|
|
|
|
|
by dzpower
2447 days ago
|
|
I feel similarly to Gene Kim about Racket. Here's a comparison ... Gene Kim's Clojure example: ; input is JSON string: "{foo: 2}"
(defn xform [s]
(-> (js/JSON.parse s)
js->clj
(update "foo" + 2)
clj->js
js/JSON.stringify))
Racket equivalent: #lang racket
(require threading json)
; input is (xform "{\"foo\" : 2 }")
(define (xform s)
(~> s
string->jsexpr
(hash-update 'foo (λ (x) (+ 2 x)))
jsexpr->string))
|
|