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

But does it generalize? $a > 10 is easy but what if you want "where $a and $b are coprime"? Or a subtype of the integers of all prime numbers.


Yes, "$a > 10" isn't special, any boolean expression in its place is perfectly legal. Define coprime(Int a,Int b) -> Bool and request that coprime($a,$b) holds in the Where clause, define prime(Int a) -> Bool and request it holds for both $a, $b.

The same machinery that runs "<" or ">" at runtime would just as well run coprime and prime.




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

Search: