Create an executable (recapture
) that plays a signal through 24 audio ports and simultaneously records from another 24 ports. These ports come from three daisy chained Presonus FP10’s connected by firewire to a linux box. This hardware is accessed by the ffado jack drivers.
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
#!/bin/sh | |
PORT=9000 | |
OUT_DIR='out' | |
while getopts ":f:p:d:" opt; do | |
case $opt in | |
f) | |
HTML="$OPTARG" | |
;; |
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
#!/bin/sh | |
git diff-index --check --cached $against -- && \ | |
rm -rf out && \ | |
git stash save --keep-index 'pre-commit unstaged changes' && \ | |
lein clojurescript fresh test && \ | |
git stash pop |
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
macro $enum { | |
case $name:ident {$val:ident (,) ...} => { | |
var $name = {$($val: null) (,) ...}; | |
for (var k in $name) { | |
$name[k] = k; | |
} | |
Object.freeze($name); | |
} | |
} |
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
function ngIt($injector) { | |
return function(text, fn) { | |
it(text, function(done) { | |
var $rootScope = $injector.get('$rootScope') | |
, fin | |
, finished = function(err) { | |
fin = true; | |
done(err); | |
}; | |
fn(finished); |
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
using System.Collections.Generic; | |
using System.Diagnostics.Contracts; | |
using System.Linq; | |
[ContractClass(typeof(IValidatorContract<,>))] | |
public interface IValidator<E, in A> | |
{ | |
IEnumerable<E> Validate(A a); | |
} |
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
using System.Diagnostics.Contracts; | |
[ContractClass(typeof(ILanguageContract<>))] | |
public interface ILanguage<A> | |
{ | |
A Literal(string s); | |
string Escape(string s); | |
string Render(A a); | |
} |
Welcome to the inaugural Functional Friday post. I intend to explore, as far as is possible in C#, what functional programming brings to the table: types, laws, and equational reasoning. Example code is in the C# project at the root of this repository.
First up: parametricity and type classes.
The previous post glossed over some features of C# that make functional programming difficult. Here they are explicitly addressed. Let’s call them warts. These warts make it difficult to reason about code and thus to write correct code.
Tony Hoare invented the null pointer and later apologised for doing so:
OlderNewer