Wednesday, February 08, 2006

New Programming Language (Matz suggestion)

Here are the Obie Fenandez's Notes on the RubyConf 2005.

Matz suggested Io, or Haskell, but also "old" (I would say "classical") programming languages were specified: Lisp, Scheme, Smalltalk.

I've learned Lisp at the University, but I didn't enjoy the prefix notation (+ 2 3 4 5)
Smalltalk is always fun, but it is not a new mind-challenging concept (I would say that ruby is a file-based smalltalk).

Io "is a small, prototype-based programming language. The ideas in Io are mostly inspired by Smalltalk (all values are objects), Self (prototype-based), NewtonScript (differential inheritance), Act1 (actors and futures for concurrency), LISP (code is a runtime inspectable/modifiable tree) and Lua (small, embeddable)."
But for now it is very basic, nearly approaching the 1.0 release. So for more "interesting" stuff,
libraries are missing.

Haskell might be an interesting option. (darcs is written in it). Looking at the introduction,
I saw a qsort implementation, which looks very prolog-like:

qsort []     = []
qsort (x:xs) = qsort elts_lt_x ++ [x] ++ qsort elts_greq_x
elts_lt_x = [y | y <- xs, y < x]
elts_greq_x = [y | y <- xs, y >= x]

def qsort(list)
return [] if list.empty?

x, *xs = *list
smaller_than_x, bigger_than_x = xs.partition{|y| y < x}
qsort(smaller_than_x) + [x] + qsort(bigger_than_x)

Once again, I was surprized by how flexible ruby is. I didn't know (maybe forgot) about the x, *xs = *list assignement possibility.

ps. here is a japanese post about qsort in several languages.

No comments: