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
UILocalNotification *notif = [[UILocalNotification alloc] init]; | |
notif.fireDate = [NSDate dateWithTimeIntervalSinceNow:10]; | |
[[UIApplication sharedApplication] scheduleLocalNotification:notif]; |
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
tests( | |
JS, | |
{ | |
name: 'unify(Var, Clause)', | |
code: 'new Subst().unify(new Var("X"),\n' + | |
' new Clause("foo"));', | |
expected: new Subst().bind("X", new Clause("foo")) | |
}, | |
{ | |
name: 'unify(Clause, Var)', |
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
// This function is used by the test harness to pretty-print values. | |
// Right now it doesn't handle undefined, functions, NaN, Number.POSITIVE_INFINITY, etc. | |
// Feel free to modify / extend it as you see fit. | |
// (FYI, pretty-printing is not used by our grading scripts.) | |
function prettyPrintValue(value) { | |
return JSON.stringify(value); | |
} | |
// Helper functions used in the tests |
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
tests( | |
F, | |
{ | |
name: 'primitive number', | |
code: '6', | |
expected: 6 | |
}, | |
{ | |
name: 'primitive boolean', | |
code: 'true', |
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
(* Tail Recusrive Check on if a Binary Tree is a search binary tree *) | |
type Node = Internal of Node * int * Node | Leaf of int | |
type Wrapper = W of Node * int * int | |
let isSearch tree = | |
let rec isSearchHelper ret wlist = | |
match wlist with | |
[] -> ret | |
| [W(n, minn, maxx)::rest] -> match n with |
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 <climits> | |
#include <queue> | |
typedef struct Holder { | |
Node* node; | |
int min; | |
int max; | |
Holder(Node* n, int min, int max): node(n), min(min), max(max) {} | |
} *Holder_p; |