Skip to content

Instantly share code, notes, and snippets.

@gamma235
gamma235 / ann.clj
Created August 10, 2015 00:40
neural network exploration
(ns machine-learning.ann
(:use clojure.core.matrix)
(:require [clojure.core.matrix.impl.mathsops :as m]
[clojure.core.matrix.operators :as o]))
(defn make-layers [coll]
"Takes a coll like [3 4 2] and uses it to make an architecture of 3 layers with an input layer of 3 nodes, hidden layer of 4, etc. "
(let [make-layer (fn [number-of-nodes] (vec (take number-of-nodes (repeat 0))))
input-layer (make-layer (first coll))
@gamma235
gamma235 / OO-Clojure.clj
Last active August 29, 2015 14:07
Implementing OOP in Clojure
;;==== Object Oriented Clojure ====;;
;;;;-------------------------;;;;
;;;; functions & macros ;;;;
;;;;-----------------------------;;;;
;;;;---------| private |--------;;;;
;; general abstraction over override functions
@gamma235
gamma235 / joc-logic.clj
Last active July 30, 2021 06:37
Joy of Clojure, updated core.logic examples
(ns logic.core
(:require [clojure.core.logic.pldb :as pldb] ;; facts are now stored in a logic database which requires the pldb ns
[clojure.core.logic.fd :as fd] ;; for constraint programming, no need to include include in project.clj
[clojure.core.logic :refer :all :exclude [record?]])) ;; I left out ":as :logic" for aesthetics
(run* [answer]
(== answer 5))
(run* [val1 val2]
(== {:a val1, :b 2}
(ns samsara.core
(:import java.util.Date))
(def sensual-objects (atom #{{:G__8279 [:neutral :thought]}}))
(def mindfulness (atom 44444))
(def karmic-history (atom []))
(def faculties (atom {:faith 0 :energy 0 :concentration 0 :wisdom 0}))
(def ignorance (atom 88888))
(defn map-span
(ns jsync.elevator
(:refer-clojure :exclude [map reduce into partition partition-by take merge])
(:require [clojure.core.async :refer :all :as async]))
;; This is necessary to check and see what is on the persistent queue
(defmethod print-method clojure.lang.PersistentQueue
[q, w]
(print-method '<- w)
(print-method (seq q) w)
(print-method '-< w))