Skip to content

Instantly share code, notes, and snippets.

jfacorro / reducers.cljc
Last active Jun 10, 2020
Reducers Comparison
View reducers.cljc
(require '[clojure.core.reducers :as r])
(defn wait [millis]
#?(:clj (Thread/sleep millis)
:clje (timer/sleep millis)))
(defmacro times
{:added "1.0"}
[& exprs]
jfacorro / ants.cljc
Last active May 13, 2020
Ant Simulation - Clojure on the BEAM
View ants.cljc
(ns ants.core)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2008 Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
jfacorro / clojerl.bat
Created Jun 18, 2019
View clojerl.bat
@echo off
erl -pa "%CD%/_build/default/lib/clojerl/ebin" -s clojerl_cli start -noshell +pc unicode -extra -r
jfacorro / example.core
Last active May 25, 2019
Example core file that doesn't load in OTP 22
View example.core
module 'example' ['f'/1,
attributes []
'f'/1 = fun (_1) ->
case <_1> of
<~{'foo':='foo'}~> when 'true' ->
jfacorro / vector_comparison.clj
Last active Jul 3, 2019
Clojure persistent vector implementation benchmark comparison
View vector_comparison.clj
(ns vector-comparison)
(defn compare-creation []
(doseq [n [0 100 1000 10000]]
(println "compare-creation with" n)
(let [coll (->erl (range n))
runs 10000]
(simple-benchmark [] (array/from_list coll) runs)
(simple-benchmark [] (clj_vector/new coll) runs))))
jfacorro / fn-predicate.clj
Last active May 19, 2019
Clojure on the BEAM: finding a fast and correct implementation for the fn? predicate
View fn-predicate.clj
(ns fn-pred)
(defn fn?-1
"Returns true if x is either a function"
{:added "1.0"}
[x] (erlang/is_function x))
(defn fn?-2
"Returns true if x is a function"
{:added "1.0"}
jfacorro /
Created Feb 12, 2018
Install PicoTTS in CentOS
# Installer for SVOX Pico TTS on non-Debian platforms
# Author: Steven Mirabito <>
# Check architechure
if [ $(uname -m) == 'x86_64' ]; then
View gist:7519d5013545930b98b04abbecd04526
find ./ -type f -name '*.wsp' -exec --nobackup {} 10s:6h 10min:180d 12h:2y \;
jfacorro / pattern_list.erl
Last active Mar 18, 2017
sys_core_fold generates invalid Core Erlang
View pattern_list.erl
Module =
jfacorro / loop-let.clj
Last active Mar 6, 2017
loop macro, wrapping let
View loop-let.clj
(require '[clojure.walk :as walk])
(walk/macroexpand-all '(loop [[x & xs] xs a 3]))
(let* [G__1249 xs
vec__1250 G__1249
x (clojure.core/nth vec__1250 0 nil)
xs (clojure.core/nthnext vec__1250 1)
a 3]
(loop* [G__1249 G__1249 a a]
(let* [vec__1251 G__1249