Nobody still post, I try.
According to
Users Manual and Reference,
(map exp-functor list-args-1 [list-args-2 ... ])
Successively applies the primitive function, defined function, or lambda expression exp-functor to the arguments specified in list-args-1, list-args-2-, returning all results in a list.
Then,
Code: Select all
(map 1 '((a b c d) (e f g h) (i j k l)))
(map (curry 1 2) '((a b c d) (e f g h) (i j k l)))
↓
(list (1 '(a b c d)) (1 '(e f g h)) (1 '(i j k l)))
(list ((curry 1 2) '(a b c d)) ((curry 1 2) '(e f g h)) ((curry 1 2) '(e f g h)))
And,
Implicit indexing for rest and slice
Implicit forms of rest and slice can be created by prepending a list with one or two numbers for offset and length.
Then,
Code: Select all
(1 '(a b c d)) → (b c d)
(1 '(e f g h)) → (f g h)
(1 '(i j k l)) → (j k l)
Continuously,
(curry func exp)
Transforms func from a function f(x, y) that takes two arguments into a function fx(y) that takes a single argument. curry works like a macro in that it does not evaluate its arguments. Instead, they are evaluated during the application of func.
Then,
((curry 1 2) '(a b c d)) → (1 2 '(a b c d)) → (b c)
((curry 1 2) '(e f g h)) → (1 2 '(e f g h)) → (f g)
((curry 1 2) '(i j k l)) → (1 2 '(i j k l)) → (j k)
Additonally,
Implicit indexing for nth
In original Lisp, the first element in an s-expression list is applied as a function to the rest elements as arguments. In newLISP, a list in the functor position of an s-expression assumes self-indexing functionality using the index arguments following it.
Then,
Code: Select all
> (map ''(a b c d) '(3 2 1 0))
(d c b a)
>
I'm sorry if my English usage would be wrong or my words would be insufficient.