Well...Functional languages can be divided into two broad groups: those
like Scheme and ML that allow assignment (sometimes called "impure"),
and those like Haskell that do not (called "pure"). But in any case,
"variables" have to get a value somehow. What happens is that the value
is defined just once and is immutable. Iteration is replaced by
recursion in which each invocation gets a new scope (the variable is
NEW in MUMPS terms), so no value is actually changed. The recursion
sounds more expensive than it actually is, though, because tail
recursion (recursion where there is a single recursive call occuring at
the end) is mechanically converted to iteration when the code is
compiled. Why bother? One reason is that when values are immutable,
then mathematical correctness proofs are much more straightforward
(and, for that matter, compiler optimizations are much easier).

There is an explicit let keyword in Haskell (which works just as it
does in Scheme or LISP), but frequently the mechanism through which
these "NEW" copies of the variable occur is hidden. One such mechanism
is list comprehensions, which work just like set notation (and are
named after one of Peano's axioms). To illustrate, if you want 2*i for
each i in the list [1, 2, 3, 4, 5], you can do this

Main> [2*i | i<- [1..5]]
[2,4,6,8,10]       

I don't know if you're familiar with Quicksort, but it's a fast sorting
algorithm based on the following idea:

1. Remove the first element of the list
2. Divide the remaining elements into two sublists, those less than the
first element and those greater than or equal to the first element.
3. Sort the two sublists (recursively).
4. Form the result by concatenating the first (sorted) sublist, the
selected element, and the second (sorted) sublist.

When you code this in Haskell, you get what is scarcely more than a
symbolic representation of this idea:

qSort [] = []
qSort (x:xs)
    = qSort [ y | y <-xs , y < x] ++ [x] ++ qSort [y | y <-xs, y >= x]

but that's all you need:

Main> :load c:\quick.hs
Main> qSort [0, -1, 240, 7, -8, 1, 0, 25]
[-8,-1,0,0,1,7,25,240]  

since the "variables" never vary, a correctness proof is nothing more
than a trivial induction on the length of the list. Perhaps even
better, it is easy to intuitively grasp the algorithm from its
expression in Haskell.

--- James Gray <[EMAIL PROTECTED]> wrote:

> Care to explain to an old timer how functional programming gets rid
> of 
> assignment statements?
> 
> Jim Gray
> 
> ----- Original Message ----- 
> From: "Greg Woodhouse" <[EMAIL PROTECTED]>
> To: "Hardhats" <[email protected]>
> Sent: Friday, October 21, 2005 1:10 PM
> Subject: [Hardhats-members] Fwd: [Haskell] TFP2006: call for papers
> 
> 
> > Okay, I don't know who else might be interested in functional
> > programming, but it does seem to me that in the medical arena,
> where
> > safety is critical, functional approaches would provide a very good
> > "fit".
> >
> > (Aside: my tongue-in-cheek remark about eliminating SET was not
> meant
> > to be sarcastic. It was a possibly overly obscure reference to
> > functional programming.)
> >
> > --- Henrik Nilsson <[EMAIL PROTECTED]> wrote:
> >
> >> Date: Fri, 21 Oct 2005 19:59:30 +0100
> >> From: Henrik Nilsson <[EMAIL PROTECTED]>
> >> To: [email protected]
> >> Subject: [Haskell] TFP2006: call for papers
> >>
> >> Apologies for multiple copies.
> >>
> >> /Henrik
> >>
> >> -- 
> >> Henrik Nilsson
> >> School of Computer Science and Information Technology
> >> The University of Nottingham
> >> [EMAIL PROTECTED]
> >>
> >>
> >> This message has been checked for viruses but the contents of an
> >> attachment
> >> may still contain software viruses, which could damage your
> computer
> >> system:
> >> you are advised to perform your own checks. Email communications
> with
> >> the
> >> University of Nottingham may be monitored as permitted by UK
> >> legislation.
> >>
> >> >    TFP 2006
> >>     Seventh Symposium on Trends in Functional Programming
> >>      Nottingham, UK, 19 - 21 April, 2006
> >>
> >>     http://www.cs.nott.ac.uk/~nhn/TFP2006
> >>
> >>   Co-located with Types 2006
> >>
> >>        CALL FOR PAPERS
> >>
> >>
> >>
> >> The Symposium on Trends in Functional Programming (TFP) is an
> >> international
> >> forum for researchers with interests in all aspects of functional
> >> programming
> >> languages, focusing on providing a broad view of current and
> future
> >> trends in
> >> Functional Programming. It aspires to be a lively environment for
> >> presenting
> >> the latest research results through acceptance by extended
> abstracts.
> >> A formal
> >> post-symposium refereeing process then selects the best papers
> >> presented at
> >> the symposium for publication in a high-profile volume.
> >>
> >> TFP 2006 is going to be held in Nottingham, UK, 19 - 21 April.
> Note
> >> that this
> >> is significantly earlier in the year than past TFPs that generally
> >> were held
> >> in August - September. TFP 2006 is co-located with Types 2006 (18
> -
> >> 21 April).
> >>
> >> Previous TFP symposia were held in Scotland in 2002 and 2003, as
> >> successors to
> >> the successful series of Scottish Functional Programming
> Workshops,
> >> in Munich,
> >> Germany in 2004, and in Tallinn, Estonia in 2005 (co-located with
> >> ICFP and
> >> GPCE). For further general information about TFP, see
> >> http://www.tifp.org/.
> >>
> >>
> >> SCOPE OF THE SYMPOSIUM
> >>
> >> The Symposium recognises that new trends may arise through various
> >> routes. As
> >> part of the Symposium's focus on trends we therefore identify the
> >> following
> >> five categories of paper. High-quality papers are solicited in any
> of
> >> these
> >> categories:
> >>
> >>     Research Papers:   leading-edge, previously unpublished
> research
> >> work
> >>     Position Papers:   on what new trends should or should not be
> >>     Project Papers:    descriptions of recently started new
> projects
> >>     Evaluation Papers: what lessons can be drawn from a finished
> >> project
> >>     Overview Papers:   summarising work with respect to a trendy
> >> subject
> >>
> >> Papers must be original, and not submitted for simultaneous
> >> publication in any
> >> other forum. They may consider any aspect of functional
> programming:
> >> theoretical, implementation-oriented, or more experience-oriented.
> >> Also
> >> applications of functional programming techniques to other
> languages
> >> may be
> >> considered.
> >>
> >> Papers on the following subject areas are particularly welcome:
> >>
> >>     o dependently typed functional programming
> >>     o validation and verification of functional programs
> >>     o debugging for functional languages
> >>     o functional programming and security
> >>     o functional programming and mobility
> >>     o functional programming and formally motivated computing
> >>     o functional languages for telecommunications applications
> >>     o functional languages for embedded systems
> >>     o functional programming applied to global computing
> >>     o functional GRIDs
> >>     o functional languages for reasoning about
> >> imperative/object-oriented
> >>       programs
> >>     o interoperability with imperative programming languages
> >>     o any new emerging trend in the functional programming area
> >>
> >> If you are in doubt on whether your paper is within the scope of
> TFP,
> >> please
> >> contact the TFP 2006 program chair, Henrik Nilsson,
> >> [EMAIL PROTECTED]
> >>
> >>
> >> BEST STUDENT PAPER AWARD
> >>
> >> TFP traditionally pays special attention to research students,
> >> acknowledging
> >> that students are almost by definition part of new subject trends.
> To
> >> acknowledge this, a prize for the best student paper is awarded
> each
> >> year.
> >>
> >>
> >> CO-LOCATION WITH TYPES 2006
> >>
> >> TFP 2006 is co-located with Types 2006 (to be held 18 - 21 April).
> To
> >> take
> >> advantage of the synergies offered by these two complementary
> events,
> >> we will
> >> invite a number of joint keynote speakers, hold joint sessions on
> >> topics of
> >> mutual interest, such as dependently typed functional programming,
> >> and run
> >> common social events. The schedule will be arranged so that
> >> participants may
> >> freely move between parallel sessions of the two events.
> >>
> >>
> >> SUBMISSION
> >>
> >> Acceptance to the symposium will be based upon extended abstracts
> of
> >> between 6
> >> and 10 pages. Accepted abstracts are to be completed to full
> papers
> >> before the
> >> symposium for publication in the local symposium proceedings.
> >>
> >> Important dates:
> >>
> >>     Deadline for abstract submission: 17 February, 2006
> >>     Notification of acceptance: 27 February, 2006
> >>     Registration deadline: 17 March, 2006
> >>     Camera-ready copy of full paper: 24 March, 2006
> >>
> >> The submission must clearly indicate to which category it belongs:
> >> research,
> >> position, project, evaluation or overview paper. It should also
> >> indicate
> >> whether the main author or authors are research students.
> >>
> >> Abstracts and full papers must be written in English. Papers for
> the
> >> symposium
> >> proceedings must adhere to the formatting instructions using the
> >> provided on
> >> the TFP 2006 site. Papers must not exceed 16 pages; papers in some
> >> categories
> >> may comprise considerably fewer pages.
> >>
> >>
> >> POST SYMPOSIUM REFEREEING AND PUBLICATION
> >>
> >> In addition to the local symposium proceedings, we intend to
> continue
> >> the TFP
> >> tradition of publishing a high-quality subset of contributions in
> the
> >> Intellect series on Trends in Functional Programming. Revised
> papers
> >> will be
> >> refereed after the symposium to the normal conference standards
> and a
> >> subset
> >> of the best papers over all categories will be selected for
> >> publication.
> >> Papers will be judged on their contribution to the research area,
> >> with
> >> appropriate criteria applied to each category of paper.
> >>
> >> Papers submitted for publication by Intellect must follow
> formatting
> >> and any
> >> other instructions provided by the Programme Chair.
> >>
> >> For TFP 2005, in order to enhance the quality of student
> submissions,
> >> a
> >> process where student papers were given extra feedback was tried
> out.
> >> A
> >> similar process might be put in place for this TFP, contingent on
> the
> >> outcome
> >> of that trial.
> >>
> >>
> >> ORGANISATION
> >>
> >> Symposium Chair: Marko van Eekelen, Radboud University Nijmegen,
> NL
> >> Programme Chair: Henrik Nilsson, University of Nottingham, UK
> >> Treasurer: Greg Michaelson, Heriot-Watt University, UK
> >> Local Arrangements: Joel Wright, University of Nottingham, UK
> >>
> >>
> >> PROGRAMME COMMITTEE:
> >>
> >> The programme committee is currently being assembled.
> >>
> >> The current members of the TFP Advisory Committee are:
> >>
> >>     o Sharon Curtis, Oxford Brookes University
> >>     o Gaetan Hains, Université d'Orléans
> >>     o John Hughes, Chalmers University
> >>     o Kevin Hammond, University of St Andrews
> >>     o Hans-Wolfgang Loidl, Ludwig-Maximilians-Universität München
> >>     o Rita Loogen, Philipps-Universität Marburg
> >>     o Greg Michaelson, Heriot-Watt University
> >>     o John O'Donnell, University of Glasgow
> >>     o Ricardo Pena, Universidad Complutense de Madrid,
> >>     o Phil Trinder, Heriot-Watt University
> >>     o Marko van Eekelen, University of Nijmegen
> >>
> >>
> >> SPONSORS
> >>
> >> We are actively looking for additional TFP sponsors, who may help
> to
> >> subsidise
> >> attendance by research students, for example. If you or your
> >> organisation
> >> might be willing to sponsor TFP, or if you know someone who might
> be
> >> willing
> >> to do so, please do not hesitate to contact the Symposium chair:
> >> Marko van
> >> Eekelen. Your students will be grateful!
> >>
> >>
> >>
> >> > _______________________________________________
> >> Haskell mailing list
> >> [email protected]
> >> http://www.haskell.org/mailman/listinfo/haskell
> >>
> >
> >
> >
> > ===
> > Gregory Woodhouse  <[EMAIL PROTECTED]>
> >
> >
> >
> > "Einstein was a giant. He had his head in the clouds and his feet
> on the 
> > ground."
> >
> > -- Richard P. Feynman
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 
>
--------------------------------------------------------------------------------
> 
> 
> >    TFP 2006
> >     Seventh Symposium on Trends in Functional Programming
> >      Nottingham, UK, 19 - 21 April, 2006
> >
> >     http://www.cs.nott.ac.uk/~nhn/TFP2006
> >
> >   Co-located with Types 2006
> >
> >        CALL FOR PAPERS
> >
> >
> >
> > The Symposium on Trends in Functional Programming (TFP) is an 
> > international
> > forum for researchers with interests in all aspects of functional 
> > programming
> > languages, focusing on providing a broad view of current and future
> trends 
> > in
> > Functional Programming. It aspires to be a lively environment for 
> > presenting
> > the latest research results through acceptance by extended
> abstracts. A 
> > formal
> > post-symposium refereeing process then selects the best papers
> presented 
> > at
> > the symposium for publication in a high-profile volume.
> >
> > TFP 2006 is going to be held in Nottingham, UK, 19 - 21 April. Note
> that 
> > this
> > is significantly earlier in the year than past TFPs that generally
> were 
> > held
> > in August - September. TFP 2006 is co-located with Types 2006 (18 -
> 21 
> > April).
> >
> > Previous TFP symposia were held in Scotland in 2002 and 2003, as 
> > successors to
> > the successful series of Scottish Functional Programming Workshops,
> in 
> > Munich,
> > Germany in 2004, and in Tallinn, Estonia in 2005 (co-located with
> ICFP and
> > GPCE). For further general information about TFP, see 
> > http://www.tifp.org/.
> >
> >
> > SCOPE OF THE SYMPOSIUM
> >
> > The Symposium recognises that new trends may arise through various
> routes. 
> > As
> > part of the Symposium's focus on trends we therefore identify the 
> > following
> > five categories of paper. High-quality papers are solicited in any
> of 
> > these
> > categories:
> >
> >    Research Papers:   leading-edge, previously unpublished research
> work
> >    Position Papers:   on what new trends should or should not be
> >    Project Papers:    descriptions of recently started new projects
> >    Evaluation Papers: what lessons can be drawn from a finished
> project
> >    Overview Papers:   summarising work with respect to a trendy
> subject
> >
> > Papers must be original, and not submitted for simultaneous
> publication in 
> > any
> > other forum. They may consider any aspect of functional
> programming:
> > theoretical, implementation-oriented, or more experience-oriented.
> Also
> > applications of functional programming techniques to other
> languages may 
> > be
> > considered.
> >
> > Papers on the following subject areas are particularly welcome:
> >
> >    o dependently typed functional programming
> >    o validation and verification of functional programs
> >    o debugging for functional languages
> >    o functional programming and security
> >    o functional programming and mobility
> >    o functional programming and formally motivated computing
> >    o functional languages for telecommunications applications
> >    o functional languages for embedded systems
> >    o functional programming applied to global computing
> >    o functional GRIDs
> >    o functional languages for reasoning about
> imperative/object-oriented
> >      programs
> >    o interoperability with imperative programming languages
> >    o any new emerging trend in the functional programming area
> >
> > If you are in doubt on whether your paper is within the scope of
> TFP, 
> > please
> > contact the TFP 2006 program chair, Henrik Nilsson,
> [EMAIL PROTECTED]
> >
> >
> > BEST STUDENT PAPER AWARD
> >
> > TFP traditionally pays special attention to research students, 
> > acknowledging
> > that students are almost by definition part of new subject trends.
> To
> > acknowledge this, a prize for the best student paper is awarded
> each year.
> >
> >
> > CO-LOCATION WITH TYPES 2006
> >
> > TFP 2006 is co-located with Types 2006 (to be held 18 - 21 April).
> To take
> > advantage of the synergies offered by these two complementary
> events, we 
> > will
> > invite a number of joint keynote speakers, hold joint sessions on
> topics 
> > of
> > mutual interest, such as dependently typed functional programming,
> and run
> > common social events. The schedule will be arranged so that
> participants 
> > may
> > freely move between parallel sessions of the two events.
> >
> >
> > SUBMISSION
> >
> > Acceptance to the symposium will be based upon extended abstracts
> of 
> > between 6
> > and 10 pages. Accepted abstracts are to be completed to full papers
> before 
> > the
> > symposium for publication in the local symposium proceedings.
> >
> > Important dates:
> >
> >    Deadline for abstract submission: 17 February, 2006
> >    Notification of acceptance: 27 February, 2006
> >    Registration deadline: 17 March, 2006
> >    Camera-ready copy of full paper: 24 March, 2006
> >
> > The submission must clearly indicate to which category it belongs: 
> > research,
> > position, project, evaluation or overview paper. It should also
> indicate
> > whether the main author or authors are research students.
> >
> > Abstracts and full papers must be written in English. Papers for
> the 
> > symposium
> > proceedings must adhere to the formatting instructions using the
> provided 
> > on
> > the TFP 2006 site. Papers must not exceed 16 pages; papers in some 
> > categories
> > may comprise considerably fewer pages.
> >
> >
> > POST SYMPOSIUM REFEREEING AND PUBLICATION
> >
> > In addition to the local symposium proceedings, we intend to
> continue the 
> > TFP
> > tradition of publishing a high-quality subset of contributions in
> the
> > Intellect series on Trends in Functional Programming. Revised
> papers will 
> > be
> > refereed after the symposium to the normal conference standards and
> a 
> > subset
> > of the best papers over all categories will be selected for
> publication.
> > Papers will be judged on their contribution to the research area,
> with
> > appropriate criteria applied to each category of paper.
> >
> > Papers submitted for publication by Intellect must follow
> formatting and 
> > any
> > other instructions provided by the Programme Chair.
> >
> > For TFP 2005, in order to enhance the quality of student
> submissions, a
> > process where student papers were given extra feedback was tried
> out. A
> > similar process might be put in place for this TFP, contingent on
> the 
> > outcome
> > of that trial.
> >
> >
> > ORGANISATION
> >
> > Symposium Chair: Marko van Eekelen, Radboud University Nijmegen, NL
> > Programme Chair: Henrik Nilsson, University of Nottingham, UK
> > Treasurer: Greg Michaelson, Heriot-Watt University, UK
> > Local Arrangements: Joel Wright, University of Nottingham, UK
> >
> >
> > PROGRAMME COMMITTEE:
> >
> > The programme committee is currently being assembled.
> >
> > The current members of the TFP Advisory Committee are:
> >
> >    o Sharon Curtis, Oxford Brookes University
> >    o Gaetan Hains, Université d'Orléans
> >    o John Hughes, Chalmers University
> >    o Kevin Hammond, University of St Andrews
> >    o Hans-Wolfgang Loidl, Ludwig-Maximilians-Universität München
> >    o Rita Loogen, Philipps-Universität Marburg
> >    o Greg Michaelson, Heriot-Watt University
> >    o John O'Donnell, University of Glasgow
> >    o Ricardo Pena, Universidad Complutense de Madrid,
> >    o Phil Trinder, Heriot-Watt University
> >    o Marko van Eekelen, University of Nijmegen
> >
> >
> > SPONSORS
> >
> > We are actively looking for additional TFP sponsors, who may help
> to 
> > subsidise
> > attendance by research students, for example. If you or your
> organisation
> > might be willing to sponsor TFP, or if you know someone who might
> be 
> > willing
> > to do so, please do not hesitate to contact the Symposium chair:
> Marko van
> > Eekelen. Your students will be grateful!
> >
> >
> >
> >
> 
> 
>
--------------------------------------------------------------------------------
> 
> 
> > _______________________________________________
> > Haskell mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/haskell
> > 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Hardhats-members mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hardhats-members
> 



===
Gregory Woodhouse  <[EMAIL PROTECTED]>



"Einstein was a giant. He had his head in the clouds and his feet on the 
ground."

-- Richard P. Feynman












-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Hardhats-members mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to