Skip to content

Instantly share code, notes, and snippets.

View aciceri's full-sized avatar
🍹
drinking spritz

Andrea Ciceri aciceri

🍹
drinking spritz
View GitHub Profile
const T = (x) => ((y) => x)
const F = (x) => ((y) => y)
const ifThenElse = (cond) => ((a) => ((b) => cond(a)(b)))
const cons = (a) => ((b) => ((c) => c(a)(b)))
const car = (l) => l(T)
const cdr = (l) => l(F)
const nil = cons(T)(T)
const isNil = car
const node = (x) => cons(F)(x)
@aciceri
aciceri / test.c
Created May 28, 2019 23:25
Personale approccio alla memoizzazione in C usando i puntatori a funzione.
#include <stdio.h>
#include <stdlib.h>
/* Roba relativa alla gestione della memoizzazione, in teoria riutilizzabile per
* diverse funzioni */
#define LUNGHEZZA 1000
struct { //Memoria globale, cioe' vettore di coppie input/output
int in, out;
} memoria[LUNGHEZZA];
@aciceri
aciceri / flake.nix
Last active February 19, 2023 18:13
A Nix Flake example for an Haskell application
{
description = "An Haskell application";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs;
flake-utils.url = github:numtide/flake-utils;
easy-hls-src.url = github:jkachmar/easy-hls-nix;
};
outputs = { self, nixpkgs, flake-utils, easy-hls-src }:
@aciceri
aciceri / bf2pyc.py
Last active March 14, 2024 16:38
Brainfuck to Python bytecode compiler
#!/usr/bin/env python3
from sys import exit, stdin
from argparse import ArgumentParser, RawDescriptionHelpFormatter, FileType
from types import CodeType
from dis import dis, opmap
import marshal
from importlib.util import MAGIC_NUMBER
from textwrap import dedent