Liking cljdoc? Tell your friends :D

Clojure functions to treat klists as maps.

Build status

builds.sr.ht status

Deps

Clojars Project

Klists

Klists are sequential collections of maps with a single key-value pair as maps, similar to traditional lisp plists.

(require '[nl.jomco.klist :as klist])

(klist/get [{:pebbles 1}
            {:barney 2}
            {:fred 3}]
           :barney)
=> 2

This klist format is sometimes found in YAML configuration files:

- pebbles: 1
- barney: 2
- fred: 3

The klist functions can work with nested datastructures containing plain maps and klists:

(require '[nl.jomco.klist :as klist])

(klist/assoc-in {:rubbles     [{:barney 3}]
                 :flintstones [{:wilma 1}
                               {:fred 2}]}
                [:flintstones :fred] :changed)
=> {:rubbles     [{:barney 3}]
    :flintstones [{:wilma 1}
                  {:fred :changed}]}

Most functions in nl.jomco.klist have the same name as the corresponding functions in clojure.core, so requireing with an alias is strongly recommended over using :refer.

These datastructures are slow and mostly useless, so don't use it unless you have to deal with data that is already in this format.

Can you improve this documentation?Edit on sourcehut

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close