From: Kenneth Knowles <kknowles@berkeley.edu>
To: SWAMPY <swampy@spacebird.net>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Functional critical section
Date: Tue, 18 May 2004 13:31:26 -0700 [thread overview]
Message-ID: <20040518203126.GA1047@tallman.kefka.frap.net> (raw)
In-Reply-To: <006801c43d14$61edef40$10015c0a@word>
With Camlp4 you may be able to do this via pre-processing. Otherwise you could
do it with lazy evaluation, supported by the Lazy module in the standard
library. An inefficient lazy evaluation can be had be just adding an additional
unit argument to your function. (lablGL does something like this, though I'm
not sure of their motivations)
http://caml.inria.fr/camlp4/manual/
http://wwwtcs.inf.tu-dresden.de/~tews/htmlman-3.07/libref/Lazy.html
Kenn
On Tue, May 18, 2004 at 04:10:44PM -0400, SWAMPY wrote:
> Hello!
>
> I'm very new to ocaml, and I'm trying to figure out how
> to do something that may or may not actually be possible.
> Any suggestions?
>
> I'd like to write
>
> <name> <expr>
>
> as an expression, and have this evaluate <expr> first
> evaluating fixed expression A, and then after evaluting
> <expr> evaluate fixed expression B.
> Then, I could do something like:
>
> critical (threadsafeFunction arg1 arg2 arg3)
>
> and have this do the equivalent of
>
> Mutex.lock someMutex; let tmp = threadsafeFunction arg1
> arg2 arg3; Mutex.unlock someMutex; tmp;;
>
> Is this sort of thing possible? In general I'm
> interested in techniques I could use to wrap
> imperative-biased parts of the library to more functional
> constructs.
>
> Cheers,
>
> David J. Trombley
>
> -------------------
> 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
-------------------
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-05-18 21:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-18 8:38 [Caml-list] Automatic wrapper generator skaller
2004-05-18 8:58 ` Richard Jones
2004-05-18 10:07 ` skaller
2004-05-18 9:06 ` Basile Starynkevitch local
2004-05-18 10:25 ` skaller
2004-05-18 12:11 ` Richard Jones
2004-05-18 17:21 ` Michael Hamburg
2004-05-18 18:34 ` skaller
2004-05-18 19:27 ` Richard Jones
2004-05-18 20:52 ` skaller
2004-05-18 20:02 ` Gerd Stolpmann
2004-05-18 20:10 ` [Caml-list] Functional critical section SWAMPY
2004-05-18 20:31 ` Kenneth Knowles [this message]
2004-05-18 20:39 ` Evan Martin
2004-05-19 7:35 ` thornber
2004-05-19 7:33 ` thornber
2004-05-18 9:25 ` [Caml-list] Automatic wrapper generator Olivier Andrieu
2004-05-18 10:36 ` skaller
2004-05-18 9:38 ` Fermin Reig
2004-05-18 10:42 ` skaller
2004-05-18 10:57 ` Felix Winkelmann
2004-05-18 10:58 ` John Chu
2004-05-18 11:33 ` skaller
2004-05-22 10:09 ` Marcin 'Qrczak' Kowalczyk
2004-05-22 13:13 ` skaller
2004-05-22 14:19 ` Marcin 'Qrczak' Kowalczyk
2004-05-22 16:14 ` skaller
2004-05-23 10:58 ` Marcin 'Qrczak' Kowalczyk
2004-05-23 19:59 ` skaller
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=20040518203126.GA1047@tallman.kefka.frap.net \
--to=kknowles@berkeley.edu \
--cc=caml-list@inria.fr \
--cc=swampy@spacebird.net \
/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