Sorry to plague you with more newbie questions, but I'm a little pressed
for time here.

OK, for anyone familiar with Scheme/Lisp/λ-calculus etc, here's what I'm
trying to do:

(define (gamma q)
  (lambda(t)
    (list t (q t) ((d1 q) t)))


In other words, I want to pass a monadic verb (call it 'q') to the
'gamma' verb/function  and I want the result to be a monadic
verb/function that will accept a value ('t') and return a three elem
array of rank 1
t, q t, q D.1 t

IOW, something like
testfunc =. gamma @ q
testfunc 1.1
  1.1 (q 1.1) ((q D.1) 1.1)

(In case anyone wonders why the weird questions, I am working through
Sussman & Wisdom's SICM, and would like to try the code in parallel in J
to compare the two notations.)

I suppose I am really trying to figure how J deals with anonymous
functions.  Where I am getting stuck is the scoping of the values of y
(and x) in explicit definitions.

I /could/ do it as a dyad, but
gamma=: dyad : 'y,(x y),x D.1 y'
doesn't seem to work for me either, and I really would prefer monadic,
kinda seeing how "currying" maps to J.






----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to