Skip to content

Instantly share code, notes, and snippets.

View VictorTaelin's full-sized avatar

Victor Taelin VictorTaelin

View GitHub Profile
@Hirrolot
Hirrolot / a-preface.md
Last active April 18, 2024 16:50
A complete implementation of the positive supercompiler from "A Roadmap to Metacomputation by Supercompilation" by Gluck & Sorensen

Supercompilation is a deep program transformation technique due to V. F. Turchin, a prominent computer scientist, cybernetician, physicist, and Soviet dissident. He described the concept as follows [^supercompiler-concept]:

A supercompiler is a program transformer of a certain type. The usual way of thinking about program transformation is in terms of some set of rules which preserve the functional meaning of the program, and a step-by-step application of these rules to the initial program. ... The concept of a supercompiler is a product of cybernetic thinking. A program is seen as a machine. To make sense of it, one must observe its operation. So a supercompiler does not transform the program by steps; it controls and observes (SUPERvises) the running of the machine that is represented by the program; let us call this machine M1. In observing the operation of

@wrongbyte
wrongbyte / closures.md
Last active September 30, 2022 01:38
closures and nested functions

Nested functions, closures and first-class functions

Closures store the environment along with a function. However, closures are only meaningful when a function can be excecuted from outside the scope in which it's declared.

In languages without first-class functions, you could still have nested functions, but they couldn't be used as closures, because you would not be able to execute a function outside of its original scope (since you could not assign this function to any other variable, pass it as an argument or return this function by another function).

Let's see it clearer with some examples:

function outer1() {
  const foo = 42;
@dicej
dicej / type-systems.txt
Last active March 30, 2024 07:34
Type system learning notes
Classes
* Keith Devlin - Introduction to Mathematical Thinking - https://www.coursera.org/learn/mathematical-thinking
* Michael Genesereth - Introduction to Logic - https://www.coursera.org/learn/logic-introduction
* Robert Harper - Homotopy Type Theory - http://www.cs.cmu.edu/~rwh/courses/hott/
Books and Articles
* Benjamin C. Pierce - Types and Programming Languages - https://www.cis.upenn.edu/~bcpierce/tapl/
* x775 - Introduction to Datalog - https://x775.net/2019/03/18/Introduction-to-Datalog.html
* Bartosz Milewski - Category Theory For Programmers - https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
* Benjamin C. Pierce et al. - Software Foundations - https://softwarefoundations.cis.upenn.edu/
@bukzor
bukzor / formality.md
Last active August 14, 2020 11:32
Figuring out type definitions in Formality lang. https://github.com/moonad/Formality

Type definition

T Color.
| Red.;
| Blue.;

Desugars to:

import Data.Char (isLetter, isNumber, isSpace)
import Data.List (span, dropWhile, lookup)
type ParseError = String
-- A parser is a function that takes a string and returns a parse error or a
-- pair of the parsed data and the remaining string.
type Parser a = String -> Either ParseError (a, String)
type Context = [(String, Term)]
@rezoner
rezoner / spritestackformat.md
Last active August 15, 2021 14:34
SpriteStack format specs draft

A spritestack model is a ZIP file with two obligatory entries:

package.json

{
    "fileType": "SpriteStackModelProject",
    "title": "Whatever"
}
@takanuva
takanuva / Church
Last active March 11, 2020 16:42
Conversion between Scott encoding and Church endocing for naturals in CoC
\/(N: *) ->
\/(z: N) ->
\/(s: N -> N) ->
N
@cheery
cheery / interaction_combinators.py
Created March 28, 2019 20:43
Interaction combinators
# -*- encoding: utf-8 -*-
# Implements symmetric interaction combinators
# I took some ideas from Victor Maia's projects.
# Bunch of cells form an interaction net.
# It's a half-edge graph.
class Cell:
def __init__(self, kind):
self.ports = (Port(self), Port(self), Port(self))
self.kind = kind # 'era', 'con', 'fan'
@gallais
gallais / linear.agda
Last active March 26, 2019 21:57
Raw linear terms
open import Data.Nat.Base
open import Data.Vec
open import Data.Bool.Base using (Bool; false; true)
open import Data.Product
variable
m n : ℕ
b : Bool
Γ Δ Ξ T I O : Vec Bool n
@AndrasKovacs
AndrasKovacs / AB.agda
Last active September 11, 2018 10:20
Solution to SO question
-- https://stackoverflow.com/questions/52244800/how-to-normalize-rewrite-rules-that-always-decrease-the-inputs-size/52246261#52246261
open import Relation.Binary.PropositionalEquality
open import Data.Nat
open import Relation.Nullary
open import Data.Empty
open import Data.Star
data AB : Set where
A : AB -> AB