6f43a660d22a

Remove the stupid cl-arrows dep
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 29 Mar 2017 18:20:14 +0000
parents a5086be7e1aa
children 53b3bd05714d
branches/tags (none)
files contrib/gdl-benchmark/run_temperance.ros package.lisp src/compiler/4-tokenization.lisp src/compiler/6-optimization.lisp src/ui.lisp src/utils.lisp temperance.asd

Changes

--- a/contrib/gdl-benchmark/run_temperance.ros	Tue Mar 14 13:33:03 2017 +0000
+++ b/contrib/gdl-benchmark/run_temperance.ros	Wed Mar 29 18:20:14 2017 +0000
@@ -33,9 +33,9 @@
 (defpackage :temperance.contrib.gdl-benchmark
   (:use
     :cl
-    :cl-arrows
     :losh
     :temperance.quickutils
+    :temperance.utils
     :temperance))
 
 (in-package :temperance.contrib.gdl-benchmark)
--- a/package.lisp	Tue Mar 14 13:33:03 2017 +0000
+++ b/package.lisp	Wed Mar 29 18:20:14 2017 +0000
@@ -1,9 +1,10 @@
 (defpackage :temperance.utils
   (:use
     :cl
-    :cl-arrows
     :temperance.quickutils)
   (:export
+    :-<>
+    :<>
     :push-if-new
     :recursively
     :recur
@@ -56,7 +57,6 @@
 (defpackage :temperance
   (:use
     :cl
-    :cl-arrows
     :temperance.circle
     :temperance.quickutils
     :temperance.utils)
--- a/src/compiler/4-tokenization.lisp	Tue Mar 14 13:33:03 2017 +0000
+++ b/src/compiler/4-tokenization.lisp	Wed Mar 29 18:20:14 2017 +0000
@@ -129,7 +129,7 @@
   "Tokenize `term` as a program term, returning its tokens."
   (let ((tree (parse-top-level term)))
     (allocate-registers tree clause-props :nead t)
-    (-> tree flatten-program tokenize-assignments)))
+    (-<> tree flatten-program tokenize-assignments)))
 
 (defun tokenize-query-term (term clause-props &key in-nead is-tail)
   "Tokenize `term` as a query term, returning its tokens."
--- a/src/compiler/6-optimization.lisp	Tue Mar 14 13:33:03 2017 +0000
+++ b/src/compiler/6-optimization.lisp	Wed Mar 29 18:20:14 2017 +0000
@@ -103,9 +103,9 @@
 
 
 (defun optimize-instructions (instructions)
-  (->> instructions
-    (optimize-constants)
-    (optimize-void-runs)))
+  (-<> instructions
+    optimize-constants
+    optimize-void-runs))
 
 
 
--- a/src/ui.lisp	Tue Mar 14 13:33:03 2017 +0000
+++ b/src/ui.lisp	Wed Mar 29 18:20:14 2017 +0000
@@ -324,9 +324,9 @@
         (let* ((,code (allocate-query-holder)))
           (multiple-value-bind (,vars ,size)
               (compile-query-into
-                ,code ',(->> terms
-                          (mapcar #'eval)
-                          (mapcar #'normalize-term)))
+                ,code ',(-<> terms
+                          (mapcar #'eval <>)
+                          (mapcar #'normalize-term <>)))
             (list ,code ,size ,vars)))
         t))))
 
--- a/src/utils.lisp	Tue Mar 14 13:33:03 2017 +0000
+++ b/src/utils.lisp	Wed Mar 29 18:20:14 2017 +0000
@@ -176,3 +176,18 @@
       `(let ((,$keyform ,keyform))
          ,(%case/tree $keyform (sort (copy-list cases) #'< :key #'first))))))
 
+
+;;;; Threading Macro
+(defmacro -<> (expr &rest forms)
+  "Thread the given forms, with `<>` as a placeholder."
+  ;; 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
+  ;; here we are.
+  `(let* ((<> ,expr)
+          ,@(mapcar (lambda (form)
+                      (if (symbolp form)
+                        `(<> (,form <>))
+                        `(<> ,form)))
+                    forms))
+     <>))
+
--- a/temperance.asd	Tue Mar 14 13:33:03 2017 +0000
+++ b/temperance.asd	Wed Mar 29 18:20:14 2017 +0000
@@ -7,8 +7,7 @@
   :license "MIT"
   :version "1.0.0"
 
-  :depends-on (:cl-arrows
-               :policy-cond)
+  :depends-on (:policy-cond)
 
   :in-order-to ((asdf:test-op (asdf:test-op :temperance.test)))