Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: Re: Re: Anyone using Haskell?

Date2009-03-23 03:32
Frommichael.gogins@gmail.com
Subject[Csnd] Re: Re: Re: Re: Anyone using Haskell?
FWIW, I've learned a lot of languages. I know C, C++, Fortran, Java, Lua, 
Python, Basic in many flavors, Pascal, Mathematica, and a smattering of 
COBOL, Lisp, and SmallTalk.

Python is easiest, hands down. YMMV.

I agree with Victor: a fast systems language like C or C++, and an easy to 
code scripting language like Python. Anything more like that, and you are 
more interested in the tools than in what you make with the tools. IMHO.

Regards,
Mike


----- Original Message ----- 
From: "Dave Seidel" 
To: 
Sent: Sunday, March 22, 2009 9:13 PM
Subject: [Csnd] Re: Re: Re: Anyone using Haskell?


> Another alternative for a modern programming language is SuperCollider, 
> which has features of both functional and object-oriented languages 
> (SmallTalk was a major inspiration) and has the distinct advantage of 
> being an integral part of an excellent music-making system.  Very nice to 
> work with.  Though I'm not giving up on Csound + Python (which I use in 
> the context of blue).
>
> - Dave
>
> Michael Mossey wrote:
>>
>>
>> victor wrote:
>>> I'm not too convinced by all the talk on pure functional languages.
>>> My problem with Haskell is that the syntax is so foreign that it is hard
>>> to get going.
>>
>> I can sympathize... I've just spent the last three days learning Haskell 
>> and I'm still having trouble doing the simplest things. It's quite 
>> different than C and Python, but my understanding is that once you get 
>> going, it is one of the fastest/easiest language to code in.
>>
>> One of my goals in life is to make music, but I also have the goal of 
>> continuously improving the way I do things. Haskell represents a huge 
>> improvement over Python for music applications (other than signal 
>> processing), plus I'm a computer scientist at heart, so I would rather 
>> learn something new than keep doing things the old way.
>>
>> Mike
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound"
> 


Date2009-03-23 08:18
FromErik de Castro Lopo
Subject[Csnd] Re: Re: Anyone using Haskell?
michael.gogins@gmail.com wrote:

> FWIW, I've learned a lot of languages. I know C, C++, Fortran, Java, Lua, 
> Python, Basic in many flavors, Pascal, Mathematica, and a smattering of 
> COBOL, Lisp, and SmallTalk.

My list excludes COBOL and Lua but adds Haskell, Ocaml and Erlang.

> Python is easiest, hands down. YMMV.

If easiest is what you want Python is probably the best fit.

If most correct and lowest number of bugs in shipped code is your
goal Ocaml and Haskell may be a better fit.

If you want an ease of developement approaching Python, high level
language features like built-in safe string handling, bounds checked
arrays and high level data structures like maps, tries, tuples etc
*and* you want performance approaching C and C++, without resorting
to C and C++, then Haskell and Ocaml are a perfect fit.

> I agree with Victor: a fast systems language like C or C++, and an easy to 
> code scripting language like Python.

A couple of years ago I wrote a simple computer algebra system. At 
the time I knew C, C++, Python and Java but none of them were a
good fit. With  C and C++ I'd spend too much time doing manual
memory management, with C++ and Java there'd be too much boilerplate
code and with Python the performance would suck.

I ended up learning Ocaml for this project. Never before had I seen
a programming task and a programing language that were a better fit.
I wrote about it here:

   http://www.mega-nerd.com/erikd/Blog/CodeHacking/Ocaml/variant_types.html
   http://www.mega-nerd.com/erikd/Blog/CodeHacking/Ocaml/variant_types_code.html

> Anything more like that, and you are 
> more interested in the tools than in what you make with the tools. IMHO.

The computer algebra system I wrote would have been significantly more
difficult and/or slower in any other language that I knew at the time I
started this project in Ocaml.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

Date2009-03-23 15:11
FromMichael Gogins
Subject[Csnd] Re: Re: Re: Anyone using Haskell?
Yes, I knew about your advocacy of OCaml, thanks for giving me
additional context for it.

What is the computer algebra system? Is it available?

I looked at your blog, and I noticed that OCaml has features similar
to Mathematica, such as fold and map.

Regarding bugs, I use Python not for writing applications for other
people to use, but rather for writing music.

Debugging is a somewhat different process in this context. Most of the
bugs are logical, they are problems in the implementation of a concept
or algorithm. Python's ease of use actually speeds up this kind of
debugging quite a bit. Other kinds of bugs are not so common. By
definition, when my piece renders to a soundfile that I like, I am
done and there are no bugs.

However, I am not at all concerned about what would happen if the
inputs to my program changed -- until I change them. Also, most of my
pieces are fairly short programs that use libraries. Either the
libraries are by me but are small and I have been using them for a
while and debugged them, or they are big standard libraries that are
already pretty well debugged, like numpy.

Regards,
Mike



On Mon, Mar 23, 2009 at 4:18 AM, Erik de Castro Lopo
 wrote:
> michael.gogins@gmail.com wrote:
>
>> FWIW, I've learned a lot of languages. I know C, C++, Fortran, Java, Lua,
>> Python, Basic in many flavors, Pascal, Mathematica, and a smattering of
>> COBOL, Lisp, and SmallTalk.
>
> My list excludes COBOL and Lua but adds Haskell, Ocaml and Erlang.
>
>> Python is easiest, hands down. YMMV.
>
> If easiest is what you want Python is probably the best fit.
>
> If most correct and lowest number of bugs in shipped code is your
> goal Ocaml and Haskell may be a better fit.
>
> If you want an ease of developement approaching Python, high level
> language features like built-in safe string handling, bounds checked
> arrays and high level data structures like maps, tries, tuples etc
> *and* you want performance approaching C and C++, without resorting
> to C and C++, then Haskell and Ocaml are a perfect fit.
>
>> I agree with Victor: a fast systems language like C or C++, and an easy to
>> code scripting language like Python.
>
> A couple of years ago I wrote a simple computer algebra system. At
> the time I knew C, C++, Python and Java but none of them were a
> good fit. With  C and C++ I'd spend too much time doing manual
> memory management, with C++ and Java there'd be too much boilerplate
> code and with Python the performance would suck.
>
> I ended up learning Ocaml for this project. Never before had I seen
> a programming task and a programing language that were a better fit.
> I wrote about it here:
>
>   http://www.mega-nerd.com/erikd/Blog/CodeHacking/Ocaml/variant_types.html
>   http://www.mega-nerd.com/erikd/Blog/CodeHacking/Ocaml/variant_types_code.html
>
>> Anything more like that, and you are
>> more interested in the tools than in what you make with the tools. IMHO.
>
> The computer algebra system I wrote would have been significantly more
> difficult and/or slower in any other language that I knew at the time I
> started this project in Ocaml.
>
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>



-- 
Michael Gogins
Irreducible Productions
Michael dot Gogins at gmail dot com


Date2009-03-23 19:03
FromErik de Castro Lopo
Subject[Csnd] Re: Re: Anyone using Haskell?
Michael Gogins wrote:

> What is the computer algebra system? Is it available?

Sorry, no it isn't. I haven't released it because it only does a
tiny  subset of what anyone would reasonably  expect a computer
algebra system to do. Another reason is that I don't want to have
to support it :-).

> I looked at your blog, and I noticed that OCaml has features similar
> to Mathematica, such as fold and map.

Those are features in Mathematica were inspired by the ML
language which  is a direct forebear of Ocaml.

> Regarding bugs, I use Python not for writing applications for other
> people to use, but rather for writing music.

I have written Ocaml code at work that ships in an embedded Linux
system to customers all around the world. I feel far more confident
in the Ocaml code on that system than I do in the C and C++ code I
wrote for the same machine :-).

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

Date2009-03-23 19:52
FromMichael Gogins
Subject[Csnd] Re: Re: Re: Anyone using Haskell?
Well, thanks again. I'll look at your O'Caml blog entries again. At
various times I have looked at the language, but I have never actually
tried to write any code in it. Perhaps I will try.

Regards,
Mike

On Mon, Mar 23, 2009 at 3:03 PM, Erik de Castro Lopo
 wrote:
> Michael Gogins wrote:
>
>> What is the computer algebra system? Is it available?
>
> Sorry, no it isn't. I haven't released it because it only does a
> tiny  subset of what anyone would reasonably  expect a computer
> algebra system to do. Another reason is that I don't want to have
> to support it :-).
>
>> I looked at your blog, and I noticed that OCaml has features similar
>> to Mathematica, such as fold and map.
>
> Those are features in Mathematica were inspired by the ML
> language which  is a direct forebear of Ocaml.
>
>> Regarding bugs, I use Python not for writing applications for other
>> people to use, but rather for writing music.
>
> I have written Ocaml code at work that ships in an embedded Linux
> system to customers all around the world. I feel far more confident
> in the Ocaml code on that system than I do in the C and C++ code I
> wrote for the same machine :-).
>
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>



-- 
Michael Gogins
Irreducible Productions
Michael dot Gogins at gmail dot com


Date2009-03-23 21:25
FromErik de Castro Lopo
Subject[Csnd] Re: Re: Anyone using Haskell?
Michael Gogins wrote:

> Well, thanks again. I'll look at your O'Caml blog entries again. At
> various times I have looked at the language, but I have never actually
> tried to write any code in it. Perhaps I will try.

Quite honestly I'd say look at Haskell instead, for the following
reasons:

  - Haskell syntax is much nicer than Ocaml's.
  - Haskell has type classes which are closer to Smalltalk objects
    than anything else I can think of.
  - Ocaml development is rather moribund, while Haskell's is very
    very vibrant.
  - The Ocaml community is good but a little quiet. Haskell's 
    community is incredibly active and vibrant.
  - Haskell's functional purity means that it is better able to cope
    with addressing the problems of multicore (> 8) programming [0].
  - The vast majority of interesting CompSci research is done in
    Haskell.

Ocaml is still a great language, but the only things it has that
Haskell doesn't is parameterized Modules (these are very powerful)
and objects. However, almost noone uses Ocaml's object system and
I would advise anyone looking at Ocaml to stay away from the object
system until they are comfortable with the core of the langauge.
They should also avoid imperative programming (ie references, for
and while loops) to begin with as well. Since Ocaml has imperative
and object oriented features its actually possible to write a subset
of C in Ocaml and never really come to grips with the functional
parts of the langauge.

Erik

[0] See Data Parallel Haskell. Its new and doesn't quite work
    yet but show enormous promise.
    http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell

-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/