-------- Original Message --------
Subject: Re: [Maxima] use "for" loop to create list
Date: Tue, 03 Apr 2012 07:19:06 -0700
From: Richard Fateman <fateman at eecs.berkeley.edu>
To: Ether Jones <maxima at etherjones.us>
On 4/3/2012 7:09 AM, Ether Jones wrote:
> How do I create this list:
>
> f(x):=x^2;
>
> myList: [
> [1, f(1)],
> [2, f(2)],
...
mylist: makelist([i,i^2],i,1,10)
or if you insist on a " for loop ',
s:[],
for i:1 thru 10 do s:cons([i,i^2],s),
mylist: reverse(s),
...
I had suggested (and, I think, implemented) a change to allow
mylist: for i:1 thru 10 collect [i,i^2];
but that somehow didn't happen.
The common lisp "loop" could be used as an inspiration for other extensions.
RJF
the implementation, waiting for someone to insert into the code, is in
www.cs.berkeley.edu/~fateman/lisp.mdo.lisp
which you can load in to your maxima and then the "collect" will work.