#clojure log - May 14 2012

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

0:00 ForSpareParts: oh

0:00 um

0:00 technomancy: clojure-mode is a piece of elisp code, swank is a piece of Clojure code

0:00 ForSpareParts: my bad, I meant what I said the first time

0:00 Do I have to install swank separately?

0:00 For some reason I thought it came with clojure-mode.

0:00 * ForSpareParts is really sorry for being such a fucking noob.

0:00 zcaudate: clojurebot: yeah... bultitude works really well

0:00 clojurebot: http://haacked.com/images/haacked_com/WindowsLiveWriter/IConfigMapPathIsInaccessibleDueToItsProt_1446B/works-on-my-machine-starburst.png

0:01 technomancy: ForSpareParts: I have a lot of sympathy because it's crazy confusing and there are lots of horrible misleading docs out there

0:01 amalloy: zcaudate: you're not going to get a lot of unique dialog from a bot

0:01 technomancy: amalloy: hush, it's more fun when they realize it on their own

0:02 ForSpareParts: you want `lein plugin install [...]` as per the swank-clojure readme

0:02 zcaudate: Damn it

0:03 I just looked back at the conversation

0:03 technomancy: ...

0:04 technomancy: zcaudate: bots can be surprisingly lifelike

0:04 zcaudate: I'm impressed... its my second time on irc

0:05 very cool

0:05 technomancy: the bots in #emacs fool people on a regular basis

0:06 zcaudate: are they all named *bot?

0:06 technomancy: yeah =)

0:06 brehaut: nah, some of them are named rms

0:06 zcaudate: could I call myself fyoubot and start insuling people?

0:07 ForSpareParts: technomancy, I tried doing lein plugin install swank-clojure 1.4.2, but I'm getting an exception about being unable to delete files -- weird, since my prompt has admin rights. Also, it says it can't find swank in "repository central" but I don't know if that's actually a problem or if it's normal...

0:07 zcaudate: and pretend that I wasn't human?

0:07 metellus: zcaudate: why would they tolerate a bot that did nothing but insult people?

0:08 zcaudate: metellus: just a hypothetical.... back to work =)

0:08 amalloy: heh. i just tried /nick jerkbot, but that's taken :(

0:08 cgag: i would tolerate an insultbot

0:09 zcaudate: more fun pretending to be one ])

0:09 technomancy: ForSpareParts: I have heard of that problem on Windows before, but I don't know enough about Windows to know what could be causing it

0:10 ForSpareParts: alright

0:10 Could I do it through cygwin, maybe? And if I did, would I be able to get at from Win32 Emacs?

0:10 technomancy: that should work

0:11 ForSpareParts: do you know how I can add something to my path in cygwin?

0:12 technomancy: traditionally you add something like this to ~/.profile: export PATH=$HOME/bin:$PATH

0:13 ForSpareParts: oh, cool -- so then it'll be equivalent to my Windows path?

0:13 technomancy: I don't know

0:15 cgag: if i have a repl i opened via lein repl

0:15 and i change a function and save it

0:15 can i somehow access it

0:15 without exiting the repl and starting it again?

0:16 metellus: (require 'whatevernamespace :reload)

0:18 zcaudate: technomancy: if I wanted to load bultitude as soon as I start the repl... and I wanted it on every project I use... where would I put it?

0:19 cgag: great, thanks metellus

0:44 eighty: quick question about defrecord and multimethods. i can't seem to define a defrecord instance and have the multimethod dispatch on it. quick example: https://gist.github.com/648444a06275eb910d11

0:45 ForSpareParts: IT WORKS, IT FUCKING WORKS

0:45 thank you God, thank you technomancy

0:46 seriously, thanks, though, for getting me on the right track.

0:48 zcaudate: (use 'clojure.reflect)

0:48 (defn all-methods [x]

0:48 (->> x reflect

0:48 :members

0:48 (filter :return-type)

0:48 (map :name)

0:48 sort

0:48 (map #(str "." %) )

0:48 distinct

0:48 println))

0:48 (all-methods 9)

0:48 (.bitCount .byteValue .compareTo .decode .doubleValue .equals .floatValue .getChars .getLong .hashCode .highestOneBit .intValue .longValue .lowestOneBit .numberOfLeadingZeros .numberOfTrailingZeros .parseLong .reverse .reverseBytes .rotateLeft .rotateRight .shortValue .signum .stringSize .toBinaryString .toHexString .toOctalString .toString .toUnsignedString .valueOf)

0:49 brehaut: zcaudate: refheap.com, gist.github.com, etc etc. take your pick

0:52 zcaudate: okay

0:53 its more that i want it as aprt of my repl setup

0:53 *part

0:54 PeregrinePDX: Lol this is why when I pm with you brehaut I just smash my entire defn on one line.

0:54 brehaut: it doesnt matter what you want it for, its poor IRC etiquette to flood a channel with a pile of source code etc

0:54 lol

0:54 zcaudate: :brehaut sorry.. newbie here....

0:55 brehaut: zcaudate: thats why im tell you, rather than yelling at you

0:55 PeregrinePDX: gist is kind of a cool idea.

0:56 zcaudate: =) but is there anyway to customise the default repl to load libraries and scripts the same way that emacs loads

0:57 so if I type lein repl, then it comes with all the methods i want it to have

0:58 the default repl's a little bit same

0:58 reply's much better... but there still stuff that i feel is missing... i'm really used to ipython

0:59 which shows pictures

0:59 and a bunch of other stuff

1:00 PeregrinePDX: I imagine although I am a newbie but from a quick perusal of the lein documentation you could probably do it with a plugin

1:01 there is quite possibly a better way to do it then that though

1:04 brehaut: i suspect PeregrinePDX is right.

1:04 some stuff like graphical views etc are available via nREPL

1:08 PeregrinePDX: It would be somewhat interesting to make an .repl_profile that would be processed when a repl is started.

1:08 zcaudate: its been bugging me for ages now.... I'm using cljr - https://github.com/zcaudate/cljr and I have a bunch of code that I copy and paste for shell usage... like loading namespaces.. dbg...

1:08 PeregrinePDX: So people could add automatically their own things they want to do everytime they start a repl.

1:09 zcaudate: I've read somewhere that there is a user.clj file

1:09 that loads

1:09 but not too sure where it goes

1:10 and because I'm using cljr... i'm really not sure where it geos

1:10 goes*

1:10 :PeregrinePDX that'll be great

1:12 PeregrinePDX: Well with that hint http://stackoverflow.com/questions/8737452/user-clj-and-init-clj-dont-work

1:12 So apparently it already exists or did exist

1:14 zcaudate: nope... doesn't wark for me

1:17 PeregrinePDX: .lein/init.clj

1:17 Well ~/.lein/init.clj

1:17 Now everytime a repl starts it says hello world t ome

1:18 Actually everytime lein is run it says hello world to me.

1:18 So not quite what you want but maybe should work.

1:20 zcaudate: yeah.. it does load =) but I can't use any libraries like clojure.reflect or define any custom methods that i want

1:20 echo-area: amalloy: I drew several diagrams yesterday and finally saw where the problem is. I didn't notice the "recur" part of `keep'. Thanks for the help.

1:20 PeregrinePDX: Why can't you use any libraries like clojure.reflect?

1:20 zcaudate: I'm not too sure

1:21 I have a file in .lein/init.clj that says (use 'clojure.reflect)

1:21 and it gives me an exception when lein loads up

1:21 TEttinger: ok, this is getting very complicated -- I need a function to create a bunch of buttons, with the labels on the buttons drawn from mutable strings. I have no idea how to do this with clojure's many (and foreign-seeming) concurrency primitives

1:23 (I am amazed how far I got without explicit assignment, just library calls doing it for me...)

1:24 one line I have:

1:24 ,(defn rename-button[btn txtref txt2] (dosync (ref-set txtref (str @txtref txt2))(config! btn :text @txtref)))

1:24 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

1:25 TEttinger: I THINK I am passing a ref to this as its second arg

1:26 I have declared refs, I think the correct way, with

1:26 (def control (ref (str "<html>" "Control" "<br>")))

1:26 and I pass that as an argument with control , and get its value with @control ... right?

1:27 PeregrinePDX: zcaudate, uh I dunno. I'm at the end of my limited clojure knowledge

1:27 zcaudate: hahaha =) same here

1:28 oh well!

1:29 back to the good old cut and paste method =)

1:42 * PeregrinePDX slowly backs away from the reply code. Must not hack in a .reply_profile

2:08 michaelr525: hello

2:11 PeregrinePDX: Ok so I just hacked a .reply_profile into reply.... (use 'clojure.reflect) seems to work

2:11 TEttinger: uh, is there a protocol for asking a question again? I don't want to bother the group twice

2:13 ivan: TEttinger: @thing is (deref thing)

2:13 (func @thing) would pass the value itself to func

2:13 TEttinger: so how do I pass thing?

2:14 it doesn't seem to be able to change the value when I pass the ref

2:15 ivan: I dunno, but feel free to pastebin code and ask again

2:43 TEttinger: ivan, pastebin here http://pastebin.com/k6Cvs2cE

2:43 the code is really bad, but i will ask anyway...

2:43 I need a function to create a bunch of buttons, with the labels on the buttons drawn from mutable strings. I have no idea how to do this with clojure's many (and foreign-seeming) concurrency primitives

2:45 at least I think that is what I need -- I have a function, griddy for lack of a better name, that generates a grid of buttons. the buttons will have their labels changed by some menus on the side, and their colors can change as well, but when I call griddy again, I don't want to destroy the old labels, just the old colors

2:48 ivan: what part of rename-button isn't working?

2:49 TEttinger: well it isn't renaming

2:49 I think it has something to do with my poor understanding of dosync

2:49 or refs in general

2:52 ivan: I'm a noob but I don't see anything obviously wrong with the refs

2:52 I would try adding some more debug logging

2:52 TEttinger: right, good idea

2:52 ivan: does some Swing thing have to be called to refresh after you config!?

2:53 TEttinger: that... could be it? I thought seesaw handled a lot of that... but only when I call seesaw functions...

2:54 nah, I call config!

2:54 that apparently repaints and updates

2:56 ivan: (config! btn :text @txtref) <- maybe @txtref reads the old value here

2:56 * ivan reads the Joy of Clojure chapter again

2:59 ivan: nope. "All reads of Refs will see a consistent snapshot of the 'Ref world' as of the starting point of the transaction (its 'read point'). The transaction will see any changes it has made. This is called the in-transaction-value."

3:22 PeregrinePDX: argh

3:45 TEttinger: yay, it works -- thanks ivan

3:45 problem was I was using a ref instead of a string when I created a keyword

3:45 so when I tried to use a selector to get the widget with that keyword for an :id ...

3:46 it returned nil, and all those rename-button calls were renaming nil and not showing it

3:51 robertstuttaford: anyone know of a place i can get a clojure core docset for Dash? http://itunes.apple.com/us/app/dash-docs-snippets/id458034879?mt=12

3:51 Raynes: Considering that came out about 30 seconds ago, probably not. :p

3:51 robertstuttaford: i use it for html/js/css and it rocks

3:52 -grin- one can hope

3:52 aperiodic: if i wanted a data structure that was like a map in every way except how it's used as a function, what's the easiest way to do that?

3:53 can i do that with a defrecord?

3:53 PeregrinePDX: Someone was talking the other night about a iphone clojure api app

3:56 Ahh it was mudphone

3:56 mudphone: PeregrinePDX: yep

4:01 robertstuttaford: dash is nice. global shortcut launches search window, and search is lightning fast

4:01 faster'n (doc whatsit) in the repl

4:03 aperiodic: not as fast as `,s`, though

4:03 you'll pry slimv from my cold, dead fingers

4:05 robertstuttaford: you text moders are in a world all on your own

4:14 a screencast showing you how to use emacs with clojure including all the nice toys you guys use would be a great resource. does anyone know of such?

4:15 neotyk: hello everyone

4:17 robertstuttaford: there have been few of those, have you seen https://vimeo.com/25190186 ?

4:18 robertstuttaford: awesome, thanks!

4:20 neotyk: np

4:20 robertstuttaford: are you familiar with emacs?

4:21 robertstuttaford: not even slightly.

4:21 using eclipse and ccw right now but i'm hating having to use the mouse so much

4:22 neotyk: robertstuttaford: if not I highly recommend starting from 'C-h t'

4:22 robertstuttaford: tutorial mode? :)

4:23 neotyk: this won't take long but you will get you familiar with emacs

4:23 robertstuttaford: awesome, thanks

4:23 mudphone: robertstuttaford: I'm about to do a basic Clojure/Emacs/Lein/Slime-Swank tutorial for a local meetup… do you have a wishlist?

4:23 robertstuttaford: basically, how to get setup, and why each emacs thing you do is important

4:24 so, slime-swank. i guess this is some sort of repl <=> buffer sync tool?

4:24 neotyk: robertstuttaford: use emacs 24 and new emacs-starter-kit

4:24 robertstuttaford: keyboard shortcuts that you regularly use in the process of clojuring

4:24 neotyk: robertstuttaford: than you can clojure-jack-in with ease

4:25 vijaykiran: robertstuttaford: there are some commands listed here: https://github.com/technomancy/swank-clojure

4:25 robertstuttaford: starter-kit looks good!

4:25 neotyk: robertstuttaford: also paredit-mode is mighty awesome

4:26 robertstuttaford: i'm using paredit in ccw and it's quite good

4:26 so you guys are doing 100% in emacs? driving lein, repl, git?

4:26 vijaykiran: yup

4:26 neotyk: yep

4:27 + erc

4:27 vijaykiran: clojure-jack-in + ricirc + magit + swank/slime

4:27 neotyk: I only leave emacs for browser, mail and shell

4:27 mudphone: robertstuttaford: are you on a mac?

4:27 robertstuttaford: yup

4:29 neotyk: hi mittchel, thing you posted yesterday about sqrt, it looked like you've been working recursively without recur

4:29 mudphone: robertstuttaford: this is super rough right now, but it's the outline I'm going to use: https://github.com/mudphone/clojure_basics/blob/master/emacs_clojure_setup_notes.txt

4:29 robertstuttaford: ok so emacs 24, emacs-starter-kit, clojure-jack-in to begin with

4:30 wicked, thank you!

4:30 i'll beta test for you

4:30 mudphone: I'm not using emacs-starter-kit in this workshop… as I wanted it to be super simple

4:30 mittchel: neotyk: I noticed yep haha, brehaut actually helped me out with a better version

4:30 mudphone: I'll probably add that in later

4:30 as well as other helpful emacs modes

4:30 robertstuttaford: a question on the shortcuts - C-(…) is ctrl-something, M-(…) is meta, or cmd-something?

4:31 vijaykiran: M- = Alt -

4:31 neotyk: mittchel: cool

4:31 mudphone: oh, and it's not using Emacs 24

4:31 it's using 23.4

4:31 so, that

4:31 robertstuttaford: ok so ctrl and alt, no cmd

4:31 should i try with 24?

4:31 neotyk: S- is command

4:31 calvados: is there a value returning version of doc macro ?

4:32 robertstuttaford: thanks

4:32 vijaykiran: robertstuttaford: yes, by default ctrl, alt you can map what you want the keys mean in keyboard settings on mac

4:32 neotyk: vijaykiran: aer you coming to euroclojure?

4:32 robertstuttaford: i use a ms erg 4k, so i've swapped alt and cmd already

4:32 vijaykiran: neotyk: yup :)

4:33 robertstuttaford: I got my Caps as Ctrl

4:33 neotyk: vijaykiran: cool :)

4:33 vijaykiran: neotyk: you're doing a presentation thre right ?

4:33 robertstuttaford: me too, but i forget to use it :)

4:34 mittchel: Guys, what sthe answer to this one: (= (list __) '(:a :b :c))

4:34 neotyk: vijaykiran: yeah! 10 minute demo of http.async.client

4:34 mittchel: can't seem to figure it out

4:34 vijaykiran: neotyk: cool :)

4:34 robertstuttaford: mudphone: thanks for this. i'll have at it and i'll let you know how it goes

4:34 vijaykiran: neotyk: may be I'll show my crappy clojure code of gitwit.net there to you ;)

4:34 mudphone: robertstuttaford: you're welcome! Thanks for testing.

4:35 neotyk: mittchel: is it core.logic?

4:35 mittchel: Not sure I'm trying to learn via 4clojure

4:35 neotyk: mittchel: :a :b :c

4:35 mittchel: I tried that lol

4:36 huh

4:36 it works

4:36 maybe I mistyped :S

4:36 robertstuttaford: ,(= (list :a :b :c) '(:a :b :c))

4:36 clojurebot: true

4:36 mittchel: I think I mistyped lol:D

4:36 can you use clojurebot in a PM?

4:36 robertstuttaford: yes

4:36 it's called a repl

4:36 mittchel: So I won't spam you guys with all the stuff haha

4:37 neotyk: vijaykiran: gitwit.net? never heard of it

4:38 vijaykiran: neotyk: just started on it http://gitwit.net - Clojure/jGit/ElasticSearch project

4:38 lucian: mittchel: you can also use the website tryclj

4:39 neotyk: vijaykiran: http://gitwit.net/search?q=http.async.client

4:39 ivan`: TEttinger: cool, glad you figured it out

4:39 vijaykiran: neotyk: :) this is just 0.0.1-SNAPSHOT - I need to add more repos and cap-out my VPS

4:40 neotyk: vijaykiran: can I add repo to index?

4:40 robertstuttaford: mudphone: "install the latest clojure for mac osx (v23.4)" i think you mean emacs, here

4:40 vijaykiran: neotyk: yeah, from 0.0.2 :)

4:40 mudphone: robertstuttaford: thanks!

4:40 vijaykiran: neotyk: right now I'm only indexing wiki pages

4:40 mittchel: lucian: thanks

4:40 robertstuttaford: does this work with lein2? i'd love to use that if possible

4:41 vijaykiran: neotyk: still need to figure out a lot of jGit API on how to walk through git repos

4:41 mudphone: robertstuttaford: sorry, it's not using that yet… but, I don't see why not

4:41 of course, I haven't used Lein 2 yet

4:41 neotyk: vijaykiran: cool :-)

4:42 robertstuttaford: as a newbie i have no backwards compatibility to maintain so i'd like to start with clojure 1.4 and lein 2

4:42 mudphone: makes sense

4:43 mittchel: (= __ (conj '(2 3 4) 1)) shouldn't this be 1 2 3 4, since 1 will be placed in front?

4:44 robertstuttaford: mudphone: some gestures that'd be really valuable to cover are form selections. select form at point, expand to outer form, contract to inner form at point, etc

4:44 mudphone: in Paredit?

4:44 N8Dawg: Hi, I'm looking through the reasoned schemer and come across the A . B syntax, any idea what the analogue is in clojure?

4:44 robertstuttaford: right now i'm spending so much time just tapdancing up and down lines to select stuff and cut and paste

4:45 i guess, if that's where the action is

4:45 mudphone: oh, you mean to copy and paste and stuff?

4:45 some of that (the navigation, selection, and delete) is covered in this presentation on Paredit: http://www.slideshare.net/mudphone/paredit-preso

4:45 I put that together a couple years ago

4:45 robertstuttaford: ok great thanks

4:45 amalloy: N8Dawg: it kinda depends on context. it's a concept that clojure doesn't have, and depending on what it's used for clojure does something different

4:46 mudphone: time flies...

4:46 cataska_: mittchel: "conj" behaves differently for list and vector

4:46 mittchel: What does it do different?

4:47 robertstuttaford: by the end of doing all this, will starting emacs up have all the right modes set up, or will i have to enable stuff each time?

4:47 mittchel: Got it now:P

4:47 N8Dawg: amalloy: it was in the context of cons

4:48 amalloy: heh. in scheme, everything is in the context of cons

4:48 mudphone: robertstuttaford: you should be able to open up a buffer with a clj file and it should be ready to go

4:48 robertstuttaford: kickass

4:48 mudphone: but, you have to: M-x clojure-jack-in

4:48 that starts a buffer with the repl running

4:48 and then you'll be in the "user" namespace

4:49 amalloy: anyway, in other lisps, a cons cell is just a pair of two things, A and B, written as (A . B)

4:49 mudphone: so, you can "use" your ns or switch to it (in-ns)

4:49 or require it

4:49 robertstuttaford: awesome

4:49 amalloy: most often, cons cells are used to represent lists, so B is either another cons cell or nil

4:50 so (A B) is how you would write the result of (cons 'A (cons 'B nil)) - (A . B) is an "improper list", just (cons 'A 'B)

4:50 mudphone: robertstuttaford: this may not be the best way to do it, but I tried to make it the fastest way to get started

4:50 while still using tools that I think are relevant

4:51 N8Dawg: amolloy: got it, thank you! Hence lists are not lazy like in Clojure

4:53 notNicolas: http://www.4clojure.com/problem/22

4:53 Can somebody give me a hint for this? I'm stumped

4:53 robertstuttaford: thanks mudphone. i'm going to give it a go

4:53 mittchel: Still one question: (set '(:a :a :b :c :c :c :c :d :d)) why does this give: :a :c :b :d instead of a:b:c:d ?

4:54 pff smileys

4:54 mudphone: robertstuttaford: you're welcome. enjoy!

4:54 notNicolas: mittchel: sets are by definition a collection of distinct elements

4:55 mittchel: But why doesn't it give it in the right order then?

4:55 notNicolas: oh, good point.

4:56 aperiodic: order is not defined for sets, though i believe it is safe to assume it is consistent

4:56 notNicolas: seems like there is a "sorted-set" made especially for this issue

4:56 aperiodic: yes

4:57 mittchel: aperiodic: how are you able to determine the order of a certain set then? for example: (def s #{:a :b : c :d}) (conj s :e} how do you know what the new set will be like?

4:59 aperiodic: mittchel: sets in clojure follow the mathematical definition of "an unordered collection of things"; if you want a reliable ordering, use a sorted-set

5:00 mittchel: Yep but I need to now the order to complete this one: (= #{1 2 3 4} (conj #{1 4 3} __))

5:00 aperiodic: oh, really? that is surprising to me

5:00 oh, no

5:01 notNicolas: are you sure sets are not considered equivalent if their order is different?

5:01 aperiodic: equality for sets does not depend on ordering

5:01 have you tried 2?

5:01 notNicolas: I'm still totally stumped for http://www.4clojure.com/problem/22 :p

5:02 mittchel: aperiodic: pretty clear. You've to conj 2 to the list in order to get 1 2 3 4. I guess it doesn't care in which order it is

5:02 1 2 3 4 == 1 4 3 2

5:02 aperiodic: mittchel: it's not a list, it's a set!

5:02 mittchel: oh sorry ye you're right

5:03 aperiodic: equality of lists does take into account order ##(= '(1 2 3) '(3 2 1))

5:03 lazybot: ⇒ false

5:06 notNicolas: wadafa

5:07 why is this so difficult

5:08 robertstuttaford: notNicolas: (fn cc [ll] (if (= (first ll) nil) 0 (+ 1 (cc (rest ll)))))

5:08 basic recursion with first and rest

5:09 mittchel: ##(= '(1 2 3) '(3 2 1))

5:09 lazybot: ⇒ false

5:09 mittchel: ##(= '(1 2 3) '(1 2 3))

5:09 lazybot: ⇒ true

5:09 mittchel: What does that ' sign do

5:09 notNicolas: hmm

5:09 robertstuttaford: the pros in here can probably halve that code

5:11 shorter: (fn cc [ll] (if-not (first ll) 0 (+ 1 (cc (rest ll)))))

5:13 aperiodic: mittchel: that is the quote. it prevents evaluation. otherwise, the list would be evaluated as if 1 were a function, which would cause an error

5:13 ,(= (1 2 3) (list 1 2 3))

5:13 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

5:14 aperiodic: ,(= '(1 2 3) (list 1 2 3))

5:14 clojurebot: true

5:14 robertstuttaford: notNicolas: see how it works?

5:15 notNicolas: hmm yep

5:16 aperiodic: notNicolas: I think the point of the question is to emphasize that all of the things you need to count support the seq interface, so you can use seq functions like first/rest to consume all of them

5:16 notNicolas: consume all the things

5:17 mittchel: ahh

5:17 cool

5:18 PeregrinePDX: I did number 22 by mapping all of the items to 1 and then summed the sequence.

5:19 aperiodic: heh, cool

5:20 robertstuttaford: nice PeregrinePDX

5:21 PeregrinePDX: There are shorter and probably much more efficient solutions.

5:23 robertstuttaford: if there weren't, lisp would suck

5:24 PeregrinePDX: #29 stole a night of sleep from me. I couldn't figure it out and I couldn't get my head to stop thinking about it when I tried to go to sleep.

5:26 calvados: (defn docx [name] (println (with-out-str (printf "%s" (doc name))))) , is there a way to quote name there ? it always returns (doc name) not the [name]

5:32 brehaut: calvados: what are you actually wanting to do?

5:32 calvados: just get the doc string?

5:32 calvados: yep kinda web service want to return it as json "doc" output

5:32 brehaut: (with-out-str (doc name)) ?

5:33 doc returns nil

5:34 however, doc is a macro, not a function

5:34 so it might not do what you expect

5:35 calvados: hm i just want to make a function and return (doc "function parameter") result

5:35 brehaut: it may be that something like ##(-> #'name meta :doc) is what you are really after

5:35 lazybot: ⇒ "Returns the name String of a string, symbol or keyword."

5:36 brehaut: that doesnt fish out arglists or when it was added, but thats not really that much extra work

5:36 calvados: i guess i will keep on reading the book, its not going fast enough

5:40 brehaut: well all the relevant information is on the meta data of the symbol

5:41 (not on the function itself)

5:41 and s/symbol/var/

5:42 calvados: hm

5:42 brehaut: ,(map meta [name #'name])

5:42 clojurebot: (nil {:ns #<Namespace clojure.core>, :name name, :arglists ([x]), :added "1.0", :static true, ...})

5:43 brehaut: #'name is short hand for (var name) btw

5:43 ,'#'name

5:43 clojurebot: (var name)

5:43 brehaut: or if thats confusing ##(read-string "#'name")

5:43 lazybot: ⇒ (var name)

5:54 notNicolas: (fn foo[x] ( if (= empty x) empty (concat [last x] (foo(butlast x)))))

5:54 I don't understand how this creates a stack overflow error

5:54 it's supposed to reverse x

5:56 this language is kind of frustratingly hard to debug

5:58 PeregrinePDX: Lol, I'm a little nervous. Just submitted my first pull request for a clojure project.

5:59 fliebel: notNicolas: I suppose you know there are just reverse and rseq functions?

6:00 notNicolas: those are banned from the exercise

6:00 PeregrinePDX: He's doing 4clojure problems.

6:00 fliebel: ah

6:01 lucian: yeah, debugging in 4clojure sucks

6:02 notNicolas: http://ideone.com/vR51b the algorithm is sound

6:03 fliebel: notNicolas: what is empty? And what is [first x]?

6:03 erm last

6:04 notNicolas: You are also operating on the end of a linked list, which is very expensive. You could apply the same logic to the head, using cons, first and rest.

6:04 Raynes: That code doesn't even make sense.

6:05 notNicolas: that's because this language doesn't make sense

6:05 Raynes: How so?

6:06 Not like Python and not making sense are two very different things.

6:06 A book/tutorial might be helpful. I don't recommend trying to learn off of 4clojure exclusively.

6:07 http://java.ociweb.com/mark/clojure/article.html is helpful, and if you ever want to give a book a shot, Clojure Programming is an excellent up-to-date choice.

6:07 In any case, I hope you change your mind.

6:07 * Raynes goes to sleep.

6:10 PeregrinePDX: That write your own reverse function took me quite awhile to figure out.

6:11 mittchel: How can you check if a list is empty?

6:11 empty?

6:11 clojurebot: empty is amalloy: therfor I return [previous] if rest

6:11 fliebel: yea

6:11 (doc empty?)

6:11 clojurebot: "([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"

7:38 _KY_: How to "concat" 2 vectors to give a result as vector?

7:39 Is it non-idiomatic to do so?

7:39 *unidiomatic

7:45 vijaykiran: , (vec (concat ["a", "b", "c"] [1, 2, 3]))

7:46 clojurebot: ["a" "b" "c" 1 2 ...]

7:46 _KY_: Thanks... but it's indeed unidiomatic..

7:46 I fd that what I need is really set union

7:46 *found

7:46 But thanks =)

8:01 si14: hey, guys. is there any example of big cljs project to try it?

8:06 Bronsa: _KY_ ##(into [1 2 3] [4 5 6])

8:06 lazybot: ⇒ [1 2 3 4 5 6]

8:07 _KY_: That's nice to know...

8:46 neotyk: si14: have you seen twitter sample that is distributed with cljs?

9:06 twhume: I have a list of functions. What's the most idiomatic way to (a) filter a sequence using the whole list and (b) find out the first function which fails each time?

9:17 robertstuttaford: minifying html. can enlive do this or is there some other fancy gadget?

9:18 vijaykiran: I don't think enlive does that - but why do you want to minify html ?

9:22 robertstuttaford: i guess it's just removing whitespace :)

9:37 kaoD: sup

9:41 robertstuttaford: inflation

9:41 this looks pretty cool: https://github.com/tnr-global/bishop

9:45 why use :gen-class ?

9:45 i see it in the bishop source.

9:47 mduerksen: does clojure.core.logic support placeholders? i would like to write something like this: (membero [_ q _ _ 'Zebra] z) , instead of this: (fresh [c s d] (membero [c q s d 'Zebra] z)), since i don't need c, s, d to be named

9:47 mdeboard: mduerksen: yes

9:48 mduerksen: mdeboard: how would i express it then?

9:49 mdeboard: mduerksen: I don't know :(

9:50 mduerksen: because if i write it just like above, i get a NPE. i've also tried (membero ['_ q '_ '_ 'Zebra] z), and (membero ['_.0 q '_.1 '_.2 'Zebra] z)

9:50 vijaykiran: robertstuttaford: which file ?

9:51 robertstuttaford: vijaykiran: https://github.com/tnr-global/bishop-sample/blob/master/src/com/tnrglobal/bishopsample/service.clj

9:51 mfex: mduerksen, in the core.logic tutorial something called macro-let is used to be able to write _ instead of (lvar) for placeholders/don't care values: https://github.com/swannodette/logic-tutorial in the zebrao example

9:52 vijaykiran: robertstuttaford: to make the class available for some other code, I guess

9:52 matessim: Damn, amazon, still waiting for my programming clojure :/

9:53 mduerksen: mfex: nice, thanks for the pointer!

9:53 robertstuttaford: ah from java code?

9:54 vijaykiran: yeah

9:54 robertstuttaford: http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html

9:56 robertstuttaford: that's handy

9:56 thanks vijay

9:57 vijaykiran: np

10:10 dgrnbrg: I watched Guy Steele's talk on parallelization, and he mentioned that using catamorphisms for parallelization (like reducers) only admitted inductive algorithms. Does clojure's implementation also support coinductive algorithms, or is there thinking going on about that?

10:10 cmiles74: robertstuttaford: That gen-class in the service.clj file doesn't need to be there. I should pull that out, actually, as it's a little confusing.

10:11 robertstuttaford: cmiles74! thanks for an awesome library. really fits my brain. using it for a json service right now. once i get in, my next challenge is integrating cemerick's friend

10:13 cmiles74, as i have 8 services to represent, my ring app simply provides a (merge …) of each service's (service/routes) method

10:13 cmiles74: robertstuttaford: Thank you! :) Getting it working with Friend is something I'm really intertested in as well, let me know if/when you get anything working. I think it could be pretty nifty.

10:13 robertstuttaford: i'm assuming that they're quite composable in this manner

10:13 cool, i will do

10:14 i've only been clojuring for about a week, though, so wear your dragon boots

10:14 cmiles74: robertstuttaford: For sure, there's no magic in the way the library handles the routes and mapping. I'm trying to keep things simple so that you can mold it to fit your project.

10:14 :)

10:17 robertstuttaford: cmiles: coupla requires and imports in the sample app can also be removed

10:18 logging, ring-utils for eg

10:18 cmiles74: robertstuttaford: Thanks, I'll get those out of there. I was rushing to get things out the door by the end of the week. :P

10:21 robertstuttaford: um. so, this is probably so simple it's daft, but how would i solve configuration data for my app?

10:21 i'm thinking environment variables are the way to go (nothing ends up in git that way)

10:21 surely this has been solved and there's some nice code somwhere?

10:23 cmiles74: robertstuttaford: cemerick has an article that covers two different ways to handle configuration, by passing in some data or by using "binding". I think you prolly see "binding" more often.

10:23 ozataman: hi all. is there a version of update-in that provides a default starting value if not present in the map?

10:23 cmiles74: robertstuttaford: http://cemerick.com/2011/10/17/a-la-carte-configuration-in-clojure-apis/

10:24 robertstuttaford: thanks

10:24 cmiles74: Although, for the app as a whole you're down to reading in a config file or hitting some other source for that data; IMHO.

10:25 vijaykiran: one of the recommended way is indeed to use the env var - http://www.12factor.net/config

10:25 cmiles74: robertstuttaford: I have removed those extra imports, etc. Thanks again for the heads up. :)

10:26 robertstuttaford: vijaykiran: yes, it's due to this great manifesto that i know about doing that

10:26 vijaykiran: :) that's the heroku's way, btw

10:26 dnolen: improving slowly http://swannodette.github.com/mori/

10:29 twhume: Is there an easy way to have the comparator function passed into sorted-map-by refer to the map it is passed into?

10:30 robertstuttaford: dnolen: this is interesting!

10:30 i'm guessing a large part of mori is also underpinning cljs?

10:32 dnolen: robertstuttaford: mori is just exposes CLJS data structures and functions.

10:32 robertstuttaford: oh, right

10:32 how much of the advanced mode js output is purely cljs?

10:32 in kilobytes, roughly

10:33 i guess i can check this myself, just curious if anyone knows

10:33 dnolen: robertstuttaford: what do you mean?

10:34 robertstuttaford: trying to figure out what the baseline kilobyte size of a cljs 'binary' is

10:34 dnolen: robertstuttaford: it depends, there's dead code elimination

10:34 robertstuttaford: in general you're looking at ~30-40k gzipped.

10:34 robertstuttaford: that's great

10:35 dnolen: robertstuttaford: mori is between ~20-30k gzipped because a lot of stuff is irrelevant for JS consumers.

10:35 robertstuttaford: not using type annotations: was that because it was deferred as not-important or because it was found to be unnecessary?

10:37 dnolen: robertstuttaford: I don't know what the type annotation buy us.

10:37 robertstuttaford: but that's because I don't know anything about it.

10:40 solussd: anyone else having trouble getting leon marg'

10:40 robertstuttaford: compile-time type checking. i guess with cljs compiling output, it'd never generate incompatibly-typed code

10:40 dnolen: robertstuttaford: yes this was mentioned and possible - but no one's pursued it.

10:41 solussd: *oops anyone else having trouble getting lein marg working (v0.7.0). I'm getting this error: Caused by: java.lang.IllegalAccessError: escape-html does not exist. Looks like the version of hiccup it depends on is incorrect, maybe?

10:41 robertstuttaford: i'm thinking it's probably unnecessary. i thought it had a bearing on the outputted js (in terms of size and code rewriting) but it appears to be there just for type-checking

10:41 dnolen: robertstuttaford: yeah that wasn't my understanding.

10:42 robertstuttaford: but yes the possibility of type-checking.

10:42 ozataman: how can I raise a number to its nth power?

10:42 dnolen: is interesting.

10:43 robertstuttaford: and it supports typedefs; so checking whether code attempts to read off properties that aren't defined

10:43 and enums

10:43 solussd: ozataman: use Math/pow, e.g. (Math/pow 2 4)

10:44 ozataman: solussd: thanks!

10:45 solussd: ozataman: np

10:56 robertstuttaford: cmiles74: how would i support two routes reaching a single function? eg /resources/:uuid and /resources/:uuid/:version. they're both gets, and the first simply finds the latest version before doing what the second one does

10:57 cmiles74: roberstuttaford: You could point both routes at the same resource, that's totally okay to do. The resource would have to check to see if a specific version was requested.

11:03 robertstuttaford: thanks

11:11 bderooms_: Greetings, is this hte right place to ask clojure benchmark questions?

11:14 joegallo: ask away, and if nobody answers, then i guess the answer was no.

11:14 ;)

11:14 TimMc: I can't think of a better place.

11:15 bderooms_: Have you looked at criterium?

11:15 bderooms_: TimMc: I have no idea what it is

11:15 joegallo: TimMc: I'm guessing he meant for him to ask questions. Not for you to give him questions.

11:15 TimMc: A very nice Clojure benchmarking tool.

11:15 joegallo: haha, my bad :-P

11:15 joegallo: I kid, I kid. :)

11:15 bderooms_: ic, thanks for the advice, I'll check it out :)

11:16 currently I'm wondering about this: when I pmap on a problem of processing 100 000 bank transactions and I print them on the screen. Than a solution where Id o the pmap and print at the same time (print in pmap) is slower than the solution where I do the pmap and then println afterwards sequentially

11:17 I am wondering why that has an effect

11:17 *Then

11:17 fliebel: bderooms_: IO is slow, and I think pmap has a buffer

11:18 beffbernard: My mind is shot.. :( how do I turn [1 2 3] into [[1 1] [2 2] [3 3]]

11:19 fliebel: beffbernard: ##(map #(vector % %) [1 2 3])

11:19 lazybot: ⇒ ([1 1] [2 2] [3 3])

11:19 bderooms_: fliebel: shouldn't the pmap solution be faster then?

11:20 beffbernard: bahhh.. I was trying (map #([% %]) [1 2 3])

11:20 I'm so lame

11:20 TimMc: beffbernard: Do you know why that fails?

11:20 &`#([% %])

11:20 lazybot: ⇒ (fn* [p1__8140__8141__auto__] ([p1__8140__8141__auto__ p1__8140__8141__auto__]))

11:20 fliebel: bderooms_: I don;t think so. IO is serialized anyway, and not doing it allows pmap to fill up its buffer faster than you can empty it.

11:21 TimMc: aka (fn* [x] ([x x]))

11:21 joegallo: ,(map (fn [x] [x x]) [1 2 3])

11:21 clojurebot: ([1 1] [2 2] [3 3])

11:21 bderooms_: fliebel: thx, for the pointer.

11:22 fliebel: TimMc: What exactly does fn* do?

11:22 That's the special form right?

11:26 TimMc: Yeah, I think it lacks destructuring, among other things.

11:26 It is a compiler primitive/

11:30 &(macroexpand-1 '(fn [x & xs] xs))

11:30 lazybot: ⇒ (fn* ([x & xs] xs))

11:30 TimMc: OK, I guess the destructuring is there.

11:36 wkmanire: Howdy folks.

12:15 achin: Is there any way to get Leiningen to deploy checksum files when it deploys to Maven?

12:18 TimMc: technomancy: How are things coming on a clojars replacement? I'm interested in doing jar signing.

12:18 technomancy: TimMc: it's an augmentation rather than a replacement =)

12:18 but yeah, that's one of the next steps

12:19 TimMc: Ah, OK.

12:19 technomancy: IIRC once we get xeqi's HTTP deploy branch merged we can start serving up signatures

12:19 so then it's up to Leiningen to start generating them when you deploy

12:20 achin: I thought it should do that by default. which version are you using?

12:20 achin: technomancy: Maybe I'm doing something wrong. I'm using 2.0.0-preview3, but it doesn't seem to be creating the hashes when I use the deploy task.

12:21 technomancy: huh, odd. I haven't checked that specifically. if you can repro on preview4 could you open an issue on github?

12:21 matessim: Is there an open source implementation of some protocols in clojure i can look at somewhere?

12:21 achin: technomancy: Yeah, sure. I'm just running "lein2 deploy reponame".

12:21 matessim: FTP/TFTP/Telnet/IRC

12:21 anything basically

12:21 HTTP

12:22 is there a open source HTTP Server in clojure or anything ?that would do too :P

12:23 mdeboard: matessim: You could look at Ring

12:23 https://github.com/mmcgrana/ring/

12:23 tmciver: matessim: check out bishop, a(nother) clojure implementation of Webmachine: https://github.com/tnr-global/bishop

12:24 matessim: Thanks guys.

12:25 beffbernard: ("Customer segment is: " {:type "dropdown" :name "segment" :items ["Bronze" "Silver" "Gold" "Platinum"]}) I'm having time adding a key/value pair to the map in the list

12:25 cmiles74: I'm around if you have any Bishop questions, I just got it out the door last week. :P

12:26 beffbernard: and example would be to add :selected "Gold" to the map

12:26 matessim: I've never used Webmachine, so i'll have to read a bit about it

12:30 zanes: Well, using youngnh's Parsatron appears to have been a mistake.

12:40 TimMc: beffbernard: You could use update-in if you used a vector instead of a list.

12:47 wkmanire: Oh man, I accidently put vlc into slower playmode.

12:47 I thought the whole world had slowed down for a moment.

12:49 technomancy: don't do drugs, kids

12:50 wkmanire: technomancy: Fan of youtube poop?

12:51 achin: technomancy: Apologies for not being able to figure this out myself: what version of pomegranate does 2.0.0-preview4 use? I don't see it in project.clj.

12:52 technomancy: Is it a transitive dependency?

12:53 TimMc: wkmanire: Maybe you speeded up. o.O

12:53 sped? sped.

12:53 wkmanire: spedeeded.

12:55 technomancy: achin: you can check it using `lein deps :tree` or look in leiningen-core/project.clj

12:55 achin: technomancy: Ah. Got it now. Thanks. I thought the checksum issue might be fixed in a bug addressed in pomegranate 0.13.1, but it looks like lein's already on that version.

12:56 xeqi: achin: yeah, I was hoping so too

12:57 achin: technomancy, xeqi: Actually, I take that back. It's on 0.0.12. I read it wrong.

13:05 PeregrinePDX: Is there a way to pass command line options to reply from lein when you start it with lein repl?

13:08 _KY_: Why is it that when I do "send-off" the program freezes?

13:08 It returns the agent and I see its state changed

13:08 dakrone: PeregrinePDX: check out :repl-options in the project.clj if you're in a project for most of the things reply can take from lein

13:08 _KY_: But the program freezes and I had to Ctrl-C to break out of it

13:09 Supposedly send-off is non-blocking, right?

13:10 rbxbx: dnolen: it just occurred to me that the argument order of mori HOFs are inverse to underscore/jquery's ... while I realize this is in keeping with Clojure/CLJS don't you think it might harm in adoption since this is more intended for vanilla JS devs?

13:10 ibdknox: _KY_: yes, but derefing the agent isn't

13:11 _KY_: I was printing the agent's state

13:11 And I saw the result... which was correct

13:11 rbxbx: dnolen: that said a rewrite of that nature would make it a much more heavyweight project than it currently is and may not be worthwhile.

13:12 _KY_: The action I sent to it was just a simple conj

13:13 ibdknox: weird

13:13 dnolen: rbxbx: yes, I've thought about this - fogus's pipeline work is a halfway step.

13:14 rbxbx: been thinking about mori(coll).map like wrapper support as well.

13:14 _KY_: Oh... I think I know...

13:14 dnolen: rbxbx: will probably put some thought into that once I've finished documenting everything.

13:14 _KY_: It was in a try-catch

13:15 dnolen: rbxbx: if you haven't seen it already http://swannodette.github.com/mori/

13:15 rbxbx: even as is this is starting to become something I can use pretty soon at work.

13:16 _KY_: If it was caught, must I do a finally?

13:16 rbxbx: dnolen: oh nice. I hadn't seen that you'd begun working on the docs :)

13:17 dnolen: where do those live?

13:17 dnolen: rbxbx: gh-pages in the mori repo

13:18 rbxbx: dnolen: ah. duh. I'd forgotten github had that. Cheers. I'll use this as a starting point then :)

13:18 _KY_: Is it necessary to include "finally" in a try-catch?

13:18 rbxbx: dnolen: this weekend's hacking time didn't quite pan out :(

13:18 PeregrinePDX: dakrone, that seems to work.

13:19 dnolen: rbxbx: np

13:19 replaca_: _KY_: nope

13:20 _KY_: I sent something to an agent in a catch-clause, and then program got frozen

13:24 Borkdude: hi mittchel

13:24 mittchel: hi

13:25 neotyk: Hi Borkdude

13:25 Borkdude: hi neotyk

13:28 mittchel: What are you guys using as irc client on mac?

13:29 Colloquy?

13:29 neotyk: mittchel: erc

13:29 joegallo: limechat

13:29 Borkdude: mittchel: I use erc or colloquy

13:29 _KY_: Ok, I discovered the problem: if I "send-off" to an agent in a jar, it freezes

13:30 Borkdude: mittchel: (erc is an irc client within emacs)

13:30 bderooms_: if I'm using a bunch (10-20) agents and spawn work at the randomly and whatever I try they only use 40-50 percent of each cpu, what could be the cause?

13:30 same with pmap.. or an agent for each work unit

13:30 mittchel: haha

13:31 lets build one in clojure

13:32 neotyk: mittchel: because why not?

13:33 mittchel: http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/

13:34 rbxbx: dnolen: this index.html is being handwritten correct? Not generated from another source?

13:34 Borkdude: mittchel: maybe you can do it as the final assignment :)

13:35 neotyk: mittchel: lazybot

13:35 mittchel: Borkdude: Could be fun

13:36 Borkdude: Will it fall under the category hard or?

13:45 dnolen: rbxbx: yep, I don't see much need for auto-generation here.

13:46 foxdonut: mittchel: xchat

13:46 muhoo: irssi

13:47 also, someone has already written a bot in clojure, right ##true

13:47 &true

13:47 lazybot: ⇒ true

13:49 gfredericks: lazybot has a lazy parser, right ##(= 2 (+ 1 1))

13:49 lazybot: ⇒ true

13:54 ache: how does one decide what leading syntax to use to send something to a bot? & vs ## vs ...?

13:55 fliebel: ache: & is lazybot, , is clojure bot ## is lazybot mid-sentence

13:58 ache: fliebel: thanks

14:04 gtrak`: mittchel: I kind of want to write one too, I want more control over my irc experience :-)

14:04 foxdonut: ,(apply str (map (comp char dec int) "dppm-!uibolt!gps!dmfbsjoh!uibu!vq!gmjfcfm"))

14:04 mittchel: gtrak`: haha nice :)

14:04 gtrak`: I'll let you know if I make any progress

14:04 foxdonut: &(apply str (map (comp char dec int) "dppm-!uibolt!gps!dmfbsjoh!uibu!vq!gmjfcfm"))

14:04 lazybot: ⇒ "cool, thanks for clearing that up fliebel"

14:06 notNicolas: ((fn foo[& x](if (= (first x) 3) 3 (foo (rest x)))) 1 8 3 1 2)

14:06 This gives me a stack overflow... I expected it to return 3

14:07 I thought it would be foo(1 8 3 1 2) returns foo(8 3 1 2) returns foo(3 1 2) returns 3

14:07 any ideas?

14:07 TimMc: notNicolas: apply foo

14:08 By the way, you have a termination problem if the value isn't found.

14:08 gfredericks: TimMc: which is exeactly what happens to him

14:08 since (rest x) is empty after the first or second call or whatever

14:08 TimMc: Ah, yep.

14:09 foxdonut: TimMc: hey, sorry about that Spring JDBC thing. :/

14:09 notNicolas: what does "apply" do in this case?

14:10 gfredericks: notNicolas: when you call (foo (rest x)), you're only giving foo 1 argument

14:10 while your function expects many arguments

14:10 foxdonut: notNicolas: I think you're better off with ((fn [x] (if (= (first x) 3) 3 (foo (rest x)))) [1 8 3 1 2])

14:11 notNicolas: foxdonut, sure, but I'm trying to figure out the variable arguments thing

14:11 gfredericks: so either you change the way you call it, as TimMc suggested, or change the function signature as foxdonut suggested

14:11 foxdonut: notNicolas: ah ok, then what gfredericks/TimMc said.

14:11 gfredericks: either way you have to match them up

14:11 notNicolas: why would (foo (rest x)) only give 1 argument?

14:12 gfredericks: because syntactially there is only one argument there

14:12 in other languages if you call foo(x.rest()), you also just get one argument, even though that argument is a collection

14:13 foxdonut: notNicolas: you are calling foo with *one* argument, even if it is a list

14:13 dreish: (Other languages except Perl.)

14:13 notNicolas: but what does apply even do? it's not a very descriptive name for a function. reminds me of doThing()

14:14 gfredericks: notNicolas: it does the thing you're trying to do :)

14:14 takes a collection of items and spreads them out as the argumentS

14:15 foxdonut: &((fn foo [& x] (if (= 1 (first x)) (foo (rest x)) (count x))) 1 2 3 4)

14:15 lazybot: ⇒ 1

14:16 foxdonut: &((fn foo [& x] (if (= 1 (first x)) (apply foo (rest x)) (count x))) 1 2 3 4)

14:16 lazybot: ⇒ 3

14:17 notNicolas: &((fn foo [& x] (if (= 1 (first x)) (foo (rest x)) x)) 1 2 3 4)

14:17 lazybot: ⇒ ((2 3 4))

14:18 notNicolas: oh, is it because it's a list in a list?

14:18 eighty: i'm seeing some strange behavior with dispatching a defrecord via multimethod. can someone take a peek? https://gist.github.com/648444a06275eb910d11

14:18 basically, i can do (f (MyRecord. 1 2)) where f is a multimethod

14:19 buuuuuut, i can't do (def r (MyRecord. 1 2)) (f r)

14:19 foxdonut: notNicolas: yes, because (foo (rest x)) calls foo with one argument, since (rest x) is itself a list.

14:19 eighty: basically i'm seeing "No method in multimethod 'f' for dispatch value: class user.MyRecord [Thrown class java.lang.IllegalArgumentException]"

14:20 foxdonut: notNicolas: so you get (foo [2 3 4]) instead of (foo 2 3 4). To get (foo 2 3 4), you use (apply foo [2 3 4]).

14:20 notNicolas: I think this makes sense now

14:21 sweet, thanks!

14:21 foxdonut: glad that helped :)

14:21 notNicolas: by the way

14:21 is there any like...... usefulness in clojure

14:21 foxdonut: say what?

14:22 bderooms_: could someone take a look at these results and help me to explain why they are like that? http://igwe.rave.org/~bderooms/prolog_weird.png (if you need more info, let me know)

14:22 notNicolas: it seems hard to apply in a practical situation

14:22 dreish: eighty: I *think* I've had a similar problem, and it turned out to be that one namespace had "MyRecord" referring to a stale version of the class, so even though they had the same name, they didn't match. I had to redo import MyRecord to sync it up.

14:23 notNicolas: I'd wait until you've had a little more experience with it before making a judgment like that.

14:23 ralfonso: is there any way to tell if a var is an instance of any record? clojure.walk/stringify-keys causes on error because it sees records as maps and attemps "into {}"

14:23 foxdonut: notNicolas: it might seem that way because 1) it's different from what you're used to, and 2) there are tons of examples out there (in functional programming) that are more theoretical than practical.

14:23 notNicolas: but coming from Java and mostly creating web applications, I find Clojure *very* practical.

14:24 notNicolas: foxdonut, I'm finding that clojure doesn't have very many quality tools. especially compared to more popular alternatives like python and C++

14:24 ForSpareParts: notNicolas, that is VERY true.

14:24 eighty: dreish: hmmm, so my defrecord and multimethod are defined in the same namespace, and i'm seeing the problem after a lein clean, swank

14:24 ForSpareParts: and a damn shame, because I'm really enjoying using Clojure : (

14:24 foxdonut: notNicolas: do you mean development tools, IDE, etc.? Or libraries/frameworks?

14:24 dreish: notNicolas: I think I had more-or-less the same feeling at first, that I was fighting against the language to some extent, trying to bend solutions that came to mind to a language where they didn't fit naturally. But after a while with it, the idioms and methods of solving problems become second nature.

14:24 notNicolas: foxdonut, all of those basically

14:24 ForSpareParts: (I assumed he meant dev tools)

14:25 foxdonut: notNicolas: well part of it I would think is just because it hasn't been around as long

14:25 dreish: eighty: Okay, sounds like it's not the same problem, then.

14:25 eighty: dreish: nuts :)

14:25 notNicolas: this whole functional programming thing seems like more of a mental exercise than something actually practical like C++ or python

14:25 bderooms_: notNicolas: in any concurrent problem with lot s of chance on deadlocks clojure seems to take a lot of headache away for me

14:26 neotyk: notNicolas: you should try productivity boost offered by slime

14:26 TimMc: notNicolas: Tell that to the wedding gift registry site I very quickly created for myself in Clojure. :-P

14:26 bderooms_: notNicolas: that statement is not true.. in my school (vub brussels) we start of with that mental exercise and after a while it becomes easy. IT all depends on what you are used to

14:26 notNicolas: is it possible to do graphics like GL?

14:27 eighty: (defrecord MyRecord [x]) (defmulti foo class) (defmethod foo MyRecord [t] :yay)... (foo (MyRecord. 8)) => :yay, (def r (MyRecord. 8)) (foo r) => FAIL :(

14:27 notNicolas: I'm hearing a lot about Clojure being used for web stuff...

14:27 I'm more interested in graphics and games

14:27 eighty: notNicolas: yeah man, prismatic is a great example

14:28 dreish: notNicolas: http://duckduckgo.com/?q=clojure+opengl

14:28 ForSpareParts: notNicolas, there's this library for doing OpenGL: https://github.com/ztellman/penumbra

14:28 eighty: notNicolas: check out the D3 clojure port called C3

14:28 ForSpareParts: I haven't used it myself

14:28 eighty: notNicolas: oops, c2: http://keminglabs.com/c2/

14:29 notNicolas: cool stuff

14:29 ForSpareParts: Also, since it integrates so tightly with Java/CLR/Javascript, there's no reason you couldn't use Clojure to do cool parallel calculations and stuff, and then hand off the data to some imperative code to render graphics.

14:29 I've actually been thinking for a while about trying to make a simple game that way, partly as an exercise to learn the language.

14:30 notNicolas: I'd have fun making a game for a ludum dare using clojure

14:32 ForSpareParts: You know, that might actually give me a reason to do a ludum dare. That'd be fun.

14:34 Also, have you looked into refs and agents yet? That stuff was what convinced me to spend some time digging into Clojure -- after spending a semester studying the headaches of imperative concurrency, the idea of being able to handwave it is *very* appealing ; )

14:34 notNicolas: I have to figure out the basics first... Working my way through 4clojure

14:34 ForSpareParts: Maybe I should do that. I've just been trying to invent random tasks for myself...

14:35 notNicolas: it's been fun for me so far

14:35 fliebel: notNicolas: Any luck with the reversing?

14:35 edw: Hey, if any of you guys are in NYC, and are interested in working as a full-time employee at an ad-tech start up as a web dev, please check out <http://actionx.com/tech-jobs.html>.

14:36 fliebel: edw: Clojure?

14:37 notNicolas: fliebel, yep, I've worked it out finally. Just a lot of misery with the syntax.

14:37 ForSpareParts: Hey, do you guys know of any good parsing libraries?

14:38 mtkoan: what are you parsing?

14:38 edw: I hope so. It's pretty open-ended. Our prototyping was done in Clojure (by me), we're building the main system in Java + Spring, hosting on Heroku. I can't imagine that we'd ever use Pig given that Cascalog exists.

14:39 ForSpareParts: Oh, anything -- maybe a scripting language, or simplified english commends (like for text adventures). I was just looking for something to hack around with.

14:39 dnolen: notNicolas: a few people have been doing games with Clojure & ClojureScript

14:39 ForSpareParts: I really liked Parsec for Haskell, but I'm not terribly fond of Haskell.

14:39 edw: We're mostly looking for smart people, and I hope that smart people will push for using Clojure where it makes sense. (I'm the VP of product but a programmer, edw on Github.)

14:40 dnolen: notNicolas: a couple people actually did the last Ludum Dare w/ ClojureScript

14:40 fliebel: dnolen: links? Curious what they made.

14:41 notNicolas: since clojure is implemented with java it's nice that it's cross platform too

14:41 dnolen: fliebel: search the mailing list - also yoklov, http://github.com/thomcc has a bunch of stuff.

14:42 mtkoan: ForSpareParts: something my friend cooked up: https://github.com/aaronc/clj-parse

14:42 dnolen: notNicolas: also Penumbra is pretty sweet but someone needs to step up and take it over - https://github.com/ztellman/penumbra

14:42 notNicolas: http://ideolalia.com/creating-a-simple-game-in-clojure

14:43 notNicolas: looks solid

14:43 fliebel: dnolen: :( https://groups.google.com/forum/?fromgroups#!searchin/clojure/lundum$20dare

14:44 dnolen: Ludum Dare

14:44 fliebel: might need to check clojure-dev too

14:44 fliebel: *facepalm*

14:45 dnolen: notNicolas: http://thomcc.github.com/Argh/ is fun - though I'm not sure yoklov is still pursuing it

14:46 notNicolas: wow

14:46 dnolen: notNicolas: that's all ClojureScript

14:47 notNicolas: also this blog http://oblong-code.blogspot.com/

14:48 notNicolas: hmm

14:49 (fn [& args]( apply reduce (fn [x y]( if(> x y) x y)) args))

14:49 "Wrong number of args (5) passed to: core$r"

14:49 Oh, I guess I don't need to apply in that case

14:50 apply is only necessary if you pass "args" to another function which takes variable args...

14:50 Borkdude: notNicolas: not necessarily variable

14:50 ,(apply (fn [a b] (+ a b)) [1 2])

14:51 notNicolas: hmm

14:51 Borkdude: &(apply (fn [a b] (+ a b)) [1 2])

14:51 XPherior: Why isn't my Miles record available in the test files? https://gist.github.com/2695642

14:51 lazybot: ⇒ 3

14:51 Borkdude: &(doc apply)

14:51 lazybot: ⇒ "([f args] [f x args] [f x y args] [f x y z args] [f a b c d & args]); Applies fn f to the argument list formed by prepending intervening arguments to args."

14:51 ForSpareParts: mtkoan, thanks! I'll take a look at that.

14:52 mtkoan: ForSpareParts: could be ideally suited for defining a grammar for MUD commands

14:53 fliebel: &(map apply (cycle inc dec) [1 2 3 3 4])

14:53 lazybot: clojure.lang.ArityException: Wrong number of args (2) passed to: core$cycle

14:53 XPherior: Also, invoking my protocol functions with something other than a record yields a stacktrace that the first parameter is wrong, meaning those functions are in scope.

14:53 fliebel: &(map apply (cycle [inc dec]) [1 2 3 3 4])

14:53 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long

14:53 ForSpareParts: Yeah, it looks sweet!

14:56 XPherior: Nevermind, figured it out! Needed a require, not a use

14:57 Bronsa: ,(map deliver (cycle [inc dec]) [1 2 3 3 4]))

14:58 lazybot ?

14:58 ,(map deliver (cycle [inc dec]) [1 2 3 3 4])

14:59 raek: Bronsa: lazybot s triggered by "&". it is clojurebot that has the "," trigger

14:59 Bronsa: oh.

14:59 &(map deliver (cycle [inc dec]) [1 2 3 3 4])

14:59 lazybot: ⇒ (2 1 4 2 5)

14:59 raek: clojurebot seems to be offline now for some reason

15:00 Bronsa: i see

15:00 fliebel: huh, is a function a promise?

15:00 otijhuis: am currently learning clojure by rewriting some apps for fun which is a great experience. One of them is currently using the Drools rules engine. Is there an alternative in Clojure for more complex rules? (rules triggering other rules etc)

15:00 Bronsa: no

15:01 fliebel: Bronsa: then why ##(deliver inc 1)

15:01 lazybot: ⇒ 2

15:01 TimMc: &(doc deliver)

15:01 lazybot: ⇒ "([promise val]); Alpha - subject to change. Delivers the supplied value to the promise, releasing any pending derefs. A subsequent call to deliver on a promise will throw an exception."

15:02 Bronsa: because deliver is implemented as a simple funcall

15:02 i guess it's an implementation detail but it happens to work.

15:02 TimMc: $findfn + 2 3 5

15:02 lazybot: [clojure.core/trampoline]

15:02 dnolen: rbxbx: thanks for the additions

15:02 TimMc: $findfn inc 2 3

15:02 lazybot: [clojure.core/deliver clojure.core/trampoline]

15:03 Bronsa: yeah, just for single arity

15:04 rbxbx: dnolen: np, I plan to continue adding more but figured I'll do pull requests frequently so we don't step on eachother's work. Is that fine?

15:04 dnolen: rbxbx: yep

15:05 TimMc: fliebel: So it's the other way around: A promise happens to be a function.

15:08 rbxbx: dnolen: in actually sitting here using the library I think adding a proxy/wrapper would be nice...

15:09 dnolen: almost feels like something you should have by default anyway when using a Mori collection type... mori.hash_map("foo", 1).has_key('foo') // true

15:10 dnolen: rbxbx: yeah I don't see how that particular case can work.

15:10 but mori({"foo": 1}).has_key('foo') would be interesting.

15:11 rbxbx: would be nice if mori itself was a function that did the smart wrapping etc.

15:11 rbxbx: dnolen: and how. Seems worth exploring down the road :)

15:11 jsabeaudry: I'm trying to return the result of an async jquery ajax call but I'm having trouble doing it without state, (let [result nil] (.ajax $ {:async false :success #(set! result %)}) result) this doesn't work but what is the better way?

15:11 rbxbx: dnolen: seems like you'd have to add some sort of annotation for set/list/vector though, as I don't know how you'd disambiguate

15:12 dnolen: though maybe supporting vector/hash_map out of the box would get you more than 50% of the way there, as I imagine those will be the most commonly used collections

15:18 dnolen: rbxbx: I'd like figure something out for that soon as the docs are done and what the Miro actually pulls in is in sync.

15:20 TimMc: jsabeaudry: You mean a *synchronous* query, yes?

15:22 XPherior: Agh, I didn't end up figuring it out. Still having problems importing a record from another namespace. https://gist.github.com/2695642

15:23 notNicolas: soooo what does "identity" do?

15:23 TimMc: notNicolas: Not much.

15:23 tmciver: ,(doc identity)

15:23 TimMc: tmciver: clojurebot is missing

15:23 jsabeaudry: TimMc, oh yes, a synchronous query my bad

15:23 tmciver: &(doc identity)

15:23 lazybot: ⇒ "([x]); Returns its argument."

15:23 XPherior: &(partition-by identity [1 1 2 2 3 3 4 5])

15:23 lazybot: ⇒ ((1 1) (2 2) (3 3) (4) (5))

15:23 notNicolas: not very descriptive

15:24 XPherior: It does stuff with other stuff :)

15:24 AimHere: &(filter identity [false false false :brian false])

15:24 lazybot: ⇒ (:brian)

15:24 XPherior: It's descriptive. It's just simple.

15:24 TimMc: notNicolas: What would you have the docstring say?

15:24 notNicolas: I don't know because I don't understand what it does

15:24 AimHere: Identity is a function that takes an argument, and returns the argument.

15:24 tmciver: notNicolas: it returns its argument . . .

15:25 notNicolas: oh

15:25 XPherior: Really, don't overthink it

15:25 TimMc: notNicolas: ##(identity 5)

15:25 lazybot: ⇒ 5

15:25 AimHere: Like the mathematical function f(x)=x

15:26 notNicolas: &(filter identity [1 2 3 nil 4 false true 1234])

15:26 lazybot: ⇒ (1 2 3 4 true 1234)

15:26 notNicolas: this happens because nil and false are filtered by being non-true?

15:26 dnolen: notNicolas: yep

15:26 notNicolas: alright simple enough

15:26 AimHere: Filter discards all the falsy values, and identity just passes on what values are in the list, yes

15:27 TimMc: notNicolas: nil and false are "logical false", everything else is "logical true"

15:30 jsabeaudry: Function bar takes a function as a argument and will call it with the result as an argument, from function foo, you need to call bar and return the result, consider bar a black box

15:30 that could be a 4clojure challenge

15:31 all of this without mutation

15:36 dnolen: rbxbx: thanks again, there's a few things missing like that I think :)

15:36 rbxbx: find could be improved a bit by returning an array instead of a vector

15:37 amalloy: jsabeaudry: did i miss some context? in isolation i can't understand your suggested problem at all

15:37 rbxbx: dnolen: so doing something more along the lines of mori.each instead of exports CLJS's function?

15:37 exporting*

15:38 (or juxt, or curry, etc)

15:38 dnolen: rbxbx: more like juxt

15:38 rbxbx: dnolen: I may look into that later, though my Clojure/Script isn't terribly strong.

15:39 dnolen: rbxbx: sure, np - I can tackle that too.

15:39 rbxbx: dnolen: I'm sure I could use CLJS's as a reference implementation though :)

15:40 (maybe)

15:40 jsabeaudry: amalloy, (= 5 (___ #(% 5)))

15:40 Am I slow today or is this tricky?

15:41 amalloy: #(% identity)?

15:42 &(#(% identity) #(% 5))

15:42 lazybot: ⇒ 5

15:42 TimMc: jsabeaudry: Your problem is more different-like, though.

15:43 jsabeaudry: Oh yes more like (= 5 (___ (do #(% 5) nil)))

15:44 oops not quite right,

15:44 TimMc: (= 5 (___ (blackbox #(% 5))))

15:45 promise/deliver?

15:45 jsabeaudry: TimMc, do you think it's possible without state? I was thinking maybe some kind of continuation passing pmagic but is it possible if blackbox doesn't cooperate

15:46 TimMc: I doubt it.

15:46 Well, I'd have to take some couch time.

15:46 * TimMc doesn't own a hammock

15:47 ivan: hiredman: do you think that a tuple should print differently than a vector, given that getN doesn't work on vectors?

15:49 jsabeaudry: promise and deliver could do the job but they dont seem to be available in cljs

15:51 TimMc: Write 'em!

15:51 Oh wait, you need to block.

15:52 Raynes: Isn't that all javascript does? :p

15:52 gozala: TimMc: jsabeaudry I have prototyped js like promises for cljs

15:52 https://github.com/Gozala/eventual-cljs

15:52 Raynes: Should be called blockscript

15:52 TimMc: jsabeaudry: Your function could take a continuation argument, k, and call that from inside :success...

15:53 gozala: Doesn't help with returning from a synchronous function.

15:53 ivan: you know what would be really cool? if a caller that used a Deferred could "wait" on it; a macro would rewrite all of its control flow

15:54 gozala: TimMc: Sorry I have not been following whole conversation, just noticed you were talking about promises in cljs

15:55 TimMc: ivan: You have to invert control on a whole wad of the call stack, though.

15:56 ivan: TimMc: yep. not that I have any idea how to do this

15:56 but it would be nice to solve once rather than many times, as it ends up when you use Deferreds

15:58 TimMc: Oh, wait! The $.ajax call does the blocking here, right?

15:58 gozala: TimMc: why does not it helps with sync function btw ?

15:58 ivan: you can block with synchronous AJAX, but you really don't want to ever block

15:59 TimMc: gozala: It does, I forgot that sync meant sync. :-P

15:59 gozala: Did you meant async than ?

15:59 TimMc: jsabeaudry: Why *are* you using a sync call, anyway?

16:00 mittchel: (assoc-in tentamencijfers [1 :cijfer] 10

16:00 (get-in tentamencijfers [1 :cijfer]))

16:00 What's wrong witht his? I'm trying to retrieve the 10

16:00 gozala: TimMc: do you mind repeating what your problem is I'm not able to find the head of this conversion

16:01 jsabeaudry: TimMc, I'm using the jquery console (the same one as tryclj.com) and I am under the impression this is the only way to use it

16:03 hiredman: ivan: but tuples are vectors

16:03 TimMc: gozala: jsabeaudry is trying to use jQuery's $.ajax in {:async false} mode without state. $.ajax uses callbacks even in sync mode.

16:03 Raynes: jsabeaudry: You're using jquery-console from clojurescript?

16:05 ivan: hiredman: well, with the better different performance properties and the getN support. what if someone serialized a tuple and got back a vector? then they'd have slower vectors with no getN

16:05 s/different//

16:05 gozala: TimMc: ok and what are you trying to do ?

16:05 TimMc: Me? Nothing.

16:05 dsantiago: hiredman: I wasn't clear from your comment on CLJ-988; did you actually see an improvement in your tests, but just didn't get straight line benhcmark numbers?

16:06 gozala: TimMc: oh for the moment I thougt jsabeaudry was js lib :D

16:06 TimMc: haha!

16:06 jsabeaudry: Raynes, I'm trying to yes

16:07 Raynes: jsabeaudry: I'd be interested in seeing the end result if this is public code.

16:07 (I'm the author of tryclj)

16:07 xeqi: mittchel: did you misplace a paren? also note assoc-in returns a new map, which needs to get passed to get-in

16:08 gozala: jsabeaudry: so you should be able to use my promise lib to wrap $.ajax but I guess it's not worth it

16:08 mittchel: @xeqi: If I'm correct I didn't miss place..

16:09 gozala: jsabeaudry: I think wrapping $.ajax into function that modifies an atom on callback

16:09 and returning value of that atom should be ox

16:09 jsabeaudry: Raynes, I won't be public, but I'm sure I can write the good stuff a second time in a pastebin :P

16:09 gozala: as state will be captured with in that function

16:10 xeqi: &(get-in (assoc-in {} [:k1 :k2] 1) [:k1 :k2])

16:10 lazybot: ⇒ 1

16:10 mittchel: &(get-in (assoc-in tentamencijfers [1 :cijfer] 10) [1 :cijfer])

16:10 lazybot: java.lang.RuntimeException: Unable to resolve symbol: tentamencijfers in this context

16:10 mittchel: oh lol

16:10 this one works

16:10 in repl:P

16:10 hiredman: dsantiago: I don't have benchmark numbers, but when I ran the code I did not see the lock contention issues

16:10 Raynes: jsabeaudry: Cool. :>

16:11 jsabeaudry: gozala, Yes, that seems like it will be the way to go until we can find a way without using state

16:11 gozala: jsabeaudry: not using $.ajax could be another way

16:12 michaelr525: Hello

16:12 jsabeaudry: gozala, ah using a straight up XMLHttpRequest?

16:13 gozala: jsabeaudry: yeah

16:14 jsabeaudry: I would also expect that google closure compiler has some XHR wrapper

16:14 that may work without callbacks for sync requests

16:14 TimMc: The synchronous version of that will do a straight return?

16:14 It's not even hard to use XHR directly.

16:16 ivan: goog.net.xhrio is always async

16:17 gozala: jsabeaudry: Honestly I would not care about state in the cljs wrappre function that much since XHR has state anyway

16:17 Raynes: TimMc: Byte your tongue.

16:17 gozala: and $.ajax has it to

16:18 if you add yet another layer that doesn't leaks state I don't see much issue with that

16:24 mittchel: ,(true? (fn [x, y] (get-in y [x]) :a {:a nil :b 2}))

16:24 rbxbx: dnolen_: for reasons beyond my comprehension mori.nth is exhibiting different behvaior than both clj/cljs nth ... more accurately, vector seems to behave correctly. List and Set however will throw an exception when the index is length+1 (ignoring the fallback case specified), but for indexes > length+1 simply return null

16:25 dnolen_: rbxbx: sounds like a bug

16:26 rbxbx: dnolen_: indeed, it's just confusing since it works fine in a CLJS repl and you're doing a straight export of that impl

16:26 dnolen_: rbxbx: hmm might be a bug in CLJS itself.

16:26 rbxbx: nth is just CLJS's nth

16:27 rbxbx: which version of CLJS you testing this with?

16:27 rbxbx: dnolen_: head

16:30 dnolen_: https://www.refheap.com/paste/2717

16:31 dsantiago: hiredman, ok, good, thanks.

16:31 rbxbx: dnolen_: er, this one, rather - https://www.refheap.com/paste/2718

16:31 dnolen_: rbxbx: yeah definitely a bug in ClojureScript

16:32 rbxbx: dnolen_: would you like to file it or should I? I'm not sure I understand the origin. Something about the export directive being handled differently than standard compilation?

16:32 Raynes: dnolen_: We should have a party or something when refheap hits 3000 pastes.

16:33 dnolen_: rbxbx: ticket created http://dev.clojure.org/jira/browse/CLJS-256

16:33 rbxbx: dnolen_: cheers.

16:35 pandeiro: Raynes: anything else I'd need to do here? https://github.com/ibdknox/noir/pull/94

16:36 Raynes: pandeiro: Nope, looks great. I'll merge it tonight. :)

16:36 wkmanire: pandeiro: Adding stuff to noir?

16:37 pandeiro: just docstrings for the defpartial macro

16:37 Raynes: pandeiro: Also, sorry for being pedantic about the destructuring.

16:37 There wasn't anything necessarily wrong with your code or anything.

16:38 pandeiro: Raynes: i found it helpful

16:38 it's funny to look at my first two attempts, then chris' suggestion, then yours

16:38 wkmanire: Cool.

16:38 pandeiro: i don't think i could've found a harder way to do it

16:38 but "it's my first time" (with macros)

16:38 Raynes: Haha

16:39 Yeah, macros can be brutal at first.

16:39 pandeiro: i was very intimidated by the inability to debug anything while macroexpand throws exceptions

16:39 Raynes: pandeiro: Go look at lazybot's defplugin macro.

16:39 First macro I ever wrote, though it used to be a lot worse than it is today.

16:43 pandeiro: if i fork a repo to bump dependency versions, the project version number should not be touched, right? or wrong? or case-by-case?

16:44 Raynes: I'd leave it alone, because you never know when the author might want to do a different type of bump than you did.

16:45 mittchel: (true? (fn [x, y] (nil?((get y x nil))) :a {:a nil :b 2}))

16:45 why does this return false?

16:46 pandeiro: Raynes: gotcha, but then if i want to use that fork with the updated deps in my project, i need to make a jar of it, and it will overwrite the version in my local .m2?

16:46 raek: mittchel: functions are not the true object

16:46 ,(boolean (fn [x, y] (nil?((get y x nil))) :a {:a nil :b 2}))

16:46 &(boolean (fn [x, y] (nil?((get y x nil))) :a {:a nil :b 2}))

16:46 lazybot: ⇒ true

16:46 Raynes: pandeiro: You can do one of two things here.

16:46 mittchel: http://www.4clojure.com/problem/134 is a pain in the ass

16:46 I need true there

16:47 Raynes: pandeiro: You can either bump the version locally and install it and then use it until a real version is released (which is what I do), or you can use lein's checkout deps.

16:47 mebaran151: mittchel: looks like you might be missing a set of parens

16:47 mittchel: oh, where?:O

16:48 mebaran151: you want to call the function on those arguments; need an extra set '(fn' and ') :a'

16:48 mittchel: Can't seem to solve it for some reason

16:48 oh lol

16:49 mebaran151: &(fn [x, y] (nil?((get y x nil))) :a {:a nil :b 2})

16:49 lazybot: ⇒ #<sandbox3826$eval8741$fn__8742 sandbox3826$eval8741$fn__8742@595fa>

16:49 mittchel: Do you mean something like: (true? (nil?(get y [x] nil) :a {:a nil :b 2}))

16:49 mebaran151: (true? ((fn [x, y] (nil?((get y x nil)))) :a {:a nil :b 2}))

16:49 TimMc: nil? doesn't take 3 args

16:49 Raynes: The trick is that you can specify a not-found value.

16:49 &(:a {:b 0} false)

16:49 lazybot: ⇒ false

16:49 mittchel: ::not-found right

16:50 mebaran151: &(true? ((fn [x, y] (nil?((get y x nil)))) :a {:a nil :b 2}))

16:50 lazybot: java.lang.NullPointerException

16:50 mittchel: &(true? (fn [x, y] (nil?(get y [x] ::nil)) :a {:a nil :b 2}))

16:50 lazybot: ⇒ false

16:51 Raynes: mittchel: When you're okay with spoilers, let me know and I'll give you my solution.

16:51 mebaran151: mittchel, just note that your fn form returns {:a nil :b 2}, since you didn't end your function after the nil test

16:51 mittchel: this is abracadabra

16:52 mebaran151: &(true? ((fn [x, y] (nil? (get y x nil))) :a {:a nil :b 2}))

16:52 lazybot: ⇒ true

16:52 mebaran151: there we go, parens all fixed up :)

16:55 mittchel: hm

16:55 Why were they wrong

16:57 otijhuis: mittchel: looks like you were checking if the function was true, not the result of the function

16:57 mittchel: hm

16:57 Though, if I fill in this: ((fn [x, y] (nil? (get y x nil))))

16:57 test fails

16:58 otijhuis: mitchell: last one fails?

16:58 mittchel: yep

16:58 otijhuis: mitchell: now it returns nil if it isn't found and you need to return something that isn't nil when it can't find the key

16:59 mittchel: lol

16:59 false ofcourse

16:59 brehaut: prime oppertunity for juxt and every?

17:00 mittchel: thanks took a while

17:01 Raynes: mittchel: #(nil? (% %2 false))

17:01 You basically ended up with the same thing. Mine is shorter because I'm using a short form anonymous function and not using get, since keywords and maps are both functions that do the same thing as get.

17:02 amalloy: note you don't need to use false - it doesn't matter what it is, anything but nil will work. i used + just to make it look like there might be some arithmetic going on

17:03 Raynes: Hehe

17:03 I used false for clarity and because I rarely do the code golf stuff.

17:06 mittchel: what does that %2 mean raynes/

17:06 Raynes: It's the second argument to the anonymous function.

17:06 brehaut: its the second argument to an inline anonymous form

17:06 Raynes: % is the first argument, %2 is the second, %3 the third and so on.

17:06 brehaut: ,'#(str % %2)

17:08 TimMc: % = %1

17:09 PeregrinePDX: Lol that anonymous function form reminds me so much of perl.

17:09 brehaut: dnolen_: ping?

17:09 dnolen_: brehaut: pong

17:09 Raynes: PeregrinePDX: Didn't you know? Clojure is Perl with parens.

17:10 PeregrinePDX: It certainly has the terseness a lot of perl down. Which with perl caused a lot of people to complain.

17:10 brehaut: dnolen_: i sent you a PM

17:34 midrangio: anyone here on 4clojure?

17:35 brehaut: many people yes

17:36 midrangio: i'm confused as to why i get the error "You tripped the alarm! def is bad!

17:36 brehaut: you arent allowed to def things

17:36 midrangio: do they want me to use anonymous functions or something

17:36 gfredericks: yes

17:36 XPherior: I have two records that implement a protocol. Both records refer to each other, which causes a compile error. Is it possible to declare record existence?

17:36 brehaut: yes

17:37 midrangio: can you do anonymous functions with different function signatures

17:37 kaoD: midrangio:

17:37 brehaut: yes

17:37 kaoD: you might wanna go to #4clojure

17:37 gfredericks: XPherior: you can do it without them referring to each other if nothing else

17:37 XPherior: gfredericks: I could, but it would kill the point of what I'm doing.

17:38 midrangio: anyways, nice language

17:38 gfredericks: XPherior: well we wouldn't want to do that

17:38 XPherior: gfredericks: Nope. :)

17:38 gfredericks: ,((fn ([a] 1) ([b c] 2)) :one-arg)

17:38 XPherior: I guess I could split them across files.

17:38 brehaut: i think clojurebot us having a nap

17:38 gfredericks: &((fn ([a] 1) ([b c] 2)) :one-arg)

17:38 lazybot: ⇒ 1

17:39 gfredericks: &((fn ([a] 1) ([b c] 2)) :one-arg :another-arg)

17:39 lazybot: ⇒ 2

17:39 midrangio: gfredericks: thanks

17:41 gfredericks: how would i call the anonymous function internally, but with a different argument signature

17:41 it says mismatched argument count when i do 'recur'

17:41 gfredericks: you can give it a name after fn

17:42 &((fn f ([a] (f a 2)) ([b c] (+ b c))) 8)

17:42 lazybot: ⇒ 10

17:42 kaoD: midrangio: it should work with recur too

17:42 you're just missing arguments

17:42 oh, nevermind

17:42 different arg count

17:47 notNicolas: soo what's the difference between [] '() and #{}?

17:47 I think [] is vector and '() is list?

17:47 johnkpaul-afk: yes

17:48 and #{} is a set

17:48 gfredericks: and #{} is set

17:48 ,(= '() [] #{})

17:48 clojurebot: false

17:48 gfredericks: oh he lives

17:48 notNicolas: {} by itself without the # is not a set?

17:48 gfredericks: it is a map

17:48 notNicolas: I see

17:48 kaoD: hmmm

17:48 notNicolas: those seem like pretty newbie questions

17:49 gfredericks: yeah get out of here

17:49 kaoD: shouldn't you better be reading a book/tutorials?

17:49 notNicolas: too lazy to buy a book

17:49 kaoD: no, don't get me wrong, I'm not like "get outta here you filthy newb"

17:49 notNicolas: couldn't find the answer in the quick reference

17:49 kaoD: notNicolas: you ain't gonna learn clojure with a quick ref

17:49 PeregrinePDX: http://www.brainonfire.net/files/seqs-and-colls/main.html

17:50 notNicolas: we'll see about that

17:50 PeregrinePDX: With enough outside references he might possibly.

17:51 Raynes: kaoD: I pointed him at the ociweb introduction last night, which should be sufficient.

17:52 notNicolas: I'm just pwning the 4clojure things

17:52 kaoD: notNicolas: I bet you're not

17:52 :P

17:53 notNicolas: yeah I'm getting my ass kicked but I'm getting better

17:54 PeregrinePDX: Lol I have a book and was getting my ass kicked at the beginning.

17:54 Raynes: Some of those problems are ridiculously hard.

17:54 mebaran151: I'm beginning to use defrecords and defprotocol like data types and type classes respectively; makes me think that a performant monad implementation could be layered on top of those building blocks

17:55 dnolen_: mebaran151: somebody started on something like that a year ago but it hasn't gone anywhere.

17:55 mebaran151: https://github.com/antoniogarrote/clj-control

17:57 mebaran151: ah looks sort of like what I was thinking; except is there any benefit over using regular ol' functions performance wise?

17:58 muhoo: i'm curious about lein/maven version resolution. if my top-level project required [foobar "2.0.0"] and also [baz "1.0.0"] and baz itself requires [foobar "1.0.0"], will i have both versions of foobar floating around? or just the most recent?

17:58 jasonjckn: mebaran151: good question

17:58 i wonder

17:58 brehaut: muhoo: http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution

17:59 muhoo: brehaut: thanks!

17:59 brehaut: muhoo: those are soft ranges, so the highest will be used

17:59 mebaran151: jasonjckn: in ghc, I think the compiler does some smart optimizations, but there would probably just be a bunch of layered record accesses that might be as slow as .invoke() for fn's

17:59 kaoD: brehaut: but aren't major versions supposed to break backwards compatibility?

17:59 and therefore you might need both

17:59 ivan: anyone know why La Clojure takes so long to highlight all the "first symbol in list"?

18:00 brehaut: kaoD: thats up to you to sort out with your dependancy strings. if you use soft versions, its your own funeral

18:00 jasonjckn: mebaran151: Does GHC optimize away all the function dispatch of bind?

18:00 kaoD: brehaut: that makes sense

18:01 muhoo: so [foobar "[1.0.0]"] would be the lein syntax to *insist* upon older 1.0.0 even if 2.0.0 is a dependency of something else in the tree?

18:01 mebaran151: jasonjckn: I think it might do some clever inlining

18:01 jasonjckn: mebaran151: i'd hope so, considering that's the only way to get 'strict evaluation'

18:02 mebaran151: on the other hand, I don't think JVM does that

18:02 brehaut: muhoo: yup

18:02 mebaran151: I think Hotspot's inliner might not be as tuned to spot monadic applications, as the pattern probably isn't all that common in Java

18:03 dnolen_: mebaran151: core.logic uses a monadic design - Hotspot does just fine.

18:03 brehaut: muhoo: my xml-rpc lib accidentally clamped its clojure dependancy to 1.2.1 - 1.3.0 and i didnt notice until i tried to upgrade to clojure 1.4 and it stuck on 1.3

18:04 mebaran151: dnolen_: oh interesting

18:04 jasonjckn: dnolen_: do you think clj-control implementation of monads would have all the bind/m->> functions calls inlined?

18:04 i guess the more general question, is if virtual function dispatch is inlined, i believe it is in some cases

18:04 i don't know the criteria

18:05 mebaran151: I just sometimes get warnings that algo.monads is only really an option if you're not concerned with performance

18:05 I think hotspot can do virtual function inlining actually; does a lot of speculative stuff you can't do in C++

18:06 Lexer: Suggest me a book on Clojure ?

18:06 dnolen_: Lexer: the new O'Reilly one

18:06 midrangio: do you guys think clojure will emerge as the champion of the alternative-jvm scaleable language battle

18:06 Lexer: What's its name ?

18:07 brehaut: lexer: http://clojurebook.com/

18:07 gfredericks: if there's one thing that history tells us, it's that every programming language battle always has a definite winner after some finite amount of time.

18:07 brehaut: gfredericks: and its always the least qualified competitor

18:07 gfredericks: with the catchiest name

18:07 dnolen_: midrangio: doubtful, but not sure whether that's relevant to its overall success.

18:08 gfredericks: clojure cannot win as it contains an uncommon consonant

18:08 dnolen_: midrangio: people seem to like Scala & Groovy - I have no idea why, but that's just me.

18:08 midrangio: dnolen_: just curious

18:08 raek: actually, the least common consonant phoneme of the English language

18:09 mebaran151: JVM is the new C runtime: there are plenty of scripting languages on the C runtime (ruby, python, perl), so I'm not sure there is necessarily going to need to be One Dynamic Language to Rule them All

18:09 gfredericks: scala has an ambiguous pronunciation disadvantage

18:09 you avoid talking about it so people don't judge you

18:09 yoklov: groovy seems to me like the least interesting one by a wide margin

18:09 mebaran151: Groovy always seemed like a poor man's JRuby to me, but I don't know too much about it

18:09 midrangio: i saw some comparison between scala and clojure and scala was basically crap concurrently

18:10 mebaran151: Scala to me feels like the C++ of Java

18:10 brehaut: feels to me like the c++ of haskell

18:11 mebaran151: well it's just that Java and C are relatively simple and C++ and Scala both add a lot of complexity atop those runtimes

18:11 midrangio: there is some doubt raised as to whether the actor model is sufficient for good concurrency

18:11 yoklov: java feels like the c++ of java

18:11 dnolen_: midrangio: Scala is like Dart. It tries to appeal to a style of mainstream programming I've completely lost interest in.

18:11 midrangio: yeah functional is getting huge

18:12 if it weren't for the barrier to entry i'd def place my bets on clojure

18:12 mye: weird, in the README for swank-clojure it says C-c C-l Load current buffer, but here it load the file from disk

18:12 dnolen_: midrangio: Clojure advantage is also it's disadvantage. What Scala & Dart offer are at least familiar to most people.

18:13 gfredericks: mye: yeah I just got used to saving before doing that

18:13 jasonjckn: Scala is so much more complex than Clojure

18:13 mye: so there is no eval buffer?

18:13 jasonjckn: so many 'features'

18:13 mebaran151: Scala has a fearsome type system

18:13 jasonjckn: but clearly it's more familiar to OOP people

18:14 mebaran151: I'm not sure if the project of melding functional programming and OOP is really a good idea

18:14 kaoD: gfredericks: scala is not ambiguous

18:14 it's S-CALL-AH

18:14 well, nope

18:14 dnolen_: mebaran151: Clojure also melds functional programming and OOP, just via a very different approach

18:14 kaoD: S-CAL-AH

18:14 SKULLAH

18:15 raek: mye: I usually use C-c C-k (after saving the buffer)

18:15 midrangio: i like rubys functional/oop mix

18:15 mebaran151: dnolen_: there might be objects but there really isn't an orientation toward them :)

18:15 mittchel: (for [x (range 20)

18:15 :when (divisible-by-three? x)]

18:15 x)

18:15 yoklov: ruby's functional aspects have always been lacking for me.

18:15 mittchel: how can I let it return a map?

18:16 kaoD: (zipmap (yourfor) (range 20))

18:16 jasonjckn: dnolen_: how would you describe clojure's take on OOP?

18:16 kaoD: (or the other way around, not sure what your wanted)

18:16 midrangio: IMHO is not that the actor model is good or bad for concurrence... is that the Scala implementation just sucks

18:16 there is a lot of overlapping between whan an object and an actor can do

18:16 and I always find myself puzzling around ity

18:17 gfredericks: kaoD: SKAY-luh

18:17 dnolen_: jasonjckn: rich abstractions at the bottom, all data structures built on them, simple interface to those data structures via functions

18:17 kaoD: also, agent approach is much more elegant imho (and doesn't collide with the notion of object)

18:17 midrangio: kaoD: i'm just going off some article i saw where the guy compared the barbershop problem's solution from the O'Reilly scala book and some hand-rolled clojure one

18:17 kaoD: gfredericks: no way! SKAY-luh is for gringos

18:17 gfredericks: sku-LAY then

18:17 yoklov: midrangio: the fact that ruby's blocks aren't objects, the whole proc/lambda nonsense, not to mention the fact that methods aren't functions, all always bugged me

18:18 kaoD: nope

18:18 that is for... weird people

18:18 SKULL-uh is classy, sounds good and actually means something in italian (stairway, which is the logo for Scala)

18:18 mittchel: kaoD: so: (zipmap(for [x :when (divisible-by-three? x)] x) (range 20))

18:18 cause it gives some errors lol ;D

18:18 jasonjckn: dnolen_: *nods* that's pretty sound, seems clojure uses objects to organize interfaces and data, not functions and data

18:19 dnolen_: jasonjckn: Clojure actually avoids the mess you traditionally encounter with FP ADTs

18:19 kaoD: midrangio: could you point to the article?

18:19 alex_baranosky: who knows which interface conj lives on

18:19 ivan: how does (ns your-namespace (:require clojure.test)) put the `is` macro into your-namespace?

18:19 jasonjckn: dnolen_: 'mess' ?

18:19 kaoD: mittchel: that's just the bare idea, try fixing the errors :P

18:19 dnolen_: jasonjckn: read the William Cook paper, Data Abstraction Revisited

18:19 jasonjckn: dnolen_: k thx

18:20 mittchel: I hate clojure error message

18:20 never find them clear, as a newbie.

18:20 kaoD: mittchel: you need to print the stack traces

18:20 to get something useful

18:20 midrangio: kaoD: http://www.bestinclass.dk/index.clj/2009/09/scala-vs-clojure-round-2-concurrency.html

18:20 kaoD: usually you get the top stack error which is the least useful one

18:20 ivan: never mind, the thing I mentioned does not happen

18:20 mittchel: nevermind

18:20 mebaran151: dnolen_: interesting paper, just searched it

18:20 midrangio: what's an idiomatic way in clojure to tell if an argument is a function

18:21 kaoD: midrangio: fn?

18:21 &(fn? sort)

18:21 lazybot: ⇒ true

18:21 kaoD: &(fn? 1)

18:21 lazybot: ⇒ false

18:21 midrangio: thx

18:21 mebaran151: midrangio: fn?

18:21 kaoD: midrangio: there are all sort of predicates for that kind of things

18:21 I always have clojure's quick reference open when I do clojure

18:22 PeregrinePDX: Yeah, having a good list of predicates has been valuable for my attempts at things.

18:22 kaoD: PeregrinePDX: specially for things that do stuff

18:22 yoklov: ,(fn? #{})

18:22 clojurebot: false

18:22 kaoD: &(fn? [])

18:22 lazybot: ⇒ false

18:22 yoklov: ,(#{:foo} :foo)

18:22 clojurebot: :foo

18:23 yoklov: you can also use ifn? if you want to test if something can be used as a function (e.g. a data structure)

18:23 kaoD: yoklov: it's not a function but implements the required interface to be called

18:23 right?

18:23 clojurebot: flatten |is| rarely the right answer. What if your "base type" is a list

18:23 yoklov: kaoD: yup

18:23 kaoD: clojurebot: the fuck?

18:23 yoklov: ,(ifn? #{})

18:23 clojurebot: fucking is not a polite word

18:23 true

18:24 kaoD: oh

18:24 mye: (:require clojure.contrib.java-utils) doesn't work: But it's written like that on http://clojuredocs.org/clojure_contrib/clojure.contrib.java-utils/file

18:24 kaoD: an evil idea just came to my mind

18:24 brehaut: ~contrib

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

18:24 kaoD: mye: clojure contrib is deprecated

18:24 brehaut: mye ^

18:24 mye: clojure.java.io/file

18:26 mye: brehaut, is that a separate dep in leiningen?

18:26 kaoD: nope

18:26 brehaut: mye: no its part of clojure 1.3+

18:26 kaoD: it's core

18:27 well, not core technically

18:27 mye: bc. just like that I cant get it to work (:require clojure.java.io/file)

18:27 kaoD: but it's in clojure

18:27 brehaut: (:require clojure.java.io) (clojure.java.io/file "…")

18:27 kaoD: or (:use clojure.java.io.file)

18:27 and then just file

18:27 nope?

18:27 mye: this is confusing :-|

18:28 brehaut: mye clojure.java.io is a namespace file is a function. you require namespaces, not functions

18:28 kaoD: no.

18:29 mye, kaoD: if you want to use it, it would be (:use [clojure.java.io :only [file]])

18:29 or with clojure 1.4+ (:require [clojure.java.io :refer [file]])

18:29 (i tihnk)

18:29 kaoD: brehaut: yep, you're right

18:29 brehaut: ,*clojure-version*

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

18:30 brehaut: ,(require '[clojure.java.io :refer [file]])

18:30 clojurebot: nil

18:30 brehaut: ,file

18:30 clojurebot: #<io$file clojure.java.io$file@f7c8d2>

18:30 kaoD: I always have to check ns' related in clojuredocs

18:30 and I mostly copy and paste it around my files which renders me unable to remember it :P

18:31 brehaut: mye: the NS import/use/require is a bit confusing when you start out. the difference between ns form and repl invocation doesnt help

18:31 hyPiRion: huh. Is (:require [clojure.java.io :refer (file)]) equivalent to (:use [clojure.java.io :only (file)]) ?

18:32 yoklov: wait, (:require [crap :refer [othercrap]]) is how its done now?

18:33 kaoD: ,(print "&(print \"I'm the last in the chain!\")")

18:33 clojurebot: &(print "I'm the last in the chain!")

18:33 lazybot: ⇒ I'm the last in the chain!nil

18:33 technomancy: hyPiRion: yeah, on 1.4+

18:34 clojurebot: what's the best programming language is <reply>http://www.qwantz.com/index.php?comic=1786

18:34 clojurebot: Alles klar

18:34 hyPiRion: technomancy: Is there any specific reason why this was added?

18:35 (If you know)

18:35 technomancy: hyPiRion: because the ns macro needs to be simplified; it's way too confusing

18:36 if :use becomes redundant, then all you have to think about is the difference between Clojure vars (:require) and Java classes (:import)

18:37 kaoD: technomancy: I found that confusing too when I started doing Clojure

18:37 but I'm sure there's a good reason to keep them separated

18:37 hyPiRion: Ah - good. So I suppose :use is going to be deprecated then.

18:38 technomancy: the require/import distinction is useful because vars and classes are very different things. the use/require distinction is unnecessary complexity.

18:39 mye: I like how in Rackets docs the required (require) form is spelled out explicitly

18:43 yoklov: mye: racket's require/provide are really quite complicated though

18:43 mye: oh, you mean in the documentation?

18:46 brehaut: mye: clojures namespaces and names are quite straight forward once you understand what the various names mean (and as technomancy said, you only need to know about require and import now). once you understand that you dont need docs explaining how to import

18:47 mye: brehaut, yeah I'm getting there. Now if I could get that new 1.4 dependecy to work. Looks like just jacking in again (which restarts the repl and asks to kill the running process) isn't enough

18:48 still says 1.3.0

18:48 brehaut: have you done a lein deps?

18:48 mye: y the jars there

18:48 yoklov: you might need a new jar?

18:48 brehaut: in where?

18:49 mye: lib/clojure-1.4.0.jar

18:49 brehaut: i have no idea if jack in starts a new swank server on the back end

18:49 or if it will reuse an existing one

18:49 i like to test this sort of thing out with a lein repl

18:49 because there are less parts

18:50 technomancy: jack-in restarts swank

18:50 also: running lein deps is never the answer

18:50 clojurebot: lein deps

18:50 clojurebot: http://github.com/technomancy/leiningen

18:51 technomancy: clojurebot: lein deps is the equivalent of taking the cartridge out and blowing on it

18:51 clojurebot: 'Sea, mhuise.

18:51 brehaut: technomancy: sorry i was out making a coconut radio on my new air strip.

18:52 technomancy: is lein deps just done automatically when the project changes anyway?

18:52 wkmanire: brehaut: That is the best excuse I've heard for anything so far this year.

18:52 technomancy: brehaut: yeah, basically you can't run any code that needs your dependencies without deps getting invoked

18:53 this has been true since (I believe) lein 1.4?

18:53 * brehaut hangs his head in shame

18:53 brehaut: ,(print "(dec brehaut)")

18:53 clojurebot: (dec brehaut)

18:53 lazybot: ⇒ 6

18:53 brehaut: thanks bots

18:53 hyPiRion: tsk.

18:54 technomancy: hehe; no worries, just watch out for others spreading that notion and stop them =)

18:54 brehaut: yessir

18:55 mye: restarted emacs, still (clojure-version) -> "1.3.0" :'( [org.clojure/clojure "1.4.0"] is in project.clj

18:55 brehaut: technomancy: does the same apply to lein clean ?

18:55 hyPiRion: mye: Have you tried turning it on and off again? :^)

18:55 brehaut: mye: what other deps do you have? one of them could have clamped you on 1.3

18:56 PeregrinePDX: Does swank process the project.clj?

18:56 brehaut: i know for a fact that the idiot who wrote necessary-evil made that mistake

18:56 technomancy: brehaut: if you switch profiles, there are still cases where you need an explicit clean right now

18:56 brehaut: technomancy: ok thanks

18:56 technomancy: but it's a flaw in Leiningen; if lein did the right thing it wouldn't be necessary

18:57 but it's a bug

18:57 oops

18:57 https://github.com/technomancy/leiningen/issues/468

19:00 brehaut: technomancy: theres a command that spits out the deps tree now isnt there?

19:01 mye: hyPiRion, rebooting would probably help as windows won't even let me delete the 1.3 jar (used by ..??) ;-)

19:02 technomancy: brehaut: `lein deps :tree`

19:02 brehaut: I probably would have removed the deps task if it weren't for that

19:02 PeregrinePDX: But running lein deps is never the answer.

19:03 brehaut: lol

19:03 technomancy: ah, I should have been clearer: running `lein deps`

19:03 partial application doesn't count! =)

19:04 brehaut: need more point free lein commands

19:04 technomancy: brehaut: actually I was just thinking about this

19:04 brehaut: mye: run that command and have a look at the deps it spits out

19:04 technomancy: yeah? what would it return?

19:04 technomancy: right now you chain leiningen tasks with commas, and it's hard-coded in the leiningen.core.main namespace

19:04 brehaut: oh right

19:04 technomancy: but that sucks because it doesn't compose with higher-order tasks

19:04 brehaut: yeah

19:05 technomancy: so `lein with-profile production jar, run` will have the run task not use the production profile

19:05 but if chaining were lifted into another higher-order task, it would be easy to make it work with profiles, right?

19:05 brehaut: yeah it would

19:05 technomancy: so `lein with-profile production do jar, run`

19:05 it would just break a lot of stuff

19:05 but the design is much better

19:06 * technomancy notes that he probably needs monads

19:06 brehaut: awesome enough to introduce before 2.0 goes final?

19:06 technomancy: I think so

19:06 brehaut: the M word had also entered my mind

19:06 technomancy: maybe with a graceful degradation period with preview5 where both approaches work

19:07 brehaut: have it spit a warning when it detects complicated command lines?

19:07 bhenry: what's the trick to make this less crazy (.-property (.-property (.-property object)))

19:07 technomancy: or just any time there's a comma and the first task isn't "do"

19:08 do is a monad, right?

19:08 brehaut: technomancy: yeah, i think it could be the identity monad with bind discarding arguments

19:08 (ie, a let where every LHS of the binding is _)

19:09 ibdknox: bhenry: (.-property.property.property foo)

19:09 technomancy: oh, of course

19:09 bhenry: ibdknox: thanks

19:14 brehaut: technomancy: if it is just the identity monad, then its perhaps a bit redundant to use a monad

19:14 at least in clj where we get no type level enforcement that things are sane

19:15 technomancy: oh yeah, I probably won't implement it as a monad

19:16 but that doesn't mean I can't use the jargon

19:16 brehaut: oh for sure

19:17 not least because employing monads does limit the future contributions anywhere they are visible

19:18 technomancy: not something you want to do when your tag line is "doesn't set your hair on fire"

19:19 brehaut: haha yes

19:20 im pretty convinced that the biggest advantage of monads in clojure is prototyping ideas for things that you might want to sprinkle some macro sugar over

19:28 hiredman: ~ping

19:28 clojurebot: PONG!

19:28 hiredman: clojurebot: <3

19:28 clojurebot:

19:28 gtrak: clojurebot:☠

19:28 clojurebot: Titim gan éirí ort.

19:45 mrakana: Anybody here have experience with the seesaw library? I can't for the life of me figure out how to "fill" a panel or "stretch" and element to "fit" its parent.

19:47 eighty: i have a java class Foo with a static variable bar. I can access it like this: (def x (Foo/bar)) no problem. but how can i construct Foo/bar from a string "Foo" and "bar"?

19:48 brehaut: ,(symbol "Foo" "bar")

19:48 clojurebot: Foo/bar

19:48 brehaut: but i dont know ifthats what you are actually asking

19:49 eighty: brehaut: holy cow dude, this might be it. checking...

19:49 hyPiRion: ,(doc symbol)

19:49 clojurebot: "([name] [ns name]); Returns a Symbol with the given namespace and name."

19:50 brehaut: eighty: im pretty sure its not

19:51 eighty: brehaut: (load-string "Foo" "bar")

19:51 BOOM!

19:51 mebaran151: eighty: you'll probably have to reflect it (.getDeclaredField klass sname)

19:52 eighty: mebaran151: oh nice! trying...

19:52 mebaran151: if klass is a string, (Class/forName klassstr) is your friend too (though it might have to be fully qualified)

19:54 hyPiRion: The classname has to be the whole name though.

19:56 For instance won't ##(.getDeclaredField (Class/forName "Math") "PI") work, because its real name is java.lang.Math.

19:56 lazybot: java.lang.ClassNotFoundException: Math

19:56 mebaran151: &(-> (Class/forName "java.lang.Integer") (.getDeclaredField "MAX_VALUE") (.get (Class/forName "java.lang.Integer"))

19:56 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

19:57 mebaran151: &(.get (.getDeclaredField (Class/forName "java.lang.Integer") "MAX_VALUE") (Class/forName "java.lang.Integer"))

19:57 lazybot: java.lang.SecurityException: You tripped the alarm! package java.lang.reflect, Java Platform API Specification, version 1.6 is bad!

19:58 hyPiRion: heh.

20:02 mebaran151: I wonder how the reader does it, with just Foo...

20:10 powrtoc: I'm looking for a good clojure parser library... can anyone recommend one that works with clojure 1.3/1.4?

20:25 gfredericks: mebaran151: the reader returns a symbol

20:25 the compiler or something turns the symbol into a class based on the ns imports and such

20:25 &(-> "Foo" read-string type)

20:25 lazybot: ⇒ clojure.lang.Symbol

20:38 mebaran151: gfredericks: I'

20:39 gfredericks: I'm just wondering how the compiler turns the symbol into a the qualified class (i.e. how it applies imports to Class/forName logic

20:50 gfredericks: well I imagine when you say (:import foo.bar.Baz) the compiler notes that "Baz" means "foo.bar.Baz"

20:52 hyPiRion: yeah.

20:52 And usual java.lang is already "imported": ##(Math/pow 3 4)

20:52 lazybot: ⇒ 81.0

22:05 TimMc: ,(.importClass *ns* 'Math java.lang.Math)

22:05 clojurebot: java.lang.Math

22:05 TimMc: ,(.importClass *ns* 'M java.lang.Math)

22:05 clojurebot: java.lang.Math

22:05 TimMc: ,(M/abs -4)

22:05 clojurebot: 4

22:06 brehaut: (inc TimMc )

22:06 lazybot: ⇒ 1

22:06 tmciver: TimMc: hey, that looks like the renaming feature you were trying to implement before.

22:07 TimMc: tmciver: hey, that looks like #'rename from org.baznex/imports :-P

22:08 tmciver: Is that new in 1.4?

22:10 TimMc: Yep, according to the changelog.

22:11 I haven't done much Java interop recently, so I haven't needed to scratch the import itch very much...

22:23 kaoD: is there any sane way to run clojure code sandboxed without using clojail?

22:23 in other words: I want to run Clojure code using a sandboxed classloader

22:23 and I want it to be easier that Clojail (or I'd be better using Clojail)

22:23 (which I'm not reluctant to do, just checking)

22:25 TimMc: What's onerous about using Clojail? I haven't used it, so I'm curious.

22:27 kaoD: TimMc: what do you mean onerous?

22:28 TimMc: difficult, burdensome, hard

22:29 not easy

22:29 22:22 < kaoD> and I want it to be easier that Clojail

22:29 kaoD: it's not that it's hard

22:30 I'm just accustomed to Java's sandboxing capabilities

22:33 also, TimMc, only blacklist

22:33 I'd prefer whitelisting

22:34 since I'm developing a very restricted plugin system

22:34 (I just want math and not much more)

22:37 TimMc: Hmm, interesting. I think you could write your own sandboxer for Clojail.

22:38 err, whitelister

22:40 kaoD: that's what I wanted to check, if it could be easier doing my own hackish solution

22:40 or just hacking into Clojail myself

22:40 (or keeping with blacklist and just cross my fingers)

23:01 ivan: oh man, (require 'useful.io_test) works and then (useful.io_test/test-whatever) fails, frickin' underscores

23:02 TimMc: huh

23:03 ivan: the namespace is useful.io-test

23:03 TimMc: But the require appears to succeed?

23:03 ivan: yep

23:03 TimMc: What happens if you do (ns-publics (the-ns 'useful.io_test)) after the first require in a clean REPL?

23:04 ivan: user=> (ns-publics (the-ns 'useful.io_test))

23:04 Exception No namespace: useful.io_test found clojure.core/the-ns (core.clj:3691)

23:19 TimMc: ,(require 'clojure.core_deftype)

23:19 clojurebot: nil

23:19 TimMc: Interesting.

23:19 ,(require 'clojure.core-deftype)

23:19 clojurebot: nil

23:19 TimMc: ,(require 'blah.foo)

23:19 clojurebot: #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate blah/foo__init.class or blah/foo.clj on classpath: >

23:19 TimMc: ,(require 'clojure.blah)

23:19 clojurebot: #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/blah__init.class or clojure/blah.clj on classpath: >

23:19 TimMc: I got nothin'.

23:24 tmciver: TimMc: require must do a "-" to "_" conversion; in the first case it's not necessary?

23:24 PeregrinePDX: Hello trptcolin.

23:24 trptcolin: PeregrinePDX: howdy

23:36 kaoD: http://theoatmeal.com/comics/tesla <- made me laugh

23:39 jasonjckn: kaoD: how factual is it?

23:39 TimMc: tmciver: Mmm, and then it doesn't match the ns clause.

23:39 kaoD: jasonjckn: not sure about it all but there are MANY things that are right

23:39 I'm not a Tesla expert but hey, he was actually awesome

23:40 jasonjckn: kaoD: *nods* he doesn't get enough credit

Logging service provided by n01se.net