View Issue Details

IDProjectCategoryView StatusLast Update
0000366LDMudEfunspublic2005-02-20 12:58
Reporterbubbs Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Summary0000366: sort() efun
DescriptionImplement a mapping aware sort() efun.

sort() would sort arrays and mappings, but always return an array.

In the case of arrays, it would act like sort_array().

In the case of mappings, if no index is specified, then sort the mapping keys.
Alternatively, specify an index to sort on mapping values.

Optionally, use #'> as the default sorting function.
Additional Informationsort(mixed *array)
- would return sort_array(array, #'>)

sort(mixed *array, string|closure func, ...)
- would return sort_array(array, func, ...)

sort(mapping mapp)
- would return sort_array(m_indices(mapp), #'>)

sort(mapping mapp, string|closure func, ...)
- would return sort_array(m_indices(mapp), func, ...)

sort(mapping mapp, int index)
- would return the keys of the mapping mapp, ordered by:
    ( mapp[key1, index] > mapp[key2, index] ).

sort(mapping mapp, int index, string|closure func, ...)
- would return the keys of the mapping mapp, ordered by:
    funcall(func, mapp[key1, index], mapp[key2, index], ... ).
  Effectively,
    map(sort(mapp, index, func...), mapp) == sort(m_values(mapp, index), func...)
TagsNo tags attached.
External Data (URL)

Activities

bubbs

2005-02-20 12:58

reporter   ~0000331

Correction:
  Effectively,
    map(sort(mapp, index, func...), mapp) == sort(m_values(mapp, index), func...)

Should be:
  Effectively,
    map(sort(mapp, index, func...), mapp, index) == sort_array(m_values(mapp, index), func...)

Except map(mixed *, mapping, int) doesn't work - see other issue.

Additionally, I should be clear that sort(mapping, ...) ALWAYS returns the keys of the mapping.

Issue History

Date Modified Username Field Change
2005-02-20 12:49 bubbs New Issue
2005-02-20 12:58 bubbs Note Added: 0000331