Skip to content

Instantly share code, notes, and snippets.

So, I was having a twitter discussion with the esteemed @alandipert and @swannodette that has gone beyond the scope of what can be effectively communicated in 140 characters.

It was on the perceived value of Clojure's new feature expressions and whether they are worth the complexity cost of adding to Clojure and all its dialects.

Alan's contention (and forgive me if I am misconstruing this, Alan) is that feature expressions make the Clojure reader considerably more complex, and so it becomes that much more difficult to write any software which reads Clojure code (except for Clojure's own reader, of course, where the work is already done). As best I understand Alan's argument, this is a significant enough effect to undermine or negate the value proposition of Feature Expressions all together.

I disagree, so I'd like to go through the pros and cons of each use case.

  • Application developers (single-platform codebase): No impact.
  • Application developers (multi-platform codebase): FX are strictly easier to u
(deftype MyCountable [delegate]
#+clj clojure.lang.Counted #+cljs ICounted
#+clj (count [_] (.count delegate))
#+cljs (-count [_] (-count delegate)))
@levand
levand / gist:5f89e5831c0f9e75b748
Created July 9, 2015 16:28
datomic repo profile example
;;profiles.clj
{:user {:repositories {"my.datomic.com" {:url "https://my.datomic.com/repo"
:username "luke@cognitect.com"
:password "MY SUPER SECRET PASSWORD"}}}}
### Keybase proof
I hereby claim:
* I am levand on github.
* I am vanderhart (https://keybase.io/vanderhart) on keybase.
* I have a public key whose fingerprint is 033A 1E51 4A22 2CC4 5C34 E6C2 F8E0 3980 F58B C1B7
To claim this, I am signing this object:
#my/str [
"The first line"
"The second line"
"The third line"
]
# all indexes are 0-based
2 def page_map(page, count, vidaas_count = 20)
3
4 start_idx = page * count
5
6 first_page = start_idx / vidaas_count
7 last_page = first_page + (count / vidaas_count)
8
9 start_offset = start_idx % vidaas_count
10 end_offset = start_idx + count
1 # all indexes are 0-based
2 def page_map(page, count, vidaas_count = 20)
3
4 start_idx = page * count
5
6 first_page = start_idx / vidaas_count
7 last_page = first_page + (count / vidaas_count)
8
9 start_subset = start_idx % vidaas_count
10 end_subset = start_subset + count
def page_map(page, count, vidaas_count = 20)
  start_idx = page * count
  first_page = start_idx / vidaas_count
  last_page = first_page + (count / vidaas_count)
  start_subset = start_idx % vidaas_count
  end_subset = start_subset + count
@levand
levand / asset-dsl.clj
Last active January 10, 2017 15:48
What style of asset/cljs DSL do you find more natural?
;; Both of these code samples do exactly the same thing: define an asset pipeline
;; with a ClojureScript build that reads from "src/cljs/*" and compiles to "out/*".
;;The question is, which style of DSL is more readable/natural?
(require '[arachne.assets.dsl :as a])
(require '[arachne.cljs.dsl :as cljs])
(def opts {:output-to "js/main.js"
:output-dir "js"
:asset-path "js"
@levand
levand / explicit-flow-dsl.clj
Last active January 10, 2017 19:36
Arachne asset DSL with the flow wired up as a separate form
(def opts {:output-to "main.js"
:asset-path "js"
:output-dir "js"
:optimizations :none
:main 'arachne.cljs.example})
(a/input-dir :test/input {:dir "src/cljs" :watch? false})
(cljs/build :test/build {:compiler-options opts})
(a/output-dir :test/output {:dir "out"})