#clojure log - Nov 16 2013

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

0:14 justin_smith: it can be done in a middleware https://github.com/mikejs/ring-gzip-middleware

0:30 ddellacosta: any Clojure books available in French?

0:30 not sure how to figure this out

0:30 was hoping Clojure Programming (http://www.clojurebook.com/) was, but don't see anything about it on their site

0:57 logic_prog: is core.async moving clojure towards erlang?

1:00 justin_smith: logic_prog: it isn't the same kind of actor model you have with erlang

1:00 and it is a direct translation of the go language go blocks

1:00 name and all

1:02 also, it is not part of the language as far as I can tell, but a good example of syntntax and feature extension via a library

1:39 amalloy: sritchie, justin_smith: mikejs/ring-gzip-middleware is quite outdated. i have a fork that's more modern, and apparently there's another fork under rm-hull whose quality i know nothing of

1:47 Lajjla: ,(symbol? (symbol "I worship his spaces"))

1:47 clojurebot: true

1:47 Lajjla: Aim_Here, my god.

1:47 You are everywhere.

1:49 bitemyapp: Lajjla: I worship his Shadow?

1:49 Lajjla: bitemyapp, certainly.

1:49 But mostly testing if Clojure still has tht big

1:59 bitemyapp: `cbp: ggs

1:59 `cbp: ggs

2:02 bitemyapp: `cbp: that was intense.

2:03 `cbp: heh

2:21 arrdem: bitemyapp: sorry I kinda crapped out on you there, how'd it go?

2:24 bitemyapp: arrdem: I cannot describe it without using words and concepts that will offend and alienate everybody in this channel.

2:25 arrdem: longest TW: [...] in the history of mankind.

2:25 arrdem: suffice it to say, we went like 1 and 4 or 5

2:26 arrdem: bitemyapp: ouch. oh well.

2:26 bitemyapp: arrdem: pffft, no big deal.

2:27 arrdem: thanks for sticking out that game despite technical difficulties.

2:27 arrdem: bitemyapp: no problem. the wifi's been kinda sketch here for a few months but it's never been that bad. I've learned better than to duck out in MOBAs if I can avoid it :P

2:30 ok. goodnight, world.

4:04 notofi: Hi guys, I made my first open source project on github. If somebody could review it would be nice, its a 2 dimensional grid data structure for clojure: https://github.com/damn/grid2d

4:17 echo-area: How can I refer fns defined with defmethod in :use?

4:20 Hmm, those don't seem to be needed

4:36 addisaden: Good morning :)

4:37 Is there a live-stream of the clojure conj?

5:12 ohcibi: hi I have a function that calculates the square root of a number with a given precisiion and I want to test that.. how to round doubles in clojure? note that I want to round doubles and not create rounded string representations (which might be localized and are thus potentially confusing '.' and ',')

5:17 TEttinger: ohcibi, there's (doc with-precision)

5:17 (doc with-precision)

5:17 clojurebot: "([precision & exprs]); Sets the precision and rounding mode to be used for BigDecimal operations. Usage: (with-precision 10 (/ 1M 3)) or: (with-precision 10 :rounding HALF_DOWN (/ 1M 3)) The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP."

5:17 TEttinger: but that's for BigDecimals

5:19 ohcibi: TEttinger: yes, I read that... but I dont see how this applys to single numbers? I tried (with-precision 3 (* 1M 1.14353345)) to round to 1.144 but it just prints out the whole number

5:19 TEttinger: ,(with-precision 3 (* 1M 1.14353345))

5:19 clojurebot: 1.14353345

5:20 TEttinger: weird

5:20 ohcibi: indeed

5:20 TEttinger: ,(with-precision 3 (* 1M 1.14353345M))

5:20 clojurebot: 1.14M

5:20 ohcibi: oO

5:20 TEttinger: need to both be bigdecimals

5:20 there's ##(doc *')

5:20 lazybot: ⇒ "([] [x] [x y] [x y & more]); Returns the product of nums. (*) returns 1. Supports arbitrary precision. See also: *"

5:22 ohcibi: hmm... but thats not actually convenient... I just want to round the return value of a function... dont want to mess up with the implementation

5:22 TEttinger: right.

5:22 simple way...

5:25 ,(let [precision 5 num 0.123456789 mult (Math/pow 10 precision)] (/ (int (* num mult)) mult))

5:25 clojurebot: 0.12345

5:25 TEttinger: ohcibi, will that work?

5:27 ohcibi: TEttinger: I was thinking about a mathematical solution.. thanks

5:27 TEttinger: you can decrement the precision if you want the correct number, sorry about that

5:27 ohcibi: i'll just use 1000 8-))

5:28 its just for the tests... dont need a convenience function actually

5:28 TEttinger: heh much better

5:28 because it turns out this does not limit total places, as with-precision does -- only places after the decimal point

5:28 which might be what you want?

5:30 ohcibi: its exactly what I want.. i have this sqrt-function that calculates the sqrt with a certain precision and I want to test the result, problem is the result is not rounded to the precision so I cant compare to e.g. 1.141 for sqrt(2)

5:30 TEttinger: great, glad my mathematical incompetence found a correct result by accident <_<

5:30 ohcibi: 8-)

5:49 wei___: anyone know a good way to read java properties files into clojure?

5:49 would be nice if I could set them as environment variables on startup

6:15 Glenjamin: wei___: https://github.com/weavejester/environ

6:15 wei___: thanks, I am using environ. wanted to extend it to read properties files

7:19 ohcibi: hi, I have a littel problem with the shorthand syntax #(%) for (fn) statements: i want to create tuples [a a] out of a set #{a b c d}, i was thinking about (map #([% %]) myset) but that doesnt work because it trys to call [% %] as a function of course... do I have to use (fn [x]) syntax here or can I do it somehow with the shorthand syntax?

7:20 wei___: ohcibi: try vector

7:20 ohcibi: #(vector [% %])?

7:21 poppingtonic: Hey

7:21 wei___: #(vector % %)

7:21 or (vec [% %])

7:22 ohcibi: wei___: thanks

7:23 poppingtonic: I'm trying to select a link from within a webpage: http://refheap.com/20944

7:23 Can anyone tell me why this isn't working?

7:23 Incanter, enlive.

7:24 The url is http://data-sorcery.org/book-recommendations/

7:27 http://refheap.com/20945

7:29 TEttinger: ohcibi, there's also (fn [a] [a a])

7:29 poppingtonic, how are you calling load-data ?

7:31 poppingtonic: TEttinger: (def book-data (load-data book-url)). which gets me an Incanter dataset.

7:32 see http://refheap.com/20945

7:33 TEttinger: yeah, I just didn't see that in there

7:34 poppingtonic: :) If I do (dataset colnames rows) at the end of load-data, it works. I'd like to include the links to the books as well, which is where my knowledge of css selectors fails.

7:37 TEttinger: `headers` isn't necessary.

7:41 TEttinger: poppingtonic, I don't think you need href, that's part of one <a> tag, not its own tag

7:43 poppingtonic: yeah, so the selector is the problem, right? How do I select the link string, though?

7:43 TEttinger: hm, '[[:a (attr? :href)]​] might work

7:43 https://github.com/cgrand/enlive/wiki#selectors

7:43 which, yes, I did not guess on my own

7:44 poppingtonic: to extract it so I can include it on its own row, next to the book it points to

7:44 Hm, lemme check it out. I've been looking at dnolen's tutorial

7:48 Thank you, TEttinger. I'll run with it and see how it works out.

7:48 TEttinger: no prob

7:48 I've only used selectors via seesaw for swing, I've never run into the CSS "a[href]" either

7:49 so I have no clue if it will work

7:50 poppingtonic: One of these days, I'm gonna have to take a long walk...

7:54 johnminton: Hello - can I download the HTML Clojure library docs that are on the website anywhere?

7:58 TEttinger: johnminton, I believe they're on github, let me check

7:59 https://github.com/clojure/clojure/tree/gh-pages

8:05 johnminton: TEttinger: thanks

8:06 TEttinger: no problem, it used to say github in the url

8:06 so i guessed it still was there

8:37 ohcibi: does midje's roughly not work with floating point? i tried (fact 3 => roughly 2 0.5) and it says true

9:09 thorben: roughly is a function - try "(fact 3 => (roughly 2 0.5))"

9:24 TimMc: Trying to run 'lein trampoline repl', I got "The repository system is offline but the artifact reply:reply:jar:0.2.1 is not available in the local repository."

9:24 I have an internet connection, and 'lein repl' works fine...

9:24 (Hmm, taking this to #leiningen.)

9:24 technomancy: wait, midje is CL's LOOP?

9:27 TimMc: (Answer: I had ":offline? true" in the project. *sigh*)

10:10 patrkris: hi. does anyone here have experience getting Vaadin up and running with Clojure?

10:11 s_kilk: patrkris , I've never heard of Vaadin, just took a look at its site now. what does it do exactly?

10:12 patrkris: it's a UI framework for creating web applications

10:12 Datomic Console apparently uses it

10:12 which got me interested

10:14 s_kilk: sounds sweet. as for getting it running with Clojure, I'd imagine you could do the clojure-java interop manually as a last resort. it might be worth asking the datomic console guys how they got it working.

10:15 patrkris: yes

10:15 the examples I've found requires writing an web.xml in WEB-INF and setting up a servlet (http://codebrickie.com/blog/2013/02/12/using-vaadin-7-with-clojure/)

10:16 I'm not too familiar with Java and HTTP servlets

10:16 most of the stuff I've done has been with Compojure and Jetty, where I've been able to avoid learning about web.xml and serlvets

10:16 s_kilk: yeah, i get the feeling that working with Vaadin might be a bit more low-level than Compojure. good luck :)

10:17 patrkris: thanks :)

10:19 s_kilk: is there anything you want to do in Vaadin that could not be done in (for example) Compojure and AngularJS?

10:20 patrkris: probably not

10:20 s_kilk: Actually, I've just had a look at the Vaadin demo pages and they do look fantastic

10:20 patrkris: yeah

10:21 it seems like a well-liked framework, and since the Datomic guys chose it, it must be good ;)

10:25 xuser: its as something pedestal aspires to be

10:26 boccato: Im trying to configure a rev proxy for a ring web site, i wanted it to map from /tst to / but I cant understand how to make ring generate the right urls.

10:27 patrkris: xuser: does pedestal contain an UI framework also?

10:28 justin_smith: patrkris: if you run lein ring uberwar, it generates the WEB-INF and web.xml

10:28 you just drop that into the container and it serves your code as an app

10:28 (the uberwar has all the stuff in it tomcat needs)

10:29 boccato: Ive read some things on the net about setting :context or :path-info, anyone know if it is the way to go?

10:29 patrkris: justin_smith: I don't really use a container. I was hoping to be able to do something as simple as `lein ring server` and have that run whatever is needed for me to get Vaadin running on localhost

10:29 justin_smith: don't run lein on production

10:30 at the very least do lein jar and run java -jar on the server

10:30 *lein uberjar

10:30 ahh but yes to try in locally...

10:30 patrkris: justin_smith: right now I'm just trying to learn Vaadin, not run anything in production ;)

10:31 and I was hoping to sidestep running a container

10:31 but I have to admit I don't know much else than starting a Jetty-server with either lein-ring or through the Jetty adapter's API

10:33 justin_smith: looking at that site, I am wondering about generating an uberwar, then unzipping and tweaking the web.xml

10:34 running an uberwar in tomcat is as simple as renaming it to ROOT.war, putting it in /var/lib/tomcat7/webapps/ and restarting tomcat

10:34 this all depends on how much vaadin really needs the container functionality

10:35 patrkris: justin_smith: I have to warn you: most of the web development I have done is on Windows in ASP.NET, so I don't know anything about Tomcat

10:35 justin_smith: maybe this codebrickie guy just doesn't know how much easier making an uberwar is

10:36 patrkris: could be. I'll try to look into that at least. but for development and exploring, do you see any way to just run a simple Jetty-like webserver and try Vaadin off of that?

10:37 justin_smith: oh, I think the issue is vaadin is not something that would play well with ring, so you can't use the ring automation

10:37 patrkris: ah

10:38 justin_smith: https://github.com/tlipski/appengine-magic-vaadin just saw this

10:38 patrkris: would using a servlet container require that I recompile everytime I want to see a chance and exclude me from experimenting with a running application from a REPL?

10:38 thanks

10:38 justin_smith: that project I just linked puts vaadin into a ring context

10:39 patrkris: you can run a repl from inside a war running inside tomcat

10:39 you can load new code in that repl

10:40 patrkris: okay

10:40 justin_smith: but appengine-magic-vaadin may be a better way to do this stuff - we'll need to check out their model

10:40 ok, appengine-magic-vaadin creates an uberwar

10:41 so yeah, you'll want to look into nrepl.server for starting an nrepl inside the app container

10:41 it is not hard to do at all

10:41 but sadly this stuff is all very JAVA and very ENTERPRISE

10:41 not friendly for hack and reload interactive development for the most part it seems

10:42 patrkris: hehe, yeah, enterprise indeed

10:43 justin_smith: ok, going more into their readme, looks like you can just run ring in the normal way

10:43 patrkris: hmm... better read this: https://vaadin.com/book/-/page/getting-started.maven.html

10:44 justin_smith: this is why frameworks are so annoying

10:44 if it was just a lib/middleware it would not be this complex

10:46 patrkris: I agree

10:46 the middleware concept in ring is so easy to understand and use

11:02 xuser: patrkris: don't think so but I guess it should be in their plans

11:36 tupi: hello. trying to run clojure [imagej] batch mode scripts, in particular using cron. it complains that it can not set/use the DISPALY variable, any hints? i tried export DISPLAY=127.0.0.1:0.0 and export DISPLAY=localhost:0.0, but no success so far

11:39 justin_smith: tupi: there is a headless option for the jvm iirc

11:39 if you aren't showing the image but just manipulating it, you can do things headless and it won't need to care about DISPLAY

11:39 also, not that if it does need DISPLAY, it will need the right permissions to access your display

11:40 but what if it runs while you are not logged into X for example?

11:40 tupi: justin_smith: i know about the headless, it is fine if i manually run the script in a terminal. however, triggering the script in a crontab does not work

11:40 justin_smith: tupi: a terminal will see DISPLAY

11:40 test it in a console

11:40 or while not logged into X at all

11:41 tupi: justin, tested, it does not work, that is exactly what i am saying

11:41 you can try a crontab scripty yourself, you'll see

11:41 so any one knows the solution ?

11:41 justin_smith: are you running with -Djava.awt.headless=false

11:42 tupi I run clojure on machines that don't even have X11 installed

11:42 tupi: justin now let me paste the command here

11:42 justin_smith: err true

11:42 I mean true :)

11:42 tupi: justin, it is not clojure, it is java and imagej ...

11:43 justin_smith: OK

11:43 can I see a paste of your jvm args?

11:43 tupi: java -cp clojure.jar:ij-core.jar clojure.main ../measures/me-step2.3.clj \

11:43 "/usr/lpdi/projects/octave/ocom/measures/tests" \

11:43 "mefiji" \

11:43 "png"

11:44 justin_smith: see, that is clojure!, anyway do java -Djava.awt.headless=true ...

11:44 just insert that arg, that should make it no longer look for display

11:44 tupi: ok, i will try now, and let you know, tx

11:48 justin_smith: it looks like imagej is by default a GUI app, so I hope what you want actually makes sense without the GUI part

11:48 tupi: justin it does, our scripts do not open any image/dialog...

11:48 justin_smith: cool

12:05 tupi: justin_smith: that worked fine, many tx

12:05 justin_smith: woohoo my quad tree is working

12:05 http://i.imgur.com/nz0mxLx.png

12:05 light grey is quads created but not occupied, dark with white outline is created and occupied

12:06 all done without interop, so I can use it in clj or cljs

12:06 tupi: fun! where is the code ?

12:06 justin_smith: it will be on noisesmith/quad-tree

12:06 I just got the basics working, so it isn't all up yet

12:06 I still need to do walking, collision detection etc.

12:07 just have the data structure plus filling in the data structure recursively at this point

12:07 which was the hard part :)

12:07 tupi: when ready send me an email david at altosw dot be with the link of the code if that is ok with you of course ...

12:09 justin_smith: oops I forgot to create the repo

12:09 lol

12:09 what I have now will be up in a moment, then you can bookmark the repo for checking later

12:12 OK, it is up now https://github.com/noisesmith/quad-tree

12:12 tupi: great tx

12:12 justin_smith: not quite there yet, but you can check back, and what I have now may still be interesting

12:12 tupi: i'll look at it when i have some time ...

12:13 justin_smith: analemma for the svg output (which lets me use inkscape to debug my code - see if each quad has the boundaries I expect in its xml svg object)

12:13 and also of course just see if the output looks right :)

12:38 if anyone was trying out the quad-tree example in the README, I just pushed a namespace I had forgotten to commit, and without it the code did not work

12:39 is there an automated test for whether my code requires interop? I would like to be able to ensure I am not hitting code paths that would fail in cljs in a simple way

12:49 Glenjamin: can you just run your tests on cljs?

12:49 justin_smith: that may be the best way to do it, yeah

12:50 is there a formula for that? I assume making a clojurescript project and then running the tests under node.js?

12:50 Glenjamin: i have no idea i'm afraid

12:51 justin_smith: https://github.com/cemerick/clojurescript.test looks like this is the ticket

13:01 amacdougall: As long as we're talking about ClojureScript testing, has anyone managed to set up asynchronous or functional tests in pure ClojureScript? All the examples I see in clojurescript.test, Purnam, and so on all seem to focus on traditional synchronous input->output functions -- but most webapps have a lot more going on.

13:03 Glenjamin: i think i've seen an example of using mocha with clojurescript somewhere

13:04 amacdougall: I've been dithering about it for a while now... since testing isn't my area of expertise to begin with, I'm reluctant to try to be a pioneer here. Might be wisest to just use a JS test framework, but that means explicitly establishing a JS surface your test code can operate on.

13:04 Glenjamin: you can do it the other way

13:04 use interop to call the test framework

13:05 this sounds interesting https://groups.google.com/forum/#!topic/clojure/ZyM9SANi2Ig

13:05 amacdougall: I hadn't really considered that, but actually it might be a good way to go.

13:06 Interesting, I'll check those out. Good link!

13:06 Glenjamin: mocha and chai are what i use when doing pure-js, the interfaces are fairly simple

13:07 amacdougall: I like simple.

13:08 I'm making a single-page webapp as a hobby project, and I just want a basic level of tests to affirm that things work. Doesn't have to be a multi-browser test-on-change behemoth.

13:09 Just "after I put this value in this channel, does this event occur before the timeout?"

13:11 Glenjamin: yeah, mocha should let you do that

13:11 it's node-flavoured, so you'll call a callback to indicate when your test is "done"

13:13 amacdougall: Flexible! This could be just the ticket.

13:35 coventry2: Anyone know what fogus's patagonia project is about? (I came in late to his talk.)

14:30 arohner: with prismatic/schema, is there a way to specify "this map can have more keys than I've listed", without enumerating all possible optional-keys?

14:31 aha, yes

14:31 There can also be a single additional key, itself a schema, mapped to the schema for corresponding values, which applies to all key-value pairs not covered by an explicit key.

14:43 derp: hello

14:44 bitemyapp: derp: derp

14:44 derp: is there a way to change the definition of a defn- from the repl?

14:47 justin_smith: derp: you can use ns or in-ns to switch to that ns, and then redefine from there

14:48 derp: aha thnx

14:50 Raynes: You can also use alter-var-root if you're feeling frisky.

15:19 * TimMc squints at derp

15:23 justin_smith: the debug svg output as I work on my quad tree implementation is a great way to accidentally create 1980's new wave pop album covers http://i.imgur.com/JPucKQA.png

15:23 (that's a quad tree with five rectangular regions marked)

15:25 bitemyapp: justin_smith: nifty

15:43 danneu: oh man, that sign bit on BigInteger sometimes. such tricky

17:21 satshabad: what's the best way to remove an item at a particular index from a vector? and for a sequence?

17:22 if feel like (dissoc [2 4 6 8] 0) should work...

17:22 ,(dissoc [2 4 6 8] 0)

17:22 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.IPersistentMap>

17:24 satshabad: would this be the best answer? http://stackoverflow.com/a/1395274

17:27 augustl: looking for an embeddable KV-database for an app that is supposed to be self-hosted. Only really need bytes as keys and bytes as values, I guess. Any suggestions? :)

17:41 creese: Lately, I've been writing validators for APIs, and then I realized... "This has got to be a solved problem." What do you all use?

17:58 justin_smith: satshabad: you may need to loop and set each index starting at position n to be the value at the next index after it

17:58 satshabad: I don't think vectors support insertion directly

17:59 satshabad: I was expecting this (dissoc [2 4 6 8] 0) to eval to '(4 6 8)

17:59 justin_smith: with a cons / list you should be able to replace the preceding cons with the following

17:59 satshabad: I don't think it is build that way at all

17:59 satshabad: yesh it's not

18:00 I did something else any way

18:00 worked out better

18:03 hyPiRion: ,(require 'clojure.reflect)

18:03 clojurebot: nil

18:19 concur: Is there any reason running "lein test" should return "Tests failed." and nothing else?

18:19 it should be telling me *which* tests failed

18:19 but it doesn't

18:22 hiredman: concur: if you call (System/exit 1) somewhere, maybe

18:22 concur: I don't

18:23 I'm using a thread pool

18:23 hiredman: concur: do you call something that does?

18:23 concur: I shouldn't be

18:24 could an uncaught exception possibly be the culprit?

18:25 hiredman: concur: unlikely

18:26 gfredericks: concur: is the failure happening on another thread?

18:26 hiredman: you can get weird behaviour from fixtures that swallow exceptions sometimes

18:26 concur: I'm not sure where the failure is happening

18:26 gfredericks: concur: _can_ failures happen on other threads?

18:26 concur: it gives no details

18:27 gfredericks: since you're using a thread-pool the first thing I'd try is to use bound-fn for all the thread pool jobs

18:27 concur: actually, the assertions are happening after the thread pool is finished

18:27 hiredman: "I'm using a thread pool" is also not very descriptive

18:28 concur: lol

18:28 I'm using a thread pool made by calling java.util.concurrent/Executors.newFixedThreadPool()

18:28 (defn dopool

18:28 "Executes a function over a collection using a fixed thread pool"

18:28 [func coll threads]

18:28 (let [thread-pool (pool threads)

18:28 func-coll (for [item coll]

18:28 #(func item))]

18:28 (doseq [results (.invokeAll thread-pool func-coll)]

18:28 (.get results))

18:28 (.shutdown thread-pool)))

18:29 hiredman: "I'm using a threadpool(to hang on to results so they don't get gc'ed when I run benchmarks)"

18:29 concur: pastebin next time please

18:29 concur: sorry

18:29 hiredman: I doubt that has anything to do with it

18:30 meoblast001: hiredman: in concur's defense, while switching through my idling channels, i was quite pleased to see some lisp code

18:30 concur: I used the same function for something else, and that worked fine

18:30 so I'm not using the pool incorrectly

18:30 hiredman: what happens if you comment out everything, put in (deftest t-foo (is nil))

18:33 concur: Ran 1 tests containing 1 assertions. 1 failures, 0 errors. Tests failed.

18:33 hiredman: ok, so now uncomment out things until that goes away

18:34 m_m: Hi. I am searching major, well documented, still active web framework for clojure. Can you give me some clues ?

18:34 concur: I know which test is failing

18:35 hiredman: concur: but you wonder about the lack of output, the above has more output than you said you saw

18:35 concur: yeah

18:35 but until I added a new test

18:35 it was producing the expected output

18:35 and saying there were no failures

18:35 hiredman: that is not what you said

18:36 concur: what did I say?

18:36 hiredman: 11:21 < concur> Is there any reason running "lein test" should return "Tests failed." and nothing else?

18:36 concur: that's what it does now

18:36 now that I've added this new test, that's all it returns

18:36 before, it was working fine

18:37 sorry if I was unclear

18:40 actually, what I said was a little incorrect

18:41 it does say "Testing rwl.core-test"

18:41 and it executes a couple println's I put in there

18:41 and after that it says tests failed

18:41 but gives no details

18:58 kEND_: has anyone mapped vim-fireplace key mappings for evil mode emacs? I'm looking for some good evil key mappings to interact with the repl in evil mode

18:59 fireplace is great, but I'm pairing with seasoned emacs user

19:10 zilti: kEND_: Cider is great and it's for emacs. There's no reason to use fireplace in Emacs.

19:12 kEND_: zilti: not trying to. I'm a long time vim user and want a good couple of vimish key mappings to execute cider. cider is in the house. ;-)

19:16 seangrove: Uhg, I've forgotten how to require a new lib in clojurescript from the repl

19:17 Do you just change the ns statement and re-eval? Seems to work. I remember some command was supposed to be more straightforward, but can't find it now.

19:35 Is it a good idea to extend ISeqable onto a goog.iter.Iterator in cljs? Or inherently a bad idea?

19:43 amalloy: seangrove: i would guess bad, assuming that an Iterator is mutable

19:43 seangrove: amalloy: It is, that's my concern

19:43 amalloy: eg, consider clj-jvm: ##(seq (.iterator []))

19:43 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.APersistentVector$2

19:44 amalloy: instead, there's ##(iterator-seq (.iterator []))

19:44 lazybot: ⇒ nil

19:44 amalloy: &(iterator-seq (.iterator [1 2 3])) would be clearer, i guess

19:44 lazybot: ⇒ (1 2 3)

19:46 amalloy: the difference is that you can't accidentally pass some mutable thing into a function that expects a sequence; you have to go a little out of your way to converty

19:46 seangrove: That seems fair to me; make it explicit

19:47 (inc amalloy) ;; thanks as always

19:47 lazybot: ⇒ 78

19:59 seangrove: Is this try/catch form wrong for cljs? https://www.refheap.com/8c2297c31c80f698be309c15e I'm getting this error when using the code: TypeError: Expecting a function in instanceof check, but got Error: StopIteration

20:47 amalloy: seangrove: it looks to me like StopIteration is a value of some kind, rather than a constructor/prototype/class

21:00 yeah. cljs catch clauses want a class specified, whereas StopIteration is a singleton defined as Error('StopIteration')

21:00 there might be a catch* or something in cljs that lets you catch arbitrary things, i dunno

21:49 gfredericks: there was a long discussion about that recently

21:49 I think the concensus was to move to (catch :default ...) but I doubt that effects current releases

21:50 I know dnolen removed the ability to catch everything at some point but I don't know whether that got as far as a release

21:53 bitemyapp: Raynes: ring ring muddafakka

21:53 CompilerException java.lang.IllegalArgumentException: No matching method : parseXmlFragment, compiling:(hickory/core.clj:115:11)

21:53 Raynes: bitemyapp: This is from laser?

21:54 bitemyapp: Raynes: yessir, pairing with a friend right now.

21:54 Raynes: https://github.com/Raynes/laser/issues/30 relephant?

21:54 Raynes: http://i.imgur.com/zZiGhot.jpg

21:54 Raynes: bitemyapp: What version of laser specifically?

21:55 bitemyapp: Raynes: lein try '[[me.raynes/laser "1.1.1"] [clj-http "0.7.7"]]'

21:57 devinus_: can anybody recommend me some web frameworks?

21:57 Raynes: bitemyapp: Well, the fix is to manually include the right version of hickory (whatever is newest and under my groupid).

21:57 In your project.clj. It'll override laser's.

21:57 bitemyapp: devinus_: We're generally opposed to things like Rails, but Luminus should get you going: http://www.luminusweb.net/

21:57 Raynes: I'll have to push a new version of the 1.1.1 line to fix it later.

21:58 devinus_: bitemyapp: is luminus still actively maintained?

21:58 bitemyapp: I don't think I can do an exclusion in lein try, sadface. I'll have to make a project.clj

21:58 devinus_: uh, yeah. The author of Clojure Web Development made Luminus.

21:58 devinus_: it doesn't really need a lot of maintaining, it's just a template for best practices with Clojure web apps, there's not *that* much to it.

22:00 Raynes: thank you for the quick answer :)

22:00 Raynes: Apologies for not realizing this was an issue until now.

22:00 bitemyapp: Raynes: why do you have your own version of hickory?

22:00 Raynes: I somehow thought the issue was resolved.

22:00 bitemyapp: I forked it to make some changes that the maintainer wasn't particularly interested in.

22:01 bitemyapp: Raynes: I don't think santiago is interested in much of anything, so that's fair :)

22:02 Raynes: Well, it wasn't like any animosity or anything.

22:02 bitemyapp: Sure

22:02 Raynes: We didn't have a lengthy argument about it or anything :P

22:02 bitemyapp: Raynes: he's too chill for that.

22:07 trptcolin: thanks for tweeting stuff from the Conj, it's helping me to be less miserable about it :)

22:07 trptcolin: bitemyapp: hey, my pleasure.

22:18 SegFaultAX: I wish I could have made it to conj this year. I had a family engagement though that made it impossiburu. :(

22:38 grncdr: ,(and (= 1 2) (print "hm"))

22:39 clojurebot: false

22:39 grncdr: is that idiomatic? or is (when (and …) (side-effect)) preferred?

22:39 I have more than 1 condition anyways, so I need the (and ...)

22:41 amalloy: grncdr: when is better

22:41 grncdr: ok

23:04 zeebrah: i'm using cider or nrepl or slime or whatever it's called now. I remember there was a way to insert a ns definition quickly. can someone remind me how?

23:15 bacon1989: Hello

23:15 i'm interested in learning clojure, and I have a few questions

23:15 I downloded the clojure package, and it runs and everything

23:15 but where should I place my clojure file in order to make it system wide?

23:16 swarthy: I suggest using leiningen to work with clojure.

23:16 bacon1989: http://leiningen.org/

23:16 bacon1989: swarthy: thank you

23:17 i saw that in the tutorial, and I guess I should get it a gander

23:17 swarthy: Basically clojure is a java archive, so it is a bit odd to work with. Leiningen makes it very easy.

23:17 once you have leiningen, you just go to the directory you want to run it from

23:17 and type 'lein new my-app'

23:17 then cd into my-app

23:17 and you are ready to go

23:18 amacdougall: In fact, I haven't really heard of anyone NOT using leiningen.

23:18 swarthy: you certainly could I guess, but it would be a lot more work

23:20 bacon1989: so should I be placing the clojure.jar file anywhere on my path?

23:20 coventry: zeebrah: Do you mean insert the ns form of the current buffer into the repl? C-c M-n.

23:20 swarthy: bacon1989: leiningen will actually download everything you need for you

23:20 amacdougall: If you're using Leiningen, you won't even need to get the clojure jar itself.

23:20 bacon1989: wow nice

23:20 amacdougall: Leiningen handles all dependency management... even the dependency on Clojure.

23:21 zeebrah: coventry: i meant inserting a skeleton ns declaration

23:21 amacdougall: bacon1989: In fact, in your project.clj file, you'll declare a Clojure version. The project templates used by "lein new" will auto-include this.

23:21 Just check out project.clj once it's been generated.

23:21 bacon1989: does leinegen also work for clojurescript?

23:22 kk

23:22 amacdougall: Absolutely. There's a plugin called lein-cljsbuild. You get it by just adding a declaration to project.clj and then leiningen handles the rest.

23:22 You may be starting to see a pattern.

23:22 bacon1989: that's amazing

23:22 amacdougall: Leiningen is one of the best build tools I've ever seen.

23:22 bacon1989: I think I just wet myself

23:23 zeebrah: trying to translate a piece of code from sicp - https://www.refheap.com/c48c08c45c1b85732fd45a9b1 -- have trouble calling the iter function recursively

23:23 amacdougall: Don't wet yourself. Leiningen handles dependencies, but you'll have to get your own Depends.

23:24 swarthy: zeebrah: you should look at loop/recur

23:24 its best to use that when writing recursive functions

23:25 Raynes: Well.

23:25 zeebrah: swarthy: yeah i will, but i'm just transliterating faithfully first

23:25 Raynes: zeebrah: You can replace the 'iter' call with 'recur' and it should work.

23:26 zeebrah: Raynes: oh that's cool. Thanks!

23:26 Raynes: zeebrah: You want to use 'recur' because Clojure doesn't have tail call optimization and recur gets around that. However, if you really needed an anonymous function to call itself by name, define it like (fn iter [] ..)

23:27 Pupnik: doesn't it stop being anonymous when you give it a name

23:28 Raynes: No.

23:28 You can't refer to that name outside of the body of the function.

23:29 zeebrah: btw have I got the local definitions right by using let? in scheme it was two defines at the top of the function

23:29 Raynes: Naming anonymous functions like this has no effect on their anonymity, makes them clearer in stacktraces, and allows the function to call itself recursively outside of the tail position.

23:29 zeebrah: Raynes: very interesting, thanks again :)

23:31 bacon1989: lighttable is pretty slick!

23:32 this is probably going to make learning clojure super easy

23:47 paomian: hello

23:47 (def a {:a 1 :b 2})

23:47 (defn b [& code] (merge a code))

23:47 (b {:c 3})

23:48 ClassCastException clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry clojure.lang.APersistentMap.cons (APersistentMap.java:42)

23:48 why

23:48 technomancy: paomian: get rid of &

23:49 paomian: but the code is not must be needed

23:51 technomancy: paomian: (defn b ([] a) ([code] (merge a code)))

23:51 paomian: technomancy: nice

23:52 grncdr: I'm having difficulty figuring out how to do without mutable references

23:52 swarthy: grncdr: in what context?

23:52 grncdr: this one: https://www.refheap.com/20962

23:52 basically, I want to reference the same data 2 different ways

23:53 and be able to (assoc …) once

23:54 which I know is fundamentally at odds with immutable data structures… so I'm looking for the "right" way to structure that data

23:54 swarthy: Instead of state being a flag, think more in terms of transformations.

23:54 so: date -> new form of data -> new again -> final 'state'

23:54 data*

23:55 each arrow is a function

23:55 sorry if that is vague

23:55 grncdr: it's a bit vague ;)

23:55 swarthy: lol

23:55 grncdr: it's ok, I think the thing I'm having a problem with is fairly concrete

23:55 like, the concepts make sense...

23:56 but doing this one particular operation (in the paste I referenced up there) seems ugly/unwieldly to me

23:56 swarthy: From what I read, when you feel that way you are likely taking the wrong approach.

23:56 technomancy: devn: linky: https://github.com/ato/clojars-web/issues/83

23:59 grncdr: yeah, that's why I asked here ;)

23:59 Raynes: technomancy: I'll see your (defn b ([] a) ([code] (merge a code))) and raise you a (defn b [& [code]] (merge a code))

Logging service provided by n01se.net