In addition to having a map function with multiple arities (up to 4), Prolog allows you (under certain circumstances) to match the multiple arity function into a single list. Suppose you want to check if "x" is a member of several lists. You can do:
maplist(member(x),[[a,b,c,x],[3,f,s,x]]).
The first member argument is included, and all this is displayed in a list.
Question 1: Something similar to Erlang? I cannot find it in the documentation, but then again I can not find it in any Prolog documentation.
Question 2: How to use a card (and similar functions) with multiple states? Roll up your own?
Thanks.
list lambda erlang functional-programming prolog
Ultranewb
source share