- Sublime text 3 http://www.sublimetext.com/3
- 7zip http://www.7-zip.org/a/7z1505-x64.exe
- GSview (for Postscript and PDF viewing) http://www.gsview.com/downloads.html
Install https://msys2.github.io/
#!/bin/zsh -f | |
set -e | |
PKG_DIR=/tmp/SystemHeaders-`uname -r` | |
echo "Packaging $PKG_DIR..." | |
mkdir -p $PKG_DIR | |
cd / | |
for d in System/Library/Frameworks usr/include Developer/Library/Frameworks usr/lib; do |
Install https://msys2.github.io/
open Higher | |
(* | |
See `Free Applicative Functors' http://arxiv.org/abs/1403.0749 | |
*) | |
type (_, _) t = | |
| Pure : 'a -> ('a, 'f) t | |
| Apply : ('a -> 'b, 'f) t * ('a, 'f) app -> ('b, 'f) t | |
let pure v = Pure v |
var old_sin = Math.sin; | |
Math.sin = function(x) { | |
if (typeof x == "number" && isFinite(x)){ | |
return old_sin(x); | |
} | |
var str = "" + x; | |
if (str.length>0){ | |
str = str.repeat(Math.ceil(Math.max(1,18/str.length))); | |
} | |
var sinstr = "|\n"; |
State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?
There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.
Here I present a composable pattern for pure state machiness with effects,
The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse