#clojure log - Mar 28 2013

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

0:07 kligon: in clojure script externs file, what should be be the location of externs file :externs ["lib/raphael-min.js"] what is the location of lib with respect to project.clj

0:08 alex_baranosky: any good libraries for actor model in Clojure? Has anyone tried to use Akka from Clojure?

0:12 tieTYT2: does anyone know how I can use enlive to find an anchor that contains text that says something?

1:01 devn: tieTYT2: use laser or if you're *really* lazy, yokogiri

1:02 Raynes: Ata boy.

1:02 devn be representin'

1:02 devn: word up

1:02 https://github.com/devn/yokogiri

1:02 the cheapest thrill ever

1:03 https://github.com/devn/yokogiri/blob/master/src/yokogiri/core.clj

1:03 ^-simple

1:05 Raynes: devn: If you ever want something to do go ahead an implement a subset of CSS selectors on top of laser's selectors.

1:05 This might be a full time job so prepare as such.

1:07 devn: Raynes: so much to do already :L)

1:07 Raynes: i just wanted dead-simple scraping so i stole Yoko Harada's deps for nokogiri for JRuby and used a subset of them to sculpt yokogiri

1:08 hence the name

1:08 it's mostly centered around: give me the attributes for an element, give me the text for an element

1:09 no fancy pants action to it

1:47 TheBusby: technomancy: lein repl :headless no longer takes port number as an argument at the command line or from project.clj or profile.clj?

2:02 tieTYT2: check out this stack trace. I actually do know what code is causing this: https://www.refheap.com/paste/95e5f0d72f409e9f2a179fe4a

2:02 but it doesn't have anything related to clojure in it. Does that prevent me from catching it?

2:03 i guess only one way to find out

2:14 tyler: is it just me or does cljsbuild ignore lein profile Xmx?

2:48 ambrosebs: This is weird, it looks like defrecord's macroexpansion qualifies all the implicit methods in clojure.core. e.g., (entrySet [...]) becomes (clojure.core/entrySet [...]). Can someone confirm this? https://gist.github.com/frenchy64/5261196

2:52 Raynes: My doctor says I can't use gist.

2:52 Says it's bad for my teeth.

2:54 ambrosebs: Confirmed that it does that in my repl too.

2:54 ambrosebs: :D

2:57 Yet another oddity of the JVM compiler :)

3:03 heh, but the AST node doesn't have the clojure.core prefix! Weird :)

3:42 m00nlight: Hi, everyone, how can I use the latest clojure 1.5 using "lein" to create new project? It seems that the lein still use the version 1.4

3:48 nightfly: At least in CL package resolution is done in the reader, maybe similar here

3:55 m00nlight: It seems that I just change the dependency in project.clj and lunch clojure repl, it will automatically get version 1.5.0, sorry for trouble

4:02 DaReaper5: how do i return an output stream in a ring response?

4:03 so far i have been converting the output stream to a byte array then an input stream

4:03 but i think ZipOutputStream does not allow it

4:04 basically i have created a zip file in memory and i now want to return it

4:04 i dont want to have to save it to a file

4:08 hello?

4:08 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline DaReaper5

4:14 mduerksen: DaReaper5: have you tried to just pack it into your ring response?

4:14 DaReaper5: i cant return an output stream in a response can i?

4:15 :body (io/input-stream zipIOutStream)

4:15 ?

4:15 mduerksen: yes, just like that. as far as i know, you can return an inputStream in your body

4:16 at least thats what i'm guessing, never tried it actually

4:16 DaReaper5: Cannot open <#<ZipOutputStream java.util.zip.ZipOutputStream@f00ab7>> as an InputStream.

4:17 is there any ways of directly retreiving ring's output sream?

4:18 that has been the popular java solution

4:18 mduerksen: look at this: https://github.com/ring-clojure/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L81

4:18 DaReaper5: http://stackoverflow.com/questions/5516922/returning-zipoutputstream-to-browser

4:18 mduerksen: it seems an inputStream can be used, but not an outputstream. ironically, the code calls .getOutputStream ...

4:19 ah wait, i was wrong

4:19 DaReaper5: ya i saw that

4:19 only inputstream can be returned

4:19 mduerksen: .getOutputStream is on the HttpServletResponse, my bad.

4:20 DaReaper5: which i dont have access to

4:20 mduerksen: yup. doesn't look good

4:21 DaReaper5: this is stupid :/

4:21 i need to return the zip file

4:21 i shouldnt need to save it to file just to open again

4:22 if i could get the byte array of the outstream i would be fine

4:22 but i dont think i can

4:23 mduerksen: the right way would be to create an inputstream from your outputstream

4:23 DaReaper5: how would i do that

4:23 am i just being super tired? :P

4:24 kalasjohnny2000: Maybe some food for thought: http://code.google.com/p/io-tools/wiki/ConvertOutputStreamInputStream

4:25 DaReaper5: on there right now lol

4:27 i dont think i can use pipes

4:27 if you look at pipes they require the output stream to specify the inputstream

4:28 i have to use zipoutstream

4:29 mduerksen: you could of course always do something like this: new BlablaInputStream(out.toByteArray()), but i guess you would like to avoid byte copying

4:30 kalasjohnny2000: It feels like you could do something like (while (not (empty? in-stream)) (.write out-stream (.nextThing in-stream)))

4:31 mduerksen: kalasjohnny2000: thats converting an inputstream into an outputstream, DaReaper5 wants the opposite direction

4:35 DaReaper5: i cant do out.toByteArray

4:35 not on xipoutputstream

4:36 mduerksen: hmm

4:36 DaReaper5: is the only solution to write to file!?

4:36 mduerksen: does a ZipInputStream class exist?

4:37 DaReaper5: yes

4:37 http://docs.oracle.com/javase/6/docs/api/java/util/zip/ZipInputStream.html

4:38 mduerksen: how can you construct one? only from file? seems so: "...input stream filter for reading files in the ZIP file format..."

4:40 kalasjohnny2000: Use http://docs.oracle.com/javase/7/docs/api/java/io/PipedOutputStream.html but remember to use two threads.

4:41 or a http://docs.oracle.com/javase/6/docs/api/java/io/PipedInputStream.html if it was that way round.

4:44 DaReaper5: kalasjohnny2000 it seems that pipedinputstream need to be paired with a pipeoutputstream

4:45 mduerksen: DaReaper5: the constructor of ZipOutputStream takes an outputStream. thats the actual output stream. you could use the PipedOutputStream like kalasjohnny2000 is saying

4:48 Glenjamin_: it seems like this should be easier.

4:48 tomoj: DaReaper5: did you not see my refheap?

4:49 https://www.refheap.com/paste/80bad6da903cc2e6542b33d3d

4:49 ..if you're OK with a byte array

4:49 DaReaper5: looking now

4:50 you are creating a bytearrayoutstream and then using it to create the zip stream

4:50 which afterwards you use the bytestream to get the byte array?

4:51 tomoj: yep

4:51 DaReaper5: nice

4:51 ill try that

4:52 omg yes

4:52 now i need to fix a few other things

4:52 tomoj: like mduerksen said, could put a PipedOutputStream there instead of the baos, I guess

4:53 DaReaper5: ... like that the fiel within the zip are empty without a type

4:53 file*

4:54 and fixed

4:54 omg this is awesome

4:54 i can now generate 100 individual agent commission reports

4:54 now for probably making it more effient

4:54 since creating 200+ jasper reports is slow

4:54 ...

4:55 i use a loop to create the reports and conj them to an array

4:55 is there a more efficent approach that would use multiple threads?

4:55 i am only ever adding to that array

4:56 []

4:57 Glenjamin: some sort of parallel map?

4:57 DaReaper5: ya

4:58 pmap?

4:58 clojurebot: pmap is not what you want

4:58 DaReaper5: lol?

4:58 does the bot speak the truth?

4:58 Glenjamin: i *think* clojure.core.reducers is what you want

4:59 but i have no experience with it, only seen a few mentions

5:07 ejackson: DaReaper5: you have a bunch of options

5:07 pmap could well be the bot you are looking for

5:07 you also have agents, which are quite flexible

5:07 and reducers

5:24 DaReaper5: pmap seems ok for now

5:26 93 reports in 36seconds down from 49seconds

5:27 if i reimplement my java code in clojure would i get a speed increase?

5:27 (i am calling a java class to create part of the report)

5:27 Ember-: depends completely on the algorithm you would use in clojure

5:27 clojure is *not* faster than java as a language

5:28 it cannot be

5:28 it can be as fast though

5:28 DaReaper5: they are basic method calls

5:28 Ember-: your method calls form an algorithm

5:28 that algorithm and it's complexity is all that really matters

5:28 DaReaper5: but wouldn't taking otu a bit of interop with my java class help with speed?

5:28 or does the compiler take care of that

5:29 complexity is always 1 per report

5:29 Ember-: it's negligble to say the least

5:29 DaReaper5: n complexity for all reports

5:29 Ember-: and imho when calling java methods there is no performance penalty since java methods always have static types thus no reflection needed

5:30 in fact if you're making a LOT of calls then your performance could get a whole lot worse by rewriting everything with clojure

5:30 by providing proper type hints you'd get identical performance with clojure than with java assuming the algorithm would stay the same

5:31 but with clojure you have the functional power behind you

5:31 thus if you rewrite your algorithm with clojure and are able to take advantage of lazy sequences and so on then yes, your performance could improve

5:31 but really, just by changing the language you will not improve performance

5:32 well written clojure will beat the crap out of not so well written assembler in performance

5:32 it's all about algorithms

5:34 DaReaper5: hope I didn't confuse you :)

5:34 but that's the cruel reality - understand algorithms

5:34 it's the only way to make your program run faster

5:35 clgv: what was the original question?

5:36 Ember-: 11:29 < DaReaper5> 93 reports in 36seconds down from 49seconds

5:36 11:29 < DaReaper5> if i reimplement my java code in clojure would i get a speed increase?

5:37 11:29 < DaReaper5> (i am calling a java class to create part of the report)

5:37 that

5:37 clgv: ah ok.

5:38 I'd say reimplementing java code in clojure for speed if no parallelization is involved wont work

5:38 Ember-: well it might. But then there would be a lot of room of improvement in the java code too

5:38 for example, looping many times through large collections and so on

5:38 clgv: ah ok thats true. I assumed a pretty good java implementation in terms of speed ;)

5:39 Ember-: lazy sequences could give a large performance boost just due to that reason

5:39 but it all depends

5:40 but since the business logic in this case is actually generating reports then I'd guess one could pretty easily beat the java code performance wise

5:40 since generating reports is all about handling data and that's where clojure really shines

5:41 you can achieve the same level of performance in java too but it's a lot harder

5:41 clgv: depends how the data is represented.

5:41 Ember-: yes

5:41 it all depends :)

5:41 just thinking

5:41 clgv: if it's something map like the clojure code could be pretty simple :)

5:41 *map-like

5:42 Ember-: and if there's multiple transformations applied before the actual report is generated then lazy sequences and map operations could really help

5:42 assuming those operations are done at java side one after another

5:42 clgv: ah I read about pmap in the log. better dont use pmap. there is core.reducers in clojure 1.5.1^^

5:42 Ember-: pmap is an easy way out and it's great for certain situations

5:43 but it's really not THAT hard to do equal functionality in java too...

5:43 by using ExecutorService

5:43 reducers are more like fork/join (and they use fork/join under the hood if I'm correct)

5:43 clgv: hmm no pmap is awful and will disappoint you as soon as it can - the proble is its semi-lazy nature

5:44 Ember-: well yes. True

5:44 clgv: the problem arises immediately if not all tasks have about the same time consumption

5:44 Ember-: I've used it in parallelizing several operations which have side effects

5:44 makes it so easy :)

5:45 TEttinger: ok uh... so I wrote some really poorly formatted Clojure in jEdit, and I am looking to clean it up as an open source project. It definitely has a use -- it's a simple Swing app that lets a user look up whether a food is OK on the user's restricted diet (such as the weak-kidney diet or diabetic diet)

5:45 I can't seem to find an editor that handles whole-file auto-indentation

5:46 and I am not a fan of emacs

5:50 clgv: TEttinger: sadly afaik there is none. you could try to read the files and pretty print them with clojure.pprint/pprint

5:50 but it is not really the same as an IDE would do it

5:50 TEttinger: pretty sure I could re-insert comments where they exist

5:51 clgv: TEttinger: another option is to got through the files and use tabulator on each line -- works in emacs and counterclockwise

5:51 TEttinger: I do have (an old version of) CCW installed

5:51 clgv: you can update that one^^

5:52 TEttinger: does it still have rainbow parens?

5:52 clgv: yes. why?

5:52 TEttinger: love em.

5:52 clgv: it has leiningen support since some time now^^

5:53 TEttinger: I actually contributed a tiny bit of code to CCW so it wouldn't use the same color for parens as certain syntactical elements

5:53 it used fancier colors

9:29 MikeSeth: anybody here uses Sublime/SublimeREPL for clojure development? I'd like to hear your impressions

9:30 nDuff: MikeSeth: The consensus, IIRC from last discussion, is that it can be done, but the tools aren't nearly as mature as what you'll find for emacs.

9:31 MikeSeth: IIRC, the paredit mode there does strict enforcement and expand-to-selection and not much else, so you end up having to use cut-and-paste for operations that would be a single motion with a "real" paredit implementation.

9:31 MikeSeth: nDuff: I absolutely agree, emacs is my primary working environment as well, I am currently hacking on sublime repl plugin which is why I am asking

9:32 I didn't even realize sublime *has* paredit ;)

9:32 nDuff: MikeSeth: https://github.com/masondesu/sublime-paredit

9:33 MikeSeth: ooh, nice

9:33 nDuff: ...though, heh, it actually _does_ have a slurp

9:34 MikeSeth: well, nothing can compete with 30+ of lisper contributions

9:35 years, that is

10:03 jcromartie: hsqldb or h2?

10:04 should I go with HSQLDB or H2?

10:04 kalasjohnny2000: datomic uses h2, h2 is also newer I think

10:10 devn: I can't kill the association in my mind between the oversized vehicle and H2 the DB

10:11 http://content.worldcarfans.co/2009/2/medium/hummer-h2-cabriolet_1.jpg

10:11 Is that H2?

10:13 kalasjohnny2000: Reliable, a Choice of Independence, Self Contained, Practical, Strong, Fast... some many things equal. Keep the association in mind.

10:35 jcromartie: I get a better feeling from H2

10:35 also, Hummer drivers are 5 times more likely to get a traffic ticket than the average motorist

10:35 and that's accounting for bias

10:40 tbaldridge: kalasjonny2000: Datomic uses H2? Where'd you here that from?

10:46 kasterma: I have some reducer behavior I don't understand. In the code at https://gist.github.com/anonymous/5263706 as it stands it runs through the list in order, when I increase the length of the list to say 1000 it just hangs never giving any output after the initial trace.

10:46 gfredericks: tbaldridge: the free version seems to

10:46 kasterma: The r/map finishes, but the r/fold gets nowhere.

10:46 Any advice.

10:47 tbaldridge: gfredrericks: ahhh...that's probably for the SQL store backend.

10:47 gfredericks: right

10:47 kasterma: Ohhh, the output goes to the repl in the terminal, not to my nrepl.

10:48 tbaldridge: I thought someone was saying datomic was built on top of H2. Which I don't think is true. It just supports H2 as a backend.

10:48 gfredericks: ah yes

10:54 pellis: hello

10:54 i'm looking for advice about how to structure my project in a healthy way

10:55 i don't want to bring things from my Java or Scala or even Ruby experience, I'd like to do it the clojure way

10:55 i.e. when to just use a function, when a structure, and when does a function or a set of functions go in a module

10:56 obviously I can think in OO way and model everything that way.. but surely I assume this is less preferred in the 'clojure way'

10:56 but given all that, I haven't bumped into a book that tips about actual file structure or module structure

10:57 S11001001: pellis: Plenty of existing projects to look at, see how they do it

10:57 kalasjohnny2000: pellis, take a look a clojurescriptone, I think that's a good project to start with (it looks very complicated to begin with, but everything has it's reasons)

10:57 pellis: i see. so looking at existing open source projects was an idea i had. just that when I do that - i don't even know if the author is doing a best practice or just getting away with it

10:58 kalasjohnny2000: tbaldrige: exactly, it supports H2 (as opposed to HSQLdb) as backend.

10:58 clgv: pellis: always start with functions and see if you can solve your problem with functions only in a simple way

10:58 * algernon found https://github.com/bbatsov/clojure-style-guide to be a useful read too, as far as style goes.

10:58 pellis: so i'd look at clojurescriptone - any other easy to read project out there? that are precepted to use good clojure idioms with regard to project structure?

10:59 algernon, thanks

11:00 clgv: pellis: do you want to write in Clojure or ClojureScript?

11:00 pellis: Clojure actually

11:01 leif-p: dakrone: hi. I was wondering why clj-http still uses commons-codec 1.6. Is it for backwards compatibility with Java 1.5?

11:01 technomancy: clojurescript one is abandoned, right?

11:01 pellis: if I can talk specific, then I have a service (Web). this service will compute some value based on parameters. then it will persist to database.

11:01 so basically i have a "controller", "core logic" and "persistence layer" if i'm looking at it from an OOP view

11:01 in clojure, this whole thing can be 3 big functions in the same file

11:02 however that looks to be messy

11:02 nDuff: pellis: Encouraging breaking down the logic into tiny functions is one of Pedestal's strong points.

11:03 pellis: ah. I had Pedestal open in a tab one day, forgot all about it.

11:03 rkneufeld: nDuff: with emphasis on *pure*

11:03 pellis: surely I need to look into it

11:04 nDuff, this will actually be an infrastructural api-only service. think about it as a trackingpixel for analytics

11:05 i worry that Pedestal is an overkill?

11:05 nDuff: pellis: If it's not stateful-client, pedestal indeed sounds like overkill then.

11:05 ...though some of the server-side parts could be handy if you needed long-polling or such.

11:06 that's one place where the interceptor model has some rather compelling advantages over traditional ring middleware

11:07 kalasjohnny2000: then maybe start with some tutorial on how to build a webapp with compojure, ring and some database lib (if SQL maybe checkout Korma, mongo: congomongo, etc etc)

11:07 rplaca: technomancy: are you guys having a seattle meetup next thursday?

11:09 kalasjohnny2000: pedestal is probably not overkill, btw. The tutorial with ordering and verification and stuff is maybe exactly what you want? Then your web service is done in like 40 lines of code. crazy times.

11:13 pellis: rkneufeld, oh, you're one of the authors :)

11:13 rkneufeld: pells: yeah i should have said that.

11:14 yogthos: pellis: I'm also trying to document good parctices here http://www.luminusweb.net/

11:14 pellis: much less ambitious than pedestal, but has lots of docs and base project setup in a reasonable way

11:14 jcromartie: the moment when you are trying to solve a problem and read a helpful stack overflow answer… that was written by yourself…

11:14 O_o

11:14 yogthos: lol

11:15 the past you was helping the future you :P

11:16 rkneufeld: pellis: don't hesitate to ping the pedestal-users google group. I'm in charge of making sure things get attention, so if you had specific questions about how pedestal might fit for your application I would be compelled to help you ;)

11:16 jcromartie: yogthos: you are sticking with noir?

11:16 yogthos: jcromartie: I'm maintaining lib-noir with Raynes

11:16 jcromartie: ah ha :)

11:17 yogthos: jcromartie: I'm kind of using it as a catch all for utility functions and such

11:17 jcromartie: yeah

11:17 dakrone: leif-p: I just hadn't bumped it yet, it should work with common-codec 1.7, thanks for the reminder though, I'll look into bumping it

11:20 Driadan: hi

11:24 leif-p: dakrone: Cool. Thanks for all your work on it.

11:33 alandipert: piranha: https://github.com/priornix/todoFRP/tree/master/todo/javelin

11:33 piranha: ha!

11:33 technomancy: rplaca: yeah, definitely. this one should be downtown.

11:33 piranha: alandipert: thanks, I'll look at that :)

11:34 technomancy: so is lib-noir basically flatland/useful for ring? =)

11:37 yogthos: technomancy: sort of :)

11:37 shriphani: hi guys. How do I map over the k,v pairs in a hash-map? I want to check if a particular value exists in the table. Thanks.

11:38 I tried (map (fn [k v] …)…) but that didn't work.

11:38 hyPiRion: shriphani: (map (fn [[k v]] ...) ...)

11:38 yogthos: technomancy: I've been adding stuff like this to it http://yogthos.github.com/lib-noir/noir.io.html

11:39 hyPiRion: notice the double square brackets: You're destructuring the first element

11:39 yogthos: technomancy: and my preference is to use existing libs when possible instead of rolling my own :)

11:39 * si14 hi. can someone help me to understand what's a decent way to write dynamic programming in Clojure?

11:40 TimMc: How do you define dynamic programming?

11:40 nDuff: si14: Are you familiar with the concept of higher-order functions?

11:40 (though... err, yes, need a high-level description of what you want)

11:41 si14: TimMc: let's say Viterbi algorithm.

11:41 nDuff: of course.

11:41 nDuff: Ahh; wasn't expecting a question about dynamic programming in the formal sense.

11:42 si14: the problem is that we need to somehow reuse X_{i,j} (like in X_{i+1,j}=argmax_by_y(f(X_{i, y}))

11:42 hyPiRion: I tend to use memoize quite heavily for DP

11:42 clgv: si14: recursion with memoization can suffice.

11:43 * si14 you mean clojure.core/memoize?

11:43 hyPiRion: When recursion blows the stack, I tend to use doseq or dotimes to iterate over smaller values first

11:43 si14: yeah

11:44 * si14 but AFAIK it's quite heavy compared to mtx[i,j] lookup (it's a HAMT, isn't it)?

11:45 dobladez: piranha

11:45 piranha: dobladez: ?

11:45 clgv: another option is to write a macro that expands into nested loop-recurs which fill the table up to the given argument

11:45 dobladez: (oops sorry)

11:45 clgv: would be pretty reusable^^

11:46 dobladez: piranha: was opening alandipert's link and somehow pasted here by mistake

11:46 si14: clgv: just hoped that some seq-lazy-[handwaving] magic will solve this problem for me :)

11:46 rboyd_: can always count on #clojure to make me feel like an idiot

11:46 * si14 btw, is it a good idea to submit chunks of code to maillist for review? :)

11:47 rboyd_: come on osmosis, feel free to kick in any time

11:47 clgv: si14: not for general DP since you usually have recursions with multiple recursive calls e.g. like f(x,y) = min( f(x-1,y), f(x,y-1), f(x-1,y-1))

11:48 si14: clgv: there was some way to explot ML

11:48 oops, sorry

11:48 ystael: rboyd_: my experience is that one doesn't stop feeling like an idiot - the definition of idiocy just changes :)

11:48 si14: clgv: there was some way to exploit Haskell's laziness to implement dynamic search of Levenshtein distance in O(n) in "sufficiently good" case. Can't remember the details though.

11:49 so that [handwaving] :)

11:50 clgv: si14: humm but that distance uses a 2d matrix so do you access the values in a prvious row when using a lazyseq?

11:50 si4: oh laziness in general could help.

11:51 si4: but not lazy sequences

11:51 si14: clgv: yeah, I just hoped that I don't understand something and there is a way :) seems like a good chance to try shiny matrix-api lib.

11:53 hyPiRion: Well, if you want to do repeated levenshtein distances on, say L(x, y1), L(x, y2), ... L(x, y_n), then you can generate a Levensthein NFA for x

11:54 Using the NFA (or was it DFA? I don't remember) takes O(n), so it's going to be faster

11:54 * si14 NFA? DFA? :)

11:54 hyPiRion: NonDeterministic Finite Automaton

11:55 * si14 ah, I see, thanks

11:55 hyPiRion: Yeah, here it is: http://blog.notdot.net/2010/07/Damn-Cool-Algorithms-Levenshtein-Automata

11:55 (Well, it's kind of not related to DP, but I think it's cool :p)

11:55 * si14 nope, my goal is to implement Viterbi algo, so I've used Levenshtein just as an example of DP

11:57 clgv: si14: you could build something declarative with delays

11:57 * si14 clgv: what do you mean?

11:59 clgv: si14: put the whole vector or vector of vertors in a `promise` but after the cells are constructed. the cells are delays that use the promise to access other cells and deref those cells to get the values. thus, every cell is only calculated once

12:00 the only advantage from memoize is that no hashing is used... might be not worth it

12:00 hyPiRion: Yeah, a vector of vectors is usually slower than a single map with vectors as keys

12:03 clgv: if you have interger params you could just build a specialized memoize to avoid hashing if it turns out to be a performance problem

12:05 si14: hm, maybe that's a way to go. thanks!

12:08 TimMc: &(.getPort (java.net.URL. "http://google.com:-1/&quot;))

12:08 lazybot: ⇒ -1

12:08 TimMc: &(.getPort (java.net.URL. "http://google.com:-2/&quot;))

12:08 lazybot: java.lang.IllegalArgumentException: Invalid port number :-2

12:08 TimMc: Good times in parser-land.

12:10 hyPiRion: whut

12:10 TimMc: java.net.URL has some interesting ideas about parsing URLs.

12:11 Gonzih: &(slurp "/etc/resolv.conf")

12:11 lazybot: java.security.AccessControlException: access denied (java.io.FilePermission /etc/resolv.conf read)

12:11 Gonzih: :)

12:13 hyPiRion: &(slurp "~/.bashrc") ;?

12:13 lazybot: java.security.AccessControlException: access denied (java.io.FilePermission ~/.bashrc read)

12:13 hyPiRion: I think everything is denied

12:15 Gonzih: %(slurp "project.clj")

12:15 &(slurp "project.clj")

12:15 lazybot: java.security.AccessControlException: access denied (java.io.FilePermission project.clj read)

12:16 Gonzih: hm, how is it done?

12:16 some java io restrictions? or just os permissions?

12:17 MikeSeth: chrooted jvm?

12:17 mpenet: it's clojail doing its thing

12:17 * MikeSeth shudders

12:18 hyPiRion: java access restrictions

12:36 tyler: does anyone know if cljsbuild obeys Xmx limit in project.clj? it doesn't appear to

12:38 ppppaul: last night i dreamt about atoms

12:41 lpetit: clgv: hello

12:41 clgv: lpetit: hi

12:41 lpetit: clgv: how are you ?

12:42 clgv: lpetit: good but a lot of work to do ;) and you?

12:42 lpetit: a little exhausted today, did not sleep enough

12:42 anyway, I'm experimenting with a little "lein command line" gadget integrated in CCW

12:43 clgv: Currently, it's a little one-line modal prompt, you enter a leiningen command line in there, and it executes it and the result is output in the Console

12:44 The initial content of the input area is

12:44 - if say you issue the command from project fooproj: "fooproj $ lein <task>" and <task> is already selected so you can start typing the real task immediately. And typing Enter automatically sends the command

12:46 - if say there's no particular project the command is launched from, the command line says: "<no project> $ lein <task>" ; <task> is selected also, and you can leave <no project>, the command will be executed outside any project. Or you can replace yourself <no project> with a project name of your choice

12:46 clgv: question, what could I use as a "not so bad" default for invoking this command line utility ?

12:47 clgv: the current binding is (on a Mac) "Cmd + Option + L L" (Ctrl on Win/Lin), note the "double" L

12:47 clgv: lpetit: it is no standard eclipse view/editor?

12:48 lpetit: clgv: what ?

12:48 clgv: clgv: the leiningen command line tool is not implemented as standard Eclipse View/Editor?

12:48 lpetit: clgv: not that I'm aware of :-)

12:49 clgv: clgv: if it were you could just put it beneath the REPLView or so. ;)

12:49 s/you/the user/

12:50 lpetit: clgv: please explain. What do you mean ? You want a View ? What would it look like ?

12:50 clgv: leptit: is it currently some kind of popup after a shortcut combination was pressed?

12:50 lpetit: clgv: Is Cmd+Option+L already bound to something in your Eclipse ?

12:51 clgv: yes, I've tried to prototype something leight weight, but maybe I'm heading the wrong way.

12:51 s/leight/light/

12:51 clgv: lpetit: that combination is bound in my window manager and logged me out ;)

12:51 lpetit: clgv: crap :-(

12:52 clgv: lpetit: luckily only "lock screen" mode^^

12:52 lpetit: What about only Alt+L ?

12:53 clgv: leptit: Ctrl+Alt+L is not bound in my eclipse - thats Cmd+Option+L right?

12:53 lpetit: Cmd for Mac, Ctrl for Windows / Linux

12:53 clgv: Alt+L is leiningen

12:54 "Alt+L R" and "Alt+L U"

12:54 lpetit: I wonder if it was something else before I used it :-)

12:54 So "Alt+L L" could invoke Lein command line

12:55 Then later, some common tasks could be pre-bound to e.g. Alt+L R : "lein run", "Alt+L T" : "lein test", "Alt+L D" "lein deploy", etc.

12:55 leaving for ~20 mins, BBL

12:57 clgv: lpetit: sounds good

12:59 grebus: alexbaranosky: the clj-schema github page seems not to be there anymore

13:05 bartonh: when running nrepl in emacs using the paredit-mode, how is a multi line function entered? if i turn off paredit-mode i can use RET.

13:06 Driadan: have you tried ctrl-j?

13:07 shriphani: Hi. I have this one line: (def db {:classname "org.sqlite.JDBC" :subprotocol "sqlite" :subame "db/monitor.db"}) and the repl complains about it : ArityException Wrong number of args (0) passed to: PersistentHashMap. What am I doing wrong ?

13:08 bartonh: ctrl-j works perfect. thanks.

13:08 Driadan: :)

13:08 ejackson: shriphani: that evals fine over here

13:08 shriphani: ejackson: heritrix-monitor.core=> (heritrix-monitor.db-layer/db)

13:08 ArityException Wrong number of args (0) passed to: PersistentHashMap clojure.lang.AFn.throwArity (AFn.java:437)

13:09 hiredman: :( sqlite

13:09 shriphani: is that the wrong way to use it ?

13:09 hiredman: should I use something else?

13:09 hiredman: use a jvm embedded sql

13:09 nDuff: shriphani: you're trying to call it as a function

13:09 shriphani: so, yes, that's the wrong way to use it.

13:09 ejackson: shriphani: yes, you can do (db) as thats calling it as a function

13:09 nDuff: shriphani: if you want to look at its value, just db, not (db)

13:09 shriphani: oh wow. I am an idiot

13:09 ejackson: s/can/can't/

13:09 technomancy: "from the JVM" is the wrong way to use SQLite though unfortunately

13:10 ejackson: frying pan -> fire.

13:10 * nDuff (who is rather a fan of SQLite) underlines the "unfortunately"

13:10 shriphani: hmm… what are these jvm embedded sqls? Can I run simple sql queries on them outside of clojure (say from Python which colleagues use ?)

13:12 nDuff: shriphani: Ahh; if you need compatibility with non-JVM-based languages, then you have a compelling reason for SQLite-from-Java.

13:12 * nDuff has heard a lot of folks speaking of pain and suffering stemming from issues with the many various JDBC wrappers, but... well, good luck.

13:13 shriphani: nDuff: yea. I want something to look at things quickly and "select * …." at a prompt is still faster than lein repl blah blah.

13:14 also. lein repl is sort of slow-ish for me. Is there any trick to make it run faster? I am loading up incanter (only heavyweight lib I can see) and it takes about 10 seconds to start

13:15 nDuff: shriphani: See https://github.com/technomancy/leiningen/wiki/Faster

13:15 shriphani: ...in particular, perhaps, the link from there to https://github.com/flatland/drip/

13:16 shriphani: nDuff: docs for making lein use drip ?

13:17 ppppaul: i didn't find that drip makes lein faster

13:17 lpetit: clgv: do you use leiningen ? If so, what are the command line tasks you use most with it ?

13:17 nDuff: shriphani: *shrug*. Not speaking from personal experience there; I just follow the "throw lots of hardware at it" approach to startup times.

13:18 * nDuff wanders for lunch

13:18 tieTYT: http://channel9.msdn.com/Shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure

13:18 shriphani: heh

13:19 clgv: lpetit: lein repl, lein clean, "lein do clean, install", lein deps :tree, (lein checkouts uberjar <- my own plugin)

13:19 lpetit: ah "lein run" sometimes...

13:20 lpetit: clgv: so do you think you would use such gadget (since you're a power user and not a newbie anymore), or still the command line ?

13:22 clgv: lpetit: yeah. it'll be pretty usefull to be able to install altered libs and a second later to update a second CCW project to use it without switching to command line

13:23 lpetit: clgv: and what do you think about the idea of using a "simple" text input. If everything works well, I intend to then provide intelligent content assist for the task part, the project part, etc. (fuzzy completion for the tasks + task help message, etc.)

13:24 I think this could be more useful than a vertical form with "project", "task", "task arguments" fields

13:25 clgv: lpetit: I would try it on the beta channel to see how it feels. I am not sure if the simple text input will suffice... ;)

13:26 lpetit: clgv: since it's a totally independent feature, I intend to release it, as is, on the stable version.

13:26 clgv: lpetit: yeah content assits would be great ^^

13:26 lpetit: (on the beta also)

13:26 clgv: ah ok. no problem then^^

13:26 lpetit: clgv: and also UP / DOW arrows for history, of course

13:27 tieTYT: anyone here use CCW? How do you "compile all files in my project"?

13:28 clgv: lpetit: did you see bug #556

13:28 tieTYT: or load, rather

13:28 clgv: lpetit: http://code.google.com/p/counterclockwise/issues/detail?id=556&start=100

13:30 lpetit: clgv: hopefully will be solved in next stable ; I now ship with leiningen-standalone and not just leiningen-core

13:30 tieTYT: what for ?

13:33 Sonderblade: any suggestions on what tools to use to develop with clojurescript efficently? the cljs compiler is to slow to be used from the command line

13:34 bbloom: Sonderblade: lein-cljsbuild

13:35 lpetit: tieTYT: there's a global option for automatically loading namespaces when you start a REPL. See Preferences > Clojure > General > Automatic namespaces load on start and save

13:39 tieTYT: lpetit: sometimes I've made changes in like 3 files

13:39 and I am ready to try them out. I just want to say, "load teh current state"

13:40 lpetit: that would require restarting the repl, which is what I already do

13:40 Sonderblade: bbloom: do you mean lein cljsbuild auto? that doesn't reduce the recompilation time really

13:40 tieTYT: so maybe I have that option on already (it would have to be a default)

13:40 also, does CCW have a way to format the text?

13:40 lpetit: tieTYT: and you didn't "Ctrl+Enter" or "Ctrl+Alt+S" the changes ?

13:40 tieTYT: lpetit: not at the time

13:40 bbloom: Sonderblade: it should eliminate recompilation of cljs.core on each edit, which should dramatically reduce iteration time

13:41 tieTYT: especially because I changed file 1 which would break file 2 until I updated file 2

13:41 patchwork: If I decompiled the class files generated from a clojure project back into java files and recompiled it, would it run?

13:41 tieTYT: that's just the way I (currently) think

13:41 lpetit: tieTYT: maybe the flag I mentioned above is for you then. Make your changes without saving the files. When ready, "Save all editors" and there you go

13:41 tieTYT: lpetit: did you mean to say this option loads files on save? You said it loads them on repl start

13:42 lpetit: tieTYT: does both

13:42 tieTYT: oh cool, good to know

13:42 technomancy: patchwork: no, clojure emits bytecode that is impossible to express as java source

13:42 tieTYT: anotehr thing

13:42 my-proj.core has the (-main)

13:42 technomancy: particularly for locals clearing

13:42 lpetit: tieTYT: less used these days. People prefer more control over what's (and when) sent to the REPL.

13:43 tieTYT: yes ?

13:43 Sonderblade: bbloom: it does, but it still takes a few seconds to compile a single file which is kind of slow

13:43 tieTYT: i noticed that if I ctrl+alt+s another file and it changes my NS

13:43 then I ctrl+alt+n back into core

13:43 if I try to run (-main) it says it doesn't exist

13:43 this may be a repl thing or a clojure thing

13:43 but i always have to restart my repl to be able to run (-main) again

13:43 lpetit: tieTYT: not sure I'm following you

13:43 patchwork: technomancy: How does that work? Shouldn't java be able to generate any possible byte code sequence?

13:43 ToBeReplaced: favorite clojure path manipulation library?

13:43 tieTYT: ok let me restart

13:43 technomancy: patchwork: nope

13:43 patchwork: That is valid running code

13:44 Interesting

13:44 technomancy: there is no way to express locals-clearing in Java

13:44 lpetit: tieTYT: yeah, slowly, few neurons there, today ;)

13:44 patchwork: Crazy, I had no idea

13:44 technomancy: lots of things are possible in bytecode that aren't expressable in the Java language

13:44 I mean, Java is not at all an expressive language to begin with.

13:44 tieTYT: lpetit: If I go to file2 and start the repl with ctrl+alt+s

13:44 patchwork: How did it get written then?

13:44 tieTYT: then go to core and do ctrl+alt+n

13:44 patchwork: I thought clojure was written in java?

13:44 tieTYT: then try to (-main)

13:44 it says (-main) doesn't exist

13:45 technomancy: patchwork: the compiler is written in java

13:45 tieTYT: and the only way I've been able to figure out how to run main is to restart the repl from the core namespace

13:45 lpetit: does file1 contain a namespace that is a dependencies (required or transitively required) by file2 ?

13:45 technomancy: thankfully the people working on the JVM are a lot more imaginative than the people working on the language

13:45 tieTYT: heh, there's no file1 :P

13:45 patchwork: technomancy: Aha! wow, thanks for the insight

13:45 tieTYT: just core and file2

13:45 patchwork: So it really is better than java

13:45 lpetit: s/file1/core

13:45 patchwork: not just a skin

13:45 tieTYT: oh

13:45 technomancy: patchwork: faint praise, but yes

13:45 jcromartie: and this is what I'll say when they ask me why I wrote this backend service in Clojure instead of Rails http://www.techempower.com/blog/2013/03/28/framework-benchmarks/

13:45 patchwork: Hahaha

13:46 jcromartie: because yes I need to serve K's of JSON responses per second

13:46 tieTYT: does file2 depend on core? no

13:46 does core depend on file2? yes

13:46 i couldn't figure out which of those you were asking

13:46 so i answered both

13:47 lpetit: tieTYT: so you should Ctrl+Alt+S core, then Ctrl+Alt+N and type (-main)

13:47 tieTYT: why?

13:47 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

13:48 lpetit: tieTYT: I assume that it's when there is no REPL started yet, right ?

13:48 tieTYT: the repl is started because the first step is ctrl+alt+s in file2

13:50 1) ctrl+alt+s in file2 2) ctrl+alt+n in core 3) (-main) result = error, could not find that function

13:50 lpetit: tieTYT: if file2 is to be launched from core (since it is required by core), and since you ultimately intend to run core/-main, then, provided that you didn't yet start a REPL: go to core, Cltr+Alt+S it (it will load core and require file2), Ctrl+Alt+L into core, and (-main)

13:51 tieTYT: that's to be expected. ctrl+alt+n does not load core, just emit a "(in-ns 'core)"

13:51 tieTYT: so how do I fix this? Ctrl+Alt+S in core before/after I ctrl+alt+n into it?

13:52 lpetit: tieTYT: did you try what I suggested above ? 1/ open core, Ctrl+Alt+S ; 2/ Ctrl+Alt+N ; 3/ (-main) (in REPL)

13:53 tieTYT: not yet

13:54 lpetit: tieTYT: just do it :-)

13:57 tieTYT: ah ok that works

13:57 i assumed that starting the repl loaded the whole project

13:57 thanks for the help

13:57 lpetit: you're welcome.

13:58 tieTYT: and is there a way to make it so that if I type ( it completes the ) for me and puts my cursor on the inside?

13:58 lpetit: Note that with the flag I mentioned, I think it should indeed load the entire project. It may take some time, tho. In that scenario, only doing a Ctrl+Alt+N in core & then (-main) should work

13:58 tieTYT: cool

13:59 lpetit: tieTYT: yes, that's called the "strict / paredit" mode. This mode comes bundled with some extra features (e.g. when you type a closing paren) which are, at first, a little bit surprising to newcomers. That's why it's not the default mode.

13:59 tieTYT: You can try it by switching back and forth default / strict mode via Alt + D

14:00 tieTYT: When you feel comfortable in the strict mode, you can definitely open your editors in it via Preferences > Clojure > Editor > … don''t remember the wording … option

14:01 tieTYT: pro-tip. When in the strict/paredit mode, you can "escape" from it, for the duration of the next keystroke, by hitting "Esc" key before the key you want to type

14:01 tieTYT: pro-tip 2: the whole list of keyboard shortcuts is here: https://code.google.com/p/counterclockwise/wiki/EditorKeyBindingsFeatures

14:02 tieTYT: thank you

14:02 i'm an intellij guy normally

14:03 lpetit: tieTYT: not too lost in Eclipse? How come you had to switch?

14:08 tieTYT: lpetit: I didn't like the La Clojure plugin

14:08 fractastical: Hey everyone, I'm a total Clojure n00b

14:09 tieTYT: i'm lost in eclipse. I don't like how it doesn't help you learn. There's tons of shit you can't access from the menu, and tons of shit in the menu it doesn't tell you the shortcuts for

14:09 fractastical: i've been playing with a few web apps in Clojure

14:09 hyPiRion: fractastical: hello there

14:09 fractastical: but i'm constantly getting java.lang.ClassNotFoundExceptions

14:09 tieTYT: but i'll learn

14:09 Driadan: glad to hear I'm not the only one starting with Clojure :D

14:09 fractastical: sometimes I suspect that they are actually errors in something else

14:11 hyPiRion: fractastical: hmm, care to elaborate a bit further about when you get these exceptions?

14:11 fractastical: is this a common clojure problem when debugging?

14:11 well, at this moment I've added a controller and a view to my app

14:11 i'm booting it up with foreman

14:11 TimMc: Those usually mean I've forgotten to import a class.

14:12 fractastical: and then it tells me: java.lang.ClassNotFoundException: fractastical-service.server

14:12 TimMc: Oh, hypens!

14:12 fractastical: but it was working just before i added the controller / view

14:12 and there is no explicit call back to the server in any of the new code as far as I'm aware

14:12 hyPiRion: TimMc: Yeah, I get them when I forget to import a class, refer to a nonexisting class or generally try to jar a swearjure program

14:13 TimMc: fractastical: I bet you've got a - vs. _ problem. Where namespaces have hyphens, the file and directory names (packages) have underscores.

14:13 fractastical: yep, i noticed that

14:13 jcromartie: fractastical: if you haven't require'd the fractastical-service.server namespace then "fractastical-service.server" will be treated as a class lookup

14:13 fractastical: but like i said, it was working

14:13 hmm

14:13 TimMc: That would do it as well.

14:13 hyPiRion: Well, that's strange

14:13 fractastical: maybe i need to require the namespace on every subclass (i.e. the controller/view)

14:14 ?

14:14 TimMc: ,clojure.string/split

14:14 clojurebot: #<string$split clojure.string$split@1ebf394>

14:14 fractastical: I actually had the same problem the other day when I was attempting to rename my whole webapp

14:14 and I did a project-wide find/replace

14:14 and got exactly the same error

14:14 hyPiRion: Ah!

14:14 fractastical: went from working, to constantly not finding the main class

14:14 hyPiRion: in your project.clj, have you replaced the :main function?

14:14 fractastical: couldn't figure out why so I abandoned it...

14:15 no, I haven't touched the :main function

14:15 hyPiRion: namespace*

14:15 fractastical: it is the same as before

14:15 hyPiRion: so the symbol is equal to the namespace of the main namespace?

14:16 fractastical: yes

14:16 hyPiRion: hmm

14:16 fractastical: here are the actual values

14:16 project.clj -> :main liberator-service.server

14:17 tomoj: I've been getting that too on `lein run` lately for at least one project

14:17 hyPiRion: and the name of the program is liberator-service.server, I suppose

14:17 technomancy: fractastical: foreman is fairly redundant when using Leiningen

14:17 fractastical: yeah, i figured that

14:17 technomancy: you already enumerate your project's entry points in project.clj

14:17 fractastical: i was using leon run

14:17 lein run

14:17 technomancy: right

14:17 fractastical: I assumed that foreman used trampoline if I had it specified in a Procfile

14:17 tomoj: hmm, but in a new test project, it works fine.

14:18 fractastical: not quite sure what that does when I am running it locally, probably nothing useful

14:18 but the heroku people seemed to think it was a good idea, so i thought I'd try it

14:18 i think it is more to keep their dynos from being used when not necessary

14:18 that was my take-away anyways

14:18 * technomancy is a heroku person =)

14:18 fractastical: :p

14:19 lpetit: tieTYT: yeah, it shows in Eclipse that the main "classic" plugins one expects to see are not sufficiently coordinated and tightly integrated into a coherent "whole", thus the feeling of being lost at first.

14:19 fractastical: anyways, it is good policy from the heroku standpoint to not have us running dynos for no reason

14:19 so I support it ;)

14:19 lpetit: tieTYT: it' s a little bit too "open" : lots of possible customizations, but poor defaults

14:20 * pjstadig wants to write a build tool named leon now

14:20 hiredman: pjstadig: instead of creating projects it will kill them

14:20 fractastical: ha

14:20 deploy to trash...

14:21 anyways, the problem with this error: "Exception in thread "main" java.lang.ClassNotFoundException: liberator-service.server" is that I have no idea where it is from in the code

14:21 TimMc: pjstadig: Will it turn off autocorrect, download lein, delete itself, and symlink to lein?

14:21 Because that would be cool.

14:21 danlarkin: rf -rf /

14:22 hyPiRion: ls -a

14:22 lazybot: data home lost+found media opt proc root sbin selinux swap tmp

14:23 technomancy: "Of course, on the system I administrate, leon has been replaced by a shell script which Generates a syslog message at level LOG_EMERG, reduces the user's disk quota by 100K; and RUNS ED!!!!!!"

14:24 danlarkin: ahahh

14:24 S11001001: ed is the industry best practice text editor

14:25 hiredman: it also replaces replaces your prompt with "C:\Documents and Settings\home>"

14:25 technomancy: !!!

14:25 shriphani: hello. I have a jdbc question. What parameter is missing in this list? I am working off an example on github but it doesn't seem to be right : db-spec {:subame "db/monitor.db", :subprotocol "sqlite", :classname "org.sqlite.JDBC"} is missing a required parameter clojure.java.jdbc.internal/get-connection

14:26 technomancy: hiredman: necessarily

14:26 hyPiRion: technomancy: huh, where is that from? Or did you just made that up?

14:26 technomancy: hyPiRion: https://www.gnu.org/fun/jokes/ed.msg.html

14:27 thalassios_xelon: helo room:) is there an easy way to limit availible time for evaluation of an expression? example: (limit-time 1000 (.....)) if its takes more than 1000ms cancel the evaluation

14:28 lynaghk: ping: dnolen

14:28 dnolen: lynaghk: pong

14:28 lynaghk: dnolen: you wrote a blog post about using ClojureScript protocols to do neat stuff with strings and regexes

14:28 hyPiRion: technomancy: I should've known once I saw Ed, really.

14:29 dnolen: lynaghk: yes a long while ago

14:29 lynaghk: dnolen: is that still around somewhere or did you take down the old blog for your new github one? I'd like to link to that post

14:29 dnolen: lynaghk: it's probably on posterous sadly

14:29 lynaghk: which is going away soon so I wouldn't like to ti

14:29 TimMc: hyPiRion: You should have known once you saw all those exclamation points.

14:29 lynaghk: dnolen: my google skills are failing me.

14:29 dnolen: oh, okay.

14:29 thalassios_xelon: i found the way to limit time .... bye room

14:30 TimMc: ...thanks for telling us.

14:30 Driadan: that was fast...

14:30 TimMc: I would have liked to know the answer, actually.

14:30 ToBeReplaced: in the clojure.java.jdbc docs, it says with-query results is "Deprecated since JDBC-based SQL Interface version 0.3.0" ... what is the JDBC-based SQL interface?

14:31 technomancy: ToBeReplaced: I don't think 0.3.0 is out yet

14:31 hyPiRion: TimMc: I should have known everything really. Would've made IRC life so much easier.

14:31 ToBeReplaced: yeah latest on maven is 2.4

14:37 fractastical: so apparently the ClassNotFound problem was from sort of mismatch between liberator and compojure.route

14:37 which weirdly declared that my main class file could not be found

14:39 hyPiRion: Oh, ooh. May be that either liberator or compojure grabs *ns* somehow.

14:39 though I can't understand how that would crash.

14:39 technomancy: hoping to do a bugfix release of Leiningen today or tomorrow; anyone got some issues they'd like to make it in?

14:40 n_b: I'm currently working on enhancing the Clojure bindings to the Boilerpipe library (an HTML content extraction lib) and am trying to determine why the original author used protocols rather than just slurp'ing in the source and passing it to the lib; anyone mind taking a quick look here and possibly enlightening me? https://gist.github.com/nickbarnwell/28992b89bc3e0c925416

14:40 ppppaul: technomancy, lein is too pretty and easy to use. fix this please

14:40 n_b: Or would a question like this be better suited to the mailing list

14:41 amalloy: ppppaul: that would make it more familiar to some of the mainstream-language programmers...

14:41 technomancy: what's that? xml-based project.clj replacement, you say? it's so crazy it just might work.

14:42 tomoj: n_b: I don't think you're missing anything

14:42 yazirian: technomancy: you should be able to work some m4 in there somewhere

14:42 mknoszlig: TimMc: here's a pretty ad hoc solution for that timeout thing icusc: https://gist.github.com/mknoszlig/5265744

14:42 hyPiRion: ppppaul: Leiningen is a pretty guy, true that. It's hardly we can anything we could do about that though. Except maybe shave his moustache.

14:43 ppppaul: the only issue i have with lein is start up time. i do lein test a lot and it takes seconds to boot

14:43 pellis: please don't replace lein with XML

14:43 ppppaul: using drip too

14:43 n_b: tomoj: First guy just overcomplicated it, right? The entire file has to be read in to be parsed, so the *only* advantage I could see with the protocol method was being able to optimise, e.g. HTTP fetching, with clj-http or such

14:43 noncom: Hey what is the library to use if i need to make an HTTPS client? Google only says there are HTTP libraries for Clojure... will neotyk's http.async.client work with HTTPS?

14:44 n_b: clj-http works with HTTPS for me

14:44 hyPiRion: noncom: I think clj-http/compojure + Friend can do HTTPs stuff

14:44 tomoj: I don't see any advantage of having a protocol there at all

14:44 it looks like the author was just confused

14:44 ppppaul: i tried to use friend and found it hard

14:44 moved to liberator

14:45 yazirian: ever since i started using clj-http, my bread started landing butter side up when i drop it.

14:45 n_b: OK, cool cool. Will just write some tests and then make a pull request then. Thanks tomoj

14:45 tomoj: I mean, a TextExtractor protocol could maybe make sense

14:45 noncom: thank you good people!

14:46 tomoj: but it should be a protocol over text extractors, not over URLs and bodies..

14:47 amalloy: tomoj: i think that protocol is just clojure.java.io/reader

14:47 (should be, that is)

14:47 tomoj: and that only would make sense if you wanted to be able to swap boilerpipe for something else..

14:47 "extractor" means something different here

14:47 ppppaul: can i talk about pedestal here?

14:47 rkneufeld: Sure.

14:47 technomancy: man... lein ring launching a browser by default

14:47 ppppaul: i'm really curious about how it will scale

14:47 technomancy: what is up with that =(

14:47 rkneufeld: We have #pedestal too

14:47 tomoj: amalloy: oh, right

14:48 ppppaul: from my understanding, scaling is easy to do if i can cache my data. the easier i can cache the better i can scale. i don't see this being possible with pedestal

14:49 hyPiRion: technomancy: lein ring :headless

14:49 or something

14:49 ppppaul: rkneufeld,

14:49 devinus: what do you guys think are the coolest clojure libraries being developed right now?

14:49 rkneufeld: ppppaul: one sec

14:50 technomancy: hyPiRion: like you, I always forget the exact invocation

14:50 noncom: lein ring server-headless

14:50 technomancy: it's just a silly default for ring

14:51 maybe a website-specific plugin could assume that, but ring is low-level and shouldn't make assumptions

14:51 ppppaul: shouda put a ring on it

14:51 hyPiRion: yeah, I remembered first time I was going to check if I could access a webpage through ring on my server, and lein ring crashed

14:52 "oh, I'm missing X11 on my server?"

14:54 hiredman: technomancy: the `lein ring` plugin also always aots the whole project https://github.com/weavejester/lein-ring/issues/52

14:54 and needless generates new servlet classes for every project

14:55 blrm: devinus: its not exactly a library, but overtone is pretty awesome

14:55 devinus: blrm: that's the music generation one, right?

14:55 hiredman: pedestal has a single ClojureVarServlet class that you just slot the vars you want in to

14:56 n_b: core.logic is pretty great, probably decidedly less cool to the prolog fans though ;)

14:56 blrm: devinus: yeah, if you wanna see what its capableof, sam aaron did a great presentation on it: http://blip.tv/clojure/sam-aaron-programming-music-with-overtone-5970273

14:56 hiredman: https://github.com/pedestal/pedestal/blob/master/service/java/io/pedestal/servlet/ClojureVarServlet.java but defined in java, which is also gross

15:00 technomancy: hiredman: huh; not seeing that here

15:01 hiredman: technomancy: have you built a war?

15:01 technomancy: no

15:01 I would never do that =)

15:02 hyPiRion: make peace, not war.

15:02 fractastical: overtone was what first got me interested in Clojure

15:02 or at least, was the first thing I used to experiment in Clojure

15:02 unfortunately i could never get it to do the cool things that were in the video

15:02 technomancy: hiredman: the issue says it comes from running `lein ring server` though

15:03 fractastical: undocumented features...

15:04 hiredman: technomancy: try running `lein clean` first

15:04 nope, hmmm

15:04 blrm: fractastical: did you ever use any of the midi mapping features? I've never messed with that part of it

15:04 fractastical: not really, i just went through whatever tutorial there was at the time

15:05 don't even remember exactly what i did anymore, was awhile ago

15:05 a few beeps that sounded a bit like music ;)

15:05 blrm: fractastical: haha :)

15:06 fractastical: is it possible to have a single page clojure web app?

15:06 amalloy: fractastical: just play a bunch more beeps at once, layered over each other, and it's real music

15:06 fractastical: amalloy: yeah, that's what they told me, but it sounded more like a bunch of beeps colliding into each other

15:07 more like the bumper cars of music than a trip to the local philharmonic

15:07 still fun though ;)

15:09 hiredman: technomancy: it looks like lein doesn't print out the "compiling ..." lines when lein-ring creates an uberwar, even though it definitely aot compiles

15:10 technomancy: yeah, I'm just using this to throw together a dummy "500 on every request" app; I don't use it for real projects.

15:16 fractastical: is Midje the preferred way to do testing in a clojure web app?

15:17 ppppaul: no fractastical

15:17 fractastical: is there a preferred way?

15:17 Ember-: clojure test is the preferred way, but midje is great and I like it more

15:17 it all depends on what you like

15:17 try em both, then make your choice

15:18 ppppaul: i don't see midje being more than a renaming of stuff from test. please enlighten me Ember-

15:19 technomancy: midje has a number of questionable design decisions

15:19 start with clojure.test and if you don't like it you can look for alternatives

15:20 fractastical: ok, thx

15:20 Ember-: ppppaul: for example metaconstants, top-down testing and so on

15:20 there is only one thing that *really* bugs me in midje

15:20 and it's the stacktraces

15:20 technomancy: the great thing about clojure.test is that you only have to learn 2 macros and you're good to go. (plus one function if you want to get fancy)

15:20 Ember-: midje f**ks them up in case of an exception

15:20 technomancy: so it's not a big investment

15:21 ppppaul: clojure test also integrates into cat nip

15:21 borkdude: I like clojure.test for its simplicity

15:22 mocking can be done with binding or with-redefs

15:22 amalloy: simplicity is such a strong word, borkdude. i'd say clojure.test has minimalism :P

15:22 technomancy: yeah, most people who think they need midje for mocking just don't know about with-redefs

15:24 borkdude: amalloy ok =)

15:24 hyPiRion: oh man

15:25 with-redefs makes me so angry when I have to write tests or try out code in other languages

15:25 It's too useful

15:25 hiredman: vars are sweet

15:25 technomancy: I wrote with-redefs for ruby when I was young and foolish

15:26 http://technomancy.us/94

15:26 borkdude: technomancy how old are you now? ;)

15:26 technomancy: wow, the formatting on that broke pretty badly

15:26 hiredman: every var is a dependency injection point, which it turns out, having those everywhere is super useful

15:26 technomancy: borkdude: now I'm just foolish.

15:26 hyPiRion: borkdude: still young, not so foolish anymore though

15:26 technomancy: heh

15:26 I'm 29

15:26 hyPiRion: technomancy: hah,

15:26 < 30

15:26 still in your twenties

15:28 hq1: hi, coming from Erlang, what would you say is the best resource to start with Clojure?

15:28 borkdude: hq1 ClojureBook and 4clojure

15:28 pjstadig: functions that call other functions through vars are not pure

15:28 hyPiRion: technomancy: Oh, now I just realized where I stole the CSS for my code blocks for my blog :)

15:29 technomancy: hyPiRion: hah... mine is stolen from htmlize.el

15:29 hq1: borkdude: ty

15:29 hyPiRion: hq1: http://www.clojurebook.com/ is a good one

15:29 hq1: thanks

15:30 hyPiRion: hq1: While you're here, can you tell me about a valuable place to learn OTP properly? :)

15:30 borkdude: technomancy htmlize.el uses css? it's inlined css I think then?

15:30 ppppaul: anyone play with simulant?

15:30 technomancy: borkdude: it is, yeah

15:30 hq1: hyPiRion: LYSE - http://learnyousomeerlang.com/

15:31 hyPiRion: hq1: ah, good to get that confirmed, thanks!

15:31 hq1: hyPiRion: np

15:32 borkdude: hq1 there are some other great clojure books as well: … wtf, my clojure books question on SO got removed: http://stackoverflow.com/questions/2578837/comparing-clojure-books

15:32 hq1: haha

15:32 fractastical: heh, i was searching for that earlier today and got the same removal notice

15:32 Driadan: what's the name for the <- thing? I can't google it :/

15:32 rkneufeld: threading macro?

15:32 clojurebot: macro are macros

15:32 amalloy: $google symbolhound

15:32 lazybot: [SymbolHound: Search Better. Code Better.] http://symbolhound.com/

15:33 borkdude: hq1 it's stll in cache: http://webcache.googleusercontent.com/search?q=cache:onOQFehkNQIJ:stackoverflow.com/questions/2578837/comparing-clojure-books+&cd=3&hl=nl&ct=clnk&gl=nl

15:33 Driadan: thanks :D

15:33 amalloy: borkdude: it's really off-topic for SO. it'd be fine on programmers.stackexchange.com, i imagine

15:33 hq1: borkdude: ah, I think I've been there like year ago or so ;). cool, thanks

15:34 amalloy: though i dunno, maybe it'd be closed as non-constructive there

15:34 borkdude: amalloy maybe, I don't like these categorizations

15:34 hyPiRion: amalloy: wow, thanks

15:34 (inc amalloy)

15:34 lazybot: ⇒ 45

15:34 amalloy: hyPiRion: for what, symbolhound?

15:34 hyPiRion: amalloy: yeah

15:34 rcg: any idea why *ns* evaluates to user when being used after the (ns ...) definition in a .clj file?

15:34 amalloy: they don't index github at all, so i find them pretty useless personally

15:42 pjstadig: rcg: i'm guessing because *ns* is set to your ns during compiling, but when the code is finally loaded and the static initializer for the class runs (which is where the evaluation of *ns* happens) the value of *ns* is back to user

15:43 jamescarr: using the viterbi algorithm to send concurrent network requests?

15:43 rcg: pjstadig, hmm ic

15:43 any idea how to circumvent the issue?

15:44 SegFaultAX: amalloy: Do they only index StackOverflow and the SE network because at least the first page of results from symbolhound was just SO links.

15:44 pjstadig: rcg: i'm not sure exactly what you're trying to accomplish, but ... maybe

15:44 rcg: pjstadig, am trying to write junit style test output into a file named as the namespace

15:45 using a fixture for this, applied with (use-fixtures :once)

15:46 pjstadig: in clojure.test there is a way to hook in and produce different output

15:46 there is a junit XML output, if that's what you're interested in

15:46 but i've heard maybe it isn't perfect

15:47 rcg: pjstadig, no, i already get the junit output via with-junit-outpu

15:47 t

15:47 and i can also write it into a file via a writer

15:47 i just wanted to name the file according to the namespace name automatically

15:47 pjstadig: it seems like decisions about output should be made by the code that is running the tests, not necessarily the tests or fixtures

15:48 rcg: sounds sensible

15:48 pjstadig: there's a look somewhere that is looping namespaces and vars to tests and hooking into that, if you can, would be the place to worry about file names and output formats

15:48 rcg: that would be my next try then

15:48 pjstadig: loop*

15:48 rcg: right

15:52 jcromartie: I am not digging the data migration libs out there

15:53 drift looks better than Lobos

15:53 but I don't want to set up special paths and all that nonsense

15:53 why not just a namespace for migrations?

15:53 instead of a file per migration?

15:59 Driadan: if the file exists, what does the "Exception in thread "main" java.io.FileNotFoundException: Could not locate cloturas/model/schema__init.class or cloturas/model/schema.clj on classpath" could mean?

16:00 $ ls src/cloturas/models/schema.cls does find it

16:01 nDuff: Driadan: err, .cls?

16:01 Driadan: :O

16:01 T_T

16:01 nDuff: Driadan: Driadan and models vs model

16:01 Driadan: thanks

16:01 nDuff: (singular vs plural)

16:02 Driadan: that'll teach me to double check

16:02 supersym: Clojure scares me a bit now and then... is that normal?

16:02 Driadan: mmm the cls was a typo, but the models

16:03 was the problem

16:04 nDuff: supersym: Took a pretty significant while for me to grok it.

16:04 Driadan: supersym, it scares me always ;) I'm fighting against going to any other language I know

16:05 supersym: glad to hear :)

16:07 Driadan: I suppose it's expected, I'm only a couple of weeks into the language, and everything seems alien to me

16:07 fractastical: do people use liberator for serving REST responses? or can you get by fine with simply compojure?

16:07 i'm struggling to figure out exactly how liberator is working

16:08 in general so far with Clojure there are a lot of things I would expect to grok immediately

16:08 supersym: Driadan: I imagine you came here like me because those languages you knew most, if not all to learn

16:08 fractastical: that instead I end up staring at for awhile

16:08 supersym: where is the fun in that

16:08 nDuff: I have my little moments of insight, I consider ending up here and recognizing its awesomeness a case of enlightment :)

16:09 nDuff: Driadan: I spent a few months rereading The Joy of Clojure, a few years playing with the language on and off, and one year actually writing Clojure in production.

16:10 Driadan: It's only about halfway through that year that I'd describe myself as comfortable, and there's a big gap between "comfortable" and mastery yet to traverse.

16:10 wink: there's even a big gap between baby steps and comfortable usage :P

16:11 then again I found the start easier than in other functional languages

16:11 rplaca: technomancy: is there a seattle meetup next Thursday?

16:14 tieTYT: i have a function that I want to wait a random amount of time each time I call it. Do i have to learn about concurrency in clojure to do this?

16:14 hyPiRion: tieTYT: Not really, you can do (Thread/sleep (rand-int some-number))

16:15 ,(Thread/sleep (rand-int 2000))

16:15 clojurebot: nil

16:15 hyPiRion: ,(Thread/sleep (rand-int 2000))

16:15 clojurebot: nil

16:15 supersym: nDuff: thanks for sharing, I can imagine it will take myself about the same time and a lot of wikipedia reading up on the mathematic behind many subjects

16:15 tieTYT: ah so I gotta reach out into java? K

16:15 thanks

16:15 hyPiRion: tieTYT: np

16:15 supersym: my nomenclature fetish will send me right back at those anyway

16:20 Driadan: nDuff at least I know some of the stuff from functional languages, I'd be completely lost otherwise, but i never used it except for small stuff

16:21 trying to build a webpage seems like a big deal right now (since I could do it easily in some other language)

16:21 antares_: Driadan: do you know about http://clojure-doc.org?

16:21 danneu: Driadan: http://clojure-doc.org/articles/tutorials/basic_web_development.html

16:21 supersym: heh

16:22 antares_: Driadan: Web development in Clojure is not really that mature yet, most people (my impression) use Clojure for data processing, stream processing, UI-less services, machine learning, …

16:22 but not Web apps that have to render HTML

16:23 nDuff: antares_: I'd agree that there are still lots of improvements being made, but disagree that it's not in a thoroughly usable state.

16:23 fractastical: antares_ what about serving a rest API?

16:24 danneu: Clojure's basic web stack feels 1:1 with Ruby's Sinatra stack to me (and actually better).

16:24 antares_: fractastical: that is pretty trivial with Compojure and Cheshire

16:24 fractastical: nDuff: I'm in a similar situation right now

16:24 antares_: Cheshire keeps everything in memory though, no?

16:25 antares_: Clojure is my favorite language for HTTP services but I don't have to generate HTML :)

16:25 fractastical: I'm not sure but it is built on top of Jackson

16:25 fractastical: righto

16:25 antares_: which I think has streaming support

16:25 supersym: antares_: true

16:25 dakrone: fractastical: depends on how you use it, it does have streaming support

16:25 fractastical: ok, interesting

16:25 i already hooked up postgres+jdbc to my app

16:25 supersym: atm I just generate static HTML using coffee,stylus,jade,md and docpad on node.js

16:26 danneu: I frankly love generating HTML with Hiccup. It's an ultraterse Haml.

16:26 supersym: many dynamic engines/solutions or 1-page apps blow when its about SEO

16:26 antares_: nDuff: sorry, I did not imply that it's not useable, just that it may be pretty rough around the edges and there are no good conventions yet

16:26 nDuff: *nod*.

16:26 That's fair.

16:26 fractastical: antares_: how much throughput do you have in your HTTP services?

16:26 supersym: basically just kills it and most customers care.. so glad I spent much time perfecting that toolset so I can render pages in no-time because of code-cutting and short-hand notation

16:27 fractastical: I'm a bit worried about high load stuff, haven't seen too much documentation about that floating around

16:27 jcromartie: fractastical: you can test it w

16:27 antares_: fractastical: about 10K with absolutely no tuning with Jetty 7. I bet Jetty 9 is noticeably higher, they did impressive performance work there.

16:28 fractastical: 10K req/sec ?

16:28 supersym: Docpad is really nice and I can easily create many native web stuff with livereload so that works great for me now in terms of productivity

16:28 antares_: this is with some warm-up time and a very straightforward endpoint

16:28 jcromartie: fractastical: with ab or weighttp

16:28 antares_: fractastical: correct

16:28 jcromartie: netty is a real beast if you wanted to make that ork

16:28 make that work

16:29 antares_: fractastical: it highly depends on your concurrency levels, Jetty fairly transparently uses multiple cores

16:29 supersym: I long for the day I master clojure, LT and Clojure are mature and I can develop for web/desktop/? in those, but it will take some time :)

16:29 jcromartie: antares_, fractastical: I will be deploying a web service for up to 300K mobile users soon

16:29 it's Compojure right now

16:29 danneu: supersym: are you trying to build something that's out of your reach or something?

16:29 fractastical: jcromartie: how have you been testing that?

16:29 jcromartie: ab

16:29 antares_: jcromartie: I'm just saying it's a good baseline, ~10K with absolutely no tuning and even more with Jetty upgrade

16:29 jcromartie: yeah

16:30 but I can't get ab to make 10K requests per second

16:30 antares_: if you want 50K/s you will have to tune the hell out of anything

16:30 fractastical: jcromartie: how fast are you?

16:30 antares_: jcromartie: I used two powerful machines and Linux. ab on OS X is badly broken :(

16:30 jcromartie: yeah it is

16:32 fractastical: I honestly have no idea right at the moment… I have made a mess of the API for the moment :P

16:32 fractastical: jcromartie: maybe we can have a longer private discussion then, we are doing something very similar

16:33 a bit in the beginning stages, but i want to make sure we can scale out to >300K users

16:33 Driadan: antares_, danneu thanks, I know both resources, but thanks

16:33 jcromartie: sure! I love the opportunity to bounce ideas off of others

16:34 Driadan: antares_, currently I'm using web development because I have a small project to develop, that way I can start using it to learn

16:36 antares_: Driadan: by all means start with what sounds interesting or relevant to you

16:36 Driadan: but Web development with UI is a relatively weak point for Clojure right now, compared to data processing

16:36 Driadan: It's nothing fancy, mostly crud

16:37 I'm doing it with luminus, following the tutorial and adjusting to my needs, seems good so far

16:37 made me look for a couple of functions, read a lot, and stuff like that

16:37 :)

16:39 danneu: Driadan: are you coming from another language/web stack?

16:39 Driadan: yep

16:39 danneu: Driadan: from where?

16:39 Driadan: mostly python with tornado and flask, but I've had my share of other stuff

16:51 danneu: If your library is expressed in macros that define functions, what's the general way to incorporate docstrings? do i refactor the macros to accept a docstring and then pass it on to the resulting defn?

16:52 rplaca: danneu: the the resulting functions define an API, then yes

16:55 Driadan: time to get some dinner

16:55 see you guys later, have fun :)

16:55 danneu: take it ez

16:57 technomancy: rplaca: yeah, seajure is next week

16:57 pbostrom: hi y'all, I have a two pieces of information that I want to use as map key, a string and an id, e.g. ["abc" 123] and ["abc" 456] would be two different keys, I'm wondering what is the best way, just use the vectors as is, or convert to strings "abc_123", or keywords :abc_123

16:57 I always feel weird when I use anything other than keywords

16:57 antares_: pbostrom: just use a vector

16:59 danneu: if applicable you could create a nested hashmap if "abc" represents the same thing in both of those sample vectors

17:07 pellis: anyone knows what clojure course this is ? https://github.com/dbushenko/clojure_course_task01

17:10 OlegYch: yeah that's by a friend of mine

17:10 asteve: what is the purpose of name?

17:11 SegFaultAX: ,(type (name :foo))

17:11 aaelony: extract "a" from "a

17:11 clojurebot: java.lang.String

17:11 aaelony: :a

17:12 asteve: so it converts a symbol or keyword to a string?

17:12 aaelony: , (name (keyword "a"))

17:12 clojurebot: "a"

17:13 SegFaultAX: asteve: Try (doc name) at your repl.

17:13 asteve: SegFaultAX: I'm reading the clojure doc on it, but I don't understand the purpose

17:14 SegFaultAX: ,(map name [:foo 'foo "foo"])

17:14 clojurebot: ("foo" "foo" "foo")

17:14 SegFaultAX: asteve: ^

17:15 aaelony: asteve: suppose you read in some data that has a :foo key but you want to have "foo" not :foo.

17:18 turbofail: ,(name 'foo/bar)

17:18 clojurebot: "bar"

17:18 turbofail: it gets rid of the namespace too

17:18 ,(str 'foo/bar)

17:18 clojurebot: "foo/bar"

17:25 danneu: i vaguely remember seeing a way to do (doc xyz) but for the clojuredoc (incl examples) as well. but i couldn't seem to google it. am i just making it up?

17:26 TimMc: cdoc

17:26 But I don't know if you need a plugin.

17:26 technomancy: it ships with lein repl but might be made optional soon

17:26 * TimMc shakes fist at apropos

17:27 TimMc: &(apropos 'doc)

17:27 lazybot: java.lang.RuntimeException: Unable to resolve symbol: apropos in this context

17:27 TimMc: &(use 'clojure.repl)

17:27 lazybot: ⇒ nil

17:27 TimMc: &(apropos 'doc)

17:27 lazybot: ⇒ (defdocument document build-doc find-docs doc* find-doc doc doc *clojuredocs-root* doctype javadoc-url *javadoc-base-url*)

17:27 TimMc: ...but what namespace, apropos? What namespace?

17:27 hiredman: ~apropos namespace

17:27 clojurebot: Open Library Author Namespace is a Namespace. (http://www.freebase.com/view//m/04sty07)

17:28 hyPiRion: clojurebot: wat

17:28 clojurebot: For Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888

17:28 TimMc: :-D

17:28 JS-wat

17:28 hyPiRion: oh, thanks

17:28 j-SWAT I suppose.

17:38 jcromartie: I am absolutely loving the in-memory H2 for development and testing

17:38 like, there's literally *nothing* to do to test database operations… they are totally contained to a single connection

17:38 when the last connection closes the in-memory DB is gone

17:40 wink: ugh

17:40 I had huge problems last I tried to use it

17:40 then again, I'm a little java-ecosystem-illiterate

17:47 kwertii: Can nREPL be made to deal with very large returned results nicely, by e.g. truncating them or just not printing them?

17:51 amalloy: kwertii: (do big-computation nil)

17:51 kwertii: amalloy: Yeah…. but sometimes I forget to do that, or something unexpectedly returns something huge …. :/

17:52 is there anything in nrepl-mode, maybe, that will just truncate after the first x characters?

17:56 TimMc: kwertii: You can set *print-length* and friends.

17:56 chawls: does anyone know if cgrand's enlive tutorial is out of date or if hackernews changed their layout? his scrape1/scrape2 examples aren't working for me.

17:56 TimMc: &(apropos "*print")

17:56 lazybot: ⇒ (*print-radix* *print-miser-width* *print-pprint-dispatch* *print-suppress-namespaces* *print-right-margin* *print-pretty* *print-base* *print-level* *print-length* *print-dup* *print-readably* *print-meta*)

17:57 TimMc: Whoa, *print-suppress-namespaces*. Cool. I wonder if that's part of pprint...

17:58 azkane: chawls: i remember having to change the url to https

17:58 amalloy: TimMc: apparently so

17:58 neat

17:59 kwertii: TimMc: Cool. Thanks

17:59 chawls: azkane: that didn't work for me

17:59 kwertii: Can you make nrepl-mode run Clojure code at startup?

18:01 finishingmove: can i write this shorter? (map (fn[x] (* x 2)) '(1 2 3))

18:01 TimMc: Sure, [2 4 6] :-P

18:02 (map #(* 2 %) [1 2 3]) would be reasonable

18:02 SegFaultAX: ,(map #(* 2 %) [1 2 3])

18:02 clojurebot: (2 4 6)

18:02 finishingmove: the anonymous function part

18:02 SegFaultAX: Or even ,(map (partial * 2) [1 2 3])

18:02 finishingmove: hm i see

18:02 SegFaultAX: ,(map (partial * 2) [1 2 3])

18:02 clojurebot: (2 4 6)

18:05 lpetit: Bodil: hi

18:06 finishingmove: ,(map (fn[x] (* x 2)) '(1 2 3))

18:06 clojurebot: (2 4 6)

18:06 finishingmove: hm

18:06 when i write that in LightTable i get something like

18:06 3 3 (2 4 6)

18:06 lpetit: Hello, any CCW (Counterclockwise) user here, using from the beta update site ?

18:09 algernon: finishingmove: the 3 3 are the intermediate params of the fn

18:10 finishingmove: the first 3 is the input param, the second is the x in (* x 2)

18:10 finishingmove: algernon so why just 3 ?

18:11 is it something like when you loop in javascript

18:11 TimMc: It's the last value seen for that binding, presumably.

18:11 algernon: finishingmove: because it displays the last thing going in (it probably queues displaying all, but only shows the latest)

18:11 finishingmove: and then the iterator retains value

18:11 ah

18:11 TimMc: finishingmove: Like that, but intentional, and it's an aspect of Light Table, not Clojure.

18:11 finishingmove: ah i understand

18:17 TimMc: I'm going to use java.nio.charset.CoderMalfunctionError for all my throwable needs from now on.

18:17 because it's probably true

18:18 Has anyone made an illustrated guide to Java exceptions?

18:19 e.g. LinkageError and a picture of a busted linkage on a car

18:19 bosie: i am using vimclojure in vim and i am wondering if there is another plugin that would properly reformat my code?

18:20 Bodil: lpetit: Hi yourself :)

18:20 lpetit: Bodil: Seems like you did an impression today @ DevoxFR, congrats !

18:21 Bodil: lpetit: Thanks, it was a good crowd. :)

18:21 lpetit: Bodil: Seems like it was all yours even before beginning :-p

18:23 Bodil: lpetit: I guess there was a bit of hype up front. :)

18:23 lpetit: Bodil: Will we see you at Mix It ?

18:23 Bodil: lpetit: No, wish I could go, but I'm organising three conferences in Oslo around that time...

18:24 lpetit: Bodil: Wow

18:26 Bodil: Good luck then, organizing & all. Save some time for Catnip, tho!

18:26 antares_: Bodil: looking forward to "what every hipster needs to know about organizing a conference"

18:27 Bodil: lpetit: Thanks. Don't worry, I've promised too many people paredit in Catnip to let it just sit there now...

18:28 antares_: I can do that in one slide - "find other people to do the boring stuff." :)

18:29 lpetit: Bodil: yeah, but nobody like you does find the right picture to illustrate it ;) /cc antares_

18:29 Ok, enough flattery, and it's alsy time to rest a little bit, good bye all ;)

18:30 * Bodil agrees.

18:30 Bodil: nn!

18:31 hyPiRion: TimMc: You should see what I did in a project once. Every single method was a void, and I passed values around by extending Throwable

18:32 TimMc: hyPiRion: You should see what C did once. There were no exceptions, so it passed around error conditions as return values. :-P

18:32 hyPiRion: You know, I should probably keep all these insane projects for myself. At this pace noone would hire me if I lose my current job.

18:32 TimMc: Which is worse?

18:32 amalloy: TimMc: c'mon, that's a totally viable approach. it's how haskell does it

18:32 TimMc: heh!

18:32 amalloy: there's just...much nicer machinery to deal with it

18:32 hyPiRion: Monads man

18:33 Well, the idea was to jump several steps on the stack to avoid handle special cases

18:33 amalloy: hyPiRion: worst superhero name ever?

18:33 hyPiRion: Monads, man*

18:34 antares_: Bodil: yeah but tell it me with ponies

18:48 lpetit: New #Counterclockwise Beta with paredit slurp / barf & Leiningen (2.1.1) Integrated Command Line: https://groups.google.com/d/msg/clojuredev-users/8ay-3eterYA/YMzXoBqA1eoJ

18:48 hyPiRion: lpetit: Oh, "bad timing"

18:49 Leiningen 2.1.2 was just released

18:49 but sweet

18:49 technomancy: the curse of everyone choosing Thursday as their open source hack day

18:49 lpetit: hyPiRion: Ah ! :-) Anyway, it's just a beta, will roll out a new one in a few days

18:50 rplaca: technomancy: is there a seattle meetup next Thursday?

18:50 lpetit: I would not have had time to test CCW integration with Leiningen 2.1.2 anyway

18:50 hyPiRion: I suspect it's more due to Easter, unless you guys don't have holidays

18:50 lpetit: just bugfixes, actually

18:51 technomancy: rplaca: for the third time, yes =)

18:51 lpetit: hyPiRion: Yeah, and one or two internal API changes as well, he ;)

18:51 rplaca: technomancy: sorry, I didn't see your answer so I thought you didn't see my question :)

18:51 hyPiRion: lpetit: ah, yeah, I suspect it's a bit more critical for CCW

18:51 technomancy: must be a pretty unstable connection =)

18:51 hyPiRion: ,(repeat 3 'yes)

18:51 clojurebot: (yes yes yes)

18:52 rplaca: technomancy: looks like I'll be in town - I'll try to join up

18:52 lpetit: technomancy, hyPiRion : I was able of the risk, no regret :-)

18:52 technomancy: rplaca: cool. this one will be down in the pioneer square location.

18:52 lpetit: I already said that 1/2 hour earlier, good bye all, cu

18:53 moredogmeat: hello

18:53 rplaca: technomancy: that's perfect since that's where I'll be working

18:53 moredogmeat: does anyone know how to get rid of #<core$read_line clojure.core$read_line@4e68e6bf> when I use read-line?

18:53 technomancy: rplaca: it's a fun part of town

18:53 as long as you don't have to park down there

18:54 rplaca: technomancy: it is - I've been wandering in and out of there the past 8 months or so

18:54 technomancy: oh yeah, with the consulting gig; nice

18:54 rplaca: an easy trip from SF with the light rail and all

18:54 well, barring client crisis, I'll see you then

18:57 technomancy: cool

18:58 moredogmeat: hello, sorry, is this the correct channel for asking clojure questions?

18:59 hyPiRion: moredogmeat: it is indeed the correct channel to ask clojure questions, yes :)

18:59 supersym: :D

19:00 moredogmeat: cool thanks, I have a somewhat "stupid" question: :)

19:00 I'm using read-line but I keep on getting #<core$read_line clojure.core$read_line@4e68e6bf> when I run the program

19:00 how do I get rid of it?

19:01 I'm using something like (loop [line read-line]

19:01 hyPiRion: moredogmeat: ah, that's the problem

19:01 read-line is a function, and in Clojure, you can return functions

19:01 ,read-line

19:01 clojurebot: #<core$read_line clojure.core$read_line@18ef813>

19:01 hyPiRion: but if you call it

19:01 ,(read-line) ; (will crash here)

19:01 clojurebot: Execution Timed Out

19:02 nfisher: Sorry to interrupt what's the best way to run a test suite in the repl?

19:02 moredogmeat: I thought loop [line read-line] is similar to (let [line read-line]) no?

19:02 nfisher: (or individual test set)

19:02 TimMc: (sh/sh "lein" "test") :-P

19:02 nfisher: haha TimMc thanks! :P

19:02 hyPiRion: moredogmeat: yes, but here's the thing, you don't call the function, you just return it

19:03 See the difference here:

19:03 ,+

19:03 clojurebot: #<core$_PLUS_ clojure.core$_PLUS_@13a55c>

19:03 hyPiRion: ,(+ 1 2)

19:03 clojurebot: 3

19:03 nfisher: TimMc I have a (run-tests 'etl.core-test)

19:03 moredogmeat: nod hyPiRion

19:03 nfisher: at the bottom of my test but, I suspect that isn't the best of ideas.

19:03 brb

19:04 hyPiRion: moredogmeat: What you'd like is most likely (loop [line (read-line)] ...

19:04 moredogmeat: what's the idiomatic way to use read-line to process user input until I either Ctrl-D or say 'q'?

19:04 TimMc: nfisher: I've never tried. You're trying to test new code in the repl?

19:04 moredogmeat: oh ok thanks hyPiRion

19:05 woot, you are right! thank you

19:05 nfisher: TimMc yeah I've been writing unit tests.

19:05 To verify it parses correctly

19:06 Driadan: hi

19:06 hyPiRion: moredogmeat: no problem :)

19:37 jcromartie: bleh, people PMing me to ask me to to homework for them

19:37 muhoo: jcromartie: O_o

19:37 jcromartie: "homework"

19:38 there's one guy who asks for JavaScript help once in a while but now he's just like "hey can you do this too: ..."

19:38 muhoo: who has homework in javascript?

19:39 cdh473: "homework"

19:39 jcromartie: I don't mind looking at something and giving comments or a little refactoring

19:39 give a man a fish, and all that

19:51 bytechunky: is there a way to undo the effects of 'def'?

19:52 bbloom: bytechunky: ##(doc ns-unmap)

19:52 lazybot: java.lang.SecurityException: You tripped the alarm! ns-unmap is bad!

19:52 bbloom: (doc ns-unmap)

19:52 clojurebot: "([ns sym]); Removes the mappings for the symbol from the namespace."

19:52 bytechunky: ah very good. thanks

19:57 i am having trouble trying to obtain an AST of a form from a source file

19:58 (i am using clojure.tools.analyzer)

20:05 * st3fan happy with his first more serious clojure app

20:06 st3fan: you can see it in action at

20:08 bytechunky: @st3fan: what does it do? showing subway information?

20:10 st3fan: bytechunky: streetcars :)

20:10 it talks to the nextbus.com api to get predictions for routes

20:11 Raynes: I wish LA buses had GPS. :(

20:11 bytechunky: st3fan: so i guess this is live data of ... departure times?

20:11 jcromartie: nice

20:11 amalloy: Raynes: they don't?

20:11 Driadan: good night

20:12 Raynes: amalloy: If they do they don't report to anything I've tried on my phone or laptop. They give estimates based on when they're supposed to run.

20:12 Which is more or less entirely useless because of traffic.

20:12 st3fan: Raynes: there is a mention of LA on http://www.nextbus.com/predictor/agencySelector.jsp#California-Northern

20:12 oh estimates suck, you really want gps yes

20:13 Raynes: wat

20:13 st3fan: bytechunky: the code is at https://github.com/st3fan/clj-transit .. i'm cleaning it up now and writing some insturctions on hwo to get it going

20:13 Raynes: st3fan: Well, this says METRO buses have this technology.

20:14 So either this technology is always wrong, or...

20:14 st3fan: give it a try on the nextbus site . maybe it works better than you think :)

20:15 Raynes: st3fan: http://www.smartrideapp.com/ is what I've been using, and I assumed it pulled from nextbus.

20:15 I'll see about getting something that explicitly mentions nextbus.

20:16 st3fan: yeah it probably does

20:16 i'm working on a mobile app too, that uses your current position to find the nearest stops

20:16 * Raynes gets iNextBus.

20:16 Raynes: I'll try it tonight.

20:16 On my way home.

20:17 st3fan: The one I was using does that. I think all of them do.

20:17 I've used at least 2 apps on the iPhone that detect nearby stops.

20:17 st3fan: yeah i know there are plenty .. i'm just doing it to learn some new technologies

20:17 Raynes: Oh, I wasn't dismissing your project.

20:17 st3fan: my target is Firefox OS

20:18 Raynes: Are you using clj-transit to do this?

20:18 st3fan: yup

20:18 clj-transit is what runs on

20:18 Raynes: Cooool

20:20 st3fan: that app just uses predefined stops but i actually also load all the routes and stop positions into a geo db so that i can find stops nearby (the nextbus api does not do that)

20:20 it has been a good clojure intro project :)

20:21 Raynes: Ahhhhhh! XML!

20:22 * Raynes http://tf2chan.net/dis/src/129470155772.jpg

20:22 st3fan: yeah :-(

20:22 i'm looking at ways to make the xml parsing code better .. i'm not super proud of it

20:23 cornotahti: Raynes: I had a nightmare that you hated me

20:23 You don't really ate me do you.

20:23 cdh473: anyone here start programming with clojure as a first language?

20:24 st3fan: cdh473: i envy you :)

20:24 cdh473: st3fan: you shouldn't, i started with batch

20:24 st3fan: oh ok haha

20:24 cdh473: st3fan: i'm experimenting with the idea of teaching it as a first language, clojure, and so far it has been extremely successful

20:24 st3fan: yeah i can't see why that would not work

20:25 see SICP

20:25 cdh473: indeed

20:25 i would have taught scheme, were it more "relevant"

20:25 cornotahti: Scheme is probably better as a first language.

20:25 hyPiRion: cdh473: There was this guy who did it, he was on the channel for about 2 months ago I think.

20:26 cornotahti: The point about teaching people good languages as a first language is that even though they program well, they aren't like 'omfg, cheme is so elegant' when they first encounter it, they are like 'wtf, ava is fucking nonsenstical garbage' when they first encunter it

20:26 hyPiRion: I think he had the usual "startup" issues related to any programming language, but extrapolating anything useful out of one datapoint is always scary.

20:26 cdh473: cornotahti: i agree, yet i would like to at least experiment with it

20:27 cornotahti: Nothing wrong with experimenting on human beings that way, I'm teaching my barely speaking daughter higher maths to see if I can breed a maths super genius

20:27 cdh473: lol

20:27 i hope that's sarcastic

20:27 cornotahti: They say you can breed a super genius just by exposing them to a specialized subject early on because brain will wire itself to accomodate that ubject then

20:27 No it's not.

20:27 IT's been done before.

20:27 TErrance Tao was such an experiment, as were the Pólgár sisters

20:28 hyPiRion: oh, there was this psychologist doing the same with chess to his sisters?

20:28 cdh473: wouldn't it end up damaging other cognitive development?

20:28 hyPiRion: *daughters

20:28 supersym: lol

20:28 cornotahti: hyPiRion: well, he wasn't a psychologist, he was a chess player

20:28 st3fan: cornotahti: wat what age can i teach my daughter clojure you think? (she is 3 weeks now :)

20:28 cornotahti: They are basically the three best female chess players by a vast margin now. The youngest one in particular.

20:28 supersym: I plan to teach my gfs little neice

20:28 cornotahti: I assume talking is on the first order of business.

20:29 supersym: I was thinking to slip in TuxMath :)

20:29 st3fan: hehe yeah

20:29 hyPiRion: cornotahti: ah

20:29 cdh473: maybe i should implant a C64 into the mother's womb

20:29 cornotahti: The theory is that human beings can accomplish such vastly complex feats like walking upright talking, recognizing faces purely because they were introduced to it at a young age.

20:29 hyPiRion: Close enough :)

20:29 cornotahti: If you look at it objectively, speaking a language surely is harder than advanced maths.

20:29 amalloy: st3fan: get her some parenthesis pillows today

20:29 supersym: no it isnt

20:30 cdh473: cornotahti: depending on how the brain develops, yes. yes it is.

20:30 supersym: kids see language not like we do

20:30 cornotahti: Tell that to AI programmers

20:30 supersym: to them, they are streams of words

20:30 cdh473: supersym: because they have been around it

20:30 supersym: if they grow up around advanced math, they will accomodate that better

20:31 cornotahti: It's a lot harder to make a program that outputs coherent sentences of ENglish than a program that outputs coherent maths.

20:31 The grammatical rules for English are vastly more complicated

20:31 supersym: yea and the path has been paved... there is a reason to the order of subjects in math

20:31 hyPiRion: cornotahti: speaking a language is harder than advanced math?

20:31 cornotahti: Well, the rules of any natural language are infinitely more complex.

20:31 hyPiRion: cornotahti: What is more likely, that a PhD in maths manage to do a masters in French or vice versa?

20:32 cornotahti: The only reason we can actually do it is because our brains were wired to it from an early age is the theory. Basically if a kid that is 9 year old is only accustomed to the concept of language then, they can't even develop a native language.

20:32 supersym: the rules may be a bit more complex, but given a vocabulary of about 2500 words you can express any concept

20:32 cornotahti: They can master little more tan a chimp

20:32 supersym: and it becomes harder to distinguish if someone "masters" a language

20:33 the thing is,...kids dont "think" about language too much

20:33 cdh473: supersym: a child can either develop the language portion of the brain during the critical period, or be without full development in that area forever.

20:33 cornotahti: supersym: okay, say I give you this ultimatum, you will either write a program that checks if a formal mathematical proof is correct or not or if an English sentence is, and I will shoot you if there are false positives or negatives.

20:33 supersym: and both calculus and language are parts of the entire package in education... but say extra-curricular scholarship in the secrets of math is bound to help anyone

20:33 cornotahti: Wat would you choose?

20:34 I'd go with the proof checker myelf, much easier.

20:34 For one, they already exist, language checkers not so much

20:34 cdh473: likewise, a child can develop natural math abilities early-on, or not.

20:34 by the time the child gets into schooling, it's already too late

20:34 most of that part of the brain is already formed if it's going to be

20:34 supersym: thats not the point :)

20:34 cornotahti: Yeah

20:34 THat _is_ the point

20:35 That kid's brains are wired towards language becaue they were accustomed to it from an early age.

20:35 And if they don't, then they can't even learn a native language later.

20:35 After a certain age, people lose the capacity to learn a language by imitation only.

20:35 cdh473: they can't even learn it the way a native english speaker learns spanish

20:35 they don't have anything to relate the words to

20:36 supersym: but its more or less done now and we can build on the work of others... but with math, you have to understand, like really understand the basics to get any further... while language is greatly a subconcious process I think... not many people think in mathematical terms

20:36 cdh473: err... not enough

20:36 cornotahti: I mean, babies teach themselves to speak fluent English simply from watching it around them while they do't even have another language to compareit with, how sick is that

20:36 supersym: perhaps a few rainmen here and there

20:36 cornotahti: No one explains it to them

20:36 supersym: http://www.cruxbot.com/

20:36 cdh473: supersym: part of the problem with math is that the english language does not allow natural math discussion and thought

20:36 cornotahti: supersym: you don't ave to understand it if you get taught at an early age is the theory.

20:37 Same with the polgar sisters

20:37 cdh473: there are languages more accustomed to math discussion

20:37 cornotahti: THey all claim they play chess on an intuitive level, they don't really understand what they are doing either and have a hard time explaining what they are doing

20:37 cdh473: and you'll notice that the children there have greater capacity for learning math

20:37 supersym: cdh473: true i guess :)

20:37 i see

20:37 cornotahti: They don't actually consciously think about it because they acquired it from such an early age it becomes second nature, like chess, or addition of numbers.

20:38 Like ehh, know the Pirahã tribe in South AMerica?

20:38 Which famously does not have a concept of numbers

20:38 You cannot teach the adults to even count to 4.

20:38 cdh473: i'd like to see someone do that with Go

20:38 cornotahti: But the kids, just fine

20:38 cdh473: as opposed to chess

20:39 another interesting thing to do would be to teach math to children using finger binary

20:39 cornotahti: You know people have learnt something early enough when they can't explain why it is so, they just know it si.

20:39 Like ask a 7 year old what 8+3 is, they will say 11, they cannot explain why though.

20:39 amalloy: can we move this to #babychessprodigies? if someone has a clojure question it will get lost in this stream

20:39 cornotahti: They certainly do not need to understand it, as in apply peano arithmetics, to arrive at 11.

20:40 amalloy: if you give me a cuddle.

20:40 cdh473: lol, #babychessprodigies

20:42 i should point out that i'm actually teaching the subject clojurescript rather than clojure, may be a difference there

20:43 i just can't bear to see anyone have to use javascript ;)

20:43 supersym: clj, cljs all the same in that respect :P

20:44 cdh473: yeah I never liked it from aesthetical perspective, so I often just use coffee but implicit is often something you'd want to avoid

20:45 and thats the same problem with cljs for that matter: if other people have to work with it, it needs to be readable

20:45 cdh473: perhaps he will have an easier time then, coming from such a background

20:45 supersym: shame so few people eventually end up with lisp-like languages in that respect that it holds back the potential in community development

20:46 definitly

20:46 cdh473: i have a feeling haskell may catch up to clojure eventually, where clojure excels, but something about it feels off

20:47 i have faith clojure will succeed more than previous lisps, due largely to the fact that it's so widely usable

20:47 it is literally the java of lisps :P

20:50 I saw a text editor for clojure a while back, but I can't remember the name of it. It reminded me a bit of sublime text, anyone know what it might have been?

20:53 supersym: dunno... I use LightTable

20:53 almost exclusively now

20:53 cdh473: that looks like it. oooooh yes.

20:53 thanks.

20:53 supersym: :)

20:54 <3 instarepl feedback + doc

20:54 cdh473: holy sweet jesus, this is fantastic

20:55 supersym: now thats about what I think every time... that and "how could we have missed this"

20:55 truth is, of course as often, things with emacs had already evolved in that direction

20:56 you might want to take a peek at github.com/overtone/emacs-live

20:56 same guy

20:56 cdh473: i just can't get myself to use emacs anymore

20:57 supersym: there are 2 lighttables btw

20:57 playground (on github) and that from the website

20:57 ted_: I am new to clojure. I am working with Korma and h2. When I insert a record a record, I get {:SCOPE_IDENTITY() 1} as the result. How do I get the number out of there?

20:57 cdh473: supersym: is it stable?

20:58 supersym: they are really a bit different in the sense that, I believe, the lighttable-playground is to get structured feedback+metrics on

20:58 its pre-alpha but very workable already...stable yes

20:58 never crashed with me but it runs on chrome

20:58 and that has been giving me problems with flash on linux lately...

20:59 freeze etc.. but fixed now, its still as stable as chromium is

20:59 dynamically linked chromium packed with clojure(script), jquery and a few node.js modules

21:00 then hook any java/lein project you want...the repl can connect to it

21:00 tieTYT: i'm sort of into testing

21:00 cdh473: supersym: what if i want to use CLR?

21:00 tieTYT: i know in ruby you don't really need DI frameworks because you can just open up a dependency and replace it's new() method. Can clojure do things like this?

21:01 like i'm writing this program that uses an http client. I'd like to test it without actually hitting the web

21:01 supersym: people have done it,..with .net

21:02 i believe one of the visualstudio core developers is a frequent visitor here and used it with CLR/.NET

21:02 not sure who it was tho

21:02 st3fan: i really like lighttable but i got frustrated by its limited functionality atm

21:02 supersym: or you ment LightTable itself, that is language agnostic

21:03 or supposed to become tho

21:03 st3fan: also the instarepl turned out to be not that useful for more complex things

21:03 cdh473: does the repl let you call functions defined in your program?

21:03 st3fan: yes

21:03 or change those functions

21:03 cdh473: sweet

21:04 st3fan: the repl is one of the best things in clojure imo

21:04 but you might need some time to get used to that style of coding

21:05 s/style/way/

21:05 cdh473: i am

21:05 st3fan: i'm trying to turn my app into a .war now, so that i can drop it in tomcat

21:08 supersym: true

21:08 large projects, I found visual studio to be a dream

21:08 much better than eclipse

21:09 but it becomes a pain, all the options, when you want to focus

21:09 20 windows dont help

21:09 cdh473: yeah

21:09 i'm a big C# guy myself

21:10 originally coming from java, i found VS really nice

21:10 supersym: like you have writer mode for text editors, I like the repl for 'larger' snippet works, but either it would become a full fledged IDE, or someone/thing else would fill that neice eventually... fact is that this kind of IDE are complex beasts

21:10 and it takes a $$$ company or tons of ppl to get it done

21:10 I bet

21:11 cdh473: which is why you focus on 1 language

21:11 http://www.codinghorror.com/blog/2005/01/its-the-ide-dummy.html

21:11 supersym: and some plugins really make it even better where they left off, and I only worked with VS2010, 2012 is supposed to be even better

21:12 cdh473: it is.

21:13 supersym: good topic there cdh473..thanks

21:13 cdh473: :3

21:14 supersym: i find it a bit dualistic in nature tho

21:14 i worked so hard to rid myself of windows, mouse, went to a tiling window manager (now xmonad)

21:15 only to go back to x, y GUI

21:16 although the alternatives arent great either

21:17 cdh473: indeed

21:17 supersym: ideally a code editor would distinguish between any programming language, and the (literate) text that goes with it

21:18 but emacs/babel/org-mode I think has everything you'd need on that level...its the plugins/generators of a IDE that really add value to it

21:20 often I found it to be a delicate balance between cleaness, readability and expressiveness e.g. you have to explicitly tell emacs babel what code is in the blocks, (implying it is near impossible and undesirable) but you can make it run anything that has an interpreter

21:22 there is only so much you should want to cut away

21:23 but back to the IDE though, I found also after seeing it all and ending up here, that a lot of stuff I did in the .NET environment, to be either added weight

21:23 or easily done with any basic UNIX tool since a lot of it were repeating patterns of stuff

21:24 imho...intellisense and VS like tools make for dumber programmers

21:24 cdh473: or people who can work without an internet connection :P

21:25 (yes, it was a jest)

21:25 supersym: :)

21:26 regardless how you take it, everything has atleast a certain amount of learning curve

21:27 just once you been through many programs and code often enough, you get better and faster at it..looking up information.

21:27 It helps if you know how/where to look...

21:28 then again I get why only a small amount of web programmers actually "get" the DOM

21:28 those w3org documents are unreadable :P

21:29 cdh473: client-side web programmers don't even count :P

21:29 most of the time, anyways

21:29 supersym: a good question is if you have to "get it"...you can work with it without understanding too much and html is friendly, forgiving of mistakes

21:30 haha :)

21:30 yeah ur right

21:30 st3fan: wow travis-ci is awesome .. https://travis-ci.org/st3fan/clj-transit

21:30 took 2 minutes to setup .. really cool

21:31 hyPiRion: st3fan: yeah, it's very Clojure friendly

21:31 cdh473: i feel like html is a terrible language now for the purpose it serves

21:31 supersym: anyway they are tradeoffs as well, the hypertext languages are designed like that for a reason too, not always, with enough common sense but also loose rules because the whole world will have to comply (or not if they dont feel like it) and then there is Microsoft/IE

21:31 MikeSeth: anybody here who is a nrepl wizard? I am looking at bencode responses I get and I am not sure if I am missing something

21:31 supersym: good thing they choose Java for clj

21:32 cdh473: supersym: i did an html/css replacement based on s-expressions

21:33 supersym: :)

21:34 I make my money atm as front-end development mostly...I just nearly perfected my code-cutting skills at it so Clojure like that is a next logical step

21:34 cdh473: that, and whitespace syntax (only as sugar, of course) and a few other features like hierarchical style sheets and advanced types for markup elements

21:34 supersym: yeah mixed feelings on significant whitespaces

21:35 cdh473: it's entirely optional

21:35 MikeSeth: obligatory python joke

21:35 supersym: and thats really great

21:35 everything is optional, so its up to the programmer to understand what to do when

21:35 st3fan: hyPiRion: do you know if it is possible to see nice test overviews in travis?

21:35 cdh473: the elements were represented as they are in the DOM

21:36 supersym: it involves some 'thinking' about it though and fact is, a lot more web developers feel comfortable with JS probably also because the web is literally crowded with examples to cut and paste

21:36 cdh473: for instance, instead of doing <p id="foo" class="bar"></p>

21:36 you just did [p#foo.bar]

21:36 oh, it has no closing tags either ;)

21:36 supersym: ppl tend to be lazy or build on work of others which is a good thing.. but past it? I dont see a web without HTML/JS at the moment,

21:37 :P

21:37 cdh473: no, it compiles to html/css

21:37 very cleanly, in fact

21:37 supersym: yeah

21:38 so thats to it then... and which is why cljs is such as well,...a stage where nearly everything and anything can (trans)compile to JS

21:38 and its good I guess, a tad too verbose for me but it works

21:39 cdh473: i thought the cool thing was how well the styling language was the same as the markup language; that was an accident that it came out so seamless

21:39 supersym: :)

21:39 cdh473: http://cdh473.com/vanguard/standard.php if you are interested

21:40 supersym: cool

21:40 interesting

21:41 cdh473: (still not done with it due to school)

21:41 supersym: I've been thinking about these things as well lately

21:43 hyPiRion: st3fan: hmm, well, I think the interface is okay-ish, albeit a bit laggy at times

21:43 You could probably hit up the docs and check it out though

21:44 cdh473: http://snipt.org/zhfjf3

21:44 ToBeReplaced: what's the right way to compare two maps to see if they have the same keys? (= (set (keys m1)) (set (keys m2)))?

21:44 cdh473: that was a comparison between a snippet of vanguard and CSS

21:47 hyPiRion: ToBeReplaced: keys perhaps?

21:48 ,(= (keys {:a 1 :b 2}) (keys {:a 3 :b 6}))

21:48 clojurebot: true

21:48 hyPiRion: waittt

21:48 ,(keys {:a 1 :b 2})

21:48 clojurebot: (:a :b)

21:49 hyPiRion: Do something like (-> {:a 1 :b 2} keys set) instead, and compare those

21:49 oh wait

21:49 I'll go to bed, ignore me.

21:50 ToBeReplaced: :) i was wondering if there was something more idiomatic or efficient... i have a sequence of maps, and i want to guarantee as i iterate through that they all have the same keys

21:51 hyPiRion: ToBeReplaced: So you need to check that all have the same set of keys?

21:52 You could probably compare the map sizes first, that's constant time

21:52 (the size lookup)

21:55 tomoj: (= (.keySet a) (.keySet b)) ?

21:55 looks to be ~6x faster than (comp set keys)

21:56 ..on a big map

21:57 hyPiRion: (and (= (count a) (count b)) (every? #(contains? b %) (keys a))) should be fast too

21:58 supersym: cool

22:02 I need a bit of help too if only pointers

22:03 cdh473: on what?

22:03 supersym: I work on a board game we play here in the Netherlands called trictrac, its played on a backgammon board

22:03 two players working in oposite directions towards eachother

22:03 4x6 pigeonholes

22:05 since its only two players with 15 game pieces each, and 6x4 slots, I figured I could use pos and neg integers where field is -5 to +5 because each player can have a max of 5 pieces on a slot/field

22:05 I was just wondering about the datatype to use for the playing field, a array or list

22:06 I have 2-dices (rand int) and with the outcome you can move the pieces forward and hit someone when they only have 1 piece inside a slot

22:07 cdh473: well if the playing field is a constant size, i'd use an array

22:08 supersym: ok and 4x6 or 24 one-dimension?

22:08 ToBeReplaced: tomoj: hyperion: thanks

22:09 tomoj: hyperion's answer is better

22:09 supersym: because there are rules like: you can only move to the second section of 6 slots once all pieces are in play, you can only move to the last section once every piece is out of the begin section

22:10 cdh473: what advantages do arrays give you?

22:10 (asking you to self-evaluate)

22:10 supersym: I guess one is easier and just neglect any outside its range that is limited in dynamcs

22:10 cdh473: then, what advantages does a list give you?

22:10 oops

22:10 supersym: good question :P

22:10 cdh473: disregard that

22:11 or not

22:11 supersym: I'm not sure :)

22:11 cdh473: i am too tired lol

22:11 supersym: well same here and I could be overthinking tho

22:12 I geuss the board is its state to persist and it can be a sequence of integers in a element range -5 to 5 with 24 slots and take peek/pops

22:12 that would be a lispy way I guess... yeah its mostly learning to think in the clojure/lisp way of doing things now

22:15 yeah same here being tired and I should know these things ... or refactor later.. premature optimization anyway

22:18 cdh473: indeed

22:19 dnolen: supersym: I would use a vector

22:21 tyler: in datomic im running a query and it throwing an error on IllegalStateException Attempting to call unbound fn: #'clojure.core/mapv

22:21 tieTYT2: i've read about the clojure concurrency support, but it didn't explain how the separate threads get started. Do I just start them myself with the Thread class?

22:21 tyler: its mapv a function in clojure.core?

22:21 or is it some how 'monkey patched', please excuse my ignorance

22:24 dnolen: tieTYT: that's one way yes. you could also use an agent or a future too.

22:25 tyler: hrm now its throwing it when i try to start repl, maybe i got a bug somewhere

22:26 oh had that query run on require

22:26 so same error

22:26 tieTYT2: an agent would be for a slow task to do asynchronously that you don't care about, right?

22:28 dnolen: tieTYT2: I think agents are really about uncoordinated changes.

22:31 MikeSeth: is lein's cli repl a full implementation of nrepl client? can I e.g. switch repl sessions in it?

22:32 supersym: this is more or less the problem I've been playing with and the answer is vectors

22:38 supersym: I knew it

22:38 should have trusted my gut feeling

22:38 thanks :)

22:39 ivan: MikeSeth: yes, it uses reply which is an nREPL client

22:45 tieTYT2: http://stackoverflow.com/questions/15696574/does-clojure-need-dependency-injection-to-make-code-more-testable

22:46 hyPiRion: tieTYT2: with-redefs

22:47 Not sure if I can do this in the clojurebot repl, but an attempt

22:47 tieTYT2: let me google that

22:49 ha the examples there show my case

22:50 thanks

22:51 hyPiRion: ,(with-redefs [class (constantly :what)] (class {1 2 3 4}))

22:51 clojurebot: :what

22:53 tieTYT2: ha

22:57 supersym: can struct keys be any data type?

22:58 it doesnt seem to like a range, Java heap exception after a while

22:58 dnolen: supersym: best to avoid structs, deprecated

22:58 supersym: great.. thanks

22:59 I guess a protocol would be a suitable replacement?

22:59 dnolen: supersym: maps work just as well, and the keys can be arbitrary

22:59 supersym: ah ok

23:00 amalloy: well, (range) is still not a good key for a hashmap :P

23:00 supersym: true

23:00 it was a very naive writedown of something :P

23:09 xumingmingv: a silly question: why *clojure-version* is declared as a dynamic binding? what's the purpose?

23:18 tyler: i have a datastructure that looks like (([foo] [foo] [foo])([foo] [foo])) how do i turn it into ([foo] [foo] [foo] [foo] [foo] [foo]) ?

23:18 `arrdem: ,(doc concat)

23:18 clojurebot: "([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."

23:18 tyler: `arrdem: thnx

23:20 ,(concat '(([] [] [])([] [])))

23:20 clojurebot: (([] [] []) ([] []))

23:20 tyler: ...

23:21 `arrdem: ,(apply concat '(([] [] [])([] [])))

23:21 clojurebot: ([] [] [] [] [])

23:21 tyler: ahh

23:21 good ol apply

23:21 thnx

23:22 * `arrdem disengages pro bad answer dodging skillz and goes back to fixing sad

23:24 supersym: ,(+ (rand-int 6) 1)

23:24 clojurebot: 5

23:24 supersym: would that be proper use or mess up the (pseudo) 'randomization' :)

23:27 i dunno why i ask/look at these things... i never do that :S guess it seems a bit hacky but I couldn't think of another way to get random 1-6 values :P

23:28 `arrdem: how is that hacky? that's obvious...

23:28 take a distribution and shift it by a constant into your desired range

23:29 supersym: haha ok... so thats just me still uncomfortable with prefix notation

23:29 yeah it seems valid :D

23:29 `arrdem: I mean I could be picky and demand that you use (inc) rather than (+ 1)..

23:30 supersym: right ;)

23:31 `arrdem: (def integer (conc (opt sign) integer)) yeah that'll work -_-

23:31 supersym: that looks a lot cleaner anyway

23:32 `arrdem: inc? yeah usually does.

23:32 tieTYT2: what is rich hickey's stance on automated testing? I've gathered he doesn't like TDD, but I haven't heard him say anything else

23:32 supersym: yup.. see didnt know that function but should have guessed there would be one

23:33 `arrdem: yeah other lisps call it things like 1+...

23:33 don't think it's +1 anywhere tho.

23:33 supersym: lol

23:33 `arrdem: clojurebot: +1 is ,(doc inc)

23:33 clojurebot: You don't have to tell me twice.

23:34 `arrdem: ~+1

23:34 clojurebot: +1 is ,(doc inc)

23:34 `arrdem: close enough.

23:34 supersym: *grin*

23:35 thm_prover: Is there a variant of cons that owrks with with the maybe monad? i.e. I want somethign which takes a list of Maybe's, and drops the Nothings, and takes the value out of the Justs

23:36 tieTYT2: clojure has a maybe and a monad?

23:39 dnolen: tieTYT: it does not

23:40 thm_prover: dnolen: https://github.com/clojure/algo.monads

23:40 dnolen: thm_prover: well, as a lib sure

23:40 thm_prover: dnolen: patched match yet? :-)

23:41 dnolen: thm_prover: nope, waiting for you to send me a fix ;)

23:41 tieTYT2: this is weird. Hard for me to see the advantage without static typing

23:41 dnolen: tieTYT2: monads are a control abstraction, static types make them a bit easier to work w/

23:41 thm_prover: dnolen: unlikely, my copy of "The Book of Shen" just arrived today

23:42 dnolen: thm_prover: hehe, fun

23:42 thm_prover: I feel like if we could merge Rich Hickey's ability to create practical language with Mark Tarver's ability to create powerful languges, I'd be happy.

23:45 http://hpaste.org/84800 <-- I want to know how to write this piece of code as a domonad

23:45 supersym: ok I should rarely use lists,...vectors are for random access, assoc-in is what I seeked. Getting the hang of it :)

23:51 tyler: I have something that looks like (["tyler" 23] ["tyler" 34] ["don" 64]["don" 82]) how to i translate to (["tyler" [23 34]] ["don" [64 82]])

23:52 s/how to/how do/

23:52 `arrdem: ,(doc group-by)

23:52 clojurebot: "([f coll]); Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll."

23:52 tyler: `arrdem: thanks

23:52 supersym: ,(assoc [0 0 0 0 0 0] 0 0 1 0 1 0)

23:52 clojurebot: [0 0 0 0 0 ...]

23:53 supersym: why doesnt that work though

23:54 metellus: supersym: what do you expect from it?

23:54 supersym: these are pidgeon hold/counters

23:54 vector [0 0 1 0 1 0]

23:55 *hole

23:55 metellus: ,(doc assoc)

23:55 clojurebot: "([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)."

23:55 metellus: it's treating 0 0 1 0 1 0 as pairs of index, new value

23:55 so it's putting 0 at index 0, then 0 at index 1, then 0 at index 1

23:56 supersym: ahhh

23:56 i see

23:56 metellus: ,(assoc [0 0 0 0 0 0] 3 1)

23:56 clojurebot: [0 0 0 1 0 ...]

23:56 supersym: i have them mixed up

23:57 ,(assoc [0 0 0 0 0 0] 3 1 5 1)

23:57 clojurebot: [0 0 0 1 0 ...]

23:57 supersym: thanks

23:59 tyler: ,(group-by first '(["tyler" 23] ["tyler" 34] ["don" 64]["don" 82]))

23:59 clojurebot: {"tyler" [["tyler" 23] ["tyler" 34]], "don" [["don" 64] ["don" 82]]}

23:59 tyler: heh

23:59 technomancy: tyler: you could use merge-with too

Logging service provided by n01se.net