More tweaks to example

This commit is contained in:
Ed Langley
2018-08-18 13:18:07 -07:00
parent 48ff3c1166
commit 7187d8e4bd
2 changed files with 12 additions and 1 deletions

View File

@ -4,7 +4,9 @@ This library provides a language for expressing data manipulations as
the composition of more primitive operations.
#+BEGIN_SRC lisp
DATA-LENS> (funcall (on (compress-runs :collector 'combine-matching-lists)
DATA-LENS> (funcall (on (alexandria:compose
(over (transform-tail (over (slice 1))))
(compress-runs :collector 'combine-matching-lists))
(alexandria:compose
(over (data-lens:juxt
(data-lens:element 0)

View File

@ -102,6 +102,15 @@
(lambda (seq)
(map 'list selector seq)))
(defun slice (start &optional end)
(lambda (it)
(subseq it start end)))
(defun-ct transform-tail (fun)
(lambda (it)
(list* (car it)
(funcall fun (cdr it)))))
(defun-ct key-transform (fun key-get key-set)
(lambda (it)
(let ((key-val (funcall key-get it)))