Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jean-Yves Moyen <Jean-Yves.Moyen@loria.fr>
To: Caml mailing list <caml-list@inria.fr>
Subject: Re: let ... in layout
Date: Wed, 15 Mar 2000 09:22:34 +0100 (MET)	[thread overview]
Message-ID: <Pine.GSO.4.21.0003150913460.15609-100000@bar.loria.fr> (raw)
In-Reply-To: <wx8zzlm2yh.fsf@suburbia.net>

On 15 Mar 2000, Julian Assange wrote:

> 
> let .. in
> let .. in ...
> 
> seems such a common construct in caml that it could do with some
> syntatic sugar. I often see let..in run to 5-20 clauses. This appears
> incredibly ugly compared to the equivalent haskell code, is harder to
> read and takes longer to write due to the clutter of the surrounding
> token magic. Has anyone thought about applying layout in general to
> ocaml, or otherwise sugaring let...in? Is there any reason why the BNF
> 
>         let {name = expr}+ in
> 
> would be ambiguous?

I guess one can write:
let silly f=
  let x=List.map f z=3 in
    ...

which can be read either:
let silly f=
  let x=List.map f in 
  let z=3 in
    ...

or:
let silly f=
  let x=List.map in
  let f z=3 in
    ...

Of course, if your definition aren't mutually recursive, you can use 'and'
to separate two deifferent definitons:
let x=t
and y=u
and ...
and z=v in
  ...

which is not so long to write, unambigous and readable (I find).

> The only other haskell features I frequently miss, are list
> comprehensions and multiple argument pattern matching.

I don't understand exactly what you mean by 'multiple argument pattern
matching', but I guess you could just use a tuple-pattern matching:

let f a b c=
  match a,b,c with
    ...

which allows you to match several arguments at once.



Hypocoristiquement,
Jym.



  reply	other threads:[~2000-03-15 14:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-15  1:33 Julian Assange
2000-03-15  8:22 ` Jean-Yves Moyen [this message]
2000-03-15 22:18   ` Julian Assange
2000-03-17  9:42     ` Pierre Weis
2000-03-15  8:56 ` Benoit Deboursetty
2000-03-17 13:16 ` Dmitri Lomov

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=Pine.GSO.4.21.0003150913460.15609-100000@bar.loria.fr \
    --to=jean-yves.moyen@loria.fr \
    --cc=caml-list@inria.fr \
    /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