Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Maybe I’m missing something, but at the bottom there are these two statements:

  7×3 ⍝ Dyadic × is multiplication
  ׯ7 ⍝ Monadic × is 'direction', or signum (the sign, in our case). Thanks.
And looking at the output I can see:

  21
  ¯1
Is it a typo or really -7 is becoming -1 for some esoteric reason that escapes my comprehension?


It's not a typo. Monadic × will return 1 if the right argument is positive, ¯1 (minus one) if it is negative, and zero if it is zero.


It's the sign of the number. -7 is negative so you get -1. 7 gives you 1 and 0 gives 0.

  ×-7
  ¯1
  ×7
  1
  ×0
  0




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: