From: "Loup Vaillant" <loup.vaillant@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Re: Teaching bottomline, part 3: what should improve.
Date: Fri, 25 May 2007 09:58:45 +0200 [thread overview]
Message-ID: <6f9f8f4a0705250058y769cb536wa95970d3fcafae23@mail.gmail.com> (raw)
In-Reply-To: <1180042153.6098.40.camel@Blefuscu>
2007/5/24, David Teller <David.Teller@ens-lyon.org>:
> On Thu, 2007-05-24 at 18:30 +0200, Loup Vaillant wrote:
> > It sounds like you need some kind of macro which can encapsulate a
> > chunk of code into an anonymous function like :
> >[...]
>
> Or perhaps
>
> map i traversing my_list
> begin
> i*2
> end
>
> accumulate acc = 0 with i traversing my_list
> begin
> acc+i
> end
>
> ...
Discussing of syntactic sugar, I prefer Jon's syntax : more concise,
and no ugly "begin end" (I hate those, and I proposed them only
because I lacked a better Idea).
Another solution, no macro of any kind required : why not explain map
and fold as mere syntactic constructions?
Sure, such a syntax looks a bit weird, but you can then wait before
explaining anything about anonymous functions.
Your students could just know they have some construction to iterate
over a list, some other to select some elements of a list, and some
other to accumulate a list on something through a computation.
When complaints arise about such an awful syntax, have them implement
map, filter, and fold. You may have to make clear that the first
argument is a function.
Personally, I'd begin by the latter part (implementation), so the
former are useless. My brother is currently in his first year in
college, and he is studying Caml light. I'll try to have him implement
map.
cheers,
Loup
next prev parent reply other threads:[~2007-05-25 7:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070522234715.0BCB2BC74@yquem.inria.fr>
2007-05-23 5:21 ` Dan Grossman
2007-05-23 8:03 ` [Caml-list] " Loup Vaillant
2007-05-23 12:51 ` David Teller
2007-05-24 16:30 ` Loup Vaillant
2007-05-24 18:08 ` Jon Harrop
2007-05-24 21:29 ` David Teller
2007-05-25 7:58 ` Loup Vaillant [this message]
2007-05-25 9:57 ` Markus E.L.
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=6f9f8f4a0705250058y769cb536wa95970d3fcafae23@mail.gmail.com \
--to=loup.vaillant@gmail.com \
--cc=caml-list@yquem.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