The thing about syntax like this fac :: Int -> Int fac 0 = 1 fac n = n * fac (n-1) to me, is that all the statements of this function declaration seem "disconnected". I'm guessing the "fac" connects them but it seems less clear than open-closed brackets in a c-like language (and also more cluttered). Especially, I'm not sure what tells me I've reached the end of the function declaration. This may seem trivial but it'…
Clean – A functional programming language
11–20 of 68 posts
Re: Clean – A functional programming language
#12The thing about syntax like this fac :: Int -> Int fac 0 = 1 fac n = n * fac (n-1) to me, is that all the statements of this function declaration seem "disconnected". I'm guessing the "fac" connects them but it seems less clear than open-closed brackets in a c-like language (and also more cluttered). Especially, I'm not sure what tells me I've reached the end of the function declaration. This may seem trivial but it'…
also, this is syntactic sugar for a case statement.. and you couldn't just use those.
Re: Clean – A functional programming language
#13The thing about syntax like this fac :: Int -> Int fac 0 = 1 fac n = n * fac (n-1) to me, is that all the statements of this function declaration seem "disconnected". I'm guessing the "fac" connects them but it seems less clear than open-closed brackets in a c-like language (and also more cluttered). Especially, I'm not sure what tells me I've reached the end of the function declaration. This may seem trivial but it'…
In Haskell you could always avoid that style and use the case syntax (or for this example guard syntax) instead. All varieties eventually desugar to a case analysis anyway. Haskell even added curly braces as an alternate to indentation!
Re: Clean – A functional programming language
#14Re: Clean – A functional programming language
#15You wonder why Clean isn't as popular as Haskell and Ocaml. I've read it's the lack of community. The name doesn't help either.
The only reason why clean has always been confidential is this: "Developers wishing to distribute commercial applications (either publicly or privately) can purchase a commercial license." Although there seams to be a dual license now? Can anybody with more understanding of legal verbiage confirm that if I choose to use the bsd+lgpl then the above restriction don't hold anymore?
> The company is not claiming that you can't sell your programs. The licensing only matters when it comes to modifying the compiler itself.
which it makes sense. The language runtime is LGPL but the program you write is anything you want.
At http://clean.cs.ru.nl/download/Clean24/CleanLicenseCondition...
> Clean is available under a dual license. Users can choose which of these two licenses they wish to operate under:
> 1 The Simplified BSD License (see below) applies to the libraries, runtime system and examples, the LGPL the standard GNU Lesser General Open Source license (see below) to the rest. The libraries, runtime system and examples consist of the files in the following directories (including subdirectories of these directories):
> - Libraries and Examples (versions for Windows)
> - StdEnv, data and examples (versions for Linux and Mac OS X)
> - libraries, RuntimeSystem and CleanExamples (source code).
> 2 A commercial license (see below) that can be purchased. Information on that license can be obtained from [check the original document for name and email]
So, it should be ok as using any LGPL library on any proprietary program. I wonder if they are making any money from the commercial license or this confusion is only harming the language.
Re: Clean – A functional programming language
#16The thing about syntax like this fac :: Int -> Int fac 0 = 1 fac n = n * fac (n-1) to me, is that all the statements of this function declaration seem "disconnected". I'm guessing the "fac" connects them but it seems less clear than open-closed brackets in a c-like language (and also more cluttered). Especially, I'm not sure what tells me I've reached the end of the function declaration. This may seem trivial but it'…
I have struggled with FP for many years. What I try and do, is approach these concepts with an open mind and I look for ways of 'saying' what I see which I then rehearse with my FP friends and stick to the one which does not make them wince when I say it. So this says three true things we know about this 'fac' Firstly it says it takes an int and it returns an int. Secondly that if the int it takes is specifically zer…
The function doesn't terminate if n is negative, so you are right to worry!
Re: Clean – A functional programming language
#17The thing about syntax like this fac :: Int -> Int fac 0 = 1 fac n = n * fac (n-1) to me, is that all the statements of this function declaration seem "disconnected". I'm guessing the "fac" connects them but it seems less clear than open-closed brackets in a c-like language (and also more cluttered). Especially, I'm not sure what tells me I've reached the end of the function declaration. This may seem trivial but it'…
The style is lifted straight from mathematics tradition. It is a closed definition and so it would be syntax error to insert anything between the lines. In Haskell you could always avoid that style and use the case syntax (or for this example guard syntax) instead. All varieties eventually desugar to a case analysis anyway. Haskell even added curly braces as an alternate to indentation!
If clean has a REPL (which I couldn’t easily find out from its web page) I expect it to have that, too.
Re: Clean – A functional programming language
#18You wonder why Clean isn't as popular as Haskell and Ocaml. I've read it's the lack of community. The name doesn't help either.
In my experience with Clean, uniqueness typing has been some kind of magic.
Re: Clean – A functional programming language
#19The thing about syntax like this fac :: Int -> Int fac 0 = 1 fac n = n * fac (n-1) to me, is that all the statements of this function declaration seem "disconnected". I'm guessing the "fac" connects them but it seems less clear than open-closed brackets in a c-like language (and also more cluttered). Especially, I'm not sure what tells me I've reached the end of the function declaration. This may seem trivial but it'…
I don't program in functional environments, however this seems beautiful to me. I do understand your argument and tend to agree, I would like to see a syntax error if there is anything between the multiple lines of implementation.
Re: Clean – A functional programming language
#20Earlier quoted context omitted.
The style is lifted straight from mathematics tradition. It is a closed definition and so it would be syntax error to insert anything between the lines. In Haskell you could always avoid that style and use the case syntax (or for this example guard syntax) instead. All varieties eventually desugar to a case analysis anyway. Haskell even added curly braces as an alternate to indentation!
Is it a closed definition? The equivalent in Mathematica would allow one to add things whenever one wants, for example to add definitions for fac for negative integers, or to hard-code the value of fac 100 . If clean has a REPL (which I couldn’t easily find out from its web page) I expect it to have that, too.
In the Haskell REPL, you would need to enter the definitions together.