- my mail within my system definitions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun geta (alist key) | |
"Similar to assoc-value... but operates in depth! | |
key can be a list or a single key." | |
(when (and alist key) | |
(etypecase key | |
((or string symbol) | |
(alexandria:assoc-value alist key :test 'string=)) | |
(cons | |
;; associate in depth | |
(if (cdr key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun endless (str pos len) | |
(if (<= pos len) | |
(elt str pos) | |
(if (zerop (mod pos len)) | |
(elt str len) | |
(elt str (1- (mod pos len)))))) | |
(defun square-val (x y str len) | |
(cond | |
((eql y 0) (elt str x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; (c) 2019 Defunkydrummer | |
;; MIT License | |
(defun indent (str &key with-indent) | |
"Indent a string" | |
(format t | |
(format nil "~~~dT ~~a" (1+ with-indent)) | |
str)) | |
(defun |brutally practical line| (l &optional (indent 0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- mode: lisp -*- | |
;; | |
;; A quick and dirty tree shaker for SBCL. Basically, it destroys the | |
;; package system and does a gc before saving the lisp image. Gives | |
;; about a 40% reduction in image size on a basic hello world test. | |
;; Would like to hear how it works on larger projects. | |
;; | |
;; Original idea from: https://groups.google.com/d/msg/comp.lang.lisp/6zpZsWFFW18/WMy4PyA9B4kJ | |
;; | |
;; Burton Samograd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun getf* (l r) | |
"Recursive getf, to traverse nested plists. | |
Ej: | |
list = | |
(:id 10 :detail (:name \"Flavio\" :dni 666)) | |
(getf* list '(:detail :dni)) --> obtains 666 | |