On 9 February 2011 16:02, Nataraj S Narayan <[email protected]> wrote:

> Hi Aanjhan,
>
> Comparing these two recursive factorials in Lisp and C
>
> (define factorial
>  (lambda (n)
>    (if (< n 1)
>        1
>        ( * n (fact (- n 1))))))
>
>
> int factorial(int i)
> {
> if (i>1)
> return (i * factorial(i-1));
> }
>
> Pardon me for a flawed logic.
>
>  Lisp code does look cool to me.  Much more intutive than C. So says
>
Here's one way of writing factorial in Haskell.

factorial 0=1
factorial n=n*factorial(n-1)

Nice, isn't it? Just the way you learnt it in school! Pattern matching
rules!

Vinod.


> Paul Graham too, http://paulgraham.com/diff.html.
>
> regards
>
> Nataraj
>
> regards
>
> Nataraj
>
>
>
>
>
> On Wed, Feb 9, 2011 at 9:44 AM, Aanjhan R <[email protected]> wrote:
> > On Wed, Feb 9, 2011 at 6:43 AM, Kenneth Gonsalves
> > <[email protected]> wrote:
> >> in order to improve my programming skills, I am contemplating learning a
> >> new language. Not a scripting language - something else. So far my
> >> research indicates either C or C++ - recommendations?
> >
> > Famous quote:
> >
> > "Ironically, C programmers understand this much better than Lisp
> > programmers. One of the ironies of the programming world is that using
> > Lisp is vastly more productive than using pretty much any other
> > programming language, but successful businesses based on Lisp are
> > quite rare. The reason for this, I think, is that Lisp allows you to
> > be so productive that a single person can get things done without
> > having to work together with anyone else, and so Lisp programmers
> > never develop the social skills needed to work effectively as a member
> > of a team. A C programmer, by contrast, can't do anything useful
> > except as a member of a team. So although programming in C hobbles you
> > in some ways, it forces you to form groups whose net effectiveness is
> > greater than the sum of their parts, and who collectively can stomp on
> > all the individual Lisp programmers out there, even though one-on-one
> > a Lisper can run rings around a C programmer."
> >
> > IMHO, every programmer must know C. It exposes the actual working of
> > your program. Once you cross the basics, you will HAVE to understand
> > how your program data and code gets organised in memory and stuff.
> > Once you start trying to optimise for code size and performance, you
> > will get to understand a lot more. Getting a systems perspective is
> > VERY important. Go learn C (if you can do parallel learning do LISP)
> >
> > http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/
> >
> > --
> > A
> > _______________________________________________
> > ILUGC Mailing List:
> > http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
> >
> _______________________________________________
> ILUGC Mailing List:
> http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
>
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to