Re:Clean – A functional programming language
by always_good on Saturday December 16, 2017 @07:55AM
(#15939333)
Might be cool to just overload in the function body instead of at the top level:
[ Parent
| on HN ]
Re:Clean – A functional programming language
by mrkgnao on Saturday December 16, 2017 @10:17AM
(#15939873)
In Haskell:
fac :: Int -> Int
fac x = case x of
0 -> 1
n -> n * fac (n-1)
or even {-# LANGUAGE LambdaCase #-}
fac :: Int -> Int
fac = \case
0 -> 1
n -> n * fac (n-1)
Re:Clean – A functional programming language
by joe_the_user on Saturday December 16, 2017 @04:29PM
(#15942239)
Just adding parenthesis to the original would make it clearer and closer to the mathematics expresses the structure. Especially given that parenthesis are clearly used sometimes to designate arguments in here.
fac :: Int -> Int
fac(0) => 1
fac(n) => n * fac(n-1)
Re:Clean – A functional programming language
by thepratt on Saturday December 16, 2017 @08:00AM
(#15939351)
What you're describing is the exact same, just different syntax.
Re:Clean – A functional programming language
by always_good on Saturday December 16, 2017 @08:07AM
(#15939369)
Yes, we are talking about syntax.
OP's first four words: "The thing about syntax".
Re:Clean – A functional programming language
by thepratt on Monday December 18, 2017 @04:39AM
(#15950511)
No, the comment replied to has the first four words "Might be cool to". The differences are so minuscule that the argument could be made for it to be 2 differing standards for the same language.
Re:Clean – A functional programming language
by always_good on Wednesday December 20, 2017 @06:32PM
(#15974892)
I don't understand your point, much less why you're using the "first four words" thing back at me on my own comment.
The differences may be miniscule. They are syntactic. "Might be cool to" have this other syntax. You're just belaboring the obvious.
Re:Clean – A functional programming language
by coldtea on Saturday December 16, 2017 @10:41AM
(#15939974)
That's the whole point. Syntax can be very influential in how people use (or don't) a language
Re:Clean – A functional programming language
by thepratt on Monday December 18, 2017 @04:43AM
(#15950523)
Yes and no. For what I replied to is essentially garden shedding the language. The overall problem is grasping the concepts, weather or not you want es6 style lambdas, or proper haskell function definitions is irrelevant if you don't understand the concepts.