Re:Clojure vs. The Static Typing World
by tome on Saturday October 28, 2017 @05:49PM
(#15576869)
Where did I specify types here?
[ Parent
| on HN ]
Re:Clojure vs. The Static Typing World
by wellpast on Saturday October 28, 2017 @06:51PM
(#15577088)
They are specified in the definition of the operators. Define a new operator '%' that concatenates two numbers together and then show me how in Haskell you would do:
myfun x y = x ^ 2 % 2 * y * x - y ^ 2What does it mean to "concatenate two numbers together"?
55 % 102 would produce 55102
I made it up.And what does 55.1 % 102 produce? 1e-12 % 3i+12?
And if your answer is "I only need it to work on integers" then don't blame Haskell when I choose to specialise it to Int!
I'm a bad product manager. The % should round the value to a tenth and then concat.
This is a silly example, of course, but the real world isn't short on creativity/silliness.
And for complex numbers?
Precondition: complex numbers are not supported. Unspecified behavior.