Talk:J operator

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

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)[reply]

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

79.183.183.207 (talk) 11:05, 24 January 2014 (UTC)[reply]