(om::defmethod! no-voice-crossing ((voices list) (input-mode t) &optional (rule-type :true/false) (weight 1)) :initvals '( (0 1) :all :true/false 1) :indoc '("voices-list" "input-mode" "rule-type" "weight-number") :icon 180 ; THIS IS THE NUMBER OF THE QUESTION MARK ICON FOR OM :menuins '( (1 (("all" :all) ("beat" :beat) ("1st-beat" :1st-beat) ("1st-voice" :1st-voice) )) (2 (("true/false" :true/false) ("heur-switch" :heur-switch)) ) ) :doc "Voices should not cross, i.e., the pitch of simultaneous note pairs in voices are always sorted in decreasing order. Arguments are inherited from rpitch-pitch." ;NOTE: I've changed the name r-pitch-pitch to rpitch-pitch when porting CE to OM (This is also true for all CE functions). The original function (r-pitch-pitch) still exists in CE package as a ordinary lisp function (without the OM interface generated by om::defmethod!). (let ((sorted-voices (sort voices #'<)) (rule (eval `#'(lambda (pitches) ;MOVED THE RULE HERE TO AVOID LEXICAL CLOSURES (apply #'>= (remove NIL pitches)))))) ;; no rests -- no NILs (mappend #'(lambda (voice1 voice2) (ce::r-pitch-pitch rule ;<== THE VARIABLE RULE CREATED BY LET voices '(0) input-mode nil ;<== gracenotes?: no grace-notes available in OM :pitch rule-type weight)) (butlast sorted-voices) (rest sorted-voices))))