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
let mk_idmap (mk_id : unit -> 'b) (ids : 'a list) : 'a -> 'b = | |
List.fold_left (fun acc x -> | |
let new_id = mk_id () in | |
(fun id -> if id = x then new_id else acc id ) | |
) (fun _ -> raise Not_found) ids | |
let mk_id = | |
let id = ref 0 in | |
function () -> incr id; !id |
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
// gcc -Wall -std=gnu11 main.c -o main | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef void callback_t(void); | |
void test(void (*)(void)); | |
void myFun(void *); |
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
(* count *) | |
(* val count: 'a -> 'a list -> int *) | |
let rec count x xs = | |
match xs with | |
| a::xs when a == x -> 1 + count x xs | |
| _::xs -> 0 + count x xs | |
| [] -> 0 | |
(* remove list duplicates *) | |
(* val nub : 'a list -> 'a list *) |
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
simon@merkel:~/tmp | |
$ gcc -Wall stat_arr.c -o stat_arr | |
simon@merkel:~/tmp | |
$ ./stat_arr | |
Pub #0 is at 51.27955, 1.07893 | |
Pub #1 is at 51.28248, 1.08050 | |
Pub #2 is at 51.28223, 1.07135 | |
Pub #3 is at 51.27766, 1.08356 | |
Pub #4 is at 51.28236, 1.08262 |
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
WHEEL_D = 30; // Wheel diameter | |
WHEEL_W = 10; // Wheel width (or height) | |
WHEEL_T = 3; // Wheel & axle rim thickness | |
COMB_SIZE = 4; // Width of honey comb "holes" | |
COMB_GAP = 1; // Width of honey comb "walls" | |
AXLE_D = 2; // Axle diameter | |
// Set the resolution of the render | |
$fn = 100; |
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
#include "mbed.h" | |
#include "C12832.h" | |
Serial xbee(D1, D0); | |
Serial host(USBTX, USBRX); | |
C12832 lcd(D11, D13, D12, D7, D10); | |
AnalogIn pot(A0); | |
#define MAX_RPM 9600 |
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
- Updated include for readline.h | |
- Included lambda.tab.h in lamscan | |
- Changed `NEWLINE` to `NEW_LINE` to prevent naming clash |
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
wc_zero = [ | |
lambda n: (n < 32), | |
lambda n: (n >= 127 and n < 160), | |
lambda n: unicodedata.combining(chr(n)) > 0 | |
] | |
wc_two = [ | |
lambda n: (n>=4352 and n<=4447), | |
lambda n: (n>=11904 and n<=42191 and (n&~17)!=12298 and n!=12351), | |
lambda n: (n>=65072 and n<=65135), lambda n: (n>=65280 and n<=65375), | |
lambda n: (n>=65504 and n<=65511), lambda n: (n>=131072 and n<=196607) |
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
#!/usr/bin/env runhaskell | |
--- Moves all headings down one for use as sections in a LaTeX document | |
--- Also overrides : | |
--- The codeblock behaviour to use minty, with some given options | |
--- The image behaviour | |
import Text.Pandoc.JSON | |
import Text.Pandoc.Walk | |
heading :: Block -> Block |
NewerOlder