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

[REBOL] Re: sorting a serie ....

From: tim:johnsons-web at: 18-Jun-2003 15:52

I'm a short man among the tall when it comes to the talent on this list. I split my coding time between python and rebol, and find myself switching languages sometimes every hour. Besides the obvious trip-ups, like confusing ':' and '=' and '=' and '==', I still stumble over the issue of a rebol 'word', because there is no real comparison in other languages.... the subtleties remain elusive for me still ..... tim * Brett Handley <[brett--codeconscious--com]> [030618 15:06]:
> Hi Arnaud, > > There has been plenty responses answering your problem, I just want to add a > little more detail on the reason the solutions work. > > 1) A block is an ordered sequence of values. > 2) [a b c] is a block of three values. These value are of type word! *not > integer!* > 3) Words can indirectly express other values. The user guide says "An > indirectly expressed value is unknown until it is evaluated." > > In overview, in your example you need to sort [255 1 -1] which is a result > of the evaluation of: REDUCE [a b c]. > Sort [red green blue] sorts the three block values - words - using their > spelling as you have discovered. > > Looking at some of the solutions. > > Max suggested: > print sort compose [(a) (b) (c)] > He was creating the [255 1 -1] block first using Compose. > > Max and others suggested > print sort reduce [a b c] > As noted above Reduce creates the [255 1 -1] that is subsequently sorted. > > Tim suggested: > print sort/reverse [a b c] > This works because Print implicitly carries out a REDUCE. > > Hope that was useful! > Brett. > > ----- Original Message ----- > From: "Arnaud" <[garcia--a2--wanadoo--fr]> > To: <[rebol-list--rebol--com]> > Sent: Thursday, June 19, 2003 3:32 AM > Subject: [REBOL] sorting a serie .... > > > > > Hello, > > I try to find the minimun of a serie (print first reduce sort serie). > > > > the problem: the sort function works with the name of the variable instead > > of using their values, even if a use ":" > > example: > > a: 255 > > b: 1 > > c: -1 > > >> print sort[:a :b :c] > > 255 1 -1 > > > > >> print sort[a b c] > > 255 1 -1 > > > > And I would like: > > -1 1 255 > > > > how can I do this ? > > > > thanks > > arnaud > > > > > > -- > > To unsubscribe from this list, please send an email to > > [rebol-request--rebol--com] with "unsubscribe" in the > > subject, without the quotes. > > > > > > -- > To unsubscribe from this list, please send an email to > [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com http://www.johnsons-web.com