bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Non-bug: Help comparing solutions


From: Jay Foad
Subject: Re: [Bug-apl] Non-bug: Help comparing solutions
Date: Thu, 6 Mar 2014 10:09:53 +0000

>> Even the classic example of a fork (+/÷≡) is harder to read than its
>> functional version {(+/⍵)÷≡⍵} and it goes downhill from there with longer
>> trains. But maybe it's just me being unfamiliar with the syntax.
>
>
> Did you intend to use ⍴ instead of ≡ there? I can't see how {(+/⍵)÷≡⍵} could
> ever be useful?

I guess Tobia meant ≢. Monadic ≢ is Tally, which gives you the length
of an array along the first axis (in NARS2000 and Dyalog version 14
and probably others).

Incidentally, if you're taking the length along the first axis, you
should probably reduce along the first axis too:

      +⌿ ÷ ≢
      {(+⌿⍵)÷≢⍵}

This will give you a useful result on matrices and higher-ranked arrays.

Jay.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]