Skip to content

Instantly share code, notes, and snippets.

Avatar
⚜️
百合

Nymphium Nymphium

⚜️
百合
View GitHub Profile
View natural_builder.ml
module type NATURAL = sig
type t
val build : ((t -> t) -> t -> t) -> t
end
module type BUILD_NATURAL = functor
(M : sig
type t
View freer_ext2.ml
module Base = struct
type _ operations = ..
end
module Freer : sig
type _ t
module Syntax : sig
val ( let* ) : 'a t -> ('a -> 'b t) -> 'b t
end
View hoge.ml
module type S = sig val x: int end
let module M = struct let x = 3 end in
Obj.magic (module M : S) |> fun m -> let module M = (val m : S) in M.x (* 3 *)
View result.md
environment
OS ArchLinux
Mem 16GB
CPU intel Core i7 8565U
$ time node hoge
hello
!
View pagination.tex
\documentclass[landscape,a4paper]{article}
\usepackage{luacode}
\usepackage{pdfpages}
\begin{document}
\begin{luacode*}
local options = [==[
pages= -,
nup = 2x2,
width = 0.49\paperwidth,
View test.lua
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()
View countier.ml
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 ->
View toggle.lua
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)
View shallow-effect-handler.rkt
#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)
View fcontrol.rkt
(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))