Dear George,
?- St1 new stack. St1 = stack(tS9lmfFFFFFFF) ? yes ?- St1:push(8). {ERROR: user:push/1 - undefined predicate}
In your latter call, St1 is already a variable again. The behavior is similar to:
?- X = 1. X = 1 ? yes
?- display(X). _158 yes
What you want is to continue the execution using the you got for the variables, i.e.,
?- St1 new stack, St1:push(8), St1:pop(Top). St1 = stack(iaJzXsrADEgjw), Top = 8 ? ;
This is what you'd probably do in a program. You can also use the 'continuation' facility of the Ciao toplevel (other Prolog systems may also implement it). Typing a comma (',') when the toplevel shows an asnwer tells it to continue the execution where it was before, without backtracking:
?- St1 new stack. St1 = stack('Ah23Od3ZjjrxG') ? ,
1 ?- St1:push(8). St1 = stack('Ah23Od3ZjjrxG') ? ,
2 ?- St1:pop(Top). St1 = stack('Ah23Od3ZjjrxG'), Top = 8 ? yes
2 ?- St1 = stack('Ah23Od3ZjjrxG') ? yes
1 ?- St1 = stack('Ah23Od3ZjjrxG') ? yes
Hope this helps.
============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------