#clojure logs

2012-05-14

00:00ForSparePartsoh
00:00ForSparePartsum
00:00technomancyclojure-mode is a piece of elisp code, swank is a piece of Clojure code
00:00ForSparePartsmy bad, I meant what I said the first time
00:00ForSparePartsDo I have to install swank separately?
00:00ForSparePartsFor some reason I thought it came with clojure-mode.
00:00zcaudateclojurebot: yeah... bultitude works really well
00:00clojurebothttp://haacked.com/images/haacked_com/WindowsLiveWriter/IConfigMapPathIsInaccessibleDueToItsProt_1446B/works-on-my-machine-starburst.png
00:01technomancyForSpareParts: I have a lot of sympathy because it's crazy confusing and there are lots of horrible misleading docs out there
00:01amalloyzcaudate: you're not going to get a lot of unique dialog from a bot
00:01technomancyamalloy: hush, it's more fun when they realize it on their own
00:02technomancyForSpareParts: you want `lein plugin install [...]` as per the swank-clojure readme
00:02zcaudateDamn it
00:03zcaudateI just looked back at the conversation
00:03zcaudatetechnomancy: ...
00:04technomancyzcaudate: bots can be surprisingly lifelike
00:04zcaudateI'm impressed... its my second time on irc
00:05zcaudatevery cool
00:05technomancythe bots in #emacs fool people on a regular basis
00:06zcaudateare they all named *bot?
00:06technomancyyeah =)
00:06brehautnah, some of them are named rms
00:06zcaudatecould I call myself fyoubot and start insuling people?
00:07ForSparePartstechnomancy, 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...
00:07zcaudateand pretend that I wasn't human?
00:07metelluszcaudate: why would they tolerate a bot that did nothing but insult people?
00:08zcaudatemetellus: just a hypothetical.... back to work =)
00:08amalloyheh. i just tried /nick jerkbot, but that's taken :(
00:08cgagi would tolerate an insultbot
00:09zcaudatemore fun pretending to be one ])
00:09technomancyForSpareParts: I have heard of that problem on Windows before, but I don't know enough about Windows to know what could be causing it
00:10ForSparePartsalright
00:10ForSparePartsCould I do it through cygwin, maybe? And if I did, would I be able to get at from Win32 Emacs?
00:10technomancythat should work
00:11ForSparePartsdo you know how I can add something to my path in cygwin?
00:12technomancytraditionally you add something like this to ~/.profile: export PATH=$HOME/bin:$PATH
00:13ForSparePartsoh, cool -- so then it'll be equivalent to my Windows path?
00:13technomancyI don't know
00:15cgagif i have a repl i opened via lein repl
00:15cgagand i change a function and save it
00:15cgagcan i somehow access it
00:15cgagwithout exiting the repl and starting it again?
00:16metellus(require 'whatevernamespace :reload)
00:18zcaudatetechnomancy: 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?
00:19cgaggreat, thanks metellus
00:44eightyquick 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
00:45ForSparePartsIT WORKS, IT FUCKING WORKS
00:45ForSparePartsthank you God, thank you technomancy
00:46ForSparePartsseriously, thanks, though, for getting me on the right track.
00:48zcaudate(use 'clojure.reflect)
00:48zcaudate(defn all-methods [x]
00:48zcaudate (->> x reflect
00:48zcaudate :members
00:48zcaudate (filter :return-type)
00:48zcaudate (map :name)
00:48zcaudate sort
00:48zcaudate (map #(str "." %) )
00:48zcaudate distinct
00:48zcaudate println))
00:48zcaudate(all-methods 9)
00:48zcaudate(.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)
00:49brehautzcaudate: refheap.com, gist.github.com, etc etc. take your pick
00:52zcaudateokay
00:53zcaudateits more that i want it as aprt of my repl setup
00:53zcaudate*part
00:54PeregrinePDXLol this is why when I pm with you brehaut I just smash my entire defn on one line.
00:54brehautit doesnt matter what you want it for, its poor IRC etiquette to flood a channel with a pile of source code etc
00:54brehautlol
00:54zcaudate:brehaut sorry.. newbie here....
00:55brehautzcaudate: thats why im tell you, rather than yelling at you
00:55PeregrinePDXgist is kind of a cool idea.
00:56zcaudate=) but is there anyway to customise the default repl to load libraries and scripts the same way that emacs loads
00:57zcaudateso if I type lein repl, then it comes with all the methods i want it to have
00:58zcaudatethe default repl's a little bit same
00:58zcaudatereply's much better... but there still stuff that i feel is missing... i'm really used to ipython
00:59zcaudatewhich shows pictures
00:59zcaudateand a bunch of other stuff
01:00PeregrinePDXI imagine although I am a newbie but from a quick perusal of the lein documentation you could probably do it with a plugin
01:01PeregrinePDXthere is quite possibly a better way to do it then that though
01:04brehauti suspect PeregrinePDX is right.
01:04brehautsome stuff like graphical views etc are available via nREPL
01:08PeregrinePDXIt would be somewhat interesting to make an .repl_profile that would be processed when a repl is started.
01:08zcaudateits 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...
01:08PeregrinePDXSo people could add automatically their own things they want to do everytime they start a repl.
01:09zcaudateI've read somewhere that there is a user.clj file
01:09zcaudatethat loads
01:09zcaudatebut not too sure where it goes
01:10zcaudateand because I'm using cljr... i'm really not sure where it geos
01:10zcaudategoes*
01:10zcaudate:PeregrinePDX that'll be great
01:12PeregrinePDXWell with that hint http://stackoverflow.com/questions/8737452/user-clj-and-init-clj-dont-work
01:12PeregrinePDXSo apparently it already exists or did exist
01:14zcaudatenope... doesn't wark for me
01:17PeregrinePDX.lein/init.clj
01:17PeregrinePDXWell ~/.lein/init.clj
01:17PeregrinePDXNow everytime a repl starts it says hello world t ome
01:18PeregrinePDXActually everytime lein is run it says hello world to me.
01:18PeregrinePDXSo not quite what you want but maybe should work.
01:20zcaudateyeah.. it does load =) but I can't use any libraries like clojure.reflect or define any custom methods that i want
01:20echo-areaamalloy: 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.
01:20PeregrinePDXWhy can't you use any libraries like clojure.reflect?
01:20zcaudateI'm not too sure
01:21zcaudateI have a file in .lein/init.clj that says (use 'clojure.reflect)
01:21zcaudateand it gives me an exception when lein loads up
01:21TEttingerok, 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
01:23TEttinger(I am amazed how far I got without explicit assignment, just library calls doing it for me...)
01:24TEttingerone line I have:
01:24TEttinger,(defn rename-button[btn txtref txt2] (dosync (ref-set txtref (str @txtref txt2))(config! btn :text @txtref)))
01:24clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
01:25TEttingerI THINK I am passing a ref to this as its second arg
01:26TEttingerI have declared refs, I think the correct way, with
01:26TEttinger(def control (ref (str "<html>" "Control" "<br>")))
01:26TEttingerand I pass that as an argument with control , and get its value with @control ... right?
01:27PeregrinePDXzcaudate, uh I dunno. I'm at the end of my limited clojure knowledge
01:27zcaudatehahaha =) same here
01:28zcaudateoh well!
01:29zcaudateback to the good old cut and paste method =)
02:08michaelr525hello
02:11PeregrinePDXOk so I just hacked a .reply_profile into reply.... (use 'clojure.reflect) seems to work
02:11TEttingeruh, is there a protocol for asking a question again? I don't want to bother the group twice
02:13ivanTEttinger: @thing is (deref thing)
02:13ivan(func @thing) would pass the value itself to func
02:13TEttingerso how do I pass thing?
02:14TEttingerit doesn't seem to be able to change the value when I pass the ref
02:15ivanI dunno, but feel free to pastebin code and ask again
02:43TEttingerivan, pastebin here http://pastebin.com/k6Cvs2cE
02:43TEttingerthe code is really bad, but i will ask anyway...
02:43TEttingerI 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
02:45TEttingerat 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
02:48ivanwhat part of rename-button isn't working?
02:49TEttingerwell it isn't renaming
02:49TEttingerI think it has something to do with my poor understanding of dosync
02:49TEttingeror refs in general
02:52ivanI'm a noob but I don't see anything obviously wrong with the refs
02:52ivanI would try adding some more debug logging
02:52TEttingerright, good idea
02:52ivandoes some Swing thing have to be called to refresh after you config!?
02:53TEttingerthat... could be it? I thought seesaw handled a lot of that... but only when I call seesaw functions...
02:54TEttingernah, I call config!
02:54TEttingerthat apparently repaints and updates
02:56ivan(config! btn :text @txtref) <- maybe @txtref reads the old value here
02:59ivannope. "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."
03:22PeregrinePDXargh
03:45TEttingeryay, it works -- thanks ivan
03:45TEttingerproblem was I was using a ref instead of a string when I created a keyword
03:45TEttingerso when I tried to use a selector to get the widget with that keyword for an :id ...
03:46TEttingerit returned nil, and all those rename-button calls were renaming nil and not showing it
03:51robertstuttafordanyone 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
03:51RaynesConsidering that came out about 30 seconds ago, probably not. :p
03:51robertstuttafordi use it for html/js/css and it rocks
03:52robertstuttaford-grin- one can hope
03:52aperiodicif 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?
03:53aperiodiccan i do that with a defrecord?
03:53PeregrinePDXSomeone was talking the other night about a iphone clojure api app
03:56PeregrinePDXAhh it was mudphone
03:56mudphonePeregrinePDX: yep
04:01robertstuttaforddash is nice. global shortcut launches search window, and search is lightning fast
04:01robertstuttafordfaster'n (doc whatsit) in the repl
04:03aperiodicnot as fast as `,s`, though
04:03aperiodicyou'll pry slimv from my cold, dead fingers
04:05robertstuttafordyou text moders are in a world all on your own
04:14robertstuttaforda 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?
04:15neotykhello everyone
04:17neotykrobertstuttaford: there have been few of those, have you seen https://vimeo.com/25190186 ?
04:18robertstuttafordawesome, thanks!
04:20neotyknp
04:20neotykrobertstuttaford: are you familiar with emacs?
04:21robertstuttafordnot even slightly.
04:21robertstuttafordusing eclipse and ccw right now but i'm hating having to use the mouse so much
04:22neotykrobertstuttaford: if not I highly recommend starting from 'C-h t'
04:22robertstuttafordtutorial mode? :)
04:23neotykthis won't take long but you will get you familiar with emacs
04:23robertstuttafordawesome, thanks
04:23mudphonerobertstuttaford: I'm about to do a basic Clojure/Emacs/Lein/Slime-Swank tutorial for a local meetup… do you have a wishlist?
04:23robertstuttafordbasically, how to get setup, and why each emacs thing you do is important
04:24robertstuttafordso, slime-swank. i guess this is some sort of repl <=> buffer sync tool?
04:24neotykrobertstuttaford: use emacs 24 and new emacs-starter-kit
04:24robertstuttafordkeyboard shortcuts that you regularly use in the process of clojuring
04:24neotykrobertstuttaford: than you can clojure-jack-in with ease
04:25vijaykiranrobertstuttaford: there are some commands listed here: https://github.com/technomancy/swank-clojure
04:25robertstuttafordstarter-kit looks good!
04:25neotykrobertstuttaford: also paredit-mode is mighty awesome
04:26robertstuttafordi'm using paredit in ccw and it's quite good
04:26robertstuttafordso you guys are doing 100% in emacs? driving lein, repl, git?
04:26vijaykiranyup
04:26neotykyep
04:27neotyk+ erc
04:27vijaykiranclojure-jack-in + ricirc + magit + swank/slime
04:27neotykI only leave emacs for browser, mail and shell
04:27mudphonerobertstuttaford: are you on a mac?
04:27robertstuttafordyup
04:29neotykhi mittchel, thing you posted yesterday about sqrt, it looked like you've been working recursively without recur
04:29mudphonerobertstuttaford: 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
04:29robertstuttafordok so emacs 24, emacs-starter-kit, clojure-jack-in to begin with
04:30robertstuttafordwicked, thank you!
04:30robertstuttafordi'll beta test for you
04:30mudphoneI'm not using emacs-starter-kit in this workshop… as I wanted it to be super simple
04:30mittchelneotyk: I noticed yep haha, brehaut actually helped me out with a better version
04:30mudphoneI'll probably add that in later
04:30mudphoneas well as other helpful emacs modes
04:30robertstuttaforda question on the shortcuts - C-(…) is ctrl-something, M-(…) is meta, or cmd-something?
04:31vijaykiranM- = Alt -
04:31neotykmittchel: cool
04:31mudphoneoh, and it's not using Emacs 24
04:31mudphoneit's using 23.4
04:31mudphoneso, that
04:31robertstuttafordok so ctrl and alt, no cmd
04:31robertstuttafordshould i try with 24?
04:31neotykS- is command
04:31calvadosis there a value returning version of doc macro ?
04:32robertstuttafordthanks
04:32vijaykiranrobertstuttaford: yes, by default ctrl, alt you can map what you want the keys mean in keyboard settings on mac
04:32neotykvijaykiran: aer you coming to euroclojure?
04:32robertstuttafordi use a ms erg 4k, so i've swapped alt and cmd already
04:32vijaykiranneotyk: yup :)
04:33vijaykiranrobertstuttaford: I got my Caps as Ctrl
04:33neotykvijaykiran: cool :)
04:33vijaykiranneotyk: you're doing a presentation thre right ?
04:33robertstuttafordme too, but i forget to use it :)
04:34mittchelGuys, what sthe answer to this one: (= (list __) '(:a :b :c))
04:34neotykvijaykiran: yeah! 10 minute demo of http.async.client
04:34mittchelcan't seem to figure it out
04:34vijaykiranneotyk: cool :)
04:34robertstuttafordmudphone: thanks for this. i'll have at it and i'll let you know how it goes
04:34vijaykiranneotyk: may be I'll show my crappy clojure code of gitwit.net there to you ;)
04:34mudphonerobertstuttaford: you're welcome! Thanks for testing.
04:35neotykmittchel: is it core.logic?
04:35mittchelNot sure I'm trying to learn via 4clojure
04:35neotykmittchel: :a :b :c
04:35mittchelI tried that lol
04:36mittchelhuh
04:36mittchelit works
04:36mittchelmaybe I mistyped :S
04:36robertstuttaford,(= (list :a :b :c) '(:a :b :c))
04:36clojurebottrue
04:36mittchelI think I mistyped lol:D
04:36mittchelcan you use clojurebot in a PM?
04:36robertstuttafordyes
04:36robertstuttafordit's called a repl
04:36mittchelSo I won't spam you guys with all the stuff haha
04:37neotykvijaykiran: gitwit.net? never heard of it
04:38vijaykiranneotyk: just started on it http://gitwit.net - Clojure/jGit/ElasticSearch project
04:38lucianmittchel: you can also use the website tryclj
04:39neotykvijaykiran: http://gitwit.net/search?q=http.async.client
04:39ivan`TEttinger: cool, glad you figured it out
04:39vijaykiranneotyk: :) this is just 0.0.1-SNAPSHOT - I need to add more repos and cap-out my VPS
04:40neotykvijaykiran: can I add repo to index?
04:40robertstuttafordmudphone: "install the latest clojure for mac osx (v23.4)" i think you mean emacs, here
04:40vijaykiranneotyk: yeah, from 0.0.2 :)
04:40mudphonerobertstuttaford: thanks!
04:40vijaykiranneotyk: right now I'm only indexing wiki pages
04:40mittchellucian: thanks
04:40robertstuttaforddoes this work with lein2? i'd love to use that if possible
04:41vijaykiranneotyk: still need to figure out a lot of jGit API on how to walk through git repos
04:41mudphonerobertstuttaford: sorry, it's not using that yet… but, I don't see why not
04:41mudphoneof course, I haven't used Lein 2 yet
04:41neotykvijaykiran: cool :-)
04:42robertstuttafordas a newbie i have no backwards compatibility to maintain so i'd like to start with clojure 1.4 and lein 2
04:42mudphonemakes sense
04:43mittchel(= __ (conj '(2 3 4) 1)) shouldn't this be 1 2 3 4, since 1 will be placed in front?
04:44robertstuttafordmudphone: 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
04:44mudphonein Paredit?
04:44N8DawgHi, I'm looking through the reasoned schemer and come across the A . B syntax, any idea what the analogue is in clojure?
04:44robertstuttafordright now i'm spending so much time just tapdancing up and down lines to select stuff and cut and paste
04:45robertstuttafordi guess, if that's where the action is
04:45mudphoneoh, you mean to copy and paste and stuff?
04:45mudphonesome of that (the navigation, selection, and delete) is covered in this presentation on Paredit: http://www.slideshare.net/mudphone/paredit-preso
04:45mudphoneI put that together a couple years ago
04:45robertstuttafordok great thanks
04:45amalloyN8Dawg: 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
04:46mudphonetime flies...
04:46cataska_mittchel: "conj" behaves differently for list and vector
04:46mittchelWhat does it do different?
04:47robertstuttafordby 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?
04:47mittchelGot it now:P
04:47N8Dawgamalloy: it was in the context of cons
04:48amalloyheh. in scheme, everything is in the context of cons
04:48mudphonerobertstuttaford: you should be able to open up a buffer with a clj file and it should be ready to go
04:48robertstuttafordkickass
04:48mudphonebut, you have to: M-x clojure-jack-in
04:48mudphonethat starts a buffer with the repl running
04:48mudphoneand then you'll be in the "user" namespace
04:49amalloyanyway, in other lisps, a cons cell is just a pair of two things, A and B, written as (A . B)
04:49mudphoneso, you can "use" your ns or switch to it (in-ns)
04:49mudphoneor require it
04:49robertstuttafordawesome
04:49amalloymost often, cons cells are used to represent lists, so B is either another cons cell or nil
04:50amalloyso (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)
04:50mudphonerobertstuttaford: this may not be the best way to do it, but I tried to make it the fastest way to get started
04:50mudphonewhile still using tools that I think are relevant
04:51N8Dawgamolloy: got it, thank you! Hence lists are not lazy like in Clojure
04:53notNicolashttp://www.4clojure.com/problem/22
04:53notNicolasCan somebody give me a hint for this? I'm stumped
04:53robertstuttafordthanks mudphone. i'm going to give it a go
04:53mittchelStill 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 ?
04:54mittchelpff smileys
04:54mudphonerobertstuttaford: you're welcome. enjoy!
04:54notNicolasmittchel: sets are by definition a collection of distinct elements
04:55mittchelBut why doesn't it give it in the right order then?
04:55notNicolasoh, good point.
04:56aperiodicorder is not defined for sets, though i believe it is safe to assume it is consistent
04:56notNicolasseems like there is a "sorted-set" made especially for this issue
04:56aperiodicyes
04:57mittchelaperiodic: 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?
04:59aperiodicmittchel: sets in clojure follow the mathematical definition of "an unordered collection of things"; if you want a reliable ordering, use a sorted-set
05:00mittchelYep but I need to now the order to complete this one: (= #{1 2 3 4} (conj #{1 4 3} __))
05:00aperiodicoh, really? that is surprising to me
05:00aperiodicoh, no
05:01notNicolasare you sure sets are not considered equivalent if their order is different?
05:01aperiodicequality for sets does not depend on ordering
05:01aperiodichave you tried 2?
05:01notNicolasI'm still totally stumped for http://www.4clojure.com/problem/22 :p
05:02mittchelaperiodic: 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
05:02mittchel1 2 3 4 == 1 4 3 2
05:02aperiodicmittchel: it's not a list, it's a set!
05:02mittcheloh sorry ye you're right
05:03aperiodicequality of lists does take into account order ##(= '(1 2 3) '(3 2 1))
05:03lazybot⇒ false
05:06notNicolaswadafa
05:07notNicolaswhy is this so difficult
05:08robertstuttafordnotNicolas: (fn cc [ll] (if (= (first ll) nil) 0 (+ 1 (cc (rest ll)))))
05:08robertstuttafordbasic recursion with first and rest
05:09mittchel##(= '(1 2 3) '(3 2 1))
05:09lazybot⇒ false
05:09mittchel##(= '(1 2 3) '(1 2 3))
05:09lazybot⇒ true
05:09mittchelWhat does that ' sign do
05:09notNicolashmm
05:09robertstuttafordthe pros in here can probably halve that code
05:11robertstuttafordshorter: (fn cc [ll] (if-not (first ll) 0 (+ 1 (cc (rest ll)))))
05:13aperiodicmittchel: that is the quote. it prevents evaluation. otherwise, the list would be evaluated as if 1 were a function, which would cause an error
05:13aperiodic,(= (1 2 3) (list 1 2 3))
05:13clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
05:14aperiodic,(= '(1 2 3) (list 1 2 3))
05:14clojurebottrue
05:14robertstuttafordnotNicolas: see how it works?
05:15notNicolashmm yep
05:16aperiodicnotNicolas: 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
05:16notNicolasconsume all the things
05:17mittchelahh
05:17mittchelcool
05:18PeregrinePDXI did number 22 by mapping all of the items to 1 and then summed the sequence.
05:19aperiodicheh, cool
05:20robertstuttafordnice PeregrinePDX
05:21PeregrinePDXThere are shorter and probably much more efficient solutions.
05:23robertstuttafordif there weren't, lisp would suck
05:24PeregrinePDX#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.
05:26calvados(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]
05:32brehautcalvados: what are you actually wanting to do?
05:32brehautcalvados: just get the doc string?
05:32calvadosyep kinda web service want to return it as json "doc" output
05:32brehaut(with-out-str (doc name)) ?
05:33brehautdoc returns nil
05:34brehauthowever, doc is a macro, not a function
05:34brehautso it might not do what you expect
05:35calvadoshm i just want to make a function and return (doc "function parameter") result
05:35brehautit may be that something like ##(-> #'name meta :doc) is what you are really after
05:35lazybot⇒ "Returns the name String of a string, symbol or keyword."
05:36brehautthat doesnt fish out arglists or when it was added, but thats not really that much extra work
05:36calvadosi guess i will keep on reading the book, its not going fast enough
05:40brehautwell all the relevant information is on the meta data of the symbol
05:41brehaut(not on the function itself)
05:41brehautand s/symbol/var/
05:42calvadoshm
05:42brehaut,(map meta [name #'name])
05:42clojurebot(nil {:ns #<Namespace clojure.core>, :name name, :arglists ([x]), :added "1.0", :static true, ...})
05:43brehaut#'name is short hand for (var name) btw
05:43brehaut,'#'name
05:43clojurebot(var name)
05:43brehautor if thats confusing ##(read-string "#'name")
05:43lazybot⇒ (var name)
05:54notNicolas(fn foo[x] ( if (= empty x) empty (concat [last x] (foo(butlast x)))))
05:54notNicolasI don't understand how this creates a stack overflow error
05:54notNicolasit's supposed to reverse x
05:56notNicolasthis language is kind of frustratingly hard to debug
05:58PeregrinePDXLol, I'm a little nervous. Just submitted my first pull request for a clojure project.
05:59fliebelnotNicolas: I suppose you know there are just reverse and rseq functions?
06:00notNicolasthose are banned from the exercise
06:00PeregrinePDXHe's doing 4clojure problems.
06:00fliebelah
06:01lucianyeah, debugging in 4clojure sucks
06:02notNicolashttp://ideone.com/vR51b the algorithm is sound
06:03fliebelnotNicolas: what is empty? And what is [first x]?
06:03fliebelerm last
06:04fliebelnotNicolas: 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.
06:04RaynesThat code doesn't even make sense.
06:05notNicolasthat's because this language doesn't make sense
06:05RaynesHow so?
06:06RaynesNot like Python and not making sense are two very different things.
06:06RaynesA book/tutorial might be helpful. I don't recommend trying to learn off of 4clojure exclusively.
06:07Rayneshttp://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.
06:07RaynesIn any case, I hope you change your mind.
06:10PeregrinePDXThat write your own reverse function took me quite awhile to figure out.
06:11mittchelHow can you check if a list is empty?
06:11mittchelempty?
06:11clojurebotempty is amalloy: therfor I return [previous] if rest
06:11fliebelyea
06:11fliebel(doc empty?)
06:11clojurebot"([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"
07:38_KY_How to "concat" 2 vectors to give a result as vector?
07:39_KY_Is it non-idiomatic to do so?
07:39_KY_*unidiomatic
07:45vijaykiran, (vec (concat ["a", "b", "c"] [1, 2, 3]))
07:46clojurebot["a" "b" "c" 1 2 ...]
07:46_KY_Thanks... but it's indeed unidiomatic..
07:46_KY_I fd that what I need is really set union
07:46_KY_*found
07:46_KY_But thanks =)
08:01si14hey, guys. is there any example of big cljs project to try it?
08:06Bronsa_KY_ ##(into [1 2 3] [4 5 6])
08:06lazybot⇒ [1 2 3 4 5 6]
08:07_KY_That's nice to know...
08:46neotyksi14: have you seen twitter sample that is distributed with cljs?
09:06twhumeI 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?
09:17robertstuttafordminifying html. can enlive do this or is there some other fancy gadget?
09:18vijaykiranI don't think enlive does that - but why do you want to minify html ?
09:22robertstuttafordi guess it's just removing whitespace :)
09:37kaoDsup
09:41robertstuttafordinflation
09:41robertstuttafordthis looks pretty cool: https://github.com/tnr-global/bishop
09:45robertstuttafordwhy use :gen-class ?
09:45robertstuttafordi see it in the bishop source.
09:47mduerksendoes 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
09:47mdeboardmduerksen: yes
09:48mduerksenmdeboard: how would i express it then?
09:49mdeboardmduerksen: I don't know :(
09:50mduerksenbecause 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)
09:50vijaykiranrobertstuttaford: which file ?
09:51robertstuttafordvijaykiran: https://github.com/tnr-global/bishop-sample/blob/master/src/com/tnrglobal/bishopsample/service.clj
09:51mfexmduerksen, 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
09:52vijaykiranrobertstuttaford: to make the class available for some other code, I guess
09:52matessimDamn, amazon, still waiting for my programming clojure :/
09:53mduerksenmfex: nice, thanks for the pointer!
09:53robertstuttafordah from java code?
09:54vijaykiranyeah
09:54vijaykiranrobertstuttaford: http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html
09:56robertstuttafordthat's handy
09:56robertstuttafordthanks vijay
09:57vijaykirannp
10:10dgrnbrgI 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:10cmiles74robertstuttaford: 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:11robertstuttafordcmiles74! 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:13robertstuttafordcmiles74, as i have 8 services to represent, my ring app simply provides a (merge …) of each service's (service/routes) method
10:13cmiles74robertstuttaford: 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:13robertstuttafordi'm assuming that they're quite composable in this manner
10:13robertstuttafordcool, i will do
10:14robertstuttafordi've only been clojuring for about a week, though, so wear your dragon boots
10:14cmiles74robertstuttaford: 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:14cmiles74:)
10:17robertstuttafordcmiles: coupla requires and imports in the sample app can also be removed
10:18robertstuttafordlogging, ring-utils for eg
10:18cmiles74robertstuttaford: 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:21robertstuttafordum. so, this is probably so simple it's daft, but how would i solve configuration data for my app?
10:21robertstuttafordi'm thinking environment variables are the way to go (nothing ends up in git that way)
10:21robertstuttafordsurely this has been solved and there's some nice code somwhere?
10:23cmiles74robertstuttaford: 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:23ozatamanhi all. is there a version of update-in that provides a default starting value if not present in the map?
10:23cmiles74robertstuttaford: http://cemerick.com/2011/10/17/a-la-carte-configuration-in-clojure-apis/
10:24robertstuttafordthanks
10:24cmiles74Although, 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:25vijaykiranone of the recommended way is indeed to use the env var - http://www.12factor.net/config
10:25cmiles74robertstuttaford: I have removed those extra imports, etc. Thanks again for the heads up. :)
10:26robertstuttafordvijaykiran: yes, it's due to this great manifesto that i know about doing that
10:26vijaykiran:) that's the heroku's way, btw
10:26dnolenimproving slowly http://swannodette.github.com/mori/
10:29twhumeIs there an easy way to have the comparator function passed into sorted-map-by refer to the map it is passed into?
10:30robertstuttaforddnolen: this is interesting!
10:30robertstuttafordi'm guessing a large part of mori is also underpinning cljs?
10:32dnolenrobertstuttaford: mori is just exposes CLJS data structures and functions.
10:32robertstuttafordoh, right
10:32robertstuttafordhow much of the advanced mode js output is purely cljs?
10:32robertstuttafordin kilobytes, roughly
10:33robertstuttafordi guess i can check this myself, just curious if anyone knows
10:33dnolenrobertstuttaford: what do you mean?
10:34robertstuttafordtrying to figure out what the baseline kilobyte size of a cljs 'binary' is
10:34dnolenrobertstuttaford: it depends, there's dead code elimination
10:34dnolenrobertstuttaford: in general you're looking at ~30-40k gzipped.
10:34robertstuttafordthat's great
10:35dnolenrobertstuttaford: mori is between ~20-30k gzipped because a lot of stuff is irrelevant for JS consumers.
10:35robertstuttafordnot using type annotations: was that because it was deferred as not-important or because it was found to be unnecessary?
10:37dnolenrobertstuttaford: I don't know what the type annotation buy us.
10:37dnolenrobertstuttaford: but that's because I don't know anything about it.
10:40solussdanyone else having trouble getting leon marg'
10:40robertstuttafordcompile-time type checking. i guess with cljs compiling output, it'd never generate incompatibly-typed code
10:40dnolenrobertstuttaford: yes this was mentioned and possible - but no one's pursued it.
10:41solussd*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:41robertstuttafordi'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:41dnolenrobertstuttaford: yeah that wasn't my understanding.
10:42dnolenrobertstuttaford: but yes the possibility of type-checking.
10:42ozatamanhow can I raise a number to its nth power?
10:42dnolenis interesting.
10:43robertstuttafordand it supports typedefs; so checking whether code attempts to read off properties that aren't defined
10:43robertstuttafordand enums
10:43solussdozataman: use Math/pow, e.g. (Math/pow 2 4)
10:44ozatamansolussd: thanks!
10:45solussdozataman: np
10:56robertstuttafordcmiles74: 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:57cmiles74roberstuttaford: 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:03robertstuttafordthanks
11:11bderooms_Greetings, is this hte right place to ask clojure benchmark questions?
11:14joegalloask away, and if nobody answers, then i guess the answer was no.
11:14joegallo;)
11:14TimMcI can't think of a better place.
11:15TimMcbderooms_: Have you looked at criterium?
11:15bderooms_TimMc: I have no idea what it is
11:15joegalloTimMc: I'm guessing he meant for him to ask questions. Not for you to give him questions.
11:15TimMcA very nice Clojure benchmarking tool.
11:15TimMcjoegallo: haha, my bad :-P
11:15joegalloI kid, I kid. :)
11:15bderooms_ic, thanks for the advice, I'll check it out :)
11:16bderooms_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:17bderooms_I am wondering why that has an effect
11:17bderooms_*Then
11:17fliebelbderooms_: IO is slow, and I think pmap has a buffer
11:18beffbernardMy mind is shot.. :( how do I turn [1 2 3] into [[1 1] [2 2] [3 3]]
11:19fliebelbeffbernard: ##(map #(vector % %) [1 2 3])
11:19lazybot⇒ ([1 1] [2 2] [3 3])
11:19bderooms_fliebel: shouldn't the pmap solution be faster then?
11:20beffbernardbahhh.. I was trying (map #([% %]) [1 2 3])
11:20beffbernardI'm so lame
11:20TimMcbeffbernard: Do you know why that fails?
11:20TimMc&`#([% %])
11:20lazybot⇒ (fn* [p1__8140__8141__auto__] ([p1__8140__8141__auto__ p1__8140__8141__auto__]))
11:20fliebelbderooms_: 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:21TimMcaka (fn* [x] ([x x]))
11:21joegallo,(map (fn [x] [x x]) [1 2 3])
11:21clojurebot([1 1] [2 2] [3 3])
11:21bderooms_fliebel: thx, for the pointer.
11:22fliebelTimMc: What exactly does fn* do?
11:22fliebelThat's the special form right?
11:26TimMcYeah, I think it lacks destructuring, among other things.
11:26TimMcIt is a compiler primitive/
11:30TimMc&(macroexpand-1 '(fn [x & xs] xs))
11:30lazybot⇒ (fn* ([x & xs] xs))
11:30TimMcOK, I guess the destructuring is there.
11:36wkmanireHowdy folks.
12:15achinIs there any way to get Leiningen to deploy checksum files when it deploys to Maven?
12:18TimMctechnomancy: How are things coming on a clojars replacement? I'm interested in doing jar signing.
12:18technomancyTimMc: it's an augmentation rather than a replacement =)
12:18technomancybut yeah, that's one of the next steps
12:19TimMcAh, OK.
12:19technomancyIIRC once we get xeqi's HTTP deploy branch merged we can start serving up signatures
12:19technomancyso then it's up to Leiningen to start generating them when you deploy
12:20technomancyachin: I thought it should do that by default. which version are you using?
12:20achintechnomancy: 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:21technomancyhuh, odd. I haven't checked that specifically. if you can repro on preview4 could you open an issue on github?
12:21matessimIs there an open source implementation of some protocols in clojure i can look at somewhere?
12:21achintechnomancy: Yeah, sure. I'm just running "lein2 deploy reponame".
12:21matessimFTP/TFTP/Telnet/IRC
12:21matessimanything basically
12:21matessimHTTP
12:22matessimis there a open source HTTP Server in clojure or anything ?that would do too :P
12:23mdeboardmatessim: You could look at Ring
12:23mdeboardhttps://github.com/mmcgrana/ring/
12:23tmcivermatessim: check out bishop, a(nother) clojure implementation of Webmachine: https://github.com/tnr-global/bishop
12:24matessimThanks guys.
12:25beffbernard("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:25cmiles74I'm around if you have any Bishop questions, I just got it out the door last week. :P
12:26beffbernardand example would be to add :selected "Gold" to the map
12:26matessimI've never used Webmachine, so i'll have to read a bit about it
12:30zanesWell, using youngnh's Parsatron appears to have been a mistake.
12:40TimMcbeffbernard: You could use update-in if you used a vector instead of a list.
12:47wkmanireOh man, I accidently put vlc into slower playmode.
12:47wkmanireI thought the whole world had slowed down for a moment.
12:49technomancydon't do drugs, kids
12:50wkmaniretechnomancy: Fan of youtube poop?
12:51achintechnomancy: 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:52achintechnomancy: Is it a transitive dependency?
12:53TimMcwkmanire: Maybe you speeded up. o.O
12:53TimMcsped? sped.
12:53wkmanirespedeeded.
12:55technomancyachin: you can check it using `lein deps :tree` or look in leiningen-core/project.clj
12:55achintechnomancy: 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:56xeqiachin: yeah, I was hoping so too
12:57achintechnomancy, xeqi: Actually, I take that back. It's on 0.0.12. I read it wrong.
13:05PeregrinePDXIs 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_KY_It returns the agent and I see its state changed
13:08dakronePeregrinePDX: 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_KY_Supposedly send-off is non-blocking, right?
13:10rbxbxdnolen: 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:10ibdknox_KY_: yes, but derefing the agent isn't
13:11_KY_I was printing the agent's state
13:11_KY_And I saw the result... which was correct
13:11rbxbxdnolen: 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:13ibdknoxweird
13:13dnolenrbxbx: yes, I've thought about this - fogus's pipeline work is a halfway step.
13:14dnolenrbxbx: been thinking about mori(coll).map like wrapper support as well.
13:14_KY_Oh... I think I know...
13:14dnolenrbxbx: will probably put some thought into that once I've finished documenting everything.
13:14_KY_It was in a try-catch
13:15dnolenrbxbx: if you haven't seen it already http://swannodette.github.com/mori/
13:15dnolenrbxbx: 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:16rbxbxdnolen: oh nice. I hadn't seen that you'd begun working on the docs :)
13:17rbxbxdnolen: where do those live?
13:17dnolenrbxbx: gh-pages in the mori repo
13:18rbxbxdnolen: 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:18rbxbxdnolen: this weekend's hacking time didn't quite pan out :(
13:18PeregrinePDXdakrone, that seems to work.
13:19dnolenrbxbx: np
13:19replaca__KY_: nope
13:20_KY_I sent something to an agent in a catch-clause, and then program got frozen
13:24Borkdudehi mittchel
13:24mittchelhi
13:25neotykHi Borkdude
13:25Borkdudehi neotyk
13:28mittchelWhat are you guys using as irc client on mac?
13:29mittchelColloquy?
13:29neotykmittchel: erc
13:29joegallolimechat
13:29Borkdudemittchel: 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:30Borkdudemittchel: (erc is an irc client within emacs)
13:30bderooms_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:30bderooms_same with pmap.. or an agent for each work unit
13:30mittchelhaha
13:31mittchellets build one in clojure
13:32neotykmittchel: because why not?
13:33mittchelhttp://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/
13:34rbxbxdnolen: this index.html is being handwritten correct? Not generated from another source?
13:34Borkdudemittchel: maybe you can do it as the final assignment :)
13:35neotykmittchel: lazybot
13:35mittchelBorkdude: Could be fun
13:36mittchelBorkdude: Will it fall under the category hard or?
13:45dnolenrbxbx: yep, I don't see much need for auto-generation here.
13:46foxdonut mittchel: xchat
13:46muhooirssi
13:47muhooalso, someone has already written a bot in clojure, right ##true
13:47muhoo&true
13:47lazybot⇒ true
13:49gfrederickslazybot has a lazy parser, right ##(= 2 (+ 1 1))
13:49lazybot⇒ true
13:54achehow does one decide what leading syntax to use to send something to a bot? & vs ## vs ...?
13:55fliebelache: & is lazybot, , is clojure bot ## is lazybot mid-sentence
13:58achefliebel: thanks
14:04gtrak`mittchel: I kind of want to write one too, I want more control over my irc experience :-)
14:04foxdonut,(apply str (map (comp char dec int) "dppm-!uibolt!gps!dmfbsjoh!uibu!vq!gmjfcfm"))
14:04mittchelgtrak`: haha nice :)
14:04gtrak`I'll let you know if I make any progress
14:04foxdonut&(apply str (map (comp char dec int) "dppm-!uibolt!gps!dmfbsjoh!uibu!vq!gmjfcfm"))
14:04lazybot⇒ "cool, thanks for clearing that up fliebel"
14:06notNicolas((fn foo[& x](if (= (first x) 3) 3 (foo (rest x)))) 1 8 3 1 2)
14:06notNicolasThis gives me a stack overflow... I expected it to return 3
14:07notNicolasI thought it would be foo(1 8 3 1 2) returns foo(8 3 1 2) returns foo(3 1 2) returns 3
14:07notNicolasany ideas?
14:07TimMcnotNicolas: apply foo
14:08TimMcBy the way, you have a termination problem if the value isn't found.
14:08gfredericksTimMc: which is exeactly what happens to him
14:08gfrederickssince (rest x) is empty after the first or second call or whatever
14:08TimMcAh, yep.
14:09foxdonutTimMc: hey, sorry about that Spring JDBC thing. :/
14:09notNicolaswhat does "apply" do in this case?
14:10gfredericksnotNicolas: when you call (foo (rest x)), you're only giving foo 1 argument
14:10gfrederickswhile your function expects many arguments
14:10foxdonutnotNicolas: I think you're better off with ((fn [x] (if (= (first x) 3) 3 (foo (rest x)))) [1 8 3 1 2])
14:11notNicolasfoxdonut, sure, but I'm trying to figure out the variable arguments thing
14:11gfredericksso either you change the way you call it, as TimMc suggested, or change the function signature as foxdonut suggested
14:11foxdonutnotNicolas: ah ok, then what gfredericks/TimMc said.
14:11gfrederickseither way you have to match them up
14:11notNicolaswhy would (foo (rest x)) only give 1 argument?
14:12gfredericksbecause syntactially there is only one argument there
14:12gfredericksin other languages if you call foo(x.rest()), you also just get one argument, even though that argument is a collection
14:13foxdonutnotNicolas: you are calling foo with *one* argument, even if it is a list
14:13dreish(Other languages except Perl.)
14:13notNicolasbut what does apply even do? it's not a very descriptive name for a function. reminds me of doThing()
14:14gfredericksnotNicolas: it does the thing you're trying to do :)
14:14gfrederickstakes a collection of items and spreads them out as the argumentS
14:15foxdonut&((fn foo [& x] (if (= 1 (first x)) (foo (rest x)) (count x))) 1 2 3 4)
14:15lazybot⇒ 1
14:16foxdonut&((fn foo [& x] (if (= 1 (first x)) (apply foo (rest x)) (count x))) 1 2 3 4)
14:16lazybot⇒ 3
14:17notNicolas&((fn foo [& x] (if (= 1 (first x)) (foo (rest x)) x)) 1 2 3 4)
14:17lazybot⇒ ((2 3 4))
14:18notNicolasoh, is it because it's a list in a list?
14:18eightyi'm seeing some strange behavior with dispatching a defrecord via multimethod. can someone take a peek? https://gist.github.com/648444a06275eb910d11
14:18eightybasically, i can do (f (MyRecord. 1 2)) where f is a multimethod
14:19eightybuuuuuut, i can't do (def r (MyRecord. 1 2)) (f r)
14:19foxdonutnotNicolas: yes, because (foo (rest x)) calls foo with one argument, since (rest x) is itself a list.
14:19eightybasically i'm seeing "No method in multimethod 'f' for dispatch value: class user.MyRecord [Thrown class java.lang.IllegalArgumentException]"
14:20foxdonutnotNicolas: 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:20notNicolasI think this makes sense now
14:21notNicolassweet, thanks!
14:21foxdonutglad that helped :)
14:21notNicolasby the way
14:21notNicolasis there any like...... usefulness in clojure
14:21foxdonutsay what?
14:22bderooms_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:22notNicolasit seems hard to apply in a practical situation
14:22dreisheighty: 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:23dreishnotNicolas: I'd wait until you've had a little more experience with it before making a judgment like that.
14:23ralfonsois 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:23foxdonutnotNicolas: 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:23foxdonutnotNicolas: but coming from Java and mostly creating web applications, I find Clojure *very* practical.
14:24notNicolasfoxdonut, I'm finding that clojure doesn't have very many quality tools. especially compared to more popular alternatives like python and C++
14:24ForSparePartsnotNicolas, that is VERY true.
14:24eightydreish: hmmm, so my defrecord and multimethod are defined in the same namespace, and i'm seeing the problem after a lein clean, swank
14:24ForSparePartsand a damn shame, because I'm really enjoying using Clojure : (
14:24foxdonutnotNicolas: do you mean development tools, IDE, etc.? Or libraries/frameworks?
14:24dreishnotNicolas: 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:24notNicolasfoxdonut, all of those basically
14:24ForSpareParts(I assumed he meant dev tools)
14:25foxdonutnotNicolas: well part of it I would think is just because it hasn't been around as long
14:25dreisheighty: Okay, sounds like it's not the same problem, then.
14:25eightydreish: nuts :)
14:25notNicolasthis whole functional programming thing seems like more of a mental exercise than something actually practical like C++ or python
14:25bderooms_notNicolas: in any concurrent problem with lot s of chance on deadlocks clojure seems to take a lot of headache away for me
14:26neotyknotNicolas: you should try productivity boost offered by slime
14:26TimMcnotNicolas: Tell that to the wedding gift registry site I very quickly created for myself in Clojure. :-P
14:26bderooms_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:26notNicolasis it possible to do graphics like GL?
14:27eighty(defrecord MyRecord [x]) (defmulti foo class) (defmethod foo MyRecord [t] :yay)... (foo (MyRecord. 8)) => :yay, (def r (MyRecord. 8)) (foo r) => FAIL :(
14:27notNicolasI'm hearing a lot about Clojure being used for web stuff...
14:27notNicolasI'm more interested in graphics and games
14:27eightynotNicolas: yeah man, prismatic is a great example
14:28dreishnotNicolas: http://duckduckgo.com/?q=clojure+opengl
14:28ForSparePartsnotNicolas, there's this library for doing OpenGL: https://github.com/ztellman/penumbra
14:28eightynotNicolas: check out the D3 clojure port called C3
14:28ForSparePartsI haven't used it myself
14:28eightynotNicolas: oops, c2: http://keminglabs.com/c2/
14:29notNicolascool stuff
14:29ForSparePartsAlso, 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:29ForSparePartsI'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:30notNicolasI'd have fun making a game for a ludum dare using clojure
14:32ForSparePartsYou know, that might actually give me a reason to do a ludum dare. That'd be fun.
14:34ForSparePartsAlso, 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:34notNicolasI have to figure out the basics first... Working my way through 4clojure
14:34ForSparePartsMaybe I should do that. I've just been trying to invent random tasks for myself...
14:35notNicolasit's been fun for me so far
14:35fliebelnotNicolas: Any luck with the reversing?
14:35edwHey, 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&gt;.
14:36fliebeledw: Clojure?
14:37notNicolasfliebel, yep, I've worked it out finally. Just a lot of misery with the syntax.
14:37ForSparePartsHey, do you guys know of any good parsing libraries?
14:38mtkoanwhat are you parsing?
14:38edwI 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:39ForSparePartsOh, anything -- maybe a scripting language, or simplified english commends (like for text adventures). I was just looking for something to hack around with.
14:39dnolennotNicolas: a few people have been doing games with Clojure & ClojureScript
14:39ForSparePartsI really liked Parsec for Haskell, but I'm not terribly fond of Haskell.
14:39edwWe'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:40dnolennotNicolas: a couple people actually did the last Ludum Dare w/ ClojureScript
14:40fliebeldnolen: links? Curious what they made.
14:41notNicolassince clojure is implemented with java it's nice that it's cross platform too
14:41dnolenfliebel: search the mailing list - also yoklov, http://github.com/thomcc has a bunch of stuff.
14:42mtkoanForSpareParts: something my friend cooked up: https://github.com/aaronc/clj-parse
14:42dnolennotNicolas: also Penumbra is pretty sweet but someone needs to step up and take it over - https://github.com/ztellman/penumbra
14:42dnolennotNicolas: http://ideolalia.com/creating-a-simple-game-in-clojure
14:43notNicolaslooks solid
14:43fliebeldnolen: :( https://groups.google.com/forum/?fromgroups#!searchin/clojure/lundum$20dare
14:44dnolenLudum Dare
14:44dnolenfliebel: might need to check clojure-dev too
14:44fliebel*facepalm*
14:45dnolennotNicolas: http://thomcc.github.com/Argh/ is fun - though I'm not sure yoklov is still pursuing it
14:46notNicolaswow
14:46dnolennotNicolas: that's all ClojureScript
14:47dnolennotNicolas: also this blog http://oblong-code.blogspot.com/
14:48notNicolashmm
14:49notNicolas(fn [& args]( apply reduce (fn [x y]( if(> x y) x y)) args))
14:49notNicolas"Wrong number of args (5) passed to: core$r"
14:49notNicolasOh, I guess I don't need to apply in that case
14:50notNicolasapply is only necessary if you pass "args" to another function which takes variable args...
14:50BorkdudenotNicolas: not necessarily variable
14:50Borkdude,(apply (fn [a b] (+ a b)) [1 2])
14:51notNicolashmm
14:51Borkdude&(apply (fn [a b] (+ a b)) [1 2])
14:51XPheriorWhy isn't my Miles record available in the test files? https://gist.github.com/2695642
14:51lazybot⇒ 3
14:51Borkdude&(doc apply)
14:51lazybot⇒ "([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:51ForSparePartsmtkoan, thanks! I'll take a look at that.
14:52mtkoanForSpareParts: could be ideally suited for defining a grammar for MUD commands
14:53fliebel&(map apply (cycle inc dec) [1 2 3 3 4])
14:53lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: core$cycle
14:53XPheriorAlso, 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:53fliebel&(map apply (cycle [inc dec]) [1 2 3 3 4])
14:53lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long
14:53ForSparePartsYeah, it looks sweet!
14:56XPheriorNevermind, figured it out! Needed a require, not a use
14:57Bronsa,(map deliver (cycle [inc dec]) [1 2 3 3 4]))
14:58Bronsalazybot ?
14:58Bronsa,(map deliver (cycle [inc dec]) [1 2 3 3 4])
14:59raekBronsa: lazybot s triggered by "&". it is clojurebot that has the "," trigger
14:59Bronsaoh.
14:59Bronsa&(map deliver (cycle [inc dec]) [1 2 3 3 4])
14:59lazybot⇒ (2 1 4 2 5)
14:59raekclojurebot seems to be offline now for some reason
15:00Bronsai see
15:00fliebelhuh, is a function a promise?
15:00otijhuisam 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:00Bronsano
15:01fliebelBronsa: then why ##(deliver inc 1)
15:01lazybot⇒ 2
15:01TimMc&(doc deliver)
15:01lazybot⇒ "([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:02Bronsabecause deliver is implemented as a simple funcall
15:02Bronsai guess it's an implementation detail but it happens to work.
15:02TimMc$findfn + 2 3 5
15:02lazybot[clojure.core/trampoline]
15:02dnolenrbxbx: thanks for the additions
15:02TimMc$findfn inc 2 3
15:02lazybot[clojure.core/deliver clojure.core/trampoline]
15:03Bronsayeah, just for single arity
15:04rbxbxdnolen: 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:04dnolenrbxbx: yep
15:05TimMcfliebel: So it's the other way around: A promise happens to be a function.
15:08rbxbxdnolen: in actually sitting here using the library I think adding a proxy/wrapper would be nice...
15:09rbxbxdnolen: 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:10dnolenrbxbx: yeah I don't see how that particular case can work.
15:10dnolenbut mori({"foo": 1}).has_key('foo') would be interesting.
15:11dnolenrbxbx: would be nice if mori itself was a function that did the smart wrapping etc.
15:11rbxbxdnolen: and how. Seems worth exploring down the road :)
15:11jsabeaudryI'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:11rbxbxdnolen: 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:12rbxbxdnolen: 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:18dnolenrbxbx: 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:20TimMcjsabeaudry: You mean a *synchronous* query, yes?
15:22XPheriorAgh, I didn't end up figuring it out. Still having problems importing a record from another namespace. https://gist.github.com/2695642
15:23notNicolassoooo what does "identity" do?
15:23TimMcnotNicolas: Not much.
15:23tmciver,(doc identity)
15:23TimMctmciver: clojurebot is missing
15:23jsabeaudryTimMc, oh yes, a synchronous query my bad
15:23tmciver&(doc identity)
15:23lazybot⇒ "([x]); Returns its argument."
15:23XPherior&(partition-by identity [1 1 2 2 3 3 4 5])
15:23lazybot⇒ ((1 1) (2 2) (3 3) (4) (5))
15:23notNicolasnot very descriptive
15:24XPheriorIt does stuff with other stuff :)
15:24AimHere&(filter identity [false false false :brian false])
15:24lazybot⇒ (:brian)
15:24XPheriorIt's descriptive. It's just simple.
15:24TimMcnotNicolas: What would you have the docstring say?
15:24notNicolasI don't know because I don't understand what it does
15:24AimHereIdentity is a function that takes an argument, and returns the argument.
15:24tmcivernotNicolas: it returns its argument . . .
15:25notNicolasoh
15:25XPheriorReally, don't overthink it
15:25TimMcnotNicolas: ##(identity 5)
15:25lazybot⇒ 5
15:25AimHereLike the mathematical function f(x)=x
15:26notNicolas&(filter identity [1 2 3 nil 4 false true 1234])
15:26lazybot⇒ (1 2 3 4 true 1234)
15:26notNicolasthis happens because nil and false are filtered by being non-true?
15:26dnolennotNicolas: yep
15:26notNicolasalright simple enough
15:26AimHereFilter discards all the falsy values, and identity just passes on what values are in the list, yes
15:27TimMcnotNicolas: nil and false are "logical false", everything else is "logical true"
15:30jsabeaudryFunction 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:30jsabeaudrythat could be a 4clojure challenge
15:31jsabeaudryall of this without mutation
15:36dnolenrbxbx: thanks again, there's a few things missing like that I think :)
15:36dnolenrbxbx: find could be improved a bit by returning an array instead of a vector
15:37amalloyjsabeaudry: did i miss some context? in isolation i can't understand your suggested problem at all
15:37rbxbxdnolen: so doing something more along the lines of mori.each instead of exports CLJS's function?
15:37rbxbxexporting*
15:38rbxbx(or juxt, or curry, etc)
15:38dnolenrbxbx: more like juxt
15:38rbxbxdnolen: I may look into that later, though my Clojure/Script isn't terribly strong.
15:39dnolenrbxbx: sure, np - I can tackle that too.
15:39rbxbxdnolen: I'm sure I could use CLJS's as a reference implementation though :)
15:40rbxbx(maybe)
15:40jsabeaudryamalloy, (= 5 (___ #(% 5)))
15:40jsabeaudryAm I slow today or is this tricky?
15:41amalloy#(% identity)?
15:42amalloy&(#(% identity) #(% 5))
15:42lazybot⇒ 5
15:42TimMcjsabeaudry: Your problem is more different-like, though.
15:43jsabeaudryOh yes more like (= 5 (___ (do #(% 5) nil)))
15:44jsabeaudryoops not quite right,
15:44TimMc(= 5 (___ (blackbox #(% 5))))
15:45TimMcpromise/deliver?
15:45jsabeaudryTimMc, 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:46TimMcI doubt it.
15:46TimMcWell, I'd have to take some couch time.
15:47ivanhiredman: do you think that a tuple should print differently than a vector, given that getN doesn't work on vectors?
15:49jsabeaudrypromise and deliver could do the job but they dont seem to be available in cljs
15:51TimMcWrite 'em!
15:51TimMcOh wait, you need to block.
15:52RaynesIsn't that all javascript does? :p
15:52gozalaTimMc: jsabeaudry I have prototyped js like promises for cljs
15:52gozalahttps://github.com/Gozala/eventual-cljs
15:52RaynesShould be called blockscript
15:52TimMcjsabeaudry: Your function could take a continuation argument, k, and call that from inside :success...
15:53TimMcgozala: Doesn't help with returning from a synchronous function.
15:53ivanyou 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:54gozalaTimMc: Sorry I have not been following whole conversation, just noticed you were talking about promises in cljs
15:55TimMcivan: You have to invert control on a whole wad of the call stack, though.
15:56ivanTimMc: yep. not that I have any idea how to do this
15:56ivanbut it would be nice to solve once rather than many times, as it ends up when you use Deferreds
15:58TimMcOh, wait! The $.ajax call does the blocking here, right?
15:58gozalaTimMc: why does not it helps with sync function btw ?
15:58ivanyou can block with synchronous AJAX, but you really don't want to ever block
15:59TimMcgozala: It does, I forgot that sync meant sync. :-P
15:59gozalaDid you meant async than ?
15:59TimMcjsabeaudry: Why *are* you using a sync call, anyway?
16:00mittchel(assoc-in tentamencijfers [1 :cijfer] 10
16:00mittchel (get-in tentamencijfers [1 :cijfer]))
16:00mittchelWhat's wrong witht his? I'm trying to retrieve the 10
16:00gozalaTimMc: do you mind repeating what your problem is I'm not able to find the head of this conversion
16:01jsabeaudryTimMc, 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:03hiredmanivan: but tuples are vectors
16:03TimMcgozala: jsabeaudry is trying to use jQuery's $.ajax in {:async false} mode without state. $.ajax uses callbacks even in sync mode.
16:03Raynesjsabeaudry: You're using jquery-console from clojurescript?
16:05ivanhiredman: 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:05ivans/different//
16:05gozalaTimMc: ok and what are you trying to do ?
16:05TimMcMe? Nothing.
16:05dsantiagohiredman: 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:06gozalaTimMc: oh for the moment I thougt jsabeaudry was js lib :D
16:06TimMchaha!
16:06jsabeaudryRaynes, I'm trying to yes
16:07Raynesjsabeaudry: I'd be interested in seeing the end result if this is public code.
16:07Raynes(I'm the author of tryclj)
16:07xeqimittchel: did you misplace a paren? also note assoc-in returns a new map, which needs to get passed to get-in
16:08gozalajsabeaudry: so you should be able to use my promise lib to wrap $.ajax but I guess it's not worth it
16:08mittchel@xeqi: If I'm correct I didn't miss place..
16:09gozalajsabeaudry: I think wrapping $.ajax into function that modifies an atom on callback
16:09gozalaand returning value of that atom should be ox
16:09jsabeaudryRaynes, I won't be public, but I'm sure I can write the good stuff a second time in a pastebin :P
16:09gozalaas state will be captured with in that function
16:10xeqi&(get-in (assoc-in {} [:k1 :k2] 1) [:k1 :k2])
16:10lazybot⇒ 1
16:10mittchel&(get-in (assoc-in tentamencijfers [1 :cijfer] 10) [1 :cijfer])
16:10lazybotjava.lang.RuntimeException: Unable to resolve symbol: tentamencijfers in this context
16:10mittcheloh lol
16:10mittchelthis one works
16:10mittchelin repl:P
16:10hiredmandsantiago: I don't have benchmark numbers, but when I ran the code I did not see the lock contention issues
16:10Raynesjsabeaudry: Cool. :>
16:11jsabeaudrygozala, Yes, that seems like it will be the way to go until we can find a way without using state
16:11gozalajsabeaudry: not using $.ajax could be another way
16:12michaelr525Hello
16:12jsabeaudrygozala, ah using a straight up XMLHttpRequest?
16:13gozalajsabeaudry: yeah
16:14gozalajsabeaudry: I would also expect that google closure compiler has some XHR wrapper
16:14gozalathat may work without callbacks for sync requests
16:14TimMcThe synchronous version of that will do a straight return?
16:14TimMcIt's not even hard to use XHR directly.
16:16ivangoog.net.xhrio is always async
16:17gozalajsabeaudry: Honestly I would not care about state in the cljs wrappre function that much since XHR has state anyway
16:17RaynesTimMc: Byte your tongue.
16:17gozalaand $.ajax has it to
16:18gozalaif you add yet another layer that doesn't leaks state I don't see much issue with that
16:24mittchel,(true? (fn [x, y] (get-in y [x]) :a {:a nil :b 2}))
16:24rbxbxdnolen_: 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:25dnolen_rbxbx: sounds like a bug
16:26rbxbxdnolen_: indeed, it's just confusing since it works fine in a CLJS repl and you're doing a straight export of that impl
16:26dnolen_rbxbx: hmm might be a bug in CLJS itself.
16:26dnolen_rbxbx: nth is just CLJS's nth
16:27dnolen_rbxbx: which version of CLJS you testing this with?
16:27rbxbxdnolen_: head
16:30rbxbxdnolen_: https://www.refheap.com/paste/2717
16:31dsantiagohiredman, ok, good, thanks.
16:31rbxbxdnolen_: er, this one, rather - https://www.refheap.com/paste/2718
16:31dnolen_rbxbx: yeah definitely a bug in ClojureScript
16:32rbxbxdnolen_: 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:32Raynesdnolen_: We should have a party or something when refheap hits 3000 pastes.
16:33dnolen_rbxbx: ticket created http://dev.clojure.org/jira/browse/CLJS-256
16:33rbxbxdnolen_: cheers.
16:35pandeiroRaynes: anything else I'd need to do here? https://github.com/ibdknox/noir/pull/94
16:36Raynespandeiro: Nope, looks great. I'll merge it tonight. :)
16:36wkmanirepandeiro: Adding stuff to noir?
16:37pandeirojust docstrings for the defpartial macro
16:37Raynespandeiro: Also, sorry for being pedantic about the destructuring.
16:37RaynesThere wasn't anything necessarily wrong with your code or anything.
16:38pandeiroRaynes: i found it helpful
16:38pandeiroit's funny to look at my first two attempts, then chris' suggestion, then yours
16:38wkmanireCool.
16:38pandeiroi don't think i could've found a harder way to do it
16:38pandeirobut "it's my first time" (with macros)
16:38RaynesHaha
16:39RaynesYeah, macros can be brutal at first.
16:39pandeiroi was very intimidated by the inability to debug anything while macroexpand throws exceptions
16:39Raynespandeiro: Go look at lazybot's defplugin macro.
16:39RaynesFirst macro I ever wrote, though it used to be a lot worse than it is today.
16:43pandeiroif i fork a repo to bump dependency versions, the project version number should not be touched, right? or wrong? or case-by-case?
16:44RaynesI'd leave it alone, because you never know when the author might want to do a different type of bump than you did.
16:45mittchel(true? (fn [x, y] (nil?((get y x nil))) :a {:a nil :b 2}))
16:45mittchelwhy does this return false?
16:46pandeiroRaynes: 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:46raekmittchel: functions are not the true object
16:46raek,(boolean (fn [x, y] (nil?((get y x nil))) :a {:a nil :b 2}))
16:46raek&(boolean (fn [x, y] (nil?((get y x nil))) :a {:a nil :b 2}))
16:46lazybot⇒ true
16:46Raynespandeiro: You can do one of two things here.
16:46mittchelhttp://www.4clojure.com/problem/134 is a pain in the ass
16:46mittchelI need true there
16:47Raynespandeiro: 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:47mebaran151mittchel: looks like you might be missing a set of parens
16:47mittcheloh, where?:O
16:48mebaran151you want to call the function on those arguments; need an extra set '(fn' and ') :a'
16:48mittchelCan't seem to solve it for some reason
16:48mittcheloh lol
16:49mebaran151&(fn [x, y] (nil?((get y x nil))) :a {:a nil :b 2})
16:49lazybot⇒ #<sandbox3826$eval8741$fn__8742 sandbox3826$eval8741$fn__8742@595fa>
16:49mittchelDo you mean something like: (true? (nil?(get y [x] nil) :a {:a nil :b 2}))
16:49mebaran151(true? ((fn [x, y] (nil?((get y x nil)))) :a {:a nil :b 2}))
16:49TimMcnil? doesn't take 3 args
16:49RaynesThe trick is that you can specify a not-found value.
16:49Raynes&(:a {:b 0} false)
16:49lazybot⇒ false
16:49mittchel::not-found right
16:50mebaran151&(true? ((fn [x, y] (nil?((get y x nil)))) :a {:a nil :b 2}))
16:50lazybotjava.lang.NullPointerException
16:50mittchel&(true? (fn [x, y] (nil?(get y [x] ::nil)) :a {:a nil :b 2}))
16:50lazybot⇒ false
16:51Raynesmittchel: When you're okay with spoilers, let me know and I'll give you my solution.
16:51mebaran151mittchel, just note that your fn form returns {:a nil :b 2}, since you didn't end your function after the nil test
16:51mittchelthis is abracadabra
16:52mebaran151&(true? ((fn [x, y] (nil? (get y x nil))) :a {:a nil :b 2}))
16:52lazybot⇒ true
16:52mebaran151there we go, parens all fixed up :)
16:55mittchelhm
16:55mittchelWhy were they wrong
16:57otijhuismittchel: looks like you were checking if the function was true, not the result of the function
16:57mittchelhm
16:57mittchelThough, if I fill in this: ((fn [x, y] (nil? (get y x nil))))
16:57mittcheltest fails
16:58otijhuismitchell: last one fails?
16:58mittchelyep
16:58otijhuismitchell: 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:59mittchellol
16:59mittchelfalse ofcourse
16:59brehautprime oppertunity for juxt and every?
17:00mittchelthanks took a while
17:01Raynesmittchel: #(nil? (% %2 false))
17:01RaynesYou 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:02amalloynote 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:03RaynesHehe
17:03RaynesI used false for clarity and because I rarely do the code golf stuff.
17:06mittchelwhat does that %2 mean raynes/
17:06RaynesIt's the second argument to the anonymous function.
17:06brehautits the second argument to an inline anonymous form
17:06Raynes% is the first argument, %2 is the second, %3 the third and so on.
17:06brehaut,'#(str % %2)
17:08TimMc% = %1
17:09PeregrinePDXLol that anonymous function form reminds me so much of perl.
17:09brehautdnolen_: ping?
17:09dnolen_brehaut: pong
17:09RaynesPeregrinePDX: Didn't you know? Clojure is Perl with parens.
17:10PeregrinePDXIt certainly has the terseness a lot of perl down. Which with perl caused a lot of people to complain.
17:10brehautdnolen_: i sent you a PM
17:34midrangioanyone here on 4clojure?
17:35brehautmany people yes
17:36midrangioi'm confused as to why i get the error "You tripped the alarm! def is bad!
17:36brehautyou arent allowed to def things
17:36midrangiodo they want me to use anonymous functions or something
17:36gfredericksyes
17:36XPheriorI 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:36brehautyes
17:37midrangiocan you do anonymous functions with different function signatures
17:37kaoDmidrangio:
17:37brehautyes
17:37kaoDyou might wanna go to #4clojure
17:37gfredericksXPherior: you can do it without them referring to each other if nothing else
17:37XPheriorgfredericks: I could, but it would kill the point of what I'm doing.
17:38midrangioanyways, nice language
17:38gfredericksXPherior: well we wouldn't want to do that
17:38XPheriorgfredericks: Nope. :)
17:38gfredericks,((fn ([a] 1) ([b c] 2)) :one-arg)
17:38XPheriorI guess I could split them across files.
17:38brehauti think clojurebot us having a nap
17:38gfredericks&((fn ([a] 1) ([b c] 2)) :one-arg)
17:38lazybot⇒ 1
17:39gfredericks&((fn ([a] 1) ([b c] 2)) :one-arg :another-arg)
17:39lazybot⇒ 2
17:39midrangiogfredericks: thanks
17:41midrangiogfredericks: how would i call the anonymous function internally, but with a different argument signature
17:41midrangioit says mismatched argument count when i do 'recur'
17:41gfredericksyou can give it a name after fn
17:42gfredericks&((fn f ([a] (f a 2)) ([b c] (+ b c))) 8)
17:42lazybot⇒ 10
17:42kaoDmidrangio: it should work with recur too
17:42kaoDyou're just missing arguments
17:42kaoDoh, nevermind
17:42kaoDdifferent arg count
17:47notNicolassoo what's the difference between [] '() and #{}?
17:47notNicolasI think [] is vector and '() is list?
17:47johnkpaul-afkyes
17:48johnkpaul-afkand #{} is a set
17:48gfredericksand #{} is set
17:48gfredericks,(= '() [] #{})
17:48clojurebotfalse
17:48gfredericksoh he lives
17:48notNicolas{} by itself without the # is not a set?
17:48gfredericksit is a map
17:48notNicolasI see
17:48kaoDhmmm
17:48kaoDnotNicolas: those seem like pretty newbie questions
17:49gfredericksyeah get out of here
17:49kaoDshouldn't you better be reading a book/tutorials?
17:49notNicolastoo lazy to buy a book
17:49kaoDno, don't get me wrong, I'm not like "get outta here you filthy newb"
17:49notNicolascouldn't find the answer in the quick reference
17:49kaoDnotNicolas: you ain't gonna learn clojure with a quick ref
17:49PeregrinePDXhttp://www.brainonfire.net/files/seqs-and-colls/main.html
17:50notNicolaswe'll see about that
17:50PeregrinePDXWith enough outside references he might possibly.
17:51RayneskaoD: I pointed him at the ociweb introduction last night, which should be sufficient.
17:52notNicolasI'm just pwning the 4clojure things
17:52kaoDnotNicolas: I bet you're not
17:52kaoD:P
17:53notNicolasyeah I'm getting my ass kicked but I'm getting better
17:54PeregrinePDXLol I have a book and was getting my ass kicked at the beginning.
17:54RaynesSome of those problems are ridiculously hard.
17:54mebaran151I'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:55dnolen_mebaran151: somebody started on something like that a year ago but it hasn't gone anywhere.
17:55dnolen_mebaran151: https://github.com/antoniogarrote/clj-control
17:57mebaran151ah looks sort of like what I was thinking; except is there any benefit over using regular ol' functions performance wise?
17:58muhooi'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:58jasonjcknmebaran151: good question
17:58jasonjckni wonder
17:58brehautmuhoo: http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution
17:59muhoobrehaut: thanks!
17:59brehautmuhoo: those are soft ranges, so the highest will be used
17:59mebaran151jasonjckn: 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:59kaoDbrehaut: but aren't major versions supposed to break backwards compatibility?
17:59kaoDand therefore you might need both
17:59ivananyone know why La Clojure takes so long to highlight all the "first symbol in list"?
18:00brehautkaoD: thats up to you to sort out with your dependancy strings. if you use soft versions, its your own funeral
18:00jasonjcknmebaran151: Does GHC optimize away all the function dispatch of bind?
18:00kaoDbrehaut: that makes sense
18:01muhooso [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:01mebaran151jasonjckn: I think it might do some clever inlining
18:01jasonjcknmebaran151: i'd hope so, considering that's the only way to get 'strict evaluation'
18:02jasonjcknmebaran151: on the other hand, I don't think JVM does that
18:02brehautmuhoo: yup
18:02mebaran151I 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:03dnolen_mebaran151: core.logic uses a monadic design - Hotspot does just fine.
18:03brehautmuhoo: 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:04mebaran151dnolen_: oh interesting
18:04jasonjckndnolen_: do you think clj-control implementation of monads would have all the bind/m->> functions calls inlined?
18:04jasonjckni guess the more general question, is if virtual function dispatch is inlined, i believe it is in some cases
18:04jasonjckni don't know the criteria
18:05mebaran151I just sometimes get warnings that algo.monads is only really an option if you're not concerned with performance
18:05mebaran151I think hotspot can do virtual function inlining actually; does a lot of speculative stuff you can't do in C++
18:06LexerSuggest me a book on Clojure ?
18:06dnolen_Lexer: the new O'Reilly one
18:06midrangiodo you guys think clojure will emerge as the champion of the alternative-jvm scaleable language battle
18:06LexerWhat's its name ?
18:07brehautlexer: http://clojurebook.com/
18:07gfredericksif 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:07brehautgfredericks: and its always the least qualified competitor
18:07gfrederickswith the catchiest name
18:07dnolen_midrangio: doubtful, but not sure whether that's relevant to its overall success.
18:08gfredericksclojure cannot win as it contains an uncommon consonant
18:08dnolen_midrangio: people seem to like Scala & Groovy - I have no idea why, but that's just me.
18:08midrangiodnolen_: just curious
18:08raekactually, the least common consonant phoneme of the English language
18:09mebaran151JVM 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:09gfredericksscala has an ambiguous pronunciation disadvantage
18:09gfredericksyou avoid talking about it so people don't judge you
18:09yoklovgroovy seems to me like the least interesting one by a wide margin
18:09mebaran151Groovy always seemed like a poor man's JRuby to me, but I don't know too much about it
18:09midrangioi saw some comparison between scala and clojure and scala was basically crap concurrently
18:10mebaran151Scala to me feels like the C++ of Java
18:10brehautfeels to me like the c++ of haskell
18:11mebaran151well it's just that Java and C are relatively simple and C++ and Scala both add a lot of complexity atop those runtimes
18:11midrangiothere is some doubt raised as to whether the actor model is sufficient for good concurrency
18:11yoklovjava feels like the c++ of java
18:11dnolen_midrangio: Scala is like Dart. It tries to appeal to a style of mainstream programming I've completely lost interest in.
18:11midrangioyeah functional is getting huge
18:12midrangioif it weren't for the barrier to entry i'd def place my bets on clojure
18:12myeweird, in the README for swank-clojure it says C-c C-l Load current buffer, but here it load the file from disk
18:12dnolen_midrangio: Clojure advantage is also it's disadvantage. What Scala & Dart offer are at least familiar to most people.
18:13gfredericksmye: yeah I just got used to saving before doing that
18:13jasonjcknScala is so much more complex than Clojure
18:13myeso there is no eval buffer?
18:13jasonjcknso many 'features'
18:13mebaran151Scala has a fearsome type system
18:13jasonjcknbut clearly it's more familiar to OOP people
18:14mebaran151I'm not sure if the project of melding functional programming and OOP is really a good idea
18:14kaoDgfredericks: scala is not ambiguous
18:14kaoDit's S-CALL-AH
18:14kaoDwell, nope
18:14dnolen_mebaran151: Clojure also melds functional programming and OOP, just via a very different approach
18:14kaoDS-CAL-AH
18:14kaoDSKULLAH
18:15raekmye: I usually use C-c C-k (after saving the buffer)
18:15midrangioi like rubys functional/oop mix
18:15mebaran151dnolen_: there might be objects but there really isn't an orientation toward them :)
18:15mittchel(for [x (range 20)
18:15mittchel :when (divisible-by-three? x)]
18:15mittchel x)
18:15yoklovruby's functional aspects have always been lacking for me.
18:15mittchelhow can I let it return a map?
18:16kaoD(zipmap (yourfor) (range 20))
18:16jasonjckndnolen_: how would you describe clojure's take on OOP?
18:16kaoD(or the other way around, not sure what your wanted)
18:16kaoDmidrangio: IMHO is not that the actor model is good or bad for concurrence... is that the Scala implementation just sucks
18:16kaoDthere is a lot of overlapping between whan an object and an actor can do
18:16kaoDand I always find myself puzzling around ity
18:17gfrederickskaoD: SKAY-luh
18:17dnolen_jasonjckn: rich abstractions at the bottom, all data structures built on them, simple interface to those data structures via functions
18:17kaoDalso, agent approach is much more elegant imho (and doesn't collide with the notion of object)
18:17midrangiokaoD: 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:17kaoDgfredericks: no way! SKAY-luh is for gringos
18:17gfrederickssku-LAY then
18:17yoklovmidrangio: 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:18kaoDnope
18:18kaoDthat is for... weird people
18:18kaoDSKULL-uh is classy, sounds good and actually means something in italian (stairway, which is the logo for Scala)
18:18mittchelkaoD: so: (zipmap(for [x :when (divisible-by-three? x)] x) (range 20))
18:18mittchelcause it gives some errors lol ;D
18:18jasonjckndnolen_: *nods* that's pretty sound, seems clojure uses objects to organize interfaces and data, not functions and data
18:19dnolen_jasonjckn: Clojure actually avoids the mess you traditionally encounter with FP ADTs
18:19kaoDmidrangio: could you point to the article?
18:19alex_baranoskywho knows which interface conj lives on
18:19ivanhow does (ns your-namespace (:require clojure.test)) put the `is` macro into your-namespace?
18:19jasonjckndnolen_: 'mess' ?
18:19kaoDmittchel: that's just the bare idea, try fixing the errors :P
18:19dnolen_jasonjckn: read the William Cook paper, Data Abstraction Revisited
18:19jasonjckndnolen_: k thx
18:20mittchelI hate clojure error message
18:20mittchelnever find them clear, as a newbie.
18:20kaoDmittchel: you need to print the stack traces
18:20kaoDto get something useful
18:20midrangiokaoD: http://www.bestinclass.dk/index.clj/2009/09/scala-vs-clojure-round-2-concurrency.html
18:20kaoDusually you get the top stack error which is the least useful one
18:20ivannever mind, the thing I mentioned does not happen
18:20mittchelnevermind
18:20mebaran151dnolen_: interesting paper, just searched it
18:20midrangiowhat's an idiomatic way in clojure to tell if an argument is a function
18:21kaoDmidrangio: fn?
18:21kaoD&(fn? sort)
18:21lazybot⇒ true
18:21kaoD&(fn? 1)
18:21lazybot⇒ false
18:21midrangiothx
18:21mebaran151midrangio: fn?
18:21kaoDmidrangio: there are all sort of predicates for that kind of things
18:21kaoDI always have clojure's quick reference open when I do clojure
18:22PeregrinePDXYeah, having a good list of predicates has been valuable for my attempts at things.
18:22kaoDPeregrinePDX: specially for things that do stuff
18:22yoklov,(fn? #{})
18:22clojurebotfalse
18:22kaoD&(fn? [])
18:22lazybot⇒ false
18:22yoklov,(#{:foo} :foo)
18:22clojurebot:foo
18:23yoklovyou can also use ifn? if you want to test if something can be used as a function (e.g. a data structure)
18:23kaoDyoklov: it's not a function but implements the required interface to be called
18:23kaoDright?
18:23clojurebotflatten |is| rarely the right answer. What if your "base type" is a list
18:23yoklovkaoD: yup
18:23kaoDclojurebot: the fuck?
18:23yoklov,(ifn? #{})
18:23clojurebotfucking is not a polite word
18:23clojurebottrue
18:24kaoDoh
18:24mye(: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:24kaoDan evil idea just came to my mind
18:24brehaut~contrib
18:24clojurebotMonolithic 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:24kaoDmye: clojure contrib is deprecated
18:24brehautmye ^
18:24brehautmye: clojure.java.io/file
18:26myebrehaut, is that a separate dep in leiningen?
18:26kaoDnope
18:26brehautmye: no its part of clojure 1.3+
18:26kaoDit's core
18:27kaoDwell, not core technically
18:27myebc. just like that I cant get it to work (:require clojure.java.io/file)
18:27kaoDbut it's in clojure
18:27brehaut(:require clojure.java.io) (clojure.java.io/file "…")
18:27kaoDor (:use clojure.java.io.file)
18:27kaoDand then just file
18:27kaoDnope?
18:27myethis is confusing :-|
18:28brehautmye clojure.java.io is a namespace file is a function. you require namespaces, not functions
18:28brehautkaoD: no.
18:29brehautmye, kaoD: if you want to use it, it would be (:use [clojure.java.io :only [file]])
18:29brehautor with clojure 1.4+ (:require [clojure.java.io :refer [file]])
18:29brehaut(i tihnk)
18:29kaoDbrehaut: yep, you're right
18:29brehaut,*clojure-version*
18:29clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
18:30brehaut,(require '[clojure.java.io :refer [file]])
18:30clojurebotnil
18:30brehaut,file
18:30clojurebot#<io$file clojure.java.io$file@f7c8d2>
18:30kaoDI always have to check ns' related in clojuredocs
18:30kaoDand I mostly copy and paste it around my files which renders me unable to remember it :P
18:31brehautmye: the NS import/use/require is a bit confusing when you start out. the difference between ns form and repl invocation doesnt help
18:31hyPiRionhuh. Is (:require [clojure.java.io :refer (file)]) equivalent to (:use [clojure.java.io :only (file)]) ?
18:32yoklovwait, (:require [crap :refer [othercrap]]) is how its done now?
18:33kaoD,(print "&(print \"I'm the last in the chain!\")")
18:33clojurebot&(print "I'm the last in the chain!")
18:33lazybot⇒ I'm the last in the chain!nil
18:33technomancyhyPiRion: yeah, on 1.4+
18:34technomancyclojurebot: what's the best programming language is <reply>http://www.qwantz.com/index.php?comic=1786
18:34clojurebotAlles klar
18:34hyPiRiontechnomancy: Is there any specific reason why this was added?
18:35hyPiRion(If you know)
18:35technomancyhyPiRion: because the ns macro needs to be simplified; it's way too confusing
18:36technomancyif :use becomes redundant, then all you have to think about is the difference between Clojure vars (:require) and Java classes (:import)
18:37kaoDtechnomancy: I found that confusing too when I started doing Clojure
18:37kaoDbut I'm sure there's a good reason to keep them separated
18:37hyPiRionAh - good. So I suppose :use is going to be deprecated then.
18:38technomancythe require/import distinction is useful because vars and classes are very different things. the use/require distinction is unnecessary complexity.
18:39myeI like how in Rackets docs the required (require) form is spelled out explicitly
18:43yoklovmye: racket's require/provide are really quite complicated though
18:43yoklovmye: oh, you mean in the documentation?
18:46brehautmye: 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:47myebrehaut, 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:48myestill says 1.3.0
18:48brehauthave you done a lein deps?
18:48myey the jars there
18:48yoklovyou might need a new jar?
18:48brehautin where?
18:49myelib/clojure-1.4.0.jar
18:49brehauti have no idea if jack in starts a new swank server on the back end
18:49brehautor if it will reuse an existing one
18:49brehauti like to test this sort of thing out with a lein repl
18:49brehautbecause there are less parts
18:50technomancyjack-in restarts swank
18:50technomancyalso: running lein deps is never the answer
18:50technomancyclojurebot: lein deps
18:50clojurebothttp://github.com/technomancy/leiningen
18:51technomancyclojurebot: lein deps is the equivalent of taking the cartridge out and blowing on it
18:51clojurebot'Sea, mhuise.
18:51brehauttechnomancy: sorry i was out making a coconut radio on my new air strip.
18:52brehauttechnomancy: is lein deps just done automatically when the project changes anyway?
18:52wkmanirebrehaut: That is the best excuse I've heard for anything so far this year.
18:52technomancybrehaut: yeah, basically you can't run any code that needs your dependencies without deps getting invoked
18:53technomancythis has been true since (I believe) lein 1.4?
18:53brehaut,(print "(dec brehaut)")
18:53clojurebot(dec brehaut)
18:53lazybot⇒ 6
18:53brehautthanks bots
18:53hyPiRiontsk.
18:54technomancyhehe; no worries, just watch out for others spreading that notion and stop them =)
18:54brehautyessir
18:55myerestarted emacs, still (clojure-version) -> "1.3.0" :'( [org.clojure/clojure "1.4.0"] is in project.clj
18:55brehauttechnomancy: does the same apply to lein clean ?
18:55hyPiRionmye: Have you tried turning it on and off again? :^)
18:55brehautmye: what other deps do you have? one of them could have clamped you on 1.3
18:56PeregrinePDXDoes swank process the project.clj?
18:56brehauti know for a fact that the idiot who wrote necessary-evil made that mistake
18:56technomancybrehaut: if you switch profiles, there are still cases where you need an explicit clean right now
18:56brehauttechnomancy: ok thanks
18:56technomancybut it's a flaw in Leiningen; if lein did the right thing it wouldn't be necessary
18:57technomancybut it's a bug
18:57technomancyoops
18:57technomancyhttps://github.com/technomancy/leiningen/issues/468
19:00brehauttechnomancy: theres a command that spits out the deps tree now isnt there?
19:01myehyPiRion, rebooting would probably help as windows won't even let me delete the 1.3 jar (used by ..??) ;-)
19:02technomancybrehaut: `lein deps :tree`
19:02technomancybrehaut: I probably would have removed the deps task if it weren't for that
19:02PeregrinePDXBut running lein deps is never the answer.
19:03brehautlol
19:03technomancyah, I should have been clearer: running `lein deps`
19:03technomancypartial application doesn't count! =)
19:04brehautneed more point free lein commands
19:04technomancybrehaut: actually I was just thinking about this
19:04brehautmye: run that command and have a look at the deps it spits out
19:04brehauttechnomancy: yeah? what would it return?
19:04technomancyright now you chain leiningen tasks with commas, and it's hard-coded in the leiningen.core.main namespace
19:04brehautoh right
19:04technomancybut that sucks because it doesn't compose with higher-order tasks
19:04brehautyeah
19:05technomancyso `lein with-profile production jar, run` will have the run task not use the production profile
19:05technomancybut if chaining were lifted into another higher-order task, it would be easy to make it work with profiles, right?
19:05brehautyeah it would
19:05technomancyso `lein with-profile production do jar, run`
19:05technomancyit would just break a lot of stuff
19:05technomancybut the design is much better
19:06brehautawesome enough to introduce before 2.0 goes final?
19:06technomancyI think so
19:06brehautthe M word had also entered my mind
19:06technomancymaybe with a graceful degradation period with preview5 where both approaches work
19:07brehauthave it spit a warning when it detects complicated command lines?
19:07bhenrywhat's the trick to make this less crazy (.-property (.-property (.-property object)))
19:07technomancyor just any time there's a comma and the first task isn't "do"
19:08technomancydo is a monad, right?
19:08brehauttechnomancy: yeah, i think it could be the identity monad with bind discarding arguments
19:08brehaut(ie, a let where every LHS of the binding is _)
19:09ibdknoxbhenry: (.-property.property.property foo)
19:09technomancyoh, of course
19:09bhenryibdknox: thanks
19:14brehauttechnomancy: if it is just the identity monad, then its perhaps a bit redundant to use a monad
19:14brehautat least in clj where we get no type level enforcement that things are sane
19:15technomancyoh yeah, I probably won't implement it as a monad
19:16technomancybut that doesn't mean I can't use the jargon
19:16brehautoh for sure
19:17brehautnot least because employing monads does limit the future contributions anywhere they are visible
19:18technomancynot something you want to do when your tag line is "doesn't set your hair on fire"
19:19brehauthaha yes
19:20brehautim 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:28hiredman~ping
19:28clojurebotPONG!
19:28hiredmanclojurebot: <3
19:28clojurebot
19:28gtrakclojurebot:☠
19:28clojurebotTitim gan éirí ort.
19:45mrakanaAnybody 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:47eightyi 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:48brehaut,(symbol "Foo" "bar")
19:48clojurebotFoo/bar
19:48brehautbut i dont know ifthats what you are actually asking
19:49eightybrehaut: holy cow dude, this might be it. checking...
19:49hyPiRion,(doc symbol)
19:49clojurebot"([name] [ns name]); Returns a Symbol with the given namespace and name."
19:50brehauteighty: im pretty sure its not
19:51eightybrehaut: (load-string "Foo" "bar")
19:51eightyBOOM!
19:51mebaran151eighty: you'll probably have to reflect it (.getDeclaredField klass sname)
19:52eightymebaran151: oh nice! trying...
19:52mebaran151if klass is a string, (Class/forName klassstr) is your friend too (though it might have to be fully qualified)
19:54hyPiRionThe classname has to be the whole name though.
19:56hyPiRionFor instance won't ##(.getDeclaredField (Class/forName "Math") "PI") work, because its real name is java.lang.Math.
19:56lazybotjava.lang.ClassNotFoundException: Math
19:56mebaran151&(-> (Class/forName "java.lang.Integer") (.getDeclaredField "MAX_VALUE") (.get (Class/forName "java.lang.Integer"))
19:56lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
19:57mebaran151&(.get (.getDeclaredField (Class/forName "java.lang.Integer") "MAX_VALUE") (Class/forName "java.lang.Integer"))
19:57lazybotjava.lang.SecurityException: You tripped the alarm! package java.lang.reflect, Java Platform API Specification, version 1.6 is bad!
19:58hyPiRionheh.
20:02mebaran151I wonder how the reader does it, with just Foo...
20:10powrtocI'm looking for a good clojure parser library... can anyone recommend one that works with clojure 1.3/1.4?
20:25gfredericksmebaran151: the reader returns a symbol
20:25gfredericksthe compiler or something turns the symbol into a class based on the ns imports and such
20:25gfredericks&(-> "Foo" read-string type)
20:25lazybot⇒ clojure.lang.Symbol
20:38mebaran151gfredericks: I'
20:39mebaran151gfredericks: 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:50gfrederickswell I imagine when you say (:import foo.bar.Baz) the compiler notes that "Baz" means "foo.bar.Baz"
20:52hyPiRionyeah.
20:52hyPiRionAnd usual java.lang is already "imported": ##(Math/pow 3 4)
20:52lazybot⇒ 81.0
22:05TimMc,(.importClass *ns* 'Math java.lang.Math)
22:05clojurebotjava.lang.Math
22:05TimMc,(.importClass *ns* 'M java.lang.Math)
22:05clojurebotjava.lang.Math
22:05TimMc,(M/abs -4)
22:05clojurebot4
22:06brehaut(inc TimMc )
22:06lazybot⇒ 1
22:06tmciverTimMc: hey, that looks like the renaming feature you were trying to implement before.
22:07TimMctmciver: hey, that looks like #'rename from org.baznex/imports :-P
22:08tmciverIs that new in 1.4?
22:10TimMcYep, according to the changelog.
22:11TimMcI haven't done much Java interop recently, so I haven't needed to scratch the import itch very much...
22:23kaoDis there any sane way to run clojure code sandboxed without using clojail?
22:23kaoDin other words: I want to run Clojure code using a sandboxed classloader
22:23kaoDand I want it to be easier that Clojail (or I'd be better using Clojail)
22:23kaoD(which I'm not reluctant to do, just checking)
22:25TimMcWhat's onerous about using Clojail? I haven't used it, so I'm curious.
22:27kaoDTimMc: what do you mean onerous?
22:28TimMcdifficult, burdensome, hard
22:29TimMcnot easy
22:29TimMc22:22 < kaoD> and I want it to be easier that Clojail
22:29kaoDit's not that it's hard
22:30kaoDI'm just accustomed to Java's sandboxing capabilities
22:33kaoDalso, TimMc, only blacklist
22:33kaoDI'd prefer whitelisting
22:34kaoDsince I'm developing a very restricted plugin system
22:34kaoD(I just want math and not much more)
22:37TimMcHmm, interesting. I think you could write your own sandboxer for Clojail.
22:38TimMcerr, whitelister
22:40kaoDthat's what I wanted to check, if it could be easier doing my own hackish solution
22:40kaoDor just hacking into Clojail myself
22:40kaoD(or keeping with blacklist and just cross my fingers)
23:01ivanoh man, (require 'useful.io_test) works and then (useful.io_test/test-whatever) fails, frickin' underscores
23:02TimMchuh
23:03ivanthe namespace is useful.io-test
23:03TimMcBut the require appears to succeed?
23:03ivanyep
23:03TimMcWhat happens if you do (ns-publics (the-ns 'useful.io_test)) after the first require in a clean REPL?
23:04ivanuser=> (ns-publics (the-ns 'useful.io_test))
23:04ivanException No namespace: useful.io_test found clojure.core/the-ns (core.clj:3691)
23:19TimMc,(require 'clojure.core_deftype)
23:19clojurebotnil
23:19TimMcInteresting.
23:19TimMc,(require 'clojure.core-deftype)
23:19clojurebotnil
23:19TimMc,(require 'blah.foo)
23:19clojurebot#<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate blah/foo__init.class or blah/foo.clj on classpath: >
23:19TimMc,(require 'clojure.blah)
23:19clojurebot#<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/blah__init.class or clojure/blah.clj on classpath: >
23:19TimMcI got nothin'.
23:24tmciverTimMc: require must do a "-" to "_" conversion; in the first case it's not necessary?
23:24PeregrinePDXHello trptcolin.
23:24trptcolinPeregrinePDX: howdy
23:36kaoDhttp://theoatmeal.com/comics/tesla <- made me laugh
23:39jasonjcknkaoD: how factual is it?
23:39TimMctmciver: Mmm, and then it doesn't match the ns clause.
23:39kaoDjasonjckn: not sure about it all but there are MANY things that are right
23:39kaoDI'm not a Tesla expert but hey, he was actually awesome
23:40jasonjcknkaoD: *nods* he doesn't get enough credit