Skip to main content
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
Results tagged with
Search options not deleted user 73954

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

0 votes

My device malfunctions... Abuse its undefined string behaviour!

Clojure v1.8, 63 62 58 bytes #(map(fn[l](dotimes[i %2](prn(apply str(repeat %2 l)))))%) Try it online! Explanation (map ... s) For every letter of the string 's' (dotimes[i %2] ...) Do 'n …
Chris's user avatar
  • 31
1 vote

Let's converge to 9!

Clojure v1.8, 124 113 112 bytes 0-indexed (fn[n](loop[a n k 0](if(= a 9)k(recur(if(even? a)(+(/ a 2)1)(apply +(map #(-(int %)48)(str(* a a)))))(inc k))))) Try it online! Explanation (loop[a n k 0](if …
Chris's user avatar
  • 31
0 votes

Matrix in Range

Clojure v1.8, 97 bytes #(conj(mapv(fn[i](conj(vec(range i(+ % i)))(* 2 %)))(range 1(inc %)))(vec(repeat(inc %)(* 2 %)))) Try it online! Explanation (range 1(inc %)) Numb …
Chris's user avatar
  • 31
1 vote

Make an alphabet searchlight!

Clojure v1.8, 93 bytes Converted Renzo's answer to Clojure. (dotimes[i 26](prn(apply str(concat(repeat(- 25 i)" ")(subs"ZYXWVUTSRQPONMLKJIHGFEDCBA"i))))) Explanation (dotimes [i 26] ...) …
Chris's user avatar
  • 31
1 vote

Sum the rows of the concatenated triangle

Clojure v1.8, 154 bytes 1-indexed (fn[n](loop[i 1 s(clojure.string/join""(take(* n n)(iterate inc 1)))](if(= i n)(apply +(map #(Character/digit % 10)(take n s)))(recur(inc i)(subs s i))))) Try it …
Chris's user avatar
  • 31