unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Faraz Shahbazker" <faraz_ms@rediffmail.com>
Cc: nickjohnson@virginia.edu, guile-user@gnu.org
Subject: Re: Re: to serialize/deserialize closures; and multithreading
Date: 26 Mar 2004 20:02:51 -0000	[thread overview]
Message-ID: <20040326200251.19862.qmail@webmail27.rediffmail.com> (raw)


[-- Attachment #1.1: Type: text/html, Size: 2934 bytes --]

[-- Attachment #1.2: Type: text/plain, Size: 2184 bytes --]


        The problem with Kali and other distributed Scheme
implementations (and there are quite a few) is that most of
them are built around the imperative style of parallel
computation -- result: things get ugly quickly for complex
programs. You could end-up writing C-like programs in
Scheme.

        IMHO the ideal system would be built around pure
functional style (using MultiLisp type parallel annotations
like future/touch/pcall). This category is also known as
para-functional languages. It has been explored reasonably in
ML/Haskell, but little work of this nature has been done in
Scheme/Lisp so far.....


> Autsch, that does get rather expensive when closures/continuation
> are used (something that does happen occasionally in functional
> programming ;-)

        That I accept. It can be speeded up by building the
transformation into the compiler, something which is not possible
with guile - bigloo perhaps would be a better choice for such work.
But it is difficult to leave guile for 2 reasons :

1. it's got the "GNU" in it's name
2. SCM API is too good - absolutely love it. I don't think anyone
can provide a better extensibility for Scheme than what we have here.



As an aside : for functional purists like me, we should built
future/touch constructs into guile - they are a lot of fun.
Try out these prototypes =>
(Note : these are not actually correct - the simple semantics fail
in the presence of mutations/continuations. A proper implementation
would have to be done in C using Guile-internals)

        It basically works like delay/force except that any-thing
that is "future"d returns a place-holder immediately and starts
concurrent computation. When the value is required, you "touch"
the place-holder, causing a block until the computation completes.


(defmacro future (expr)
  `(let ((ans (cons "#<future>" (cons #f #f))))
     (set-car! (cdr ans)
               (begin-thread
                (set-cdr! (cdr ans) ((lambda () ,expr)))))
     ans))

(defmacro touch (future-val)
  `(begin
     (join-thread (car (cdr ,future-val)))
     (cdr (cdr ,future-val))))


regards,
- faraz 



[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user

             reply	other threads:[~2004-03-26 20:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-26 20:02 Faraz Shahbazker [this message]
2004-03-26 20:35 ` to serialize/deserialize closures; and multithreading Andreas Rottmann

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040326200251.19862.qmail@webmail27.rediffmail.com \
    --to=faraz_ms@rediffmail.com \
    --cc=guile-user@gnu.org \
    --cc=nickjohnson@virginia.edu \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).