You could put this code in an infinite loop and have your first version of S?
t =: (1!:1) 1
vname =. t {~ i. 0 { '=:' i.~ t
fdef =. t {~ <: |. (#t) - i. 1 { '=:' i.~ t
fdef =. '3 : ''',fdef,''''
". vname, '=:', fdef
Obviously, the code coud be a lot tidier and more bits could be added.
On Fri, May 1, 2009 at 11:14 AM, Don Watson <[email protected]> wrote:
> Hi Ric,
>
> You wrote:
>
>> ''Let
>> mean=: (+/y) % #y
>> ssdev=: +/ *: y - mean y
>> var=: (ssdev y) % <:#y
>> stddev=: %: var y
>> )
>
> Tacit J is a central component of J that is introduced early in the
> documentation All I really want is a mode in which I can remove the
> surrounding material and just write:
>
> mean=: (+/y) % #y
> ssdev=: +/ *: y - mean y
> var=: (ssdev y) % <:#y
> stddev=: %: var y
> stddev2=: %: (% <:#y) * +/ *: y - (+/y) % #y
>
> That's not a lot to ask. I'll give up on replacing the x and y with [ and ].
>
> Anyway, I have some work to do, I'll be back.
>
> Don
>
> ----- Original Message -----
> From: "Sherlock, Ric" <[email protected]>
> To: "Chat forum" <[email protected]>
> Sent: Friday, May 01, 2009 3:25 AM
> Subject: Re: [Jchat] Language S
>
>
>> Don,
>>
>> So far the all the evidence and advice brought up in this thread suggests
>> that:
>> * explicit reference to arguments in equations is likely to be less
>> confusing to math students (or beginning J users) than tacit or
>> implicit references.
>> * the use of a little additional syntax to define verbs presents
>> little or no barrier to students unfamiliar with J and/or
>> programming.
>>
>> I wonder at this point whether you would be receptive to going back to an
>> earlier suggestion in post by Oleg proposing a "verb definition mode"?
>>
>> The implementation details are specified on the wiki page:
>> <http://www.jsoftware.com/jwiki/Phrases/Definitions>
>>
>> If the adverb "defn" on that page were renamed "Let" you could use it in a
>> session like this:
>>
>> ==============
>> NB. blah blah intro
>> NB. For:
>> y=: 3 4 9 4 3 8 5
>> NB. The mean is
>> (+/y) % #y
>> 4.6
>>
>> NB. ... when want to define verbs:
>>
>> ''Let
>> mean=: (+/y) % #y
>> ssdev=: +/ *: y - mean y
>> var=: (ssdev y) % <:#y
>> stddev=: %: var y
>> )
>> mean y
>> 4.6
>> ssdev y
>> 29.2
>> var y
>> 7.3
>> stddev y
>> 2.70185
>>
>> ==================
>>
>> If you wanted to get really picky you could define a noun
>> Now=: 'whatever you like cause it just gets ignored'
>>
>> So that you could write:
>>
>> Now Let
>> coeffvar=: (stddev y) % mean y
>> )
>>
>> That's getting pretty close to the treatment of equations in a text book?
>>
>> Note you are free to make the definition for stddev one big line if you
>> like, I just think that dividing it up into meaningful bits as above is
>> more illuminating (not to mention flexible).
>>
>>
>> ----------------------------------------------------------------------
>> 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