Jump to content
Sign in to follow this  
AM

length-invert** (works with ties)

Recommended Posts

;;; FUNCTION: for some coding-cases i needed THIS function, to keep the OMN-notation 
;;; and not to change to RATIO (otherwise i got strange results in NOTATION because the "ties are gone")

(defun length-invert** (length-val)
  (append (compress (list '- length-val))))

;;; EXAMPLES

;;; new => keeps OMN
(length-invert** (car '(q e4 mp)))
=> -q

; in this case i wanted to keep the format with tie
(length-invert** (car '(3q_q e4 mp)))
=> -3q_q




;;; original => changes to ratio
(length-invert (car '(q e4 mp)))
=> -1/4

; no tie here! i was in trouble :-)
(length-invert (car '(3q_q e4 mp)))
=> -1/3

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×