Recursive list comprehension

Torbjorn Tornkvist <>
Fri Jan 13 22:56:03 CET 2006


Joel Reymont wrote:
> 
> On Jan 13, 2006, at 10:29 AM, Peter-Henry Mander wrote:
> 
>> I'm reading http://web.engr.oregonstate.edu/~erwig/papers/ Zurg_JFP04.pdf
>>
>> I haven't read all of the paper but it probably gives good guidance in
>> avoiding re-implementing backtracking in Erlang. Have you looked  there?
> 
> 
> I believe that is the paper that I pointed to :-). Apart from a  Haskell 
> implementation that builds a lazy list I do not see any  guidance in 
> avoiding re-implementing backtracking in Erlang.
> 
>> Since Erlang was derived from Prolog a long time ago, I think Dr.  Joe &
>> colleagues omitted backtracking because of rampant memory consumption
>> and the possibly iffy use of red/green cut that I for one never  properly
>> understood. Erlang gains clarity without backtracking methinks.
> 
> 
> That much I understand but it does not answer the question of why my  
> recursive comprehention returns [] instead of a long list of results.
> 
> Also, I _do_ want to implement backtracking in Erlang. I would like  to 
> use Erlang as a base for a future project that might require it  and I 
> do not want to switch to Haskell.

Just for the fun of it; I actually wrote an extremely naive
prolog interpreter in Erlang once. It must be the slowest
Prolog in the world, so obviously it is of no use other than
to play with...

Anyway, you'll find it here if you'd care to take a look:

  http://www.tornkvist.org/epilogue/

Btw: I think I remember that Hans Nilsson did a much better 
'backtracker' that he used for Mnemosyne.

Cheers, Tobbe

> 
>     Thanks, Joel
> 
> -- 
> http://wagerlabs.com/
> 
> 
> 
> 
> 
> 




More information about the erlang-questions mailing list