Apply a callback to an array: Difference between revisions

Line 4:
 
=={{header|ACL2}}==
 
{{incorrect|ACL2|This is recursive list processing with a hard-coded function.
First class functions are not required in this problem; "second class" functions will do (see C solution, etc).}}
 
ACL2 does not have first-class functions; this is close, however:
 
<lang lisp>(defun sqapply-to-each (xs)
(if (endp xs)
nil
(cons (* (first xs)fn-to-apply (first xs))
(sq-each (rest xs)))))</lang>
 
(defun fn-to-apply (x)
(* x x))
</lang>
 
=={{header|ActionScript}}==
Anonymous user