Jump to content

Recommended Posts

Dear All,

 

just a little help, please !

 

Here´s a list of scales...

 

((fs4 gs4 a4 b4 cs5 eb5 e5) (db5 eb5 f5 g5 ab5 bb5 c6) (cs5 eb5 e5 fs5 gs5 bb5 b5) (bb4 c5 d5 e5 f5 g5 a5) (d4 e4 f4 g4 a4 b4 c5) (gb4 ab4 bb4 c5 db5 eb5 f5) (g4 a4 b4 cs5 d5 e5 fs5) (f4 g4 a4 b4 c5 d5 e5) (c5 d5 e5 fs5 g5 a5 b5) (cb5 db5 eb5 f5 gb5 ab5 bb5) (g4 a4 b4 cs5 d5 e5 fs5) (f4 g4 a4 b4 c5 d5 e5) (a4 b4 c5 d5 e5 fs5 g5) (c5 d5 e5 fs5 g5 a5 b5) (cs5 eb5 e5 fs5 gs5 bb5 b5) (e4 fs4 g4 a4 b4 cs5 d5) (gb4 ab4 bb4 c5 db5 eb5 f5) (db5 eb5 f5 g5 ab5 bb5 c6) (bb4 c5 d5 e5 f5 g5 a5) (eb4 f4 fs4 gs4 bb4 c5 cs5) (c5 d5 e5 fs5 g5 a5 b5) (a4 b4 c5 d5 e5 fs5 g5) (db5 eb5 f5 g5 ab5 bb5 c6) (g4 a4 b4 cs5 d5 e5 fs5))

 

I just want to pick the same elements of all the sublists. I don´t remember how to do it...

For example (0 2 1) of all the sublists would return  this:

 

((fs4 a4 gs4) 

(db5 f5 eb5)

(cs5 e5 eb5) etc etc

 

Please, some help ?

 

Thanks a lot !

 

Best, 

Julio

 

 

Link to comment
Share on other sites

(setf list
'((fs4 gs4 a4 b4 cs5 eb5 e5) (db5 eb5 f5 g5 ab5 bb5 c6) (cs5 eb5 e5 fs5 gs5 bb5 b5) (bb4 c5 d5 e5 f5 g5 a5) (d4 e4 f4 g4 a4 b4 c5) (gb4 ab4 bb4 c5 db5 eb5 f5) (g4 a4 b4 cs5 d5 e5 fs5) (f4 g4 a4 b4 c5 d5 e5) (c5 d5 e5 fs5 g5 a5 b5) (cb5 db5 eb5 f5 gb5 ab5 bb5) (g4 a4 b4 cs5 d5 e5 fs5) (f4 g4 a4 b4 c5 d5 e5) (a4 b4 c5 d5 e5 fs5 g5) (c5 d5 e5 fs5 g5 a5 b5) (cs5 eb5 e5 fs5 gs5 bb5 b5) (e4 fs4 g4 a4 b4 cs5 d5) (gb4 ab4 bb4 c5 db5 eb5 f5) (db5 eb5 f5 g5 ab5 bb5 c6) (bb4 c5 d5 e5 f5 g5 a5) (eb4 f4 fs4 gs4 bb4 c5 cs5) (c5 d5 e5 fs5 g5 a5 b5) (a4 b4 c5 d5 e5 fs5 g5) (db5 eb5 f5 g5 ab5 bb5 c6) (g4 a4 b4 cs5 d5 e5 fs5)))

 

(setf sl '(0 2 1))


(loop for x in list collect (loop for y in sl collect (nth y x)))
 

Jesper

Link to comment
Share on other sites

(setf list '((fs4 gs4 a4 b4 cs5 eb5 e5) (db5 eb5 f5 g5 ab5 bb5 c6)
             (cs5 eb5 e5 fs5 gs5 bb5 b5) (bb4 c5 d5 e5 f5 g5 a5)
             (d4 e4 f4 g4 a4 b4 c5) (gb4 ab4 bb4 c5 db5 eb5 f5)
             (g4 a4 b4 cs5 d5 e5 fs5) (f4 g4 a4 b4 c5 d5 e5)
             (c5 d5 e5 fs5 g5 a5 b5) (cb5 db5 eb5 f5 gb5 ab5 bb5)
             (g4 a4 b4 cs5 d5 e5 fs5) (f4 g4 a4 b4 c5 d5 e5)
             (a4 b4 c5 d5 e5 fs5 g5) (c5 d5 e5 fs5 g5 a5 b5)
             (cs5 eb5 e5 fs5 gs5 bb5 b5) (e4 fs4 g4 a4 b4 cs5 d5)
             (gb4 ab4 bb4 c5 db5 eb5 f5) (db5 eb5 f5 g5 ab5 bb5 c6)
             (bb4 c5 d5 e5 f5 g5 a5) (eb4 f4 fs4 gs4 bb4 c5 cs5)
             (c5 d5 e5 fs5 g5 a5 b5) (a4 b4 c5 d5 e5 fs5 g5)
             (db5 eb5 f5 g5 ab5 bb5 c6) (g4 a4 b4 cs5 d5 e5 fs5)))

(position-filter '((0 2 1)) list)
=> ((fs4 a4 gs4) (db5 f5 eb5) (cs5 e5 eb5) (bb4 d5 c5) (d4 f4 e4)
    (gb4 bb4 ab4) (g4 b4 a4) (f4 a4 g4) (c5 e5 d5) (cb5 eb5 db5)
    (g4 b4 a4) (f4 a4 g4) (a4 c5 b4) (c5 e5 d5) (cs5 e5 eb5)
    (e4 g4 fs4) (gb4 bb4 ab4) (db5 f5 eb5) (bb4 d5 c5) (eb4 fs4 f4)
    (c5 e5 d5) (a4 c5 b4) (db5 f5 eb5) (g4 b4 a4))

 

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