This file contains hidden or 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
(defproject nightcode "2.3.8-SNAPSHOT" | |
:description "An IDE for Clojure and Java" | |
:url "https://github.com/oakes/Nightcode" | |
:license {:name "Public Domain" | |
:url "http://unlicense.org/UNLICENSE"} | |
:source-paths #{"src/clj" "src/cljs"} | |
:resource-paths #{"resources"} | |
:dependencies [[org.clojure/test.check "0.9.0" :scope "test"] | |
[adzerk/boot-cljs "1.7.228-2" :scope "test"] | |
; cljs deps |
This file contains hidden or 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
(def m {:a ["a" [1 2 3]] :b ["b" [4 5 6]]}) | |
(for [[k v] m | |
[l xs] v] | |
[l xs]) | |
;;returns... | |
;;([\a nil] [1 2] [\b nil] [4 5]) | |
;;Wat? | |
;;Why are strings being destructured this way? | |
;;Expected |
This file contains hidden or 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
(ns heat | |
(:require [incanter [core :as i] [charts :as c]])) | |
(defn f [x y] (i/minus (i/sq x) (i/sq y))) | |
;;looks good | |
(i/view (c/heat-map f -10 10 -10 10)) | |
;;boxes for xyblock renderer are too small, | |
;;leaving gaps that show the grey background | |
;;behind, giving the appearance of "lines" | |
;;all over the plot. |
This file contains hidden or 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
(defpackage :err-demo | |
(:use :common-lisp)) | |
(in-package :err-demo) | |
(defun str (x &rest xs) | |
(format nil "~{~a~}" (cons x xs))) | |
(defun show-excuse (excuse) | |
((print (str excuse " is no excuse for poor errors!")))) |
This file contains hidden or 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
/* Generated by Clojure */ | |
package org.clojure; | |
import org.clojure.runtime.*; | |
public class Clojure{ | |
/* Generated by Clojure from the following Lisp: | |
(defn* f0 (NIL)) | |
*/ | |
static public class f0 extends AFn{public Object invoke(ThreadLocalData __tld) throws Exception | |
{return null;}} | |
/* Generated by Clojure from the following Lisp: |
This file contains hidden or 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 children [item coll] | |
(-> (filter #(= (:parent %) (:id item)) coll) | |
seq)) | |
(defn item-children | |
([get-children item coll] | |
(if-let [xs (get-children item coll)] | |
(map #(lazy-seq (cons item (item-children get-children % coll))) xs) | |
(list [item nil]))) | |
([item coll] (item-children (memoize children) item coll))) |
This file contains hidden or 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
(ns spec-problem) | |
;;This is a smalle example of some circa clojure 1.7 code I found | |
;;that spec seemed to dislike when I was trying to port it. | |
;;It comes from the fn-fx library by way of the freactive.core | |
;;library fyi. | |
;;dumb function pre-defined... | |
(defn my-fn [x] (+ x 2)) | |
;;dumb macro that just builds an anonymous fn that |
This file contains hidden or 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
(ns incdebug.core | |
(:require [incanter [excel :as xls] [core :as i]] | |
[clojure.core.matrix.impl.dataset :as ds] | |
[clojure.core.matrix.protocols :as mp])) | |
;;this is what incanter is doing....we'll tease it apart | |
;;to debug. | |
#_(defn- read-sheet [rows-it header-keywords] | |
(let [colnames (incanter.excel.cells/read-line-values (first rows-it)) | |
rows (->> (rest rows-it) |
This file contains hidden or 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
(ns blah | |
(:require [clojure.core.async :as a])) | |
(defn error [x] {:error x}) | |
(defn success [x] {:success x}) | |
(defmacro maybe [expr] | |
`(->> (try (success ~expr) | |
(catch ~'Exception e# (error e#))))) |
This file contains hidden or 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
;;So for my incoming API boundary, I only would retain keys defined in | |
;;spec after receiving data from client (to wholesale limit potentially | |
;;dangerous crafting of json/edn payload). | |
;;Likewise, at my outgoing boundary, I would similarly only retain keys | |
;;defined in spec (sending absolute minimum data necessary). | |
(ns incoming | |
(:require [clojure.spec.alpha :as s])) |