MathGroup Archive 2011

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

Search the Archive

Re: Weird Position[list,form] behavior when used inside of Module.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117099] Re: Weird Position[list,form] behavior when used inside of Module.
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 9 Mar 2011 07:03:06 -0500 (EST)

Works here

$Version

"8.0 for Mac OS X x86 (64-bit) (November 6, 2010)"

Module[{A, B, RETURN},
 A = {5.3, 5.4, 5.2, 5.9};
 B = Position[A, Min[A]];
 RETURN = B]

{{3}}

Note that your RETURN is unnecessary

Module[{A, B},
 A = {5.3, 5.4, 5.2, 5.9};
 B = Position[A, Min[A]]]

{{3}}


Bob Hanlon

---- Dwayne <dwaynedcole at gmail.com> wrote: 

=============

This works:

Position[A, Min[A]]]

where, A = {5.3, 5.4, 5.2, 5.9}.  the Position function returns ( 3 ).

But this doesn't

Module[{ A, B, RETURN},
             A = Table[ F, {i,{.1, .2, .3, .4}]; (* The function F
returns {5.3, 5.4, 5.2, 5.9} *)
             B = Position[A, Min[A]];
            RETURN = B]

The above module returns, { }.

Is this a bug?





  • Prev by Date: Re: Set diagonal of square matrix
  • Next by Date: Finding Clusters
  • Previous by thread: Weird Position[list,form] behavior when used inside of Module.
  • Next by thread: Re: Weird Position[list,form] behavior when used inside of Module.