Re: HP39gII teaching materials online Message #18 Posted by Gilles Carpentier on 22 July 2012, 5:09 a.m., in response to message #17 by Tim Wessman
Hi Tim,
The size is without the comments...
I think MAP is the 'normal' name (Mathematica and many other languages). Imo MAP should apply to matrix, lists and vectors,like on the 50G
1/ With matrix,no problem :
MAP( Function(x), M1)
It is like on the 50G M1 << NEXTPRIME >> MAP
It would be fine if we could use an algebraic expression for the 'function' without defining it before( but then how to manage parameters ?) MAP ( > x '2*x^2+2*x+7', M1)
2/ With list
On the 50G MAP applies the program to all the items ( include inner lists).( but we can use DOLIST for more complex things)
I think it would be judicious to have an additionnal argument for the "level of deep" to manage inner lists (i dont like very much the idea of variable number of arguments for a function but it's already that way on the 39GII and it has his advantages)
So we could manage in different ways :
{ 1 2 3 4 }
{ {1 2} {3 4} }
{ { 12 3 4} {1 { 2 5}}}
0 : compute all the items (inner lists include) default value
1 : compute only the first level of the list
2 : compute first and second level
n : compute 1..n level
MAP (> x 'SORT(x)', L1, 1) will sort all the first level inner list of L1
MAP ( > x 'IF x==0 THEN x:=1E499 END', L1)
Here are some implementaion of MAP in various language :
Map examples
PS : also note that in the 50G, in many occasion there is no need of MAP command and the // list processing is very powerfull
{ 2 3 4 } 1  gives { 1 2 3 }
{'a' 'b' 'c' } SIN gives { 'SIN(a)' 'SIN(b)' 'SIN(c)'}
{2 3 4 } { 1 2 3 }  gives { 1 1 1 }
{2 3 4 } 2 * gives { 4 6 8 }
{2 3 4 } { 1 2 3 }  gives { 2 6 12 }
etc. (AppendixC AUR)
In that point of view the APLY program example in the AUR is a non sense
Edited: 22 July 2012, 6:27 a.m.
