Skip to main content
1 of 3

What are the scoping rules for function parameters shadowing global symbols?

Here are some very contrived code snippets, highly unlikely to appear in real code, but still I am curious why they behave like this:

Function[List, {1, 2, 3}][Hold] (* Hold[1, 2, 3] *) Function[Function, Function[Slot[1]]][Hold] (* Hold[#1] *) Function[Slot, Function[Slot[1]]][Hold] (* Hold[1] & *) Function[Function, Function[x, 1]][Hold] (* Function[x, 1] *) (* Why not Hold[x, 1]? *) {Function[Null, Null][1]} (* {Null} *) (* Why not 1? *) 

I think I understand the first 3 cases.
Could you please explain the last 2 results?