[Haskell-cafe] How to implement `amb' operator?

2004-04-07 Thread Meihui Fan
Hi, I think it's good idea to compute non-deterministic problems with the `amb' operator, just as in LISP/scheme. But how to implement it in haskell? noclouds ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/hask

Re: [Haskell-cafe] How to implement `amb' operator?

2004-04-07 Thread Keith Wansbrough
> Hi, > I think it's good idea to compute non-deterministic problems with the `amb' > operator, just as in LISP/scheme. But how to implement it in haskell? Do you mean "evaluate e1 and e2, and return the result of whichever returns first"? Probably best to do this using threads. --KW 8-) --

Re: [Haskell-cafe] How to implement `amb' operator?

2004-04-07 Thread Brandon Michael Moore
Keith is talking about a "comitted choice" style of nondeterminism, where one of the arguments is picked and the computation continues from there. If you want a computation with backtracking, or a list of all possibly results then you should use the list monad, or another monad that supports nonde

RE: [Haskell-cafe] How to implement `amb' operator?

2004-04-07 Thread Bayley, Alistair
Not wanting to appear glib, but... SICP 4.3.3 Implementing the Amb Evaluator http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-28.html#%_sec_4.3.3 Ralf Hinze (2000): Deriving Backtracking Monad Transformers http://www.informatik.uni-bonn.de/~ralf/publications.html#P12 > -Origina

Re: [Haskell-cafe] Newbie: Is it possible to catch _|_ ?

2004-04-07 Thread Graham Klyne
I'm not familiar with yacc, but I understand that it's a bottom-up parser generator. I've not come across any bottom-up parser generators written in Haskell. I have seen (at least) three examples of top-down parser generators coded in Haskell: (1) in Simon Thompson's book, the Craft of Functio

Re: [Haskell-cafe] Newbie: Is it possible to catch _|_ ?

2004-04-07 Thread Matthew Walton
Isn't Happy [1] a bottom-up parser generator in the style of yacc? [1] http://www.haskell.org/happy/ As for parsing yacc's input files, if you can come up with an EBNF grammar for it that avoids some of the nasty recursion possibilities [2] then I can't see why you couldn't parse it with Parsec

Re: [Haskell-cafe] How to implement `amb' operator?

2004-04-07 Thread Andy Moran
[ Was sent only to participants, but I meant to send it to the list ] On Wednesday 07 April 2004 06:04 am, Brandon Michael Moore wrote: > Keith is talking about a "comitted choice" style of nondeterminism, where > one of the arguments is picked and the computation continues from there. > > If you