I would like to pass to the macro not only list itself: '((1 2 3)(4 5 6)), but also a variable (setf thelist '((9 8 7)(6 5 4)(3 2 1)))

(n-mapcar #'(lambda (x y z) (* x y z)) thelist)

and I tried hundred different ways and can't do that.

The ncr macro must stay as is because it makes recursive nesting of mapcans and mapcar, so it's structure should be clear.It seems there is a need for another macro which passes arguments to ncr, and part of them stays unevaluated, and rest part is (lst).

In one of previous experiments I successfully used an EVAL, but all big people (Norvig, Seibel, Graham) suggest to avoid it especiallyin such constructs as mine.

You should nearly always use functions, not macros, i basically see macros as little decorations to make code look better and have less parenthesis. (An exception being simple iteration constructs, like dolist) The rest is to be done with taking functions as arguments.

In this case, there is a simple -but not so simple to find- recursive way to get this using functions. I had to muck about a little before finding it.

I tried to explain how it works in words, i failed to produce anything good. Basically got keeps track on the arguments gathered so-far, when list runs out, you know we have all that we need to call funcall with it, if the list did not run out yet, call n-mapcar for each element from the first element of the list (car list), and the rest of the list, while adding the elements to what we got.

If you did this iteratively you would have to keep a list storing the positions where you are on the different lists. You would have to increment the position for the different lists one by one, and funcall the function for each combination. Recursively, keeping track of the list storing the positions is easier. (Lisp does it for you, not a special lisp feature, though; C and such would too.)

I don't know how to make that funcall with multiple elements, but the following might help:

Your "quick hack" only works for commutative operators, I would call it "n-reduce". It doesn't work for, e.g., #'list. I believe using curry (it is easy to implement, metatilities has it) is also a good solution, and it will make it work the way it's intended to.

@Ajschylos: Don't destroy the code you made for the macro, you can use it to create a compiler macro if you want. Anyway, making it is interesting to learn how to write compiler macros at least.

This is the first time i made a compiler macro. It works if you convert it into a ordenary macro. (Watch out for infinite loops though!) If i run the last it doesn't print (cadr list), so i am not entirely sure if it is correct. Have no clue why it doesn't print it, the compiler macro should be triggered.