Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Why pascal is not good

Author: Dan Andersson

Date: 15:56:14 07/31/03

Go up one level in this thread


On July 31, 2003 at 18:41:38, Dan Andersson wrote:

> The basic idea in functional programming is that a program is expressed as a
>function. Some languages are *very* strictly typed and can be reasoned on to
>prove correctness. While some have no type system. Computations can be lazy and
>be executed when neccesary. Memoization can be transparent. Order of execution
>might be undefined in some. Pattern matching and list comprehension is usually a
>part of the syntax.
> ML FAQ: http://www.faqs.org/faqs/meta-lang-faq/
> A paper implementing alpha-beta in a functional language:
>http://www.math.chalmers.se/~rjmh/Papers/whyfp.html
> Here's a factorial function in FP pseudocode using pattern matching:
>  factorial 0 = 1
>  factorial x = x * factorial (n - 1)
                                ^(x - 1)
> Loops are replaced by recursion. To reduce time complexity in programs you can
>use the nifty Continuation Passing Style transformation. Here is a CPS form
>factorial:
>  factorial' 0 s = s
>  factorial' x s = factorial (x - 1) (s * x)
                    ^factorial'
>  factorial x = factorial' x 1
>
>MvH Dan Andersson



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.