-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathduckdb-misc.lisp
27 lines (21 loc) · 924 Bytes
/
duckdb-misc.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
;;;; duckdb-misc.lisp
(in-package #:duckdb)
(defun concat (&rest args)
"Concatenate arguments into a string."
(apply #'concatenate 'string args))
(defun join (separator xs)
"Intersperse SEPARATOR between elements of XS and string-concatenate result."
(apply #'concatenate 'string
(butlast (mapcan (lambda (x) (list x separator)) xs))))
(defun replace-substring (match replacement s)
"Replace all substrings matching MATCH with REPLACEMENT in S."
(let ((cl-ppcre:*allow-quoting* t))
(cl-ppcre:regex-replace-all (concat "\\Q" match)
s
(list replacement))))
(defun snake-case-to-param-case (s)
"Downcase input and replace underscores with hyphens."
(substitute #\- #\_ (string-downcase s)))
(defun param-case-to-snake-case (s)
"Downcase input and replace hyphens with underscores."
(substitute #\_ #\- (string-downcase s)))