Did you know ... | Search Documentation: |
Packs (add-ons) for SWI-Prolog |
Title: | Sorts dicts by key |
---|---|
Rating: | Not rated. Create the first rating! |
Latest version: | 0.0.3 |
SHA1 sum: | d9c1a6dd2f6107143fde960282b55eea6584a4ee |
Author: | Raivo Laanemets http://rlaanemets.com/ |
Home page: | https://github.com/rla/sort-dict |
No reviews. Create the first review!.
Version | SHA1 | #Downloads | URL |
---|---|---|---|
0.0.3 | d9c1a6dd2f6107143fde960282b55eea6584a4ee | 116 | http://packs.rlaanemets.com/sort-dict/sort_dict-0.0.3.tgz |
0.0.2 | f0350d538b7c3a9aceaef851550fe95a63ea83b0 | 2 | http://packs.rlaanemets.com/sort-dict/sort_dict-0.0.2.tgz |
0.0.1 | 2fa7c99cc7692f426682b04b0689fe65b58a8398 | 2 | http://packs.rlaanemets.com/sort-dict/sort_dict-0.0.1.tgz |
Sorts list of dicts by key in the given direction. Duplicate entries are not removed.
Sorting some things by the key weight
in the descending order:
?- sort_dict(weight, desc, [ object{ name: paper, weight: 0.01 }, object{ name: rock, weight: 1.0 }, object{ name: scrissors, weight: 0.2 } ], Sorted). ?- Sorted = [ object{ name:rock, weight:1.0 }, object{ name:scrissors, weight:0.2 }, object{ name:paper, weight:0.01 } ].
This package requires Swi-Prolog 7.x.
pack_install(sort_dict).
Sorting is not stable.
Please send bug reports/feature request through the GitHub project page.
See http://packs.rlaanemets.com/sort-dict/doc/.
@<
for comparing.The MIT License. See LICENSE file.
Pack contains 5 files holding a total of 5.4K bytes.