- Exceptions
- Delimited continuations, because continuations are cool.
- Macros (maybe)
- Attribute lookup – lenses?
- Keyword parameters
- [GHC implicit parameters][] are interesting
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 rec elem x xs = | |
match xs with | |
| [] -> false | |
| y :: ys -> x = y || elem x ys | |
let rec uniques l = | |
let rec helper l acc = | |
match l with | |
| [] -> acc | |
| x :: xs -> |
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 ; Requires Racket >= 5.1.1 | |
(provide (rename-out (objective-r-read read) | |
(objective-r-read-syntax read-syntax))) | |
(require syntax/stx) | |
(define (rewrite-method-calls stx) | |
(if (stx-list? stx) | |
(let ((stx* (stx-map rewrite-method-calls stx))) |
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
# Untested! | |
type 'a zipper = Zip of 'a list * 'a list | |
let empty = Zip ([], []) | |
let from_list l = Zip ([], l) | |
let to_list (Zip (ls, rs)) = List.rev ls @ rs | |
let at_begin = function | |
| Zip ([], _) -> true | |
| _ -> false |
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
from collections import defaultdict | |
class BadMatch(NameError): | |
"""Exception when your args don't match a pattern""" | |
pass | |
class Any(object): | |
""" | |
>>> 'wutup' == Any() | |
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
(use '[clojure.core.match :only [match]]) | |
(defn evaluate [env [sym x y]] | |
(match [sym] | |
['Number] x | |
['Add] (+ (evaluate env x) (evaluate env y)) | |
['Multiply] (* (evaluate env x) (evaluate env y)) | |
['Variable] (env x))) | |
(def environment {"a" 3, "b" 4, "c" 5}) |
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
# xcode-build-bump.sh | |
# @desc Auto-increment the build number every time the project is run. | |
# @usage | |
# 1. Select: your Target in Xcode | |
# 2. Select: Build Phases Tab | |
# 3. Select: Add Build Phase -> Add Run Script | |
# 4. Paste code below in to new "Run Script" section | |
# 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0) |
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
(* Boilerplate *) | |
(* Identity: id :: a -> a *) | |
let id = fun x -> x | |
(* Function composition: (.) :: (b -> c) -> (a -> b) -> a -> c *) | |
let (<.>) (f : 'b -> 'c) (g : 'a -> 'b) : 'a -> 'c = | |
fun x -> f (g x) | |
(* Cont type *) | |
type ('w, 'a) cont = Cont of (('a -> 'w) -> 'w) |
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
(* | |
ocamlfind ocamlopt -o netclient_https_threads -thread -linkpkg -package threads,netclient,ssl,equeue-ssl netclient_https_threads.ml | |
http://docs.camlcity.org/docs/godipkg/3.12/godi-ocamlnet/doc/godi-ocamlnet/html/Https_client.html | |
*) | |
open Printf | |
module HTTP = Http_client | |
module HTTPS = Https_client | |
;; |
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
// http://rentzsch.tumblr.com/post/40806448108/ns-poor-mans-namespacing-for-objective-c | |
#ifndef NS | |
#ifdef NS_NAMESPACE | |
#define JRNS_CONCAT_TOKENS(a,b) a##_##b | |
#define JRNS_EVALUATE(a,b) JRNS_CONCAT_TOKENS(a,b) | |
#define NS(original_name) JRNS_EVALUATE(NS_NAMESPACE, original_name) | |
#else | |
#define NS(original_name) original_name | |
#endif | |
#endif |
OlderNewer