Skip to content

Instantly share code, notes, and snippets.

@lamg
lamg / print_tree.kts
Created May 1, 2025 10:57
print_tree.kts
sealed class Tree<out T> {
data class Leaf<T>(val value: T) : Tree<T>()
data class Branch<T>(
val value: T,
val children: List<Tree<T>>,
) : Tree<T>()
}
fun <T> printTree(tree: Tree<T>): List<String> {
fun connectIndent(isLast: Boolean, child: String, grandChildren: List<String>): List<String> {
@lamg
lamg / z3_example.fsx
Created May 3, 2025 16:20
Using Z3 theorem prover in F#
#r "nuget: Microsoft.Z3.x64"
open Microsoft.Z3
let ctx = new Context()
let x = ctx.MkIntConst "x"
let y = ctx.MkIntConst "y"
// Define the premise: x > 0 && y > 0
let premise = ctx.MkAnd(ctx.MkGt(x, ctx.MkInt 0), ctx.MkGt(y, ctx.MkInt 0))
@lamg
lamg / config.lua
Created May 24, 2025 08:21
Lunar Vim F#
-- Read the docs: https://www.lunarvim.org/docs/configuration
vim.o.guifont = "Cascadia Code:h16"
vim.opt.shell = "/bin/fish"
-- indentation
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.smartindent = true