bug-apl
[Top][All Lists]
Advanced

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

[Bug-apl] Scan operator has strange behaviour


From: Elias Mårtenson
Subject: [Bug-apl] Scan operator has strange behaviour
Date: Wed, 19 Mar 2014 21:22:04 +0800

The following code returns the expected results:

      {⍺+⍵}\⍳10
1 3 6 10 15 21 28 36 45 55

However, if I also print all the calls, I get a lot more evaluations of the function than expected:

      {(⍺+⍵)⊣⎕←('[',(⍕⍺),',',(⍕⍵),']')}\⍳10
[1,2]
[2,3]
[1,5]
[3,4]
[2,7]
[1,9]
[4,5]
[3,9]
[2,12]
[1,14]
[5,6]
[4,11]
[3,15]
[2,18]
[1,20]
[6,7]
[5,13]
[4,18]
[3,22]
[2,25]
[1,27]
[7,8]
[6,15]
[5,21]
[4,26]
[3,30]
[2,33]
[1,35]
[8,9]
[7,17]
[6,24]
[5,30]
[4,35]
[3,39]
[2,42]
[1,44]
[9,10]
[8,19]
[7,27]
[6,34]
[5,40]
[4,45]
[3,49]
[2,52]
[1,54]
1 3 6 10 15 21 28 36 45 55

This can't possibly be correct?

Regards,
Elias

reply via email to

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