Anonymous committed 25020f2

Unbreak `pure` module; all tests pass once again.

  • Participants
  • Parent commits b7da1e7

Comments (0)

Files changed (3)

File README.markdown

 * Work out the static analysis modules.  See the Static Analysis document
   for more information.
-* Support values, rather than simply presence of a value, in metadata.
-  This makes metadata more like a map of keys to values on a value,
-  than liks a set of keys on a value.
 ### Devices ###
 * Create the `device` module and use it instead of `crude-io` and

File doc/module/Pure.markdown

 from a guarantee.)
     | (robin (0 1) ((pure (0 1) *))
-    |   (has? (literal pure) head))
+    |   (has? pure head))
     = #t
     | (robin (0 1) ((pure (0 1) *))
-    |   (has? (literal pure) tail))
+    |   (has? pure tail))
     = #t
     | (robin (0 1) ((pure (0 1) *))
-    |   (has? (literal pure) prepend))
+    |   (has? pure prepend))
     = #t
     | (robin (0 1) ((pure (0 1) *))
-    |   (has? (literal pure) if))
+    |   (has? pure if))
     = #t
     | (robin (0 1) ((pure (0 1) *))
-    |   (has? (literal pure) macro))
+    |   (has? pure macro))
     = #t
     | (robin (0 1) ((pure (0 1) *))
-    |   (has? (literal pure) fun))
+    |   (has? pure fun))
     = #t
 ### Purity Analysis ###

File module/pure_0_1.robin

   ;''This is an EXPERIMENTAL module for EXPERIMENTING with
      static analysis in Robin using metadata on values.''
   (let (
-    (head     (with (literal pure) head))
-    (tail     (with (literal pure) tail))
-    (prepend  (with (literal pure) prepend))
-    (list?    (with (literal pure) list?))
-    (symbol?  (with (literal pure) symbol?))
-    (number?  (with (literal pure) number?))
-    (boolean? (with (literal pure) boolean?))
-    (macro?   (with (literal pure) macro?))
-    (subtract (with (literal pure) subtract))
-    (divide   (with (literal pure) divide))
-    (floor    (with (literal pure) floor))
-    (sign     (with (literal pure) sign))
-    (macro    (with (literal definer) (with (literal pure) macro)))
-    (if       (with (literal pure) if))
-    (with     (with (literal pure) with))
-    (has?     (with (literal pure) has?))
-    (literal  (with (literal pure) literal))
-    (bind     (with (literal binder) (with (literal pure) bind)))
-    (env      (with (literal pure) env))
-    (fun      (with (literal definer) (with (literal pure) fun)))
+    (head     (with pure #t head))
+    (tail     (with pure #t tail))
+    (prepend  (with pure #t prepend))
+    (list?    (with pure #t list?))
+    (symbol?  (with pure #t symbol?))
+    (number?  (with pure #t number?))
+    (boolean? (with pure #t boolean?))
+    (macro?   (with pure #t macro?))
+    (subtract (with pure #t subtract))
+    (divide   (with pure #t divide))
+    (floor    (with pure #t floor))
+    (sign     (with pure #t sign))
+    (macro    (with definer #t (with pure #t macro)))
+    (if       (with pure #t if))
+    (with     (with pure #t with))
+    (has?     (with pure #t has?))
+    (literal  (with pure #t literal))
+    (bind     (with binder #t (with pure #t bind)))
+    (env      (with pure #t env))
+    (fun      (with definer #t (with pure #t fun)))
     (dummy-fun (fun (x) x))
     (pure-fun-defn?-r (fun (self pure-expr?-r env expr)
       ;''XXX The following is badly written.''
               ((equal? maybe-val ())
               ((macro? (head maybe-val))
-                (has? (literal pure) (head maybe-val)))
+                (has? pure (head maybe-val)))
         ((elem? expr args) #t)
         ((number? expr)    #t)
-        ((macro? expr)     (has? (literal pure) expr))
+        ((macro? expr)     (has? pure expr))
         ((boolean? expr)   #t)
         ((empty? expr)     #t)
         ;''XXX The following is badly written.''
               ((equal? maybe-applier ())
-              ((has? (literal binder) (head maybe-applier))
+              ((has? binder (head maybe-applier))
                 ;''When analyzing a `bind` expression, we analyze the value
                    being bound to see if it, too, is pure or not.  We then
                    extend the environment with a value for the bound
                             self env bound-expr))
                         (if bound-pure-fun
-                          (with (literal pure) dummy-fun)
+                          (with pure #t dummy-fun)
                          (extend ident placeholder env))
                         (head (tail (tail (tail expr))))))
                       (self self new-env args body-expr))
-              ((has? (literal definer) (head maybe-applier))
+              ((has? definer (head maybe-applier))
                 ;''A "definer" expression (such as `macro` or `fun`), which
                    simply evaluates to a macro value of some kind, is pure.