Sign in to follow this  
Followers 0
opmo

Opusmodus 1.2.22016

1 post in this topic

New:

 

position-swap swap list &key seq

 

The function POSITION-SWAP swaps the positions of the items within a list.

 

(position-swap '(0 2) '(0 1 2 3 4 5 6))

=> (2 1 0 3 4 5 6)

 

(position-swap '((0 2) (3 5)) '(c4 d4 e4 f4 g4 a4 b4))

=> (e4 d4 c4 a4 g4 f4 b4)

 

(position-swap '((0 2) (3 5)) '(c4 d4 e4 f4 g4 a4 b4:seq t)

=> ((e4 d4 c4 f4 g4 a4 b4) (e4 d4 c4 a4 g4 f4 b4))

 

(position-swap '((0 2) (3 5)) '(e c4 f d4 p s e4 mp f4 g4 f a4:seq t)

=> ((s e4 mp e d4 p c4 f s f4 mp g4 f a4)

    (s e4 mp e d4 p c4 f s a4 g4 f4 mp))

 

Stephane Boussuge and AM like this

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  
Followers 0