COMPGROUPS.NET | Post | Groups | Users | Stream | Browse | About | |

### Java Collections List : Converting from List '<Column <String1, String2>>' to 'List <String1>'

• Email
• Follow


I have a function that returns a list like this:-

List <Column <String1, String2>>

Next I want to pass this list to a 2nd function, but 2nd function just need=
s a list which contains only 1st part (string1) of the Column(s) of the abo=
ve list.

So I want pass just this list to 2nd function:-

List <String1>

What would be the best way to do this ??

[my use case: Both the functions are from a library that I use to access da=
tabase(Cassandra) for a web application. 1st function gives me a list of al=
l columns which has two parts name(String1) and value(String2). So 1st func=
tion gives me a list of all columns(each of which has two strings) then I j=
ust need to use the list of column names to supply it to 2nd function that'=
ll query the DB for those columns.]

 0

See related articles to this posting

On 2/19/11 8:04 PM, asil klin wrote:
>
>
> I have a function that returns a list like this:-
>
> List<Column<String1, String2>>
>
> Next I want to pass this list to a 2nd function, but 2nd function just needs a list which contains only 1st part (string1) of the Column(s) of the above list.
>
> So I want pass just this list to 2nd function:-
>
> List<String1>
>
> What would be the best way to do this ??

If the second method is already written and there is the literal
requirement that you pass a List<String> to it (I've never heard of the
"String1" type, so don't really know what that's supposed to mean, if
not simply a "String"), then I think you are pretty much stuck copying
the individual strings from your Column instance into the new
List<String> list.

Note that with a little effort, you can implement a .NET-like
"enumerable" solution, in which the new object need not actually copy
the entire data set, but rather simply "project" from the original.

In C#, it's very concise:

void method2(IEnumerable<string> names)
{
foreach (string name in names)
{
// do something
}
}

where you call like this:

List<Column> columns = …; // initialized somehow

method2(columns.Select(column => column.String1));

But you can accomplish much the same sort of thing, albeit with not
quite as concise a call site (but at least the entire collection doesn't
have to be duplicated). For example:

public interface Select<T, S>
{
S select(T t);
}

public class Iterables
{
public static <T, S> Iterable<S> Select(Iterable<T> source, Select<T,
S> select)
{
return new SelectIterable<T, S>(source, select);
}

private static class SelectIterable<T, S> implements Iterable<S>
{
private final Iterable<T> source;
private final Select<T, S> select;

public SelectIterable(Iterable<T> source, Select<T, S> select)
{
this.source = source;
this.select = select;
}

@Override
public java.util.Iterator<S> iterator()
{
return new Iterator(source.iterator());
}

private class Iterator implements java.util.Iterator<S>
{
private final java.util.Iterator<T> source;

public Iterator(java.util.Iterator<T> source)
{
this.source = source;
}

@Override
public boolean hasNext()
{
return source.hasNext();
}

@Override
public S next()
{
return SelectIterable.this.select.select(source.next());
}

@Override
public void remove()
{
throw new UnsupportedOperationException();
}
}
}
}

public class Column
{
private final String string1;
private final String string2;

public Column(String string1, String string2)
{
this.string1 = string1;
this.string2 = string2;
}

public String getString1() { return string1; }
public String getString2() { return string2; }
}

import java.util.ArrayList;
import java.util.List;

public class Main
{

/**
* @param args
*/
public static void main(String[] args)
{
List<Column> columns = new ArrayList<Column>();

method2(Iterables.Select(columns, new Select<Column, String>()
{
public String select(Column column)
{
return column.getString1();
}
}));
}

private static void method2(Iterable<String> names)
{
for (String name : names)
{
System.out.println(name);
}
}

}

 0

On 02/19/2011 07:04 AM, asil klin wrote:
>
>
> I have a function that returns a list like this:-

DO NOT MULTI-POST!

--
Lew
Honi soit qui mal y pense.

 0

On 19/02/2011 14:19, Peter Duniho allegedly wrote:

> But you can accomplish much the same sort of thing, albeit with not
> quite as concise a call site (but at least the entire collection doesn't
> have to be duplicated). For example:
>
>
> public interface Select<T, S>
> {
> S select(T t);
> }
>
>
> public class Iterables
> {
> public static <T, S> Iterable<S> Select(Iterable<T> source, Select<T, S>
> select)
> {
> return new SelectIterable<T, S>(source, select);
> }
>
> private static class SelectIterable<T, S> implements Iterable<S>
> {
> private final Iterable<T> source;
> private final Select<T, S> select;
>
> public SelectIterable(Iterable<T> source, Select<T, S> select)
> {
> this.source = source;
> this.select = select;
> }
>
> @Override
> public java.util.Iterator<S> iterator()
> {
> return new Iterator(source.iterator());
> }
>
> private class Iterator implements java.util.Iterator<S>
> {
> private final java.util.Iterator<T> source;
>
> public Iterator(java.util.Iterator<T> source)
> {
> this.source = source;
> }
>
> @Override
> public boolean hasNext()
> {
> return source.hasNext();
> }
>
> @Override
> public S next()
> {
> return SelectIterable.this.select.select(source.next());
> }
>
> @Override
> public void remove()
> {
> throw new UnsupportedOperationException();
> }
> }
> }
> }
>
>
> public class Column
> {
> private final String string1;
> private final String string2;
>
> public Column(String string1, String string2)
> {
> this.string1 = string1;
> this.string2 = string2;
> }
>
> public String getString1() { return string1; }
> public String getString2() { return string2; }
> }
>
>
> import java.util.ArrayList;
> import java.util.List;
>
> public class Main
> {
>
> /**
> * @param args
> */
> public static void main(String[] args)
> {
> List<Column> columns = new ArrayList<Column>();
>
>
> method2(Iterables.Select(columns, new Select<Column, String>()
> {
> public String select(Column column)
> {
> return column.getString1();
> }
> }));
> }
>
> private static void method2(Iterable<String> names)
> {
> for (String name : names)
> {
> System.out.println(name);
> }
> }
>
> }

This is what I'd suggest, too. Although I'd call it 'map' rather than
'select'. And I would recommend going the whole way and making it a
(read-only) collection (by extending AbstractCollection) or a
(read-only) List (by extending AbstractList), rather than using only
Iterable. Iterable is OK, but lacks useful features (notably, size())
for the more than basic uses. And since you're writing some code
already, might as well put in a little extra effort and get the whole bang.

I've written a little framework exactly like this some time ago. It is
insanely useful -- which shouldn't come as a surprise for anyone who's
ever heard of functional programming.

Note that the main advantage is that this approach is that it reflects
modifications of the underlying object transparently, and thus blends in
very nicely with an object-oriented structure.

--
DF.

 0

On 2/20/11 12:50 AM, Daniele Futtorovic wrote:
> This is what I'd suggest, too. Although I'd call it 'map' rather than
> 'select'.

The word "select" simply came from my exposure to .NET. Actually, I find
the word "project" (as a verb) to be more appropriate, though I agree
"map" is fine too.

I don't think the precise name is going to matter too much.  :)

> And I would recommend going the whole way and making it a
> (read-only) collection (by extending AbstractCollection) or a
> (read-only) List (by extending AbstractList), rather than using only
> Iterable.

It will depend on how one intends to use it.  Again, because I am
following the .NET model, Iterable is the first choice only due to that.

However, it's worth pointing out that Iterable allows for sequences
larger than 2GB items, while extending AbstractList or
AbstractCollection, because those classes use an int to describe their
length (and in the case of AbstractList, to enumerate as well).

Also, using Iterable means that the code is usable for a broader range
of inputs.  I.e. is more re-usable.  Extending AbstractList or
AbstractCollection will limit the uses to wrapping lists or collections.

> Iterable is OK, but lacks useful features (notably, size())
> for the more than basic uses.

..NET addresses that lack by including the extension method Count() (in
my code, that would show up as a static method in the Iterables class),
which checks for common interfaces that support a direct retrieval of
the collection length, and if those are not available, then enumerates
the entire collection as a fall-back.

One could easily do the same here, providing the greater re-usability
without sacrificing countability or efficiency.

> And since you're writing some code
> already, might as well put in a little extra effort and get the whole bang.

One might say that since you're writing some code already, you might as
well put in a little extra effort and make the code as broadly re-usable
as possible.  :)

> I've written a little framework exactly like this some time ago. It is
> insanely useful -- which shouldn't come as a surprise for anyone who's
> ever heard of functional programming.

Right.  The .NET features come from LINQ, which has a strong functional
bent to it.  Of course, the other functional-like features in C# work
closely with LINQ and the Enumerable extension methods in a way that is
not possible with the current version of Java.  But one can get a large
portion of the same benefit, with some worthwhile effort.

> Note that the main advantage is that this approach is that it reflects
> modifications of the underlying object transparently, and thus blends in
> very nicely with an object-oriented structure.

I'm not sure I'd call that the _main_ advantage.  In fact, it can be a
bit of a pitfall in .NET, as chained enumerators are all re-run each
time you enumerate the last link of the chain.

Not only is it a potential performance issue, variable capturing can
result in some non-intuitive (and often unintended) results, because
even the parameters of the enumerations may be changed after the fact,
having effect on subsequent enumerations of the new enumerable object.

But it definitely can be a very handy aspect of the approach, if one is
careful to mind the implications of the implementation.

Pete

 0

On 2/20/11 1:23 AM, Peter Duniho wrote:
> [...]
> However, it's worth pointing out that Iterable allows for sequences
> larger than 2GB items, while extending AbstractList or
> AbstractCollection, because those classes use an int to describe their
> length (and in the case of AbstractList, to enumerate as well).  [...]

Sorry…I really did mean to finish that thought.  Hopefully where I was
going with it was obvious, but the conclusion is that extending the
Abstract… types will necessarily limit sequences to 2GB items or fewer.

Some of the time that might matter, a lot of the time it probably won't.
But it's a consideration.

Also, it should go without saying that the code I posted is simply to
illustrate the technique.  It's usable as-is, but if one is going to
develop this kind of abstraction, they will likely wind up with a

Pete

 0

On 19/02/2011 18:23, Peter Duniho allegedly wrote:
> On 2/20/11 12:50 AM, Daniele Futtorovic wrote:
>> This is what I'd suggest, too. Although I'd call it 'map' rather
>> than 'select'.
>
> The word "select" simply came from my exposure to .NET. Actually, I
> find the word "project" (as a verb) to be more appropriate, though I
> agree "map" is fine too.
>
> I don't think the precise name is going to matter too much. :)

Sure.

>> And I would recommend going the whole way and making it a
>> (read-only) collection (by extending AbstractCollection) or a
>> (read-only) List (by extending AbstractList), rather than using
>> only Iterable.
>
> It will depend on how one intends to use it. Again, because I am
> following the .NET model, Iterable is the first choice only due to
> that.
>
> However, it's worth pointing out that Iterable allows for sequences
> larger than 2GB items, while extending AbstractList or
> AbstractCollection, because those classes use an int to describe
> their length (and in the case of AbstractList, to enumerate as
> well).

Good point; I hadn't thought of that. Still, as the underlying structure
is already one that is constrained by the 2^31 -1 limit (being, in the
OP's case, a java.util.List), and considering how the overwhelming
majority of use-cases would fall hither of that limit, I think it would
be safe to code for these uses. Might of course make the Iterable
available, too.

> Also, using Iterable means that the code is usable for a broader
> range of inputs. I.e. is more re-usable. Extending AbstractList or
> AbstractCollection will limit the uses to wrapping lists or
> collections.

Now I'm not sure you got what I meant. I meant that the content-mapping
code you showed for Iterable structures could be extended so that the
"view" objects would be Collections, when mapping the contents of any
class implementing Collection, or Lists, when mapping the contents of
any class implementing List; and that it's very easy to do by making the
"view" Object extend Abstract(Collection|List), because you only have a
very few methods to implement (provided you make them read-only -- if
they're writable it becomes slightly more tricky).

I agree that Iterable is an interface that serves broader purposes and
can be implemented by a wider range of objects than Collection et al.,
but nevertheless a great share of the code (my code, at least) consists
of working with Collections. It's fine if it's broad, but not if it

>> Iterable is OK, but lacks useful features (notably, size()) for the
>> more than basic uses.
>
> ..NET addresses that lack by including the extension method Count()
> (in my code, that would show up as a static method in the Iterables
> class), which checks for common interfaces that support a direct
> retrieval of the collection length, and if those are not available,
> then enumerates the entire collection as a fall-back.

Is that the equivalent of this "defender methods" stuff I've been

>> Note that the main advantage is that this approach is that it
>> reflects modifications of the underlying object transparently, and
>> thus blends in very nicely with an object-oriented structure.
>
> I'm not sure I'd call that the _main_ advantage. In fact, it can be a
>  bit of a pitfall in .NET, as chained enumerators are all re-run each
>  time you enumerate the last link of the chain.
>
> Not only is it a potential performance issue, variable capturing can
>  result in some non-intuitive (and often unintended) results, because
>  even the parameters of the enumerations may be changed after the
> fact, having effect on subsequent enumerations of the new enumerable
> object.
>
> But it definitely can be a very handy aspect of the approach, if one
> is careful to mind the implications of the implementation.

Sorry but you totally lost me there.

I wouldn't claim for a second that these things are going to be very
efficient. To me, the main use is as a specific "view" of a given
structure, short-term objects which I'm going briefly to manipulate and
then discard. In those cases, there is next to no performance impact,
because what the view is doing, I would have to do if I didn't have it
-- it just hides it and provides a handy syntax, making the application
logic clearer.

--
DF.

 0

On 2/20/11 8:05 AM, Daniele Futtorovic wrote:
> Good point; I hadn't thought of that. Still, as the underlying structure
> is already one that is constrained by the 2^31 -1 limit (being, in the
> OP's case, a java.util.List) [...]

If the "underlying structure" is simply an Iterable, there is no such
limit.  If you got the Iterable from a List, then yes…it's got that
limit.  But not all Iterables come from Lists.

>> Also, using Iterable means that the code is usable for a broader
>> range of inputs. I.e. is more re-usable. Extending AbstractList or
>> AbstractCollection will limit the uses to wrapping lists or
>> collections.
>
> Now I'm not sure you got what I meant. I meant that the content-mapping
> code you showed for Iterable structures could be extended so that the
> "view" objects would be Collections, when mapping the contents of any
> class implementing Collection, or Lists, when mapping the contents of
> any class implementing List; and that it's very easy to do by making the
> "view" Object extend Abstract(Collection|List), because you only have a
> very few methods to implement (provided you make them read-only -- if
> they're writable it becomes slightly more tricky).

I don't know if I understand what you mean either.  I wouldn't want to
have to write the code three different times, implementing Iterable,
List, _and_ Collection.  But that sounds like what you're proposing.

In a full-blown implementation, you can provide List- and
Collection-like features in the Iterables class in the same way I
pointed out a size() method can be implemented: check for List or
Collection and use that implementation if present, otherwise iterate
through the Iterable to achieve it "the hard way".

> I agree that Iterable is an interface that serves broader purposes and
> can be implemented by a wider range of objects than Collection et al.,
> but nevertheless a great share of the code (my code, at least) consists
> of working with Collections. It's fine if it's broad, but not if it
> being broad lessens its usefulness.

There's no reason it should.

>>> Iterable is OK, but lacks useful features (notably, size()) for the
>>> more than basic uses.
>>
>> ..NET addresses that lack by including the extension method Count()
>> (in my code, that would show up as a static method in the Iterables
>> class), which checks for common interfaces that support a direct
>> retrieval of the collection length, and if those are not available,
>> then enumerates the entire collection as a fall-back.
>
> Is that the equivalent of this "defender methods" stuff I've been

I have no idea.  What "defender methods" have you been hearing about?
I've never even heard the term.

>>> Note that the main advantage is that this approach is that it
>>> reflects modifications of the underlying object transparently, and
>>> thus blends in very nicely with an object-oriented structure.
>>
>> I'm not sure I'd call that the _main_ advantage. In fact, it can be a
>> bit of a pitfall in .NET, as chained enumerators are all re-run each
>> time you enumerate the last link of the chain.
>>
>> Not only is it a potential performance issue, variable capturing can
>> result in some non-intuitive (and often unintended) results, because
>> even the parameters of the enumerations may be changed after the
>> fact, having effect on subsequent enumerations of the new enumerable
>> object.
>>
>> But it definitely can be a very handy aspect of the approach, if one
>> is careful to mind the implications of the implementation.
>
> Sorry but you totally lost me there.
>
> I wouldn't claim for a second that these things are going to be very
> efficient. [...]

My point is not that the performance issue is a problem per se.  Simply
that it exists, and that for the same reason it exists there can
potentially be other non-intuitive behaviors.  I.e. it's not always
_beneficial_ that modifications to the original data structure are also
reflection in the new Iterable object.

I'm simply saying that while in some cases having modifications to the
original data structure be visible in the new Iterable object as well,
this isn't always a desirable behavior, never mind the most important
aspect.

But honestly, what the "main advantage" is, isn't all that important a
question.  Different people in different situations will find different
uses for something like this.  I only commented by way of offering an
alternate perspective, not for the purpose of trying to dissuade you
from yours.  :)

Pete

 0

On 19-02-2011 20:00, Peter Duniho wrote:
> On 2/20/11 8:05 AM, Daniele Futtorovic wrote:
>> Is that the equivalent of this "defender methods" stuff I've been
>
> I have no idea. What "defender methods" have you been hearing about?
> I've never even heard the term.

http://cr.openjdk.java.net/~darcy/DefenderMethods.pdf

Arne

 0

On 2/20/11 9:05 AM, Arne Vajhøj wrote:
> On 19-02-2011 20:00, Peter Duniho wrote:
>> On 2/20/11 8:05 AM, Daniele Futtorovic wrote:
>>> Is that the equivalent of this "defender methods" stuff I've been
>>
>> I have no idea. What "defender methods" have you been hearing about?
>> I've never even heard the term.
>
> http://cr.openjdk.java.net/~darcy/DefenderMethods.pdf

Huh?  Don't you mean http://www.lmgtfy.com/?q=java+defender+methods

:)

to what I meant, but it involves run-time support, whereas I simply
meant that the "extension method" itself could do the necessary run-time
check to accomplish the same thing.

I see the appeal for the "defender method" approach, but it's not quite
what I was talking about.  My discussion isn't assuming any new Java
features, simply providing static methods to execute with existing Java
interfaces (and Iterable in particular).  Those static methods could
explicitly check for, casting to and calling if available, the
(presumably) more efficient implementations for such methods, but would
always have a fallback implementation guaranteed to work with the
original Iterable interface.

As far as "defender methods" go, IMHO if one is going to make such a
change to Java, there are two important aspects that need to be
included:  one needs to be able to specify more than one default
interface method to serve as the default implementation, and one needs
to be able to specify a static method to fall back on should there be
none of the interface implementations available.

That said, I'm a bit skeptical of that approach anyway, because it seems
to encourage the modification of existing interfaces.  Applied here, it
to the Iterable interface which, to me, would detract from the
simplicity and directness of that interface.

The motivation seems to be that "it's difficult to change an interface
once published".  But for me, that's one of the benefits of interfaces.
Yes, version control on an interface is hard.  It's _supposed_ to be!  :)

Even as I might find myself at times desirable to call those methods on
an Iterable object, I feel like I should do so only judiciously and
while understanding that doing so could be a costly operation.  Adding
them to the interface itself would, I think, encourage inappropriate
generalization of code related to the Iterable interface.

It seems to me that if the code really needs such regular use of size()
and/or get() that it's inconvenient to call a static method, one ought
to consider simply using List or Collection as the input interface in
the first place.

(And I write that even as I'm a big fan of C#'s extension methods, which
do provide a _syntactic_ — not run-time — shortcut for calling such
static methods).

Pete

 0

On 11-02-19 09:05 PM, Arne Vajhøj wrote:
> On 19-02-2011 20:00, Peter Duniho wrote:
>> On 2/20/11 8:05 AM, Daniele Futtorovic wrote:
>>> Is that the equivalent of this "defender methods" stuff I've been
>>
>> I have no idea. What "defender methods" have you been hearing about?
>> I've never even heard the term.
>
> http://cr.openjdk.java.net/~darcy/DefenderMethods.pdf
>
> Arne

I respect Goetz, but it's a lousy name. IMO.

AHS

--
We must recognize the chief characteristic of the modern era - a
permanent state of what I call violent peace.
-- James D. Watkins

 0

On 19-02-2011 20:40, Arved Sandstrom wrote:
> On 11-02-19 09:05 PM, Arne Vajhøj wrote:
>> On 19-02-2011 20:00, Peter Duniho wrote:
>>> On 2/20/11 8:05 AM, Daniele Futtorovic wrote:
>>>> Is that the equivalent of this "defender methods" stuff I've been
>>>
>>> I have no idea. What "defender methods" have you been hearing about?
>>> I've never even heard the term.
>>
>> http://cr.openjdk.java.net/~darcy/DefenderMethods.pdf
>
> I respect Goetz, but it's a lousy name. IMO.

He explains the name in the text.

I don't have a problem with it.

But I think that the headline should be "virtual extension methods"
because that is what it is all about. The "defender methods" is
just a part of it.

Arne


 0

On 11-02-19 09:49 PM, Arne Vajhøj wrote:
> On 19-02-2011 20:40, Arved Sandstrom wrote:
>> On 11-02-19 09:05 PM, Arne Vajhøj wrote:
>>> On 19-02-2011 20:00, Peter Duniho wrote:
>>>> On 2/20/11 8:05 AM, Daniele Futtorovic wrote:
>>>>> Is that the equivalent of this "defender methods" stuff I've been
>>>>
>>>> I have no idea. What "defender methods" have you been hearing about?
>>>> I've never even heard the term.
>>>
>>> http://cr.openjdk.java.net/~darcy/DefenderMethods.pdf
>>
>> I respect Goetz, but it's a lousy name. IMO.
>
> He explains the name in the text.
>
> I don't have a problem with it.
>
> But I think that the headline should be "virtual extension methods"
> because that is what it is all about. The "defender methods" is
> just a part of it.
>
> Arne
>
I know he explained it; I read the paper. :-) But it was an unnecessary
and cutesy name. What's wrong with virtual extension method? If Goetz'
pet name takes off then it'll be just more useless jargon to confuse
novices...and without having read the specific explanation for it, the
name isn't even meaningful.

Like I said, I respect the guy a great deal. But I'll take him up on his
implied out, when he says "you could call these “public defender”
methods...". I could, but I won't. :-)

AHS

--
We must recognize the chief characteristic of the modern era - a
permanent state of what I call violent peace.
-- James D. Watkins

 0

On Sat, 19 Feb 2011 04:04:53 -0800 (PST), asil klin
<asdkl93@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>What would be the best way to do this ??

you pretty well have to create a new list and copy the items over one
at a time.
--
http://mindprod.com
Refactor early. If you procrastinate, you will have
even more code to adjust based on the faulty design.
..


 0

In article <8f13c843-eced-41f8-b20b-901979548436
>
> I have a function that returns a list like this:-
>
> List <Column <String1, String2>>
>
> Next I want to pass this list to a 2nd function, but 2nd function just needs a list which contains only 1st part (string1) of the Column(s) of the above list.
>
> So I want pass just this list to 2nd function:-
>
> List <String1>
>
> What would be the best way to do this ??

> [my use case: Both the functions are from a library that I use to
> access database(Cassandra) for a web application. 1st function gives
> me a list of all columns which has two parts name(String1) and value
> (String2). So 1st function gives me a list of all columns(each of
> which has two strings) then I just need to use the list of column
> names to supply it to 2nd function that'll query the DB for those
> columns.]

Naive Solution:

List<String> names= new ArrayList<String>();
for(Column<String1,String2> c : columns){
names.add(c.getName()); //or any appropriate method to get access
}

Seriously: if that's yous solution I don't understand your question,
because it's an no-brainer that even a novice programmer should be able
to find out all by himself in less than 10 minutes.

Anyway, if that's your solution, there is still another way to do it
nicely, which is not that apparrent and it goes by help of the "Apache
commons" library:
http://commons.apache.org/collections/
http://commons.apache.org/collections/api-release/index.html

Here is how it looks like:

Transformer columnToName = new Transformer(){
public void transform(Object o){
return ((Column)o).getName(); //or any appropriate method
}
};
List<String> names= new ArrayList<String>();
CollectionUtils.collect(columns, columnToName, names);

This style makes it possible to share and reuse the Transformer-
Implementation instead of copying the extracting code everywhere. That
might be pretty helpful if the structure of your data changes and forces
you to find and change every bit of the program that relies on the old
one. Especially if the transformation-process is less trivial and there
are pitfalls to avoid, sharing and passing around a good reference
implementation may come handy. Another fine thing is that the name of
the transformer variable can serve as documentation of what is happening
here.

Kind regards
Wanja

--
...Alesi's problem was that the back of the car was jumping up and down
dangerously - and I can assure you from having been teammate to
Jean Alesi and knowing what kind of cars that he can pull up with,
when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer]

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

 0

On 02/20/2011 06:04 AM, Wanja Gayk wrote:
> In article<8f13c843-eced-41f8-b20b-901979548436
>>
>> I have a function that returns a list like this:-
>>
>> List<Column<String1, String2>>
>>
>> Next I want to pass this list to a 2nd function, but 2nd function just needs a list which contains only 1st part (string1) of the Column(s) of the above list.
>>
>> So I want pass just this list to 2nd function:-
>>
>> List<String1>
>>
>> What would be the best way to do this ??
>
>> [my use case: Both the functions are from a library that I use to
>> access database(Cassandra) for a web application. 1st function gives
>> me a list of all columns which has two parts name(String1) and value
>> (String2). So 1st function gives me a list of all columns(each of
>> which has two strings) then I just need to use the list of column
>> names to supply it to 2nd function that'll query the DB for those
>> columns.]
>
> Naive Solution:
>
> List<String>  names= new ArrayList<String>();

This does not fulfill the OP's condition that the list's base type be 'String1'.

A singularly poorly-named type, to be sure, but the one they asked for.

--
Lew
Honi soit qui mal y pense.

 0

On 20/02/2011 02:00, Peter Duniho allegedly wrote:
> On 2/20/11 8:05 AM, Daniele Futtorovic wrote:
>>> Also, using Iterable means that the code is usable for a broader
>>> range of inputs. I.e. is more re-usable. Extending AbstractList or
>>> AbstractCollection will limit the uses to wrapping lists or
>>> collections.
>>
>> Now I'm not sure you got what I meant. I meant that the content-mapping
>> code you showed for Iterable structures could be extended so that the
>> "view" objects would be Collections, when mapping the contents of any
>> class implementing Collection, or Lists, when mapping the contents of
>> any class implementing List; and that it's very easy to do by making the
>> "view" Object extend Abstract(Collection|List), because you only have a
>> very few methods to implement (provided you make them read-only -- if
>> they're writable it becomes slightly more tricky).
>
> I don't know if I understand what you mean either. I wouldn't want to
> have to write the code three different times, implementing Iterable,
> List, _and_ Collection. But that sounds like what you're proposing.

Yes, of course.

So, given:

interface Mapper<In, Out> {
Out map( In in );
}

You'd have (possibly statically somewhere):

<In, Out> Iterable<Out> createProjection( final Iterable<? extends
In> iterable, final Mapper<? super In, ? extends Out> mapper );

<In, Out> Collection<Out> createProjection( Collection<? extends
In> coll, Mapper<? super In, ? extends Out> mapper );

<In, Out> List<Out> createProjection( List<? extends In> list,
Mapper<? super In, ? extends Out> mapper );

And for the less faint-hearted:

<K, In, Out> Map<K, Out> createProjection( Map<K, ? extends In>
map, Mapper<? super In, ? extends Out> mapper );

And for the truly brave:

<K, In, Out> SortedMap<K, Out> createProjection( SortedMap<K, ?
extends In> map, Mapper<? super In, ? extends Out> mapper );

If that's too much code to write for you, considering it's a toolset and
the power it brings, then might as well stay in bed, if I may say so.

> In a full-blown implementation, you can provide List- and
> Collection-like features in the Iterables class in the same way I
> pointed out a size() method can be implemented: check for List or
> Collection and use that implementation if present, otherwise iterate
> through the Iterable to achieve it "the hard way".

Disagreed. The projection should be isomorphic. If you need size and
only have an Iterable to work with, then something's wrong with your
data structures in the first place.

<snip />'d the rest due to agreement.

--
DF.

 0

In article <ijra47$2an$1@news.albasani.net>, noone@lewscanon.com says...

> > Naive Solution:
> >
> > List<String>  names= new ArrayList<String>();
>
> This does not fulfill the OP's condition that the list's base type be 'String1'.

Nitpicking.
I understood rather that the OP was asking for an algorithm to extract
one of both values. Changing the types to the own requirements is even
more trivial.

Kind regards,

--
...Alesi's problem was that the back of the car was jumping up and down
dangerously - and I can assure you from having been teammate to
Jean Alesi and knowing what kind of cars that he can pull up with,
when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer]

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

 0

On 02/24/2011 06:51 PM, Wanja Gayk wrote:
> In article<ijra47$2an$1@news.albasani.net>, noone@lewscanon.com says...
>
>>> Naive Solution:
>>>
>>> List<String>   names= new ArrayList<String>();
>>
>> This does not fulfill the OP's condition that the list's base type be 'String1'.
>
> Nitpicking.
> I understood rather that the OP was asking for an algorithm to extract
> one of both values. Changing the types to the own requirements is even
> more trivial.

So you think attention to detail doesn't matter.

You are wrong.

"Nitpicking", as you attempt to disparage it, is vital to good programming.  I
guess you're not a good programmer.

Learn to nitpick.  The difference between 'String1' and 'String' is likely to
be significant in the real world.  Your casual attitude will create bugs.

--
Lew
Honi soit qui mal y pense.

 0

2011-02-25 01:05, Lew wrote:
> On 02/24/2011 06:51 PM, Wanja Gayk wrote:
>> In article<ijra47$2an$1@news.albasani.net>, noone@lewscanon.com says...
>>
>>>> Naive Solution:
>>>>
>>>> List<String>   names= new ArrayList<String>();
>>>
>>> This does not fulfill the OP's condition that the list's base type be
>>> 'String1'.
>>
>> Nitpicking.
>> I understood rather that the OP was asking for an algorithm to extract
>> one of both values. Changing the types to the own requirements is even
>> more trivial.
>
> So you think attention to detail doesn't matter.
>
> You are wrong.
>
> "Nitpicking", as you attempt to disparage it, is vital to good
> programming.  I guess you're not a good programmer.
>
> Learn to nitpick.  The difference between 'String1' and 'String' is
> likely to be significant in the real world.  Your casual attitude will
> create bugs.

Come on!
It's obvious that the OP did not intend that String1 and String2 should
be anything other than String. He used 1 and 2 to indicate which of the
String's should be placed in the derived List.


 0

In article <ik6rok$bdl$1@news.albasani.net>, noone@lewscanon.com says...

> > Nitpicking.
> > I understood rather that the OP was asking for an algorithm to extract
> > one of both values. Changing the types to the own requirements is even
> > more trivial.
>
> So you think attention to detail doesn't matter.
>
> You are wrong.
>
> "Nitpicking", as you attempt to disparage it, is vital to good programming.  I
> guess you're not a good programmer.

Following your argumentation the GOF book is written by a bunch of lousy
particular question. Instead of providing you a ActionListener-Example,
they just talk about observers- and command-patterns. How can they dare?

Guess what you want, my employer is happy, because I pay a lot of
attention to detail. But this is not work and I'm not here to do other
people's homework or prodive complete solutions. Still I will happily
help to solve a problem by pointing someone into a possibly right
direction, providing a guideline, or a pattern so to speak.

Kind ergards,

--
...Alesi's problem was that the back of the car was jumping up and down
dangerously - and I can assure you from having been teammate to
Jean Alesi and knowing what kind of cars that he can pull up with,
when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer]

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

 0

On 02/24/2011 07:25 PM, Lars Enderin wrote:
> 2011-02-25 01:05, Lew wrote:
>> On 02/24/2011 06:51 PM, Wanja Gayk wrote:
>>> In article<ijra47$2an$1@news.albasani.net>, noone@lewscanon.com says...
>>>
>>>>> Naive Solution:
>>>>>
>>>>> List<String>    names= new ArrayList<String>();
>>>>
>>>> This does not fulfill the OP's condition that the list's base type be
>>>> 'String1'.
>>>
>>> Nitpicking.
>>> I understood rather that the OP was asking for an algorithm to extract
>>> one of both values. Changing the types to the own requirements is even
>>> more trivial.
>>
>> So you think attention to detail doesn't matter.
>>
>> You are wrong.
>>
>> "Nitpicking", as you attempt to disparage it, is vital to good
>> programming.  I guess you're not a good programmer.
>>
>> Learn to nitpick.  The difference between 'String1' and 'String' is
>> likely to be significant in the real world.  Your casual attitude will
>> create bugs.
>
> Come on!
> It's obvious that the OP did not intend that String1 and String2 should

You call it "obvious".  In my work I have been corrected many, many times for
assuming what I thought was "obvious", only to find out the specification was
intended as stated.
> be anything other than String. He used 1 and 2 to indicate which of the
> String's should be placed in the derived List.

You base that on zero evidence, only your own assumptions.  I, on the other
hand, assume the OP meant precisely what he wrote.  But you go right ahead and
invent interpretations for him that are not what he said, sport.

--
Lew
Honi soit qui mal y pense.

 0

On 02/26/2011 09:51 AM, Wanja Gayk wrote:
> In article<ik98h3$fkc$2@news.albasani.net>, noone@lewscanon.com says...
>
>> You base that on zero evidence, only your own assumptions.
>> I, on the other  hand, assume the OP meant precisely what he wrote.
>
> ..on zero evidence.

Huh?  He wrote it.  That's not "zero" evidence.  It's the evidence of the
actual post.  Go back and read it.  You will see:
> So I want pass just this list to 2nd function:-
>
> List <String1>

There's your evidence, right there.  Right in black and white.  Concretely.
Posted and archived.  Look.  Right there.  It says, "String1".  See?

Think I'm misquoting him?  You can check for yourself.

--
Lew
Honi soit qui mal y pense.

 0
Reply noone7 (4050) 3/3/2011 1:04:26 PM

Lew <noone@lewscanon.com> wrote:
> On 02/26/2011 09:51 AM, Wanja Gayk wrote:
>> In article<ik98h3$fkc$2@news.albasani.net>, noone@lewscanon.com says...
>>> You base that on zero evidence, only your own assumptions.
>>> I, on the other  hand, assume the OP meant precisely what he wrote.
>> ..on zero evidence.
> Huh?  He wrote it.  That's not "zero" evidence.

That ${someone} wrote${something} is not "evidence" for
that ${someone} actually meant${something}.

It's generally a strong indication, so your assumption wasn't
generally weak, but still it's no evidence.

Otoh, the stranger ${something} is (e.g. using String1 without further explanation of it), the weaker is even the indication.   0 Reply avl1 (2748) 3/3/2011 1:29:26 PM On Mar 3, 8:29=A0am, Andreas Leitgeb <a...@gamma.logic.tuwien.ac.at> wrote: > Lew <no...@lewscanon.com> wrote: > > On 02/26/2011 09:51 AM, Wanja Gayk wrote: > >> In article<ik98h3$fk...@news.albasani.net>, no...@lewscanon.com says..=
..
> >>> You base that on zero evidence, only your own assumptions.
> >>> I, on the other =A0hand, assume the OP meant precisely what he wrote.
> >> ..on zero evidence.
> > Huh? =A0He wrote it. =A0That's not "zero" evidence.
>
> That ${someone} wrote${something} is not "evidence" for
> that ${someone} actually meant${something}.
>

Of course it is.

What other evidence do you have forwhat they mean?

> It's generally a strong indication, so your assumption wasn't
> generally weak, but still it's no evidence.
>

"Indication" is a synonym for "evidence", so you just disproved your
own thesis.

> Otoh, the stranger ${something} is (e.g. using String1 without > =A0further explanation of it), the weaker is even the indication. It's the only evidence you have. How can you say that what someone says is not evidence of what they mean? That's crazy talk! If you're not going to be intellectually honest, I'm not going to play. -- Lew   0 Reply lew (2468) 3/3/2011 5:00:33 PM 2011-03-03 18:00, Lew skrev: > On Mar 3, 8:29 am, Andreas Leitgeb <a...@gamma.logic.tuwien.ac.at> > wrote: >> Lew <no...@lewscanon.com> wrote: >>> On 02/26/2011 09:51 AM, Wanja Gayk wrote: >>>> In article<ik98h3$fk...@news.albasani.net>, no...@lewscanon.com says....
>>>>> You base that on zero evidence, only your own assumptions.
>>>>> I, on the other  hand, assume the OP meant precisely what he wrote.
>>>> ..on zero evidence.
>>> Huh?  He wrote it.  That's not "zero" evidence.
>>
>> That ${someone} wrote${something} is not "evidence" for
>> that ${someone} actually meant${something}.
>>
>
> Of course it is.
>
> What other evidence do you have forwhat they mean?
>
>> It's generally a strong indication, so your assumption wasn't
>> generally weak, but still it's no evidence.
>>
>
> "Indication" is a synonym for "evidence", so you just disproved your
> own thesis.
>
>> Otoh, the stranger ${something} is (e.g. using String1 without >> further explanation of it), the weaker is even the indication. > > It's the only evidence you have. > > How can you say that what someone says is not evidence of what they > mean? That's crazy talk! > > If you're not going to be intellectually honest, I'm not going to > play. You are being ridiculous. The OP has not returned to the thread (scared off by you?) we have no way to tell exactly what he meant with: "I have a function that returns a list like this:- List <Column <String1, String2>> Next I want to pass this list to a 2nd function, but 2nd function just needs a list which contains only 1st part (string1) of the Column(s) of the above list. So I want pass just this list to 2nd function:- List <String1> What would be the best way to do this ?? [my use case: Both the functions are from a library that I use to access database(Cassandra) for a web application. 1st function gives me a list of all columns which has two parts name(String1) and value(String2). So 1st function gives me a list of all columns(each of which has two strings) then I just need to use the list of column names to supply it to 2nd function that'll query the DB for those columns.]" There is no evidence that his problem definition was meant to be rigorous. The most likely interpretation is that String1 and String2 stand for the first and second String. Note the reference to "string1". His problem formulation may be deficient, but you are being anal. It's much less likely that he actually refers to two new types, String1 and String2.   0 Reply lars.enderin1 (162) 3/3/2011 5:54:17 PM Lars Enderin wrote: > It's much less likely that he actually refers to two new types, String1 > and String2. > That's a different statement from, "There's no evidence that he actually refers to two new types." You can make (in this case unfounded) assertions about likelikhood and I won't question that. But to claim there's "no evidence" when we have the actual verbiage from the OP is stupid. Of course there's evidence. Maybe not conclusive, but it's evidence. You are the one being ridiculous making statements countervailing claims I have not made. I said I chose to believe what the OP said, instead of inventing a different meaning, and you all dumped a load of manure on me claiming there's "no evidence" that the OP meant what he said. Well, the statement is evidence in and of itself. You call that "ridiculous". But it's true nonetheless. What is ridiculous is to insist that the OP meant something *different* from what he said with no evidence. The burden of proof is on the assertion that the meaning is different. It's exactly the kind of stupid assumption you all are making, "They *must* have meant something different from the spec", that gets programmers in trouble. I've been called to account by customers for this kind of mistake. It's not theoretical. -- Lew   0 Reply lew (2468) 3/3/2011 7:13:33 PM Lew <lew@lewscanon.com> wrote: > On Mar 3, 8:29 am, Andreas Leitgeb <a...@gamma.logic.tuwien.ac.at> > wrote: >> Lew <no...@lewscanon.com> wrote: >> > On 02/26/2011 09:51 AM, Wanja Gayk wrote: >> >> In article<ik98h3$fk...@news.albasani.net>, no...@lewscanon.com says...
>> >>> You base that on zero evidence, only your own assumptions.
>> >>> I, on the other  hand, assume the OP meant precisely what he wrote.
>> >> ..on zero evidence.
>> > Huh?  He wrote it.  That's not "zero" evidence.
>> That ${someone} wrote${something} is not "evidence" for
>> that ${someone} actually meant${something}.
> Of course it is.
> What other evidence do you have forwhat[sic] they mean?

Your definition of "evidence" seem to be incompatible.

Wikipedia says:
"Evidence in its broadest sense includes everything that is
used to determine or demonstrate the truth of an assertion.
[...]
Evidence is the currency by which one fulfills the burden
of proof."

That doesn't sound like synonym to indication, to me.

Oh, and by your own logic&terms, we have now strong "evidence",
that you *meant* to create the new word "forwhat"...


 0
Reply avl1 (2748) 3/3/2011 10:31:43 PM

On 03/03/11 13:29, Andreas Leitgeb wrote:
> Lew <noone@lewscanon.com> wrote:
>> On 02/26/2011 09:51 AM, Wanja Gayk wrote:
>>> In article<ik98h3$fkc$2@news.albasani.net>, noone@lewscanon.com says...
>>>> You base that on zero evidence, only your own assumptions.
>>>> I, on the other  hand, assume the OP meant precisely what he wrote.
>>> ..on zero evidence.
>> Huh?  He wrote it.  That's not "zero" evidence.
>
> That ${someone} wrote${something} is not "evidence" for
> that ${someone} actually meant${something}.

It's better evidence that they meant it than that they didn't mean it.
Which is the essence of this [pointless] argument.

>
> It's generally a strong indication, so your assumption wasn't
> generally weak, but still it's no evidence.

It's evidence, it is reasonably convincing evidence. It is not, however,
conclusive evidence. But in the absence of any conclusive evidence one
can only work with the evidence which is available, and that would lead
to the conclusion that the OP actually meant what they wrote.

>
> Otoh, the stranger ${something} is (e.g. using String1 without > further explanation of it), the weaker is even the indication. > Maybe so, but it's still a better assumption that they meant what they wrote than that they didn't. In the absence of any evidence to the contrary on what basis do you assume that they /did not/ mean it?   0 Reply nmw-news (85) 3/4/2011 9:12:04 AM On 04/03/11 11:18, Andreas Leitgeb wrote: > Nigel Wade <nmw-news@ion.le.ac.uk> wrote: >> On 03/03/11 13:29, Andreas Leitgeb wrote: >>> Lew <noone@lewscanon.com> wrote: >>>> On 02/26/2011 09:51 AM, Wanja Gayk wrote: >>>>> In article<ik98h3$fkc$2@news.albasani.net>, noone@lewscanon.com says... >>>>>> You base that on zero evidence, only your own assumptions. >>>>>> I, on the other hand, assume the OP meant precisely what he wrote. >>>>> ..on zero evidence. >>>> Huh? He wrote it. That's not "zero" evidence. >>> That${someone} wrote ${something} is not "evidence" for >>> that${someone} actually meant ${something}. >> It's better evidence that they meant it than that they didn't mean it. > > Seems like you share Lew's relaxed definition of "evidence". I think I share his actual definition of evidence, rather than the one you've invented. > >> Which is the essence of this [pointless] argument. > > Pointless, not so much, but not very fruitful, either. :-( > >> But in the absence of any conclusive evidence one can only >> work with the evidence which is available, and that would lead >> to the conclusion that the OP actually meant what they wrote. > > If using your relaxed definition of "evidence", my definition is accurate. You seem to be very confused between evidence and inference. this is correct, > but doesn't apply. There *is* "evidence"(again, the relaxed one) > that the numbers appended to String were meant to "tag" them for > later reference. no, not evidence, inference. You have no evidence whatsoever that the OP did not mean what they stated, only your own inference. So, the blatant fact that the OP actually stated something is somehow not evidence (unless you "relax" the term in your words), but your inference that the OP somehow didn't mean what they said is actual evidence? And you accuse me and Lew of distorting facts? Lew is either blind to these other sources of > "evidence" or consciously ignores them. You, too? No, we are blind to your ignoring actual evidence and instead substituting your inferences in lieu, and then claiming it as evidence. > > Thus, the precondition of "absence" of other "evidence" isn't an > absolute given. > > Just as much, as there exists an indication (inferred from his posting > history, as well as the small Hamming-distance to the more sense making > "for what") that Lew didn't mean to make up the word "forwhat". Lew > might, of course, anytime clarify if indeed he meant to make up a new > word "forwhat". > and the inference from your post, where you stipulate that just because someone wrote something is not evidence that they meant it, is that we should accept nothing you write in your posts because it's probably not what you actually meant. On that basis I'll take that lack of evidence that you actually mean what you've written, and instead infer that you are actually in full agreement with both Lew and myself. -- Nigel Wade   0 Reply nmw-news (85) 3/4/2011 12:10:04 PM Nigel Wade <nmw-news@ion.le.ac.uk> wrote: >> Seems like you share Lew's relaxed definition of "evidence". > I think I share his actual definition of evidence, rather than the one > you've invented. I'm not that creative. I ripped mine from Wikipedia, instead. And I found it surprisingly consistent with what I remember having learnt in those English lessons at school, long ago, btw. Your recent postings indicate that you've written me off as a troll, and just play your "confuse-a-troll" program on me.   0 Reply avl1 (2748) 3/4/2011 2:21:29 PM Andreas Leitgeb wrote: > Lew <lew@lewscanon.com> wrote: >> On Mar 3, 8:29 am, Andreas Leitgeb <a...@gamma.logic.tuwien.ac.at> >> wrote: >>> Lew <no...@lewscanon.com> wrote: >>>> On 02/26/2011 09:51 AM, Wanja Gayk wrote: >>>>> In article<ik98h3$fk...@news.albasani.net>, no...@lewscanon.com says...
>>>>>> You base that on zero evidence, only your own assumptions.
>>>>>> I, on the other  hand, assume the OP meant precisely what he wrote.
>>>>> ..on zero evidence.
>>>> Huh?  He wrote it.  That's not "zero" evidence.
>>> That ${someone} wrote${something} is not "evidence" for
>>> that ${someone} actually meant${something}.

Certainly it is, unless you're a solipsist. It's not proof (for any
number of reasons, mostly epistemological, phenomenological, and
psychological), but it is evidence.

> Your definition of "evidence" seem to be incompatible.

Your use of "incompatible" has the wrong arity. It's a comparative
attribute.

> Wikipedia says:
>  "Evidence in its broadest sense includes everything that is
>   used to determine or demonstrate the truth of an assertion.
>   [...]
>   Evidence is the currency by which one fulfills the burden
>   of proof."

Wikipedia is neither the arbiter of the English language nor an
authority on epistemological foundation. I don't know whether you did
a poor job of quoting whatever article that comes from, or whether the
article in question is poorly written; but that's not a useful
definition of "evidence" in relation to the interpretation of a
written statement.

Under any useful theory of the interpretation of writing - from the
most bluntly realist, intentionalist claims that an utterance means
what its author believes it means, to the most deferred, displaced,
non-transmissive ends of poststructuralism and neopragmatism - must
hold that the utterance is in some way *evidence* of an
interpretation, and the outcome of interpretation is meaning.

Even under Derrida's model of writing as the trace of an
eternally-deferred meaning; even under Lacan's locating the origin of
writing in the unconscious (and so original meaning is largely
inaccessible to the author); even under Foucault's rejection of the
author-function; even under Rorty's rejection of the model of language
as a channel for the transmission of an idea. Under all of these,
parole is still evidence of meaning.

Whether that meaning is the facade of a meaning that inheres in the
author's conscious thought is another question - that one's been
fought over endlessly since at least the beginning of the twentieth
the leisure time to worry about inconsequentials). But if you accept
the axioms that 1) someone created the utterance and 2) that person
did so under the influence of meaning, then the utterance must be
*evidence* of that meaning. (It could be misleading, misinterpreted,
damaged, etc. But it's still evidence of that meaning.)

> Oh, and by your own logic&terms, we have now strong "evidence",
> that you *meant* to create the new word "forwhat"...

Evidence. Not "strong" evidence. Why? Because we can assign
probabilities to features of the surface form of the utterance. In
fact we have to; that's how we're able to process natural language at
all, with its ambiguities and errors.

--
Michael Wojcik
Micro Focus
Rhetoric & Writing, Michigan State University

 0
Reply mwojcik (1879) 3/4/2011 9:10:02 PM

On Mar 4, 4:10=A0pm, Michael Wojcik <mwoj...@newsguy.com> wrote:
> Andreas Leitgeb wrote:
> > Lew <l...@lewscanon.com> wrote:
> >> On Mar 3, 8:29 am, Andreas Leitgeb <a...@gamma.logic.tuwien.ac.at>
> >> wrote:
> >>> Lew <no...@lewscanon.com> wrote:
> >>>> On 02/26/2011 09:51 AM, Wanja Gayk wrote:
> >>>>> In article<ik98h3$fk...@news.albasani.net>, no...@lewscanon.com say= s... > >>>>>> You base that on zero evidence, only your own assumptions. > >>>>>> I, on the other =A0hand, assume the OP meant precisely what he wro= te. > >>>>> ..on zero evidence. > >>>> Huh? =A0He wrote it. =A0That's not "zero" evidence. > >>> That${someone} wrote ${something} is not "evidence" for > >>> that${someone} actually meant ${something}. > > Certainly it is, unless you're a solipsist. It's not proof (for any > number of reasons, mostly epistemological, phenomenological, and > psychological), but it is evidence. > > > Your definition of "evidence" seem to be incompatible. > > Your use of "incompatible" has the wrong arity. It's a comparative > attribute. > > > Wikipedia says: > > =A0"Evidence in its broadest sense includes everything that is > > =A0 used to determine or demonstrate the truth of an assertion. > > =A0 [...] > > =A0 Evidence is the currency by which one fulfills the burden > > =A0 of proof." > > Wikipedia is neither the arbiter of the English language nor an > authority on epistemological foundation. I don't know whether you did > a poor job of quoting whatever article that comes from, or whether the > article in question is poorly written; but that's not a useful > definition of "evidence" in relation to the interpretation of a > written statement. > > Under any useful theory of the interpretation of writing - from the > most bluntly realist, intentionalist claims that an utterance means > what its author believes it means, to the most deferred, displaced, > non-transmissive ends of poststructuralism and neopragmatism - must > hold that the utterance is in some way *evidence* of an > interpretation, and the outcome of interpretation is meaning. > > Even under Derrida's model of writing as the trace of an > eternally-deferred meaning; even under Lacan's locating the origin of > writing in the unconscious (and so original meaning is largely > inaccessible to the author); even under Foucault's rejection of the > author-function; even under Rorty's rejection of the model of language > as a channel for the transmission of an idea. Under all of these, > parole is still evidence of meaning. > > Whether that meaning is the facade of a meaning that inheres in the > author's conscious thought is another question - that one's been > fought over endlessly since at least the beginning of the twentieth > century (and sporadically before that, probably since people first had > the leisure time to worry about inconsequentials). But if you accept > the axioms that 1) someone created the utterance and 2) that person > did so under the influence of meaning, then the utterance must be > *evidence* of that meaning. (It could be misleading, misinterpreted, > damaged, etc. But it's still evidence of that meaning.) > > > Oh, and by your own logic&terms, we have now strong "evidence", > > that you *meant* to create the new word "forwhat"... > > Evidence. Not "strong" evidence. Why? Because we can assign > probabilities to features of the surface form of the utterance. In > fact we have to; that's how we're able to process natural language at > all, with its ambiguities and errors. > Brilliant. Fucking brilliant. You are a master, M. Wojcik. I learned a great deal from this post. -- Lew   0 Reply lew (2468) 3/4/2011 10:26:51 PM Michael Wojcik <mwojcik@newsguy.com> wrote: > Andreas Leitgeb wrote: >>>> That${someone} wrote ${something} is not "evidence" for >>>> that${someone} actually meant ${something}. I clarified that I considered evidence to be a synonym of proof. As it isn't (so far three posters seem to agree on that it isn't. I've yet to meet a native English speaker that I really trust to confirm it, but I'll pretend to be convinced for now for the sake of this discussion), there's no sense in judging my statement as if I had denied any indication-ship at all. > [...] Under all of these, parole is still evidence of meaning. It is! I'm not changing my mind here, just correcting my vocabulary. What's still open, and where I'm sure that I disagree at least with Lew, is, how to weigh that particular evidence against the already mentioned counter-indications drawn from context. >> Oh, and by your[Lew's] own logic&terms, we have now strong >> "evidence", that you *meant* to create the new word "forwhat"... > Evidence. Not "strong" evidence. Lew appeared very confident about the OP meaning to write about String-compatible user defined types String1 and String2, so with this mindset, usage of "forwhat" would have to be really strong evidence, too. Hardly to anyone else, though.   0 Reply avl1 (2748) 3/4/2011 10:56:56 PM Andreas Leitgeb wrote: > Lew appeared very confident about the OP meaning to write about > String-compatible user defined types String1 and String2, so > with this mindset, usage of "forwhat" would have to be really > strong evidence, too. Hardly to anyone else, though. > That's a misinterpretation of what I said. I never spoke to the strength of the evidence. But the evidence was there, as I said and you finally conceded. Programming is an art of precision. If the OP had meant 'String' in his code, he should have said that. The natural language "forwhat" is not a comparable error; rules of interpretation are different for natural language than for code. As you no doubt realize but that it would interfere with your sophistry. If the OP really did mean 'String', they were careless, just as I was with "forwhat". But the former means a program crash, and the latter nearly nothing. Given that the OP's post used 'String1' and 'String2' repeatedly, and that he was careful to use both, it was evident that the choice was deliberate, unlike with my typo. A deliberately chosen parole carries more evidentiary weight than an accidentally chosen one. Another point omitted in your sophistry. Regardless, it's clear that you're arguing for the sake of arguing, misstating my position so that you can continue to argue it, and generally behaving very unlike your usual contributory self. -- Lew Honi soit qui mal y pense.   0 Reply noone7 (4050) 3/5/2011 12:35:29 AM Lew <noone@lewscanon.com> wrote: > But the evidence was there, as I said and you finally conceded. I immediately conceded with the "indication" being there. It just took me a while to accept that "evidence" really appears to be understood as a synonym of indication by more than just you alone, despite wikipedia (possibly falsely) supporting my (old) understanding. > Programming is an art of precision. Programming is. Asking a question here, otoh., is communication, not programming. We're no AI-robots, but humans, and should be mentally able (even if not always willing) to parse less than perfect problem-descriptions and apply a good dose of experience and gut-feeling w.r.t what the asker really might mean. > If the OP had meant 'String' in his code, he should have said that. There's some evidence (induced by that it just makes most sense to assume it), that the appended numbers were neither carelessness nor meant literally, but just a meta-syntax to *tag* each use of String. As such, I found it impressively clear and concise. > ... your usual contributory self. Thanks at least for that last acknowledgement. I haven't consciously left it. Casually, I feel like clarifying misunderstandings between others. That it may happen that I introduce even worse ones thereby, is at least not intended.   0 Reply avl1 (2748) 3/5/2011 1:59:25 AM  comp.lang.java.programmer 52121 articles. 40 followers. 35 Replies 485 Views Similar Articles [PageSpeed] 35 • Permalink • Email • Follow  Reply: Similar Artilces: Java Collections List : Converting from List '<Column <String1, String2>>' to 'List <String1>' I have a function that returns a list like this:- List <Column <String1, String2>> Next I want to pass this list to a 2nd function, but 2nd function just need= s a list which contains only 1st part (string1) of the Column(s) of the abo= ve list. So I want pass just this list to 2nd function:- List <String1> What would be the best way to do this ?? [my use case: Both the functions are from a library that I use to access da= tabase(Cassandra) for a web application. 1st function gives me a list of al= l columns which has two parts name(String1) and valu... Java Collections List : Converting from List '<Column <String1, String2>>' to 'List <String1>' I have a function that returns a list like this:- List <Column <String1, String2>> Next I want to pass this list to a 2nd function, but 2nd function just need= s a list which contains only 1st part (string1) of the Column(s) of the abo= ve list. So I want pass just this list to 2nd function:- List <String1> What would be the best way to do this ?? [my use case: Both the functions are from a library that I use to access da= tabase(Cassandra) for a web application. 1st function gives me a list of al= l columns which has two parts name(String1) and valu... List of lists of lists of lists... I would like to have a list of lists N times deep, and my solution is (in pseudocode): def deep(x): a=[x] return a mylist=[] for N: mylist=deep(mylist) Is there a more elegant way to do it? The maine idea is: from a list having the numbre of steps along N dimensions, generate a list with an item at each possible point. Example 1: N=2 list=[2,3] result=[[1,2],[1,2],[1,2]] Example 2: N=3 list=[3,1,2] result=[[[1,2,3]],[[1,2,3]]] -- Ángel Gutiérrez Rodríguez - agr@fq.uniovi.es Instituto de Ciencia de los Materiales de Madrid - CSIC SpLine - European Syncrothorn Radiat... list of lists of lists .... Hi, I have a list of data (type A) my list can includes element of type A or a lists, these list can includes element of type A or a lists, and so on ... is there a simple way to obtain a single list of all the elemets of type A ? thanks yomgui I forgot the most important, I am looking for a non recursive method. thanks yomgui yomgui wrote: > > Hi, > > I have a list of data (type A) > my list can includes element of type A or a lists, > these list can includes element of type A or a lists, and so on ... > > is there a simple way to obtain a single list of all... convert list of lists to list Is there a way to convert list_of_listsA to list_of_listsB, where one list in listof lists A is one element of listB? list_of_listsA: [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['koe'], ['arm*', '*', '*(haar)'], ['groei*', '*', '*', '*', '*']] listB: ['klas* * *', 'mooi* * * *, 'koe', 'arm* * * (haar)', 'groei* * * * *'] Thankx! antar2 wrote: > Is there a way to convert list_of_listsA to list_of_listsB, where one >... Sort a List, in a List of Lists of Lists Dear Mathgroup, I have a lsit of Lists of Lists: {{{1,2},{2,1},{1,1}},{{1,1},{1,1},{1,2}},{{2,1},{2,2},{1,2}},{{2,2},{1,2},{2,2}},{{1,1},{2,1},{1,2}},{{1,2},{2,2},{2,2}}} I would like to sort the elements in the lowest level of brackets to give {{{1, 2}, {1, 2}, {1, 1}}, {{1, 1}, {1, 1}, {1, 2}}, {{1, 2}, {2, 2}, {1, 2}}, {{2, 2}, {1, 2}, {2, 2}}, {{1, 1}, {1, 2}, {1, 2}}, {{1, 2}, {2, 2}, {2, 2}}} i.e retaining the same structure with the paired elements in the original order. I can't seem to get the syntax right to do this apart from the obvious {{Sort[{1,... Converting a list of lists to a single list I think that itertools may be able to do what I want but I have not been able to figure out how. I want to convert an arbitrary number of lists with an arbitrary number of elements in each list into a single list as follows. Say I have three lists: [[A0,A1,A2], [B0,B1,B2] [C0,C1,C2]] I would like to convert those to a single list that looks like this: [A0,B0,C0,C1,C2,B1,C0,C1,C2,B2,C0,C1,C2,A1,B0,C0,C1,C2,B1,C0,C1,C2,B2,C0,C1,C2,A2,B0,C0,C1,C2,B1,C0,C1,C2,B2,C0,C1,C2] An easier way to visualize the pattern I want is as a tree. A0 B0 C0 C1 C2 B1 C0 C1 ... Re: Sort a List, in a List of Lists of Lists On 11/13/10 at 12:59 AM, leigh.pascoe@inserm.fr wrote: >I have a lsit of Lists of Lists: >{{{1,2},{2,1},{1,1}},{{1,1},{1,1},{1,2}},{{2,1},{2,2},{1,2}},{{2,2}, >{1,2},{2,2}},{{1,1},{2,1},{1,2}},{{1,2},{2, 2},{2,2}}} >I would like to sort the elements in the lowest level of brackets to >give >{{{1, 2}, {1, 2}, {1, 1}}, {{1, 1}, {1, 1}, {1, 2}}, {{1, 2}, {2, >2}, {1, 2}}, {{2, 2}, {1, 2}, {2, 2}}, {{1, 1}, {1, 2}, {1, 2}}, >{{1, 2}, {2, 2}, {2, 2}}} >i.e retaining the same structure with the paired elements in the >original order. I can't seem... List of Atom or List of List?? how can detect some element of list is list o Atom?? for example when i try head (head p1) where p1=[[1,2],2] return 1 but when try head (head p1) where p1=[1,2] it returns Error plz help me..it my project and i have just 2 hours..:( i want to replace on Atom by another in list..for example: replace 1 2 [1,2] => [2,2] but sometime i have replace 1 2 [[1,2],2]=>[[2,2],2] i want to detect if first element of list is list then recurcively call head on that element.. is there any solutions?? On 8 Apr 2007 02:46:25 -0700, kheirandish.amin@gmail.com wrote: >how can detect some eleme... Extracting a List from a List of lists Hi, I have an ArrayList of ArrayLists. I want to extract all the lists, but I dont know how many ArrayLists will be in the ArrayList. I know I can do it if i know how many lists are there using the ArrayList get() method. this is how i'm doing it List<String> list1 = new ArrayList<String>(); list1 = res.get(0); List<String> list1 = new ArrayList<String>(); list2 = res.get(1); List<String> list1 = new ArrayList<String>(); list3 = res.get(2); But if theres only two lists in the list i get a NullPointerException Is there any way i can loop through the l... How to have a list of lists (or array of lists) Hi, I want to have many lists, such as list0, list1, list2, ..., each one holding different number of items. Is there something like list[0] list[1] list[2] so that I can iterate through this list of lists? Thanks! bahoo On Apr 3, 7:12 pm, "bahoo" <b83503...@yahoo.com> wrote: > Hi, > > I want to have many lists, such as list0, list1, list2, ..., each one > holding different number of items. > Is there something like > list[0] > list[1] > list[2] > > so that I can iterate through this list of lists? > > Thanks! > bahoo listOfLists = [... Copying a List to a List of Lists Hi, I am having trouble with the following: I wish to have a list of lists of type Double called A. I then have a separate List of Doubles called B which i wish to add to A. I then want to be able to clear B and reuse it without clearing what I have added to A. Currently my code looks like: for(int i=0;i<seqLength;i++) { B.clear(); for(int j=i+1;j<seqLength;j++) { if(fourGameteTest(i,j)) { B.add(segPositions.get(j)); } } A.get(i).add(B); } However, it seems that due to, I guess the element held in A being a reference to the same pl... lists of lists I'm using C++ and I'm trying to create a list of a list and it won't let me create an iterator for it. if I do a list of an int, everything is fine. my syntax is list<list<string> > some_list; and my iterator would be someting like list<list>::Iterator blah; or maybe list<list<string> >::Iterator blah; ?? neither work, ofcourse. basicaly I'm trying to parse a text file, each line is token that contains tokens and I have a function that takes a string and returns the list of the tokens. so I have my the parent list to contain lists to t... Lists of list Hi All I am having problem with delete line if its belong to another one , example ['0132442\n', '13\n', '24\n'] the 2nd and 3rd are already in the first line , how can do this !!! Thanks Mohammed Altaj wrote: > Hi All > > I am having problem with delete line if its belong to another one , example I think, you mean to remove all lines that are substrings of another line. l = ['0132442\n', '13\n', '24\n'] l = [e.strip() for e in l] i = 0 while True: try: for j in range(len(l)): if i == j: continue if l[j]... list*list There must be a better way to multiply the elements of one list by another: a = [1,2,3] b = [1,2,3] c = [] for i in range(len(a)): c.append(a[i]*b[i]) a = c print a [1, 4, 9] Perhaps a list comprehension or is this better addressed by NumPy? Thanks, jab > There must be a better way to multiply the elements of one list by > another: > > a = [1,2,3] > b = [1,2,3] > c = [] > for i in range(len(a)): > c.append(a[i]*b[i]) > a = c > print a > [1, 4, 9] > > Perhaps a list comprehension or is this better addressed by NumPy? First of all: it's ... When is a List not a List? g[x_, n_] := x^n FullForm[Table[g[x, n], {n, 1, 2}]] FullForm[{g[x, 1], g[x, 2]}] Plot[{g[x, 1], g[x, 2]}, {x, 0, 1}, PlotStyle -> {Red, Blue}] Plot[Table[g[x, n], {n, 1, 2}], {x, 0, 1}, PlotStyle -> {Red, Blue}] The FullForm[]s are identical. One Plot[] has red and blue curves; the other has two blue curves. Quirky! AES wrote: > g[x_, n_] := x^n > FullForm[Table[g[x, n], {n, 1, 2}]] > FullForm[{g[x, 1], g[x, 2]}] > Plot[{g[x, 1], g[x, 2]}, {x, 0, 1}, PlotStyle -> {Red, Blue}] > Plot[Table[g[x, n], {n, 1, 2}], {x, 0,... List of lists... I would like to add a List environment with an accompanying list of lists included at the front of the document. Basically, a List is like a table or a figure. However, I want to be able to refer to a bulleted list. I am using gatech-thesis.cls (which is based on report.cls). I went through report.cls, and copied everything having to do with figures into gatech-thesis.cls (just after it includes report.cls) and changed everything that said figure to list. Then, I went through gatech-thesis.cls, and copied everything having to do with figures, changing everything that said figure to list..... List of lists How do I extract a list of lists from a user defined function and print the results as strings for each list? On Fri, 27 Jun 2003 01:44:42 GMT, Mike wrote: > How do I extract a list of lists from a user defined function Depends how that function is returning its values. The most obvious, and simplest way to do what you describe, is to have the function return a list of lists, as its return value. If you mean something else, you'll have to be more descriptive of what you actually want to do. > and print the results as strings for each list? The 'repr()' method of any o... List of lists So you can create listoffigures tableofcontents and listoftables, but can you and if so how do you do the same thing for a list of numbered lists? Cheers Try the tocloft package: http://www.ctan.org/tex-archive/help/Catalogue/entries/tocloft.html On 21 Mar, 17:26, "Matt" <matthew.w.tur...@gmail.com> wrote: > Try the tocloft package: > > http://www.ctan.org/tex-archive/help/Catalogue/entries/tocloft.html That looks great, cheers. But I am having trouble using it. This is the code I am trying, just lifted from the instructions: \newcommand{\listanswername}{List o... List of a list Hi, I'm very new to latex. I'm trying to make a list of a list, with: \begin{list}{} \item \begin{list}{} \item \end{list} \end{list} However, I'm getting the error: Runaway argument? ! Paragraph ended before \list was complete. <to be read again> \par l.2273 However, I can do a list of enumerates, but that's not what I want. Is this a clash in syntax? Is there a way to prevent this? Please help. Michael On 1 Nov 2004 00:19:43 -0800, Michael <dayzman@hotmail.com> wrote: > Hi, > I'm very new to latex. I'm trying to make a list ... list or not a list? Hello, I was a bit astonished using such tcl code: % set list "Abbruch der Aktion \" ##ACTION \" !" Abbruch der Aktion " ##ACTION " ! % llength$list 5 % llength [split $list] 7 % % set idx 0 0 % foreach element$list {puts "element($idx) = '$element'"; incr idx} element(0) = 'Abbruch' element(1) = 'der' element(2) = 'Aktion' element(3) = ' ##ACTION ' element(4) = '!' % % set idx 0 0 % foreach element [split \$list] {puts "ele...

Lists from Lists
Can anyone tell me how can I make a list from all the first elements of the following pairs? l:=[[1,2],[3,4],[5,6],[7,8]] ; to get, m:=[1,3,5,7]; Thanks, Tony Connell "Tony Connell" <a.connell@galileo.karoo.co.uk> wrote in message news:vfk59prj7bp0fb@corp.supernews.com... > Can anyone tell me how can I make a list from all the first elements of the > following pairs? > > l:=[[1,2],[3,4],[5,6],[7,8]] ; > > to get, > > m:=[1,3,5,7]; > If you know the length of the list you could do like this: > m:=[seq(l[i][1], ...

Lists of lists
I've written a simple forum. The posts are lists of lists of lists... Each new list steps out the left margin. What happens is that after so many replies the lists get pushed too far right. I'd like to reset the list margin back to the beginning. for ex: ul > ul>ul> ul > ul... { margin-left: original thread left position; ??? position: absolute; left 0; } For ex: http://earlymorningreport.com/test_zig_zag_lists.html I would think this would not be an uncommon request. How now can we do this (other than that)? Jeff In article <jpom3b...

converting a hash where the value is a list of lists to just a list
Hi All, I have a hash where the values are a list of lists. What I would like to do is convert this to a hash where the value is just a reference to an array that contains the list of lists. Below is my attempt to convert this to what I want, the problem is that I am loosing some people in the process! use strict; use warnings; use Data::Dumper; my %people = ( 'hillrich' => [ [5308125], [2053628], [5312468], [5312492] ], 'hsieh' => [ [5312182], [5312613], [5312517] ], 'prakash' => [], 'florencb' => [ [1420688], [1420596]...

concatenate the elements in each list of a list of lists
I already asked a similar question, but encounter problems with python... How can I concatenate the elements in each list of a list of lists list_of_listsA = [['klas*', '*', '*'], ['mooi*', '*', '*', '*'], ['arm*', '*', '*(haar)']] wanted result: list_of_listsA = [['klas* * *'] ['mooi* * * *'] ['arm* * *(haar)']] Thanks a lot ! On Jul 23, 5:33=A0pm, antar2 <desoth...@yahoo.com> wrote: > I already asked a similar question, but encounter problems with > python... > How c...