You actually do not need to enbed each record in a block.  For each
SORT call you can use the /skip refinement to define the length of
the record.  This way you can do the SORT by name like this:
sort/skip citas 4
and by email:
sort/compare/skip citas func [x y] [ (second x) < (second y) ] 4

This is not always a better solution, just flatter.  It depends on all 
the functionality that you wish to implement which way you want to do
it.

One last note is that if you joined your date and time fields to a
REBOL date value, you could also sort by date and time at once.  With
the fields split, SORTing by date and time together will be difficult.

Sterling

> Try
> >> citas: [
> [    ["Javier Delgado"  [EMAIL PROTECTED]     8:30 1/12/1999]
> [    ["Pancho lopez"    [EMAIL PROTECTED]            9:00 2/12/1999]
> [    ["Margarita Masa"  [EMAIL PROTECTED]  8:30  4/08/1999]
> [    ]
> 
> Note that I've embedded each record in its own block. 
> 
> 
> >
> >how can I sort it by name or by mail?
> 
> by name:
> >> sort citas
> == [["Javier Delgado" [EMAIL PROTECTED] 8:30 1-Dec-1999] ["Margarita
> Masa" Margarita@closeup.
> com.mx 8:30 4-Aug-1999] ["Pancho ...
> 
> 
> by email:
> >> sort/compare citas func [x y] [ (second x) < (second y) ]
> == [["Javier Delgado" [EMAIL PROTECTED] 8:30 1-Dec-1999] ["Margarita
> Masa" Margarita@closeup.
> com.mx 8:30 4-Aug-1999] ["Pancho ...
> 
> 
> >how can i print the value of, for example the time of the second record?
> >
> 
> >> third second citas
> == 8:30
> 
> >if i have have defined elsewhere:
> >
> >  Newperson: "Fulano de tal"
> >  Newmail: [EMAIL PROTECTED]
> >  Newhour: 10:50
> >  newdate: 4/11/1999
> >
> > how i append the data?
> >
> >if i use:
> >
> >append citas [newperson newmail newhour newdate]
> >
> >it appends the variable names instead of the variable values!!!
> 
> append/only citas reduce [newperson newmail newhour newdate]
> 
> >> Newperson: "Fulano de tal"
> == "Fulano de tal"
> >> Newmail: [EMAIL PROTECTED]
> == [EMAIL PROTECTED]
> >> Newhour: 10:50
> == 10:50
> >> newdate: 4/11/1999
> == 4-Nov-1999
> 
> >> append/only citas reduce [newperson newmail newhour newdate]
> == [["Javier Delgado" [EMAIL PROTECTED] 8:30 1-Dec-1999] ["Margarita
> Masa" Margarita@closeup.
> com.mx 8:30 4-Aug-1999] ["Pancho ...
> 
> >> foreach record citas [print record]
> Javier Delgado [EMAIL PROTECTED] 8:30 1-Dec-1999
> Margarita Masa [EMAIL PROTECTED] 8:30 4-Aug-1999
> Pancho lopez [EMAIL PROTECTED] 9:00 2-Dec-1999
> Fulano de tal [EMAIL PROTECTED] 10:50 4-Nov-1999
> >>
> 
> 
> >
> >but if i have defined the block with make block!,
> 
> I don't quite understand what you mean here
> 
> >it appends the values, 
> 
> how do you know that if ...
> 
> >but then if i print
> >
> >print [citas]
> >
> >it prints "citas" instead of the value of citas!!!
> 
> this is what it prints? Look:
> 
> >> print citas
> Javier Delgado [EMAIL PROTECTED] 8:30 1-Dec-1999 Margarita Masa
> [EMAIL PROTECTED] 8:30
>  4-Aug-1999 Pancho lopez [EMAIL PROTECTED] 9:00 2-Dec-1999 Fulano de tal
> [EMAIL PROTECTED] 10:50 4-N
> ov-1999
> 
> >
> >i am confussed !
> 
> This last point confuses me a bit as well. I'm not sure what you were doing
> to have REBOL print citas/
> 
> Hope this helps,
> 
> Elan

Reply via email to