This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
/***************************************************************************** | |
* QuantCup 1: Price-Time Matching Engine | |
* | |
* Submitted by: voyager | |
* | |
* Design Overview: | |
* In this implementation, the limit order book is represented using | |
* a flat linear array (pricePoints), indexed by the numeric price value. | |
* Each entry in this array corresponds to a specific price point and holds | |
* an instance of struct pricePoint. This data structure maintains a list |
Delimited continuations manipulate the control flow of programs. Similar to control structures like conditionals or loops they allow to deviate from a sequential flow of control.
We use exception handling as another example for control flow manipulation and later show how to implement it using delimited continuations. Finally, we show that nondeterminism can also be expressed using delimited continuations.
//========================================== | |
// Working fully self-contained getting-started example for Suave Web Server scripting | |
// | |
// Note you don't need to have _anything_ installed before starting with this script. Nothing | |
// but F# Interactive and this script. | |
// | |
// This script fetches the Paket.exe component which is referenced later in the script. | |
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been | |
// downloaded by the user (by executing the first part of the script) the reference | |
// shows as resolved and can be used. |
In this gist we will first show that we can beat the arc challenge | |
(http://www.paulgraham.com/arcchallenge.html), and then build the library that | |
shows how we did it. This gist is Literate Haskell and is of course executable. The packages needed are happstack-server and applicative-extras, installable using cabal. | |
Let's start with some imports (for now, you can ignore these) | |
> {-# LANGUAGE GADTs, TypeSynonymInstances #-} | |
> module ArcChallenge where | |
> | |
> import Control.Applicative |
// Based on the article 'Combinators for logic programming' by Michael Spivey and Silvija Seres. | |
let rec inf_seq n = seq { yield n; yield! inf_seq (n+1) } | |
let rec lzw f l1 l2 = | |
LazyList.delayed ( fun () -> | |
match l1,l2 with | |
|LazyList.Nil, _ -> l2 | |
|_, LazyList.Nil -> l1 | |
|LazyList.Cons(p1,tail1),LazyList.Cons(p2,tail2) |
# https://cardanodocs.com/technical/wallet/api/ | |
# create a new wallet | |
$ curl -H "Content-Type: application/json" --cacert cardano-sl/scripts/tls-files/ca.crt https://localhost:8090/api/wallets/new -d '{ | |
"cwInitMeta": { | |
"cwName": "my-cardano-wallet", | |
"cwAssurance": "CWAStrict", | |
"cwUnit": 0 | |
}, | |
"cwBackupPhrase": { |
I came from the OOP world, most of my professional work was in Java or C#. The languages were similar, and I could use them interchangably as I built software in each of them for several years. With enough experience in both, I was comfortable with either ecosystem and could generally be productive in either. Sometimes the job required one or the other. Sometimes the target OS constrained my choice to Java, which frustrated me a bit, because the languages were so similar, why would the runtime try to restrict a choice? I enjoyed writing server applications on Unix in college, and Linux afterwards, because the machines were so easy to configure compared to Windows machines that took a few hours to install and configure to get my software running. On Linux, I could type a handful of commands into a newly installed system and be up and running.
Sometime around 2005, Java had stagnated while C# was flourishing. They both released generics, but then C# came out with new features like
var http = require('http') | |
var fork = require('child_process').fork; | |
function fib(n) { | |
if (n < 2) { | |
return 1; | |
} else { | |
return fib(n - 2) + fib(n - 1); | |
} | |
} |
/// A probability is a number between 0 and 1 inclusive. | |
type Prob = float | |
/// A distribution is a sequence of outcome-probability pairs such that the | |
/// probabilities sum to 1. | |
type Dist<'a> = D of seq<'a * Prob> | |
/// A spread takes a sequence of elements and assigns probabilities. | |
type Spread<'a> = 'a list -> Dist<'a> |