Nice example, David. Very nice.
Worth working up into a J Lab and offering for publication in one of
the many magazines for science teachers?
I saw this demo-ed in APL once long ago (early 80s), where overtly APL
syntax was hidden under a collection of cover functions, to make a
potted "natural language" interface.
I forget the author -- can any (ex) IBMer remember him? Educational
Customer Engineer, if I recall.
The result supported a lab class in basic Dynamics.
UK educationalists apt to scorn the promotion of APL as a medium in
which to "do" classroom physics were notably taken with the demo.
J is better than APL in this regard, thanks to Adverbs. Thus: "5 ft"
had to be represented as:
distance ← 5 ft ''
giving the function 'ft' a compulsory dummy right arg: ''
And little could be done to disguise the APL assignment primitive (←).
Here's the flavour (in J) of what the author was trying to achieve in APL:
----
NB. Script given to class...
require 'plot'
size=: 1 : '$x' NB. Thank You, David...
plot3d=: 'surface'&plot
sin=: 1&o.
ints=: i:
in=: j.
range=: of=: ] NB. just noise-words (optional)
steps=: 1 : 'x' NB. another optional noise-word
tabulated=: +/~
is=: 4 : 'i.0 0 [ (x)=:y'
NB. Examples performed by class...
plot3d tabulated sin of ints range 6 in 99 steps
'table' is tabulated sin ints 6j99
table size
plot3d table
----
And (teachers facing cutbacks please note:) the software is FREE !
On Tue, Apr 12, 2011 at 2:29 PM, David Ward Lambert
<[email protected]> wrote:
> I don't have the tacit adverb under my belt yet. However, I've started
> to use more adverbs. Saves on parens, eg: 8 inches squared ; expr1
>
> squared=: 1 : '*:x'
> inches=: 1 : '0.0254*x'
> 8 inches squared
> 0.0412902
>
>
> On Tue, 2011-04-12 at 02:54 +0800, [email protected]
> wrote:
>> Date: Mon, 11 Apr 2011 09:26:39 +0100
>> From: Steven Taylor <[email protected]>
>> Subject: [Jprogramming] 1 : n adverb
>> To: Programming forum <[email protected]>
>> Message-ID: <[email protected]>
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> ref: http://www.jsoftware.com/help/dictionary/d310n.htm
>>
>> Hi,
>>
>> I had a little look around for usage / examples of 1 : n adverb
>> definition.
>> Do any http:// links come to mind?
>>
>> thanks,
>> -Steven
>>
>>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm