Skip to content

Instantly share code, notes, and snippets.

@slifin
slifin / 00_script.clj
Created March 26, 2020 14:50 — forked from ericnormand/00_script.clj
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@slifin
slifin / ConstrainedTypesExamples.fsx
Created July 18, 2018 08:46 — forked from swlaschin/ConstrainedTypesExamples.fsx
Examples of creating constrained types in F#
// General hints on defining types with constraints or invariants
//
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
//
// In F#, only classes can have private constructors with public members.
//
// If you want to use the record and DU types, the whole type becomes
// private, which means that you also need to provide:
// * a constructor function ("create").
@slifin
slifin / functor.php
Created February 28, 2017 11:42 — forked from ksassnowski/functor.php
Playing around with functors in PHP
<?php
interface Functor
{
// fmap :: Functor f => (a -> b) -> f a -> f b
public function fmap(callable $fn): Functor;
}
class Fn implements Functor
{