#clojure logs

2013-02-15

01:38Frozenlockfrom wikipedia: "Clojure (pronounced like "closure")"
01:38FrozenlockThat's a joke, right?
01:38RaynesFrozenlock: No?
01:39RaynesI mean, the pronunciation should be IPA probably.
01:39RaynesBut that is accurate.
01:39FrozenlockIPA?
01:40Rayneshttp://en.wikipedia.org/wiki/International_Phonetic_Alphabet
01:41Frozenlocko_O
01:41FrozenlockYet I'm sure I've always heard cloJure. My brain is failing me.
01:44spjtIt's a pun.
01:45spjtmy cousin saw a book and called it clo-JOOR like it was French
01:45amalloyFrozenlock: nobody really bothers to put in enough emphasis to make the j sound distinct from the...zh sound in closure or measure
01:51arrdem_I say cloJer too...
01:55arrdem_anyone tried using congomongo's gridfs stuff?
01:57spjtit's pronounced "latek"
01:58spjtthe X is chi, not "x"
01:58FrozenlockI know.
01:58FrozenlockI'm a rebel.
02:00spjthipster language....
02:00spjtI'm still in school, the hipsters like Java.
02:00Raynesgf3: You still working on refheap colors and stuff?
02:00arrdem_spjt: I see what you did there
02:02hyPiRionoh man. I knew that it was possible to embed videos into pdfs, so I wondered how you'd do that in LaTeX.
02:03hyPiRionApparently "LaTeX video" on Google didn't give me what I expected
02:03FrozenlockRaynes: 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?
02:03spjtThere's one guy who likes Haskell, he is a hipster, with all the tattoos and hipster glasses and skinny jeans
02:03RaynesFrozenlock: *shrug*
02:04spjtdid you try "embed video into latex pdf"
02:04hyPiRionspjt: yeah
02:05hyPiRionI found what I wanted by attaching "embed pdf"
02:05spjthyPiRion: sorry, I'm dense.
02:06hyPiRionIt's like the time I found this neat tool named Rubber for LaTeX. That's even worse
02:07spjtThe 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.
02:07arrdemlol
02:07arrdemI tried that but the CS machines don't have clj or lein
02:07arrdemand the rule is that you have to be able to build from source on DPT machines
02:07arrdemso... common lisp it is
02:08spjtthis 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
02:08hyPiRionspjt: I just point them in the direction of Leiningen and tell them "lein uberjar" + java -jar uberjar
03:13JanxSpirit_how can I make this work? (str "sale" "20%")
03:15magopianJanxSpirit_: what's your question?
03:15magopian,(str "sale" "20%")
03:15clojurebot"sale20%"
03:16magopianwhat does "work" mean to you? What are you trying to achieve?
03:16JanxSpirit_hmm.it's not working in a repl for me when a % is in one of the strings
03:18JanxSpirit_hmm...only in emacs using C-M-X
03:18JanxSpirit_it works at a normal shell repl in lein
03:24thorwil,(str "sale" "20" \%)
03:24clojurebot"sale20%"
03:25thorwilJanxSpirit_: ^ how does emacs think about that?
03:45JanxSpirit_thorwil: still doesn't like it that way
03:47RaynesDear persons and personettes.
03:47RaynesI just moved www.refheap.com back to my an amalloy_'s linode. Through blood sweat and tears, I believe I have persevered.
03:48RaynesHowever, 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.
04:01tomojso a loop with 5 bindings can't have primitive support, right?
04:25broquaintNice one, Raynes.
04:26ifesdjeenw000t Raynes great! teh best pastebin service ;)
04:53opahi. 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
05:04thorwilopa: seen "Install" on http://leiningen.org/ ?
05:06thorwilopa: since lein is a bash script, java version doesn't matter there
05:06opai forgot to mention, i have the leiningen installed but it uses java 1.7. i have to get it to use 1.6
05:06opaso its configurable in the batch?
05:11maiolein contains: export JAVA_CMD="${JAVA_CMD:-"java"}"
05:11maioexport LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-$JAVA_CMD}"
05:11maioso I guess you just set LEIN_JAVA_CMD to desired java binary
05:12thorwilseems there is a :java-cmd key
05:13babilenopa: Just make sure "java" is "java 1.6" and not "java 1.7" -- Which platform/os is this on?
05:14opai 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
07:09t-goossenswhy would emacs be more suitable than vim for clojure programming? It's just, in all the talks i watch, they are always using emacs
07:09t-goossens(almost)
07:09t-goossensis there any (non religious) reason?
07:10borkdudet-goossens apart from religion, no
07:10borkdudet-goossens emacs works well with parens (paredit), I have no idea how that is in vim
07:10t-goossensvim has paredit if you want
07:11t-goossenssublime also (although still in development i think)
07:11borkdudet-goossens and emacs is driven by elisp, which is also a lisp, so this draws a lot of lispy people there maybe
07:12borkdudet-goossens and because of that growing amount, clojure supports gets better and better?
07:12t-goossensits just
07:13hyPiRionI would suppose, since elisp and lisp has usually been developed on emacs, that emacs has simply better support for clojure to begin with
07:13t-goossensif i'm about to learn to work with a fancy editor
07:13t-goossensfor other languages than clojure
07:13t-goossensis there any more suitable editor?
07:13borkdudet-goossens for Java I still would choose Eclipse/IntelliJ etc
07:13hyPiRiont-goossens: define "other languages"
07:13t-goossenswell
07:13t-goossensthe languages that i have in mind
07:14borkdudet-goossens but for other "languages" that involve text, like latex, html, etc, I like emacs best until no
07:14hyPiRion(I still program in Eclipse for java too, borkdude. Though I'm working on setting up CEDET, so maybe that would change things)
07:14borkdudew
07:14t-goossenspython, ruby, scala
07:14borkdudehyPiRion I tried setting up some java stuff in emacs, but it wasn't giving me any benefit
07:14t-goossensjavascript
07:14borkdudet-goossens I also use it for javascript
07:15hyPiRionborkdude: 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.
07:15hyPiRiont-goossens: Well, you could either pick Vim or Emacs
07:16hyPiRionI don't think there's any major difference really, as long as you pick one of them
07:17borkdudehyPiRion I don't want to spend a day configuring stuff
07:17borkdudet-goossens one thing that also makes emacs worthy is org-mode
07:17hyPiRionborkdude: Ah, I usually tend to procrastinate by tweaking my setup
07:17ChongLianyone here looked at LLJS?
07:17ChongLihttp://mbebenita.github.com/LLJS/
07:17borkdudehyPiRion I recognize that, but I've been doing it too much
07:17hyPiRionhehe
07:18ljosborkdude: if you want to do Java in emacs you should look at emacs-eclim.
07:18ChongLithis seems really interesting
07:18ChongLias a faster compile target
07:19hyPiRion(inc ljos)
07:19lazybot⇒ 1
07:19hyPiRionthanks
07:19borkdudeljos tnx
07:21borkdudet-goossens maybe Raynes has writting something about emacs/vi, he tried vi for a while
07:21borkdudewritten
07:22hyPiRionI've heard people have used evil for emacs for some time now
07:22borkdudet-goossens for my students I just recommend Eclipse - I don't want to make clojure more difficult for them than necessary
07:22hyPiRionI think one of the Stuarts use it.
07:23borkdudet-goossens I could try recommending LightTable this year, but it's still a bit unstable
07:23ljoshyPiRion: I use
07:23ljosevil mode some times.
07:23ljosit works good.
07:23borkdudet-goossens one step that helped me most in learning emacs why disable the menu by default
07:23borkdudewhy=was
07:24borkdudet-goossens and just type M-x commands when you don't remember the key combinatino for some command
07:27t-goossensborkdude: a few months ago i played with lighttable for a while (it was one of the first experiences I had with clojure actually)
07:35borkdudegtg
08:19dog_cat11has anyone noticed instability in lein 2?
08:19dog_cat11I 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
08:20dog_cat11I reinstalled, it fixed the problem, then happened again
08:47hyPiRiondog_cat11: uh, lein repl only?
08:47hyPiRionwhat are you running on?
08:48vijaykirandog_cat11: did you check if something else wasn't blocking the port ? or perhaps the prev. lein process is still lying around ?
08:49hyPiRionvijaykiran: that shouldn't be an issue, it just picks a random port every time
08:49hyPiRionthe last one, that is
08:50Anderkent|awayhyPiRion: it's possible some plugin is making it run with a constant jvm debug port for example
08:51hyPiRionAnderkent: yeah, what I was saying is that it shouldn't be an issue with the repl
08:55dog_cat11mac os x 10.7 w/o root privilage
08:55dog_cat11its a work computer
08:57dog_cat11i'll check, there could be another lein process in the bkgrnd
09:08morrifeldmanI'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?
09:09vijaykiranmorrifeldman: C-q ?
09:09hetanoC-c C-b I think
09:10morrifeldmanI'm started the nrepl using lein repl from the command line, not in emacs
09:11vijaykiranmorrifeldman: not sure what you mean - but you can try Ctrl-D or Ctrl-C and return ?
09:12morrifeldmanI can do ^D to kill the repl completely, but I'd prefer to figure out how to just cancel out of the command
09:12morrifeldmanCtrl-C is not doing anything for me. I'm on OSX if that is relevant.
09:14vijaykirando you mean you are at "#_=> " ?
09:14morrifeldmanvijaykiran: Yes!
09:14vijaykiranmorrifeldman: just try ))))) and enter :)
09:15vijaykiranmorrifeldman: it should fail with "RuntimeException Unmatched delimiter: ) "
09:18morrifeldmanThanks! Sometimes )))))) doesn't work for me, but I'm not sure why
09:19vijaykiranmorrifeldman: may be you are too deep in the parens and need to type more :)
09:19AnderkentHow 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)
09:19morrifeldmancool. Thanks!
09:28TimMcAnderkent: Make it public and note that it isn't part of the API? :-/
09:29AnderkentTimMc: went with (deref (var fn-name)) instead... Rather unhappy with that though ;P
09:29morrifeldmanIs 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.
09:30Chousukemorrifeldman: putting stuff in front of a vector involves a full copy.
09:30Chousukeunless you're okay with making it a lazy seq instead and losing indexed access.
09:32morrifeldmanAny kind of sequence is OK and I don't have any performance worries.
09:33Chousukemorrifeldman: then you can use concat and wrap the head and tail in something seqable.
09:37noncomIn 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?
09:40Anderkentnoncom: not usually - docs are your go-to. You can get them in a repl using (clojure.repl/doc <fn-symbol>)
09:40TimMcJust (doc foo).
09:40Anderkentassuming you have clojure.repl refered, sure
09:41TimMcIf that doesn't work, (use 'clojure.repl) at the beginning of the session.
09:41Anderkentdoesn't help if you switch namespaces often
09:51jcidahoHi - nrepl.el has some hotkeys that clash with paredit - for example M-r...?
09:57noncomi see!
09:57noncomand the docs usually describe that just textually, right?
09:58noncomlike "... expects an integer and a vector..."
10:03reiddraperTimMc: yeah, was scheduled for valentine's day, and we had no speaker, so figured it was best to just wait till march
10:05noncomppl, please see my question above! thanx))
10:06Anderkentnoncom: you're mostly correct - though docstrings can be anything really, so it depends on what code you're workign with
10:09TimMcreiddraper: Ah yeah, would have conflicted with a lot of dinner plans.
10:09TimMcThere didn't seem to be a cancellation announcement, though.
10:13rplacaAnderkent: your private function thing is kind of an idiom, though folks usually use the reader macros: (@#'myns/foo ...)
10:14canweriotnowSo… macro question...
10:14canweriotnowI'm using a lib with a macro that expects a vector literal of symbols.
10:16canweriotnowI'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:16ChongLicanweriotnow: yes
10:16canweriotnowIs there any way to force evaluation before the macro sees it?
10:16ChongLicanweriotnow: no
10:16ChongLimacros do not exist at run time
10:17ChongLithey can only work on literal forms
10:17canweriotnowthat's… annoying. but thanks for the info. I was tearing my hair out :)
10:17ChongLiwhy is it annoying?
10:18ChongLiif you need evaluation at run-time use a function :)
10:18canweriotnowThe macro in question is for templating PDF generation.
10:18noncomthanx!!!
10:18canweriotnowYeah, I'm going to replace that functionality with an fn
10:19canweriotnowI think it's a 'convenience macro' in that lib, just happens to be inconvenient for me :)
10:19canweriotnowthanks
10:19ChongLibasically all macros are 'convenience macros'
10:19ChongLithey exist only to clean up the structure of your code
10:19canweriotnowgotcha.
10:28canweriotnowHah. I gave up on the damn macro, used a nested data structure, first and rest.
10:28canweriotnowdata structures > fns > macros
10:30cheekee(clojure.set/difference #{1 2 3} #{2})
10:31cheekeewhen I type (clojure.set/difference #{1 2 3} #{2}) I get a ClassNotFoundException clojure.set error
10:32cheekeedoes anyone know why?
10:33ChongLiworks fine for me
10:33ChongLidid you (require 'clojure.set) ?
10:33abp^ cause require is load
10:35cheekeeI tried (:require clojure.set) and got CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:41)
10:35ChongLiinside the (ns ...) form?
10:35abpcheeke that's only for use in ns
10:36cheekeeI am a noob to clojure...I don't know what ns is
10:37ChongLins is the namespace form
10:38ChongLiare you working in the repl or in a source code file?
10:40clgvcheekee: 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:43cheekeeI am using repl and I am reading a clojure chapter in a book now
10:44cheekeedifference is the author had leiningen and I just used Ubuntu's version
10:44cheekee(require 'clojure.set)
10:45headshoti'd start by hitting the leiningen site, and going down that path
10:45cheekeesorry mistype
10:45TimMccheekee: Don't use what Ubuntu packages for you, it's super out of date. :-/
10:46headshotsave you a lot of headaches with regards to dependencies, etc
10:48cheekeeok! anyway I got clojure.set working with what I just mistyped
10:49TimMccheekee: 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:51ChongLipimeys: you use Xmonad right?
10:53pimeysChongLi: yup
10:53pimeysawesome, xmonad, i3 are all good
10:53ChongLipimeys: yeah I use xmonad too
10:53pimeysI just somehow choose xmonad, and I cannot change anymore :D
10:53ChongLihopefully people in that thread will check it out
10:54ChongLitoo many people equate linux with whatever comes with ubuntu
10:54pimeysI mean, every time I hear somebody saying linux is slow for work, I want to hit him in the face :D
10:54pimeysnothing is faster than a good tiling wm + a good editor
10:55ChongLiand good hotkeys for everything
10:55pimeysyes.
10:55hashbang1pimeys: i loved awesome, i need to go back and give it another try. it has been a while
10:55ChongLiI'm still messing around with my setup
10:55pimeysand I really love xmonad's way of handling the desktops
10:55pimeysyou can select your desktop for every monitor
10:55ChongLixmonad gets confused when you do a lot of nesting of layouts
10:56pimeysand select a different way of handling the windows for every desktop
10:56ChongLiperhaps I should just write a layout straight-up
10:56pimeysI'm using tabbed, tall, mirrored tall, grid and a special gimp layout
10:57ChongLican you assign hotkeys for tabbed?
10:57pimeysChongLi: what kind of?
10:57pimeysjust using the same hotkeys as with every layout
10:57clojurebotexcusez-moi
10:57ChongLifor switching tabs
10:57pimeyscmd + j and k
10:58ChongLiI have meta + h j k l for navigation
10:58ChongLiusing XMonad.Actions.WindowNavigation
10:58pimeyshmm, cmd + h and l changes the horizontal size of a split
10:59pimeysj and k browses through windows
10:59kryftpimeys: Is 'tabbed' the one where each window is full-screen and you switch between them using cmd + j/k?
10:59pimeysyep
10:59ChongLiWindowNavigation does 2D browsing
10:59ChongLiin screen-space
10:59pimeysand you have a slim tab on top of the window
10:59pimeyswhere you can see all open windows
10:59pimeysand even *gasp* click them
10:59ChongLiif you have nested layouts then the 1D ordering of windows is non-obvious
11:00seangrov`Damnit, is there a way to unsubscribe from this goddamn "Why is this so hard" thread?
11:01ChongLiI use meta-shift-h & l for sizing windows
11:05AnderkentIn 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:07mpenetOddly enough I almost exclusively use full screen windows in xmonad, only 1 shortcut to learn: alt-tab. Yup that lazy
11:08pimeysI like tabbed better
11:08mpenetdefeats the purpose of the whole tiling thing but anyway
11:08pimeysalmost like full, but you have some indicator what's open
11:08pimeysespecially with my laptop
11:08pimeysat work I have enough screen space for grid layout
11:08ChongLiI have all these different workspaces setup with complicated layouts
11:08mpenetyeah, I forgot about that. spaces and the occasional 2 window view
11:09mpenetmy config is around 20 lines or so max
11:09ChongLimine's 398!
11:09mpenetI had a huge one at some point
11:09ChongLia lot of comments and blank lines though
11:09mpenetbut the defaults are just fine in most cases
11:09pimeysI would love if the xmonad config would be lisp instead of haskell :P
11:10ChongLiI don't mind the haskell
11:10pimeyswell, it's a nice language, but I don't want to write it so much
11:10pimeystoo strict for me ;)
11:10ChongLiI think the type safety is really nice for this
11:10pimeysit is
11:10pimeysand the type system altogether is very good
11:10ChongLiyou can just try stuff and then fix the type errors and it works
11:11mpeneta bit scary for newcomers
11:11pimeysI think I'll learn ML instead, when I want to jump on that train
11:11pimeysbut not now
11:11ChongLiruntime errors would be very annoying with such complicated configs like this
11:11ChongLiI don't know if you'll get as much of a benefit with ML
11:12ChongLiif you're already using clojure you're programming in a non-pure language
11:12pimeysI know, and not even a real functional language
11:12ChongLiML is basically the same thing without the lisp syntax
11:12pimeysI can do closures and give them names to get objects :D
11:13pimeysand I can do side effects
11:13pimeysML has a type system
11:13ChongLihaskell is a radical departure which is very nice
11:14ChongLilearning monads really expands your way of thinking
11:14ChongLiit's the one thing I really miss in clojure
11:15hyPiRionChongLi: Tried working with unbounded "variables" before?
11:15hyPiRionThat's also amazing
11:15ChongLiunbounded variables? you mean like logic variables?
11:16hyPiRionkind of, but not exactly
11:17hyPiRionSay you have two variables, X and Y. You then define X to be a set containing Y, then unify Y with X
11:17hyPiRionNow X contains itself
11:17ChongLididn't X start out containing everything?
11:18hyPiRionIn clojure terms: (unbound [x y] (unify x #{y}) (unify y x))
11:18hyPiRionnow (= x (get x x))
11:20ChongLihmmm
11:20hyPiRionCheck out Mozart/Oz, dnolen can vouch for that.
11:22ChongLichecking it out
11:24ChongLidataflow variables
11:25ChongLiweird how they use % for comments
11:25hyPiRionyeah, that's the name
11:27hyPiRionI thought ; was weird for comments, coming from Java and all.
11:27TimMcimma make a language where the comments are ( in parens )
11:28lucianTimMc: doesn't forth do that?
11:29TimMc,(let [a (object-array 32), v (vec a)] (aset a 0 v) (= v (v 0)))
11:29clojurebottrue
11:39gf3Raynes: Yeah, just been ultra busy with work :-(
11:55clojure-newbhey guys, how do I turn a LazySeq ({:k "val"}) into a collection like [{:k "val"}] ?
11:56ChongLiclojure-newb: into
11:56ChongLi,(into [] '({:k "val"}))
11:56clojurebot[{:k "val"}]
11:56clojure-newbChongLi: thanks
11:59ayiaHI 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:59TimMcThose are earmuffs, indicating a dynamic var. (Just a convention, but long-standing.)
12:00eggheadwhat in the, why does clj-http lower case all the header names
12:01dakroneegghead: because it reduces header collision and the RFC supports it
12:01eggheadah dakrone I didn't know it was valid by the rfc, think I'll start using lower case exclusively in that case
12:01eggheadcheers, thanks for clearing that up
12:02dakroneyea, RFC explicitly says headers should be treated as case-insensitive
12:02dakroneegghead: np, good luck!
12:05clgvTimMc: hey. does lein-otf allow to specify a function that is calle before the real main is loaded?
12:13aavwho knows where to find clojure.contrib.seq ?
12:14dnolenaav: clojure.contrib is deprecated and I don't think there's a replacement for that one.
12:15llasramMost of the useful stuff made it into clojure.core though, didn't it?
12:15aavi somehow cannot find where "indexed" is
12:15aavthere ws such function in contrib.seq
12:16aavfound map-indexed in clojure.core
12:16aavthanx
12:26TimMcclgv: Nope, why?
12:27clgvTimMc: 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:27clgvTimMc: tools.logging should include something to setup logging without a properties file^^
12:31TimMcYou can always emulate lein-otf's behavior yourself; it is extremely simple.
12:34TimMcclgv: (defn -main [& args] (require 'foo.bar) (apply (ns-resolve 'foo.bar '-main) args))
12:34TimMcSomething like that. Put the logging configuration before the require.
13:31Raynesgf3: Just curious. Obviously don't expect you to do anything. Thus is the nature of open sourc.
13:31Raynessource*
13:32callenbotRaynes: what needs changed with refheap colors?
13:32gf3Raynes: ❤
13:32callenbotseemed fine to me, although the typography is really weird.
13:32gf3Raynes: It's gonna happen
13:32Raynescallenbot: Nothing, really. gf3 just wanted to play around with stuff.
13:33Raynescallenbot: Got font suggestions?
13:33gf3As gf3 is want to do
13:33RaynesI hate choosing fonts.
13:33RaynesI didn't even choose the ones that are there. I always delegate to someone else.
13:36technomancygf3: 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:37gf3technomancy: Of course not, by all means
13:37gf3technomancy: I'll have some spare time in ~2 weeks
13:37cemerickgf3: got a link handy?
13:37gf3technomancy: If you need things like custom icons, logos, tweaks
13:37technomancygf3: well no pressure of course; just wanted to check.
13:38callenbotRaynes: A few. Typography is an interest of mine. I will experiment locally and get back to you.
13:38technomancyI 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:39callenbotgf3: are you a designer?
13:39gf3callenbot: Sometimes
13:39callenbotgf3: how came you to Clojure?
13:39SegFaultAXtechnomancy: Have you been following the recent HN drama re: Heroku? Do you have any thoughts on it?
13:39gf3callenbot: Through Scheme, Racket specifically
13:40gf3technomancy: If you don't find anyone in the next ~2 weeks I can cut it up
13:40callenbotgf3: how interested are you in collabs?
13:40callenbotgf3: I build a lot of side projects - web apps in Clojure.
13:40gf3callenbot: I love collaborating
13:41callenbotgf3: can I /query you to trade contact info?
13:41technomancySegFaultAX: I do, but I'm not supposed to talk about it. there's a technical response that should be posted soon.
13:41callenbotSegFaultAX: I can talk about it.
13:41callenbotSegFaultAX: I'm not a Heroku employee.
13:41SegFaultAXtechnomancy: Oh, sorry. :)
13:41ravsterhello all
13:41callenbotSegFaultAX: RG's complaints aren't very substantive.
13:41callenbotSegFaultAX: what do you want to know?
13:42callenbotravster: hi
13:42SegFaultAXtechnomancy: 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:42RaynesSegFaultAX: What drama?
13:42SegFaultAXRaynes: Sec, lemme get you a link.
13:42RaynesSegFaultAX: Found it.
13:42callenbotSegFaultAX: more or less. You're supposed to be on Cedar running concurrent workers.
13:42SegFaultAXcallenbot: Honestly, I thought Heroku was phasing out bamboo entirely.
13:43SegFaultAXIt's been second class for at least the last year or two.
13:43callenbotSegFaultAX: correct.
13:43Raynestechnomancy: 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:43SegFaultAXI started using Heroku right about when Cedar was made publicly available.
13:43callenbotSegFaultAX: the whole situation is silly. Yes random routing is sub-optimal, no it shouldn't matter.
13:44gf3cemerick: PM?
13:44cemerickgf3: sure
13:44Raynesgf3: My God, you said you were a designer and everybody is lining up to eat your soul.
13:44SegFaultAXRaynes: The other thing Heroku taught me when I moved back to Linode is how awesome LXC containers are!
13:45callenbotRaynes: shush you.
13:45callenbotSegFaultAX: that too.
13:45SegFaultAXcallenbot: Especially for a site the size of Rap Genius, why the hell would they still be using Bamboo?
13:45callenbotSegFaultAX: also LXC container is like ATM machine.
13:45callenbotSegFaultAX: I don't think RG is known for their technical competence or expertise.
13:45SegFaultAXcallenbot: I know, I realized that after I wrote it.
13:46SegFaultAXBut LX container sounds weird.
13:46callenbotSegFaultAX: they're hustlers selling eyeballs.
13:46callenbotand after seeing how they handled the Heroku situation, I know definitely not to work with them
13:46SegFaultAXcallenbot: I'd never heard of them until this drama came out.
13:46callenbotbecause they'll bitch loudly about things they don't really understand.
13:46callenbotSegFaultAX: I work at a YC company, I can't say which.
13:46callenbotSegFaultAX: so I know of them.
13:48SegFaultAXcallenbot: 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:48gf3Raynes: Joke's on them—I'm soulless
13:48technomancythe 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:49technomancyit's the programmer equivalent of "assume a frictionless vacuum"
13:49bbloomtechnomancy: heh, that's a great analogy
13:50bawrtechnomancy: I laughed hearily, kudos for that description/
13:50gfredericksso "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:50SegFaultAXtechnomancy: Did you see that xpost from elance on HN yesterday? It's particularly relevant to your analogy.
13:51bbloomit'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:51SegFaultAXhttps://www.elance.com/j/website-like-amazon/37294947/
13:53callenbotbbloom: that's been my experience as well, but I still use it for side projects.
13:57ppppaulhey guys. i'm having issues with this code: -> (io/copy (io/file source-path) (io/file dest-path))
13:57ppppaulsometimes it works, sometimes it hangs
13:57ppppaulthe output is created by the copy. io/ = clojure.java.io
13:58ppppauli'm reading from the file system and writing to the file system
14:00SegFaultAXppppaul: Are source-path and dest-path ever the same?
14:00ppppauli hope not
14:01ppppauli will wrap my code in a 'when
14:01ppppaulthe thing is, this code is running in a test
14:01ppppauland the test data is always the same
14:01ppppaulsometimes the code runs fine, sometimes it stalls and i have to do nrepl-interupt
14:04ppppaulin my tests i'm transferring 416 files
14:04ppppaulcould 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:06callenbotppppaul: stop opening the files without closing them
14:06callenbotppppaul: http://clojuredocs.org/clojure_core/clojure.java.io/copy
14:07mefestoio/copy will close streams that it opens itself which is what i think ppppaul was saying
14:08callenbotshould.
14:12ppppaulyeah... 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:31FrozenlockAnybody knows how to give socketpermissions in clojail? "java.security.AccessControlException: access denied ("java.net.SocketPermission" "<someIP>:47808" "connect,resolve")"
14:33RaynesYou cant to give socket permissions to the sandboxed code?
14:33RaynesEr, want*
14:34FrozenlockYes I want :)
14:35dnolenthis is pretty interesting http://asmjs.org/spec/latest/
14:35SegFaultAXdnolen: I was just reading that as well.
14:35RaynesFrozenlock: 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:35dnolenas is this https://bugzilla.mozilla.org/show_bug.cgi?id=840282
14:35dnolenw/in 2X of C one some benchmarks
14:35FrozenlockRaynes: Thanks!
14:35dnolen"on some"
14:38callenbotthe problem with making something faster than C is that C implementations get to cheat.
14:38callenbotFortran's main advantage was lost with -fno-alias
14:39callenbotwhen you get to change the semantics and expectations to suit the use-case, it's hard to compete.
14:43clojure-newbhi 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:44gfredericksclojure-newb: what do you want the result to be?
14:44callenbotclojure-newb: pretty ambiguous.
14:44clojure-newbgfredericks: [{:key1 "12345" :k2 "any val"}]
14:45clojure-newbgfredericks: no bothered about which one it removes at this point
14:45gfredericksclojure-newb: so always the first one?
14:45clojure-newbgfredericks: yes that will do
14:45TimMcSomething with annotation and merge-with, I'd say.
14:45gfredericks,(#(->> % (group-by :key1) vals (map first)) [{:key1 "12345" :k2 "any val"}{:k1 "12345" :k2 "other val"}])
14:45clojurebot({:key1 "12345", :k2 "any val"} {:k1 "12345", :k2 "other val"})
14:46gfredericks,(#(->> % (group-by :key1) vals (map first)) [{:key1 "12345" :k2 "any val"}{:key1 "12345" :k2 "other val"}])
14:46clojurebot({:key1 "12345", :k2 "any val"})
14:46gfredericksthere we go
14:46TimMcOh hell, group-by.
14:46clojure-newbgfredericks: thanks, I will give it a go
14:46clojure-newbjust processing that :-)
14:46gfredericksthat one is guaranteed to give you the first for each key
14:52SegFaultAXgfredericks: Why make it so complicated?
14:52SegFaultAX,(apply merge (reverse [{:key1 "12345" :k2 "any val"}{:key1 "12345" :k2 "other val"}]))
14:52clojurebot{:key1 "12345", :k2 "any val"}
14:52rplacaright, just use merge
14:53rplacaplus, clojure-newb said he didn't really care which one you picked
14:54clojure-newbthat is not returning a sequence of maps
14:54clojure-newbthe former solution was
14:54SegFaultAX,(list (apply merge (reverse [{:key1 "12345" :k2 "any val"}{:key1 "12345" :k2 "other val"}])))
14:54clojurebot({:key1 "12345", :k2 "any val"})
14:55rplacaclojure-newb: you want a list of maps or a vector with a single map?
14:56rplacaif you don't care which result is picked:
14:56rplaca,(vector (merge {:k1 "12345", :k2 "any val"} {:k1 "789", :k2 "other val"}))
14:56clojurebot[{:k1 "789", :k2 "other val"}]
14:56clojure-newbrplaca: sequence of maps where :k1 value is unique/distinct
14:58rplacaahh, so you're filtering an original list of maps with some k1s being duplicate into a list with only unique k1s
14:58clojure-newbrplaca: yes
14:58rplacawhere k1 is known ahead of time
14:58rplacaahh, I misunderstood
14:58clojure-newbrplaca: yes
14:58clojure-newbno worries
14:58clojure-newbsorry.. my original question was probably not well phrased
14:59rplacaand I'm doing three things at once! :)
14:59clojure-newbyeah, my brain is pretty much melting too
15:07mikerodCould 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:08mikerodanything 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:08mikerodclearly*
15:10bbloommikerod: if you re-def a type, you've created a new type with the same name, but different runtime values
15:10bbloommikerod: all of your previous instances and references aren't automatically updated
15:12mikerodbbloom: I'm not sure I follow you on this.
15:13mikerodI only defrecord once
15:13bbloommikerod: are you re-evaluating the file in which that defrecord occurs?
15:13mikerodthe auto-generated map-> factory function seems to not always evaluate as an instance of the type
15:14mikerodNo, I'm not reevaluating.
15:14bbloomcheck (= (class x) (class y))
15:14bbloomcompare to (= (str (class x)) (str (class y)))
15:19mikerodbbloom: both of those checks are true for me
15:20mikerodin the same context where (instance? user.MyRec (map->MyRec{:x "x"})) is false.
15:20tekkkwhy is this true? (associative? [:a :b]) .. what does associative mean?
15:20tekkkisn't that the key is associated with the value
15:21bbloommikerod: ok, then i guess i don't undertand. can you provide a minimal reproduction?
15:21bbloomtekkk: vectors are associative, like maps, with respect to integer indexes:
15:21bbloom,([:a :b :c] 1)
15:22clojurebot:b
15:22tekkkbbloom: i see
15:22bbloomtekkk: lists, however, are not, since they can't provide better than linear runtime for lookups by index
15:22bbloom,(associative? '(:a :b))
15:22clojurebotfalse
15:26TimMc~seqs and colls
15:26clojurebotseqs and colls is http://www.brainonfire.net/files/seqs-and-colls/main.html
15:26amalloybbloom: associative is for assoc, not get
15:26amalloyyou can be ILookup without being Associative
15:26bbloomamalloy: ah yes, as usual, you are correct.
15:27bbloomtekkk: what amalloy said
15:27mikerodbbloom: 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:28mikerodso this was in a different namespace i.e. my.test-ns that :use 'my.ns
15:29mikerodsorry :use my.ns (no quote)
15:29mikerodto get the test to pass
15:29mikerodI changed it to (is (instance? my.ns.MyRec (eval (map->MyRec{:x 'x}))))
15:30mikerodSo it seems that eval caused the type of the object to become realized for the instance? check...
15:30amalloystop adding evals. all they are doing is distracting you by hiding the problem; they are not doing anything meaningful
15:31amalloyeval 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:32hiredmanyou have stale classes
15:33mikerodI "sort of" understand this. I'm not sure what I do to make this happen though.
15:33hiredmane.g. generated via aot or something
15:33hiredmandelete them and restart your repl
15:33hiredmanthey will be in where ever your build tool puts them
15:33mikerodIt 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:35hiredmanmikerod: look, you know nothing about it, stop trying to guess, you will just confuse yourself and anyone else impressionable watching the chat
15:35tekkkwhat is the difference between clojure.lang.PersistentHashMap and clojure.lang.PersistentArrayMap
15:35tekkktry this: (def a-map {:a :b}) (type a-map) (type {:a :b})
15:35tekkkit gives two different types
15:35tekkk,(def a-map {:a :b}) (type a-map) (type {:a :b})
15:35clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
15:35hiredmanmikerod: just clear out your stale generated classes, and if possible stop aot compiling
15:36mikerodhiredman: 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:36mikerodhiredman: ok I'll look into that
15:37mikerodThanks for helping out too!
15:38borkdudeSomeone on Twitter asked where "fn* was defined" - is this baked into the compiler?
15:41hiredmanhttp://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:41hiredman.win 15
15:41technomancyborkdude: it is; it's in Java
15:42borkdudetechnomancy I saw something in Compiler.java, but couldn't exactly figure out how this worked
15:43callenbotborkdude: http://stackoverflow.com/questions/10767305/what-is-fn-and-how-does-clojure-bootstrap#10767535
15:44callenbotbtw, Duckduckgo got me that answer. I was having an impossible time finding that answer on Google.
15:44borkdudecallenbot tnx :-)
15:45Raynescallenbot: You listened to Cinderella Man by Eminem didn't you?
15:46mikerodhiredman: thanks for the jira links, that is certainly helpful
15:46callenbotRaynes: yes, you sent it to me.
15:46Raynescallenbot: Fantastic.
15:55jweissi'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:55jweissand is there another way to serialize to text more efficiently
15:56amalloypr shouldn't really use any ram; it writes directly to whatever Writer you give it
15:57amalloyso i'd say your object is bigger than you think (so large it takes up all RAM when you realize it?)
15:57SegFaultAXTime to profile!
15:58hiredmanamalloy: people tend to do things like call .getBytes on strings and such
15:58jweissyeah 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:58hiredmanwhich for some period of time doubles the ram required
15:59amalloyhiredman: who is "people" here? implementors of the pr multimethod? i don't quite see how your observation is related
15:59jweissamalloy: 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:00SegFaultAXjweiss: Is the object fully realized before you print it?
16:00amalloyjweiss: (let [obj (range)] (...lots of code, no OOM...) (pr-str obj)) ;; omg, OOM
16:00hiredmanamalloy: pr is extendable, if he is trying to print something with data structures that have naive print-methods defined it very easily oom
16:01jweissamalloy: 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:01amalloybarf. 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:02jweissamalloy: well, how else can you trace functions that return infinite seqs
16:03amalloyyou 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:05jweissamalloy: if you printed an infinite seq, i would expect you would have hit it :)
16:05amalloyindeed
16:06jweisshttps://github.com/weissjeffm/fn.trace/blob/master/src/fn/trace.clj#L24
16:06jweisssomehow i doubt that is what's responsible for OOM
16:06jweissunless there was a possibly-infinite data type i missed.
16:09amalloy*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:09SegFaultAXjweiss: 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:09amalloy(reify Object (toString [this] (pr-str (range))))
16:10augustlis test.generative similar to QuickCheck, ScalaCheck, etc?
16:10SegFaultAXjweiss: (Since you already know it's realized, that is)
16:10jweissSegFaultAX: i think i had an issue with ChunkedCons.
16:10jweissi can't remember exactly, it's been a few months since i worked on that.
16:11jweissSegFaultAX: oh i think i see what you are saying, why make the returned seq lazy at all
16:12SegFaultAXjweiss: Right.
16:13jweissSegFaultAX: i think that if i took out lazy-seq i'd get a stackoverflow, wouldn't i?
16:13jweissbecause that function calls itself
16:14SegFaultAXjweiss: 1) Only until it reaches the unrealized portion, 2) it could be re-written with a reduce.
16:15jweissyeah, seems that way looking at it now. i can't remember if there was any reason that wouldn't work
16:16amalloyit's better as a lazy seq anyway
16:17amalloyreduce 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:24enquorahas anyone worked with construction of PDFs using raw pdf primitives?
16:27nickmbaileyi can ask him
16:28pzuraqhi
16:28nickmbaileyerr wrong room
16:28nickmbaileyhaha
16:28pzuraqare datastructures in clojure similar to haskell? I'm trying to implement a graph but not sure where to start
16:28Iceland_jackpzuraq: How would you start in Haskell?
16:29pzuraqhmm, good question. I've done trees in haskell but not graphs...
16:29Iceland_jackRight, modelling graphs in Haskell is a major issue
16:29Iceland_jackat least using ADT's
16:30gfredericksI just interviewed a guy who remarked how difficult it is to do trees in J
16:31Iceland_jackpzuraq: Adjacency matrix, adjacency list, … I suggest you look up how graphs are normally implemented
16:31ChongLiI don't see why you couldn't use the same techniques as clojure in Haskell
16:31Iceland_jackImplementing them in Clojure and Haskell shouldn't be different
16:31ChongLijust use Maps
16:32pzuraqcool, so clojure is pretty similar to haskell. I'm just getting used to functional languages, feels like relearning to ride a bike
16:32Iceland_jackClojure is not pretty similar to Haskell I'd say
16:32gfredericksI've done undirected graphs a lot in clojure using sets of sets; but it wasn't too perf-sensitive
16:33ChongLiIceland_jack: depends on how you define similar
16:33pzuraqIceland_jack: Would you say it's closer to Haskell or Java?
16:33Iceland_jackpzuraq: I would.
16:33Iceland_jackBut pzuraq seems to have inferred that because implementing one thing isn't too different between the two
16:34pzuraqI 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:35Iceland_jackFair enough.
16:35ChongLiClojure is the most Haskell-like of the lisps
16:36ChongLiwith its focus on immutability and stuff like STM
16:36Iceland_jackSure, but I would say that something without a strong type system simply isn't that similar to Haskell
16:36Iceland_jackOf course similarity is subjective so let's not argue about that
16:36ChongLiyeah this is one of those rock paper scissors thing
16:37Iceland_jackWhy does paper ‘beat’ rock again?
16:37ChongLijava has strong types but is less similar
16:37ChongLibecause paper needs *something* to beat
16:39pzuraqIceland_jack: With hugs
16:39pzuraqhttp://iwidk.com/wp-content/uploads/2013/01/rock-paper-scisssors.jpg
16:44augustlI 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:45augustltest.generative seems to be mostly about testing pure clojure functions. I want my tests to do networking and other nastyness.
16:45dnolenneat, http://tailrecursion.com/blog/2013/02/15/introducing-javelin-an-frp-library-for-clojurescript/#.UR6Juounla8.twitter
16:46gfredericksaugustl: use core.contract and run a lot of real data through the system?
16:46noprompti'm curious. is the use of macros to create a pseudo templating language a bad idea?
16:47augustlgfredericks: what's core.contract?
16:47gfredericksnoprompt: you're not just trying to replicate unquoting are you?
16:47gfredericks$google clojure core contracts
16:47lazybot[clojure/core.contracts · GitHub] https://github.com/clojure/core.contracts
16:47gfredericksaugustl: ^
16:47ChongLidnolen: this is really neat
16:47noprompti don't think so but i could be wrong.
16:48nopromptbasically 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:48nopromptit's a bit complex and using string templates is hard to maintain
16:48augustlseems like few people are doing generative testing, I'm not finding any blog posts that holds my hand, step by step :)
16:49gfredericksaugustl: I'm interested in it, but haven't been able to
16:49ChongLiI think the spreadsheet metaphor gives a much better naming convention than the typical event/behaviour duality
16:49nopromptso 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:49augustlgfredericks: same :)
16:49gfredericksaugustl: I think I've wanted better ways for describing data schemas
16:50noprompt(SQL* LOAD DATA INFILE "somefile" ...)
16:50noprompti'm pretty sure it's an abuse though
16:50gfredericksnoprompt: you could use &env for that
16:50gfredericksthat's a fascinating macro actually
16:51gfredericksthat doesn't mean it isn't terrible; I won't judge that :)
16:51nopromptthe resolution part is needed because i have some things like (SET {:some_field "some value})
16:51nopromptwhich i want to leave alone
16:52noprompthow would &env help me in this case? i've never used it before.
16:53noprompthaha, i'm pretty sure it's terrible
16:54bbloomnoprompt: 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:55gfredericksnoprompt: &env would allow you to just use locals
16:55nopromptso here's the code https://gist.github.com/noprompt/4963866
16:55nopromptwith an example
16:56noprompti'm still learning how to use this stuff
16:56nopromptbbloom: checking it out
16:56nopromptah, so in this case i could avoid the resolution code?
16:57bbloomnoprompt: sorry, i spoke before i saw your implementation
16:57nopromptcan you give me any tips?
16:57bbloomnoprompt: your usage of postwalk is sufficient
16:57nopromptbbloom: thanks
16:58bbloomnoprompt: 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:00nopromptbbloom: that's pretty cool
17:01nopromptbbloom: reading your article, it's funny you mention the use of ERB with SQL - that's what i was originally doing
17:02bbloomnoprompt: i mentioned it because people do it :-P
17:05bbloomnoprompt: i don't know what's popular in the clojure/sql world right now, but i remember being impressed by http://clojureql.org/
17:07nopromptbbloom: i've had a lot of success with korma
17:07nopromptbbloom: but i did run across this yesterday
17:08bbloomnoprompt: with all due respect to ibdknox, i prefer to avoid reification of "entities"
17:09ibdknoxfwiw, you don't have to reify entities in korma
17:09ibdknox(select :users (where {:blah 4}))
17:09bbloomibdknox: i haven't used either korma or clojureql, so i'll step back from the conversation :-)
17:09ibdknoxhaha
17:12tomojwonder why bit-set etc aren't inlined, seems to prevent primitive transmission
17:15gfredericks(defmacro strs [& syms] (let [vs (vec (for [sym syms] (if (contains? &env sym) sym (s\
17:15gfredericksoops
17:16gfredericks(defmacro strs [& syms] (let [vs (vec (for [sym syms] (if (contains? &env sym) sym (str sym))))] `(clojure.string/join " " ~vs)))
17:21nopromptgfredericks: is that an alternate solution?
17:22nopromptgfredericks: i actually like that a lot more, cause it avoids the regex test
17:23SegFaultAXI think Korma is an awesome idea, but I haven't seen many projects using it. Do most people just use clojure jdbc?
17:26nopromptgfredericks: but shouldn't it still use postwalk?
17:27noprompt(strs super duper (println true)) => "super duper (println true)"
17:27nopromptSegFaultAX: i've been using korma for a small application, and i've been really happy with it.
17:28nopromptSegFaultAX: i've enjoyed it far more than the active record stuff i'm used to dealing with in the rails world.
17:29bbloomnoprompt: active record, the best worst idea ever
17:29nopromptbut i've been going through this "i want to build it myself" phase because i'm tired of being sheltered by frameworks.
17:30RaynesSegFaultAX: Most projects using it are likely going to be closed source company projects.
17:31SegFaultAXRaynes: That's a good point.
17:31SegFaultAXNot to mention a lot of the open source projects don't even use relational databases. Most of them are mongodb + monger.
17:31nopromptare relational db's that bad?
17:32SegFaultAXnoprompt: They aren't bad at all.
17:32SegFaultAXnoprompt: 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:33nopromptSegFaultAX: i've been using mysql mostly since that's what i "grew" up with, but i keep hearing about postgres.
17:34nopromptSegFaultAX: in your opinion what's the best rdb?
17:35nopromptSegFaultAX: or rather, which would you choose?
17:35SegFaultAXnoprompt: Postgresql is my go to database and has been for many years.
17:36SegFaultAXnoprompt: But it really depends. There are lots of factors to consider for those kinds of decisions.
17:37pbostromRaynes: does refheap support jsonp requests?
17:38Raynespbostrom: Probably not.
17:39Raynespbostrom: What are you doing that would require that?
17:40RaynesIt 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:40pbostromI was playing around with loading pastes client-side
17:41pbostromi.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:42pbostromRaynes: I can try to fix it myself and send a pull request or whatever the kids are doing these days
17:42dnolencemerick:
17:42dnolencemerick: ping
17:42gfredericksnoprompt: yeah if you want it nested it would have to be something like that
17:42cemerickdnolen: hi
17:42gfredericksnoprompt: I just wrote that macro because I thought it was fun and you gave me the idea.
17:42Raynespbostrom: Yup, that's about the only way to do it.
17:42dnolencemerick: I found the CLJS bug, fixing and releasing
17:44pbostromRaynes: I think it just requires setting the content-type header of the response to application/javascript instead of application/json
17:45RaynesNot exactly.
17:45RaynesYou have to wrap the results of the API call in a js function call.
17:46pbostromgotcha
17:47RaynesInstead of the API returning JSON like "{'foo':'bar'}", you'd pass something like ?jsonp=myfnname and it'd return "myfnname(\"{'foo':'bar'}\")"
17:47RaynesAt least, that's how I remember it.
17:47pbostromyeah, you're right
17:47RaynesI think lib-noir has a noir.response/jsonp thing that makes this easier.
17:48Sgeo_jsonp sketches me out
17:48RaynesDoes it do a good job?
17:48Sgeo_DO NOT CONSUME JSONP FROM UNTRSUTED SERVICES
17:49RaynesI'd like to see the resultant drawing.
17:49RaynesSurely pbostrom trusts me.
17:49pbostromyeah, I haven't worked out how jsonp is supposed to be more secure
17:49RaynesI've only stole from him twice.
17:49pbostromRaynes: I'm on the fence at this point
17:49Sgeo_pbostrom, it's not more secure, it works around a security feature
17:49RaynesThe problem is that you can't just trust me.
17:50RaynesYou have to trust that my website is secure enough to not get corrupted data in the db.
17:50Sgeo_It tells the service a function name, and expects the service to reply something like the_func(blah blah);
17:50RaynesIf someone managed to get some js code in my database, for example, I imagine that'd be bad.
17:50Sgeo_But you effectively run foreign Javascript code right on your page
17:50Raynes*shrug*
17:50Sgeo_It's like reading from a JSON service with eval
17:50Sgeo_You're trusting the input to not be malicious
17:51RaynesI trust people to not stab or shoot me on the bus every morning.
17:51RaynesIt has so far worked out in my favor.
17:52cemerickdnolen: That's great; so it's a cljs bug and not a match bug?
17:53pbostromhmm, maybe I should put some more thought into this, or just pull it down on the server side and escape anything funky
17:53nopromptRaynes: haha that's awesome
17:53nopromptRaynes: i trust people not to spit in my food
17:54RaynesMe too! We're wild creatures.
17:54amalloypbostrom: jsonp isn't supposed to be more secure at all
17:54dnolencemerick: yeah, core.match CLJS support is old, looks like I didn't account for try/catch syntax change that aligned CLJS w/ Clojure
17:54pbostromamalloy: yeah, Sgeo_ set me straight
17:55cemerickdnolen: Thanks :-) Sorry I couldn't offer up a patch.
17:56Sgeo_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:57Sgeo_I think there's some sort of secure alternative for cross-domain stuff in the works, but don't know details
17:58bbloomSgeo_: cross-domain is a cluster fuck all around
17:59bbloomi've found server side proxying to be by far the simplest solution
17:59Sgeo_I have considered using JSONP out of laziness, but I would have fully controlled both ends of it
17:59Sgeo_Ended up not using it though
18:12dnolencemerick: 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:12dnolencemerick: :require [clojure.core.match] also needs to be added to your CLJS ns
18:14TimMcSgeo_: If you use JSONP, remember that JSON is *not* a subset of JS.
18:15TimMcSgeo_: You have to remember to encode U+2028 and U+2029 in string literals.
18:15TimMc(this is if you want eval to work)
18:16technomancyhttp://www.netmeister.org/blog/images/dijkstra-quick-n-dirty.jpg
18:16bbloomTimMc: googled that & saw http://timelessrepo.com/json-isnt-a-javascript-subset -- holy crud. javascript, i hate you
18:17bbloomtechnomancy: he looks so serious!
18:17arrdemtechnomancy: we've had those around the department for a few months now...
18:17Sgeo_Have some VERY repetitive Tcl code lying around
18:18TimMcbbloom: In this case, direct your hate towards Crockford.
18:18technomancyTimMc: the best part is that since JSON is fixed in stone, it'll never get fixed.
18:18technomancygo go gadget hubris
18:18Sgeo_Why is it so important that eval work on JSON, exactly?
18:19TimMcIt's not, it's just an attractive nuisance.
18:19ppppaulwhat's the simplest way to write pretty printed clojure to a file?
18:19hiredmanalso doubles
18:19hiredman(binding [*out* ...] (clojure.pprint/pprint ...))
18:20Sgeo_"However, when you’re dealing with JSONP there’s no way around: You’re forced to use the JavaScript parser in the browser. "
18:20Sgeo_ouch
18:20technomancyhiredman: "Do the simplest thing that could possibly work. Except that, don't do that. No, that's stupid. Stop."
18:20ppppaul^_^
18:20hiredmanI must admit I often just do (spit "/tmp/foo" (with-out-str (pprint ...)))
18:20technomancyhiredman: re: JS doubles, not binding fwiw
18:21TimMcSgeo_: The workaround is to have the JSON gerenator emit a subset of JSON that is also a subset of JS.
18:21Sgeo_Then again, JSONP is an cute hack/horrible abomination that must die
18:21TimMc\u2028 and \u2029 are allowed escape sequences in both, after all
18:21hiredmanI forget if using spit like that is actually bad
18:21TimMcCrockford despises JSONP, yes.
18:21Sgeo_Crockford?
18:21hiredmanI think it may end up with more quotes or something
18:22TimMcDouglas Crockford created the JSON spec.
18:22Sgeo_Ah
18:22TimMcALso JSLint, I think?
18:22TimMcAnd wrote Javascript: THe Good Parts
18:23dnolencemerick: alpha12 going out
18:23arrdemyou forgot Javascript: The Working parts and Javascript: The Bits We Don't Talk About
18:27ppppaulhiredman, with-out-str works
18:28ppppaulhowever, i'm outputting datomic schema, and it is evaluating the reader macros which i wish it would not evaluate.
18:28ppppaulwhen i do pr-str i get correct output
18:28ppppaulbut reader macros get evaluates with pprint
18:29ppppaulis there a way around this? to get pprinted output that looks the similar as pr-str output?
18:31bbloomppppaul: 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:34noprompti need to finish my compsci education
18:35nopromptwhenever i try to read some of these papers i just get lost
18:40bbloomnoprompt: you just need an education education
18:40bbloomnoprompt: here's a good trick: print the paper out & get a red pen
18:40bbloomeverytime you don't understand something, underline it
18:40bbloomwhen you DO understand it, write a note or two in the margin
18:40nopromptand then go look it up?
18:40bbloomthen, print it out again and start over
18:40bbloomrepeat that process until you don't mark up the paper at all
18:40bbloomit takes a long time, but it works!
18:41nopromptthat's an interesting approach
18:41nopromptit's like debugging for the brain
18:41bbloomoh, and you need to perform this process recursively against the citations, but utilize a huristic search
18:42bbloomyou don't need to read every citation, and especially not the transitive closure of citations, but error on reading greater rather than fewer
18:43bbloomalso, Google Scholar is your friend.
18:43nopromptwow i didn't even know about that
18:43bbloomthe [PDF] link often circumvents paywalls, which is nice
18:44nopromptoh man
18:44bbloomnoprompt: this completes your education education
18:44warzhm, im trying to get ring-json's wrap-json-response middleware to convert my response map into json
18:44nopromptthis would have been so helpful so many times
18:44bbloom(for today)
18:44warzbut its just returning text/plain string version of the map
18:45nopromptwarz: you can always hand roll it :)
18:46noprompt{:status 200 :headers {…} :response json-stuff}
18:46noprompterr :body
18:46nopromptnot :response
18:46warzi 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:46warzim prob doing something wrong. im sure it works.
18:47nopromptbbloom: wow, this is awesome
18:47weavejesterwarz: You need to set the content-type
18:47bbloomnoprompt: do try the red pen technique & report how that goes as well :-)
18:47warzoh i thought it did that. i see reference to it in the code, i think.
18:48weavejesterwarz: Oh wait, this is on the response
18:48warzyea, response
18:48weavejesterwarz: So… what do you mean by "text/plain string version of the map"?
18:49warzwell like, the compojure route handler returns a map, and the http response is text/plain instead of application/json
18:49warzbut i thought it would be application/json, based on looking at the code for ring-json
18:49weavejesterwarz: You need to wrap the map inside a response map
18:50weavejesterwarz: e.g. (response {:foo "bar"})
18:50weavejesterwarz: Or {:body {:foo "bar"}}
18:50weavejesterwarz: Otherwise Compojure assume you're returning a request map.
18:50weavejesterEr
18:50weavejesterA response map
18:52warzim 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:52warzgithub shows different spacing that mine, maybe that has something to do with it
18:53warznot missing a paren or anything, heh
18:54warzmight have to do with my map call
18:54warzah yup thats it. hrm ok. something to go on.
19:02warzi 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:03weavejesterwarz: Yes, that would be why. I'm strongly considering changing that.
19:03weavejesterwarz: Lazy seqs are valid Ring bodies, and initially I didn't want to override any base behavior of Ring
19:04warzah ok. i did see a pull request that i think offers some code for that change
19:06weavejesterHuh, there are a few pull requests on ring-json that I don't believe ever arrived in my inbox
19:07warz:)
19:36weavejesterDoes 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:36weavejesterI was thinking of making one so that I can effectively hash a data structure
19:37amalloyweavejester: a gloss codec to do that would be interesting
19:38weavejesteramalloy: Oh, that's an idea. I'd forgotten about gloss.
19:39amalloyheader frames let you implement tagged unions pretty simply, which i think is all you really need to encode clojure data structures
19:40amalloyyou could ask zack, too; he might already know of a codec someone's written
19:42bbloomweavejester: have you looked at https://github.com/Datomic/fressian ? i dunno it it meets your requiresments or not
19:43hiredmanfressian's caching stuff might interfere with repeatability there
19:44weavejesterbbloom: I don't think Fressian makes any guarantees about order
19:44hiredmanweavejester: doesn't pr-str do that?
19:44ivanconsistent indentation in fressian? I am disappointed
19:44weavejesterhiredman: I don't think it does. For instance, compare an array map to a hash map
19:44amalloyhiredman: {:a 1 :b 2} vs {:b 2 :a 1}?
19:44hiredmanah
19:44hiredmanright
19:45weavejester,(pr-str {:b 1 :a 2} (hash-map :a 2 :b 1))
19:45clojurebot"{:a 2, :b 1} {:a 2, :b 1}"
19:45weavejesterThat did get the order right, but I don't think it guarantees it...
19:45hiredmanyou could, of course, patch the print-methods to order the keys always
19:45bbloomweavejester: do you need to support non-clojure types or records?
19:45weavejesterbbloom: Nope
19:46bbloomweavejester: then it should be pretty easy to implement yourself... after all, clojure.walk has to handle all the types
19:46weavejesterbbloom: Yep, it shouldn't be too hard
19:48weavejesterhiredman: 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:53bbloomweavejester: passing through string form just seems like a completely unecessary intermediate step
19:54weavejesterbbloom: String form?
19:54bbloomweavejester: i mean printing before serializing
19:54hiredmanbbloom: sure, and very ineffecient on the jvm if what you want is bytes
19:54weavejesterAh, yep
19:57bbloomon a totally unrelated note, i find myself wishing for an intrinsic notation & abstraction for propertied trees
19:57bblooma la html or xml or any other tree of maps with a :children key
21:26ayiaHi 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:26ayia help me...
21:27ayia(defspel game-action [command subj obj place & args]
21:27ayia `(defspel ~command [subject# object#]
21:27ayia `(spel-print (cond (and (= location '~'~place)
21:27ayia (= '~subject# '~'~subj)
21:27ayia (= '~object# '~'~obj)
21:27ayia (have? '~'~subj))
21:27ayia ~@'~args
21:27ayia :else '(i cannot ~'~command like that -)))))
21:27ayiathat was the macro... (defspel is an alias for defmacro)
21:28akhudekayia: please use https://www.refheap.com/ for code
21:28akhudekthe best way to understand what a macro is doing is to look at it's output with macroexpand
21:28ayiaoh... big sorry for that... next time i will use...
21:30ayiaakhudek: I see... seems like there is no easy way)
21:34akhudekI wish I could offer more, but know enough of the macro nuances to know why you'd nest backticks
21:35akhudekbut you can see the output by using macroexpand-1
21:35akhudekand compare the versions with and without the second set of backticks
21:39ayiaakhudek: thanks... will try)
21:45alex_baranoskyhow do I sign my jar so Clojars is happy?
22:03ayiaakhudek: by the way... the output of macroexpand-1 is terrible... )
22:05technomancyalexbaranosky: usually if you're generating signatures at deploy the missing piece is not putting your public key in your clojars profile
22:05ayiaakhudek: that is it after deleting all namespaces... https://www.refheap.com/paste/11337
22:06dnolenayia: it's useless unless you use pprint w/ code dispatch on the output
22:06dnolenayia: some editor tools support incremental macro expansion like swank-clojure / nrepl.el
22:42gfredericksdoes cljs have proper keywords now?
22:54dnolengfredericks: no
23:06gfredericksman. coulda sworn that keyword-string was going into a constructor.
23:08dnolengfredericks: oh sorry yes, under advanced optimization if (:foo bar), we wrap :foo in a Keyword type
23:09dnolengfredericks: this is because keyword invocation is very slow otherwise
23:09dnolengfredericks: 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:09bbloomdnolen: maybe we should try to tackle keywords and symbols on sunday?
23:10dnolenbbloom: I was actually thinking the same thing.
23:10bbloomdnolen: would be nice to finally cross that one off the list :-)
23:11dnolenbbloom: don't know if we'll finish but we can at least make a dent :)
23:12bbloomdnolen: 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:13dnolenbbloom: well that's what I mean, a dent towards something fast :)
23:16bbloomdnolen: and doesn't leak memory! *grumble*grumble* no WeakReferences
23:21dnolenbbloom: 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:23bbloomdnolen: 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:42dnolenbbloom: right, sounds good