Advertisement
Adytzu04

SBC 18/11/2014

Nov 18th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. (deffacts initial
  2. (stiva)
  3. (pop)
  4. (stiva 123 13 4)
  5. (stiva 2)
  6. )
  7.  
  8. (defrule pop-stiva-vida "ex1 pag 39 lab 4"
  9.  
  10. ?adresa <- (pop)
  11. ?stiva <- (stiva)
  12.  
  13. =>
  14.  
  15. (retract ?adresa)
  16. (printout t "nu sunt elemente in stiva" crlf)
  17. )
  18.  
  19. (defrule pop-stiva-plina "ex1 +2 pag 39 lab 4"
  20.  
  21. ?adresa <- (pop)
  22. ?stiva <- (stiva ?valoare #?rest)
  23.  
  24. =>
  25.  
  26. (retract ?adresa ?stiva)
  27. (assert (stiva ?stiva $?rest)
  28. (printout t "Valoarea extrasa din stiva este " ?valoare crlf))
  29. )
  30.  
  31. (defrule pop-stiva-untimul-element "ex2 pag 39 lab 4"
  32.  
  33. ?adresa <- (pop)
  34. ?stiva <- (stiva ?valoare )
  35.  
  36. =>
  37.  
  38. (retract ?adresa ?stiva)
  39. (assert (stiva )
  40. (printout t "Ultima valoarea extrasa din stiva este " ?valoare crlf))
  41. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement