On 6 July 2016 at 20:31, Xiao-Yong Jin wrote:
> I’m not sure which one is at fault here. Any idea?
The standard explicitly says A f.g B ←→ f/A g B when A & B vectors.
A←⊂[1]⍳2 3
B←⊂[1]10×⍳2 3
GNU APL is at fault here:
{⍺+.+⍵}/A+B
165 242
(+.+)/A+B
209 198
But in the
The clearest and most versatile idiom for me would be
⍎ ('case1' 'case2' 'case3' ...)[tests]
This acts exactly like a case statement (and by extension like an if/else).
For example:
'/' {⍎ ('+-×÷')['+-*/' ⍳ ⍺] , '/⍵'} 2 .5
yields 4.
If you want to select the corresponding case from a list of tests,
The following from GNU APL,
(⊂[1]⍳2 3)+.+.+⊂[1]10×⍳2 3
209 198
(⊂[1]⍳2 3)(+.+).+⊂[1]10×⍳2 3
209 198
(⊂[1]⍳2 3)+.(+.+)⊂[1]10×⍳2 3
33 66 66 66
do not agree with Dyalog APL,
⎕ML
3
(⊂[1]⍳2 3)+.+.+⊂[1]10×⍳2 3
165 242
(⊂[1]⍳2 3)(+.+).+⊂[1]10×⍳2 3
165
Hi Xiao-Yong,
thanks, fixed in SVN 771.
/// Jürgen
On 07/05/2016 10:12 PM, Xiao-Yong Jin
wrote:
Hi, here goes another micro error.
2 3+.{⍺×⍵}2 3
LENGTH ERROR
μ-Z__A_LO_INNER_RO_B[5] (μ-IA μ-IB)←⊃μ-I[μ-N]
Hi Kacper,
I agree. I was also thinking of the power operator but then could
not find the right way of using it.
Your solution is very elegant and clear.
/// Jürgen
On 07/06/2016 03:10 AM, Kacper Gutowski
wr