Skip to content

Instantly share code, notes, and snippets.

Timothy Baldridge halgari

Block or report user

Report or block halgari

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
halgari / gist:f431b2d1094e4ec1e933969969489854
Last active Jul 11, 2019
What I want from a Type System
View gist:f431b2d1094e4ec1e933969969489854
The question was asked why I (as a programmer who prefers dynamic languages) don't consider static types "worth it". Here
is a short list of what I would need from a type system for it to be truely useful to me:
1) Full type inference. I would really prefer to be able to write:
(defn concat-names [person]
(assoc person :full-name (str (:first-name person)
(:second-name person))))
And have the compiler know that whatever type required and produced from this function was acceptible as long as the
View gist:a874b5e8e281c3e4afe51c0249b31811
(defn unordered-pmap [threads f in-c out-c]
(let [remain (atom threads)]
(dotimes [x threads]
(go-loop []
(if-some [v (<! in-c)]
(do (>! out-c (f v))
View gist:c17f378718cbd2fd82324002133ef678

So you’d like to contribute to Clojure, great! Let’s talk about what that involves.

The first thing you’ll want to make sure is that your idea is valid, and that you won’t spend a ton of time working on something that won’t make into master. To do this, you should create a JIRA ticket. For example, let’s say we want to improve how core.async handles channel closing propagation. It’s not a super complex problem, but there are some design questions about which of the various semantics currently in place should be the default, and if some semantics should be configurable.

So start by making a JIRA ticket and stating what the problem is you’re trying to solve, what the possible options for solving the problem. Now hit save and wait for the ticket to be triaged. Alex Miller will take a look when he can, and that can take a few days to a few weeks, depending on the time of the year (he has other responsibilities). Alex may out-right reject the idea if he knows Rich would never approve the ticket, but otherwise h

View gist:9885b337ca0199dd8cc12d7ecae361c1
package main
import "fmt"
func main() {
fmt.Println("hello world")
(defn -main []
halgari / gist:7160778
Created Oct 25, 2013
Using core.logic to query custom data sources.
View gist:7160778
(ns extend-core-logic.core
(:require [clojure.core.logic :refer :all]
[clojure.core.logic.protocols :refer [walk]]
[ :as jio]
[clojure.string :as string])
(:import [ BufferedReader StringReader]))
;; from:
(defn load-db []
(let [data ( ( (slurp "/Users/tim/Downloads/free-zipcode-database.csv")))
View gist:5d7780e6f068ae217bb2
(ns vararg-bench.core
(:require [criterium.core :refer [quick-bench]])
(defn varargs [arg1 & [arg2 arg3]]
View set-test.clj
(ns set-test
(:require [criterium.core :refer [bench quick-bench]])
(:import [clojure.lang IPersistentSet]))
(defn- bubble-max-key
"Move a maximal element of coll according to fn k (which returns a
number) to the front of coll."
[k coll]
(let [max (apply max-key k coll)]
(cons max (remove #(identical? max %) coll))))
View reduced_usage.clj
(defn r-some?
"Super fast version of clojure.core/some that does minimal allocation"
[pred coll]
(fn [acc v]
(if-let [val (pred coll)]
(reduced val)
View gist:fff9b90c7786942b937ae21fbbcd9f00
(defn r-some?
"Super fast version of clojure.core/some that does minimal allocation"
[pred coll]
(fn [acc v]
(if-let [val (pred coll)]
(reduced val)
View psudeo_fn_ptrs
enum FnNames {
struct Fn {
enum FnNames name;
You can’t perform that action at this time.