Sunday, May 18, 2014

Simple Way to Remember Monadic Hooks

A simple to remember the rules of J Hooks is to use the very simple verbs:


v1 =. +!
and
v2 =. +@:!

v1 is a hook while v2 is a simple vrb train that applies ! and then + to the argument(s).

Example

arg =. 1 2 3 4

v1 arg  2 4 9 28
v1 applies ! to each element and then applies + to the result and the original argument.
i.e. 1+1! =2, 2+2!=4 etc.

If you forget how Hooks work, it may be useful to consider this simple case and then you should be able to figure out how to write your verb train correctly.

No comments:

Post a Comment