Skip to content

Instantly share code, notes, and snippets.

@run-dlang
run-dlang / main.d
Created July 24, 2023 11:33
Code shared from run.dlang.io.
import std,std.format,std.container,std.range;
//shared
class Baz { int v; this(int w) { this.v = w; }
//const bool opEquals(const Baz o) pure nothrow @safe { return this.v == o.v; }
override string toString() const pure nothrow @safe { return this.v.to!string; }
//string toString() shared const pure nothrow @safe { return this.v.to!string; }
}
//bool opEquals(Baz t,Baz o) pure nothrow { return t.v == o.v; }
void main() { //writeln("Hello D");
DList!Baz q;
@run-dlang
run-dlang / main.d
Created July 19, 2023 06:54
Code shared from run.dlang.io.
import std;
alias section = void function(ulong s);
void bar(ulong s) {
writefln("bar(%d)",s);
return S(&bar)(s+1);
}
void baz(ulong s) {
writefln("baz(%d)",s);
}
void quux(ulong s) {
@dvanhorn
dvanhorn / syntax-rules-eval.rkt
Last active October 25, 2020 07:11
A CPS interpreter for a CBV language w/ some fancy features written in syntax-rules
#lang racket
;; A CPS interpreter for a CBV language written in syntax-rules
;; e ::= 'd literal
;; | x variable
;; | (e e ...) application
;; | (λ (x ...) e) abstraction
;; | (let ((x e) ...) e) let
;; | (if e e e) conditional

Guix on WSL2

(updated versions of this document, plus more, live here)

This will show you how to get Guix running on WSL2.
We're going to go as "minimal" as possible, without starting off one of the readily available WSL2 distros.
Parts of this guide should help with understanding how to set up any custom distro on WSL, not just Guix.

Disclaimer: I'm a Guix nOOb! (hence going through the trouble of installing it on WSL2)

@dpiponi
dpiponi / test.lhs
Last active August 26, 2018 10:47
Invert infinite upper triangular matrix
> scale :: Num a => a -> [a] -> [a]
> scale a bs = map (a *) bs
Invert an infinite upper triangular matrix with 1 on diagonal
[
[1, b₀₁, b₀₂, b₀₃, …],
[1, b₁₂, b₁₃, …],
[1, b₂₃, …],
]
@darius
darius / RABBIT.scm
Last active February 13, 2020 20:39
;;- -*-scheme-*-
;;; rabbit compiler
;;- This is the source code to the RABBIT Scheme compiler, by Guy Steele,
;;- taken from the Indiana Scheme repository and annotated by me, Darius
;;- Bacon. I converted it from all-uppercase to all-lowercase and
;;- reindented it with Emacs for better readability. I've added the
;;- comments starting with either ;- or ;*. Other comments are by Steele.
;;- The ;- comments were things I'd figured out, while ;* denoted things
;;- for me to look into. (Sometimes I didn't bother to type in the answer
@jyp
jyp / Organ.lhs
Last active September 16, 2015 09:21
---
title: On the Duality of Streams
subtitle: How Can Linear Types Help to Solve the Lazy IO Problem?
author:
- name: Jean-Philippe Bernardy
- name: Josef Svenningsson
...
<!--
@dyokomizo
dyokomizo / Prefixed.rkt
Last active August 29, 2015 14:07
Interpreter for a polish notation "stack" language
#lang racket
(define eval [lambda (p ) (eval/s p '())])
(define eval/s [lambda (p s) (eval/k p s (lambda (x) x))])
(define eval/k
[lambda (p s k)
(cond {(eq? p '()) (k s)}
{(number? (car p)) (eval/k (cdr p) s [lambda (s) (k (cons (car p) s))])}
{(eq? (car p) 'dup) (eval/k (cdr p) s [lambda (s) (k (cons (car s) (cons (car s) (cdr s))))])}
@lwhjp
lwhjp / factorial.rkt
Created October 19, 2014 08:18
Factorials in Racket
#lang racket
;;
;; These are some examples of different ways to compute factorials
;; using various paradigms and features provided by Racket. There
;; are more options available in packages which are not imported
;; by default, but that rabbit hole goes very deep indeed.
;;
;; Comments and suggestions welcome!
;; leo@lwh.jp
@staltz
staltz / introrx.md
Last active May 30, 2024 18:43
The introduction to Reactive Programming you've been missing