bug-apl
[Top][All Lists]
Advanced

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

[Bug-apl] Bug in the parser?


From: Elias Mårtenson
Subject: [Bug-apl] Bug in the parser?
Date: Tue, 25 Nov 2014 14:16:49 +0800

Given a typical implementation of prime-finding, the following _expression_ works fine:

      (2 = +/[1] 0 = m ∘.| m) / m←⍳N
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

However, trying to swap the sides of the selection gives an error message:

      m /⍨ 2 = +/[1] 0 = m ∘.| m←⍳N
SYNTAX ERROR
      m/⍨2=+/[1]0=m∘∘.∣m←⍳N
      ^ ^

Adding a parentheses around the right-hand side does not work:

      m /⍨ (2 = +/[1] 0 = m ∘.| m←⍳N)
SYNTAX ERROR
      m/⍨(2=+/[1]0=m∘∘.∣m←⍳N)
      ^  ^

However, placing parens around the m makes it work:

      (m) /⍨ (2 = +/[1] 0 = m ∘.| m←⍳N)
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

Another way of getting rid of the error is to place parens around the function:

      m (/⍨) (2 = +/[1] 0 = m ∘.| m←⍳N)
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

This surely can't be right?

Regards,
Elias

reply via email to

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