Although it is executed fro right to left,
it usually read and possibly written from
left to right. Speaking of a vector,

  Length is "root" of the "sum" of "squares"

   %: +/ *: 3 4
5

   len=: %: @ +/ @: *:
   len 3 4
5

   or "sum" "under" "square"

   +/ &.: *: 3 4
5


Moreover, this is the easiest and shortest way to say it.



--- Brian Schott <[EMAIL PROTECTED]> wrote:

>       The example below shows how J code for one-liners
> can be entered on a keyboard more like it is developed -- at
> least by me. J parses from right to left and so I find that
> my code is written from right to left, but with the existing
> user interface the code must be entered left to right. While
> there is likely no way to completely alter this situation,
> the examples below may help a little.
> 
>       The example only works in the jconsole mode in
> unix/linux for now and I am not sure how to make it work in
> an ijx window -- maybe someone can help with that. I don't
> even know how to make it work in windows jconsole.
> 
>       The main idea is captured by the verb rc which
> parses tacit verbs pretty well.  But one-liner explicit
> definitions are more complicated; the long bit of code which
> follows is a first crack at parsing one-line explicit verbs.
> See the full script far below, please.
> 
> "."1;:^:_1"1(([: mt&,[:,&''''[:rc [: }:[: }.])^:(mt&-:@{.))each@:;:;._1 temp
> 
>       I welcome suggestions.
> 
> (B=)
> 
> Brian Schott
> Atlanta, GA, USA
> schott DOT bee are eye eh en AT gee em ae eye el DOT com
> http://schott.selfip.net/~brian/
> 
> NB. jread.ijs
> NB. 2/18/5
> NB. 4/10/6 revised
> 
> NB. routines to facilitate one-liner definition writing
> NB. from left to right ******
> 
> rc =: |.&.;:
> keyboardIn =: [: 1!:1 3:  NB. unix only
> 
> NB. usage: rc '[EMAIL PROTECTED]'
> 
> NB. usage:  read''   (in unix only)
> NB. enter as many lines as desired
> NB. then type Ctrl-D to break
> 
> NB. this system gets confused by parens
> NB. so they must be entered backwards (see example below)
> 
> mt =: ''''
> read =: monad define
>   temp =: rc keyboardIn y.
> "."1;:^:_1"1(([: mt&,[:,&''''[:rc [: }:[: }.])^:(mt&-:@{.))each@:;:;._1 temp
> )
> 
> test =: noun define
>   read'' NB. press Ctrl-d to end
>   %@:/+=:mean
>   'y. {. 2 / + ~ - 10 * >:' : 13=:rind
>   }.&2 ; {.&)1+2(=:sparer
> 
>   NB. press Ctrl-D after the sparer definition above
>   NB. then you can view the saved definitions by type
>   NB. the following names
>   mean
>   rind
>   sparer
> )
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to