#43 zexy msgfile sort

open
zexy (1)
5
2006-08-21
2006-07-08
No

PART 1: SIMPLE SORT

I would find it useful if [msgfile] had a 'sort'
method. This could be [sort( to sort in normal order
or [sort reverse( to sort in reverse order.

Case-sensitive or no, either would be useful, though
not a high priority for me personally to be able to
choose which.

However a stable sorting algorithm is a high priority
for me, meaning that repeated calls of [sort( with no
intervening operations leave the order of the lines the
same.

Here is an example of a sorted list of messages in
(some) normal order:

---cut-here---
#ffeeff
1
2
10
AMBULANCE
FIRE-ENGINE
Fire-Engine
FOG
a
a blah
ablah 1
ablah 2 foo
zimmer
---cut-here---

PART 2: ADVANCED SORT

An advanced sorting method could be the following:

[pdsort mycallbackreceiver myleftreceiver myrightreceiver(

Which would allow arbitrary Pd patch implementation of
comparison operations. On receiving this message,
[msgfile] would, for each comparison operation, act as
follows:

Given we need to compare $1 < $2, execute the message:

[ ;
myrightreceiver $2;
myleftreceiver $1;
mycallbackreceiver XXX
(

where XXX is a receive-symbol for the Pd patch
comparison implementation to reply to.

For single floats, the Pd patch comparison
implementation could be:

[r my-cb-r] [r my-l-r] [r my-r-r]
| | |
| [ < ]
| |
[pack s f ]
|
[ ; $1 $2 (

PART 3: CONCLUSION

Simple sort with some stable algorithm that sorts
numbers numerically and symbols alphabetically with
'anythings' handled in the obvious way would be more
than enough for me.

The advanced sort would allow more flexibility, but
would be horrible to implement, at a guess...

Thank you for your attention :)

Discussion


Anonymous


Cancel   Add attachments