;;; -*- lexical-binding: t -*- ;; ;; -------------------------------------------------------------------------- (require 'cl-lib) (cl-pushnew "." load-path :test #'string=) (require 'luki-lisp) ;; -------------------------------------------------------------------------- (defmacro bad-timing (&rest body) "http://nullprogram.com/blog/2009/05/28/" (let ((beg (make-symbol "beg"))) `(let ((,beg (float-time))) ,@body (- (float-time) ,beg)))) ;; (bad-timing (cl-loop repeat (** 2 16) do (+ 1 (- 1 (* 1 (/ 1 (** 1 (sqrt 1)))))))) ; 0.07s (defmacro pushlast (e lst) (declare (debug (form gv-place))) (macroexp-let2 macroexp-copyable-p x e (gv-letplace (get set) lst (funcall set `(append ,get (cons ,e nil)))))) ;; (setq lst '(1 2 3)) ; (1 2 3) ;; (pushlast 4 lst) ; (1 2 3 4) (defun bad-list-shift (l) (append (last l) (butlast l))) ;; (setq lst '(1 2 3)) ; (1 2 3) ;; (bad-list-shift lst) ; (3 1 2) ;; -------------------------------------------------------------------------- (<- 'bad-helpers)