I'm too lazy to evaluate those assignments, but I'm pretty sure you'll get an error ... something like missing or bad function ...
added: addressed to the OP.
Yep, correct. There are too many parentheses in there. A very good reason for using a decent editor. The OP's code should look like this instead:
(list '
(23 23 23 23) '
(23 23 23) '
(23 23) '
(23)) (list '
(12 12 12 12 12 12 12 12) '(12 12 12 12 12 12 12) '(12 12 12 12 12 12) '(12 12 12 12 12) '(12 12 12 12) '(12 12 12)
'(12 12) '(12)))
a2 100)
Then that should result in:
_$ a1
(((45 45) (45)) ((34 34) (34)) ((23 23 23 23) (23 23 23) (23 23) (23)) ((12 12 12 12 12 12 12 12) (12 12 12 12 12 12 12) (12 12 12 12 12 12) (12 12 12 12 12) (12 12 12 12) (12 12 12) (12 12) (12)))
_$ a2
100
Now is there a reason you have them in sub-lists? Should the permutations only happen between these? Or should some combinations also occur between items in the same sublist, e.g.:
(12 12) + (12)
Sorry, from samples this is unclear. If this is allowable, then making it slightly simpler would be to append all the sublists (i.e. flatten) into one list like so:
_$ (apply 'append a1)
((45 45) (45) (34 34) (34) (23 23 23 23) (23 23 23) (23 23) (23) (12 12 12 12 12 12 12 12) (12 12 12 12 12 12 12) (12 12 12 12 12 12) (12 12 12 12 12) (12 12 12 12) (12 12 12) (12 12) (12))
Else the combinations become slightly more complex.
Edit: Also are the numbers always positive? That could allow for some algorithmic optimization as some combinations could immediately be omitted.