Jump to content

2nd evaluation is different...

Recommended Posts

Hi again!  :)


I am setting these pitches:

(setf pitchOnlyFirstCall '(bb5 bb5 bb5 bb5 gb5 db6 f6 eb6 bb5 eb5 ab5 gb5 db6 f6 eb6 bb5 eb5 ab5 eb5 eb5 eb5 eb5))

then I want to reverse and transpose down so I do this:


(setf leftHand   (pitch-transpose  'c0 (nreverse pitchOnlyFirstCall)) )


and the first time I evaluate the snippet I get what I want, the second time I evaluate the snippet I only get one note...


So, The helpfile says that nreverse 'destroys the argument', does that mean that the variable I just passed becomes unassigned and this is why I get only one note on second eval?


Is there a way to reverse a list without losing the original assignment? I guess I will have to have an intermediary assignment so I don't lose my original list?









Link to comment
Share on other sites

The NREVERSE is destructive Lisp function and for other use.

What you are looking for is REVERSE or even bette (safer) the GEN-RETROGRADE function.

(setf leftHand (pitch-transpose 'c0 (gen-retrograde pitchOnlyFirstCall)))


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.

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