> --- Stefano Lanzavecchia <[EMAIL PROTECTED]> wrote:
> > What is actually required to meet Graham's challenge is not to return
> > a function (or verb) but a closure. The challenge was discussed on
> > this same maillist not long ago: I do recommend checking its archive.
> > If I remember correctly the only possible solution is to use J's OO
> > extensions. In many occasions closure are converted to objects when
> > compiling from an FP language to an OO language. J is not an FP
> > language in the now expected meaning so it's better to consider it an
> > OO language for the class of problems that can be solved with
> > explicitely returning closures in traditional FP languages.

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> Sent: giovedì 6 aprile 2006 17.36
> Subject: RE: [Jprogramming] Function returning a function - how?
> 
> I see that I misunderstood the accgen problem.
> 
> It boils down to problem definition.  The function is supposed to keep
> track of n (updating it) on each call  then yes,  an object is part of
> the only solution.
> Only because of the need for a static variable. Pretty hard to come up a
> non-object version for handling static variables, but I maintain its
> unrelated to closures.

A friend of mine who is also an implementer of APL interpreters showed me
this:
http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html
I'd love to quote the Zen koan therein inserted:
* * *
  The venerable master Qc Na was walking with his student, Anton.  Hoping to
prompt the master into a discussion, Anton said "Master, I have heard that
objects are a very good thing - is this true?"  Qc Na looked pityingly at
his student and replied, "Foolish pupil - objects are merely a poor man's
closures."

  Chastised, Anton took his leave from his master and returned to his cell,
intent on studying closures.  He carefully read the entire "Lambda: The
Ultimate..." series of papers and its cousins, and implemented a small
Scheme interpreter with a closure-based object system.  He learned much, and
looked forward to informing his master of his progress.

  On his next walk with Qc Na, Anton attempted to impress his master by
saying "Master, I have diligently studied the matter, and now understand
that objects are truly a poor man's closures."  Qc Na responded by hitting
Anton with his stick, saying "When will you learn? Closures are a poor man's
object."  At that moment, Anton became enlightened.
* * *

Anton, the pupil in the koan  and also its author, is Anton van Straaten, a
Scheme expert.
-- 
WildHeart'2k6 - mailto:[EMAIL PROTECTED]
My digipics and blogs: http://spaces.msn.com/members/wildy2k5/



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

Reply via email to