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
// db | |
var crypto = require("crypto"), | |
zlib = require("zlib"), | |
fs = require("fs"); | |
var Oddball = function(hash, digest) { | |
this.hash = hash; | |
this.digest = digest; | |
this.data = {}; |
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 System.Environment | |
import System.Directory.Extra | |
import Control.Exception.Extra | |
import System.FilePath | |
import Control.Monad | |
import System.IO.Extra | |
import Data.List.Extra | |
main = do | |
[dir,out] <- getArgs |
Basic unit type:
λ> replTy "()"
() :: ()
Basic functions:
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
(ns node-test.core | |
(:require [cljs.nodejs :as nodejs])) | |
(nodejs/enable-util-print!) | |
(def cp (.-spawn (nodejs/require "child_process"))) | |
(defn run-cmd [cmd args call-back] | |
(let [child (cp cmd args)] | |
(.on (.-stdout child) "data" call-back) | |
(.on (.-stdout child) "end" #(println (str cmd " process ended"))))) |
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
// Free monad based thread simulation and FRP constructs written in JavaScript | |
// First, we need some way to express lazy values and actions. | |
// We can use zero-argument functions for this purpose: call the function and | |
// you get the value. We also need to compose lazy values/actions. For that | |
// we have bindLazy function. Lazy values are not expected to be pure | |
// in this program: evaluating a lazy value/action at different times can produce | |
// a different value. |
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
(require '[clojure.test :as test]) | |
; Rewrite clojure.test to generate data structures instead of writing to | |
; stdout | |
(def ^:dynamic *results* | |
"Bound dynamically to an atom wrapping a vector of test report maps") | |
(defn add-name | |
"Given a testing report map, assoc's on a :name derived from the current | |
`clojure.test/testing` context." |
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
(defmacro html [body] | |
`(if-not (:render-colors? initial-query-map) | |
(html/html ~body) | |
(let [body# ~body] | |
(try | |
(let [[tag# & rest#] body# | |
attrs# (if (map? (first rest#)) | |
(first rest#) | |
{}) | |
rest# (if (map? (first rest#)) |
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
module FizzBuzzC | |
%default total | |
-- Dependently typed FizzBuzz, constructively | |
-- A number is fizzy if it is evenly divisible by 3 | |
data Fizzy : Nat -> Type where | |
ZeroFizzy : Fizzy 0 | |
Fizz : Fizzy n -> Fizzy (3 + n) |