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

Is the choice operator somehow analogous to OR? If not, why not just choose any other syntax than `|`?


It is or... i.e x := (3 | 4) means x is either 3 or 4. The ; seems to be basically be an and. The evaluation finds an assignment of the values such that the world is true. For instance x:= (3 |4); (x % 2 = 1); x evaluates to 4. Type checking and evaluation seem to be the same thing... so x:= (int | string) x = ("hello" | 4.3); x might evaluate to "hello"




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

Search: