hi Mr Kane..
from a novice perspective (having come from those pitfalls only
recently) i notice (as well as the assignment lapse, which i continjue
to do all the time) 2 errors in the use of :[ return ]:
i.e...
:[ return t ]: should actually be :[ t return. ]: for it to work as i'm
guessing you expect (returning the value "t"?).
First problem... missing :[ . ]: from the end of "return".
Second... :[ return. t ]: wouldn't return the value "t" after it. It
would quit immediately returning the most recent expressed value
*before* the return. So, if you want to return the value "t" ... :[ t
return. ]:
........
(nb.^:1) i like to use :[ return. ]: as an explicit marker to help with
cursory examination of a construction. I don't know if a superfluous :[
return. ]: has a performance penalty, but until i create something where
it makes a difference, i find it useful.
(nb.^:2) i'm toying with using :[ ... ]: in emails to isolate bits of J
within text to make it stand out. I've not decided yet if it looks too
silly to continue using.)
On 2011-08-08 03:56, nykkyo Kane wrote:
> Following is a creenshot of my "J" console. I do not understand why I am
> getting a error>
> =================
> compress 4 : 0
> i =. 0
> t =. 0$0
> while. i< $x do.
> if. 1 = i{x do. t =. t , i{y end.
> i =.>:i
> end.
> return t
> )
>
> compress 4 : 0
> i =. 0
> t =. 0$0
> while. i< $x do.
> if. 1 = i{x do. t =. t , i{y end.
> i =.>:i
> end.
> return t
> )
> b compress a
> |value error: compress
> | b compress a
> a
> 11 12 13 14 15 16 17 18 19 20
> b
> 1 0 1 0 1 0 1 0 1 0
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm