Thanks very much for that Marshall and Raul,

I will go over it in detail!

BTW,
If any Jers want to understand Wisdom & Sussman's approach to Classical
Mechanics, using a clear unambiguous modern functional notation (=>
computer executable) there is also a good introductory paper:
"The Role of Programming in the formulation of Ideas"
http://dspace.mit.edu/handle/1721.1/6707

Also if you have got SICM, and want a brief intro into their model look
at Chapter 8 (our notation) so that you don't have to glean the
computational approach from reading the book.
http://mitpress.mit.edu/sicm/book-Z-H-79.html#%_chap_8

Finally, what I think will be an interesting J challenge (when I get
round to it) is the implementation of their tuples.  The text uses two
types "up" and "down" tuples, with up tuples equivalent to regular
vectors, while down tuples correspond to duals.  There is an interesting
contraction  possible when tuples are of the same length and opposite
type.
You can get a taste of this from the MIT-scheme "scmutils" manual
In the section on "Up tuples and Down tuples".
http://groups.csail.mit.edu/mac/users/gjs/6946/refman.txt  (about 10
screens down)

My apologies for going a bit off-topic, but this stuff along with some
practical applications will be my J playing field for the foreseeable...




On Thu, 2010-12-09 at 22:57 -0500, Marshall Lochbaum wrote:
> Having taken an incredibly shallow look at the first few pages of SICM, I 
> will now highly recommend to you the conjunction
> 
> T=: 2 : '] , u d. (i.<:n)'
> 
> where (u T n) gives the first n components of the "local tuple" of the 
> function u. It may then be applied to a time t to obtain the actual value of 
> this vector. So:
> 
>    *: T 4
> ] , (*: , +: , 2"0)"0
> 
> For the record, I am not entirely sure how this works with vector outputs (or 
> inputs, but these seem less important).
> 
> Marshall
> 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Alex Gian
> Sent: Thursday, December 09, 2010 7:53 PM
> To: Programming forum
> Subject: [Jprogramming] Verbs that take verbs as arguments (pt 2)
> 
> 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
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm


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

Reply via email to