#clojure log - Feb 15 2013

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

1:38 Frozenlock: from wikipedia: "Clojure (pronounced like "closure")"

1:38 That's a joke, right?

1:38 Raynes: Frozenlock: No?

1:39 I mean, the pronunciation should be IPA probably.

1:39 But that is accurate.

1:39 Frozenlock: IPA?

1:40 Raynes: http://en.wikipedia.org/wiki/International_Phonetic_Alphabet

1:41 Frozenlock: o_O

1:41 Yet I'm sure I've always heard cloJure. My brain is failing me.

1:44 spjt: It's a pun.

1:45 my cousin saw a book and called it clo-JOOR like it was French

1:45 amalloy: Frozenlock: nobody really bothers to put in enough emphasis to make the j sound distinct from the...zh sound in closure or measure

1:51 * Frozenlock will secretly use cloJure, just like he uses lateX

1:51 arrdem_: I say cloJer too...

1:55 anyone tried using congomongo's gridfs stuff?

1:57 spjt: it's pronounced "latek"

1:58 the X is chi, not "x"

1:58 Frozenlock: I know.

1:58 I'm a rebel.

1:59 * arrdem_ ponders a hipster joke, then realizes he's in a hipster language chan

2:00 spjt: hipster language....

2:00 I'm still in school, the hipsters like Java.

2:00 Raynes: gf3: You still working on refheap colors and stuff?

2:00 arrdem_: spjt: I see what you did there

2:02 hyPiRion: oh man. I knew that it was possible to embed videos into pdfs, so I wondered how you'd do that in LaTeX.

2:03 Apparently "LaTeX video" on Google didn't give me what I expected

2:03 Frozenlock: Raynes: In tryclj you've given an expiration date to the sandboxed namespace. As it seems to be associated with the session, wouldn't it just go away when the user closes his browser?

2:03 spjt: There's one guy who likes Haskell, he is a hipster, with all the tattoos and hipster glasses and skinny jeans

2:03 Raynes: Frozenlock: *shrug*

2:04 spjt: did you try "embed video into latex pdf"

2:04 hyPiRion: spjt: yeah

2:05 I found what I wanted by attaching "embed pdf"

2:05 spjt: hyPiRion: sorry, I'm dense.

2:06 hyPiRion: It's like the time I found this neat tool named Rubber for LaTeX. That's even worse

2:07 spjt: The best thing I've found about clojure so far is that sometimes my professors let us write a program in a language of our choice, so I write it in clojure, and they can't understand it, or compile it.

2:07 arrdem: lol

2:07 I tried that but the CS machines don't have clj or lein

2:07 and the rule is that you have to be able to build from source on DPT machines

2:07 so... common lisp it is

2:08 spjt: this prof is new and didn't say anything about it having to be available anywhere. We needed to include "instructions to build", which was too long for him to bother

2:08 hyPiRion: spjt: I just point them in the direction of Leiningen and tell them "lein uberjar" + java -jar uberjar

3:13 JanxSpirit_: how can I make this work? (str "sale" "20%")

3:15 magopian: JanxSpirit_: what's your question?

3:15 ,(str "sale" "20%")

3:15 clojurebot: "sale20%"

3:16 magopian: what does "work" mean to you? What are you trying to achieve?

3:16 JanxSpirit_: hmm.it's not working in a repl for me when a % is in one of the strings

3:18 hmm...only in emacs using C-M-X

3:18 it works at a normal shell repl in lein

3:24 thorwil: ,(str "sale" "20" \%)

3:24 clojurebot: "sale20%"

3:25 thorwil: JanxSpirit_: ^ how does emacs think about that?

3:45 JanxSpirit_: thorwil: still doesn't like it that way

3:47 Raynes: Dear persons and personettes.

3:47 I just moved www.refheap.com back to my an amalloy_'s linode. Through blood sweat and tears, I believe I have persevered.

3:48 However, this was over the last couple of hours. The domain changes may have not propagated to you yet, so if you see a maintenance page, that's the old Heroku server that I've brought down. You can wait or you can set your hosts file to what raynes.me resolves to.

4:01 tomoj: so a loop with 5 bindings can't have primitive support, right?

4:25 broquaint: Nice one, Raynes.

4:26 ifesdjeen: w000t Raynes great! teh best pastebin service ;)

4:53 opa: hi. can someone help me how can i install leiningen with java 1.6? i tried to google a bit but couldn't find the answer

5:04 thorwil: opa: seen "Install" on http://leiningen.org/ ?

5:06 opa: since lein is a bash script, java version doesn't matter there

5:06 opa: i forgot to mention, i have the leiningen installed but it uses java 1.7. i have to get it to use 1.6

5:06 so its configurable in the batch?

5:11 maio: lein contains: export JAVA_CMD="${JAVA_CMD:-"java"}"

5:11 export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-$JAVA_CMD}"

5:11 so I guess you just set LEIN_JAVA_CMD to desired java binary

5:12 thorwil: seems there is a :java-cmd key

5:13 babilen: opa: Just make sure "java" is "java 1.6" and not "java 1.7" -- Which platform/os is this on?

5:14 opa: i figured out that the reson was that i had java.exe on system32 which was in PATH before my explicit jdk. thanks for your help

7:09 t-goossens: why would emacs be more suitable than vim for clojure programming? It's just, in all the talks i watch, they are always using emacs

7:09 (almost)

7:09 is there any (non religious) reason?

7:10 borkdude: t-goossens apart from religion, no

7:10 t-goossens emacs works well with parens (paredit), I have no idea how that is in vim

7:10 t-goossens: vim has paredit if you want

7:11 sublime also (although still in development i think)

7:11 borkdude: t-goossens and emacs is driven by elisp, which is also a lisp, so this draws a lot of lispy people there maybe

7:12 t-goossens and because of that growing amount, clojure supports gets better and better?

7:12 t-goossens: its just

7:13 hyPiRion: I would suppose, since elisp and lisp has usually been developed on emacs, that emacs has simply better support for clojure to begin with

7:13 t-goossens: if i'm about to learn to work with a fancy editor

7:13 for other languages than clojure

7:13 is there any more suitable editor?

7:13 borkdude: t-goossens for Java I still would choose Eclipse/IntelliJ etc

7:13 hyPiRion: t-goossens: define "other languages"

7:13 t-goossens: well

7:13 the languages that i have in mind

7:14 borkdude: t-goossens but for other "languages" that involve text, like latex, html, etc, I like emacs best until no

7:14 hyPiRion: (I still program in Eclipse for java too, borkdude. Though I'm working on setting up CEDET, so maybe that would change things)

7:14 borkdude: w

7:14 t-goossens: python, ruby, scala

7:14 borkdude: hyPiRion I tried setting up some java stuff in emacs, but it wasn't giving me any benefit

7:14 t-goossens: javascript

7:14 borkdude: t-goossens I also use it for javascript

7:15 hyPiRion: borkdude: ah. Some friend of mine have a very nice CEDET setup for C++ (Think Eclipse + emacs), so I assume it's portable to java as well.

7:15 t-goossens: Well, you could either pick Vim or Emacs

7:16 I don't think there's any major difference really, as long as you pick one of them

7:17 borkdude: hyPiRion I don't want to spend a day configuring stuff

7:17 t-goossens one thing that also makes emacs worthy is org-mode

7:17 hyPiRion: borkdude: Ah, I usually tend to procrastinate by tweaking my setup

7:17 ChongLi: anyone here looked at LLJS?

7:17 http://mbebenita.github.com/LLJS/

7:17 borkdude: hyPiRion I recognize that, but I've been doing it too much

7:17 hyPiRion: hehe

7:18 ljos: borkdude: if you want to do Java in emacs you should look at emacs-eclim.

7:18 ChongLi: this seems really interesting

7:18 as a faster compile target

7:19 hyPiRion: (inc ljos)

7:19 lazybot: ⇒ 1

7:19 hyPiRion: thanks

7:19 borkdude: ljos tnx

7:21 t-goossens maybe Raynes has writting something about emacs/vi, he tried vi for a while

7:21 written

7:22 hyPiRion: I've heard people have used evil for emacs for some time now

7:22 borkdude: t-goossens for my students I just recommend Eclipse - I don't want to make clojure more difficult for them than necessary

7:22 hyPiRion: I think one of the Stuarts use it.

7:23 borkdude: t-goossens I could try recommending LightTable this year, but it's still a bit unstable

7:23 ljos: hyPiRion: I use

7:23 evil mode some times.

7:23 it works good.

7:23 borkdude: t-goossens one step that helped me most in learning emacs why disable the menu by default

7:23 why=was

7:24 t-goossens and just type M-x commands when you don't remember the key combinatino for some command

7:27 t-goossens: borkdude: a few months ago i played with lighttable for a while (it was one of the first experiences I had with clojure actually)

7:35 borkdude: gtg

8:19 dog_cat11: has anyone noticed instability in lein 2?

8:19 I installed it, it worked, then I started getting error opening up lein repl. The error mesg was something about not being able to open up a port

8:20 I reinstalled, it fixed the problem, then happened again

8:47 hyPiRion: dog_cat11: uh, lein repl only?

8:47 what are you running on?

8:48 vijaykiran: dog_cat11: did you check if something else wasn't blocking the port ? or perhaps the prev. lein process is still lying around ?

8:49 hyPiRion: vijaykiran: that shouldn't be an issue, it just picks a random port every time

8:49 the last one, that is

8:50 Anderkent|away: hyPiRion: it's possible some plugin is making it run with a constant jvm debug port for example

8:51 hyPiRion: Anderkent: yeah, what I was saying is that it shouldn't be an issue with the repl

8:55 dog_cat11: mac os x 10.7 w/o root privilage

8:55 its a work computer

8:57 i'll check, there could be another lein process in the bkgrnd

9:08 morrifeldman: I'm in a nrepl session and I typed a mismatched bracket and pressed return. Now I can't figure out how to cancel the botched command. Any advice?

9:09 vijaykiran: morrifeldman: C-q ?

9:09 hetano: C-c C-b I think

9:10 morrifeldman: I'm started the nrepl using lein repl from the command line, not in emacs

9:11 vijaykiran: morrifeldman: not sure what you mean - but you can try Ctrl-D or Ctrl-C and return ?

9:12 morrifeldman: I can do ^D to kill the repl completely, but I'd prefer to figure out how to just cancel out of the command

9:12 Ctrl-C is not doing anything for me. I'm on OSX if that is relevant.

9:14 vijaykiran: do you mean you are at "#_=> " ?

9:14 morrifeldman: vijaykiran: Yes!

9:14 vijaykiran: morrifeldman: just try ))))) and enter :)

9:15 morrifeldman: it should fail with "RuntimeException Unmatched delimiter: ) "

9:18 morrifeldman: Thanks! Sometimes )))))) doesn't work for me, but I'm not sure why

9:19 vijaykiran: morrifeldman: may be you are too deep in the parens and need to type more :)

9:19 Anderkent: How can I call a private function from a macro? (it's in the same ns as the macro, but not in the same ns as where the macro is used)

9:19 morrifeldman: cool. Thanks!

9:28 TimMc: Anderkent: Make it public and note that it isn't part of the API? :-/

9:29 Anderkent: TimMc: went with (deref (var fn-name)) instead... Rather unhappy with that though ;P

9:29 morrifeldman: Is there a combination of cons and conj? I'd like to do the following: (XXX "test1" ["test2" "test3"] "test4") and get out ["test1" "test2" "test3" "test4"], where XXX is the function I'm looking for.

9:30 Chousuke: morrifeldman: putting stuff in front of a vector involves a full copy.

9:30 unless you're okay with making it a lazy seq instead and losing indexed access.

9:32 morrifeldman: Any kind of sequence is OK and I don't have any performance worries.

9:33 Chousuke: morrifeldman: then you can use concat and wrap the head and tail in something seqable.

9:37 noncom: In clojure one does not usually specify types. Then, is there a way to know what type of arguments is expected by a function, by looking at its signature, except than refering to a documentation?

9:40 Anderkent: noncom: not usually - docs are your go-to. You can get them in a repl using (clojure.repl/doc <fn-symbol>)

9:40 TimMc: Just (doc foo).

9:40 Anderkent: assuming you have clojure.repl refered, sure

9:41 TimMc: If that doesn't work, (use 'clojure.repl) at the beginning of the session.

9:41 Anderkent: doesn't help if you switch namespaces often

9:51 jcidaho: Hi - nrepl.el has some hotkeys that clash with paredit - for example M-r...?

9:57 noncom: i see!

9:57 and the docs usually describe that just textually, right?

9:58 like "... expects an integer and a vector..."

10:03 reiddraper: TimMc: yeah, was scheduled for valentine's day, and we had no speaker, so figured it was best to just wait till march

10:05 noncom: ppl, please see my question above! thanx))

10:06 Anderkent: noncom: you're mostly correct - though docstrings can be anything really, so it depends on what code you're workign with

10:09 TimMc: reiddraper: Ah yeah, would have conflicted with a lot of dinner plans.

10:09 There didn't seem to be a cancellation announcement, though.

10:13 rplaca: Anderkent: your private function thing is kind of an idiom, though folks usually use the reader macros: (@#'myns/foo ...)

10:14 canweriotnow: So… macro question...

10:14 I'm using a lib with a macro that expects a vector literal of symbols.

10:16 I'm trying to provide this programmatically. If I pass it a var of that vector, it fails. If I generate the vector with a fn, it also fails. The only thing that works is a vector literal.

10:16 ChongLi: canweriotnow: yes

10:16 canweriotnow: Is there any way to force evaluation before the macro sees it?

10:16 ChongLi: canweriotnow: no

10:16 macros do not exist at run time

10:17 they can only work on literal forms

10:17 canweriotnow: that's… annoying. but thanks for the info. I was tearing my hair out :)

10:17 ChongLi: why is it annoying?

10:18 if you need evaluation at run-time use a function :)

10:18 canweriotnow: The macro in question is for templating PDF generation.

10:18 noncom: thanx!!!

10:18 canweriotnow: Yeah, I'm going to replace that functionality with an fn

10:19 I think it's a 'convenience macro' in that lib, just happens to be inconvenient for me :)

10:19 thanks

10:19 ChongLi: basically all macros are 'convenience macros'

10:19 they exist only to clean up the structure of your code

10:19 canweriotnow: gotcha.

10:28 Hah. I gave up on the damn macro, used a nested data structure, first and rest.

10:28 data structures > fns > macros

10:30 cheekee: (clojure.set/difference #{1 2 3} #{2})

10:31 when I type (clojure.set/difference #{1 2 3} #{2}) I get a ClassNotFoundException clojure.set error

10:32 does anyone know why?

10:33 ChongLi: works fine for me

10:33 did you (require 'clojure.set) ?

10:33 abp: ^ cause require is load

10:35 cheekee: I tried (:require clojure.set) and got CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:41)

10:35 ChongLi: inside the (ns ...) form?

10:35 abp: cheeke that's only for use in ns

10:36 cheekee: I am a noob to clojure...I don't know what ns is

10:37 ChongLi: ns is the namespace form

10:38 are you working in the repl or in a source code file?

10:40 clgv: cheekee: then better get started by reading a clojure book. otherwise you will stumble from error to error not knowing why it failed until your disappointment grows large enough to quit learning clojure ;)

10:43 cheekee: I am using repl and I am reading a clojure chapter in a book now

10:44 difference is the author had leiningen and I just used Ubuntu's version

10:44 (require 'clojure.set)

10:45 headshot: i'd start by hitting the leiningen site, and going down that path

10:45 cheekee: sorry mistype

10:45 TimMc: cheekee: Don't use what Ubuntu packages for you, it's super out of date. :-/

10:46 headshot: save you a lot of headaches with regards to dependencies, etc

10:48 cheekee: ok! anyway I got clojure.set working with what I just mistyped

10:49 TimMc: cheekee: Someone on the Debian end of things is working on setting up proper packaging of lein, but I don't know when that will hit Ubuntu's repos.

10:51 ChongLi: pimeys: you use Xmonad right?

10:53 pimeys: ChongLi: yup

10:53 awesome, xmonad, i3 are all good

10:53 ChongLi: pimeys: yeah I use xmonad too

10:53 pimeys: I just somehow choose xmonad, and I cannot change anymore :D

10:53 ChongLi: hopefully people in that thread will check it out

10:54 too many people equate linux with whatever comes with ubuntu

10:54 pimeys: I mean, every time I hear somebody saying linux is slow for work, I want to hit him in the face :D

10:54 nothing is faster than a good tiling wm + a good editor

10:55 ChongLi: and good hotkeys for everything

10:55 pimeys: yes.

10:55 hashbang1: pimeys: i loved awesome, i need to go back and give it another try. it has been a while

10:55 ChongLi: I'm still messing around with my setup

10:55 pimeys: and I really love xmonad's way of handling the desktops

10:55 you can select your desktop for every monitor

10:55 ChongLi: xmonad gets confused when you do a lot of nesting of layouts

10:56 pimeys: and select a different way of handling the windows for every desktop

10:56 ChongLi: perhaps I should just write a layout straight-up

10:56 pimeys: I'm using tabbed, tall, mirrored tall, grid and a special gimp layout

10:57 ChongLi: can you assign hotkeys for tabbed?

10:57 pimeys: ChongLi: what kind of?

10:57 just using the same hotkeys as with every layout

10:57 clojurebot: excusez-moi

10:57 ChongLi: for switching tabs

10:57 pimeys: cmd + j and k

10:58 ChongLi: I have meta + h j k l for navigation

10:58 using XMonad.Actions.WindowNavigation

10:58 pimeys: hmm, cmd + h and l changes the horizontal size of a split

10:59 j and k browses through windows

10:59 kryft: pimeys: Is 'tabbed' the one where each window is full-screen and you switch between them using cmd + j/k?

10:59 pimeys: yep

10:59 ChongLi: WindowNavigation does 2D browsing

10:59 in screen-space

10:59 pimeys: and you have a slim tab on top of the window

10:59 where you can see all open windows

10:59 and even *gasp* click them

10:59 ChongLi: if you have nested layouts then the 1D ordering of windows is non-obvious

11:00 seangrov`: Damnit, is there a way to unsubscribe from this goddamn "Why is this so hard" thread?

11:01 ChongLi: I use meta-shift-h & l for sizing windows

11:05 Anderkent: In midje: can I have around :facts backgrounds only happen around outermost facts? Alternatively, can I provide messages for assertions in some different way than nesting facts?

11:07 mpenet: Oddly enough I almost exclusively use full screen windows in xmonad, only 1 shortcut to learn: alt-tab. Yup that lazy

11:08 pimeys: I like tabbed better

11:08 mpenet: defeats the purpose of the whole tiling thing but anyway

11:08 pimeys: almost like full, but you have some indicator what's open

11:08 especially with my laptop

11:08 at work I have enough screen space for grid layout

11:08 ChongLi: I have all these different workspaces setup with complicated layouts

11:08 mpenet: yeah, I forgot about that. spaces and the occasional 2 window view

11:09 my config is around 20 lines or so max

11:09 ChongLi: mine's 398!

11:09 mpenet: I had a huge one at some point

11:09 ChongLi: a lot of comments and blank lines though

11:09 mpenet: but the defaults are just fine in most cases

11:09 pimeys: I would love if the xmonad config would be lisp instead of haskell :P

11:10 ChongLi: I don't mind the haskell

11:10 pimeys: well, it's a nice language, but I don't want to write it so much

11:10 too strict for me ;)

11:10 ChongLi: I think the type safety is really nice for this

11:10 pimeys: it is

11:10 and the type system altogether is very good

11:10 ChongLi: you can just try stuff and then fix the type errors and it works

11:11 mpenet: a bit scary for newcomers

11:11 pimeys: I think I'll learn ML instead, when I want to jump on that train

11:11 but not now

11:11 ChongLi: runtime errors would be very annoying with such complicated configs like this

11:11 I don't know if you'll get as much of a benefit with ML

11:12 if you're already using clojure you're programming in a non-pure language

11:12 pimeys: I know, and not even a real functional language

11:12 ChongLi: ML is basically the same thing without the lisp syntax

11:12 pimeys: I can do closures and give them names to get objects :D

11:13 and I can do side effects

11:13 ML has a type system

11:13 ChongLi: haskell is a radical departure which is very nice

11:14 learning monads really expands your way of thinking

11:14 it's the one thing I really miss in clojure

11:15 hyPiRion: ChongLi: Tried working with unbounded "variables" before?

11:15 That's also amazing

11:15 ChongLi: unbounded variables? you mean like logic variables?

11:16 hyPiRion: kind of, but not exactly

11:17 Say you have two variables, X and Y. You then define X to be a set containing Y, then unify Y with X

11:17 Now X contains itself

11:17 ChongLi: didn't X start out containing everything?

11:18 hyPiRion: In clojure terms: (unbound [x y] (unify x #{y}) (unify y x))

11:18 now (= x (get x x))

11:20 ChongLi: hmmm

11:20 hyPiRion: Check out Mozart/Oz, dnolen can vouch for that.

11:22 ChongLi: checking it out

11:24 dataflow variables

11:25 weird how they use % for comments

11:25 hyPiRion: yeah, that's the name

11:27 I thought ; was weird for comments, coming from Java and all.

11:27 TimMc: imma make a language where the comments are ( in parens )

11:28 lucian: TimMc: doesn't forth do that?

11:29 TimMc: ,(let [a (object-array 32), v (vec a)] (aset a 0 v) (= v (v 0)))

11:29 clojurebot: true

11:39 gf3: Raynes: Yeah, just been ultra busy with work :-(

11:55 clojure-newb: hey guys, how do I turn a LazySeq ({:k "val"}) into a collection like [{:k "val"}] ?

11:56 ChongLi: clojure-newb: into

11:56 ,(into [] '({:k "val"}))

11:56 clojurebot: [{:k "val"}]

11:56 clojure-newb: ChongLi: thanks

11:59 ayia: HI Guys. I am reading http://en.wikibooks.org/wiki/Learning_Clojure/Macros. Found such a line of code: (defonce *conn* nil). Is there any special reason for using "*" around conn? And common clojure coding guideline? What's the meaning?

11:59 TimMc: Those are earmuffs, indicating a dynamic var. (Just a convention, but long-standing.)

12:00 egghead: what in the, why does clj-http lower case all the header names

12:01 dakrone: egghead: because it reduces header collision and the RFC supports it

12:01 egghead: ah dakrone I didn't know it was valid by the rfc, think I'll start using lower case exclusively in that case

12:01 cheers, thanks for clearing that up

12:02 dakrone: yea, RFC explicitly says headers should be treated as case-insensitive

12:02 egghead: np, good luck!

12:05 clgv: TimMc: hey. does lein-otf allow to specify a function that is calle before the real main is loaded?

12:13 aav: who knows where to find clojure.contrib.seq ?

12:14 dnolen: aav: clojure.contrib is deprecated and I don't think there's a replacement for that one.

12:15 llasram: Most of the useful stuff made it into clojure.core though, didn't it?

12:15 aav: i somehow cannot find where "indexed" is

12:15 there ws such function in contrib.seq

12:16 found map-indexed in clojure.core

12:16 thanx

12:26 TimMc: clgv: Nope, why?

12:27 clgv: TimMc: I wanted to setup logging beforeanything gets loaded. but now I just use org.apache.log4j.PropertyConfigurator at the beginning of my main function

12:27 TimMc: tools.logging should include something to setup logging without a properties file^^

12:31 TimMc: You can always emulate lein-otf's behavior yourself; it is extremely simple.

12:34 clgv: (defn -main [& args] (require 'foo.bar) (apply (ns-resolve 'foo.bar '-main) args))

12:34 Something like that. Put the logging configuration before the require.

13:31 Raynes: gf3: Just curious. Obviously don't expect you to do anything. Thus is the nature of open sourc.

13:31 source*

13:32 callenbot: Raynes: what needs changed with refheap colors?

13:32 gf3: Raynes: ❤

13:32 callenbot: seemed fine to me, although the typography is really weird.

13:32 gf3: Raynes: It's gonna happen

13:32 Raynes: callenbot: Nothing, really. gf3 just wanted to play around with stuff.

13:33 callenbot: Got font suggestions?

13:33 gf3: As gf3 is want to do

13:33 Raynes: I hate choosing fonts.

13:33 I didn't even choose the ones that are there. I always delegate to someone else.

13:36 technomancy: gf3: I love the mock-ups you did for clojars. if you're busy would you mind if we got some folks to work them into the clojars codebase?

13:37 gf3: technomancy: Of course not, by all means

13:37 technomancy: I'll have some spare time in ~2 weeks

13:37 cemerick: gf3: got a link handy?

13:37 gf3: technomancy: If you need things like custom icons, logos, tweaks

13:37 technomancy: gf3: well no pressure of course; just wanted to check.

13:38 callenbot: Raynes: A few. Typography is an interest of mine. I will experiment locally and get back to you.

13:38 technomancy: I don't think we have anyone ready to give it a go right now, but I thought I might go asking for help at some point since the current design is pretty dated.

13:39 callenbot: gf3: are you a designer?

13:39 gf3: callenbot: Sometimes

13:39 callenbot: gf3: how came you to Clojure?

13:39 SegFaultAX: technomancy: Have you been following the recent HN drama re: Heroku? Do you have any thoughts on it?

13:39 gf3: callenbot: Through Scheme, Racket specifically

13:40 technomancy: If you don't find anyone in the next ~2 weeks I can cut it up

13:40 callenbot: gf3: how interested are you in collabs?

13:40 gf3: I build a lot of side projects - web apps in Clojure.

13:40 gf3: callenbot: I love collaborating

13:41 callenbot: gf3: can I /query you to trade contact info?

13:41 technomancy: SegFaultAX: I do, but I'm not supposed to talk about it. there's a technical response that should be posted soon.

13:41 callenbot: SegFaultAX: I can talk about it.

13:41 SegFaultAX: I'm not a Heroku employee.

13:41 SegFaultAX: technomancy: Oh, sorry. :)

13:41 ravster: hello all

13:41 callenbot: SegFaultAX: RG's complaints aren't very substantive.

13:41 SegFaultAX: what do you want to know?

13:42 ravster: hi

13:42 SegFaultAX: technomancy: Either way, this isn't something that materially affects you, is it? It seems isolated to Bamboo and the Clojure stuff is all Cedar, yea?

13:42 Raynes: SegFaultAX: What drama?

13:42 SegFaultAX: Raynes: Sec, lemme get you a link.

13:42 Raynes: SegFaultAX: Found it.

13:42 callenbot: SegFaultAX: more or less. You're supposed to be on Cedar running concurrent workers.

13:42 SegFaultAX: callenbot: Honestly, I thought Heroku was phasing out bamboo entirely.

13:43 It's been second class for at least the last year or two.

13:43 callenbot: SegFaultAX: correct.

13:43 Raynes: technomancy: One thing Heroku taught me that benefitted me moving back to linode is how easy it is to configure things if you use environment variables.

13:43 SegFaultAX: I started using Heroku right about when Cedar was made publicly available.

13:43 callenbot: SegFaultAX: the whole situation is silly. Yes random routing is sub-optimal, no it shouldn't matter.

13:44 gf3: cemerick: PM?

13:44 cemerick: gf3: sure

13:44 Raynes: gf3: My God, you said you were a designer and everybody is lining up to eat your soul.

13:44 SegFaultAX: Raynes: The other thing Heroku taught me when I moved back to Linode is how awesome LXC containers are!

13:45 callenbot: Raynes: shush you.

13:45 SegFaultAX: that too.

13:45 SegFaultAX: callenbot: Especially for a site the size of Rap Genius, why the hell would they still be using Bamboo?

13:45 callenbot: SegFaultAX: also LXC container is like ATM machine.

13:45 SegFaultAX: I don't think RG is known for their technical competence or expertise.

13:45 SegFaultAX: callenbot: I know, I realized that after I wrote it.

13:46 But LX container sounds weird.

13:46 callenbot: SegFaultAX: they're hustlers selling eyeballs.

13:46 and after seeing how they handled the Heroku situation, I know definitely not to work with them

13:46 SegFaultAX: callenbot: I'd never heard of them until this drama came out.

13:46 callenbot: because they'll bitch loudly about things they don't really understand.

13:46 SegFaultAX: I work at a YC company, I can't say which.

13:46 SegFaultAX: so I know of them.

13:48 SegFaultAX: callenbot: In fairness, they did say in that article that they don't know anything about ops, and they don't want to (which is probably why most people use Heroku to begin with)

13:48 gf3: Raynes: Joke's on them—I'm soulless

13:48 technomancy: the armchair architects are really annoying with the whole "It's easy; just assume it's possible to have complete instantaneous knowledge of the state of the entire cluster, and then you just ..."

13:49 it's the programmer equivalent of "assume a frictionless vacuum"

13:49 bbloom: technomancy: heh, that's a great analogy

13:50 bawr: technomancy: I laughed hearily, kudos for that description/

13:50 gfredericks: so "heroku's tech is terrible" is a different claim from "it now costs 50x more to get the same perf and they never said so"

13:50 SegFaultAX: technomancy: Did you see that xpost from elance on HN yesterday? It's particularly relevant to your analogy.

13:51 bbloom: it's kinda a bummer because we moved off heroku after about a year b/c we simply couldn't understand, predict, or improve our performance for our rails app. i wish the abstraction worked for ever and never leaked. it's really a great platform for getting started & i recommend it to a ton of folks. but you need to jump in the deep end much sooner than many folks do

13:51 SegFaultAX: https://www.elance.com/j/website-like-amazon/37294947/

13:53 callenbot: bbloom: that's been my experience as well, but I still use it for side projects.

13:57 ppppaul: hey guys. i'm having issues with this code: -> (io/copy (io/file source-path) (io/file dest-path))

13:57 sometimes it works, sometimes it hangs

13:57 the output is created by the copy. io/ = clojure.java.io

13:58 i'm reading from the file system and writing to the file system

14:00 SegFaultAX: ppppaul: Are source-path and dest-path ever the same?

14:00 ppppaul: i hope not

14:01 i will wrap my code in a 'when

14:01 the thing is, this code is running in a test

14:01 and the test data is always the same

14:01 sometimes the code runs fine, sometimes it stalls and i have to do nrepl-interupt

14:04 in my tests i'm transferring 416 files

14:04 could i be hitting an open file cap (i'm doing these copy's in sequence, so i expect the streams to be closed by io/copy (it is opening the streams)

14:06 callenbot: ppppaul: stop opening the files without closing them

14:06 ppppaul: http://clojuredocs.org/clojure_core/clojure.java.io/copy

14:07 mefesto: io/copy will close streams that it opens itself which is what i think ppppaul was saying

14:08 callenbot: should.

14:12 ppppaul: yeah... actually, now that i inspect my file system, it seems like the destination folders have the copied files in them... so maybe my bug is somewhere after the code that copies

14:31 Frozenlock: Anybody knows how to give socketpermissions in clojail? "java.security.AccessControlException: access denied ("java.net.SocketPermission" "<someIP>:47808" "connect,resolve")"

14:33 Raynes: You cant to give socket permissions to the sandboxed code?

14:33 Er, want*

14:34 Frozenlock: Yes I want :)

14:35 dnolen: this is pretty interesting http://asmjs.org/spec/latest/

14:35 SegFaultAX: dnolen: I was just reading that as well.

14:35 Raynes: Frozenlock: I'm fuzzy on the topic, but you should look at clojail.jvm/permissions and then change the default :content argument when you call sandbox. Take a look at the default for an example.

14:35 dnolen: as is this https://bugzilla.mozilla.org/show_bug.cgi?id=840282

14:35 w/in 2X of C one some benchmarks

14:35 Frozenlock: Raynes: Thanks!

14:35 dnolen: "on some"

14:38 callenbot: the problem with making something faster than C is that C implementations get to cheat.

14:38 Fortran's main advantage was lost with -fno-alias

14:39 when you get to change the semantics and expectations to suit the use-case, it's hard to compete.

14:43 clojure-newb: hi guys how do I do a distinct on the value of a specific key in a collection of maps ? IE [{:key1 "12345" :k2 "any val"}{:k1 "12345" :k2 "other val"}]

14:44 gfredericks: clojure-newb: what do you want the result to be?

14:44 callenbot: clojure-newb: pretty ambiguous.

14:44 clojure-newb: gfredericks: [{:key1 "12345" :k2 "any val"}]

14:45 gfredericks: no bothered about which one it removes at this point

14:45 gfredericks: clojure-newb: so always the first one?

14:45 clojure-newb: gfredericks: yes that will do

14:45 TimMc: Something with annotation and merge-with, I'd say.

14:45 gfredericks: ,(#(->> % (group-by :key1) vals (map first)) [{:key1 "12345" :k2 "any val"}{:k1 "12345" :k2 "other val"}])

14:45 clojurebot: ({:key1 "12345", :k2 "any val"} {:k1 "12345", :k2 "other val"})

14:46 gfredericks: ,(#(->> % (group-by :key1) vals (map first)) [{:key1 "12345" :k2 "any val"}{:key1 "12345" :k2 "other val"}])

14:46 clojurebot: ({:key1 "12345", :k2 "any val"})

14:46 gfredericks: there we go

14:46 TimMc: Oh hell, group-by.

14:46 clojure-newb: gfredericks: thanks, I will give it a go

14:46 just processing that :-)

14:46 gfredericks: that one is guaranteed to give you the first for each key

14:52 SegFaultAX: gfredericks: Why make it so complicated?

14:52 ,(apply merge (reverse [{:key1 "12345" :k2 "any val"}{:key1 "12345" :k2 "other val"}]))

14:52 clojurebot: {:key1 "12345", :k2 "any val"}

14:52 rplaca: right, just use merge

14:53 plus, clojure-newb said he didn't really care which one you picked

14:54 clojure-newb: that is not returning a sequence of maps

14:54 the former solution was

14:54 SegFaultAX: ,(list (apply merge (reverse [{:key1 "12345" :k2 "any val"}{:key1 "12345" :k2 "other val"}])))

14:54 clojurebot: ({:key1 "12345", :k2 "any val"})

14:55 rplaca: clojure-newb: you want a list of maps or a vector with a single map?

14:56 if you don't care which result is picked:

14:56 ,(vector (merge {:k1 "12345", :k2 "any val"} {:k1 "789", :k2 "other val"}))

14:56 clojurebot: [{:k1 "789", :k2 "other val"}]

14:56 clojure-newb: rplaca: sequence of maps where :k1 value is unique/distinct

14:58 rplaca: ahh, so you're filtering an original list of maps with some k1s being duplicate into a list with only unique k1s

14:58 clojure-newb: rplaca: yes

14:58 rplaca: where k1 is known ahead of time

14:58 ahh, I misunderstood

14:58 clojure-newb: rplaca: yes

14:58 no worries

14:58 sorry.. my original question was probably not well phrased

14:59 rplaca: and I'm doing three things at once! :)

14:59 clojure-newb: yeah, my brain is pretty much melting too

15:07 mikerod: Could someone please explain why on several occasions, when in namespace user a record is def'ed, such as (defrecord MyRec [x]) and you do (instance? user.MyRec (map->MyRec{:x "something"})) it is false, but when doing (instance? user.MyRec (eval (map->MyRec{:x "something"}) it is true.

15:08 anything I do to determine what (map->MyRec{:x "something"}) is when it is not user.MyRec ends up evaluating it and saying it is an instance of user.MyRec ... Hopefully I'm explaining this accurately.

15:08 clearly*

15:10 bbloom: mikerod: if you re-def a type, you've created a new type with the same name, but different runtime values

15:10 mikerod: all of your previous instances and references aren't automatically updated

15:12 mikerod: bbloom: I'm not sure I follow you on this.

15:13 I only defrecord once

15:13 bbloom: mikerod: are you re-evaluating the file in which that defrecord occurs?

15:13 mikerod: the auto-generated map-> factory function seems to not always evaluate as an instance of the type

15:14 No, I'm not reevaluating.

15:14 bbloom: check (= (class x) (class y))

15:14 compare to (= (str (class x)) (str (class y)))

15:19 mikerod: bbloom: both of those checks are true for me

15:20 in the same context where (instance? user.MyRec (map->MyRec{:x "x"})) is false.

15:20 tekkk: why is this true? (associative? [:a :b]) .. what does associative mean?

15:20 isn't that the key is associated with the value

15:21 bbloom: mikerod: ok, then i guess i don't undertand. can you provide a minimal reproduction?

15:21 tekkk: vectors are associative, like maps, with respect to integer indexes:

15:21 ,([:a :b :c] 1)

15:22 clojurebot: :b

15:22 tekkk: bbloom: i see

15:22 bbloom: tekkk: lists, however, are not, since they can't provide better than linear runtime for lookups by index

15:22 ,(associative? '(:a :b))

15:22 clojurebot: false

15:26 TimMc: ~seqs and colls

15:26 clojurebot: seqs and colls is http://www.brainonfire.net/files/seqs-and-colls/main.html

15:26 amalloy: bbloom: associative is for assoc, not get

15:26 you can be ILookup without being Associative

15:26 bbloom: amalloy: ah yes, as usual, you are correct.

15:27 tekkk: what amalloy said

15:27 mikerod: bbloom: I've been trying to recreate the issue in a predictable way. One instance of this is that I tried to do a (is (instance? my.ns.MyRec (map->MyRec{:x 'x}))) in a deftest and it was false/failed.

15:28 so this was in a different namespace i.e. my.test-ns that :use 'my.ns

15:29 sorry :use my.ns (no quote)

15:29 to get the test to pass

15:29 I changed it to (is (instance? my.ns.MyRec (eval (map->MyRec{:x 'x}))))

15:30 So it seems that eval caused the type of the object to become realized for the instance? check...

15:30 amalloy: stop adding evals. all they are doing is distracting you by hiding the problem; they are not doing anything meaningful

15:31 eval is (probably) effectively round-tripping the record through pr-str and read-string, so that the problem bbloom says you are having gets hidden, by converting the old class into a string name, and then reading it back in as the new class

15:32 hiredman: you have stale classes

15:33 mikerod: I "sort of" understand this. I'm not sure what I do to make this happen though.

15:33 hiredman: e.g. generated via aot or something

15:33 delete them and restart your repl

15:33 they will be in where ever your build tool puts them

15:33 mikerod: It seems I defrecord in one namespace, but if I use it in another namespace with the factory function map-> , it isn't necessary an instance? of what I expect until it is evaluated.

15:35 hiredman: mikerod: look, you know nothing about it, stop trying to guess, you will just confuse yourself and anyone else impressionable watching the chat

15:35 tekkk: what is the difference between clojure.lang.PersistentHashMap and clojure.lang.PersistentArrayMap

15:35 try this: (def a-map {:a :b}) (type a-map) (type {:a :b})

15:35 it gives two different types

15:35 ,(def a-map {:a :b}) (type a-map) (type {:a :b})

15:35 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

15:35 hiredman: mikerod: just clear out your stale generated classes, and if possible stop aot compiling

15:36 mikerod: hiredman: I'm wondering is it a bad thing that I need to do the (eval ...) call around it, or is this just the way it should be handled. I've ran into this in non-test code.

15:36 hiredman: ok I'll look into that

15:37 Thanks for helping out too!

15:38 borkdude: Someone on Twitter asked where "fn* was defined" - is this baked into the compiler?

15:41 hiredman: http://dev.clojure.org/jira/browse/CLJ-979 http://dev.clojure.org/jira/browse/CLJ-1132 and I am sure there is at least one other

15:41 .win 15

15:41 technomancy: borkdude: it is; it's in Java

15:42 borkdude: technomancy I saw something in Compiler.java, but couldn't exactly figure out how this worked

15:43 callenbot: borkdude: http://stackoverflow.com/questions/10767305/what-is-fn-and-how-does-clojure-bootstrap#10767535

15:44 btw, Duckduckgo got me that answer. I was having an impossible time finding that answer on Google.

15:44 borkdude: callenbot tnx :-)

15:45 Raynes: callenbot: You listened to Cinderella Man by Eminem didn't you?

15:46 mikerod: hiredman: thanks for the jira links, that is certainly helpful

15:46 callenbot: Raynes: yes, you sent it to me.

15:46 Raynes: callenbot: Fantastic.

15:55 jweiss: i'm getting OOM errors in pr (admittedly, a large object, >10mb of text when printed). But still, it's not that deeply nested, i don't think it ever goes more than 10-20 levels deep. so why does pr use so much ram?

15:55 and is there another way to serialize to text more efficiently

15:56 amalloy: pr shouldn't really use any ram; it writes directly to whatever Writer you give it

15:57 so i'd say your object is bigger than you think (so large it takes up all RAM when you realize it?)

15:57 SegFaultAX: Time to profile!

15:58 hiredman: amalloy: people tend to do things like call .getBytes on strings and such

15:58 jweiss: yeah i guess that is possible, my size estimate was based on a successful "run" but the one that failed could have gone awry and somehow produced far more data.

15:58 hiredman: which for some period of time doubles the ram required

15:59 amalloy: hiredman: who is "people" here? implementors of the pr multimethod? i don't quite see how your observation is related

15:59 jweiss: amalloy: but isn't it a little suspicious that it only goes OOM when i go to print out this object (every time?) i've never gotten OOM before that.

16:00 SegFaultAX: jweiss: Is the object fully realized before you print it?

16:00 amalloy: jweiss: (let [obj (range)] (...lots of code, no OOM...) (pr-str obj)) ;; omg, OOM

16:00 hiredman: amalloy: pr is extendable, if he is trying to print something with data structures that have naive print-methods defined it very easily oom

16:01 jweiss: amalloy: i added some print-method dispatch to stop pulling items from lazy seq's when it hits the end of the already-realized portion

16:01 * jweiss goes back to find that dispatch

16:01 amalloy: barf. you're on your own there, man. "i added some specialized code to how pr works, and now when i pr things i run out of memory"

16:02 jweiss: amalloy: well, how else can you trace functions that return infinite seqs

16:03 amalloy: you know, i add debug-prints to the args or return values of my functions pretty often, and for some reason i've never run into that problem

16:05 jweiss: amalloy: if you printed an infinite seq, i would expect you would have hit it :)

16:05 amalloy: indeed

16:06 jweiss: https://github.com/weissjeffm/fn.trace/blob/master/src/fn/trace.clj#L24

16:06 somehow i doubt that is what's responsible for OOM

16:06 unless there was a possibly-infinite data type i missed.

16:09 amalloy: *shrug* there is an open-ended set of infinite data types. i'm not saying that's what's causing the problem, but it easily could

16:09 SegFaultAX: jweiss: Question - why not just return the realized part of the list all at once instead of building a lazy seq to return the realized part of a lazy seq?

16:09 amalloy: (reify Object (toString [this] (pr-str (range))))

16:10 augustl: is test.generative similar to QuickCheck, ScalaCheck, etc?

16:10 SegFaultAX: jweiss: (Since you already know it's realized, that is)

16:10 jweiss: SegFaultAX: i think i had an issue with ChunkedCons.

16:10 i can't remember exactly, it's been a few months since i worked on that.

16:11 SegFaultAX: oh i think i see what you are saying, why make the returned seq lazy at all

16:12 SegFaultAX: jweiss: Right.

16:13 jweiss: SegFaultAX: i think that if i took out lazy-seq i'd get a stackoverflow, wouldn't i?

16:13 because that function calls itself

16:14 SegFaultAX: jweiss: 1) Only until it reaches the unrealized portion, 2) it could be re-written with a reduce.

16:15 jweiss: yeah, seems that way looking at it now. i can't remember if there was any reason that wouldn't work

16:16 amalloy: it's better as a lazy seq anyway

16:17 reduce would have to use a vector and its purpose would be kinda obscured; the recursive nature of the problem is easiest to see with just using recursion, and a lazy seq makes that possible without adding more problems

16:24 enquora: has anyone worked with construction of PDFs using raw pdf primitives?

16:27 nickmbailey: i can ask him

16:28 pzuraq: hi

16:28 nickmbailey: err wrong room

16:28 haha

16:28 pzuraq: are datastructures in clojure similar to haskell? I'm trying to implement a graph but not sure where to start

16:28 Iceland_jack: pzuraq: How would you start in Haskell?

16:29 pzuraq: hmm, good question. I've done trees in haskell but not graphs...

16:29 Iceland_jack: Right, modelling graphs in Haskell is a major issue

16:29 at least using ADT's

16:30 gfredericks: I just interviewed a guy who remarked how difficult it is to do trees in J

16:31 Iceland_jack: pzuraq: Adjacency matrix, adjacency list, … I suggest you look up how graphs are normally implemented

16:31 ChongLi: I don't see why you couldn't use the same techniques as clojure in Haskell

16:31 Iceland_jack: Implementing them in Clojure and Haskell shouldn't be different

16:31 ChongLi: just use Maps

16:32 pzuraq: cool, so clojure is pretty similar to haskell. I'm just getting used to functional languages, feels like relearning to ride a bike

16:32 Iceland_jack: Clojure is not pretty similar to Haskell I'd say

16:32 gfredericks: I've done undirected graphs a lot in clojure using sets of sets; but it wasn't too perf-sensitive

16:33 ChongLi: Iceland_jack: depends on how you define similar

16:33 pzuraq: Iceland_jack: Would you say it's closer to Haskell or Java?

16:33 Iceland_jack: pzuraq: I would.

16:33 But pzuraq seems to have inferred that because implementing one thing isn't too different between the two

16:34 pzuraq: I mean to say that what I've learned from Haskell will help in writing this project in Clojure, not that the languages are interchangeable or even incredibly similar

16:35 Iceland_jack: Fair enough.

16:35 ChongLi: Clojure is the most Haskell-like of the lisps

16:36 with its focus on immutability and stuff like STM

16:36 Iceland_jack: Sure, but I would say that something without a strong type system simply isn't that similar to Haskell

16:36 Of course similarity is subjective so let's not argue about that

16:36 ChongLi: yeah this is one of those rock paper scissors thing

16:37 Iceland_jack: Why does paper ‘beat’ rock again?

16:37 ChongLi: java has strong types but is less similar

16:37 because paper needs *something* to beat

16:39 pzuraq: Iceland_jack: With hugs

16:39 http://iwidk.com/wp-content/uploads/2013/01/rock-paper-scisssors.jpg

16:44 augustl: I want to do model based generative testing. Similar to what you can do in QuickCheck (afaik). I'm also testing a very impure system with lots of state and databases. Anyone got some suggestions?

16:45 test.generative seems to be mostly about testing pure clojure functions. I want my tests to do networking and other nastyness.

16:45 dnolen: neat, http://tailrecursion.com/blog/2013/02/15/introducing-javelin-an-frp-library-for-clojurescript/#.UR6Juounla8.twitter

16:46 gfredericks: augustl: use core.contract and run a lot of real data through the system?

16:46 noprompt: i'm curious. is the use of macros to create a pseudo templating language a bad idea?

16:47 augustl: gfredericks: what's core.contract?

16:47 gfredericks: noprompt: you're not just trying to replicate unquoting are you?

16:47 $google clojure core contracts

16:47 lazybot: [clojure/core.contracts · GitHub] https://github.com/clojure/core.contracts

16:47 gfredericks: augustl: ^

16:47 ChongLi: dnolen: this is really neat

16:47 noprompt: i don't think so but i could be wrong.

16:48 basically i have a query that's more or less the same every day that imports data in to a mysql database with LOAD DATA INFILE.

16:48 it's a bit complex and using string templates is hard to maintain

16:48 augustl: seems like few people are doing generative testing, I'm not finding any blog posts that holds my hand, step by step :)

16:49 gfredericks: augustl: I'm interested in it, but haven't been able to

16:49 ChongLi: I think the spreadsheet metaphor gives a much better naming convention than the typical event/behaviour duality

16:49 noprompt: so i wrote a little macro that allows me to write sql with uppercase symbols, which get resolved if possible, and converted to a string otherwise

16:49 augustl: gfredericks: same :)

16:49 gfredericks: augustl: I think I've wanted better ways for describing data schemas

16:50 noprompt: (SQL* LOAD DATA INFILE "somefile" ...)

16:50 i'm pretty sure it's an abuse though

16:50 gfredericks: noprompt: you could use &env for that

16:50 that's a fascinating macro actually

16:51 that doesn't mean it isn't terrible; I won't judge that :)

16:51 noprompt: the resolution part is needed because i have some things like (SET {:some_field "some value})

16:51 which i want to leave alone

16:52 how would &env help me in this case? i've never used it before.

16:53 haha, i'm pretty sure it's terrible

16:54 bbloom: noprompt: you can use github.com/brandonbloom/backtick to do resolution of symbols that is compatable with quasiquote -- unfortunately, i don't provide the resolver yet, but it's pretty easy to port from the clojure source if you want to contribute that

16:55 gfredericks: noprompt: &env would allow you to just use locals

16:55 noprompt: so here's the code https://gist.github.com/noprompt/4963866

16:55 with an example

16:56 i'm still learning how to use this stuff

16:56 bbloom: checking it out

16:56 ah, so in this case i could avoid the resolution code?

16:57 bbloom: noprompt: sorry, i spoke before i saw your implementation

16:57 noprompt: can you give me any tips?

16:57 bbloom: noprompt: your usage of postwalk is sufficient

16:57 noprompt: bbloom: thanks

16:58 bbloom: noprompt: basically, postwalk knows how to walk all the various types of clojure data structures. backtick does the same thing, but supports clojure.core/unquote and clojure.core/unquote-splicing as well as calls a resolver function on symbols, just like you do

17:00 noprompt: bbloom: that's pretty cool

17:01 bbloom: reading your article, it's funny you mention the use of ERB with SQL - that's what i was originally doing

17:02 bbloom: noprompt: i mentioned it because people do it :-P

17:05 noprompt: i don't know what's popular in the clojure/sql world right now, but i remember being impressed by http://clojureql.org/

17:07 noprompt: bbloom: i've had a lot of success with korma

17:07 bbloom: but i did run across this yesterday

17:08 bbloom: noprompt: with all due respect to ibdknox, i prefer to avoid reification of "entities"

17:09 ibdknox: fwiw, you don't have to reify entities in korma

17:09 (select :users (where {:blah 4}))

17:09 bbloom: ibdknox: i haven't used either korma or clojureql, so i'll step back from the conversation :-)

17:09 ibdknox: haha

17:12 tomoj: wonder why bit-set etc aren't inlined, seems to prevent primitive transmission

17:15 gfredericks: (defmacro strs [& syms] (let [vs (vec (for [sym syms] (if (contains? &env sym) sym (s\

17:15 oops

17:16 (defmacro strs [& syms] (let [vs (vec (for [sym syms] (if (contains? &env sym) sym (str sym))))] `(clojure.string/join " " ~vs)))

17:21 noprompt: gfredericks: is that an alternate solution?

17:22 gfredericks: i actually like that a lot more, cause it avoids the regex test

17:23 SegFaultAX: I think Korma is an awesome idea, but I haven't seen many projects using it. Do most people just use clojure jdbc?

17:26 noprompt: gfredericks: but shouldn't it still use postwalk?

17:27 (strs super duper (println true)) => "super duper (println true)"

17:27 SegFaultAX: i've been using korma for a small application, and i've been really happy with it.

17:28 SegFaultAX: i've enjoyed it far more than the active record stuff i'm used to dealing with in the rails world.

17:29 bbloom: noprompt: active record, the best worst idea ever

17:29 noprompt: but i've been going through this "i want to build it myself" phase because i'm tired of being sheltered by frameworks.

17:30 Raynes: SegFaultAX: Most projects using it are likely going to be closed source company projects.

17:31 SegFaultAX: Raynes: That's a good point.

17:31 Not to mention a lot of the open source projects don't even use relational databases. Most of them are mongodb + monger.

17:31 noprompt: are relational db's that bad?

17:32 SegFaultAX: noprompt: They aren't bad at all.

17:32 noprompt: Well, they all have their warts (mysql in particular), but there is nothing wrong with relational databases. And there are a /lot/ of benefits.

17:33 noprompt: SegFaultAX: i've been using mysql mostly since that's what i "grew" up with, but i keep hearing about postgres.

17:34 SegFaultAX: in your opinion what's the best rdb?

17:35 SegFaultAX: or rather, which would you choose?

17:35 SegFaultAX: noprompt: Postgresql is my go to database and has been for many years.

17:36 noprompt: But it really depends. There are lots of factors to consider for those kinds of decisions.

17:37 pbostrom: Raynes: does refheap support jsonp requests?

17:38 Raynes: pbostrom: Probably not.

17:39 pbostrom: What are you doing that would require that?

17:40 It probably wouldn't be that hard to add. You can open an issue and I'll get to it when I'm finished moving the views to laser.

17:40 pbostrom: I was playing around with loading pastes client-side

17:41 i.e. my app makes an ajax call to refheap.com. in my limited web knowledge, I think the only way to do that is using jsonp or CORS

17:42 Raynes: I can try to fix it myself and send a pull request or whatever the kids are doing these days

17:42 dnolen: cemerick:

17:42 cemerick: ping

17:42 gfredericks: noprompt: yeah if you want it nested it would have to be something like that

17:42 cemerick: dnolen: hi

17:42 gfredericks: noprompt: I just wrote that macro because I thought it was fun and you gave me the idea.

17:42 Raynes: pbostrom: Yup, that's about the only way to do it.

17:42 dnolen: cemerick: I found the CLJS bug, fixing and releasing

17:44 pbostrom: Raynes: I think it just requires setting the content-type header of the response to application/javascript instead of application/json

17:45 Raynes: Not exactly.

17:45 You have to wrap the results of the API call in a js function call.

17:46 pbostrom: gotcha

17:47 Raynes: Instead of the API returning JSON like "{'foo':'bar'}", you'd pass something like ?jsonp=myfnname and it'd return "myfnname(\"{'foo':'bar'}\")"

17:47 At least, that's how I remember it.

17:47 pbostrom: yeah, you're right

17:47 Raynes: I think lib-noir has a noir.response/jsonp thing that makes this easier.

17:48 Sgeo_: jsonp sketches me out

17:48 Raynes: Does it do a good job?

17:48 Sgeo_: DO NOT CONSUME JSONP FROM UNTRSUTED SERVICES

17:49 Raynes: I'd like to see the resultant drawing.

17:49 Surely pbostrom trusts me.

17:49 pbostrom: yeah, I haven't worked out how jsonp is supposed to be more secure

17:49 Raynes: I've only stole from him twice.

17:49 pbostrom: Raynes: I'm on the fence at this point

17:49 Sgeo_: pbostrom, it's not more secure, it works around a security feature

17:49 Raynes: The problem is that you can't just trust me.

17:50 You have to trust that my website is secure enough to not get corrupted data in the db.

17:50 Sgeo_: It tells the service a function name, and expects the service to reply something like the_func(blah blah);

17:50 Raynes: If someone managed to get some js code in my database, for example, I imagine that'd be bad.

17:50 Sgeo_: But you effectively run foreign Javascript code right on your page

17:50 Raynes: *shrug*

17:50 Sgeo_: It's like reading from a JSON service with eval

17:50 You're trusting the input to not be malicious

17:51 Raynes: I trust people to not stab or shoot me on the bus every morning.

17:51 It has so far worked out in my favor.

17:52 cemerick: dnolen: That's great; so it's a cljs bug and not a match bug?

17:53 pbostrom: hmm, maybe I should put some more thought into this, or just pull it down on the server side and escape anything funky

17:53 noprompt: Raynes: haha that's awesome

17:53 Raynes: i trust people not to spit in my food

17:54 Raynes: Me too! We're wild creatures.

17:54 amalloy: pbostrom: jsonp isn't supposed to be more secure at all

17:54 dnolen: cemerick: yeah, core.match CLJS support is old, looks like I didn't account for try/catch syntax change that aligned CLJS w/ Clojure

17:54 pbostrom: amalloy: yeah, Sgeo_ set me straight

17:55 cemerick: dnolen: Thanks :-) Sorry I couldn't offer up a patch.

17:56 Sgeo_: pbostrom, well, the point of JSONP is to work around a security restriction that browsers have, which, admittedly, I don't fully understand the point of the restriction.

17:57 I think there's some sort of secure alternative for cross-domain stuff in the works, but don't know details

17:58 bbloom: Sgeo_: cross-domain is a cluster fuck all around

17:59 i've found server side proxying to be by far the simplest solution

17:59 Sgeo_: I have considered using JSONP out of laziness, but I would have fully controlled both ends of it

17:59 Ended up not using it though

18:12 dnolen: cemerick: ok, so one unavoidable ugliness because of the try/catch change and the horrible fact that natives in JS don't return true for instanceof

18:12 cemerick: :require [clojure.core.match] also needs to be added to your CLJS ns

18:14 TimMc: Sgeo_: If you use JSONP, remember that JSON is *not* a subset of JS.

18:15 Sgeo_: You have to remember to encode U+2028 and U+2029 in string literals.

18:15 (this is if you want eval to work)

18:15 * Sgeo_ would not use eval with JSON

18:16 * arrdem cannot fathom why read and eval are mashed into the eval function

18:16 technomancy: http://www.netmeister.org/blog/images/dijkstra-quick-n-dirty.jpg

18:16 bbloom: TimMc: googled that & saw http://timelessrepo.com/json-isnt-a-javascript-subset -- holy crud. javascript, i hate you

18:17 technomancy: he looks so serious!

18:17 arrdem: technomancy: we've had those around the department for a few months now...

18:17 * Sgeo_ is guilty of quick and dirty

18:17 Sgeo_: Have some VERY repetitive Tcl code lying around

18:18 TimMc: bbloom: In this case, direct your hate towards Crockford.

18:18 technomancy: TimMc: the best part is that since JSON is fixed in stone, it'll never get fixed.

18:18 go go gadget hubris

18:18 Sgeo_: Why is it so important that eval work on JSON, exactly?

18:19 TimMc: It's not, it's just an attractive nuisance.

18:19 ppppaul: what's the simplest way to write pretty printed clojure to a file?

18:19 hiredman: also doubles

18:19 (binding [*out* ...] (clojure.pprint/pprint ...))

18:20 Sgeo_: "However, when you’re dealing with JSONP there’s no way around: You’re forced to use the JavaScript parser in the browser. "

18:20 ouch

18:20 technomancy: hiredman: "Do the simplest thing that could possibly work. Except that, don't do that. No, that's stupid. Stop."

18:20 ppppaul: ^_^

18:20 hiredman: I must admit I often just do (spit "/tmp/foo" (with-out-str (pprint ...)))

18:20 technomancy: hiredman: re: JS doubles, not binding fwiw

18:21 TimMc: Sgeo_: The workaround is to have the JSON gerenator emit a subset of JSON that is also a subset of JS.

18:21 Sgeo_: Then again, JSONP is an cute hack/horrible abomination that must die

18:21 TimMc: \u2028 and \u2029 are allowed escape sequences in both, after all

18:21 hiredman: I forget if using spit like that is actually bad

18:21 TimMc: Crockford despises JSONP, yes.

18:21 Sgeo_: Crockford?

18:21 hiredman: I think it may end up with more quotes or something

18:22 TimMc: Douglas Crockford created the JSON spec.

18:22 Sgeo_: Ah

18:22 TimMc: ALso JSLint, I think?

18:22 And wrote Javascript: THe Good Parts

18:23 dnolen: cemerick: alpha12 going out

18:23 arrdem: you forgot Javascript: The Working parts and Javascript: The Bits We Don't Talk About

18:27 ppppaul: hiredman, with-out-str works

18:28 however, i'm outputting datomic schema, and it is evaluating the reader macros which i wish it would not evaluate.

18:28 when i do pr-str i get correct output

18:28 but reader macros get evaluates with pprint

18:29 is there a way around this? to get pprinted output that looks the similar as pr-str output?

18:31 bbloom: ppppaul: you can use https://github.com/brandonbloom/fipp which doesn't do anything (yet) for reader macros, et al. and when it does do something for reader macros, i intend to have it be configurable via a stylesheet-type functionality

18:34 noprompt: i need to finish my compsci education

18:35 whenever i try to read some of these papers i just get lost

18:40 bbloom: noprompt: you just need an education education

18:40 noprompt: here's a good trick: print the paper out & get a red pen

18:40 everytime you don't understand something, underline it

18:40 when you DO understand it, write a note or two in the margin

18:40 noprompt: and then go look it up?

18:40 bbloom: then, print it out again and start over

18:40 repeat that process until you don't mark up the paper at all

18:40 it takes a long time, but it works!

18:41 noprompt: that's an interesting approach

18:41 it's like debugging for the brain

18:41 bbloom: oh, and you need to perform this process recursively against the citations, but utilize a huristic search

18:42 you don't need to read every citation, and especially not the transitive closure of citations, but error on reading greater rather than fewer

18:43 also, Google Scholar is your friend.

18:43 noprompt: wow i didn't even know about that

18:43 bbloom: the [PDF] link often circumvents paywalls, which is nice

18:44 noprompt: oh man

18:44 bbloom: noprompt: this completes your education education

18:44 warz: hm, im trying to get ring-json's wrap-json-response middleware to convert my response map into json

18:44 noprompt: this would have been so helpful so many times

18:44 bbloom: (for today)

18:44 warz: but its just returning text/plain string version of the map

18:45 noprompt: warz: you can always hand roll it :)

18:46 {:status 200 :headers {…} :response json-stuff}

18:46 err :body

18:46 not :response

18:46 warz: i started out with my method but i saw ring-json and thought id move to that, but i cant get it to work. guess ill go back to my own function, heh

18:46 im prob doing something wrong. im sure it works.

18:47 noprompt: bbloom: wow, this is awesome

18:47 weavejester: warz: You need to set the content-type

18:47 bbloom: noprompt: do try the red pen technique & report how that goes as well :-)

18:47 warz: oh i thought it did that. i see reference to it in the code, i think.

18:48 weavejester: warz: Oh wait, this is on the response

18:48 warz: yea, response

18:48 weavejester: warz: So… what do you mean by "text/plain string version of the map"?

18:49 warz: well like, the compojure route handler returns a map, and the http response is text/plain instead of application/json

18:49 but i thought it would be application/json, based on looking at the code for ring-json

18:49 weavejester: warz: You need to wrap the map inside a response map

18:50 warz: e.g. (response {:foo "bar"})

18:50 warz: Or {:body {:foo "bar"}}

18:50 warz: Otherwise Compojure assume you're returning a request map.

18:50 Er

18:50 A response map

18:52 warz: im doing that, but it must be something else. my single handler is here: https://github.com/ryancole/localshop/blob/master/src/localshop/routes/api/items.clj

18:52 github shows different spacing that mine, maybe that has something to do with it

18:53 not missing a paren or anything, heh

18:54 might have to do with my map call

18:54 ah yup thats it. hrm ok. something to go on.

19:02 i see. ring-json is not converting to json because map returns a lazy seq, which probably does not meet the map? vector? checks in ring-json.

19:03 weavejester: warz: Yes, that would be why. I'm strongly considering changing that.

19:03 warz: Lazy seqs are valid Ring bodies, and initially I didn't want to override any base behavior of Ring

19:04 warz: ah ok. i did see a pull request that i think offers some code for that change

19:06 weavejester: Huh, there are a few pull requests on ring-json that I don't believe ever arrived in my inbox

19:07 warz: :)

19:36 weavejester: Does anyone know of a library for serializing Clojure datastructures in a way that always winds up with the same bytes for the same data structures?

19:36 I was thinking of making one so that I can effectively hash a data structure

19:37 amalloy: weavejester: a gloss codec to do that would be interesting

19:38 weavejester: amalloy: Oh, that's an idea. I'd forgotten about gloss.

19:39 amalloy: header frames let you implement tagged unions pretty simply, which i think is all you really need to encode clojure data structures

19:40 you could ask zack, too; he might already know of a codec someone's written

19:42 bbloom: weavejester: have you looked at https://github.com/Datomic/fressian ? i dunno it it meets your requiresments or not

19:43 hiredman: fressian's caching stuff might interfere with repeatability there

19:44 weavejester: bbloom: I don't think Fressian makes any guarantees about order

19:44 hiredman: weavejester: doesn't pr-str do that?

19:44 ivan: consistent indentation in fressian? I am disappointed

19:44 weavejester: hiredman: I don't think it does. For instance, compare an array map to a hash map

19:44 amalloy: hiredman: {:a 1 :b 2} vs {:b 2 :a 1}?

19:44 hiredman: ah

19:44 right

19:45 weavejester: ,(pr-str {:b 1 :a 2} (hash-map :a 2 :b 1))

19:45 clojurebot: "{:a 2, :b 1} {:a 2, :b 1}"

19:45 weavejester: That did get the order right, but I don't think it guarantees it...

19:45 hiredman: you could, of course, patch the print-methods to order the keys always

19:45 bbloom: weavejester: do you need to support non-clojure types or records?

19:45 weavejester: bbloom: Nope

19:46 bbloom: weavejester: then it should be pretty easy to implement yourself... after all, clojure.walk has to handle all the types

19:46 weavejester: bbloom: Yep, it shouldn't be too hard

19:48 hiredman: Patching the print methods is an option, but the pr function might change subtly in future versions of Clojure, and if I'm going to be generating a hash, I need to guarantee that the same bytes will always be produced.

19:53 bbloom: weavejester: passing through string form just seems like a completely unecessary intermediate step

19:54 weavejester: bbloom: String form?

19:54 bbloom: weavejester: i mean printing before serializing

19:54 hiredman: bbloom: sure, and very ineffecient on the jvm if what you want is bytes

19:54 weavejester: Ah, yep

19:57 bbloom: on a totally unrelated note, i find myself wishing for an intrinsic notation & abstraction for propertied trees

19:57 a la html or xml or any other tree of maps with a :children key

21:26 ayia: Hi guys, I read a russian version of the "lisp casting" tutorial adapted for clojure (http://lisperati.planvita.com/actions.html). There is a place there with a definition of macros with nested quotes (game-action macro), original article is http://lisperati.com/actions.html. Can anybody explain me how it works? Or at least help somehow... Maybe there are some good articles about nested quotes... I did seek them, but did not find anything that can

21:26 help me...

21:27 (defspel game-action [command subj obj place & args]

21:27 `(defspel ~command [subject# object#]

21:27 `(spel-print (cond (and (= location '~'~place)

21:27 (= '~subject# '~'~subj)

21:27 (= '~object# '~'~obj)

21:27 (have? '~'~subj))

21:27 ~@'~args

21:27 :else '(i cannot ~'~command like that -)))))

21:27 that was the macro... (defspel is an alias for defmacro)

21:28 akhudek: ayia: please use https://www.refheap.com/ for code

21:28 the best way to understand what a macro is doing is to look at it's output with macroexpand

21:28 ayia: oh... big sorry for that... next time i will use...

21:30 akhudek: I see... seems like there is no easy way)

21:34 akhudek: I wish I could offer more, but know enough of the macro nuances to know why you'd nest backticks

21:35 but you can see the output by using macroexpand-1

21:35 and compare the versions with and without the second set of backticks

21:39 ayia: akhudek: thanks... will try)

21:45 alex_baranosky: how do I sign my jar so Clojars is happy?

22:03 ayia: akhudek: by the way... the output of macroexpand-1 is terrible... )

22:05 technomancy: alexbaranosky: usually if you're generating signatures at deploy the missing piece is not putting your public key in your clojars profile

22:05 ayia: akhudek: that is it after deleting all namespaces... https://www.refheap.com/paste/11337

22:06 dnolen: ayia: it's useless unless you use pprint w/ code dispatch on the output

22:06 ayia: some editor tools support incremental macro expansion like swank-clojure / nrepl.el

22:42 gfredericks: does cljs have proper keywords now?

22:42 * gfredericks has been staring at some advanced-compiled code

22:54 dnolen: gfredericks: no

23:06 gfredericks: man. coulda sworn that keyword-string was going into a constructor.

23:08 dnolen: gfredericks: oh sorry yes, under advanced optimization if (:foo bar), we wrap :foo in a Keyword type

23:09 gfredericks: this is because keyword invocation is very slow otherwise

23:09 gfredericks: but it's not a proper keyword type, it's just faster to construct an instance and invoke than it is to go through String prototype.

23:09 bbloom: dnolen: maybe we should try to tackle keywords and symbols on sunday?

23:10 dnolen: bbloom: I was actually thinking the same thing.

23:10 bbloom: dnolen: would be nice to finally cross that one off the list :-)

23:11 dnolen: bbloom: don't know if we'll finish but we can at least make a dent :)

23:12 bbloom: dnolen: i see no reason why we can't get it working, considering i did that in only a day or two myself before... the real question is whether or not we can get it performing :-)

23:13 dnolen: bbloom: well that's what I mean, a dent towards something fast :)

23:16 bbloom: dnolen: and doesn't leak memory! *grumble*grumble* no WeakReferences

23:21 dnolen: bbloom: yeah, I really think we should probably focus on getting the static keyword case fast - that's an immmediate improvement for a lot of code

23:23 bbloom: dnolen: agreed, but it's tricky to do so without also breaking dynamically instantiated keywords because of = vs identical? -- let's go over the details in person

23:42 dnolen: bbloom: right, sounds good

Logging service provided by n01se.net