#clojure log - Jan 15 2013

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

0:20 tomoj: http://www.infoworld.com/d/application-development/functional-programming-step-backward-205105

0:20 yogthos: tomoj: yeah saw that, not very convincing I must say :)

0:20 tomoj: it's like an english speaker complaining french is hard to read after studying it for a week

0:23 first red flag is in the second paragraph where he says "looping is performed with recursion", when in reality explicit recursion is quite rare as that's what higher order functions are for

0:23 also it's hard to swallow the argument that declarative style is harder to understand than imperative where you mix what and how together

0:25 TimMc: "The syntax of functional programming just isn't readable at a glance."

0:25 And then he gives Erlang and Haskell examples. *yawn*

0:26 yogthos: and I don't see what's unreadable about the erlang one specifically

0:26 it kind of tells you what it's doing

0:26 also amusing is the lack of the imperative counterpart :P

0:26 because that's would be so much more readable :)

0:28 TimMc: yogthos: Readability comes down to idioms.

0:28 yogthos: TimMc: it's also highly dependent on what you're experienced with

0:28 TimMc: It's similar to the differeing phonotactics of various languages.

0:30 yogthos: Well... to the extent that a Java programmer isn't experienced with Erlang idioms, sure.

0:30 I don't know that different Java sources are going to vary too much on average.

0:31 yogthos: TimMc: when somebody knows java and they look at python, ruby, c#, etc. they really can apply most of what they know, and just have to learn a new concept here and there and some syntax sugar

0:31 TimMc: when you switch to fp, you actually have to learn new ways to structure code and approach problems, and that's what people find frustrating

0:31 bbloom: the biggest issue is that there is a lack of good functional code bases to go study

0:31 yogthos: bbloom: that doesn't help either

0:31 SegFaultAX: As an Erlang programmer, I can confidently say that Erlang has a generally unusual syntax.

0:31 bbloom: learning how to structure functional code is reaaally really hard

0:31 just like learning how to structure object oriented code is really hard

0:31 yogthos: exactly

0:32 bbloom: but you can go read Id's game engines, or take a look at a large java project

0:32 and get a feel for what big systems look like

0:32 and how they play together

0:32 yogthos: but if you've had years of experience with imperative/oo you forget that you had to learn and internalize all that at some point

0:32 bbloom: yeah exactly

0:32 also, it further doesnt help that functional programming has traditionally had a weak model for state/identity/whatever

0:32 yogthos: and then people think the language is inherently more difficult because they have trouble learning it

0:32 bbloom: not saying clojure invented it; haskell has had TVar and MVar and whatnot forever

0:33 yogthos: clojure is definitely more accessible in that regard though :)

0:33 bbloom: just saying that it's one of those things that takes time to bake into the collective conscious

0:33 yogthos: yup

0:33 and I find part of it is ego too, if I've been coding for years and I'm an expert why is this stuff hard

0:33 bbloom: oh yeah, for sure

0:33 tomoj: "I find both claims equally doubtful."

0:33 bbloom: you feel REALLY DUMB

0:33 now i just assume that i AM really dumb

0:33 tomoj: is that a clever way to say "I have no clue." but sound smart?

0:34 yogthos: and getting past the hump tends to weed out a lot of people unfortunately

0:34 bbloom: and actively seek the enlighten moments

0:34 i also think that there is a category of applications, like databases or game engines, or user interfaces

0:34 that are traditionally friendly to the object oriented model

0:34 hell, objects were practically invented for the sole purpose of simulation

0:34 yogthos: I'm not sure I agree with the databases :P

0:35 they map terribly to oo, hence the orm messes :)

0:35 bbloom: sorry, databases != functional tho, more imperitive

0:35 execute this command, execute that command

0:35 sure, sql is "declarative" but there are lots of other types of databases

0:35 yogthos: but they do tend to be immutable and atomic :)

0:35 TimMc: clojurebot: ORM?

0:35 clojurebot: Object-Relational Mappers are the Vietnam of computer science.

0:35 yogthos: yeah that's true

0:36 hehe

0:36 but even with something like document oriented dbs, my experience is very favorable when it comes to fp

0:36 bbloom: i now look at some old code that i was once very proud of and i'm like SHOCKED at how fragile it feels

0:36 yogthos: hehe

0:36 yeah old code is almost always a big disappointment :P

0:37 bbloom: there was a point where i was writing c# and i was very careful to make all the right ReadOnlyCollections and whatnot and make sure i didn't leak a mutable value from a property with a getter, but no setter

0:37 yogthos: I often have those "why did I write" that moments ;)

0:37 I find state management without persistent data structures is very hard

0:38 your options are pass by value or pass by reference

0:38 and pass by value tends to be expensive

0:38 bbloom: i'm finally getting the hang of it "in the large" i'd say

0:38 yogthos: with persistent data structures you only pay the price proportional to the size of the change

0:39 to me that's really the biggest advantage hands down

0:39 bbloom: another really big issue is that ALL THE LIBRARIES OUT THERE are mutable

0:39 yogthos: yup

0:39 bbloom: you need turtles (almost) all the way

0:39 yogthos: it's very difficult to make any sorts of guarantees

0:39 I liked that idea that fp is essentially SOA all the way to function level

0:40 if you already buy into doing it at high level why would you do something different at low level

0:40 each function is a service, they communicate over a common protocol which is the data structures

0:40 bbloom: i like to think of my code in terms of procedures, functions, processes, and systems

0:40 yogthos: and when I call a function I don't need to know what happens inside it

0:40 bbloom: which correspond to sequences, trees, DAGs, and graphs respectively :-P

0:40 yogthos: I just get a value back and it's mine to do with as I like :)

0:41 bbloom: i think each level of thing has different trade offs

0:41 yogthos: yeah thinking in terms of data transformations is definitely the way to go ;)

0:42 I mean most problems are take some data here transform it and put it there

0:42 bbloom: right, but down one level from there is the algorithm/proceedure/strategy

0:42 yogthos: yup

0:42 bbloom: and one level up from there is forking/joining sequence of steps all arranged together

0:42 and then a level up from THAT is the big ol' loop around the state of the universe

0:43 yogthos: knowing how to get that data from a to b properly and efficiently takes skill :)

0:43 bbloom: luckily, it's getting easier because more people are trying it and writing about it

0:43 yogthos: yup

0:44 I also find for a lot of people it's concrete examples that resonate the best

0:44 like here's a web app in 5 minutes, can you do that with your jsf/spring/hibernate monstrosity? :)

0:44 bbloom: but even if you see an example, you can't do it yourself until you internalize the mechanisms

0:45 yogthos: I've had much better success with that approach than explaining the fine details of state isolation :)

0:45 well once people get curious and the problem set is limited to a small domain it gets easier

0:45 bbloom: the real problem is that people want to make THINGS

0:45 and most THINGS do STUFF

0:45 yogthos: hehe

0:45 bbloom: but the real hard part is that DO word

0:46 yogthos: yeah that gets ingrained over the years

0:46 Raynes: You guys talk too much.

0:46 bbloom: because it's really not obvious how to think about DOING in a functional world

0:46 yogthos: Raynes: heya :)

0:46 tomoj: Raynes: is lazybot's example.policy only safe for private channels?

0:46 yogthos: Raynes: btw did a new release for lib-noir, bumped version for cheshire to the latest and added some tests :)

0:47 bbloom: was rereading this the other day and had a chuckle :) http://steve-yegge.blogspot.ca/2006/03/execution-in-kingdom-of-nouns.html

0:47 bbloom: oh yeah

0:47 yogthos: I find what's worse is that people often get distracted from the actual problem they're solving with oo

0:48 Raynes: tomoj: It's the safe thing.

0:48 tomoj: You're just granting your own code permission to run with the sandbox turned on.

0:48 yogthos: I saw.

0:48 yogthos: they start building their hierarchies and interfaces, and abstract classes, and they forget what the problem actually was :)

0:48 Raynes: yogthos: I keep an eye on what goes on. If I don't say anything, it means I approve.

0:48 yogthos: Raynes: excellent :P

0:49 bbloom: Raynes: i'll just wait until you're gone to say a bunch of stuff that would upset you :-)

0:49 yogthos: Raynes: I also gave a grace period on merging it in, figured if you'd object it would be sooner than later :P

0:49 hehe

0:49 Raynes: yogthos: This is true. But the important thing is that the pull requests give me notifications whereas I wouldn't know if you just randomly pushed something to master. It's more of an easy way to tell me "Yo, look at this."

0:49 yogthos: bbloom: but yeah I think web apps are a really good domain for people to get feet wet in fp

0:50 Raynes: yup :)

0:50 bbloom: yogthos: to some extent, but they generally require communicating with external services that are stateful

0:51 yogthos: but that's why i tell people that their first little clj app should have exactly one atom :-)

0:51 yogthos: bbloom: haha good rule

0:52 bbloom: lol I felt dirty the other day showing somebody how to use an atom for accumulator :P

0:52 I started explaining how to reduce recursively and then noticed the glazed over look :P

0:52 bbloom: eh, sometimes convenient works

0:52 i've done it :-P

0:53 yogthos: yup, it's like this thing is not performance critical in any way just use an atom

0:53 I still feel dirty any time I do :P

0:53 the haskell habits die hard

0:54 when I started learning fp I made it into a game of figuring out how to do something without using stateful things :)

0:54 instead of frustrating it quickly turned into rewarding

0:57 tomoj: Raynes: I see, thanks.

0:57 Raynes: tomoj: AllPermission can sound scary, but I assure you is is harmless. :)

0:58 tomoj: hmm.. getting `java.security.AccessControlException: access denied ("java.util.PropertyPermission" "net.spy.log.LoggerImpl" "read")`

0:58 need to customize clojail?

1:09 I added that to .java.policy, but I'm guessing it's in the wrong place, since I put it in the same place as AllPermission

1:13 Gooder: Hi, in query-replace-regex, how can replace them globally? Now I type '!', it just replace these after cursors.

1:15 tmciver: Gooder: if you want all regexs replaced, use replace-regexp

1:16 samrat: I'm trying to write tests and `lein run` works fine but running the test seems to give me a EOF error. my core-test: https://www.refheap.com/paste/8643

1:17 I can't figure out why I'm getting an EOF, because the program actually just works fine and the tests don't seem to have any missing parens either

1:19 Gooder: tmciver: thanks, although it is not convenient.

2:06 ro_st: anyone using lein run with their ring apps have a way to do zero-downtime restarts?

2:06 perhaps spinning up a new process and somehow switching ports once it's up?

2:09 ejackson: ro_st: reverse proxy ?

2:10 ro_st: we already do that

2:10 with apache

2:10 i'm hoping we can do it without having to change ports in the apache config

2:12 ejackson: how about when you start an ring app, before you bring up the jetty/whetever you make an HTTP call on the port that any servers listening will hear and shut down ?

2:12 i haven't done this, its just a thought

2:13 its async though, so you couldn't guarantee it would work. If the server has shut down its HTTP it can't tell you so

2:13 over http anyway.

2:13 danieroux: ro_st: I would symlink my current deployment to somewhere where the main Apache config can just include the symlinked config. An apache reload would then work with the new config.

2:13 ejackson: perhaps over nrepl ?

2:13 danieroux: It also allows a previous config to lie around and get back into the action

2:13 ejackson: danieroux: thats quite cool

2:14 me idea seems too complicated.

2:15 ro_st: thanks for the ideas, guys

2:15 danieroux: It would mean that you will have two instances of ring running concurrently, so that app would need to do fancy footwork to not talk to the wrong version of the data. But that's under your control :)

2:16 ro_st: this is in the context of a load balanced ec2 cluster, so we're going to see how far we get by lifting new nodes with pallet and taking down the old ones on a rolling restart basis

2:17 if that takes too long, then we'll investigate process fiddling options

2:17 ejackson: there must be some literature in the continuous deployment space ?

2:17 maybe immutant/pallet lists have ideas

2:17 ro_st: yup. we don't use wars or jars, though. and most java deployment solutions assume that

2:18 ejackson: yeah, I used to just push wars to tomcat and it would take care of it

2:19 ro_st: ya. we're using loose files on disk.

2:19 development = staging = production. only env vars change from location to location, which can include uris to services

2:20 ejackson: ro_st: perhaps the solution is bulk up your process ?

2:20 making wars was pretty easy last time i tried

2:21 ro_st: we're definitely going to investigate and compare wars to loose files

2:21 loose files makes nrepling in and reloading from disk possible, though

2:22 ejackson: yeah

2:25 ro_st: aside from the startup time (which can be mitigated with a two-jvms-with-port-switching process), i don't know that wars or jars provide any value

2:25 we already lein check everything on our build server prior to deploy

2:25 ejackson: well, you can get your build server to deploy straight to the tomcat which will auto restart

2:26 so you solve the question you initially asked. I think.

2:26 dunno if its zero downtime though

2:26 but anyway, there will exists such a solution in javaland somewhere, i'd bet.

2:26 ro_st: it's not zero :-)

2:28 headshot: nasty stuff like ehcache, session replication, clustering

2:28 p_l: afaik some servers can reload applications without restart

2:29 headshot: tomcat/jetty/jboss can re-start an app without restarting the server

2:29 ro_st: ring sessions and datomic peer cache are in memcached, all other data in datomic, and rabbitmq for queuing. so the actual web app is 100% share-nothing

2:29 p_l: and well, WAR is there to do "component" like dropping of apps into server

2:30 ro_st: it's about restarting the whole VM, which can on a big system be pretty.... big

2:30 ro_st: yeah

2:30 p_l: especially if you have multiple smaller applications instead of one humongous app

2:31 so you can "swap" the part without incurring penalty of losing all the hotspot optimalizations or reloading various objects etc.

2:31 because you only reload one smaller WAR (a "sub" app, let's say, in a big system)

2:33 ro_st: interesting, i didn't know it was modular like that

2:35 p_l: well, that's what a short look suggests. That is, if you structure your system as multiple smaller applications (each in a war), you can do like that

2:35 while sharing the load of JVM

3:08 mae_: how do i type annotate array of something

3:08 like array of string

3:10 mae: how can i type annotate array of String

3:10 String[] makes it choke

3:18 echo-area: mae: ^"[Ljava.lang.String;"

3:19 mae: thx

3:35 juxovec: I asked yesterday but didn't found a way out of my problem with parsing of large X(HT)ML file. There's question on Stack Overflow http://stackoverflow.com/questions/14333637/how-can-i-lazily-parse-big-xhtml-file-in-clojure

3:38 ro_st: juxovec: you need a streaming xml parser

3:39 juxovec: I know SAX in other languages

3:39 ro_st: http://nakkaya.com/2009/10/10/processing-xml-with-clojure/

3:39 boom

3:39 first hit in google for "streaming xml parser clojure"

4:24 tomoj: &(map {} [1 2 3] [4 5 6])

4:24 lazybot: ⇒ (4 5 6)

4:42 ro_st: what does {} do when used as a fn?

4:43 echo-area: `get'

4:43 ro_st: &{{} 1 [1 2 3])

4:43 lazybot: java.lang.RuntimeException: Unmatched delimiter: )

4:43 ro_st: &({} 1 [1 2 3])

4:43 lazybot: ⇒ [1 2 3]

5:50 grav: howdy

5:50 How does (String. byteArray "UTF-8") work?

5:50 There doesn't seem to be a java.util.String constructor that takes a byte array and a string

5:51 woops, there is ...

5:52 Ember-: indeed there is

5:52 grav: sometimes it helps just asking ;-)

6:06 augustl: are there any commonly used HTTP routing libraries out there other than compojure?

6:06 would like something more aware of things like content types, method not allowed, etc

6:06 p_l: hmmm... I seem to recall one

6:07 augustl: I guess this is what most people call REST nowadays :)

6:08 p_l: found

6:09 https://github.com/cmiles74/bishop https://github.com/banjiewen/Clothesline https://github.com/malcolmsparks/plugboard

6:10 the first one is the one I knew about, the other two were linked as "similar"

6:10 DrPheltRight: http://clojure-liberator.github.com/

6:11 augustl: http://clojure-liberator.github.com/

6:11 ah yeah :)

6:11 p_l: clojure-liberator is in a way followup on plugboard, afaik

6:11 anyway, look into WebMachine for inspiration :)

6:11 they actually implemented HTTP :P

6:11 Ember-: does liberator provide support for real REST?

6:12 augustl: liberator looks very nice

6:12 Ember-: meaning, it allows describing the API via HTML

6:12 p_l: Ember-: ...

6:12 augustl: Ember-: who does.. Even the wikipedia article messes up REST :)

6:12 p_l: that's not REST

6:12 Ember-: without you having to write that HTML yourself

6:12 p_l: wrong, what I described is REST

6:12 augustl: "REST has emerged as a predominant Web service design model." wikipedia says

6:12 Ember-: but 90% of the world things otherwise

6:12 augustl: at least the article has a "multiple issues" box at the top

6:13 p_l: Ember-: no. That's some custom documentation generated on top. REST is the flow based on HTTP state machine

6:13 HTML serving is an *example* of such

6:13 Ember-: but Roy Fieldling thinks it's like what I said and since it's mr Fieldling who _invented_ REST I'm kinda like thinking he is correct

6:13 no offense

6:13 REST is about resources

6:13 and that's it

6:13 if you're using it in any other way then you're building a RPC

6:13 p_l: Ember-: and HTTP's fsm. And HTML is jusst one kind of resource on it.

6:14 Ember-: totally fine, do a RPC if it's what you need

6:14 but please don't call it REST...

6:14 p_l: including auto-generated documentation in HTML served when you get apropriate content-type isn't required

6:14 Sgeo: What do Clojure people think about continuation-based web frameworks?

6:14 Ember-: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven

6:14 augustl: liberator = massive thumbs up, what a well defined project

6:15 Ember-: you've lost that fight :P Ref the wikipedia article

6:15 alexbaranosky: any of you using LIberator?

6:15 Ember-: augustl: not really. I'm not even trying to do that battle :P

6:15 augustl: Ember-: hypermedia is a better word, now that REST has been translated to mean HTTP

6:15 Ember-: just bringing this think up to make people a bit wiser

6:16 augustl: alexbaranosky: I'm about to

6:16 Ember-: think = thing

6:16 alexbaranosky: augustl: cool, am I correct in it being a thin wrapper over Compojure for expressing restful routes?

6:17 p_l: Ember-: ... none of those include requirement for HTML

6:17 * p_l read through the rules

6:17 augustl: alexbaranosky: no, it's an implementation of the entire HTTP flowchart

6:17 alexbaranosky: so you'll get 403 method not allowed, not 404, when you PUT to a path you didn't define a PUT for, etc

6:17 p_l: "Hypertext does not need to be HTML on a browser."

6:18 I feel old in such discussions -_-;

6:18 Ember-: indeed, in that I do agree

6:18 alexbaranosky: augustl: neat. It is built on top of Compojure though too right?

6:18 p_l: Ember-: yes, but you stated that as requirement for REST :)

6:18 Ember-: but in the web world it's HTML which is the de facto hypertext format

6:18 augustl: alexbaranosky: no, you need to use your own routing library

6:18 alexbaranosky: i.e. (ANY "/foo" (call-liberator-here ...))

6:18 Ember-: and no, not requirement for REST. Requirement for a REST library

6:18 sure, pass me that data via XML and I'm happy too

6:19 p_l: Ember-: HTML is just one type of resource that can be delivered by REST

6:19 REST library shouldn't deal with resource spec

6:19 Ember-: indeed, but it should provide a mechanism to generate that spec

6:19 p_l: nope

6:19 Ember-: well, let's agree to disagree?

6:19 and call it even

6:20 augustl: alexbaranosky: .. or so it seems :) Just been reading about it for a couple of minutes

6:22 Sgeo: So, no one cares about frameworks that are anti-REST?

6:23 Ember-: anti-rest?

6:23 you mean stuff like soap when talking about webservices?

6:23 soap is so blergh, hope I never ever have to touch that stuff again

6:23 Sgeo: I mean as in the URLs aren't necessarily meaningful

6:23 http://en.wikipedia.org/wiki/Seaside_(software)

6:24 p_l: Sgeo: I cared a bit, but I don't think you'll find a lot of support for them in stuff running on JVM ;)

6:24 Also, SOAP can be useful (just stay away from the god-damned RPC mode)

6:24 * Sgeo doesn't really know what SOAP is

6:24 p_l: it's just... not necessary for majority of "public" apis out there

6:25 Ember-: haven't heard of Seaside before, gotta check it out

6:25 Sgeo: It's Smalltalk though, which in my opinion is a great environment and IDE but not so nice language

6:26 (Still better than Ruby)

6:26 p_l: the difference with REST and SOAP is that SOAP didn't have nerdfights on keeping it "pure" :)

6:26 scottj: unfortunately the best seaside app (and one of the most impressive web apps I've ever used), Dabble DB, was closed when Twitter acquired them.

6:32 augustl: will kittens die if I name a Clojure project "com.domainname.thing"?

6:35 the name of the product/client is a domain name, so it's tempting :)

6:35 clgv: augustl: probably

6:35 augustl: domainname.com-thing vs com.domainname.thing

6:36 clgv: what exatly do you want to name? the group-id and artifact-id?

6:36 augustl: clgv: I'm embarassed to admit that after 6 months of working with clojure I don't really know the difference..

6:37 clgv: augustl: in leiningen you specify [group-id/artifact-id version]

6:38 augustl: clgv: ah

6:38 seems most clojure libs only has one of them

6:38 clgv: then the artifact-id is the group-id as well

6:38 augustl: there's org.clojure/clojure, and com.datomic/datomic-free, but also just "ring"

6:38 I see

6:42 Sgeo: ...Java ecosystem stuff, isn't it?

6:43 clgv: Sgeo: what do you mean?

6:43 Sgeo: artifact-id group-id etc

6:43 p_l: Sgeo: maven ecosystem, actually

6:43 Sgeo: Maven is a Javaish thing, isn't it?

6:43 clgv: hm well, I think it makes sense to have groups.

6:44 p_l: yes. Oh so javaish

6:44 bloated, with XML that makes you puke

6:44 so, yes, Javaish

7:14 augustl: hmm, it seems liberator is more focused on implementing the http spec than documenting itself and generally being convenient to use :)

7:22 has anyone here used liberator to build an API?

7:24 simonh: anyone have any experience with postgres on heroku with korma? i've seen john hume's post on the korma group (http://bit.ly/VHzxpV) but it's failing to compile on deployment. i'm guessing tis is the aot compilation problem (http://bit.ly/ZSDOFh)

7:27 the problem is splitting the DATABASE_URL btw. in john's example the db-uri is defd but there is no url to split at that point

7:52 augustl: seems to me that the examples from the liberator git repo doesn't describe a whole lot of real-world scenarios

7:53 for example, a PUT to /myresource/:id. How do you ensure a 404 via checking the database for that id?

7:57 cemerick: clojure.math.combinatorics has a (comment) form before its ns decl; how does this ever work? https://github.com/clojure/math.combinatorics/blob/master/src/main/clojure/clojure/math/combinatorics.clj#L7

7:58 silasdavis: Could anyone suggest a good way of mainting inline documentation - ideally that I could auto-generated human-readable html documentation from - for a restful API built with http://clojure-liberator.github.com and compojure?

7:58 maintaining*

7:59 augustl: silasdavis: oh hey, I was just asking whether anyone in here ever built something with liberator and had some tips to share :)

7:59 silasdavis: is it open source?

8:00 silasdavis: ah well I'm afraid I'm right at the beginning of it

8:01 augustl: I see

8:01 trying to figure out how you avoid double processing on validation, and avoiding double database fetch for :resource-exists?

8:02 silasdavis: yes it will be open source - it is messaging system for free text messages (like twitter), but based on a social graph of various relay/broadcast type relations

8:02 uses mongodb and neo4j

8:03 the base is quite generic but the application layers on top are support peer-to-peer and peer-to-clinician support in maternity units

8:03 augustl: I'm afraid I'm also new to clojure - but could memoize help?

8:03 augustl: well, I could use a thread local variable, but that's not very functional now is it :)

8:04 generally, I find the DSL of liberator to be problematic in that there's no direct flow in it, just a map of specifications

8:04 silasdavis: I haven't actually implemented anything with it yet

8:05 I've just used compojure

8:05 augustl: I see

8:05 silasdavis: do you think it's worth investigating at all?

8:05 augustl: I've just been playing with it for the last hour

8:05 I can't see how I'd be able to actually implement something with it

8:05 silasdavis: ok well I'm about to start writing some methods so I'll get back to you

8:05 augustl: probably mostly due to the lack of documentation though, for all I know

8:14 noidi: cemerick, why shouldn't it work?

8:31 cemerick: noidi: the namespace won't load if it's being required from a namespace that uses :refer-clojure

8:37 yogthos: silasdavis: I've got a tutorial on liberator if that helps ;) http://yogthos.net/blog/30-Making+services+with+Liberator

8:39 bpr: cemerick: why's that?

8:40 couldn't that be considered a bug?

8:52 cemerick: noidi, bpr: see http://groups.google.com/group/clojure-dev/browse_frm/thread/a59aa6419bc84ba1?hl=en

8:52 fixed on master

8:53 bpr: cemerick: ah cool

8:53 cemerick: thanks!

9:14 xificurC: if I have a .clj file saved at lets say C:/code/stuff/ and I want to load it in the repl in one go, how do I do it?

9:15 ro_st: ,(doc "load-file")

9:15 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol>

9:15 ro_st: (doc load-file)

9:16 clojurebot: "([name]); Sequentially read and evaluate the set of forms contained in the file."

9:20 xificurC: ro_st: thanks

9:26 I downloaded this snake game Stuart Halloway's book but I'm getting an error when loading it

9:27 FileNotFoundException Could not locate clojure/contrib/import_static__init.class or clojure/contrib/import_static.clj on classpath: clojure.lang.RT.load (RT.java:434)

9:27 silasdavis: thanks yogthos

9:28 yogthos: silasdavis: no problemo :)

9:30 xificurC: (import-static java.awt.event.KeyEvent VK_LEFT VK_RIGHT VK_UP VK_DOWN) <-- this doesnt seem to work

9:30 is this old>

9:30 ?

9:36 nevermind, it tries to :use examples.import-static but its not in the zip

9:42 this snake game: http://java.ociweb.com/mark/programming/ClojureSnake.html uses import-static as well, but it tries to load it from clojure.contrib. Where can one find it nowadays?

9:44 pjstadig: ~contrib

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

9:44 pjstadig: xificurC: you'll want to look here to try to find where import-static ended up ^

9:44 but it was probably dropped

9:47 xificurC: pjstadig: it's listed but not maintained. is there another library that serves the same purpose? If I understand correctly this was used to catch key presses

9:47 so that the snake's movement could be changed by pressing the arrow keys

9:48 pjstadig: xificurC: wish i could help, but i didn't even know that import-static existed until you mentioned it

9:48 if it didn't get migrated to new contrib, then it's possible that some other library exists to do the same thing, but i don't know

9:48 xificurC: so how does one read key presses nowadays in clojure

9:48 chouser: you can import java.awt.event.KeyEvent and then use KeyEvent/VK_LEFT

9:49 pjstadig: yeah you'll just have to qualify the static field names

9:49 xificurC: thanks pjstadig and chouser, I'll try

9:49 pjstadig: shouldn't affect the ability to read key presses, you'll just have to rework the code a bit

9:50 chouser: xificurC: another option: http://stackoverflow.com/questions/7878714/how-to-find-import-static-in-clojure-1-3

10:01 yogthos: xificurC: here's another example of handling inputs https://github.com/yogthos/Clojure-Tetris/blob/master/src/tetris/core.clj

10:09 jweiss: watchers are still called "alpha" in the docstring, even though they've been there for what, 3-4 releases? really still alpha?

10:09 * jweiss reluctant to rely on them

10:09 jweiss: $doc add-watch

10:10 chouser: I doubt they'd go away, but I suppose they're reserving the right to change their API.

10:10 silasdavis: is the license key a standard part of defproject - is it interpreted by lein to do anything in particular?

10:13 xificurC: yogthos thanks, i'll try to check that too

10:19 jweiss: is this a place to use transients: i'm repeatedly conj'ing onto a list in an atom. other threads might want to read that value as the conjing is happening

10:20 matthavener: jweiss: afaik, you cannot store transients in an atom

10:21 dnolen: jweiss: no - transients are performance optimization when you need to build some data quickly - never let them escape

10:21 matthavener: not true, you can put anything in an atom.

10:21 jweiss: dnolen: i see, so it's meant to be used locally, in a single thread

10:21 dnolen: jweiss: locally in a function preferable.

10:21 matthavener: dnolen: ah, for some reason i thought it detected that as "bad" and threw an exception

10:41 silasdavis: any style guidance on when to use 'use'?

10:41 yogthos: silasdavis: it's discouraged generally

10:41 silasdavis: I'm inclined to default to require, but I see that use might make certain files (like those containing routes) more DSL-y

10:42 so require everywhere then?

10:42 nDuff: use with :only can make sense

10:43 yogthos: I find there's 2 main issues with use, a) you don't know where things are coming from, b) you might get a collision with another namespace

10:43 * Sgeo wishes Smalltalk had namespaces

10:46 silasdavis: yes I see both of those, I suppose the case I have in mind is with compojure in a file containing primarily defroutes directives

10:46 is (GET "url" [] (foo)) nicer than (cc/GET "url" [] (food))

10:46 yogthos: like anything it's a rule of thumb, if use makes the code more readable then it's appropriate :)

10:55 silasdavis: is foo-bar a sensible clojure module name?

10:57 no it's not a valid class name

10:57 clgv: you can name a namespace like that

10:57 silasdavis: how should I name two word clojure modules then?

10:58 I read that it gets converted to and underscore when compiled

10:58 clgv: but the filename needs to have a "_" instead of the "-"

10:58 silasdavis: perhaps I should use an underscore to start with to reduce possible confusion?

10:58 what is the convention?

10:59 augustl: silasdavis: dashes for names, underscores in file names

10:59 yogthos: the convention is to use - in the names

11:01 silasdavis: if you have 3 identically named files in different namespaces and locations in the file structure, say 'message.clj' would you rename to 'message-tests', 'message-routes', and 'message-model'

11:01 ?

11:02 this would be similar to the convention in MVC.NET where you might have 'MessageController', 'MessageViewModel', etc

11:02 can't remember what rails does - it's more verbose but it makes the files more instantly recognisable by name...

11:07 yogthos: generally you'd make separate folders, for example routes.messages, models.message-model, etc

11:08 so you'd have structure like src/myapp/routes/messages.clj and the namespace name would be myapp.routes.messages

11:09 hyPiRion: Hey guys, have everyone upgraded to lein 2.0.0-RC2?

11:10 ToxicFrog: I'm still on pre7, apparently

11:12 babilen: hyPiRion: I have, why?

11:13 hyPiRion: babilen: If there's any bugs within RC2 I'd like to check them out before I get too busy with other things

11:15 babilen: hyPiRion: Well, apart from RC1's problem with lein-newnew I haven't seen anything. But I did not stress-test it (been mostly just using "lein repl" which was working fine for the projects I've been working with)

11:17 hyPiRion: babilen: Yeah, I think edge cases there are fixed. There was another one in RC1 regarding "lein upgrade" not working properly, but that's fixed as well.

11:18 It's just, well, I'd be sad if some trivial bug which is kind of a dealbreaker got into 2.0.0.

11:19 dgrnbrg: So, I'm trying to figure out if this is possible in core.logic: I have a collection of maps: [{:a 1 :b 2} {:b 3 :c 4 :d 5} {:d 6}] and I'd like to have a goal that unifies that to get {:a [1] :b [2 3] :c [4] :d [5 6]} as the answer (merging maps and concating values)

11:19 jweiss: anyone here run lazybot (either here on freenode, or another copy)? mine gets disconnected and won't reconnect himself. i just see a whole bunch of repeated ">>>PING :lazybot" in the log. no ping response but the bot does nothing to resolve the problem

11:26 TimMc: augustl: Reaching into the backlog... no, kittens will not die if you name your project "com.example/fnurbl". I can't promise the same if you name your project "stuff".

11:27 Rich_Morin: http://richhickey.github.com/clojure-contrib/doc/pprint/CommonLispFormat.html references http://github.com/tomfaulhaber/pprint-examples, but that gets a 404 error. Any ideas where it went?

11:27 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/doc/pprint/CommonLispFormat.html and try to stop linking to rich's repo.

11:28 hyPiRion: hahah.

11:29 Oh, speaking of cl-format, anyone here using it who would like to vet a bug in it?

11:29 $google CLJ-1134

11:30 Hrmph, lazybot doesn't like to search anymore. Oh well: http://dev.clojure.org/jira/browse/CLJ-1134

11:31 It's very easy to confirm it's a bug and that the patch works, as it's an implementation of a specification.

11:33 Rich_Morin: Thanks, lazybot, but http://clojure.github.com/clojure-contrib/doc/pprint/CommonLispFormat.html removes the broken link and says to look in "the clojure.contrib.pprint.examples package". Is http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/pprint/examples/?r=907 now the place to look?

11:37 TimMc: Rich_Morin: If you're doing archaeology, sure.

11:37 ~contrib

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

11:41 Rich_Morin: Unfortunately, when "clojure.contrib.pprint migrated to clojure.pprint", the examples seem to have gotten lost. I'm looking for some examples on how to extend pprint - suggestions welcome.

11:42 TimMc: Ah, I see.

11:42 So archaeology indeed.

12:01 devn: whoa, cool!

12:02 Google Refine lets you do transforms using Clojure

12:02 http://code.google.com/p/google-refine/wiki/Downloads?tm=2

12:04 pandeiro: i'd like to make available a wrapper for this lib: http://www.jthink.net/jaudiotagger/index.jsp - but it's in no repos anywhere as far as i can see... can anyone advise me on how to proceed?

12:05 yogthos: pandeiro: they do have a maven repo http://mavenhub.com/mvn/java.net-m2/org/jaudiotagger/2.0.3

12:06 pandeiro: yogthos: oops.. thanks! how'd you find that btw?

12:06 yogthos: pandeiro: so you'd reference it in your project as [org/jaudiotagger "2.0.3"]

12:06 pandeiro: google fu :P

12:07 * pandeiro bows

12:07 yogthos: hehe

12:11 maleghast: Anyone give me a quick pointer as to how to create a string representation (in MySQL Datetime format) of a today-a-year-ago - need a quick hit to construct a Korma Where clause...

12:13 frozenlock: maleghast: I like to use clj-time whenever I need to deal with time thingy.

12:13 maleghast: Thanks, I will look at that :-)

12:13 frozenlock: Cheers!

12:13 ejackson: maleghast: what frozenlock said

12:14 frozenlock: ewwww javascript... time to fire up the cljs repl!

12:19 Anyone knows of a cljs wrapper for envision? http://www.humblesoftware.com/envision/index

12:44 ppppaul: hey guise

12:47 frozenlock: What would be the quickest way to determine if a js library is compatible with the google closure compiler?

12:53 ppppaul: i'm parsing xml, (using data.xml and data.zip). when i hit a string of length 1, the parser makes a char instead of a string... is there an easy way for me to prevent this)?

12:54 pbostrom: frozenlock: in my experience, any js library is compatible in terms of calling it from cljs with advanced optimization turned off, if you want advanced optimization, there's possibly a little more work to do

12:55 frozenlock: if you want to turn on adv comp, then the quickest thing to try is to specify the js library itself as an extern file, if that doesn't work, then you'll have to write your own extern file for the lib

12:56 TimMc: ppppaul: <a> gives \a and <bc> gives "bc"?

12:56 frozenlock: pbostrom: thanks!

12:57 ppppaul: yes

12:57 TimMc: That's... insane.

12:57 ppppaul: well, actually <Number>2</Number> gives /2

12:57 TimMc: Still insane.

12:57 ppppaul: indeed

12:58 AWizzArd: I want to ask your opinion, about licensing. I found an interesting lib which is under gpl. I want to use it as a dev-dependency only, and think that because of this I can still freely chose my own license for my lib. It doesn’t have to be gpl, because I happen to use a gpl program during development time. Opinions?

12:58 technomancy: the GPL only applies to what you distribute

12:59 AWizzArd: no gpl code distributed – so free choice for me then

12:59 technomancy: you should be fine

13:00 AWizzArd: thx

13:00 technomancy: no problem

13:03 ppppaul: (xml1-> ) was doing weird things that i didn't expect

13:03 it was turning my string into a list of chars

13:04 i was only dealing with single length strings, so it looked like it was doing a char conversion, but it was doing really weird things with stings of length > 1

13:08 silasdavis: is (:require foo.bar.core :as foo) considered harmful?

13:09 ppppaul: lol

13:09 why?

13:09 clojurebot: why not?

13:09 ppppaul: foo/fn

13:09 how many foos do you need?

13:09 technomancy: silasdavis: I'd say yes; you should wrap it in a vector so you can add more clauses

13:09 silasdavis: technomancy: ah yes that too

13:10 ppppaul: (:require [foo.bar.core :as foo])

13:10 silasdavis: I mean I'm hiding the namespaces symbol

13:10 'foo'

13:10 ppppaul: i think foo is too common of a name

13:10 your namespace should be foo1 or something

13:11 however, if you have no other namespaces competing for 'foo' then you are good to go

13:11 silasdavis: ppppaul: noted, but will bad things happen if I alias a module with the name of a namespace?

13:11 ppppaul: i haven't used (alias) so i'm not sure

13:12 silasdavis: not alias then, whatever I'm doing there

13:12 TimMc: silasdavis: No, since no one is using single-segment namespaces. (Right? Right?)

13:12 jduan1981: let's say you are given a lazy sequence of infinite length, how can you find the first element that is repeated? e.g., given [1,2,3,4,5,1,7,8 …], should return 1

13:12 TimMc: silasdavis: Also, you haven't require'd the namespace foo.

13:13 ppppaul: jduan1981, that could take up a lot of mem

13:13 silasdavis: TimMc: ah so it means nothing outside of the ns macro?

13:13 ppppaul: conj to a list that you use (contains? on for each element in the infinite list

13:13 and cross your fingers

13:13 arrdem: ppppaul: won't work.

13:13 ppppaul: you can do (take-while)

13:13 arrdem: contains? never does a linear search

13:14 ,(contains? [1 2 3 4 5 6] 6)

13:14 clojurebot: false

13:14 arrdem: has to be a set or map.

13:14 jduan1981: so go through the sequence one by one and call contains?

13:14 arrdem: or some other lookup structure.

13:14 TimMc: jduan1981: loop/recur building up a set of seen items

13:15 ppppaul: <3 sets

13:15 jduan1981: loop/recur should work, is there a more functional solution? loop/recur seems a bit more imperative

13:15 TimMc: So?

13:16 jduan1981: just wonder if there's another way

13:17 cemerick: ,(reduce (fn [s x] (if (s x) (reduced x) (conj s x))) #{} [1 2 3 4 5 1 7 8])

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

13:17 cemerick: feh

13:17 jduan1981: that'll work in Clojure 1.5.0.

13:17 jduan1981: that's more functional!

13:17 let me try to understand it

13:18 TimMc: Yeah, but I don't like how the type of the reduce output changes.

13:18 cemerick: TimMc: that's one of the 12 ways in which reduced is *awesome*

13:18 TimMc: heh

13:19 tomoj: you mean you want reduce to return the reduced?

13:26 ppppaul: emacs clojure-mode, how do i add fancy syntax hilighting to symbols?

13:26 i want to hilite 'keep'

13:35 progo: hi-lock-mode for starters

13:41 rahcola: what are my options if I want to define (with def) something mutually recursive?

13:41 progo: (declare) your other function

13:42 jeremyheiler: Can also use trampoline.

13:43 TimMc: jeremyheiler: I don't think that helps...

13:45 rahcola: progo: not a function, and I'm gettin unbound errors with declare

13:45 jeremyheiler: TimMc: I suppose the "with def" requirement makes that so...

13:45 progo: rahcola: oh! :)

13:47 rahcola: I actually managed to make it work once with #'

13:47 did some reorganizing of the code and it stoped working

13:48 progo: well then. Run bisect with your DVCS of choice ;)

13:49 dnolen: rahcola: sounds like you're trying to do something at the top level, you should paste what you're doing - but mutually recursive values at the top level is not really supported.

13:49 TimMc: ~paste

13:49 clojurebot: paste is not gist.github.com

13:49 TimMc: ~botsmack

13:49 clojurebot: clojurebot evades successfully!

13:50 * nDuff is saddened by gist's recent descent in to suck

13:50 TimMc: nDuff: What changes?

13:51 nDuff: TimMc: New JavaScript that makes copy/paste often inoperable was the breaking point for me.

13:51 s/in to/into/

13:51 TimMc: ew, wha?

13:52 S11001001: anyway using gist isn't showing clojure pride

13:52 TimMc: That's not a change.

13:53 cemerick: nDuff: yeah, whatever editor they're using is badly broken

13:53 rahcola: http://pastebin.com/Sz112wnX

13:54 nDuff: *shudder*

13:54 (but... at least gist isn't pastebin.com)

13:54 rahcola: not even too sure why this would work in a strictly evaluating language

13:54 S11001001: yeah.

13:54 silasdavis: does anyone know how to serve different content types from the same url using liberator?

13:55 how would you achieve that with compojure alone

13:55 S11001001: nDuff: I don't understand its popularity.

13:55 nDuff: rahcola: ...for future note, pastebins with ads (and pastebin.com is historically full of 'em, often animated) tend to be frowned on a bit.

13:55 S11001001: Which one?

13:55 S11001001: nDuff: pastebin

13:55 given all the ads

13:55 nDuff: S11001001: Ahh. I think that comes from owning the domain linked to the vernacular.

13:55 ...only excuse I can think of, anyhow.

13:56 * nDuff can actually justify looking at ads for enough cool functionality -- ie. ideone.com's multi-language sandboxed execution

13:56 nDuff: ...but it's a matter of cost/benefit; pastebin.com is high-cost, low-benefit.

13:57 rahcola: nDuff: noted, can't actually see the ads my self, adblocked

13:58 S11001001: rahcola: not everyone can do that

13:58 dnolen: rahcola: yeah that's not going to work (the paste).

14:00 rahcola: just didn't know about the ads as I didn't see them :D. what would you recommend then?

14:01 nDuff: rahcola: ...well, in #clojure we tend to dogfood a bit and use refheap.com (written by Raynes in Clojure)

14:02 rahcola: ...personally I'm also kinda' fond of ideone.com, since it'll actually run your code server-side, so folks can see the bug you're reporting directly, you can see that fixes they propose work, etc.

14:03 (that one does have ads, but they're less conspicuous/annoying than pastebin.com, and... well, sandboxed server-side evaluation)

14:03 gist.github.com also used to be a popular choice, but some recent revisions broke it a bit.

14:07 rahcola: ok, this actually seems to work (again) https://www.refheap.com/paste/8654

14:07 lichtblau: Any ideas why the *nrepl* buffer would remain empty after connecting?

14:08 rahcola: is there a "right" way to do this?

14:08 ieure: Is Clojure metadata restricted to some arbitrary whitelist?

14:08 Because

14:08 (def xf (with-meta (fn [] "hey") {:my "sup"}))

14:08 TimMc: ieure: In terms of its contents? No.

14:08 lichtblau: I've got two emacses from different machines trying to connect to the same nrepl. One emacs (23.3.1) works, the other doesn't (23.1.1). (The one that I actually need is the one that doesn't work, and I don't have root on that system to try and upgrade...)

14:08 I'm pretty certain that I'm using the same nrepl.el and clojure-mode on both. Running emacs -q --no-site-file.

14:08 ieure: (meta #'xf) -> {:ns #<Namespace user>, :name xf, :line 1, :file "NO_SOURCE_FILE"}

14:08 dnolen: rahcola: like I said earlier, there is no good way to do what you want. You need to reformulate your approach.

14:08 TimMc: ieure: You're checking the var's meta, not the val's meta.

14:09 ieure: TimMc, Got it.

14:09 TimMc, And the attr-map in defn forms is set as metadata on the val?

14:10 TimMc: ,(meta count)

14:10 clojurebot: nil

14:10 rahcola: dnole: ok, thanks anyway

14:10 TimMc: ,(meta #'count)

14:10 clojurebot: {:ns #<Namespace clojure.core>, :name count, :file "clojure/core.clj", :line 810, :arglists ([coll]), ...}

14:10 ieure: TimMc, Right, so:

14:10 (defn hi ^{:sup "Hi"} [] "oh boy")

14:10 TimMc: ieure: On the var.

14:10 ieure: Does not show the :sup key on the var nor the val.

14:10 TimMc: There you're attaching it to the args. :-)

14:11 ieure: TimMc, Okay, I see.

14:11 TimMc: def and defn pluck metadata off of the symbol and (I think in some cases) the args, but mostly the symbol.

14:12 ieure: TimMc, I get it. Just wasn't thinking about how the reader interpreted what was sent to defn.

14:12 TimMc: nDuff: OK, yeah, gist definitely is less useful now.

14:12 ieure: And was confused by the [name doc-string? attr-map? [params*] body] doc on defn

14:13 bordatoue: hello , could anyone please tell me how to iterate through an Enumerator type in clojure

14:14 TimMc: ,(apropos 'enumer)

14:14 clojurebot: (enumeration-seq)

14:14 ieure: TimMc, Thanks for the clarification.

14:16 bordatoue: TimMc: i can't find a func apropos in clojure 1.4

14:17 silasdavis: if I have a module 'message-views', do I have to name it message_views.clj?

14:17 I was under the impression clojure or lein or something would handle this

14:17 ppppaul: i want to do destructuring something like this {{user-session :session} :as company-resp}

14:18 without the :keys keyword as i have a symbol collision

14:18 i haven't seen any examples of something like thiat

14:18 this, is is possible?

14:20 bordatoue: where is the function apropos defined

14:20 dnolen: ppppaul: {user-session :session :as company-resp} should work

14:20 jeremyheiler: bordatoue: clojure.repl

14:21 ppppaul: really?

14:21 bordatoue: jeremyheiler: thanks,

14:22 is there any way to link find doc from clojure repl on emacs

14:22 dnolen: ppppaul: yes

14:22 ppppaul: thanks. i thought i had trouble with it in the past... maybe i was doing something nutty

14:22 dnolen: ,(let [{foo :foo :as bar} {:foo 1}] [foo bar])

14:23 clojurebot: [1 {:foo 1}]

14:24 bordatoue: currently I am using C-c C-d d for doc \

14:30 ppppaul: i have changed my ways

14:32 amalloy: "where is the function apropos defined" - what a sad, ironic problem to have

14:36 clgv: amalloy: huh?

14:36 amalloy: because apropos is for finding things you don't know where they are

14:36 clgv: ah lol. I got bitten by that as well, but for other functions^^

14:38 amalloy: linux has its "whereis" ;)

14:39 bordatoue: there used to be a func called javadoc in clojure.repl i can't find it anymore

14:39 nz-: has anybody ran to any problems with newest lein and midje?

14:40 bordatoue: where is javadoc ? even apropos can't help

14:41 jeremyheiler: bordatoue: I refer you to http://clojure.github.com/clojure/

14:41 TimMc: amalloy: Actually, apropos is bad for that -- it tells you that something exists, but not where it found it. :-(

14:41 nz-: lein midje started giving Could not locate bultitude/core__init.class or bultitude/core.clj after upgrading lein from preview10 to RC2

14:41 TimMc: bordatoue: (use 'clojure.repl) if your repl doesn't do it for you

14:42 nz-: adding bultitude 0.2.0 to dependencies fixes things

14:47 bordatoue: TimMc: Is there any general rules / policies that are used to determine which fns needs to be stored in under certain namespaces, for example 'clojure.repl

14:48 frozenlock: Any `fetch' user here? I'm wondering why (fm/letrem [a (adder 3 4)] a) returns nil, but (fm/letrem [a (adder 3 4)] (print a)) will print 7...

14:48 augustl: I'm mapping a collection. But one of the map operation might throw an exception. In that case, I need to get the item in the collection that caused the exception and return it applied to a function. Suggestions? :)

14:49 TimMc: bordatoue: I don't think there are any explicit policies, but you'd have to ask someone from Relevance I mean Clojure/core.

14:49 frozenlock: TimMc: finger slipped? :P

14:49 TimMc: Yeah, the keys are *right* next to each other, for some reason.

14:51 bordatoue: General question, do you have 'clojure.repl loaded in your namespace while working on clojure. I am asking because when I use 'clojure-jack-in i don't usually load clojure.repl

14:52 frozenlock: Ok now `fetch' really confuses me... (fm/letrem [a (adder 3 4)] (def tt a)), tt ---> 7

14:54 TimMc: bordatoue: I get annoyed if it's not there, yes.

14:55 bordatoue: thanks

15:02 gfredericks: are there any clojure testing libs that can create mock java objects?

15:05 nopolabs: Can't resist: http://www.dehora.net/journal/2008/12/02/qotd-mock-objects/

15:06 dnolen: augustl: catch the exception in your map fn and throw ex-info

15:06 Sgeo: I like Lisps

15:07 Slightly annoyed that Smalltalk is not a Lisp

15:07 >.>

15:08 craigbro: hehe

15:09 augustl: dnolen: I actually know beforehand where the exception will be, the array wil contain a nil. So I'll just look for that :)

15:09 s/array/mapped list/

15:09 Iceland_jack: Sgeo: So you want SmallTalk to be even less popular :)

15:10 Sgeo: Nooo

15:10 Actually, I'm sure if Smalltalk were more popular, I'd be against it. I feel like a language hipster sometimes :/

15:10 technomancy: better find a new obscure language, Clojure is getting dangerously popular

15:11 may I suggest Io or Factor?

15:11 Iceland_jack: I would suggest mine but I don't want to ruin then

15:11 *them

15:14 Sgeo: I think the thing scaring me from Io is largely issues getting it to work on Windows

15:14 technomancy: seems like that'd be a plus for a hipster language

15:15 brehaut: my new language is only going to run on plan9 and arch linux

15:16 seangrove: Hrm, how can I tell if a variable is a function in cljs? Something like (= (type #()) "function")

15:17 frozenlock: seangrove: (fn? +)

15:17 TimMc: Sgeo: I only write my programs in Fixie.

15:17 seangrove: frozenlock: hrmp

15:18 Thanks!

15:18 Sgeo: seangrove, do you want :foo to count as a function?

15:18 seangrove: Nah

15:18 Sgeo: Wait, I have no idea if cljs has ifn?

15:18 seangrove: Just keeping it basic

15:18 Sgeo: Ah, ok

15:20 nz-: technomancy: has leiningen started to do something different with bultitude since 2.0.0-preview10?

15:25 technomancy: nz-: it's now contained on the bootclasspath rather than loaded as part of a plugin

15:26 nz-: lein midje started complaining that bultitude is not found after I upgraded lein preview10->RC2

15:26 technomancy: nz-: did you see the mailing list thread? seancorfield got it working.

15:27 Sgeo: Factor is cool in some ways, but annoying in others

15:27 nz-: technomancy: i missed that one

15:27 Sgeo: Smalltalk's ifTrue:ifFalse: is far more readable

15:30 TimMc: technomancy: Was it in fact a lein-midje bug?

15:30 nz-: http://librelist.com/browser//leiningen/2013/1/14/changed-behavior-between-preview10-and-rc1-2/#dda732eae0e59724a91f0fba324657ef

15:31 technomancy: TimMc: not sure

15:33 TimMc: Huh. Using :plugins isn't exactly a workaround, since that's really the right way to use it, but Marick's stacktraces are pretty weird.

15:34 nz-: it seems that it triggers in midje 1.4 even if you put lein-midje to plugins, if I change midje to 1.5-alpha5, it starts to work

15:35 also putting bultitude to dependencies fixes this

15:36 my project.clj: https://github.com/RuuviTracker/ruuvitracker_server/blob/master/project.clj

15:47 TimMc: technomancy: You said that newnew has temporarily been copied into leiningen -- will any modifications to the included version be propagated back?

15:51 I ask because I'd like to make a better fix than "quadruple bacon backslashes", but I'm not sure where to put it.

15:52 technomancy: TimMc: it's not temporarily; I just haven't updated the newnew readme to explain that the copy in leiningen is now canonical

15:52 TimMc: k

15:53 technomancy: nz-: so it sounds like a bug in midje 1.4 that was taking advantage of a bug in older versions of Leiningen perhaps?

15:53 some kind of weird classpath leakage

15:58 nz-: something like that

16:03 frozenlock: Any templates to create new cljs project? (Something with ring perhaps?)

16:06 TimMc: stuartsierra: Does http://dev.clojure.org/jira/browse/CLASSPATH-4 need anything to move forward? (java.classpath breaks when there are spaces in the pathnames)

16:06 amouat: frozenlock: there's a few I think, including lein-cljsbuild

16:07 stuartsierra: I hate JIRA.

16:07 aroemers: frozenlock: or have a look at the Luminus project: https://github.com/yogthos/luminus-template

16:07 TimMc: heh

16:07 stuartsierra: I'll add it to my TODO list.

16:07 TimMc: Thanks!

16:07 stuartsierra: np

16:08 aroemers: it is quite new and under development, but that may be fine for you

16:11 frozenlock: read more about Luminus in the posts at http://yogthos.net

16:13 amouat: aroemers: looks good - wish I'd seen it before starting my cljs project yesterday!

16:13 frozenlock: amouat: I already use lein-cljsbuild for compiling.. it's not really what I'm looking for. But thanks for the input.

16:14 rlander: amouat: have you used it for an actual prod app?

16:14 frozenlock: aroemers: Thanks. Again, not really what I was looking for (I just want a dev environment for a cljs library), but it sure looks very nice for a complete app!

16:14 amouat: I just found the blog post I read the other day: http://squirrel.pl/blog/2013/01/02/get-started-with-clojurescript-with-leiningen-templates/

16:15 aroemers: it's just a side project, but hopefully it will get used

16:15 aroemers: frozenlock: no problem

16:15 amouat: still struggling to get started really :(

16:15 aroemers: rlander: ^^

16:16 rlander: amouat: oops, I think I meant aroemers

16:16 frozenlock: "get-started-with-clojurescript-with-leiningen-templates" Well that looks promising :P

16:18 amouat: sorry, and I meant rlander ;)

16:18 aroemers: rlander: No, I haven't. But I read about it and thought it is nice project.

16:18 rlander: aroemers: Yes, I'm taking a look at the docs now. =)

16:21 yogthos: Is compojure the only routing lib on Luminus? Are you planning on supporting more?

16:21 yogthos: rlander: I wasn't really planning on using others at the moment, is there reason to?

16:22 rlander: moustache would probably the other popular one

16:22 rlander: yogthos: In my case, yes.

16:22 yogthos: as far as I can tell they provide fairly similar functionality and compojure is probably more popular

16:23 rlander: yogthos: I'm actually not a fan of either compojure nor moustache

16:23 yogthos: rlander: which one do you use?

16:24 rlander: yogthos: none atm, but I'm getting there https://github.com/rlander/fevre =)

16:24 yogthos: rlander: ah a new effort :)

16:24 rlander: yogthos: I like all my routes in a single place.

16:25 yogthos: rlander: that's sort of how compojure does it by default though no?

16:25 rlander: you have (routes ...)

16:25 it lets you break them up into groups, but doesn't require doing that

16:25 rlander: yogthos: Well, sortof...

16:26 yogthos: first, there's no built-in reverse-url mechanism

16:26 yogthos: and nobody's been able to figure out one yet.

16:26 seangrove: ohpauleez: Any chance of a new shoreleave-browser release? The current version of chrome chokes on the Blob constructor in the current release

16:26 yogthos: rlander: heh I think there was a discussion on this topic yesterday :)

16:27 seangrove: I'm working from head now, but seems like it'd qualify for a point version release

16:27 rlander: yogthos: ohh, coll. I'll go back and read the logs.

16:27 *cool

16:29 yogthos: anyways, I like Luminus' conventions a lot, but why not let each project define it's own libraries, like ruby's Padrino does (padrinorb.com) ?

16:30 yogthos: or monkrb

16:33 biff_tannen: what are some real applications that use clojure ? i define 'real' as customer-facing, scalable, etc ...

16:33 having some relative usefulness

16:33 tolsen: jux.com uses clojure called by jruby on rails for optimizing layout of photos

16:33 systemfault: twitter storm is written with clojure IIRC

16:34 nickmbailey: it is

16:34 or mostly

16:34 systemfault: storm is far from being a toy.

16:35 egghead: more from marz, cascalog for cascading/hadoop workflows

16:37 biff_tannen: some popular companies using clojure: http://geni.com http://runa.com http://www.factual.com/ there are tons of others

16:37 dnolen_: biff_tannen: do you mean companies building products w/ it? There are quite a few now

16:37 egghead: groupon is another big name using it, but I think it's mostly internal there, not 'customer facing' as such

16:38 frozenlock: biff_tannen: https://bacnethelp.com is written entirely with clojure and cljs. But I'm bad at webdev, so I don't know if it's a valid example :P

16:38 technomancy: biff_tannen: clojars is the biggest OSS clojure web app

16:38 ohpauleez: seangrove: It's in master

16:38 it'll be cut to release shortly

16:39 There are updates across the all the modules

16:39 and a new one about to be released: shoreleave-baseline

16:42 I'll cut some snapshot releases by Friday

16:44 frozenlock: technomancy: wouldn't Lein also be a perfect example? Must be one of the most used clojure project.

16:49 technomancy: frozenlock: sure, but it's not very typical of a customer-facing program unless your customers are hackers

16:50 biff_tannen: tolsen egghead dnolen_ frozenlock technomancy thank you

16:52 tmciver: biff_tannen: why don't you make like a tree . . . and get outta here.

16:52 * tmciver hopes everyone gets the "Back to the Future" reference.

16:52 biff_tannen: its leave

16:52 make like a tree and LEAVE

16:52 technomancy: tmciver: I was tempted to make that joke too =)

16:52 biff_tannen: you sound like a DAMN FOOL when you say it like that

16:52 tmciver: Love those movies.

16:53 systemfault: 1.21 GIGAWATTTS!

16:54 In french... the dolorean takes a lot more energy... 2.12 gigawatts.

16:54 *2.21

16:55 TimMc: Arg, what keeps creating ~/repl-port?

16:55 egghead: lein

16:55 frozenlock: I'm leaving this here for logging and google search: I had a question earlier about how to get a value when using the `fetch' library in cljs. It would always return nil. I asked M. Granger if it was possible to get the value of anything inside a fetch: "Unfortunately no :( By the nature of JavaScript letrem is an asynchronous block, meaning that it will execute at a point later and simply return nil for now. The block gets execute

16:55 when the server responds and so you need to think about your flow a little differently. Instead of returning something, it's basically just a callback and so everything you expect to happen as a result needs to happen in functions called within that block."

16:56 egghead: quick technomancy how do I make nrepl not dump repl-port files everywhere or at least clean them up when I control+d

16:56 technomancy: egghead: should be fixed in the latest

16:56 egghead: ah cool, will pull latest then, cheers!

16:57 yogthos: rlander: well that's sort of what the +foo module support is like

16:57 rlander: you could write a plugin which will swap out compojure with something else fairly easily

16:58 rlander: yogthos: +foo module support?

16:58 yogthos: rlander: http://www.luminusweb.net/docs/profiles.md

16:58 rlander: yogthos: ahhh, gotcha

17:11 dpick: hey guys, any idea why hitting a url in the browser and grabbing it with wget would give me once set of html and grabbing it with slurp or clj-http would give a another?

17:11 doesn't seem to be a user agent thing

17:11 pmonks: redirects? <warning: n00b>

17:12 dpick: does slurp not follow redirects?

17:12 (there are redirects)

17:12 pmonks: No clue sorry…

17:13 technomancy: I think curl doesn't by default

17:13 rboyd: dpick: wireshark?

17:13 brehaut: slurp is powered by java.net.URL et al right?

17:13 amalloy: curl doesn't follow redirects

17:13 brehaut: im pretty sure it doesnt follow redirects by default either

17:13 amalloy: slurp doesnt either last i checked

17:14 dpick: I set wget to not follow redirects and it just bombs out early, I don't get any html

17:14 rboyd: nothing interesting there, just a couple of 302's

17:14 brehaut: dpick: get wget to display the response

17:14 'bombs out early' isnt really science

17:15 dpick: it sends back a 302 and wget doesn't follow it

17:15 arohner: is there a version of hash-map that accepts duplicates without throwing?

17:15 amalloy: i think in 1.5 that function is hash-map

17:16 prior to 1.5, your best bet is assoc or into

17:16 dpick: ahhh crap figured it out

17:16 the server sends a different redirect if the client doesn't accept cookies

17:16 AWizzArd: I have N doubles, and would like to use the format string "%,11f". I don’t know however what my N is. Can be between 1-15. Is there a format directive to say “use this format string for all args and divide them by two spaces”?

17:17 arohner: amalloy: thanks

17:18 amalloy: AWizzArd: (s/join " " (map #(format ...) doubles)))?

17:19 AWizzArd: yes, I use join so far, but thought there might be something else

17:19 brehaut: jkkramer's formative lib (https://github.com/jkk/formative) looks interesting

17:20 jkkramer: brehaut: you just beat me to soliciting feedback about it ;)

17:20 brehaut: lol :)

17:20 its not often i snipe anyone from the other side of the world

17:22 dpick: \q

17:22 brehaut: jkkramer: is it possible to extend datatype?

17:23 jkkramer: brehaut: yes, with formative.parse/parse-input

17:23 (a multimethod dispatching on :datatype or :type)

17:24 brehaut: cool

17:27 jkkramer: based on reading only the docs, it seems solid.

17:27 jkkramer: brehaut: it's been in development a while, and seen some real-world usage

17:28 brehaut: cool

17:28 kovas_: ohpauleez: ping

17:28 brehaut: i like that everything is data and that you've seperated all the bits

17:29 kovas_: ohpauleez: I'm having an issue with BlobBuilder. Is that limited to shoreleave-browser, or does it affect (possibly transitively) the other modules also?

17:29 technomancy: jkkramer: looks good

17:29 wish I had found that before I started syme =)

17:30 jkkramer: have you considered putting the source next to the rendered form in the demo app?

17:30 jkkramer: technomancy: not a bad idea, I will do that

17:31 technomancy: does syme do form stuff? I thought it was like a pair coding thing

17:32 technomancy: jkkramer: there's a single form in it, but it's not tricky by any means

17:32 well, technically two if you count the single-form "which project?" splash

17:34 jkkramer: technomancy: ah yep I see

17:35 technomancy: btw, do you know about the placeholder input attr? it does basically what your onfocus/blur handlers are doing

17:35 technomancy: jkkramer: aha; I did not. is that part of HTML5?

17:35 brehaut: technomancy: yes

17:35 technomancy: my web programming skills are basically c. cutting-edge-2008

17:36 thanks

17:36 jkkramer: most sane browsers support it these days

17:36 * frozenlock brings IE to the table

17:36 technomancy: I doubt any IE users would want to use Syme anyway =)

17:37 brehaut: technomancy: im not sure web technology has a cutting edge. just less rusty than previously

17:38 frozenlock: cljs : In my project I've added :foreign-libs [{:file "libs/envision.min.js" :provides ["envision.core"]}]. Now I require it in my ns declaration: (:require [envision.core :as v]). How can I access a js function envision.templates.myFn ?

17:38 michaelr525: am i not supposed to start a project from lighttable if I want to work on it from lighttable?

17:38 there is no "new project" command..

17:39 dcjackson: technomancy: all of sudden today lein2rc1 and lein2rc2 are glacially slow. Seemed to start right after I first attempted to upgrade to rc2. Takes MINUTES to run lein version. Any ideas what is wrong with my setup? OSX, been running lein for years….

17:39 technomancy: dcjackson: haven't heard of that

17:40 upgrading to rc2 made rc1 slow too?

17:40 what about preview20?

17:40 10

17:40 dcjackson: here is what happened once: ✗ lein2rc2 version

17:40 Jan 15, 2013 2:19:34 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute

17:40 INFO: I/O exception (java.net.SocketException) caught when processing request: Connection reset

17:40 Jan 15, 2013 2:19:34 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute

17:40 INFO: Retrying request

17:40 Leiningen 2.0.0-RC2 on Java 1.6.0_37 Java HotSpot(TM) 64-Bit Server VM

17:43 p10 is very snappy

17:44 they all seem to work now

17:44 something is strange

17:44 Perhaps this is some sort of weird network issue for me

17:45 ohpauleez: kovas_: Just the browser

17:45 it's all patched up in master

17:46 new releases for everything should be done by Friday

17:46 kovas_: cool. i just upgraded my deps and it seems to work again

17:46 technomancy: dcjackson: you shouldn't need to hit the network if your ~/.m2 has been primed

17:47 dcjackson: lein deps

17:47 Could not transfer artifact postgresql:postgresql:pom:9.2-1002.jdbc4 from/to mvnrepository (http://mvnrepository.com/): Failed to transfer file: http://mvnrepository.com/postgresql/postgresql/9.2-1002.jdbc4/postgresql-9.2-1002.jdbc4.pom. Return code is: 502, ReasonPhrase:Bad Gateway.

17:47 This could be due to a typo in :dependencies or network issues.

17:47 Could not resolve dependencies

17:47 that jar is in m2 for sure

17:48 technomancy: dcjackson: so this is only inside a specific project?

17:48 dcjackson: want me to try another project?

17:48 technomancy: yeah, or outside

17:49 it could be we default to unreasonable fetch timeouts

17:52 dcjackson: technomancy: I am having various problems still

17:52 outside of a project, lein version seems to work OK

17:53 In a project, lein or lein version are OK. But lein deps hangs, as does a line run alias

17:59 xeqi: dcjackson, technomancy: I notice its looking for the pom, not the jar. Also should mvnrepository.com resolve in a browser?

17:59 ah, 504 Gateway Time-out

17:59 dcjackson: There is no pom for that jar

17:59 :-(

18:00 in my .m2

18:00 can't find one on the net. so I've just been using the jar

18:00 alone

18:01 hyPiRion: Humm, make up one with no dependencies

18:01 technomancy: using a jar without a pom would probably make lein very confused

18:02 xeqi: eh, it just means it tries to find the pom, fails, and then acts as if it doens't have any dependencies

18:02 dcjackson: well, you would know, but it seems to have been working ok

18:02 xeqi: which based on an older version of postgresql seems fine

18:02 if you want to stop the network looking for it copy http://search.maven.org/remotecontent?filepath=postgresql/postgresql/9.1-901-1.jdbc4/postgresql-9.1-901-1.jdbc4.pom

18:02 and change the version name

18:03 since it looks like a basic pom w/o dependencies that should work fine

18:03 dcjackson: I'll try that

18:09 tomoj: Raynes: my markup has [{:type :element :tag :p} "\n\n" {:type :element :tag :table}]

18:09 which requires (l/adjacent-to (l/element= :p) (l/any) (l/element= :table))

18:10 bug or intended?

18:10 dcjackson: technomancy, xeql: Well, one of two things helped a lot: I went back and ran lein2p10. That had NO problems doing a lein deps, etc. Also I did what xeql proposed, copied the other postgresql .pom into the new directory . now rc2 works fine

18:10 tomoj: ..maybe I should just run htmlcleaner on the markup before I parse it?

18:11 blackdog: hey - what's the current hotness for emacs-clojure interaction?

18:11 egghead: blackdog: I like nrepl

18:11 https://github.com/kingtim/nrepl.el

18:11 tomoj: or maybe I just want ~ instead of +

18:11 blackdog: egghead: cheers

18:13 dcjackson: xeql, technomancy: thank you for the help. Now I am back to my previous level of productivity :-)

18:14 xeqi: dcjackson: hurray, looks like the network at mvnrepository.com fixed as well

18:15 my theory - slowness due to looking for the jar would have hit p10 as well, but they finally fixed it. However, now that you have the pom in place it shouldn't matter anymore

18:15 * looking for the pom

18:16 Raynes: tomoj: That's more or less a bug. Could you open an issue? There are a couple of ways I could fix it.

18:17 frozenlock: Is there js->cljs cljs->js now in cljs?

18:17 (IIRC one of the two wasn't)

18:18 egghead: ya frozenlock

18:18 both are in there now

18:18 frozenlock: \o/

18:18 .. which ns?

18:19 egghead: (ns cljs-app.yunoincore)

18:19 frozenlock: Damnit... it threw an error before I 'got it'

18:20 tomoj: Raynes: also: https://www.refheap.com/paste/441a891419f3cd7d74f06ecec

18:20 bug?

18:20 clojurebot: Paste the contents of project.clj and ~/.lein/init.clj along with the output of ls ~/.lein/plugins and lein version.

18:21 tomoj: I forgot the </table>, but that doesn't change anything

18:21 Raynes: tomoj: What specifically?

18:21 frozenlock: egghead: wait.. aren't supposed to have access to the core fns in any ns? str, print, +... they all work fine.

18:22 tomoj: well, possible bug 1: adjacent-to doesn't skip whitespace (probably it shouldn't?)

18:22 possible bug 2: in that refheap, I expect to get (("foo" "bar") ("baz" "bing"))

18:22 egghead: ya frozenlock, was just saying you don't need to manually include that snippet anymore

18:23 tomoj: s/whitespace/text nodes/ I guess

18:23 Raynes: tomoj: Probably a bug. I'm actually on a phone at the moment. I'll try this out and see what's up asap.

18:23 * Raynes means that he is IRCing on a phone.

18:24 TimMc: Raynes would never be so uncool as to actually place a voice call.

18:24 frozenlock: egghead: I must be doing very wrong... (clj->js {:a 1}) should do it, right?

18:24 TimMc: That's for *old* people.

18:25 tomoj: Raynes: no prob, I should be doing something else right now anyway

18:26 egghead: frozenlock: maybe it's a version thing? https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L6927

18:30 arohner: is there a known issue with (merge) in 1.5?

18:31 in 1.4, (merge) returns nil, while in 1.5.0-RC2, (merge) throws

18:33 frozenlock: egghead: Yup, I was using lein-cljsbuild 0.2.8 insteand of 0.2.10. Thank you :)

18:33 zodiak: arohner, (merge) doesn't throw for me in 1.5.0-rc2

18:33 ivan: do the examples in https://github.com/frenchy64/typed-clojure bother anyone else because the function name appears twice?

18:34 * ivan looks for a typeddefn macro

18:36 arohner: zodiak: hrm. I was going to try to reproduce it, but now I'm getting a different error. Maybe I had something else weird going on

18:37 dnolen_: ivan: not really since that's how it is in Typed Racket (on which it is based) and various other typed langs.

18:37 ivan: huh.

18:38 my memory of a concise version when it was first released must be failing me

18:38 * nDuff doesn't like it (re: typed clojure adopting highly verbose conventions), but... well, it is what it is.

18:38 nDuff: ivan: The release that came with the original paper describing it had that same convention.

18:39 dnolen_: ivan: he may have toyed around with syntax but that would have been back before Google Summer of Code started I think

18:39 last year

18:56 weavejester: Hmm. When I add seque to my program, it blocks for 60 seconds before exiting.

18:57 hiredman: weavejester: seque cause the agent pools to spin up

18:58 weavejester: Hm, so a shutdown-agents might be in order

18:58 I guess they must use an executor with a 60 second keepalive or something

19:03 frozenlock: Is there some way to have a namespace require different libraries depending on wether it's in prod on dev?

19:03 *or

19:04 weavejester: Frozenlock: Use an environment variable to determine the difference, and then use a case statement to determine which libraries to load?

19:04 technomancy: or have a different :src-paths entry in the :dev profile

19:05 weavejester: technomancy: That's a better idea

19:05 hiredman: Thanks for pointing me in the right direction. It exits immediately now.

19:06 frozenlock: technomancy: That might do it :)

19:07 weavejester: For ages I thought the timeout was due to my own ineptitude in configuring a custom executor. I forgot that agents use one too.

19:37 blackdog: why does the first work but the second doesn't? https://gist.github.com/4543502

19:37 hiredman: what is the value of .getName?

19:37 blackdog: i get "can't resolve symbol: .getName in this context"

19:38 it's a method on the java object

19:38 hiredman: what is the value of .getName?

19:38 blackdog: well, obviously it's undefined, at least in the second one. that's why i'm asking: is there some voodoo that brings it into scope in the first form?

19:38 hiredman: ,(macroexpand '(.foo bar))

19:39 clojurebot: (. bar foo)

19:40 Sgeo: .foo is not a value, it is syntactic sugar

19:42 blackdog: Sgeo: ok. is there a value i can pass in to map that will do the right thing?

19:43 Sgeo: #(.getName %)

19:44 ,(map #(.toString %) [1 2 3])

19:44 clojurebot: ("1" "2" "3")

19:44 Sgeo: (Although in this case I would use str, but you get the drift)

19:45 blackdog: whee, so much syntax:) can you explain what's happening there? is #( ... %) a special form?

19:45 * blackdog is a bit adrift without a type system gently telling him he's an idiot :)

19:45 zodiak: blackdog, it's short hand for an anonymous function

19:45 Sgeo: It's syntax sugar for a lambda

19:46 blackdog: ah, ok. that's right, remember seeing that in joy of clojure

19:47 i miss partial application :/ guess that's the price for variadic functions.

19:47 Sgeo: ,(map (partial + 1) [1 2 3])

19:47 clojurebot: (2 3 4)

19:48 brehaut: blackdog: you mean you miss automatically curried functions

19:48 * Sgeo gathers that blackdog is a Haskeller?

19:48 blackdog: brehaut: yes, was imprecise.

19:49 Sgeo: yeah. looking around for functional-ish stuff on the JVM, and scala scares the living shit out of me.

19:49 Sgeo: For me, Clojure is mostly a thing I look at in spite of the JVM, not because of it

19:50 I like Haskell, but also like macros and the ability to change code at runtime easily

19:50 frozenlock: What the... when I add domina to my dependencies, clj->js stops working o_O

19:50 TimMc: blackdog: The various syntactic forms should be covered by http://clojure.org/reader

19:50 blackdog: Sgeo: don stewart's thesis was interesting there - showed how far you can push dynamic systems in haskell

19:50 Sgeo: blackdog, I haven't seen it

19:51 blackdog: still, it's not trivial, and it's certainly not the way haskell systems are typically built

19:51 brehaut: blackdog: the problem with that is that dons is a genius and some of us are not

19:51 (and by some of us i mean me)

19:51 blackdog: Sgeo: code.haskell.org/~dons/papers/thesis/dons-phd-thesis.pdf

19:51 brehaut: :) i agree entirely.

19:51 (he used to be my cubicle-mate at UNSW - scarily productive & smart guy)

19:51 * Sgeo is trying to get back into Smalltalk, but it's so.... single-dispatch-OOy and unfunctional

19:52 Sgeo: I like it for the IDE, not the language

19:52 brehaut: university of new south wales?

19:52 blackdog: brehaut: yeah

19:53 brehaut: blackdog: just across the ditch then

19:53 blackdog: brehaut: oh, you're an NZer?

19:53 brehaut: yeah

19:53 blackdog: do you functional types hang out much? I know stephen blackheath and hamish mackenzie are kiwis

19:53 brehaut: i dont know either of them

19:54 ive not met many kiwi FP people

19:54 blackdog: i took stephen to an nz railscamp a while back and he proselytised haskell at the unwashed rails hackers for three days :)

19:54 brehaut: lol

19:54 blackdog: ah - stephen's the guy who got ghc working on ARM and iOS. hamish is working on the haskell ide

19:55 brehaut: sure

19:56 the closest i get to know those kinds of people is a friend who partially ported GHC to the CLR, he's not a FP guy though.

19:57 TimMc: brehaut: Dammit, I'm reading about the eymology of "kiwi" and now I've completely scanted out on the word.

19:57 brehaut: timmc: scanted?

19:58 TimMc: smock smock smock smock smock

19:58 brehaut: ◎_◎

19:58 TimMc: https://en.wikipedia.org/wiki/Semantic_satiation

19:59 blackdog: TimMc: you're a verbal terrorist :)

19:59 brehaut: TimMc: oh true.

19:59 Sgeo: semantic satiation semantic satiation semantic satiation semantic satiation

19:59 brehaut: TimMc: Squirrel does this to me all the time

19:59 TimMc: I was hoping you'd get the Calvin & Hobbes reference and I wouldn't have to try to remember the more formal term.

19:59 egghead: hmm

19:59 30-mins isn't a valid symbol eh :(

19:59 brehaut: i have not read C&H in many years. i need to remedy that

20:00 TimMc: (Hmm, that C&H strip was not actually about scanting out.)

20:00 egghead: &'30-mins

20:00 lazybot: java.lang.NumberFormatException: Invalid number: 30-mins

20:00 egghead: is this a feature of clojure or an artifact of the host?

20:02 Sgeo: Probably Clojure

20:02 Apage43: symbols must begin with a not-number

20:02 TimMc: The stack trace appears to indicate LispReader.

20:02 Apage43: Right. It's because the reader.

20:02 You can, if you really want to intentionally construct a symbol object that if asked its name will give you something that can't be read back by the reader

20:03 ,(symbol "30")

20:03 clojurebot: 30

20:03 Apage43: which would be read back of course as a number, not a symbol

20:04 TimMc: &(-> 30 str symbol pr-str read-string class)

20:04 lazybot: ⇒ java.lang.Long

20:04 dnolen: egghead: not a valid symbol

20:05 egghead: guess It's because of my poor knowledge of the reader

20:05 amalloy: if you made the reader accept 30num as a symbol, you'd have to change a lot of the compiler as well, because it often turns symbols into class names or member variables

20:05 TimMc: I think the reader is an LL(1) parser, yeah?

20:06 amalloy: yeah, i think so

20:08 TimMc: Although... that really depends on the tokenizer.

20:08 Based on the dispatch table stuff, I'm gonna guess the "tokens" are always characters.

20:10 Holy crud, C++ isn't context-free-parseable?

20:10 brehaut: indeed it is not

20:10 crazy eh

20:12 TimMc: That means that someone knew *exactly* how complex the syntax was befor releasing it, because they had to implement a parser first...

20:14 blackdog: TimMc: suspect it went like this: "Welp, we can either implement this pig-ugly grammar, or sit through another six months of standardisation meetings. Pig-ugly it is."

20:17 tomoj: hmm, does clojars order by date? https://clojars.org/ring

20:17 1.1.7 is 'newer'

20:17 need a semver library

20:17 weavejester: It must be by date

20:18 I fixed and released 1.1.7 first because more people use 1.1

20:19 Foxboron: putting my hands on emacs and nrepl for the first time. Damn, big learning curve from using Sublime Text :/

20:24 frozenlock: Errm... a javascript library I want to use requires the user to add a css file. What would be the most elegant way to package this in a cljs library? Store the css file into resources, then add it to the head on document load?

20:24 xeqi: tomoj, weavejester: yeah, its by date atm

20:24 TimMc: You could always re-push 1.1.7. :-P

20:25 xeqi: easier to compare that in the db, hopefully w'll finish some transition work later and we can change the sorting

20:26 aaelony: any tips on the fastest way to write very large data to a file?

20:26 tomoj: lazybot just scrapes clojars

20:27 aaelony: it's actually the lazy-seq that is quite large, not the elements within the seq

20:42 Foxboron: Umm, trying to use nrepl with clojure, but when i use C-c C-e to eval an expression nrepl replies with: No Lisp subprocess; see variable `inferior-lisp-buffer'. Anyone able to help me in the right direction?

20:46 ivan: Foxboron: is your .clj buffer in clojure-mode?

20:47 anyway, works for me with just (require 'clojure-mode) (require 'nrepl)

20:49 Foxboron: I found a stackoverflow question burried down. Had to enable nrepl-enable-on-existing-clojure-buffers

20:50 ivan: works as a charm now :)

20:56 ohpauleez: For those that follow shoreleave news - With the upcoming release a new module has been added: shoreleave-baseline

20:56 it's a repo you can clone, and serves as a starting block, much like ClojureScript:One

20:57 three branches: bare, master, and kitchensink let you dial the example in

20:57 comes complete with everything you need, just clone, code, and off to the races

21:00 frozenlock: ohpauleez: Any running example of shoreleave?

21:01 ohpauleez: frozenlock: There's a demo app someone made, let me link you

21:01 frozenlock: https://github.com/robert-stuttaford/demo-enfocus-pubsub-remote this one?

21:01 ohpauleez: that's the one

21:01 * frozenlock wanted a live example, because he's lazy :P

21:01 ohpauleez: shoreleave-baseline is a more complete version of that

21:02 frozenlock: haha

21:02 I know of a dozen or so production apps that use some piece of shoreleave

21:02 frozenlock: How convenient, I was toying with fetch today because I needed some client/server communication.

21:03 tomoj: where is it?

21:03 ohpauleez: kablammo

21:03 frozenlock: Shoreleave is basically all the stuff you end up writing anyway when you build a serious CLJS app

21:03 tomoj: Where is what?

21:04 tomoj: shoreleave-baseline

21:04 ohpauleez: haven't cut the release yet and pushed the repo

21:04 tomoj: ah

21:04 ohpauleez: just wrapping up the kitchensink code tonight

21:04 literally every piece of shoreleave, all wired up. Sort of a smoke-test type of application

21:04 frozenlock: ohpauleez: I'll use your cljs expertise then! :D I have a JS library that requires a css file. Is there a way to package everything in a nice little cljs library, without the user having to manually add the css file?

21:05 tomoj: excellent

21:05 frozenlock: ohpauleez: doh! cljsbuild failed -_-

21:06 ohpauleez: frozenlock: what release? what error? (I haven't cut the new releases yet)

21:06 I cut all of my CLJS projects over to a release, let them run for a bit, then if it looks good I push the releases

21:06 frozenlock: Well the link above...

21:06 clojurebot: unlink: and constantly is just a function that takes any arguments and returns whatever argument is given

21:07 frozenlock: WARNING: using numeric exit values in plugins is deprecated.

21:07 Plugins should use leiningen.core.main/abort instead.

21:07 Support for this will be removed before the stable 2.0.0 release.

21:07 cljsbuild failed.


21:07 ohpauleez: frozenlock: Ahh

21:07 thank you, I'll make sure it gets updated

21:08 frozenlock: I think changing cljsbuild version solved the problem.

21:12 Yup, solve it.

21:12 solved even

21:13 ohpauleez: Is it unique for each visitor?

21:13 ohpauleez: frozenlock: Is what unique? The JS?

21:14 frozenlock: The demo, I was wondering if each user had its own item list.

21:18 ohpauleez: Is there other code examples besides the demo?

21:25 ohpauleez: frozenlock: Off the top of my head, I can only think of two blog posts that made examples

21:25 and soon, shoreleave-baseline

21:29 dnolen: core.logic is breaking away from cKanren naming convention for the fd functionality - http://github.com/clojure/core.logic/compare/org-fd

21:29 tomoj: hooray

21:29 dnolen: sorry to cause trouble for people who are already relying on this stuff - it mostly just means renaming

21:29 +fd -> fd/+, distinctfd -> fd/distinct etc to make it more Clojure-y

21:31 tomoj: yeah, I probably should have done that from the beginning but was deep in implementation issues.

21:31 frozenlock: ohpauleez: Would you mind explaining what is this for? (rpc/remote-ns 'example.api :as "api")

21:31 tomoj: I was just daydreaming earlier about forking core.logic and renaming everything

21:31 frozenlock: I haven't seen namespace mention in `fetch'.

21:32 dnolen: also clojure.core.logic.clj now has 1K less code, so hopefully a little bit easier to read for people curious about the implementation who don't want to be bogged down in CLP(FD) details

21:32 tomoj: heh

21:32 tomoj: but I feel not even close to understanding it, so..

21:32 ohpauleez: frozenlock: That changes a little in upcoming release, but it let's you expose an entire namespace as a remote API

21:33 that call means on the client, you can call (api/whatever-fn …)

21:33 dnolen: tomoj: well we're moving further and further away from miniKanren so, for new stuff I'm definitely up for good names and proper namespacing.

21:33 frozenlock: oh... Oh!

21:33 tomoj: I was also thinking about the -o stuff

21:33 imagined '?foo?

21:33 dnolen: tomoj: the core miniKanren stuff probably won't change nor the -o stuff.

21:33 tomoj: however we can build much better functionality off the constraint stuff anyhow

21:34 ohpauleez: frozenlock: It means that instead of having to wire a whole namespace up, you can just say, "This is the remote API into my system"

21:34 dnolen: I look forward to the day that people don't use membero and appendo ever

21:34 tomoj: we'll need good names for whatever replace them, and hopefully deprecate them.

21:34 frozenlock: ohpauleez: consider me sold. When does the new version come up? :)

21:34 tomoj: interesting

21:35 ohpauleez: frozenlock: Should be Friday

21:35 tomoj: I saw oleg wrote a paper about how to do arithmetic in minikanren by simulating a hardware adder

21:35 ohpauleez: I need to wrap up the new pieces, deploy all of my apps that use Shoreleave, then cut releases and make the announcement

21:35 dnolen: tomoj: yes we're getting really close to being able to use bi-directional assoc and stuff like that

21:35 tomoj: so you can actually to proper relational programming with maps and stuff.

21:35 frozenlock: ohpauleez: Will it still be based on Noir?

21:36 dnolen: actually do

21:36 tomoj: great, I've been eyeballing partial-map

21:36 dnolen: tomoj: partial-map is an implementation detail - featurec is the thing to actually use

21:36 muhoo: is shoreleave in use in production anywhere yet?

21:37 tomoj: I figured featurec was constraint-related and so ignored it since I don't have a clue about that stuff

21:37 ohpauleez: muhoo: Yeah, I certainly know of a few - it was developed in parallel of working on productions systems

21:37 and I know of about a dozen or so outside of my own that are using it

21:37 frozenlock: Nope, that's one of the changes - better ring/compojure support

21:38 dnolen: tomoj: things are moving more and more towards constraints - they are less trouble then relations and serve much the same purpose minus the bad non-termination stuff.

21:38 frozenlock: Damnit. I really need to switch from Noir to compojure.

21:38 dnolen: tomoj: constraints TDLR; - relations that can be delayed so you can avoid more non-termination cases

21:39 er tldr;

21:39 ohpauleez: frozenlock: FWIW, the new shoreleave-baseline is a compojure/lib-noir stack on the server side

21:40 muhoo: TDLR Time Domain Linear Refractometer

21:40 tomoj: if that enables bidirectional assoc, I wonder if you can get bidirectional lens families

21:41 muhoo: ohpauleez: thanks, good to know. the focus on XSS security indicated to me that it was used in production somewhere :-)

21:41 dnolen: tomoj: heh, dunno, I don't know anything about lenses. But at least you can write core.logic code with better data structures.

21:43 tomoj: I hate to ask, but, you think, 'close' as in.. months? I ask because if it were expected sooner than months, then I really need to catch up on constraints

21:43 dnolen: tomoj: 'close' as in anyone could implement it today

21:44 tomoj: featurec is a starting point?

21:45 dnolen: tomoj: sort of, I mean I can write up an example here in a bit.

21:45 tomoj: the only reason I haven't done it yet, because I have decided on the constraint implementation API - but I closing on something I like for that

21:45 I haven't decided I mean.

21:45 tomoj: cool

21:45 dnolen: so you could do it today - but the API is going to change - so it's not time yet.

21:47 tomoj: I think it will be awesome :) and it will happen soon, but perhaps not until after Clojure/West

21:47 tomoj: or if I'm able find enough time, demo it @ Clojure/West

21:48 tomoj: there are problems with higher-order relations, iirc?

21:48 or just you can't table them

21:49 dnolen: tomoj: "problems"? there's just no support for that at all.

21:49 tomoj: right, that's what I thought

21:49 I was trying to imagine bidirectional update-in

21:50 gfredericks: that would kind of imply that a logic var's value can be a relation

21:50 tomoj: indeed

21:50 gfredericks: does prolog have such a thing?

21:50 tomoj: oh, I didn't realize that

21:50 dnolen: tomoj: it's possible to do FP style higher stuff in a LP paradigm ... but it's not something I'm planning on pursuing anytime soon.

21:51 even crazier would be higher order logic programming - but I'm also not going there anytime soon.

21:51 tomoj: (I mean, I assumed the, uh, 'inner' relation would always be ground)

21:52 dnolen: gfredericks: yes, you thinking about higher order logic programming - Lambda Prolog

21:52 tomoj: so I guess you just have a function like (relation-in ks relation) that returns a new relation

21:52 dnolen: http://www.amazon.com/Programming-Higher-Order-Logic-Dale-Miller/dp/052187940X

21:53 though I will say, a lot of what people use that for is theoretical CS - and it's still an open question whether nominal logic doesn't deliver most of that power w/o the complexity.

21:54 tomoj: I'm just completely blocking out the "nominal" stuff :(

21:54 ohpauleez: dnolen: I've been trying to wrap my head around the nominal stuff

21:54 hahaha

21:54 it looks like I'm not alone

21:54 gfredericks: dnolen: there are so many things I haven't even heard of O_O

21:54 dnolen: tomoj: no worries, it's heady stuff unless you want dig into theory.

21:54 tomoj: one of those papers where I follow along patiently for a while, waiting to catch any whiff of the idea, then skim the rest in despair

21:55 dnolen: tomoj: what's cool about it is that it let's you literally take inference rules and operational semantics from a paper and convert them trivially into a logic program.

21:55 so if you ever wanted to run the pi calculus - well that's like maybe a hundred lines of code or something.

21:55 * gfredericks googles pi calculus

21:59 dnolen: these are the typing rules for the simply typed lambda calculus - http://en.wikipedia.org/wiki/Simply_typed_lambda_calculus#Typing_rules

22:00 and the core.logic nominal program that corresponds to them, http://github.com/namin/TAPL-in-miniKanren-cKanren-core.logic/blob/master/clojure-tapl/tapl/src/tapl/stlc.clj#L89

22:01 (2) in the Wikipedia article is not included - but otherwise if you squint, it's a direct translation

22:48 xeqi: ppppaul: thanks for the issues on peridot. That last one did lead to me finding a bug with multipart and :headers. Not sure if I answered everything in it or not, let me know

23:06 tomoj: dakrone: want a pull request? https://www.refheap.com/paste/e13f0c97503bfa55601964a68

Logging service provided by n01se.net