Skip to content

Instantly share code, notes, and snippets.

View cronokirby's full-sized avatar
🗿

Lúcás Meier cronokirby

🗿
View GitHub Profile
{-# LANGUAGE RankNTypes #-}
newtype Nat = Nat { unNat :: forall m. Monoid m => m -> m }
instance Num Nat where
Nat f + Nat g = Nat (\m -> f m <> g m)
Nat f * Nat g = Nat (\m -> f (g m))
abs = id
negate _ = error "negate @Nat"
signum (Nat f) = if f [()] == [] then 0 else 1
{-# LANGUAGE RankNTypes #-}
data List a = List (forall x. x -> (a -> List a -> x) -> x)
instance Show a => Show (List a) where
show = foldR "[]" (\a str -> show a ++ " :: " ++ str)
instance Eq a => Eq (List a) where
(List l1) == (List l2) =
type Peeked<T> = { ready: true; value: T } | { ready: false };
class Peekable<T> implements IterableIterator<T> {
private _peeked: Peeked<T> = { ready: false };
private _iter: Iterator<T>;
constructor(iter: Iterable<T>) {
this._iter = iter[Symbol.iterator]();
}
import { delay } from "https://deno.land/std/async/delay.ts";
async function* messages(msg: string, timeout: number) {
for (let i = 0; i < 100; ++i) {
await delay(timeout);
yield `${msg} ${i}`;
}
}
async function* mergeStreams<T>(...streams: AsyncIterable<T>[]) {
use crate::ast::*;
use crate::lexer;
grammar;
Comma<T>: Vec<T> = {
<v:(<T> ",")*> <e: T?> => match e {
None => v,
Some(e) => {
let mut v = v;
; instr 0
1 3 7 7
2 5 7 8
2 7 7 7
2 3 7 _
1 0 0 0
2 0 0 0
2 0 0 0
1 0 0 0
1 0 1 0
This file has been truncated, but you can view the full file.
{"kind": "fish", "description": "Filets de perche meuniére (Estonie) sauce tartare Frites Salade mêlée", "info": "Suggestion du Chef 1", "restaurant": "Cafétéria BC", "price": {"E": 16.0, "V": 16.0, "D": 16.0, "C": 16.0}, "date": "2016-1-1"}
{"kind": "fish", "description": "Quadroni aux gambas et crème de poivrons", "info": "Plat du jour", "restaurant": "Espace Copernic by Novae", "price": {"E": 24.0, "V": 24.0, "D": 24.0, "C": 24.0}, "date": "2016-1-1"}
{"kind": "fish", "description": "Délice ricotta épinard, sauce citron et saumon fumé", "info": "Pasta de la semaine", "restaurant": "L'Arcadie", "price": {"E": 12.0, "V": 12.0, "D": 12.0, "C": 12.0}, "date": "2016-1-1"}
{"kind": "fish", "description": "Salade de légumes, sauce tartare, œuf et thon", "info": "Salade de saison", "restaurant": "L'Epicure", "price": {"E": 8.0, "V": 8.0, "D": 8.0, "C": 8.0}, "date": "2016-1-1"}
{"kind": "fish", "description": "Salade de légumes, sauce tartare, œuf et thon", "info": "Salade de saison", "restaurant": "L'Epicure", "p
@cronokirby
cronokirby / gist:f6e2fdd4784672999a2241d9de64b2e4
Created November 13, 2019 21:55
I, Lúcás C. Meier, attest to the validity of this public key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBF3MelkBCAC2SlLs0Hw7KoRl8g9Ya2cYsXD87hLwdRD5xF5+38h1YKGNVc9Q
54a7GPvAg74qNn0eIxC5Hak31xeAoVaA1pMSrUxVAPaifz9pSr0zI+4QFkLHH2c1
N3WW3w6g+VRKwuX2p3vI1UaJZ0N1ls5kSOQUEwYHzktaJf8njXvo4+55CIx/gZIN
2QnVb4bQO5PBqSMi5Qlj10VL0mjh7sQFeOMwjKSVyTKlk54/Dq1Yi46j8BR9JQQb
hh5sY2LKq3ORm6apg8H2Au16S/o6p4/cv1jAgVN3sxG25ftypLhYeZKXTt+lWte/
DJl8pKdhW8UbwOCiumveZuc7FJmuelVI07XzABEBAAG0MEzDumPDoXMgQ3LDrW9z
dMOzaXIgTWVpZXIgPGNyb25va2lyYnlAZ21haWwuY29tPokBVAQTAQgAPhYhBJKB
0W/t2Kfme1QRcDubDum8Ie9cBQJdzHpZAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQW
0000000000001119 <add>:
1119: 55 push rbp
111a: 48 89 e5 mov rbp,rsp
111d: 48 83 ec 10 sub rsp,0x10
1121: 89 7d 00 mov DWORD PTR [rbp+0x0],edi
1124: 89 75 fc mov DWORD PTR [rbp-0x4],esi
1127: 8b 45 00 mov eax,DWORD PTR [rbp+0x0]
112a: 50 push rax
112b: 8b 45 fc mov eax,DWORD PTR [rbp-0x4]
112e: 50 push rax
.globl add
add:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movl %edi, 0(%rbp)
movl %esi, -4(%rbp)
movl 0(%rbp), %eax
pushq %rax
movl -4(%rbp), %eax