This article is rated Stub-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||
|
Why did they invent the J operator? The article does not clearly describe what the purpose of the J operator is, or give any examples of how it would be used. What... is it? — Preceding unsigned comment added by 71.234.123.137 ( talk) 04:52, 29 May 2012 (UTC)
(defun j-operator (function continuation)
(lambda (&rest args)
(funcall continuation (apply function args))))
(defun j-operator-test (continuation)
(j-operator (lambda (x) (+ x x)) continuation))
;; CL-USER> (j-operator-test (lambda (x) (format t "~&result: ~d" x)))
;; #<CLOSURE (LAMBDA (&REST ARGS) :IN J-OPERATOR) {100565428B}>
;; CL-USER> (funcall * 2)
;; result: 4
79.183.183.207 ( talk) 11:05, 24 January 2014 (UTC)
This article is rated Stub-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||
|
Why did they invent the J operator? The article does not clearly describe what the purpose of the J operator is, or give any examples of how it would be used. What... is it? — Preceding unsigned comment added by 71.234.123.137 ( talk) 04:52, 29 May 2012 (UTC)
(defun j-operator (function continuation)
(lambda (&rest args)
(funcall continuation (apply function args))))
(defun j-operator-test (continuation)
(j-operator (lambda (x) (+ x x)) continuation))
;; CL-USER> (j-operator-test (lambda (x) (format t "~&result: ~d" x)))
;; #<CLOSURE (LAMBDA (&REST ARGS) :IN J-OPERATOR) {100565428B}>
;; CL-USER> (funcall * 2)
;; result: 4
79.183.183.207 ( talk) 11:05, 24 January 2014 (UTC)