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
| \documentclass[landscape,a4paper]{article} | |
| \usepackage{luacode} | |
| \usepackage{pdfpages} | |
| \begin{document} | |
| \begin{luacode*} | |
| local options = [==[ | |
| pages= -, | |
| nup = 2x2, | |
| width = 0.49\paperwidth, |
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
| function() return error() endlocal socket = require('socket') | |
| local gettime = socket.gettime | |
| local TIMES = 1000000 | |
| local t1 = gettime() | |
| for _ = 1, TIMES do | |
| pcall(error) | |
| end | |
| local t2 = gettime() |
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
| let run_continuer : type a. ((unit -> (unit -> a)) -> a) -> a = | |
| fun f -> | |
| let module M = struct | |
| effect Save : unit -> (unit -> a);; | |
| let save () = perform @@ Save () | |
| end | |
| in | |
| let open M in | |
| match f save with | |
| | effect (Save ()) k -> |
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
| awful.key({ modkey }, 't', function() | |
| local w = {} | |
| for _, c in ipairs(filter_ddt(get_tag_clients())) do | |
| local str = ('/tmp/%s.png'):format(tostring{}:match('0x([0-f]+)')) | |
| gears.surface(c.content):write_to_png(str) | |
| local font_orig = beautiful.font:match('^(.*) %d+$') | |
| local font_size = 14 | |
| local font = ('%s %d'):format(font_orig, font_size) |
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
| #lang racket | |
| (require racket/control) | |
| (struct spwn (val p) #:prefab #:extra-name Spwn) | |
| (define (fcontrol-at p v) | |
| (fcontrol (spwn v p))) | |
| (define (%-at p th handler) |
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
| (require control/racket) | |
| ; (% (+ (fcontrol 3) (fcontrol 4)) (λ (x k) (k (* x x)))) | |
| ; ~> ((λ (x k) (k (* x x))) 3 (λ (y) (+ y (fcontrol 4)))) | |
| ; ~> ((λ (y) (+ y (fcontrol 4))) 9) | |
| ; ~> (+ 9 (fcontrol 4)) | |
| ; ~> %の外側に出ちゃたあ(正しい) | |
| (let [(p (make-continuation-prompt-tag))] | |
| (% (+ (fcontrol 3 #:tag p) (fcontrol 4 #:tag p)) (λ (x k) (k (* x x))) #:tag p)) |
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
| 命令列Cと状態{m, h, w, d, p}の遷移から成るPainter Programmingの小ステップ意味論を考える。 | |
| 要素が{0, 1}から成るHxW行列が得られる。 | |
| `M`atrix, `H`eight, `W`idth, `D`irection[←↓↑→], `P`rogram stack | |
| init = { m = H x Wの000...0, h = 1, w = 1, d = →, P = []} | |
| ## 補助関数 | |
| edge_HW → H _ = true | |
| edge_HW ← 1 _ = true |
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
| % lualatex main.tex | |
| % convert -density 2000 -strip main.pdf out.png | |
| \documentclass[tikz]{standalone} | |
| \usepackage{graphicx} | |
| \usepackage{pagecolor,xcolor} | |
| \usepackage{newtxmath} | |
| % \usepackage{pagecolor} | |
| % \definecolor{greenback}{HTML}{00ff00} | |
| % \pagecolor{greenback} |
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
| (* | |
| ref: Efficient Compilation of algebraic effects and handlers | |
| *) | |
| type (_, _) operation = .. | |
| type 'a computation = | |
| | Return : 'a -> 'a computation | |
| | Call : ('arg, 'res) operation * 'arg * ('res -> 'a computation) -> 'a computation |
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
| -- allocate variable for back patching | |
| local bind | |
| -- type computation | |
| local computation = function(t) | |
| return function(a) | |
| return setmetatable(a, { __index = t, __shr = bind }) | |
| end | |
| end |