#clojure log - Nov 23 2012

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

0:03 mrowe: flying_rhino: emacs/slime/swank works very well, but there's a fair learning curve if you haven't used emacs before

0:03 flying_rhino: mrowe: never used emacs before

0:03 mrowe: flying_rhino: it's definitely worth learning. but not really a "beginner's ide" :)

0:03 akhudek: flying_rhino: I use IntelliJ with the La Clojure plugin

0:04 flying_rhino: akhudek: intellij isn't free (not that I am aginst piracy)

0:04 akhudek: flying_rhino: there is a free version

0:04 mrowe: their "community edition" is free

0:04 akhudek: there is also eclipse + counter clockwise

0:04 mrowe: (and partly open source I think?

0:04 )

0:04 akhudek: but I've always found eclipse to be too slow and clunky

0:04 flying_rhino: akhudek: me too

0:05 ToxicFrog: I've been using IntelliJ. Not sure I'd call it a beginner's IDE, but it's more discoverable than vim/cream or emacs, at least

0:06 flying_rhino: but seriously you guys should have one click setup.exe that installs lein, along with some sort of starter-kit emacs. Even getting lein to work was PITA

0:06 muhoo: flying_rhino: i think that's lighttable

0:06 akhudek: http://www.lighttable.com/

0:06 at least that's the goal

0:07 flying_rhino: although now that I have lein, I just need IDE

0:07 muhoo: seriously, look at lighttable. i think the goal of it is a one-click dev env, and it has some very cool smalltalk-ide-like ideas in it

0:07 now, a mundane question: is anyone using bishop for web services, with friend?

0:08 bishop looks interesting, but i'm scratching my head on how to integrate the two.

0:08 flying_rhino: lighttable has rainbow parens? Neat

0:09 akhudek: flying_rhino: it's still a work in progress, though I know Chris (the author) uses it full time already

0:10 flying_rhino: akhudek: once I download the thing, how I hook it up with lein?

0:10 akhudek: there is a command "connect" that you feed your project directory

0:10 it does everything else automatically

0:12 Urthwhyte: I found vim+vimclojure to be quite easy to get going

0:12 slimv was another story

0:15 flying_rhino: so I create project vie lein

0:15 and then I tell it connect

0:15 and it connects?

0:15 *via

0:25 hey this lighttable seems to work

0:26 atom_: flying_rhino: +1 for intellij

0:26 flying_rhino: does intellij uses lein, too?

0:26 atom_: yes, you can

0:27 flying_rhino: are you using some sort of source control to monitor your progress?

0:28 flying_rhino: no

0:28 you think I should?

0:29 atom_: flying_rhino: I've found it to be a useful tool in helping me study/learn clojure. It's each persons own preference. I keep my notes on their as well using markdown.

0:30 ToxicFrog: <3 version control

0:31 flying_rhino: I'll need all these tools to sneak as much mutable state into clojure as I can so you'll curse me for all eternity. :P

0:31 okay not really

0:31 Bergle_1: ive been using lighttable a little, notthing serious, seems to work ok.

0:31 atom_: ToxicFrog: What's your flavor of choice?

0:32 ToxicFrog: atom_: git

0:33 atom_: ToxicFrog: Popular choice! I'm a Mercurial man myself

0:33 flying_rhino: okay I have connected to project via lighttable. What now

0:33 ?

0:33 ToxicFrog: Although I wouldn't hesitate to recommend hg as well, git's my personal pref

0:35 atom_: ToxicFrog: IMO they're both excellent and neither offers a huge featureset or advantage over another except in terms of adoption %

0:37 ToxicFrog: GitHub is probably the biggest benefit to Git. Personally I am a self-confessed FogCreek fan and so I use Kiln.

0:39 ToxicFrog: Hg, from what I've used of it, is more polished and has better windows support, but I find git more flexible.

0:39 And yeah, github is lovely.

0:48 flying_rhino: lighttable repl is totally badass

0:48 (still not sure how it works with projects)

0:48 thanks for recommendation

0:50 muhoo, akhudek thanks for recommending me lighttable

1:47 hakujin: exit

1:56 muhoo: any experience with bishop? is it useful? worthwhile?

2:00 brainproxy: muhoo: I've been using liberator, which I think was partially inspired by bishop

2:22 muhoo: brainproxy: thanks. how w well is it working out?

2:41 yedi: whats the fn to append two vectors?

2:43 foodoo: yedi: concat

2:43 andrewmcveigh: &(concat [1 2] [3 4])

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

2:51 yedi: thanks

2:51 can someone help me with this: https://gist.github.com/4134413

2:51 the map function doesn't seem to be getting called on the first item of the vector

2:52 jyu: why (map #(print (val %) (key %)) {:a :b :c :d}) have 2 additional nil in the result?

2:52 ivan: print returns nil

2:53 mapping with print like that returns a seq with two nils

2:54 yedi: also concat doesn't seem to be working

2:55 jyu: ivan: thanks

2:56 ivan: would I get rid of the nil to print string

2:58 ivan: I think you're always going to see the return value in the REPL

2:58 you can avoid using print if you want to see the returned seq instead

2:59 something like (dorun (map #(print %) [1 2 3])) will only print one nil in the REPL

3:21 flying_rhino: can you have inner function in clojure?

3:22 jakubH: letfn ?

3:22 p_l: or since clojure is (at least claims to) a lisp-1, normal let with lambda should be enough

3:28 rbxbx: yup, either form should work fine

3:28 flying_rhino: why my factorial function doesn't work

3:28 this works

3:28 (defn fac [n]

3:28 (if (> 2 n)

3:28 n

3:28 (* n (fac (- n 1))) ))

3:29 but when I replace fac with recur it doesn't work at all

3:29 *recur with fac

3:29 AimHere: That's because your call to fac isn't in the tail position

3:29 flying_rhino: it is last call

3:30 AimHere: No, you're actually multiplying it by n afterwards

3:30 flying_rhino: I see

3:30 so how to fix this thing

3:30 ?

3:30 AimHere: And because you're doing something to it, you can't tail optimize it

3:30 You have to rewrite it slightly more radically

3:30 jakubH: the typical solution is to pass n into the recursive call and multiple there

3:32 AimHere: If you do that, You might want to use 'loop' since otherwise you'd have to pass that temporary 'n' to fac along with the initial n parameter

3:32 jakubH: good point

3:33 AimHere: I'd rewrite it to something like like (defn fac [n] (loop [n n a 1] (if (> 2 n) a (recur (dec n) (*' a n)))))

3:34 But bleah, got to go work :(

3:36 flying_rhino: it worked

3:37 Mr_Bond: loop/recur can be used for so many things :)

3:38 flying_rhino: it is annoying that when using lightable instarepl it doesn't tell you where the problem is, it just doesn't work

3:48 yedi: rhyme-finder.core> (map test-prons (clojure.string/split poem-line #"\s"))

3:48 (["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"])

3:48 rhyme-finder.core> (concat (map test-prons (clojure.string/split poem-line #"\s")))

3:48 (["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"])

3:49 concat doesn't seem to be doing anything

3:50 oh, I had to (apply concat ...)

3:50 andrewmcveigh|w: &(apply concat (["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"]))

3:50 lazybot: clojure.lang.ArityException: Wrong number of args (5) passed to: PersistentVector

3:50 andrewmcveigh|w: &(apply concat '(["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"]))

3:50 lazybot: ⇒ ("ih" "t" "ih" "z" "n" "aa" "t" "k" "w" "ay" "t" "dh" "ah" "b" "eh" "s" "t")

3:52 andrewmcveigh|w: &(reduce concat '(["ih" "t"] ["ih" "z"] ["n" "aa" "t"] ["k" "w" "ay" "t"] ["dh" "ah"] ["b" "eh" "s" "t"]))

3:52 lazybot: ⇒ ("ih" "t" "ih" "z" "n" "aa" "t" "k" "w" "ay" "t" "dh" "ah" "b" "eh" "s" "t")

4:32 mammoth: one thing

4:32 generally the biggest complaint about clojure is that it doesn't have debugger that is any good.

4:32 is that complaint valid?

4:33 how do you debug large clojure codebase?

4:33 borkdude: valid, but the way of development is also very different from other languages, more interactive

4:33 REPL-oriented

4:34 mammoth and more debugging support is being worked on (I think)

4:35 mammoth furthermore, writing a good suite of tests always helps

4:35 mammoth: I am concerned for example I played around in lighttable instarepl and sometimes it doesn't tell me at all where is a bug, it just doesn't work

4:35 jakubH: lighttable isn't best for that, it still feels quite "alpha"

4:36 mammoth: yeah

4:36 p_l: borkdude: any comparison with SLDB under SBCL/CCL?

4:36 jakubH: I had similar problems there; but Eclipse+Conutercloclwise or Emacs+nRepl shall be much better

4:36 mammoth: jakubH: I actually like lighttable, it has great feel to it. But yeah it is alpha.

4:37 borkdude: p_l I'm no expert on that, but I saw a tweet from the conj about "better restarts than common lisp on the way" or smth, you should def. ask someone else who has been there

4:37 p_l: borkdude: somehow I doubt the claim... at least as long as it runs on JVM ;P

4:37 jakubH: Yes, it has high "coolness factor" :-) I am looking forward it being more mature

4:38 p_l: lighttable for is disqualified by nature of the platform it's implemented on

4:38 *for me

4:39 jakubH: you mean clojurescript?

4:39 borkdude: if you disqualify clojure because of its host platforms, you shouldn't be looking at clojure in the first place

4:40 p_l: jakubH: browser

4:40 borkdude: I don't disqualify clojure itself.

4:41 jakubH: Come on, where do you live? If it doesn't run in the cloud, it isn't cool anymore! *just kidding*

4:41 p_l: jakubH: Chrome is a synonym for "Six Gigabytes and Constantly Swapping"

4:41 jakubH: :)

4:41 p_l: that's on light use

4:42 mammoth: so far my complaints about clojure are:

4:42 jakubH: Well, if you are used to Java + Websphere + IBM Software Developer as I was, you would certainly miss not to have that & swapping :)

4:43 p_l: jakubH: I'm used to having >200 tabs open

4:44 Chrome dies at 15

4:44 augustl: firefox is apparently much better at having a gazillion tabs open

4:45 p_l: firefox has big up-front memory cost, but low memory use on top of that

4:45 augustl: p_l: then there's 32 bit vs 64 bit though, not that I know anything about the details there

4:45 p_l: Chrome noms memory like crazy and for long time was incapable of rate limiting its plugins

4:46 (I got 100% across multiple cores with about:blank as the only tab in Chrome once)

4:46 augustl: but I would assume chrome "solves" it by having multiple 32 bit processes. IIRC V8 has a limit of around 1gb of JS allocations per VM anyway.

4:47 rojepp: Who cares about 64-bit in a browser? If it needs more address space, time to find another browser`?

4:47 p_l: rojepp: I care about not having to support much 32bit software on my install

4:49 * p_l has been running nearly-pure 64bit system since ~2006

5:13 thorwil: i guess there is no "private, but still accessible for tests"?

5:14 augustl: rojepp: a gazillion tabs might need more than 4gb ram

5:32 thorwil: technomancy: i guess https://github.com/technomancy/leiningen/wiki/Upgrading should contain a note about using :profiles {:dev {:dependencies ... instead of :dev-dependencies. at least that fixed an issue i had, so i assume it's mandatory

5:44 oddy: ladys, gents, given that lein project definition is correct and has aot + main specified, under what conditions it won't find my class from aot namespace?

5:52 mpenet: oddy: missing gen-class in your main ns maybe?

5:53 oddy: mpenet: na, it's there. Runnable gets precompiled, but aot clases don't...

6:03 Anderkent: Any easier syntax for printing to stderr than (binding [*out* *err*] (prn ...)) ?

6:10 augustl: Anderkent: not that I'm aware of

6:25 wingy: what is the idiomatic style in https://www.refheap.com/paste/6927

6:26 alexnixon: wingy: the second

6:26 wingy: alexnixon: ok

6:29 is it idiomatic to indent the values so they start at the same line?

6:30 https://www.refheap.com/paste/6928

6:30 maybe not .. since that is house keeping work i perhaps don't want to spend time in

6:32 alexnixon: wingy: I'd generally not, as it's a maintenance burden and makes diffs nasty (imagine if you later added a :something-else-which-is-long key)

6:32 pellis: hey guys. I'd like to add a 'metrics' module (or what would be class?) to my project. what would be the idiomatic way to write it?

6:32 wingy: alexnixon: yeah

6:33 alexnixon: wingy: there are some guidelines here (although the issues you've just raised aren't covered): http://dev.clojure.org/display/design/Library+Coding+Standards

6:36 pellis: i'm wondering if to implement as a record or just a bunch of functions in a file

6:39 wingy: alexnixon: would the indentation style be an exception in https://www.refheap.com/paste/6929

6:40 or like this: https://www.refheap.com/paste/6930

6:40 alexnixon: wingy: you mean lining up the elements of the :providers array?

6:40 wingy: yeah

6:40 look at the latest one

6:41 which one is preferred .. the second one follows the first recommendation

6:41 and you don't end up with them too far to the right if the :key is long

6:43 alexnixon: I can see arguments for both, though personally I'd prefer the first as I find it easier to read

6:44 wingy: yeah

6:44 ill just stick with the first one then

6:46 Anderkent: wingy: there's no hard rule. Do whatever looks right. I like to align values as long as key are similar length, and split keys and values on separate lines if keys are very long

6:47 wingy: on the other hand your 1-space indent looks really weird to me :P

6:48 wingy: Anderkent: one space indent where?

6:48 you mean for the first [

6:48 Anderkent: everywhere, pretty much? The first { for example

6:48 wingy: got it from datomic examples

6:48 Anderkent: well, to each his own. As long as you're consistent, it's fine.

6:49 Anyway, anyone have any tips for debugging Midje tests? I'm having issues with prereqs - it's not calling the prereq even though the arguments seem to match.

6:49 wingy: https://www.refheap.com/paste/6931

6:49 Anderkent: (i.e. it says 'You never said __prereq__ would be called with these arguments:...')

6:50 wingy: the first one defintely looks weird .. so perhaps the second one? or the "datomic" one?

6:50 i'll stick to the second one .. one space indent looks weird

6:50 Anderkent: wingy: yes, you definitely should align the :keys

6:56 (nevermind my midje question, I'm just bad at eyeballing strings)

7:19 Chiron: Hi , I generated pom file via lein pom . what are the equivalent lein's command for mvn ?

7:31 Anderkent: Chiron: which commands do you want?

7:32 Chiron: lein repl , lein deps , lein test

7:32 Anderkent: lein test will be mvn test, you don't need to do deps (it does it automatically), don't think there's a repl by defualt unless you add a plugin (maven-clojure-plugin or zi)

7:34 Chiron: what about lein compile >

7:34 ?

7:34 Anderkent: mvn compile

7:34 hm, i suppose for that to work it has to add some clojure plugin already, so you can try mvn clojure:repl for a repl

7:35 ah, it doesn't. Then you can't use mvn to compile it, I guess

7:36 unless you hack on the pom yourself

7:36 I think the purpose of lein pom is just so that you can expose your lein project in a maven repository

7:36 not to give you a maven dev setup

7:36 Chiron: i have a clojure project and we want to add it to jenkins . the team is employing pom files . yes there is jenkins-plugin for lein

7:37 oh, so lein pom is to jenkins-fiy the project?

7:37 if yes, then I'm done :)

7:37 Anderkent: I don't know, sorry! I suppose you can just shell out in jenkins if nothing else helps

7:38 Chiron: ok, thanks for help!

7:39 bbloom: in case anybody is up early and is looking for a nice long blog post to read over their coffee...

7:39 http://blog.brandonbloom.name/2012/11/templating-clojures-backtick.html

7:44 augustl: bbloom: early is relative :)

7:45 p_l: 1241 UTC, The One Time Zone

7:45 bbloom: augustl: true, my apologies for addressing the US populous

7:46 augustl: afternoon coffee is also a good time to read a long blog post :-)

7:46 Anderkent: Soooo, compiling midje tests seems to take forever (good 20 seconds on some files). Any reason for that?

8:01 Bergle_1: bbloom 1. im a noob to clojure (worked through one book), 2. that backtick write up was interesting.

8:02 bbloom: Bergle_1: glad you liked it! as a noob, was it helpful for understanding syntax-quotes?

8:02 Bergle_1: yeah somewhat, i think i understood them mostly anyway. book ive worked through is Pragmatics "Programming Clojure 2nd Ed"

8:03 i liked the context in clojure and hte why of it.

8:03 bbloom: cool :-) well backtick is just the first stable piece of some larger cool bits i'm planning on open sourcing

8:05 I usually use outlining as a way to help myself understand things. basically write the outline of explaining it to someone else. unfortunately, it takes a long time to fully flesh out thoughts into a real post, but i decided it was time i started to do that.

8:06 Bergle_1: explaining verbally or written helps me think through stuff a lot.

8:06 been writing software in assorted context for 20+ years here ;)

8:07 bbloom: Yeah, I often must look like a crazy person talking to myself in gibberish. people walking by generally have no idea what a syntax quote is :-)

8:08 Bergle_1: get a wilson for your desk :)

8:08 thats a reference to movie Castaway :)

8:08 friend was solo at company doing dev for quite a while, so actually setup a wilson to talk to.

8:09 bbloom: Bergle_1: tried that. I've got a little yellow platypus with a microfiber screen cleaning cloth on his belly

8:09 Bergle_1: heh

8:09 bbloom: Bergle_1: doesn't help much.

8:09 and it's a terrible screen cleaner :-P

8:09 Bergle_1: actually verbalising helps me sometimes.

8:09 bordatoue`: Could anyone please helpme to identify what is actually wrong with a simple binding , I am getting unmatched delimiter exception (defn check-fn [arg1 arg2]

8:09 (let [check-arg2

8:09 (if (= (.indexOf arg2 '@') -1)

8:09 "-1"

8:09 (.indexOf arg2 '@'))]

8:09 (println check-arg2)))


8:09 http://hastebin.com/vepovubiqe.lisp

8:10 sorry about that i pressed the wrong key, really sorry..

8:10 bbloom: bordatoue`: apostrophe is not how you represent a character

8:10 bordatoue`: use a backslash:

8:10 &(class \@)

8:10 lazybot: ⇒ java.lang.Character

8:11 bordatoue`: bbloom: thanks very much , the error was misleading

8:11 bbloom: would you be able to tell me why i got an unmatched delimiter exception when i used wrong representation for char

8:12 bbloom: bordatoue`: because ' consumes a token

8:13 bordatoue`: it's probably not precisely the right error message, but apostrophe acts like a prefix operator

8:13 bordatoue`: bbloom: thanks , so it might have taken it as a symbol

8:13 Bergle_1: i should have known better, tried intellij 12 eap version leiningen plugin project open stuff didnt work, and the La Clojure plugin isnt letting me run s-expressions in the clojure console, v11 seems fine :)

8:14 bbloom: bordatoue`: yeah, it's basically as if you had written (x +y+) in a C-style language. that second addition operator needs an operand

8:14 bordatoue`: bbloom: thanks very much for clarification .

8:33 Chiron: guys, I installed clojure-maven-plugin and run mvn clojure:repl but i got Exception in thread "main" java.lang.ClassNotFoundException: jline.console.completer.Completer

8:33 any ideas?

8:38 andrewmcveigh|w: Chiron: missing dependency?

8:38 Chiron: from my code or plugin's code ? because i don't use jline

8:40 andrewmcveigh|w: no idea? Somewhere in your deps?

8:41 mvn tries to compile everything before putting you into a repl, iirc, unlike lein.

8:41 Anderkent: Chiron: clojure-maven-plugin dynamically selects which repl backend to use depending on available jars

8:41 Chiron: apparently it thinks you have jline available while you don't

8:41 try adding reply or iclojure to your projects dependencies, see if it works then

8:41 Chiron: ok, thanks fellas !

8:42 Anderkent: https://github.com/talios/clojure-maven-plugin#jlineiclojurerepl-y

8:42 (if you can post your pom somewhere we might be able to trace the bug down and fix it ;P)

8:52 Nocab: anyone here using sublime-text and sublimerepl with clojure?

8:53 when I try to start the repl, I get a new editor tab with the repl, Im able to write text there, Im able to transfer code tehre

8:53 but it seems like whatever I do, the code never gets executed

8:53 I just get the one first "current-namespace=>" prompt and thats it

8:55 hcumberdale: Hi, lein compile starts jetty

8:56 So it never ends

8:56 How can I change that?

8:56 gfredericks: hcumberdale: you're probably starting jetty at the top level of your file

8:56 hcumberdale: this is for a ring server?

8:56 Anderkent: hcumberdale: stop your code from starting jetty when compiled

8:56 Nocab: Anderkent: that sounds like the advice I was given when debugging some multi-threaded code

8:57 Anderkent: I know, sorry

8:57 Nocab: "stop writing buggy multi-threaded code"

8:57 to be honest, the response made me grin :D

8:57 hcumberdale: it is actually aleph

8:57 Anderkent: not much more that can be said though, the issue is obvsly in his code not usage of lein :P

8:57 Nocab: mhm

8:57 hcumberdale: (defn -main [] (start-http-server (....

8:57 gfredericks: hcumberdale: that looks reasonable -- so it must be that -main is being called somehow on compile?

8:57 Anderkent: hcumberdale: does it tell you which file it's compiling when it starts the server?

8:57 hcumberdale: in project clj >> :main projectname.core

8:58 It's only one file in the project

8:58 'core'

8:58 Anderkent: can you upload it perhaps?

8:58 hcumberdale: which contains -main

8:59 gfredericks: for sanity checking you could wrap the start-http-server call in (when-not *compile-files* ...)

8:59 Anderkent: lein question: I have an old project that depends on clojure 1.2 and clojure contrib 1.2. When I do lein deps; lein test, it complains about contrib not being on classpath, but when I do lein uberjar the contrib jar is there. Ideas?

8:59 hcumberdale: I've found 2 solutions on google

8:59 Anderkent: lein deps also doesnt seem to be doing anything

9:00 hcumberdale: (defonce server (atom nil)) (reset! server (ring.adapter.jetty/run-jetty ,...

9:00 gfredericks: Anderkent: lein 1 or 2?

9:00 Anderkent: 2

9:00 hcumberdale: lein2

9:00 Anderkent: I can see the contrib jars in my .m2/repository

9:00 gfredericks: Anderkent: `lein deps` I think just checks that you have the relevant jars in your ~/.m2; I also don't think there's normally any need to call it directly

9:01 Foxboron: Morning Clojurians

9:05 pellis: how can i make an atom from a string?

9:05 i.e. "production" to :production ?

9:05 gfredericks: s/atom/keyword/

9:05 ,(keyword "production")

9:05 clojurebot: :production

9:05 gfredericks: atoms are reference types

9:06 pellis: thanks

9:16 Foxboron: SO getting The Joy of Clojure, Clojure Programming. Any recommended LISP/Clojure book?

9:17 gfredericks: SICP has probably been recommended for decades now

9:17 Foxboron: ugh, a little expensive for me atm :/

9:18 ohwait, the hardcover costed a lot more.

9:20 Nocab: Foxboron: iirc SICP is available as a free e.pub or .mobi

9:20 and if you ahve to pay for, it's probably one of those books where it's REALLY worth it

9:21 I mean, it's the only programming book which has wowed me

9:21 it's on another level than most other books out there. it focuses on computing, problem solving in a very educational, academical manner.

9:21 * gfredericks has not read it

9:21 Nocab: that it uses lisp for its demos is just a bonus ;)

9:22 gfredericks: its next on your list now :P

9:23 gfredericks: Nocab: it's been in the back of my head for a few years

9:23 I have an automatic hesitancy to learn anything related to other lisps

9:23 Nocab: ah well. just saying. its one of those books which just makes you want to read more :)

9:23 its very focused on problem solving

9:23 lisp oriented problem solving

9:23 gfredericks: though now that I say it I remember abedra recently convinced me to learn scheme

9:24 Nocab: that it uses scheme is just an implementation detail ;)

9:24 I find myself reading the book thinking "i want to try this out in clojure"

9:24 makes it doubly educational

9:25 its (IMO) fundamentally different from all other programming language books I've read

9:25 most books gives you "learn how to program language X"

9:25 this book gives you "learn how to solve lots of computing languages in language X, including how to make a language X interpeter in language X"

9:26 Foxboron: interesting

9:26 I will look at it :D

9:26 Nocab: s/computing languages/computing problems/

9:26 but yeah

9:27 Foxboron: joy of clojure is also recommended btw

9:27 so not saying you shouldnt read that

9:27 clojure has a ton of specifics which is best learned in a clojure-specific book

9:28 Chousuke: lately I've had a rekindled interest in learning haskell. lisps are cool but some of the abstractions they have in haskell-land are mindblowing

9:28 Foxboron: Nocab, i have actually red Joy of Clojure... 1 and a half chapter

9:28 (ebook)

9:28 also read Clojure programming a tad.

9:28 Nocab: ah ok

9:28 Foxboron: So i read protions of them before buying, always.

9:28 portions*

9:28 Nocab: Chousuke: yes. but... its just too much magic. there are too many leaps of faith for my taste

9:28 Chousuke: just a couple days ago I encountered something that the author called a TARDIS :P it's a combination of the state and reverse state monads

9:29 Foxboron: What thre mew off SICP is that on amazon.co.uk it got 14 1 star reviews and 16 5 star

9:29 Chousuke: Nocab: nah, that's the thing. there's no magic.

9:29 there are just bloody awesome abstractions

9:29 Nocab: I find haskell too different from other languages to bother

9:29 I mean... thats a good thing for a lanaguge, to be differnt, not to be a complete rehash of something already out there

9:30 but I only have so much time, and I just cant bother investing time in it :)

9:30 Chousuke: so, with this tardis monad you could model an algorithm that recurses over a list and sends data from the latter recursions to the earlier ones and vice versa

9:30 it was crazy

9:30 all purely functional, of course

9:31 Nocab: yes yes

9:31 there are lots of cool things Ive seen you can do

9:31 but all the explanations of HOW things works seems to pre-suppose that you already understand it

9:31 which sorta defeats the point :P

9:31 Chousuke: if anything, I think everyone should take the time to read typeclassopedia.

9:32 it does a good job in explaining some of the core ebstractions and why they are awesome

9:32 Nocab: http://www.haskell.org/wikiupload/d/df/Typeclassopedia-diagram.png

9:32 you mean this? :P

9:33 Ive tried reading up on category-theory instead of haskell, to get a higher level understanding on the subject

9:33 it failed :P

9:33 Foxboron: lol

9:34 borkdude: is it possible to write filter with reduce somehow?

9:34 Chousuke: Nocab: honestly, category theory is not needed to understand anything that exists in haskell.

9:34 Foxboron: So if i order Joy of Clojure, Clojure Programming and SICP from amazone.com, it costs 77 dollar, aka 435 Norwegian Kroner, if i just order Clojure Programming and Joy of LCojure from amazone.co.uk it costs me the same :P

9:34 Chousuke: well, maybe except some of the crazier thing

9:34 s

9:34 Foxboron: thats one heck of a difference

9:35 HolyJak: Foxborn: sa du norsk kroner? Flott :-)

9:35 Foxboron: Hahahaha

9:35 Neimen, sku du ha sett :D

9:35 Nocab: jaja

9:35 dette er en engelsk kanal :P

9:35 Foxboron: i know :3 you started .3

9:36 :3*

9:36 Negdayen: borkdude: do you mean implement filter by using reduce, or combine filter and reduce into one function? either way, the answer is yes :-P

9:36 borkdude: Negdayen implement filter by using reduce

9:36 HolyJak: :-) Hope to meet you in the ^{Oslo "Socially Functional Programmers" if you're in Oslo

9:36 Nocab: Im sure it can be said that filter is a special implementation of reduce :P

9:37 gfredericks: Nocab: though it's lazy while the reduce version wouldn't be

9:37 Foxboron: HolyJak, i am actually in Bergen :P Going to a Beer and Programming session soon :)

9:37 SHould note i started CLojure last week, and still don't know much about Functional programming yet ^^

9:38 HolyJak: good luck then :)

9:38 gfredericks: anybody awake at this time of day have any guesses about why ##(.seq {2 2})

9:38 lazybot: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap

9:40 ambrosebs: Was thinking of proposing Typed Clojure for contrib. Thoughts?

9:41 Chousuke: cool.

9:41 gfredericks: as some who hasn't tried typed clojure yet, I am all in favor of that.

9:41 Chousuke: I'll actually have to try typed clojure someday

9:42 see what I can do with it.

9:43 ambrosebs: Cool. was thinking a name like core.types or core.typed.

9:44 gfredericks: core.picky-compiler

9:44 Chousuke: what's the status of the library atm? can you only do type checking or is it possible to eg. make macros that have different results depending on the types of the objects?

9:44 gfredericks: ambrosebs: I did spend half of a day reading half of your thesis and got fully excited about it

9:45 ambrosebs: Chousuke: It's very much a 0.1 prototype atm. But so far Typed Clojure has no effect on compilation.

9:45 Focus on safety

9:46 IMO TC is a basic framework that people can build such things out of.

9:47 qroc: Chousuke, what I feel the problem is with the films of the Wachowskis is that they are like 'just barely not good'

9:47 Chousuke: I think core.typed is the better name

9:47 qroc: Which is worse than bad, because you're watching them and you're like 'Well, this is a decent concept, if this and this was different it would've been a good flick' and it keeps nagging you

9:47 Chousuke: types kind of implies it will define some types that you can then use, instead of defining an actual static type checker.

9:47 gfredericks: Chousuke: agreed

9:48 ambrosebs: Right. My concern is that "Typed Clojure" implies "a version of Clojure that is typed". Which is totally incorrect.

9:48 Chousuke: ambrosebs: or you could just make it core.typechecking

9:48 ambrosebs: core.typed is perhaps less susceptible to that misconception.

9:49 pellis: any idea how to make my redis instance available to all modules? *cough*global variable?*cough*

9:50 ambrosebs: Seems a bit watered down, since it's a "type system"

9:50 Chousuke: core.silverbullet :>

9:51 ambrosebs: pow

9:51 gfredericks: core.scala

9:51 ambrosebs: core.typed-clojure

9:51 Chousuke: well, if it's a typesystem... it could just be core.typesystem

9:51 andrewmcveigh|w: core.tysy

9:51 ambrosebs: haha that just sounds so cold and dead.

9:52 core.typed allows you to keep informally calling it Typed Clojure

9:53 Chousuke: core.want-a-haskell :P

9:53 ambrosebs: tough act to follow :)

9:53 qroc: Are we talking about a fully fledged type hierarchy

9:53 Chousuke: but yeah, I think typed is fine

9:53 qroc: specfically, do we get that (if cond then else) is typed as the union of then and else?

9:54 And if a continuation demands a certain type, it can consume that type and all its subtypes.

9:54 And do we get type variables?

9:54 Else Chousuke doesn't approve.

9:54 Only the finest type systems for the finest finn in this channel, 'tis as eating less than top quality reindeer.

9:54 Chousuke: :P

9:55 qroc: Chousuke, how does one pronounce Chousuke?

9:56 Chousuke: hm, I don't have a way of typing IPA

9:56 qroc: Hmm

9:56 gfredericks: let's just say chouSOOkee and let everybody interpret that how they will

9:56 qroc: Well, tiousukei, tiousookii?

9:56 tiousuuk?

9:56 Chousuke: the su and ke are short.

9:57 ambrosebs: qroc: lol? Sounds like Typed Clojure

9:57 qroc: gfredericks, Chousuke is the finest finn in this channel built from the finest of ruisleipä

9:57 ambrosebs, is that bad?

9:57 Chousuke: :P

9:57 * Nocab calls it weekend

9:58 qroc: Behold how fine he is: Chousuke: istu, koira.

9:58 ambrosebs: qroc: haha I just missed the relevance of listing those features :)

9:58 qroc: Well, I'm asking if it has them

9:58 not listing them.

9:58 ambrosebs: yes!

9:58 qroc: Excellent

9:58 Chousuke: ambrosebs: now I want to test if I can bend TC to implement monads so that I can choose the monad operations to use without actually explicitly choosing the monad like in contrib monads

9:59 qroc: so we're not talking about some kind of stupid hindly-milner like system that Crapskell has?

9:59 ambrosebs: Chousuke: that would be badass

9:59 qroc: we're talking Typed Racket.

9:59 qroc: Ah yes

9:59 excellent

9:59 ambrosebs: indeed

9:59 Chousuke: but alas, I am required to be elsewhere right now, so it will have to wait.

9:59 qroc: As expected from the finest of Finns in this channel, nyt istu, koira.

10:00 Chousuke: :P

10:00 qroc: Siis mä syötän sut ruisleivällä

10:01 syötän suomalaispäähäsi

10:01 Chousuke: I still fail to understand what you are trying to accomplish with your random Finnish

10:02 hughfdjackson: what determines what gets in core?

10:03 Chousuke: rhickey, mostly.

10:03 hughfdjackson: makes sense ^^

10:03 qroc: hughfdjackson, the finest les miserables fan in this channel.

10:03 Chousuke: contrib may have an easier process, dunno.

10:03 qroc: Chousuke, learning to speak the finest Finnish in this channel of course.

10:04 Chousuke: You should join Finnish channels for that instead.

10:04 qroc: There is one, it has 4 users.

10:04 Chousuke: join and spectate

10:04 qroc: Oh, in that way

10:04 Yeah, I am in #starcraft2.fi on quake

10:04 there too, I speak the finest finnish

10:04 And they are like 'this guy is insane, let's not ban him because it's hilarious'

10:04 * gfredericks just realized that /finest fin*/ is phonetically intentional

10:04 Chousuke: yeah, well, that's what you make yourself look like most of the time.

10:05 hcumberdale: does rhickey join #clojure frequently?

10:05 Chousuke: but I have to be going now, so later :P

10:06 qroc: Chousuke, what is insanity but a square man's term for interesting?

10:07 Chousuke, jos olisin kissa, mulla olisi pyörät ja olisin robokissa.

10:07 nopeain kissä maailmalla

10:20 brainproxy: Chousuke: you get something like that with protocol-monads

10:22 gfredericks: if you try to define monads with protocols don't you run into an issue with pure?

10:23 brainproxy: gfredericks: i'm not sure what you mean, can you elaborate?

10:23 gfredericks: brainproxy: (pure 42) should return what type?

10:24 or I guess the haskell term is (return 42)

10:24 brainproxy: so, if I understand correctly, w/ protocol-monads that's basically inferred or made explicit with a factory function

10:25 e.g. (monads.core/plus [(list 1) (list 2)]) will use the monad defined on clojure.lang.PersistentList

10:25 because list returns type clojure.lang.PersistentList

10:25 gfredericks: sure

10:25 but with return you don't have an instance on hand whose type you can dispatch on

10:26 brainproxy: right, so that is a limitation but also "feature" of how p-m works

10:26 gfredericks: so you define a separate return for each monad?

10:26 brainproxy: yep, called "do-result"

10:26 gfredericks: gotcha

10:26 kthx :)

10:26 brainproxy: there is also "do" notation

10:27 (m/do list [...] expr)

10:27 and optional return-type checking

10:27 gfredericks: I wanted the writer monad the other day

10:28 brainproxy: (binding [m/*check-types* true] (m/do list [x (list 1 2) y (into #{} (list 2 4))] [x y])

10:28 will throw an exception

10:28 since #{2 4} doesn't satisfy java.util.List

10:29 trivial example, but anyway that's the idea

10:29 gfredericks: cool

10:29 brainproxy: and the writer monad is available

10:29 as is writer transformer

10:29 I ported over the examples from algo.monads, here: https://github.com/michaelsbradleyjr/protocol-monads/blob/master/src/monads/examples.clj#L248

10:30 there are two writer monad examples in there

10:30 but no writer-t examples

10:30 btw, my work is not merge back into the parent project, but my 1.1.0-SNAPSHOT is available on clojars

10:31 just search for monads

10:32 all in all, i'd say the library is still pretty rough around the edges, but usable

10:34 pellis: im stuck

10:34 if I implement an abstraction, as a protocol, lets say Engine

10:34 and now i implement a concrete defrecord V8Engine

10:34 and now I want the V8Engine to be available to every module in my code - what should I do? usually in Java i'd put it in an IoC container

10:39 lucian: pellis: what's wrong with importing it?

10:40 pellis: well it would make a new instance of it every time - i want what would appear as a singleton

10:41 lucian: pellis: then you can make an instance of it in a module and import that

10:41 pellis: i wouldn't know how to configure it until runtime

10:42 i have the 'core' application, loads up the configuration, and then its responsible to set up all of the database connections, etc.

10:42 lucian: you can make the instance at runtime

10:42 pellis: that's what i'm trying to do

10:42 lucian: simplest way might be a get-engine function that caches in a private var

10:43 pellis: yea, but I can't seem to be able to do that mutation on a private var (def)

10:43 lucian: you only bind it once

10:43 you can be careful about how you bind it

10:43 * lucian is a clojure newbie

10:44 pellis: but if I bind it from within a function, won't it be avalable to the function scope only?

10:44 like a (def instance 1) from within a functoin, and then I expect to be accessing it from module/instance ?

10:44 lucian: pellis: in the function engines/get-engine, you can bind engines/engine-singleton and return it

10:45 pellis: how

10:45 ?

10:45 gfredericks: you can use an atom

10:45 pellis: yea, i've tried using an atom, ref etc. but it seems i have to maintain quite a bit (map) for a simple instance

10:45 gfredericks: (let [engine (atom nil), make-engine (fn [config] ...)] (defn get-engine [] (or @engine (reset! engine (make-engine some-config)))))

10:46 pellis: hmm.. ill look at that one

10:46 gfredericks: or probably a delay would be even simpler

10:46 ambrosebs: ok I proposed core.typed on clojure-dev.

10:46 Anderkent: Is there a difference between `(my list contents) and '(my list contents) if i'm not in a macro?

10:46 gfredericks: (let [engine (delay ...do stuff with config...)] (defn get-engine [] @engine))

10:46 Anderkent: yeah

10:47 ,'(my list contents)

10:47 clojurebot: (my list contents)

10:47 gfredericks: ,`(my list contents)

10:47 clojurebot: (sandbox/my clojure.core/list sandbox/contents)

10:47 Anderkent: right thanks

10:47 gfredericks: Anderkent: also you can unquote with `

10:48 Anderkent: backquote is independent of macros; macros are merely its 99% use case

10:50 Anderkent: right. It's hard to search for these, and obviously (doc ') does not work :P

10:51 pellis: any idea why this happens: Parameter declaration clojure.core/deref should be a vector

10:51 tgoossens: anyone already played with the java 8 lambda syntax? I just figured out that they are planning to support it in the next java version.

10:52 gfredericks: pellis: you left out the arglist from a function?

10:52 lucian: pellis: this sort of works too https://gist.github.com/52584d0c240fa9399702

10:52 pellis: it's similar to how java singletons work, with the same problems

10:53 gfredericks: vars are a bit nicer than singletons for global stuff, since you can rebind them locally if you like

10:54 pellis: lucian: how can this define a root binding?

10:54 i tried that before and it blew up on me

10:54 gfredericks: def works inside functions

10:54 lucian: yeah, gfredericks's example is nicer overall

10:54 gfredericks: it just makes people angry

10:55 pellis: so is there any way i can not do (work (get-engine)) but (work get-engine) ?

10:56 lucian: pellis: i don't know. but the explicit call is nicer. it makes it clear what's going on

10:56 gfredericks: you can do what lucian does, which should work, or equivalently try (alter-var-root #'engine (constantly (make-engine)))

10:57 pellis: ok

10:58 gfredericks: which makes fewer people angry

10:58 pellis: i'd like to have (engine/set-instance ... ) (engine/method1 ...) etc

10:59 gfredericks: set-instance can perform the alter-var-root for you

10:59 pellis: yea... hmm i'm trying to avoid duplicating all of the method signatures though, because engine is also a protocol Engine

10:59 gfredericks: if this were me, I'd have a slightly more functional approach of making the var dynamic, and setting it at the entry-point to the application

10:59 pellis: so i will have a protocol Engine, and then i will have that many methods in the engine.clj file so that i can require and do engine/method

11:04 gfredericks: the dynamic var option makes testing a lot easier

11:05 tomoj: (defonce ^:dynamic *engine* (make-engine)) ?

11:05 pellis: well, im kinda stuck now infront of having to duplicate a ton of code just to have an (engine/work) kind of flow

11:05 (engine/work) will delegate #work to the current engine instance

11:06 and it will call (work @engine-instance)

11:07 ucb: I recall a discussion about agents using a pool of threads of size 2 * number of cores, where's this stuff documented? And what's a good library for multithreading in clojure?

11:08 pellis: wow i feel like i'm working so hard to implement such a wrong code. i haven't done a set-instance and global singletons since i've been young and stupid.

11:13 tgoossens: How do you document that the function you expect has certain properties. Like: two parameters, first a coll and second a vector

11:13 bbloom: tgoossens: generally with careful prose

11:13 ,(doc reduce)

11:14 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...

11:14 bbloom: tgoossens: there are lots more examples in core

11:14 tgoossens: ok

11:15 I have a mixed feeling about it. Maybe because its only recently that my only experience was Java.

11:15 Eg:

11:15 Function1<Integer,Integer> increment

11:15 and you know there will be

11:16 an .apply(int)

11:16 i think that that is a good api.

11:16 I'm still struggling with that

11:16 in clojure

11:17 because i cannot enforce that you accept only a function with certain properties

11:17 how do programmers in clojure cope with this?

11:17 to write robust api's?

11:17 bbloom: tgoossens: by running smaller pieces of code much more often

11:17 tgoossens: the result is that you're more likely to get an error closer to it's source

11:18 It's a very different style of working

11:18 In a statically typed language, such as Java, and to a lesser extent a language like Haskell, you'll write a large program and rely on the type check to validate many properties of your program

11:18 tgoossens: correct

11:19 bbloom: in a dynamic language, and especially true of one with a powerful REPL, you generally run each new little bit of code as you implement it

11:19 and you test a bunch of inputs

11:19 Wild_Cat: actually, I'd argue that you rely on it *more* in Haskell, simply due to the immense power of its type system

11:19 (which manages to do a lot of it automatiacally, and is much harder to subvert than Java's)

11:19 bbloom: Wild_Cat: *shrug* not really interested in debating, just trying to explain the overall style

11:19 tgoossens: part of my confusion perhaps is that this is the first time i work with a dynamically typed language

11:19 Wild_Cat: bbloom: I agree with the core of your explanation, though.

11:19 bbloom: tgoossens: for sure

11:20 tgoossens: if you wait until your program is structurally complete to run it, you'll be in for a world of hurt in clojure

11:20 because you'll need to debug a deep call stack with limited insight

11:20 tgoossens: so what you are saying

11:20 Wild_Cat: tgoossens: a nice property of dynamically-typed languages is that it allows people to reuse your code in interesting ways you didn't initially plan for

11:21 bbloom: if you run very small pieces of new code as you write, you'll get a stack trace and you can IGNORE the stack trace b/c 9 out of 10 times, the bug is in the code you JUST WROTE

11:21 tgoossens: programming style is very close to the TDD paradigm?

11:21 bbloom: tgoossens: yes, feels like TDD

11:21 it's very common for people to put a big (comment ……… ) form at the bottom of a file filed with expressions

11:21 and people use evaluate expressions as they work

11:21 Wild_Cat: (for example, Python's "file-like objects" allows you to take most function/methods initially written with files in mind and apply them to network streams, in-memory StringIO objects and whatever else, without needing to refactor the initial API)

11:22 bbloom: rather than running a full test suite, you run just the expressions that are relevant to the changes you just made

11:22 Wild_Cat: and yeah, write lots of tests.

11:23 bbloom: the primary difference, i'd say, between what most people do with clojure, and true TDD, is that TDD expects you'll have a fully automated test suite. you can run all your tests at once. where as clojure devs tend to run just one or two tests at a time

11:23 tgoossens: hmmm

11:23 bbloom: when coupled with pure functions, you can run your tests in any order you like

11:23 if your number of tests eventually gets large, you can start to automate suites of them

11:24 tgoossens: so far in clojure i had a big file full of tests, testing every function for different input (using jayc expectations lib)

11:24 Wild_Cat: bbloom: leiningen offers a nice repeatable testing framework, though

11:24 bbloom: Wild_Cat: yes, which i highly recommend that people use once their programs start to grow :-)

11:25 Wild_Cat: agreed ^^

11:25 bbloom: generally, my code and test suites look like this: (defn double [x] (* 2 x)) (comment (double 5))

11:25 tgoossens: Ok lets try this: So when i'm using a clojure library. And i've just written a function that does something with that library. Then afterwards i make a test for it

11:25 oh

11:25 bbloom: i just eval (double 5)

11:25 i know it's supposed to be 10

11:25 tgoossens: now i see

11:26 bbloom: but if it's complex, i'll add a comment ; 10

11:26 tgoossens: never saw the comment before

11:26 bbloom: tgoossens: a great example is at the bottom of zip.clj https://github.com/clojure/clojure/blob/master/src/clj/clojure/zip.clj

11:27 tgoossens: reading..

11:27 bbloom: notice how there's just a bunch of code that rich was using to test things out

11:27 no assertions or anything

11:27 if you change the zip library, then a human needs to validate those test cases by evaluating them

11:27 for a small library, that's totally OK!

11:29 tgoossens: those expression in the comment

11:29 are that the things he tested in the repl then

11:29 bbloom: tgoossens: yup

11:29 tgoossens: so you write a piece of code and you test it in a few ways using the repl

11:29 bbloom: you got it

11:30 tgoossens: and then you put those "tests" in a comment

11:30 almost there i guess. but

11:30 bbloom: yup, and then automation of tests is a separate concern

11:30 tgoossens: what can other developers do with those expr. in the comment

11:31 bbloom: well, if i wanted to change zip.clj, i would have some test cases to try :-)

11:31 generally, clojure development happens side by side with a REPL and an editor

11:31 you write some code in the editor and send it to the repl as you write it

11:31 every time you change a piece of code, you send it to the editor

11:31 tgoossens: yes. But what i mean is. Nowhere in that comment there is written what de the developer was expecting to happen if he executed it

11:32 bbloom: tgoossens: well, it's usually obvious for most simple functions

11:32 tgoossens: but if it's not, you can write it down :-)

11:32 i usually just tack on a comment ; [5 :foo]

11:33 tgoossens: ok

11:33 bbloom: if you're more comfortable with explicit assertions, then use one:

11:33 (assert (= 10 (double 5)))

11:34 tgoossens: ok

11:35 i noticed this in certain functions in zip.clj

11:35 (defn remove {:added "1.0"} ...)

11:35 what does that mena?

11:35 Anderkent: Idiomatic way to change a value in a map? I.e. {:a 1} -> {:a (f 1)}. Best I came up with was (assoc (dissoc map key) key (f (get map key))), which is highly meh

11:35 tgoossens: anderkent: (assoc map key newvalue)

11:35 Anderkent: tgoossens: functions can have metadata

11:35 bbloom: Anderkent: update-in

11:35 Anderkent: bbloom: thanks

11:36 bbloom: ,(update-in {:a 1} [:a] inc)

11:36 clojurebot: {:a 2}

11:36 Anderkent: yes it's exactly what i was looking for, just didn't know the name :P

11:36 tgoossens: ,(assoc {:a 1} :a 2)

11:36 clojurebot: {:a 2}

11:37 tgoossens: ok

11:37 bbloom: tgoossens: that's just saying what version of clojure the function appeared in. it's structured documentation. sorta like /** @author */ comments in java

11:38 tgoossens: ok cool

11:42 bblooms: thanks!

11:43 iosica: does anybody know how is it possible to dump REPL compiled statements to class file?

11:46 antares_: iosica: it is not possible

11:46 iosica: why?

11:46 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

11:47 antares_: iosica: to start with, because .class format has pretty strict structure and what you enter in the REPL is completely free form

11:47 iosica: another reason is that nobody needed it badly enough to implement it. REPL history is supported.

11:48 iosica: but if I'd write history of repl to a user.clj and compile that

11:48 it would compile

11:48 also repl is compiling on the fly

11:48 so it is jvm bytecode

12:10 tgoossens: anyone experience with sublimeREPl with clojure?

12:18 Frozenlock: How does one push a java library jar to clojar?

12:18 gfredericks: same as a regular jar

12:19 Frozenlock: Well regular jar I just do lein push :P

12:19 It's magic!

12:19 gfredericks: doesn't clojars have instructions for scp?

12:19 Guest75802: what do you think about slingshot?

12:20 Frozenlock: I found this: https://github.com/ato/clojars-web/wiki/pushing, but I'm not sure where and what I should put in the pom.xml

12:21 gfredericks: oh you don't have a pom?

12:21 you could run `lein pom` for your project and adapt that

12:23 Frozenlock: That's the thing, it's a simple java library (not clojure), so there's not any project.clj.

12:23 Guest75802: Should I use slingshot or avoid it?

12:23 gfredericks: Guest75802: I think its good

12:23 Guest75802: Last commit is 4 month ago

12:23 People reporting problems to catch all exceptions

12:23 more dependencies

12:24 Don't know about the native clojure exception handling and it's drawbacls

12:24 drawbacks,...

12:24 antares_: Guest75802: 4 months should not worry you. I find Slignshot not worth using.

12:25 some projects simply get to the point when they work and there isn't much you can add or really improve

12:25 Anderkent: Any way to get a symbol from a var? I.e. the opposite of resolve?

12:25 Guest75802: antares_ , thx

12:25 gfredericks: Frozenlock: `find ~/.m2 -name '*.pom' | shuf | head -1 | xargs cat`

12:25 Guest75802: I'll have a look at the native exception handling

12:26 what would you suggest for validation of input data?

12:27 gfredericks: ,(-> #'clojure.core/first meta :name)

12:27 clojurebot: first

12:27 gfredericks: Anderkent: ^

12:27 Anderkent: thanks

12:27 Guest75802: I don't get the point about when to write things by myself and when to use libs. The Java world is full of bad libs full of bugs. The 'feeling' when to write things by your own seems not to be adoptable to the 'native' clojure libs

12:28 gfredericks: Guest75802: asking in #clojure is a reasonable way to sanity-check :)

12:28 Guest75802: I'm also missing discussion about what is really worth using on my google adventures ;)

12:29 gfredericks, a page with 'verified worth using libs' would be a great thing

12:29 gfredericks: that sounds controversial

12:30 Guest75802: There is a http://clojure.org/libraries , only listning contrib, lein ,...

12:33 Frozenlock: gfredericks: Thanks, I'll try to fiddle with this :)

12:40 Guest75802: If I use a fn to resolve all entries with a specified extension in a dir and pass them to a second fn, should I test them for file?

12:40 And absoulte?

12:41 Or take the afford to test it while filtering the list of files for a specified extension?

12:51 maleghast: Evening All

12:51 gfredericks: good evening europe

12:53 Anderkent: geh, now getting bit by the lack of .toString on lazy seqs... Annoying!

12:53 antares_: maleghast: hi

12:53 maleghast: antares_: Hi there...

12:53 antares_: maleghast: I pushed core.cache implementation to Spyglass, 1.1.0-SNAPSHOT should have it

12:53 gfredericks: Anderkent: maybe you want pr-str instead?

12:53 maleghast: I saw your commit on the SpyGlass code - thanks :-)

12:54 I am going to have to try and get my head around how to use it now :-)

12:54 Did you find a way to limit the re-try policy as well, by any chance?

12:55 Anderkent: gfredericks: thanks again

13:01 cheezey: how can i get the Class object of a certain class ?

13:01 like Object.class equivalent in java

13:02 maleghast: I gotta go - see you all around!

13:03 alexnixon: cheezey: (class x)

13:04 Anderkent: that's on an instance, I think he ment statically

13:04 alexnixon: ah

13:04 edlothiol: just write the class name

13:04 ,Object

13:04 clojurebot: java.lang.Object

13:05 cheezey: Oh okay

13:05 thnx

13:16 iosica: user=> (type Object)

13:16 java.lang.Class

13:16 user=> (type Integer)

13:16 java.lang.Class

13:16 user=> (class 1)

13:16 java.lang.Long

13:17 user=> Object

13:17 java.lang.Object

13:17 user=> Integer

13:17 java.lang.Integer

13:17 gfredericks: o_O

13:19 yedi: learning by doing is such a superior strategy

13:33 is there a function that returns the key(s) of a given value in a map?

13:35 gfredericks: ,(let [m {:foo 7 :bar 8 :baz 7}] ((group-by m (keys m)) 7))

13:35 clojurebot: [:foo :baz]

13:36 gfredericks: I guess that's not the most efficientest though

13:37 ,(let [m {:foo 7 :bar 8 :baz 7}] (->> m (filter (comp #{7} val)) (map key)))

13:37 clojurebot: (:foo :baz)

13:40 Chousuke: brainproxy: I actually have a gist somewhere that implements monads using protocols with a couple dozen lines of code :P

13:42 yedi: still need to figure out how the ->> works

13:42 macro works*

13:43 Chousuke: heh, found it. I like the docstring on lift.

13:43 https://gist.github.com/312137

13:45 ambrosebs: lol

13:53 a few more Typed Clojure contrib names: core.static-types, core.optional-types, core.gradual-types

13:55 HolyJak: core.types or .typed sounds best to me :)

13:55 bbloom: ambrosebs: shorter is better

13:55 i like core.types

13:57 ambrosebs: core.types is easiest to say also. :)

13:58 there was a previous contrib IIRC called something similar to core.types

13:58 as in , nonmodular contrib

13:58 had nothing to do with static type checking

13:59 here's hoping in a few years we'll get clojure.types :)

13:59 lynaghk: whaaa worst cljs bug ever: function parameter name overwrites global namespace in scope of fn.

14:01 yedi: any help with this: https://gist.github.com/4136844

14:01 bbloom: lynaghk: gah! i thought that was fixed

14:01 lynaghk: what version are you using?

14:01 lynaghk: I'm using lein cljsbuild 0.2.7

14:02 bbloom: ah, have you tried using clojurescript master? you can easily set that up

14:02 lynaghk: bbloom: I'm waiting for the 0.3.0 to drop, because there are some regressions in cljs r1503 and r1513 that blow my shit.

14:03 bbloom: lynaghk: which ones? i dunno because i just always work agains thead

14:03 er master

14:03 lynaghk: bbloom: which regressions? Not sure---something goes wrong with my reflex library, which is nasty to debug as it is

14:04 bbloom: so I just tested against master and saw that it was fixed---I didn't try to isolate the underlying regression.

14:04 bbloom: lynaghk: if you isolate it, maybe dnolen or I would fix it for you :-)

14:04 free work!

14:05 lynaghk: bbloom: it's fixed in master, I just don't know where or how

14:05 bbloom: if I tried to track down the underlying cause of every single bug I ran into, I'd never get any work done =)

14:05 bbloom: ah, ok misread you a second ago

14:05 glad it's working :-)

14:06 how's the graphics lib coming?

14:06 thorwil: yedi: i don't think you're doing yourself a favor with having classify-lines group the lines

14:06 yedi: thorwil: why's that

14:06 lynaghk: bbloom: pretty well, dnolen has been awesome in getting core.logic stuff cut out

14:07 bbloom: waiting for some constraint stuff + lvar "if-not-unified-with" defaults to drop, then I'll throw down a ton of rewrite rules and roll out to alpha folks

14:08 thorwil: yedi: rather classify the first line, note it's an "a". check next line, if it's the same class, append "a", else "b" ...

14:08 bbloom: lynaghk: cool!

14:08 thorwil: yedi: so you have to walk the poem only once and don't need complicated mechanism to make sense of the grouped lines

14:08 lynaghk: bbloom: yeah, it's pretty rad. How is your stuff coming along?

14:09 gfredericks: I'm thinking I want some sort of low-level clojure library for assembling SVG images

14:09 maybe by passing in a hiccup-like data structure, and with a lot of helper functions

14:09 bbloom: lynaghk: pretty well. i've been making some good progress on bits and pieces of my clojurescript libs

14:09 gfredericks: am I describing something that already exists anywhere?

14:09 bbloom: gfredericks: you should listen to what i'm about to say to lynaghk

14:10 * gfredericks listens

14:10 bbloom: so i wanted a more declarative way to work with the dom

14:10 hiccup is cool for static html, but not great for dynamic stuff

14:10 so i had the realization that a postfix notation is perfect for creating and manipulating dom trees without ever having to refer to elements by name

14:10 example would be this code that would create a button and append it to the screen:

14:11 "body" select first "div" tag "button" class "i am a button" text append

14:11 a little hard to read on one line

14:11 anyway, the same general idea would work splendedly for SVG

14:11 gfredericks: my use case is more static than dynamc

14:12 I just want a functional data-driven way to describe an SVG image

14:12 bbloom: still, the resulting code is kinda halfway between hiccup and enlive

14:12 gfredericks: I forget does hiccup officially support generic xml generation?

14:12 bbloom: dunno

14:12 i'll keep svg in mind with the work i'm doing tho

14:13 lynaghk: bbloom: I saw you making noise about that. The merits of that over the existing approaches aren't immediately clear to me. It's a total trope at this point, but it'd be helpful if you put together a todoMVC implementation to show it off.

14:13 bbloom: lynaghk: heh, was considering it

14:13 lynaghk: bbloom: I am kind of tempted to start a todoFRP project with the same goal.

14:13 especially since "FRP" is about as meaningless at this point as "MVC" = )

14:13 bbloom: lynaghk: I've studied the FRP stuff a bunch and i'm just not sold yet

14:14 lynaghk: seems like something that demos well but sucks in reality

14:14 a lot of FRP systems seem to do signals and transformers and some other stream-oriented metaphore

14:14 but i think that the identity/value split makes more sense

14:15 lynaghk: bbloom: yeah, me too. Though most of the time it's not clear what people mean by "FRP". I think the way I use C2/Reflex is "FRP"ish and that works out pretty well. My big issue now is translating DOM events back into the data space. Doing data->DOM mapping is pretty straightforward with my stuff (though not always super performant).

14:15 bbloom: i've been thinking about doing a property model where you send it property changes, just like you send EAVs to datomic, but then a constraint solver propegates the property changes via bindings

14:15 gfredericks: fibre-reinforced plastic is what google says

14:16 lynaghk: bbloom: that sounds like it might be cool. Please submit a todoFRP =P

14:16 bbloom: lynaghk: yeah, i haven't deeply considered dom events deeply

14:16 lynaghk: i just kinda am assuming that if no one but me touches the dom, i can listen to a subset of events that are "complete" ignoring people fucking around in the web inspector

14:16 but that might just be wishful thinking

14:17 lynaghk: bbloom: that assumption is not tenable for the kind of work I do. We use things like "FastClick" and Cordova to do mobile stuff, and they shim the browser and patch into the native event system sometimes

14:19 bbloom: lynaghk: *sigh* damn browsers

14:20 yedi: thorwil: thanks for the advice, i'll try that out

14:20 bbloom: lynaghk: hmmm fastclick says it creates a synthetic click event

14:20 that shouldn't be an issue

14:20 lynaghk: bbloom: also, after writing/using Hiccup-based stuff for the past year, I'm not convinced the benefits (primarily, "YAY, it's Clojure!") outweigh the costs (all designers hate it; takes a lot of discipline to separate logic/view)

14:21 tomoj: what's the problem listening to a subset of events?

14:21 bbloom: lynaghk: well if you have designers and want them to do templates, then you use a designer friendly template language… preferably one that you can open in a browser just renders reasonably

14:21 thorwil: yedi: on further thinking, try to seed reduce with [] and build the list of rhyme-types. only afterwards map that to "a"s and "b"s

14:21 lynaghk: bbloom: the bigger issue is that "no one but me touches the DOM". That's one thing if you can scope everything by element/selectors, but there have been times where we've needed to use some external JS to manipulate bits of the DOM but still want to do most of the handling in cljs.

14:22 bbloom: lynaghk: that's fine as long as the external JS only manipulates bits of the DOM in ways you can understand

14:22 yedi: thorwil: so instead of grouping it by the rhyme-types, I should just build a list of the rhyme types and reduce over it

14:22 lynaghk: bbloom: right, but then you can't use something like Singult to do dom updates/merging without hella duplication.

14:23 bbloom: anyway, I find this very difficult to talk about without the context of a particular application. Maybe if you're in PDX for Clojure/west we'll have some working next-generation cljs+DOM systems to show off = )

14:24 thorwil: yedi: almost. build the list of rhyme-types via reduce. the mapping to a/b might be another reduce or something else entirely

14:24 bbloom: lynaghk: i've deferred a lot of thinking for now. i'm trying to work up from the bottom…. i've gotten side tracked by implementing a concatenative language layer :-)

14:24 lynaghk: bbloom: classic nerd trap =P

14:24 bbloom: lynaghk: heh, well i have a working prototype and it's < 30 lines or so

14:25 lynaghk: and i copy pasted the gmail dom into a file, ran a script to convert it to my little DSL, and then ran that: 350ms!

14:25 which is pretty good for totally unoptimized interpreter

14:25 builds the whole gmail UI from a little postfix notation program :-)

14:25 thorwil: lynaghk: i vaguely recall a html->hiccup project. does or would that help with the designers?

14:26 lynaghk: thorwil: No; maintaining hiccup would just be another slowdown step during iterations, and it's likely the two sources would diverge.

14:27 thorwil: the tools most web designers are familiar with are optimized around html/css. Editors have good intergation with the base, as well as more established DSLs like HAML, SASS, and so on.

14:28 thorwil: ultimately my issue with hiccup comes down to a problem representing markup in the application code. Sometimes that is what you want and it makes things cleaner/shorter, but other times it is a huge pain.

14:28 bbloom: lynaghk: gotta run for a bit, but i promise a cool demo soon :-)

14:28 lynaghk: thorwil: I think Angular.js's approach is very interesting, but how to integrate it with cljs is still up in the air: https://gist.github.com/3856153

14:28 bbloom: looking forward to it!

14:31 thorwil: lynaghk: i understand that hiccup is a problem when working with others. enlive becomes problematic because of the tightly couple code you need. template languages with placeholders and such suck if there's no support in the editor and if a "unique" language ends up integrated

14:32 lynaghk: thorwil: agreed on all points. My feelings go back and forth on "semantic templates" with mini languages

14:35 Guest75802: lynaghk I do not use hiccup and I do not use enlive

14:36 Thinking enlive is just to complicated and does not work with 'designers', to choose CSS classes for template mechanisms seems wrong

14:36 hiccup is mixing code and design, which is bad

14:36 you can seperate hiccup code in own namespaces, but it still feels wrong

14:37 thorwil: sounds like dogmatic thinking

14:37 Guest75802: thorwil, y?

14:38 thorwil: cleanly separating "code" and "design" seems a good idea, until you arrive at those cases where both touch and intermingle

14:38 Guest75802: Provide use-cases

14:38 thorwil: and enlive is not limited to selecting by css class

14:39 Guest75802: For example Mustache is language agnostic

14:39 Works like string-template

14:39 and clearly seperates logic from presentation because the templates are logicless

14:40 lynaghk: Guest75802: one of the reasons I've written so many libraries around hiccup is because I do data visualization, where there is quite a bit of logic related to the markup. I.e., passing a ton of parameters via a single map would be unrealistic.

14:40 Guest75802: 'stencil' and 'clostache' are good frameworks for clojure

14:40 lynaghk: Guest75802: it couples markup/code in the same way that, e.g., D3 couples the two.

14:40 * gfredericks learning svg in detail

14:40 Guest75802: D3?

14:41 lynaghk: D3.js

14:41 Guest75802: ahh

14:42 when you use D3 providing the raw data behind a 'ajax' service may be the best idea?

14:43 lynaghk: Guest75802: I'm not sure what you mean. I've got to run at the moment, though. sorry!

14:44 Guest75802: lynaghk when you do so much in javascript, there should be a better alternative to hiccup like just providing raw data for D3.js

14:44 yedi: (ns rhyme-finder.core

14:44 (use [clojure.contrib.seq-utils :only (positions)]))

14:44 i'm getting this error: java.io.FileNotFoundException: Could not locate clojure/contrib/seq_utils__init.class or clojure/contrib/seq_utils.clj on classpath:

14:45 Guest75802: yedi tried 'lein clean && lein deps'

14:45 ?

14:45 thorwil: yedi: do you really have "use" there, not ":use"?

14:45 lynaghk: Guest75802: my point is that I'm using Hiccup in the same way that people use D3---to generate markup from "raw data"

14:46 gfredericks: thorwil: I think it works either way

14:46 Guest75802: lynaghk, ahh okay.

14:46 lynaghk: Guest75802: that is inherently coupling code and markup.

14:46 yedi: Guest75802: I just ran it in my terminal, but I still get the error when executing C-c C-n in emacs

14:46 Guest75802: Never seen hiccup in such a combination

14:46 yedi: thorwil: I'm not sure of what the distinction is, gimme a sec

14:47 lynaghk: Guest75802: I wrote C2 (a D3 port to clj/cljs) that does exactly that. So my typical use case maybe be very skewed compared to how most people use Hiccup =)

14:47 thorwil: yedi: use and require are functions. :use and :require a keys that the ns form will translate

14:47 yedi: ah

14:48 yea, still getting the same error

14:49 Guest75802: lynaghk, sorry then. Just thought about the common hiccup using projects at github

14:50 yedi clojure-version in project.clj? Dependency to seq-utils included?

14:51 yedi: :dependencies [[org.clojure/clojure "1.4.0"]])

14:52 i have to include a dependency to seq-utils in my project.clj file?

14:52 gfredericks: yes

14:52 to clojure-contrib

14:52 thorwil: isn't clojure contrib dead, only for pre 1.4 clojure?

14:52 Guest75802: yedi in clojure 1.4 yes

14:52 contrib isn't a part of clojure since 1.3...?

14:53 yedi: if it's deprecated, should I avoid using fns from there?

14:53 Guest75802: thorwil, yes. Not included anymore. A lot projects are now existing as own github projects

14:53 gfredericks: ~contrib

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

14:54 gfredericks: I don't remember contrib ever being packed in the same jar; only that `lein new` automatically included it in the project.clj

14:57 thorwil: i wonder how i could write a test for my routing (moustache, not compojure), without checking what the actual handlers deliver. i.e i only want to test which handler is called and that everything that should go 404 goes 404

14:57 gfredericks: are "handlers" vars?

14:57 * gfredericks doesn't know anything about moustache

14:58 thorwil: gfredericks: moustache expects functions taking one argument, just like compojure(?)

14:59 TehranForever: Chousuke is the finest Finn of this channel.

14:59 Iceland_jack: TehranForever: what about me?

14:59 gfredericks: more finn comments?

15:00 thorwil: could/should my test define all the handler names to fns specific to the test?

15:00 Guest75802: Is there a good way to clean up my (:use ... by any tool?

15:00 like java import optimizers?

15:00 gfredericks: Guest75802: slamhound _might_? I haven't tried it

15:01 Guest75802: gfredericks, have tried it. It can't work with a lot of things

15:01 produced a lot of quirx

15:01 ;)

15:01 pjstadig: has slamhound been updated for (:use [... :refer [...]])?

15:08 yedi: is there a fn to append to a vector? instead of having to do (assoc vec (count vec) <new item>)

15:08 Guest75802: pjstadig had similar problems with :use ... :only ...

15:08 gfredericks: yedi: conj

15:08 Guest75802: yedi conj

15:08 yedi: oh duh right

15:08 Raynes: Wow.

15:09 You knew that you could assoc to a vector, but you didn't know about conj?

15:09 :P

15:10 gfredericks: I guess most people who do it wrong prefer (vec (concat my-vector [x]))

15:17 yedi: thorwil: here is how I implemented rhyme-scheme: https://github.com/yedi/rhyme-finder/blob/master/src/rhyme_finder/core.clj#L96

15:18 thorwil: I decided not to use classify-lines at all like you suggested

15:21 are there any general practices for organizing code? right now I just have a ton of fns and a few global defs in my core.clj file

15:21 seems like it's probably the equivalent of spaghetti code in clojure

15:21 gfredericks: break them into namespaces by functionality?

15:21 similar approaches to organizing code in other languages

15:22 pellis: is there a way to destructure within anonymous function? like #(foo %1) but want to destructure %1 ?

15:23 gfredericks: use the normal fn syntax

15:23 hcumberdale: ;)

15:23 gfredericks: (fn [[a b c]] ...)

15:27 tomoj: a while back I wrote several utility functions that seemed sort of nuts to me. today I went back to the semantic editor combinators blog post to try again to understand them, and now realize that I ended up with several of those combinators independently :)

15:29 Guest75802: How to add a section <abc>elem1</abc>\n<abc>elem2</abc> from a seq '(elem1 elem2) under a specified structure of a xml file ?

15:30 lypanov: anyone know if the cljs in cljs compiler thang is already somewhere on github?

15:32 * lypanov beats github with a stick

15:32 lypanov: found it (https://github.com/kanaka/clojurescript)

15:36 Guest75802: hm

15:38 clojure-newb: hey guys… if I were to use a clojure library giving me content negotiation, caching, API versioning etc and nice REST support, which ones are people using ? Its kinda hard to choose, and particularly API versioning is not well documented

15:38 technomancy: clojure-newb: nobody has implemented generalized content-negotiation yet

15:39 but you should use compojure

15:39 clojure-newb: technomancy: how is it's API versioning support ?

15:39 technomancy: clojure-newb: as good as you want to make it?

15:40 clojure-newb: technomancy: oh I see… roll your own ?

15:40 Guest75802: what is the most simple way to add elements to xml files

15:41 is it right that no native Clojure lib deals correctly with XML namespaces?

15:44 ChongLi: hmm

15:44 4clojure ought to have a "next problem" link after getting the answer correct

15:45 oh

15:45 it does, it's just not called next

15:45 Guest75802: what's the prefered API to handle XML ?

15:45 clojure.contrib.zip-filter.xml ?

15:46 thorwil: why doesn't with-redefs-fn like me? https://www.refheap.com/paste/6935

15:46 borkdude: have you ever seen an implementation of filter using reduce like this? https://www.refheap.com/paste/6936

15:47 gfredericks: thorwil: I think it expects the body to be a function

15:48 so instead of (root-routes ...) you give (fn [] (root-routes ...))

15:48 thorwil: with-redefs is a macro that lets you avoid that

15:50 thorwil: gfredericks: works, thanks! but for with-redefs, something else must change, because: https://www.refheap.com/paste/6937

15:51 gfredericks: thorwil: yeah I think it also wants a vector of bindings like let

15:51 I don't remember if you need the #' syntax either

15:51 ,(doc with-redefs)

15:51 clojurebot: "([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mockin...

15:51 gfredericks: yeah just the symbol

15:52 clojurebot: with-redefs is useful for mockin...

15:52 clojurebot: You don't have to tell me twice.

15:52 thorwil: aha: (with-redefs [h/journal (fn [r] "plop!")] (root-routes {:request-method :get :uri "/"}))

15:53 gfredericks: yep

15:53 also that function is (constantly "plop!") :)

15:53 thorwil: phew, headache avoided, ty

15:53 gfredericks: por eso estamos

15:54 thorwil: hmm, i don't think my replacement handlers have to be valid ring handlers

15:54 * gfredericks looks up HTML documentation on ehow.com

15:59 borkdude: oh of course, I'm the only one who didn't know about difference lists

16:02 Guest75802: Anyone used data.xml already?

16:22 How to insert elements in a structure like: https://github.com/clojure/data.xml#examples

16:23 romanandreg: hey need some help with clojurescript macros

16:23 I'm trying to use the try macro inside a macro definition, but it won't work

16:23 the result javascript just has the body of the try

16:23 tomoj: huh, I never realized that on the jvm, all protocol fns share a name/sig space

16:23 romanandreg: any suggestions

16:23 gfredericks: romanandreg: can we see the code?

16:25 kmicu__: Are there any contraindications for putting lazybot @ heroku?

16:26 gfredericks: tomoj: I never realized that in cljs they don't :)

16:26 romanandreg: gfredericks: there you go https://gist.github.com/4137377

16:26 tomoj: didn't mean to imply that, although I suspect that's true. do you now know?

16:26 gfredericks: tomoj: I....think?

16:26 tomoj: ditto

16:27 to avoid the problem on the jvm I named my seq protocol fn -seq

16:27 romanandreg: gfredericks: the client code runs that, but only returns what is in body (without the actual catch)

16:27 tomoj: bet I'm going to regret that when I go to cljs..

16:27 hopefully not!

16:28 hugod: dnolen, lynaghk : would be grateful if either of you could have a look at this. If I use prep I get what I think is an erroneous result https://gist.github.com/4137374/a8361de5ff2e78609f99dbc521ff53e52b192a2b - maybe linked to use of c.c.l/not-found?

16:29 dnolen: romanandreg: patch applied http://github.com/clojure/clojurescript/commit/ee25599abb214074cbeefe37b399038d70c6ab89

16:29 romanandreg: dnolen: awesome! thanks :-)

16:30 gfredericks: romanandreg: I do not know :(

16:30 romanandreg: oh try e# for the error name

16:30 romanandreg: dnolen: do you have some minutes to spare? if someones knows macros on clojure, that must be you :-p

16:30 gfredericks: I bet the compiler bails when it sees the qualified e

16:30 romanandreg: gfredericks: went there, the gclosure compiler actually throws a warning

16:30 saying

16:31 that I'm not using

16:31 e__auto__number_number

16:31 gfredericks: change it in the body too?

16:31 romanandreg: sorry no "not using" but rather, not defined

16:31 gfredericks: o_O

16:32 then I _really_ don't know what's going on

16:32 but you definitely want e# instead of e

16:33 romanandreg: gfredericks: Ok, will change that then...

16:33 dnolen: hugod: which behavior are you expecting?

16:33 lypanov: dnolen: random q any clue where the clojurescript-lua guy went? was anything heard of him?

16:33 dnolen: romanandreg: looking

16:34 lypanov: raphael amiard, he's around - tho I'm not sure if he's actively working cljs-lua

16:34 lypanov: dnolen: *nod* no commits for 4+ months

16:35 dnolen: lypanov: yeah I think he's been busy w/ his other OCaml LLVM project

16:35 lypanov: dnolen: gonna read over his repo in the coming weeks and that of kanaka would be great to get a -> lua generator in lua

16:35 dnolen: *nod* lots of commits to that

16:36 bummer but ya his GSOC was long over

16:37 hugod: dnolen: I was expecting both expressions to yield the same result

16:37 dnolen: lypanov: yes but goal was achieved - he helped make the analyzer/compiler more modular. still cljs-lua is probably a solid starting point for anyone wanting to carry it forward

16:37 hugod: but which one are you expecting?

16:38 hugod: dnolen: I was expecting a single term - ie, the result without prep

16:39 romanandreg: dnolen: updated gist with more code, just in case

16:42 dnolen: romanandreg: still not really following - what are you expecting to see?

16:42 hugod: so the second one is unexpected?

16:42 lypanov: dnolen: *nod* wouldn't it make more sense to base it on kanaka work tho?

16:42 romanandreg: dnolen: I'm expecting to see the assert from the catch clause

16:42 lypanov: i have so little experience not sure how modular the actual generation parts of things are

16:43 but i'd expect more cljs -> less work ;)

16:43 dnolen: lypanov: yes, is kanaka?the self compiling cljs project?

16:44 romanandreg: gimme a second looking more closely at hugod's issue.

16:44 tomoj: what the hell? https://www.refheap.com/paste/2909721cacda1bfafd7a20a8c

16:45 romanandreg: dnolen: no worries… let me know when you are available, thanks

16:45 lypanov: dnolen: thats just the guys github name - https://github.com/kanaka/clojurescript

16:45 dnolen: so figured i'd call it that ;)

16:45 tomoj: guess clojure doesn't like initial hyphens in protocol fn names

16:47 lypanov: dnolen: btw your video intro to c.l was awesome thank you looking forward to playing with it in near future for some constraint problems

16:47 dnolen: lypanov: thx

16:48 hugod: dnolen: for me at least - the ?a in the second result implies it hasn't unified doesn't it? the second pattern calls for a match on the :a key, which isn't satisfied. But I could have my wires crossed.

16:48 Guest75802: How to work with such structures: https://github.com/clojure/data.xml#examples

16:49 like #clojure.data.xml.Element ...

16:49 dnolen: hugod: to be honest I hadn't realy intended prep to be used from w/in a run, so you may just be running into a case I did not account for.

16:50 hugod: dnolen: ok, I was trying to get a simple repro case - I'll hoist the prep calls and see if it still differs

16:52 wingy: i have a folder with a dot .. how will the namespace be like?

16:52 the folder is called context.io and it has a file client.clj in it

16:52 the ns looks weird now: (ns myapp.context.io.client)

16:53 hugod: dnolen: gist updated - no change, there are still two terms produced

16:53 dnolen: hugod: it just seems like a bug to me, (run* [q] (== (partial-map (prep {:a '?a :c :clojure.core.logic/not-found})) {:x 1})), succeeds - does not w/o prep - feel free to open a ticket and I take a closer look in a bit. thanks.

16:54 hugod: dnolen: ok, thanks - I'll also close the one I opened yesterday re recursive partial-map

16:57 wingy: anyone?

16:57 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

16:57 wingy: clojurebot: i have already asked the question

16:57 clojurebot: tufflax: there was a question somewhere in there, the answer is no

16:58 wingy: clojurebot: you are a little annoying girl

16:58 clojurebot: It's greek to me.

16:58 egghead: :3

16:59 hugod: dnolen: I would close http://dev.clojure.org/jira/browse/LOGIC-72 but I don't seem to have permissions to do it

17:00 raek: wingy: dots in namespace names have to correspond to forward slashes in paths

17:00 wingy: raek: so in other words you can't have a dot in a folder name

17:00 dnolen: romanandreg: I'm still having trouble figuring out what you're expecting to see since some context is missing.

17:01 raek: wingy: yes. not if you want to use ns/require/use anyway...

17:01 dnolen: romanandreg: the multimethod is clearly part of some larger macro

17:01 raek: wingy: if you want the namespace to be called myapp.context.io.client, then put the code in myapp/context/io/client.clj

17:02 romanandreg: dnolen: yes, it is part of the is macro for testing, this code follows the same scheme as in clojure.test

17:02 but for some reason the resulting javascript doesn't contain the try/catch

17:02 let me do one more thing, and if it doesn't work, I'll push the complete code for you to check it out, thanks in advanced for offering to help :-)

17:03 tomoj: it seems somewhat weird to me that (extend-type default IFoo (...)) will cause (satisfies? IFoo x) to be true for all x

17:03 dnolen: romanandreg: yes I can't see what's going on - there's clearly something wrong w/ is.

17:03 tomoj: requires a marker protocol I guess if you want to differentiate

17:03 wingy: raek: yeah .. but that would feel like a hack just for not breaking how namespace is working .. contextio will suffice

17:03 dnolen: tomoj: what else would you expect?

17:04 tomoj: I guess that is what I expected

17:04 raek: wingy: hyphens are usually used to separate words: myapp.context-io.client ~ myapp/context_io/client.clj

17:05 tomoj: the other possibility I entertained was that objects having the default impl would not satisfy the protocol

17:05 wingy: raek: i should do that

17:05 raek: (and they correspond to underscores in paths, as you might have heard)

17:05 wingy: looks much better

17:05 yeah

17:05 tomoj: which wouldn't make sense. I just wanted a marker protocol and didn't know it

17:07 Guest75802: struct-map

17:07 tomoj: (..or my current choice is to just not extend to default)

17:08 Guest75802: https://refheap.com/paste/6939

17:08 dnolen: tomoj: yeah extending to default is usually more trouble than it's worth unless you really, really need it. core.cljs only does that on 2 protocols IHash & IEquiv

17:09 Guest75802: how can I add (element :test) in :tag :b's :content ?

17:09 dnolen: tomoj: initially CLJS did that for ICounted and IIndexed - which was painful

17:09 (counted? 1) -> true

17:09 tomoj: heh

17:09 but (count 1) is an error?

17:10 raek: nickOnClj: you could use update-in

17:10 dnolen: it is in Clojure & ClojureScript

17:11 lynaghk: hugod: do you need two colons for a namespaced keyword?

17:11 raek: hrm, wait

17:12 nickOnClj: raek, don't know how

17:12 hugod: lynaghk: only if your not using the full namespace name

17:12 nickOnClj: can you provide an example?

17:12 raek: nickOnClj: sorry, what I had in mind didn't work

17:12 strczprstskrzkrk: So widow mines are a pretty horrible unit.

17:12 THey just make you afrad to move out and split your army up because they could be basially everyhwere.

17:13 raek: nickOnClj: are you going to change just this element or more elements?

17:13 nickOnClj: I want to add a element under :b :content

17:14 thought about assoc-in

17:14 or assoc? with juxt?

17:14 raek: you can't really use assoc-in or update-in here because you need to find the map with the correct :tag value in a :content sequence.

17:14 the -in functions require data structures with keys

17:15 if the sequences were vectors, you could have used the "-in" functions though

17:15 nickOnClj: yes... how to find them?

17:15 I need them to be records to write them back

17:16 using data.xml

17:16 okay, starting by 'finding' the elements

17:16 that's hard enough

17:16 raek: nickOnClj: you could use the Enlive library for this

17:17 nickOnClj: Uhhh more dependencies,...

17:17 raek: or you could write a simple function that just transforms this particular tree

17:18 nickOnClj: that's what I try to do

17:18 raek: but if you generalize that function, you will end up with something like enlive, I think

17:18 nickOnClj: but I just don't get it

17:18 raek: what do you want to do if there are multiple :b elements?

17:19 nickOnClj: I don't know. Just searching for a solution

17:19 raek: nickOnClj: I can show you a specialized function if you want to

17:20 nickOnClj: how can I write such a function to find a element? Is there any search/access method? [[:tag :xml] :content]

17:20 raek, please ;)

17:22 dnolen: hugod: ping

17:22 raek: nickOnClj: ok, hang on a minute...

17:25 nickOnClj: https://www.refheap.com/paste/6940

17:25 hugod: dnolen: pong

17:25 cmajor7: what is the way to convert JS list to a Clojure one? e.g. "No protocol method ISeqable.-seq defined for type object: [object FileList]"

17:26 raek: nickOnClj: Enlive is a library for dealing with specifically these kind of trees. with it you can just write (defn f [root new-node] (at root [:b] (prepend new-node)))

17:26 dnolen: hugod: so this is what is happening - prep converts ?symbols to logic vars

17:27 hugod: partial-maps always "control" the unification since we only are about a certain set of keys.

17:27 raek: here the [:b] selector will match any :b element in the tree. you can of course make the selector more specific if you want to

17:27 nickOnClj: raek i'll try it

17:27 dnolen: hugod: partial map looks up a key, ::not-found is returned if the key does not exist

17:28 but the map's entry in the partial map is a logic now - of course that will unify w/ ::not-found.

17:28 raek: nickOnClj: [enlive "1.0.1"]

17:30 nickOnClj: raek does it work with lazy streams and >20GB XML ?

17:30 raek: probably not

17:31 is the stream a single xml tree?

17:31 cmajor7: should "js->clj" convert JS list object to Clojure seq?

17:31 raek: or is it a sequence of root elements?

17:31 hugod: dnolen: you're referring to the unification for the first rule?

17:31 nickOnClj: a data.xml tree

17:31 https://github.com/clojure/data.xml#examples

17:31 dnolen: hugod: I'm assuming the behavior you want is that some value for that key is present but you don't car ewhat? correct?

17:32 hugod: dnolen: for the second rule, yes

17:32 raek: nickOnClj: ah, it says there in the docs that it is lazy. then it should be able to do it

17:33 nickOnClj: there are multiple parsers that generate xml trees that look like this, and the ones I have used the most were not lazy

17:33 dnolen: hugod: fixing

17:33 raek: but that doesn't mean that data.xml isn't lazy

17:33 hugod: dnolen: the first rule should match if there is no :a key, the second if there is an :a key

17:34 dnolen: thanks :)

17:34 nickOnClj: does enlive work with namespaces?

17:34 raek: no

17:34 it is not namespace aware

17:34 and I don't know if enlive is lazy...

17:35 nickOnClj: and it's written for html

17:35 hmpf

17:35 is there no native way to access the elements?

17:35 raek: nickOnClj: yes, but it has two parts: an html parser and a tree transformation library

17:36 the tree transforms work perfectly well for xml (don't know about the laziness, though)

17:36 what do you mean by "native"?

17:36 nickOnClj: like it is possible to get the :content

17:37 (:content (parse input))

17:37 raek: you could use 'some', I guess

17:37 nickOnClj: is there no way to ([:tag :b] :content (:content (parse input)))

17:37 raek: but you also need to record were that element were, so that you can replace it

17:38 not in clojure.core

17:38 dnolen: hugod: fixed

17:38 hugod: http://github.com/clojure/core.logic/commit/9a964d6c744433825332dd82370cb46eac7919da

17:39 raek: nickOnClj: also, 'at' in enlive does precisely that

17:40 nickOnClj: perhaps you could use some function in clojure.walk

17:41 nickOnClj: http://stackoverflow.com/questions/9989818/clojure-recurs-strange-behavior

17:41 somebody has written a filter-tags

17:43 wingy: anyone here having experience with oauth in http requests? i am using context.io which needs me to authenticate requests using oauth http://context.io/docs/2.0/authentication but im not sure how to do that in clj

17:43 raek: what your function needs to do is to create a new root not like the old one, but with updated :content

17:43 the :content should be a sequence like the old one, but with one element replaced

17:43 nickOnClj: yes !

17:44 raek: the replacement element should be like the old one, but with one more child in its content

17:44 as you can see this involves many steps

17:44 nickOnClj: raek that shouldn't be a problem since i can (merge old_b (element :new))

17:45 but the 'navigation' in the structure is the major problem for me

17:45 raek: nickOnClj: another way is to use a "zipper"

17:45 Raynes: wingy: There are some libraries for doing it, but oauth is pretty horrible to use.

17:45 wingy: Raynes: why

17:46 a lot of services are using it

17:46 raek: you can use it to "imperatively" navigate through the tree and "change" elements in place

17:46 Raynes: It's complicated and annoying.

17:46 raek: when you are done you get a new updated tree

17:46 Raynes: Especially for desktop applications that need to work with oauth.

17:46 wingy: I need to generate a token I think that I send through OAuth header

17:46 but i don't know how to generate it

17:46 nickOnClj: reak, how to use zipper on https://www.refheap.com/paste/6939 ?

17:47 wingy: https://github.com/mattrepl/clj-oauth

17:47 https://github.com/r0man/oauth-clj

17:48 raek: nickOnClj: I know what zippers do and how they work (basically), but I haven't used them myself

17:48 nickOnClj: there are a few examples here: http://clojuredocs.org/clojure_core/clojure.zip/xml-zip

17:48 hugod: dnolen: thanks for the quick fix! working well here :)

17:49 raek: nickOnClj: do you need to update :b elements in a specific location in the tree, or do you want to update any occuring :b?

17:50 nickOnClj: no specific location

17:50 raek: (zippers go hand in hand with specific locations, enlive goes hand in hand with arbitrary locations)

17:51 nickOnClj: semms zippers are my friends

17:51 how to use them?

17:52 wingy: why can't they support basic auth :)

17:53 i know how that one works :)

17:53 dnolen: hugod: great :)

17:53 elendal: Clojure devs might be interested: IBM Java PackedObjects http://www.slideshare.net/mmitran/ibm

17:58 raek: nickOnClj: https://www.refheap.com/paste/6941

17:59 nickOnClj: clojure.contrib.zip-filter << only zip-filter?

17:59 or a build-in in clojure 1.4 ?

18:00 raek: or a slightly updated one: https://www.refheap.com/paste/6942

18:00 nickOnClj: clojure.contrib is pre 1.3 stuff

18:01 http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

18:01 see that page for where the namespace went

18:02 clojure.contrib.zip-filter seems to be here now: https://github.com/clojure/data.zip

18:10 nickOnClj: thx raek

18:10 yedi: is there a function that does the equivalent to this: https://github.com/yedi/rhyme-finder/blob/master/src/rhyme_finder/core.clj#L101

18:11 removes duplicate items from a vector

18:12 raek: yedi: you could use (vec (distinct some-vector))

18:12 yedi: ...or simply use sets :)

18:15 borkdude: my first encounter with the haskell community http://stackoverflow.com/questions/13534676/is-it-possible-to-implement-filter-using-foldl-instead-of-foldr#comment18536354_13534676 - my god, no wonder I love clojure

18:15 raek: :(

18:16 Raynes: borkdude: That's ridiculous.

18:16 raek: I have found the Haskell community (mostly via the IRC channel) to be very friendly, though

18:16 Raynes: borkdude: That isn't Haskell though, that's stackoverflow syndrome. Ask in #haskell.

18:17 FWIW, I voted to reopen your question.

18:17 xeqi: becareful of confusing haskell conmmunity with stackoverflow mods

18:17 borkdude: Raynes tnx

18:17 raek: I think it was a perfectly resonable question

18:18 Raynes: borkdude: Second what xeqi said. I've asked brain dead questions to exceptional answers in #haskell before.

18:18 They have a really good community.

18:19 borkdude: well ok, it wasn't my first encounter with haskell, I entered their IRC today before, and yes, they are nice. maybe it's SO specific, let's hope

18:20 Raynes: xeqi: Can I have a veggie burger with fries?

18:20 Not fries fried in animal fat though, of course.

18:20 nickOnClj: raek, it is nearly finished

18:20 https://refheap.com/paste/6949

18:21 a one-liner ;)

18:21 xeqi: Raynes: sure, but not sure if they serve that in alabama

18:22 wait till you get to LA

18:22 Raynes: I've been to LA.

18:22 Got a big fat burger at The Counter.

18:22 Enjoyed every bite.

18:22 * Raynes dons sunglasses and walks away.

18:23 nickOnClj: Raynes awesome story.

18:23 Ordered 30 chicken nuggets at mc donalds

18:23 will never do it again

18:23 raek: nickOnClj: neat!

18:24 nickOnClj: can't believe how sick I felt

18:27 gfredericks: is nobody targeting go with the cljs compiler yet?

18:28 dnolen: gfredericks: haven't heard of anything yet.

18:31 pandeiro: how do i get lein to include cljs files in a src-cljs dir when doing `lein install`?

18:39 wingy: lets target clojure with clojurescript

18:43 borkdude: wingy clojure all the way down?

18:44 AimHere: Write clojure in clojurescript, and clojurescript in clojure

18:45 Have them mutually recursing all the way down

18:45 wingy: borkdude: all the way

18:46 like inception .. we just need a good stabilizer

18:47 pandeiro: so is the only choice for making a cljs jar either using the jar command or lein cljsbuild?

18:48 borkdude: wingy we need a clojure machine that has all the special forms baked into the processor

18:49 dnolen: pandeiro: doesn't lein package up anything on :source-paths ?

18:52 hcumberdale: It's horrible

18:53 spending hours on one line clojure

18:53 In java you have pages full of syntax and text in the same time,... without another result but it feels like you have done more

18:54 Foxboron: hcumberdale, imagen when you finally get it :D

18:54 alanzoppa: Hi, noob here. Can someone tell me how to run unit tests from the REPL in a standard lein project?

18:55 borkdude: hcumberdale if it helps, you can always type extra spaces and comma's in clojure, they are ignored

18:57 hcumberdale: alanzoppa lein test

18:57 alanzoppa: from the REPL, not CLI

18:57 hcumberdale: borkdude that's way not enough

18:57 In java I can write so much more nice stuff ;)

18:58 Imagine parsing XML,... one line in Clojure... a few hundered in java

18:58 Objects, Factories, Conversions, ...

18:58 Bloat everywhere

18:59 Annotations for Dependency Injection, Configuration of the XML Factory and XML providing instance

18:59 Code to 'make it working in every application server'

18:59 Code to 'omg, does not work in every application server'

19:02 borkdude and spaces are invisible. Filling up everything with "," looks stupid and not like hard work

19:03 borkdude: hcumberdale you can always add some extra function calls to identity or smth to fill up your lines

19:04 hcumberdale: identity?

19:04 borkdude: ,(identity 1)

19:04 clojurebot: 1

19:04 borkdude: instead of just writing 1

19:04 clojurebot: Huh?

19:05 pandeiro: dnolen: thanks hadn't realized :source-path became :source-paths :/

19:06 hcumberdale: is there any version for clojure of https://github.com/airblade/acts_as_enterprisey

19:10 alanzoppa: anyone? what's the equivalent of `lein test` from the REPL?

19:14 dnolen: alanzoppa: http://richhickey.github.com/clojure/clojure.test-api.html

19:14 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure/clojure.test-api.html and try to stop linking to rich's repo.

19:14 dnolen: alanzoppa: oops I meant http://clojure.github.com/clojure/clojure.test-api.html

19:15 flying_rhino: hello guys

19:16 hcumberdale: hi flying_rhino

19:16 alanzoppa: @lazybot @dnolen Thanks. (disclosure: totally new to lisp, etc). I've been through this, I'm just not sure what I need to require or what namespace to run this in.

19:16 flying_rhino: one question: When I do map or other function on hash table is it slower than doing map on vector? If it is, how to make it the same speed?

19:17 is there hash/vector hybrid?

19:18 dnolen: alanzoppa: (require 'clojure.test), (clojure.test/run-tests 'some-namespace-with-tests)

19:21 flying_rhino: there is no provided hybrid - there are probably data structures you could implement with some of the properties you want.

19:22 flying_rhino: I am actually surprized that doing map and reduce work at all on hasth table. But they do.

19:22 *surprised

19:23 dnolen: flying_rhino: well maps are sequable, so maps get converted into a sequence so it can be mapped over.

19:23 alanzoppa: @dnolen thanks for being so patient while i bumble through this. Do i have to require the test file or something? Running that for my core ns finds 0 tests.

19:23 dnolen: ,(seq {:foo 1 :bar 2})

19:23 clojurebot: ([:foo 1] [:bar 2])

19:23 dnolen: alanzoppa: yes you may need to require your namespace first - it's been a while since I tried running tests at the REPL

19:24 alanzoppa: @dnolen oh damn, there we go

19:37 gfredericks: ,(.seq {2 2})

19:37 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap>

19:37 gfredericks: ^ does anybody understand that?

19:43 as far as I can tell from the java code, calling seq on something that is not an ISeq but is Seqable results in callign .seq on it

19:49 flying_rhino: I need data structure that acts a bit like database table with primary key. This means that all items are numbered, like vector. However, when you remove item from the middle (or rather create new table w/o that item), other items won't reduce number by one.

19:50 that's in short what I need

19:50 Hash table where numbers are keys is a candidate

19:51 but I witsh it returned only value when mapped instead of key value pair.

19:51 *wish

19:51 gfredericks: you can call vals on a map

19:54 flying_rhino: gfredericks: what is speed penalty when iterating hash instead of vector?

19:54 gfredericks: assymptotically none I'm sure

19:56 flying_rhino: I just worry about too much overhead. Since that table like structure is a backbone of what I am trying to create so it is worth optimizing.

19:56 hence caution

19:57 gfredericks: write a protocol, implement it for map, code to the protocol, write your own type if it's too slow?

19:57 flying_rhino: gfredericks: thanks, I'll try

19:57 gfredericks: I guess that doesn't solve the seq problem though

19:58 flying_rhino: gfredericks: well hash table can be iterated.

19:59 gfredericks: things like map and reduce work on it.

19:59 gfredericks: right I meant your "I wish it just returned values" complaint

19:59 flying_rhino: gfredericks: yeah

19:59 gfredericks: I guess I can just create some macros so ithides implementation

19:59 *it hides

20:01 it would be t-map and t-reduce

20:01 or something

20:02 and t-filter

20:03 yeah that's probably a way to go

20:07 Guest92674: can somebody see if there is something wrong with my namespace definition. Im getting a 'unable to resolve symbol' error http://cljbin.com/paste/50b01cece4b0490da5c95e40

20:10 here's the whole file http://cljbin.com/paste/50b01d89e4b0490da5c95e42

20:14 gfredericks: Guest92674: you use sidebar-snippet before defining it

20:14 you can (declare sidebar-snippet) at the top if you want to keep them in that order

20:16 Guest92674: gfredericks: oh, i thought like haskell, the order of the function definitions didnt matter

20:16 thanks

20:16 gfredericks: clojure is single-pass; equivalent to entering the forms at the repl

20:17 Guest92674: what does single-pass mean

20:18 gfredericks: it just reads through the file once

20:18 aperiodic: Guest92674: most of my malformed ns statements result in an error about not being able to create sequences from symbols

20:33 flying_rhino: gfredericks: but even if it is single pass, the annoying thing is that wen you call function a from function b, and function b calls a it immediately screams an error. Even if it is single pass, it should only scream error if you actually call function a before defining function b.

20:34 all in all that's one thing that I find extremely annoying about clojure

20:34 gfredericks: I don't do that often enough to be extremely annoyed by it

20:34 I appreciate clojure behaving the same way whether it's reading code from a file or the repl

20:35 flying_rhino: it would still behave the same way. There is no reason for repl to complain either when you feed it function, as long as you don't try to call it

20:35 gfredericks: it has to compile the code, which means it has to resolve the symbols

20:36 also if the compiler didn't complain when you referenced things it didn't know about, a heckuva lot more typos wouldn't get noticed right away

20:36 romanandreg: dnolen: still over there?

20:37 dnolen: romanandreg: hey

20:37 romanandreg: dnolen: the code with the macro trying to use try is over here => https://github.com/BirdseyeSoftware/buster-cljs, in case you are still interested

20:38 flying_rhino: the far bigger problem is that from repl map get's called immediately while normally it is lazily evaluated so result may warry if var changes for some reson. (say due to binding)

20:39 dnolen: romanandreg: you have to watch out w/ cljs macros espcially macros that emit further macros

20:39 romanandreg: yeah, also the try macro is really magical

20:39 dnolen: romanandreg: you need to fully quality otherwise it'll get resolved to the wrong thing - i.e. your JS namespace and not your macro namespace.

20:40 gfredericks: romanandreg: I believe try is a special form

20:40 romanandreg: gfredericks: is actually both… try uses try* which is an special form

20:40 dnolen: romanandreg: line 11 in macros.clj looks wrong to me.

20:40 romanandreg: that the emitter check

20:40 gfredericks: romanandreg: ah ha

20:40 dnolen: romanandreg: same w/ line 96

20:40 romanandreg: dnolen: that one works well actually

20:40 flying_rhino: gfredericks: also compiler could throw a warning or something in case function contains symbol that's yet undefined. It still doesn't have to throw an error.

20:41 romanandreg: dnolen: that one works (not for the thrown? thrown-with-message? though

20:41 dnolen: romanandreg: I don't see how it could, fully qualify those symbols.

20:43 romanandreg: dnolen: hehehe, well it does, as long as thrown?, thrown-with-message? are not there

20:43 it compiles correctly and run buster.js tests correctly

20:43 runs*

20:44 dnolen: are you familiar with busterjs?

20:44 dnolen: romanandreg: well they look suspicious to me based on my experience w/ porting core.match & core.logic to CLJS

20:44 romanandreg: I am not

20:45 romanandreg: well yeah, they might be a bit "stretchy", not an expert on macros myself…

20:45 maybe they work as long as I don' do crazy stuff, the tests are not that extensive

20:46 buster.js, I could give a child to the guy that created it, is the best js test server I've found out there so far

20:47 dnolen: I wouldn't be surprised if your issues go away if you qualify, there's no other reason I can think of why your macros don't work.

20:48 romanandreg: dnolen: should I stick to single quote instead of syntax quote and qualify everything by hand?

20:48 dnolen: romanandreg: no just your macros.

20:48 clojurebot: Barking spiders!

20:50 dnolen: romanandreg: oops sorry I'm actually wrong I think - http://github.com/clojure/core.logic/blob/master/src/main/clojure/cljs/core/logic/macros.clj

20:50 romanandreg: I had to quality runtime calls to lib - not the macros.

20:51 romanandreg: dnolen: ok… I shouldn't qualify the functions that are actual cljs right? just the clj ones

20:51 dnolen: romanandreg: yes you need to qualify your CLJS fns, otherwise they get resolved to the macro ns.

20:52 romanandreg: dnolen: ok

20:52 dnolen: thanks for the enlightening on there

20:52 tomoj: you can manually (alias 'x 'the-cljs-ns) in clj

20:52 romanandreg: dnolen: how about cljs macros

20:52 ?

20:52 tomoj: to avoid having to fully qualify

20:53 dnolen: romanandreg: what do you mean?

20:53 romanandreg: like, I'm using the and macro inside a macro, should I put cljs.core/and

20:53 ?

20:53 tomoj: I got confused doing that with a cljs ns that has the same name as a clj macro ns, but I guess it's confusing no matter what

20:53 romanandreg: how does it tell the difference btw cljs.core on clojure and cljs.core on cljs?

20:54 dnolen: romanandreg: no

20:54 romanandreg: sorry for the confusion, you shouldn't have to qualify macros - just runtime functions

20:54 romanandreg: ok ok

20:54 hugod: dnolen: I'm now getting lb and ub called on ::not-found https://gist.github.com/4138017

20:55 romanandreg: don't worry, you won't be the last who will apologize for macros confusion :-p, there is no way around it

20:56 dnolen: hugod: go ahead and make a ticket + the code that triggers it.

20:56 hugod: dnolen: trying to create a simple repro case...

20:57 romanandreg: dnolen: thanks for the feedback man, I owe you a beer

21:00 dnolen: hugod: wow I really need to start using ritz, being able to see locals like that in stack trace ... I NEED THAT

21:00 hugod: it looks like somehow a logic var got unified w/ ::not-found

21:00 hugod: dnolen: makes life much easier ;)

21:00 dnolen: hugod: there's an assumption w/ the FD stuff that a FD constrained var will only take on integer values

21:01 hugod: dnolen: right, but somehow it's getting unified with ::not-found, as you say

21:01 dnolen: that's been violated - so it blows up trying to call lb/ub which only apply to the integer types or the domain types.

21:01 hugod: are you explicitly unifying with ::not-foudn?

21:02 hugod: oops I see it fixing

21:02 hugod: I have some rules that unify with ::not-found, and some that unify with an onteger

21:02 I assume some cross-talk between rules

21:04 the substitution map is even easier to work with when you can pretty print the values in the stack frames using 'd'...

21:07 dnolen: hugod: try master

21:09 hugod: looks like you're doing some fun stuff w/ core.logic :)

21:10 hugod: dnolen: pretty similar to what lynaghk is doing, and I've add guards for my rules

21:11 dnolen: hugod: nice! constraints really open the door for this use case I think.

21:11 hugod: dnolen: looks like I'm still getting the exception

21:12 dnolen: constraints are fantastic for this :)

21:12 Sgeo__: o.O dnolen where are these awesome almost CL-looking exception stuff coming from?

21:13 Just saw you link it on your Twitter

21:13 dnolen: Sgeo__: hugod's ritz

21:13 Sgeo__: Ah

21:13 I should set that up at some point

21:14 * bbloom checks twitter

21:14 bbloom: bwha? is that working now?

21:14 how can i get me some of that goodness? :-)

21:14 dnolen: hugod: the last commit should prevent unification w/ ::not-found from w/in core.logic itself.

21:14 hugod: is it some how slipping through because of the way you've written your code?

21:15 hugod: dnolen: it's possible - though I have gone through the logic a few times

21:15 Sgeo__: Oh, it starts another JVM?

21:15 I might not be able to do that on this POS computer

21:16 hugod: Sgeo__: attaching to a remote jvm is on the todo list

21:16 Sgeo__: Not what I meant

21:16 I meant, if... oh, now I'm confused

21:16 But if I'm running 2 JVMs instead of 1, not sure how my computer can handle that

21:16 bbloom: hugod: is https://github.com/pallet/ritz the homepage? where should i be looking?

21:17 hugod: bbloom: indeed - follow either the ritz-nrepl or ritz-swank links from there

21:18 bbloom: hugod: does it depend on emacs? or does it work with the normal nrepl too?

21:18 seancorfield: just noticed clojure-mode (1.11.5) enables slime for all clojure buffers (as a slime-connected-hook) - this plays havoc with nrepl... anyone else run into that problem?

21:19 hugod: bbloom: the only clients at the moment are nrepl.el and slime, so yes, depends on emacs

21:19 bbloom: it would be possible to extend to other clients though

21:20 bbloom: hugod: I'm a vim guy… I generally run nrepl in a tmux session

21:20 hugod: i have a pretty lowtech send-text-from-vim-to-tmux hotkey

21:20 aperiodic: tim pope is working on an nrepl client for vim

21:20 hugod: bbloom: a cdt type interface for lein repl would be possible, which would also work in vim once middleware support is in vimclojure

21:21 dnolen: hugod: try master now

21:22 bbloom: hugod: aperiodic: thx. i hope i get to play with it via vim land soon :-)

21:23 dnolen: seancorfield: it is a bit annoying - it's been that way for a long time I think. I have to turn clojure-mode on/off in order to use inferior lisp w/ CLJS for example.

21:24 aperiodic: bbloom: for now, you can get a pretty sweet setup with either slimv or vimclojure that's IMO loads better than the blitting text around w/tmux approach

21:24 bbloom: aperiodic: i'm using vimclojure but have all the nailgun stuff turned off. i found neither that nor slimv to really work correctly at all for me

21:24 but it's been a while since i tried

21:26 seancorfield: dnolen: good to know i'm not crazy... i just removed the hook and have commented the add-hook call out of clojure-mode.el for now

21:27 if slime/swank is deprecated for clojure now, and nrepl preferred, then that should be fixed - who maintains clojure-mode.el? is it technomancy ?

21:27 dnolen: seancorfield: yep

21:27 aperiodic: bbloom: oh, unfortunate. what sort of problems were you seeing?

21:28 bbloom: aperiodic: i forget, but i'm also doing a bunch of cljs stuff, so i've been finding it easier to just have a consistent experience, even if it's consistently bad

21:30 hugod: dnolen: still looking the same https://gist.github.com/4138096

21:31 the rule it is complaining about is [{:pallet.vm.ram ?r :kernel.fs.file-max ::not-found} {:kernel.fs.file-max 10240} (< ?r 2048)]

21:33 dnolen: hugod: yeah I'm confused as to how ?r is getting unified w/ ::not-found

21:33 seancorfield: dnolen: I opened an issue against clojure-mode

21:35 Deston: I must be doing something stupid here, but I haven't been able to figure out what. Would someone please enlighten me? http://pastebin.com/rVdCjHU1

21:36 gfredericks: Deston: your filter function needs to accept one arg

21:36 it will be a pair, but one arg nonetheless

21:36 you can use (fn [[a b]] (not= a b))

21:36 hugod: dnolen: it could be due to how I'm applying the guard? https://gist.github.com/e44877d0a1b69fa3ed89

21:37 Deston: oooh, right, derp.

21:37 thanks. I kept thinking it was the actually call to hamming-distance that it didn't like.

21:37 Sgeo__: Has to be an easier way

21:37 gfredericks: (partial apply not=) will also work

21:37 Sgeo__: No idea wh... oh

21:38 I was thinking in terms of composition for some reason

21:38 gfredericks: (comp #{2} count set) if you want to be clever

21:38 also (partial apply distinct?)

21:39 this discussion will not be complete until somebody figures out a way to use juxt

21:39 Deston: haha

21:41 erewhon: hugod: what are you using core.logic for?

21:42 (just curious seeing the kernel.fs.file-max bit)

21:43 dnolen: hugod: I've made unification w/ ::not-found impossible in master - try now.

21:46 hugod: (defn hamming-distance [dna1 dna2] (count (remove identity (map = dna1 dna2))))

21:48 erewhon: doing some software configuration...

21:49 Deston: ha, I like that one...

21:50 hugod: dnolen: still getting the exception - I have to go read to the kids - will try again in a while

21:51 erewhon: hugod: ok. a module / add-on for pallet, pallet itself, or something else?

22:08 bbloom: dnolen: are you using a query selector library with your clojurescript code? jquery? the goog.dom.query thing from dojo? something else?

22:09 dnolen: bbloom: not using anything since I mostly just hack on the compiler ;) but if I was going to use something I would look at domina

22:10 hugod: hmm very weird - feel free to open a ticket. I'd be curious to see the stack trace now.

22:10 bbloom: dnolen: ok yeah that's using goog.dom.query

22:11 dnolen: for some reason, i'm getting an exception in Compiler.java:903 com.google.javascript.jscomp.Compiler.newTracer when trying to require that

22:11 dnolen: bbloom: yeah dunno - tho that seems weird.

22:12 bbloom: dnolen: yeah, i'm not even sure how to go about debugging that now :-/ problem for another night, i'm headed out :-P

22:19 hugod: dnolen: hasn't changed any, afaict https://gist.github.com/cce071ec95aeef87e20a

22:27 tomoj: dumped brain, appreciate thoughts but know it's a lot to read: https://www.refheap.com/paste/bcc50aafcf1188b102b33cd21

22:27 ..plus haskell-ish. but the clojure at the bottom may help some

22:28 dnolen: hugod: go ahead and open a ticket - I must be missing a case somewhere - the locals in the second frame of the stack trace should not possible.

22:29 getting closer and closer on source maps for CLJS ...

22:29 erewhon: woo-hoo!

22:30 tufflax: What are source maps? :p

22:31 dnolen: so we can debug ClojureScript directly in our browsers

22:31 tufflax: ok :)

22:31 erewhon: it'll be awesome (at least i hope so)

22:32 dnolen: i was actually thinking about asking you about that again at the conj. had actually thought about volunteering to help it along but, uh, forgot.

22:33 hugod: erewhon: this is for something on top of pallet

22:34 dnolen: erewhon: I'm pretty sure it'll be awesome.

22:35 erewhon: dnolen: :-)

22:35 definitely looking forward to it

22:52 flying_rhino: can you in clojure have reference from one record to some other record?

22:52 gfredericks: just like with maps? {:foo {:bar 7}}?

22:53 seangrove: I'm seeing clojurescript objects that are never getting GC'd in the browser

22:53 Let me just double check that I'm using atoms correctly...

22:56 Is this the correct use of atoms? https://gist.github.com/ad13e5d068b32a6349c3

22:56 flying_rhino: gfredericks: I mean for example you have several vectors of records. You want some of them to reference other records (like foreign key in database). Only way I can think of is to make them hashes and use numbers as primary keys.

22:57 seangrove: Swapping to add items to the atom, and then clearing out the atom with a function that returns [], it seems all the controls stick around in memory and never get GC'd

22:58 erewhon: hugod: cool.

22:58 seangrove: To the point after a medium stress-test, it's taking up 67% of the browser's memory, or ~250MB or so

22:59 hugod: dnolen: my initial repro case (where I had an extra term using prep) was wrong - I was calling prep separately on the pattern and on the production so they were getting different logic vars.

23:00 dnolen: hugod: gotcha

23:02 seangrove: Any ideas why these persistent vectors are being kept in this list? http://dl.dropbox.com/u/412963/Screenshots/aj.png

23:03 Right now the atom is a PersistentVector with 0 items, so it shouldn't have any references to the outstanding objects

23:05 Sgeo__: Could that PersistentVector be referencing old versions that have references to the outstanding objects?

23:06 dnolen: seangrove: that map to dispose objects won't do anything tho right? map is lazy?

23:06 seangrove: in destroy-widget

23:06 seangrove: dnolen: Yeah, that's a separate piece, but you're absolutely right

23:06 Sgeo__: I didn't look at the code, sorry

23:07 seangrove: I should be using doseq

23:07 Sgeo__: Well, the PersistentVector is put into an Atom, and when swapping, I'm creating a new PersistentVector obviously, so there shouldn't be any references lingering around - so the GC should be able ot clean up

23:07 Unfortunately, there are references to it somewhere preventing it from being collected

23:08 dnolen: seangrove: I'd curious to know if you can recreate this issue w/o involving the DOM at all - it's definitely something we haven't looked at closely enough.

23:09 seangrove: dnolen: I can certainly give it a try, it may be an interplay between closure and cljs

23:10 More likely I suspect I'm doing something wrong, but as I do more mem/perf tests, I'm having a hard time tracking this down

23:10 dnolen: seangrove: so you can't always reproduce it?

23:10 yedi: how does incanter compare to just using something like R or maybe a numpy equivalent?

23:11 seangrove: dnolen: Oh no, I can reliably repro it every time

23:11 I'm just having a hard time figuring out where the references to these objects are coming from

23:11 dnolen: seangrove: so issue isn't related to using doseq? or is?

23:11 not using

23:11 seangrove: No, not at all

23:12 Oh, wait, maybe

23:12 Goodness, let me check..

23:12 The lazy reference could be the problem

23:12 dnolen: seangrove: yeah

23:17 seangrove: Alright, running the test again with doseq, will let you know if it didn't solve it...

23:21 brainproxy: Chousuke: cool gist! sorry was gone all day

23:22 seems like the same ideas for sure

23:34 tomoj: seangrove: are you aware of what *1 etc point to?

23:34 I had the same problem because I didn't think about those

23:35 seangrove: Not sure what *1 is?

23:35 tomoj: if you're in the repl

23:35 the 1'th 2'th etc result

23:36 er, *1 is the last evaluation result in the repl, *2 the one before that, and *3

23:36 seangrove: Ah, no not working from the repl right now

23:36 Have a more sparse setup right now, while I get a grip on it piece by piece

23:45 yedi: is next == rest

23:47 dnolen: yedi: no

23:47 antares_: yedi: http://clojure-doc.org/articles/language/collections_and_sequences.html#first_rest_next

23:48 yedi: i see

23:51 Raynes: antares_: That isn't the only difference.

23:52 dnolen: yedi: rest is lazier

23:52 antares_: Raynes: ok, what are other differences? (so I can document them)

23:52 tomoj: (= next (comp seq rest)) ?

23:53 dnolen: tomoj: pretty much, tho for perf reasons that's not actually done.

23:53 Raynes: antares_: rest has to know if there are more elements in order to return nil, which makes it more eager than next. I guess that doesn't necessarily have to be explained though.

23:53 tomoj: that's backwards

23:54 dnolen: next has to know, rest doesn't

23:54 Raynes: Then I guess clojure.org is wrong.

23:55 Oh, right, I was reading the old section.

23:56 &(rest ())

23:56 lazybot: ⇒ ()

23:56 dnolen: ah lazy-cons

23:57 Raynes: Anyways, I don't know if this actually matters to antares_ because I'm not sure a beginner reading that will even know what it means or care, or have to care for that matter.

23:57 But it might ought to be mentioned if you're going for a complete reference.

23:57 antares_: good to know for the guide on laziness

23:58 yedi: i think beginner readers probably should know about laziness

23:58 tomoj: lazy seqs complect laziness and seqness :(

Logging service provided by n01se.net