Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorials:intermediate:performing_plans [2019/02/20 12:55] – Removed reference to cram-plan-occasions-events. cpotutorials:intermediate:performing_plans [2022/03/30 21:24] – [Plan goals] schimpf
Line 1: Line 1:
-====== Performing Activities ======+====== Performing Actions ======
  
 ===== Basic functionality ===== ===== Basic functionality =====
Line 15: Line 15:
  
 <code lisp> <code lisp>
-CL-USER> (cpl:def-cram-function eat (stuff+CL-USER> (cpl:def-cram-function eat (&key ((:yummy ?yummy)) &allow-other-keys) 
-           (format t "hmmm... nomnomnom... ~a~%" stuff))+           (declare (type (or string null) ?yummy)
 +           (format t "hmmm... nomnomnom... ~a~%" ?yummy))
 </code> </code>
  
Line 23: Line 24:
 <code lisp> <code lisp>
 CL-USER> (prolog:def-fact-group eating-plans (desig:action-grounding) CL-USER> (prolog:def-fact-group eating-plans (desig:action-grounding)
-           (prolog:<- (desig:action-grounding ?action-designator (eat ?object)) +             (prolog:<- (desig:action-grounding ?action-designator (eat ?action-designator)) 
-             (desig:desig-prop ?action-designator (:to :eat)) +                        (desig:desig-prop ?action-designator (:to :eat)) 
-             (desig:desig-prop ?action-designator (:yummy ?object))))+                        (desig:desig-prop ?action-designator (:yummy ?object))))
 </code> </code>
  
Line 36: Line 37:
            (exe:perform (desig:an action (to eat) (yummy pizza))))            (exe:perform (desig:an action (to eat) (yummy pizza))))
 hmmm... nomnomnom... PIZZA hmmm... nomnomnom... PIZZA
 +NIL
 +#<A ACTION
 +    (TO EAT)
 +    (YUMMY PIZZA)>
 </code> </code>
  
Line 62: Line 67:
 CL-USER> (defparameter *pizza-eaten-p* nil) CL-USER> (defparameter *pizza-eaten-p* nil)
 *PIZZA-EATEN-P* *PIZZA-EATEN-P*
-CL-USER> (cpl:def-cram-function eat (stuff+CL-USER> (cpl:def-cram-function eat (&key ((:yummy ?yummy)) &allow-other-keys) 
-           (format t "hmmm... nomnomnom... ~a~%" stuff)+           (declare (type (or string null) ?yummy)
 +           (format t "hmmm... nomnomnom... ~a~%" ?yummy)
            (setf *pizza-eaten-p* t))            (setf *pizza-eaten-p* t))
 +; in: CRAM-LANGUAGE-IMPLEMENTATION:DEF-CRAM-FUNCTION EAT
 +;     (TYPE (OR STRING NULL) ?YUMMY)
 +
 +; caught WARNING:
 +;   undefined variable: COMMON-LISP-USER::?YUMMY
 +
 +; compilation unit finished
 +;   Undefined variable:
 +;     ?YUMMY
 +;   caught 1 WARNING condition
 STYLE-WARNING: redefining COMMON-LISP-USER::EAT in DEFUN STYLE-WARNING: redefining COMMON-LISP-USER::EAT in DEFUN
 EAT EAT