2 ms·
TXR Lisp: 1> (op mapcar [dup *]) #<interpreted fun: lambda #:arg-rest-0011> 2> [*1 '(1 2 3 4 5)] (1 4 9 16 25) Let's do it with a vector of objects th
by kazinator 8y ago
TXR Lisp:
1> (op mapcar [dup *])
#<interpreted fun: lambda #:arg-rest-0011>
2> [*1 '(1 2 3 4 5)]
(1 4 9 16 25)
Let's do it with a vector of objects that need their value slot accessed:
1> (defstruct (silly-wrapper value) () value)
#<struct-type silly-wrapper>
2> (defun square (table)
(mapcar [chain .value [dup *]] table))
square
3> (square (vec (new (silly-wrapper 2)) (new (silly-wrapper 5))))
#(4 25)