caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: nikhil@crl.dec.com
To: chet@watson.ibm.com
Cc: caml-list@pauillac.inria.fr
Subject: Re: vector dot multiply
Date: Fri, 9 Jun 1995 09:20:58 -0400	[thread overview]
Message-ID: <9506091320.AA27705@mattapoisett.crl.dec.com> (raw)
In-Reply-To: <9506091150.AA30307@lusitania.watson.ibm.com> (message from Chet Murthy on Fri, 09 Jun 1995 07:50:06 -0400)


Chet Murthy writes:
>    > >Also, is there a similar construct to Haskell array/list comprehensions?
>    >
>    > Bird and Wadler's book gives a simple translation scheme
>    > for list comprehensions to map+filter functions (pp63-64).
>    > This may meet your requirements.
>    
>    That translation is wildly inefficient, too.  There's a reason
>    that lazy languages, and pure languages, haven't caught on --
>    it's called efficiency.  It's far more efficient to construct
>    a decent set of imperative classes (e.g. Rogue Wave Vector Classes)
>    than to try to import into CAML (which was, after all, designed
>    to (IMHO) not penalize the imperative code writer) the constructs of
>    intrinsically broken languages like Haskell.

I don't understand why the question about list/array comprehensions
provokes this sharp comment about lazy languages and Haskell in
particular.

1) List comprehensions and array comprehensions are simply a
   convenient way to express nested loops, collecting a subset of the
   results.  The notation is completely neutral to whether you embed
   it in a strict, lazy, pure or impure language.  It has nothing
   to do do with Haskell per se.

   In fact, modern list comprehension notation was originally
   introduced by Darlington and Burstall in the _strict_ language Hope
   at Edinburgh.

   A similar construct existed even earlier in the _strict_, _impure_
   language SETL from New York University.

   List and array comprehensions also appear in Id, which is an _impure_
   language.

2) The translation in Bird and Wadler (page 63-64) is given purely for
   illustrative purposes, and was never claimed to be the way to
   implement them efficiently.  It's simply meant to build an
   intuitive connection between list comprehensions and maps and filters.

   A better, more efficiecy-motivated, translation is given (by
   Wadler) in Peyton Jones' book (Ch 7).  It is optimal in the sense
   that it does not cons unnecessarily.  Even better translations
   exist in existing compilers using just loops.

So, to summarize: there's nothing inefficient per se about list and
array comprehensions, and the notation has no specific connection to
lazy languages or to Haskell.

Nikhil




  reply	other threads:[~1995-06-09 16:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-06-09 11:50 Chet Murthy
1995-06-09 13:20 ` nikhil [this message]
  -- strict thread matches above, loose matches on Subject: below --
1995-06-08 17:16 U-E59264-Osman Buyukisik
1995-06-08 18:29 ` Pierre Weis
1995-06-08 23:02 ` Ascander Suarez
1995-06-08 23:17 ` Bob Buckley
1995-06-09  7:29 ` Pascal Nicolas
1995-06-09 10:42   ` Judicael Courant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9506091320.AA27705@mattapoisett.crl.dec.com \
    --to=nikhil@crl.dec.com \
    --cc=caml-list@pauillac.inria.fr \
    --cc=chet@watson.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).