Skip to content

Instantly share code, notes, and snippets.

View hellerve's full-sized avatar

Veit Heller hellerve

View GitHub Profile
(defndynamic derive-special-internal2 [comb f ms]
(if (= (length ms) 0)
'(zero)
(if (= (length ms) 1)
(f (caar ms))
(list comb
(f (caar ms))
(derive-special-internal2 comb f (cdr ms))))))
(defndynamic derive-special-internal [comb f a]
@hellerve
hellerve / capitalize-string.carp
Last active January 19, 2020 15:13
Our solutions to the puzzles from the Clojure Berlin Meetup in January, in Carp
; as an introduction, we tried to do string capitalization by hand,
; using as many different interesting idioms as possible
(defn capitalize-char [c]
(if (Char.lower-case? c)
(=> c
(to-int)
(- 32)
(from-int))
c))
@hellerve
hellerve / client.carp
Last active February 12, 2020 16:04
A simple HTTP client
(load "[email protected]:carpentry-org/sockets@master")
(load "[email protected]:carpentry-org/http@master")
(load "https://veitheller.de/git/carpentry/[email protected]")
(defn read-all [sock s]
(let [read (Socket.read sock)]
(if (= &read "")
(Response.parse &s)
(let [acc (String.concat &[s read])]