Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: false == 2 ??

From: larry:ecotope at: 1-Jul-2001 21:05

Hi Graham, Volker, Robert
>> help pick
USAGE: PICK series index DESCRIPTION: Returns the value at the specified position in a series. PICK is an action value. ARGUMENTS: series -- (Type: series pair event money date time object port tuple any-function) index -- (Type: number logic) So PICK is an action. Actions are polymorphic functions that can have very different effects depending on the datatype of the arguments. PICK takes a number or a logic arg. If the arg is a number it is used as an index into the series arg. If it is a logic value, it returns the first element for true and the second element for false.
>> pick [545 676 828] true
== 545
>> pick [545 676 828] false
== 676 There is no connection with any numeric value associated with true and false. As Robert mentioned,
>> to-integer true
== 1
>> to-integer false
== 0 Also
>> to-logic 0
== false
>> to-logic -123.5
== true
>> to-logic 123.5
== true So to-logic returns false for 0 or 0.0 and returns true for all other numbers. Cheers -Larry