Lisp-Python vs. Erlang (was MLvtA, was Meta)
Sean Hinde
sean.hinde@REDACTED
Fri Aug 25 13:31:28 CEST 2006
On 25 Aug 2006, at 12:04, Bengt Kleberg wrote:
> On 2006-08-25 12:28, Sean Hinde wrote:
>> This is fun!
>> Here is my Erlang translation of the GPS from Norvig, following
>> the lisp code as closely as possible.
>> I found it quite kludgy to write in erlang. I ended up using a
>> deprecated function from lists.erl, and there were some features
>> of lisp
> ...deleted
>> find_all(Goal, Ops, Pred) ->
>> lists:filter(Pred, [Goal], Ops).
>
> what does filter/3 do?
filter(Pred, Eas, List) -> [ E || E <- List, apply(Pred, [E|Eas]) ].
It applies the fun to a list which has the extra parameter as the
tail of the list.
At some point I intended to try to re-write it without using that..
but real work intrudes. Excercise for someone?
Sean
More information about the erlang-questions
mailing list