virex wrote:Also if you really need to, you can use (declare (special variable)) directly after a let-form's variable definition to tell the compiler that variable is special, which allows shadowing, but prevents outside access since there is no global symbol associated with the variable, so you have a special local variable then.

If you declare a variable special, it's accessible from any other function that uses that symbol name for a variable in a context where it's special. I.e., the symbol used to name it is a "global symbol associated with the variable."

virex wrote:Also if you really need to, you can use (declare (special variable)) directly after a let-form's variable definition to tell the compiler that variable is special, which allows shadowing, but prevents outside access since there is no global symbol associated with the variable, so you have a special local variable then.

If you declare a variable special, it's accessible from any other function that uses that symbol name for a variable in a context where it's special. I.e., the symbol used to name it is a "global symbol associated with the variable."

Actually, to solve the task recursively, I'ld propose a solution quite similar to your attempt above.You just don't need this new-lst variable.That is, if you do (cons 1 ()) you get a new list, so there is no need to establish an explicit binding in numbers...Just cons each number on the value of the recursive application until you reach nil. Then return nil. So the call tree would evaluate to sth. like this:

Once again, thank you everyone for the help so far. I haven't posted anything in a while. I haven't forgotten about this thread:)The only reason for that is that I've got a very busy period at work and have to bring a lot of paperwork home so don't reallyhave time for lisp. I think I'll have more time in a week or so and will be able to come back to this thread.