Skip to content

Instantly share code, notes, and snippets.

(defn create-nfg-strategy-list
[strategies]
(->> strategies
(map (fn [strat]
(add-braces (str/join " " (doall (map add-doublequotes strat))))
;; (->> strat
;; (map add-doublequotes)
;; (str/join " ")
;; add-braces)
))
(defmacro mget-at [m at]
`(mget ~m ~@at))
(defn payoffs-at [game at]
(let [payoffs (:payoffs game)]
(map #(mget-at % at) payoffs)))
CompilerException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol, compiling:(/private/var/folders/j2/zvt92c1s39d_0kdmhrhbgtkm0000gn/T/form-init602105178864433939.clj:3:11)
(message "THE USER CONFIG FILE WAS LOADED")
;; Configure: Add org-mode-dir/lisp/ to Emacs load-path
(add-to-list 'load-path "~/.emacs.d/plugins/org-8.2.5c/lisp")
(require 'org)
(require 'ox-publish)
;; Incise uses the new org-mode Export Framework (introduced in 8.0) See more
;; information here:
(setq org-publish-project-alist
'(
("incise-org"
:base-directory "~/Development/clojure/incise-org-parser/resources/org/"
:base-extension "org"
:publishing-directory "~/Development/clojure/incise-org-parser/public/"
:recursive t
:publishing-function org-html-publish-to-html
:headline-levels 2
:auto-preamble t)
(def sudoku-board [[5 3 0 0 7 0 0 0 0]
[6 0 0 1 9 5 0 0 0]
[0 9 8 0 0 0 0 6 0]
[8 0 0 0 6 0 0 0 3]
[4 0 0 8 0 3 0 0 1]
[7 0 0 0 2 0 0 0 6]
[0 6 0 0 0 0 2 8 0]
[0 0 0 4 1 9 0 0 5]
[0 0 0 0 8 0 0 7 9]])
(define-generic-mode 'ebnf-mode
'(("(*" . "*)"))
'("=" ":" ":=" "::=")
'(
("^[^ \t\n][^=]+" . font-lock-variable-name-face)
("<" . font-lock-constant-face)
(">" . font-lock-constant-face)
("['\"].*?['\"]" . font-lock-string-face)
("\\[\\|\\]\\|{\\|}\\|(\\|)\\||\\|,\\|;" . font-lock-type-face)
("\\?" . font-lock-builtin-face)
user> (defmacro fundef [a b]
`(defn ~(symbol (str "plus-" a "-" b)) [arg#] (+ ~a ~b arg#)))
#'user/fundef
user> (fundef 1 2)
#'user/plus-1-2
user> (plus-1-2 3)
6
user> (map #(fundef %1 %2) (range 3) (range 3))
(#'user/plus-p1__10068#-p2__10069# #'user/plus-p1__10068#-p2__10069# #'user/plus-p1__10068#-p2__10069#)
user> (plus-0-0 1)
@luxbock
luxbock / core.clj
Created September 21, 2014 12:00
lein-plz-nicknames
(ns lein-plz-nicknames
"Tiny script to check for additional projects discovered by crawling
crossclj.info and filtering for the popularity of the project."
(:require [me.raynes.laser :as l]
[clojure.string :as str]
[leiningen.plz :refer [fallback-nicknames]]))
(def prj-from-crossclj
"Fetches a list of projects from crossclj.info"
(apply str
@luxbock
luxbock / anonymous-gist.clj
Created September 24, 2014 18:43
data-readers weirdness
(deftype Bar [a]
Object
(equals [self other] true)
(toString [_] (str a)))
(defn barme [a] (->Bar a))
(set! *data-readers* {'bar myns/barme})
;; #bar :foo => nil
@luxbock
luxbock / clj-imenu.el
Last active August 29, 2015 14:06
clojure imenu support
(setq clojure-imenu-generic-expression
'((nil "^\\s-*(\\(?:s\\|t/\\)?defn-?\\s-+\\(?:\\^[^[:space:]\n]+\\s-+\\)?\\([^[:space:]\n]+\\)" 1)
("Variable""^\\s-*(\\(?:s\\|t/\\)?def[[:space:]\n]+\\(?:\\(?:\\^{[^}]+}[[:space:]\n]+\\)\\|\\(?:\\^:[^[:space:]\n]+\\s-+\\)\\)?\\([^[:space:]\n\)]+\\)" 1)
("Macro" "^\\s-*(defmacro\\s-+\\([^[:space:]\n]+\\)" 1)
("Record" "^\\s-*(\\(?:s/\\)?defrecord\\s-+\\([^[:space:]\n]+\\)" 1)
("Type" "^\\s-*(deftype\\+?\\s-+\\([^[:space:]\n]+\\)" 1)
("Protocol" "^\\s-*(\\(?:def\\(?:-abstract-type\\|interface\\+?\\|protocol\\)\\)\\s-+\\([^[:space:]\n]+\\)" 1)
("Multimethod" "^\\s-*(defmulti\\s-+\\([^[:space:]\n]+\\)" 1)
("Multimethod" "^\\s-*(defmethod\\s-+\\([^[:space:]\n]+\\)" 1)))