#clojure log - Oct 03 2012

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

0:00 casion: "IllegalArgumentException No matching field found: getInputStream for class java.util.zip.ZipFile "

0:00 akhudek: jcrza: Eclipse and IntelliJ both have decent clojure support.

0:00 technomancy: jcrza: counterclockwise is generally considered the top contender for IDEs

0:00 casion: that is just insanely confusing of an error message

0:01 jcrza: Sweet, thanks :)

0:01 technomancy: Sgeo: reasonable enough

0:01 akhudek: jcrza: counterclockwise is eclipse

0:01 or rather a plugin

0:01 arrdem: srsly? counterclockwise over Vimclojure or SLIME?

0:01 casion: arrdem: on windows?

0:01 * arrdem backs down

0:02 arrdem: yeah... I'm trying to get Cygwin set up for that but it isn't looking good

0:03 akhudek: arrdem: cygwin isn't worth the trouble. If you want unix that much, just run a vm. :/

0:03 arrdem: akhudek: right now I'

0:03 m just using it to SSH to real unix machines... it's even bad at that T_T

0:04 akhudek: haha, it is, putty is the goto on windows I think

0:05 jcrza: Putty is the best.

0:08 xeqi: counterclockwise has leiningen integration and uses nrepl and is contributed to by the nrepl maintainer, seems top tier to me

0:19 Sgeo: What thread do watchers (as in, fns placed by add-watch) run in?

0:40 amalloy: Sgeo: unspecified

0:45 Sgeo: With Aleph HTTP server, how does Ring middleware interact with handlers that are synchronous but have async bodies?

0:48 arohner: amalloy: is it? I thought the docstring was clear that ref watchers would run synchronously, after the ref commits

0:48 but it's in the thread pool, i.e. unspecified, for agents

0:56 amalloy: &(doc add-watch)

0:56 lazybot: ⇒ "([reference key fn]); Alpha - subject to change. Adds a watch function to an agent/atom/var/ref reference. The watch fn must be a fn of 4 args: a key, the reference, its old-state, its new-state. Whenever the reference's state might have been changed, any regis... https://www.refheap.com/paste/5461

0:58 amalloy: arohner: i think that's probably how it's implemented, but "synchronously" does not imply "on the current thread"

0:59 eg, imagine there's a worker thread that handles calling all the watch functions, to make sure you only interact with the gui on a single thread. if you give him that work to do, and then wait for him to finish, it's still synchronous

0:59 arohner: amalloy: sure. but 'synchronously, after the ref commits, before anything else commits' strongly implies it. Your only other alternative is 'on another thread, but it blocks the original thread while things run on an alternative thread'

1:00 amalloy: it definitely does not say "before anything else commits"

1:00 which would be an impossible contract anyway

1:01 arohner: you're right. I should have said, before anything else sends

1:01 amalloy: not even that. just, before sends queued by the current transaction send

1:02 (dotimes [_ 2] (add-watch r (fn [& args] (send a inc))))

1:02 can't help but allow those sends through, i think; although i'm not sure on that

1:08 francis: 21:54 <amalloy> arohner: i think that's probably how it's implemented, but "synchronously" does not imply "on the current thread"

1:57 Sgeo: Is there a way to remove all watchers from a ...... mutable item (not sure what the formal Cloure name is) without knowing the keys?

2:05 muhoo: is there some way to specify a bunch of forms to run whenever an nrepl connection starts up to an existing process?

2:06 :profiles {:repl {:injections }} doesn't work

2:11 BrainBacon: Will someone help me become more familiar with vimclojure?

2:45 Sgeo: Is there a significant difference between using Aleph solely for the ability to put a channel in the body and just using an InputStream for the body in regular Ring with Jetty?

2:49 cark: aleph does not do ssl

2:49 which is annoying, because i really like it otherwise

2:54 Sgeo: Uh, other than the fact that implementing my own InputStreams might be painful :

2:54 :/

2:54 Would it likely be

2:54 Whereas I can just enqueue with Aleph, I'd need to ... make a lazy InputStream somehow

2:54 :/

2:55 Wait, are InputStreams as bodies allowed to block in Jetty? Is that a bad idea/

2:55 cark: can't be that hard =P

3:03 why do you need a lazy output for your web app ?

3:03 doing some kind of a commet thingie ?

3:03 comet*

3:04 Sgeo: cark, yes

3:04 cark: nice, this is something that has been missing from the clojure ecosystem

3:05 (as far as i know)

3:05 Sgeo: :/

3:06 cark: the top would be a library that does websockets ond falls back to comet style when not available

3:06 on the client side and server side

3:12 ForSpareParts: Would anybody be able to take a quick look at my code? I'm starting my first big Clojure project, and I'd appreciate any comments on my coding style or direction...

3:12 https://gist.github.com/3825501

3:15 cark: the whole property-map business seems fishy to me

3:16 looks like you're trying to do OO

3:16 Sgeo: Why doesn't Aleph do SSL?

3:17 cark: Sgeo: maintainer does not want to have to maintain it

3:17 Sgeo: the ssl part i mean

3:17 Sgeo: tho it seems like it's not too hard to add that by directly using the underlying whatitsname library

3:19 ForSpareParts: cark: you're probably right -- what would be a better, more clojure-y way to do it?

3:21 Sgeo: Would it be a bad idea for me to rely on .getWatches?

3:21 cark: move could be directly working on any structur which has x and y properties

3:21 then you can make a behaviour like this #(move 10 0 %)

3:22 to apply several behaviours : (reduce apply-behaviour initial-item behaviours)

3:23 apply behaviour woudl be (fn [result behaviour] (behaviour item))

3:23 apply behaviour woudl be (fn [result behaviour] (behaviour result))

3:24 so that makes (reduce #(%2 %1) initial-item behaviours)

3:25 see what i mean ?

3:25 ForSpareParts: cark: trying to. Functional newbie, here.

3:26 cark: also in clojure you seldom need to use actual lists

3:26 ForSpareParts: Are you saying that move would be a function that gets applied directly to a structure with an x/y?

3:26 cark: right

3:26 ForSpareParts: And it would return the subset of the map that changed?

3:27 ivan: Sgeo: seen clj-browserchannel? writing a Comet thing is harder than it looks given dropped/re-ordered HTTP requests. and many other things.

3:27 cark: (defn move [x y target] (-> target (update-in [:x] #(+ % x)) (update-in [:y] #(+ % y))))

3:28 Sgeo: ivan, is that production ready?

3:28 ivan: no idea. but the author says he uses it in production on one site.

3:29 * ivan should port his BrowserChannel replacement to Clojure

3:29 ForSpareParts: cark: Thanks! I'm going to study that until it makes sense. Might be back with more questions.

3:30 ivan: at least the client side of BrowserChannel is definitely production ready

3:30 cark: ok =)

3:30 Sgeo: Is there a way to use clj-browserchannel without ClojureScript, as in, just Javascript on the client-side?

3:31 ivan: I would assume so. All of BrowserChannel is in Closure Library, and there's no cljs in its repo

3:31 cark: ForSpareParts: getproperty already exists (get-in state [:ball :position :x))

3:31 Sgeo: Is Google Closure a compiler?

3:31 :/

3:32 ivan: Closure Compiler is a compiler

3:32 Closure Library is a huge pile of JavaScript

3:32 cark: i'd say it's a gloryfied minifier =P

3:32 Sgeo: Ah, ok

3:33 ivan: a minifier with tree-shaking and an advanced type system ;)

3:33 cark: yeah it's at the boundary betwenn minifier and compiler =P

3:33 ForSpareParts: cark: Good to know! Also glad to learn about the arrow (had seen it, but hadn't looked it up until just now) and update=in, which I suspect does something I spent a bunch of time trying to figure out how to do.

3:34 cark: ForSpareParts: great =)

3:37 ForSpareParts: tho my sample usage of update-in was kinda wrong

3:37 (defn move [x y target] (-> target (update-in [:x] + x) (update-in [:y] + y)))

3:37 that's better !

3:54 kral: namaste

4:17 josteink: oooh

4:17 https://github.com/weavejester/lein-beanstalk

4:17 this makes me want to try out creating a clojure web app of sorts

4:17 (and AWS elastic beanstalk)

4:18 what's the recommended clojure framework/library for web development these days?

4:24 cark: i personally use ring, add a couple libraries, and build most stuff myself around it

4:25 once you've got the web server, everything else is actually rather easy, not much need for frameworks

4:26 except maybe for routing, but i rolled my own for that too

4:26 *request routing

4:28 mjc: there's also compojure and noir, which are built on top of ring

4:28 cark: compojure does the routing, it's not too bad !

5:05 wingy: is there any benefit for using "get map key" rather than "map key" or "key map" ?

5:06 cark: (key map) works only with keyword keys

5:06 but returns nil when map is nil

5:06 wingy: so then its "get map key" vs "map key"

5:07 cark: ,(get nil :blah)

5:07 clojurebot: nil

5:07 cark: (nil :blah)

5:07 ,(nil :blah)

5:07 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0)>

5:07 wingy: i c

5:07 cark: (get {} :a :not-found)

5:07 ,(get {} :a :not-found)

5:07 clojurebot: :not-found

5:08 wingy: ,({} :a :not-found)

5:08 clojurebot: :not-found

5:08 wingy: :)

5:08 cark: wingy: i didn't know that one !

5:08 =P

5:08 wingy: new feature i guess

5:08 ,(get nil :not-found)

5:08 clojurebot: nil

5:09 wingy: ,(get nil :hey :not-found)

5:09 clojurebot: :not-found

5:09 cark: i usually do (:key map)

5:09 wingy: ok seems like "get" is safer .. also good since then "get-in" makes sense

5:10 man i love clj

5:10 never js again

6:22 how do you loop a map to get the key and value?

6:22 for each element

6:28 josteink: mjc & cark: thanks. input noted

6:30 algernon: wingy: (map (fn [[key value]] (do-stuff key value)) (seq hash-map)) ? ; probably not the best way, though

6:30 wingy: http://stackoverflow.com/questions/6685916/how-to-iterate-over-map-keys-and-values

6:30 read about this

6:31 the answer seems logical

6:35 (doseq [keyval map] (prn (second keyval)))

6:40 it seems not working since doseq is returning nil

6:40 a

6:41 i need something that returns the expression body since im using it for hiccup

6:41 how do i loop a map in hiccup returning an element that is using the key/value pairs for each iteration

6:43 (for [keyvalue (seq {:name "foo" :age 23})] keyvalue)

6:44 (for [keyvalue {:name "foo" :age 23}] keyvalue)

6:44 wow .. how come no one mentions this

6:45 worked like a charm

6:52 cark: ,(seq {:name "blah" :age 40})

6:52 clojurebot: ([:age 40] [:name "blah"])

7:04 augustl: is it possible to (apply some-macro a-list) to call (some-macro list-item-1 list-item-2)?

7:05 cark: your list is a literal list ?

7:06 remember that macros can't look inside a run-time list

7:07 augustl: cark: it's a run-time list

7:08 cark: then it's not possible

7:08 augustl: writing a function that takes a list and ends up calling weavejester.github.com/compojure/compojure.core.html#var-context which is a macro

7:08 I guess I have to write a macro instead of a function

7:09 and it's not actually a run-time list now that I think about it

7:09 cark: i think there must be an underlying functional interface to these macros

7:09 augustl: all the functions are unfortunately private

7:09 cark: well if it's not, then you can unroll it

7:11 but i have to ask, how do you have a list bound to a name while not being a run time list

7:11 augustl: I'm writing it as a macro now

7:12 wingy: today is the day i make a decision using ApiGee App Services or Datomic

7:12 cark: if it's inside a macro then you could `(some-macro ~@my-list)

7:12 wingy: Datomic fits clojure and is cooler but ApiGee App Services is a BAAS

7:13 handling deployment and everything .. if anyone has some inputs please share

7:14 cark: have you considered heroku ?

7:14 wingy: cark: yeah heroku is PAAS .. apigee is BAAS

7:14 a level abobe PAAS

7:15 but even if i choose ApiGee i still need Heroku to serve my app

7:15 cark: hum what is baas ?

7:15 wingy: i used the wrong word .. ApiGee isn't doing deployment .. i just meant that i don't have to care for their backend (softwares).. you just use their HTTP API

7:16 backend as a service .. PAAS is you saying "i want this and that software" BAAS is you saying "create new user…save this user"

7:16 IAAS handles hardware for you … PAAS handles software for you .. BAAS handles data for you

7:17 pretty cool

7:17 cark: oh i see

7:17 wingy: but if i use Datomic i stay closer clojure .. which i like

7:17 have a look at ApiGee app services, Kinvey, Parse and Stackmob

7:18 an emerging trend .. pretty new but already growing rapidly

7:25 sundbp: anyone recognize this error message trying to use ritz-swank 0.5.0 from emacs24: "Symbol's value as variable is void: slime-ritz"

7:26 cmiles74: sundbp: That looks like maybe the slime-ritz mode isn't actually loading.

7:27 sundbp: cmiles74: i'd agree. it's listed as an installed package by package manager though.

7:29 cmiles74: hmm.. i seem to just have gotten it working. reinstalled packages

7:30 cmiles74: sundbp: I've had el-get install stuff, but it doesn't actually show up until I restart Emacs. Not all packages, just some of them.

7:30 sundp: :-)

7:31 sundbp: cmiles74: not sure i did anything more than reinstall. perhaps restarted emacs. not sure

7:36 cmiles74: i do however get an error "5 slime-media-4e750cb9.el:1:1:Error: Cannot open load file: slime-repl"

7:52 Cheiron_: Hi, any libs to mock objects in clojure?

7:56 sundbp: cmiles74: false alarm, was missing slime-repl package. all sorted now

7:56 ifesdjeen: hi guys, does anyone know how to avoid Reflection Warnings when using thrush (->) operator?

7:56 I'm using type hints, setting explicit type, but that doesn't really help

8:04 cemerick: ifesdjeen: pastebin, please?

8:04 ifesdjeen: sec

8:09 cemerick: https://gist.github.com/3826589 here it is

8:09 first example is project-specific, below one is generic

8:31 cemerick: ifesdjeen: so, the ArrayList examples don't work as you'd expect, because .add returns a boolean, not the List

8:32 You're looking for (doto (ArrayList.) (.add 3) …) in that case

8:32 ifesdjeen: ah, true

8:32 that makes perfect sense

8:33 thank you cemerick

8:33 cemerick: I suspect the same applies to the Column example, since the methods are .setXXX

8:33 ifesdjeen: yup, most likely that is the error

9:41 Cheiron_: Hi, how to add this dependency to project.clj?

9:43 http://mvnrepository.com/artifact/org.mockito/mockito-all/1.9.0

9:43 how to add http://mvnrepository.com/artifact/org.mockito/mockito-all/1.9.0 as a dependency to project.clj?

9:44 andrewmcveigh: Cheiron: [org.mockito/mockito-all "1.9.0"] should do it

9:49 Cheiron_: andrewmcveigh: thanks!

10:05 _wingy: what does sound data model mean in datomic?

10:09 chouser: probably some combination of immutable, composable, good equality semantics.

10:23 jcromartie: dang, I feel stupid… I've been using (in-ns 'foo.bar) instead of (ns foo.bar) in the REPL all this time?

10:23 all of those wasted keystrokes! I'm sure they add up to almost as much as I just typed here to whine about it!

10:24 casion: jcromartie: you don't use autocomplete or something like that?

10:24 jcromartie: casion: oh snap, now you're making me feel really bad

10:25 casion: I just hit i-tab, '<first-letter or two> tab

10:25 jcromartie: What's i-tab?

10:25 In swank-clojure it's C-c M-p

10:25 casion: the character i, follow by tab which completes to "(in-ns "

10:26 jcromartie: ah ha

10:26 slick

10:26 casion: n completes to something else first

10:26 BeLucid: I want to not start my web server when I run my project in the repl... is there a test for if your running from lein repl or not?

10:26 casion: so I just use in-ns since it always is first on the list for i

10:27 jcromartie: I assume you use emacs, it's worth checking out ac-nrepl

10:27 jcromartie: hm

10:27 ToBeReplaced: at http://clojure.org/namespaces it tells you to use in-ns instead of ns

10:29 jcromartie: ToBeReplaced: I think that means for creating new namesakes at the repl, no?

10:29 or does it really mean for switching namespaces

10:29 I mean in-ns makes sense

10:29 ToBeReplaced: i have no idea; i struggle to understand the difference

10:29 i just noticed that i was always using in-ns as well, and was wondering why when at a high level ns seems simpler

10:30 jcromartie: I'm also surprised that clojure.repl is not use'd by default in the user namespace

10:30 it used to be, no?

10:30 doc, source, etc.

10:30 hm, well looks like doc is there but not source

10:30 weird

10:33 ToBeReplaced: do you know the difference between in-ns and ns?

10:34 oh i get it;

10:35 if you use ns, there are additional implieds like using clojure.core... with in-ns, you don't get that, you only get the mappings defined in the namespace

10:37 Cheiron_: hi, why this (Mockito/mock TupleImpl.class) is generating CompilerException java.lang.ClassNotFoundException ?

10:38 even (Mockito/mock String.class) is throwing the same exception

10:38 jkkramer: Cheiron_: you don't need .class. Just use String or TupleImpl

10:39 Cheiron_: jkkramer: oh true!

10:43 How to write this in clojure? Mockito.verify(service).commit() ?

10:45 never mind ..

10:58 mefesto: I've been using nrepl and notice that sometimes while working in a nrepl session that usage of *1, *2, ... doesn't seem consistent. For example, I'll evaluate something then do `(def x *1)` but find that x is nil instead of the value i expected. Has anyone else noticed this?

10:58 it happens randomly

10:59 ok it happens always now :)

10:59 eval 1 then immediately afterwards (def x *1)

11:00 ToBeReplaced: mefesto: that works for me in nREPL... (eval 1), then (def x *1), then x prints 1

11:01 mefesto: hmmm im using nrepl-jack-in from emacs, you?

11:01 wjlroe: Does anyone know how to 'recompile' a def in a library you've used? (emacs/slime)

11:02 ToBeReplaced: mefesto: lein repl from my project

11:02 mefesto: ToBeReplaced: that works for me too

11:02 I guess my issue is specific to emacs

11:03 ToBeReplaced: mefesto: i don't have an emacs setup, so i can't help there... gl

11:36 uroborus_labs: So I like seesaw, but is there a way to create desktop based applications using html5? Or some sort of clojure/webkit setup?

11:37 Where I am going with this is that I really like the Light Table Ui, but not sure the best way to go about creating a desktop app.

11:38 From what little information is on the Light Table blog, it sounds like he is using Noir and built the app using a client/servr type model

11:39 wjlroe: uroborus_labs: I looked into that myself - took apart the light table jar, but I can't find anything for building webkit apps easily unfortunately. Also, on Linux and Windows, Light Table just opens in chrome, so it appears there isn't an easy way to encapsulate webkit for a frontend

11:39 uroborus_labs: Ahh, I have only tested it on OSX, wasn't aware that it was a chrome app on osx and linux.

11:39 Hmm...

11:39 wjlroe: yeah it's all pretty standard web server stuff in Light Table, with lots of ClojureScript

11:39 cark: i think there is a webkit widget in swt

11:40 wjlroe: you ideally want the full V8 and all that jazz

11:40 uroborus_labs: I might just be better off sticking with seesaw for what I want to do then...

11:40 hiredman: javafx has a webview that is webkit

11:40 cark: hiredman: mhh nice

11:40 is it possible to script it from java ?

11:40 hiredman: sure

11:41 cark: mhh

11:41 is it portable to windows ?

11:41 hiredman: http://docs.oracle.com/javafx/2/webview/jfxpub-webview.htm

11:42 * uroborus_labs is reading hiredman's link

11:42 hiredman: http://www.a1o1.com/java-fx20-embedding-webview-in-swing

11:42 etc

11:42 uroborus_labs: It seems possible to do well...

11:42 cark: hiredman: awesome thanks a lot

11:43 hiredman: the main thing is you need java 7+, and you need to specifically put the javafx jar on the classpath

11:43 wjlroe: pooh, this is worth playing with

11:43 I mean ooh

11:43 not pooh

11:43 uroborus_labs: lol

11:45 wjlroe: The reason I looked into this was for my Ludum Dare entry http://www.ludumdare.com/compo/ludum-dare-24/?action=preview&uid=14189 which is ClojureScript and wanted to distribute it as if it was an app

11:45 cark: well that's a whole new thing with lots of implications ...

12:09 technomancy: IIRC the java7 backport of javafx isn't licensed for redistribution

12:10 hiredman: technomancy: is it a backport?

12:10 technomancy: surely you mean the java6 backport

12:11 technomancy: hiredman: well I mean as distinct from the javafx that will ship with java8

12:13 hiredman: technomancy: http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#10

12:15 technomancy: hiredman: I believe "subject to the terms and conditions of the license" means "you have to make the user click through a EULA" and thus it can't be distributed via a proper repository.

12:15 "JavaFX is available under the same license and business model as Java SE" <- same reason oracle's JRE is no longer available via apt, etc.

12:16 wjlroe: oh. Oracle FTW

12:16 SegFaultAX|work: For the wanking?

12:16 wjlroe: you decide

12:17 SegFaultAX|work: Its got a nice ring to it. :)

12:18 pipeline: technomancy: not exactly

12:18 oracle's JRE is unavailable via apt

12:18 because java used to be available only under a VERY SMALL set of restrictions

12:19 so Sun worked with open source distributors to come up with a magic special snowflake license

12:19 JUST FOR a handful of linux distributions

12:19 when openjdk came out, with a 99.9% complete java under a truly open free unencumbered license

12:19 oracle shitcanned the special snowflake license

12:19 and that was perfectly reasonable to do, since it had outlived its usefulness

12:19 technomancy: pipeline: sure, I'm just saying whatever reasons prevent Oracle's JDK from being available via apt apparently also apply to JavaFX

12:20 I agree that redistributing Oracle's JDK via apt doesn't make sense when you can just use OpenJDK

12:20 pipeline: yeah

12:20 and that's true

12:20 but not a super helpful statement without context

12:21 (and, like the jdk, there is a javafx project licensed under gpl)

12:21 technomancy: oh, now that I did not know. interesting.

12:21 wjlroe: I wonder - all the people using the JVM and automated orchestration of servers, do they all use the OpenJDK?

12:22 technomancy: wjlroe: pretty much

12:22 pipeline: technomancy: it's not nearly as active because outside vendors have a lot less reason to care. e.g. no redhat interest

12:23 technomancy: wjlroe: we use openjdk at heroku. we only recently have started to get people asking for Oracle JDK since we've started pushing "heroku for enterprises" where people are more interested in the brand name than the actual functionality.

12:23 cark: i've redone the domonad macro ... should i keep lispy and have (<- id (slget db-next-id)) or haskellish and have (id <- (slget db-next-id)) ?

12:23 both a clear enough when reading the code

12:23 wjlroe: technomancy: oh interesting. You corrected detected I was actually asking about Heroku

12:24 technomancy: hehe

12:24 cark: technomancy: are you implying that openjdk is functionally equivalent or even better than oracle jdk ?

12:24 wjlroe: technomancy: we use the OracleJDK, but I'm not entirely sure why. In the projects I work on, it's Clojure apps anyway

12:25 technomancy: http://enterprise.heroku.com/ <- the set of people who ask for oracle is a subset of the people who want to contact a sales representative to get started with heroku instead of just installing the command-line client and creating apps themselves =)

12:26 wjlroe: technomancy: heh. Reasonable right? "git push heroku". No wait. Where's the release form?

12:26 technomancy: cark: last I heard (~3 years ago) there were a handful of differences in the codebase surrounding font rendering engines in gui apps due to patent concerns, but for server-side code IME they are completely indistinguishable apart from licensing.

12:27 TimMc: "process manifold"

12:27 you're killing me

12:27 cark: technomancy: there is the thing, there is a world outside the server-side

12:27 wjlroe: technomancy: I would have thought lack of Safe Harbour would be a bigger concern to people than the enterprisey things

12:27 cark: tho java isn't very well suited for it

12:28 technomancy: TimMc: "I've reversed the polarity of the neutron flow; it should reduce the strain on the process manifold until we can get the ship's accelerator to push us into hyperspace!!!"

12:28 TimMc: s/hyperspace/IPO/

12:29 technomancy: cark: sure, understood. I don't know if the font rendering issue is still present in openjdk7; that's just the last time I heard about there being any appreciable difference.

12:30 cark: technomancy: i should maybe check openjdk ... though it's always trouble and doesn't make my code grow any faster =P

12:32 technomancy: back when we were stuck on oracle JDK we would have to manually plop some jars into the JDK dir because they neutered the strength of their crypto algorithms in order to comply with mid-90s US trade export laws =\

12:32 ("we" in this case not being heroku)

12:33 wjlroe: I remember those days

12:33 used to be a problem with all free software

12:34 technomancy: go USA!

12:34 wjlroe: yeah, that was super effective

12:35 _wingy: a fn body can consist of multiple forms right? just that the former ones have to have side effects

12:36 wjlroe: technomancy: as much as I love the graphics on your enterprise.heroku.com I feel it needs a geek.heroku.com with emacs screen grabs instead of eclipse ;)

12:36 "Full stack Clojure"

12:37 technomancy: wjlroe: actually internally we refer to the teams as "Hacker languages" and "Enterprise languages" =)

12:37 wjlroe: haha

12:40 Does anyone know of a good Clojure style guide? I'm tired of thinking

12:42 hiredman: ~library

12:42 clojurebot: library is "Our class libraries have destroyed our brains." - rhickey

12:44 jcrossley3: wjlroe: http://dev.clojure.org/display/design/Library+Coding+Standards

12:45 wjlroe: jcrossley3: oh thanks!

12:53 Cheiron: Hi, in Mockito, how to code this in clojure? Mockito.verfiy(mock).doSomething() ?

12:53 hiredman: ~mock

12:53 clojurebot: Excuse me?

12:54 hiredman: clojurebot: objects?

12:54 clojurebot: Equal Rights for Functional Objects is Baker's paper on equality and why it's impossible to define sensible equality in the presence of mutable data structures: http://www.pipeline.com/~hbaker1/ObjectIdentity.html

12:54 hiredman: clojurebot: mock objects?

12:54 clojurebot: Your mock object is a joke; that object is mocking you. For needing it. -- rhickey

12:55 goracio: hello there :)

12:55 Cheiron: here is my attempt: http://pastie.org/4903462

12:56 technomancy: Cheiron: just wrap the method call in a function and use with-redefs

12:56 wjlroe: +1 with-redefs … also https://github.com/marick/Midje

12:56 Cheiron: may i ask for pastie ? i'm sorry to ask

12:56 technomancy: mockito is just a complicated workaround for shortcomings in the java programming language

12:57 goracio: question - is there any func for this : if element exist in vector ?

12:57 Cheiron: with midje i can do things similar to mockito?

12:57 technomancy: Cheiron: no need for a fancy library: (let [p (promise)] (with-redefs [mocked-fn #(deliver p %)] (do-stuff)) (is (= :expected-value @p)))

12:59 goracio: so for example [1 2 3] i want to know if there is 3 in this vector - maybe there is some heplful func ?

12:59 technomancy: ,(some #{3} [1 2 3])

12:59 clojurebot: 3

12:59 wjlroe: beat me to it

13:00 it still irritates me that you can't use contains? for this

13:00 but chest la vie

13:00 technomancy: contains? is a long-troll

13:00 wjlroe: c'est la vie .. I mean

13:00 Cheiron: technomancy: i'm sorry but i don't understand the line you posted :( sorry to ask

13:01 wjlroe: technomancy: you mean the authors of contains? are trolling us? heh

13:01 technomancy: Cheiron: it redefines the mocked function to be a function that just delivers to a promise. then you check the value of the promise to see that it received what you expected.

13:02 wjlroe: yup

13:02 wjlroe: how else do you explain the fact that it hasn't been renamed to has-key? and contains? left around as a deprecated alias?

13:03 contains? exists solely to trick newcomers into thinking about big-o notation

13:03 wjlroe: technomancy: yeah. also confusingly you can use it to test for set membership. but not vector membership. war.

13:03 s/war/wat/

13:04 cemerick: technomancy: long troll ~= waging war on everything Sequential

13:05 I don't think it's a coincidence that clojure.set includes a bunch of relational operations, etc.

13:06 not that anyone uses them

13:06 hiredman: cemerick: and people reimplement it

13:07 https://github.com/danlarkin/subrosa/blob/master/src/subrosa/database.clj

13:07 danlarkin: yeah but mine is totally sweet

13:07 wjlroe: ahaha

13:08 cemerick: hiredman: incompletely, I 'spose

13:08 ;-)

13:09 pjstadig: every sufficiently large irc server has a incomplete, bug-ridden, implementation of half of clojure.set

13:09 jcrossley3: cemerick: default port for nrepl? 7888?

13:10 cemerick: jcrossley3: That's the one I've been eyeballing

13:10 Cheiron: Hi, would you please have a look at this: http://pastie.org/4903537 i'm trying to mock

13:10 cemerick: ~mock

13:10 clojurebot: Excuse me?

13:10 cemerick: no rhickey mock quote?

13:10 danlarkin: pshhhhhhhh subrosa's database is distinct from clojure.set

13:10 technomancy: Cheiron: you can't redef a method, only a var

13:11 wjlroe: we totally haven't seen a rich hickey mock quote for 5 whole minutes

13:11 cemerick: oh, did I miss the fun?

13:11 one of my favorites

13:11 wjlroe: :)

13:12 Cheiron: technomancy: i'm sorry but this is an advanced topic to me. i appreciate your time but how to fix it? thanks a lot

13:12 technomancy: Cheiron: you need to wrap the method call you want to mock in a defn

13:13 joegallo_: (defn to-string [s] (.toString s))

13:13 for instance

13:13 and then you can redef that

13:14 Cheiron: technomancy: you mean wrap it in the vector of with-redefs bindings or with-redefs body?

13:15 joegallo_: ok , will try this, thanks

13:19 Frozenlock: Weird... I can't seem to require this ring middleware https://github.com/amalloy/ring-gzip-middleware

13:19 Cheiron: joegallo_: any idea ? http://pastie.org/4903585

13:19 wjlroe: Frozenlock: gist/paste?

13:20 joegallo_: Cheiron: on line 7, you should be calling (get-string ...) not (.getString ...), for starters.

13:21 but the problem you have is that you're calling the TupleImpl constructor wrong.

13:21 Frozenlock: well I added it in my project dependencies [amalloy/ring-gzip-middleware "0.1.2"]. "Lein deps" Then in my REPL I try (use 'ring.middleware.gzip) but it says it's not on my classpath.

13:21 joegallo_: hence the illegalargumentexception

13:21 Frozenlock: On wait, do I need to re-start the REPL?

13:22 joegallo_: In this case, I'm guessing that you mean "... (TupleImpl. 0))" not "... (TupleImpl.) 0)"

13:22 Cheiron: joegallo_: the problem is TupleImpl takes a lot of params that are heavy to create https://github.com/nathanmarz/storm/blob/master/src/jvm/backtype/storm/tuple/TupleImpl.java i only want to mock the behavior of .getString

13:23 that is why i was trying to use Mockito

13:23 cemerick: Frozenlock: Yes, you need to restart the REPL after adding a dependency, unless you want to try your luck with e.g. pomegranate

13:23 joegallo_: Cheiron: okay, i guess, but the point is that you're trying to call a constructor that doesn't exist.

13:23 Cheiron: yes true

13:25 joegallo_: in this case i have to fallback to something like jmock or mockito?

13:26 joegallo_: sounds reasonable, given my highly limited view of the issue you're having

14:05 wingy: if Mac OS X was using functional programming instead of OOP would it be more stable?

14:06 wjlroe: only if functional programming is magical pixie dust

14:06 cark: it is !

14:06 emezeske: wingy: What, you mean, like, the kernel? Or libc? Or other parts of userspace?

14:06 wjlroe: then yes

14:06 wingy: emezeske: not something specific .. was just wondering

14:07 emezeske: wingy: Well, your question is impossible to answer

14:07 wingy: saw a video from 1990 when steve jobs said they are using OOP in NEXT to make softwares faster

14:07 productivity gain by 10 times faster

14:07 emezeske: wingy: To my knowledge, nobody has written a day-to-day-usable kernel in a functional language

14:08 wingy: would be cool if there was an operating system in FP heavily promoting it

14:08 datomic is a cool initiative

14:08 nDuff: ...

14:08 cmiles74: wingy: I think they're talking about the productivity of NeXT engineers working on the product, not the product itself.

14:08 emezeske: wingy: There are functional kernels out there

14:09 wingy: cmiles74: yeah i know

14:09 FP is so cool and simple

14:09 nDuff: ...

14:09 wingy: nDuff: what do you mean by ...

14:09 cmiles74: I'm not sure it follows that more productive engineers necessarily produce a more stable product. I mean, OOP prolly didn't make them better; mostly just more productive.

14:10 wingy: yepp

14:10 cark: i think the typical fp programmer is not very interested with bit twidling, so not many are trying

14:10 emezeske: wingy: FP is not a panacea

14:10 nDuff: wingy: It's hard to come up to anything to say that isn't going to devolve into a much larger discussion.

14:10 wingy: Many of the pieces of FP that actually apply to OS kernels are already practiced in the design of message-passing microkernels.

14:10 wingy: ...some pieces simply don't apply by nature -- working with hardware means mutating things, by design.

14:11 wingy: ...but it's a discussion that would need to happen with more grounding -- if you're asking the question at this level, it means you don't have enough background to discuss it.

14:11 wingy: i dont .. i was just curious

14:12 emezeske: wingy: The answer to your original question is: nobody has a clue, because nobody has rewritten OS X in a functional language.

14:12 wingy: yeah

14:15 goracio: @wingy

14:15 :wingy

14:15 wingy: goracio: yeah?

14:16 goracio: wingy:

14:16 trying to insert your name :)

14:16 wingy: using iPad? :)

14:16 goracio: Xchat ubuntu

14:16 wjlroe: wingy: the closest OS I can think of, although a research project, is Coyotos, written in BitC http://en.wikipedia.org/wiki/Coyotos

14:16 but obv nobody uses that

14:20 Sgeo: Would it be at all sensible to use a Java implementation of socket.io with Clojure?

14:20 Ring etc.?

14:22 wjlroe: Sgeo: you can probably use https://github.com/ztellman/aleph for websocket server support

14:22 Sgeo: wjlroe, but I need a fallback for clients that don't support websockets, because the stock Android browser sucks like that :(

14:22 hammer: so is anybody using clojure-maven-plugin to unit test a maven project and putting the test reports in the maven site?

14:23 wingy: does anyone know how to fire up a clojure shell for datomic? http://docs.datomic.com/getting-started.html

14:23 duck1123: Sgeo: I'd be interested to know if you ever come up with anything for socket.io for clojure

14:23 wjlroe: Sgeo: yeah, have to work out how to fall back to long polling and all that - dunno about that

14:23 TimMc: hammer: Nice idea. Haven't heard of anyone doing that, though.

14:24 duck1123: I'm using aleph, but I'm also hit by the browsers that don't support websockets

14:24 wjlroe: you can just fall back to ajax for non-websockets

14:25 hammer: yeah my issue is the test-with-junit reports aren't readable by surefire, and i haven't figured out a way to take the old-style junit reports and get them in the site

14:27 antares_: technomancy: can you recommend a good S3 clojure client?

14:27 Sgeo: wjlroe, but a library that did that for you would be nice

14:27 BrowserChannel looks nice but doesn't support websockets at all :(

14:27 technomancy: antares_: I just call jets3t; it's got a reasonable API

14:28 not sure it's worth bothering wrapping it

14:28 wjlroe: Sgeo it would be nice, but would have a very limited shelf-life. non-websocket-capable clients won't be around forever, so it's a stopgap

14:28 duck1123: wjlroe: What about IE?

14:28 Sgeo: Why is stock Android browser non-websocket-capable :(

14:29 hiredman: props3t!

14:29 technomancy: hiredman: oh yeah, did you finish that?

14:30 wjlroe: duck1123 IE 10 has them. so limited shelf-life. basically IE lags behind the most, but at some point you can reasonably say, basically nobody uses these clients

14:30 hiredman: finish?

14:30 it works

14:30 technomancy: vaguely recall there was something keeping you from deploying a release

14:31 hiredman: great, the github readme drops the TODO header from the todo section

14:31 so the TODOs look like a list of features

14:31 TimMc: haha

14:31 technomancy: heh, I was wondering about that

14:31 TimMc: THat's fantastic.

14:31 hiredman: https://raw.github.com/hiredman/propS3t/master/README.org vs https://github.com/hiredman/propS3t/blob/master/README.org

14:32 technomancy: github's org support is a lost cause. sorry to break it to you =\

14:32 it's just rubbish

14:32 hiredman: I am aware

14:35 TimMc: Are they using an open source module for that?

14:35 technomancy: yeah, a ruby gem

14:36 cemerick: TimMc: Don't bother. PR's were submitted for the asciidoc support, and they were ignored.

14:36 Markdown For Life, apparently.

14:37 TimMc: On that note, does anyone know if it's possible to write an escape-for-markdown function?

14:37 cemerick: s'okay, github sucks for content anyway…

14:37 TimMc: Or is Markdown too shitty for that?

14:37 gfredericks: TimMc: you're wondering if it supports all possible strings?

14:38 wingy: bin/repl to start the clj shell

14:38 cemerick: TimMc: Yes is the answer to any "Is Markdown too shitty for X?"

14:50 TimMc: gfredericks: Something like that, yes.

14:50 It's more complicated, since you probably have to write different escapers for link text, table text, etc.

14:55 gfredericks: yeah that crazy

14:55 Cheiron: it is possible to use reify to subclass and define new properties?

14:56 define new properties for the subclass

15:01 joegallo_: iirc reify only works with interfaces and Object

15:01 well, and protocols

15:01 so subclassing is right out

15:01 but i could be totally wrong on that

15:02 Cheiron: joegallo_: yep true http://clojure.org/datatypes

15:02 technomancy: Cheiron: somehow I get the feeling you're making things more complicated than they need to be

15:02 michaelr525: good evening

15:02 Cheiron: technomancy: possibly :D I falled back to mockito and now i need to subclass a class a define a new property for it

15:03 technomancy: you're describing a proposed solution rather than a problem

15:04 Cheiron: with reify i can implement an anonymous type and create and instance of it. but is it possible to define a new instance variable for the subclassed type?

15:06 joegallo_: you can close over any data that you want

15:06 ,(let [a (atom 0) o (reify Object (toString [this] (swap! a inc) (str @a)))] [(str o) (str o)])

15:06 clojurebot: ["1" "2"]

15:07 joegallo_: for instance, here i've closed over the atom a.

15:07 but i didn't need to create a new property to do that.

15:07 so i'm with technomancy on this one

15:07 Cheiron: yep true

15:07 abalone: hm. i just went through a wizard for choosing an open source license and it didn't ask me whether i cared about derivative works including my name somewhere. but that's all i care about :-P

15:08 i guess if no one knows my name, then they can't curse me

15:08 Iceland_jack: damn that abalone

15:20 ForSpareParts: Is there a good way to thread a value through a list of functions at runtime, analogous to the -> macro?

15:20 Alternate question: should I not be trying to do that?

15:21 rmarianski: you may be able to use reduce for that

15:21 scriptor: ForSpareParts: as in if you're given a collection of functions?

15:22 ForSpareParts: scriptor: Yeah.

15:22 scriptor: I think I asked for something like that before, you'd have to create a variant of reduce

15:22 ForSpareParts: interesting

15:23 TimMc: ForSpareParts: comp

15:24 ForSpareParts: TimMc: Ah, yeah. That looks about right.

15:24 Thanks!

15:24 scriptor: oh, right, reduce is only needed if you're going through another collection of values as well

15:24 TimMc: &(let [fns [inc #(mod % 3) #(* % %)] ((apply comp fns) 4)))

15:24 lazybot: java.lang.RuntimeException: Unmatched delimiter: )

15:26 TimMc: &(let [fns [inc #(mod % 100) #(* % %)]] ((apply comp (reverse fns)) 104)) ;; reverse makes it better

15:26 lazybot: ⇒ 25

15:30 TimMc: &(let [fns [inc #(mod % 100) #(* % %)]] (reduce #(%2 %1) 104 fns)) ;; using reduce

15:30 lazybot: ⇒ 25

15:31 oskarth: Running "lein ring server-headless" => could not find myapp/core.clj. The source code is in src/clj/myapp/core.clj and I've set :source-path to "src/clj" in project.clj. How do I get lein-ring to find core.clj?

15:32 metajack: Is ring-devel 1.1.x broken? It seems to fail to compile due to some issue in hiccup: https://gist.github.com/2427322f1de61f1811c5

15:33 andrewmcveigh_: oskarth: which lein version are you running?

15:33 oskarth: andrewmcveigh: lein2

15:34 (preview6)

15:34 metajack: oskarth: then you want :source-paths ["src/clj"]

15:34 andrewmcveigh_: oskarth: then you should use the key :source-paths ["src/clj"]

15:34 oskarth: oh!

15:35 metajack: maybe lein should yell about :source-path in lein2. that seems to trip everyone up

15:35 oskarth: thanks metajack and andrewmcveigh

15:38 wingy: datomic users: is it possible to change schema dynamically?

15:39 my users will add attributes on the fly

15:43 ordnungswidrig: wingy: do you need the attributes or will a single attribute with a map value do?

15:43 wingy: {:custom-attr-a "foo" :cutstom-attr-b "bar"} vs. {:custom-attrs {"a" "foo" "b" "bar"}}

15:44 wingy: ordnungswidrig: i dont get your question

15:44 i c

15:44 hm

15:44 ordnungswidrig: what are the pros and cons with these? or are they equivalent feature wise?

15:45 one thing i need is full text search working for each attribute

15:47 ordnungswidrig: wingy: so you need every attribute as a first class attribute then, datomic does not support map as values and text search / query. AFAIK.

15:48 wingy: i c .. too bad

15:48 ordnungswidrig: wingy: but to my understanding adding an attribute in datomic is common and leightweight.

15:48 wingy: cool

15:48 thats all that matters that i can add/remove attrs

15:49 ordnungswidrig: wingy: attributes are "installed" one by one anyways.

15:50 cemerick: wingy: you can't remove them

15:50 Or, you can, but things go sideways somehow IIRC

15:50 wingy: yeah sounds logical since some entities are having those attrs

15:50 no probs anyway .. the most important part was adding them

15:52 im not familiar with java .. if i want to add a Price attribute, which of the following types should I use in Datomic: long, bugint, float, double or bigdec

15:52 SegFaultAX|work: Heh, bugint.

15:52 Fits large numbers of insects.

15:53 Or conversely, errors out anytime you try and use it.

15:53 I'll just let myself out.

15:53 wingy: long, bigint, float, double or bigdec

15:55 SegFaultAX|work: wingy: Double or bigger.

15:55 cemerick: wingy: read: http://docs.datomic.com/schema.html

15:55 wingy: yeah im reading it

15:56 double then

15:57 xeqi: double for a price?

15:57 wingy: xeqi: something wrong?

15:57 emezeske: I thought it was generally recommended to avoid use of floating point for money

15:57 xeqi: its inaccurate

15:57 sorry, double cannot accurately hold some prices

15:57 (inc emezeske

15:57 wingy: bigdec?

15:57 xeqi: (inc emezeske)

15:57 lazybot: ⇒ 3

15:58 SegFaultAX|work: Which would matter if it was a balance.

15:58 For a fixed floating point value, don't you think a double is precise /enough/?

15:58 (Mixed terms there. Static floating point value eg 19.99)

15:59 ToBeReplaced: i would use the base unit of the currency and store in bigint if i could assume that you can't have fractional units

15:59 emezeske: SegFaultAX|work: I think that's still a bad idea

15:59 cemerick: ,(- 19.99 1.89)

15:59 clojurebot: 18.099999999999998

15:59 emezeske: SegFaultAX|work: E.g. you can't store 0.1 exactly using binary

16:00 SegFaultAX|work: Err s/using binary/using a floating point rep

16:00 cemerick: Thank you.

16:00 ToBeReplaced: ,( -1900 189) ;wink!

16:00 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

16:00 SegFaultAX|work: Hmm, for a price I wouldn't have thought it mattered.

16:00 I'm sold though.

16:01 (See what I did there?)

16:01 ToBeReplaced: <3

16:01 wingy: so what type should i use?

16:01 emezeske: wingy: BigDecimal, int, or long, depending on how you want to approach the problem

16:02 wingy: probably BigDecimal

16:02 wingy: ok

16:02 thx for the discussions

16:03 cemerick: wingy: You should probably try to fully grok http://docs.datomic.com/schema.html lest random irc advice doesn't pan out one of these days.

16:04 emezeske: wingy: Do what cemerick says ^^. It's a bad idea to blindly follow my advice (I can tell you this from firsthand experience).

16:04 Especially when they're money involved, you want to be careful. :)

16:04 wingy: yeah but it says nothing about what is suitable for pricing :)

16:04 yepp

16:04 cemerick: Well, it doesn't give you the code you need to write for your app, either…

16:04 SegFaultAX|work: ,(- (BigDecimal. 19.99) (BigDecimal. 3.99))

16:05 clojurebot: 15.9999999999999982236431605997495353221893310546875M

16:05 wingy: im just doing a prototype though .. some more experienced with banking/money will handle the money part

16:05 SegFaultAX|work: Well, that's not what I expected.

16:05 amalloy: don't use bigdec

16:05 wingy: what usually do people use for price then

16:05 amalloy: to handle money properly, use an integral number of cents (or tenths of a cent, or however low you want to go)

16:06 ordnungswidrig: wingy: always count in pennies

16:06 wingy: good idea :)

16:06 SegFaultAX|work: That's how I handle balances. In pennies or fractions thereof.

16:06 ordnungswidrig: wingy: or, if necessary in millipennies.

16:06 wingy: hmm

16:06 or ratios?

16:06 SegFaultAX|work: For simple static floating point values, I usually don't care.

16:06 amalloy: wingy: usually they use doubles, and then someone steals from them

16:07 ordnungswidrig: wingy: it's like handling time. always use seconds/ms since epoch. Delay conversion into other representation until the view layer

16:07 wingy: yeah

16:07 is that how you do localization

16:07 one currency in system, then converts it on view layer?

16:08 cemerick: I'll bet pjstadig has a way to implement currency arithmetic using UUIDs…

16:08 pjstadig: UUIDs solve everything

16:08 SegFaultAX|work: If you want to store arbitrarily precise monies, just store the denominator. 100/100 = $1 1000/100 = $10 100/1000 $0.10

16:09 That way if some point in the future you have to change the scale, you can do it without having to guess what the original scale was.

16:09 There was a DailyWTF on this topic I think.

16:09 ordnungswidrig: SegFaultAX|work: like fp-arithmetic.

16:09 emezeske: SegFaultAX|work: ##(- (BigDecimal. "19.99") (BigDecimal. "1.89"))

16:09 lazybot: ⇒ 18.10M

16:10 cemerick: pjstadig: you could even table every possible operation, and make all that math *really* fast

16:10 emezeske: SegFaultAX|work: Your example initialized BigDecimals with doubles

16:10 ordnungswidrig: so a pair [381,-2] => 3.81?

16:10 SegFaultAX|work: emezeske: Oh is that what I did wrong? :)

16:10 wingy: ordnungswidrig: so you use milli/pennies with long or bigint?

16:10 pjstadig: definitely floating points are wrong for prices, you want bigdecs

16:10 ordnungswidrig: wingy: depends on your prices ;) long should be enough.

16:10 wingy: in most cases

16:10 emezeske: SegFaultAX|work: The doubles lost the precision, and the bigdecs were initialized with that imprecise value

16:10 pjstadig: and maybe to tune the math context so you're getting the right rounding and such

16:11 SegFaultAX|work: emezeske: I understand. I just didn't expect it at first.

16:11 emezeske: SegFaultAX|work: Sure! When I saw your example I was confused for a second too.

16:11 ordnungswidrig: bigdecimals are fine, depends on the memory / storage constraints.

16:11 SegFaultAX|work: emezeske: It's obvious once you think about it for more than 2 seconds, though. :)

16:11 wingy: wow a lot of things to think about .. is that how java made it simple :)

16:12 emezeske: ,(- 19.99M 1.89M)

16:12 clojurebot: 18.10M

16:12 emezeske: There we go. I didn't know about the M suffix.

16:12 wingy: ok bigdec :)

16:13 emezeske: wingy: What are you building? Some kind of shopping thing?

16:13 wingy: emezeske: the next amazon

16:13 SegFaultAX|work: wingy: So you're the guy...

16:13 emezeske: wingy: Ambitious! :)

16:13 wingy: yes

16:13 ordnungswidrig: oh dear, java 7 javadocs are an attack on my eyes.

16:13 wingy: i am

16:13 the one!

16:14 SegFaultAX|work: wingy: Good luck, Neo.

16:14 ordnungswidrig: and it is no complected.

16:14 wingy: im starting to believe...

16:14 callen: so, why does there seem to be enmity for macros among clojurians?

16:14 SegFaultAX|work: Do we actually get to use "complect" in sentences now?

16:14 callen: no, stop it.

16:14 emezeske: callen: Because macros are harder to work with than functions

16:14 callen: it means to weave or plait something together using a loom.

16:15 pjstadig: callen: there is no enmity, just to prefer functions first and use macros only when necessary

16:15 callen: emezeske: as a Lisper, that makes me intensely uncomfortable that you're not willing to embrace macros.

16:15 ordnungswidrig: btw. bigdecimal uses 36+x bytes of memory (in case somebody cares)

16:15 SegFaultAX|work: (inc pjstadig)

16:15 lazybot: ⇒ 3

16:15 ordnungswidrig: pjstadig: +1

16:15 emezeske: callen: Sigh. As a lisper, you should understand the disadvantages.

16:16 ordnungswidrig: lazybot: y u not understand my syntax?

16:16 callen: everything has a trade-off, a cultural bias that is categorically against the use of macros except in some imaginary extreme case concerns me.

16:16 pjstadig: ~55

16:16 clojurebot: Titim gan éirí ort.

16:16 pjstadig: hmm

16:16 amalloy: ~#55

16:16 emezeske: callen: I don't know where you got this "categorically against the use of macros" business

16:16 clojurebot: 55. A LISP programmer knows the value of everything, but the cost of nothing. -- Alan J. Perlis

16:16 callen: emezeske: I did CL, I've had my share of bad macros.

16:16 emezeske: callen: The only advice I ever hear is: start with functions, only use macros if necessary

16:16 pjstadig: amalloy: thx

16:17 nDuff: callen: It seems like solid advice to me, but then, I've had a lot of recent experience being bitten by 3rd-party libraries full of things that aren't composible on account of being implemented as macros.

16:17 callen: emezeske: seems reasonable on the face of it. I'm just concerned that if I ask for help with a macro, I'll just get told to not bother until I replace it with a function.

16:17 nDuff: ...not that the extreme cases don't exist.

16:17 callen: nDuff: we had this discussion.

16:17 nDuff: Yes, we did.

16:17 technomancy: callen: why not worry about that when it happens?

16:17 pjstadig: callen: you will be told that if you're doing it wrong

16:17 emezeske: callen: Why don't you complain when that actually happens, rather than pre-complaining about a thing you think might happen?

16:17 callen: nDuff: I'm still unconvinced by your unabomber reaction to that library.

16:17 technomancy: emezeske: jinx

16:18 emezeske: technomancy: lol

16:18 scriptor: callen: if the macro can be replaced with a function then people will tell you to use a function instead, yes

16:18 callen: emezeske: technomancy because I've had to deal with intransigent language communities before and it infuriates me.

16:18 nDuff: callen: Hmm. Was the "OK, that's reasonable" response (after pointing out the lack of extensibility) a "fine, go away" then?

16:18 callen: emezeske: notably: #python in particular.

16:18 scriptor: although, I've seen people actually write out the function alternative on here before

16:18 pjstadig: if the programmer sees many different programming language communities as intransigent, then it is he who is intransigent

16:19 Sgeo: Is using doto in a -> a reasonably idiomatic way to do a quick side-effect in a -> chain?

16:19 amalloy: callen: i can imagine communities becoming intrangisent when confronted with a belligerent complainer

16:19 callen: pjstadig: just *try* dealing with #python.

16:19 technomancy: Sgeo: sure

16:19 pjstadig: hehe

16:19 SegFaultAX|work: callen: Python are legion.

16:19 * emezeske 's interest in talking to callen diminishes.

16:19 amalloy: Sgeo: yes

16:19 callen: #go is guilty of this too.

16:19 amalloy: no, if you go to them with code that you need help getting to work, and if it deviates from what they perceive as being the "python way", even if there's a legitimate specific case reason for doing so, they won't help you until you change it.

16:20 even if you can prove it's not the origin of any bugs in that case.

16:20 pjstadig: anyway, no one is against macros, but i've seen people get tripped up over libraries that contain macros, and are therefore not composable

16:20 cemerick: I guess we're preemptively intransigent.

16:20 pjstadig: especially newbs

16:20 callen: in contrast, #haskell and #ruby have in my experience been pretty accommodating/open-minded.

16:20 SegFaultAX|work: callen: But we want you to correct /and good/ code.

16:20 callen: SegFaultAX|work: and #haskell doesn't?

16:20 nDuff: callen: The "avoid macros" advice is something which has evolved in the community over time.

16:20 callen: SegFaultAX|work: they're the penultimate fascists of code correctness.

16:20 nDuff: callen: If you haven't been here long enough to see that evolution -- and it's an over-the-course-of-years thing, it may seem caprecious.

16:20 callen: SegFaultAX|work: they're just easier to talk to than python people.

16:21 pjstadig: callen: what is your macro question? do you have a macro you need help with?

16:21 callen: nDuff: I've dipped in and out of Clojure over the years, never really immersing because I wasn't sure if I wanted to come to grips with the Java ecosystem.

16:21 Sgeo: There are cases in Clojure where you can use a function but in Haskell you'd be forced into a macro.

16:21 callen: pjstadig: I'm trying to gauge community, not code.

16:21 nDuff: callen: ...that said, there's solid reasoning and experience behind it. There's was a talk at the conj on the subject a few years ago, if you're interested.

16:21 technomancy: callen: CLers also agree you shouldn't write a macro where a function will do, except for that subset of CLers who came starry-eyed from paul graham's tales of viaweb's 25%-macro codebase

16:21 callen: nDuff: yeah, he's part of the reason I'm worried you guys have a bias against macros to begin with.

16:21 technomancy: an experienced lisper would be horrified at that kind of number

16:22 callen: technomancy: I know that.

16:22 cemerick: callen: cgrand gave the canonical talk on "functions first, then macros as necessary" at the first conj. I'll just presume you're not grouping him in with these "fascists" you're worried about.

16:22 callen: technomancy: I only ever used CL macros as a terminal API, there were always underlying functions (90%++) that could be invoked for composability.

16:22 nDuff: callen: And that's fine.

16:22 technomancy: callen: ok, so you're in complete agreement with the clojure community

16:22 next?

16:22 nDuff: callen: Nobody here, including me, is arguing against that kind of use case.

16:22 pjstadig: callen: have you seen the talk? because i'm very disappointed in the way people have misinterpreted it simply from the title and a complete ignorance of its content

16:22 callen: function composition is to varying degrees the basis of my Python code, but absent the benefit of the macros to clean it up.

16:22 SegFaultAX|work: technomancy: I kind of have mixed emotions about it. It sounds like they basically built an entirely new tool for their work. So after a while it wasn't really CL... it was Viaweb lisp.

16:23 callen: SegFaultAX|work: it was a ton of C code too.

16:23 SegFaultAX|work: that's one thing that seems to get ignored.

16:23 SegFaultAX|work: technomancy: Not unlike Honeywell Pascal being a specific Pascal for Honeywell automation systems.

16:23 I don't know if that's a good thing or bad thing. But it doesn't /seem/ terrible outright.

16:24 I mean, you might say they built a DSL for their business. If that provided value and expediance, where is the harm in that? Objectively speaking.

16:24 Sgeo: For what it's worth, I think -> is an overuse of macros, but the community seems to disagree

16:24 amalloy: Sgeo: -> isn't even a use of macros. it is a macro, and it's up to you to use it

16:25 SegFaultAX|work: Sgeo: Dunno, I kinda wish -> wasn't syntax. Or at least a proper thrush combinator.

16:25 Sgeo: SegFaultAX|work, yeah

16:25 technomancy: SegFaultAX|work: because the 25% number seems insanely high and leads me to believe they're inventing their own language for the sake of being different.

16:25 ToBeReplaced: i just asked on SO about ->... it's driving me nuts at the moment

16:25 SegFaultAX|work: technomancy: Without looking at their code or working there, I have no opinion on that claim.

16:26 technomancy: But again, if it allowed them to be successful, who cares? They extended their tool around their domain.

16:26 technomancy: SegFaultAX|work: of course it's their own business, but pg writes as if that's a normal everyday thing

16:27 SegFaultAX|work: technomancy: Hmm, that's not been my interpretation of his articles on the matter. Just my $0.02

16:27 BeLucid: Anyone able to help out with a noir on Heroku issue?

16:28 SegFaultAX|work: technomancy: My real question is: why is that mentality objectively wrong?

16:28 BeLucid: I've got a simple little app that runs fine locally... seems to start up OK on Heroku as well, but then it seems to start a 2nd instance on the same port

16:28 callen: I'm sorry if I caused any friction, I'm just trying to understand where the community stands on things I'm concerned about.

16:28 BeLucid: not sure what's causing the second instance

16:28 here's a gist comparing local w/ Heroku https://gist.github.com/4e2f3148c0fb4bec55d5

16:29 SegFaultAX|work: BeLucid: What gives you that impression?

16:29 callen: technomancy emezeske sorry.

16:29 ToBeReplaced: SegFaultAX|work: usually, companies create languages because the market isn't meeting their needs and later discard them, like SCUMM at LucasArts... did viaweb eventually pitch their DSL or just keep running?

16:29 technomancy: BeLucid: I can take a look

16:29 callen: ToBeReplaced: it kept getting used at Yahoo for a long time until the code was eventually refactored out.

16:29 technomancy: BeLucid: you're probably not honoring the $PORT environment var?

16:29 callen: ToBeReplaced: supposedly, some of it still runs.

16:29 ToBeReplaced: I can't speak to the lifespan of it or what percentage lived on.

16:29 ToBeReplaced: interesting

16:29 BeLucid: I think I am... the line I'm starting noir with is: (server/start (Integer/parseInt (or (System/getenv "PORT") "8080")))

16:29 SegFaultAX|work: ToBeReplaced: IIRC, it was used extensively for quite some time after they were acquired by Yahoo. Is mass adoption the only measure of value?

16:30 ToBeReplaced: They extended the language to create a custom tailored tool set to meet their needs.

16:30 BeLucid: it is ending up on 8080 from what I can tell from the output...

16:30 SegFaultAX|work: ToBeReplaced: Which almost certainly would not map perfectly (or even well) to many or most other organizations.

16:30 BeLucid: which makes me think it's getting my default... not $PORT

16:30 technomancy: BeLucid: oh, I see what the problem is. you're starting the server on compile

16:30 rather than putting it in -main

16:30 xeqi: BeLucid: its running the server during a compile, do you have some top level forms that start it?

16:31 BeLucid: ahhh... I see

16:31 ToBeReplaced: SegFaultAX|work: no not at all... i'm completely in your camp here

16:31 BeLucid: umm... hmm

16:31 wonder what would be starting it during compile

16:32 technomancy: BeLucid: if you need help debugging you can pm me with the app name and I can take a closer look

16:32 BeLucid: ok, thanks

16:32 here is the project file...

16:32 https://gist.github.com/c9411f6b399ffecf3202

16:32 what are some candidates for me to look for? as to what would cause the startup at compile

16:33 technomancy: it's not the project file but the main ns that's at fault

16:33 src/cookable/main.clj

16:33 SegFaultAX|work: BeLucid: Your projects core.clj for example.

16:33 BeLucid: so... this makes some sense then

16:34 I do start the server in src/cookable/web.clj

16:34 SegFaultAX|work: Shouldn't the buildpack do that for you?

16:34 BeLucid: which is the :main in my project file

16:34 technomancy: you need to start the server inside the -main function in that ns

16:34 BeLucid: k

16:35 I can try that., one moment.. many thanks

16:35 technomancy: BeLucid: in general, all top-level forms should start with def

16:35 though I guess noir kind of breaks that convention out of the box =(

16:36 ordnungswidrig: shouldn't clojure-mode then higligh als (def*) toplevel forms like it does with defn?

16:37 SegFaultAX|work: technomancy: What's the significance of -main over main?

16:37 technomancy: SegFaultAX|work: it means it'll get turned into a method if it's gen-classed, which is relevant since that's the only way to launch from the CLI if you make an uberjar

16:38 so lein run just re-uses the same convention that's necessary for uberjar

16:38 SegFaultAX|work: technomancy: Oh is uberjar not a term that Leiningen introduced?

16:39 It's a thing outside of Lein?

16:39 BeLucid: wonderful... putting the noir server/start in -main did the trick

16:39 gfredericks: there was a maven uberjar plugin at some point

16:39 ordnungswidrig: SegFaultAX|work: it's even a java thing

16:39 BeLucid: seems that it did start one up at compile time w/o it

16:39 many, many thanks!

16:39 technomancy: BeLucid: cool, np

16:49 Sgeo: I wonder if I should try bringing one of the Java socket.io implementations into Clojure

16:51 Are there any stylistic guidelines on when to use a map as a function vs a keyword as a function?

16:52 clj_newb: Hi, I always see comments like ';;' thou the comment is a single ';', is this a kind of convention?

16:53 joegallo_: clj_newb: emacs treats ;; as a comment on a line by itself, and a ; as a comment at the end of a line, basically.

16:53 it's just a lisp convention, though, i think.

16:53 ;; the next line is tricky

16:53 (println "foo") ; see, i told you

16:54 technomancy: clj_newb: it's an old lisp convention that predates clojure

16:54 a lot of clojure people seem to be unaware of it

16:54 emezeske: technomancy: I seem to remember reading that more semicolons indicated emphasis (kind of like h1, h2, h3, etc)

16:54 technomancy: Is that at all true?

16:55 technomancy: well, s/true/a common convention that you've seen

16:55 joegallo_: emezeske: so sayeth the stackoverflow http://stackoverflow.com/questions/6365334/lisp-commenting-convention

16:55 emezeske: joegallo_: thanks!

16:57 clj_newb: so if I want to comment at the beginning of the line I use ;; and at the end a single ; Or it does not matter at all ?

16:57 pjstadig: clojure.core uses ';' in its header :(

16:58 joegallo_: clj_newb: there are no comment police

16:58 pjstadig: basically all of clojure's clojure source

16:59 amalloy: there's also http://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html

16:59 Frozenlock: clj_newb: If you use a simple ';' on a line by itself, then press tab, it will displace it to the center of that line. ';;' will keep everything in place.

16:59 pjstadig: clj_newb: ;; should be used to comment out a whole line, and ; for comments at the end of a line FSVO 'should'

17:00 technomancy: emezeske: I think marginalia actually translates them into h3-ish things

17:01 clj_newb: thank you

17:01 technomancy: joegallo_: does that mean the position is open?

17:02 joegallo_: it's stuck in committee, we're worried about who watches the watchmen.

17:03 callen: for anybody else who's trying to make web apps in Clojure, this guy's articles are top-notch: http://www.vijaykiran.com/topics/programming/

17:04 some of the best walkthrough, "survey of the landscape" intros to doing a web app in a new language I've ever seen.

17:04 vijaykiran: callen: :) thanks - I'm gonna update the articles to Clojure 1.4 and latest versions of library this weekend.

17:05 callen: vijaykiran: seriously though, it's not one of those dumb, "here's a 30 line hello-world example, kthxbai", you actually cover things like, "here's what I recommend for querying, for migrations, etc" and on down the line.

17:05 vijaykiran: and the prose itself seems to be written with an understanding of what the learner will and will not know.

17:05 vijaykiran: thank you so much for writing those.

17:06 vijaykiran: if you're ever in the bay area, a beer on me :)

17:06 vijaykiran: callen: thanks, I'm glad that you found them useful :) if you find any problems - just add a comment, I'll try to keep them updated.

17:08 gfredericks: emezeske: what's the status on the cljs-version-configurability for cljsbuild? if there's work outstanding there I might like to hack at it tomorrow

17:09 emezeske: gfredericks: I think you can just put the clojurescript version you want in :dependencies in your project

17:09 gfredericks: Someone told me that worked -- I haven't tested it myself

17:10 gfredericks: ah interesting

17:11 emezeske: gfredericks: If you confirm that works, let me know. Otherwise, I'd be open to a pull request (although I think it might not be straightforward to add that feature)

17:12 callen: vijaykiran: you're on a roll, your post on eshell and sudo solved an old problem I had in tramp that I'd previously been solving with some egregious hacks.

17:13 http://www.vijaykiran.com/2012/07/21/editing-remote-sudo-files-from-emacs/ <-- this one.

17:17 happy4crazy: learning clojure at hacker school eh?

17:18 happy4crazy: callen: mainly erlang and go, but yeah, some clojure too :)

17:30 mwillhite: if I have a function like this (fn blah [^clojure.lang.Atom config] stuff)

17:30 is the first element in the param vector a sort of type hint?

17:30 what is that?

17:30 hiredman: mwillhite: that is amazingly silly

17:30 TimMc: mwillhite: It's a type hint on the config parameter.

17:30 hiredman: (type hinting as an atom)

17:30 mwillhite: okay thanks

17:30 why is it silly?

17:31 TimMc: mwillhite: Because unless you're calling a (.method ...) on that atom, it doesn't do anything.

17:31 hiredman: because all operations on atoms are done via clojure functions, so there is no reflection to get rid of

17:32 mwillhite: ah yes I see

17:32 hiredman: everytime you want to recommend reading code as a good way to learn something like that pops up

17:33 and you just sort of have to sigh

17:36 joegallo_: hiredman: i type hint everything and compile with --funroll-loops and --fomit-frame-pointer

17:36 it makes the lack of reflection even faster.

17:36 hiredman: don't forget -fPIC

17:36 joegallo_: oh, yeah, i mean, of course

17:37 hiredman: hah, tricked you, -fPIC will actually slow things down

17:38 emezeske: -funsafe-math

17:38 Which I read as "fun, safe math."

17:39 cemerick: I thought -funsafe-math were JVM primitives…?

17:39 ordnungswidrig: cemerick: I think its -XXunsafe-math for the JVM

17:40 or ist it -XX:+UnsafeMath?

17:41 joegallo_: hiredman: blast! now i have to recompile my whole machine!

17:41 ordnungswidrig: joegallo_: ksplice will safe you from reboot.

17:42 cemerick: ordnungswidrig: you tricked me into googling it :-P

17:42 ordnungswidrig: cemerick: gotcha!

17:42 (inc ordnungswidrig)

17:42 lazybot: You can't adjust your own karma.

17:42 ordnungswidrig: *duh*

17:52 devth: let's say I have an alias to some fn: (def foo map). how can I do (clojure.repl/source foo) and have it tell me the source for map? some kind of syntax quoting magic?

17:52 nDuff: devth: ...so, you need to copy the metadata on the var

17:53 devth: ahh

17:54 i might be going about this wrong. what i'm really trying to do is get the source for a function name that's passed in as a string. (source (symbol "map"))

17:54 but maybe i have the same problem in that case

17:55 ordnungswidrig: devth: maybe the symbol is missing the namespace

17:56 nDuff: ...so, you just need to get the var associated with that name.

17:56 do you know which namespace it's supposed to come from?

17:56 devth: i could require that the user pass it in. it's for use in a chatbot

17:57 still not quite right: (source (find-var (symbol "clojure.core/map")))

17:58 ordnungswidrig: devn: have you looked at lazybot's source or clojurebot's?

17:58 devth: i have but i didn't think to look in this case. good idea.

17:59 Raynes: I'm not following.

17:59 Why would devth want to look at lazybot's source?

17:59 devth: does lazybot do source lookups?

17:59 Raynes: Like for functions and macros?

17:59 devth: yeah

18:00 Raynes: It has a $source command that is completely broken because it links to github line numbers for an incorrect version of Clojure.

18:00 devth: ah

18:00 Raynes: And I'm too lazy to update it and amalloy is too lazy to even consider thinking about updating it.

18:00 devth: i'm trying to use clojure.repl/source to look up fns in core, given a string fn name

18:03 thorbjornDX: ,(flatten (repeat 10 (range 3))) ;is this as simple as it can be? (I'm probably missing out on a core fn here)

18:03 clojurebot: (0 1 2 0 1 ...)

18:04 amalloy: :(((((( flatten

18:04 thorbjornDX: amalloy: that's why I'm asking :). I don't like using it either

18:04 amalloy: &(doc cycle)

18:04 lazybot: ⇒ "([coll]); Returns a lazy (infinite!) sequence of repetitions of the items in coll."

18:04 thorbjornDX: amalloy: <3

18:05 Raynes: amalloy: Did you even know about cycle before I showed it to you?

18:05 amalloy: wat

18:06 Urthwhyte: Is there a way in lein to just have it default to the newest version of a dependency?

18:06 Raynes: That's really awful.

18:07 Urthwhyte: ?

18:08 If you're just doing a one-off, or you know the library is stable it's a very sensible request

18:09 BrainBacon: Does anyone know if it's possible to send an expression to the current REPL in vimclojure? It seems like when I try it opens a new window with a repl response instead of sending it to the current repl.

18:09 Raynes: It's best to have a solid default. You don't know that your code will always work with new versions of things. I'm also pretty sure you'd have to use version ranges of some sort for that, http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html

18:14 BrainBacon: Does anyone even use vimclojure effectively or is it better to go with lein swank + slimv?

18:14 devth: swank + slimv works great for me

18:14 i messed around with vimclojure first but never really got it working

18:15 thorbjornDX: BrainBacon: I use vimclojure, I don't play in the REPL much though, I just edit in the file buffer and select and <leader>eb to send it to be evaluated

18:15 BrainBacon: Yeah I got it working, but the workflow isn't quite what I thought it would b

18:15 jamii: Is there an easy way to see the bytecode that clojure outputs for a function?

18:16 thorbjornDX: BrainBacon: I don't like how the repl behaves too much, but \el \eb \ef have been very useful.

18:16 BrainBacon: though you have to reload everything once in a while to make sure your file is all in the right order :p

18:16 Urthwhyte: the REPL is definitely a little flaky

18:17 but it's worth it to keep using the same environment for editing everything from clojure to class notes

18:17 BrainBacon: eh maybe I'll just switch to slimv then

18:21 * Apage43 has given up and uses emacs+evil if I want REPL action

18:22 wingy: im sure this is a clojure thing .. i have a datomic entity but when evaluating it it returned just a map with an id

18:22 thorbjornDX: Apage43: evil scares me

18:22 wingy: but when looping it it returns all keys/values

18:22 https://www.refheap.com/paste/5491

18:22 why is this? and is it possible to return the whole map instead of me having to loop?

18:22 Apage43: wingy: That's normal. Datomic result maps are "lazy", in that they don't actually retrieve their component parts until you use them.

18:23 wingy: use (touch) to force it to realize the whole map.

18:24 http://docs.datomic.com/clojure/index.html#datomic.api/touch

18:25 wingy: Apage43: thx!

18:25 Apage43: Mind, the object is semantically the same object before and after touching it, so you don't need to do that to loop over it, compare it, etc.

18:26 wingy: yeah

18:26 Apage43: are there more use cases to use touch besides wanting to see the properties in the repl?

18:29 Apage43: wingy: hm.. If pr/pr-str also print the partial representation then I guess it's also useful for shipping entities out wholesale, if you need to to spit them off somewhere over some network protocol or something

18:29 I forget if that's true or not, I think it may be

18:30 wingy: yeah they print out the partial representation

18:31 Apage43: well them that's where it'd be useful

18:31 wingy: yepp

18:31 Apage43: most other things are going to iterate it and realize it when necessary

18:37 cemerick: Urthwhyte: there are evil ways of doing what you want, but it's just not a good idea

18:38 Urthwhyte: Just going to download the latest verion of a bunch of libs and then symlink them into lib path

18:38 What could go wrong ;)

18:39 cemerick: :-O

18:39 interesting, looks like kibit won't load at all if AOT-compiled stuffs are on the classpath

18:40 ohpauleez: cemerick: :( womp womp

18:42 cemerick: womp?

18:43 emezeske: cemerick: Sad trombone.

18:43 cemerick: ah

18:44 I needed the terminal wooooonnh to catch that one. :-)

18:44 emezeske: It's totally three notes.

18:44 cemerick: "womping" has a particular meaning in my wife's family, which probably threw me off more than most

18:44 emezeske: Should I be afraid to inquire as to that particular meaning? >:)

18:44 SegFaultAX|work: "Sad trombone" is so depressing.

18:45 technomancy: probably shooting womp rats

18:45 emezeske: SegFaultAX|work: Well, only in a melodramatic kind of way!

18:45 augustl: is there anything in ring to automatically handle servlet context paths somehow? I suppose not..

18:46 and I guess it's more of a routing question anyway (compojure in my case)

18:46 SegFaultAX|work: augustl: What does that even mean?

18:47 cemerick: augustl: The ServletContext is in the request map if you're deployed in a container

18:47 dunno if that help you

18:47 SegFaultAX|work: What is a ServletContext?

18:48 cemerick: If you don't know already, don't bother. :-)

18:48 augustl: SegFaultAX|work: java servlets has an API to "mount" the servlet to a specific context path, so that /myapp/foo calls myapp but with /foo as the path

18:48 cemerick: I see

18:48 perhaps there's some sort of standard for "servlet compatible ring handlers"

18:49 cemerick: augustl: ah, only if you're using defservice et al.: https://github.com/mmcgrana/ring/blob/master/ring-servlet/src/ring/util/servlet.clj

18:49 been a while since I was in that neighborhood

18:50 augustl: nice to see that there's something built-in for servlets at least

18:50 ohpauleez: Side-note - You forget how great controlled concurrency is once you have to go back to no concurrency :(

18:51 BrainBacon: augustl: what server are you trying to deploy to?

18:52 augustl: BrainBacon: haven't gotten that far :) Just investigating how good friends ring and servlets are

18:53 BrainBacon: augustl: I've been deploying to glassfish with clojure, I use a handler middleware in noir and I have a context lookup for getting resources

18:54 augustl: https://bitbucket.org/bajesse/it354/src/79da51a2f28c/src/it354/server.clj

18:54 augustl: you can see the fix base url middleware there

18:55 augustl: https://bitbucket.org/bajesse/it354/src/79da51a2f28ccd372003b45dbad08670b74847b2/src/it354/views/utils.clj

18:56 augustl: there's a function to fix absolute resource path lookups called add-context

18:57 augustl: took me a couple of extra brain cycles to grok line 19+20 :)

18:58 since the else wasn't on a separate line

19:07 BrainBacon: augustl: Oh, and I almost forgot you have to register the handler with ring as well https://bitbucket.org/bajesse/it354/src/79da51a2f28c/project.clj

19:08 augustl: Anyway it comes out pretty nicely, you just use lein ring uberwar projectname.war and it will generate the package for you

19:21 Urthwhyte: So I'm doing something very stupid and trying to map a function across a line-seq to try and parse some data

19:21 doseq would be preferred to doall, right?

19:25 emezeske: Urthwhyte: doseq is for side-effects.

19:25 Urthwhyte: that was my understanding of the do* constructs

19:26 if I don't use some form of them my reader seems to close immediately

19:26 emezeske: Are you doing something like with-open?

19:27 Urthwhyte: yea

19:27 emezeske: A lot of people run into trouble using with-open -- the problem is if you use something like 'map, you might return a lazy sequence

19:27 And then elements of that lazy-seq are realized outside of the with-open, later on

19:28 And since you're outside with-open, the file is closed, and things blow up

19:28 So you need to (by some means) ensure that you do all the I/O inside with-open, and don't return a lazy-seq that depends on the open file

19:28 Urthwhyte: ahh

19:28 of course

19:29 This is a ~10k text file where having everything in memory is fine, it's just me trying to get used to doing things idiomatically

19:29 emezeske: Depending on what you're doing, doall might be appropriate for that

19:30 Urthwhyte: I just totally blanked on thinking map would return anything other than a lazy-seq

19:31 Thanks for the help :)

19:31 emezeske: HTH.

20:49 holo: hi

20:49 anyone here uses tools.cli actively?

20:50 it's getting me crazy, this lib. i just.. don't get it

20:50 emezeske: Is there a specific problem you're having, holo?

20:51 holo: emezeske, this doesn't work: (let [[options args banner] (cli ["-f" "--faux" "bar" "The faux du fafa"] ["--help" "-h" "Show help" :default false :flag true])])

20:52 like most combinations, i get something like: Exception in thread "main" java.lang.RuntimeException: java.lang.Exception: '-f' is not a valid argument

20:54 emezeske: That error message is unhelpful

20:54 I notice that neither of the vectors you pass to cli seem to be in the format described in the README

20:54 In the first vector, it looks like there are two description strings?

20:55 And in the second vector, the docs say the -h switch should be before the --help switch

20:55 holo: my observational skills suck

20:55 but regarding the "-h", it was before, that was just an experiment to check if something would come up

20:56 emezeske: Does the error persist if you correct the two things I pointed out?

20:58 holo: emezeske, yes, the error still persists. anyways, that "foo".. i wonder why i put it there, it kind of pisses me off such obvious event after many hours

20:59 emezeske: holo: So, the next thing I observe is that cli's first argument is supposed to be the argv vector passed to your program

21:00 holo: oh... now the docs start to make sense

21:00 emezeske thanks ^^"

21:00 emezeske: HTH.

21:02 holo: It's kind of a bummer that the tools.cli README doesn't at least hint about where the program's arguments might come from

21:02 casion: when using a binding with &, is there a way to unroll it in place?

21:03 e.g. ((fn [& t] [[1 2] (vector t)]) 1 2 3 4) return [[1 2] 1 2 3 4]

21:03 holo: emezeske, actually i was kind of ovelwhelmed why there were some random "some" "--extra" "argument" in there. but my bias was strong, so i couldn't see through it

21:03 emezeske: holo: :)

21:03 casion: the actual code I'm dealing with is https://www.refheap.com/paste/5493 for more context

21:04 emezeske: casion: ##((fn [& t] (conj t [1 2])) 1 2 3 4)

21:04 lazybot: ⇒ ([1 2] 1 2 3 4)

21:05 casion: emezeske: see the refheap, I need tags to be "unrolled", I can't think of a better word atm

21:06 I'm struggling with how to even phrase my question, apologies if I'm not being totally clear

21:06 emezeske: casion: Does my snippet above not do what you want?

21:06 casion: emezeske: it does not

21:06 emezeske: I guess it was a bad example to give, the refheap link makes it clearer I hope

21:06 emezeske: Well, the refheap doesn't show me what you want returned

21:08 casion: I'd like (tag-in-track xf uid :one :two :three) to be (select xf [[:MediaTrack (has [(attr= :uid uid)])] :one :two :three])

21:08 rather than (:one :two :three)

21:08 I was hoping there was a way to do it without making a macro of it

21:09 emezeske: My example above is what you want, I think

21:09 amalloy: i think he just wants apply

21:09 emezeske: haha

21:09 amalloy: I can't see the forest for the trees :)

21:10 * emezeske reminds himself to not fix invented problems but to fix actual problems.

21:11 casion: I don't understand how I'd use apply in this situation

21:18 akhudek: I've noticed that most of the clojure validation libraries simply validate a map by key and return a set of errors

21:19 However, I've found that I often want a "fail on first error" type behaviour.

21:19 How do others solve this?

21:34 casion: ok, so the solution was indeed conj

21:35 I didn't realize [& x] would be a list and conj would prepend to a list, so I ended up doing it in reverse order

21:43 I'm actually very confused as to why this works now

22:32 Frozenlock: Lein deps fails with congomongo https://clojars.org/congomongo. Apparently the java-driver isn't found. How can I manually use it in my project?

22:33 cshell: what version are you using?

22:33 Frozenlock: lein or congomongo?

22:33 cshell: congo

22:33 Frozenlock: 0.1.10

22:34 cshell: add [org.mongodb/mongo-java-driver "2.7.3"]

22:34 to your project

22:34 that might not be the latest version, but it's what i use

22:38 Frozenlock: Thanks, I'll try it immediately!

22:41 Oh wait I have that. I must have screwed somewhere; lein deps also gets me congomongo 0.1.7, which requires mongo-java-driver 2.6.5 (missing).

22:41 * Frozenlock bangs his head on the wall

22:50 AustinYun: is there any way to get pprint as a function that returns a string?

22:52 tmciver: AustinYun: not sure if there's a better way, but you could use ##(doc with-out-str)

22:52 lazybot: ⇒ "Macro ([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."

22:52 xeqi: &(with-out-str (clojure.pprint/pprint {:a 1 :b 2 :c 3}))

22:52 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

22:52 Sgeo: If I have a library in .NET that I want to use, should I try to get a ClojureCLR environment working, or should I try to use jni4net?

22:58 gert: ohpauleez: thanks for the quick reply to my shoreleave pubsub question!

22:59 ohpauleez: gert: No problem, more than happy to help

22:59 And I know I've lacked a lot on the documentation

22:59 gert: I think shoreleave is very promising. I'm planning to use it in production. :)

22:59 ohpauleez: I think you may have found a bug, but it's easy enough to patch (having apply dispatch correctly)

23:00 gert: glad I could help by breaking it

23:00 ;)

23:00 ohpauleez: I have four systems in prod - two used an earlier first, two used the version that was released

23:00 We don't use atoms for state a lot (we just switched over to that camp actually), so there is a chance that the pubsub is choking on it

23:01 gert: ah yeah. I started out with Clojurescript pretty much from scratch, and had my own data-binding thing going on with atoms and watchers

23:02 now that I have a little more understanding it's easier to start using shoreleave. I love the idea of chaining (the subscribe-> function)

23:02 ohpauleez: yes, it's something we have working internally, just need to polish it up

23:03 we inevitable do exactly what your examples does

23:03 gert: what kind of application are you using it for?

23:03 ohpauleez: t1 -> t2; t2 -> t3; ...

23:03 so subscribe-> would be nice

23:03 gert: Are you going to the conj?

23:03 gert: I wish!! I'm in New Zealand though

23:04 ohpauleez: oh right! I saw your site - ok. Here are some spoilers

23:04 gert: I love spoilers! :)

23:04 ohpauleez: the first system we built joins Google Map queries with SOLR queries, then hits our DB and calls and API server

23:05 to search, filter, and analyze *things* in our DB

23:05 gert: nice one! that sounds interesting

23:05 are Conj talks going to be online?

23:05 ohpauleez: but we wanted to test the theory: Can we put everything into dedicated servers and on a CDN, then run the app all on the client

23:05 they're always recorded

23:06 amalloy: gert: eventually. last time it took around four months for them to all get up, maybe?

23:06 ohpauleez: and another one is a port of an existing Python system, to a mostly CLJS system, with project and code metrics

23:06 gert: I'll try to be patient. New Zealand is awesome, but it's so far away from where all the Clojure goodness is happening

23:07 sounds good ohpauleez. I started building a frontend with Compojure, but client side apps are a lot more pleasant to program. Wrangling stateless http into something faux-stateful is just no fun

23:09 ohpauleez: I've found CLJ/CLJS to be a HUGE success - less effort, more flexibility, easy extension, shorter timelines, more dependable, better capacity

23:09 gert: I'm sold yes!

23:09 ohpauleez: than say a standard Python app, running on wsgi behind NGINX, with raw JS on the client

23:10 gert: I used Sproutcore (now Ember.js) before, but yeah.. javascript. :) With a backend in Clojure it makes sense to use Clojurescript

23:12 ohpauleez: for sure

23:14 AustinYun: i don't get why compojure.response/render takes two arguments

23:14 wait, is the second argument the request object?

23:15 (defprotocol Renderable (render [this request])) <-- why "this"?

23:17 ok looks like i got it, nevermind

23:17 gert: "this" is a Renderable object

Logging service provided by n01se.net