define a function from a list

Scan[] is your friend:

Scan[(f[First[#]] = Last[#]) &, 
  WaveletFilterCoefficients[DaubechiesWavelet[2], "PrimalHighpass"]];
f[_] = 0;

??f
  Global`f
f[-2]=-0.0915064

f[-1]=-0.158494

f[0]=0.591506

f[1]=-0.341506

f[_]=0

You could easily create a pattern doing the replacement for you:

ls = WaveletFilterCoefficients[DaubechiesWavelet[2], "PrimalHighpass"];
rule = Rule @@@ ls
{-2 -> -0.0915064,
 -1 -> -0.158494,
  0 ->  0.591506,
  1 -> -0.341506}

This can now be used as usual, for example

{-1, 1} /. rule
{-0.158494, -0.341506}

If you want to map all integers to 0, append (!) this to your rule list:

AppendTo[rule, _ -> 0];
{-2 -> -0.0915064,
 -1 -> -0.158494,
  0 ->  0.591506,
  1 -> -0.341506,
  _ -> 0}

Be careful though, because when you apply this to a list as before it'll match the whole list as _, replacing it with 0:

1 /. rule
-0.341506
{0, 1} /. rule
0

To properly do the list replacement in this case, use something like

myReplace = # /. rule &;
myReplace /@ {0, 1}
{0.591506, -0.341506}

Depending on your application this may be most efficient:

pts =
  {{-2, -0.0915064},
   {-1, -0.158494},
   { 0,  0.591506},
   { 1, -0.341506}};

f = Interpolation[pts, InterpolationOrder -> 0];

f /@ {1, -1, -2, 0}
{-0.341506, -0.158494, -0.158494, 0.591506}

This assumes that your function will only be given arguments that are in your list rather that points between them, which will otherwise effectively give f[Floor[#]] &.


Also, I recognize the advantage of Scan but I cannot pass the syntactical elegance of:

(f[#] = #2) & @@@ pts;