Created
June 20, 2021 00:58
-
-
Save ezyang/592626fd8f13383ded9cdaeeb8eb55fb to your computer and use it in GitHub Desktop.
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
ezyang-mbp:labs ezyang$ cat a.kk | |
fun reuse( g : list<int> -> int, x : list<int>) : (int, int) { | |
(match(x) { | |
Nil() -> 0 | |
Cons(_, _) -> 1 | |
} | |
, g(x)) | |
} | |
ezyang-mbp:labs ezyang$ koka -O2 -l -c --showcore a.kk | |
compile: a.kk | |
loading: std/core | |
loading: std/core/types | |
loading: std/core/hnd | |
check : a | |
module a | |
private import std/core/types = std/core/types = ""; | |
private import std/core = std/core = ""; | |
public fun reuse : (g : (list<int>) -> int, x : list<int>) -> (int, int) | |
= fn(g: (list<int>) -> int, x: list<int>){ | |
val .b.38.36 : int | |
= g((std/core/types/.dup(x))); | |
std/core/types/(,)((std/core/types/.box((match (x) { | |
(std/core/Nil() : (list<int>) ) | |
-> 0; | |
(.skip std/core/Cons(((.skip std/core/types/.Box((.pat1: int)) : .Box ) as .box-x34: .Box), (.pat2: list<int>)) : list<int> ) | |
-> std/core/types/.drop(x, (std/core/int32(2))); | |
1; | |
}))), (std/core/types/.box(.b.38.36))); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment