Live data from Hacker News

Clean – A functional programming language

clean.cs.ru.nl

11–20 of 68 posts

Re: Clean – A functional programming language

#11

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'…

[deleted]

Re: Clean – A functional programming language

#12

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'…

the definition of fact ends when the lines starting with fac end. they aren't doing something nuts like mixing up lines of a function definition if that's what you're getting at.

also, this is syntactic sugar for a case statement.. and you couldn't just use those.

Re: Clean – A functional programming language

#13

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'…

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!

Re: Clean – A functional programming language

#15
post #4

You 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?

According to the wiki linked into the other answer

> 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

#16
post #9

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'…

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…

> I worry about why it doesn't have to say abs(n) but then I remember two negatives multiplied together are positive.

The function doesn't terminate if n is negative, so you are right to worry!

Re: Clean – A functional programming language

#17
post #13

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'…

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.

Re: Clean – A functional programming language

#18

You 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.

An additional hurdle may be it's use of uniqueness typing (http://clean.cs.ru.nl/download/html_report/CleanRep.2.2_11.h...), which it uses for IO instead of monads.

In my experience with Clean, uniqueness typing has been some kind of magic.

Re: Clean – A functional programming language

#19

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'…

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.

There would be

Re: Clean – A functional programming language

#20
post #17
post #13

Earlier 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 Haskell it certainly is a closed definition, you would get a "multiple declarations" syntax error if you tried to split the definition up. I would assume the same for Clean also.

In the Haskell REPL, you would need to enter the definitions together.

Post reply on HN