--- a/losh.asd Sat Nov 12 12:47:06 2016 +0000
+++ b/losh.asd Sat Nov 12 12:51:05 2016 +0000
@@ -1,4 +1,4 @@
-(asdf:defsystem #:losh
+(asdf:defsystem :losh
:name "losh"
:description "My personal utility belt library."
@@ -7,7 +7,7 @@
:license "MIT/X11"
:version "0.0.1"
- :depends-on (#:iterate)
+ :depends-on (:iterate)
:serial t
:components
--- a/losh.lisp Sat Nov 12 12:47:06 2016 +0000
+++ b/losh.lisp Sat Nov 12 12:51:05 2016 +0000
@@ -1,7 +1,6 @@
(in-package #:losh)
-
-;;;; Sanity
+;;;; Sanity -------------------------------------------------------------------
(defmacro -<> (&rest forms)
;; I am going to lose my fucking mind if I have to program lisp without
;; a threading macro, but I don't want to add another dep to this library, so
@@ -12,7 +11,7 @@
(-<> ,@(rest forms)))))
-;;;; Chili Dogs
+;;;; Chili Dogs ---------------------------------------------------------------
(defmacro defun-inlineable (name &body body)
`(progn
(declaim (inline ,name))
@@ -27,7 +26,7 @@
',name))
-;;;; Math
+;;;; Math ---------------------------------------------------------------------
(defconstant tau (* pi 2)) ; fuck a pi
(defconstant tau/2 (* tau 1/2))
@@ -138,7 +137,7 @@
(t value))))
-;;;; Random
+;;;; Random -------------------------------------------------------------------
(defun-inlineable randomp (&optional (chance 0.5))
"Return a random boolean with `chance` probability of `t`."
(< (random 1.0) chance))
@@ -223,7 +222,7 @@
plus))
-;;;; Functions
+;;;; Functions ----------------------------------------------------------------
(defun juxt (&rest functions)
"Return a function that will juxtapose the results of `functions`.
@@ -284,7 +283,7 @@
(fixed-point function next :test test :limit (when limit (1- limit)))))))
-;;;; Control Flow
+;;;; Control Flow -------------------------------------------------------------
(defmacro recursively (bindings &body body)
"Execute `body` recursively, like Clojure's `loop`/`recur`.
@@ -414,7 +413,7 @@
(queue-contents ,result))))
-;;;; Mutation
+;;;; Mutation -----------------------------------------------------------------
(defun build-zap (place expr env)
(multiple-value-bind (temps exprs stores store-expr access-expr)
(get-setf-expansion place env)
@@ -498,7 +497,7 @@
:collect `(%callf ,place ,function))))
-;;;; Lists
+;;;; Lists --------------------------------------------------------------------
(defun take (n list)
"Return a fresh list of the first `n` elements of `list`.
@@ -518,7 +517,7 @@
(collect item)))
-;;;; Arrays
+;;;; Arrays -------------------------------------------------------------------
(declaim
(ftype (function ((array * *) t)) fill-multidimensional-array)
(ftype (function ((array t *) t)) fill-multidimensional-array-t)
@@ -610,7 +609,7 @@
(defun-fmda single-float)
-;;;; Queues
+;;;; Queues -------------------------------------------------------------------
;;; Based on the PAIP queues (thanks, Norvig), but beefed up a little bit to add
;;; tracking of the queue size.
@@ -670,7 +669,7 @@
:finally (return size)))
-;;;; Iterate
+;;;; Iterate ------------------------------------------------------------------
(defmacro-driver (FOR var PAIRS-OF-LIST list)
"Iterate over the all pairs of the (including (last . first)).
@@ -1181,7 +1180,7 @@
(keywordize-clause clause))))))
-;;;; Hash Tables
+;;;; Hash Tables --------------------------------------------------------------
(defun mutate-hash-values (function hash-table)
"Replace each value in `hash-table` with the result of calling `function` on it.
@@ -1194,7 +1193,7 @@
hash-table)
-;;;; Sequences
+;;;; Sequences ----------------------------------------------------------------
(defun prefix-sums (sequence)
"Return a list of the prefix sums of the numbers in `sequence`.
@@ -1292,7 +1291,7 @@
(finally (return result))))
-;;;; Debugging & Logging
+;;;; Debugging & Logging ------------------------------------------------------
(defun pr (&rest args)
"Print `args` readably, separated by spaces and followed by a newline.
@@ -1409,7 +1408,7 @@
(values))
-;;;; Weightlists
+;;;; Weightlists --------------------------------------------------------------
(defstruct (weightlist (:constructor %make-weightlist))
weights sums items total)
@@ -1435,7 +1434,7 @@
(finding item :such-that (< n weight))))
-;;;; Bit Sets
+;;;; Bit Sets -----------------------------------------------------------------
;;; Implementation of the sets-as-integers idea in the Common Lisp Recipes book.
(deftype bset () '(integer 0))
@@ -1487,7 +1486,7 @@
(apply #'make-bset list))
-;;;; Licensing
+;;;; Licensing ----------------------------------------------------------------
;;; Original code from @dk_jackdaniel:
;;; http://paste.lisp.org/display/327154
(defun license-tree (quicklisp-project-designator)
@@ -1544,7 +1543,7 @@
:key #'car)))
-;;;; Eldritch Horrors
+;;;; Eldritch Horrors ---------------------------------------------------------
(defmacro dlambda (&rest clauses)
;;; From Let Over Lambda.
(with-gensyms (message arguments)
--- a/package.lisp Sat Nov 12 12:47:06 2016 +0000
+++ b/package.lisp Sat Nov 12 12:51:05 2016 +0000
@@ -1,7 +1,7 @@
-(defpackage #:losh.internal
- (:use #:cl))
+(defpackage :losh.internal
+ (:use :cl))
-(in-package #:losh.internal)
+(in-package :losh.internal)
(eval-when (:compile-toplevel :load-toplevel :execute)
(defun external-symbols (package)
@@ -19,198 +19,198 @@
`(:export ,@(external-symbols parent-package)))))
-(defpackage #:losh.math
+(defpackage :losh.math
(:documentation "Utilities related to math and numbers.")
(:export
- #:tau
- #:tau/2
- #:1/2tau
- #:tau/4
- #:1/4tau
- #:2/4tau
- #:3/4tau
- #:tau/8
- #:1/8tau
- #:2/8tau
- #:3/8tau
- #:4/8tau
- #:5/8tau
- #:6/8tau
- #:7/8tau
+ :tau
+ :tau/2
+ :1/2tau
+ :tau/4
+ :1/4tau
+ :2/4tau
+ :3/4tau
+ :tau/8
+ :1/8tau
+ :2/8tau
+ :3/8tau
+ :4/8tau
+ :5/8tau
+ :6/8tau
+ :7/8tau
- #:radians
- #:degrees
- #:square
- #:dividesp
- #:norm
- #:lerp
- #:precise-lerp
- #:map-range
- #:clamp))
+ :radians
+ :degrees
+ :square
+ :dividesp
+ :norm
+ :lerp
+ :precise-lerp
+ :map-range
+ :clamp))
-(defpackage #:losh.random
+(defpackage :losh.random
(:documentation "Utilities related to randomness.")
(:export
- #:randomp
- #:random-elt
- #:random-range
- #:random-range-exclusive
- #:random-around
- #:random-gaussian
- #:random-gaussian-integer
- #:d))
+ :randomp
+ :random-elt
+ :random-range
+ :random-range-exclusive
+ :random-around
+ :random-gaussian
+ :random-gaussian-integer
+ :d))
-(defpackage #:losh.functions
+(defpackage :losh.functions
(:documentation "Utilities for working with higher-order functions.")
(:export
- #:juxt
- #:nullary
- #:fixed-point))
+ :juxt
+ :nullary
+ :fixed-point))
-(defpackage #:losh.control-flow
+(defpackage :losh.control-flow
(:documentation "Utilities for managing control flow.")
(:export
- #:recursively
- #:recur
- #:when-found
- #:if-found
- #:gathering
- #:gather))
+ :recursively
+ :recur
+ :when-found
+ :if-found
+ :gathering
+ :gather))
-(defpackage #:losh.mutation
+(defpackage :losh.mutation
(:documentation "Utilities for mutating places in-place.")
(:export
- #:zapf
- #:%
- #:mulf
- #:divf
- #:modf
- #:remainderf
- #:clampf
- #:negatef
- #:notf
- #:callf))
+ :zapf
+ :%
+ :mulf
+ :divf
+ :modf
+ :remainderf
+ :clampf
+ :negatef
+ :notf
+ :callf))
-(defpackage #:losh.lists
+(defpackage :losh.lists
(:documentation "Utilities related to lists.")
(:export
- #:take))
+ :take))
-(defpackage #:losh.arrays
+(defpackage :losh.arrays
(:documentation "Utilities related to arrays.")
(:export
- #:do-array
- #:fill-multidimensional-array
- #:fill-multidimensional-array-t
- #:fill-multidimensional-array-fixnum
- #:fill-multidimensional-array-single-float))
+ :do-array
+ :fill-multidimensional-array
+ :fill-multidimensional-array-t
+ :fill-multidimensional-array-fixnum
+ :fill-multidimensional-array-single-float))
-(defpackage #:losh.queues
+(defpackage :losh.queues
(:documentation "A simple queue implementation.")
(:export
- #:queue
- #:make-queue
- #:queue-contents
- #:queue-size
- #:queue-empty-p
- #:enqueue
- #:dequeue
- #:queue-append))
+ :queue
+ :make-queue
+ :queue-contents
+ :queue-size
+ :queue-empty-p
+ :enqueue
+ :dequeue
+ :queue-append))
-(defpackage #:losh.iterate
- (:use #:iterate) ; need this for iterate's `for` symbol fuckery
+(defpackage :losh.iterate
+ (:use :iterate) ; need this for iterate's `for` symbol fuckery
(:documentation "Custom `iterate` drivers and clauses.")
(:export
- #:pairs-of-list
- #:averaging
- #:into
- #:timing
- #:since-start-into
- #:per-iteration-into
- #:real-time
- #:run-time
- #:in-lists
- #:in-sequences
- #:in-whatever
- #:in-array
- #:across-flat-array
- #:index-of-flat-array
- #:cycling
- #:for-nested
- #:within-radius
- #:skip-origin
- #:macroexpand-iterate))
+ :pairs-of-list
+ :averaging
+ :into
+ :timing
+ :since-start-into
+ :per-iteration-into
+ :real-time
+ :run-time
+ :in-lists
+ :in-sequences
+ :in-whatever
+ :in-array
+ :across-flat-array
+ :index-of-flat-array
+ :cycling
+ :for-nested
+ :within-radius
+ :skip-origin
+ :macroexpand-iterate))
-(defpackage #:losh.hash-tables
+(defpackage :losh.hash-tables
(:documentation "Utilities for operating on hash tables.")
(:export
- #:mutate-hash-values))
+ :mutate-hash-values))
-(defpackage #:losh.sequences
+(defpackage :losh.sequences
(:documentation "Utilities for operating on sequences.")
(:export
- #:prefix-sums
- #:frequencies
- #:proportions
- #:group-by))
+ :prefix-sums
+ :frequencies
+ :proportions
+ :group-by))
-(defpackage #:losh.debugging
+(defpackage :losh.debugging
(:documentation "Utilities for figuring out what the hell is going on.")
(:export
- #:pr
- #:bits
- #:shut-up
- #:dis
- #:aesthetic-string
- #:structural-string
- #:print-table
- #:print-hash-table))
+ :pr
+ :bits
+ :shut-up
+ :dis
+ :aesthetic-string
+ :structural-string
+ :print-table
+ :print-hash-table))
-(defpackage #:losh.weightlists
+(defpackage :losh.weightlists
(:documentation
"A simple data structure for choosing random items with weighted probabilities.")
(:export
- #:weightlist
- #:weightlist-weights
- #:weightlist-items
- #:make-weightlist
- #:weightlist-random))
+ :weightlist
+ :weightlist-weights
+ :weightlist-items
+ :make-weightlist
+ :weightlist-random))
-(defpackage #:losh.licensing
+(defpackage :losh.licensing
(:documentation "Utilities related to open source licenses.")
(:export
- #:print-licenses))
+ :print-licenses))
-(defpackage #:losh.eldritch-horrors
+(defpackage :losh.eldritch-horrors
(:documentation "Abandon all hope, ye who enter here.")
(:export
- #:dlambda
- #:define-with-macro))
+ :dlambda
+ :define-with-macro))
-(defpackage-inheriting #:losh
- (#:losh.arrays
+(defpackage-inheriting :losh
+ (:losh.arrays
- #:losh.control-flow
- #:losh.debugging
- #:losh.eldritch-horrors
- #:losh.functions
- #:losh.hash-tables
- #:losh.iterate
- #:losh.licensing
- #:losh.lists
- #:losh.math
- #:losh.mutation
- #:losh.queues
- #:losh.random
- #:losh.sequences
- #:losh.weightlists
+ :losh.control-flow
+ :losh.debugging
+ :losh.eldritch-horrors
+ :losh.functions
+ :losh.hash-tables
+ :losh.iterate
+ :losh.licensing
+ :losh.lists
+ :losh.math
+ :losh.mutation
+ :losh.queues
+ :losh.random
+ :losh.sequences
+ :losh.weightlists
)
(:use
- #:cl
- #:iterate
- #:losh.quickutils)
+ :cl
+ :iterate
+ :losh.quickutils)
(:documentation
"This package exports all of the symbols in the other packages.