I first encountered lambdas in the mid-70s, and I have thought about
them a lot and taken a number of classes which use them. For that
matter, I have implemented the Y combinator in J (or, at least,
something that works the same way).

With that in mind, I am curious: what do you mean by "a nice lambda syntax"?

Thanks,

-- 
Raul


On Tue, Jan 27, 2015 at 1:24 PM, Tobia Conforto
<[email protected]> wrote:
> I, for one, found Raul's solution an interesting challenge to decode by
> myself, purposely not looking at his explanation until I had cracked it
> myself.
>
> Coming from a traditional and functional programming background, with some
> recent APL study, I find explicit definitions much easier to understand
> than J's verb trains. I still don't understand the philosophical reason why
> J won't have a nice lambda syntax, analogous to {…} in modern APL or the
> countless variations of (lambda …) or function() {…} in other languages.
>
> It would make it easier to nest function definitions, avoid unnecessary
> string escaping, and introduce nested local (lexical) scoping, something
> that seems conspicuously missing in J to my novice eyes. I'm sure there is
> a reason, but I cannot see it yet. I get that { and } were too valuable as
> standalone characters, but then I'm sure the authors could have found a
> different pair of balanced symbols to use for this purpose, if they wanted.
>
>
> On Tue, Jan 27, 2015 at 3:43 PM, Raul Miller <[email protected]> wrote:
>
>> Are you asking for this?
>>
>>    f=:13 :'y </.~ +/\ t * _1 |. t=. y ~: {.;:''&'''
>>
>> Thanks,
>>
>> --
>> Raul
>>
>> On Tue, Jan 27, 2015 at 4:22 AM, Linda Alvord <[email protected]>
>> wrote:
>> >
>> >
>> > Here's a challenge:
>> >
>> >
>> >
>> > Just because @ might show up in third grade, that doesn't include all its
>> > little cousins like  @: & and &:
>> >
>> >
>> >
>> > To me, minimal documentation begins with the data using capital letters
>> for
>> > the name. Since F is not a verb, don't start here.
>> >
>> >
>> >
>> > F=: </.~ +/\@(-.@+._1&|.)@:=&(<,'&')
>> >
>> >
>> >
>> > Also it is a very tangled verb:
>> >
>> >   5!:4 <'F'
>> >
>> >   -- ~ --- /. ---- <
>> >   │                   -- \ --- / --- +
>> >   │                   │
>> >   │                   │           -- -.
>> > --+             -- @ -+     -- @ -+- +.
>> >   │             │     │     │
>> >   │     -- @: --+     L-----+     -- _1
>> >   │     │       │           L- & -+- |.
>> >   L- & -+       L- =
>> >
>> >
>> >
>> > Begin here with the data:
>> >
>> >         L- <,'&'
>> >
>> >    ]T=:  ;:'4&count int 3 8&inrange'
>> >
>> > --T-T-----T---T---T-T-------┐
>> > │4│&│count│int│3 8│&│inrange│
>> > L-+-+-----+---+---+-+--------
>> >
>> >
>> >
>> > Here's the challenge. Just for fun, write a single line direct
>> definition of
>> > F. Use simple J. You may use @ and name the verb f.
>> >
>> >
>> >
>> >
>> >
>> >    f=: 13 :' (direcct defn) '
>> >
>> >    f T
>> >
>> > ------------T-----T---------------┐
>> > │--T-T-----┐│----┐│----T-T-------┐│
>> > ││4│&│count│││int│││3 8│&│inrange││
>> > │L-+-+------│L----│L---+-+--------│
>> > L-----------+-----+----------------
>> >
>> >
>> >
>> > Apply f to T to get the result.
>> >
>> >
>> >
>> > That is usually enough information for sending a question to the forum.
>> > Advanced programmers could use tacit verbs like Pascal's verb. Often you
>> can
>> > only explain these parts in words. Having a sample of your data and an
>> > indication of whether you are planning one or two arguments for your verb
>> > will help.
>> >
>> >
>> >
>> > Linda
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > Message-----
>> > From: [email protected]
>> > [mailto:[email protected]] On Behalf Of Cliff
>> Reiter
>> > Sent: Monday, January 26, 2015 3:46 AM
>> > To: [email protected]
>> > Subject: Re: [Jprogramming] A parsing challenge
>> >
>> >
>> >
>> > Lovely. Tiny remark:
>> >
>> >
>> >
>> >  <mailto:-.@> -.@+. could be replaced by +:
>> >
>> >
>> >
>> > On 1/26/2015 1:00 AM, Raul Miller wrote:
>> >
>> >> A note of explanation...
>> >
>> >>
>> >
>> >> (I have been noticing that far too much software is poorly documented.
>> >
>> >> And while I cannot do an adequate job of documenting other people's
>> >
>> >> software, I can document software I write.)
>> >
>> >>
>> >
>> >>     F=: </.~ +/\@( <mailto:-.@+._1&;|.)@:=&(%3c,'&')>
>> > -.@+._1&|.)@:=&(<,'&')
>> >
>> >>     T=:  ;:'4&count int 3 8&inrange'
>> >
>> >>
>> >
>> >> The first thing I do is find out where & appears:
>> >
>> >>     =&(<,'&') T
>> >
>> >> 0 1 0 0 0 1 0
>> >
>> >>
>> >
>> >> The second thing I do is rotate to the right and combine:
>> >
>> >>     (+. _1&|.) =&(<,'&') T
>> >
>> >> 0 1 1 0 0 1 1
>> >
>> >>
>> >
>> >> Except I want to mark the beginning of each section with a 1, and
>> >
>> >> right now they are zeros.
>> >
>> >>     ( <mailto:-.@> -.@+. _1&|.) =&(<,'&') T
>> >
>> >> 1 0 0 1 1 0 0
>> >
>> >>
>> >
>> >> As an aside, note that I could have cut that step out if I had started
>> >
>> >> by identifying where & does not appear (and then combine using logical
>> >
>> >> and instead of logical or):
>> >
>> >>
>> >
>> >>     (* _1&|.) ~:&(<,'&') T
>> >
>> >> 1 0 0 1 1 0 0
>> >
>> >>
>> >
>> >> Next, I use plus scan to turn my markers into keys:
>> >
>> >>
>> >
>> >>     +/\ (* _1&|.) ~:&(<,'&') T
>> >
>> >> 1 1 1 2 3 3 3
>> >
>> >>
>> >
>> >> Finally, I use these keys to group the original elements:
>> >
>> >>
>> >
>> >>     T </.~ +/\ (* _1&|.) ~:&(<,'&') T
>> >
>> >> +-----------+-----+---------------+
>> >
>> >> |+-+-+-----+|+---+|+---+-+-------+|
>> >
>> >> ||4|&|count|||int|||3 8|&|inrange||
>> >
>> >> |+-+-+-----+|+---+|+---+-+-------+|
>> >
>> >> +-----------+-----+---------------+
>> >
>> >>
>> >
>> >> And that exposition pretty much follows the thought process I
>> >
>> >> originally used to compose the sentence.
>> >
>> >>
>> >
>> >> Thanks,
>> >
>> >>
>> >
>> >
>> >
>> > ----------------------------------------------------------------------
>> >
>> > For information about J forums see  <http://www.jsoftware.com/forums.htm
>> >
>> > 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
>>
> ----------------------------------------------------------------------
> 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