b6b6000308ea

Remove `slurp` and `spit`

They duplicate Alexandria's `read-file-into-string` and
`write-string-into-file`.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 23 Aug 2016 00:45:49 +0000
parents 768bd70efb57
children fcc9fc4cb7c2
branches/tags (none)
files DOCUMENTATION.markdown losh.lisp make-docs.lisp package.lisp

Changes

--- a/DOCUMENTATION.markdown	Mon Aug 22 20:36:47 2016 +0000
+++ b/DOCUMENTATION.markdown	Tue Aug 23 00:45:49 2016 +0000
@@ -317,23 +317,6 @@
 
     (DLAMBDA &REST CLAUSES)
 
-## Package `LOSH.FILE-IO`
-
-Utilities for reading from and writing to files.
-
-### `SLURP` (function)
-
-    (SLURP PATH)
-
-Sucks up an entire file from PATH into a freshly-allocated string,
-   returning two values: the string and the number of bytes read.
-
-### `SPIT` (function)
-
-    (SPIT PATH STR)
-
-Spit the string into a file at the given path.
-
 ## Package `LOSH.FUNCTIONS`
 
 Utilities for working with higher-order functions.
--- a/losh.lisp	Mon Aug 22 20:36:47 2016 +0000
+++ b/losh.lisp	Tue Aug 23 00:45:49 2016 +0000
@@ -1166,21 +1166,6 @@
                                    ,@body)))))
 
 
-;;;; File IO
-(defun slurp (path)
-  "Sucks up an entire file from PATH into a freshly-allocated string,
-   returning two values: the string and the number of bytes read."
-  (with-open-file (s path)
-    (let* ((len (file-length s))
-           (data (make-string len)))
-      (values data (read-sequence data s)))))
-
-(defun spit (path str)
-  "Spit the string into a file at the given path."
-  (with-open-file (s path :direction :output :if-exists :supersede)
-    (format s "~A" str)))
-
-
 ;;;; Weightlists
 (defstruct (weightlist (:constructor %make-weightlist))
   weights sums items total)
--- a/make-docs.lisp	Mon Aug 22 20:36:47 2016 +0000
+++ b/make-docs.lisp	Tue Aug 23 00:45:49 2016 +0000
@@ -8,7 +8,6 @@
         "LOSH.DEBUGGING"
         "LOSH.DISTRIBUTIONS"
         "LOSH.ELDRITCH-HORRORS"
-        "LOSH.FILE-IO"
         "LOSH.FUNCTIONS"
         "LOSH.HASH-SETS"
         "LOSH.ITERATE"
--- a/package.lisp	Mon Aug 22 20:36:47 2016 +0000
+++ b/package.lisp	Tue Aug 23 00:45:49 2016 +0000
@@ -163,12 +163,6 @@
     #:bits
     #:dis))
 
-(defsubpackage #:losh.file-io
-  (:documentation "Utilities for reading from and writing to files.")
-  (:export
-    #:slurp
-    #:spit))
-
 (defsubpackage #:losh.weightlists
   (:documentation
     "A simple data structure for choosing random items with weighted probabilities.")