util: provide pointer (ptr = (make-array nil)
This commit is contained in:
parent
f6a361f4b8
commit
1e6ffc1fa2
2 changed files with 9 additions and 1 deletions
|
@ -67,6 +67,10 @@
|
|||
(util:lgi (crypt:create-secret))
|
||||
(let ((now (get-universal-time)))
|
||||
(== (util:from-unix-time (util:to-unix-time now)) now))
|
||||
(let* ((x (util:ptr))
|
||||
(y x))
|
||||
(setf (aref y) 42)
|
||||
(== (aref x) 42))
|
||||
(== (util:rfill '(1 2 3 4 5) '(a b c)) '(a b c nil nil))
|
||||
(== (util:rtrim '(1 2 nil 3 nil)) '(1 2 nil 3))
|
||||
(== (util:to-keyword "hello-kitty") :hello-kitty)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#+sbcl (:import-from :sb-ext #:add-package-local-nickname)
|
||||
(:export #:make-vars-format #:lg #:lgd #:lgi #:lgw
|
||||
#:from-unix-time #:to-unix-time
|
||||
#:ptr
|
||||
#:rfill #:rtrim
|
||||
#:loop-plist #:filter-plist #:plist-pairs #:plist-equal #:plist-add
|
||||
#:flatten-str #:from-keyword #:to-keyword #:to-integer #:to-string
|
||||
|
@ -41,7 +42,10 @@
|
|||
(defun to-unix-time (time)
|
||||
(when time (- time +unix-time-base+)))
|
||||
|
||||
;;;; lists and loops
|
||||
;;;; pointers, lists, loops
|
||||
|
||||
(defun ptr (&optional x)
|
||||
(make-array nil :initial-element x))
|
||||
|
||||
(defun rfill (ll ls)
|
||||
(mapcar #'(lambda (x) (pop ls)) ll))
|
||||
|
|
Loading…
Add table
Reference in a new issue