Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] variant with tuple arg in pattern match?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Prevost <jmp@a...>
Subject: Re: [Caml-list] variant with tuple arg in pattern match?
>>>>> "db" == Dave Berry <Dave@kal.com> writes:

    db> As for syntax versus semantics, I nearly wrote "semantic
    db> hack", until I realised that it only works if the syntax also
    db> supports it.

Actually, it works regardless.  It's just that a convenient syntax
makes it nicer.  For example:

(define (map f)
  (let ((map' l)
        (cond ((cons? l) (cons (f (car l)) (map' (cdr l))))
              (t         l))
    map'))

((map (lamba (x) (+ x 2))) '(1 2 3 4 5))

This is a curried function in Scheme: it's not as nice as in a
language with a simpler (juxtaposition) application syntax, but it's
the same operation.  It's just that ML makes using curried functions
simpler.

The fact that this is more possible in Scheme, by the way, is one of
the things that makes Scheme superior to Lisp.  The fact that function
values and normal values are considered to be different in Lisp just
complicates things.

John.
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr