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
<?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
module Data.Tape where | |
import Prelude | |
import Control.Comonad (class Comonad, extract) | |
import Control.Extend (class Extend, extend) | |
import Data.List (List(Cons, Nil), uncons) | |
import Data.Foldable | |
( class Foldable | |
, foldl |
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
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE OverloadedLists #-} | |
module FreddyVsJson where | |
import Control.Comonad.Cofree | |
import Data.Fix | |
import Data.Map | |
-- Here's our JSON "DSL". With this, we can represent any |
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
const Option = require('fantasy-options') | |
const Either = require('fantasy-eithers') | |
const Task = require('data.task') | |
const { tagged } = require('daggy') | |
const { Some, None } = Option | |
const { Left, Right } = Either | |
const Pair = tagged('_1', '_2') |
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 daggy = require('daggy') | |
const { Loop, Done } = | |
daggy.taggedSum({ Loop: ['b'] | |
, Done: ['a'] }) | |
Array.empty = () => [] | |
const Pair = T => { | |
const Pair_ = daggy.tagged('_1', '_2') |
OlderNewer