This file contains hidden or 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
| (define-statement-abstractor (monad m) | |
| (:rules | |
| (val ((name expr) rest) `(let ((,name ,expr)) ,rest)) | |
| (get ((name expr) rest) `($ (monad-bind m) ,expr (fn (,name) ,rest))) | |
| (:else (expr rest) | |
| (let ((arg (gensym))) | |
| (if rest | |
| `($ (monad-bind m) ,expr | |
| (fn (,arg) (declare (ignore ,arg)) ,rest)) | |
| expr)))) |
This file contains hidden or 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
| (defstruct monad lift bind) | |
| (defconstant +id-monad+ | |
| (make-monad | |
| :lift #'identity | |
| :bind (lambda (x f) (funcall f x)))) | |
| (defconstant +list-monad+ | |
| (make-monad | |
| :lift #'list |
This file contains hidden or 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
| (defvar *registry* (make-hash-table)) | |
| (defmacro define-statement-abstractor ((name &rest parameters) &body definitions) | |
| `(eval-when (:compile-toplevel :load-toplevel :execute) | |
| (setf (gethash ',name *registry*) | |
| (list ',parameters | |
| ',(cdr (assoc :rules definitions)) | |
| ',(cdr (or (assoc :whole definitions) | |
| '(:whole (expr) expr))))))) |
This file contains hidden or 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 Data.Trie as T (Trie, empty, insert, member) | |
| import Data.Map as M (Map, fromList, (!)) | |
| import Data.Set as S (Set, fromList, toList, delete, intersection) | |
| import Data.Array.IArray as A | |
| import Data.List | |
| import Data.Ord | |
| import Data.Ix | |
| import Control.Monad | |
| import Control.Parallel.Strategies | |
| import System.IO.UTF8 as UTF8 (readFile) |
This file contains hidden or 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
| module KV where | |
| open import Data.Nat hiding (_⊔_) | |
| open import Data.Unit | |
| open import Data.List using (List; []; _∷_) | |
| open import Data.Empty | |
| open import Data.Maybe | |
| open import Data.Product | |
| open import Function | |
| open import Relation.Binary.Core |
This file contains hidden or 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
| // Enviance Form Filler | |
| // --------------------------------------------------------------------------------------------- | |
| // | |
| // Form-filling script for custom enviance applications. | |
| // Currently can into many basic things but doesn't support complex dependencies between fields. | |
| // | |
| // --------------------------------------------------------------------------------------------- | |
| // | |
| // ==UserScript== | |
| // @name Enviance Form Filler |
This file contains hidden or 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
| {-# LANGUAGE NoMonomorphismRestriction, MultiParamTypeClasses, GADTs, StandaloneDeriving, | |
| TypeFamilies, ConstraintKinds, TypeOperators, TupleSections, | |
| NoImplicitPrelude #-} | |
| import BasicPrelude hiding ((.), id, Map, Set) | |
| import GHC.Prim | |
| import Data.Map (Map) | |
| import Data.Set (Set) | |
| import qualified Data.Map as M | |
| import qualified Data.Set as S |
This file contains hidden or 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
| module Dual where | |
| import Prelude.Unicode | |
| import Data.List | |
| import Control.Applicative | |
| data Term = Term :$: [Term] | |
| | Term :→: Term | |
| | Id String |
This file contains hidden or 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
| #include <iostream> | |
| using namespace std; | |
| template <typename Type> | |
| typename Type::Repr quux(Type sig, typename Type::Repr val) { | |
| return val; | |
| } | |
| template <typename Type> |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdint.h> | |
| uint32_t quux(void) { | |
| uint32_t ebx; | |
| __asm ("inc %ebx"); | |
| __asm ("mov %%ebx, %0" : "=r"(ebx)); | |
| return ebx; | |
| } |