Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

sort_dict

Sorts list of dicts by key in the given direction. Duplicate entries are not removed.

Build Status

Example

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 }
].

Installation

This package requires Swi-Prolog 7.x.

pack_install(sort_dict).

Known issues

Sorting is not stable.

Bug reports/feature requests

Please send bug reports/feature request through the GitHub project page.

API documentation

See http://packs.rlaanemets.com/sort-dict/doc/.

Changelog

  • 2014-04-22 v0.0.3 - uses dot notation instead of get_dict_ex/3.
  • 2014-02-13 v0.0.2 - uses @< for comparing.
  • 2014-02-04 v0.0.1

License

The MIT License. See LICENSE file.

About

Sorts list of dicts by key in the given direction.

Topics

Resources

License

Packages

No packages published
You can’t perform that action at this time.