#clojure log - Jan 19 2016

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:00 mheld: hey y'all

0:01 I have a ring handler that spits out other ring handlers (liberator resources), thus requiring to be called twice on a request to get a response — is there a better way of doing this?

0:02 so I end up having to do something nasty like this -> (fn [x] ((user-handler x) x)) and it barfs if I try to go up the stack

1:45 amalloy: well, if it returns a ring handler it's not a ring handler itself, since those return responses

1:47 an easy solution would be to define a trampolining middleware, (defn tramp [handler] (fn [req] (let [x (handler req)] (if (fn? x) (x req) x)))), and then insert that at the appropriate place in your middleware stack

1:49 mheld: ^

2:08 kenrestivo: liberator is weird that way, IIRC

2:08 some keys in their map want handlers, some want results, and i think some want functions that return handlers (wrappers), it's been a few years

4:16 jonathanj: i think returning a static result is just convenience for (fn [ctx] (merge ctx {:my 'values}))

4:17 pretty sure everything can just be a function

4:17 however what the function does depends on which key it is, there are decisions, actions and handlers; it's all pretty well documented

4:18 it doesn't really make any sense for a decision function to return a ring response because the nature of the function asking a question like "is this resource available?"

4:19 my biggest wish for liberator (and ring) is handling async correctly

4:21 (or at all)

4:32 RedNifre: Hey there. I had a brief look at Clojure and wrote a tiny program in it. It seems nice but I'm not sure if I should dive in. Do you have a link to some examples of complex/brilliant/interesting/impressive/unusual things that you can do with Clojure? I might be looking for a unique selling point so to speak.

4:35 TEttinger: RedNifre: ohoho!

4:35 got any unusual problems you want tackled?

4:39 RedNifre: you around? I'm curious what the audience for this is

4:40 the seq abstraction is really good at making code cleaner

4:41 ,(map count [{:a 1, :b 2} [1 2 3] #{:red :green :blue :beige}])

4:41 clojurebot: (2 3 4)

4:41 jonathanj: i'm trying to remember the last time i found something brilliant or impressive in a language

4:42 i think it must have been Erlang

4:42 TEttinger: gave it three different kinds of collection and it could count all of them just fine

4:42 clojure tends to be very very short code

4:46 so as part of a "how short can you go" contest,

4:46 (let[a #(apply str(flatten %))p partition R rand-nth n #(a(R(mapcat p[1 2 3]%&)))v #(n"aioeu""iaaiaa")](a[(n"STKNYPKLGVZ""GlThShNyFtCh""ZvrCthShrMycTch")(for[_" "][(v)(n"lpstnkgxzv"(concat[(R '[h gl gr nd])(v)]"rnthggghtsltrkkhshng")"ghnlok")])]))

4:46 ,(let[a #(apply str(flatten %))p partition R rand-nth n #(a(R(mapcat p[1 2 3]%&)))v #(n"aioeu""iaaiaa")](a[(n"STKNYPKLGVZ""GlThShNyFtCh""ZvrCthShrMycTch")(for[_" "][(v)(n"lpstnkgxzv"(concat[(R '[h gl gr nd])1(v)]"rnthggghtsltrkkhshng")"ghnlok")])]))

4:46 clojurebot: "Kakol"

4:46 TEttinger: 250 character or less demonic name generator

4:50 schmir: TEttinger: that actually makes me want to run away from clojure

4:50 TEttinger: haha

4:50 it's heavily heavily obfuscated

4:51 RedNifre: Yes, I'm here, somewhat. Sorry.

4:51 TEttinger: cleaned up and long version: http://ideone.com/L0eHc6

4:51 the impressive thing is some of the shorter versions have about the same features

4:53 alex``: yeah that's pretty impressive, and the management of different sorts of types within the same function is nice too

4:53 TEttinger: it was a team effort

4:53 schmir: RedNifre: REPL based development is a unique selling point for me

4:53 TEttinger: yep

4:53 RedNifre: No, I don't have a particular problem in mind. But jonathanj mentioned Erlang, I find it impressive that it is geared towards reliability and it's interesting how actors are somewhat like OOP on top of FP. Or in Haskell I was impressed by how those hyper abstract concepts make your brain explode. Or in Kotlin I found the syntax rule "if the last parameter is a lambda you may close the paren before it" very neat because foo(x) {bla() } loo

4:53 ks nicer than foo(x, { bla() }) etc.

4:54 Don't all languages except Java have a REPL?

4:54 TEttinger: probably. clojure has a good one

4:54 others probably have good ones too

4:54 MasseR: RedNifre: no, not really no :)

4:55 alex``: lispies have good REPLs

4:55 MasseR: C, C++, Java, HaXe, etc

4:55 schmir: RedNifre: I've been doing python before, which has a REPL. but clojure's REPL is *much* better

4:55 TEttinger: clojure can call java about as easily as java can call java. with macros involved, it can be easier to call java from clojure than calling java from java

4:55 schaueho: schmir, to be fair, ipython isn't exactly bad

4:55 IMHO, of course

4:55 mpenet: it's more the advanced integration of the repl in every editor/IDE more than the repl itself

4:55 alex``: interop is a really nice feature for commercial purpose

4:56 TEttinger: sane names.

4:56 one of my favorites.

4:56 schaueho: and btw, there are REPLs for Java

4:56 TEttinger: "I want something like reduce but it doesn't throw away the intermediate values"

4:56 "reductions"

4:57 "it maps and then concats" "mapcat"

4:57 schmir: schaueho: ipython is fine. but I've used that mostly to explore 3rd party libraries. when you're trying to reload your own code, I've hit a wall pretty early in python.

4:57 MJB47: on the flip side: contains

4:57 TEttinger: "it finds the frequencies things appear in a collection" "frequences"

4:57 frequencies

4:57 RedNifre: Well, in Haskell you can create an infinite list of fibonacci numbers by zipping it with itself, which I find pretty wild: fibs = 1 : 1 : zipWith (+) fibs (tail fibs). Is there something like that in Clojure i.e. something that made you think "Huh, I didn't expect that could be done like that"?

4:58 TEttinger: ,(doc contains)

4:58 clojurebot: excusez-moi

4:58 TEttinger: ,(doc contains?)

4:58 clojurebot: "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."

4:58 schaueho: schmir, agreed, although reloading can be a pain in Clojure, too

4:58 TEttinger: RedNifre: you can do the same in clojure

4:59 alex``: RedNifre: i found a lot of stuff that surprising in clojure, even coming form lisps

4:59 RedNifre: Is it called mapcat everywhere or just for lists? E.g. I find it annoying that in Java, mapcat is called flatMap for Optionals and Streams, but it's called thenCompose on CompletableFuture.

4:59 alex``: lazy evaluation is really good, maybe haskell partialitation is easier, tho

5:02 RedNifre: alex`` do you have an example for something surprising?

5:03 Kneiva: ,(def cats (cons 'cat (lazy-seq cats)))

5:03 clojurebot: #'sandbox/cats

5:03 Kneiva: ,(take 20 cats)

5:03 clojurebot: (cat cat cat cat cat ...)

5:04 jonathanj: RedNifre: i don't think i could tell you anything about Clojure that doesn't apply to other lisps, but i really enjoy the (almost entirely) consistent syntax

5:04 being able to write (if) inside a function call is something i find quite convenient and totally foreign compared to languages where if is a statement

5:07 TEttinger: ,(defn fibs ([] (fibs [1 1]) ([so-far] (conj so-far (apply + (take-last 2 so-far))))

5:07 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

5:07 ridcully: well that fn(x) {...} bit on kotlin makes me even more believe, that it's just groovy in disguise

5:07 TEttinger: ,(defn fibs ([] (fibs [1 1])) ([so-far] (conj so-far (apply + (take-last 2 so-far)))))

5:07 clojurebot: #'sandbox/fibs

5:07 TEttinger: ,(iterate fibs)

5:07 clojurebot: #error {\n :cause "Wrong number of args (1) passed to: core/iterate"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (1) passed to: core/iterate"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 32]\n [sandbox$eval164 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$ev...

5:07 TEttinger: ,(iterate fibs [1 1])

5:07 clojurebot: ([1 1] [1 1 2] [1 1 2 3] [1 1 2 3 5] [1 1 2 3 5 ...] ...)

5:08 TEttinger: ,(nth (iterate fibs [1 1]) 20)

5:08 jonathanj: except isn't recursion without (recur) usually a mistake?

5:08 clojurebot: #error {\n :cause "Unable to resolve symbol: fibs in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: fibs in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: fibs in this co...

5:08 TEttinger: yes

5:08 it isn't iterating here

5:08 scottj: ,(do (def fibs' (lazy-cat [0 1] (map + fibs' (rest fibs')))) (take 10 fibs'))

5:08 clojurebot: (0 1 1 2 3 ...)

5:08 TEttinger: ah, lazy-cat

5:08 that's what I was looking for

5:08 mpenet: error messages could be nicer. It doesnt matter much once you get used to it, but a 300 line stacktrace isn't very welcoming to somebody trying it out

5:08 jonathanj: RedNifre: i think Clojure's pragmatism is kind of a hard sell to make but it's incredibly valuable

5:09 TEttinger: indeed

5:09 ridcully: mpenet: +1

5:09 TEttinger: there's lots of "make your life easier" tools

5:10 mpenet: personnally I dont mind the stacktraces, but for somebody with 1h clojure experience I doubt installing libs for better output is something reasonable

5:11 but I think I've hear it's something we might get sometime soon (whatever "soon" means heh)

5:11 jonathanj: mpenet: really? where did you hear that?

5:12 i've managed to become conversationally fluent in reading clojure stack traces but boy i would love for them to be better

5:12 mpenet: I think on twitter or slack

5:13 well, sometimes scrolling through 1km of noise from the compiler to get to 1 line is a tiny bit annoying

5:13 I guess having different output levels could make sense

5:14 if you work on core you might want the over chatty stacktraces

5:14 jonathanj: i don't really know if this is doable but reading stacktraces caused by async code is basically meaningless garbage

5:14 in other words, you get a stacktrace that occurs in exactly zero of your own code

5:15 it would be really nice to be able to tell where the call originated from, but that's possibly more of a JVM requirement than a Clojure compiler one

5:21 alex``: i prefer common lisp error reports more than java ones

5:22 unfortunately, clojure took the java ones

5:24 jonathanj: was that even a choice?

5:24 alex``: i guess not, the JVM has counterparts

5:29 jonathanj: ,(if-let [[x y] [0 nil]] :a :b)

5:29 clojurebot: :a

5:29 jonathanj: ,(if-let [[x y] nil] :a :b)

5:30 clojurebot: :b

5:30 lnostdal: with some overhead ("debug mode") i'm sure closures and stuff could have metadata needed for filename, line + col number etc. added to them

5:30 jvm or not doesn't matter i think

5:31 jonathanj: to be honest i'd be a bit hesitant about slapping "debug mode" on that kind of information

5:31 lnostdal: why?

5:31 clojurebot: why is the ram gone

5:31 jonathanj: having that information in a production environment would be just (if not more) useful

5:32 lnostdal: sure in some cases i guess, but that wasn't the point

8:07 visof: hi guys

8:07 is there anybody using archimedis?

9:56 is there a method which partition [1 2 3 4] to [[1 2] [2 3] [3 4]] ?

9:56 aurelian: partition

9:56 visof: ,(partition [1 2 3 4])

9:56 clojurebot: #error {\n :cause "Wrong number of args (1) passed to: core/partition"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (1) passed to: core/partition"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 32]\n [sandbox$eval25 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox...

9:57 visof: ,(partition 2 [1 2 3 4])

9:57 clojurebot: ((1 2) (3 4))

9:57 aurelian: partition with a twist :)

9:57 ridcully: ,(partition 2 1 [1 2 3 4])

9:57 clojurebot: ((1 2) (2 3) (3 4))

9:58 visof: ah thanks

9:59 aurelian: ,(doc partition)

9:59 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

10:30 dadinn: hi all

10:30 I am trying to use clojure.data.zip.xml

10:31 xml-> specifically

10:31 and it doesn't seem to work at all

10:31 I parsed html with crouton

10:32 turned it into zipper with clojure.zip/xml-zip

10:32 but xml-> returns nothing but empty lists

10:33 is this a known issue I missed?

11:02 csd_: I have a defrecord that is implementing an interface that only throws FooException. If I instantiate that record with a function that instead calls BarException, what happens?

11:10 juanjo_: hi

11:10 how can I add to leingen dependencies a path lo a local repo of a lib i'm trying to debug=

11:10 ?

11:14 mpenet: juanjo_: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies

11:20 juanjo_: thanks mpenet

11:58 dadinn: hi all

11:58 could anyone help with a bit of html parsing with zippers?

12:00 I specifically have issues with clojure.data.zip.xml/xml->

12:01 I have the following code:

12:01 (ns stuff

12:01 (:require [org.httpkit.client :as http]

12:01 [clojure.data.xml :as xml]

12:01 [crouton.html :as html]

12:01 [clojure.zip :as z]

12:01 [clojure.data.zip.xml :as zx]))

12:02 (def res2 (http/get "http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm"))

12:02 (def body2 (:body @res2))

12:02 (det xdat2 (html/parse-string body2))

12:02 (def zdat2 (z/xml-zip xdat2))

12:02 ridcully: whoa

12:02 could you please use some paste site?

12:02 dadinn: sorry

12:03 one last line:

12:03 (zx/xml1-> zdat2 :html :title zx/text)

12:03 this one is not returning what I would expect instead an () empty list

12:04 what I am doing wrong (besides pasting multiple line to the channel :))?

12:12 hi

12:13 trying again, would need some help with clojure.data.zip.xml: http://pastebin.com/D3UzTA2Y

12:13 can anyone help why its not returning the title of the html?

12:14 thanks

12:15 plz

12:17 luxbock: dadinn: maybe you are thinking that xml1-> works like ->, when based on the doc string it seems more analogous to cond-> ?

12:18 I haven't used clojure.data.zip.xml before so it's hard to say for me

12:18 dadinn: can I ask for some help with xml zippers?

12:19 luxbock: dadinn: do you know how zippers work in general?

12:20 dadinn: luxbock: yes I used zip-filter a year ago and it was working then only now it seems I am trying to do the same what then but it doesn't work

12:21 luxbock: this is the example code: http://pastebin.com/D3UzTA2Y

12:23 I would like to get the text of the title, I remember using xml-> or xml1-> before but it returns an empty list not what I would expect

12:25 I've been trying to figure what I am doing wrong for days but couldn't get it to work :(

12:26 luxbock: yeah I'm not sure, I've used zippers before but not with xml

12:26 dadinn: any ideas?

12:30 luxbock: dadinn: I'd just try to break down what you're doing into smaller and smaller parts while testing at the REPL where things go awry

12:31 dadinn: I'we used xml-> when it was part of contrib zip-filter and I've been using it to extract gigabytes of xml elements and in ETL kind of processing with xml-> parallelly and I am completely surprised why this is not working, what I am doing wrong

12:32 luxbock: dadinn: if you're using Emacs, the debugger that comes with Cider is pretty awesome

12:33 dadinn: luxbock: it doesn't really go awry only that xml-> returns empty list, and xml1-> nil

12:34 luxbock: by awry I meant find the point where your expectation deviates from what actually happens

12:34 dadinn: luxbock: the httpkit, crouton parser part works fine until xml->

12:37 luxbock: possibly I am using the xml-> wrong, but I don't know how else it should be used, it's according to the docs keywords should be transformed into tag= matchers, so it should be working...

12:37 luxbock: dadinn: so you need to zoom in, use the source

12:46 dadinn: lukbock: I understand, but if the source of clojure.data.zip needs to be modified for it to work then I would call it a bug... and it was working before... I came here hoping that the answer would be that I am doing something wrong instead :(

12:48 Kamuela: What is the rails of Clojure? Not necessarily the same design pattern, but certainly the relative popularity?

12:48 ecelis: Kamuela: for web development I have used luminus

12:49 mavbozo: luminus

12:50 MJB47: clojure typically likes to go with picking a choosing various libraries

12:50 compared to using a framework

12:50 luminous is the closest you have, but it is actually a collection of libraries and some documentation around them

12:50 it isnt a framework

12:50 ridcully: dadinn: leave out the :html

12:51 dadinn: or rather use :head instead of :html

12:52 mavbozo: MJB47, it's not a framework but a tasty omakase that yogthos creates

12:52 (inc yogthos) ;; i hope it works

12:52 ,(inc yogthos) ;; i hope it works this time

12:53 clojurebot: #error {\n :cause "Unable to resolve symbol: yogthos in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: yogthos in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: yogthos i...

12:53 dadinn: :ridcully thanks that was the problem indeed

12:53 justin_smith: mavbozo: inc is done by lazybot, who is on long term vacation

13:02 Kamuela: Thank you

13:08 sdegutis: Hi.

13:08 Good day.

13:08 I mean good day to all of you here.

13:16 mavbozo: sdegutis, good day to you too

13:17 sdegutis: Thanks :)

15:49 engblom: Thread/sleep seem to not be able to wake the thread up fast enough if one got really small values like (Thread/sleep 0.1). Is there any busy waiting alternative that would be faster?

15:50 amalloy: 0.1 is a pretty strange integer

15:50 justin_smith: engblom: with a value that low, aren't you dealing with the time slice of the OS itself?

15:50 that too

15:51 amalloy: anyway you can't ever expect timing stuff like that to be precise. at any moment your thread might be descheduled for whatever reason, maybe the user is rendering six video files at once and the OS decides your program is boring

15:52 so instead, ask *why* you want a sleep precision of a tenth of a millisecond, and then maybe find a solution that is possible to the real problem

15:52 justin_smith: there is (Thread/sleep 0 500000) which I think would do what that intends?

15:53 engblom: justin_smith: Where do you find documentation about Thread/sleep?

15:53 amalloy: it might, anyway. microsleep support depends on platform

15:53 $google javadoc thread

15:53 er

15:53 justin_smith: engblom: javadoc https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html

15:53 amalloy: someone restart that bot pls

15:54 justin_smith: engblom: one arg is long millis, two args is long millis followed by int nanos

15:54 engblom: Thanks!

15:54 justin_smith: but you still have to wrestle the OS for time slices that small if they need to be accurate

15:56 engblom: for linux kernel the smallest unit reliable would be 100ms if I read this right

15:56 http://stackoverflow.com/questions/16401294/how-to-know-linux-scheduler-time-slice

15:58 "Timeslice will be always between sysctl_sched_min_granularity and sysctl_sched_latency, which are defaults to 0.75 ms and 6 ms respectively and defined in kernel/sched/fair.c."

15:59 hiredman: a technique used sometimes to stall a thread for a small amount of time on the jvm is to busy loop for a small amount of time

16:00 that also isn't predictable because of the jit, and also because to cpus, that kind of code can end up looking like an idle run loop for the os so the cpu may go in to a lower power state

16:01 (amazing hear say)

16:07 nuttynutnut: what's a good way of removing all parts of a string that don't match a regex? i was trying something like this but keep getting "error: null" (filter #(re-matches #"\w" %) "Have a nice day.")

16:07 ,(filter #(re-matches #"\w" %) "Have a nice day.")

16:07 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.CharSequence>

16:08 nuttynutnut: oo lambabot gives a better error message than light table

16:08 still not sure what the problem is though

16:08 amalloy: what is a "part of a string"? "Have a" doesn't match the regex \w either

16:08 nuttynutnut: or if this is even the best way of doing this

16:09 hiredman: ,(seq "Have a nice day.")

16:09 clojurebot: (\H \a \v \e \space ...)

16:09 nuttynutnut: isn't \w [a-zA-Z0-9_]?

16:09 i just want all the letters, numbers, and spaces

16:09 amalloy: yes, and "Have a" is six characters

16:09 nuttynutnut: i dont get it

16:10 amalloy: so you want (re-seq #"\w" "Have a nice day")

16:10 nuttynutnut: oh

16:10 ,(re-seq #"\w" "Have a nice day")

16:10 clojurebot: ("H" "a" "v" "e" "a" ...)

16:10 nuttynutnut: o

16:10 i still need the spaces

16:10 where did the space go

16:12 matthavener: \w doesn't match spaces

16:12 ,(re-seq #"." "Have a nice day")

16:12 clojurebot: ("H" "a" "v" "e" " " ...)

16:12 pbx: ,(re-seq #"[\w ]" "have a nice")

16:12 clojurebot: ("h" "a" "v" "e" " " ...)

16:13 hiredman: ,*clojure-version*

16:14 clojurebot: {:major 1, :minor 8, :incremental 0, :qualifier nil}

16:14 amalloy: did 1.8 just come out?

16:15 nuttynutnut: \w doesnt match spaces?

16:15 hiredman: amalloy: yep

16:15 nuttynutnut: "\w stands for "word character". It always matches the ASCII characters [A-Za-z0-9_]"

16:15 lokien_: amalloy: clojure 1.8?

16:15 nuttynutnut: am i missing something or is java's regex different

16:15 amalloy: nuttynutnut: are you aware of what character _ is?

16:15 nuttynutnut: oooooo

16:15 lol

16:15 got it

16:15 lokien_: and new site! my god, so excited

16:16 amalloy: the site certainly looks a lot nicer

16:16 lokien_: and looks good on mobile too

16:17 but.. where is j-pb?

16:29 hiredman: https://vimeo.com/65102395 is a really neat doug lea talk that touches on how long it takes to just wake up a thread, and some different idling approaches

16:32 momerath: i have what amounts to a style question: I have some types and compound types, which need to be 'serialized' to basic edn, throwing away some information in the process, which I don't need for my current purposes (shipping out to a visualization in clojurescript). The types already implement toString to output compact human readable forms, which in some cases elide the bulk of the data. Is there

16:32 some other existing interface that would be idiomatic? Some library? Just a term other than 'serialize' that's less misleading?

16:37 amalloy: it's a bit like marshaling, or encoding

16:43 engblom: How soon is leiningen usually catching up with the newest release of Clojure?

16:43 hiredman: in what context?

16:44 projects that build using lein specify which clojure version they want to use

16:44 amalloy: 0.1 milliseconds after a clojure version is released, you can use it with lein

16:45 hiredman: well, as soon as it is up in a maven repo

16:45 amalloy: i'm choosing to call that the release

16:45 really i just wanted a cheap 0.1ms joke for engblom

16:46 engblom: :)

17:09 Kamuela: What construct is identified like #’thing-here

17:09 rhg135: var

17:09 hiredman: it is #'

17:09 amalloy: ,#'x

17:09 er

17:09 clojurebot: #error {\n :cause "Unable to resolve var: x in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve var: x in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6875]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve var: x in this context"\n :at ...

17:09 amalloy: ,'#'x

17:09 clojurebot: (var x)

17:09 rhg135: #,+

17:10 ,#+

17:10 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

17:10 rhg135: uh, I can't type

17:10 hiredman: #’ (hash followed by, what I think is the unicode prime mark) isn't anything

17:11 #' is var quote, and #' followed by the name of a var, is the var

17:11 ,#'+

17:11 clojurebot: #'clojure.core/+

17:11 hiredman: ,(deref #'+)

17:11 clojurebot: #object[clojure.core$_PLUS_ 0x74070ee9 "clojure.core$_PLUS_@74070ee9"]

17:11 hiredman: ,+

17:11 clojurebot: #object[clojure.core$_PLUS_ 0x74070ee9 "clojure.core$_PLUS_@74070ee9"]

17:14 hiredman: and the difference between (var +) and #'+ is one is a list that needs to be evaluated to get a var, and the other is a var

17:16 Kamuela: so is it a reference to this var?

17:16 amalloy: hiredman: i'm not so sure about this last one. they're both a list that needs to be evaluated

17:16 #'+, unevaluated, is just turned by the reader into (var +)

17:17 ,(= '(var +) '#'+)

17:17 clojurebot: true

17:18 hiredman: amalloy: huh, and there is commented out code for it that does return the var

17:18 which was commented out in 2009, so I am just wrong and I don't know why

17:39 Kamuela: Ok thank you

17:39 Finally separated out routes to different files in luminus

17:42 I’m wondering if my development setup is correct, does changing code require a rebuild?

17:51 justin_smith: Kamuela: depends, do you have anything that auto-loads changed code?

17:52 Kamuela: justin_smith: what do you mean? basically I’m running luminus with lein within nightcode

17:54 justin_smith: Kamuela: I mean there is nothing inherent about a standard setup that would auto reload anything

17:55 Kamuela: that’s what I figured, so basically a rebuild is what’s required

17:56 justin_smith: Kamuela: well, depends what you mean by "rebuild" - at the very least it requires reloading your changed namespaces, it could require restarting the server or ensuring that you use a var rather than just a function as your handler

17:59 Kamuela: well, right now I am clicking “stop” and “run” which I admit, i’m not totally sure what it’s doing. i do know that a stop/run procedure is needed when I change code and it seems to take a very long time to start up again

18:00 so I figured I may just be doing something inefficiently

18:01 justin_smith: yeah, stop and run is going to be the slowest thing, if you make sure your handler is a var and not function (eg (start-web-server #'handler) rather than (start-web-server handler)) then reloading the apropriate namespaces will suffice, and is much faster

18:11 sdegutis: Someone wanna change the topic?

18:11 Clojure 1.8 is out.

18:12 I forgot alex's IRC nick.

18:12 justin_smith: sdegutis: it's not on maven yet?

18:12 sdegutis: http://search.maven.org/#artifactdetails%7Corg.clojure%7Cclojure%7C1.8.0%7Cjar

18:12 ping puredanger

18:13 I hope this translates into CIDER!

18:13 I mean, I hope CIDER gets slimmer, or something.

18:14 justin_smith: cidr

18:15 sdegutis: haha

18:15 cidr.io

18:16 justin_smith: sdegutis: odd, 1.8.0 still not showing up here http://mvnrepository.com/artifact/org.clojure/clojure

18:16 sdegutis: Hmm.

18:17 puredanger: That stuff gets added by some batch system - usually takes a day or two

18:17 amalloy: that's an indexer

18:18 rhg135: cool

18:20 amalloy: quote now throws if passed more or less than one arg - dang, that's an old bug to finally fix

18:21 justin_smith: :message java.lang.NoClassDefFoundError: IllegalName: compile__stub.clj_http.headers.clj-http.headers/HeaderMap, compiling:(clj_http/headers.clj:105:1)

18:21 interesting

18:23 amalloy: looks like some pretty good stuff in 1.8

18:23 http://dev.clojure.org/jira/browse/CLJ-1208 was a common cause of confusion

18:24 justin_smith: hmm, the namespace getting that error uses potemkin

18:25 ashnur: can someone please tell me in a few words what is the relationship between edn, transit, datascript ?

18:26 sdegutis: ashnur: edn and transit are json alternatives, datascript is an in-browser datomic-like thing

18:26 also datomic uses both edn and transit iirc

18:26 ashnur: datascript is a database?

18:26 holy shit

18:26 it writes on the github page

18:26 justin_smith: regarding the above error with clj-http when using 1.8.0, updating to a newer clj-http fixed it

18:26 ashnur: but somehow i missed it

18:27 sdegutis: "Immutable database and Datalog query engine for Clojure, ClojureScript and JS"

18:27 first few words

18:27 :D

18:27 ashnur: yeah :( sorry

18:28 sdegutis: I'm excited to figure out how Clojure 1.8 can help us!

18:42 puredanger: ashnur: I wrote some stuff about transit and edn (and fressian) at https://groups.google.com/d/msg/clojure/9ESqyT6G5nU/2Ne9X6JBUh8J if you're interested

18:43 ashnur: reading it, thanks

19:12 puredanger, thanks, that was exactly what i needed to orient myself :)

19:19 leavesofgrass: if I have a ref foo and add a watch to it that updates another ref bar, will it do it in a transaction if I change foo in a dosync block?

19:26 justin_smith: leavesofgrass: I was curious so I tried it. the watcher is not run inside the transaction. https://gist.github.com/noisesmith/653e2280be728ab3909f

19:31 leavesofgrass: justin_smith cool, thanks

19:31 (i could/should have tried it though, lol)

19:32 was afraid of it maybe not giving me an exception but not running in a transaction at the same time, which I now realize doesn't make sense

19:34 justin_smith: leavesofgrass: of course I would only have shared the example if it proved one way or another that it was/wasn't in a transaction

19:36 leavesofgrass: I know, thanks a lot

20:18 jarjar_p_: (wave)

20:18 I'm trying to enable compiler options in my project file

20:18 "Can't change/establish root binding of: *compiler-options* with set" and getting this error

Logging service provided by n01se.net