Advertisement
logicmoo

duplicates a term that lasts after failure

Nov 23rd, 2016
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.40 KB | None | 0 0
  1. ?- T = nice(N),
  2.         (   N = world,
  3.             nb_linkval(myvar, T),
  4.             fail
  5.         ;   nb_getval(myvar, V),
  6.             writeln(V)
  7.         ).
  8. nice(_5314)
  9. T = V, V = nice(N).
  10.  
  11. ?- T = nice(N),
  12.         (   N = world,
  13.             nb_setval(myvar, T),
  14.             fail
  15.         ;   nb_getval(myvar, V),
  16.             writeln(V)
  17.         ).
  18. nice(world)
  19. T = nice(N),
  20. V = nice(world).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement