Utils
Generic utilities.
- utils:random-string number
Usage and installation
(ql:quickload "utils")
API
List utilities
- (pg-reverse lst) function: Reverse the elements of the list. (Thanks Mr. Paul Graham)
CL-USER> (pg-reverse '(1 2 3 4))
(4 3 2 1)
- (list+ lst number) function: Adding number in a all elements of the lst (lst is a list of numbers).
CL-USER> (list+ '(1 2 3 4) 5)
(6 7 8 9)
- (combine-cars lst1 lst2) function: Combine the elements of the list, first with first, second with second ... return a list of list.
CL-USER> (combine-cars '(1 2 3) '(4 5 6))
((1 4) (2 5) (3 6))
- (mklist atom) function: Transform an atom in a list
CL-USER> (mklist 'abc)
(abc)
- (firsts lst) function: lst is a list of lists. Extract the cars of the sublists.
CL-USER> (first '((1 2 3) (4 5 6) (7 8 9)))
(1 4 7)
- (my-member atom lst) function: Check if atom exist in lst.
CL-USER> (my-member 'abc '(1 3 4 abc add))
T
CL-USER> (my-member 'abc '(1 3 4 abcd add))
NIL
- (rfember atom lst) function: Remove the first coincidence of atom in the lst.
CL-USER> (rfember 'abc '(foo bar baz abc buu abc 1 2))
(FOO BAR BAZ BUU ABC 1 2)
- (rember atom lst) function: Remove all coincidences of atom in the lst.
CL-USER> (rember 'abc '(foo bar baz abc buu abc 1 2))
(FOO BAR BAZ BUU 1 2)
- (replace-atom new-atom old-atom lst) function: Replace the first coincidence of old-atom to new-atom
CL-USER> (replace-atom 'new 'old '(abc def 1 old 2 3 5 old))
(ABC DEF 1 NEW 2 3 5 OLD)
- (full-replace-atom new old lst) function: Replace all the coincidences of the old atom for the new atom in the list.
CL-USER> (full-replace-atom 'new 'old '(abc def 1 old 2 3 5 old))
(ABC DEF 1 NEW 2 3 5 NEW)
Filesystem utilities
- (directory-p pathname) function: Return true if pathname is a directory
CL-USER> (directory-p "/home/")
T
CL-USER> (directory-p "/home/lisper/sound.ogg")
NIL
- (file-exists-p pathname) function: Return true if the file exist (directories and files)
CL-USER> (file-exists-p "/home")
T
CL-USER> (file-exists-p "/homeds")
NIL
Random String
- (random-string length) function: Return a random string of length
CL-USER> (random-string 20)
"f6RL/AqHrZ3Q]y7nXUhT"
Author
- Innaky ([email protected])
Copyright
Copyright (c) 2019 Innaky ([email protected])
License
Licensed under the GPLv3 License.