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
/* A simple state machine in C: The enemy moves left, then to the | |
* right, and finally stops. */ | |
#include <stdio.h> | |
/* Enemy forward declaration, so that EnemyState can refer to it */ | |
struct Enemy; | |
/* Enemy state type */ | |
typedef struct EnemyState { |
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
(defn fmap | |
"Filtering map. Like map, but removes nils from the result seq." | |
[& args] | |
(filter identity (apply map args))) | |
(defn update-matching | |
"Updates the given object(s) with fns selected by predicates. | |
(update-matching object(s) predicate-fn*) |
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
(defn map-keys | |
"Applies f to all keys of m recursively." | |
[f m] | |
(cond | |
(map? m) (into {} (map (fn [[key value]] | |
[(f key) (map-keys f value)]) | |
m)) | |
(coll? m) (map (partial map-keys f) m) | |
:default m)) |
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
(defn maybe-reduce [f a l] | |
"Short-circuits if f returns nil." | |
(if (seq l) | |
(let [[b & cs] l | |
fab (f a b)] | |
(if cs | |
(if (nil? fab) | |
nil | |
(recur f fab cs)) | |
fab)) |
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
(defn nil-or-last [[x & xs]] | |
(if xs | |
(if (nil? x) | |
nil | |
(recur xs)) | |
x)) |
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.walk :only [prewalk-replace]]) | |
(defmacro doto$ | |
"Like doto, but replaces $ with a reference to the object." | |
[object & forms] | |
(let [object-sym (gensym "object")] | |
`(let [~object-sym ~object] | |
(doto ~object-sym | |
~@(prewalk-replace {'$ object-sym} forms))))) |
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
;;; parenface.el --- Provide a face for parens in lisp modes. | |
;; By Dave Pearson <[email protected]> | |
;; $Revision: 1.1 $ | |
;; Add a paren-face to emacs and add support for it to the various lisp modes. | |
;; | |
;; Based on some code that Boris Schaefer <[email protected]> posted | |
;; to comp.lang.scheme in message <[email protected]>. | |
(defvar paren-face 'paren-face) |
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
<plugin> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>jar-with-dependencies</id> | |
<phase>package</phase> | |
<goals> | |
<goal>single</goal> | |
</goals> | |
<configuration> |
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.contrib.map-utils | |
:only [deep-merge-with]]) | |
(defn file-path [[first & rest]] | |
(if rest | |
{first (file-path rest)} | |
first)) | |
(defn restore-hierarchy [x] | |
(->> x |
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
# HG changeset patch | |
# Parent 9105afa7527a99de3620e61cb673416bac1da97b | |
Specify commit to check out instead of HEAD | |
diff -r 9105afa7527a PKGBUILD | |
--- a/PKGBUILD Thu Dec 08 17:38:09 2011 +0200 | |
+++ b/PKGBUILD Thu Dec 08 17:48:11 2011 +0200 | |
@@ -14,7 +14,7 @@ | |
'66425a9e185788f720b466ca1caf5769') | |
OlderNewer