partial

partial[paolo][f_,v_,1]:=f[v,#1,#2]&
partial[paolo][f_,v_,2]:=f[#1,v,#2]&
partial[paolo][f_,v_,3]:=f[#1,#2,v]&

test1[a_,b_,c_]:=a^b+c

#1^#2+#3&

Function[{x,y,z},x^y+z]

test[1]={
partial[paolo][test1,Pi,1][b,c],
partial[paolo][test1,Pi,2][a,c],
partial[paolo][test1,Pi,3][a,b]}

test[2]={
partial[paolo][#1^#2+#3&,Pi,1][b,c],
partial[paolo][#1^#2+#3&,Pi,2][a,c],
partial[paolo][#1^#2+#3&,Pi,3][a,b]}

test[3]={
partial[paolo][Function[{x,y,z},x^y+z],Pi,1][b,c],
partial[paolo][Function[{x,y,z},x^y+z],Pi,2][a,c],
partial[paolo][Function[{x,y,z},x^y+z],Pi,3][a,b]}

SameQ@@Array[test,3]

eval

Insert[{a,b,c,d,e},Pi,3]

eval[paolo][f_,v_,p_]:=
Apply[f,Insert[{##},v,p]]&

f@@Insert[{##},v,p]

myFun=Function[{a,b,c,d,e,f,g},
a+b/c+d^e+Sin[f]/Cos[g]];

myFun[x,y,z,w,h,k,j]

eval[paolo][myFun,Pi,3][x,y,w,h,k,j]

myFun2[args__]:=
MapIndexed[g,{args}]

myFun2[a,b,c,d,e,f,g]

eval[paolo][myFun2,Pi,3][a,b,d,e,f,g]

nested

nested[paolo][f_,k_]:=Nest[f,#,k]&

nested[paolo][Sin,4][t]

nested[paolo][Sin,4][3.]-Sin[Sin[Sin[Sin[3.]]]]

nested[paolo][#^2+#+1&,4][t]//Expand

nested[paolo][#^2+#+1&,4][2]

f[x_]:=x^2+x+1

f[f[f[f[2]]]]

pure

pure[f_,0]:=#&
pure[f_,1]:=f

pure[f_,k_]:=
pure[f,k-1][f[#]]&

Clear[f]

pure[f,4][t]

pure[Sin,4][3.]-nested[paolo][Sin,4][3.]

pure[f,4]

pure2[f_,0]:=#&

pure2[f_,k_]:=
f[pure2[f,k-1][#]]&

pure2[g,4][t]

pure2[Sin,4][3.]-nested[paolo][Sin,4][3.]

seq

seq[paolo][n_,inc_,limit_]

next[visited_List,current_,inc_,limit_]:=
If[current>limit, visited,
With[{low=current-inc, high=current+inc},
If[low>=0&&FreeQ[visited,low],
next[Join[visited,{low}],low,inc+1,limit],
next[Join[visited,{high}],high,inc+1,limit]
]
]
]

next[{},0,1,10]

seq[paolo][n_,inc_,limit_]:=next[{},n,inc,limit]

seq[paolo][0,2,100]

visual

Graphics[
{Green,
Circle[{2,1},3,{-Pi,0}],
Circle[{4.5,1},2,{0,Pi}]}
]

visual[visited_List,arcs_List,current_,inc_,limit_]:=
If[current>limit, arcs,
With[{low=current-inc, high=current+inc},
If[low>=0&&FreeQ[visited,low],
visual[
Join[visited,{low}],
Join[arcs,{Circle[{current-inc/2,0},inc/2,{-Pi,0}]}],
low,inc+1,limit
],
visual[
Join[visited,{high}],
Join[arcs,{Circle[{current+inc/2,0},inc/2,{0,Pi}]}],
high,inc+1,limit
]
]
]
]

visual[{0},{Green},0,1,100]//Graphics

Mod[#,12]&/@seq[paolo][0,1,100]

SoundNote[3,2]//Sound

SoundNote[Mod[#,12],.1]& /@seq[paolo][0,1,1000] //Sound

Patterns & Recap

t[ _[_, a_]]:= Pi

t[ f_[x_, y_]]:= {f,x,y}

?t

t[g[a,b]]

t[Sin[x,y]]

t[Sin[x+y]]

t[Sin[3+Pi]]

Sin[3+Pi]

Optional arguments

f[a_,b_,c_,mode_:"Lower"]:=
Switch[mode,
"Lower",{{a,0},{b,c}},
"Upper",{{a,b},{0,c}},
mode,Print["I don't understand you"];Abort[]
]

f[Pi,E,3]//MatrixForm

f[Pi,E,3,"Lower"]//MatrixForm

f[Pi,E,3,"lower"]//MatrixForm

2 x2 matrices

isLowerQ[M_]:=M[[1,2]]==0

isLowerQ[{{_,0},{_,_}}]:=True

isLowerQ[_]:=False

isLowerQ[f[1,2,3]]

isLowerQ[f[1,2,3,"Upper"]]

Clear[f]

f[a_^b_]:={a,b}

{
f[1^2],
f[2^1],
f[Pi^(t+y)],
f[(t+y)]
}

ff[a_^(b_:1)]:={a,b}

{
ff[1^2],
ff[2^1],
ff[Pi^(t+y)],
ff[(t+y)]
}

Clear[f]

3 x3 matrix

f[{{a_,0,0},
{b_,c_,0},
{d_,e_,f_}}]:={d,e,f}

f[{{1,2,3},{4,5,6},{7,8,9}}]

f[{{1,0,0},{4,5,0},{7,8,9}}]

g[{{_,0,0},
{_,_,0},
r:{_,_,_}}]:=r

g[{{1,0,0},{4,5,0},{7,8,9}}]