0
$\begingroup$

I'm having some trouble with Mathematica's placeholders within functions. The function sel[lowerLimit_] should select all elements of x that are greater than the lowerLimit:

In[227]:= x = Range[10]
Out[227]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

sel[lowerLimit_] = Select[x, # > lowerLimit &]
Out[230]= {}

However, as you can see in Out[230], Mathematica doesn't let me create the function sel.

Does someone have an idea why this is happening?

$\endgroup$
  • 2
    $\begingroup$ sel[lowerLimit_]: = Select[x, # > lowerLimit &] . you need SetDelayed not Set. You should then be able to call your function. $\endgroup$ – ubpdqn Feb 2 '15 at 8:15
  • $\begingroup$ That was it, thanks! $\endgroup$ – alxppp Feb 2 '15 at 8:22
  • 1
    $\begingroup$ you're welcome...it is a common issue when you're starting...and even later...the power of ':', like the power of the hyphen, e.g. "I resign" v "I re-sign":) $\endgroup$ – ubpdqn Feb 2 '15 at 8:25