anchor.diff:    "A pk returns a value from the current *event* context, returning DEFAULT if that value is nil.")
   
   (defun pk (key &optional (default 1))
  -  "Create an instance of the PK class."
     (make-instance 'pk
                    :key key
                    :default default))
  
positive.code:     (or (get-event-value *event* key)
          default)))
  
  ;;; prand ;; FIX - have a separate REPEATS parameter instead of just putting it into remaining
  
  (defpattern prand (pattern)
    ((list :initarg :list))
    "A prand returns a random value from LIST.")
  
  (defun prand (list &optional (remaining :inf))
    "Create an instance of the PRAND class."
    (make-instance 'prand
                   :list list
                   :remaining remaining))
  
  (defmethod next ((pattern prand-pstream))
    (alexandria:random-elt (slot-value pattern 'list)))
  
  ;;; pxrand ;; FIX - have a separate REPEATS parameter instead of just putting it into remaining
  
  (defpattern pxrand (pattern)
    ((list :initarg :list)
     (lr :initarg :lr :initform nil) ;; last result
     )
    "A pxrand returns a random value from LIST, never repeating the same one twice in a row.")
  
  (defun pxrand (list &optional remaining)
    "Create an instance of the PXRAND class."
    (assert (> (length (remove-duplicates list)) 1) (list))
    (make-instance 'pxrand
                   :list list
                   :remaining remaining))
  
  (defmethod next ((pattern pxrand-pstream))
    (with-slots (list lr) pattern
      (let ((res (alexandria:random-elt list)))
        (loop :while (eql res lr)
           :do (setf res (alexandria:random-elt list)))
        (setf lr res)
        res)))
  
  ;;; pfunc
  ;; NOTE: This implementation doesn't provide the event as an argument to the function like the SuperCollider implementation does.
  
negative.code:   "A pfunc returns the result of the provided function FUNC.")
  
  (defun pfunc (func)
    (make-instance 'pfunc
                   :func func))
  
  