[Haskell-cafe] Infinite lists in real world programs

Yves Parès limestrael at gmail.com
Sat Dec 18 19:48:22 CET 2010


Thanks you all for your links,

I will read this.

However, Brent, I fail to understand your implementation of Monad... I
understand the purpose, but not the algorithm.


2010/12/18 Matthew Sottile <mjsottile at mac.com>

> Hi-
>
> This may be of some interest:
>
> https://github.com/mjsottile/hsworkflow/raw/master/docs/works09paper.pdf
>
> That describes a simple project that I think is similar to what you are
> looking at doing.  The code is in that github repository as well, a couple
> directories up from the paper.
>
> https://github.com/mjsottile/hsworkflow/
>
> -m
>
>
> On Dec 15, 2010, at 5:52 AM, Yves Parès wrote:
>
> > Hello Café,
> >
> > I was wondering if using infinite lists was a viable and efficient
> solution in haskell programs (I mean not simple prototypes) :
> > I was considering using them to model agents in a hierarchical
> multi-agent application for school.
> > A list would representate the state of an agent at a step of the program.
> >
> > Let's say we have two simple agents, one multiplying its input by 2 and
> the other dividing it by 4 :
> >
> >
> > agent1 = fmap (*2)
> > agent2 = fmap (/4)
> >
> > allValues = xs where
> >   ys = agent1 xs
> >   xs = 100:agen2 ys
> >
> > main = do
> >    mapM_ print $ take 100 allValues
> >
> >
> > Of course, in a real program, an agent would rather take a list of
> multiple agents (i.e. a list of lists) in input, so that its ouput could
> depend on what several agents feed him.
> >
> > Some could state what I'm trying to do is FRP, and I agree. But it
> remains a simple goal so I'd like to keep the program simple, and not go
> into the whole complexity of a FRP framework (and I'm working with a
> non-haskeller).
> > For instance, with my solution, I cannot dynamically connect or
> disconnect agents during the runtime, but I'll will not need to do that in
> my program.
> > Besides, I'd like to try to implement this myself, not use an already
> existing framework.
> >
> > So is it viable or would the use of multiple infinite lists kill the
> performances?
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101218/c2672660/attachment.htm>


More information about the Haskell-Cafe mailing list