#clojure log - Oct 17 2012

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

0:16 xeqi: hmm, that sounds like a fun lazybot challenge

0:31 Raynes: xeqi: What?

0:31 Man, he already looks like Golum.

0:33 xeqi: forcing memory usage

0:34 though it just leads to not allowing others to use it, so not very nice

0:34 * it would

1:28 AtKaaZ: ,'hi wingy

1:28 clojurebot: hi

1:28 wingy: AtKaaZ: hi wazzup?

1:28 AtKaaZ: not much, bidding my time thru some datomic docs

1:29 s/dd/d/

1:39 wingy: i still need to watch database as a value by rich

1:46 AtKaaZ: wingy: you mean this? https://www.youtube.com/watch?v=EKdV1IgAaFc I didn't finish watching it, I don't understand what he means about the monkey

1:47 wingy: its the same topic .. i was referring to this one

1:47 http://www.infoq.com/presentations/Datomic-Database-Value

1:47 yeah must be something that we missed

1:48 AtKaaZ: he either talked about it before, or it's common knowledge between devs :)

1:48 wingy: but i can get the concept he is talking about

1:48 seems like its something they talked about

1:50 arrdem: has anyone now present actually used that DB system? I'm really curious about it.

1:53 ForSpareParts: Do you guys know of any clojure-native physics libraries?

1:54 There's a bunch of Java stuff, but I was hoping there might be something out there that leverages immutable data structures.

2:35 wingy: anyone here who has used https://github.com/clojure/data.xml and http://clojuredocs.org/clojure_core/clojure.xml and can give some thoughts about which one i should use

2:35 for reading and writing xml .. seems that both are capable of doing so

2:38 https://github.com/clojure/data.xml seems more powerful

2:38 and there is also https://github.com/clojure/data.json

2:38 nice fit

2:53 muhoo: cheshire too

2:54 wingy: i need some help

2:54 with retrieving a specific key of a parsed xml string

2:54 https://gist.github.com/3904073

2:55 muhoo: yeah .. why so many different json and xml parsers :)

2:55 muhoo: oh this xml tag nonsense? i had to do this recently. hmm, let me see

2:56 i used map, filter, and reduce

2:56 amalloy: i think there's something in clojure.xml or clojure.zip that makes nested access not awful

2:56 muhoo: reduce????

2:56 muhoo: amalloy: yes, to stuff them into a map in a different format

2:57 (reduce #(assoc %1 %2 (get-tag %2 m) {} [:tag1 :tag2 :tag3])) or something, i don't recall

2:57 amalloy: (->> m (:content) (filter (comp #{:expectedfields} :tag)) (first) (:content) (filter (comp #{:us_name} :tag)) (first) (:content)))

2:57 muhoo: reduce/assoc is almost always ebtter as into/for

2:58 muhoo: wingy: what amalloy said

2:58 god DAMN i knew amalloy would just crush it

2:58 amalloy: well that's really an awful solution. you want to abstract that out

2:59 wingy: perhaps i should have a look at zip

2:59 muhoo: yeah, but for a 1-liner in 30 seconds to illustrate the solution, that's sweet

2:59 amalloy: (into {} (for [tag [:t1 :t2 :t3]] [tag (get-tag tag m)])) is the right way to do your reduce/assoc, muhoo

2:59 muhoo: amalloy: thanks

2:59 amalloy: i <3 into/for so much

3:00 so much that words turn into curious glyphs when i try to speak about it

3:00 muhoo: funny, i used for a lot when i first started clojure, coming from python. after a while, i abandoned it, and started using map/reduce instead

3:00 aperiodic: it's grown on me quite a lot

3:01 one thing i hope somebody puts together w/codeq is some sort of visualization of the functions/macros i'm using the most changing over time

3:01 amalloy: if i ever write `(map #(` it's like...waiiit a minute, amalloy, put the knife down, nobody has to get hurt

3:02 every so often i decide it's actually what i want, but it's a huge warning sign

3:03 wingy: :s

3:03 so difficult to get

3:03 the zip thing

3:03 aperiodic: yeah, if you're using an anonymous function literal as the map fn, it'll probably read nicer as a for

3:05 muhoo: good point

3:05 amalloy: wingy: i don't think zip is very useful for you

3:05 wingy: amalloy: could we sum it up , what should i use to traverse it?

3:05 amalloy: you just need a function that's like (first-tag-named m tag-name)

3:06 and then the ->> i did is nicer

3:06 (defn first-tag-named [m tag-name] (first (filter (comp #{:tag-name} :tag))))

3:07 wingy: amalloy: btw the :content in the example is a list?

3:07 amalloy: (->> m :content (first-named :expectedfields) :content (first-named :us_name) :content)

3:08 wingy: i see

3:09 amalloy: then maybe write get-in-xml

3:09 which does that silliness when you write (get-in-xml m [:expected-fields :us_name])

3:10 muhoo: that's what my get-tag function did

3:11 fredyr: btw wouldn't the hiccup style representation of the xml be easier to use for traversing?

3:11 amalloy: fredyr: only a little

3:11 and maybe not even that

3:12 muhoo: afaict there's no non-ugly way to deal with xml

3:12 fredyr: it's a bit friendlier to the eyes imo at least

3:13 amalloy: fredyr: so? try writing that function to operate on hiccup

3:13 it's actually harder

3:14 muhoo: the java folks would probably use http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html

3:14 muhoo: hahaha

3:14 fredyr: :)

3:14 amalloy: and if you find that name so horrible that you want similar, made-up joke names: http://www.classnamer.com/

3:14 muhoo: i am right now procrastinating from dealing with an insane java bureaucracy to get a dialog to pass data back and forth to the main activity in android

3:14 fredyr: sorry amalloy i'm not arguing against your suggestion, just saying that i found the hiccup rep less noisy

3:15 amalloy: fredyr: i agree that the hiccup representation looks nicer, and i like using it to write xml

3:15 but it's not a convenient format for processing xml

3:15 muhoo: amalloy: that is by far the best java function name i've ever seen. thank for that.

3:15 aperiodic: oh wow, that fake javadoc is right on the money

3:16 amalloy: aperiodic: not fake at all. you'd think so, but no

3:16 it is a real class that is (was?) included in a real, recent version of a real project

3:16 muhoo: the onion couldn't have made something up that good

3:17 * aperiodic speechless

3:17 abp: Hi, has anyone tried to get some autocomplete working in clojurescript?

3:18 aperiodic: i thought HBase's WritableByteArrayComparable was bad

3:18 amalloy: aperiodic: https://twitter.com/ftrain/status/242597696949604352

3:19 abp: I would prefer using jquery-ui autocomplete, because I had a similiar requirement in terms of usage in another js-project, so I could grab the configuration from there once I got it working in cljs.

3:20 amalloy: i actually thought WriteableByteArrayComparable was a reasonable interface when i was doing cassandra or hadoop or whatever project wanted it

3:21 aperiodic: it actually does make sense, but i've found one invariably has a gut-level repulsion towards it on first encounter

3:23 i think it's because it's half adjectives

3:25 muhoo: let's name a class for all the interfaces it supports

3:28 aperiodic: it seems that way, but it's just an interface for things you can compare writable byte arrays to

3:56 tomoj: nrepl-set-ns does what I always wanted slime-repl-set-package to do :)

3:56 and it's easier to type..

3:57 and jumping works! hurray

3:57 ejackson: tomoj: you on linux ?

3:58 hoeck1: tomoj: haven't looked at nrepl.el for a while, can you use it productively now, as a full slime replacement?

3:59 tomoj: ejackson: yeah

3:59 I dunno, I just tried again

4:00 I don't have paredit in the repl

4:00 but I spent.. years.. that way before

4:00 maybe I can deal with it :(

4:00 ejackson: hoeck1: I'm using it full time to good effect

4:01 tomoj: are you using any autocomplete ?

4:01 hoeck1: ejackson: cool, last time, nrepl (the server) and overtone had still issues with, so I kept using slime

4:02 tomoj: autocomplete in repl doesn't work yet, hmm

4:02 wow, the completion that works in a file buffer is not at all what I want

4:03 ejackson: yeah, I've been struggling a bit. What happens if you type a java package like thing: com.tomoj.package ?

4:03 tomoj: hmm, maybe it is

4:03 actually yeah, that's better

4:04 I think

4:04 ouch

4:05 java packages seem to tab complete ok, I think

4:05 ejackson: hoeck1: i think samaaron has fixed it all up :)

4:05 tomoj: except it adds a space at the end

4:05 tab completing namespaces adds a space, which seems silly

4:05 ejackson: yeah, and what happens if the package is not found ? On my end it exceptions

4:06 tomoj: and completing at "la.tomoj.ns/" throws a nasty error

4:06 I just get 'no match'

4:08 guess it's good enough to keep trying

4:12 hyPiRion: yeah, nrepl is kind of nasty in that regard

4:12 It's getting better, though.

4:15 ejackson: tomoj, ok. I get a focus stealing exception and stacktrace ! Trying to fix it now.

4:15 otherwise I'm finding the whole thing great

4:30 Raynes: ejackson: Oh man, you're talking at the conj? Ugh, I'll refund my donation. No way I can go and listen to that accent for 40 minutes.

4:31 I'm just kidding, I can't deny my love for your accent. It's the whole reason I'm going. If all of the talks except for yours didn't happen, I'd still come away happy.

4:33 clgv: Raynes: got your founding complete, already?

4:33 Raynes: Yessir.

4:34 clgv: uh, that was pretty fast

4:34 Raynes: It took around… 16 hours?

4:34 clgv: you probably have to dance ;)

4:34 Raynes: See the footnote.

4:34 clgv: yeah, read it. just joking around

4:35 Raynes: This community is awesome.

4:35 This is my second trip to the conj fully funded without me doing much of anything.

4:35 Except being relatively poor. :p

4:36 clgv: the clojure community seems to be a very social environment in our capitalism world ;)

4:36 Raynes: Now I just hope I can get the money out of paypal and into my bank account before the planes leave.

4:36 Paypal horror stories scare me. I wish I could have found something else for donations, but it was all such short notice.

4:37 clgv: well you got at least 3 weeks, I guess

4:39 kral: namaste

4:39 Raynes: aloha

4:43 mindbender1: what's all this talk I hear of nrepl acting up for some. I have been totally enjoying a wonderful time doing autocomplete with nrepl.el, switching to cljs repl and back seemlessly from nrepl.el

4:43 antares_: Raynes: congrats about hitting the goal

4:44 Raynes: antares_: Thanks!

4:45 ejackson: Raynes: cheeky bastard !

4:46 Raynes: BTW I'm super pleased you got the funding sorted - no way the Conj would be the same w/o you there

4:46 Raynes: <3

4:46 AWizzArd: Were there some changes in Clojure 1.5.0-alpha5 with respect to the -main method? With alpha4 it compiles nicely, but with alphas 5-7 it doesn't. Could it have to do with swank missing support?

4:47 Exception in thread "main" java.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.Compiler$CompilerException, compiling:(swank/commands/basic.clj:182:25)

4:48 ejackson: Raynes: actually putting this talk together is winding me a bit. Its quite hard to think of something to say that is worth saying to that crowd. You know, like, they're all going to know anyting I say already :)

4:48 Raynes: People don't notice.

4:49 My entire talk was a code reading. I probably could have just showed the code and everyone would have known what was going on. I just made jokes about flatten and everybody seemed happy.

4:50 ejackson: yeah, I remember you had a lolcat or two - may follow your lead :)

4:51 Raynes: I had one of those every other slide, dude.

5:29 muhoo: Raynes: could be worse, you could be using bitcoin

5:30 actually i'm told stripe and dwolla are better than paypal, but i haven't used them yet

5:30 tomoj: bitcoin would be worse?

5:30 well, guess it'd be hard to pay for the flight

5:31 muhoo: trying to get money in and out of it.

5:32 i'll be using clojure and cljs to do a bitcoin interface for a guy soon. not that interested in bitcoin but it's an excuse to use clojure

5:32 tomoj: you might get someone to give you dwolla in #bitcoin-otc, but if paypal screws you, you're just screwed

5:32 of course dwolla is scary too :(

5:32 muhoo: and i'm getting paid in bitcoin, so i get to figure out how to exchange that for real money. it's a PITA

5:32 tomoj: using gloss?

5:33 muhoo: naw, just json to bitcoind

5:33 cheshire :-)

5:33 tomoj: I see

5:33 muhoo: but implementing the protocol using gloss/aleph would be fun too

5:33 wei_: have you heard of coinbase? might be useful to check out

5:34 muhoo: there are a bunch of those, yes

5:34 tomoj: I just found 364 lines of code towards a bitcoin clojure library

5:34 muhoo: really? where?

5:34 tomoj: haven't touched it since march :(

5:34 sitting on my disk

5:35 muhoo: hahaa

5:35 well if you want to stuff it onto github, maybe it'll get picked up

5:39 wei_: i did try to convince him to use a commercial service like coinbase, but no, he wants his own server, and his own web ui.

5:39 Raynes: muhoo: Careful, muhoo, you just told him you'd maintain his project.

5:39 Now he'll expect things of you.

5:39 muhoo: i said nothing of the sort.

5:39 read the transcript :-)

5:39 tomoj: needs updating for latest bitcoin, maybe gloss

5:39 Raynes: In so many words.

5:39 tomoj: and it has no docs

5:40 Raynes: Sounds like conch.sh.

5:40 tomoj: I think I can do that within a month or so and publish it after I confirm that it actually works

5:41 muhoo: cool. for what i'm doing, i'll have to stick with bitcoind and json, but it'd be interesting to see a native clj implementation.

5:41 tomoj: also, datomic..

5:42 muhoo: it uses datomic?

5:43 tomoj: no

5:43 I just started playing with datomic

5:43 but I think it could be interestin

5:49 muhoo: i noticed an isomorphism in clojure immutability, couchdb, git, and bitcoin.

5:50 and datomic

5:51 there's a kind of common thread through all of them.

5:52 tomoj: was it you who wrote that blog post?

5:53 couchdb, though?

5:53 its implementation?

5:54 I've wondered if couchdb has the properties necessary for datomic storage

5:59 abp: Meanwhile, got my jquery-ui autocomplete working. It actually wasn't very hard.

5:59 With Clojurescript.

6:09 tomoj: shouldn't vars be named?

6:13 edlich: They should.

6:15 ddeaguiar: wow, just installed the emacs-live config. really like it.

6:16 ejackson: ddeaguiar: yeah samaaron should get a medal for that. Its hyper useful.

6:17 ddeaguiar: ejackson: no kidding. I've gone through various permutations of emacs configs for working with clojure and think I've found the winner for me.

6:43 clgv: is there a cheat sheet for emacs and slime (not specialized on clojure)?

6:44 ejackson: clgv... yes... i have printout on my desk

6:44 clgv: ejackson: you got a link for me?

6:45 ejackson: right next to the paredit one :)

6:45 clgv.... looking

6:46 http://www.pchristensen.com/slimecommands.pdf

6:46 clgv: ejackson: thx. looks good

6:49 pyykkis: ejackson: would you happen to have a link to paredit cheatsheet also? :)

6:49 ejackson: hehehe LMGTFY :)

6:49 http://emacswiki.org/emacs/PareditCheatsheet

6:49 clgv: awesome

6:50 right I need paredit. does that ship with emacs or do I need to install that separately?

6:51 pyykkis: d'oh. :D Thanks a lot ejackson. :)

6:51 ejackson: np

7:03 clgv: will .emacs still be executed when I add an .emacs.d/init.el ?

7:06 hyPiRion: clgv: I don't think so, unless you manually load it from init.el

7:06 But it depends on what it checks first, I guess.

7:06 clgv: I already hate editing all those files ;)

7:07 ejackson: if you use samaaron's emacs live you can edit your own 'pack' that plays nicely with everything else

7:09 clgv: so to be safe I move the stuff from .emacs to .emacs.d/init.el?

7:10 AtKaaZ: cmdrdats, welcome

7:11 cmdrdats: hey :)

7:11 Raynes: $lmgtfy paredit cheatsheet

7:11 lazybot: http://www.lmgtfy.com/?q=paredit+cheatsheet

7:12 Raynes: ejackson: ^

7:13 ejackson: lol

7:13 mindbender1: technomancy: is it possible to get a cljs repl from a standalone clj repl

7:15 AtKaaZ: cmdrdats, good stuff there with clj-minecraft and clj-memorystone

7:20 cmdrdats: thanks - i need to get back onto it sometime

7:20 atkaaz: the craftbukkit guys have changed a ton of api's since I've done work it, so going to be a bit of a learning curve :P

7:21 AtKaaZ: I'm checking fightingsail

7:21 yeah it was tough but I learned some, still new to clojure though

7:25 AWizzArd: I already found the nrepl.el emacs support, but didn’t see what Leiningen plugin is needed to start an nrepl server from the shell.

7:26 ejackson: AWizzArd: i think for lein2 just doing lein repl brings up nrepl with a random port number to attach to

7:31 antares_: AWizzArd: lein repl :headless or just lein repl starts an nREPL server

7:35 AWizzArd: ok, will try that, thanks you two

7:40 cmdrdats: atkaaz: nice - fightingsail is no more than a skeleton though, but at least it sets up a 3d environment :)

7:41 AtKaaZ: cmdrdats, I saw jme3, but some deps fail to resolve, maybe they removed jogl from maven or something

7:45 works even so :)

7:45 cmdrdats: atkaaz: curious - I'm amazed it works with broken deps

7:45 AtKaaZ: yep about 4 of them

7:46 I looked are repos like this: http://dev.nightlabs.org/maven-repository/repo/com/jme3/oggd/3.0.0-SNAPSHOT/

7:46 but no .jar there

7:47 i see two cubes which aren't cubes cubes, rectangular cubes?

7:48 on like an island

7:49 antares_: AtKaaZ: you can use search on search.maven.org and oss.sonatype.org. Note that it may be that Maven Central is having an issue and returning 404s, it happens every so often.

7:51 AtKaaZ: thanks antares_, already found two on sonatype, ogg and vorbis

7:55 cmdrdats: atkaaz: yep, that's as far as I got with fightingsail, i'm afraid

7:55 then i got stuck trying to get the water to work, then distracted with work :P

7:56 AtKaaZ: i noticed that the ones I found were already below lol

7:56 well it works now, at least doesn't complain about ogg missing:)

7:56 cmdrdats: nice :)

7:56 Apage43: bluhr

7:56 using clojure.data.xml

7:57 there's not a way to prevent it from downloading the same DTD over and over when parsing lots of similar xml files

8:22 edlich: One question please: if I need to capture the state

8:23 of a chessprogram (board, rochade, etc.) in between the moves.

8:23 What should I take in cloujure?

8:23 (just one thread here, Alpha-Beta search comes later with safe datatypes)

8:23 def var and change value with alter-var-root?

8:23 But "vars are fundamentally intended to hold constant values" (Emrick, Carper,Grand) But Refs Atoms & Agents look like overkill because no thread-magic happens here.

8:24 clgv: edlich: you can use an atom if you have only one thread anyway

8:25 hyPiRion: edlich: The best would be to have a function which takes in the former state and an action, and then returns the new state

8:25 You could then recurse over it by e.g. reduce.

8:25 clgv: hyPiRion: `iterate` even ^^

8:25 antares_: edlich: just use an atom, it is blazing fast when there is no contention (e.g. with just 1 thread)

8:26 hyPiRion: clgv: Yeah, even iterate.

8:26 edlich: even if the synchronous stuff is not needed. ok.

8:26 antares_: edlich: for async updates you can use an agent

8:26 but for chessboard state you probably won't ever care about performance characteristics of the two

8:26 so just use an atom, it is dead easy to reason about

8:27 edlich: yes performance comes in another modele

8:27 module

8:27 clgv: edlich: I am not quite sure if there is any problem at all where alter-var-root is encouraged (except for "robert.hooke")

8:28 edlich: @hyRiPiRion I also thought about no state but let the (shit) rotate in a loop while getting the new move... ;-)

8:30 So atoms, agents and no state at all has to be tested...

8:34 So thanks all!

8:44 hyPiRion: edlich: it's more work to think without state, yeah :p

8:45 alexander__b: is it possible/neat to use clojure on android?

8:45 and if so, are there any good guides for complete android newbies that just don't like java? heh

8:46 I just set up an emulator and the SDK with an API and src. that's all of my android knowledge. I have a vague understanding of the underlying principles, with activities, views, etc. I just... don't want to use java.

8:47 antares_: alexander__b: http://clojure-android.blogspot.com/, http://www.deepbluelambda.org/programming/clojure/creating-android-applications-with-clojure. I don't know how much easier it is in the end but some people do it.

8:47 alexander__b: thanks

8:49 edlich: hyPiRion: yes. But it's the more fascinating perfect solution. I think it can work. Because I can always replay all moves! (Arena chess sends the entire line on each move)

9:16 :sthubner Did you wrote me yesterday about euroclojure?

9:27 babilen: Hi there. XML processing in Clojure (clojure.data.zip.xml et al.) is breaking my head. I am trying to parse https://www.refheap.com/paste/5938 and get a sequence such as ((("en" "foo") ("sv" "føø")) (("en" "bar") ("zh" "bar"))) -- I can access the content and even the attribute, but I have no idea how to get hold of the tags. Any hint would be appreciated.

9:29 antares_: babilen: you can use jsoup directly for XML if you find data.xml or zippers too painful. that's what I do.

9:29 jsoup.org

9:30 duck1123: I've found that XOM is fairly easy to use from Clojure

9:31 ejackson: babilen: i've used enlive well for this

9:31 babilen: antares_: I happily use c.data.zip.xml if I know which tag (sequence) I am after. I am just not sure how to formulate something like "all (tag, content) tuples of all children of tag page" or something like that.

9:32 ejackson: Yeah, I was thinking about enlive, but that is yet another dependency for something that should (IMHO) be really easy.

9:32 mklappstuhl: hey there

9:32 babilen: Thanks for the tips though and I'll take a look at jsoup, XOM and enlive for that.

9:34 duck1123: XOM is probably only worth it if you need ns support, the other options are probably a better fit for your usecase

9:35 still, it does handle XPath well enough that it would make parsing that doc pretty easy

9:39 babilen: I'll take a look at enlive. Bit sad that I'll probably spend the next 2 hours learning it before I can tackle the problem at hand. But well, guess that is OK.

9:41 algernon: babilen: enlive is fairly straightforward, imo. if you want all (tag, content), that's pretty much [:.tag] (do-what-you-want-with-it) in a defsnippet.

9:43 babilen: algernon: Yeah, I have the impression that learning enlive will pay off and I am sure that the solution will be quite easy in the end. I just haven't used it before and therefore have to start from the beginning. But thanks for the heads up!

9:45 Cheiron: Hi, what is the difference between assoc-in and update-in?

9:46 ejackson: Cheiron: update in calls a function f on the element, assoc-in just assocs a new value

9:46 babilen: Cheiron: The latter takes a function

9:46 Cheiron: but the final output should be the same?

9:47 ejackson: ,(update-in {:a 1} [:a] inc)

9:47 clojurebot: {:a 2}

9:48 antares_: ,(assoc-in {:a 1} [:a] 100)

9:48 clojurebot: {:a 100}

9:48 antares_: Cheiron: it depends on what function you pass in. If the new value depends on the old one, use update-in. If it's just an arbitrary value, use assoc-in.

9:49 _ulises: quick question: isn't nrepl-jack-in supposed to ask me where my project directory is?

9:51 ejackson: _ulises: i always just get it to infer it from the currently active buffer

9:51 _ulises: ejackson: ah, interesting

9:51 ejackson: I was under the impression that if it couldn't infer then it'd ask you

9:52 ejackson: perhaps you have a project.clj in your root dir ? :P

9:54 _ulises: ejackson: no, that's not the case

9:54 ejackson: I recently migrated; I must've broken something

9:54 ejackson: and not read the docs properly, of course.

9:54 ejackson: i don't know how it works really, to be honest :)

9:54 always do the thing that works... and carry on.

9:58 _ulises: ejackson: yeah, slime worked for me and then I decided to migrate :'(

9:58 ejackson: no worries and thanks anyway

9:58 ejackson: what isn't working

9:58 there are a couple of options

9:59 if you open the pom.xml you want, and then m-x nrepl-jack-in it should work

9:59 or if you run lein repl from the cmd line, you can then connect to that nrepl from emacs with m-x nrepl

10:04 _ulises: ejackson: now it all works; I had a stale nrepl server running who knows where. I've killed it and jacked-in from a buffer in my project and the world is again a safe place. Thanks!

10:05 ejackson: good to hear

10:13 goracio: hi are there any syntax checker for clojure ? was seeking mistake half an hour - i use sublime and loaded project to eclipse with clojure plugin eclipse didn't complaint about mistake

10:14 or maybe this is not mistake ? (ns ... (testpro.models.replies as mrepl) no : before as

10:14 nDuff: goracio: There are some static-checking tools available.

10:14 ...and yes, that's not a mistake; it has a valid meaning.

10:15 AtKaaZ: what does it mean?

10:15 scriptor: as the error says, it should be :as instead of as

10:15 goracio: error says that there is no file

10:15 nothing about :

10:15 mklappstuhl: I'm given a task to develop a server with simple domain logic (mainly storage & rest stuff) and I'd like to avoid java (which is used on the desktop side of this project) ... my experience in clojure is not very high, nontheless I'd like to have some good arguments in the java vs. clojure debate

10:15 nDuff: Yes, it's trying to use testpro.models.replies.as

10:15 which isn't what they want, but _is_ syntactically valid.

10:16 AtKaaZ: sweet haha

10:16 babilen: algernon: Hmm, I don't quite understand your example. I am trying to *extract* information from the XML file I pasted earlier and I don't know which tags will be used as children to <page>. I want to extract all children of <page> and get (tag, content) tuple.

10:16 scriptor: ah, you still need to add a colon before the `as` though

10:16 nDuff: scriptor: Only if you want it to be treated as a keyword rather than an instruction to load something named "as". :)

10:16 AWizzArd: I am using nrepl now for the first time. Instead of sseeing docstrings I get this error message: „eldoc error: (error No buffer named *nrepl-connection*)”. In the shell I did a „lein repl :headless” and connected to it. In my emacs config I added „(add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode)”. Ideas?

10:16 AtKaaZ: I'll add that to my list, thanks goracio:)

10:16 goracio: so no checker could tell that this is a mistake ?

10:16 babilen: algernon: I've started playing with enlive but haven't (yet) found a way to get the (tag, content) pair of all children of a location

10:16 jkkramer: ns is notoriously tricky for newcomers. best to read and absorb the docs carefully. ##(doc ns)

10:16 lazybot: ⇒ "Macro ([name docstring? attr-map? references*]); Sets *ns* to the namespace named by name (unevaluated), creating it if needed. references can be zero or more of: (:refer-clojure ...) (:require ...) (:use ...) (:import ...) (:load ...) (:gen-class) with the syn... https://www.refheap.com/paste/5940

10:17 nDuff: goracio: it could be detected as a warning, but not a 100% error

10:17 babilen: algernon: And it looks as if defsnippet is used in the context of generation rather than scraping.

10:17 goracio: nDuff: from where as a warning ?

10:17 scriptor: goracio: because it's still valid clojure code

10:17 nDuff: goracio: I didn't say anything detects it as a warning _now_.

10:17 goracio: ...but there is at least one static checker available.

10:17 goracio: lein check also give no warning only file not found mistake

10:18 nDuff: goracio: see https://github.com/jonase/kibit

10:18 algernon: babilen: ah, right. yes, defsnippet is generation. (I mostly used enlive for that, let me refresh my memory)

10:18 nDuff: goracio: ...but again, I'm not asserting that it actually throws a warning, just saying it _could_ if someone chose to add it.

10:18 scriptor: hmm, where is the source for lein check?

10:18 goracio: nDuff:will check that

10:19 scriptor: what you mean ?

10:19 nDuff: goracio: ...if you care about that particular case being supported, by all means submit a patch to kibit adding it.

10:19 scriptor: goracio: sorry, wasn't directed at you, just wondering in general

10:20 it'd be interesting to see how easy it'd be to add a warning for that to lein check, although I probably don't know enough clojure to do that

10:20 or to kibit, for that matter

10:20 ohpauleez: I or Jonas will approve all good patches for kibit rules - we certainly welcome them

10:22 algernon: babilen: off the top of my head: (html/select *your-content* [:page html/content]) should get you a list of all the children of page, which you can map over and extract whatever further stuff you need with enlive functions

10:24 hrm, perhaps that's not right.. looking at enlive-tutorial's scrape3.clj, that does something similar to what you want, I think

10:25 babilen: algernon: Yeah, I know how to get content of tags/nodes that I know in advance. But here I only know that I want all children of something. I could, naturally, do something like (map (juxt :tag html/text) (html/select p [:page html/content])) and clean up the results manually, but that feels wrong.

10:29 scriptor: ohpauleez: as a rough sketch, would a rule checking for as/:as errors looking something like [(use ?x as ?y) (use ?x :as ?y)] ?

10:30 ohpauleez: yes

10:30 Scriptor: ^

10:33 scriptor: extending that to (ns (:use …)) might be trickier ...

10:44 pandeiro: say i'm making an API and i want to have a special version of it for REPL usage: better to use the same function names in whatever.repl ns, or do something to differentiate (like an asterisk)?

10:51 gtrak: pandeiro: what's the difference except maybe using literals and data for things?

10:51 goracio: is there any equivalent to "and" "or" in clojure ? ( if (this and that) (do this) (otherwise))

10:52 gtrak: goracio: try and or or, but it's prefix notation

10:52 hyPiRion: goracio: (if (and this that) (do this) (otherwise))

10:52 same applies to or

10:53 goracio: ah ok

10:54 seems obvious how i didn't try this :)

10:54 gtrak: goracio: they're macros so they short-circuit

10:55 ,(and (println 1) (println 2))

10:55 clojurebot: 1

10:55 gtrak: since println returned nil

10:58 clgv: pandeiro: if you want to separate it like that thats ok I guess. you can even do better and annotate with metadata the function you want to use in the repl frequently and have a "list-command" function that parses the namespace for functions with that metadata

10:59 ejackson: clgv: that's sneaky-cool.

10:59 clgv: ejackson: yeah, I used it in a DSL to automatically `refer` the DSL words when loading a document ;)

11:01 pandeiro: clgv: hmm, not sure i understand how to do that

11:01 gtrak: the difference in this case will be that this is a cljs lib that will do async requests, and i would like syncronous versions for use at the repl

11:02 gtrak: ah, can you wrap everything in promises?

11:02 I think a separate ns makes sense

11:03 pandeiro: gtrak: hmm, hadn't considered that, i am basically wrapping the google closure xhr.net.io or whatever it is

11:03 gtrak: I'm doing the same thing in jvm-land

11:03 pandeiro: i think the repl ns is a good idea, just wondering if there is an established way to handle functions that are specifically for development vs. the actual api versions

11:04 gtrak: in jvm clojure, I might consider putting it in a test ns

11:04 clgv: pandeiro: docstrings? ;)

11:04 pandeiro: clgv: got those :)

11:04 clgv: pandeiro: depends on what you mean with "handle"^^

11:04 gtrak: if it's code that isn't going to be used live, then it shouldn't exist live

11:05 pandeiro: clgv: handle as in 'present to the user of the library'

11:05 gtrak: in this case, it shouldn't be called anywhere in an actual cljs app, ergo the closure compiler should not include it

11:05 gtrak: ah ok

11:05 best of both worlds, then

11:06 pandeiro: playing with async fns at the cljs repl is a pain b/c of how println works*

11:06 gtrak: I wish I could have whole-program optimization on jvm :-)

11:06 abp: Hm, default in protocols should handle everything that the protocol is not explicitly extend to, shouldn't it?

11:06 Even keywords in Cljurescript

11:06 gtrak: b/c it has to load all the classes recursively

11:07 pandeiro: anyway i think i will just mirror the fn names in the repl namespace and see if anyone complains later... thks clgv gtrak

11:07 mklappstuhl: I'm given a task to develop a server with simple domain logic (mainly storage & rest stuff) and I'd like to avoid java (which is used on the desktop side of this project) ... my experience in clojure is not very high, nontheless I'd like to have some good arguments in the java vs. clojure debate ... does anyone have any links or comments to that?

11:08 clgv: mklappstuhl: declarative desciption of your rest api/resources could be one

11:16 mklappstuhl: clgv: what exactly do you mean my declarative? the way java does it also seems kind of declarative to me

11:19 abp: Good that no one answered to my question, I were tangled in a lack of attention. :)

11:20 wingy: I can't get how I can make compojure reload the code

11:20 abp: wingy: Are you running jetty from the repl?

11:20 weavejester: wingy: How do you want it to reload the code? Automatically? Via the REPL?

11:21 wingy: abp weavejester: I have this line in the server file: (run-jetty #'handler {:port (get config :port) :join? false})

11:21 its wrapped in a "main" function which I run on the cli: (-main)

11:21 clgv: mklappstuhl: well usually in clojure due to macros (and maybe also the literal notation for sets and maps) you can be declarative within the language and without xml-bloat

11:22 weavejester: wingy: That looks okay so far.

11:22 abp: weavejester: Starting via run-jetty, passing a var, then reloading code stopped working for me a while ago. With nrepl in eclipse.

11:22 wingy: that starts the server .. i thought the #'handler would make the code reload when running: (require 'myapp.server :reload-all)

11:22 clgv: mklappstuhl: if you really convince your project leader(s) you will have to compare the best java lib with the best clojure lib anyway and show them that it is faster to do in clojure and hence cheaper...

11:23 abp: weavejester: Used lein-ring with nrepl-server started from :init for a while, so I do it like that now too.

11:23 weavejester: wingy: Passing it as a var means run-jetty will take the latest version of the var.

11:24 wingy: What part isn't "reloading"?

11:24 wingy: The definition of handler?

11:24 wingy: weavejester: i added a println message in a route handler and it is using the latest since i can see the new message

11:25 weavejester: wingy: So why do you think it isn't reloading?

11:25 wingy: weavejester: i just realized it now .. but the hiccup templates are not reloading

11:25 so perhaps it has something to do with hiccup?

11:26 let me retry

11:28 weavejester: wingy: There shouldn't be anything special with Hiccup with regard to reloading.

11:28 wingy: But it might be that you haven't reloaded your view namespaces

11:30 wingy: weavejester: actually now it worked with (require 'myapp.server :reload-all)

11:30 mklappstuhl: clgv: ok, got what you meant by declarative... thought you were referring to a specific lib or something like that

11:31 abalone: basic naive question: can ClojureScript (javascript) be used for server administration / deployment to cloud infrastructure, etc?

11:32 nDuff: abalone: If you have infrastructure that lets you do it with javascript alone, sure. :)

11:33 abalone: nDuff: is that rare?

11:33 nDuff: abalone: ...inasmuch as you have RESTful APIs and such, it can probably be done, but you'd be building a lot of parts on your own

11:33 mklappstuhl: nDuff: why would you aim to do that?

11:33 weavejester: wingy: Out of interest, what version of Clojure are you running?

11:34 nDuff: vs having higher-level APIs available for other platforms (Java, Ruby, &c).

11:34 mklappstuhl: I wouldn't.

11:34 mklappstuhl: ...but abalone asked.

11:34 abalone: nDuff: sounds like it would be better to use some existing thing

11:34 nDuff: abalone: Yup, sure would.

11:34 wingy: weavejester: 1.4

11:34 abalone: nDuff: darn. i was trying to come up with excuses to use clojurescript

11:35 wingy: weavejester: the values defined with (def) doesnt update

11:35 nDuff: abalone: If you aren't getting asked to build web UIs to your infrastructure, count yourself lucky. Otherwise, you'll find an excuse sooner or later. :)

11:35 wingy: should i wrap them in (defn) or is it a better way to having them reloading?

11:36 mklappstuhl: nDuff: oh, then this question was directed to abalone , sorry

11:37 nDuff: wingy: ...if you want to be able to mutate something without coordination, sounds like a job for an atom, unless you'd have a reason a dynamic var would make more sense (like being able to install temporary, thread-local values during test execution)...

11:37 abalone: mklappstuhl: yeah, i'd only want to use clojurescript if the existing already-invented wheels were on par with other options

11:37 clgv: abalone: clojure can though. the lib is called pallet

11:38 abalone: OH IS THAT SO? cackles

11:38 clgv: that is very good to hear

11:38 i may have my dream after all

11:38 wingy: nDuff: i just want the value to update when I run (require 'myapp.server :reload-all) .. the suggestions are still atom/dynamic var ?

11:39 clgv: I only use rsync and exec-script right now, but that library even has built-in support to install ubuntu-packages remotely ;)

11:39 abalone: clgv: i'm very glad you mentioned it

11:40 clgv: or even more advanced setup instances on cloud services^^

11:54 wingy: this is so weird .. suddenly the hiccup templates aren't reloading again when doing (require 'myapp.server :reload-all)

11:56 abp: wingy: Do you have multiple java processes running?

11:57 wingy: abp: i have light table and this app server running

11:57 abp: wingy: I once had a problem with an old server still running and answering the requests..

11:58 wingy: now its working again

11:58 i have no clue

11:58 let me start a new instance and try it again

11:58 abp: wingy: Yes. My problems were with hiccup templates too. Will investigate as soon as I can.

11:59 wingy: Got to go now. Good luck. Will have a look at the irc-logs later.

11:59 wingy: abp: ok thx

12:00 think i knw what the problem is

12:00 the namespace wasn't reloading

12:01 i reloaded the hiccup template namespace separately and it worked .. though reloading the main server file should reload the template namespace since i used :reload-all

12:01 i thought

12:03 clgv: wingy: maybe the templates are loaded within a function - then you would have to reload-all and call that function

12:04 wingy: clgv: no the route is executing that function to get the template

12:04 and the route executes it everytime i refresh the browser

12:05 im sure that the namespace wasn't updated .. i can actually see this with the repl wait

12:05 clgv: ok. that would have been a possible explanation ;)

12:06 wingy: yepp .. that was the case

12:07 so that leaves .. why isn't template namespace reloading when i reload the main file

12:07 i think i read something about it in the doc

12:09 (require 'myapp :reload-all :verbose) confirms that it reloads only itself and not the other files it requires in the head

12:11 seems to be a clojure issue then .. does anyone know how i can reload a file and all the other files it requires recursively til the chain is ending?

12:12 jkkramer: wingy: a common practice is to reload a file or section as you edit it using the appropriate shortcut in your IDE - e.g., C-c C-k in Emacs. it's a lot easier than putting in "(require … :reload)" all the time in the repl

12:12 wingy: yeah

12:13 waiting for Light Table to be ready .. im using Sublime text atm

12:14 jkkramer: eclipse & counterclockwise are relatively easy to setup if you don't want to go down the Emacs rabbit hole

12:15 wingy: jkkramer: i should look at eclipse/ccw

12:17 hldfr: wingy I switched to emacs from sublime text recently, I'm not looking back to anything else now

12:17 wingy: hldfr: im more of a fan of light table though .. its the future!

12:18 hldfr: wingy: yes, it's exciting :)

12:18 wingy: i would have used emacs if not for light table though

12:18 hldfr: I must try light table sometime

12:19 wingy: try it now .. the repl is awesome

12:19 live eval

12:19 much better than using the lein repl to test out snippets

12:19 nDuff: Is light table actually useful for real-world projects now? Last I played with it it was a fun toy, but Emacs was still the right thing for actual work.

12:20 hldfr: getting the jar

12:20 wingy: nDuff: its not ready for real world projects

12:20 hldfr: I've been reading about it time to time

12:20 wingy: more like a repl for now

12:21 thorbjornDX: supposedly lighttable has project integration now, but I haven't used it with much success

12:21 wingy: but its on its way .. the features look good for real world projects when its ready

12:22 thorbjornDX: I would love to see scm integration of some sort

12:22 wingy: still buggy and missing basic features for ditching your favorite ide

12:22 TimMc: No paredit yet?

12:22 wingy: yeah i think he'll cover it .. he's a good visionary .. knowing where we should head

12:23 TimMc: no

12:23 hldfr: I've been wondering if emacs-live is just meant for music, or do people also use it as a good default emacs config for clojure ? https://github.com/overtone/emacs-live

12:25 love the doc popup as seen here https://github.com/downloads/overtone/live-coding-emacs/live-coding-config-in-use.png

12:29 thmzlt: hldfr: I use emacs-live for clojure in general

12:29 hldfr: thmzlt I'm new to both clojure, emacs, is it good off the shelf or needs more work/understanding of emacs ?

12:30 s/or/or does it/

12:30 nDuff: hldfr: emacs-live is a pretty nice off-the-shelf package.

12:30 thmzlt: hldfr: good off the shell, I use because I don't want (yet) to figure out emacs

12:31 nDuff: hldfr: ...much easier to configure than building your own emacs setup from scratch..

12:31 hldfr: nDuff thmzlt sounds perfect, gonna try tonight :)

12:31 nDuff: hldfr: ...that said, to get a good experience out of it, you _will_ want to learn to use paredit-mode.

12:31 pipeline: paredit has driven me insane so far, i have not got the knack

12:31 thmzlt: nDuff: what is there to learn about paredit?

12:31 nDuff: thmzlt: the keybindings?

12:32 hldfr: ...that said, paredit will help your productivity enough that it'll pay for itself in very little time.

12:32 technomancy: learning paredit is all about coming to grips with your own shortcomings

12:32 realizing that your editing desires are often corrupt and that you need to change your expectations to focus on what is right

12:32 thmzlt: I don't know any paredit keybindings and I use it just fine, what should I know?

12:32 hldfr: nDuff nice, I'm yet to explore paredit too, thx

12:33 thmzlt: technomancy: example?

12:33 technomancy: thmzlt: people get frustrated about paredit because it prevents them from performing actions that would result in broken structure

12:34 nDuff: thmzlt: the slurp commands are the big ones to me, but individual workflows differ.

12:34 technomancy: it shows them that they're asking the wrong questions. don't ask "how can I delete this paren" but "how can I move this expression to the right place"

12:34 hldfr: would love to do that ^

12:34 pipeline: also it occasionally crashes out.

12:34 thmzlt: technomancy: right.

12:35 nDuff: pipeline: Only bugs I've seen in the paredit version shipped with emacs-live surround overwrite mode

12:35 pipeline: ...and I use it day-in-day-out.

12:35 thmzlt: technomancy: but all I do is C-k to move forms around

12:35 nDuff: (and overwrite mode is evil)

12:35 egghead: paredit really is one of those things that is confusing at first but insanely rewarding

12:36 thmzlt: also, if you C-k from within a string, it breaks

12:36 technomancy: thmzlt: 50% of the benefit of paredit is just what it doesn't let you do. but the slurp and splice commands are definitely worth learning.

12:36 egghead: a lot of what I use it for (moving around blocks of code) is similar to d% in vim tho

12:36 technomancy: thmzlt: o_O

12:36 haven't seen that

12:36 nDuff: thmzlt: Not the version I'm running.

12:36 thmzlt: ...correctly cuts only the remainder of that string for me.

12:36 thmzlt: maybe it's caused by something else in emacs-live

12:37 * nDuff is also using emacs-live.

12:38 thmzlt: yeah, I just tested it now and it worked fine, but sometimes it kills the closing \"

12:39 * technomancy just learned M-", which wraps the next expression in "" and automatically quotes any strings inside

12:39 technomancy: interesting

12:41 gfredericks: technomancy: you can splice back out of the string as well

12:41 technomancy: oh fancy; didn't realize splice worked inside strings

12:41 and it unquotes

12:41 huh; the cheat sheet doesn't cover convolute-sexp

12:42 gfredericks: technomancy: I didn't know about M-" so we inter-learned each other

12:42 in a very symmetric way

12:42 technomancy: gfredericks: o/

12:42 gfredericks: \o

12:42 technomancy: =D

12:43 gfredericks: it's like we each had half a locket...

12:44 goracio: suppose we have 2 lists - list1 list2 : how to get list1 without elements in list2 ?

12:44 nDuff: Hrm.

12:45 * nDuff overrides a protocol implementation provided by stock clj-msgpack, and has a moment of feeling very, very icky.

12:47 jkkramer: goracio: (remove (set list2) list1)

12:48 nDuff: ...be nice if there were a way to do this only within a thread / binding context / such...

12:48 goracio: jkkramer: thanks it's magic i don't understand so far but it works :)

12:49 pjstadig: technomancy & gfredericks: you guys are weird

12:49 but informative

12:56 rlb: TimMc: yeah, incanter window's blank here via ssh -X or -Y. It works fine locally...

12:56 s/window's/window is/

12:59 Kototama: so for the daring minds using clojurescript with lein cljsbuild auto I have written a little emacs mode: https://github.com/kototama/cljsbuild-mode

13:02 TimMc: rlb: The window does appear, though?

13:13 jcromartie: what's the easiest way to serve up a REPL from my Java web app

13:22 andrewmcveigh: jcromartie: I've done it with clojure.tools.nrepl, fairly straightforward.

13:27 Cheiron: Hi, I have a map of maps . i want to iterate through the maps , if any of the maps isn't consisting of three elements, i want to return false. otherwise return true (which means each of the nested maps consist of three elements)

13:27 S11001001: ,(doc all?)

13:28 clojurebot: Cool story bro.

13:28 S11001001: ,(doc every?)

13:28 clojurebot: "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."

13:28 S11001001: Cheiron: you can use every? *again* in the pred you pass to the outer every?

13:29 TimMc: (every? #(= (count (val %)) 3) map-of-maps)

13:29 S11001001: TimMc: I think Cheiron wants to test the submaps' sizes

13:29 Cheiron: yes indeed

13:30 S11001001: ..in which case maybe you don't need to nest

13:30 Cheiron: don't need to nest?

13:30 the data structure I have is a map of maps

13:30 can't change that

13:30 TimMc: S11001001: Pretty sure that's what my code does.

13:30 S11001001: Cheiron: I thought you wanted to lift the "does this have 3 elts"? test twice

13:30 but maybe you only want to lift it once

13:30 TimMc: &(every? #(= (count (val %)) 3) {:x {:a 1 :b 2 :c 3} :y {:d 4 :e 5 :f 6}})

13:31 lazybot: ⇒ true

13:31 hyPiRion: 'Course you can: (every? #(= (count (val %)) 3) (apply concat map-of-maps))

13:31 S11001001: hyPiRion: nope, keys

13:31 hyPiRion: o

13:32 Cheiron: TimMc: why you are passing val?

13:32 hyPiRion: ,(val [0 1])

13:32 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry>

13:32 hyPiRion: Well, val takes a map entry and gives the value in that entry.

13:33 Cheiron: oh eye c

13:33 thorbjornDX: what's the best way to profile clojure code?

13:33 TimMc: That predicate gets Map.Entry key-value pairs. The values, in this case, should be 3-element maps.

13:33 Cheiron: thorbjornDX: VisualVM ?

13:34 TimMc: Hmm, someone in here does work on a commercial JVM profiler... I can't recall the name.

13:34 thorbjornDX: Cheiron: I'll give it a look

13:35 jcromartie: what replaces add-classpath?

13:36 Cheiron: TimMc: Thanks, it works !

13:37 technomancy: jcromartie: pomegranate, sorta

13:37 clojurebot: ok, fail. pomegranate is installed, but this dies:

13:37 technomancy: clojurebot: jerk

13:37 clojurebot: you cut me deep, man.

13:37 TimMc: clojurebot: forget ok, fail. pomegranate |is| installed, but this dies:

13:37 clojurebot: I forgot that ok, fail. pomegranate is installed, but this dies:

13:37 * TimMc remains skeptical

13:38 TimMc: pomegranate

13:39 Oops. OK, that worked in PM. I thought "." was causing it problems, but I guess not.

13:39 thorbjornDX: Cheiron: visualvm seems like overkill for my problem, maybe I just want "time" :p

13:39 TimMc: thorbjornDX: You want benchmarking?

13:39 Cheiron: clojurebot: this IRC desrves a better bot, like me !

13:39 clojurebot: Thanks! Can I have chocolate next time

13:39 TimMc: >_<

13:40 thorbjornDX: TimMc: yeah, I think that's more accurate

13:40 TimMc: I have a feeling my memory is exploding too, but I can live with that for now

13:40 TimMc: clojurebot: benchmarking is https://github.com/hugoduncan/criterium

13:40 clojurebot: You don't have to tell me twice.

13:41 TimMc: thorbjornDX: ^ Works nicely.

13:41 thorbjornDX: TimMc: thanks for the link, looks good

13:41 Cheiron: thorbjornDX: https://github.com/ptaoussanis/timbre

13:42 thorbjornDX: Cheiron: ah, this looks good. Thanks :)

13:48 TimMc: YourKit, that's the one.

13:49 Wait, why does a logging lib include a profiling utility?

13:53 dnolen: ohpauleez: hey when you get a second can you chime in on this http://dev.clojure.org/jira/browse/CLJS-395

13:54 ohpauleez: dnolen: definitely, I'll look right now

13:56 weird, I'm working on two nodejs CLJS apps and I haven't seen that error

13:59 I'll assign it to myself and see what I can find.

14:00 dnolen: ohpauleez: do you use advanced optimization or just simple?

14:00 Cheiron: the body of when is enclosed with implicit do , right?

14:00 dnolen: Cheiron: yes

14:00 ohpauleez: dnolen: I have it on simple right now

14:00 Cheiron: which means the body could consist of many forms, correct?

14:00 dnolen: Cheiron: yes

14:01 Cheiron: hmmmm, strange

14:01 dnolen: ohpauleez: do you see the error if you switch to advanced?

14:01 Cheiron: I have a when, the body is executed even if the condition is false, once i wrap the body with do , when is behaving as expected

14:02 TimMc: Cheiron: in CLJ or CLJS?

14:02 Cheiron: Clojure

14:02 dnolen: Cheiron: paste

14:04 Cheiron: http://pastie.org/5074427

14:04 Storm powered project

14:05 ohpauleez: dnolen: Nope, on my own branch no errors. I'll try on master and poke around

14:05 Cheiron: Oh, extra ) at line 3

14:06 dnolen: ohpauleez: thx much

14:06 ohpauleez: np

14:06 Cheiron: thank you all guys, it was the extra ) at line #3

14:07 don't blame me, blame the long coding sessions :)

14:07 clojurebot: have you read "Hackers and Painters" ?

14:07 clojurebot: I don't understand.

14:25 doomlord: does there exist a tool for searching a sourcebase for a function by providing sample input and output. i think lisps' would suit this. eg you submit (??? [1 2][3 4])=> [1 2 3 4] and the return value is 'concat. (or any other funtions that are empirically found to do that). one could imagine such a tool caching the queries and so on

14:26 xeqi: $findfn [1 2] [3 4] [1 2 3 4]

14:26 lazybot: [clojure.set/union clojure.core/lazy-cat clojure.core/concat clojure.core/into]

14:26 xeqi: https://github.com/Raynes/findfn

14:26 doomlord: ^

14:28 doomlord: i figured clojures' nifty literals would make it quite handy... in haskell-land hoogle's "type based search" is pretty useful

14:28 but an example based version could be even easier to use

14:28 interesting link thanks

14:30 someone should build a website using that :)

14:31 i suppose it could use concurrency to avoid halting-problem issues.. (spawn some tests, cancel ones that dont halt after a threshold)

14:39 ivenkys: gents noob, generic question : Is there a canonical easy-to-read tutorial for Clojure , for newbs to Functional Programming ?

14:39 S11001001: ivenkys: rhickey's video intro for java programmers; extremely easy/impossible to read

14:40 nDuff: Many of the resources that are widely agreed tend to be things that ship in dead-tree form.

14:40 ejackson: ivenkys: if you're coming at this from non-FP / non-lisp then a book is your best bet

14:41 lfranchi: ivenkys: i'd recommend clojure-koans to get you started writing it, and 4clojure.org was helpful for me too. i had no real functional experience beforehand, and it got me going at least

14:41 ivenkys: nDuff: dead-tree would work in a pinch -

14:42 S11001001: the impossible to read bit is a hindrance

14:42 nDuff: ivenkys: It's not short, but the O'Reilley book http://www.clojurebook.com/ is widely recommended. If you want something that focuses on concepts over practice, on the other hand, The Joy Of Clojure is pretty near canonical -- thing is, opinion is widely split on whether it's better as a first or second book.

14:42 * nDuff learns best concepts-first, and thus suggests starting with JoC, but that doesn't work for everyone.

14:42 ivenkys: ejackson: hence something to read - my lisp knowledge is rudimentary at best - i dont *really* grok it

14:43 lfranchi: i will give those a look -

14:44 S11001001: ivenkys: it's impossible to read because it's a video, not a text :)

14:45 ivenkys: S11001001: i know -

14:46 nDuff: sounds reasonable - i have heard good things about JoC

14:47 if it helps at all - i do high-volume low latency servers (think Trading Servers) in Java - so something along those lines would be great

15:22 amalloy: Cheiron: (every? (comp #{3} count) (vals map-of-maps))

15:23 TimMc: Ridiculous.

15:28 Cheiron: amalloy: Wow!

15:30 ohpauleez: Alan Malloy is the champion of comp

15:30 Cheiron: amalloy: Still digesting it :D

15:30 I have always want to use comp but it looks I have a low IQ

15:34 dnolen_: amalloy: nice

15:37 hyPiRion: (->> (vals map-of-maps) (map count) (apply = 3))

15:42 ohpauleez: hyPiRion: Save the performance and use a lambda

15:43 hyPiRion: ohpauleez: If I needed performance I wouldn't be in this channel

15:46 amalloy: ohpauleez: what performance? his is probably a smidge faster than mine

15:47 ohpauleez: amalloy: I ready it too fast and thought the `apply` was short-sighted

15:47 shortsighted**

15:47 I retract my claim haha

15:48 hyPiRion: Hm, would it make sense to reimplement every? not-any? and friends with reduce + reduced now?

15:48 amalloy: though i must say i don't like the ->> there. it hides the important stuff on the right, and puts the uninteresting stuff on the left

15:48 ohpauleez: hyPiRion: I was JUST thinking that

15:49 screams for reducers

16:02 ghadishayban: how do you get clojurebot to require?

16:02 hyPiRion: ,(require '[clojure.string :as s])

16:02 clojurebot: nil

16:03 hyPiRion: ,(s/join "," [1 2 3])

16:03 clojurebot: "1,2,3"

16:03 ghadishayban: oh snap

16:03 (require '[clojure.core.reducers :as r])

16:03 ,(require '[clojure.core.reducers :as r])

16:03 clojurebot: #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/core/reducers__init.class or clojure/core/reducers.clj on classpath: >

16:03 hyPiRion: ,*clojure-version* ; still too young, this one.

16:03 clojurebot: {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}

16:04 ghadishayban: Ah. Oh well.

16:04 (let [large-vector (into [] (repeatedly 10000000 rand))]

16:04 (r/fold (r/monoid max (constantly Float/MIN_VALUE)) max large-vector))

16:04 hyPiRion: ohpauleez: Wow, the speedup is extreme too.

16:05 ghadishayban: total hack…but parallel max is crazy fast

16:05 ohpauleez: hyPiRion: I'd imagine so! n-times where n is number of cores?

16:05 ghadishayban: but you have to fake out the combining fn

16:05 amalloy: ghadishayban: makes a rather curious result when your input vector is empty, as well

16:06 hyPiRion: ohpauleez: Well, I guess it depends on how many items you have to look at.

16:07 but (every? pos? (range 1 50000000)) went from 5 seconds to... 0.13 mseconds.

16:07 bfreis: Is there any reason other than "it has not yet been implemented, but will be" to the lack of the family of functions "partition" on the new Reducers library?

16:08 amalloy: hyPiRion: that sounds more like "you accidentally did no work at all" than "gosh you did that work so fast"

16:08 hyPiRion: ohpauleez: Yeah, I suddenly realised that my result was false, as well.

16:08 ohpauleez: yeah, you should see a change based on the cores you have

16:09 amalloy: bfreis: welllllll, you can't do that so performantly without some more new ideas

16:09 bfreis: amalloy: what kind of new ideas?

16:09 amalloy: i dunno, i haven't had them

16:09 but if your reduce function is supposed to accept a seq of things, then the fact that the reducers lib avoids its *own* consing isn't that important: it has to cons up a whole bunch of lists to feed you anyway

16:09 hyPiRion: ohpauleez: ~2 times faster with 4 cores.

16:10 So it's a noticable speedup.

16:10 amalloy: hyPiRion: i'd be somewhat suspicious of any speedup, really, since range isn't part of the reducers lib

16:10 (yet. my patch seems to have been delayed to past 1.5)

16:11 that is, i would expect a noticeable improvement for (reduce max (vec ...)), but not for (reduce max (range ...))

16:12 hyPiRion: amalloy: What do you mean by suspicious?

16:12 Certainly this isn't scientific, of course.

16:12 devinus: amalloy: what does your patch do?

16:13 amalloy: $google clj-993

16:13 lazybot: [Clojure - Clojure JIRA] http://dev.clojure.org/jira/browse/CLJ?selectedTab=com.atlassian.jira.plugin.system.project%3Apopularissues-panel

16:13 amalloy: damn it, google

16:13 http://dev.clojure.org/jira/browse/CLJ-993

16:13 dnolen_: hyPiRion: the structure of the range datastructure isn't optimal for leverage what reducers can do.

16:13 amalloy: dnolen_: not true at all

16:13 dnolen_: for leveraging

16:13 amalloy: or, well. true before my patch. unclear what you meant

16:14 hyPiRion: dnolen_: Sure, but there's still a noticable speedup on lazy-seqs from what I see here.

16:15 amalloy: hyPiRion: i mean, suspicious that the speedup is due to some unrelated difference/change. reducers shouldn't be able to work on a range any faster than the current implementation of every?

16:15 hyPiRion: amalloy: Doesn't reduce chunk its input? every? and friends doesn't.

16:15 amalloy: as it happens, in this case the speedup is because range is chunked, and reducers "handle" chunked seqs, while the current impl of every? doesn't

16:15 ohpauleez: yeah, that's not true, you'd see a speedup, just not the full potential

16:15 right

16:16 amalloy: but that's really not a gain from using reducers imo, just a better impl of every

16:16 ohpauleez: you guys already typed the reason

16:16 dnolen_: amalloy: what I meant is that range isn't random access so you can't implement fold the way vectors do.

16:16 amalloy: dnolen_: untrue. my patch does that

16:16 range is random access if you do a little math

16:16 hyPiRion: amalloy: Nope, it's not a gain from reducers, it's a gain by using reduce + reduced.

16:17 amalloy: fair enough, hyPiRion

16:17 dnolen_: amalloy: ah right, so you don't actually look at the range, rather it's size and work over the sub ranges?

16:17 amalloy: yes. size, start, step, and end. split up into halves accordingly

16:18 dnolen_: hyPiRion: yes reducers benefit from lack of allocation overhead. but it just bends on what you doing whether reducers will actually benefit any given program.

16:18 hyPiRion: So yeah, it shouldn't increase the speed with more cores, but it should increase it due to more cache hit.

16:18 dnolen_: s/bends/depends

16:18 hyPiRion: it will increase with more cores w/ the right data structure

16:18 amalloy: hyPiRion: cache hits? i suppose that's some of it; i would have guessed it's fewer allocations

16:18 dnolen_: hyPiRion: it's a good thing you're in Clojure to talk about performance

16:19 hyPiRion: dnolen_: oh?

16:21 Daishiman: Hi everyone . I seem to be getting an error when trying these use and require directives on an ns. I'm very new at this, although I understand it's not that simple a topic http://pastebin.com/WqtTu2X7

16:21 And I get the error 'Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol, compiling:(core.clj:1)'

16:23 TimMc: Daishiman: :only (settings)

16:23 hyPiRion: I should just take a look under the covers on how it's implemented I guess.

16:23 TimMc: Daishiman: Your error message is saying "I expected a sequence but found a symbol."

16:23 amalloy: TimMc: down with parens, long live brackets!

16:24 TimMc: Sure, or :only [settings]

16:27 Daishiman: Alright, I got it

16:27 thanks TimMc!

16:37 emezeske: amalloy: Long live curly brackets! ##(use '[clojure.string :only #{split}])

16:37 lazybot: ⇒ nil

16:38 amalloy: haha, nice

16:38 emezeske: I actually, in a perverse way, kind of like that

16:38 In principle it really is a set

16:38 amalloy: emezeske: i sympathize, but i still have no choice but to take away your clojure license for this abomination

16:39 emezeske: amalloy: I'm no stranger to operating without a license.

16:39 ohpauleez: haha

16:40 * Raynes tips off the cops.

16:40 emezeske: ~guards

16:40 clojurebot: SEIZE HIM!

16:42 bfreis: What would be a good way (performance-wise) to look for a "pattern" in a reducible collection, if that pattern consists of, say, 3 elements from the collection? For instance, suppose I want to find all the local maximums of a sequence of numbers.

16:42 TimMc: emezeske: Consider me a convert.

16:42 * emezeske does a fist pump.

16:43 amalloy: &(partition 3 1 (range 8))

16:43 lazybot: ⇒ ((0 1 2) (1 2 3) (2 3 4) (3 4 5) (4 5 6) (5 6 7))

16:43 TimMc: bfreis: What are the local maximums of (range 10)?

16:43 bfreis: amalloy: that's exactly why I was looking for an implementation of "partition" on reducers :p

16:44 TimMc: it is just the last element

16:46 TimMc: bfreis: The b for any (a b c) where (and (< a b) (< c b))?

16:47 bfreis: TimMc: yes, that's what I call an example of a "pattern" I'm looking for in a sequence. But I would like to do so using reducers, not just sequences (which is trivial: (filter matches-my-pattern (partition my-pattern-size 1 my-sequence)))

16:48 TimMc: I see -- because the input sequence collapses to a smaller output sequence.

16:49 amalloy: like i said, there's no real way to benefit from reducers in this problem

16:50 you can't fold in parallel, because some input items are used in more than one output item and you can't combine intermediate results in any way i can see

16:51 and you can't avoid consing up a bunch of lists for your triples, so the non-parallel part of the reducers lib can't cut down on consing for you

16:51 technomancy: clojurebot: litany against cons

16:51 clojurebot: litany against cons is "I must not cons. Cons is the perf-killer. Cons is the little death that brings total obliteration. I will face my cons and permit it to pass over me and through me, and when it has gone past I will turn my GC to see its path. And where it has gone there will be nothing; only I will remain."

16:52 TimMc: amalloy: And if the pattern recognition is slow compared to allocation and GC, then...?

16:52 amalloy: TimMc: then who cares if you use reducers or sequences?

16:53 TimMc: I suppose if the triples can only be generated linearly, that's a problem.

16:54 bfreis: amalloy: I was thinking about a way to avoid consing lists. What if I write some kind of mutable datatype, with an array of the appropriate type, representing a circular buffer with the size of the partition I want? Then there would be no consing. Do you think it is any good?

16:55 amalloy: you could probably do that. doesn't seem worth the bother for me, since consing is unlikely to be your primary bottleneck, but i'm not writing your app

16:55 huangjs: hey, just wondering if there's extra clojure/conj ticket available

17:27 Mr_Bond: Clojure is fun :)

17:29 Daishiman: Hey guys, another question: I have a function that starts a number of threads that just print stuff with (dotimes ...... (.start (Thread. (fn [] (print "stuff"))))), and while the function body appears to run without issues, the prints within the thread bodies seem to have no effect.

17:29 S11001001: Daishiman: future is a cooler way to write .start Thread. fn []

17:30 gfredericks: Daishiman: I think print doesn't flush the buffer?

17:30 S11001001: Daishiman: and you probably don't have the dynamic binding to *out* in your thread

17:30 Daishiman: which, incidentally, will magically be fixed when you rewrite to use future instead

17:30 gfredericks: S11001001: isn't stdout the root binding anyhow?

17:30 S11001001: gfredericks: I don't know Daishiman's setup

17:31 Daishiman: @S11001001: any docs that might reference how to use futures

17:31 ?

17:31 S11001001: ,(doc future)

17:31 gfredericks: (future (print "stuff"))

17:31 clojurebot: "([& body]); Takes a body of expressions and yields a future object that will invoke the body in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block, unless the variant of deref with timeout is used. See also - realized?."

17:34 Mr_Bond: I'm trying to call java.nio.file.Files.walkFileTree(), my namespace has java.nio.file.Files. How would I do it? I tried "(.walkFileTree Files)", but it seems to try .walkFileTree on java.lang.Class

17:34 _ulises: ,(future 1)

17:34 clojurebot: #<SecurityException java.lang.SecurityException: no threads please>

17:34 _ulises: pah

17:35 Daishiman: @S11001001: Seems to be doing the trick

17:35 gfredericks: ,&(future 1)

17:35 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: & in this context, compiling:(NO_SOURCE_PATH:0)>

17:35 gfredericks: &(future 1)

17:35 lazybot: java.lang.SecurityException: You tripped the alarm! future-call is bad!

17:35 brehaut: there is no future for you here, gfredericks

17:36 S11001001: ,@(future 42)

17:36 clojurebot: #<SecurityException java.lang.SecurityException: no threads please>

17:36 S11001001: heh

17:36 gfredericks: ,(let [future identity] (future 42))

17:36 clojurebot: 42

17:36 emezeske: Mr_Bond: Have you tried something like (Files/walkFileTree) ?

17:36 S11001001: Daishiman: good. Also you just got thread pooling for free

17:36 Mr_Bond: emezeske: ahh! Thanks!

17:36 Daishiman: Can the execution of a future be controlled with regular threading methods such as sleep()?

17:37 S11001001: Daishiman: yeah

17:37 Daishiman: S11001001: excellent

17:38 S11001001: ,(send-off (agent 21) (partial + 21))

17:38 clojurebot: #<Agent@59abb215: 21>

17:38 S11001001: no threads, eh?

17:38 aperiodic: Mr_Bond: /g d

17:38 oops

17:39 Mr_Bond: cool, it works :) I wasn't sure (proxy) would do the trick or not, but it does :)

17:40 spent almost whole trying to make the walkfiletree work

17:40 duck1123: Daishiman: this might help, http://www.clojureatlas.com/org.clojure:clojure:1.4.0?guest=t#ref/futures

17:40 Mr_Bond: I learned you can reload a class in lein. That's useful

17:40 lein repl

17:52 when you are writing functions inside a (proxy), is it possible to set variables outside the proxy? I mean something like (let [size 0] (proxy (doSomethingWithSize [] ...)))

17:52 amalloy: it's never possible to set variables in any circumstances

17:52 Mr_Bond: or (def size 0); first

17:53 Or perhaps it's better to use gen-class for it?

17:55 hiredman: def is always global

17:55 raek: Mr_Bond: you can do something like (let [state (atom ...)] (proxy ... methods that read or update state...))

17:56 Mr_Bond: raek: cool, thanks!

18:03 edlich: Can someone tell me what's wrong here:

18:03 (def myat (atom :empty))

18:03 (swap! myat nthrest '(:a :b :c :d :e) 3)

18:04 wrong args passed to nthrest

18:04 gfredericks: ,(doc nthrest)

18:04 clojurebot: "([coll n]); Returns the nth rest of coll, coll when n is 0."

18:04 gfredericks: takes two args but you're giving it three

18:04 edlich: But this works: (reset! myat (nthrest '(:a :b :c :d :e) 3))

18:04 Daishiman: Speaking of futures, I keep getting a " Can't take value of a macro: #'clojure.core/let" for a let block within a future. I'm not really sure what this error means.

18:04 gfredericks: edlich: you're effectively calling (nthrest :empty '(:a :b :c :d :e) 3)

18:05 edlich: I do not see three

18:05 gfredericks: edlich: swap! is for including the current value as part of the update; reset! is for ignoring the current value

18:05 edlich: so with swap! the current value is transparently passed to the update function as the firs arg

18:05 edlich: nthrest has two args (puzzeld)

18:05 gfredericks: edlich: yes but you're giving it effectively three

18:05 there is the current value of the atom (:empty) and the two extra args you passed to swap!

18:06 '(:a :b :c :d :e) and 3

18:06 edlich: so what would be a correct swap?

18:06 gfredericks: edlich: what are you trying to do? just set the value to the nthrest of the two args and ignore the current value?

18:07 edlich: i.e., why can't you just use reset! ?

18:07 edlich: I have a list, want to drop 3 elements and swap it into the atom

18:07 gfredericks: edlich: if you don't care what the current value of the atom is, use reset!

18:07 edlich: reset is fine but I have a book saying that reset is not good. Because normally the value comes from a function!

18:07 ah ok!

18:08 Got it! Thanks a lot!!

18:08 gfredericks: no problem

18:08 clojure bang functions are great for making people wonder if you're yelling at them

18:08 amalloy: edlich: the recommendation is to avoid updating an atom without regard for its previous value, not to avoid using reset! if that's what you really want to do

18:09 ivan: still waiting for some !? functions

18:09 thmzlt: what's the semantic of "!" in a function name?

18:09 brehaut: not safe in a transaction

18:09 technomancy: ivan: for destructive predicates? why not

18:09 ivan: thmzlt: mutation

18:09 nDuff: thmzlt: Side-effecting.

18:09 thmzlt: thanks

18:09 technomancy: why not ‽

18:09 Mr_Bond: are atoms slow?

18:09 gfredericks: thmzlt: screwing things up

18:09 brehaut: i am infavor of ‽

18:09 nDuff: Mr_Bond: No.

18:09 thmzlt: in ruby it is "something dangerous", but everything is dangerous in ruby

18:10 ivan: technomancy: perhaps in a quantum system?

18:10 technomancy: ivan: I had the heisenberg uncertainty principle in mind

18:10 gfredericks: it is a destructive update and a predicate in superposition

18:10 Mr_Bond: Hm, I thought this java.nio.walkFileTree would be way faster than (file-seq)

18:10 TimMc: Maybe it'sa destructive operations that tells you if it succeeded.

18:11 gfredericks: when you examine the value you will find that either something has been destructively updated or else you have a boolean value

18:11 TimMc: ivan: Actually, yeah -- you modify information by reading it in quantum computing. Good call.

18:12 gfredericks: you also modify it by modifying it

18:12 TimMc: Sure.

18:15 Mr_Bond: Ah, lol. It is, it's about 8x faster :)

18:15 thanks for all the help guys, appreciate it!

18:25 thmzlt: is clojurescriptone.com the thing to use to get started with clojurescript? (I already know a little clojure)

18:26 nDuff: I'm wondering if I ought to make http://stackoverflow.com/questions/12940052/extending-a-library-provided-protocol-without-impacting-other-users/12943585 a mailing list post. Feels like something there should be a clean way to do, but if there is one, I'm not aware of it.

18:26 * nDuff is trying to override a protocol implementation from a 3rd-party library without impacting other tools using that library within the same Clojure environment.

18:34 dnolen_: nDuff: not a good iea

18:34 idea

18:34 nDuff: dnolen_: I agree.

18:34 dnolen_: ...using the reader would be much, much saner.

18:34 dnolen_: (if you're talking about the specific use case)

18:35 dnolen_: ...and monkey-patching is pretty darned squicky (if you're talking about the general case)

18:36 ...but it is what it is; I have a bunch of data already serialized to an external datastore using msgpack, with strings constrained such that the only ones that start with ":" should be keywords, and code which uses keyword-based access.

18:36 dnolen_: nDuff: make your own protocol, default it to delegate to the original protocol - but handle this type specially.

18:36 nDuff: dnolen_: The objects that need to be handled are generated by the msgpack library; I can't change their type.

18:37 ...oh

18:37 Ahh.

18:37 ...okay, I could do that, but I'd need to replace rather a lot of clj-msgpack

18:37 as the protocol in question isn't called by my code, but by it.

18:37 (granted, there isn't _that_ much of clj-msgpack to replace)

18:38 dnolen_: nDuff: yes, was just about PITAness depends on API surface

18:38 was just about to say I mean

18:45 callen: actually, if you want an example of how a bad API can thoroughly ruin something, just write some Scala code.

18:46 you need a table of elements just for the operators specific to the HTTP library, at least in Perl the digraphs were composable and reusable in multiple contexts. In scala you have to memorize of the context of a specific arcane symbol per API.

18:46 infinite combinations. SO MUCH FUN </sarcasm>

18:52 emezeske: callen: Are you talking about Dispatch for scala? Looking at the docs... so much pain.

19:01 technomancy: oh dear: http://www.amazon.com/Dispatch-ebook/dp/B007RE79X8/ref=sr_1_1?ie=UTF8&qid=1333606637&sr=8-1

19:01 there is a book. on an http client.

19:01 oh, only 23 pages. that's some consolation.

19:03 brehaut: "Dispatch is probably the most popular library for doing HTTP requests from Scala"

19:03 where to begin

19:04 callen: brehaut: technomancy Dispatch is 40% of why I abandoned Scala.

19:04 the other 60% has a lot to do with oxymoron named sbt.

19:05 technomancy: leiningen is the beautiful antebellum Clojure noobies step through on their way to enlightenment. sbt is the brutal gauntlet of sorrow Scala newbies sprint through as they get their limbs hacked off.

19:06 technomancy: I've heard a few horror stories

19:07 hyPiRion: brehaut: "Think of it as a Scala version of curl or wget."

19:07 callen: technomancy: the best part, is the horror just gets worse as time goes on and you have to tackle edge-cases. sbt is like the worst of cmake and cabal combined.

19:09 Sgeo: What's the issue with Dispatch?

19:10 callen: Sgeo: satanspawn.

19:10 Sgeo: I haven't looked closely at it, but it mentions Either and promises, both simple concepts

19:10 callen: Sgeo: you've just walked into our daily 5 minutes of hate. I like to remind people how good they have it.

19:11 technomancy: usually a mention of maven is enough to get a few good shivers

19:11 Sgeo: val svc = url("http://api.hostip.info/country.php")

19:11 val country = Http(svc OK as.String)

19:11 val length = for (c <- country) yield c.length

19:11 callen: Sgeo: doesn't work as well in practice as you'd think. Try it with something non-trivial.

19:11 Sgeo: This looks simple enough, if for is essentially Scala's equivalent of do notation

19:11 brehaut: Sgeo: it is

19:11 callen: technomancy: yeah so actually I was wondering, why do so many clojurians seem to be using maven? Are they hiding out in a java project?

19:11 Sgeo: Although I don't know what this 0K as.String thing is

19:11 technomancy: callen: I'm the wrong person to ask =)

19:12 callen: technomancy: I just figured you'd understand the habits of your non-users. :P

19:12 TimMc: Sgeo: OK, not 0K, I think

19:12 callen: guess that was silly.

19:12 Sgeo: Well, there doesn't seem to be another way to use a standalone jar, other than making a maven repo

19:12 technomancy: callen: contrib projects use it because c. lein 1.4 there was no way to deploy to remote maven repositories

19:12 * Sgeo tends to need standalone jars more than Maven or Clojar libraries

19:13 Sgeo: It's sort of hindering me a lot

19:13 * aperiodic ponders how to dress up as maven for halloween

19:13 technomancy: callen: I don't see a lot of usage of maven outside contrib projects

19:13 callen: technomancy: just wondering, because it's usually the first example after the lein package + version notation.

19:13 technomancy: certainly not in OSS, maybe it's more common for internal projects

19:14 Sgeo: What should I call a language that's heavily based on Clojure but takes a crucial concept from Tcl?

19:14 callen: that's what I figured anyway.

19:14 thorbjornDX: Sgeo: Tclojure

19:14 Sgeo: Tclj seems nice and pun-y, but implies that it's centered around Tcl but it isn't

19:14 callen: Sgeo: TickleMeElmo

19:14 Sgeo: thorbjornDX, ooh

19:14 * Sgeo was thinking Cloqure, because of all the quote marks that will be involved

19:14 hyPiRion: Wow, both T and Clojure, two great lisp implementations in one.

19:15 Raynes: aperiodic: http://www.marthastewart.com/sites/files/marthastewart.com/images/content/web/contests/halloween/best_of_halloween09_empire_state_bldg_xl.jpg

19:15 callen: Tcl...is not lisp.

19:15 hyPiRion: callen: I was talking about T.

19:15 Sgeo: callen, but there are some really cool things about Tcl that I wish more Lisps did

19:15 TimMc: I'm keeping my damn mouth shut.

19:16 callen: Sgeo: prolific mutable string eval? What?

19:16 TimMc: I have a record of coming up with horrible names that people end up using.

19:16 Sgeo: callen, the eval part

19:16 And strings aren't mutable

19:16 callen: Sgeo: you realize lisps used to do prolific eval and they backed off of it for a reason, right?

19:16 cf. dynamic scope

19:17 Sgeo: callen, if it can be given a lexical scope...

19:17 Although currently the easiest way I see to do that involves uplevel, and I think people are scared of it

19:17 Kernel does something or other, I should read that paper again

19:17 emezeske: Sgeo: uplevel is cool, but it takes some getting used to for sure

19:18 TimMc: Sgeo: Wait, this will be a language? Language naming is way harder than lib naming.

19:18 callen: Sgeo: I wasn't linking them, I was mentioning it as another example of something that turned out to be a bad idea.

19:18 emezeske: Sgeo: Also, uplevel can be used for such great evil in the wrong hands

19:19 Sgeo: emezeske, so can macros

19:20 TimMc, I'm not particularly expecting it to become the next big language

19:20 _tca: Sgeo: have you looked at wat

19:20 technomancy: lava's a good name; it's not taken

19:20 Sgeo: _tca, haven't heard of it

19:20 _tca: http://manuel.github.com/wat-js/doc/manual.html

19:21 TimMc: Sgeo: Do you expect it to solve one problem and then go away? In that case, "cloture".

19:22 (Silence falls as everyone reads up on parliamentary procedure.)

19:22 _tca: even if you don't plan on using it, read the manual before you start working on your own

19:22 Sgeo: _tca, sounds interesting, for all I know, this might do exactly what I was thinking, plus more

19:23 callen: uplevel is fucking diabolical.

19:23 _tca: last time you mention this Tcl thing i don't know anything about it sounded like f-expressions to me

19:23 Sgeo: _tca, ah, no, it still doesn't do what I want

19:23 _tca: which is?

19:24 Sgeo: I want the determination of when to evaluate arguments to occur at the call site, not determined by the operative/applicative

19:24 Or at least, if it's going to be unevaluated, evaluate part of it before the operative sees it

19:25 I could probably use Kernel/wat's model of lexical scoping though, as soon as I understand/remember what it is

19:29 Example:

19:30 (if (nil? blah) '(println "nil") '(println "not nil"))

19:31 Oh hey, wat's example of the Error monad is EXACTLY why I wanted to combine delimc and protocol monads

19:34 _tca: Sgeo: why cant you do it with a macro

19:34 Sgeo: _tca, because I want my language to not have the macro/function distinction.

19:34 dustingetz: sego: what is protocol monad

19:34 only google references refer to jim duet's monad protocols, which is an impl detail

19:34 Sgeo: _tca, (and arguably Kernel/wat do not in fact have a operator/applicative distinction, as all applicatives should theoretically be operators)

19:35 dustingetz, yes, I meant that implementation of monads, because I dislike algo.monads.

19:35 _tca: Sgeo: there has to be some distinction where the evaluation happens

19:36 Sgeo: _tca, presumably, if is a function that calls eval

19:38 TimMc: Sgeo: So any function could do syntax transformations on argument expressions if chose to?

19:39 Sgeo: Yes. But only if it's actually passed a syntax expression

19:39 In my example

19:40 (if (nil? blah) (println "nil") (println "not nil")) will always print "nil" then print "not nil"

19:41 TimMc: Sgeo: And these syntax expressions, would they keep the lexical scope of their origin?

19:42 Sgeo: lexical scoping is definitely something I want to do... somehow... hmm

19:42 TimMc: (if (nil? blah) #(println "nil") #(println "not nil"))

19:42 Sgeo: Well, not "of their origin", no, use lambdas to make closures for that.

19:43 TimMc: Never mind, that doesn't support transformation.

19:44 Sgeo: (when true '(println x)) -- what is x's scope?

19:44 Sgeo: If when does an uplevel sort of thing, it's whatever's in scope at the when level

19:45 But the lexical scoping aspect is still something I need to think through.

19:45 TimMc: OK. I figured you had a scoping model in mind already.

19:46 Sgeo: Hrm.

19:46 I just realized I have no idea how to distinguish:

19:47 (def code '(println x))

19:47 (when true x)

19:47 From

19:47 (when true '(println x))

19:47 TimMc: (when true code), you mean

19:47 Sgeo: Oops, you're right

19:48 Or even whether distinguishing at that point would be desirable. Or if not distinguishing immediately kills all claims of lexical scope

19:51 I still don't understand why people hate Kernel's $prefixes so much

19:54 I think it might be sufficient to have some constructs make a clean scope?

19:55 I would imagine defn introducing a clean scope, but that's just def+fn, and fn usually makes closures

19:55 Hrm.

19:55 Making a clean-scope function?

19:55 aperiodic: Raynes: maybe i can just wear a big box that says "~/.m2"

19:57 TimMc: aperiodic: EEEEK!

19:57 aperiodic: You might get jars thrown at you.

19:57 Sgeo: Would having defn not be capable of making a closure be problematic for anyone?

19:58 Does anyone ever do something like... oh, I guess they do

19:58 huangjs: hi, I'd like to ask for opinions on current status of web development in clojure comparing to node.js. what are the pros and cons?

19:58 oops, brb

19:58 aperiodic: Sgeo: you mean fn? absolutely

19:58 Sgeo: (let [a (atom 0)] (defn f [] (swap! a inc)))

19:58 aperiodic, no, I mean defn

19:59 nDuff: huangjs: I'm not sure they're comparable -- I mean, you can use clojurescript to write code for node.js, if you felt like it, but using Clojure server-side the idiom set is completely different.

19:59 aperiodic: Sgeo: i think that would be fine for me

19:59 nDuff: *Clojure-on-JVM server-side

19:59 aperiodic: TimMc: why would you have jars just lying around??

19:59 lazybot: aperiodic: Uh, no. Why would you even ask?

19:59 Sgeo: aperiodic, any good names for a function that clears what I don't think can even rightly be called lexical anymore scope?

20:00 huangjs: nDuff: i only want to cmopare the server side

20:00 the eco system, libraries

20:00 nDuff: huangjs: Clojure is built to take extremely good advantage of highly parallel systems (lots and lots of cores).

20:00 emezeske: huangjs: The JVM is one of the most sprawling ecosystems out there

20:00 huangjs: i don't care, i care about the speed of development, and easier of debugging (which node sucks)

20:00 Sgeo: But note that Java libraries are usually unidiomatic to Clojure

20:01 huangjs: JVM has loads of bloated libraries,

20:01 technomancy: yeah but node.js has the advantage of not being legacy bullshit

20:01 everybody knows there are only like five languages worth using

20:01 huangjs: which is CL Scheme Clojure Prolog and Haskell

20:01 hiredman: technomancy: people will think you are serious

20:02 technomancy: hiredman: oh I don't know about that

20:02 nDuff: *shrug*. The Clojure debugging story isn't that great either, if you compare to what used to be available on CL

20:02 emezeske: huangjs: You just asked about the ecosystem, and then you say you don't care... ?

20:02 nDuff: ...but I'd take it over Node any day.

20:02 huangjs: nDuff: true

20:02 nDuff: ...some of the profiling and debugging tools built for the JVM are downright excellent, if you're willing to deal with some impedence mismatch.

20:03 Sgeo: nDuff, used to be available?

20:03 Did SLIME die?

20:03 brehaut: deprecated

20:04 Sgeo: o.O

20:04 brehaut: http://technomancy.us/163

20:04 huangjs: ok, question, what's the counterpart of 'express' in clojure? the 'passport' or 'everyauth' for auth, the engine.io for real-time stream?

20:04 how could you make slime die?

20:04 Sgeo: brehaut, "what used to be available on CL"

20:04 huangjs: sigh...

20:04 Sgeo: CL, not Clojure.

20:04 nDuff: Sgeo: I don't consider CL a living language, and I don't have time for a flamewar about it.

20:04 brehaut: oh, cl

20:05 huangjs: what is the defacto awesome environment for CL

20:05 nDuff: CL is pretty alive,

20:05 Frozenlock: And now with Quicklisp even more so.

20:06 huangjs: and i just finished a prototype using obscure mongrel2 + cl, good, but development speed still can't beat node even i know much better in CL

20:07 btw, anyone who has spare clojure/conj tickets, please sell it to me :)

20:07 doomlord: does clojure stdlib have something like CL's "with-slots" ... preferably like this (with obj (... all components of 'obj' are bound in a let available here..) )

20:08 TimMc: doomlord: Is that like destructuring?

20:08 huangjs: TimMc: it's like symbol macro

20:08 TimMc: you can modify the slots, not vars bound

20:09 doomlord: ah i keep forgetting its very good at destructuring , but not quite: i'm after something where you dont need to specify which components to map; it just brings all into the scope.

20:09 Sgeo: TimMc, with-slot lets you take a CLOS object and, instead of needing to use (slot-value my-obj 'slot) to get the value and (setf (slot-value my-obj 'slot) ...) to set it, within the body of with-slots you can use slot and (setf slot ...)

20:09 doomlord: almost like assigning the "this" pointer in C++

20:09 (not that C++ can do it heh)

20:09 Sgeo: huangjs, there is a library, not in stdlib, for symbol-macrolet

20:09 If that's any help

20:10 But usually you don't mutate objects, so the idiom might not be as useful

20:10 doomlord: i still think it would be useful for reading things to pass on in immutable-land

20:11 huangjs: Sgeo: yeah, that makes sense in clojure

20:11 Sgeo: Could write a macro to do it fairly easily

20:11 At least the reading and binding part

20:11 Actually, there is something

20:11 doomlord: yes i figured one could.

20:12 Sgeo: ,(let [{:keys [a b c]} {:a 1 :b 2 :c 3}] (str "My a is " a " and my b is " b " and my c is " c))

20:12 huangjs: hey, please share your opinions, i know there are many good people here, what's your opinions comparing clojure and node.js for web dev?

20:12 clojurebot: "My a is 1 and my b is 2 and my c is 3"

20:13 TimMc: huangjs: You just asked that.

20:13 huangjs: TimMc: i know

20:13 Sgeo: doomlord, oh, all components automatically?

20:13 That... sounds like a security hole waiting to happen.

20:13 doomlord: that looks very close to what i have in mind, but yes a version that just grabs everything automatically

20:13 Sgeo: Pretty sure with-slots doesn't actually do that either

20:13 TimMc: Bleh, spooky magically appearing bindings.

20:14 nDuff: huangjs: I'm not sure this is the right place to ask if you don't want people whose opinions are colored by language aesthetics.

20:14 doomlord: its just like a "this" pointer for OOP

20:14 Sgeo: doomlord, the OOP languages you have in mind, are they all statically typed?

20:14 nDuff: huangjs: ...I mean, there are a _lot_ of places where JavaScript has admitted major design flaws, and it's pretty hard for someone who's picky to get past those and focus only on development velocity.

20:14 doomlord: you've got the object ... you can access the components with (obj :member) anyway.. its just makig it less verbose

20:15 huangjs: nDuff: i love and hate javascript, flexible, powerful, but retarded

20:15 Sgeo: Yeah, Common Lisp's with-slots also asks for the names

20:15 doomlord: to me this is better than OOP because there's nothing special about one of the 'objects' passed to a function

20:15 emezeske: doomlord: Seems like a bad idea -- what if someone later on adds a field to the object that you used as a name inside the (with obj ...)

20:15 doomlord: thats somethign i've never liked in c++ etc

20:15 Sgeo: doomlord, you're asking for a feature from Common Lisp that Common Lisp doesn't actually have.

20:16 TimMc: Actually, it can't be done.

20:16 shaungilchrist: huangjs agreed it is like a turrets savant, totally capable but entirely vulgar

20:16 doomlord: not really a feature from CL.. just inspired

20:17 "what if someone later adds a field.." - welll i'm used to that sort of hazard in C++ , collisions between arguments, locals, and members

20:17 emezeske: doomlord: By adding a property to an object, couldn't someone possibly break your (with obj ...) overloading some name that is used there for a different purpose? Seems very fragile

20:17 TimMc: doomlord: If knowledge of the possible set of fields isn't available at macro-expand time, you can't set up the bindings.

20:17 emezeske: doomlord: Yeah, but in C++ it's not much of a hazard because the compiler will happily warn you

20:17 Sgeo: TimMc, hey, that's one of the things that my language will allow.

20:17 TimMc: haha

20:17 Sgeo: Suddenly, my language idea seems less attractive.

20:17 TimMc: :-P

20:18 "toljure"

20:18 as in

20:18 doomlord: ok the fact its dynamic precludes it

20:18 TimMc: toljureso

20:18 (Except I didn't really tell-you-so in the first place.)

20:18 doomlord: so if i have many functions using a set of common bindings ... it might be better to just make a macro that grabs a specific set of bindings

20:19 Sgeo: Then again, just because someone can do something stupid, doesn't mean they should be stopped from doing it

20:19 doomlord: (with-xyz srcVector ... )

20:19 Sgeo: doomlord, if that's your planned use case, go for it, I think

20:19 _tca: Sgeo: you should implement the individual things you want in clojure first

20:19 Sgeo: That sort of fill-in-the-blank thing is the easiest sort of macro to write

20:20 Heck, go insane and write a macro to write macros to do that

20:20 huangjs: shaungilchrist: well said!

20:20 TimMc: shaungilchrist: Oh, "Tourette's".

20:20 I was trying to figure out wtf you were talking about.

20:21 doomlord: i think i'd do it with a prefix... (defn cross(vec-a vec-b) (with-xyz a vec-a (with xyz b vec-b ( [ -(* ay bz )(* az by)....

20:21 brehaut: everyone has probably seen this already but http://www.ioccc.org/2012/tromp/hint.html that blew my mind

20:21 shaungilchrist: haha.. I meant like tower defense...

20:22 emezeske: doomlord: If you have a prefix, isn't the advantage over (:property object) rather negligable?

20:23 doomlord: i guess so; however you could use more verbose argument names and less verbose prefixes in the body of the function

20:23 i concede its not clear cut though

20:24 heh the cross product example is a bad one because clojure's destructuring arguments can do it better

20:24 (defn vec-cross[[ax ay az][bx by bz]] (...)?

20:26 emezeske: Seems pretty reasonable.

20:27 doomlord: oh isn't it possible to call things with maps as an argument anyway

20:28 oh no that doesn't do it

20:33 amalloy: okay, pretty cool, brehaut

20:33 Sgeo: ,'(blah blah '(bla `(woot ~wut ~~huh)))

20:33 clojurebot: (blah blah (quote (bla (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox/woot)) (clojure.core/list wut) (clojure.core/list (clojure.core/unquote huh)))))))

20:34 Sgeo: ,`(a b c `(d e f ~honk ~~honk))

20:34 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: honk in this context, compiling:(NO_SOURCE_PATH:0)>

20:34 Sgeo: ,`(a b c `(d e f `(g h ~honk ~~honk)))

20:35 clojurebot: (sandbox/a sandbox/b sandbox/c (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox/d)) (clojure.core/list (quote sandbox/e)) (clojure.core/list (quote sandbox/f)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/seq)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list #) (clojure.core/list #) (clojure.co...

20:35 emezeske: Sgeo: Don't you have your own repl? :P

20:35 Sgeo: honk

20:37 brehaut: amalloy: the downside is it makes me acutely aware of how little i know about computation

20:41 notsonerdysunny: I have imported a simple java class into clojure repl usint (import 'callback.runme)

20:41 I have imported a simple java class into clojure repl usint (import callback.runme)

20:41 brehaut: (repeatedly notsonerdysunny)

20:42 notsonerdysunny: it has a main method and I am unable to call its main

20:42 Sgeo: Is deflfn an ugly name for my language's equivalent of defn?

20:42 notsonerdysunny: I tried (.main (callback.runme.)) and (callback.runme/main)

20:42 and main is a static member function ..

20:43 both the attempts to call the main member function were unsuccessfull .. it say it is unable to find a variable named main .. can somebody help?

20:43 brehaut: notsonerdysunny: what is the artiy of main?

20:44 notsonerdysunny: one argument .. with array of strings

20:44 Sgeo: ,(.charAt "honk" "HONK" ":o)")

20:44 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: charAt for class java.lang.String>

20:44 Sgeo: ,(Math/sin 1 2 3 4 5)

20:44 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: sin, compiling:(NO_SOURCE_PATH:0)>

20:45 Sgeo: Hmm. Different error

20:45 notsonerdysunny, sure the portion before / is correct?

20:45 brehaut: notsonerdysunny: then you'll need to pass that in then

20:46 ,(apropos 'array)

20:46 clojurebot: (object-array boolean-array long-array short-array char-array ...)

20:47 brehaut: at a guess (callback.runme/main (make-array String 0)) ?

20:48 notsonerdysunny: thanks brehaut that fixed it ..

20:49 brehaut: notsonerdysunny: arity is important to functions on the JVM. javas overloaded methods are effectively name munged to have the airty and type as part of the 'name'. so if you dont include the appropriate arguments, the reflector will say that it cant find the arguments

20:49 notsonerdysunny: brehaut: what surprises me is it does not complain about arity mismatch .. but says the method is not found.. K now I know .. thanks again

20:49 brehaut: (approximately)

20:50 thats an implementation detail of java bleeding out

20:51 Sgeo: Now, if only we can bleed out the rest of Java too.

20:52 doomlord: clojure on llvm :)

20:52 * brehaut waits to be corrected by hiredman or amalloy

20:53 doomlord: would be nice to have a native lisp with all the neat features of clojure (like destructuring function args etc)

20:54 brehaut: liskell

21:01 rlb: TimMc: yes -- the incanter window does show up via ssh -X or -Y, but it's blank.

21:37 Frozenlock: Eh.. I have a little problem with Noir. I know for a fact that :dev is being passed as the mode. However, when I use noir.options/dev-mode? in the repl, I get false. Any ideas what I might be missing?

21:40 Perhaps it needs to be started from lein?

21:41 doomlord: whats the difference between :x and 'x

21:42 both appear to work in maps

21:43 Frozenlock: Wouldn't "x" work too?

21:44 doomlord: doesn't seem to

21:44 Frozenlock: &(get {"x" 1} "x")

21:44 lazybot: ⇒ 1

21:44 doomlord: x tries to evaluate itself wheras both :x and 'x appear to be a literal

21:44 ah "x" not x sorry

21:45 well i think :x is nicer than 'x ... but is there some underlying difference.

21:46 xeqi: &(identical? :x :x)

21:46 lazybot: ⇒ true

21:46 xeqi: &(identical? 'x 'x)

21:46 lazybot: ⇒ false

21:46 Frozenlock: Yes, iirc a keyword evaluate to itself.

21:57 hiredman: /win 15

22:04 TimMc: &(= ':x :x)

22:04 lazybot: ⇒ true

22:07 TimMc: doomlord: Keywords refer to themselves. They're used for ad-hoc structuring of data e.g. {:foo 1 :bar "hello"} and as interned values for comparison e.g. (= :error (:result foo)).

22:09 doomlord: Symbols are intended to be dereferenced at some point. The code (count foo) has two symbols, both of which are replaced with other values at eval time. (Exception: Compiler literals such as 'if, 'do, etc.)

22:11 doomlord: ok thanks

22:12 symbol almost like a pointer or reference. keyword more like an enum perhaps

22:30 TimMc: Basically.

22:33 mindbender1: Thinking in Clojure?

22:54 xeqi: anyone have an example of using https://github.com/edgecase/dieter ?

23:12 sent-hil: I included [ clojure.contrib.math :only ( abs)] in my file, how do I install the library?

23:13 I'm getting this error: https://gist.github.com/5b7569e8b11c8a9a86dc

23:21 antares_: sent-hil: clojure.contrib.math has been obsolete for over 1 year. Use math.numeric-tower (https://github.com/clojure/math.numeric-tower), the README mentions its Leiningen dependency

23:21 sent-hil: for abs, you can use Math/abs from the JDK without any libraries

23:21 ,(Math/abs -1.2)

23:22 clojurebot: 1.2

23:22 sent-hil: antares_: that works, thx!

23:23 Sgeo: I'm sad that it's easy to implement automatic differentiation on arbitrary mathing functions in Haskell but not so in Clojure

23:24 Because if a function works on Nums, it's using one of a number of primitive Num using functions, and I can define a new type of Num that behaves how I want and functions that deal with Nums will use my functions

23:24 ForSpareParts: Any of you guys know of a Clojure-native physics library? Something that leverages the immutable-data stuff?

23:24 Sgeo: But with Clojure, everything uses Math/whatever, and I can't replace that

23:27 xeqi: I have similar feelings for the networking. I liked ruby's artifice for mocking external apis

Logging service provided by n01se.net