< Back to IRCAM Forum

Adding a level of parenthesis to a list

Hi, I have a LISP question. For the interface I’m building I need the lists to have an extra level of parenthesis.

I’m making two inputs

A. (50 4)
B. (4 2 4 5 8)
C. ? (Question mark)

that should end in this list:

(? (((50 4) (4 2 4 5 8))))

It would be practical in the patch I’m building, that I can write one level of parenthesis for A and B, and that the patch adds an extra level. Now I have to write both levels as in the attached example.

Best

Dagfinn

Dear Dagfinn,

I suspect you want to do this ?:

If not, please can you develop your problem.

Best
:slight_smile:
K

Dear Karim, thanks a lot for your answer with examples!

I’m modifying a patch I’ve got from you.

Is there in LISP a function that is the opposite of “flat”? A function that adds an extra level of parentheses. That would be practical for the interface of the algorithm.
Example:scale2.omp (14.2 KB)


Input (50 4) → ((50 4))

Best

Dagfinn

Yes, of course:

Screenshot_2021-05-16_11-15-41

But i am not sure i am getting your question. By the way, there is a missing function in your patch, so I can’t check your problem.

Sorry
K

Thanks a lot, great!

Here an optimised version of the patch. I’ve also added screen shots.

I’m doing tests of my Harmonic skins and position mapping (dedicated to you) and I’ve developed 16 pitch tools, eight rhythmic tools and six common tools. I’m writing a new manual. Perhaps it can be developed to a library.

Best

Dagfinn

scale2 2.omp (14.6 KB)

1 Like