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
<?php | |
/** | |
* The prototype class. | |
*/ | |
class Object | |
{ | |
/** | |
* The object's 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
<?php | |
function U ($f) { | |
return $f ($f); | |
} | |
function Y ($f) { | |
return U (function ($x) use ($f) { | |
return $f (function ($y) use ($x) { | |
return U ($x) ($y); |
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
const Graph = { | |
A: ['B', 'C'], | |
B: ['D'], | |
C: ['A', 'B'], | |
D: ['E'] | |
} | |
const nextSteps = node => Graph[node] | |
// Forgive me, padre |
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
// reduce with the acc at each stage. | |
const scan = (f, init, xs) => { | |
let acc = init | |
return [init, ... xs.map( | |
x => acc = f(acc, x) | |
)] | |
} | |
// Some methods... |
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 Main where | |
import Prelude | |
import Effect.Console (logShow) | |
import TryPureScript (render, withConsole) | |
-- Declare the recursive type. | |
data Peano = Z | S Peano | |
-- This allows us to print the type. |
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
<?php | |
// == Arrow functions - A Love Story == | |
// Arrow functions are wonderful for a variety of reasons, and below are some | |
// of my favourites. Hopefully, these will provide some sort of support for | |
// the RFC. Note that none of these have been tested, though... | |
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
-- ## An Elm-entary visualisation | |
-- by _Tom Harding_ | |
module Main exposing (..) | |
-- This project uses a few dependencies. To anyone who's written any | |
-- amount of Elm before, the only stranger is `AnimationFrame`, from | |
-- the `elm-lang/animation-frame` package. This lets us subscribe to | |
-- the browser's RAF API. Everything else should be fairly obvious: | |
-- `Html` / `Svg` for our view, `Http` / `Json.Decode` for the AJAX |
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
const { tagged } = require('daggy') | |
const First = tagged('val') | |
First.prototype.concat = function (that) { | |
return this | |
} | |
const Min = tagged('val') |
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 Main where | |
import Prelude | |
import Control.Comonad (class Comonad, class Extend, extend, extract) | |
import Control.Monad.Eff.Console (log) | |
import Data.Array ((..), (!!), cons, length, replicate, zipWith) | |
import Data.Function (on) | |
import Data.Int (fromStringAs, binary, toNumber, floor) | |
import Data.Int.Bits ((.&.)) |
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
const Task = require('data.task') | |
Task.prototype.alt = function (that) { | |
return new Task((rej, res) => | |
this.fork(_ => that.fork(rej, res), res)) | |
} | |
const hosts = [ | |
[ 'db1.mysite.com', 'user', 'password' ], | |
[ 'db2.mysite.com', 'user', 'password' ], |
OlderNewer