From: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
To: caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] Q: Correct locations for macro camlp4 extensions
Date: Tue, 24 Aug 2004 09:43:11 +0200 [thread overview]
Message-ID: <1093333391.8623.44.camel@qrnik> (raw)
In-Reply-To: <Pine.LNX.4.58.0408231842040.6046@ls02.fas.harvard.edu>
W liście z pon, 23-08-2004, godz. 19:16 -0400, Michael Alexander Hamburg
napisał:
> Another syntax construction that I might write up (which I'm not aware of
> in any programming language) would be something like
>
> (f _ x _ _ y) translates into (fun p1 p2 p3 -> f p1 x p2 p3 y)
My language Kogut uses this (along with _ in patterns as in other
functional languages). Note: these expressions are evaluated once,
not each time the function is applied.
http://kokogut.sourceforge.net/kogut.html
> When I have n lists of pairs to sort by the
> first element of the tuple, or some other function like that, it saves me
> a significant amount of programming effort to write
>
> # let (<-<<) f g a b = f (g a) (g b);;
> or
> # let sort_by g a b = sort (compare (g a) (g b));;
It may be better to perform Schwartzian transform: make a list of
(g x, x) pairs, sort it, and extract elements back. It applies g
O(N) rather than O(N log N) times.
Well, unless g is as simple as fst.
--
__("< Marcin Kowalczyk
\__/ qrczak@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2004-08-24 7:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-23 9:33 Jan Kybic
2004-08-23 10:59 ` skaller
2004-09-03 14:37 ` Yamagata Yoriyuki
2004-09-04 2:12 ` skaller
2004-08-23 17:21 ` Michael Alexander Hamburg
2004-08-23 18:29 ` Richard Jones
2004-08-23 20:33 ` David Brown
2004-08-23 21:53 ` skaller
2004-08-23 23:16 ` Michael Alexander Hamburg
2004-08-24 7:43 ` Marcin 'Qrczak' Kowalczyk [this message]
2004-08-24 7:02 ` [Caml-list] " Jan Kybic
2004-08-24 16:31 ` Michael Alexander Hamburg
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=1093333391.8623.44.camel@qrnik \
--to=qrczak@knm.org.pl \
--cc=caml-list@pauillac.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