This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Verifying that +andrewwilcox is my openname (Bitcoin username). https://onename.io/andrewwilcox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (use arc runtime) | |
| (pr "load ac ") | |
| (time (= r0 (runtime '(ac)))) | |
| (pr "load arc ") | |
| (time (r0!use-load 'arc)) | |
| (= r1 (runtime '(ac))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/arc.arc b/arc.arc | |
| index c824eb3..c3218ef 100644 | |
| --- a/arc.arc | |
| +++ b/arc.arc | |
| @@ -1047,6 +1047,28 @@ | |
| (car args) | |
| `(let it ,(car args) (and it (aand ,@(cdr args)))))) | |
| +(def ar-fnil (x) | |
| + (and (ar-tnil x) x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def respond (req) | |
| (iflet f (srvops* req!op) | |
| (if (redirector* req!op) | |
| (do (prn rdheader*) | |
| (prn "Location: " (f req!str req)) | |
| (prn)) | |
| (do (prn header*) | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def build-response (str op args cooks ip headers) | |
| (w/stdout str | |
| (respond (inst 'request 'args args 'cooks cooks 'ip ip 'op op 'str str 'headers headers)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def respond (str op args cooks ip) | |
| (w/stdout str | |
| (iflet f (srvops* op) | |
| (let req (inst 'request 'args args 'cooks cooks 'ip ip) | |
| (if (redirector* op) | |
| (do (prn rdheader*) | |
| (prn "Location: " (f str req)) | |
| (prn)) | |
| (do (prn header*) | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defop foo req | |
| (foo req)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| arc> (= other (new-arc)) | |
| #hash((racket-namespace* . #<namespace:0>)) | |
| arc> (aload other "arc.arc") | |
| #<void> | |
| arc> (eval '(mac bar () `(prn "yo, this is macro bar")) other) | |
| #(tagged mac #<procedure>) | |
| arc> (eval '(mac foo () `(do (prn "this is macro foo expanding into bar") (,bar))) other) | |
| #(tagged mac #<procedure>) | |
| arc> (namespace-set (this-namespace) 'foo (namespace-get other 'foo)) | |
| nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define (mac? x) | |
| (and (tagged? x) | |
| (eq? (arc-type x) 'mac))) | |
| (ac-def ac-macro? (fn) | |
| (cond ((mac? fn) | |
| (ar-rep fn)) | |
| ((symbol? fn) | |
| (let ((v (get-default arc fn (lambda () 'nil)))) | |
| (if (mac? v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| arc> (= other (new-arc)) | |
| #hash((racket-namespace* . #<namespace:0>)) | |
| arc> (aload other "arc.arc") | |
| #<void> | |
| arc> (eval '(def bar () (prn "hi, this is bar")) other) | |
| #<procedure:g2864> | |
| arc> (eval '(mac foo () `(do (prn "this is macro foo expanding into bar") (,bar))) other) | |
| #(tagged mac #<procedure>) | |
| arc> (namespace-set (this-namespace) 'foo (namespace-get other 'foo)) | |
| nil |