Jump to content

Applying length-augmentation (or any function) to a list by name


Recommended Posts

Hello,

 

This seems like a simple issue but I think there's some underlying lisp concept I'm missing. I'm trying to apply length-augmentation to a list rather than explicit lengths and getting an error.

 

So to begin with I import a plainchant MIDI file:

(setf source "/Users/tomtolleson/OpusModus/Scores/The Bifurcated Fruit of a Mirror/MIDI/dominabi.mid")

 

I define the lengths from the source as "sourcelengths"

(setf sourcelengths (midi-to-omn source :type :length))

 

This all works properly.

 

Now, if I apply length-augmentation to a series of lengths explicitly (from the documentation):

(length-augmentation 2 '(1/8 1/8 1/8 1/8 -1/8 1/8 1/8 -1/8))

 

That works properly.

 

However if I try to apply length-augmentation to 

(length-augmentation 2 '(sourcelengths))

 

or

 

(length-augmentation 2 (sourcelengths))

 

I receive an error. What is the correct format for applying length-augmentation (or any other function) to a list by name rather than by explication?

Thanks!

 

THT

Link to comment
Share on other sites

Thank you for the response. That's still throwing an error.

 

Even when I'm using it as 

 

(setf lengths (length-augmentation 2 sourcelengths))

 

or

 

(setf lengths (length-augmentation 2 (sourcelengths)))

 

or

 

(setf lengths (length-augmentation 2 '(sourcelengths)))

 

Ah, just realized the source of the problem is my original variable "sourcelengths"

 

When that's evaluated it's

 

(((1/16 -3/16 1/16 -3/16 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/16 -3/16) (-1/4 1/4 1/16 -3/16 1/4) (3/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (1/8 1/2 1/4 1/8) (1/8 1/4 1/4 1/16 -1/4 -1/16) (-1/8 1/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/16 -3/16 7/16 -3/16) (-1/8 1/4 1/4 1/4 1/8) (1/8 1/4 1/16 -3/16 1/4 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/4 1/4 1/8) (1/8 7/16 -3/16 1/4) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/16 -3/16) (1/16 -3/16 7/16 -1/16 1/4) (1/4 1/4 1/4 1/4) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/4) (1/16 -3/16 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (3/16 -1/2 -1/16 1/16 -3/16) (1/16 -3/16 1/4 1/16 -3/16 1/4) (1/16 -3/16 1/16 -3/16 1/4 1/16 -3/16) (1/4 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/2) (7/16 -3/16 1/16 -3/16 1/8) (1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/16 -3/16 3/8) (1/8 1/16 -3/16 1/4 1/4 1/8) (1/8 1/2 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (3/8 1/4 1/4 1/8) (1/8 1/2 3/8) (1/16 -1/4 -1/16 1/4 1/4 1/8) (1/8 1/4 1/16 -3/16 3/8) (1/16 -1/16 1/4 1/4 1/4 1/8) (1/8 1/2 3/8) (1/8 1/4 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/4 1/4 1/8) (5/16 -3/16 1/4 1/4) (1/4 1/16 -3/16 1/16 -3/16 1/4) (1/4 1/4 1/2) (7/16 -1/16 1/4 1/4) (1/4 1/4 1/4 1/4) (1/16 -3/16 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (1/4 1/4 1/2) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (3/16 -1/2 -1/16 1/16 -3/16) (1/16 -3/16 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/16 -7/16) (1/4 1/16 -3/16 7/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (3/8 1/4 1/4 1/8) (1/8 1/4 1/16 -7/16 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 7/16 -1/4 -1/16 1/8) (1/8 1/4 1/4 1/4 1/8) (1/8 1/16 -3/16 1/4 1/16 -3/16 1/16 -1/16) (-1/8 1/4 1/4 1/16 -3/16 1/8) (1/8 1/4 1/4 1/4 1/8) (5/16 -3/16 1/4 1/16 -3/16) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/16 -3/16) (7/16 -1/16 1/4 1/4) (1/4 1/4 1/4 1/16 -3/16) (1/16 -3/16 1/16 -3/16 1/4 1/16 -3/16) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/2 7/16)))

 

Applying Length augmentation to that will cause a problem no matter how I do it. I'll need to solve that issue first. Thanks!

It should be 

 

(setf sourcelengths '((1/16 -3/16 1/16 -3/16 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/16 -3/16) (-1/4 1/4 1/16 -3/16 1/4) (3/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (1/8 1/2 1/4 1/8) (1/8 1/4 1/4 1/16 -1/4 -1/16) (-1/8 1/16 -3/16 1/16 -3/16 1/4 1/8) (1/8 1/16 -3/16 7/16 -3/16) (-1/8 1/4 1/4 1/4 1/8) (1/8 1/4 1/16 -3/16 1/4 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/4 1/4 1/8) (1/8 7/16 -3/16 1/4) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/16 -3/16) (1/16 -3/16 7/16 -1/16 1/4) (1/4 1/4 1/4 1/4) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/4) (1/16 -3/16 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (3/16 -1/2 -1/16 1/16 -3/16) (1/16 -3/16 1/4 1/16 -3/16 1/4) (1/16 -3/16 1/16 -3/16 1/4 1/16 -3/16) (1/4 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/2) (7/16 -3/16 1/16 -3/16 1/8) (1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/16 -3/16 3/8) (1/8 1/16 -3/16 1/4 1/4 1/8) (1/8 1/2 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (3/8 1/4 1/4 1/8) (1/8 1/2 3/8) (1/16 -1/4 -1/16 1/4 1/4 1/8) (1/8 1/4 1/16 -3/16 3/8) (1/16 -1/16 1/4 1/4 1/4 1/8) (1/8 1/2 3/8) (1/8 1/4 1/4 1/4 1/16 -1/16) (-1/8 1/4 1/4 1/4 1/8) (5/16 -3/16 1/4 1/4) (1/4 1/16 -3/16 1/16 -3/16 1/4) (1/4 1/4 1/2) (7/16 -1/16 1/4 1/4) (1/4 1/4 1/4 1/4) (1/16 -3/16 1/2 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (1/4 1/4 1/2) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/2 1/4) (3/16 -1/2 -1/16 1/16 -3/16) (1/16 -3/16 1/4 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/16 -7/16) (1/4 1/16 -3/16 7/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/8) (1/8 1/4 1/4 1/4 1/8) (3/8 1/4 1/4 1/8) (1/8 1/4 1/16 -7/16 1/16 -1/16) (-1/8 1/16 -3/16 1/4 1/4 1/16 -1/16) (-1/8 7/16 -1/4 -1/16 1/8) (1/8 1/4 1/4 1/4 1/8) (1/8 1/16 -3/16 1/4 1/16 -3/16 1/16 -1/16) (-1/8 1/4 1/4 1/16 -3/16 1/8) (1/8 1/4 1/4 1/4 1/8) (5/16 -3/16 1/4 1/16 -3/16) (1/16 -3/16 1/16 -3/16 1/16 -3/16 1/16 -3/16) (7/16 -1/16 1/4 1/4) (1/4 1/4 1/4 1/16 -3/16) (1/16 -3/16 1/16 -3/16 1/4 1/16 -3/16) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/4 1/4 1/2) (1/4 1/4 1/4 1/4) (1/2 7/16)))

 

Not sure how to remove the extra parenthesis algorithmically though.

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