mirror of
https://gitlab.com/vindarel/ciel.git
synced 2025-12-06 02:30:39 -08:00
parent
4e5485ad98
commit
687472719f
3 changed files with 28 additions and 0 deletions
2
ciel.asd
2
ciel.asd
|
|
@ -142,6 +142,8 @@
|
|||
:serapeum
|
||||
:shlex
|
||||
|
||||
:function-cache ;; memoization
|
||||
|
||||
;; tests
|
||||
:fiveam
|
||||
|
||||
|
|
|
|||
|
|
@ -183,6 +183,8 @@ And there is more. All the available macros are:
|
|||
|
||||
## Functions
|
||||
|
||||
### Partial application
|
||||
|
||||
We import Serapeum's `partial` and Alexandria's `rcurry`. They allow
|
||||
partial application of functions.
|
||||
|
||||
|
|
@ -194,6 +196,25 @@ You can check [Serapeum's function helpers](https://github.com/ruricolist/serape
|
|||
the non-imported ones are only a `serapeum` package prefix away in CIEL if you need
|
||||
them. Other noticeable functions: `distinct`, `once`, `throttle`, `trampoline`, `do-nothing`…
|
||||
|
||||
### Memoization
|
||||
|
||||
We import `defcached` from
|
||||
[function-cache](https://github.com/AccelerationNet/function-cache), a
|
||||
library that provides extensible caching/memoization.
|
||||
|
||||
For example:
|
||||
|
||||
```lisp
|
||||
(defcached (foo :timeout 10) (arg)
|
||||
(sleep 3)
|
||||
arg)
|
||||
```
|
||||
|
||||
Run `(foo 1)`, it sleeps 3 seconds and returns 1. Run `(foo 1)` again
|
||||
and it returns 1 immediately. Its result (for this argument) is cached
|
||||
for 10 seconds.
|
||||
|
||||
|
||||
|
||||
## Bind, more destructuring in `let` (metabang-bind)
|
||||
|
||||
|
|
|
|||
|
|
@ -290,6 +290,11 @@ We currently only try this with serapeum. See *deps/serapeum/sequences-hashtable
|
|||
(export '(apropos-regex
|
||||
apropos-regex-list))
|
||||
|
||||
;; function-cache: memoization
|
||||
(cl-reexport:reexport-from :function-cache
|
||||
:include '(:defcached)) ;; not in binary??
|
||||
|
||||
|
||||
;;;
|
||||
;;; Conveniently add type declarations.
|
||||
;;; Straight from Serapeum, only it is -> thus it conflicts with our arrow-macro.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue