Pascal Jasmin wrote:
> I Prefer using the definition
> select=: 1 : 'u # ]'
> 
> instead of your hook below.
> I find it much easier crafting compound conditions (for example >4 and <8)
> 
>    4&< select some_numbers
> 5 7 9
>    (8&> *. 4&<) select some_numbers
> 5 7
> 
> seeing a select statement in a sentence also helps me realize what its doing 
> in a way that # wouldn't because it is more vague, and its position in a 
> train is less recognizable.  Also, 4 verb trains make this way to filter a 
> bit daunting on beginers, I think the adverb version is just much easier.
> 
> 
> ----- Original Message ----
> From: Dan Bron <[EMAIL PROTECTED]>
> 
> 
>        (#~ 4 < ]) some_numbers
>     7 9 5

FWIW, this is just matter of habit, some J users prefer using idiom (as-is,
without name) instead of utility function, eg.
  (#~ v) to select using boolean
  ({~ v) to select using index
so that the phrase
  (#~ 4 < ]) some_numbers
is not mentally parsed from the right; the leftmost #~ will indicate this is a
selection idiom.

Just like you don't need to parse the formula
x= -b +- sqrt(b^2 - 4ac) / 2a
but simply recognize it as the root of quadratic equation.

you may find the following useful,
J Phrases by jsoftware

An Encyclopeda of APL by Garry Helzer
  This book although written for I-APL, gives very useful comments and idioms
for each verb. Contact Anatony Camacho if he still have it stocked.

-- 
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to