Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pfc_lambda([A1],Body,A1):-Body.
- pfc_lambda([A1,A2],Body,A1,A2):-Body.
- pfc_lambda([A1,A2,A3],Body,A1,A2,A3):-Body.
- pfc_lambda([A1,A2,A3,A4],Body,A1,A2,A3,A4):-Body.
- ?- maplist(pfc_lambda([X-Y],writeln(["I see ",X," and ",Y])),[a-b,c-d]).
- C:\pf\swi666\bin>swipl
- % c:/users/administrator/appdata/roaming/swi-prolog/pl.ini compiled 0.00 sec, 4 clauses
- Welcome TO SWI-Prolog (Multi-threaded, 64 bits, Version 6.6.6)
- Copyright (c) 1990-2013 University of Amsterdam, VU Amsterdam
- SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
- AND you are welcome TO redistribute it under certain conditions.
- Please visit http://www.swi-prolog.org FOR details.
- FOR help, use ?- help(Topic). OR ?- apropos(Word).
- 1 ?- asserta((pfc2_lambda(A,B,A):-B)).
- true.
- 2 ?- maplist(pfc2_lambda(X,writeln(X)),[a,b]).
- a
- false.
- 3 ?- trace,maplist(pfc2_lambda(X,writeln(X)),[a,b]).
- ^ Call: (7) apply:maplist(pfc2_lambda(_G1936, writeln(_G1936)), [a, b]) ? creep
- Call: (8) apply:maplist_([a, b], user:pfc2_lambda(_G1936, writeln(_G1936))) ? creep
- Call: (9) pfc2_lambda(_G1936, writeln(_G1936), a) ? creep
- Call: (10) writeln(a) ? creep
- a
- EXIT: (10) writeln(a) ? creep
- EXIT: (9) pfc2_lambda(a, writeln(a), a) ? creep
- Call: (9) apply:maplist_([b], user:pfc2_lambda(a, writeln(a))) ? creep
- Call: (10) pfc2_lambda(a, writeln(a), b) ? creep
- Fail: (10) pfc2_lambda(a, writeln(a), b) ? creep
- Fail: (9) apply:maplist_([b], user:pfc2_lambda(a, writeln(a))) ? creep
- Fail: (8) apply:maplist_([a, b], user:pfc2_lambda(_G1936, writeln(_G1936))) ? creep
- ^ Fail: (7) apply:maplist(user:pfc2_lambda(_G1936, writeln(_G1936)), [a, b]) ? creep
- false.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement