Fork me on GitHub

Clojure folks here, you might enjoy this blog post I wrote here on Finger Trees: Although written in Haskell, but should be very easy to follow. In case you are not aware @chouser wrote an implementation of the same in Clojure.


@abhiroop Awesome work. Kudos to you. Would you care to comment on the differences with hitchhiker trees, which have recently also been implemented in Clojure (and which also sound awesome),


hey folks -- does anyone know why shelling out using might add a ton of execution time? I'm using Apple's textutil inside some clj in order to convert a rtf file to html, and then do some processing to the html inside my own code. But shelling out to textutil massively increases the execution time, even in an uberjar. And this is so even though running the same textutil command straight from the commandline is instant. Even this minimal test version exhibits the same behavior:

(ns test-shell.core
  (:require [ :refer [sh]])

(defn string-from-rtf [filename]
  (:out (sh "textutil" "-convert" "html" filename "-stdout")))

(defn -main
  (spit "foo.html" (string-from-rtf filename)))


like, that should not linger for what feels like a full minute. seriously


@gowder Does it also happen when you use date instead of textutil, for example?


@mobileink i guess that still count as a "derivative work" and you would need to adhere to the EPL. then again, if you "steal" 1% of core, it's a question of how much effort that part is really worth, but IANAL


@mobileink I'd argue. It comes down to what can actually be fought against, and how much money people are willing to put up on both sides.


How can I transform

[[a1 b1 c1] [a2 b2 c2] [a3 b3 c3]]
[[a1 a2 a3] [b1 b2 b3] [c1 c2 c3]]


@doglooksgood (apply map (cons vector '[[a1 b1 c1] [a2 b2 c2] [a3 b3 c3]]))


@urix that's what I want, thx!


(apply mapv vector '[[a1 b1 c1] [a2 b2 c2] [a3 b3 c3]])


@fossifoo , @johnnyillinois : I don’t mind the license bit, it’s the copyright bit that isn’t clear to me. Rich Hickey owns his code, but not mine. For reference:


;   Copyright (c) Rich Hickey. All rights reserved.
;   The use and distribution terms for this software are covered by the
;   Eclipse Public License 1.0 ()
;   which can be found in the file epl-v10.html at the root of this distribution.
;   By using this software in any fashion, you are agreeing to be bound by
;   the terms of this license.
;   You must not remove this notice, or any other, from this software.


What does “this notice” mean? Surely the licensing terms do not cover copyright?


I think something like `Portions Copyright (c) Rich Hickey” would be more accurate.


"this notice" is likely the text you just quoted. "this software" is for example the Clojure jar file.


ooooh thanks @mfikes that must be the problem


gowder: Yes, you can solve it by adding (shutdown-agents) at the end of your script (or when you know your process is otherwise finished).


magical! that indeed was the problem, and I've gone down from a minute to the 10 seconds it should take. thanks so much!


@mobileink look at how the murmur3 code is handled in Clojure. It's under a different copyright/license from the rest of the code.


All that said with the caveat IANAL and I speak for myself (not as a employee of Cognitect)


seems to be some similarities there though.


thanks, I'll take a look. fwiw i'm not looking to pull a fast one, my code is definitely derived from clojure source and EPLed. Just wondering about copyright, code ownership, and licensing. Haven't thought much about it previously, it prolly does take a lawyer.


hi guys, I’m running the follow code on my repl

(require '[clojure.core.async :as async])

(def ch (async/chan 1))

(defn caller [channel]
   (async/take! channel (fn [x] (str “some-” x)) true))

(async/put! ch “oli”)
(caller ch)
and according with the take! documentation, if the channel contains value, it will call the function (fn [x] (str “some-” x)) on the calling thread. what I was expecting when I called (caller ch) was the reuslt of (str “some-” x), but I got nil. do you guys know why , any clue ?


the take! docstring says "Returns nil"


show of hands: anybody else working on using in Clojure? I'm working on a Clojure language extension that supports webcomponents in idiomatic 100% Clojure. There are some tricky design decisions for which I could use some help.


fyi it will revolutionize web programming. 😉


I'm thinking specifically about shared styles which are exactly analogous to vars in a namespace. a perfect fit for clojure metaprogramming.



(:import [ bar baz])
or similar.


result being

<link rel="import" href="styles/foo.html">
<style is="custom-style" include="bar"></style>
<style is="custom-style" include="baz"></style>
In this case, bar and baz are "style modules" inside of styles/foo.html.


the design problem is that we also need to support regular html imports, where

(:import [ bar])
would mean
<link rel="import" href="styles/foo/bar">
In this case, bar is a file within the styles/foo directory. It's all just namespaces, but with different contexts.


really more of a design question than a clojure language question, but I don't see any other channel that is obviously more appropriate.


i suppose responses should probably go to #web .


@danielsz Thanks for pointing me towards hitchhiker trees. I was not aware of this project and I just read through its docs. Its ideas of modeling write and insertion as: storage to buffers associated with the B tree nodes and flushing it when necessary, seem somewhat similar(not exactly) to what Rich Hickey talks about datomic in here:;t=33m45s about an index merging process which seems to do something like a bulk write. Basically being lazy and deferring writes to the actual persistent index until necessary. Correct me if I am wrong, but what I understood is that Hitchhiker trees seem to be solving a pretty specific problem of making functional updates to fractal trees using path copying rather than straight mutation. Fractal trees themselves already seems read and write optimized(better than B+ trees) for database style requirements. Hitchhiker build on top of Fractal trees making it more functional. Finger Trees on the other hand tries to be as generic as possible and answer multiple types of queries(be it search or random access or priority queues) through a common abstraction i.e Monoids. I am pretty sure if we want to optimize a Hitchhiker Tree to answer 2 or 3 specific types of queries we can find Monoidal instances of those types of queries and model reads in Hitchhiker Trees through Finger Trees.


@abhiroop Thank you for these comments. They were very enlightening. And yes, it is my understanding as well that hitchhiker trees are a refinement of fractal trees in terms of functional data structures. The Strange Loop talk given by the author has been very educational for me. . I'm mainly on the consumer side, though, quite interested to use an open source implementation of a functional database in production, so the API on top of Redis which the author has made available got me all excited. It's not quite but almost there.