This file contains 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
(statements | |
(compile | |
'((define (factorial n) | |
(if (= n 0) | |
1 | |
(* n (factorial (- n 1))))) | |
(factorial 1000)) | |
'val | |
'return)) | |
; => |
This file contains 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
x = [ | |
%q{puts "x = ["}, | |
%q{x.each_with_index {|s,i| puts "%q{" << s << "}" << (i == x.length-1 ? "" : ",") }}, | |
%q{puts "]"}, | |
%q{puts "x.map {|s| eval s}"} | |
] | |
x.map {|s| eval s} |
This file contains 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
(defn draw [{{[px py :as pos] :pos h :health s :score sees :sees, lv :level :as play} :player, | |
{:keys [points width height monsters seen]} :level, msgs :messages}] | |
(set! (.-font ctx) "12px monospace") | |
(doto ctx (set-fill "black") (.fillRect 0 0 canv-width canv-height)) | |
(let [mpts (set (map :pos monsters))] | |
(loop [yy (dec height)] | |
(when-not (neg? yy) | |
(loop [xx (dec width)] | |
(when-not (neg? xx) | |
(let [p [xx yy], |
This file contains 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
;; macros.clj | |
(ns stuff.macros) | |
(defmacro with-path | |
[c & forms] | |
`(doto ~c | |
(.beginPath) | |
~@forms | |
(.closePath))) | |
;; core.cljs | |
(ns stuff.core |
This file contains 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
Compiling "pub/main.js" failed: | |
java.lang.OutOfMemoryError: Java heap space | |
JsDocTokenStream.java:239 com.google.javascript.jscomp.parsing.JsDocTokenStream.getStringFromBuffer | |
JsDocTokenStream.java:86 com.google.javascript.jscomp.parsing.JsDocTokenStream.getJsDocToken | |
JsDocInfoParser.java:2258 com.google.javascript.jscomp.parsing.JsDocInfoParser.next | |
JsDocInfoParser.java:928 com.google.javascript.jscomp.parsing.JsDocInfoParser.parse | |
IRFactory.java:352 com.google.javascript.jscomp.parsing.IRFactory.createJsDocInfoParser | |
IRFactory.java:260 com.google.javascript.jscomp.parsing.IRFactory.handleJsDoc | |
IRFactory.java:271 com.google.javascript.jscomp.parsing.IRFactory.transform | |
IRFactory.java:79 com.google.javascript.jscomp.parsing.IRFactory.access$300 |
This file contains 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-syntax (getters+setters stx) | |
(syntax-case stx () | |
[(_) #'(begin)] | |
[(_ name . more) | |
(with-syntax ([(val . __) (generate-temporaries #'(name))]) | |
#`(begin | |
(define/public (#,(format-id #'name #:source #'name "get-~a" (syntax-e #'name))) | |
name) | |
(define/public (#,(format-id #'name #:source #'name "set-~a" (syntax-e #'name)) val) | |
(set! name val)) |
This file contains 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
#lang racket | |
(define ptr "ptr") | |
(define tape "tape") | |
(define tape-size 64000) | |
(define (bf-compile-optimized bf [pp? #t]) | |
(define level 0) | |
(define (indent lvl) | |
(for ([i lvl]) | |
(display " "))) |
This file contains 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
#lang racket | |
(struct closure (args body env) #:constructor-name make-closure) | |
(struct env (parent data) #:constructor-name make-env) | |
(define-values (nothing nothing?) | |
(let () | |
(struct <nothing> ()) | |
(values (<nothing>) <nothing>?))) |
This file contains 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
#lang racket | |
(require racket/unsafe/ops racket/mpair) | |
(define sz 5000000) | |
(struct t (a b c d e f g h i j) #:transparent) | |
(struct mt (a b c d e f g h i j) #:mutable #:transparent) | |
(define lists (make-vector sz (list 1 2 3 4 5 6 7 8 9 10))) | |
(define mlists (make-vector sz (mlist 1 2 3 4 5 6 7 8 9 10))) |
This file contains 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
(struct vnode (edit arr) #:transparent) | |
(define (pvector-fresh-node edit) | |
(vnode edit (make-vector 32 #f))) | |
(define empty-node (pvector-fresh-node #f)) | |
(define empty-pvector (pvector 0 5 empty-node (vector))) | |
(struct pvector (cnt shift root tail)) |