Sure, I was going to add it last night, but brain had shut down for
the night.

The program I'm working on is a Communicating Sequential Processes
toolbox, so you can write a process and collect the traces (along with
other tools that simplify expressions and such).  I've written a
traces function that should return a lazy sequence of all the possible
traces for a process.  A process is actually a tree composed of
c.c.types abstract data types, it can't do anything on its own.  The
event-set function returns a set of events in which the process can
engage.  The proc function takes one step forward in the process,
based on the event passed.
You can think of it more abstractly as getting a collection of values
that are currently applicable, applying each value to the current
state and in return getting a list of all the possible future values
that could be applied down to a certain depth... like look-ahead in a
game or puzzle solver.  Each step back up through the call stack tacks
the applied value onto the head of each of the lists of possible
future steps.

(defn traces [process depth]
  (if (zero? depth)
    [nil]
    (for [e (event-set process)
          t (traces (proc process e) (dec depth))]
      (cons e t))))

I was playing around with nested pmap calls last night but I always
got one extra layer of nesting for each depth I went.

Any help is much appreciated,
Tim


On Feb 8, 8:22 am, Sean Devlin <francoisdev...@gmail.com> wrote:
> Do you have a specific example, some code you could paste?
>
> On Feb 7, 11:53 pm, Tim Snyder <tsnyder...@gmail.com> wrote:
>
>
>
> > Is there a straight-forward way to get parallelization when using list
> > comprehension?
> > The form of "for" syntax is much preferable to the closest I could
> > come up with using pmap.  I also was having trouble getting the
> > correct level of nesting down when using pmap, though probably because
> > I'm tired.
>
> > If there's nothing like a "pfor", is there a way to algorithmically
> > convert a list comp. into some nested pmaps?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to