#clojure log - Oct 02 2012

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

0:49 Frozenlock: Oh wow. Going back to seesaw after a couple months of clojurescript... NOW I understand the CSS-style selectors!

1:23 jasonleaf: hi, has seq-utils in clojure contribute been deprecated in 1.4?

1:23 xeqi: ~contrib

1:23 clojurebot: Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

1:27 jasonleaf: thanks, but seq-utils is not among the modules listed in the page

2:55 mpan: I seem to misunderstand here, but: how do I get back the whole tree (no zip metadata) from a zipper?

2:55 zip/node doesn't seem to do what I thought

2:56 Sgeo: How easy/difficult would it be to add my own protocol to Aleph?

2:56 Erm, well, make a library that allows Aleph to use my protocol

2:57 mpan: wait, does zip/root return the tree at the root or a zipper wrapping the tree at the root?

3:00 gtuckerkellogg: Something is clearly wrong here, but I am feeling foolishly stumped. https://www.refheap.com/paste/5426

3:02 amalloy: gtuckerkellogg: you're not using the same (rand) for each test

3:07 gtuckerkellogg: amalloy: but I'm not within each call to weighted-idx, either

3:07 mpan: in case anyone else was wondering, my main issue was a logic error, but, to clarify: root returns a bare tree (loses the zipper wrapper) and node returns a bare node (same)

3:08 gtuckerkellogg: (map (fn [x] (codachrom.core/weighted-idx [1 1 1])) (range 300)) should 300 weighted draws of the index

3:08 er, "give" 300 weighted draws

3:09 mpan: wondering for future reference, though: how do you get the zipper at the root from a zipper short of constructing a new one?

3:09 gtuckerkellogg: but yet, you are right. If i move the rand to the let bindings, it behaves as it should

3:23 Sgeo: With Ring, would it make sense to return a body that's an InputStream and make an input stream such that reading from it blocks until I have some data

3:23 ?

3:27 wingy: jezz light table is the shit

3:27 cloud9ide moved the ide to the cloud .. light table creates a whole new dev env

3:33 amalloy: btw gtuckerkellogg, i think your definition of cprobs is just (reductions + probs)

3:33 &(let [probs [1/4 1/2 1/4]] (reductions + probs))

3:33 lazybot: ⇒ (1/4 3/4 1N)

3:34 gtuckerkellogg: oohhh, I hadn't seen reductions before

3:34 thanks amalloy

3:35 * gtuckerkellogg still doesn't understand why moving the (rand) inside the let bindings makes such a difference

3:35 amalloy: gtuckerkellogg: because that's implementing a sensible algorithm instead of a nonsense one

3:36 you don't say "pick a number. was it less than 1/4? okay, now pick another number. is it less than 3/4?"

3:36 you pick a single number and step through the pdf

3:37 * gtuckerkellogg slaps himself

3:37 amalloy: i had an implementation of this around somewhere, but i can't find it anymore

3:53 Amaryl: Hi! I can't really understand how "apply" works... They give this example in "Clojure Programming": (apply hash-map [:a 5 :b 6]) ;= {:a 5, :b 6} Does this mean that apply does some sort of "concat" with results?

3:57 Sgeo: ,(hash-map :a 5 :b 6)

3:57 clojurebot: {:a 5, :b 6}

3:57 Sgeo: apply is basically a way of taking a concrete list, and expanding it out into arguments to be given to a function

3:58 ,(letfn [(f [a b c] {:a a :b b :c c})] (f 1 2 3))

3:58 clojurebot: {:a 1, :b 2, :c 3}

3:58 Sgeo: ,(letfn [(f [a b c] {:a a :b b :c c})] (apply f [1 2 3]))

3:58 clojurebot: {:a 1, :b 2, :c 3}

4:01 wingy: isnt this outdated info http://www.brainonfire.net/files/seqs-and-colls/main.html

4:01 a string should be a coll?

4:01 amalloy: wingy: it's an article about clojure, on the web. odds are, yes it's outdated

4:01 Sgeo: ,(coll? "Hello")

4:01 clojurebot: false

4:02 amalloy: but that table looks good to me

4:02 and unlikely to change anytime soon

4:02 i think TimMc wrote that one?

4:02 wingy: ok

4:09 Amaryl: haa ok Sgeo ! I didn't realized that "hash-map" was basically variadic! I just read about "map" and "reduce", and I was expecting something more complicated with "apply"... :)

4:14 mpan: how can I use clojure.zip zippers to splice subtrees together?

4:14 the particular operation I'm trying to do is swap two subtrees of different trees

4:15 I want to use replace, I think? but where do I get just the subtree from the other side?

4:19 Sgeo: Is Redis a good idea if I'm mostly just interested in the pub/sub stuff?

4:21 mpenet: Depends on your requirements, but yes, it is quite good at that. Easy to use, easy to setup/maintain

4:21 kral: namaste

4:21 mpenet: Sgeo: also check 0mq

4:22 kral: 0mq is really nice

4:22 Sgeo: Um

4:22 This looks like it might be a bit overkill

4:22 Then again, Redis probably is too

4:26 mpan: hm, there's clojure.zip/remove, but I kind of need the opposite of that

4:39 in case anyone was wondering about the same thing about the zippers: I can't find any mention of this explicitly documented, but it seems (??) that the first elem in a zipper is the subtree at its current location (can anyone confirm this is generally true?)

4:49 Sgeo: Hmm, is http://www.clojure-toolbox.com/ old?

4:50 mpenet: yes

4:51 AustinYun: hm, the lein-ring auto-refresh the browser window feature thingy isn't working; probably XMonad's fault though

4:51 weavejester: AustinYun: It's unlikely to be the fault of your window manager… what version of Ring/Lein-Ring are you using?

5:05 AustinYun: ring 1.1.6, lein-ring 0.7.5

5:05 seriously though, weird stuff like that seems to happen because of XMonad

5:05 weavejester: AustinYun: Really? All wrap-refresh does is inject some JS into the page

5:06 AustinYun: The content-type needs to be text/html though.

5:06 AustinYun: And the page needs a <head> element

5:06 AustinYun: ok, that's probably it then

6:31 wingy: simple, not easy!

7:23 mindbender1: what's the poor man's alternative to domina

7:25 mpenet: jayq and related libs is a good alternative

7:25 are*

7:25 if you know jquery the learning curve is almost non existant

7:27 mindbender1: mpenet: i really don't that's why I have been on the run.. but thanks for mentioning it

7:30 wingy: how do you add doctype using hiccup?

7:35 i should probably use noir instead of compojure directly

7:36 weavejester: wingy: There are functions in hiccup.page for adding doctypes

7:37 mpenet: wingy: the html* functions add it for you also

7:38 well same thing :) just realized they are in hiccup.page

7:38 wingy: ok

7:38 (:use hiccup.page)

7:39 (GET "/" [] (html5 layout))

7:39 seems to work

7:39 thx

7:45 having a layout wrapping a body was simple as i imagined

7:45 (GET "/" [] (html5 layout body))

7:45 no need for middleware

8:51 pandeiro: how can i create and define a var in in ns bar from ns foo?

8:51 ,(doc intern)

8:51 clojurebot: "([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var."

8:53 cemerick: pandeiro: might want to look at the immigrate utility from contrib

8:54 crude, but does the job. Could extract out a more subtle operation.

8:56 TimMc: wingy: A string is seq-able, but isn't itself a collection.

8:57 and that table is automatically generated using Clojure 1.3.

8:58 pandeiro: cemerick: i'm just writing a app.repl ns to automate all the junk i have to do when i need to re-launch, intern seems fine for that purpose, but i will bookmark immigrate, thanks

8:59 cemerick: btw still yet to debug why my mail attachment inputstreams won't work with clutch/put-attachment

8:59 wingy: TimMc: i c

8:59 TimMc: does seq? means seqable or sequence?

9:01 gfredericks: ,(seq? [])

9:01 clojurebot: false

9:01 gfredericks: it means something that implements the ISeq interface I believe

9:01 wingy: but does one say its then a sequence or a seqable

9:02 gfredericks: I don't know if the word "sequence" is very strictly defined around here

9:03 a vector is not a seq, but it is seqable and is also sequential

9:04 pandeiro: cemerick: i was poking around clutch too and looking at lazy-view-seq to try to understand how that works... am i right that it 'slurps' the entire view (per query parameters) into memory first, then turns it into a lazy-seq? so it uses heap space as if it were greedy?

9:04 wingy: then seq? has to mean sequence?

9:04 since vector is returning false

9:04 cemerick: pandeiro: it shouldn't, no

9:05 pandeiro: cemerick: ok let me go back and try to understand it better

9:05 cemerick: if it does, it's a bug

9:06 wingy: how does one have a attribute with no value in hiccup

9:06 pandeiro: just to be clear, eg i have a million doc db, i call all-documents, those docs are not in memory from that moment?

9:06 wingy: [:a {:href "/account_types" :data-prefetch} did give me an error Map literal must contain an even number of forms

9:07 pandeiro: b/c i was imagining you would need some clever (and magic) use of 'limit=' under the covers to do what lazy-view-seq does

9:07 gfredericks: why does lein keep running to the internet every other day when I haven't changed my project.clj?

9:07 pandeiro: gfredericks: boredom?

9:08 gfredericks: it is frustrating behavior when on a slow internet connection

9:08 cemerick: gfredericks: you have SNAPSHOT dependencies (direct or transitively)

9:08 You can run lein in offline mode to avoid such checks.

9:08 In theory, anyway? :-P

9:09 gfredericks: cemerick: ah that's probably true; thanks

9:09 wingy: [:a {:href "/account_types" :data-prefetch true} worked

9:11 cemerick: pandeiro: `changes` uses lazy-view-seq; otherwise, you need to use lazy-view-seq explicitly

9:11 pandeiro: cemerick: ahhh

9:11 cemerick: oh, hah, I should read my own lib's code

9:11 pandeiro: hadn't realized that

9:12 cemerick: Nevermind, all views are lazy, and lazy-view-seq is used implicitly all the time :-P

9:12 There's no slurping going on

9:12 Notice the use of read-lines

9:14 pandeiro: cemerick: ah right so it gets the inputstream

9:15 cemerick: so there's not as much need to use limit= with large datasets, since clutch is doing that, would you agree?

9:15 cemerick: pandeiro: I wouldn't say that. Who knows what optimizations are being done server-side for small- or large-limit GETs

9:16 pandeiro: ok i see

9:16 gfredericks: lein deps :tree shows no snapshots, though my project was itself a snapshot

9:16 cemerick: that may be enough…?

9:17 gfredericks: okeedokes

9:20 wingy: im trying to make a template with dynamic vars

9:20 https://www.refheap.com/paste/5429

9:20 i want the title to be "The best app" but it shows "App" which is the root binding

9:20 what have i done wrong?

9:21 gfredericks: wingy: layout is only defined once

9:21 you'd have to make it a function that you call each time

9:21 wingy: okay

9:22 gfredericks: wohoo thx

9:25 gfredericks: ~woohoo

9:25 clojurebot: Huh?

9:25 wingy: gfredericks: but isn't that going against FP? perhaps I want to pass the locals to the layout function instead?

9:25 than having it relying on global variables

9:25 gfredericks: wingy: sure, dynamic variables are not a pure-functional technique

9:25 clojurebot: Cool story bro.

9:26 wingy: ok

9:26 gfredericks: we have them for convenience because clojure is not haskell; use with care

9:26 wingy: cool

9:26 simpler to test if functions are pure

9:26 gfredericks: absolutely

9:29 error handling in cljs: can I throw and catch arbitrary objects (like maps)?

9:33 I think so

9:38 Cheiron: hi, for a clojure project created with lein. how to know that lib.jar is needed by dependency y ? the lib folder is full of tens of jars and not sure how to check

9:39 gfredericks: Cheiron: with lein 2 you can `lein deps :tree`

9:40 otherwise if you have maven installed you can `lein pom && mvn dependency:tree`

9:40 deps :tree might work with lein 1 as well; worth a try

9:40 I didn't quite understand your question so I hope that answers it

9:41 casion: anyone here used ocaml extensively? I'm curious what a clojure user thinks of ocaml

9:42 Cheiron: gfredericks: i'm getting SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8] and need to know why

9:43 * Sgeo is wondering if Clojure would be a terrible choice of language for Senior Project

9:43 gfredericks: Cheiron: well the dependency tree should help that

9:43 Sgeo: (Working in a group, I'm Lead Builder but others are expected to contribute)

9:43 casion: Sgeo: I know 3 other people here doing similar

9:43 gfredericks: Sgeo: but they won't end up contributing so it doesn't matter

9:43 casion: one of which is doing it in a group for a java class

9:45 Sgeo: hmm

9:47 TimMc: Sgeo: Do any of the others know Clojure? How about Java?

9:48 and other FP langs?

9:48 Sgeo: None of the others know Clojure. They probably know Java, but I haven't asked. I don't think they know other FP languages, but haven't asked. Wait, does Javascript count as an FP language, because if so, then probably.

9:53 unic0rn: i guess it mostly depends on what kind of programmers they are. clojure isn't that complicated after all. knowing java api helps though.

9:54 Cheiron: i'm having slf4j error because many libs are using different logging libs, what should i do? :/

9:54 wingy: simple, not easy!

9:54 not node.js!

9:54 clojure!

9:55 whats funny is where i needed libs i need only clojure now

9:57 kyptin: Hey folks, I'm having trouble with the *file* binding. Seems to work when I run a file (using "lein exec") but not when I run a test (with "lein test"). Has anybody had issues with this before?

9:58 I'm having a devil of a time searching the web about this because I can't get Google to match literal asterisks.

10:01 wingy: how do i tell hiccup to not compress the output?

10:01 kyptin: Alternatively, is there a way to access the project's root directory from within code?

10:02 (Or can I depend on the working directory always being the project's root?)

10:03 chouser: kyptin: *file* is probably only set to something useful during compile time

10:05 hm, and you want the project's root? Will this only ever be run by lein in the source directory, or do you want the path to your project's jar when it's being used as a lib?

10:06 kyptin: chouser: Thanks for your help. I'm currently only using this with lein, but I may want to do a jar later. Something that works for lein only would still be helpful for now, though.

10:06 pandeiro: why can my repl get (source io/file) but (io/as-file) returns Source not found ?

10:07 (source io/as-file) that is

10:07 kyptin: chouser: I may be missing something, but I think I'm OK with *file* only being set during compile time--but wouldn't that mean I should get some value for *file*, instead of just "NO_SOURCE_PATH"?

10:07 chouser: well, lein run will cd to your project's root, so you could use cwd for that. not sure what to do in the jar case.

10:07 kyptin: OK, well, that's good to know that that should be a dependable feature. Thanks!

10:08 chouser: I'm not actually sure it's possible for a .clj or .class file to know what path it was loaded from.

10:10 If you look at *file* from inside a function that's being run at run time, it will have no useful value. You could try saving its value from inside a macro instead.

10:10 kyptin: chouser: Hmm, interesting idea, about the macro. I will try that!

10:12 chouser: pandeiro: as-file is a protocol function, so doesn't have a single definition the way io/file does.

10:13 kyptin: chouser: Brilliant! Still not sure *why* it worked, but the macro idea did it.

10:13 For reference, here's the macro: (defmacro get-file [] (let [f# *file*] `(str ~f#)))

10:13 Thanks very much!

10:15 chouser: kyptin: it works because that macro is run at compile time, when the compiler is still working on your file and therefore has set *file* appropriately. And your macro returns a string which is essentially substituted into the code as just that string, so that at runtime that string can be used.

10:15 jcromartie: where are protocols preferred over multimethods?

10:15 chouser: maybe that explanation didn't help after all. :-/

10:15 jcromartie: are multimethods basically outdated?

10:15 wingy: jcromartie: not last time i checked

10:15 chouser: jcromartie: when performance matters enough to warrant the loss of flexibility provided by protocols.

10:16 jcromartie: ah

10:16 wingy: multimethods are more powerful than protocols

10:19 the-kenny: But slower

10:19 kyptin: chouser: I get the macro part, and that macros are expanded at compile time. I think the thing I don't understand is why *file* wouldn't be resolved in a function. Is there not a compilation step for a file full of regular functions?

10:21 chouser: sure, but regular functions aren't run then. So you reg fn is compiled along with its reference to *file*, but the value of *file* isn't used until later. When the reg fn is called, the value of *file* is fetched but usually compilation is all done by then and there's no useful value left.

10:23 kyptin: Oh. Right. That makes sense. Thanks!

10:23 chouser: ah good, np.

10:23 kyptin: I'm still surprised that there's no useful value left, but I'm content now that I have my macro workaround.

10:24 chouser: well, you wouldn't want the value of *file* to be changed every time a fn from one file called a fn from a different file, right? That'd be substantial overhead for a simple fn call

10:28 kyptin: Ah! Indeed, that would be a lot of overhead! Now I think I understand. Thanks for your patient explanations. :-)

10:29 casion: thorbjornDX: ##(map (fn [x] (let [n (last x)] [(dec n) n])) (partition-all 2 (range 5))

10:30 thorbjornDX: for some reason I just thought of that regarding your question last night

10:30 kyptin: chouser: BTW, I think it would be useful to capture this knowledge on StackOverflow. Would you like me to send you a link after I write up the question? If you write up what you explained here, I'll accept your answer.

10:33 ssedano: Hi, I know this is a subjective question. But to work with vim, is it better vimclojure + ng, slimv + swank, slimv + ritz, or vimclojure + (slimv + [] for repl)?

10:34 wingy: how do you guys handle localization in clojure (using compojure/hiccup)?

10:35 the-kenny: wingy: We read .po via jgettext into a gigantular clojure map, mapping locales to maps mapping namespace-prefixed keywords to strings

10:35 Pretty simple but enough for our use case

10:37 wingy: the-kenny: im not familiar with .po files .. what are the benfits of using .po files and using yaml

10:37 or even regular clojure data types

10:38 the-kenny: wingy: I'd have used normal Clojure Maps. But management wanted some "standard" file format

10:38 wingy: okay

10:38 well sounds simple .. ill try with regular maps

10:40 djanatyn: is there any way to get a list of all currently doing-stuff agents?

10:41 I just realized that my threads never die and my agents are off on missions they will never return from

10:46 kyptin: djanatyn: Dunno about agents, but I'm using futures and saving a reference to each future in the master thread, so that I can later call `future-cancel` on it if I need to.

10:46 djanatyn: that's a great idea! thank you.

10:48 dgrnbrg: Does anyone have experience with seesaw/swing's canvas? I keep trying to draw to the canvas, but I can't get anything to paint. I'm sure it's something I'd forgetting to do--I am putting the canvas in a border panel in a frame, if that helps

10:48 wingy: no probs having translation files as maps

10:50 * Sgeo attempts to learn what a .war file is

10:51 duck1123: .war huh. good god y'all. What is it good for?

10:51 Sgeo: eww xml :(

10:51 nDuff: Sgeo: Roughly, a zip-based format specific to web applications, which an appropriate container (Tomcat, Jetty, etc) can automate deploying.

10:51 the-kenny: Mostly like a jar

10:51 If you want to generate one from a ring application, use the excellent lein-ring plugin :)

10:52 kyptin: djanatyn: you're welcome.

10:53 wingy: we devs are the managers, the engineers and the sellers

10:54 chouser: kyptin: sure, if you'd like

10:55 ssedano: emacs+evil+paredit+(slime or nrepl)

10:55 dustingetz: .war is kind of like .exe for java web applications. its a standardized format for deploying to an application server (which is basically a http server with some fancy features). there's some XML because it was standardized ten years ago, but its mostly all hidden, its not painful in practice or anything and some tools generate it for you

10:55 java -> jam, including clojure, scala etc

10:55 jvm*

10:56 duck 1123 ^

10:56 duck1123 ^

10:56 kyptin: chouser: http://stackoverflow.com/questions/12692698/file-variable-not-working

10:57 wingy: do you guys agree that the power will lie in the devs tomorrow?

10:58 casion: wingy: I think you want #programming

11:00 ssedano: chouser: thanks for the reply, but I really feel confortable with vim.

11:01 chouser: ssedano: me too. evil has a very large percentage of vim bindings and colon-commands available. Much more than earlier attempts like viper.

11:01 sspooner: cemerick - would you be interested in pulling in a patch to move bandalore to the newest version of the aws-java-sdk?

11:01 djanatyn: This is str5ange.

11:01 I'm using quil, and I have a function to draw an agent.

11:01 ssedano: thanks chouser!

11:02 djanatyn: (draw-blob blob1) (draw-blob blob2) does what I want to do.

11:02 cemerick: sspooner: I just committed a change to that effect this morning; the new release is pending a maven central sync.

11:02 djanatyn: (map draw-blob [blob1 blob2]) doesn't.

11:02 in fact, when I map the draw, neither of the blobs get rendered.

11:02 sspooner: cemerick: perfect, thank you

11:03 cemerick: Watch the twitters for an announcement of when it's available for use. :-)

11:03 djanatyn: Why would that be the case?

11:03 shouldn't (map fn [foo bar baz]) always be equivalent to (fn foo) (fn bar) (fn baz)?

11:05 kyptin: djanatyn: More like (list (fn foo) (fn bar) (fn baz)).

11:06 scriptor: djanatyn: because map is lazy

11:06 djanatyn: ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

11:06 scriptor: it won't evaluate immediately

11:07 you'll probably want doseq

11:07 djanatyn: is there a strict version of map that returns nil and is only used for side effects?

11:07 do I want doseq or dotimes?

11:07 oh, I totally misunderstood what dotimes does

11:08 scriptor: (doseq [blob [blob1 blob2]] (draw-blob blob)) should be what you need

11:08 djanatyn: :D

11:08 it rendered all the blobs for the first time

11:11 redline6561: Hi. Will leiningen automatically load any JARs in the lib/ folder?

11:13 duck1123: redline6561: you really are better off installing any jars you need into a repo if they're not already in one

11:13 redline6561: I do not have legal rights to do so.

11:13 duck1123: there are ways to make loose jars work, but they're usually more hassle then they're worth

11:14 nDuff: redline6561: Not even in your local ~/.m2/ repo under your home directory?

11:14 chouser: kyptin: answered.

11:14 redline6561: I haven't tried putting it there. I was under the impression that I could put loose jars in lib/ and "lein repl" would ensure they were on the classpath.

11:15 nDuff: redline6561: ...so, there are Maven commands to automate populating ~/.m2 -- populating it by hand isn't so much the Right Thing -- but yar, that impression isn't accurate for lein2

11:15 (intentionally so, to encourage reproducible builds)

11:15 redline6561: Drat!

11:15 Thanks nDuff.

11:18 kyptin: chouser: accepted; thanks again!

11:59 DrDave: I have what looks like a Clojure bug: Equal objects that behave differently as arguments

11:59 Where can I paste the code?

12:00 babilen: DrDave: Could you paste an example to http://refheap.com please?

12:01 DrDave: babilen: Thanks, https://www.refheap.com/paste/5440

12:02 nDuff: DrDave: It'd be interested if you provided enough to reproduce.

12:02 err, interesting

12:03 DrDave: nDuff: If you like, but it's a lot

12:03 nDuff: DrDave: ...can't generate a minimal reproducer?

12:04 babilen: DrDave: You might still want to paste a maximally minimal example ;) -- That way we can play with it.

12:04 nDuff: DrDave: ...generally speaking, having a trimmed-down reproducer is fairly essential to being able to file a ticket against Clojure upstream, if it does turn out to be an actual bug.

12:05 DrDave: babilen, nDuff: I'll just paste all. I'm in a time crunch. Feel free to ignore.

12:11 jcromartie: DrDave: the suspense is killing me

12:12 DrDave: babilen, nDuff, jcromartie: OK trimmed as much as possible, https://www.refheap.com/paste/5441

12:13 nDuff: graci.

12:13 jml: is there something like a map-values function built-in to clojure? Something that takes a function and applies them to all the values of a map, e.g. (defn map-values [f m] (into {} (map (fn [[k v]] [k (f v)]) m)))

12:13 * nDuff notes that equal? isn't identical?, so what DrDave is demonstrating here isn't necessarily indicative of a bug in any case, but it'd still be interesting to understand.

12:15 DrDave: nDuff: I don't have equal?, but xxx and yyy are not identical?.

12:15 chouser: DrDave: how are xxx and yyy created?

12:15 jcromartie: DrDave: yeah xxx and yyy are the curios bits

12:16 DrDave: (def xxx (eliminate-all-implications '(not (not p))))

12:17 (def yyy '(not (not p)))

12:17 jcromartie: oh I see

12:17 I reproduced it by using a quoted list for xxx and cons to create yyy

12:18 the problem is "list?"

12:18 Sgeo: ,(list? (cons 1 '(2 3))

12:18 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

12:18 Sgeo: ,(list? (cons 1 '(2 3)))

12:19 clojurebot: false

12:19 jcromartie: or, convert the result of apply-at-all-levels to a list, instead of the lazy seq returned by cons

12:19 or don't use list?

12:20 DrDave: Should I use seq? ?

12:21 jcromartie: I'm not sure what's best: use a broader predicate, or be consistent with returning lists when generating code

12:21 DrDave: jcromartie: I did not know that about cons.

12:21 jcromartie: yeah, it's lazy :)

12:21 chouser: cons isn't lazy

12:21 DrDave: What is the simplest fix?

12:22 chouser: will sequential? work here?

12:22 jcromartie: er, right, sorry it's not lazy it just returns a seq that's not a list

12:22 ,(type (cons 1 nil))

12:22 clojurebot: clojure.lang.PersistentList

12:22 jcromartie: wut

12:22 Sgeo: ,(list? (cons 1 nil))

12:22 clojurebot: true

12:23 jcromartie: ,(type (cons 1 '(2 3)))

12:23 clojurebot: clojure.lang.Cons

12:23 chouser: nil is special

12:23 jcromartie: there we go

12:23 chouser: :-)

12:24 jcromartie: DrDave: I guess the simplest fix is seq? instead of list?

12:24 Sgeo: ,(seq? {})

12:24 clojurebot: false

12:24 Sgeo: Hmm, are there any lazy maps?

12:25 Frozenlock: How does one use the wildcard for java import in clojure? (import 'java.awt.event.*) throws an error.

12:25 jcromartie: DrDave: actually, since you only use cons in one place, you can replace it with (apply list (cons …)) and that's only one chaneg

12:25 but you still have brittle code, say, if you feed it another kind of seq from somewhere else

12:26 so, simple vs robust? your choice

12:26 DrDave: Thanks, using seq? throughout instead of list? solves the problem

12:26 Many thanks from a Clojure newbie!

12:26 TimMc: &(map (juxt sequential? associative?) [(cons 1 nil) (cons 1 '(2 3)) [4 5] {6 7} #{8}])

12:26 lazybot: ⇒ ([true false] [true false] [true true] [false true] [false false])

12:28 TimMc: What you really want is #(and (sequential? %) (not (associative? %))) I guess.

12:28 (defn listy? ...)

12:29 Sgeo: ,(sequential? {})

12:29 clojurebot: false

12:29 Sgeo: Oh, the not associative for vectors?

12:30 ,((juxt sequential? associative?) [])

12:30 clojurebot: [true true]

12:33 djanatyn: when creating records, is there a way to manually specify each value, instead of just putting them in order?

12:33 I'm using hashes and I'm starting to wonder whether using records would be a better idea

12:34 nDuff: djanatyn: map->YourRecordClass

12:34 djanatyn: oh, cool.

12:35 Sgeo: nDuff, where is that documented?

12:35 wingy: is get-in best for accessing nested keys?

12:35 in a map

12:36 chouser: wingy: yep

12:36 wingy: cool

12:36 Sgeo: Oh, I see it in the examples

12:36 for defrecord

12:41 Can someone please explain to me why -> is used with Seesaw?

12:41 Wouldn

12:41 Wouldn't it make more sense for (pack! some-frame) to return nil and not the frame since it

12:41 since it's side-effecting?

12:43 joegallo_: Sgeo that just sounds like a difference of opinion. It seems to me like the author decided to use the method chaining type approach of having all nil return types instead be "this" so that you could chain with ->.

12:43 if you don't like that, you can use doto and pretend that the author didn't do that.

12:46 thorbjornDX: casion: that works too :) (re: your partition-all fn)

12:50 wingy: i have a file in my app folder /app/sv-SE.clj .. and in my main file i added (:use app.sv-SE) … however it cannot find that file

12:50 it says it cannot find it on class path or the init file

12:50 any clue how to make it work?

12:51 nDuff: wingy: for one, your filename should have underscores where the namespace has dashes.

12:52 (silly, yes, but well, it's Java)

12:52 wingy: i c

12:52 yeah you could see that on the error message

12:52 thx

12:53 mmitchell: anyone know of a good java/clojure library for adding a buffer to a bounding box?

12:53 casion: thorbjornDX: I was just sitting here and it came to me, somewhat odd :)

13:00 Sgeo: If I want to have a mutable reference to a map which itself contains mutable references, would refs probably be best for that?

13:01 chouser: yes

13:01 all refs

13:02 or, with some care, refs and agents. But do not include atoms unless you actually mean to be asking for pain.

13:05 wingy: if there is a choice would you have clojure not running on jvm but on its own like node.js?

13:05 chouser: you can compile cljs to js and run it on node.js

13:06 casion: how does node.js run on its own?

13:06 wingy: c

13:07 nDuff: wingy: Was that meant to be an answer?

13:07 wingy: node.js runs on v8. V8 is written in C, sure, but so is the JVM.

13:08 Sgeo: Although, I assume that V8 is small enough that it can just be shipped with the application in question usually?

13:08 nDuff: wingy: Point being, V8 does a lot of runtime optimizations... just as does the JVM.

13:08 Sgeo: The JVM tends to need to be installed

13:08 nDuff: Sgeo: *shrug*. I've seen apps bundle it.

13:08 Sgeo: o.O

13:08 nDuff: (mostly insane ones -- see Oracle for an example -- but still).

13:08 casion: Sgeo: that doesn't change how it's "running on its own"

13:08 wingy: v8 is fast .. jvm is slow as hell to startup

13:08 nDuff: wingy: Sure, but that's a matter of design priorities.

13:09 casion: assuming it is… I still don't get how that makes sense

13:09 nDuff: wingy: ...the JVM was designed for throughput foremost. V8 was designed for interactive use.

13:09 wingy: yepp

13:09 Sgeo: But wouldn't Applets work better with a faster startuo time?

13:09 nDuff: wingy: ...frankly, for a lot of things Clojure is used for, the focus on throughput makes sense.

13:09 Sgeo: So why wasn't startup time a priority back when people believed that applets mattered?

13:09 nDuff: Sgeo: Because the JVM sucked back then.

13:09 wingy: nDuff: throughput meaning like server things?

13:09 casion: Sgeo: afaik, it was

13:10 nDuff: Sgeo: ...these days they're actually good at the things they want to be.

13:10 casion: it was significantly worse 'back then'

13:10 and from my reading of history the main impetus to reduce startup time was the applet producing communities

13:10 nDuff: wingy: Sure. Though, granted, the Erlang runtime still kicks the JVM's butt on some subsets of that.

13:13 scriptor: someone did make a lisp similar to clojure running on the erlang vm a bit back

13:14 redline6561: Interesting. I would have expected lein repl to require all namespaces under src/ for my project.

13:14 wingy: joxa

13:14 redline6561: Is there a way to get such behavior and/or why are my expectations wrong?

13:15 wingy: ok good to know .. seems that jvm is a good choice

13:16 nDuff: wingy: ...the ecosystem is also a very, very big part of that. The universe is littered with good languages that are useless in the real world because there aren't libraries available for them.

13:16 wingy: yeah

13:16 kirindave: Modulo the need for an ecosystem

13:16 You don't see people complaining about forth's lack of a json parser, for example. :)

13:17 wingy: thats why node.js was a huge success .. the ecosystem was huge on frontend and it was doable on backend

13:17 also for other reasons

13:17 kirindave: It "was" a huge success?

13:17 wingy: is

13:17 kirindave: It is a "huge success?"

13:17 wingy: HUGE

13:17 kirindave: #define "huge success" "shared delusion."

13:17 wingy: in popularity

13:18 kirindave: Yes. I suppose.

13:18 Sadly.

13:18 wingy: nah

13:18 promotes JS .. makes the browsers faster .. cheer up

13:18 Sgeo: CPS in JS has to be written manually :(

13:19 kirindave: Javascript is easily the most frustrating, awkward, poorly defined language we have at our disposal. It's also frightfully difficult.

13:19 wingy: i think cljs was influenced by node.js/coffeescript

13:19 technomancy: heh

13:20 wingy: when you have 10 days to make a lang for your boss .. you get JS

13:20 kirindave: technomancy: Did you see that conversation Nathan Marz and Ben Black had about intuition? I'm still trying to figure out why it worries me.

13:20 technomancy: I don't think so?

13:21 kirindave: technomancy: Backtrack in convo from http://twitter.com/b6n/status/252993377694535680 if you care to

13:25 casion: it would seem that clojurescript existed before coffeescript or node.js

13:25 technomancy: kirindave: well, abstractions are appealing, I guess.

13:26 you don't want to have to think about lower layers, and sometimes you can even get away without doing so.

13:26 but usually once you realize you do have to understand them it's too late

13:27 kirindave: technomancy: I just think this is a great example of the same sort of thinking that underlies the "I'm not an apple fanboy" phenomenon.

13:27 Or the "I am just trying to get shit done" phenomenon.

13:28 In which anything beyond what _I_ want to do is unreasonable, but what I already know I want to do is perfectly justified. ;)

13:28 (cannot believe I am mentioning a Gruber meme)

13:28 dgrnbrg: technomancy: I sometimes find that when I'm working on a plugin, if I try to (update-in project [:dependencies] conj [my-lib "0.0.1"]) in the task, the lib isn't downloaded/included in the path, but if I do the same thing just before eval-in-project, it adds the extra dependency. Is there something I'm missing w/ the way lein uses the project map that causes it to be reset if I add the dependency "too early"?

13:28 technomancy: http://wondermark.com/333/

13:29 kirindave: technomancy: Damn.

13:29 Amazong.

13:30 technomancy: dgrnbrg: yeah, it's an unfortunate side-effect of not being able to un-apply profiles

13:31 if you express your dependency in terms of adding a profile it should be preserved

13:31 dgrnbrg: technomancy: I have a plugin that apply-tasks to another plugin, that apply-tasks to a final plugin

13:32 so I could add a new profile to the project, and then add that to the active profiles for the project, and then it should carry through?

13:33 or should I just require that the plugin's runtime injected dependency must be specified in addition to the plugin?

13:33 (which I don't like)

13:38 technomancy: is it possible for a plugin to create a new profile for itself in order to ensure the dependencies it adds to the project stick around?

13:38 technomancy: dgrnbrg: yeah, that would be the way to do it

13:42 dgrnbrg: technomancy: so i'll need to add my dependencies to a newly gensymed profile, then i'll use set-profiles to add the new profile, and then I can pass along that project map to the subtasks?

13:43 jcromartie: mmitchell: what do you mean by "buffer" and "bounding box"

13:44 mmitchell: jcromartie: sorry yeah, should've added more context there. I'm talking about geo-spatial objects. I think the open-source "JTS" library will do exactly what I'm looking for.

13:44 jcromartie: cool

14:05 aaelony: I'd like to key a sorted set of keys. (into #{} (keys {:a 1 :b 2 :c 3})) gives me a set #{:a :c :b}, and (sorted-set-by <) gives me #{}, but when I try to combine the two i get a cast exception. (into (sorted-set-by <) (keys {:a 1 :b 2 :c 3})) ClassCastException clojure.lang.Keyword cannot be cast to java.lang.Number clojure.lang.Numbers.lt (Numbers.java:219) Any way around this?

14:06 ohpauleez: aaelony: You can just use (sorted-set), no?

14:06 I'm drawing a blank, maybe someone can job my memory - I have a vector ["a" "b" "c" "d"], I want to know the next element after a given element (say "b"); nil if at the end of the list

14:06 aaelony: ohpauleez: acutally I'd like sorted-set-by with a "<"

14:07 amalloy: &(second (drop-while (complement #{"b"}) ["a" "b" "c" "d"]))?

14:07 lazybot: ⇒ "c"

14:07 ohpauleez: nvm on my question - nthrest gives me what I need

14:07 amalloy: Ahh that's nice too

14:07 aaelony: it's more clear here: https://www.refheap.com/paste/5443

14:10 callen: I really wish more projects were documented like this: http://sqlkorma.com/docs

14:10 aaelony: seems odd

14:12 scriptor: not really a fan of the color scheme

14:12 * nDuff is not really a fan of Korma, docs or otherwise

14:12 callen: nDuff: why?

14:12 nDuff: ...for one thing, there are a ton of macros, so not everything works everywhere

14:12 and the docs don't cover which things are what.

14:13 also, it's very, very hard to extend for database-specific syntax

14:13 if you want to add a clause into a programatically-generated statement, it often can't be done, and you have to provide the whole thing yourself.

14:15 callen: anyhow, after spending many, many hours fighting korma, I gave up and wrote my own, and am much happier with it.

14:15 dustingetz: nDuff: github link?

14:16 nDuff: dustingetz: Unreleased. Implements only as much as I personally need and nothing more, so it probably wouldn't be useful to anyone else.

14:17 dustingetz: its quite useful to see what things other people find useful, would love to see it if you ever reconsider

14:18 callen: nDuff: what do you prefer?

14:18 nDuff: the one you wrote?

14:19 nDuff: Haven't looked at the other public ones.

14:19 callen: that's odd. writing your own before having looked at alternatives, and then still not releasing it?

14:19 nDuff: If there's something with no macros that's easier to extend for custom syntax, that might be sane.

14:19 callen: nDuff: are you a Forth programmer?

14:19 nDuff: Heh.

14:19 callen: nDuff: clearly you know what I'm referring to, even if you aren't.

14:19 ToBeReplaced: I'm working through the enlive-tutorial at https://github.com/swannodette/enlive-tutorial and got stuck on this line:

14:19 (def *link-sel* [[:.content (nth-of-type 1)] :> first-child])

14:20 I think the syntax is confusing me; could someone explain what it is saying?

14:20 callen: I still find the Clojurian insistence on mixing frontend with code galling.

14:20 nDuff: callen: If I'm going to release something, I'm going to know the competitive field and have it be something actually worth using.

14:20 callen: nDuff: http://clojureql.org/examples.html this is, along with clojure.sql itself, the other main contender.

14:21 nDuff: callen: ...if I want to get something working for my immediate case RIGHT BLOODY NOW, and I can do that with less time spent than learning another 3rd-party library, well, of _course_ I'm going to do that.

14:21 callen: *nod*; I use clojure.sql

14:21 dustingetz: callen: i think they take after the ruby community, there's a lot of ui/mt code mixed together. i think its due to the nature of html

14:21 nDuff: (err, "learning another 3rd-party library" including, of course, learning it well enough to extend it)

14:21 callen: I don't find it that difficult to learn to use other peoples' libraries, even ones with documentation written by psychotics.

14:21 dustingetz: if you can write an ajax single page app, no problems separating ui and mt

14:21 nDuff: callen: Using libraries is one thing. Extending them is sometimes another.

14:22 callen: dustingetz: I usually take a hybrid approach.

14:22 ro_st: so i know i can destructure maps in fn args when i know the key names

14:22 dustingetz: but if you want to pretender, or if you want to write a html app instead of single page ajax app, you don't have much of a choice but to complect your concerns

14:22 ro_st: but how do i get a map of all the keys passed to the fn?

14:22 callen: dustingetz: simple/plain per-page templates, but each template is an AJAX app of sorts.

14:22 dustingetz: prerender*

14:22 twitter talks about this, they had a single page app for a while with nice and clean code, it didn't work out because performance sucked on older browsers

14:22 ro_st: fn [& {:keys [*]}] sort of thing

14:22 dustingetz: they want to control performance thus they prerender

14:23 nDuff: callen: ...libraries can be easy enough to get started with, but then become difficult once one is committed (and trying to do difficult things).

14:23 callen: okay, re: complect -> http://i.imgur.com/hB7r9.png

14:23 ohpauleez: amalloy: Thank you for earlier, I like that much better than what I came up with

14:23 callen: nDuff: what were you trying to do with your SQL exactly?

14:23 dustingetz: hahaha nice link

14:23 callen

14:23 callen: dustingetz: it makes me twitch everytime a Clojure user uses that word.

14:23 dustingetz: why?

14:23 clojurebot: http://clojure.org/rationale

14:24 callen: dustingetz: it has more connection to plaiting and weaving than complexity.

14:24 dustingetz: I took Latin and know the word from that origin.

14:24 dustingetz: half of clojure's value is it provides a common vocabulary to talk about how to solve problems

14:24 ro_st: ohpauleez: :-) do you know how to gather all the k/v args passed to an fn into a map?

14:24 callen: dustingetz: that's called a cult. Scientology has their own vocabulary too.

14:24 dustingetz: sees and all that stuff covabulary as a computer language, as well as spoken language

14:24 callen: dustingetz: stop misusing words just because our glorious leader decided to experiment in a presentation.

14:24 dustingetz: wtf, spellcheck

14:25 nDuff: callen: Using syntax that wasn't supported. INSERT OR REPLACE, BETWEEN ? AND ?, ? IN (?, ?, ...), etc.

14:25 ro_st: someone appears to be short on conjugals.

14:25 nDuff: callen: ...ON DUPLICATE KEY UPDATE...

14:25 callen: nDuff: why not add that functionality to the library?

14:25 nDuff: callen: ...building the queries by piping them through mutators (which didn't work at all, on account of being macros)...

14:26 ohpauleez: ro_st: (apply hash-map args)

14:26 zerokarmaleft: callen: ejackson has the best tongue-in-cheek usage of complect in his core.logic euroclojure talk

14:26 ro_st: nice! thanks

14:26 callen: nDuff: the hell were you trying to do?

14:26 ohpauleez: ro_st: welcome

14:26 callen: nDuff: what necessitates this sort of query grammar?

14:26 Frozenlock: Using Noir (or compojure I suppose), is there a way to conserve the POST uri in the address bar? I would like the user to be able to copy the address and send it to friends. As it is, the POST uri shown is the same as the GET one (no variable=value stuff). Should I use a redirect after the POST instead?

14:26 ro_st: obvious, now that you mention it, of course :-)

14:27 callen: Frozenlock: is this something you've done before in another web framework?

14:27 nDuff: callen: I could go into the details, but... why do you care? They're legitimate constructs, and any query builder worth its salt should support them, period.

14:27 * nDuff has been spoiled by Python's SQLAlchemy.

14:27 Frozenlock: callen: No.

14:27 You could call me a web virgin :)

14:27 callen: Frozenlock: what leads you to believe this is specific to Noir?

14:27 oh, a web virgin. How apropos to what I'm talking about.

14:27 nDuff: ...or, if they aren't supported, there should be an easy way to _make_ them supported.

14:27 callen: Frozenlock: have you read up on how POST works?

14:27 ro_st: Frozenlock: that's not possible. only GET queries are possible from a web browser address bar

14:28 callen: ro_st: shut the hell up, I'm trying to teach him something useful.

14:28 nDuff: Clojure has lots of ways to make that possible -- heck, protocols are as perfect a thing I could imagine for the purpose

14:28 callen: Frozenlock: POST methods in HTTP are supposed to modify things.

14:28 clojurebot: dakrone maintains clj-http

14:28 nDuff: ...but Korma, of course, doesn't use them.

14:28 callen: Frozenlock: friends shouldn't be linking each other URIs that modify things.

14:28 Frozenlock: they should be linking each other content that is a GET

14:28 ro_st: callen: i'll consider it :p

14:28 callen: Frozenlock: other verbiage, such as POST, PUT, PATCH etc are wrapped up in mutation and aren't designed for sharing. Intentionally so.

14:28 Frozenlock: comprende?

14:29 nDuff: callen: ...if Korma supported protocol-based extension, I probably _would_ have extended it, rather than setting off alone.

14:29 Frozenlock: Awww. I was sure to have seen variable=value in some URI. Can a form be used with a GET method?

14:29 callen: Frozenlock: variable=value in the URI is GET

14:29 Frozenlock: Yes, what I wanted was simply impossible.

14:29 callen: Frozenlock: that's not the point, I'm trying to explain why what you want is wrongheaded.

14:29 nDuff: callen: ...but its design wasn't built to be readily extensible, and building something new was the lighter-weight approach than fixing it.

14:29 callen: nDuff: that's fair.

14:30 technomancy: c.j.jdbc isn't really even the right base abstraction to build on unfortunately

14:30 callen: technomancy: pretty sure he built on clojure.sql, not jdbc directly.

14:30 technomancy: unless you mean to conflate the two.

14:31 technomancy: what's clojure.sql?

14:32 Frozenlock: callen: Simply PUT, I was using POST wrongly. I didn't intend to modify things. Rather just give the user some option on where to go next. For example, choose a date and press the button.

14:38 Indeed the GET gives me the variable=value in the URI. This solves my problem, thank you very much :)

14:39 bruceadams: Frozenlock: cool! please be careful that the GET with parameters will behave well for someone that it is sent to.

14:40 Frozenlock: bruceadams: You mean not dependant uppon session information or something like that?

14:40 bruceadams: Frozenlock: exactly

14:57 technomancy: that's a neat trick: Wrong number of args (-1) passed to: conf$prefix

14:57 how does one pass a negative number of args?

14:58 casion: overflow?

15:02 hiredman: technomancy: macros

15:02 technomancy: hiredman: yeah, the call is inside an unquote, but prefix isn't a macro itself.

15:03 hiredman: I imagine someone put in a "patch" to fix the arity exceptions to them by subtracting the implicit args or something

15:05 mefesto: anyone familiar with clojurewerkz/welle?

15:06 i'm attempting to use the :if-none-modified option when storing a json doc but its not working for me

15:11 amalloy: technomancy: i haven't seen that one for like a year, but i remember it happening before. i can never figure out how to reproduce it

15:12 definitely macro-related, but maybe the problem doesn't exist anymore on 1.4 or something

15:52 josteink: so

15:52 after a small break from the world of clojure, Im trying to do some stuff again

15:53 Im currently doing emacs24 + lein2 + nrepl

15:53 is that the current recommended setup for productive work, or has that been obsoleted as well? :P

15:53 SegFaultAX|work: Or vim + vimclojure + lein2 :)

15:53 xeqi: that is the current recommended emacs setup

15:56 josteink: SegFaultAX|work: me and vim dont get along too well :P

15:56 xeqi: thanks

15:57 clojure needs a site dedicated to keeping up to date on what is the recommended setup

15:57 * josteink grins

15:57 josteink: seriously though: lots of obsolete docs out there

16:01 technomancy: the official docs are up to date

16:01 it's just that for some reason everyone feels compelled to create their own unofficial unmaintained write-ups =\

16:02 duck11231: it's because the out of date docs are what they find first. After they decide that those docs suck, they decide to publish their own and the cycle continues

16:03 ivan: is there a way to gently stab people who use :use? I mean this mysterious (copy ...) in gloss/io.clj is horrible

16:04 nightfly_: Is there no centralized Clojure wiki like CL's cliki?

16:04 * ivan starts looking at all the deps

16:04 technomancy: heh, "gently stab"

16:04 juhu_chapa: technomancy: which are the official docs?

16:05 SegFaultAX|work: technomancy: The clojure.org docs are pretty bad.

16:05 technomancy: nightfly_: not really, just dev.clojure.org, which you can't contribute to without signing paperwork

16:06 pandeiro: why is (:require ... :refer [...]) better than (:use ... :only [...]) ?

16:06 technomancy: SegFaultAX|work: oh yeah, totally agreed. I meant for Emacs integration.

16:06 juhu_chapa: I meant https://github.com/technomancy/swank-clojure

16:06 SegFaultAX|work: Oh, I'll hush then.

16:06 Raynes: pandeiro: Because the former is more consistent, since require can do everything use can do.

16:07 Unless you're trying to be backwards compatible with Clojure 1.3

16:07 pandeiro: so it's for semantic purity?

16:07 ahh it's only 1.4+?

16:08 juhu_chapa: technomancy: :O

16:08 devth: keep forgetting, what's a good way to turn [1 2] and [\a \b] into [[1 \a] [2 \b]]?

16:09 amalloy: ~zip

16:09 what the hell, clojurebot

16:09 ivan: don't use aleph perf with lamina perf. lamina perf is a total rewrite.

16:10 duck11231: I use both together just fine

16:10 devth: amalloy: ty

16:10 raek: devth: (map vector xs ys)

16:11 devth: raek: ah, nice

16:11 ivan: duck11231: did you try starting an HTTP server? gloss/io.clj uses `copy` and lamina perf doesn't have it

16:11 oh, maybe I need gloss 0.2.2 branch

16:12 nightfly_: technomancy: That's too bad

16:12 SegFaultAX|work: ,(map vector [1 2] [\a \b])

16:12 clojurebot: ([1 \a] [2 \b])

16:12 SegFaultAX|work: devth: ^

16:12 devth: SegFaultAX|work: cool thanks

16:13 SegFaultAX|work: devth: Zip isn't really a thing in Clojure because map is variadic.

16:13 duck11231: ivan: yeah, I'd check your deps. sounds like you have an old version in there somewhere

16:13 kencausey: Hello, I just updated my checkout of emacs from git and built it and now starter-kit-2.0.3/starter-kit-misc.el is choking because of (void-variable hippie-expand-try-functions-list)

16:14 devth: SegFaultAX|work: makes sense. trying to get better at determining the right fn for the job.

16:17 brainproxy: in my project.clj I have `:resource-paths ["mydir" "resources"]`

16:17 w/ the idea that clojure.java.io/resource would then be able to find things under mydir/

16:18 but i guess that's not how it works

16:18 Raynes: That's exactly how it works.

16:18 raek: brainproxy: if you have a file in mydir/foo/bar.txt you should be able to access it via (io/resource "foo/bar.txt")

16:18 hiredman: resoure-paths are "roots"

16:18 brainproxy: ahhhh

16:18 thanks

16:19 that clears it up :)

16:20 sproc: Question: Why a NPE here? http://pastebin.com/1ySJdVtb

16:20 nDuff: sproc: In the future, would you mind using gist.github.com or refheap? pastebin.com is full of ads.

16:20 sproc: Err, not an NPE, a ClassNotFoundException

16:20 Sure.

16:21 https://gist.github.com/3823021

16:21 nDuff: sproc: You need a require

16:21 emezeske: sproc: You have not :use-d or :require-d or loaded clojure.java.shell

16:24 sproc: Thanks, working now.

16:27 Anyone used this "sh" function to run a piped command?

16:27 kencausey: I've worked around my above problem for now by modifying starter-kit-misc.el to check whether or not hippie-expand-try-functions-list is bound and if not set it to an empty list

16:28 nDuff: sproc: For anything even remotely interesting, I typically end up using conch.

16:30 sproc: that said -- setting up pipelines is a shell operation; you can run (sh "sh" "-c" "foo | bar") if you want to launch a shell and have it do the work, though there are very compelling reasons to consider that bad practice.

16:31 ...short summary: The JVM doesn't provide very good tools for doing that kind of thing.

16:32 Apage43: I only learned recently that you can'

16:32 t even change the current working directory

16:37 technomancy: I'm actually coming around on that one

16:37 seen too many pieces of Ruby code that makes bad assumptions about the current directory

16:38 * hiredman stops the presses

16:43 hiredman: in this talk he references arguments about the exit code of the jvm, and if such a thing is meaningful http://www.infoq.com/presentations/Towards-a-Universal-VM

16:43 still funny

16:44 technomancy: "if it's outside the JVM, then by definition it doesn't matter. I don't see why this isn't obvious." - JVM engineers

16:45 hiredman: technomancy: to be fair they seem to have done well with that attitude

16:46 technomancy: yes, but the same attitude killed smalltalk

16:47 wingy: how do you smash multiple strings together?

16:47 cemerick: technomancy: I think the JVM is past that at this point :-)

16:47 nDuff: wingy: (str "foo" "bar") is one way.

16:47 cemerick: wingy: That thing at CERN should be able to do it.

16:48 nDuff: wingy: (format "Reading %s, got %s" "foo" "bar") is another.

16:48 wingy: CERN?

16:48 nDuff: thx

16:48 hiredman: technomancy: that attitude correlates with the death of smalltalk

16:48 cemerick: wingy: They smash all sorts of things over there.

16:49 technomancy: hiredman: sure, I mean there were a host of causes of death

16:50 cemerick: There's a rev of jrocket that sat right on top of hypervisors IIRC…at that point, who cares what's outside of the JVM?

16:50 Presumably, that's the endgame.

16:50 scriptor: wingy: European Center for Nuclear Research, CERN

16:50 :p

16:50 wingy: :)

16:51 (str) will do

16:57 Raynes: cemerick: Congrats on properly namespacing your libs, dude! Must be a big win for you. I can't express how happy I am for you, man.

16:57 cemerick: wha?

16:57 Raynes: ;)

17:00 cemerick: I was referring to the halloway tweet.

17:00 technomancy: Raynes: it shows commitment. that you're not interested in handing it off to another maintainer down the road. =)

17:00 Raynes: technomancy: Whereas you and I are all but throwing projects at other people (including each other)?

17:01 brehaut: ~rimshot

17:01 clojurebot: Badum, *tish*

17:01 cemerick: oh, that

17:01 another dead horse on both sides :-P

17:04 callen: I don't really want to ask in an actual database channel because they have more religious fervor than a chapel, but if I'm generally growing tired of MongoDB for various reasons, but still want schema-free, what are my choices?

17:05 cemerick: callen: the faithful are everywhere ;-)

17:05 callen: I hate CouchDB with a fiery passion, Riak is poorly documented. The best options seem to be Cassandra, HBase, maybe Redis.

17:05 brehaut: postgresql

17:05 cemerick: brehaut: hey-o!

17:05 callen: brehaut: I said schemafree, and if you say hstore, I will stone you with a boulder.

17:06 technomancy: callen: 9.2 has json types

17:06 cemerick: callen: dude, you've got more fervor than all of #mongo put together

17:06 callen: technomancy: I'm familiar with postgresql, I'm not doing that.

17:06 technomancy: I use PGSQL when I want a SQL database. Using a hammer for everything is a bad idea.

17:06 nickmbailey: cassandra could perhaps be an option if you are having scaling problems with mongo, no one runs a single node cassandra server

17:06 same for hbase really

17:06 technomancy: even when other options are HBase, Casandra, and Redis?

17:07 callen: nickmbailey: that's kinda the point.

17:07 nickmbailey: I'm wobbly on Redis because I don't have happy-feels about Sentinel's master election.

17:07 technomancy: hbase brings a ton of hadoop ecosystem goop into the picture

17:07 callen: HBase and Cassandra have a lot of attached drama from various angles. I hate maintaining hadoop clusters.

17:07 and Cassandra is pretty heavy-duty.

17:07 nickmbailey: just making sure you weren't trying to replace your single node mongo install with cassandra or hbase

17:07 hiredman: there is always datomic

17:07 nickmbailey: :)

17:08 callen: hiredman: I don't use databases that belong to other people.

17:08 and I can fake a triplet-store in most things. Also, Cassandra's timestamping and truth-merging works on the same principle, albeit without ever really exposing it.

17:08 technomancy: pretty sure hiredman isn't serious

17:08 hiredman: *shrug*

17:09 I find datomic's architecture very compelling

17:09 emezeske: callen: You could always write your own db

17:09 ivan: I'm sure Datomic can make you something that runs on your dozen postgres instances

17:10 callen: emezeske: not exactly a time-saving maneuver, but I do have a pretty good idea of what an ideal database for the sorts I do would be.

17:10 emezeske: it'd end up looking similar to the DataStax stuff.

17:10 technomancy: supposedly riak has gotten a lot more accessible recently

17:10 callen: technomancy: I really despise them for making master-to-master replication enterprise-only.

17:10 * technomancy had a bad experience with it pre-1.0

17:10 hiredman: very bad

17:10 callen: technomancy: I had a bad experience with it more recently than that.

17:11 technomancy: accessible, reliable, oss: pick any two?

17:11 callen: seemingly.

17:11 Riak isn't too far from what I want, but there are a few critical issues

17:12 first off, the per node performance is awful beyond my ability to articulate. Second off, its map-reduce is equally as useless as MongoDB's, third, the damned master-master/cross-cluster being enterprise-only.

17:12 jcromartie_: is there a HOF that reverses argument order?

17:12 cemerick: all databases are owned by someone in the end

17:12 lpvb: flip?

17:12 callen: the problem with half-assed map-reduce is that if they pretend aggregations are a solved problem, they absolve themselves of ever really solving the problem.

17:12 Raynes: cemerick: I'm putting that in the bible for this new religion I'm creating.

17:13 callen: 10gen is starting to wake up to this, but Basho is unlikely to do so anytime soon because they're too busying hiring technical writers.

17:13 technomancy: "Just write a map/reduce function in erlang."

17:13 hiredman: (still funny)

17:13 cemerick: Raynes: will you be advertising in Popular Mechanics?

17:14 callen: I'm half-tempted to use ElasticSearch as a first-order datastore

17:15 even though doing so is nuts.

17:15 mpan: I'm getting a divide by zero, but I've checked and the denominator isn't = 0

17:15 or is = not the correct condition?

17:15 hiredman: ,(= 0 0.0)

17:15 clojurebot: false

17:15 mpan: er, what should I use then?

17:15 callen: is there a standard predicate for zero-ness?

17:15 mpan: and ouch

17:16 hiredman: ,(zero? 0.0)

17:16 clojurebot: true

17:16 hiredman: ,(zero? 0)

17:16 clojurebot: true

17:16 mpan: thanks

17:16 callen: there's your answer.

17:16 ,botsnack

17:16 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: botsnack in this context, compiling:(NO_SOURCE_PATH:0)>

17:16 callen: hrm.

17:16 the bot deserves better.

17:16 technomancy: the bot is a thankless wretch

17:16 ~botsnack

17:16 clojurebot: Thanks! Can I have chocolate next time

17:16 wunki: is there a way to figure out the filesize of a file which is uploaded and received through a stream?

17:16 technomancy: hm; I guess not entirely thankless

17:17 TimMc: callen: Try ~

17:17 nvm

17:17 callen: has anyone here ever used ElasticSearch? it's pretty great.

17:17 brehaut: technomancy: http://farm2.staticflickr.com/1185/1367663969_5aae77760f.jpg

17:18 * algernon is using ES for some proof of concept stuff.

17:18 technomancy: callen: it really is

17:18 callen: technomancy: we use it a lot at my company, it replaced a custom NumPy algorithm.

17:19 technomancy: it's sooooooo fast

17:19 I just wish it was slightly better at durability, then I'd use it for everything :P

17:20 * technomancy handwaves "cap theorem" and wanders off

17:20 callen: durability isn't part of cap theorem

17:20 I'm not talking about the fact that ES is AP

17:20 I'm talking about the fact that it's very lackadaisical about wiping out indices and not being very careful about filesystem and protocol level merges.

17:21 it's presumed to be a secondary point of contact for information.

17:45 ToBeReplaced: what is the canonical way to make trailing slashes 302 to the uri without it using ring and/or compojure?

17:46 i see there was a function for it in compojure that seems to have been dropped; maybe the reason why it was dropped would be helpful?

17:52 emezeske: ToBeReplaced: Why do you need such a thing? /curiosity

17:53 ToBeReplaced: maybe i don't... i'm trying to step into webdev and google suggested it was standard practice to redirect one to the other

17:54 at this point, i'm just walking through the clojure/ring/compojure/enlive/clojureql tool chain and picking small problems to see how to go about solving them

17:54 would you recommend another direction?

17:55 emezeske: I've never heard of that as a standard practice, but that doesn't really mean anything

17:56 wingy: you think datomic can be used as a session store?

17:56 or is redis a better fit

17:56 cemerick: ToBeReplaced: /foo and /foo/ are completely distinct URIs; any redirection from one to the other is a service-specific convention

17:57 emezeske: ToBeReplaced: If you're just looking for an exercise, you could always make a little blog engine or shopping cart or something

17:58 ToBeReplaced: cemerick: right; so i'll contend that for my dummy case, joe-user browsing to site/login or site/login/ should be redirected to one of the two (lets say site/login), instead of receiving a 404 on one of them

17:59 cemerick: ToBeReplaced: I would personally handle such situations on a case-by-case basis

17:59 ToBeReplaced: i could add: (compojure.core/GET "/login/" [] (ring.util.response/redirect "/login"))

18:00 interesting; okay... i'll go case by case for now until i understand better

18:00 thanks to both of you

18:01 emezeske: ToBeReplaced: If you insist on doing it, that would be a typical implementation.

18:02 amalloy: https://github.com/4clojure/4clojure/blob/develop/src/foreclojure/ring.clj#L33 is also a not-crazy approach

18:02 emezeske: ToBeReplaced: (With the caveat that in production you'd probably handle that in your web server config, e.g. nginx.conf)

18:04 ToBeReplaced: amalloy: cool

18:07 emezeske: thanks for that; being new in the web space means that i'm biting off more than i need to in some places and less than i need to in others

18:07 cemerick: emezeske: I've been hearing from more and more people that have stopped bothering with nginx, etc. given what CDNs give you these days.

18:08 emezeske: ToBeReplaced: Sure. I'm very opinionated, so take whatever I say with a wheelbarrow of salt, though.

18:09 cemerick: Yeah, CDNs take care of the static serving stuff nicely.

18:09 cemerick: I'd have a hard time exposing jetty or whatever directly, though

18:09 cemerick: There was an nginx loyalist in here a few days ago that was arguing otherwise. I'll add you to the tally. :-)

18:10 emezeske: I just see things like the slow loris attack and think that having a hardened layer between the outside and the inside is good

18:10 brehaut: wait. peopel are loyal to a _web server_‽

18:10 tahts like being loyal to dirt

18:10 useful yes, but its everywhere

18:10 Raynes: Don't be dissing my soil.

18:11 cemerick: brehaut: go talk to the hordes that have been buying food with apache sysadmin work for ~20 years :-P

18:11 brehaut: cemerick: well yeah, apache has job security ;)

18:12 anyone with 800 lines of mod_rewrite goop isnt going to get the sack any time soon

18:12 * brehaut shudders

18:13 emezeske: cemerick: Another advantage to something like nginx is that you can write your app such that it's oblivious to things like way-too-big POST data, etc, and enforce that at the webserver level

18:13 cemerick: So the web server sort of acts like the gatekeeper and sanitizes things

18:14 djanatyn: wow! a multi-threaded, graphical program I wrote in clojure on windows works on my linux without any changes. That's really cool :)

18:14 mpenet: nginx has some nice tricks in its sleeve, like using it for failover between 2 jetty instances when doing deploys

18:14 apache can probably do it, but nginx makes it way too simple

18:14 emezeske: mpenet: Aye, and trivial no-downtime configuration updates

18:15 mpenet: emezeske: yup

18:17 lots of people also use it to apply caching to some REST ressouce/service (I think lanyard caches solr queries using nginx for instance), I am not too familiar with solr, maybe it is has that built

18:17 in

18:18 Again, it just makes it easy. It is probably not the best solution for that kind of thing though

18:18 emezeske: I guess realistically, most people should just deploy to something like Heroku and let them take care of the gritty details of the web server config... :)

18:20 cemerick: Indeed. I can't imagine I'm ever going to touch an nginx config file.

18:21 hiredman: I end up having to touch them everyonce and a while because nginx is fronting our jenkins and archiva at work

18:21 and will decide to not let you deploy jars over a certain size sometimes

18:21 mpenet: Heroku is fine up to a point imho, when it gets too complex it seems to become quite costly

18:22 technomancy: nginx was such a breath of fresh air after apache config that my memories with it were uniformly positive

18:22 (course that was in front of ruby mongrels c. 2008)

18:22 emezeske: technomancy: Oh hell yeah. nginx config is actually quite nice IMHO

18:22 mpenet: xml'ish config files :/

18:23 cemerick: the only one I never got to know was lighttpd

18:23 ah, lighty, pylons, and kid :-P

18:24 mpenet: cemerick: kid the template language?

18:25 cemerick: am I not the only person on earth who touched this thing back then

18:31 cemerick: mpenet: yup, I enjoyed it quite a lot

18:31 Then it was abandoned for Genshi or whatever... :-|

18:32 mpenet: for mako I think

18:33 cemerick: yeah, whatever it was

18:34 mpenet: I used to like it at the early days of TurboGears, I was just so used to xslt. But now... it feels so "complected" :)

18:35 cemerick: I never went in for TG. Pylons + WSGI all the way. :-)

18:36 djanatyn: how many agents with threads is okay?

18:36 In the thing I'm working on now, I'm making 100 agents and giving them all a task. is...is that okay?

18:37 hiredman: agents do not map 1:1 to threads

18:37 agent actions are run on threads from two different thread pools depending on how the actions are dispatched

18:37 djanatyn: Oh, hmm. Does that mean using (Thread/sleep) doesn't guarantee that an agent will pause for that amount of time?

18:39 hiredman: djanatyn: it will

18:39 technomancy: it'll also clog the thread pool

18:40 djanatyn: what does clogging the thread pool mean?

18:41 hiredman: djanatyn: http://clojure.org/agents

18:44 doomlord: does clojure have anything like the haskell "where" construct (i figure that might look odd in prefix form)

18:49 amalloy: &(->> (+ x 1) (let [x 5]))

18:49 lazybot: ⇒ 6

18:49 amalloy: but no, nobody uses that

18:50 emezeske: amalloy: You are sinister.

18:50 doomlord: It would be trivial to write a defn-like macro that gave you a where clause. O_o

18:50 amalloy: why would it be defn-like?

18:50 hiredman: but don't, please

18:51 emezeske: amalloy: I think in Haskell that the where clause is part of the function definition syntax (but don't quote me on that)

18:51 amalloy: I.e. it's not simply an expression that you can put anywhere you want

18:51 hiredman: I think it is part of the pattern matching syntax, which happens to be part of how you definie functions?

18:52 emezeske: hiredman: I think that's probably right

18:52 amalloy: yes, i think hiredman's got it there

19:08 awestholm1: Quick newbie question: I've got a macro to generate a korma query, and would like to be able to stick a wrapper around it to basically add some logic to the end of the generated code. Having a bit of trouble with that. Two questions: a) One approach is to collect the extra query bits as arguments to the macro and expand them into the code, but I don't see anything about conditional expansion inside

19:08 of a syntax quote - am I missing something? b) Is there a way to flat out wrap a macro? i.e., grab the generated code and splice my additional code into it, then execute it? Are there other, better options for solving this problem?

19:11 emezeske: ,`(1 2 3 ~(if true 4 5) 5)

19:11 clojurebot: (1 2 3 4 5)

19:12 emezeske: ,(let [x true] `(1 2 3 ~(if x 4 5) 5))

19:12 clojurebot: (1 2 3 4 5)

19:13 emezeske: Or maybe

19:13 ,(let [x true y [4 5 6]] `(1 2 3 ~@(if x y []) 5))

19:13 clojurebot: (1 2 3 4 5 ...)

19:13 awestholm1: emezeske: facepalm simple. Thanks!

19:13 emezeske: awestholm1: ^ helpful at all?

19:13 Sweet.

19:23 awestholm1: emezeske: Actually, spoke too soon. That get's me halfway there, but I really only want to unquote if true... otherwise I have a nil there that won't work in the expansion. Any ideas? tried `(1 2 3 ~(when false 'not here))

19:23 but that evaluates to (1 2 3 nil)

19:23 gfredericks: ,`(1 2 3 ~@(when false '[not] []))

19:23 clojurebot: (1 2 3)

19:24 awestholm1: gfredericks: Perfect. Thanks!

19:24 gfredericks: np

19:31 Sgeo: Is it reasonable to run MySQL or Postgres in-memory?

19:31 If permanent storage is unlikely to be necessary?

19:32 emezeske: There just has to be a better IRC channel for that question.

20:01 callen: nDuff: another question, what is it you wanted to do that couldn't be done with raw and exec-raw? I find it unlikely that you needed the full generality of composing the verbiage.

20:01 nDuff: the full generality and multiple composition layers are what made SQLAlchemy so horrible. Why would you want that for Clojure?

20:09 Frozenlock: Is there a way in compojure/noir to make a github-like directory path? For example, if the current URI is my-website.com/abc/project/id, I would like to have links to: <abc> / <abc/project> / <abc/project/id>.

20:11 cemerick: Frozenlock: you mean breadcrumbs? Lots of ways to do them, but all out of scope for compojure and noir.

20:11 well, definitely out of scope for compojure; maybe noir has something baked in for them…?

20:12 Frozenlock: Ohhh that's the term! I might have a better in my searches then :)

20:13 amalloy: &(rest (reductions conj [] '(abc project id)))

20:13 lazybot: ⇒ ([abc] [abc project] [abc project id])

20:14 Sgeo: &(reductions conj [] '(abc project id))

20:14 lazybot: ⇒ ([] [abc] [abc project] [abc project id])

20:14 amalloy: combine with your function to create a link from a list of things, and tada?

20:15 Frozenlock: Indeed. I suppose getting the current URI is trivial; so simply separate the string at '/' and that's it.

20:16 Thanks for the reductions function btw, I wasn't aware of it.

20:16 emezeske: Frozenlock: Well, presumably project and id are already passed as arguments to your route handler?

20:16 Frozenlock: E.g. with a route like "abc/:project/:id"

20:16 Frozenlock: Yes

20:17 emezeske: So you don't need to parse the URI yourself

20:21 Frozenlock: I'm not sure I follow... In this case I would need to call the function and send it the argument myself? ---> (make-breadcrumbs project id). A function without arguments would be sexier (make-breadcrumbs)

20:21 Sgeo: How often is :as req or similar used in the [] things in Compojure's GET/POST/etc macros?

20:21 Is there another way, besides :as blah to access things such as session data?

20:23 gfredericks: how do you access session data using :as blah?

20:24 Sgeo: (:session blah) I think?

20:24 gfredericks: and your route looks like (GET "foo" {:as blah} ...)?

20:25 Sgeo: Hypothetically, like (GET "foo" [id foo bar :as blah] ...)

20:25 * Sgeo is just pondering right now, not actually writing code

20:25 gfredericks: oh right

20:25 you can probably throw session in there

20:25 [id foo bar session]

20:27 thorbjornDX: ##((fn group-by-2 [s] (if (even? (count s)) (partition 2 s) (conj (partition 2 (rest s)) (seq [(first s) (second s)])))) (range 13)

20:27 ,((fn group-by-2 [s] (if (even? (count s)) (partition 2 s) (conj (partition 2 (rest s)) (seq [(first s) (second s)])))) (range 13)

20:27 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

20:27 thorbjornDX: ,((fn group-by-2 [s] (if (even? (count s)) (partition 2 s) (conj (partition 2 (rest s)) (seq [(first s) (second s)])))) (range 13)) ;whoops

20:27 clojurebot: ((0 1) (1 2) (3 4) (5 6) (7 8) ...)

20:28 thorbjornDX: casion: I actually don't care if the "duplicated" element is at the back or the front, and this method works for generic sequences (not just range)

20:29 gfredericks: that is a weird function

20:30 thorbjornDX: gfredericks: yep, it's basically a way of doing partition-all, but always returning groups of two elements (in this case it reuses the second element)

20:30 gfredericks: (seq [(first s) (second s)]) could be (take 2 s)

20:31 thorbjornDX: gfredericks: good catch, thanks

20:31 gfredericks: yeah, the (seq [vec]) felt a bit awkward

20:31 gfredericks: thorbjornDX: you probably could have left it as a vector without much trouble

20:31 hiredman: or called list

20:32 thorbjornDX: gfredericks: can you use 'apply on a vector?

20:32 gfredericks: sure

20:32 thorbjornDX: hiredman: hah, I always overlook simple things like that

20:32 gfredericks: ,(apply + [1 2 3 4 5])

20:32 clojurebot: 15

20:33 thorbjornDX: ,(apply str {:a 'b :c 'd})

20:33 clojurebot: "[:a b][:c d]"

20:41 amalloy: (seq [(first s) (second s)]) isn't the same as (take 2 s) if s is empty

20:42 gfredericks: well s can't be empty in his code; but it could have 1 element

20:42 (def TAKE [n coll] (map #(nth coll %) (range n)))

20:42 amalloy: i haven't really been following along

20:48 thorbjornDX: I can constrain s to be two or more long (which actually makes sense in my application)

20:52 * gfredericks just upgraded crate and now his app builds without extraneous compiler warnings

20:52 emezeske: gfredericks: Wonderful, huh?

20:52 gfredericks: emezeske: yo

20:52 woah wow

20:52 emezeske: haha

20:52 gfredericks: emezeske: I have a cljsbuild usage question

20:52 emezeske: Shoot.

20:53 gfredericks: I have two build configs, once for source and one for test

20:53 so the source paths are "src-cljs" and "test-cljs" respectively

20:53 works fine generally, except for the manner in which recompiles are triggered in watching mode

20:53 specifically if I update a source file, only the source build gets triggered

20:53 even though it obviously effects the test build

20:53 emezeske: Ah, yeah, that is not good

20:54 gfredericks: okay so I'm not just using it wrong?

20:54 emezeske: No, that's a shortcoming.

20:54 I've been thinking about how to handle that (and other related) problems

20:54 gfredericks: no problem whatsoever, just checking

20:54 emezeske: There's some discussion on this issue: https://github.com/emezeske/lein-cljsbuild/issues/119

20:54 gfredericks: emezeske: thanks, as well as for the library in general :)

20:55 emezeske: TL;DR: I want to build a dependency tree and watch all of it for changes.

20:55 gfredericks: Glad it's useful.

21:26 * gfredericks is disappointed that ##(read-string "=~")

21:26 lazybot: ⇒ =

21:36 cjfrisz: gfredericks: That one's gonna take me a second to grok

21:37 gfredericks: cjfrisz: ##(read-string "[=~]")

21:37 lazybot: java.lang.RuntimeException: Unmatched delimiter: ]

21:38 gfredericks: cjfrisz: the ~ has special syntactic meaning, so it won't parse them within a symbol

21:38 though it conceivably could

21:39 devn: ##(read-string "#=~")

21:39 lazybot: java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.

21:43 cemerick: is clojure.browser.dom just a sample? There's console logging all over it, but maybe that was accidentally left in at some point for debugging purposes?

21:44 emezeske: cemerick: I don't think anyone ever uses that

21:44 cemerick: It's so incomplete

21:45 cemerick: hum

21:45 helluva canonical ns…

21:45 * emezeske gives a thumbs up with a sarcastic smile.

21:46 cemerick: emezeske: don't be so cynical ;-)

21:47 emezeske: Haha, I kid, I kid. But it is a bit awkward to have something so half-baked in there

21:47 I guess maybe it's good for simple little demos?

21:48 gfredericks: I'm using the chrome debugger on my cljs. It is quite a time.

21:48 in case anybody was wondering.

21:49 an interesting way to learn about cljs internals

21:50 * gfredericks thinks he definitely found a bug

21:51 cemerick: "quite a time"?

21:51 * cemerick is scared

21:51 gfredericks: yeah; lots of careful reading through variable names like cljs.core.first.call(...)

21:51 have to distinguish those from the important function calls

21:52 cemerick: interesting: a file containing a namespace like foo-bar can be named foo-bar.cljs

21:52 gfredericks: yeah; I bet it just reads all the *.cljs files

21:53 emezeske: cemerick: Most of the time.

21:53 gfredericks: you could probably name the file anything :P

21:53 cemerick: gfredericks: no way :-P

21:53 emezeske: cemerick: Under some circumstances your file might be loaded via a (resource), in which case that will break.

21:53 cemerick: emezeske: most?

21:53 emezeske: I forget the exact circumstances.

21:53 cemerick: Surely it checks both, then?

21:53 * emezeske doesn't believe so.

21:54 emezeske: Also, that would break distribution of that code as a JAR (which may or may not bother you)

21:56 cemerick: huh, foo_bar.cljs works for me, but foo-bar.cljs doesn't…?

21:56 gfredericks: cemerick: isn't that the opposite of what you initially claimed?

21:57 emezeske: ClojureScript is still very JVM-ey, it load lots of stuff as Java resources, etc

21:57 cemerick: gfredericks: yeah, that was just based on noticing the dom-helpers.cljs file in the twitterbuzz sample

21:57 gfredericks: ah ha

21:58 * gfredericks back to the debugger

21:58 emezeske: I think the hyphen will definitely work if the source file is in the source path passed to cljs.closure/build

21:58 And only *might* work otherwise

21:58 Same thing with just throwing all the source files in a toplevel directory (instead of making the dir structure match the ns structure like with Java)

21:59 cemerick: OK, hypens just don't work, at least from the REPL

21:59 I'll bet the twitterbuzz stuff is just old enough to have benefited from early slop in the naming requirements.

22:02 gfredericks: cljs.core.pr_str(more) // "(nil)"

22:02 cljs.core.count(more) // 0

22:02 this is exciting!

22:07 cemerick: early days

22:07 Frozenlock: Is there many cljs app in the wild?

22:08 cemerick: Interesting, goog.dom.query appears to be a straight rip of dojo's $$

22:08 docs and all, even

22:10 scottj: cemerick: rip off? it's a port and it acknowledges it

22:10 brehaut: man dojo. is that thing still around?

22:10 gfredericks: cljs.core.count and cljs.core.bounded_count disagree

22:10 cemerick: scottj: rip *of*, not rip off

22:11 wasn't saying anything derogatory

22:11 scottj: cemerick: sorry, misread

22:11 cemerick: brehaut: in your cljs apps, yup ;-)

22:15 gfredericks: emezeske: how do I check what version of cljs I'm using?

22:18 scottj: gfredericks: in code or one-time? for latter, "ls lib/clojurescript*" maybe?

22:19 gfredericks: well I don't think lein2 uses /lib, and since cljsbuild is a plugin I don't think that applies anyhow

22:20 cemerick: gfredericks: you could use something like configleaf to drop the runtime/build-time project.clj file into one of your source-paths, and pick up version numbers from there

22:21 I think there was discussion recently about adding a *cljs-version* var though.

22:21 er, not-var. Whatever they're called. :-(

22:21 gfredericks: cemerick: well then; I guess I'll look for easier solutions first :) thanks

22:21 config property?

22:25 man I am seeing some weird stuff

22:26 anybody know where cljs.core/cons is defined?

22:27 oh nevermine it's declared and defined later

22:28 seq should always return nil when empty, right?

22:41 jimduey: For anyone interested in parallel core.logic.

22:41 http://www.clojure.net/2012/10/02/More-core.logic/

22:52 jcromartie: how can I call a constructor using a class value

22:53 ,(let [x String] (new x))

22:53 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: x, compiling:(NO_SOURCE_PATH:0)>

22:53 amalloy: jcromartie: reflection

22:55 jcromartie: thanks

22:55 amalloy: clojure.lang.Reflector will help a little; clojure.reflect might have some helper but i dunno

23:03 Sgeo: How feasible is long polling with default Ring stuff?

23:19 casion: anyone know offhand what the canonical version of enlive is?

23:22 xeqi: casion: https://clojars.org/enlive

23:23 casion: xeqi: thanks

23:32 Sgeo: Would I just use Aleph if I want to do that sort of thing?

23:51 jcrza: Is there a more recent version of the clojure box.. thing available?

23:51 I'm a python/java noob and I want to get started with clojure

23:51 technomancy: pretty sure clojurebox is abandoned

23:52 jcrza: =(

23:54 technomancy: just grab leiningen, clojure-mode, emacs 24, and if you want to get fancy, nrepl.el

23:55 clojurebox just mashes up old versions of those anyways

23:55 casion: emacs live is pretty good

23:56 jcrza: Are there any windows IDEs you'd recommend?

23:56 casion: you still need to install clojure and leiningen

23:56 jcrza: I borked my linux partition.. haven't bothered to fix it

23:56 technomancy: casion: not really

23:56 I mean, not clojure

23:56 Sgeo: Is it reasonable to use gensym in runtime? For example, with add-watch?

Logging service provided by n01se.net