Skip to content

Instantly share code, notes, and snippets.

View PEZ's full-sized avatar
🎯
Focusing

Peter Strömberg PEZ

🎯
Focusing
View GitHub Profile
@PEZ
PEZ / rich4clojure_easy_problem_034.clj
Last active April 25, 2024 15:57
Implement range – Rich 4Clojure Problem 34 – See: https://github.com/PEZ/rich4clojure
(ns rich4clojure.easy.problem-034
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Implement range =
;; By 4Clojure user: dbyrne
;; Difficulty: Easy
;; Tags: [seqs core-functions]
;;
;; Write a function which creates a list of all integers
;; in a given range.
@PEZ
PEZ / rich4clojure_easy_problem_032.clj
Last active April 25, 2024 15:55
Duplicate a Sequence – Rich 4Clojure Problem 32 – See: https://github.com/PEZ/rich4clojure
(ns rich4clojure.easy.problem-032
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Duplicate a Sequence =
;; By 4Clojure user: dbyrne
;; Difficulty: Easy
;; Tags: [seqs]
;;
;; Write a function which duplicates each element of a
;; sequence.
@PEZ
PEZ / rich4clojure_elementary_problem_156.clj
Last active March 30, 2024 17:01
Map Defaults – Rich 4Clojure Problem 156 – See: https://github.com/PEZ/rich4clojure
(ns rich4clojure.elementary.problem-156
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Map Defaults =
;; By 4Clojure user: jaycfields
;; Difficulty: Elementary
;; Tags: [seqs]
;;
;; When retrieving values from a map, you can specify
;; default values in case the key is not found:
@PEZ
PEZ / dumdom_defcomponent_macro.clj
Created February 18, 2024 09:37
A workaround to make default linting resolve `dumdom.core/defcomponent` without complaints.
(ns my-dumdom.macros
(:require [dumdom.core :as dumdom]))
(defn- extract-docstr
[[docstr? & forms]]
(if (string? docstr?)
[docstr? forms]
["" (cons docstr? forms)]))
(defn- extract-opts
@PEZ
PEZ / config.edn
Created February 18, 2024 08:06
A clj-kondo hook for Dumdom components `.clj-kondo/hooks/dumdom.clj`
{:linters {:dumdom/component-options {:level :warning}}
:hooks {:analyze-call {dumdom.core/defcomponent hooks.dumdom/defcomponent}}}
@PEZ
PEZ / rich4clojure_easy_problem_021.clj
Last active January 10, 2024 09:00
Nth Element – Rich 4Clojure Problem 21 – See: https://github.com/PEZ/rich4clojure
(ns rich4clojure.easy.problem-021
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Nth Element =
;; By 4Clojure user: dbyrne
;; Difficulty: Easy
;; Tags: [seqs core-functions]
;;
;; Write a function which returns the Nth element from a
;; sequence.
@PEZ
PEZ / rich4clojure_easy_problem_022.clj
Last active December 30, 2023 03:37
Count a Sequence – Rich 4Clojure Problem 22 – See: https://github.com/PEZ/rich4clojure
(ns rich4clojure.easy.problem-022
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Count a Sequence =
;; By 4Clojure user: dbyrne
;; Difficulty: Easy
;; Tags: [seqs core-functions]
;;
;; Write a function which returns the total number of
;; elements in a sequence.
@PEZ
PEZ / rich4clojure_easy_problem_020.clj
Last active December 29, 2023 22:38
Penultimate Element – Rich 4Clojure Problem 20 – See: https://github.com/PEZ/rich4clojure
(ns rich4clojure.easy.problem-020
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Penultimate Element =
;; By 4Clojure user: dbyrne
;; Difficulty: Easy
;; Tags: [seqs]
;;
;; Write a function which returns the second to last
;; element from a sequence.
@PEZ
PEZ / rich4clojure_easy_problem_061.clj
Last active December 7, 2023 07:41
Map Construction – Rich 4Clojure Problem 61 – See: https://github.com/PEZ/rich4clojure
(ns rich4clojure.easy.problem-061
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Map Construction =
;; By 4Clojure user: dbyrne
;; Difficulty: Easy
;; Tags: [core-functions]
;;
;; Write a function which takes a vector of keys and a
;; vector of values and constructs a map from them.
@PEZ
PEZ / rich4clojure_easy_problem_040.clj
Last active November 28, 2023 16:09
Interpose a Seq – Rich 4Clojure Problem 40 – See: https://github.com/PEZ/rich4clojure
(ns rich4clojure.easy.problem-040
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Interpose a Seq =
;; By 4Clojure user: dbyrne
;; Difficulty: Easy
;; Tags: [seqs core-functions]
;;
;; Write a function which separates the items of a
;; sequence by an arbitrary value.