On Thu, Mar 4, 2010 at 7:52 AM, Roger Hui <[email protected]> wrote:

> ,~/ involves lots of data movement whereas -~/ does not.
>
> The "special codes" are documented in
> Appendix B of the dictionary.
> http://www.jsoftware.com/help/dictionary/special.htm
>
> -~/ is not supported by special code.  You can confirm
> that by comparing the timings for +/ -/ and -~/ .
>
> You would avoid ,~/ for reasons other than machine
> efficiency:  ,|. (or just |. for vectors) are more direct,
> i.e. more brain efficient.
>
>
ah. Now I know why. ,~/ in J is more like '++'(append to a list, an O(n) for
each element) in Haskell rather than the (:) which is an O(1) . I know |.
serve the same purpose but tried to get a sense of what kind of function
composition I should avoid.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to