Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: bug when 'p' fails to evaluate?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115776] Re: bug when 'p' fails to evaluate?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 20 Jan 2011 06:31:37 -0500 (EST)

On 1/19/11 at 5:29 AM, lehin.p at gmail.com (Alexey) wrote:

>I wonder why treats Sort[...,p] unevaluated comparison function 'p'
>as if it was evaluated to True. Is it a bug?

>In[1]:= Sort[{a, c, d}, True &] Sort[{a, c, d}, UndefinedFunction &]
>Sort[{a, c, d}, Greater]

>Out[1]= {a, c, d}

>Out[2]= {a, c, d}

>Out[3]= {a, c, d}

>I think the expected behavior should be to return unevaluated
>Sort[...].

Since Sort should do nothing more than change the order of
elements of a list, it seems to me to be perfectly reasonable
for Sort to return the list with the element order unchanged
when it isn't possible to make meaningful comparisons of one
element with another. In fact, I see no advantage to putting
what would amount to a wrapper on the original list if
meaningful comparisons cannot be made.



  • Prev by Date: Mathematica browser plugin with Firefox 3.6.x or 4 beta
  • Next by Date: Re: SetOptions does not work with Grid
  • Previous by thread: Mathematica browser plugin with Firefox 3.6.x or 4 beta
  • Next by thread: Style Question: The Functional Way