David Ward Lambert <[email protected]> wrote:
> http://www.jsoftware.com/jwiki/Doc/J4APL
>
> The document claims this:
>
>
>  newton=. -:@(+ 2e4&;%)
>
>  newton newton newton 1
> 2502.62
>
>
>
> However, as you can tell, it won't work in current j version.
>
>  newton 1
> |domain error: newton
> |       newton 1

It appears to be a typo on the web page. There should be no semicolon:

   newton=. -:@(+ 2e4&%)
   newton 1
10000.5
   newton newton newton 1
2502.62


Also, I noticed the very next section says:

> Diamond Separator
> There is no equivalent of APL's ◊ separator used to enter several statements 
> on a single line. However, you > can obtain similar behavior using the verb [ 
> same which returns its left argument. Using this, statements > are evaluated 
> right to left.

In fact, you CAN get this behavior in J (within definitions) by using
'label_.' instead of diamond:
   3 : 'smoutput''A'' label_. smoutput''B'' label_. smoutput ''C''' 0
A
B
C

-- Mark D. Niemiec <[email protected]>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to