Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Functions that churn out lambdas - when?

Name: Anonymous 2009-09-12 1:29

I just wrote my own "repeated" implementation (SICP lecture 3x), and I thought the same could have been done with something of the format (repeated procedure item times), instead of dealing with another layer of abstraction by churning out a procedure that does the actual iteration ((repeated procedure times) item). At this point, choosing between both forms seems like an arbitrary flip of the coin - can anyone on /prog/ enlighten me?

Name: Anonymous 2009-09-12 3:53

[/code]
(defun repeated (f n)
  (lambda (item)
    (loop repeat n do (funcall f item))))
[/code]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List