This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-09
Channels
- # announcements (3)
- # babashka (1)
- # beginners (66)
- # clj-kondo (2)
- # cljdoc (46)
- # cljs-dev (7)
- # clojure (16)
- # clojure-australia (2)
- # clojure-china (1)
- # clojure-europe (3)
- # clojure-hk (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # clojurescript (4)
- # community-development (53)
- # conjure (6)
- # css (7)
- # cursive (6)
- # datascript (1)
- # datomic (5)
- # exercism (5)
- # graalvm (12)
- # helix (8)
- # jobs-rus (1)
- # kaocha (1)
- # lsp (19)
- # nrepl (1)
- # overtone (2)
- # pedestal (1)
- # polylith (2)
- # portal (2)
- # react (25)
- # reagent (1)
- # shadow-cljs (7)
- # spacemacs (8)
- # vim (9)
@porkostomus A similar problem to the original problem with spec being absent, I guess? Feature completeness vs. responsivity, as you mentioned
@magma.chambers what code is giving that error?
(ns anagram
(:require [clojure.string :as str]
[clojure.core.reducers :as r]))
(defn anagrams-for
"Filter `candidates` for valid anagrams of `word`."
[word candidates]
(let* [word (str/lower-case word)
sorted (sort word)]
(r/foldcat (r/filter #(= sorted (-> % str/lower-case sort))
(remove #{word} candidates)))))
I know that strictly speaking reducers are overkill here, and I could easily do it with a standard filterv
, but I like to use these exercises to learn the important clojure libs