The only cross-platform browser that fits in a Gist!
One line install. Works on Linux, MacOSX and Windows.
$> npm install http://gist.github.com/morganrallen/f07f59802884bcdcad4a/download
| 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) |
| (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#)) |
| (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." |
| // 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. |
| (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"))))) |
Basic unit type:
λ> replTy "()"
() :: ()Basic functions:
| 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 |
| // db | |
| var crypto = require("crypto"), | |
| zlib = require("zlib"), | |
| fs = require("fs"); | |
| var Oddball = function(hash, digest) { | |
| this.hash = hash; | |
| this.digest = digest; | |
| this.data = {}; |