Skip to content

Instantly share code, notes, and snippets.

@asherrecv
asherrecv / auto.clj
Last active October 4, 2023 14:40
Clojure autocompletion with bigrams
(require '[clojure.set :as set])
(defn bigrams-with-position [word]
(map (fn [a b i] [(str a b) i])
(seq word)
(seq (drop 1 word))
(range)))
(defn create-singleton-bigram-index [bigram position word]
{bigram {position #{word}}})