Skip to content

Instantly share code, notes, and snippets.

View VictorTaelin's full-sized avatar

Victor Taelin VictorTaelin

  • Higher Order Company
  • Rio de Janeiro, Brazil
  • Twitter @VictorTaelin
View GitHub Profile
@VictorTaelin
VictorTaelin / itt-coc.ts
Last active December 4, 2023 21:48
ITT-Flavored Calculus of Constructions Type Checker
View itt-coc.ts
// This is an example implementation of the Calculus of Constructions, using first
// class Anns that compute, inspired by Interaction Type Theory. This allows us to
// completely get rid of contexts, and the checker function becomes minimal, as
// it just needs to collapse chained ANNs into equalities. The code below is an
// initial demo of such idea (very new, not tested).
type List<A> =
| { tag: "Cons"; head: A; tail: List<A> }
| { tag: "Nil"; };
@VictorTaelin
VictorTaelin / qa.md
Created November 2, 2023 03:42
Q&A about new platelets longevity study
View qa.md

study: https://link.springer.com/article/10.1007/s11357-023-00980-6

Q: What are the main findings of the article above?

A: The main findings of the article are that a plasma fraction treatment derived from young adult pigs, termed E5, significantly reversed aging in rats according to epigenetic clocks and other biomarkers of aging. The treatment more than halved the epigenetic ages of blood, heart, and liver tissue, and also showed a significant rejuvenation effect in the hypothalamus. Alongside this, the treatment led to improvements in organ function, reduced markers of chronic inflammation and oxidative stress, increased antioxidant levels, and improved cognitive functions in the rats. The study also developed six different epigenetic clocks for rat tissues, two of which can be applied to humans as well.

Q: How clinically significant were the objective improvements observed? Provide an extensive list of measured markers and effect size.

A: The objective improvements observed in the study were clinicall

@VictorTaelin
VictorTaelin / phoas.md
Last active October 22, 2023 13:49
PHOAS in JS / HVM
View phoas.md
@VictorTaelin
VictorTaelin / semi_improved_fft.hs
Created May 3, 2023 01:39
semi_improved_fft.hs
View semi_improved_fft.hs
data Complex = C Double Double deriving Show
data Nat = E | O Nat | I Nat deriving Show
data Tree a = L a | B (Tree a) (Tree a) deriving Show
cScale :: Double -> Complex -> Complex
cScale s (C ar ai) = C (ar * s) (ai * s)
cAdd :: Complex -> Complex -> Complex
cAdd (C ar ai) (C br bi) = C (ar + br) (ai + bi)
@VictorTaelin
VictorTaelin / implementing_fft.md
Last active November 29, 2023 17:41
Implementing complex numbers and FFT with just datatypes (no floats)
View implementing_fft.md

Implementing complex numbers and FFT with just datatypes (no floats)

In this article, I'll explain why implementing numbers with just algebraic datatypes is desirable. I'll then talk about common implementations of FFT (Fast Fourier Transform) and why they hide inherent inefficiencies. I'll then show how to implement integers and complex numbers with just algebraic datatypes, in a way that is extremely simple and elegant. I'll conclude by deriving a pure functional implementation of complex FFT with just datatypes, no floats.

@VictorTaelin
VictorTaelin / complete_fft.hs
Last active May 3, 2023 02:43
complete good FFT in Haskell
View complete_fft.hs
import Debug.Trace
import Data.Bits
-- FFT Algorithm
-- =============
data Nat = E | O Nat | I Nat
data Tree a = L a | B (Tree a) (Tree a)
type GN = Tree Int
View textbook_fft.hs
data Complex = C Double Double deriving Show
cScale :: Double -> Complex -> Complex
cScale s (C ar ai) = C (ar * s) (ai * s)
cAdd :: Complex -> Complex -> Complex
cAdd (C ar ai) (C br bi) = C (ar + br) (ai + bi)
cSub :: Complex -> Complex -> Complex
cSub (C ar ai) (C br bi) = C (ar - br) (ai - bi)
@VictorTaelin
VictorTaelin / FFT.hvm
Last active May 4, 2023 02:05
fast fourier transform using only integers on HVM
View FFT.hvm
(Rot (V z)) = (V (- 0.0 z))
(Rot (G x y)) = (G (Rot y) x)
(Add (V z) (V w)) = (V (+ z w))
(Add (G x y) (G w z)) = (G (Add x w) (Add y z))
(Get (V x) f) = (f x)
(Get (G x y) f) = (f x y)
Nil = λm λx (m x)
View parity.kind2
Flip (n: Nat) : Nat
Flip Nat.zero = 1n
Flip (Nat.succ Nat.zero) = 0n
Mod2 (n: Nat) : Nat
Mod2 Nat.zero = Nat.zero
Mod2 (Nat.succ n) = Flip (Mod2 n)
IsEven (n: Nat) : Type
IsEven Nat.zero = Unit
View blabla.txt
#IfWinActive, LDPlayer
~RButton::
{
MouseGetPos, origX, origY ; Save original mouse position
SysGet, monitor, MonitorWorkArea ; Get monitor dimensions
centerX := monitorRight // 2 ; Calculate the center of the screen (X-axis)
centerY := monitorBottom // 2 ; Calculate the center of the screen (Y-axis)
; Calculate the new position with 50% of the distance from the center of the screen