Functional languages -- any recommendations?

Haskell, Scala, or Erlang? Which one is the best?

···

--
Posted via http://www.ruby-forum.com/.

I don't know, but I did enjoy Try Haskell (Try Haskell! An interactive tutorial in your browser) It's
based off of _why's Try Ruby. It goes pretty quick, though I already had a
pretty good idea how it should work and what to expect.

Haskell will be my next language (okay, after I put some time into
JavaScript) because I'm fascinated by its laziness and its type system
(that, aside from all the stuff that comes from being functional).

I also intend to put some time into Clojure, which I've played with a few
times.

···

On Mon, Apr 4, 2011 at 8:17 PM, 7stud -- <bbxx789_05ss@yahoo.com> wrote:

Haskell, Scala, or Erlang? Which one is the best?

That would depend on what you mean with "best".

AFAIK, of the three you mentioned, Erlang is in widest use, but that
doesn't mean that it is "the best", either (but it'll be easier to
find real-world examples).

And just to make a bad situation worse, let me throw out Clojure, for
when you are dealing with a JVM, F# if you are dealing with .NET (I
have no idea about Mono support), or Scheme if you are coming from a
LISPing background (pardon the pun).

···

On Tue, Apr 5, 2011 at 3:17 AM, 7stud -- <bbxx789_05ss@yahoo.com> wrote:

Haskell, Scala, or Erlang? Which one is the best?

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

Erlang is surprisingly close to Ruby in ways you would not believe.

···

On Mon, Apr 4, 2011 at 7:17 PM, 7stud -- <bbxx789_05ss@yahoo.com> wrote:

Haskell, Scala, or Erlang? Which one is the best?

--
Tony Arcieri
Medioh! Kudelski

7stud -- wrote in post #990914:

Haskell, Scala, or Erlang? Which one is the best?

I'd say Erlang would be the easiest to get your head round. It lets you
create lightweight processes which can send explicit messages to each
other, and keep their own state. This is pretty similar to the concept
of "objects", except because it uses real message passing, it eliminates
many of the problems of threads. Furthermore, your processes could be on
the same machine or on different ones, and nothing changes in the code.

Calling a function in Erlang can have side effects (in particular, the
sending of a message), and hence it's not a true functional language.

···

--
Posted via http://www.ruby-forum.com/\.

What about Racket, the descendent of PLT scheme?

http://racket-lang.org/

I'd say it's just as good for learning about functional programming as
the others, but it also makes it easy to write something useful.

For instance, it has a nifty DSL for writing web-sites. Unimaginatively
of me, here is an example from their home page:

#lang web-server/insta
;; A "hello world" web server
(define (start request)
(response/xexpr)
  '(html
    (body "Hello World")))

The standard libraries include a web-server, and if you use that DSL,
it'll start it up for you, and just serve your site, no extra
configuration required. Which is pretty cool for learning at least.

It comes with OpenGL too, which is great if you like writing games :smiley:

Also, it supports objects and classes, so you won't into the problems
described below.

Not so many libraries as Scala and Haskell though. And slower too.

You can tell I'm a "fan-boy". I swear I'm not a PLT plant!

But on to the others:

Haskell doesn't have the feature called inheritance in Object Oriented
Languages*.

Living without objects is okay, but it means you can't create a new
data-type that inherits members from another data-type.

It has other mechanisms for code-reuse, but sometimes things which
would be really simple with, for example, a template method, into a bit
of an exercise in formal logic. Still, that's okay because that's
pretty much how you program the whole of the system in Haskell.

Haskell has a really cool macro system called Meta-Haskell. It's
basically like an interface to a compiler front-end so you can create,
explore or transform a Haskell abstract syntax tree, or fragments
thereof. It's super-awesome :smiley:

Erlang doesn't have inheritance either but it doesn't become an exercise
in logic the same way because it doesn't have static-typing.
IIRC their structures are just transformed into a vector or something at
compile time, there's no real notion of a member of a data-structure.

I really like erlang though, the syntax is cool. Commas.

Apologies for the long post!

* Haskellers would probably call inheritance "sub-type polymorphism",
  sitting in their tweed and smoking their pipes, etc.

···

On Tue, 5 Apr 2011 10:17:39 +0900 7stud -- <bbxx789_05ss@yahoo.com> wrote:

Haskell, Scala, or Erlang? Which one is the best?

7stud -- <bbxx789_05ss@yahoo.com> writes:

Haskell, Scala, or Erlang? Which one is the best?

I'd say #{language_i_use} is by far the easiest of these to pick up. A
lot of people use #{one_of_the_others} because of #{some_feature}, but
it's more of a pain to use. In particular #{language_i_use} is a lot
like Ruby in ways that will surprise you.

I'd stay away from #{the_third_one}, because it has much more of a
learning curve.

Also, have you considered #{language_not_mentioned}? It's particularly
neat if you're using #{some_system}.

···

--
        Jim Wise
        jwise@draga.com

Yes.

···

On Tue, Apr 05, 2011 at 10:17:39AM +0900, 7stud -- wrote:

Haskell, Scala, or Erlang?

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

You could add Clojure to that list, it would probably be a better
(more marketable) skill to acquire than erlang or haskell and less of
a learning curve than scala (YMMV).

But you could probably pick up erlang pretty fast regardless.

Now that I think about it, the template method is a bad example.

In Haskell you can inherit from abstract interfaces - you can't inherit
from a data structure.

So you can easily have a template method, it's just that it would have
to defined as part of the abstract interface.

So each child that implements the template would have to implement the
interface. Then since you can't inherit from the data type, the
children must be a whole new type which has the parent as a member, and
pass that to the template method.

At this point any functions which could have been run on the parent
will now have to be reclared for the child :frowning:

Then again with the separation of code and data you start to consider if
that really is the structure of your program.

But usually by that time in Ruby, I'm already done!

In conclusion, I'm too stupid to program in Haskell. If you choose it,
good luck.

Cheers,
Johnny

···

On Tue, 5 Apr 2011 18:13:44 +0900 Johnny Morrice <spoon@killersmurf.com> wrote:

Haskell doesn't have the feature called inheritance in Object Oriented
Languages*.

Living without objects is okay, but it means you can't create a new
data-type that inherits members from another data-type.

It has other mechanisms for code-reuse, but sometimes things which
would be really simple with, for example, a template method, into a
bit of an exercise in formal logic. Still, that's okay because that's
pretty much how you program the whole of the system in Haskell.

Johnny M. wrote in post #990966:

Erlang doesn't have inheritance either but it doesn't become an exercise
in logic the same way because it doesn't have static-typing.
IIRC their structures are just transformed into a vector or something at
compile time, there's no real notion of a member of a data-structure.

You're probably thinking of "records", which are basically just named
offsets into a tuple.

There are proper data structures too, such as "dict" which is somewhat
like a ruby Hash.

It can be a bit overwhelming at first having all the different built-in
types: tuple, list, binary (when you'd just use Array in ruby)

I really like erlang though, the syntax is cool. Commas.

It takes some grokking as to when you need a comma, when you need a
semicolon, and when you need a dot. Erlang has great semantics and
terrible syntax.

···

--
Posted via http://www.ruby-forum.com/\.

i think you are totally wrong about #{language_you_use} because
#{feature_i_think_sucks} makes the language unintelligible. personally i
find #{language_i_use} to be the uber be-all-end-all of languages.

though i do agree that #{current_thread} is kind of wonky :stuck_out_tongue:
hex

#{hex.laughs_maniacally}

···

On Wed, Apr 6, 2011 at 1:52 PM, Jim Wise <jwise@draga.com> wrote:

7stud -- <bbxx789_05ss@yahoo.com> writes:

> Haskell, Scala, or Erlang? Which one is the best?

I'd say #{language_i_use} is by far the easiest of these to pick up. A
lot of people use #{one_of_the_others} because of #{some_feature}, but
it's more of a pain to use. In particular #{language_i_use} is a lot
like Ruby in ways that will surprise you.

I'd stay away from #{the_third_one}, because it has much more of a
learning curve.

Also, have you considered #{language_not_mentioned}? It's particularly
neat if you're using #{some_system}.

--
                               Jim Wise
                               jwise@draga.com

You're probably thinking of "records", which are basically just named
offsets into a tuple.

Hey yeah I was!

There are proper data structures too, such as "dict" which is
somewhat like a ruby Hash.

I have should said I meant user defined data structures.

It can be a bit overwhelming at first having all the different
built-in types: tuple, list, binary (when you'd just use Array in
ruby)

binary is not so unusual, kinda like bytestrings in python, or
Haskell., Except in Haskell a bytestring is user defined rather than
built in.

> I really like erlang though, the syntax is cool. Commas.

It takes some grokking as to when you need a comma, when you need a
semicolon, and when you need a dot. Erlang has great semantics and
terrible syntax.

Okay, I concede the point. I am utterly wrong. But I still enjoy the
asthetics. It's sort of like a sentence in English.

···

On Tue, 5 Apr 2011 21:43:42 +0900 Brian Candler <b.candler@pobox.com> wrote:

Oh dear, we're onto meta-recommendations.

(Anyway the language I use is clearly better (as long as you like
parenthesis))

Some others tried to be serious; they tried to write in a sensible way,
but were actually writing in Erlang.

And as I said my personal opinion is that haskell = hard.

/hangs self

···

On Thu, 7 Apr 2011 03:04:54 +0900 serialhex <serialhex@gmail.com> wrote:

i think you are totally wrong about #{language_you_use} because
#{feature_i_think_sucks} makes the language unintelligible.
personally i find #{language_i_use} to be the uber be-all-end-all of
languages.

though i do agree that #{current_thread} is kind of wonky :stuck_out_tongue:
hex

#{hex.laughs_maniacally}

Johnny M. wrote in post #991021:

> I really like erlang though, the syntax is cool. Commas.

It takes some grokking as to when you need a comma, when you need a
semicolon, and when you need a dot. Erlang has great semantics and
terrible syntax.

Okay, I concede the point. I am utterly wrong.

No, not at all. I made my point badly: *I* find Erlang's syntax to be
terrible, but syntax is clearly a very personal choice.

···

--
Posted via http://www.ruby-forum.com/\.

Johnny M. wrote in post #991283:

And as I said my personal opinion is that haskell = hard.

I made it to chapter 5 of Real World Haskell before drowning in a real
world JSON example.

···

--
Posted via http://www.ruby-forum.com/\.

If you're lookng into haskell, you could give huburis a try (I dont have a
link right now, but its on github by a guy named mark watton) it let's you
run haskel code/programs within ruby. Not what you want if you're aiming
for that "pure functional" feel, but I thought i'd mention it.
hex

an Android sent this

Johnny M. wrote in post #991021:

> I really like erlang though, the syntax is cool. Commas.

It takes some grokking as to wh...

No, not at all. I made my point badly: *I* find Erlang's syntax to be
terrible, but syntax is clearly a very personal choice.

···

On Apr 5, 2011 11:37 AM, "Brian Candler" <b.candler@pobox.com> wrote:

--
Posted via http://www.ruby-forum.com/\.

I'm annoyed by there being 4 different types of statement endings, 3 of
which look like ant turds

···

On Tue, Apr 5, 2011 at 9:36 AM, Brian Candler <b.candler@pobox.com> wrote:

No, not at all. I made my point badly: *I* find Erlang's syntax to be
terrible, but syntax is clearly a very personal choice.

--
Tony Arcieri
Medioh! Kudelski