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
-- 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 |
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
#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)) |
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
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> { |
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
#r "nuget: Microsoft.Data.Sqlite" | |
#r "nuget: Oxpecker" | |
#r "nuget: FSharp.Control.TaskSeq" | |
open Microsoft.Data.Sqlite | |
open FSharp.Control | |
open System.Threading.Tasks | |
type User = { id: int64; name: string } |
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
// vertices are implicit in the set of values of type 'a | |
type Graph<'a when 'a: comparison> = { edges: Set<'a * 'a> } | |
let adjacent (g: Graph<'a>) (x: 'a) = | |
g.edges |> Set.filter (fun (y, _) -> x = y) |> Set.map snd | |
let graphLevels (startVertex: 'a) (g: Graph<'a>) = | |
let rec subLevels (level: Set<'a>, visited: Set<'a>) = | |
match level with | |
| _ when level.IsEmpty -> [] |
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
type Tree<'a> = { value: 'a; children: Tree<'a> list } | |
let rec levels (ts: Tree<'a> list) = | |
match ts with | |
| [] -> [] | |
| _ -> | |
let xs, chls = ts |> List.map (fun t -> t.value, t.children) |> List.unzip | |
let subs = chls |> List.concat |> levels | |
xs :: subs |
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
#r "nuget: ObjectDumper.NET, 4.3.4-pre" | |
let greenFragment x = | |
let ansiGreen = "\x1b[32m" | |
let ansiReset = "\x1b[0m" | |
$"%s{ansiGreen}%s{x}%s{ansiReset}" | |
let redFragment x = | |
let ansiRed = "\x1b[31m" | |
let ansiReset = "\x1b[0m" |
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
// the trick: | |
// each node must be connected directly to its direct children (with visible characters) | |
// and indirectly (through indentation) to its children's descendants | |
type Tree<'a> = | |
| Leaf of 'a | |
| Branch of 'a * list<Tree<'a>> | |
let printTree (t: Tree<'a>) = | |
let connectIndent (isLast: bool) (child: string, grandChild: string list) = |
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
#r "nuget: GirCore.Gtk-4.0,0.5.0" | |
open System | |
open Gtk | |
let label () = | |
let label = new Label() | |
label.SetText "hello" | |
label |
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
use std::cmp::PartialEq; | |
fn is_perm<T: PartialEq>(xs: &Vec<T>, ys: &Vec<T>) -> bool { | |
let mut ok = xs.len() == ys.len(); | |
let mut ws: Vec<&T> = xs.iter().collect(); | |
let mut zs: Vec<&T> = ys.iter().collect(); | |
while ok && ws.len() != 0 { | |
let (ok0, i) = exists(&zs, &ws[0]); | |
ok = ok0; | |
if ok0 { |
NewerOlder