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
// Playground - noun: a place where people can play | |
import Cocoa | |
func checkOptionals(a:Dictionary<String,Int>,key1:String,key2:String) { | |
switch (a[key1],a[key2]) { | |
case (.Some(_),.Some(_)): println("both") | |
case (.Some(let a),.None): println("first " + String(a)) | |
case (.None,.Some(let b)): println("second " + String(b)) | |
default: println("neither") |
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
(defrule make-group | |
(make-graphic ?sheet ?id) | |
(dict-entry ?id Class "Group") | |
(not (dict-entry ?id isSubgraph ?)) | |
(dict-entry ?id Graphics ?array) | |
(array ?array $?graphics) | |
=> | |
(assert (group ?id)) | |
(foreach ?graphic $?graphics | |
(assert (make-graphic ?sheet ?graphic)) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
function makeContext() { return { choices:[], trail:[], halted:false }; } | |
// Push a new choice point onto the stack | |
function pushChoice( ctx, choiceThunk ) { | |
ctx.choices.unshift( { thunk:choiceThunk, trailIndex:ctx.trail.length } ); | |
} |
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
#lang racket/gui | |
(require framework) | |
(require ffi/unsafe) | |
(require ffi/unsafe/objc) | |
(ffi-lib "/System/Library/Frameworks/WebKit.framework/WebKit") | |
(import-class WebView) | |
(import-class NSURLRequest) | |
(import-class NSURL) | |
(import-class NSString) |
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
sprite( X, Y ) :- | |
sprite(S), | |
S.x <- X, S.y <- Y, | |
paint(S,0x8888ff), | |
spawn(( repeat, | |
receive(S,mouseMove,E), | |
S.x <- E.stageX - 50, | |
S.y <- E.stageY - 30 )). | |
paint(Sprite,Color) :- |
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
#lang racket | |
(require ffi/unsafe) | |
(require ffi/cvector) | |
(define swipl-lib (ffi-lib "/opt/local/lib/swipl-5.11.24/lib/i386-darwin10.8.0/libswipl")) | |
(define [swipl-func name type] (get-ffi-obj name swipl-lib type)) | |
(define fid_t _pointer) ;;handle to a foreign frame |
NewerOlder