This file contains 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
digraph { | |
subgraph cluster1 { | |
label="Any" | |
0 [ color=blue; label = "0: Var(0)" ] | |
1 [ color=red; label = "1: Value((VTop, Span(5)))" ] | |
} | |
subgraph cluster2 { |
This file contains 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::cell::RefCell; | |
use std::collections::{HashMap, HashSet}; | |
use std::rc::Rc; | |
use std::sync::atomic::{AtomicU64, Ordering}; | |
fn main() { | |
use Term::*; | |
let id = Lam { | |
name: "x".into(), | |
body: Var { name: "x".into() }.into(), |
This file contains 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
""" | |
Abstract Data Types in Python | |
============================= | |
(Python meta programming at its ugliest) | |
The implementation of `adt` is horrible. It could be improved by a few abstractions | |
for generating the different flavors of variant arguments. | |
I'm no longer sure if the use of exec is as bad as I initially thought. At least it's | |
relatively readable. |
This file contains 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
from __future__ import annotations | |
import ctypes | |
import dataclasses | |
from typing import Any | |
LEAF_SIZE = 32 | |
LEAF_MASK = LEAF_SIZE - 1 | |
HASH_BITS = 64 | |
This file contains 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
// This is "Typying Haskell in Rust", based on "Typing Haskell in Haskell": | |
// https://web.cecs.pdx.edu/~mpj/thih/thih.pdf?_gl=1*1kpcq97*_ga*MTIwMTgwNTIxMS4xNzAyMzAzNTg2*_ga_G56YW5RFXN*MTcwMjMwMzU4NS4xLjAuMTcwMjMwMzU4NS4wLjAuMA.. | |
use crate::Pred::IsIn; | |
use std::iter::once; | |
use std::rc::Rc; | |
type Result<T> = std::result::Result<T, String>; | |
macro_rules! list { |
This file contains 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::cell::RefCell; | |
use std::collections::HashMap; | |
use std::rc::Rc; | |
// What's missing: | |
// - branching (or more general, control flow) operations | |
// - records / structs or some form of named compound data type | |
type Symbol = &'static str; | |
type Block = Rc<[Op]>; |
This file contains 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
import ast | |
import dataclasses | |
from typing import Any, Optional, TypeAlias | |
Expr: TypeAlias = Any | |
class Context: | |
def __init__(self, env=None): |
This file contains 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::collections::HashMap; | |
use std::rc::Rc; | |
fn main() { | |
let x = &Tensor::new(vec![ | |
vec![0.0, 0.0], | |
vec![1.0, 0.0], | |
vec![2.0, 0.0], | |
vec![0.0, 1.0], | |
vec![1.0, 1.0], |
This file contains 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::collections::HashMap; | |
use std::rc::Rc; | |
macro_rules! ident_list { | |
() => { | |
vec![] | |
}; | |
($a:ident) => { | |
vec![stringify!(a)] | |
}; |
This file contains 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
data Value = Null | |
| Var Nat | |
| Pair Value Value | |
| Num Int | |
data Substitution = Nil | |
| (::) (Nat, Value) Substitution | |
State : Type |
NewerOlder