Skip to content

Instantly share code, notes, and snippets.

luxbock luxbock

Block or report user

Report or block luxbock

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gambit.clj
(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)
))
View game.clj
(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)
View incise.el
(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:
View el-conf.el
(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)
View sudoku.clj
(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]])
View ebnf-mode.el
(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)
View test.clj
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 Sep 21, 2014
lein-plz-nicknames
View core.clj
(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 Sep 24, 2014
data-readers weirdness
View anonymous-gist.clj
(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 Aug 29, 2015
clojure imenu support
View clj-imenu.el
(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)))
You can’t perform that action at this time.