I have the following code:
(define rest '(((di (a) (b c)) (sh (b) (e d))) ((al (a) (b)))))
(define first '((di (a) (5)) (sh (b) (3))))
I want to get the following list:
(((di (a) (5)) (sh (b) (3))) ((di (a) (b c)) (sh (b) (e d))) ((al (a) (b)))))
meaning, add the list first, to be the first element in rest.
When I do append, it gives me:
((di (a) (5)) (sh (b) (3)) ((di (a) (b c)) (sh (b) (e d))) ((al (a) (b))))
And any other library function, or function that I try to do, didn't help.
Thank you.
Append takes two lists and puts them together. Given that you have a first and a rest, you probably want cons. Cons takes an element and prepends it to a list. In this case, the element is first and the list is rest. So you want something like
(cons first rest)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With