Skip to content

Instantly share code, notes, and snippets.

View VictorTaelin's full-sized avatar

Victor Taelin VictorTaelin

View GitHub Profile

Higher Order Company - Series A

Processing power is a foundation of human development.

HOC's Mission:

  • build the fastest processor ever made.

  • ship chips more powerful than any GPU chip shipped.

"" Calls AIs to fill holes in the current file,
"" omitting collapsed folds to save prompt space
function! SaveVisibleLines(dest)
let l:visibleLines = []
let lnum = 1
while lnum <= line('$')
if foldclosed(lnum) == -1
call add(l:visibleLines, getline(lnum))
let lnum += 1
@VictorTaelin
VictorTaelin / chatsh_kind.txt
Created June 23, 2024 02:54
complete chatsh session refactoring kind stuff
$ chatsh
Welcome to ChatSH. Model: claude-3-5-sonnet-20240620
$ i have a single self-contained main.hs file inside a Rust project. how can I ask it to compile/build/install the file under the 'kindc' name on the terminal when the user does cargo install --path .? the conventional way
To integrate a Haskell file into a Rust project and compile it when running `cargo install --path .`, you can use a build script. Here's how to set it up:
```sh
echo 'fn main() {
println!("cargo:rustc-env=KINDC_PATH={}", std::env::current_dir().unwrap().join("kindc").display());
std::process::Command::new("ghc")
@VictorTaelin
VictorTaelin / optimal_affine_enumerator_superposed.hvm1.c
Last active June 22, 2024 04:30
OPTIMAL AFFINE ENUMERATOR SUPERPOSED
// This file enumerates `Tree -> Tree` functions, where:
// data Tree = (C Tree Tree) | L
// It works by creating a superposed tree of all algorithms with a given
// pattern-match count. For example, for count=0, we create:
// λt (t
// // case C:
// λx λy
// #0{
// (C <var> <var>)
@VictorTaelin
VictorTaelin / optimal_brute_force_search_stlc.hvm1.c
Last active June 21, 2024 22:57
Optimal Brute Force Search on Simply-Typed λ-Calculus Terms
// Types
// -----
// Type ::=
// | (Fun inp out) // ∀inp out
// | (Par fst snd) // [fst&snd]
// | (Eit fst snd) // [fst|snd]
// | Uni // ⊤
// Term ::=
@VictorTaelin
VictorTaelin / EAC.bend.py
Created June 5, 2024 00:26
Elementary Affine Calculus
# Elementary Affine Calculus
# ==========================
# Types
# -----
type Term
= (Lam bod)
| (App fun arg)
| (Box val)

Optlam.js - 3.4 million IPS

// ~~~~~~~~~~~~~~~~~~~~~~ Optlam.js ~~~~~~~~~~~~~~~~~~~~~~
// An optimal λ-calculus normalizer written in JavaScript.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Optlam.js is a simple, optimal (in Levy's sense) λ-calculus evaluator using
// interaction nets. It is, currently, as far as I know, the fastest
// implementation of functions in the world. It uses Lamping's Abstract
// Algorithm - that is, the so called (and problematic) "oracle" is avoided
#!/bin/bash
# Find all hvm processes and extract their PIDs
pids=$(ps aux | grep hvm | grep -v grep | awk '{print $2}')
# Check if any hvm processes were found
if [ -z "$pids" ]; then
echo "No hvm processes found."
else
# Forcefully kill each hvm process
@VictorTaelin
VictorTaelin / fast_scansum.cu
Created April 9, 2024 21:22
Fast CUDA block-local prefix sum (scamsun) using warp sync primitives (__shfl_up_sync)
// Fast block-local prefix-sum on CUDA, using warp-syncs.
// The input is an array of u32. It is mutated in place. Example:
// arr = [1,1,1,1,...]
// Becomes:
// arr = [1,2,3,4,...]
// The number of elements must be equal to threads per block (TPB).
#include <stdio.h>
#include <cuda_runtime.h>
Bring yourself online, center yourself, focus, surpass your limits right here right now.
The user will query a <problem> </problem> containing the argument to call the function provided below.
def feeltheagi(problem):
"""
Recursively apply the A::B rewrite rules to the given problem string.
The rewrite rules are:
A# #A ... becomes ... nothing