Dear Dr Jon D Harrop,
“List Comprehension” is a special concise syntax form that
generates lists, as a way to save typing such as for loops. It is
primarily a jargon bandied about by programers which have contributed
huge misunderstandings and miscommunications. The extensiveness of this
particula
Duncan Booth wrote:
> Ok, so, if I understand you, the definition of Table is just:
>
> def Table(f, *lists):
> return Outer(f,
> *[range(start,end+1,step) for (start,end,step) in lists])
>
> Is that about right?
>
And lest you think I left a bit too much as an "exercise for the
rea
Xah Lee wrote:
> oops, another error. The example should be:
>
> Table(f,[1,2,1],[2,6,2]) returns
> [[f(1,2),f(1,4),f(1,6)],[f(2,2),f(2,4),f(2,6)]]
>
>> Wouldn't it be more sensible just to take the iterators directly as
>> arguments, so for this example you would do:
>>
>> Table(f, range(1,3),
Dear Mr. Jones:
Our team of 3,972 expert testers judged the output of your
troll-spewing neural net virtually indistinguishable from the original.
Given this, I am please to announce that our firm is willing to
discuss arrangements for an exclusive license that you would likely
find financially c
Xah Lee wrote:
>Very very nice! I don't know scheme well... but oh the macros, such a
>wonderful facility...
>
>
Macros suck. They created by moron so-called computer scientists and IT
puntits in order opress the programming masses. But I say we must bring
freedom to all programmers. In ord
Very very nice! I don't know scheme well... but oh the macros, such a
wonderful facility...
Functional lang never let me down.
I haven't worked on a Java version yet... but i wonder what pain i'll
have to endure for a lang that lacks eval. Since i'm not Java expert...
i wonder if i can even do it
Xah Lee wrote:
>
> well yes... but this was emulation of Mathematica functions.
> (Disclaimer: Mathematica is a trademark of Wolfram Research Inc, who is
> not affliated with this project)
You could have fooled me.
--
http://mail.python.org/mailman/listinfo/python-list
oops, another error. The example should be:
Table(f,[1,2,1],[2,6,2]) returns
[[f(1,2),f(1,4),f(1,6)],[f(2,2),f(2,4),f(2,6)]]
> Wouldn't it be more sensible just to take the iterators directly as
> arguments, so for this example you would do:
>
> Table(f, range(1,3), range(2,7,2))
well yes... but
Removing cross-posts to java and scheme lists.
On Tue, 21 Jun 2005 01:54:40 -0700, Xah Lee wrote:
> here's the Python spec for the Table function:
>
> '''Table(f,[iStart,iEnd,iStep]) returns a list of f applied to the
> range range(iStart,iEnd,iStep).
> Example: Table(f,[3,10,2]) returns [f(
Xah Lee wrote:
> here's the Python spec for the Table function:
...
> References:
>
> • for a context of this message, see: http://xahlee.org/tree/tree.htm
Here is a Scheme implementation of Table. As noted on your web page and the
Mathematica documentation, the first argument of Table "evaluat
Xah Lee wrote:
> '''Table(f,[iStart,iEnd,iStep]) returns a list of f applied to the
> range range(iStart,iEnd,iStep). Example: Table(f,[3,10,2]) returns
> [f(3),f(5),f(7),f(9)] Table(f,[iStart,iEnd,iStep],
> [jStart,jEnd,jStep], ...) returns a nested list of f(i,j,...) applied
> thru the iterator
the example in the spec of previous post is wrong. Here's corrected
version:
here's the Python spec for the Table function:
'''Table(f,[iStart,iEnd,iStep]) returns a list of f applied to the
range range(iStart,iEnd,iStep). Example: Table(f,[3,10,2]) returns
[f(3),f(5),f(7),f(9)] Table(f,[iStart,
here's the Python spec for the Table function:
'''Table(f,[iStart,iEnd,iStep]) returns a list of f applied to the
range range(iStart,iEnd,iStep).
Example: Table(f,[3,10,2]) returns [f(3),f(5),f(7),f(9)]
Table(f,[iStart,iEnd,iStep], [jStart,jEnd,jStep], ...) returns a nested
list of f(i,j,...)
The Perl version of the Tree function is posted. It's a bit long.
Please see the code here:
http://xahlee.org/tree/Table.html
the choice of having a string as the first argument to Table is a bit
awkward in Perl. Possibly i'll have to rewrite it so that the first
argument is a function instead, wh
Here's the next tree functions exercise in Python, Perl, Java. Other
language solutions welcome.
http://xahlee.org/tree/tree.html
-
Table('exprString', [iMax]) generates a list of iMax copies of value
of
eval('exprString'), and returns the refence to the list. i.e.
[ev
15 matches
Mail list logo