Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A competition to solve a particular problem through the usage and manipulation of strings.
0
votes
Why was 6 afraid of 7?
Clojure, 71 bytes
Clojure is less-than-ideal for golfing due to its verbose nature - but nonetheless it's an interesting exercise:
Golfed version, using Java interop:
(defn f[s](let[x(.replaceAll s "6 …
0
votes
Don't google "google"
Clojure (43 bytes)
I know Clojure has been answered before, and shorter too, but I love the way this one generates a StackOverflow error when "google" is passed in:
(defn f[s](if(= s "google")(f s)( …
1
vote
Facey McFaceface
Clojure: 161 155
(use '[clojure.string :as s])
(defn f[t](s/join[(s/capitalize(cond(=(last t)\y)t :else(s/join[t "y"])))" Mc"(s/capitalize(s/replace t #"e*y$" ""))"face"]))
Ungolfed:
(defn facegen …
1
vote
Make me speak L33T
Clojure, 101 bytes
(defn l[s](clojure.string/replace s #"[BEISbeis]"{"B""8""b""8""E""3""e""3""I""1""i""1""S""5""s""5"}))
Try it online!
1
vote
Repeat every other character in string starting with second character
Clojure, 91 bytes
(defn d[s](apply str(map #(str(first %)(second %)(second %))(partition-all 2 2(into[]s)))))
Ungolfed version:
(defn dup-alternate-chars[s]
(apply str (map #(str (first %) (second …
1
vote
Sing Happy Birthday to your favourite programming language
Clojure (104 76 characters)
(let[h "Happy Birthday" t "to You\n"](print h t h t h "Dear Clojure\n" h t))
which prints
Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear Clojure
Hap …
1
vote
Do you want to code a snowman?
Clojure (407 402 bytes)
(defn a[s](let[[H N L R X Y T B](into[](map #(-(int %)49)(into[]s)))h([""" ___"" _"" ___"]H)i([" _===_"" ....."" /_\\"" (_*_)"]H)n([","".""_"" "]N)e[".""o""O""-"]l([" ""\\ …
0
votes
Randomly capitalize half of a string
clojure.string/upper-case))](if(<(count(re-seq #"[A-Z]" z))(/ l 2))(recur z)z)))
Un-golfed version:
(defn randomly-capitalize-half-of [s]
(let [v (vec s) ; convert string … as input
s2))) ; else return half-uppercased string …
2
votes
Alphabet Checksum
Clojure, 65 bytes
(defn a[s](char(+(mod(apply + (map #(- % 97)(map int s)))26)97)))
Try it online!
Ungolfed:
(defn alpha-checksum [s]
(char (+ (mod (apply + (map #(- % 97) (map int s))) 26) 97)))
…
1
vote
Count of "a"s and "b"s must be equal. Did you get it computer?
Clojure, 88 bytes
(defn a[s](let[g(re-find #"^(a+)(b+)$"s)](and(not(nil? g))(=(count(g 1))(count(g 2))))))
Ungolfed version:
(defn ab?[s]
(let [ groups (re-find #"^(a+)(b+)$" s) ]
(and (not …