Re: question about sequence sorting

new topic     » goto parent     » topic index » view thread      » older message » newer message

include sort.e

function compare_4th_element( sequence a, sequence b )
  compare( a[4], b[4] )
end function

sorted = custom_sort( routine_id( "compare_4th_element" ), unsorted )

Hope this helps.
Lionel

>From: colin ellis <noonian at SUNG79.FREESERVE.CO.UK>
>Reply-To: Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU>
>To: EUPHORIA at LISTSERV.MUOHIO.EDU
>Subject: question about sequence sorting
>Date: Sun, 9 May 1999 04:57:05 +0100
>
>Hi, Col22 (Colin Ellis) here with a little questionette.
>
>I have a sequence of x length, of sequences of 4 atoms.
>e.g.
>sequence snafu
>snafu = {{1,3,5,8},{1,2,3,4}, ..... ,{1,3,5,7}}
>
>My question is, What would be the most efficient/(any) way of sorting
>the sequences(of four) into ascending order (fourth atom in the sequence
>being the one to sort by).
>
>help appreciated,
>Thank you in advance, Col22


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu