Hi Sunanda,
On Tuesday, November 4, 2003, 1:02:28 PM, you wrote:
Sac> As I needed the answer yesterday, I hacked together some code. But there has
Sac> got to be a more elegant way, surely. Maybe using parse on a block?
With PARSE, a solution could be:
block: [
12 13 14 15 16 17
7 8
20 21 22 23 24 25 26
19
59 58 57 56 55 54 53 52
20 21 22 23
101 102 103 104 105 106 107
]
results: []
parse block [
some [
start:
set value integer!
any [
(value: value + 1)
1 1 value
]
finish:
(insert/only results reduce [negate offset? start finish index? start
copy/part start finish])
]
]
foreach result sort results [
print ["Sequence:" result/3 "(len" negate result/1 "pos" result/2 ")"]
]
This is less efficient because it is using SORT to find the best
result, however has the advantage of giving the other results too.
The sort can be avoided, anyway.
Regards,
Gabriele.
--
Gabriele Santilli <[EMAIL PROTECTED]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
--
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.