Commits

llibra committed e6bc0ed

#'(lambda ...) -> (lambda ...)

  • Participants
  • Parent commits 38fa4a6

Comments (0)

Files changed (2)

                     (rec stream2 (1+ index)))
                    ((nil pos msgs)
                     (failure pos msgs))))))
-    #'(lambda (stream)
-        (result-match (rec stream 0)
-          ((t _ stream pos msgs)
-           (success string stream pos msgs))
-          ((nil pos msgs)
-           (failure pos msgs))))))
+    (lambda (stream)
+      (result-match (rec stream 0)
+        ((t _ stream pos msgs)
+         (success string stream pos msgs))
+        ((nil pos msgs)
+         (failure pos msgs))))))
 
 (defun one-of (&rest cs)
   (expect (satisfy (rcurry #'member cs))
   (expect (specific-char #\Tab) "a tab"))
 
 (defalias whitespace
-  (expect (satisfy #'(lambda (c)
-                       (some (curry #'eql c)
-                             '(#\Space #\Page #\Tab #\Newline))))
+  (expect (satisfy (lambda (c)
+                     (some (curry #'eql c)
+                           '(#\Space #\Page #\Tab #\Newline))))
           "a space"))
 
 (defalias whitespaces
   (values nil pos msgs))
 
 (defun unit (x)
-  #'(lambda (stream) (success x stream)))
+  (lambda (stream) (success x stream)))
 
 (defun fail (msg)
-  #'(lambda (stream) (failure stream msg)))
+  (lambda (stream) (failure stream msg)))
 
 (defun bind (parser fn)
-  #'(lambda (stream)
-      (result-match (funcall parser stream)
-        ((t value1 stream1 _ msgs1)
-         (result-match (funcall (funcall fn value1) stream1)
-           ((t value2 stream2 pos2 msgs2)
-            (let ((msgs (if (eq stream1 stream2) (cons msgs1 msgs2) msgs2)))
-              (success value2 stream2 pos2 msgs)))
-           ((nil pos2 msgs2)
-            (let ((msgs (if (eq stream1 pos2) (cons msgs1 msgs2) msgs2)))
-              (failure pos2 msgs)))))
-        ((nil pos msgs)
-         (failure pos msgs)))))
+  (lambda (stream)
+    (result-match (funcall parser stream)
+      ((t value1 stream1 _ msgs1)
+       (result-match (funcall (funcall fn value1) stream1)
+         ((t value2 stream2 pos2 msgs2)
+          (let ((msgs (if (eq stream1 stream2) (cons msgs1 msgs2) msgs2)))
+            (success value2 stream2 pos2 msgs)))
+         ((nil pos2 msgs2)
+          (let ((msgs (if (eq stream1 pos2) (cons msgs1 msgs2) msgs2)))
+            (failure pos2 msgs)))))
+      ((nil pos msgs)
+       (failure pos msgs)))))
 
 (defmacro mlet1 (var form &body body)
   (if (string= var "_")
       (with-gensyms (_)
-        `(bind ,form #'(lambda (,_) (declare (ignore ,_)) ,@body)))
-      `(bind ,form #'(lambda (,var) ,@body))))
+        `(bind ,form (lambda (,_) (declare (ignore ,_)) ,@body)))
+      `(bind ,form (lambda (,var) ,@body))))
 
 (defmacro mlet* (bindings &body body)
   (match bindings
      `(mlet1 _ ,parser (seq/bind ,@rest)))))
 
 (defun satisfy (pred)
-  #'(lambda (stream)
-      (if stream
-          (let ((token (parser-stream-car stream)))
-            (if (funcall pred token)
-                (success token (parser-stream-cdr stream) stream)
-                (failure stream)))
-          (failure))))
+  (lambda (stream)
+    (if stream
+        (let ((token (parser-stream-car stream)))
+          (if (funcall pred token)
+              (success token (parser-stream-cdr stream) stream)
+              (failure stream)))
+        (failure))))
 
 (defun choice2 (parser1 parser2)
-  #'(lambda (stream)
-      (result-match (funcall parser1 stream)
-        ((t value stream pos msgs)
-         (success value stream pos msgs))
-        ((nil pos1 msgs1)
-         (if (eq stream pos1)
-             (result-match (funcall parser2 pos1)
-               ((t value2 stream2 pos2 msgs2)
-                (let ((msgs (if (eq pos1 stream2) (cons msgs1 msgs2) msgs2)))
-                  (success value2 stream2 pos2 msgs)))
-               ((nil pos2 msgs2)
-                (let ((msgs (if (eq pos1 pos2) (cons msgs1 msgs2) msgs2)))
-                  (failure pos2 msgs))))
-             (failure pos1 msgs1))))))
+  (lambda (stream)
+    (result-match (funcall parser1 stream)
+      ((t value stream pos msgs)
+       (success value stream pos msgs))
+      ((nil pos1 msgs1)
+       (if (eq stream pos1)
+           (result-match (funcall parser2 pos1)
+             ((t value2 stream2 pos2 msgs2)
+              (let ((msgs (if (eq pos1 stream2) (cons msgs1 msgs2) msgs2)))
+                (success value2 stream2 pos2 msgs)))
+             ((nil pos2 msgs2)
+              (let ((msgs (if (eq pos1 pos2) (cons msgs1 msgs2) msgs2)))
+                (failure pos2 msgs))))
+           (failure pos1 msgs1))))))
 
 (defun choice (&rest parsers)
   (match parsers
     (_ (reduce #'choice2 parsers))))
 
 (defun try (parser)
-  #'(lambda (stream)
-      (result-match (funcall parser stream)
-        ((t value stream pos msgs)
-         (success value stream pos msgs))
-        ((nil pos msgs)
-         (if (eq stream pos)
-             (failure pos msgs)
-             (failure stream))))))
+  (lambda (stream)
+    (result-match (funcall parser stream)
+      ((t value stream pos msgs)
+       (success value stream pos msgs))
+      ((nil pos msgs)
+       (if (eq stream pos)
+           (failure pos msgs)
+           (failure stream))))))
 
 (defun expect (parser x)
-  #'(lambda (stream0)
-      (result-match (funcall parser stream0)
-        ((t value stream pos msgs)
-         (let ((msgs (if (eq stream0 stream) (list x) msgs)))
-           (success value stream pos msgs)))
-        ((nil pos msgs)
-         (let ((msgs (if (eq stream0 pos) (list x) msgs)))
-           (failure pos msgs))))))
+  (lambda (stream0)
+    (result-match (funcall parser stream0)
+      ((t value stream pos msgs)
+       (let ((msgs (if (eq stream0 stream) (list x) msgs)))
+         (success value stream pos msgs)))
+      ((nil pos msgs)
+       (let ((msgs (if (eq stream0 pos) (list x) msgs)))
+         (failure pos msgs))))))
 
 ;; TODO: Treating a parser that accepts an empty string properly
 (defun many-common (accum-fn parser stream)
     (rec stream nil)))
 
 (defun many (parser)
-  #'(lambda (stream)
-      (result-match (many-common #'cons parser stream)
-        ((t value stream pos msgs)
-         (success (nreverse value) stream pos msgs))
-        ((nil pos msgs)
-         (failure pos msgs)))))
+  (lambda (stream)
+    (result-match (many-common #'cons parser stream)
+      ((t value stream pos msgs)
+       (success (nreverse value) stream pos msgs))
+      ((nil pos msgs)
+       (failure pos msgs)))))
 
 (defun skip-many (parser)
-  #'(lambda (stream)
-      (many-common (constantly nil) parser stream)))
+  (lambda (stream)
+    (many-common (constantly nil) parser stream)))
 
 (defun eoi (stream)
   (match stream