Skip to content

Instantly share code, notes, and snippets.

@codecitizen
Created July 20, 2020 10:50
Show Gist options
  • Save codecitizen/533ea04c097ce0ed977aa4458b629fc6 to your computer and use it in GitHub Desktop.
Save codecitizen/533ea04c097ce0ed977aa4458b629fc6 to your computer and use it in GitHub Desktop.
PF.tv Issue 387 Challenge
(ns issue387
(:require [clojure.string :as s]))
(defn asterisks [word]
(apply str (repeat (.length word) "*")))
(defn clean-word [sample word]
(s/replace sample (re-pattern (str "(?i)" word)) (asterisks word)))
(defn clean [sample index]
(loop [s sample i index]
(if (empty? i)
s
(recur (clean-word s (first i)) (rest i)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment