#clojure log - Mar 25 2013

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

0:17 wei_: to answer the above question lein-ring takes an :init function that's great for db connections

0:24 akhudek: hm, anyone here use perforate?

0:49 tyler: is there a way to see what lib lein is trying to download a dependency for?

0:52 akhudek: lein dep :tree

0:52 shows all the deps and their dependencies

0:53 also, if you aren't using it, use lein-pedantic

0:56 tyler: akhudek: thanks

0:56 akhudek: the problem i was running into was it threw an exception before lein deps completed becuase there was o dep in clojars

0:56 so the output of :tree would have never been shown

0:57 akhudek: ah

0:58 tyler: trying to use aleph but yammer metrics jar is fuqored i think

0:59 akhudek: tyler: why not http://http-kit.org/

1:00 tyler: akhudek: because i never heard of it before? thanks for the link

1:01 (inc akhudek)

1:06 zakwilson: Is there something like subs that can take a negative start? I know it's trivial to write.

1:07 akhudek: zakwilson: don't think so

1:08 zakwilson: And so util.clj grows.

1:36 xeqi: tyler: it wasn't printing out what was missing? can you paste a project.clj that does it?

1:36 tyler: xeqi: it was user error my bad

1:36 typo in project.clj

1:55 how do you get a new object in cljs? like a Date with an arg passed into constructor

1:57 bbloom: same was as in clojure: use the (Date. 123)

1:58 which is just shorthand for (new Date 123)

1:58 although in this case, i guess it's js/Date

1:58 tyler: ah thnx

1:58 bbloom: ,(macroexpand '(Date. 123))

1:58 clojurebot: (new Date 123)

1:59 bbloom: but you really want (js/Date. 123)

2:24 yunfan: i checked an repo and when running lein repl , the dependancies is so crazy, it require soooooooo many

2:58 tomoj: .

3:05 Lajjla: tomoj: do you till love me the most

4:16 robewald: pass

4:37 borkdude: say I've got this project.clj like here: https://github.com/borkdude/tictactoe/blob/master/project.clj

4:38 I see lib-noir uses a different clojure version, ring version etc, so how do these "conflicts" resolve?

4:38 I mostly copied these settings from a luminus project btw

4:58 kral: namaste

5:01 sirup: I keep getting an error about "Can't dynamically bind var: clojure.core/slurp" when I attempt to stub slurp with clojure.contrib.mock. Code + error here: https://gist.github.com/Sirupsen/71924dee7ce92dbcf98a

5:10 hmm.. seems to work when I directly depend on org.clojars.echo/test.mock "0.1.2" instead of clojure.contrib and include echo.test.mock

7:29 bosie: how would i test if a function is lazy

7:30 if the operation itself (to retrieve an element) is highly expensive

7:47 ucb: bosie: I'm curious as to why you need to check this?

7:47 bosie: ucb: so i know its lazy

7:47 ;)

7:47 marvin2: Hi, I've clobbered up a namespace and have made a symbol point to a non-standard value; is there any way to get the original binding back?

7:47 ucb: and what would you do with that knowledge afterwards? I guess I'm saying I'm interested in what you would do with this knowledge

7:48 bosie: ucb: i would use it accordingly. if i didn't know if map was lazy or not, i would use map very differently

7:49 ucb: hmm

7:49 bosie: ucb: since there are plenty of use cases with my function that dont require to realize the entire list

7:49 ucb: I'm wondering in what cases knowing whether an fn is lazy or not matters much

7:49 bosie: ucb: it returns a list though

7:50 so i would use it like (map #() (my-expensive-function [1 2 3]))

7:50 magnars_: ucb: I guess if map was not lazy, you would be more careful about using `take` first.

7:51 clgv: &(apropos "lazy")

7:51 lazybot: java.lang.RuntimeException: Unable to resolve symbol: apropos in this context

7:51 ucb: magnars_: indeed; I'm trouble figuring out why you shouldn't have all things being lazy to begin with

7:51 and then ... well, not bother about it

7:51 bosie: ucb: right but i dont know if my implementation is lazy or not

7:52 ucb: bosie: so, I'd say that it is if it's a combination of lazy fns

7:52 clgv: bosie: you can test the return value of a function if it is a clojure.lang.LazySeq via instance?

7:53 bosie: hm

7:53 k

7:54 clgv: &(instance? clojure.lang.LazySeq (map inc (range)))

7:54 lazybot: ⇒ true

7:55 bosie: thank you, will try

8:18 squidz: im trying to use dommy which is like hiccup for clojurescript, but am confused how I am supposed render the created html. This may be javascript specific, but if anybody could guide me, id be thankful

8:32 SonderbladeWork: why doesnt this work? (map #({:x %}) [1 2 3])

8:35 Anderken1: SonderbladeWork: because #({:x %}) means (fn [v] ({:x v})) - you're calling the map

8:44 clgv: SonderbladeWork: use #(hash-map :x %) instead

8:44 &(map #(hash-map :x %) [1 2 3])

8:44 lazybot: ⇒ ({:x 1} {:x 2} {:x 3})

8:45 SonderbladeWork: clgv: thanks

8:57 MikeSeth: for defrecord, is the recommended naming convention CamelCase or something else?

8:59 augustl: MikeSeth: CamelCase, yeah

9:00 MikeSeth: thanks

9:39 jtoy: hi all

9:51 squidz: whats are the best libs to use If I want to create a single-page-application in clojure?

10:00 g4mm4: can anyone recommend a mysql library for clojure?

10:00 clojureQL wasnt updated in a while and throws also some errors when requiring

10:01 squidz: g4mm4: korma

10:01 g4mm4: squidz: nice

10:17 clgv: squidz: ring+compojure

10:22 MikeSeth: hm, sublime repl keeps hanging

10:33 squidz: MikeSeth: use emacs

10:34 clgv: MikeSeth: I think the most supported environments are emacs, vim clojure and eclipse/counterclockwise

10:34 MikeSeth: yeah, I know

10:34 emestee@terminata:~$ wc -l .emacs

10:34 145 .emacs

10:34 :P

10:35 clgv: humm got only 122, might be because I only use it for sbcl atm ;)

10:36 llambda: stuartsierra: is this totally evil and bad? --> https://www.refheap.com/paste/12919

10:36 arrdem: ^

10:37 clgv: llambda: depends what guarantees you want...

10:37 yogsototh: Hi all. I'd like to take a look at clojure by building a minimal application I'll host on heroku. Is there a standard/recommended way of doing this ?

10:40 llambda: clgv: okay, so kind of evil? :)

10:40 clgv: llambda: there are also macros that do a similar aliasing of vars from different namespaces

10:41 llambda: midje used something like that (at least until 1.4)

10:42 llambda: clgv: originally i was going to use a macro, but it didn't seem necessary

10:42 clgv: llambda: you only need a macro for that task if you want to specify the variable names you want to alias.

10:43 llambda: e.g. (alias my.ns var1 var2 ...)

10:44 stuartsierra: llambda: yes

10:44 It breaks identity of Vars.

10:45 clgv: stuartsierra: is there something preventing true "reference variables" to be used for API namespaces?

10:46 stuartsierra: clgv: I don't understand the question.

10:48 clgv: stuartsierra: I mean code like the one from llambda usually occurs when someone wants to build an API namespace that exposes all functions an external use wants to use. so in this namespace you often just want to build an alias to a function in a nested implementation namespace

10:48 *external user

10:48 stuartsierra: Why not just have one namespace?

10:50 clgv: stuartsierra: most likely to separate different concerns

10:50 stuartsierra: Namespaces are just that, a space for names. If you want the whole API available as one set of names, then it's one namespace.

10:50 clgv: I mean the implementation of those if you have a small API but larger implementations behind it

10:51 stuartsierra: I noticed that for example midje did aliasing that way to build "midje.sweet"

10:51 llambda: clgv: that's exactly why i'm doing it

10:52 stuartsierra: I can't comment on Midje, haven't used it much.

10:52 llambda: it seems like i'm "doing it wrong" tho :)

10:52 i'm coming from python, so that's probably why my brain is tainted

10:52 clgv: In my projects I did need something like such an alias only once yet. so I cannot argue that much for it.

10:53 llambda: i'm trying to avoid writing the same set of functions twice

10:53 stuartsierra: Namespaces are not equivalent to modules in the Python sense.

10:53 llambda: yeah i'm realizing that more and more, stuartsierra

10:53 stuartsierra: Clojure really doesn't have modules in that sense.

10:53 llambda: i miss my modules

10:54 stuartsierra: Namespaces are only there prevent symbols from clashing. Nothing more. How you structure your code is up to you.

10:54 llambda: stuartsierra: what if i wanted to "import" these http functions from the library i'm wrapping?

10:54 stuartsierra: Don't.

10:54 llambda: it's basically just HTTP verbs wrapped around a central "request" function (which i'm redefining)

10:55 so the best practice is to write the same set of functions twice, in this case?

10:55 stuartsierra: If you're changing the definitions to be specific to your library, then yes.

10:55 llambda: twice in my library, i mean

10:56 well i don't mean twice in the sense, once in their library, once in mine: it will happen twice in my library between the oauth1 and oauth2 namespaces

10:56 stuartsierra: If they're the same, then define them in one place and make that namespace part of your public API.

10:56 llambda: okay

10:56 e.g. if it were a "client" namespace?

10:56 the HTTP functions could live there

10:57 and then the library could be used by requiring the proper oauth namespace and the client namespace

10:57 stuartsierra: sure

10:57 llambda: all right

10:57 i can do that

10:57 gfrederi1ks: I'm having trouble with streaming JSON as a ring response

10:57 llambda: i just assumed oauth2/get oauth1/post, etc would make for a more user-friendly api

10:58 thanks for indulding my incompetence :)

11:00 stuartsierra: Your users will thank you in the long run if you keep your code as simple as possible and don't play tricks with Vars. :)

11:05 llambda: stuartsierra: that sounds like sane advice to me :)

11:10 gfrederi1ks: if I want to stream data into a ring response from another thread I have the issue of handling errors -- having already returned a 200 to the ring adapter, when something goes wrong on the streaming thread I don't know how to turn the response into a 500

11:11 pl6306: Hello, I am new clojure user. Is this the right place to ask questions on how to use it?

11:12 gfredericks: pl6306: yes

11:12 pl6306: I am looking at this function (defn log->list ...) what does "->" mean?

11:13 gfredericks: it's just a naming convention

11:13 usually A->B suggests the function converts an A to a B

11:13 -> is a legal part of the naming syntax

11:13 pl6306: got it so it just part of a name

11:13 gfredericks: yep

11:13 pl6306: Thanks!

11:13 gfredericks: np

11:21 MikeSeth: will require and friends compile the lib on the fly?

11:22 gfredericks: if they haven't been AOT'd, yes

11:24 MikeSeth: ahhh

11:25 sorry, rtfm'ing

11:30 papachan: hello

11:30 i am trying to do an import of my file into REPL

11:30 but i have a ClassNotFoundException com.clojurebook.CustomException java.net.URLClassLoader$1.run (URLClassLoader.java:366)

11:30 my start project is like this

11:30 http://paste.ubuntu.com/5646655/

11:31 Anderken1: papachan: you did not add . to the classpath

11:31 gfredericks: papachan: your classpath doesn't include the root dir

11:32 Anderkent: I strongly recommend picking up lein so that you don't have to worry about the classpath

11:32 that or mvn, but lein is much easier to get started with

11:34 papachan: oh yes i use lein and it work

11:35 but i want to import simply my class into REPL

11:35 will try to not include .

11:36 ok

11:38 tried: java -cp ./clojure-1.4.0.jar clojure.main -r .

11:38 gfredericks: you want -cp .:./clojure-1.4.0.jar

11:41 papachan: ok i uderstance

11:43 clgv: -cp .:clojure-1.4.0.jar even ;)

11:46 Anderkent: Is there an idiom for dynamically selecting which namespace to use depending on some state? I'd rather avoid having to use protocols or multimethods, what I have is two namespaces with the same signatures, and one wrapping ns that delegates to one of these : (if (is-live?) (real-ns/do-stuff) (fake-ns/do-stuff))

11:49 noidi: Anderkent, what you probably want is protocols and polymorphism

11:49 TimMc: No, it sounds like situational polymorphism, not data polymorphism.

11:49 noidi: then you can configure which protocol implementation to use based on the state

11:50 Anderkent: eh, I was hoping I could use a ns like an object, but guess not.

11:50 TimMc: (I'm just making up jargon here.)

11:50 noidi: protocols are the closest you can get to a first-class namespace in clojure

11:51 clgv: TimMc: you do that often lately ;)

11:51 Anderkent: noidi: yes, but they're too annoying to work with, esp for such uncomplicated problem

11:51 MikeSeth: for (defrecord Foo) Foo is an internet symbol that is not a var, correct?

11:51 interned*

11:52 TimMc: clgv: It's on account of my getting old and decrepit.

11:52 Anderkent: I want dependency injection :P

11:52 clgv: TimMc: had to look up that last word - decrepit ;)

11:53 MikeSeth: it'll be a class that defrecord statement generates

11:53 papachan: thanks it work fine with my classes folder

11:53 clgv: Anderkent: first-class functions ;)

11:53 MikeSeth: clgv: ah

11:54 noidi: MikeSeth, interning means creating a var for a symbol

11:54 MikeSeth: clgv: so I need to use import if I want to use it in another namespace?

11:54 TimMc: noidi: No it doesn't.

11:54 clgv: MikeSeth: right. better use the automatically generated constructor function "->Foo"

11:54 MikeSeth: oh, that is new then

11:54 noidi: TimMc, ok, looking up or creating :) http://clojuredocs.org/clojure_core/1.2.0/clojure.core/intern

11:55 clgv: clojure 1.4 (or maybe 1.3 already...)

11:55 TimMc: noidi: Oh, by "interning" you mean "using clojure.core/intern"? Sure.

11:55 MikeSeth: thanks!

11:55 TimMc: Interning in general has nothing to do with Clojure.

11:58 MikeSeth: Oh, I finally get it

11:58 * MikeSeth has a bulb moment

12:02 jtoy: if I include a namespace that has a method and then do (resolve (read-string "my_fn_from_other_ns")) it returns nil

12:02 why cant i resolve it?

12:03 gfredericks: how did you "include" it?

12:04 jtoy: gfredericks: (use 'interests.enrichments)

12:04 TimMc: 25 cents on Gilardi Scenario

12:05 gfredericks: I'll take that bet

12:05 however I don't know why it's not working

12:06 presumably it's some detail you're not mentioning because it didn't occur to you it might be a problem

12:06 TimMc: jtoy: Is this in the REPL?

12:06 jtoy: TimMc: yes

12:07 TimMc: in code I do (:use [interests.enrichments])

12:07 I think I see

12:12 TimMc: jtoy: The :use is in your ns statement?

12:26 gfredericks: would it be reasonable for a lein plugin to hook the 'jar' task and do some git introspection and write a `git-commit.sha` file to /resources?

12:27 TimMc: Sounds good.

12:28 gfredericks: But bonus points if you can create that file in the commit the jar is based on by achieving a hash collision.

12:29 gfredericks: huh; leiningen.pom/read-git-head seems to exist

12:29 technomancy_: gfredericks: you can add :filespecs to project.clj that can have arbitrary bytes or paths

12:29 see `lein help sample`

12:30 gfredericks: technomancy: I saw that recently; it's not clear to me exactly what that means or how I would use it

12:30 technomancy: yeah it's not a very good interface

12:30 will be rewritten from scratch for 3.0

12:33 Sonderblade: how do you get the first/any item in a map in clojure?

12:33 technomancy: Sonderblade: you can't

12:34 maps aren't ordered

12:34 err--you can't get first; you will get an arbitrary k/v pair using clojure.core/first

12:35 hyPiRion: ,(first (sorted-map 3 :third 1 :second 0 [:first]))

12:35 clgv: Sonderblade: since maps are seqable you can do the following, but there is no guarantee on the order ##(first {:a 1 :b 2})

12:35 lazybot: ⇒ [:a 1]

12:35 clojurebot: [0 [:first]]

12:35 hyPiRion: But I suspect you don't want the sorted-ability. Though it's nice to know about.

12:36 Sonderblade: i know maps are not ordered i just want any

12:40 dnolen: Sonderblade: first does what you want

12:41 kalasjohnny2000: &join #devops

12:41 lazybot: java.lang.RuntimeException: Unable to resolve symbol: join in this context

12:41 kalasjohnny2000: sry

12:41 hyPiRion: heheh

12:43 kalasjohnny2000: talking about it, what's the most decent way to make a git push and the branch gets into a stage environment?

12:43 like heroku does, but on my own server...

12:43 I did try with git hooks, but it feels a bit shakey.

12:45 is jenkins the way to go?

12:45 nDuff: kalasjohnny2000: *shrug*. Are you already using any ops-automation tooling?

12:45 kalasjohnny2000: ...if you're already a Pallet, Chef or Puppet shop, then it makes sense to leverage that.

12:45 kalasjohnny2000: @nDuff pallet would be the most reasonable, yes.

12:46 nDuff: ...then you can push out config changes with the same infrastructure you use for code changes.

12:46 kalasjohnny2000: that's what I want, yes. What is the best... crate... for this?

12:47 pl6306: What does "->" mean in (-> "http://nytimes.com" java.net.URL. .openConnection)? I would google it but "->" doesn't produce any good search results.

12:47 kalasjohnny2000: @pl6306 -> means "take the object coming afterwards and apply all the functions after it"

12:47 yacin_: ,(-> [[1 2] 3 4] first first)

12:48 clojurebot: 1

12:48 yacin_: ,(-> [[1 2] 3 4] first second)

12:48 clojurebot: 2

12:48 kalasjohnny2000: @pl6306 http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/-%3E

12:48 pl6306: Thanks!

12:49 nDuff: kalasjohnny2000: Actually -- not in a great position to tell you, there. My personal experience is mostly with Chef; Pallet looks like 0.8 will finally be fitting the bill re: most of my use cases, but it wasn't quite baked for what I needed in the past.

12:49 dnolen: pl6306: it's important to note that -> is a macro, it just transforms the syntax

12:50 tbatchelli_m: kalasjohnny2000: you can always drop by #pallet and ask

12:51 kalasjohnny2000: thank you both of you, @nDuff and @tbatchelli_m :)

13:05 borkdude: Is there a name for apps built with ring, compojure, lib-noir and hiccup? I suggest: Hiricono apps. Say yes to Hiricono! Or Ricono if you don't use hiccup.

13:07 * jeremyheiler wonders how inebriated borkdude is.

13:09 borkdude: lol, I just made this up while biking home, sorry

13:09 jeremyheiler: lol nice

13:10 ejackson: bokdude: or orinoco

13:11 borkdude: ejackson nice

13:13 maybe Luminus should be renamed to Orinoco, I wouldn't mind ;)

13:13 unless there is some nice reasoning behind "Luminus"

13:51 gfredericks: technomancy: using the private leiningen.pom/read-git-head for getting the commit is a bad idea?

13:51 technomancy: gfredericks: the jar contains the pom with the tag; can you just get it from there?

13:53 gfredericks: from META-INF/maven/group/artifact/pom.xml?

13:54 technomancy: sure

13:54 also pom.properties if you don't feel like busting out a parser

13:54 gfredericks: you correctly guessed whether or not I felt like busting out a parser!

13:55 technomancy: I suspect you'd much rather bust out some sick rhymes about XML.

13:56 gfredericks: though to be fair, I probably would have just used a regex. I wonder how many problems I would hava had at that point.

13:56 TimMc: 7

13:56 * technomancy awkwardly segues to http://p.hagelb.org/smooth-rap-attack.png

13:58 SegFaultAX: technomancy: That's awesome.

13:58 gfredericks: technomancy: so it'd be hard to write a general lib for reading this due to having to know the group/artifact to get the path, eh?

14:00 technomancy: (be sure to visit http://nedroid.com for more lulz)

14:00 TimMc: Nedroid has quite a few of the lulz.

14:00 technomancy: gfredericks: well every lein-produced jar will have a pom.properties on the classpath, yeah

14:03 jcromartie: *phew* I just solved my JSON dilemma

14:04 create my.project.json namespace with encode and decode functions that wrap whatever lib I decide to use tomorrow :)

14:05 dakrone_: jcromartie: yes, that is always a good idea

14:05 jcromartie: I think clojure.data.json has the best API, honestly… the :key-fn and :value-fn are just about the simplest solution possible

14:05 no multimethods, or installing handlers, or maps of types to functions

14:05 functions!

14:05 what a concept ;)

14:26 patbrown: Does anyone know the significance of #_(function)? For instance in the pedestal.io user.clj file found here https://github.com/pedestal/pedestal/blob/master/service-template/src/leiningen/new/pedestal_service/user.clj

14:26 More specifically, what's the underscore for?

14:26 arkx: It's a comment

14:26 tbaldridge: The reader drops whatever is next

14:26 SegFaultAX: patbrown: It comments out the next form.

14:26 Anderkent: patbrown: #_ is a reader macro that ignores the next form

14:27 TimMc: ,[1 #_ 2 3]

14:27 clojurebot: [1 3]

14:27 TimMc: patbrown: ^

14:27 tbaldridge: compare to:

14:28 SegFaultAX: patbrown: http://clojure.org/reader

14:28 tbaldridge: ,[1 (comment 2) 3]

14:28 clojurebot: [1 nil 3]

14:28 patbrown: So, the only reason to use it in this instance is for terseness?

14:28 TimMc: patbrown: No, the point is that those are different.

14:28 [1 nil 3] is not [1 3]

14:29 patbrown: Oh, so you use it, so you don't return a nil?

14:29 tbaldridge: patbrown: in your example from pedestal, the function now returns the result of the call to in-ns, instead of just returning null

14:29 *nil

14:29 SegFaultAX: patbrown: No. You use it when you want to comment out a form.

14:29 ,(+ 1 #_ 2 3)

14:29 clojurebot: 4

14:30 TimMc: It's pretty rare to see anyone use the comment macro.

14:30 SegFaultAX: ,(+ 1 (comment 2) 3)

14:30 clojurebot: #<NullPointerException java.lang.NullPointerException>

14:30 tbaldridge: except for Rich :-P

14:30 TimMc: What you'll sometimes see is this:

14:30 SegFaultAX: patbrown: Note that when the first of those forms is evaluated, it's like the 2 isn't even there.

14:30 TimMc: ,[1 #_(comment 2 3 4 5) 6]

14:30 clojurebot: [1 6]

14:31 TimMc: (since #_ only takes out one form)

14:31 .[1 #_2 #_3 #_4 #_5 6] is more annoying to type

14:31 ,[1 #_2 #_3 #_4 #_5 6] that is

14:31 clojurebot: [1 6]

14:31 SegFaultAX: TimMc: Although that gives me some fun ideas for code obfuscation :)

14:32 Make it as hard as possible to determine which forms are actually evaluated.

14:32 TimMc: SegFaultAX: #_ can also stack, if you want obfuscation.

14:32 ,[1 #_#_#_#_ 2 3 4 5 6]

14:32 clojurebot: [1 6]

14:33 SegFaultAX: Wow, I didn't know that.

14:33 Glenjamin: hi guys, is there a common idiom to take an input stream and read it into a byte array?

14:33 TimMc: and it does weird things to anon fn args

14:33 patbrown: I just read the definition in the linked reader page. I'm still a little lost as to the practical usage of it. I stumbled across this because I'm working on conditioning my repl for cljs development. Is there any reason why in pedestal they load up a dev namespace instead of using a function to load code into the user namespace?

14:34 SegFaultAX: patbrown: In the case of the code you linked, they probably did it that way because you don't need to actually refer to anything inside the dev namespace.

14:35 It's purely for testing or development or whatever.

14:35 patbrown: That form is commented out because they don't want to call dev/start when that dev function is run.

14:36 patbrown: Why put it in there at all then?

14:36 tbaldridge: maybe because it's alpha code?

14:37 patbrown: Just like with the clojurescript one project, the boys at relevance do things way differently than I see anyone else do them.

14:37 SegFaultAX: That code is still highly active.

14:37 patbrown: My questions have been answered, thanks. Reader macros are an interesting part of clojure I've yet to explore.

14:38 technomancy: I put in comments to do things like launching a dev jetty into production code

14:39 TimMc: patbrown: If you use #_ instead of ;; you can provide (well-formed) code samples in a way that your editor will syntax-highlight them. :-)

14:39 patbrown: That's the rub I gather.

14:39 SegFaultAX: I find ;; to be mostly useless.

14:40 TimMc: It's also a way to comment out a multiple-line expression.

14:40 hyPiRion: ,(let [a 10] (inc a) #_=> 11) ;)

14:40 clojurebot: 11

14:40 patbrown: It just looks better and it doesn't return nil, still giving you proper repl feedback

14:41 TimMc: hyPiRion: Awful/

14:41 ,(let [a 10] (inc a) #_=> 'eleventy) :-(

14:41 clojurebot: eleventy

14:41 SegFaultAX: I prefer "threeve"

14:42 jro_: when I run lein repl, I get an error: No such var: user/help, compiling:(NO_SOURCE_PATH:1:12391)

14:42 TimMc: jro_: Does that happen in just one project?

14:43 jro_: TimMc, yes, if I don't have project.clj, the error disappears

14:44 TimMc: jro_: But does it happen in multiple projects?

14:44 SegFaultAX: Is anyone here using Immutant?

14:45 TimMc: Probably.

14:45 SegFaultAX: TimMc: Are you?

14:45 patbrown: In addition, I'm using piggieback for a cljs browser repl, however when I compile, my "out/goog" directory always goes in the root of my project, instead of "resources/public/js/out/goog" Does anyone know how to set the output folder? Note: my "out/cljs" and "out/clojure" are outputted under the "public/js" path.

14:46 jro_: I've currently just one checked out. Well, if it is just (user/help), then there is no problem.

14:46 TimMc: SegFaultAX: No, then I would have said "I am". :-)

14:46 SegFaultAX: TimMc: Maybe you were just being coy. ;)

14:46 TimMc: I don't know what Immutant is. Some kind of webby thing?

14:47 SegFaultAX: Yea, it's a Clojure wrapper for JBoss AS 7

14:47 squidz: SegFaultAX: why is it useful?

14:47 SegFaultAX: Basically, torquebox for clojure (if you know what that is)

14:47 TimMc: I don't know what JBoss or torquebox is either. :-P

14:48 SegFaultAX: squidz: JBoss AS 7 or Immutant?

14:48 TimMc: Ah, from Wikipedia I gather that it is a beany webby thing.

14:48 SegFaultAX: TimMc: Yea, one of themz.

14:49 It brings together a bunch of really useful stuff all in one coherent package: hornetq, infinispan, automatic clustering, distributed transactions, etc.

14:50 From an architectural perspective it seems very attractive to have all of that already available in your stack as opposed to hacking together a bunch of disparate components (zeromq, redis, etc.)

14:50 squidz: is it worth it to integrate all that stuff into a clojure app? or wouldnt using individual packages like clojurewerkz provides?

14:51 be just as good

14:52 jcrossley3: SegFaultAX: i'm one of the immutant developers. wassup?

14:52 SegFaultAX: squidz: I guess it depends on the project. I haven't used Immutant yet, but if I had to venture a guess I'd say because someone else has already taken the time to make sure everything is functional and well integrated.

14:52 jcrossley3: I know, I've seen all your talks! Great work by the way. :)

14:52 borkdude: gfredericks about the version from pom.properties: https://github.com/trptcolin/versioneer/blob/master/src/trptcolin/versioneer/core.clj

14:52 jcrossley3: SegFaultAX: thanks :)

14:53 squidz: SegFaultAX: ah right, so Immutant already did all the work to wrap everything in clojure

14:53 SegFaultAX: jcrossley3: What is unclear to me is the actual deployment aspect of Immutant. Eg, I have 5 fresh EC2 nodes, how do I bootstrap immutant on them and deploy new versions across them?

14:53 jcrossley3: And how do I do things like rolling deploys, etc.

14:53 jcrossley3: squidz: some folks like to grow their stack organically. some don't. plenty of ways to shave a yak. :)

14:53 SegFaultAX: jcrossley3: It seems like most of your talks and the documentation are geared toward the development phase and not so much on actually running in production.

14:54 squidz: Plus JBoss AS7 which is awesome all by itself.

14:54 squidz: If you're interested, checkout out jcrossley3 on InfoQ

14:54 squidz: Search for "immutant" or Jim Crossley

14:54 squidz: ill take a look thanks

14:55 jcrossley3: SegFaultAX: that is true regarding dev vs prod. the former has been our emphasis up to this point. hoping to focus more on prod during beta cycle.

14:56 jcromartie: well that was easy

14:56 (-> (ScriptEngineManager.) (.getEngineByName "JavaScript") (.eval "print(\"Hello\");"))

14:56 SegFaultAX: jcrossley3: Unfortunately I need that piece before I feel like it's worth spending the time cozying up to Immutant. Do you have any idea when more information will be available? Or do you have tips for getting started now?

14:56 jcromartie: apparently Java 6 comes with Rhino now?

14:56 jcrossley3: SegFaultAX: ec2 is rough due to lack of multicast. we're in the process of getting autoscaling to work on openshift, which is backed by ec2. once we figure that out, we'll publish that config to other native ec2 users who'd prefer not to use openshift.

14:57 SegFaultAX: jcrossley3: I'm not tied to EC2 per se. What do you recommend?

14:57 jcrossley3: (And is there documentation for production usage on it?)

14:58 jcromartie: (as of 2006 ...)

15:00 jcrossley3: SegFaultAX: folks running it production now are using homegrown solutions, e.g. scp/rsync of immutant archives. so the story is muddy at the moment.

15:00 it's on our list :)

15:01 SegFaultAX: jcrossley3: <3 I'll keep watching closely, then. Is Immutant one of your teams top projects atm?

15:02 jcrossley3: SegFaultAX: it's the primary focus of two of our team members. :)

15:07 tcrawley: SegFaultAX: you're welcome to join us in #immutant as well - it has a higher percentage of Immutant users compared to here

15:24 Raynes: gfredericks: You work at groupon?

15:25 borkdude: what is the typical way of deploying a ring webapp? uberjar, run with lein server, war?

15:30 maybe I should try immutant?

15:30 amalloy: borkdude: all of those are things that people do, yes

15:30 in fact i myself have done all of them

15:30 Raynes: I prefer using lein ring, but uberjars and wars are fine.

15:30 But the way amalloy and I run our open source stuff tends to be pretty ghetto, so might not want to listen to us.

15:31 borkdude: amalloy I actually have two simple ring apps I want to host, I don't want to configure a web server, so invoking an embedded jetty is very convenient

15:31 amalloy: so don't do it

15:32 Raynes: amalloy: But then he'll have to actually configure jetty. He needs a web server behind jetty to reverse proxy it otherwise.

15:32 No matter what he has to configure a web server.

15:32 amalloy: or just...run it on the right port from lein run

15:32 weavejester: Embedded Jetty behind an nginx stack would be my personal preference

15:32 Raynes: That's what we do.

15:33 nginx is easy to configure for a simple proxy to a jetty server.

15:33 borkdude: Raynes I have nginx running, it forwards to 8080 for one app, I can let it forward to 8081 for the second app etc

15:33 * Apage43 is running lein run with nginx reverse proxing for my ring stuff

15:33 Apage43: I was doing a separate jetty and scp'ing wars around for a while

15:34 but that required making sure I did all my setup and teardown cleanly

15:34 weavejester: I tend to use "lein ring uberjar" rather than "lein run". It's easier to deploy.

15:34 Apage43: just killing the thing was less to worry about

15:34 borkdude: weavejester what's the difference between lein ring uberjar and lein uberjar?

15:34 Apage43: actually I'm using lein ring uberjar. I'm a bit confused =P

15:35 But yeah, I didn't actually want to install lein on the prod webserver box

15:35 just java

15:35 so I can java -jar the thing

15:35 weavejester: borkdude: The former automatically adds a main method that calls the handler, integrates :init and :destroy, and adds a manifest to make the jar executable.

15:35 Apage43: borkdude: ring uberjar gives you a java -jar'able jar that runs the thing

15:35 borkdude: weavejester this is just what I need tnx

15:48 lsoa: I'm trying to read and parse a json file using clojure.data.json

15:49 I'm getting an error, presumably because there's some invalid json in there

15:49 Exception JSON error (unexpected character): clojure.data.json/-read (json.clj:222

15:49 is there a way to get the like that triggered that error?

15:50 line*

15:53 MikeSeth: idiomatic way to replace elements m to n in a vector with another value?

15:56 arohner: MikeSeth: (vector (concat (take m v) new-vals (drop n v))

15:56 maybe off-by-ones in there

15:56 MikeSeth: thanks, pondering

15:56 bbloom: arohner: you want vec, not vector

15:57 ,(vector (range 5))

15:57 clojurebot: [(0 1 2 3 4)]

15:57 bbloom: ,(vec (range 5))

15:57 clojurebot: [0 1 2 3 4]

15:57 arohner: bbloom: thanks, I always get those mixed up

15:57 pjstadig: if you know it's a vector you might just use assoc over the range of m to n with reduce or something

15:57 instead of going to a seq and back to a vector again

15:58 bbloom: arohner: here's a mnemonic: vector is longer than vec, and [(foo)] is longer than [foo]

15:58 pjstadig: that assumes the resulting length doesn't change

15:58 arohner: bbloom: meh. it's only a problem when doing IRC-based development

15:59 bbloom: arohner: what? you bothered to install lein? i do all my coding in lazybot

15:59 arohner: :-)

16:00 rkneufeld: patbrown: Hey, was your question about the dev namespace fully answered? I can provide further detail if you'd like

16:08 borkdude: MikeSeth https://www.refheap.com/paste/12926 <- my attempt

16:12 patbrown: Ryan, my man! Yeah, the use of the reader macro was well explained. Pedestal is a lot like cljs one. There is so much to it, it's hard to know where to start asking questions.

16:14 rkneufeld: Hey! I thought it might be you. Anyways, we load things through the dev function on account of some nastyness with user code. If there are any problems in your user code, it stops a REPL from opening whatsoever. We didn't have enough time to fully iron out the details in our dev code and opted to go the same route and keep the (dev) security blanket.

16:20 patbrown: rkneufeld: I've been playing around with the app and app-tools portion of pedestal. I really like the approach to handling state without atoms. What's your role been in the project?

16:21 rkneufeld: patbrown: I've spent most of my time in app as well. Taking on the role of community manager for the time being as well.

16:22 borkdude: how to change the portnr for the jetty instance, just PORT=xxxx java -jar bla?

16:24 nDuff: rkneufeld: ...ahh -- you're with Relevance? If you don't mind the asking -- do y'all have any intent to maintain Avout?

16:25 rkneufeld: nDuff: I believe that one is totally in the hands of David Liebke. He is no longer with Relevance.

16:25 * nDuff was a bit disappointed in evaluating Avout's usability recently to find some fairly big holes (ie. no transaction cancellation on thrown exceptions).

16:25 nDuff: Ahh.

16:25 Saw y'all on the copyright statement and assumed it was still a Relevance-sponsored project.

16:26 rkneufeld: No worries, doesn't hurt to ask.

16:28 borkdude: I'm editing a remote file with emacs… it works...

16:41 stuartsierra: As far as I know, no one is currently maintaining Avout.

16:42 bbloom: Bummer, since it's far more pleasant of an API than ZooKeeper... *cringe*

16:44 stuartsierra: ZooKeeper's not that bad.

16:45 bbloom: I found Netflix's ZooKeeper to be much more useful (and reminiscent of Google's internal Chubby API)

16:46 s/useful/usable/

16:46 zookeepers API is just kinda... raw

16:46 er i mean Netflix's Curaitor

16:46 thats the word i wanted

17:18 thm_prover: I'm writing a graphical REPL.

17:18 What is the right way to connect to the REPL / handle long computations?

17:19 llasram`: thm_prover: https://github.com/clojure/tools.nrepl

17:20 thm_prover: llasram`: the word interrupt appears twice on that page, claiming nREPL has interrupt support. do you know ho the interrupt suppor towrks?

17:21 https://github.com/clojure/tools.nrepl/blob/master/doc/ops.md loks like what I want

17:24 llasram: thm_prover: I actually right now don't know much about nrepl outside of the basic architecture

17:25 thm_prover: llasram: thanks for the pointer; building on nREPL looks like a better solution than throwing together my own adhoc solution

17:27 technomancy: you get a lot of useful stuff for free if you build on the nrepl stack

17:54 ppppaul: anyone here using clojure and beanstalk, also how do you feel about it if you are?

17:56 nDuff: ppppaul: You mean Amazon's, or a different beanstalk?

17:59 ppppaul: aws

18:02 i'm wondering about people's experiences using it with clojure. i have no prior experience with beanstalk

18:03 jeremyheiler: ppppaul: We use it to deploy headless Clojure webapps and it seems to work well. (I wasn't the one who set it up.)

18:06 ppppaul: jeremyheiler, can you give me more information as to how you use it? do you deploy via git or war or via lein-beanstalk? does it help you with staging and development environments too?

18:08 kursion: Hi there, i'm new in Clojure's world :)

18:09 auser: hey hey kursion

18:11 kursion: Hey auser :)

18:11 ppppaul: i'm also a user

18:14 jeremyheiler: ppppaul: We deploy WAR files. For environemnts, we built a little webapp that manages the environments and allows us to click a button to deploy.

18:15 ppppaul: interesting

18:15 thanks

18:16 jeremyheiler: ppppaul: np

18:17 auser: jeremyheiler: is that open-source?

18:17 that's sexy

18:17 squidz: i'm getting a lot - Use of undeclared Var - errors while trying to import domina in my namespace. Does anybody else use Domina know what im talking about?

18:17 jeremyheiler: auser: Unfortunately no.

18:18 auser: I bet it'd be rad if it was

18:18 jeremyheiler: auser: I would be, but it's not a high priority at the moment.

18:18 It*

18:18 auser: gotcha

18:24 * gfredericks starts learning to use nrepl.el

18:24 jimkcar: does `lein repl` execute the defined -main function?

18:24 gfredericks: no

18:25 jimkcar: I have code with a database connection that throws errors when I lein repl without the database being there. I can't figure out how it is running.

18:25 what about macros?

18:26 nDuff: jimkcar: Could this code be getting executed as part of evaluating the namespace?

18:26 jimkcar: if you do a (def connection (connect-to-the-database)) at top level somewhere, that would do it.

18:26 jimkcar: yeah I assume so, but I can't find where its happening

18:26 nDuff: jimkcar: (in which case, you might consider (def connection (delay connect-to-the-database))

18:27 jimkcar: what about a defmacro .... ~(connect-to-database)

18:27 nDuff: jimkcar: Can you post your code? (refheap is a local favorite, if you don't have a preferred ad-free pastebin already)

18:27 jimkcar: macros just rewrite your code; they don't change when the rewritten code is run.

18:27 jimkcar: ok.

18:27 let me scan again, and pastebin

18:29 nDuff: ...if you can include a stack trace from a failure alongside said code, that would be helpful too.

18:29 * nDuff tries to remember if refheap supports multi-file pastes (akin to gist.github.com's support for same).

18:30 gfredericks: how does one restart the nrepl session, other than restarting emacs and nrepl-jack-in again?

18:30 * nDuff personally doesn't use nrepl-jack-in at all, and thus uses nrepl-quit and nrepl to start from emacs, and lein repl from the command line.

18:31 nDuff: ...but I'm sure there's an easier way.

18:32 kursion: Is sublimetext a good editor for clojure guys ?

18:33 technomancy: it's not OSS

18:33 so the tooling around it is not very good from what I gather

18:33 gfredericks: there's an nrepl-restart command

18:33 amalloy: gfredericks: i think there's nrepl-restart or something

18:34 well, that's my helpful advice for the day

18:35 gfredericks: technomancy: amalloy: thank you both equally

18:35 kursion: Ok technomancy

18:35 Ty

18:36 technomancy: normally I say "go with what you already know" but if you don't know any OSS editors then that's different

18:37 kursion: I find it very light and handy + lots of plugins, better than npp

18:37 amalloy: can we call the process of open-sourcing a previously closed-source app "ossifying"?

18:37 technomancy: inc by me

18:37 kursion: :D

18:38 (Going to sleep a bit, cya tomorrow)

18:38 nDuff: kursion: There are a few things pretty much critical -- paredit and nrepl support

18:39 kursion: I wouldn't seriously consider anything without solid implementations of both.

18:39 kursion: Nrepl = terminal +bash

18:39 nDuff: Not at all.

18:39 kursion: What are your editors .?

18:40 amalloy: those things are important eventually, but if you're just playing around with the language any text editor is fine

18:40 nDuff: Having editor nrepl support means your editor knows what's in your namespaces

18:40 kursion: Hum you mean like the eclipse plugin... ?

18:40 nDuff: ...so it can autocomplete functions no matter what library they're from, it can retrieve documentation straight from the live Clojure instance, it can directly run your code...

18:41 kursion: the best implementation of all these things is emacs. That said, the Eclipse plugin is working on it, and may eventually become passable.

18:41 kursion: Yeah the only IDE that support clojure is eclipse and the plugins

18:41 nDuff: kursion: Keep in mind that emacs has been editing LISPs for decades. Its tools in the area are very, very good.

18:42 kursion: What definition of "IDE" do you use wherein Emacs doesn't qualify?

18:42 kursion: Emacs is alive ? Interresting .... :)

18:42 technomancy: nDuff: everyone knows IDE is short for "editor that's good at Java"

18:42 nDuff: :)

18:43 kursion: Autocomplete + intelli at least, then snippets

18:43 technomancy: snippets are for languages that don't have macros

18:44 kursion: True point

18:44 nDuff: emacs very much has autocomplete, and that autocomplete is nrepl-assisted

18:44 and, as technomancy says, snippets are moot in Clojure.

18:44 ...If you need them, you're Doing It Wrong.

18:44 technomancy: yeah, vim has autocomplete too

18:44 * dnolen likes snippets for ns declarations

18:44 nDuff: (though yes, of course, they do exist for emacs, if you need them)

18:45 * algernon uses them for boring copyright notices

18:45 technomancy: dnolen: yes, but only because you don't have access to macros that early in the file

18:45 hyPiRion: snippets are usually for `lein new` to handle

18:45 nDuff: kursion: Take a look at the intro video for Emacs Live

18:45 __zero: what's paraedit and nrepl?

18:45 technomancy: the ns macro is not very egalitarian

18:46 kursion: Gonna redownload emacs to see this , has i said i started clojure today

18:46 dnolen: technomancy: I actually have a couple other snippets that come in handy, but it's true I do rely on them less than when I code in say JS.

18:47 nDuff: kursion: http://vimeo.com/22798433

18:47 kursion: Ty for your advices nDuff. I appreciated this little talk :)

18:47 hiredman: clojurescript is just a very complicated set of javascript snippets dnolen has

18:47 technomancy: haha

18:47 kursion: Ok bookmarked for tomorrow :)

18:47 dnolen: hehe

18:48 nDuff: __zero: paredit is a mode specialized for editing LISPs; basically, it makes the editor structurally aware.

18:48 ivan: ~paredit

18:48 clojurebot: paredit is not for everyone, but what you need to understand ís how to become the kind of person that paredit ís for.

18:49 technomancy: ~botsnack

18:49 clojurebot: thanks; that was delicious. (nom nom nom)

18:50 nDuff: __zero: ...and nrepl is a protocol and set of tooling for, well, networked REPLs -- with support for adding things like session support, debugging operations, and other extensions via middleware.

18:52 technomancy: ,(update-in {} [] assoc :hello "world")

18:52 clojurebot: {nil {:hello "world"}}

18:53 technomancy: ^ is that surprising to anyone else?

18:53 * nDuff is surprised

18:53 amalloy: not anymore

18:53 pjstadig: it has a logic to it

18:53 seems like maybe a bug though

18:54 technomancy: amalloy: because you're paying attention to Leiningen bug reports?

18:54 amalloy: technomancy: because i've known about it for years?

18:54 technomancy: or that

18:54 hyPiRion: how does that make sense, really?

18:55 amalloy: i doubt it will ever change; i just use my own update-in* when i care about the behavior for an empty keyseq

18:55 pjstadig: amalloy: :(

18:55 hyPiRion: ,(= (update-in {} [] assoc :a :b) (update-in {} [nil] assoc :a :b))

18:55 clojurebot: true

18:55 amalloy: hyPiRion: the contract (perhaps implicit) of update-in is that you give it a non-empty keyseq; if you give it an empty keyseq, any behavior makes sense

18:56 pjstadig: ,(doc update-in)

18:56 clojurebot: "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."

18:56 amalloy: whether that's a good contract i don't want to argue about, but that's the way in which it makes sense

18:56 pjstadig: not sure that's implicit

18:56 [k & ks]

18:56 technomancy: hyPiRion: when you put it that way it's gotta be a bug

18:56 possibly a documentation bug

18:56 but a bug

18:57 oh; hrm. didn't consider :arglists as part of the doc.

18:57 so anyway, it's silly but not worth the trek to jira.

18:57 hyPiRion: technomancy: well, the signature is [k & ks], where ks is a seq only. k has to be something

18:58 technomancy: yeah, I'll buy that

18:58 don't have to like it though

18:59 hyPiRion: Well, I think it should throw some Arity Exception if it follows that contract.

18:59 It would be better to have it accept [] though.

18:59 technomancy: clojure isn't really well-known for validating inputs to functions

18:59 *ahem* contains?

18:59 Apage43: it accepts it, it just doesn't do something particularly helpful

18:59 hyPiRion: well, that doesn't mean we can better on doing that

19:00 technomancy: hyPiRion: depends how you define "we" =)

19:00 hyPiRion: well, that was one interesting sentence I made.

19:00 technomancy: Clojure contributors :)

19:02 amalloy: technomancy: doesn't contains? throw an exception as of 1.5?

19:02 technomancy: whoa seriously?

19:02 hyPiRion: huh, I only thought its docstring changed.

19:02 technomancy: holy smokes

19:03 hyPiRion: ,(contains? [1 2 3] :hrrng)

19:03 clojurebot: false

19:03 technomancy: I thought that was a line drawn in the sand

19:03 amalloy: ,*clojure-version*

19:03 clojurebot: {:major 1, :minor 5, :incremental 0, :qualifier "RC6"}

19:03 amalloy: ,(contains? :a :b)

19:03 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.Keyword>

19:04 amalloy: &(contains? :a :b)

19:04 lazybot: ⇒ false

19:04 hyPiRion: To be fair, I was more surprised by the fact that it didn't throw there.

19:13 arrdem: anyone here used the Lexington lexer before?

19:27 rationalrevolt: would someone mind looking at a sudoku code at: https://gist.github.com/rationalrevolt/4564280 , and help me understand why (gen-random-board) never completes but (solve test-hard-board) completes? I tried putting prints on the solved? function, and it seems to keep looping even after the board is solved when i run (gen-random-board)

19:28 jimkcar: nDuff: I figured it out.

19:29 nDuff: it was a dependency doing it to me.

19:29 when I require this project, it spews log messages. https://github.com/liebke/zookeeper-clj

19:40 Apage43: rationalrevolt: at first glance it looks like it's not going to short-circuit once it finds -a- solution, but could potentially generate a lot of solutions before it finally unwinds and discards most of them

19:40 possibly finding many of them multiple times

19:42 mm ,maybe

19:42 depends on the lazy-seq behavior

19:43 rationalrevolt: you could try grabbing a stack trace at that point (throw and catch an exception) to see how far down it is when solved? is returning true

19:43 could be insightful

19:43 amalloy: you're just trying to run the same naive search in a much larger probability space when you start from a blank board. you're generating gazillions of unsolvable boards

19:44 (probably. i haven't looked too deeply, but that's one plausible explanation)

19:45 rationalrevolt: hmm, in the solved? function, i tried adding a print of the return value - and it prints true multiple times - that should mean it should break out of the solve function

19:46 i know shuffle is not lazy, but cant imagine why that will cause an infinite loop - if i remove the shuffle and start with a blank board - it completes very quickly

19:46 Apage43: you may be being bitten by chunked seqs

19:46 * nDuff was thinking just that

19:47 nDuff: ...if that's the case, the number of times it continues will be bounded at the chunk size, so it's easy to look for.

19:48 rationalrevolt: I'm positive the shuffle is causing this behavior, because solving an empty board completes immediately

19:48 without the shuffle i mean

19:49 Apage43: what's probably happening is that the un-shuffled prospective boards all short-circuit to unsolveable very quickly

19:49 where is with the shuffle it is actually going down a lot of solveable paths (due to chunked seqs)

19:49 *wheras

19:49 *whereas

19:51 rationalrevolt: try wrapping your (for …) in one of the seq1's defined in the answer here: http://stackoverflow.com/questions/10556421/is-for-not-actually-lazy-in-clojure

19:51 if that fixes it, then it is due to chunked seqs

19:53 jimkcar: nDuff: did you see what my problem was? I'd be interested to know if others see it too

19:55 if you create a new lein project, add [zookeeper "0.91.0"] as a dependency, lein repl, then (require '[zookeeper :as zk]) log4j messages will spew

19:55 0.9.1 rather

19:56 rationalrevolt: Apage43: I have a feeling you may be right, will check

20:02 Apage43: You were right. If i made the result of shuffle a lazy seq, it completes as expected.

20:02 nDuff: jimkcar: Sounds like a topic for a zookeeper-clj ticket. I wonder, by the way, if 0.9.1 is before https://github.com/liebke/zookeeper-clj/commit/70ad3eaf010d74d821ade7f09a878850b88e4af5

20:02 Apage43: interesting

20:02 nDuff: jimkcar: ...could also be a side effect of interacting with java-logging

20:03 Apage43: i guess that stops for from chunking

20:03 rationalrevolt: looks like it

20:05 jimkcar: nDuff: I've been looking through the code and don't see anywhere that would do this. If it was a side-effect of java logging, there still has to be some zk code being run to print out all the logging.

20:05 I'll submit a bug to them.

20:05 nDuff: jimkcar: Well, what's the namespace on the log messages?

20:05 jimkcar: zookeeper.ZooKeeper

20:07 nDuff: It's also possible for Zookeeper itself to be responsible.

20:09 ...static class initialization can happen pretty early.

20:09 jimkcar: yeah, they have a default console log at INFO level. I wonder if they have some log call in a static block somewhere.

20:09 ugh

20:10 I can't seem to find the log4j.properties that it uses. Probably have one hidden on my classpath somewhere...

20:14 yep. right in the static block: https://github.com/apache/zookeeper/blob/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java

20:28 dnolen: Simply Typed Lambda Calculus in core.logic part II http://swannodette.github.com/2013/03/25/stlc-redux---part-ii/

20:28 trying to move a bit slower than Nada's talk at Clojure/West

20:31 bbloom: dnolen: i see you moved your blog.... my blog has been somewhat stalled by my incomplete migration to a static site generator as well....

20:33 dnolen: bbloom: yeah

20:33 tieTYT: protocols dispatch on type, right? Does that mean they're only useful when you get java classes as input?

20:33 technomancy: tieTYT: unless you use records, but yeah... don't use protocols unless you have to.

20:34 tieTYT: ok I haven't learned records yet, I should look that up

20:34 technomancy: nah

20:34 bbloom: technomancy: well, i mean, records are just java types, right?

20:34 tieTYT: nah?

20:35 technomancy: tieTYT: don't bother unless you're writing performance-critical polymorphic code

20:35 which is pretty rare

20:35 bbloom: tieTYT: what technomancy means is this: many new clojure programmers come from OOP & therefore use a lot of types and records

20:35 tieTYT: don't bother with records or with prototypes?

20:35 Bronsa: protocols*

20:35 technomancy: bbloom: *hand wavy dismissal to avoid confusion around advanced topics*

20:35 tieTYT: Bronsa: right

20:35 bbloom: tieTYT: types and records are often useful, but they are most often misused. so if you are new to clojure, avoid protocols, defrecord, deftype, etc

20:36 tieTYT: i'm writing a program that dispatches based off of the domain of a url. I used multimethods for this because it didn't seem like I could use a protocol when the inputs are all strings/urls

20:36 nDuff: tieTYT: multimethods are indeed the right tool for that job

20:36 tieTYT: i need to dispatch on the value, not the type

20:36 nDuff: good to hear, thanks

20:36 technomancy: whether that's suitable for multimethods is debatable, but it's definitely not for protocols

20:36 it's likely you don't need polymorphism at all

20:38 tieTYT: well i suppose I could use a map of <string, function>

20:38 but multimethods seemed cleaner in my newbie mind

20:38 also seems to point out, "I'm dispatching on this"

20:39 nDuff: tieTYT: if a map has functions on the RHS, it's typically pretty clear that it's involved in dispatch. :)

20:40 tieTYT: i suppose that's true

20:50 Frozenlo`: Well well well... I finally made a breakthrough. It seems Googlebot is having a hard time with wrap-force-ssl. Can anyone concur?

20:55 jcromartie: is there any reason not to create a uuid for an item before inserting it in a persistent store?

20:56 ivan: Frozenlo`: you may be able to get some insight by forcing Googlebot to hit your site with webmaster tools and capturing traffic with wireshark

20:57 Frozenlo`: unpopular HTTPS servers sometimes have bugs, or use wrong options, or your certificate has some weird options Google doesn't like

20:58 you can also see if Googlebot likes an nginx/apache server you set up with the same cert

20:58 and compare that traffic to jetty (?)

21:04 Frozenlo`: ivan: I fired wireshark once last week and saw the initial handshake, but nothing beyond that. :/

21:04 dyba: I have a question about this gist --> https://gist.github.com/weavejester/598020

21:05 on line 19, can anyone explain what is going on with the argument to handler?

21:05 Frozenlo`: Raynes: pinnnnng. Ever had any problem with refheap's https and googlebot?

21:05 dyba: handlers take requests as arguments

21:06 so I was thinking that by writing the first argument as a map, we are using destructuring to capture the data we need

21:06 is that correct?

21:09 I noticed that {{name "name"} :params} isn't the same thing as {:params {name "name"}}

21:13 gfredericks: dyba: yeah the function takes one argument

21:13 which is assumed to be a map

21:14 and it destructures it by pulling out the :params key in particular

21:14 the value under that key is further destructured

21:14 pulling out the "name" key and binding that to the local `name`

21:16 dyba: gfredericks: thanks for the explanation! It makes sense now. :)

21:16 gfredericks: the weirdest thing about map destructuring is that the keys/values are usually the opposite of what you'd expect

21:24 noprompt: i'm a bit confused here. how do i change the behavior of ILookup when using defrecord?

21:24 gfredericks: I don't think you do. You use deftype if you want something more custom.

21:25 noprompt: gfredericks: ah, ok. that's kinda what i thought.

21:34 bbloom: noprompt: i should warn you that if you're trying to make a custom Map type, it's quite a difficult road to travel

21:34 ILookup is one thing, but map with custom lookup is quite another

21:36 MikeSeth: is it possible to create a collection that is a generator?

21:36 ahh, nvm

21:36 bbloom: MikeSeth: depends on what you mean by "generator". but mostly: yes. see ##(doc lazy-seq)

21:36 lazybot: ⇒ "Macro ([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. See also - realized?"

21:37 MikeSeth: bbloom: yeah, I sinned by not rtfm'ing, thanks

21:53 Raynos: Apparently there's a functional clojure GUI framework

21:53 one that renders "scenes" or something by taking the current thing and the previous thing and rendering an efficient diff

21:53 im trying to find it

21:54 ivan: webfui?

21:54 bbloom: Are you talking about the recently announced http://pedestal.io/ ?

21:54 noprompt: bbloom: yeah, i'm starting to see that.

21:55 bbloom: noprompt: see my dispatch-map for an example https://github.com/brandonbloom/dispatch-map

21:55 noprompt: it's pretty tricky to get right, since there are so many interfaces/protocols/whatnot to implement

21:55 noprompt: i'm not even sure i got it 100%, what with hash codes, equality, printing, etc

21:55 noprompt: basically i want a custom type that models a CSS rule.

21:55 but acts like a map.

21:56 bbloom: noprompt: why does it need to be a custom type? why not just a CSS AST in a tree of maps?

21:56 noprompt: well i dunno.

21:56 i've take the approach of modeling the CSS like so ["selector" {:prop-1 "val" :prop-2 "val}]

21:57 but i thought it would be convenient to have Rule type that lets me lookup properties easily.

21:58 bbloom: why not just have a function of a rule map?

21:58 noprompt: can you explain what you mean?

21:59 like (defrule [selector prop-map]) ?

21:59 bbloom: describe the intended behavior of your desired ILookup implementation

22:00 Raynos: im just looking for examples of big efficient functional GUIs

22:00 noprompt: CSS rules are defined as a selector and any number of declarations.

22:00 Raynos: I cant figure out how to create large modular UI systems

22:00 noprompt: ie, div { prop: val; prop: val }

22:00 bbloom: Raynos: heh, that's a bit of an open research problem....

22:01 noprompt: i'd like the type to have a field for the selector and a field for the declaration map.

22:01 Raynos: i think webfui works

22:01 I know how to create large procedural modular UI systems

22:01 bbloom: noprompt: that's SORTA sufficient, it's worth pointing out that CSS selector rules are actually ordered maps & can have duplicate keys and what not, but 99% of the time that doesn't matter

22:01 noprompt: bbloom: right.

22:02 bbloom: noprompt: anyway, what operation are you trying to accomplish?

22:02 noprompt: so to work around that

22:02 bbloom: noprompt: you can't talk about how to model something until you talk about the operations you want to achieve on your model

22:02 noprompt: ["h1" {:prop "val"} {:prop "val}]

22:02 you can have multiple maps so you can preserve order, overwrite, etc.

22:03 bbloom: basically i wanted to make the manipulation of rules easy.

22:04 writing css in data structures is fine. but with CSS it's not as clean as hiccup.

22:04 bbloom: noprompt: do you know what types of manipulations you're making most often?

22:04 hiccup is somewhat hard to manipulate, you need to do stuff like check if the second entry in a vector is a map and then flatten seqs and what not

22:04 hiccup is optimized for expression, not for manipulation

22:05 or rather optimized for synthesis

22:05 noprompt: bbloom: right. and i think i have the synthesis part figured out pretty good. there's a few other tricks i haven't mentioned.

22:05 bbloom: but i've always wanted to have a flexible CSS that allowed you to pull apart selectors like you would a map.

22:06 bbloom: [:div.foo [:div.bar "baz"]] is easy to write & to compose construction, but if you want to manipulate them later, you're better off with {:tag "div" :attrs {:class "foo} :children { ...}}

22:06 noprompt: yeah and that's what i'm talking about. i could have it like that.

22:06 bbloom: a hiccup parser would read the vector notation and turn it in to clojure.data.xml style :tag, :attrs, :children representation

22:06 noprompt: and then write a few fn's and macros to make it easier.

22:06 bbloom: and by parser, i don't mean reader/parser like from strings

22:07 noprompt: so i guess then, in my case, {:rule {:selector "div" :declarations {}}}

22:07 bbloom: my suggestion is you try writing a function from hiccup -> xml maps (like clojure.data.xml) -> manipulation functions -> back to hiccup

22:08 this way both the synthesis and manipulation models are well known and defined for you

22:08 and you can get a feel for the design tradeoffs

22:08 then go back to designing your models for CSS

22:08 noprompt: wait, you do understand i'm trying to compose CSS not HTML right?

22:08 bbloom: consider things like add-class

22:08 or toggle-attribute

22:08 etc

22:09 yes

22:09 i'm suggesting you experiment with this in the HTML design space, since hiccup and clojure.data.xml have already have well designed models for you to play with

22:09 you'll get some insights you can apply to CSS

22:10 noprompt: bbloom: ah, right. yeah i started reading the hiccup source starting from the first commit, and slowly seeing how the library was put together.

22:10 Raynos: anyone use webfui ?

22:11 noprompt: i've pulled a lot of techniques from it.

22:11 bbloom: noprompt: if you try to write (fn toggle-class [hiccup-form] ...) vs (fn toggle-class [xml-tree] ...) you'll quickly see what i'm talking about :-)

22:11 noprompt: maybe the best thing to do is wrap up what i've got now, push up an alpha and get some input on the actual source.

22:11 bbloom: er i guess that toggle-class needs a class arg: [hiccup-form cls] etc

22:12 Raynos: noprompt: how do you avoid https://github.com/drcode/webfui/blob/master/webfui-examples/src-cljs/calculator/core.cljs#L44 ?

22:12 it feels like the pattern of having `render-all ENTIRE UI` would murder performance

22:12 noprompt: Raynos: i have no clue about that stuff, sorry man.

22:12 err woman(?)

22:12 Raynos: :( sorry

22:13 bbloom: Raynos: the same way persistent data structures avoid copying everything: you share previous structure

22:13 Raynos: bbloom: that's fine, but that function returns an entire new thing

22:13 it doesn't mutate a thing

22:13 i dont understand whom you can share from

22:14 noprompt: bbloom: i'll have a look at that stuff. and like i said i'll push up the code soon and see if i can't get some better insights.

22:14 bbloom: actually i did have one other question for you regarding types.

22:14 bbloom: Raynos: like i said, functional UIs are an open reserach problem. this is tricky stuff. go look at http://pedestal.io/

22:15 noprompt: CSS has various units. px, in, cm, em, etc.

22:15 imagine i wanted to add px and in together and get cms

22:15 (cm+ (px 40) (in 20))

22:15 akhudek: bbloom: how is your term rewriting project coming along?

22:15 Raynos: bbloom: thanks

22:16 danneu: yall know that joke about generating a random string by getting a freshman CS student to quit Vim?

22:16 well i'm a Vim user using Evil-mode that just got stuck in Emacs-mode for 10 min

22:16 bbloom: noprompt: that might be a reasonable place for a type, but it might also be a reasonable place for [40 :px]

22:17 akhudek: i published an early work in progress to https://github.com/brandonbloom/retree -- it's really just a toy at this point. i'm doing a bunch of exploring in the space & that was one experiment

22:17 noprompt: bbloom: that could work, but i'm going to have to do a lot of extra checking

22:17 bbloom: noprompt: i think cssgen does custom units, no idea of the implementation is any good

22:18 noprompt: bbloom: i'll look at it

22:18 bbloom: akhudek: kovasb had asked me about UpValues in mathematica: https://github.com/brandonbloom/retree/blob/master/src/retree/core.clj#L419-L437

22:19 noprompt: danneu: i tried emacs with evil-mode yesterday.

22:20 was impressed at how much better the support for vim key bindings have gotten

22:21 bbloom: thanks again

22:21 cya

22:22 akhudek: bbloom: I like the configurable strategy, looks like a fun little project!

22:23 bbloom: akhudek: the piece i'm most interested in is how to combine this with computing information about the tree & then minimizing compulation when changing the tree, such that it's cheap to evolve the tree & ask questions about it over time

22:24 akhudek: bbloom: that's a really hard problem, though in my experience anytime you can save redoing rewrites is a huge win

22:26 exploring rewrites based on term size is also a massive win (e.g. knuth-bendix ordering)

22:27 * bbloom googles knuth-bendix

22:27 bbloom: akhudek: did we meet at clojure/west? i'm trying to match names to faces to IRC handles & there was much beer drank last week

22:28 akhudek: bbloom: no, I wasn't at clojure/west, though it's possible we met at the conj. I can't remember.

22:28 bbloom: akhudek: i wasn't at the conj :-P

22:28 akhudek: bbloom: ah, that answers that :-)

22:28 bbloom: random question for the room: is there a variant of (pop []) that returns nil instead of throwing an exception?

22:29 but otherwise preserves a vector

22:33 Raynes: Frozenlock: I don't think so. I wouldn't know what a problem with that looks like.

22:33 st3fan: does anyone know how to deal with multiple request params of the same name in compojure?

22:34 a request like foo?stops=a&stops=b returns "b" for (:stops params)

22:34 Raynes: Raynos: Dude. Your name is way too similar to mine.

22:35 st3fan: Raynes: nothing soundex can't fix

22:41 Raynos: Raynes: dud no u

22:41 xeqi: st3fan: compojure/handler adds ring.util.params/wrap-params, which uses https://github.com/ring-clojure/ring-codec/blob/master/src/ring/util/codec.clj#L118 underneath. you might have to manually get then out of the request's :query-string if you want multiple ones with the same name

22:41 Raynes: Raynos: This can only be solved with fisticuffs in the courtyard. Duel at midnight!

22:41 Raynos: Raynes: https://twitter.com/Raynes ?

22:41 Raynes: Yes.

22:41 No.

22:42 IORayne

22:42 Raynos: https://twitter.com/Raynos <-

22:42 Once you get your real name on twitter

22:42 then we can duel

22:42 Raynes: I would if I could. :(

22:42 Raynos: its easy

22:42 go to SF

22:42 code at the twitter hq

22:42 wait for a good time

22:42 st3fan: xeqi: hmm i think i'll just pass them in comma separated then

22:42 Raynes: Actually, I wonder if I know anyone at twitter...

22:42 Raynos: i had to be in SF for like 6 months before I found a good time

22:42 to get my account changed to Raynos

22:43 now I need to find someone at google to give me raynos@gmail.com

22:43 xeqi: Raynes: if you do let me know, I want to stake a claim as well

22:43 Raynes: Raynos: Was there any tweets on the raynos account?

22:43 Raynos: two

22:43 from 2009

22:43 Raynes: xeqi: Yeah, the problem with the Raynes account is that there are tweets on it.

22:43 I'd have to have a really good friend to get them to give me the name.

22:49 arrdem: woah woah. Raynes AND Raynos? man gensym is fucking up tonight

22:49 Raynos: o_o;

22:54 Raynes: I feel like I've seen Raynos in other channels before.

22:55 danneu: wow

22:55 bbloom: Raynes: He's like your core.logic relational counterpart. Raynes is a function and Rayneso is the relation, but we can abbreviate Raynos

22:56 danneu: my irc client gives every name its own unique color. yet of course it gives Raynes and Raynos the same color

22:56 arrdem: ololol

22:56 Raynes: I think to think that I am Raynos's evil twin.

22:56 Raynos: Raynes: I have seen you

22:57 danneu: http://dl.dropbox.com/u/51836583/Screenshots/fv.png

22:57 Raynos: Raynes: do you use coffeescript?

22:57 arrdem: (inc danneu)

22:57 lazybot: ⇒ 1

22:57 arrdem: yer all green anyway on my monitor... monochrome xterm aw yeah

22:58 bbloom: danneu: haha. that sucks. i get confused when two people have the same color and are talking to each other & their names are wildly different

22:59 Raynos: danneu: :D

22:59 use a better hashing function

23:00 arrdem: gah fnparse make sense.

23:00 Raynos: it's probably the Java one TBH

23:00 Raynes: Raynos: I do not use Coffeescript at all.

23:00 arrdem: ,(.hash "Raynes")

23:00 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: hash for class java.lang.String>

23:00 Raynes: I may have wandered into the channel for one reason or another at some point.

23:00 Raynos: Raynes: then you are not my evil twin. My evil twin would use coffeescript

23:00 arrdem: ,(.hash Object "Raynes")

23:00 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: hash for class java.lang.Class>

23:00 Raynes: Fair enough.

23:00 bbloom: arrdem: hash or .hashCode

23:01 Raynes: &(hash "Raynes")(

23:01 lazybot: ⇒ -1854081710

23:01 Raynes: &(.hashCode "Raynes")

23:01 lazybot: ⇒ -1854081710

23:01 bbloom: ,(map (juxt hash #(.hashCode %)) ["Raynes" "Raynos"])

23:01 clojurebot: ([-1854081710 -1854081710] [-1854081400 -1854081400])

23:01 Raynos: I like how clojure outputs java exceptions :3

23:02 arrdem: clojure stacktraces...

23:02 * arrdem headdesks

23:04 * arrdem realizes why fnparse isn't behaving as expected

23:08 tieTYT2: my question: http://stackoverflow.com/questions/15628682/in-clojure-how-do-you-download-an-image-from-a-webpage-and-save-it-on-your-file

23:09 arrdem: clj-http?

23:09 clojurebot: dakrone maintains clj-http

23:09 tieTYT2: i'm using that but i didn't see an example of how to do that

23:09 i want the image, not the html

23:10 arrdem: tieTYT2: http://stackoverflow.com/questions/11321264/saving-an-image-form-clj-http-request-to-file

23:10 tieTYT2: nice thanks

23:11 i'm going to flag my own question as a duplicate

23:11 instead of deleting it. Might help people who search

23:11 i have another question though, I don't understand that method signature

23:12 (with-open [r (java.io.FileReader. "myfile.txt")] ...

23:12 is that assigning r to the right hand side?

23:12 how is that possible? I've never seen clojure work like that before

23:12 i mean except in a let

23:12 arrdem: so that's just a normal binding form...

23:13 we do that in let, for, doseq...

23:13 everywhere.

23:13 tieTYT2: can you do that anywhere?

23:13 arrdem: no.

23:13 tieTYT2: or are these special cases?

23:13 can i make my own function that uses this form?

23:13 this binding form

23:13 arrdem: you can build something else out of that form.

23:14 but it's the (with-open) which is creating the binding of symbol r

23:14 one could use a (let), but with-open will only execute it's body forms if the bindings were successful (no file open errors etc.)

23:17 tieTYT2: ok..

23:17 but i can't expose that let as part of my api like with-open does

23:17 right?

23:17 clojurebot: technomancy: you're right I should explain the reason. The reason is I would like to be able to call aether with an extra parameter for introducing my own :transfer-listener.

23:18 SegFaultAX: tieTYT2: What are you trying to do?

23:18 tieTYT2: SegFaultAX: nothing, just trying to understand the clojure language better

23:18 SegFaultAX: tieTYT2: What's unclear?

23:19 tieTYT2: i've seen the binding form with functions and let

23:19 but the difference with with-open is that it's exposed on the outside

23:19 SegFaultAX: tieTYT2: What do you mean exposed on the outside?

23:19 tieTYT2: and i was wondering if i can do that on functions i make

23:19 http://clojuredocs.org/clojure_core/clojure.core/with-open

23:19 the caller writes the binding form as a client

23:20 instead of the person who wrote with-open doing it on the inside

23:20 SegFaultAX: tieTYT2: You do that with lets to, though.

23:20 tieTYT2: yeah but lets are on the inside of functions

23:20 SegFaultAX: tieTYT2: And yes you can use that functionality yourself if you choose to.

23:20 tieTYT2: i can't expose them as part of the function api

23:21 wait can i do what this example does on any function I want?

23:21 i thought this was special to with-open

23:21 SegFaultAX: tieTYT2: Nothing special about it at all.

23:22 tieTYT2: Do you have a repl open?

23:22 tieTYT2: yes

23:22 xeqi: tieTYT2: you have to use a macro and transform the code, possible but rarely done

23:22 SegFaultAX: tieTYT2: True (source with-open)

23:22 Try*

23:22 tieTYT2: done

23:22 SegFaultAX: xeqi: Not that rare, really.

23:22 tieTYT2: You should see how they did it in with-open. You can use that as a template if you like.

23:23 tieTYT2: ok i want to make sure i understand this first

23:23 danneu: tieTYT2: been to the readme? lots of examples

23:23 tieTYT2: is r bound to bindings?

23:23 danneu: oh i realized i was scrolled up in chat

23:23 SegFaultAX: tieTYT2: I don't think you know what "bindings" are.

23:23 xeqi: SegFaultAX: hmm, I can't recall a similar one in clojars or lein

23:24 SegFaultAX: xeqi: A simliar what?

23:24 tieTYT2: it's destructuring right?

23:24 SegFaultAX: tieTYT2: Look at the source, it simply expands to a normal let form.

23:25 thm_prover: http://hpaste.org/84656 <-- this code works fine for evaluating syntacticallyv alid clojure code, i.e. "(+ 2 3)" gets me "[5]". However, when I give it syntacticaly invalid code, like "(+ 2 3", I get "nil" back ... rather than an error message. How do I get error messages back from nrepl?

23:25 xeqi: a defmacro that does a binding transformation into a let

23:25 tieTYT2: this source is a little advanced for me since it has a macro in it

23:26 maybe it's not a macro, but it's using ~@ and ~ and stuff

23:26 is there a simpler example I can look at?

23:27 SegFaultAX: tieTYT2: It's a macro, you can tell because it uses `defmacro`

23:27 tieTYT2: i'm just looking at this first example and wondering if two arguments are passed in or one: http://clojuredocs.org/clojure_core/clojure.core/with-open

23:27 SegFaultAX: tieTYT2: Probably safe to stay away while you're learning. Come back to it in a bit.

23:29 tieTYT2: whatever, obviously r is being BOUND to the rhs

23:29 i didn't know you could do that when you call

23:29 i thought you could only do that inside the def of a function

23:30 bbloom: odd:

23:30 (let [v [1 2 3]] (into {} [[v 1] [(seq v) 2]]))

23:30 vs

23:30 er:

23:30 ,(let [v [1 2 3]] (into {} [[v 1] [(seq v) 2]]))

23:30 clojurebot: {[1 2 3] 2}

23:30 bbloom: vs:

23:30 SegFaultAX: tieTYT2: Lets do it to (which is what with-open is using)

23:30 bbloom: ,(let [v [1 2 3]] (into {} [[(seq v) 1] [v 2]]))

23:30 clojurebot: {(1 2 3) 2}

23:30 bbloom: equiv is hard.

23:30 :-/

23:31 tieTYT2: a let is inside the def of a function

23:31 but this example is calling a function and using bindings

23:32 SegFaultAX: tieTYT2: No, it isn't.

23:32 tieTYT2: that's the thing i've never seen before

23:32 it isn't?

23:32 SegFaultAX: ,(let [a 1] a)

23:32 clojurebot: 1

23:33 tieTYT2: ok you can use it outside

23:33 is that what's going on?

23:33 SegFaultAX: ,(let [a 1] ((fn [] (inc a)))

23:33 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

23:33 danneu: you're still inside the let body

23:33 SegFaultAX: ,(let [a 1] ((fn [] (inc a))))

23:33 clojurebot: 2

23:33 tieTYT2: <tieTYT2> but this example is calling a function and using bindings as parameters

23:34 this is the the thing that's confusing me

23:34 can you show me an example doing that?

23:34 SegFaultAX: with-open isn't a function

23:35 tieTYT2: oh right

23:35 SegFaultAX: tieTYT2: It's a macro.

23:35 tieTYT2: well is that the only reason youc an do this?

23:35 SegFaultAX: tieTYT2: In this case, yes. Macros are evaluated at compile time. They're similar to functions, except their inputs are always unevaluated lisp forms and their outputs are usually also unevaluated lisp forms.

23:36 tieTYT2: They allow you to transform lisp forms from one shape to another at compile time.

23:36 tieTYT2: ok the world makes sense again

23:36 SegFaultAX: tieTYT2: In with-open's case, it's transforming the (with-open [...] ...) into a do or let form, based on the number of forms in the vector.

23:37 xeqi: &(macroexpand-1 '(with-open [r (java.io.FileReader. "myfile.txt")] r))

23:37 lazybot: ⇒ (clojure.core/let [r (java.io.FileReader. "myfile.txt")] (try (clojure.core/with-open [] r) (finally (. r clojure.core/close))))

23:37 tieTYT2: at a high level i get that it's taking that vector and saying "let myvector" when it replaces the code

23:37 SegFaultAX: tieTYT2: So if the vector is empty, it literally just becomes a normal (do ...) form.

23:37 tieTYT2: If the vector is non-empty, then it becomes (let [...] ...)

23:38 tieTYT2: ok

23:38 thanks for the help

23:39 SegFaultAX: tieTYT2: Again, I suggest deferring macros for a little while until you have a much firmer grasp on normal clojure.

23:39 tieTYT2: well i'm not trying to write them, but i come across code that uses them and it makes me question my understanding of everything else

23:43 danneu: itd be nice if slurp decompressed

23:44 ive used a few open source projects that lean on slurp and they choke on any gzipped website

23:45 Raynes: It'd be nice if people didn't use slurp as an http client. :p

23:46 bbloom: It'd be nice if stdlibs didn't try to be helpful and automatically interpret arbitrary URIs in their fopen routines!

23:46 sheesh, i had no idea that slurp would do that

23:48 tieTYT2: well it takes a URL, i thought it was meant for that

23:49 danneu: i wouldnt be surprised if you could pass it a :deflate option or something. "See clojure.java.io/reader for a complete list of supported arguments."

23:49 but i see no complete list there

23:51 tieTYT2: i'm getting this error in my repl: CompilerException java.lang.RuntimeException: Unable to resolve symbol: require in this context, compiling:(NO_SOURCE_PATH:1)

23:52 this is what I'm running: (require 'my-proj.image-site)

23:52 xeqi: tieTYT2: what namespace are you in?

23:53 tieTYT2: my-proj.image-site

23:53 wait

23:53 it worked this time

23:53 all i did is restart the repl twicew

23:59 how do I debug this exception? http://pastebin.com/cr9rcPa6

23:59 seems like there should be a longer stack trace

Logging service provided by n01se.net