Re: Sort within self-defined procedure
- To: mathgroup at smc.vnet.net
- Subject: [mg108603] Re: Sort within self-defined procedure
- From: dornakul <postitdummy at arcor.de>
- Date: Thu, 25 Mar 2010 04:23:48 -0500 (EST)
- References: <hocm9o$shi$1@smc.vnet.net>
Thank you very much for all your replies.
The problem was that I did not use the delayed evaluation ":=" instead
of "=" in defining the module.
For some reason, the answers are not shown here on Google groups, but
only in my Email.
Thanks a lot!
Dornakul
On 24 Mrz., 10:33, dornakul <postitdu... at arcor.de> wrote:
> 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