Re: Sort within self-defined procedure
- To: mathgroup at smc.vnet.net
- Subject: [mg108601] Re: Sort within self-defined procedure
- From: Tomas Garza <tgarza10 at msn.com>
- Date: Thu, 25 Mar 2010 04:23:22 -0500 (EST)
Perhaps using SetDelayed (i.e., :==) instead of just Set (==) in the definition of ks?
In[19]:== ks[x_]:==Module[{l},l=={1,5,x,2};
Sort[l,Greater]]
In[20]:== ks[20]
Out[20]== {20,5,2,1}
Tomas
> Date: Wed, 24 Mar 2010 04:42:34 -0500
> From: postitdummy at arcor.de
> Subject: [mg108582] Sort within self-defined procedure
> To: mathgroup at smc.vnet.net
>
> Hi,
>
> I am desperate. Why is it not possible to sort a list within a self-
> defined procedure?
>
> Here comes the minimal example
>
> In[188]:== ks[x_] == Module[{l},
> l == {1, 5, x, 2};
> Sort[l, Greater]
> ]
>
> Out[188]== {5, x, 2, 1}
>
> In[190]:== ks[20]
>
> Out[190]== {5, 20, 2, 1}
>
> Dornakul
> Using Mathematica 7 on a Windows machine
>