Skip to content

Instantly share code, notes, and snippets.

@Hirrolot
Hirrolot / CoC.ml
Last active July 17, 2024 13:27
How to implement dependent types in 80 lines of code
type term =
| Lam of (term -> term)
| Pi of term * (term -> term)
| Appl of term * term
| Ann of term * term
| FreeVar of int
| Star
| Box
let unfurl lvl f = f (FreeVar lvl)

Languages, Compilers, Debuggers, and Development Infrastructure Engineering Internships at Apple

Apple's Languages, Compilers, Debuggers and Development Infrastructure teams are now looking for interns for 2022!

We are looking for students who are motivated to get hands on experience working on these exciting technologies. We have interesting problems to solve at every level, from low-level assembly to high-level Swift code. No prior language, compiler or debugger experience is required and candidates without such experience are encouraged to apply. Candidates should be comfortable writing code in C++.

These are paid internships. While most internships last 3 months, starting in May or June, the starting dates and the internship length are flexible. Internships are restricted to students. Students must be enrolled in school in the quarter/semester immediately following the internship. We are looking for candidates of all education levels, from Bachelor’s to Ph.D. Applicants from outside the U.S.A. are w

@p4bl0-
p4bl0- / 00_readme.md
Last active October 12, 2023 09:09
A complete compiler for a simple language (in less than 150 LoC)

This project is a tiny compiler for a very simple language consisting of boolean expression.

The language has two constants: 1 for true and 0 for false, and 4 logic gates: ! (not), & (and), | (or), and ^ (xor).

It can also use parentheses to manage priorities.

Here is its grammar in BNF format:

expr ::= "0" | "1"

With scoped effects, handlers must be a part of the program

It is seductive to imagine that effect handlers in an algebraic effect system are not part of the program itself but metalanguage-level folds over the program tree. And in traditional free-like formulations, this is in fact the case. The Eff monad represents the program tree, which has only two cases:

data Eff effs a where
  Pure :: a -> Eff effs a
  Op :: Op effs a -> (a -> Eff effs b) -> Eff effs b

data Op effs a where
@praeclarum
praeclarum / MeadowEnclosure.js
Created May 22, 2020 21:02
OpenJSCAD source code for the Meadow Enclosure shown at the Wilderness Labs Dev Camp
var resolution = 50;
var printerError = 0.05;
var xsize = 100;
var ysize = 100;
var height = 20;
@MangelMaxime
MangelMaxime / fable-repl.css
Created June 27, 2019 13:51
Drag & Drop using Elmish and React hooks
html,
body {
font-size: 16px;
}
@realvictorprm
realvictorprm / Snake.fsx
Last active November 22, 2020 18:00
Snake implementation in F#
module Elmish.Snake
(**
Timer as a source of events with an SVG clock, by Zaid Ajaj.
You can find more info about Emish architecture and samples at https://elmish.github.io/
*)
open System
open Fable.Import
open Fable.Helpers.React
@nadavrot
nadavrot / Matrix.md
Last active July 21, 2024 17:27
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@jozefg
jozefg / nbe.ml
Last active March 20, 2021 00:13
module Syn =
struct
type uni_level = int
type t =
| Var of int (* DeBruijn indices for variables *)
| Nat | Zero | Suc of t | NRec of t * t * t * t
| Pi of t * t | Lam of t | Ap of t * t
| Uni of uni_level
| Subst of t * subst
and subst =
@bkase
bkase / algorithm-w.swift
Created January 5, 2018 06:00
Type Inference Algorithm W (ported from Swift Sandbox)
// Algorithm W
// From Principal Types for functional programs
// http://web.cs.wpi.edu/~cs4536/c12/milner-damas_principal_types.pdf
// by bkase
// STD library
infix operator <>: AdditionPrecedence
extension Dictionary {
static func <>(lhs: Dictionary, rhs: Dictionary) -> Dictionary {
var d: [Key: Value] = [:]