summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNic Ferier <nic@ferrier.me.uk>2012-09-09 18:35:50 +0100
committerNic Ferier <nic@ferrier.me.uk>2012-09-09 18:35:50 +0100
commit24a493ca6274093670ac20e81db3964c2538e9f3 (patch)
tree15f1ed0a85c86d50541db081a799f703fad56128
parenta63cb5d2c06aacd567e4b7da67b1670f4d918089 (diff)
README, small fix and version bump
-rw-r--r--README.creole75
-rw-r--r--kv.el7
2 files changed, 79 insertions, 3 deletions
diff --git a/README.creole b/README.creole
new file mode 100644
index 0000000..473d1e1
--- /dev/null
+++ b/README.creole
@@ -0,0 +1,75 @@
+A collection of tools for dealing with key/value data structures such
+as plists, alists and hash-tables.
+
+=== kvalist->hash alist &rest hash-table-args ===
+
+Convert //alist// to a HASH.
+
+//hash-table-args// are passed to the hash-table creation.
+
+
+=== kvalist->keys alist ===
+
+Get just the keys from the alist.
+
+
+=== kvalist->plist alist ===
+
+Convert an alist to a plist.
+
+
+=== kvalist->values alist ===
+
+Get just the values from the alist.
+
+
+=== kvalist-sort alist pred ===
+
+Sort //alist// (by key) with //pred//.
+
+
+=== kvalist-sort-by-value alist pred ===
+
+Sort //alist// by value with //pred//.
+
+
+=== kvdotassoc expr table ===
+
+Dotted expression handling with [[assoc]].
+
+
+=== kvdotassoc-fn expr table func ===
+
+Use the dotted //expr// to access deeply nested data in //table//.
+
+//expr// is a dot separated expression, either a symbol or a string.
+For example:
+
+{{{
+ "a.b.c"
+}}}
+
+or:
+
+{{{
+ 'a.b.c
+}}}
+
+If the //expr// is a symbol then the keys of the alist are also
+expected to be symbols.
+
+//table// is expected to be an alist currently.
+
+//func// is some sort of [[assoc]] like function.
+
+
+=== kvdotassq expr table ===
+
+Dotted expression handling with [[assq]].
+
+
+=== kvhash->alist hash ===
+
+Convert //hash// to an ALIST.
+
+
diff --git a/kv.el b/kv.el
index b2d1640..1a76f6f 100644
--- a/kv.el
+++ b/kv.el
@@ -4,7 +4,7 @@
;; Author: Nic Ferrier <nferrier@ferrier.me.uk>
;; Keywords: lisp
-;; Version: 0.0.2
+;; Version: 0.0.3
;; Maintainer: Nic Ferrier <nferrier@ferrier.me.uk>
;; Created: 7th September 2012
@@ -46,14 +46,15 @@ HASH-TABLE-ARGS are passed to the hash-table creation."
(defun kvhash->alist (hash)
"Convert HASH to an ALIST."
- (let (store)
+ (when hash
+ (let (store)
(maphash
(lambda (key value)
(setq
store
(append (list (cons key value)) store)))
hash)
- store))
+ store)))
(defun kvalist->plist (alist)
"Convert an alist to a plist."