Advertisement
logicmoo

Untitled

May 28th, 2015
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pfc_lambda([A1],Body,A1):-Body.
  2. pfc_lambda([A1,A2],Body,A1,A2):-Body.
  3. pfc_lambda([A1,A2,A3],Body,A1,A2,A3):-Body.
  4. pfc_lambda([A1,A2,A3,A4],Body,A1,A2,A3,A4):-Body.
  5.  
  6.  
  7.  ?-  maplist(pfc_lambda([X-Y],writeln(["I see ",X," and ",Y])),[a-b,c-d]).
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16. C:\pf\swi666\bin>swipl
  17. % c:/users/administrator/appdata/roaming/swi-prolog/pl.ini compiled 0.00 sec, 4 clauses
  18. Welcome TO SWI-Prolog (Multi-threaded, 64 bits, Version 6.6.6)
  19. Copyright (c) 1990-2013 University of Amsterdam, VU Amsterdam
  20. SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
  21. AND you are welcome TO redistribute it under certain conditions.
  22. Please visit http://www.swi-prolog.org FOR details.
  23.  
  24. FOR help, use ?- help(Topic). OR ?- apropos(Word).
  25.  
  26. 1 ?- asserta((pfc2_lambda(A,B,A):-B)).
  27.  
  28. true.
  29.  
  30. 2 ?- maplist(pfc2_lambda(X,writeln(X)),[a,b]).
  31. a
  32. false.
  33.  
  34. 3 ?- trace,maplist(pfc2_lambda(X,writeln(X)),[a,b]).
  35. ^  Call: (7) apply:maplist(pfc2_lambda(_G1936, writeln(_G1936)), [a, b]) ? creep
  36.    Call: (8) apply:maplist_([a, b], user:pfc2_lambda(_G1936, writeln(_G1936))) ? creep
  37.    Call: (9) pfc2_lambda(_G1936, writeln(_G1936), a) ? creep
  38.    Call: (10) writeln(a) ? creep
  39. a
  40.    EXIT: (10) writeln(a) ? creep
  41.    EXIT: (9) pfc2_lambda(a, writeln(a), a) ? creep
  42.    Call: (9) apply:maplist_([b], user:pfc2_lambda(a, writeln(a))) ? creep
  43.    Call: (10) pfc2_lambda(a, writeln(a), b) ? creep
  44.    Fail: (10) pfc2_lambda(a, writeln(a), b) ? creep
  45.    Fail: (9) apply:maplist_([b], user:pfc2_lambda(a, writeln(a))) ? creep
  46.    Fail: (8) apply:maplist_([a, b], user:pfc2_lambda(_G1936, writeln(_G1936))) ? creep
  47. ^  Fail: (7) apply:maplist(user:pfc2_lambda(_G1936, writeln(_G1936)), [a, b]) ? creep
  48. false.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement