#clojure log - Feb 09 2013

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

0:00 egghead: http://stackoverflow.com/a/3409568 is this anywhere in core?

0:01 the code reads as something like 'when seq-able lazily seq the sequence s'

0:22 dxeh: whats a nice clojure tutorial for someone who knows other languages but has not tried _anything_ like clojure syntax wise

0:23 egghead: I can recommend https://leanpub.com/fp-oo but it's not freely available

0:24 dxeh: everything is free on the internet if you look xd

0:34 whats the big difference between clojure & scala?

0:35 nightfly: Ones a lisp ones not?

0:37 dxeh: i havent actually seen any scala code i dont think i was just assuming it was similar to lisp as well

0:37 guess not

0:37 nightfly: similar to a lisp != a lisp

0:38 ..er (not (eql a-lisp similar-to-a-lisp))

0:39 drewc: the type system?

0:41 Frozenlock: you mean (not= a-lisp similar-to-a-lisp) :P

0:42 dxeh: is there an eql keyword?

0:42 havent delved into the language much yet just researching it a bit xd

0:42 Frozenlock: identical? ?

0:43 Note the second question mark...

0:43 dxeh: ah

0:53 yedi: can someone who knows korma help me out with this: https://gist.github.com/yedi/4743886

0:53 it's a very simple starter program and i've included my postgres log

0:55 amalloy: dxeh: i advise trying out 4clojure.com

0:56 but no, scala is not much like clojure. in attempting to improve on java, the languages went in basically opposite directions

0:56 (though really, while i'm not sure about scala, clojure wasn't an attempt to improve java)

0:58 egghead: scala is a mix of stuff like haskell/ml/eiffel/java

1:00 amalloy: yeah, to me scala looks like haskell and java mushed together. but i'm sure there are folks in here with more experience to comment on that

1:02 Raynes: amalloy: It looks like Haskell, Java, C, Erlang, Python, Ruby, Brainfuck, and every other language mushed together to me.

1:03 amalloy: that's because you're a prejudiced youngster, Raynes

1:03 egghead: clojure reminds me of erlang, lisp, ruby, and java

1:03 erlang just for concurrency semantics tho...

1:03 Raynes: It's true.

1:03 The concurrency has nothing to do with Erlang though.

1:03 egghead: thought I like clojure best when it *doesn't* remind me of java

1:04 Raynes: I mean, you can do actors in Clojure.

1:04 And stuff.

1:04 egghead: s/ght/gh

1:06 erlang has mnesia for in memory store + transactions, kind of like concurrency semantics :)

1:06 qz: about scala: pretty old, but it mostly turned out to be true for me - https://gist.github.com/anonymous/1406238

1:06 especially sbt rant

1:08 dxeh: my motivation to learn clojure is so i don't have to write java-like syntax all the time to achieve the same solution xD

1:08 the lisp is a nice change

1:10 lol i just got that joke on the 4clojure website amalloy

1:10 took me a couple seconds

1:12 callenbot: Raynes: Scala has no brainfuck, only INTERCAL

1:12 Raynes: DAT COMEFROM

1:12 Raynes: https://www.youtube.com/watch?v=UX0ue7brUfk

1:13 Raynes: callenbot: It's really hard to watch Doug Stanhope full screen when you keep pinging me.

1:13 I assure you, your videos of 20 minute long songs are not as amusing as this person.

1:13 :P

1:13 yedi: any korma users think they can help me out: http://stackoverflow.com/questions/14785500/relation-doesnt-exist-error-when-querying-postgresql-with-korma

1:14 dxeh: (= (list __) '(:a :b :c)) what would the solution be to this? (how are lists formatted in clojure)

1:14 Raynes: :a :b :c

1:14 &(list :a :b :c)

1:14 lazybot: ⇒ (:a :b :c)

1:19 dxeh: &((conj '(2 3 4) 1))

1:19 lazybot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn

1:19 dxeh: ok then

1:19 &(conj '(2 3 4) 1)

1:19 lazybot: ⇒ (1 2 3 4)

1:19 dxeh: so is the front of a list in clojure the rightmost element

1:24 tomoj: the front?

1:24 Sgeo: The head of a list is the first element

1:24 ,(cons 1 '(2 3 4))

1:25 clojurebot: (1 2 3 4)

1:25 Sgeo: You can think of a list as being made of entirely conses

1:25 jonasen: I can't get checkouts to work with lein-cljsbuild. Has anyone had problems with this?

1:25 Sgeo: And the empty list

1:25 ,()

1:25 clojurebot: ()

1:25 Sgeo: ,(cons 1 (cons 2 (cons 3 (cons 4 ()))))

1:25 clojurebot: (1 2 3 4)

1:26 Sgeo: That's what a list physically looks like, in theory

1:26 dxeh: what is cons a short form of (like the word it represents?) construct?

1:26 or consist

1:27 Sgeo: constructs, I think

1:27 http://en.wikipedia.org/wiki/Cons

1:30 callenbot: Sgeo: caddur hurr hurr

1:30 Sgeo: ?

1:30 callenbot: Sgeo: that's how I pronounce CDR in my head.

1:31 Sgeo: caddur

1:31 Sgeo: Ah

1:31 dxeh: ,(conj [1 2 3] 4)

1:31 clojurebot: [1 2 3 4]

1:32 dxeh: so basically ... since those are the same, it would be just bad practice to do (conj [1 2 3 4]) for example

1:32 you could get the same result compiling [1 2 3 4]

1:34 Raynes: callenbot: I just realized what I said earlier didn't sound like a joke. Just a heads up I was totally kidding. It's fine for you to ping me as much as you like.

1:35 yedi: what are the common database wrapper libs in clojure?

1:37 Raynes: monger or congomongo for mongodb, clutch for couchdb, korma and/or clojure.java.jdbc or whatever for SQL...

1:38 dxeh: for networking in clojure do people often just use java libs?

1:38 like nio etc

1:39 callenbot: Raynes: I hate you.

1:39 Raynes: monger

1:39 Raynes: just don't fuck up updates. If you use something else, report back about it.

1:39 Raynes: wat

1:39 callenbot: kidding

1:39 Raynes: I have no idea what you're saying :P

1:39 callenbot: Raynes: vodka, sorry.

1:39 Raynes: lol

1:41 dxeh: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Lazy_Fibonacci the code here, 'lazy-cons', what exactly is the lazy representing in the jvm

1:46 technomancy: Raynes: probably http://hackingdistributed.com/2013/01/29/mongo-ft/ ?

1:49 yedi: does anyone know if it's possible to create tables in korma

1:49 callenbot: yedi: don't.

1:49 yedi: use a migration library or write your own scripts.

1:50 yedi: like lobos or something?

1:50 callenbot: yedi: I'm sure you can find better, but if you like it.

1:50 yedi: i'll look for better

1:54 drift seems like the only other optino

1:55 callenbot: yedi: wrongo

1:55 yedi: theres migratus and ragtime but they seemed kinda janky

2:05 callenbot: yedi: all the migration libraries suck, you should write a new one.

2:06 yedi: if only i weren't a complete newb to javascript and managing sql dbs

2:06 clojure*

2:06 callenbot: yedi: that's a bad place to be in. Write plain SQL scripts to keep it simple.

2:46 yedi: callenbot: i guess there's no harm in finding a non clojure migration library

3:13 callenbot: yedi: use plain SQL scripts

4:05 alex_baranosky: anybody there?

4:06 ChongLi: hi

4:07 * babilen hands alex_baranosky a coffee

4:07 alex_baranosky: hi Chongli

4:07 are any o fyou planning to be at Clojure/West?

4:08 ChongLi: I wish, unfortunately not :(

4:08 babilen: no, way too expensive to fly to the US for that

4:08 alex_baranosky: oh, I bet. I'd never fly here for a conference

4:09 it stinks how US-centric conferences are

4:09 babilen: Well, Clojure ones at least :)

4:09 (apart from euroclojure)

4:09 kryft: That would be great if euroclojure were us centric :)

4:10 babilen: No it wouldn't -- It would be slightly amusing but at the end of the day increadibly depressing :)

4:10 kryft: Heh

4:13 babilen: Will Clojurewest stream sessions? (haven't checked so far)

4:13 alex_baranosky: doubt it. I don't think streaming sessions is standard practice

4:14 usually they show them some months later

4:15 babilen: *sigh*

4:15 Something that could be learned from conferences such as Fosdem :)

4:17 But then somebody is probably making money with Clojure/West and giving the content away for free is not in the interest. *shrug*

4:17 *their interest

4:17 alex_baranosky: of course!

4:18 you give the content away months after as advertisement for thenext conference

4:18 can't blame them for that - a lot of money goes into making a conference happen

4:19 kryft: If only conferences could be copied and distributed like software ;)

4:19 AtKaaZ: is there a function that already does this? https://www.refheap.com/paste/11115 insert a list of elements inside a (str "prefix" _here_ "suffix")

4:21 babilen: alex_baranosky, kryft: Well, it really depends on how you organise a conference. There /are/ quite a bunch of conferences that provide live streaming + vivid discussions on IRC during the even (FOSDEM, GUADEC, XYc3, …) -- It looks as if there is no interest in making this happen within the Clojure community though.

4:21 (I have no idea who organises Clojure/West and what the intentions for organising it are)

4:22 *during the event

4:23 alex_baranosky: AtKaaZ: no built-in for that, but there are cleaner implementations than your refheap

4:23 AtKaaZ: alex_baranosky: i agree, thanks; already got rid of partial for starters :D

4:26 alex_baranosky: AtKaaZ: does this work? Untested - https://www.refheap.com/paste/11117

4:26 ok tested. works

4:27 oh, I see you want no spaces in between

4:28 AtKaaZ: revised to match your requirements: https://www.refheap.com/paste/11118

4:36 amalloy: ~flatten

4:36 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

4:37 amalloy: just, you know, for reference. if you solve anything with flatten ever, throw it away and start over or ask alex_baranosky :P

4:37 alex_baranosky: flatten is your arch-nemesis! hehe

4:42 amalloy: flatten is everyone's arch-nemesis. he's the villain out to destroy the world just for fun

5:25 AtKaaZ: hey sorry I was afk, thanks amalloy and alex_baranosky, I'll check the code

5:28 I'm happy to learn about join and concat, didn't use them before

5:42 alex_baranosky: AtKaaZ: no problem, glad to help

5:59 dada: ciao

6:00 !list

6:31 manuelp: Hi everyone! There is someone here that uses cemerick/friend with enlive?

6:35 I'm reading the source code of friend but I haven't found a way to do what I need, yet.

7:56 Guest66432: what is the deps.js file that my cljs is requesting (get a 404)?

8:05 abp: Guest66432: https://groups.google.com/forum/#!topic/clojure/_WkdBGPhI-Q/discussion

8:06 Guest66432: But seems like that should be fixed

8:14 Guest66432: abp: i saw that, it looked like it shouldnt apply since im using advanced compilation

8:14 in whitespace i didnt have this issue

8:19 i dont see the code being minified either which may be part of the issue

8:20 hyPiRion: Github down for maintenance? boo

8:21 Guest66432: trying to use marginalia to generate some docs from my code as well, anyone run into this error java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol ?

8:21 "lein marg *" is the command im running

8:22 looks like its coming from hiccup

9:51 serpent213: hi

9:51 any idea on how to code this more succinctly?

9:51 http://pastebin.com/QQBjG0L8

10:00 Lajjla: Raynes, do you still love me the most?

10:01 ds300: Anyone ever have trouble compiling a lein project when overriding a clojure.core func in some other ns? I get a weird nullpointerexception during compilation that goes away when I change the name of the offending function.

10:09 xeqi: manuelp: did you get enlive + friend working?

10:17 abp`: serpent213: If you do like this better: https://www.refheap.com/paste/11120

10:26 serpent213: abp`: good inspiration, thanks! :)

10:38 manuelp: @xeqi: authentication works, but now I need a way to render some enlive templates differently based on authorization roles. For example: append this link if the logged user has the ::admin role.

10:39 xeqi: I've found the 'authorized?' and 'current-authenticated' fns, but I haven't managed to make them work for me

10:41 xeqi: something like (if (authorized? ::admin (current-authentication)) ...) but I'm having difficulties testing these functions in the repl

10:41 xeqi: thank you FYI

10:43 xeqi: manuelp: if yo uwant to fake the identiy while playing in a repl you can do something like: (binding [cemerick.friend/*identity* {:username "joe" :roles #{:admin :user}}] ...)

10:44 it sounds like you're headed the right direction with (authorized? role (current-authentication))

10:45 tmciver: A little off topic but what do people use to validate their markdown before pushing to github?

10:45 \

10:45 xeqi: manuelp: blah, that bindings not right, hold on

10:46 hyPiRion: tmciver: I force push until I get it right.

10:46 That's the stupidest way of doing it, btw.

10:46 tmciver: Ha! Yeah, that's what I've been doing. :/

10:47 manuelp: xeqi: In fact I've already tried something along those lines but without success (friend's 'auth?' fn checks the type)

10:47 tmciver: I used to use pandoc (http://johnmacfarlane.net/pandoc/try/) but it looks like it's change recently and doesn't display the html.

10:48 manuelp: tmciver: http://jrham.es/instantmark/ ?

10:49 tmciver: another one: http://dillinger.io/

10:49 tmciver: manuelp: Nice. <3

10:55 manuelp: Thanks. Seems like the first one (instantmark) doesn't support bulleted lists.

10:56 wait, I take it back. I needed a blank line before the list.

10:56 * tmciver doesn't really know markdown.

10:57 manuelp: tmciver: you are welcome :)

10:59 xeqi: ok, I'm reading friend's source code and the authentication map is a record.

10:59 xeqi: manuelp: https://www.refheap.com/paste/11121 ; that binding with provide a identity in the same way workflows do. Then you can test things out in a repl

10:59 blah, I can't type today

11:00 tmciver: I also just found http://tmpvar.com/markdown.html for markdown preview

11:01 manuelp: xeqi: You were faster than me :) thank you very much, I appreciate that. I think I'll write a friend mini-guide. Documentation is good for everyone: I consolidate my understanding and at the same time maybe I can spare some newcomer's time.

11:02 tmciver: I think nowadays there are a lot of online markdown editors. It's just a matter of finding one that you like. Thank you for the additional link however :)

12:48 Frozenlock: Is it me or #clojure is becoming more and more quiet in the weekends?

12:50 hyPiRion: Frozenlock: It's usually like that

12:50 People aren't at work etc.

12:58 AtKaaZ: hi, is there some function that would return a new map of the same type as the passed map type but empty ?

12:59 or is there a function that would empty a map? like (empty thismap) ;returns empty map of same type

12:59 jeremyheiler: Yes

12:59 ,(doc empty)

12:59 clojurebot: "([coll]); Returns an empty collection of the same category as coll, or nil"

13:00 AtKaaZ: oh cool

13:00 jeremyheiler: ,(empty {1 2 3 4})

13:00 clojurebot: {}

13:00 AtKaaZ: ,(sorted? (empty (sorted-map :b 1 :a 1)))

13:00 clojurebot: true

13:00 AtKaaZ: excellent, thanks jeremyheiler

13:01 jeremyheiler: No problem. Also, you generally shouldn't concern yourself with the type of map you're using. For example, small maps are array based, but once they get big enough, they become hash maps.

13:02 AtKaaZ: I understand, it's just that I had some check/:pre/assert somewhere that the map be sorted, and I didn't want to place code that returned sorted map in two places

13:02 jeremyheiler: ahihi, ok

13:03 ahihi, ok*

13:03 damn autocomplete... sorry ahihi

13:03 AtKaaZ: =)

13:13 mdeboard: I've got a proprietary, 3d-party SDK that I'd like to integrate with a Clojure project. The SDK is all C source with Java wrapper. How would I go about adding this as a dependency to my project?

13:13 jeremyheiler: mdeboard, Is the Java wrapper in a Maven repository?

13:14 mdeboard: No, not as far as I know. I'm using the demo version of the SDK at the moment (evaluating for purchase of license)

13:14 @ jeremyheiler

13:16 jeremyheiler: Well, you could install that into your local repository (on your machine) and depend on it from there. Although, I'm not sure what to do about the C code/binary.

13:21 mdeboard: jeremyheiler: Yeah, thanks anyway though

13:24 jeremyheiler: I guess my real question is, there's the foo.jar file with all the classes in it. What would I add to project.clj to be able to access those classes?

13:25 lein relies strictly on maven/clojars eh

13:25 modulus: hmm, maybe this is a stupid question, but i have a .jar file i want to use (it's a java lib). where do i put it so i can access those classes when using line repl?

13:25 AtKaaZ: this might be relevant to c++ stuff https://github.com/bagucode/clj-native

13:26 jeremyheiler: mdeboard, You could create a .lein-classpath file at the root of your directory, which points to the directory that your jar is in, It hink.

13:26 root of your project*

13:27 mdeboard: modulus: lol, I'm in the midst of that exact question :)

13:27 jeremyheiler: Thanks, that's a good start point for research

13:27 modulus: See jeremyheiler's most recent response to me

13:28 modulus: yes, i will look around on this

13:31 jeremyheiler: mdeboard, modulus, disclaimer, I've only used .lein-classpath for source files. I don't know if it will work for jar files. I imagine it would, since it's adding to the classpath.

13:31 mdeboard: yeah makes sense

13:32 the contents of the .lein-classpath file is just a path per line? Or should it be a clojure data structure with string members? e.g. '("/path/to/jarfile" "/other/path/to/jarfile")

13:33 jeremyheiler: Path per line

13:33 mdeboard: ok

13:33 modulus: hmm, but the jar file i'm using is already on one of the dirs on the classpath

13:33 but i do (import 'jcurses) and it doesn't work... i'm probably doing something wrong but i don't know what

13:35 mdeboard: Does (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) include the path you specified?

13:35 modulus: the .jar is on the src/project dir which is printed by lein classpath but i'll try that

13:37 the dir where the .jar is gets printed by that form, yes

13:37 though not the .jar itself

13:37 AtKaaZ: should be the .jar i think, try?

13:38 modulus: right

13:39 mdeboard: modulus: Add `:source-paths ["/path/one/1.jar" "/path/two/2.jar"]` to project.clj

13:39 that just worked for me

13:39 if you're using lein2

13:41 modulus: thanks, i will try that now

13:41 mdeboard: and I had to import the class name like it was listed in the jar contents, `(import 'com.callassoftware.pdfEngine.Constants$Transition)` for example

13:42 well, by "had to" I mean that it was the first time that worked

13:42 modulus: i assume the ` is not to be added, right?

13:42 mdeboard: right

13:42 I just use that to demarcate source

13:42 modulus: right

13:42 thx

13:46 ooh shiney, it worked at last.

13:47 thanks all for help

13:48 mdeboard: :D

13:50 yedi: in paredit/emacs is there a keybinding for highlighting the entire form you're currently in, or the form that starts where your cursor is?

13:51 i don't want to have to C-space and move cursor everytime i want to wrap parentheses around a form

13:52 Frozenlock: yedi: I really like expand-region.el for this

13:52 http://emacsrocks.com/e09.html

13:52 yedi: oh sweet, thanks

13:53 pimeys: I've tried to learn emacs now

13:53 if I turn off evil mode, I'm lost

13:53 jeremyheiler: yedi, M-( wraps parents around the form

13:53 parens*

13:53 pimeys: still waiting the one big thing in emacs that converts me, slime might be one but I don't know

13:53 jeremyheiler: with paredit, that is

13:54 yedi: jeremyheiler: oh cool, thanks aswell

13:54 jeremyheiler: pimeys, nrepl was what did it for me

13:54 pimeys: I'm still very fast with vim and a bit lost even with evil mode in emacs

13:54 Frozenlock: pimeys: org-mode :)

13:54 jeremyheiler: I also never tried evil mode, forcing myself to really learn it

13:54 pimeys: I just cannot live without the command mode

13:55 It's so superior way to edit text

13:56 jeremyheiler: yedi, i refer to this a lot: http://mumble.net/~campbell/emacs/paredit.html

13:56 modulus: so, when running lein repl does the cor.clj get run?

13:56 jeremyheiler: modulus, no

13:56 Frozenlock: jeremyheiler: I should take this day to finally learn paredit

13:57 jeremyheiler: Frozenlock, it is so worth it

13:57 Frozenlock: Does it work in the repl too?

13:57 octagon: hello! in cljs + is a macro: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L221. how is it possible to do (apply + [1 2])? i thought it was not possible to take the value of a macro?

13:57 Frozenlock: (no mode clash, anything?)

13:58 jeremyheiler: Frozenlock, not by deafult at least. I haven't tried, though. still learning

13:58 octagon: (the expression (apply + [1 2]) does evaluate to 3, correctly)

14:00 yedi: (ns skateproj.routes :require [skateproj.db :as db])

14:00 is there something wrong with this form?

14:01 i get: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword

14:01 when trying to execute it

14:01 Frozenlock: (ns skateproj.routes (:require [skateproj.db :as db])) Missing a paren?

14:01 yedi: oh right

14:03 jeremyheiler: modulus, you can specify a namespace to load in :repl-options, though

14:03 see: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L115

14:16 mdeboard: Hm, though I have imported a class successfully I can't access any of the class methods; static fields yes but not methods

14:16 jeremyheiler: How are you doing it?

14:18 mdeboard: `(import '(com.callassoftware.pdfEngine PDFEngine))` then `PDFengine/compare` just to see if it exists. But I also tried (PDFEngine/compare "a" "b") and (. (new PDFEngine) compare), always says field not found

14:18 The error I get with (new PDFEngine) is InstantiationError com.callassoftware.pdfEngine.PDFEngine user/eval893 (NO_SOURCE_FILE:1) ... which makes me wonder if it's having issues finding the C source around which that class is wrapped

14:19 yedi: how do i delete parentheses in paredit? (i couldn't find it in the cheat sheet)

14:19 jeremyheiler: mdeboard, possibly. it's definitely a no-arg constructor?

14:19 mdeboard: Yeah

14:19 @ noarg

14:20 from Javadocs: "Constructor Detail: PDFEngine\npublic PDFEngine()"

14:20 jeremyheiler: yedi, you can highlight it and C-w it

14:21 yedi, but i only do that if they somehow get unbalanced.

14:22 yedi: ok, but i can't even delete both parens when deleting just the first paren

14:22 which i though was the normal behavior

14:22 jeremyheiler: mdeboard, not sure where to take it. i assume the binary is on the PATH?

14:22 mdeboard: No, it's not, that's my next step

14:23 modulus: hmm, how do i need to organise my code so lien run will run it? i thought i just needed to write it on core.clj?

14:23 jeremyheiler: yedi, so when you delete the open paren, the close paren sticks around? (assuming they are together)

14:24 yedi: well it won't let me backspace the open paren

14:24 jeremyheiler: modulus, take a look here: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L103

14:24 modulus: right, thx

14:24 jeremyheiler: modulus, np

14:25 yedi, it should work if they're right next to each other. even if there is a space between them, it wont let you delete it.

14:25 yedi: i'm sure this a really nooby problem, but i don't get why :name returns null: https://gist.github.com/yedi/4746687

14:26 jeremyheiler: ah i see, hmm, i guess i just haven't gotten used to the paredit way yet. tanks

14:26 jeremyheiler: yedi, as for your gist, it looks like your function is returning a vector, not a map.

14:26 mdeboard: Hm, I wonder if :native-path could be used to specify location of C binary

14:26 yedi: ohh

14:28 jeremyheiler: mdeboard, I just thought that the overtone project might be a good place to look, since I think it uses a native dependency.

14:30 mdeboard: jeremyheiler: Ah, looks like it wraps the C libs directly with Clj? https://github.com/overtone/overtone/blob/master/src/overtone/sc/machinery/server/native.clj

14:31 jeremyheiler: interesting

14:37 modulus: so i'm too dumb for this language i think ;-)

14:38 mdeboard: lol

14:38 It's an abstraction of another language which is an abstraction of another language

14:38 pimeys: modulus: don't say that :D

14:38 just put more years into programming

14:38 modulus: classpath includes c:\clojure\plaything\src - in taht dir there's plaything\core.clj - in project.clj there's :main plaything.core

14:38 lein repl tells me plaything\core.clj not on classpath .... confused

14:39 Frozenlock: modulus: I prefer to think that I'm too dumb to use any other language... arrays, memory allocation, classes, methods... I can't understand all this stuff.

14:39 pimeys: although I have the same feeling when I start doing something with haskell

14:40 there's stuff, like functors, for which I cannot find any use

14:40 modulus: Frozenlock: i can more or less deal with the language, but all the deployment stuff around it is really screwing with my head

14:40 pimeys: then I read somebody else's code and they use lots of functors and monads

14:40 although I understand what monad is, I have no clue how to use them

14:40 Frozenlock: modulus: Yeah. I wonder how everyone did it before leiningen.

14:40 modulus: pimeys: monad is just way to specify sequential computation or whatever

14:41 mdeboard: pimeys: Much the same way you'd use a burrito

14:41 pimeys: of course

14:41 but then readin some monadic code

14:41 +g

14:41 modulus: anyway, any clue why lein is lying to me? ;-)

14:41 pimeys: just, it's so different

14:41 and then clojure was so easy to start with

14:41 jeremyheiler: modulus, can you gist your project.clj and main namespace?

14:42 (or refheap ;-)

14:42 modulus: yeah sure

14:42 Frozenlock: jeremyheiler: refheap using refheap.el :)

14:42 jeremyheiler: Frozenlock, oooh, gotta install that

14:43 octagon: so in cljs, both + and case are macros. however, + in the cljs repl is an actual function and case is not. how does this work?

14:43 pimeys: though it has helped me that I use xmonad, so all configuring means to be able to write some haskell

14:43 Frozenlock: Yes you do. You can paste on refheap without ever leaving emacs.

14:44 AtKaaZ: octagon: you mean clojure with the second cljs

14:44 Frozenlock: octagon: Is '+' redefined as a function in another namespace? The macro could have been used locally to bootstrap or something.

14:44 Kinda like list*

14:44 octagon: AtKaaZ: i was using himera, but there is a leiningen thing for cljs repl via ajax to the browser too

14:45 modulus: oh joy, pastebin thinks my code is spam

14:45 AtKaaZ: octagon: in clojure, + is a fn and case is macro, do you mean that in cljs repl + is a fn also? even though it seems like it's defined as a macro when you linked to it before

14:46 octagon: AtKaaZ: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1226

14:46 yes it's definitely a macro

14:46 modulus: jeremyheiler: https://www.refheap.com/paste/11125

14:46 Frozenlock: octagon: you just linked to a function

14:48 octagon: Frozenlock: whoa, you're right, so many tabs. that's interesting: it's defined as a macro here: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L221 and then as a function https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1226, problem solved!

14:48 AtKaaZ: octagon: in core.cljs + is a fn and in core.clj + is a macro :O

14:48 octagon: now it makes perfect sense!

14:48 jeremyheiler: modulus, if you have a dumb -main that does nothing, do you get the same error?

14:49 AtKaaZ: cool, cause I don't get it=)

14:49 modulus: jeremyheiler: trying, sec

14:50 AtKaaZ: octagon: but in clojure (not cljs) repl it's a fn as well

14:50 octagon: AtKaaZ: i think the answer is here: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1231

14:50 the first + in the reduce expr is the macro, the other is the function

14:50 modulus: correct, same error

14:50 main defines as (defn -main [])

14:50 octagon: err i mean the other way round

14:51 AtKaaZ: octagon: ok that makes sense

14:51 octagon: trixty lil thing there

15:28 Bodil: Ooh look, I got a Clojurescript REPL working on Nashorn: https://github.com/bodil/cljs-nashorn

15:29 ivan: cool

16:00 fredyr: i found myself wanting to do this a couple of times: https://www.refheap.com/paste/11126

16:00 any ideas would be much appreciated

16:01 yedi: callenbot: what do you have against monger?

16:08 fredyr: oh nvm, reduce does the trick obviously

16:12 callenbot: yedi: absolutely nothing

16:19 borkdude: how do I get the body of document in clojurescript?

16:21 Frozenlock: borkdude: you can make a direct JS call, or use a library like domina

16:21 hyPiRion: fredyr: do what? add in spaces?

16:21 ,(let [v [\a \b \c \d]] (assoc v 1 \space 4 \space))

16:21 clojurebot: [\a \space \c \d \space]

16:22 borkdude: Frozenlock I'm trying this (def b (-.body js/document)), what's wrong with it?

16:24 yedi: is enlive the go to for clojure html templating? or are there other contenders?

16:24 Frozenlock: borkdude: I don't have my repl running, but try typing js/document.body in yours.

16:24 borkdude: Frozenlock I'm trying it on himera

16:24 hyPiRion: ,(let [v [\a \b \c \d] poses [1 4]] (apply assoc v (interleave poses (repeat \space))))

16:24 cshell: yedi: I use enlive, but there's also hiccup

16:24 clojurebot: [\a \space \c \d \space]

16:24 borkdude: http://himera.herokuapp.com/index.html

16:25 Frozenlock hmm, yes that works

16:25 Frozenlock I'm a bit confused then how property access works

16:25 cemerick: Bodil: What's the perf like? I've been using phantomjs exclusively b/c rhino is just _so_ slow.

16:26 Frozenlock: borkdude: it's .-body, not -.body

16:27 fredyr: hyPiRion: i fixed it with a reduce

16:27 borkdude: ah

16:27 fredyr: (reduce #(assoc %1 %2 \space) my-vec indices)

16:28 Bodil: cemerick: Haven't really benchmarked it, but it should be closer to Node than Rhino. Startup time is bad, though, but the Nashorn devs promised me that should be fixed in a few weeks. If you want performance, cljs-noderepl is probably a better choice than phantomjs.

16:33 cemerick: Bodil: Is that attributable to the difference between v8 and JavascriptCore?

16:36 Bodil: cemerick: I only have experience with running JS on other Qt apps, where it's a fair bit slower than V8. Phantom's still on Qt, right?

16:36 AtKaaZ: hi, what does it mean when [f & [silently]] those [] are around silently parameter?

16:37 cemerick: Bodil: no idea

16:37 Frozenlock: AtKaaZ: Everything after & will be put inside a list. So [silenty] will take the first item from that list.

16:38 Bodil: cemerick: It was last time I checked, which was admittedly quite a while ago. :)

16:38 ordnungswidrig: lein deps :verify => bad-signature [org.clojure/clojure "1.4.0"]

16:38 should I worry?

16:38 AtKaaZ: Frozenlock: that's what I thought first, but it didn't seem to be the case :O I'll retest

16:38 Frozenlock: ,(let [[a & [b]] [1 2]] b)

16:38 clojurebot: 2

16:38 yedi: enlive vs hiccup... ugh choice paralysis will be the death of me

16:39 metellus: ,(let [[a & [b]] [1 2 3 4 5]] b)

16:39 clojurebot: 2

16:39 Frozenlock: AtKaaZ: However I recently learned that the clojure way is to rather use multiple arities function.

16:39 cemerick: Bodil: based on their build instructions, it does use qt

16:39 gfredericks: AtKaaZ: it is effectively the same as [f silently] except that the function is relaxed to allow one or more arguments

16:40 Frozenlock: Hrphm... can't find the reference... anyone here have the 'clojure best practice' github wiki?

16:40 Bodil: cemerick: Then, at a guess, Node would be faster than Phantom. Unless your code needs a DOM...

16:40 AtKaaZ: gfredericks: ohh i see now, it really does get the first element from the rest (after &) so all others are ignored

16:41 i take it that's idiomatic clojure to not throw when extra params are in fact ignored

16:42 Frozenlock: https://github.com/bbatsov/clojure-style-guide

16:42 AtKaaZ: thanks

16:42 TimMc: yedi: They're very different. I'm surprised you're ambivalent.

16:42 andyfingerhut: I'm taking a stab at writing up some documentation for people new to the read/read-string vulnerabilities, and what they can do about it in Clojure 1.5 and earlier versions.

16:43 Frozenlock: AtKaaZ: Well it will throw an error if you don't use &.

16:43 TimMc: andyfingerhut: You want readers?

16:43 cemerick: Bodil: it's mix across different projects. At the moment, I'm just basking in the rhino -> phantom improvement. :-)

16:43 andyfingerhut: TimMc: Definitely, and correcters when I have something, because I'm sure I'll get some of it wrong.

16:43 AtKaaZ: Frozenlock: true, i was only saying for things like [ f & [silently]] anything other than first after f is ignored silently :D

16:44 cemerick: rhino + *headed* browser REPL for DOM-related tests :-x

16:44 metellus: ,((fn [&] :a) 1 2 3)

16:44 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: sandbox$eval87$fn>

16:44 Frozenlock: andyfingerhut: how about "and the read-string will not just read, it will also eval, even if you have a seperate eval function. Be careful not to be #=ed."

16:45 cemerick: andyfingerhut: you have a paste/gist/etc somewhere?

16:45 AtKaaZ: ,(quote 1 2 3)

16:45 clojurebot: 1

16:45 AtKaaZ: that's an example :))

16:45 andyfingerhut: I was going over some of the #clojure IRC logs from a couple of days ago, and learned there about a potential security vulnerability in Clojure 1.4 even if you use read/read-string while *read-eval* is false. It was something involving record literals not being governed by *read-eval*.

16:45 AtKaaZ: ,(var defn 2 3)

16:45 clojurebot: #'clojure.core/defn

16:45 andyfingerhut: I'd like to include an example of what kinds of malicious things people could do with that, if they are relatively short, so more people can be aware of it.

16:46 hiredman: ,(type (read-string "`String"))

16:46 clojurebot: clojure.lang.Cons

16:46 andyfingerhut: Frozenlock: I'm hoping for something more detailed than that :)

16:46 cemerick: Not yet. Will send out a draft when I have one.

16:47 hiredman: ,(type (read-string "#java.lang.String[Foo]"))

16:47 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.String>

16:47 hiredman: causes arbitrary class loading

16:47 Frozenlock: I still find it mindbogglingly confusing that a 'read' function doesn't just read. (And I don't care if it was how it was done in the CL world)

16:47 hiredman: which causes static inits to run

16:48 TimMc: Frozenlock: It feels like there should be a reader, an X-er, and an evaluator. (For some term "X" which I haven't figured out yet.)

16:48 ordnungswidrig: TimMc: X-er ist not that bad for a name

16:48 Frozenlock: x-er?

16:48 andyfingerhut: hiredman: Is there a short example that would make it blindlingly obvious to the slowest observers (e.g. me) how that could be leveraged into a very bad thing like removing files or opening a socket to an arbitrary machine?

16:50 TimMc: Frozenlock: I have't figured out what the word would be, therefore "X".

16:50 andyfingerhut: hiredman: assuming a JVM like Oracle 1.6 or 1.7, for example?

16:50 TimMc: I hope that doesn't stick.

16:50 hiredman: andyfingerhut: aot compiled namespaces are class files with a a big static init

16:51 TimMc: hiredman: So you could load a namespace that has side-effecting defs?

16:51 What are the consequences?

16:51 hiredman: andyfingerhut: I'd have to think about it, it is tricky because you cannot really run code besides static inits and constructors

16:51 Frozenlock: I understand 'read' and 'eval'. I'm under the impression that there's some kind of 3rd functionality that was included to facilitate interop with he jvm, am I mistaken?

16:52 hiredman: you might be able to do some kind of ddos of file handles?

16:52 ,#java.net.Socket["google.com" 80]

16:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.SecurityException: denied>

16:52 ordnungswidrig: hiredman: nice

16:53 TimMc: Giant allocations, maybe>

16:53 hiredman: well that would work if it was not being read inside clojurebot's sandbox

16:53 (the socket thing)

16:53 TimMc: ,#java.util.ArrayList[1e10]

16:53 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: No matching ctor found for class java.util.ArrayList>

16:54 xeqi: I hear FileOutputStream makes files blank

16:54 Frozenlock: hiredman: even with *read-eval* to false?

16:54 hiredman: there is that

16:55 TimMc: I'd like to see read-edn split out as a separate library that old code can bring in as backporting.

16:55 s/old code/code reliant on 1.4/

16:55 xeqi: +1 TimMc

16:55 ordnungswidrig: TimMc: try 1e9

16:55 andyfingerhut: hiredman: Confirmed that with Clojure 1.4 your example causes the socket to open even when *read-eval* is bound to false. Thanks. I also like the ArrayList one.

16:56 TimMc: ordnungswidrig: Oh, was that a Long?

16:56 ordnungswidrig: a digit to moch

16:56 andyfingerhut: I also tried it on Clojure 1.5 latest master as of an hour ago, and it throws an exception about "Record construction syntax can only be used when *read-eval* == true", so that is an improvement.

16:57 TimMc: Oh, good to hear!

16:58 andyfingerhut: I'm not sure which commit changed that, but I may try to track it down.

16:59 xeqi: andyfingerhut: there is an email disclosing this by Cosmin Stejerean in the read-eval thread

16:59 I think rhickey mentioned when he fixed it

17:00 TimMc: OMG, Integer/getInteger -- I hate that so much.

17:00 andyfingerhut: Does anyone know off-hand what settings of the various *print-<foo>* vars, and which print-related Clojure functions, will restrict themselves to output that clojure.edn/read can handle?

17:01 TimMc: andyfingerhut: None, I think, since regexes aren't in EDN.

17:02 andyfingerhut: TimMc: So regexes are an exception which I will list. I'd like to list others, but if the "good data types" list is much shorter than the "bad data types" list, I'd like to give the shorter list.

17:05 TimMc: &(apropos "*print-")

17:05 lazybot: java.lang.RuntimeException: Unable to resolve symbol: apropos in this context

17:05 TimMc: &(use 'clojure.repl)

17:05 lazybot: ⇒ nil

17:05 TimMc: &(apropos "*print-")

17:05 lazybot: ⇒ (*print-radix* *print-miser-width* *print-pprint-dispatch* *print-suppress-namespaces* *print-right-margin* *print-pretty* *print-base* *print-level* *print-length* *print-dup* *print-readably* *print-meta*)

17:05 TimMc: I think only *print-dup* and *print-readably* are relevant here.

17:07 andyfingerhut: *print-level* should be nil, or large enough to avoid taking effect.

17:07 For many Clojure data types, one can have *print-dup* false and still round-trip via print then clojure.edn/read, correct?

17:12 hiredman: andyfingerhut: prn, yes

17:26 jodaro: so

17:26 i'm a windows idiot

17:27 i'm trying to read a directory thats a .lnk

17:27 with clojure.java.io/file

17:27 but

17:27 no bueno

17:54 yedi: how can i reload project.clj from emacs/nrepl?

17:54 i keep getting defproject doesn't exist errors

17:55 aaelony: A call like (clojure.xml/parse "http://search.twitter.com/search.atom?&amp;q=clojure") will parse an xml web service, but what if I first need to stuff an api-key into the Header. Is this possible to do with clojure.xml/parse ? How can I add a header?

17:55 yedi: i've been restarting emacs to get around it

17:56 ivan: jodaro: .lnk-following is really an explorer.exe feature, though it can be done if you really want it

17:56 you can also have real symlinks on Windows if you really want them

17:57 jodaro: ivan: thanks. i'll look into that

17:57 amalloy: yedi: don't restart emacs, restart your nrepl session

17:57 changes to project.clj can't impact already-running processes

17:57 ordnungswidrig: does lein.el work?

17:57 ivan: default settings require elevation to create a symlink, and you can't change the destination's folderness without recreating it

17:58 amalloy: ordnungswidrig: probably not; i've never heard of it

17:58 ordnungswidrig: https://github.com/technomancy/lein.el.git

18:00 amalloy: neat

18:01 jodaro: ooohh

18:01 i need that

18:02 AtKaaZ: ,'``````'1

18:02 &```````'1

18:02 clojurebot: Execution Timed Out

18:03 AtKaaZ: should be stack overflow:)

18:03 ivan: I get "Invalid method Code length 594054 in class file user$eval3047" after a few seconds

18:03 AtKaaZ: on the first one

18:04 ivan: ah, yes

18:05 the output of this makes Emacs' word-wrapping unhappy

18:05 AtKaaZ: I could use some word-wrapping in ccw repl

18:08 Frozenlock: Can a clojure program add files itself into the resources directory once it has been uberjared?

18:08 warz: is there a way to specify a string without having to escape back slashes? like, in C# for example you can do @"c:\users\foo"

18:09 AtKaaZ: Frozenlock: probably would work if the .jar wouldn't be locked when running

18:09 Frozenlock: Hmm... well then, I'll just spit it in the (System/getProperty "user.home") directory

18:10 amalloy: Frozenlock: the resources *directory*, of course. but not the entry in the jar file; java runs with jars opened read-only

18:10 AtKaaZ: ah, I assumed that is inside the .jar for some reason

18:11 Frozenlock: amalloy: bummer. Yet I'm sure there's a whole lot of reason why it's better this way.

18:12 amalloy: yes

18:15 yedi: am i getting this error because templates/hello-dress.html can't be found? https://gist.github.com/yedi/4747527

18:16 AtKaaZ: i blame idiomatic clojure coding :)

18:21 holo: hi

18:21 cshell: hi

18:23 holo: is there some lein plugin to scan for unused forms declared in the ns?

18:24 i'm doing some heavy refactoring, and it is time consuming to manually scan them

18:25 cshell: holo: if you use require :as you can see them pretty easily

18:27 hyPiRion: holo: There's always Slamhound

18:27 https://github.com/technomancy/slamhound

18:27 holo: cshell hi! as referenced in http://dev.clojure.org/display/design/Library+Coding+Standards -> "Be explicit and minimalist about dependencies on other packages. (Prefer the :only option to use and require)" which i agree with, except that for this situation is not being an advantage

18:29 "Slamhound rips your ns form apart and reconstructs it. No Dutch surgeon required." haha .. thanks hyPiRion

18:29 yedi: any help: https://gist.github.com/yedi/4747527#file-gistfile1-txt-L10

18:32 holo: yedi, are you getting the database env?

18:33 yedi: holo: huh?

18:35 holo: yedi, aren't you using a db? usually i get nullpointerexception when i forget to load the environment variable. just a wild guess

18:36 yedi: holo: ah, i don't believe that is it. the call to the deftemplate macro doesn't touch the db

18:37 tomoj: why don't symbols resolve at read time?

18:37 Frozenlock: ,(quote [1 2] [3 4])

18:37 clojurebot: [1 2]

18:38 tomoj: so that macro writers can do crazy stuff?

18:38 oh, no

18:39 there would just be no way not to get resolution like there is for keywords

18:40 holo: yedi, skateproj.routes really has that name in the filesystem?

18:41 i mean skateproj/routes

18:41 yedi: src/skateproj/routes.clj

18:42 oh

18:42 the templates/dress-page-html is stored in top level directory

18:43 so templates is on the same level as project.clj

18:43 holo: oh..

18:43 yedi: i updated the gist: https://gist.github.com/yedi/4747527

18:44 so... the file is being found yet i still get the NPE (and research shows that generally NPE means enlive can't find the resource html file)

18:45 holo: yedi, i think you should store it in the path for the resources

18:47 yedi: is there an easy way to add directories to the class path

18:48 i'm using lein

18:48 looks like resource-path might do it

18:51 holo: yedi, if you put inside the existing resources path, can't you use a relative path for the file?

18:52 yedi: holo: sorry i don't follow

18:54 holo: yedi, don't worry, it's probably my english. if say, your resources path is /resources/ and you put the file in /resources/templates/ , then you can try (html/deftemplate dress-page "templates/dress-page.html"

18:55 yedi: holo: ah right, that's what imma attempt to do

18:57 amalloy: so i tried your tip of reloading nrepl instead of restarting emacs, but then i just started getting namespace not found errors after nrepl restarted

18:57 this occurs even when evaluating the ns form...

19:18 Frozenlock: Is there a way to make sure a namespace has some functions already loaded? Something like (with-refer some-ns (load-file "my-clj-file"))

19:19 arohner: Frozenlock: you mean like require?

19:21 Frozenlock: Yes, but from outside the file loaded. Load this file, and make sure those functions are available for it.

19:22 Hmm.. I could make a with-require macro... (with-require (load-file))

19:27 callenbot: alright, I've made a huge mistake

19:27 I switched away from noir cookies and it's not working.

19:27 I'm trying to use vanilla Ring sessions with an encrypted cookie store..

19:28 Frozenlock: You moved away from noir or noir-lib?

19:28 callenbot: lib-noir

19:28 Frozenlock: er, lib-noir :p

19:28 callenbot: I haven't completely moved way, but I'm trying to.

19:28 I can't get these stateless sessions working though

19:28 abp`: callenbot: How so?

19:29 callenbot: I don't think the sessions are surviving across a redirect. I'm not sure though.

19:29 I'm using Ring redirect an assoc'ing the :session though

19:30 does anyone know of a particularly good example of how to use Ring sessions?

19:30 I didn't find anything compelling or that seems to work.

19:34 abp`: callenbot: When do you assoc on :session?

19:35 callenbot: I'll just pasta.

19:35 abp`: callenbot: Sure

19:36 callenbot: abp`: https://www.refheap.com/paste/11133

19:36 abp`: what am I fucking up?

19:40 abp`: callenbot: compojure.handler/site already does wrap-session. Try passing {:session options} to site

19:40 callenbot: abp`: thanks

19:41 technomancy: ordnungswidrig, amalloy: lein.el doesn't really work yet unless the emacs instance doesn't have a project-level nrepl session

19:41 I haven't adapted it to support a lein nrepl session and a regular one at the same time

19:41 callenbot: abp`: made the change, still not working.

19:41 abp`: callenbot: Don't know if that's all, but first thing standing out.

19:44 callenbot: Everything else looks good I think. Is your session-data in resp when printing from login-page handler?

19:45 sritchie: hey -- are any of you guys running multi-module projects with leiningen?

19:46 callenbot: abp`: I just got it working now

19:46 abp`: callenbot: Ok. What was the problem?

19:46 callenbot: abp`: I had to put (site ...) after some user middleware.

19:48 abp`: callenbot: Oh sure.. To have access to the session.

19:54 yedi: how exactly would i go about composing templates in enlive?

19:55 callenbot: yedi: a few points of order

19:55 yedi: 1. don't

19:56 yedi: 2. use something else

19:56 yedi: 3. reserve enlive for scraping

19:56 abp`: Rescue him!

19:56 Raynes: yedi: A few points of order

19:57 yedi: 1. Ignore callenbot.

19:57 yedi: 2. Use laser because I wrote it and I'm pretty great.

19:57 callenbot: yedi: 1. laser is cool, clabango is better.

19:57 yedi: 2. I'm a bot, don't listen to me

19:57 yedi: 3. Black metal is awesome.

19:57 Raynes: yedi: 3. Use fragments, pass them to other fragments, and pass it to a document. Etc. They're just functions. They compose normally.

19:57 yedi: callenbot: i like the idea of having my designer have access to the html

19:57 Raynes: :p

19:57 yedi: Raynes: i'll check out laser

19:57 callenbot: yedi: good thing Clabango lets you do that.

19:58 yedi: look at Clabango. Give it a shot.

19:58 yedi: https://github.com/bitemyapp/neubite/blob/master/src/neubite/templates/base.html

19:58 yedi: https://github.com/bitemyapp/neubite/blob/master/src/neubite/templates/index.html

20:00 yedi: looks like what django uses

20:00 and that's not exactly the html... though it might be good enough

20:02 callenbot: Raynes: bot: 1 Raynes: 0

20:03 abp`: *clapclap*

20:03 yedi: haven't chosen clabango yet =p

20:04 abp`: I just use hiccup.

20:04 yedi: but thanks guys, adding clabango and laser to my list of templating options will have a profound effect on the choice paralysis i was feeling earlier

20:04 callenbot: yedi: it's okay, you will.

20:04 S11001001: (inc Raynes: bot: 1 Raynes:)

20:04 lazybot: ⇒ 1

20:04 abp`: Bootstrap is my designer.

20:04 Formative builds my forms.

20:04 callenbot: abp`: he needs to work with a designer, like I do.

20:04 yedi: I can make it easy. Just use clabango.

20:07 yedi: raynes:

20:07 Raynes: yedi:

20:09 yedi: raynes: this line: "But darn it, we don't want all of our p to be omg. Let's only change the ones with the meow class!" possibly doesn't fit the code: (laser/document (laser/parse html) (laser/class= "meow") (laser/content "omg"))

20:09 won't that make all elements with the class meow have "omg"

20:09 and not just <p>

20:11 gfredericks: whistling (partition 5 1 (cycle major-scale)) is more difficult than I thought it was

20:45 callenbot: yedi: hey

20:45 yedi: sup

20:46 callenbot: yedi: use Clabango.

21:00 Raynes: callenbot: hey

21:00 callenbot: Walk off a balcony.

21:01 callenbot: Raynes: bots can't walk

21:01 Raynes: I'll take a flying leap with you in LA though :D

21:02 Raynes: :p

21:06 amalloy: yedi: presumably Raynes's tutorial is assuming that you haven't written non-p elements with class=meow

21:08 Raynes: yedi: amalloy is correct.

21:09 yedi: ok

21:11 cshell: If I have a vector that has alternating key and value (ie. [:a "a" :b "b]) what would be the right function to use to update the :b key? So I'd return [:a "a" :b "c"]

21:11 ?

21:14 callenbot: when does Clojure 1.5 go stable?

21:14 I'd like to stop using my dissoc-in shim.

21:17 amalloy: cshell: use a better data structure than that :P

21:17 cshell: amalloy: that's actually a good idea

21:17 amalloy: I must be tired

21:18 amalloy: thanks :)

21:33 gfredericks: clojure.java.jdbc/with-connection is deprecated?

21:34 * gfredericks huhs to himself

21:34 amalloy: callenbot: your statement seems to imply that clojure 1.5 contains dissoc-in

21:36 callenbot: amalloy: wait wait, it doesn't?

21:37 amalloy: the function is just as confusing as it would have been in 1.0; i can't think why you thought it was being added

21:37 what does (dissoc-in {} [:a :b :c]) return?

21:37 callenbot: an empty map

21:38 an untouched empty map.

21:38 amalloy: and why not {:a {:b {}}}?

21:38 callenbot: because the original assumption was invalid.

21:38 so best to leave it untouched.

21:38 the key path is speculative.

21:38 it's just saying, "remove if it's there, but don't sweat it if it's not"

21:39 amalloy: I see nothing confusing about that.

21:46 ivan: &(clojure.pprint/pprint 1)

21:46 lazybot: ⇒ 1 nil

21:46 ivan: &(clojure.pprint/pprint (range 40))

21:46 lazybot: java.security.AccessControlException: access denied (java.util.PropertyPermission line.separator read)

22:07 mdeboard: What does the last part of this error message correlate to? PDFEngineException com.callassoftware.pdfEngine.PDFEngine.throwIfError (:-1)

22:07 The (:-1)

22:07 I caught the exception, the actual error message is an empty string. Is it the exit code of the fn or what

22:13 TimMc: Line number? :-P

22:13 mdeboard: That's as reasonable as anything I could think of (nothing)

22:14 lynaghk: dnolen: ping

22:15 mdeboard: I'm kind of at my rope's end trying to implement this JNI wrapper class

22:17 TimMc: &:-1

22:17 lazybot: ⇒ :-1

22:18 TimMc: Maybe it's an emoticon.

22:18 mdeboard: lol.

22:18 "Just got out of the shower and smirking"?

22:18 TimMc: Impudent stack traces.

22:19 mdeboard: The stack trace == nil

22:24 TimMc: Right, it's failing to wrap the exception.

22:25 I hate that so much.

22:25 I mean, with event-driven programming, there's at least an excuse to lose the trace.

22:25 mdeboard: At least this way I get to laugh about it https://gist.github.com/mattdeboard/c1f11be5e11f096a6840

22:26 When you say "it's failing", what's "it"

22:26 TimMc: Whatever is catching and then throwing.

22:27 "throwIfError"

22:27 mdeboard: Failing to wrap the exception how? I'm not good with computer

22:27 TimMc: .printStackTrace always returns nil, by the way

22:27 amalloy: TimMc, mdeboard: (:-1) is a nil source file, line -1

22:27 mdeboard: oh, really

22:27 weird.

22:27 I have no idea what that means.

22:27 TimMc: mdeboard: Is this in the repl? Try (pst).

22:27 mdeboard: I mean, I know what nil means, but.

22:28 TimMc: Throwable.printStackTrace has a return type of void == returns null == nil

22:28 mdeboard: That did return some stack trace, cool

22:28 also, oh.

22:29 TimMc: I thought you meant that it was catching some error, discarding it, and throwing a new one in its place.

22:30 callenbot: is there a way to show private contribution activity on github?

22:30 mdeboard: ps is a proxy so maybe that's why it's saying (:-1)

22:30 callenbot: No

22:31 callenbot: mdeboard: balls.

22:31 mdeboard: yeah

22:32 callenbot: mdeboard: I'm up there with isaacs if you include my private activity. How disappointing.

23:03 dnolen: lynaghk: pong

23:05 lynaghk: dnolen: hey dude

23:05 dnolen: lynaghk: wassup?

23:05 lynaghk: I'm looking through the new unifier stuff, it's pretty rad

23:05 dnolen: lynaghk: yay!

23:05 lynaghk: had a few questions for you, but I think I've resolved most of them

23:06 dnolen: lynaghk: cool, I'm pretty happy w/ the changes

23:06 lynaghk: dnolen: one I haven't, though: if two records use unify-with-pmap* as their implementation for IUnifyWithRecord, then they should behave symmetrically

23:06 right?

23:06 clojurebot: to be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks

23:07 dnolen: lynaghk: hrm, that seems weird that a record would use unify-with-pmap* for their implementation of IUnifyWithRecord

23:07 lynaghk: dnolen: I'm doing it to ensure that things only unify with records of the same class

23:09 dnolen: but my question is: (unify [#my.A{:a 1} #my.A{:a '?a :b 2}]) should give the same result with the vector reversed, no?

23:09 dnolen: lynaghk: well it should fail

23:09 regardless of order

23:10 that different records should not unify isn't something I had considered - it should probably be handled

23:10 "had not considered"

23:10 lynaghk: why should it fail?

23:11 dnolen: lynaghk: those records have different key value pairs

23:12 lynaghk: dnolen: but if they're implementing unify-with-pmap?

23:12 dnolen: lynaghk: not a good idea IMO

23:12 lynaghk: partial map unification breaks associativity of unification

23:12 er

23:12 sorry

23:12 transitivity

23:13 lynaghk: dnolen: yeah, that has been my biggest concern.

23:13 dnolen: lynaghk: not worth it

23:13 lynaghk: partial map unification is only ok if the the thing that allows partial map unification is not "storable"

23:14 records are "storable"

23:14 it's for this reason that partial maps can no longer be bound to logic vars

23:15 lynaghk: dnolen: hmm. I'll see if I can figure out a nice way to do my rewrites without having all of the classes act like partial maps.

23:16 dnolen: lynaghk: so featurec is a constraint, so perhaps you can move those kinds of things into :when?

23:16 lynaghk: dnolen: yeah, that's exactly what I'm thinking

23:16 trof: guys, a small question, now that i've only started learning clojure, when i finish with the 4clojure tasks, do any of you have any projects where the additional pair of coding hands would be useful? i've been programming java for somewhile

23:17 dnolen: lynaghk: one issue, pointed out by hiredman, is that featurec should allow nested maps which it currently does not

23:17 trof: i mean, for free, for fun

23:17 lynaghk: dnolen: oh shit, I hadn't actually seen featurec.

23:18 dnolen: it looks like exactly what I'm trying to put together myself.

23:18 dnolen: lynaghk: yes featurec does what partial map unification did, but more sanely.

23:18 amalloy: trof: the usual answer to that question is: instead of asking for anyone who wants something, find a project *you* want to see improved, and improve it

23:18 trof: uhm, ok

23:19 amalloy: everyone turns out happier that way, generally

23:20 for example, if you've been enjoying 4clojure: what's a cool feature we could add? you could use that to learn web programming in clojure, if you're into that

23:20 lynaghk: dnolen: is it possible to use featurec with the simple unifier?

23:20 amalloy: but currently nobody works on it for months at a time, so it's not like we're in need of an extra pair of hands; it would just be if you find it fun

23:21 lynaghk: dnolen: it doesn't look like it.

23:21 dnolen: lynaghk: #(featurec % ...) doesn't work?

23:21 trof: i understand, thank you

23:22 lynaghk: dnolen: doh.

23:23 dnolen: yeah, that works.

23:24 dnolen: I'm going to need some time to stew on all of this and try my hand at some complex matches/rewrites. It all looks very promising, though---I'm jazzed =)

23:25 dnolen: lynaghk: sweet, let me know how it goes - more than happy to improve it

23:26 lynaghk: dnolen: cool, thanks. I'll update https://gist.github.com/lynaghk/4004131, hopefully making it a ton shorter.

23:28 dnolen: would you mind if I factored out the implementation of IUnifyTerms for maps into a unify-with-map* fn?

23:29 dnolen: lynaghk: go for it - send me a link to the changes so I can review before you push

23:29 lynaghk: dnolen: that way I can make records that only unify with other records of the same type without copy/pasting the implementation

23:29 dnolen: lynaghk: yes

23:29 lynaghk: okay. I'll put'em on my fork.

23:30 dnolen: lynaghk: sounds good

23:34 lynaghk: dnolen: https://github.com/lynaghk/core.logic/commit/388bcd865b4abe5837b96ba741c960c1a80bd3fe

23:41 zerokarmaleft: steev: just noticed you're in #nixos

23:41 yes, the package manager

23:56 yedi: is there really no way to reuse forms across different templates in enlive? how could people use it for templating then?

Logging service provided by n01se.net