Jump to content

symmp


Recommended Posts

use it if you like.. i needed it as a subfuction for length-legato* ...

greetings

andré

 

(defun symmp (seq)
  (let ((seq2 (if (evenp (length seq))
                (list (filter-first  (/ (length seq) 2) seq)
                      (reverse (filter-last (/ (length seq) 2) seq)))
                (list (filter-first (/ (1- (length seq)) 2) seq) 
                      (reverse (filter-last (/ (1- (length seq)) 2) seq))))))

    (if (null (member 'nil (loop 
                             for i in (car seq2)
                             for j in (cadr seq2)
                             when (equal i j)
                             collect 'T else collect 'NIL)))
      't)))

  
(symmp '(-1 2 3 5 5 3 2 -1))
(symmp '(-1 2 3 5 7 5 3 2 -1))
(symmp '(-1 2 3 4 5 3 2 -1))


(symmp '(c4 d4 fs5 d4 c4))
(symmp '(c4 d4 fs5 d4 b4))

(symmp '(mf f mp mp f mf))
(symmp '(mf f f mp fff f mf))

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy