Talk:J operator
Appearance
This article is rated Stub-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||
|
What does it do and why?
[edit]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)
- I don't know why they invented J operator. I also think that it's misleading to call it that. The original name was "program-point". The paper that describes it, describes the operator as "the thing most closest to jump", which was basically a mechanism for cases where eager evaluation would not do. (This is my speculation). As far as I can understand, the below Common Lisp code tries to roughly represent the idea:
(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