POV-Ray : Newsgroups : povray.off-topic : Haskell humour : Re: Haskell humour Server Time
6 Sep 2024 23:24:06 EDT (-0400)
  Re: Haskell humour  
From: nemesis
Date: 30 Sep 2008 08:30:00
Message: <web.48e21b3fb11b7058ab9de280@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> nemesis wrote:
>
> > I don't quite see your point.  Scheme programmers have been doing it for decades
> > without static typing systems getting in the way. :)
>
> I don't know what Scheme is.
>
> People claim that Lisp is a functional language, but it doesn't look
> very functional to me. But Lisp apparently allows you to do something
> similar too... Whether it is "common" for Lisp programs to actually
> works like this is another matter. ;-)

Common Lisp is the "industrial-strength" Lisp idiom.  It's basically a mix of
several old Lisps with a bit of Scheme.  Scheme is a minimalist Lisp idiom
designed mainly for research and education.  The many implementations make sure
it's able to do a lot more.

Old Lispers are indeed pretty imperative but Scheme is a strict, eager
evaluation, mostly functional language which solves problems mostly by function
application and applicative programming.  Mutators (set!) and direct
side-effecting IO are still present, but using sparingly.  It's very much like
ML, except with sweet regular syntax, no builtin pattern matching and no static
typing.  Of course, you may probably don't know what ML is, but Google is your
friend.  You may eventually learn about Haskell's ancestry...

Here's an example of Scheme code:
(let ((%? (lambda (a b) (zero? (modulo a b)))))
  (let sum ((i 5) (r 0))
    (if (= i 100000) r
        (sum (+ 1 i) (if (or (%? i 5) (%? i 7))
                         (+ r i)
                         r)))))

Forget the parentheses.  Besides all, they are a great aid for structured
editing of source code in appropriate editors, like replacing a whole large
parenthetical expression in a breeze.

You could try downloading
http://download.plt-scheme.org/drscheme/

And running it.  Not necessarily the fastest Scheme implementation (that would
be the Stalin native compiler), but a very complete and sound all-around
implementation and friendly programming environment.


BTW, you seem to enjoy math and programming and since there are so many things
you don't know, perhaps this is a good opportunity for showing you this?

http://projecteuler.net/

It's a very popular, friendly, free-time contest of math/programming problems.
Register, pick a favorite language, enter the correct answer to the problems
and eventually become an Eulerian:
http://projecteuler.net/index.php?section=scores&show=eulerians

It's very fun.  The statistics page is a finding... :)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.