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