Skip to content

Instantly share code, notes, and snippets.

View fogus's full-sized avatar
💭
attempting to learn how to better learn

Fogus fogus

💭
attempting to learn how to better learn
View GitHub Profile
(ns fogus.seance.advice
(:require [clojure.string :as string]
[robert.hooke :as hook]
fogus.seance.ext))
(defn- name-lexical
[n]
(symbol (string/upper-case (name n))))
(defn- name-delegate
(import 'clojure.lang.ExceptionInfo)
(defn call-cc [f]
(let [v (promise)
e (ex-info "cc" {:v v})]
(try (f #(do (deliver v %) (throw e)))
(catch ExceptionInfo ex
(if (identical? ex e)
@(:v (ex-data ex))
(throw ex))))))
;; Datomic example code
(use '[datomic.api :only (db q) :as d])
;; ?answer binds a scalar
(q '[:find ?answer :in ?answer]
42)
;; of course you can bind more than one of anything
(q '[:find ?last ?first :in ?last ?first]
"Doe" "John")
fn(test
"A simple test function that takes two expressions and uses a function to test them"
[Expr1 Expr2 F Desc]
if(not(F(Expr1 Expr2))
out("Test of " Desc " failed!" crlf)
out(" " Expr1 " " F " " Expr2 crlf)
false
else
true))

Insurrection is a Chess variant where individual pieces can move up in rank and governments are toppled.

Setup

Insurrection is set up exactly like a regular game of Chess, shown below:

setup

Because of succession you might wish to have addional sets of pieces on hand.

Genetic Algorithms for the PAC-world
PAC-world is inhabited by several species of tiny creatures called PAC-mites, all of which are engaged in a constant struggle for survival with every other species. Each individual mite lives out its short lifetime by following a small set of deterministic rules and interacting only with its immediate surroundings. However, in large numbers, the PAC-mites of a species combine to form complex patterns of behavior which enable them to compete with PAC-mites of other species. Your goal is to design a species that will annihilate every other species in this world in a one-on-one duel.
The laws of PAC-world:
PAC-world consists of a grid of discrete cells measuring 21 cells horizontally by 11 cells vertically. The world is completely surrounded by insurmountable barriers that occupy the outermost cells. Therefore, the actual world measures 19 cells by 9 cells. (In the simulator the barriers are not displayed so only the 19x9 region is visible.)
Each cell may be occupied by ei
(ns schema->gen
"Functions for generating test data from schemas."
(:require [four.stateful :as four]
[re-rand :refer [re-rand]]
[schema.core :as sch]
[simple-check.generators :as gen]))
(defn ^:private re-randify-regex
"schema requires ^$ while re-rand forbids them"
[re]
@fogus
fogus / books2go.md
Last active August 29, 2015 14:05
I need to clear off some shelf space.

I need to clear off some shelf space. I'd be willing to sell or trade the following:

  • Learn you some Erlang for Great Good
  • Learn you some Haskell for Great Good
  • Rails 3 in Action
  • Computer Lib / Dream Machines (Tempus printing)
  • The Haskell School of Expression
  • Natural Language Understanding (2nd ed)
  • The Art of UNIX programming
  • Speech and Language Processing
(ns tumblrsearch.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [clojure.browser.repl]
[cljs.core.async :as async :refer [put! chan <!]]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[figwheel.client :as fw :include-macros true]
)
(:import [goog.net Jsonp]
[goog Uri]