From: Richard F. <fa...@gm...> - 2024-10-15 13:29:31
|
The code here: https://people.eecs.berkeley.edu/~fateman/lisp/doparsesum.lisp provides a more rational version of makelist. It doesn't hide stuff or call ev For instance, for i:1 next 2*i while i< 20 collect f(i) is translated to block([g15:[]], for i next 2*i unless i>=20 do push(f(i),g15), reverse(g15)) which returns [f(1),f(2),f(4),f(8),f(16)] I think the code should be added to Maxima. It is orthogonal to everything else, so no existing test suite code could use it . It is unlikely anyone else in private code hacked the parser with these keywords.. RJF On Tue, Oct 15, 2024 at 1:32 AM Robert Dodier <rob...@gm...> wrote: > On Mon, Oct 14, 2024 at 12:00 PM Stavros Macrakis <mac...@gm...> > wrote: > > > Internally makelist calls ev, but I've got to say that that shocks me > even more than the fact that ev has bizarre behavior itself. In particular, > I find this ridiculous: > > > > makelist(['(x), '('x),'('('x))],'x,17,17) => [[17, '17, '('17)]] > > > > Re using 'x as a variable in ev and makelist, I doubt that the > implementers considered that case. It should probably raise an error. > > Ah, but this example is easily explained. 'x is a nonatomic expression > ((MQUOTE) $X) so ev is going to substitute (not assign) ?meval(17) for > ?meval('x) in ['(x), '('x),'('('x))] and then evaluate that, peeling > off one quote from each of the three list elements. (I'm pretty > impressed that it comes out with the right number of quotes on each > element, frankly.) > > I disagree that 'x should cause an error, unless all nonatomic doodads > cause an error, and I'm inclined to think they shouldn't. > > The barely-coherent intricacies of ev spill over into makelist ... Oh > well!! > > Robert > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |