Skip to content

Instantly share code, notes, and snippets.

View lread's full-sized avatar

Lee Read lread

  • Ottawa, Ontario, Canada
View GitHub Profile
@wilkerlucio
wilkerlucio / natural-sort.clj
Last active June 24, 2024 03:53
Alphabetical/Natural sorting in Clojure/Clojurescript
(ns util.natural-sorting
(:refer-clojure :exclude [sort sort-by])
(:require [clojure.string]))
(defn parse-int [s]
#?(:clj (Long/parseLong s)
:cljs (js/parseInt s)))
(defn vector-compare [[value1 & rest1] [value2 & rest2]]
(let [result (compare value1 value2)]