3

I'm trying to use Scheme in a distributed system. The idea is that one process would evaluate some expressions and pass it on to another process to finish.

Example:

(do-stuff (f1 x) (f2 x))

would evaluate to

(do-stuff res1 (f2 x))

in the first process. This process passes the expression as a string to another process (on another node), which would evaluate it to

(do-stuff res1 res2)

The ideas is to do a map reduce style work distribution, but by passing scheme expressions around. Is this possible? Any pointers would be helpful. (I'm using IronScheme btw).

biozinc
  • 4,629
  • 2
  • 25
  • 28
  • It's unclear what you're asking. Is it possible to implement map/reduce in Scheme? Yes, sure, given the right multitasking library. – Fred Foo Feb 13 '12 at 22:13
  • 2
    This may be an implementation-specific question. Racket has its `futures` and `places` libraries that applies. You can find an introduction here in Section 18.10 and 18.11 of: http://docs.racket-lang.org/guide/performance.html#(part._effective-futures) Unfortunately, I'm not familiar enough with the IronScheme world yet to point out equivalent libraries. – dyoo Feb 14 '12 at 02:18
  • You could use `delay` and `force`, but like @larsmans said, no idea what you mean here. `do-stuff` is doing multiple things here which is confusing/ambiguous. – leppie Feb 14 '12 at 10:35
  • Also, by the time code is run, all (code) sexprs are gone, compiled away. Currently, IronScheme does not support serializing procedures, so keep that in mind (not sure if this will ever happen). – leppie Feb 14 '12 at 10:38
  • As already mentioned `delay` and `force`, take a look on macros. Altogether, macros and promises (`delay` makes a promise, `force` evaluates it) may do what you need. – paul Feb 16 '12 at 06:30

2 Answers2

1

As Aslan986 suggested you need support for full continuations. Unfortunately Ironscheme does not support full continuations but only escape continuations, which go the call stack up. See the known limitations of Ironscheme. Furthermore you need to serialize the continuations, to be able to pass them from one process to another. In general this is not always possible and only few Scheme systems have support for that. One example is Gambit-C. There exists a presentation which shows how to implement a distributed computing system.

Community
  • 1
  • 1
ceving
  • 21,900
  • 13
  • 104
  • 178
0

it's not a real answer, but just an hint.

Have you tried with continuations? Here

I think the can do what you need.

Aslan986
  • 9,984
  • 11
  • 44
  • 75