Last active
March 21, 2020 22:54
-
-
Save emdeesee/f8c79e3b87bd4519355eb555dde2e4c0 to your computer and use it in GitHub Desktop.
utilities for scraping/parsing
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
(ql:quickload :str) | |
(ql:quickload :alexandria) | |
(import 'alexandria:compose) | |
(ql:quickload :arrows) | |
(use-package :arrows) | |
(defun split-names (s) | |
(mapcar (compose #'str:downcase #'str:trim) (str:split #\, s))) | |
(let (names) | |
(defun update-names-list (list) | |
(setf names (append names list))) | |
(defun clear-names () | |
(setf names nil)) | |
(defun get-names () | |
names)) | |
(defun parse-names (s) | |
(-> s | |
split-names | |
update-names-list)) | |
(defun save-names (path list) | |
(with-open-file (s path :direction :output :if-does-not-exist :create :if-exists :overwrite) | |
(print list s))) | |
(defun load-names (path) | |
(with-open-file (s path) | |
(read s))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment