#clojure logs

2012-03-28

00:00ibdknoxmany are golfed into hell
00:09mknsxt: not the long ones then, and the ones that you can understand without needing to think through them
00:09mkibdknox: I think there's a bigger issue with newbies using long or awkward constructs than with people trying to golf their solutions down. You don't get points for a short solution
00:10ibdknoxhuh?
00:10ibdknoxwe're talking about 4clojure right
00:10ibdknox?
00:10mkyes
00:10ibdknoxthe guys who are really into 4clojure are absolutely golfing the solutions down
00:10ibdknoxyou *do* get points, in a way :)
00:11ibdknoxthe league mode is about trying to get the shortest possible answer
00:12ibdknoxwhich is definitely very neat to look at
00:12ibdknoxbut often far from idiomatic
00:12mkibdknox: do you have an example? Most of the initial ones look just fine.
00:12ibdknoxthe earlier ones probably don't have particularly clever solutions
00:12stirfooIs there a document that describes exactly what immutable means when applied towards the persistent data structures in clojure? The thing that bugs me is I can place say, a StringBuffer instance in a PersistentVector, then .append to it.
00:13stirfooI want to say, that's mutating the vector, but I just don't know.
00:13ibdknoxstirfoo: did the vector change? or the things inside of it?
00:13stirfooibdknox: right, right. and that was frontmost in my mind.
00:13ibdknoxmk: I don't have one at hand, don't spend much time there. I'm sure amalloy could point you to some though
00:14mkibdknox: I see - I think for the earlier problems the shortness heuristic is good - like I said, more newbies will end up doing something huge than experts will end up with something too short
00:14ibdknoxstirfoo: if you use a mutable structure in an immutable one, that structure will still be mutable. In general, you have to dip down into java-land for that to happen
00:16mkstirfoo: immutable means that clojure will never mutate your structures, and that clojure's structures will never mutate
00:17mkstirfoo: if you use java code on java structures inside clojure, then you lose the expectation of immutability
00:17stirfooI actually understand the persistent aspect fairly well. How a history of actions is kept. You conj onto a vector, you get the 'tail' back and a reference to the original vector. The original is unchanged.
00:18stirfoomk: ok, you've both cleared it up a bit for me, thanks
00:19mkstirfoo: the underlying mechanics of clojure differ from most lisps, but you usually don't have to worry about that - what's really important is the distinction between values and identities
00:19qbgthe reference identities never change
00:19mkrich hickey has some nice talks about this up on infoq
00:20mkthe important thing is that what you usually think of as a value (like an object), isn't really a value, it's an identity (which is a bit like a changing sequence of values)
00:21mkvalues never change, in the way that 1, "abc", and so on never change
00:22mkand this extends to composite values, like collections and struct-like things
00:27stirfooThe internals of clojure are just a joy to study. There's some mind-boggling stuff going on in there, and I don't even know java that well. ;)
00:29lynaghkWhat do you guys think about embedded languages that compile down to HTML or CSS (e.g. HAML and SASS in the ruby world, or Hiccup in Clojure world)
00:29ibdknoxlynaghk: ?
00:29lynaghkI'm pretty happy with HAML, but I'm looking at CSSgen (a Clojure project) and am on the fence about jumping over to it from Sass
00:30lynaghk(er, Hiccup, not haml. I'm using both, actually.)
00:30ibdknoxI've not seen a lot of benefit with cssgen really
00:31xeqithe big gain for me in the ruby world was compass
00:31lynaghkYeah; maybe it's just the amount of syntax compared to SASS but it doesn't look like a clear win to me (especially since I'm not doing any crazy CSS like I do crazy markup)
00:31lynaghkxeqi: that is the collection of Sass mixins so you could just say "+container" and stuff to get a grid going, yeah?
00:32xeqithat was part of it
00:32ibdknoxa watcher
00:32ibdknoxand such
00:32xeqithere were other parts that would abstract all the browser specific tags
00:33lynaghkxeqi: ah yeah. I can see that being a lifesaver if you need to worry about browser compatability.
00:33xeqifor gradients, rounded corners, etc
00:33xeqiclearfix back to ie6
00:33lynaghkxeqi: you do a lot of frontend work?
00:34xeqidid web contracting for awhile
00:35xeqiso yes, but not great at the design part
00:36xeqiI haven't tried cssgen yet, but it would be hard to make me use it over bootstrap, less, or compass
00:36lynaghkibdknox: the appeal of CSSgen for me is to get everything in Clojure where it's easier to handle dependencies and compilation workflow. There is no mechanism in C2 right now to do CSS, and I feel gross either inlining strings (as in the examples) or just ignoring the issue and letting people fend for themselves.
00:36lynaghkxeqi: yeah, the ecosystem is a huge win.
00:37ibdknoxlynaghk: weavejester was working on a less compilation middleware I think
00:37ibdknoxseems to me that the simplest solution would be to just build a simple asset chain
00:38ibdknoxand let people use whatever
00:38pandeirocljs still has no official way to turn a clojure map into a js obj right?
00:38lynaghkibdknox: I'm not sure what you mean.
00:39lynaghkibdknox: in the case of something like noir, yeah, just give them extend via middleware or whatever. I'm not sure what would be analogous for C2
00:40ibdknoxlynaghk: why not have middleware there too? :)
00:40yoklovpandeiro: not that i've been able to figure out, i think you're just supposed to do it manually.
00:40lynaghkibdknox: uh oh...
00:40ibdknoxhaha
00:40ibdknoxyoklov: pandeiro: there's one in jayq
00:40ibdknoxbut nothing official
00:41lynaghkibdknox: though, now that I think about it, these kinds of styles aren't dynamic at all. Maybe just write a macro that calls out to Sass on Jruby or whatever at compile-time.
00:41mkpandeiro: a js map must take strings as its keys
00:41ibdknoxlynaghk: mhm
00:41pandeiroibdknox: what does jquery do on that front?
00:41ibdknoxpandeiro: nothing, but I needed it, so there's a util for it
00:41yoklovmk: yeah but keywords in cljs are just strings
00:41yoklovthough if you want it in normal js you'd have to call name on them
00:42yoklovor enter weird unicode
00:42mkyoklov: right - I was thinking of maps that map arbitrary values
00:42yoklovoh, yeah those would be trickier.
00:42pandeirojust reflected on that being a major part missing while playing with the online compiler tonight
00:43mkpandeiro: I haven't heard the issue come up for people using cljs to do things
00:44mkthat may or may not be reassuring
00:44ibdknoxit's a common need if you do any interop
00:45lynaghkmk: I think everyone just googles around until they find mmgrana's gist
00:45pandeiroyeah i mean json is the language
00:45ibdknoxyep lol
00:45pandeirolynaghk: `fogus should add that link to his compiler maybe
00:47pandeirolynaghk: btw i did battle with c2 for hrs today, it won
00:48lynaghkpandeiro: what were you having trouble with?
00:48pandeiroi concluded it's not possible to use c2.geo.core in a noir view - vrepl works great
00:48pandeirobut geo->svg doesn't work when i require the ns
00:48lynaghkwere you AOT compiling?
00:48pandeiroshit
00:48ibdknoxok
00:49ibdknoxwe should turn that off
00:49lynaghkthere is a bug in core.match
00:49pandeirowas i supposed to? or not?
00:49ibdknoxpandeiro: in project.clj :main add ^{:skip-aot true}
00:49ibdknoxso it'll look like
00:49lynaghkI opened a ticket on JIRA a few weeks ago about it, but it's not a priority for David or I to dig into
00:50ibdknox:main ^{:skip-aot true} mycool.server
00:50lynaghkyeah, that bug with geo->svg took me a few hours to track down because everything is peachy in the REPL.
00:50pandeiroweird i was trying to test that match expression too but i thought the prob was geo->svg
00:50pandeirothe way it defines project and the other fn i cant remember now
00:50pandeirothose are present but unbound when you require c2.geo.core
00:51lynaghkAs far as I know, it works, but I've only tried with the geoJSON that is included in vomnibus. If you keep having trouble feel free to open up an issue on the githubs.
00:51pandeiroalright i will check it out again tomorrow after skipping aot
00:52pandeirohopefully that resolves it
00:52WrecktumAnybody here sick of niggers?
00:52WrecktumI sure as hell am!
00:52WrecktumThat is why I joined
00:52Wrecktumchimpout
00:52Wrecktum.com
00:52Wrecktum /forum
01:01yoklovso, in clojurescript how do people deal with the state inherent in js events? (e.g. click toggling)
01:02yoklovthrow caution to the wind and let there be atoms?
01:03pandeiroyoklov: yeah most code i've seen uses atoms
01:35ibdknoxstatemachines!
01:47muhooyoklov: waltz :-)
01:48Raynesibdknox: Blue butterflies!
01:48muhooflying spaghetti monsters!
01:49muhoosorry, finite state machines. still, everytime i see FSM, i thank His Noodly Appendage.
01:49yoklovi looked at that, it seems really neat but i don't know if it makes sense here… i have several button-like objects
01:49yoklovseveral as in a large 2d array
01:50ibdknoxdo they all only have single states?
01:50ibdknoxif so just use classes
01:50yoklovthey all have a finite number
01:50yoklovhm
01:50yoklovctually they are all exactly finite state machines themselves
01:50ibdknox:p
01:51ibdknoxI win ;)
01:51yoklovhaha, yeah.
01:52jblomois it possible to use gen-class to extend a parameterized type?
01:53jblomoi noticed http://groups.google.com/group/clojure/browse_thread/thread/5efd692804df3f47 and see that the work around was to create an intermediate class in Java, but wanted to see if that had changed
01:53jblomoor if i was misunderstanding it
02:08amalloyjblomo: i don't think it is, exactly, but the good news is you don't really have to - type parameters are a nicety for javac, not a key component of the classfile
02:16jblomoamalloy: it looks like the framework expects a java.lang.reflect.ParameterizedType, so somehow it seems like Java is recognizing it after erasure
02:16jblomohmm, maybe I could just implement that interface
02:17amalloyyeah, i think if they're using reflection they can manage to make it impossible for you
02:18lynaghkDoes anyone know how exactly GSoC students are supposed to sign up?
02:19lynaghkI know they have a deadline in a week. Some people have emailed me about working on C2; should I just tell them to submit something at http://www.google-melange.com/gsoc/homepage/google/gsoc2012
02:37beffbernardHow do I make this unlazy? (read-string (take 1 lines))
02:38ibdknoxlynaghk: yeah I think they have to submit a project proposal
02:38ibdknoxI'm kind of confused about it myself
02:42Raynesibdknox: It's late.
02:42Raynesibdknox: Y U NO SLEEP?
02:42ibdknoxsrsly
02:42ibdknoxcuz I'm retarded
04:41echo-areaSuppose I specify A as dependency, and B as dev-dependency, but B depends on A too. Leiningen complains there are multiple A's in the classpath.
04:42echo-areaHow to resolve this besides setting LEIN_SNAPSHOTS_IN_RELEASE?
04:50echo-areaOh, there are two different problems
04:53clgvI am experimenting with JPPF to execute Jobs on remote computers. Therefore I derive a task implementation from JPPFTask via proxy. The JPPF framework needs to load that class when submitting the task. unluckily, I get a ClassNotFoundException at that time. THe first thing I noticed is that JPPFClient (and all the other JPPF classes) have AppClassLoader as ClassLoader while my task implementation has Clojure's DynamicClassLoader as ClassLoader.
04:55clgvIt makes sense that the AppClassLoader does not find my task implementation since the DynamicClassLoader is a child of the AppClassLoader and lookup is performed in parent direction. what can I do to solve this?
05:05LajjlaSo, gentlemen, again, is ##(let [some-datum (list (symbol "I worship His Shadow"))] (= some-datum (read-string (print-str some-datum)))) a bug or a feature?
05:05lazybot⇒ false
05:06clgvLajjla: symbols must not contain whitespaces. there should be an error. hopefully that will be implemented
05:07Lajjlaclgv, yes, one would assume, so it's a bug that ##(symbol? (symbol "I worship His Shadow"))
05:07lazybot⇒ true
05:07LajjlaOr (symbol ":appparently-this-is-not-a-keyword")
05:08clgvLajjla: yes. but it is also known - there were several other examples that violated symbol rules
05:09Lajjlaclgv, ah, okay, I guess people have more important things to do then I guess, I'm no expert, the MicroSoft Chief Software Architect is stilla biove but it seems reaaaaaaaaaaaaaaallly trivial to fix this to me.
05:10clgvLajjla: there are other issues where warnings/errors are also missing, e.g. usage of & in protocols
05:10LajjlaAh okay
05:10clgvI have no clue why they are still around
05:10LajjlaMy earnest opinion is that this is very sloppy honestly.
05:11LajjlaTo just stick a symbol tag on a string like that without any form of validation
05:14clgvhmmm but a quick search on the issues with "symbol" in their topics doesnt yield any matching ticket.
05:16Lajjlaclgv, ah, okay
05:16Lajjlaclgv, would you for me make it?
05:16LajjlaI would appreciate it and be aeternally thankful
05:18clgvI have no jira account there
05:18LajjlaNo idea what that is, but bawww.
05:18clgvthere management system where you can create issues.
05:18LajjlaCan has hug instead?
05:18LajjlaAhh
05:18clgv;)
05:23clgvLajjla: are you writing some macro or why do you need to create symbols indirectly via 'symbol?
05:25Lajjlaclgv, not at all, I don't use clojure, I was just fooling around and noticed that (symbol "string which isn't a symbol") didn't return an error, then I decided to print it out and I found it sloppy so I wanted to know if it was a feature or a bug.
05:29clgvhmm would have been a good issue for clojure 1.4 since they wanted to improve documentation and errors afaik
05:29clgvbut I dont see any change in the master branch
07:59solussdivan: are you referring to that thread on the mailing list?
08:00solussd{{'this 'is 'ugly 'and 'inconsistent}}, #{'at 'least 'I 'know 'this 'is 'a 'reader 'macro}
08:23BelafHello everybody, if I have a java class with a private constructor, is there any way to extend it (gen-class) in clojure?
09:26ChironI need to use MongoDB, I create a couple of vars like (def mongo-url *url* "...") (def *collection* "....") . Any better idea? how to be idiomatic?
09:41acagle /flush
09:41duck11231Chiron: Have you looked at the two big mongo libraries for clojure? They both do a pretty good job of making it idiomatic
09:42Chironactually I need to use Mongo with Storm, I found a library for that called Storm-Mongo
09:43Chironhttps://github.com/christkv/mongo-storm
10:41TimMcJust changed the Wikipedia article on Clojure to have an italicized "j". We'll see how long that lasts.
10:41TimMchttps://en.wikipedia.org/wiki/Clojure
10:59clgvTimMc: lol is that the TM version? ;)
11:00TimMcclgv: trademark?
11:00clgvyeah :P
11:00TimMcNo idea.
11:11clgvI have an old project.clj where a leiningen plugin for native deps is used - is that still the way to go?
11:31clgvargs. is there no working leiningen support to get native dependencies transitively?
11:51dnolenlynaghk: metadata core.logic patch applied, thanks much
12:24lynaghkdnolen: thank you. I had quite the adventure in logic.clj figuring out what I needed to change = )
12:24dnolenlynaghk: haha, I'm excited about how many people have looked at core.logic's internals now :)
12:25lynaghkdnolen: while I have you here---what should I tell students about GSoC
12:25dnolenlynaghk: hmm, what do you mean?
12:25lynaghkseveral people have contacted me about working on C2 this summer.
12:26lynaghkShould I tell them to go over to the google melenage site and sign up and submit a proposal?
12:26dnolenlynaghk: yes, or say they are applying for an existing proposal.
12:26dnolenthere's only a week 1/2 or so for them to submit.
12:26lynaghkAnd does Google just fund everything we come up with, or will the core team be sitting down to pick out the most promising projects from the student proposals?
12:27lynaghkdnolen: yeah, thankfully the first student who contacted me mentioned that, so I rushed out some posts to various mailing lists = )
12:29dnolenlynaghk: we'll have to pick the most promising proposal/student/mentor combinations
12:29lynaghkdnolen: any idea how many slots Clojure/core will get from The Google?
12:30dnolenIn our organization form I said we'll have at least 4 killer projects we absolutely want to move forward with, and I've requested that in an ideal world we could do 8
12:31lynaghkdnolen: alright, sounds good. I'll keep my fingers crossed that some old-hat schemers are on the GSoC funding committee = )
12:31dnolenlynaghk: yes :)
12:38pandeirolynaghk: was the aot with c2.geo.core, thanks ... want me to fork and add to the README or something?
12:39technomancyecho-area: the dev-dependencies/dependencies split in lein1 is really nasty; lein2 does away with it entirely
12:41technomancyclgv: lein should pull in native deps transitively as long as they're formatted correctly
12:41technomancybut it doesn't support cakes jar-in-a-jar scheme
12:41technomancyoh, and good morning everyone
12:41clgvtechnomancy: what do I have to add to project.clj for native-deps in 1.7.1?
12:43technomancyclgv: it should scan all the jars brought in by :dependencies for native components
12:44clgvtechnomancy: so I dont have to add anything to project.clj?
12:45technomancyshouldn't have to
12:46clgvhmm maybe the layout of the dependency is wrong. its: jriengine 0.8.4
12:48technomancyyeah, some older jars use a cake-specific layout
12:48clgvtechnomancy: jriengine has a "native" and " lib" dir. seems the lib dir is not extracted
12:49technomancyyeah, you'll have to declare the jars in there as real dependencies if jriengine doesn't declare them
12:50clgvah ok
12:53lynaghkpandeiro: what exactly do you want to change?
12:54lynaghkpandeiro: if you itchin' for a project, you could try figuring out what the underlying issue is in core.match and submit a patch for that.
12:56bsteuberin cljs, I am trying to generate (try ... (catch js/Error ..)) from a macro, which gives an "Assert failed: Can't qualify symbol in catch" - any ideas?
12:58chousertechnomancy: btw, I have most of the longbottom features in clj-stacktrace, but there are a couple bugs yet.
12:58pandeirolynaghk: actually the little testing i did of match didn't reveal any bug, but you think the issue is there? i just changed the readme to recommend skip-aot, is that not a good idea?
12:59lynaghkpandeiro: I am pretty sure it is an AOT issue with match---if you manually macroexpand the match clause in a REPL and inline it, then AOT will work fine.
13:01autodidaktoI wish people would provide more info about their projects on clojars. Sometimes it's just half a sentence and no github link. Am I right or am I right?
13:01chousertechnomancy: unfortunately, other priorities have come up so I've pushed what I've got to https://github.com/LonoCloud/clj-stacktrace and hope to get back to it in a week or so.
13:01lynaghkpandeiro: It's a pretty specific bug, so I don't really want to confuse people by mentioning it in the README---if you want, open up an issue on github and I'll look into it after I push through on cljs code generation stuff (though, that could be a week or two)
13:05technomancychouser: no worries
13:12autodidaktoCan anyone suggest good, general purpose leiningen plugins to pimp my lein? I found difftest and clj-stacktrace. I'm wondering what else I'm missing out on.
13:14RickInGAautodidakto: cljs-build
13:17RickInGAautodidakto: Assuming you are not on version 2 yet, lein-newnew
13:27autodidaktoRickInGA: thanks, I'll check those out
13:27TimMcwait wait wait
13:28TimMcHiccup just concats strings into its HTML? It doesn't escape them?
13:29TimMchttps://github.com/andrewvc/rocksandsand/blob/master/src/rocksandsand/views/index.clj <-- I'd expect line 21 to have " <> " instead of " &lt;&gt; "
13:29autodidaktoTimMc: I think you need to use escape-html *googling*
13:29TimMcugh
13:30autodidakto"One thing to watch out with hiccup is that content is not escaped by default; you need wrap it in escape-html or its alias h. This is an unfortunate default that you definately need to be aware of if you choose to use hiccup."
13:30TimMcI thought we got over this shit a decade ago.
13:30autodidaktohttp://brehaut.net/blog/2011/ring_introduction
13:30autodidaktoheh
13:32TimMcEvery time you write an HTML templating toolkit that doesn't escape by default, an Estonian bot herder eats a kitten.
13:32autodidaktowhat's a bot herder?
13:33TimMcController of a botnet.
13:33alexyakushevDoes anyone tried dynamic compilation on Android?
13:34autodidaktoTimMc: ahh, gotcha. Reasonable complaint though. I wonder what the hiccup guys' excuse is.
13:35TimMcThere is none.
13:35pandeirodoes this map literal have an even number of forms? {:advanced {:externs ["resources/jquery.js"]}}
13:36TimMc,{:advanced {:externs ["resources/jquery.js"]}}
13:36clojurebot{:advanced {:externs ["resources/jquery.js"]}}
13:36TimMcyup
13:37autodidaktoTimMc: Heh. Yeah, I'm a HAML fan, and I wasn't overly excited when I checked out clojure's templating options...
13:37TimMcautodidakto: Luckily, the web server I am contemplating writing will not need to produce HTML.
13:38autodidaktoTimMc: Web server? Sounds interesting. What are the servers clojure has now?
13:39TimMcI guess "web server" is ambiguous, isn't it. Web service, actually.
13:39TimMcI'm looking into noir.
13:39autodidaktoTimMc: ahh ok I see
13:39autodidaktoTimMc: Something interesting for public consumption?
13:41TimMcNah, just an API server for something internal.
13:42pandeiroTimMc: speaking json or clo/j/ure?
13:45TimMcjson
13:46TimMcIt's an experimental platform with a couple of query endpoints and a UI server that talks to them... except we keep experimenting with new UIs, and it's time to separate out some of the business logic into an API server.
13:47TimMcI'm advocating for Clojure, since it's fast to write and rewrite.
13:47TimMc(off to a meeting)
13:49autodidaktoTimMc: Keep fighting the good fight, homeboy
13:52jaenautodidakto: HAML is pretty cool, but I think Enlive isn't that bad either
13:53devnwhat do i need to do here? ##(map #(symbol (str "\u" %)) (range 800 850))
13:53devn,(map #(symbol (str "\u" %)) (range 800 850))
13:53clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid unicode escape: \u">
13:55autodidaktojaen: I'm reading about enlive right now. It's approach is different and interesting
13:56devnwhat do i need to do here? ##(map #(symbol (str "\u" %)) (range 8000 8025))
13:56devnwhoops, figured out the issue, disregard
13:56autodidaktojaen: you recommend it?
13:57devn&(map #(symbol (str "\u" %)) (range 8000 8025))
13:57lazybotjava.lang.RuntimeException: Invalid unicode escape: \u"
13:57devnmaybe not, heh
13:57autodidaktodevn: heh
13:57Chousukeyou sure you don't want "\\u"
13:57jaenautodidakto: actually, I didn't try it yet in anything big, but I like the approach
13:57jblomodoes clojure expect to use sun/oracle java? does it reply on it?
13:57Chousuke+? :p
13:58autodidakto,(map #(symbol (str "\\u" %)) (range 800 802))
13:58clojurebot(\u800 \u801)
13:59devnautodidakto: nah, i figured out the problem
13:59devnit's this:
13:59devn,(str "\u" "8000")
13:59clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid unicode escape: \u">
13:59devn,(str "\u8000")
13:59clojurebot"耀"
13:59devn,(symbol "\8000")
13:59clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Invalid digit: 56>
13:59devn,(symbol "\u8000")
13:59clojurebot耀
14:00devni want to build up a string that is \u8000, but str will make it a string and i want it as a symbol
14:00autodidaktohmm
14:00devnnot sure how to accomplish that
14:01autodidakto,(symbol (str "\u8000"))
14:01clojurebot耀
14:02autodidakto,(symbol (str "\\u" "8000"))
14:02clojurebot\u8000
14:03jblomo,(char 8000)
14:03clojurebot\ὀ
14:03pjstadigyou probably just want to use a method on java.lang.Character or something
14:03devnhaha, doh
14:04pjstadigthe \u is evaluated before the string object is even returned, so I don't think you have a chance of doing what you want
14:04devnnono that's fine -- i didnt know that char of int would handle higher values
14:04Bronsa,(str "\…u8000")
14:04clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unsupported escape character: \…>
14:04Bronsa,(str "\\u8000")
14:04clojurebot"\\u8000"
14:04Bronsaduh
14:04autodidaktohehe
14:05devn,(map char (range 8500 8510))
14:05clojurebot(\ℴ \ℵ \ℶ \ℷ \ℸ ...)
14:05devnThat's really all I wanted. Thanks guys.
14:05autodidaktolol np
14:05pjstadig,(char (Integer/valueOf "8000" 16))
14:05clojurebot\耀
14:05autodidakto,(char (Integer/valueOf "8503" 16))
14:05clojurebot\蔃
14:06autodidakto,(char 8503)
14:06clojurebot\ℷ
14:06pjstadig,(char 0x8000)
14:06clojurebot\耀
14:07autodidakto,"clojurebot: you break it, you buy it"
14:07clojurebot"clojurebot: you break it, you buy it"
14:14samaaronhow can i read a binary file into a byte array?
14:14technomancysamaaron: for some reason to-byte-array got dropped when clojure.contrib.io got promoted to clojure.java.io
14:14samaaronboo
14:15technomancyI think you can c.j.io/copy a j.io.File into a ByteArrayInputStream though
14:15samaaronoh, interesting
14:15pjstadigi was just going to suggest that
14:15samaarontechnomancy: oh, and whilst we're chatting - lein2 fails for me when I'm trying to start a swank server and I don't have a network connection
14:16samaaronI think it's trying to grab latest snapshots or something
14:16technomancysamaaron: oh, but not lein1?
14:16technomancyoh, I see
14:16samaaronnope, lein1 wins
14:16samaaronoh, also..
14:16technomancyI just added an :offline profile to lein2
14:16samaaronlein2 blows up if I have a .#foo.clj file in my project
14:16samaaronwhich emacs kindly places there for edited files
14:17technomancysamaaron: do you have :aot :all set?
14:17samaaronnope
14:17samaaroni've never used aot in my life
14:17technomancywonder why it would care about that
14:17samaaronsounds too much like aol for my liking
14:17technomancyoh buuuuurn
14:17technomancyyeah, aot sucks
14:19technomancycan you open issues for those two?
14:19samaaronsure
14:19autodidaktosamaaron: I suppose you're going to complain about the new :fasebuk option, too, eh?
14:19technomancythanks
14:22samaaronautodidakto: what on earth is the :fasebuk option?
14:22gtrak:fasebuk = files attributes since every batch unknown kool-aid
14:23samaaronsounds like gobbeldygook to me
14:23gf3ahem
14:23gf3it's obviously the FACEBOOK option
14:23gf3pfffft
14:23samaaron:-p
14:23samaaroni know that
14:23samaaroni just couldn't come up with similar puns in time
14:23gf3just like the new :maispaec
14:24samaaron:siri
14:24autodidaktonew? only the overtone kids use that
14:24samaaronthe overtone kids are a crazy bunch
14:25samaaronspeaking of overtone, i just got my new nanoKontrol2 hooked up
14:25samaaroni can even light up the buttons too
14:25samaaronsweet
14:25autodidakto*googles* nice
14:26samaaronthe bonus is that it fits in my bag
14:26autodidaktogot plans for it?
14:26samaaronwell, i'm always wanting to explore synth params
14:26samaaronand i'm sick of hitting C-x-C-e with new vals
14:27samaaroni want to slide a slider
14:27samaaronso now i can
14:27samaaronbasically, i'll expose the controller as a map where the vals are atoms
14:28samaaronwhich store the latest vals for all the controller components
14:28samaaronso you can start usign it for whatever you want
14:28samaaronyou can either poll with derefs or add watchers
14:29autodidaktosounds good. Having the right tools that let you quickly experiment is important for creativity.
14:29gtrakadding a watcher is kinda equivalent to skipping the atom altogether, no?
14:29gtrakevent to event, i mean
14:30samaarongtrak: yeah, overtone has an event stream you can listen in on
14:30samaaronbut it should also be possible to ask for the current state
14:30samaaronwithout having to have had already observed all the events
14:31samaaronso we'll have both :-)
14:31gtrakright, nice
14:31gtrakI was just thinking about the same thing recently, using an atom for the state in an update loop
14:31gtrakin a little physics simulation that happens to use quill :-)
14:32samaarongtrak: you mean like this monstrosity: https://github.com/samaaron/gen-art/blob/master/src/gen_art/awful_animated_rotated_lines.clj
14:33gtraksamaaron, something like that but much more monstrous, in fact, my update loop runs at 500Hz and the Processing loops polls it at 60 for drawing :-)
14:33samaarongtrak: you should be careful about using atoms within the Quil draw loop - you need to ensure that they're local to a given sketch
14:34gtraksamaaron, yea, I did that, I used applet/applet directly instead of defsketch
14:34samaaronone way to acheive that is to declare your atoms in a call to set-state!
14:34gtrakthere are still some subtleties about the dynamic scoping that I have to work through
14:34samaaronwhich stores the state within the atom
14:35gtrakif you're curious: https://github.com/gtrak/quilltest/blob/master/src/quilltest/core.clj for the loop and https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj for the main prog, though it's not ready yet
14:36samaaronwow
14:36gtrakI also proxied KeyListener so I could take control of keys
14:36samaaronyou're doing much more work than necessary
14:36gtrakheh, I imagine :-)
14:36gtrakjust messing around
14:36samaaronyou don't need to do any of that proxying stuff
14:36samaaronI need to document stuff too :-)
14:37gtraksamaaron, that semaphore thing, I stole from stackoverflow, it's actually interesting :-)
14:37samaaronso, first declare all your sketch state in set-state! within your setup fn
14:37gtrakhttp://stackoverflow.com/questions/5274619/investigation-of-optimal-sleep-time-calculation-in-game-loop
14:37samaaronthen take a look at the handler options in https://github.com/quil/quil/blob/master/src/quil/core.clj#L4300
14:38samaaronyou've got :key-pressed, :key-typed, :key-released
14:38samaaronI've done the proxying for you :-)
14:38gtrakyea, I tried to use the key-pressed functions, but it seemed like it was only happening once per frame? maybe I was doing it wrong
14:38Raynessamaaron: https://github.com/technomancy/leiningen/issues/477 Respond, damn you
14:38samaaronoh yes, definitely once per frame
14:38samaaronat the end of a frame draw
14:39gtraksamaaron, mine is not once-per-frame
14:39samaaronoh, weird
14:39samaaronwhy do you want that?
14:39samaaronRaynes: what happened to your gentlemanly manners?
14:39gtrakI keep a set of currently pressed keys, then I look at the atom in my update loop
14:39gtrakit works well
14:39Raynessamaaron: They began to wane along with the length of time I sleep at night.
14:40samaaronRaynes: you should be careful about that - good sleep is super important
14:41technomancyRaynes: maybe it's all the elixir you're consuming
14:41RaynesBahaha
14:41gtraksamaaron, it acts just like the midi device you just described, would you rather poll a keyboard at 60fps or act on it as an event stream?
14:41technomancyare you sure it isn't a jekyll/hyde kind of brew?
14:42gtrakbasically I couldn't make the 'set of currently pressed keys' thing work unless I did that
14:42Raynestechnomancy: My URI library is now in Elixir proper. Hard work payed off.
14:43technomancyso they accept pull requests then? =)
14:43technomancythat's cool
14:44samaarongtrak: if i'm using the keyboard events to control my sketch, i'm happy to poll at the current framerate
14:44samaarongiven that i can't do anything faster than the current framerate anyway (in terms of drawing)
14:44gtrakright, I think it's a consequence of my asynchronous update loop existing
14:44Raynestechnomancy: Yeah, dude, it's like they *want* contributions. Blew my mind.
14:44technomancymust be refreshing
14:44Raynestechnomancy: I actually have commit rights now though.
14:44technomancysweet
14:45Raynestechnomancy: To put it in perspective, I started using this language less than a week ago.
14:45autodidaktoIs this elixir-lang you speak off?
14:45autodidaktoof
14:45RaynesAye
14:45gtraksamaaron, well, the key thing works great, but I notice there's a little jitter in the drawing, probably due to GC
14:46autodidaktoI just stumbled across it's webpage. Looks interesting.
14:46samaarongtrak: the problem is that processing isn't as effecient as it could be
14:47gtraksamaaron, I imagine I'll end up implementing most of it if I keep on this path, haha :-). I'm new to processing,awt,swing and stuff
14:47technomancysamaaron: according to some guy in #android they considered using processing for the android graphics, but they found they could get better perf out of an 800MHz phone with their own stuff vs processing on a 2GHz desktop =(
14:47technomancy"they" being google
14:47samaarontechnomancy: doesn't surprise me at all
14:48samaaronI see Quil more as a fun toy and a prototying tool
14:48samaaronit's like a graphics gateway drug
14:48gtraki do very much like how easy it is for me to visualize stuff and focus on business logic, without having to worry about the specifics so much
14:49samaarongtrak: yeah, that's exactly the point :-)
14:49samaaronalso, if you use the :opengl renderer, things tend to go faster too
14:49BronsaWHAT'S A GOOD INTRO TO HASKELL?
14:49samaaronbut you need lein2 for that
14:49Bronsaoh gosh, sorry for the caps
14:49Iceland_jackBronsa: ...
14:49samaaronBronsa: LEARN ME A HASKELL
14:49gtraksamaaron, I'll show it to you once I get collision detection working :-), I'm a few days away
14:49Bronsathanks
14:49samaarongtrak: awesome
14:49Bronsadidnt mean to yell it
14:50samaaronBronsa: THAT'S OK!
14:50Bronsanow you're making me feel unconfortable.
14:50samaaronBronsa: I suggest remapping your CAPS LOCK key to CTRL
14:50samaaronit's much handier that way
14:50Bronsaemacs?
14:50clojurebotemacs is best configured for Clojure with instructions at http://technomancy.us/126
14:51samaaronclojurebot: you're forgetting the overtone/live-coding-emacs config
14:51clojurebotNo entiendo
14:51Bronsai do actually like the position of CTRL
14:51RickInGAsamaaron: that live coding config is fantastic
14:52samaaronRickInGA: why thank-you very much
14:52RickInGAor, at least I started to think so once I learned to live without a menu bar :)
14:52samaaronhaha
14:52llasramThat one line patch to clj-processing has really paid off! :-)
14:52samaaronllasram: haha :-)
14:53RickInGAsamaaron: probably means nothing to you, but I am racked with guilt..... I am sooo sorry that I missed overtone hack night at clojure west
14:53samaaronRickInGA: ah, that's a shame - it was a lot of fun
14:53samaaronare you coming to EuroClojure?
14:54RickInGAsamaaron I am trying to think up an excuse why I have to, and I just can't come up with one yet
14:54samaaronRickInGA: well I'm sure there will be plenty of other awesome opportunities to get your Overtone on
14:54gtrakcheaper wine?
14:54RickInGAI need to find out when my nephew is graduating from high school, if it is that weekend I have to stay here, if it is the previous weekend.... we'll just see
14:56gtraksamaaron, is quil purely a processing wrapper, or could it use some extra stuff?
14:57gtrakin terms of contributions
14:57autodidaktoBronsa: Book length, Learn You a Haskell has a free and well formatted online version. Lisperati guy (conrad or wutever) has a intro to haskell for lisp people tutorial too
14:58emezeskeBronsa: I second "Learn You a Haskell...". It was really, really good.
14:58Bronsai'll go with that then
14:58Bronsathanks all
14:58RickInGAemezeske is it available to read free online?
14:59Rayneshttp://learnyouahaskell.com/
14:59autodidaktohttp://learnyouahaskell.com/chapters
14:59emezeskeRickInGA: Yeah, definitely!
14:59emezeskeRickInGA: Although I'd recommend paying for it, it's that good ^_^
15:00emezeskeRickInGA: It's under the CC license, so I think someone ported it to the ebook formats too
15:01RickInGAI have an online subscription from oreilly, and it is available there
15:01RickInGAdoes any one know if authors get any royalties when I read books on the oreilly site?
15:02autodidaktoRickInGA: Real World haskell, from oreilly, seems to be the second best book
15:03fdaoudemezeske as in lein cljsbuild auto?
15:03ibdknoxfdaoud: that's him
15:04fdaoudvery cool--thank you for that :)
15:04ibdknoxemezeske: you're famous!
15:04emezeskeWoo!
15:04emezeskefdaoud: Thanks, that's nice to hear.
15:04fdaoudyou guys are my heroes :)
15:04amalloyibdknox is just trying to deflect his own unwanted internet fame
15:04emezeskeamalloy: hahaha
15:04ibdknoxamalloy: shhhh
15:05samaarongtrak: at its core, Quil is just a processign wrapper, but there's definitely room for namespaces of associated goodies such as physics, scenegraphs etc.
15:05fprefectis there any advantage using send instead of send-off with agents?
15:05gtrakah, you see where I am going with this, then :-)
15:05mfexhey guys, i wrote a demo for cljs <-> clj communication with browserchannel: https://github.com/thegeez/clj-browserchannel-demo
15:06samaarongtrak: that's why i created the quil organisation ;-)
15:06jaenAs for Haskell I second the Learn You A Haskell For Great Good then Real World Haskell route
15:06RickInGAmfex thanks for link
15:06samaaroni see a sea of sister projects
15:07gtrakcoolio, I'll let you know if I come up with stuff, I can definitely break out the physics part of what I'm doing
15:08gtrakthough I'm no expert, pretty sure it will explode all over the place unless I use some real algorithms
15:09autodidaktojaen: I think what haskell needs next is a good learn-by-example, play-while-learning style book/tutorial. Like the "Haskell for the Evil Genius" tutorial, but longer
15:10rhcautodidakto: isnt that supposed to be what "learn you a haskell" is?
15:10jaenautodidakto: well yes, that was pretty short
15:11autodidaktorhc: Doesn't seem that way to me. It's well structured, building block by building block, but not really "have fun while learning". It's kind of intense. methinks
15:11autodidaktorhc: but definately well written, funny, and enjoyable
15:16Zokamfex: Looks good. At what number of concurrent connections one might see performance impact regarding sync vs async?
15:16samaarontechnomancy: unfortunately you can't c.j.io/copy from a File to a ByteArrayInputStream
15:16emezeskeautodidakto: I thought Learn You A... was one of the most "fun while learning" books I've read in a long time
15:17mfexZoka: I have no idea, the current deployment on heroku runs out of allowed connections before threads
15:18jaenCertainly does good job of not scaring people away
15:18autodidaktoemezeske: I believe you. I guess my criteria aren't very objective....
15:18jaenHaskell was my first foray into functional programming and I didn't bounce off with an attituted of FP being weird shit for weird people most people I know have ; d
15:18Zokamfex: So Heroku has limit on connections?
15:19emezeskeautodidakto: Well yeah, humor is pretty darn subjective :)
15:19autodidaktoemezeske: I like the humor alot..
15:20autodidaktoBut after doing the first several chapters, I still wondered "ok and this is a superior way of doing things because..?" Like, nteresting little applications of what you just learned
15:21mfexZoka, that's what I gathered. I haven't done any load testing comparisons of sync vs async
15:22autodidaktoA lot of what I've seen, concerning the power of haskell, are clean implementations of algorithms and math stuff. I'd like to see more variety... I know there are games too, though
15:22alfborgeIs there a better way to do this: (zipmap v (map #(and nil %) v))
15:22alfborge
15:23alfborgeI just want to create a hash-map with values key => nil for each key in v
15:23amalloy(zipmap v (repeat nil))
15:24alfborgeamalloy: Ah, nice... thanks.
15:24alfborgeMakes so much sense when you know it.
15:24mfexthe demo is here: http://cold-stream-6156.herokuapp.com/index.html
15:24amalloy#(and nil %) is atrocious, btw. if you want a function that always returns nil, just use (constantly nil)
15:26RaynesBahaha
15:26autodidaktoamalloy: that sounds like a good self-deprecating clojure blog name. (constantly nil)
15:26RaynesThat's pretty awesome though, amalloy.
15:26amalloyRaynes: what is?
15:26Raynes#(and nil %)
15:26alfborgeamalloy: Thanks, that's why I'm here asking for how to do it better.
15:27amalloyyeah, i confess it is a clever trick. i kinda prefer #(do % nil) if we're looking for clever/short ways to write it
15:27Raynesalfborge: You'll come to love amalloy. He may tell you your code is disgusting, but he always helps you make it non-disgusting.
15:28autodidakto,(#(and nil %) 42)
15:28clojurebotnil
15:28autodidakto,(#(nil) 42)
15:28clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0)>
15:29autodidakto,(#(do nil) 42)
15:29clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval83$fn>
15:29Bronsa,((fn [& _]) 42)
15:29clojurebotnil
15:29autodidaktoah
15:31autodidakto,((constantly nil) 42)
15:31clojurebotnil
15:34Prasadhow do I break out of for loop in clojure? i am trying to iterate over a vector and on some condition being true, there is some action and I want to break out of the loop
15:34autodidaktoSpeaking of atrocious code, I'm looking for advice on my pull request on clojure.dongs (https://github.com/danlarkin/clojuredongs/pull/3#issuecomment-4769820)
15:34RaynesYou can't 'break' out of a loop from any given location. You have to stop recuring at some point.
15:35Prasadwhen I am using for like a for each, how do I do that?
15:35autodidaktoprasad, you're talking about the for [ list list :when cond] list comprehension thingie?
15:36Prasadfor [i some-vector]
15:36amalloy:while
15:37Prasad(for [i list] (if (something) (break-after-doing (do-something) ) )
15:37Prasadwanted something like that
15:38AimHereamalloy's :while might be what you want
15:38amalloyif you're using `for` for side effects, it will only end in tears
15:38amalloyswitch to doseq
15:38autodidaktoit sounds like you looking through a list for the right thing, then doing something and exiting?
15:38Prasadautodidakto, yes
15:38amalloyoh, good point. don't use for or doseq
15:39amalloy(do-something-to (first (filter something the-list)))
15:39AimHereIf this sequence is lazy enough, couldn't you wrap it in a take-while?
15:39Prasadits a vector not a sequence
15:39autodidaktofilter the list, do run a function on the result
15:39AimHeretake-while works happily on a vector too
15:40hhutchPrasad: a vector is an ISeq, doseq works on any ISeq
15:40autodidaktoAimHere: I think he's like for a specific thing, then doing something with just that and moving on. not really manipulating the whole list
15:40autodidakto*he's looking for
15:41AimHereWell if he's just looking for a vector/sequence/whatever entry that fulfils a condition, then won't 'filter' work?
15:41AimHereErm, no, sorry, because it'll keep riffling through the rest of the seq, unless you put a 'first' in it and it's lazy or sth
15:42amalloy&(instance? clojure.lang.ISeq [1])
15:42lazybot⇒ false
15:42autodidaktoAimHere: it looks like amalloy is way ahead of us
15:42AimHereSo he is
15:42amalloyhhutch: vectors are seqable, not seqs. your point about filter is fine, just the details (ie, ISeq) are wrong
15:43Prasadso should I be trying filters?
15:43autodidakto,(println (first (filter #(= "yes" %) ["yes"])))
15:43clojurebotyes
15:44kurtharrigeris it possible to compile a clojure class file that (:imports a jova class without the static initializers in the java class being run?
15:46TimMcamalloy: ##(#(do %& 45) 1 2 3)
15:46lazybot⇒ 45
15:46TimMcMoar general purpose.
15:46amalloyyes, i'm aware
15:46TimMcand still terrible
15:47amalloykurtharriger: no. it's not possible to do that in java, either
15:47kurtharrigerwhen using zookeeper-clj :aot compilation will result in a bunch of zookeeper log output during compile... I found it seems to be that simply (import java class) runs the static initializers... not sure if there is a way to prevent that during clojure compile
15:47Prasadautodidakto, what does that line do? println..
15:47kurtharrigeryeah but you can compile java without running the code... kind of a weird mix here where compiling clojure code runs also runs it
15:48autodidaktoPrasad: type (doc println) in your repl
15:48Prasadautodidakto, I mean the complete s-exp that you suggested
15:49TimMckurtharriger: What's the use-case?
15:49amalloyit's kinda gross that zookeeper logs/activates just when you load the class. surely it should only do that if you call some methods at it
15:49autodidaktoPrasad: ok so... ["yes"] is the vector... i should have done ["yes" "no" "maybe"] as a better example
15:49amalloyyou can kinda fake it, if you're willing to forego the import
15:50amalloyusing the Class/forName trick to delay loading to runtime, if you don't need the class at compile-time (but then you can't, eg, typehint it)
15:50kurtharrigerIt looked like my project was attempting to connect to zookeeper during compile, which would fail if zookeepr is not running
15:50autodidaktoPrasad: I filter that vector with an anonymous function (using the #( %) shortcut). It tries to find the word "yes"
15:50RaynesMan, where is brehaut. We need to talk about music and the merits of coffee.
15:50Prasadautodidakto, aah, got it, thnks
15:50kurtharrigerit seemd that simply importing a java class with static initializer is causing the issue... but not sure how to prevent it from doing that... perhaps I could move the import into the defn
15:50autodidaktoPrasad: first grabs the first result (there could be many "yes"'s), then i print it :)
15:51autodidaktoPrasad: np
15:51gtrakkurtharriger, eval
15:52alfborgeamalloy: Thanks, that's why I'm here asking for how to do it better.
15:52alfborgesorry, wrong buffer...
15:52TimMcRaynes: brehaut is in NZ. Next question?
15:53RaynesTimMc: Yes, but he is always around when I'm around. At least, usually.
15:58gtrakkurtharriger, check out https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging/impl.clj#L41 for an example
16:00devnjust compiled core.cljs to C
16:00devncrazy.
16:00alfborgeIs there a reason why the following won't work: (map #(ref-set m (assoc @m % %)) input)? It's within a dosync and m is a ref.
16:01alfborgeto a hash-map
16:02kurtharrigergtrak: ah cool thanks
16:02gtraknp
16:02replacadnolen: does core.match do any binding? I want to match a map/vector nested crazy combo and pull some values out in addition to verifying the structure.
16:02gtrakkurtharriger, actually the line above is the one that actually causes the class to get loaded
16:03gtrakthe eval is there so the code doesn't have to compile to it
16:03dnolenreplaca: it does do binding - word of caution core.match has many edge case bugs and few patches at the moment.
16:03kurtharrigerok, I'll play around with it
16:04replacadnolen: is there a binding example? I don't see anything in the readme (but I may be blind)
16:04dnolenreplaca: :as
16:04kurtharrigerit looks like its just reading config and logging config values not actually trying to connect
16:04dnolenif you want to capture a whole part of the pattern and give it name, otherwise just using variable will create bindings
16:04Raynesalfborge: Using ref-set is a 'side effect'. You don't want to use map for that. Besides that, ref-set is a huge warning side. You almost certainly don't need it for what you're trying to do. Do you have a larger example of what you're aiming for that we can look at?
16:05replacaahh, ok so {:a a} is like (let [a (get ... :a)] ...) ?
16:05gtrakkurtharriger, well, if you want more control over when a class gets loaded, you'll have to use reflection, as in that example
16:05alfborgeRaynes: I'm playing with the Anagram kata and I'm generating an anagram dictionary.
16:05kurtharrigerI don't need aot here either but I find that during development if I compile with aot I find typos and such I wouldn't find otherwise till runtime
16:07pipelineall we need is a flymake-clojure ;)
16:08ibdknoxdnolen: what'd you show for your demo the other day? :)
16:08alfborgeRaynes: I was just surprised that the ref-set within the map didn't work.
16:08gtrakpipeline, flymake-clojure is paredit, I thought :-)
16:09pipelinegtrak: I can't stand paredit for whatever reason
16:09deechHi all, does anyone know if Clojure has a Spring DSL? Something like this: http://code.google.com/p/dynaspring/
16:10dnolenibdknox: I have a whole file that I can run in Sublime Text 2 running against Chrome (I don't reveal that to the end)
16:10gtrakwell, not sure what else would count as 'syntax' to be checked
16:10dnolenibdknox: I show the basic of the language - yesterday I showed core.logic running, people were pretty impressed by that.
16:10dnolenibdknox: folks were also pretty impressed by GClosure compression
16:10ibdknox:)
16:10samaaronhow can i read in a file containing binary data into a byte array?
16:10samaarondnolen: I started reading the Reasoned Schemer yesterday
16:11samaaronI need to find some jam to make the required stains
16:11ibdknoxdnolen: you're using st2 for your clojurescript stuff?
16:14alfborgeHow about this? How would I make this work? (hash-map (map #('(sort %)) v))
16:15samaaronalfborge: what are you trying to do?
16:17gtrakalfborge, map creates a lazy sequence, a ref-set is a side-effect, it will only perform it when you realize the seq
16:18alfborgegtrak: Thanks, that explains it. :)
16:18gtraknp :-)
16:18alfborgesamaaron: The latter is an attempt to, given a vector, create a hash map of the items in the vector with the sorted item as key and the item as value.
16:20samaaronalfborge: so is v a seq of seqs?
16:20alfborgev is a seq of strings
16:20samaaron(def v ["foo" "bar" "baz"])
16:21samaaronand what would you like the output to look like?
16:21alfborge{"abr": "bar" "abz": "baz" "foo": "foo"}
16:22samaaron,(sort "bar")
16:22clojurebot(\a \b \r)
16:22samaaronso you have to deal with the fact that you'll get a seq of chars
16:22samaaron,(apply str (sort "bar"))
16:22clojurebot"abr"
16:22alfborgeI don't really need to :)
16:22alfborgeI don't mind a seq of chars
16:23mfex,(group-by sort ["foo" "bar" "baz" "zab"])
16:23clojurebot{(\f \o \o) ["foo"], (\a \b \r) ["bar"], (\a \b \z) ["baz" "zab"]}
16:23mfexhandles doubles as well
16:24alfborgemfex: nice
16:24samaaronmfex: oh awesome
16:24samaaronhadn't thought of group-by
16:24pandeiroibdknox: any idea what would be causing weird reader errors (map literal requires even number of forms) from noir.cljs.watcher/start or thereabouts? off-hand? (i have skip aot)
16:24alfborgemfex: But I'd love to know how I'd make my naive attempt work as well.
16:24alfborgemfex: As that paints a picture of a hole in my understanding. :)
16:24samaaron,(into {} (map (fn [s] [(apply str (sort s)) s]) ["foo" "bar" "baz"]))
16:24clojurebot{"foo" "foo", "abr" "bar", "abz" "baz"}
16:24ibdknoxpandeiro: gist of server.clj?
16:25ibdknoxwhat version noir-cljs?
16:25samaaronalfborge: that's more like your solution
16:25gtrakugh, I needed group-by last night, thanks mfex :-)
16:25samaaronbut group-by is far more elegant
16:25gtrakthis is why I hang out with you guys
16:25alfborgesamaaron: thanks, and I totally agree
16:26pandeiroibdknox: http://sprunge.us/MhbO
16:27ibdknoxpandeiro: which version of noir-cljs?
16:27pandeiro0.3.0
16:28ibdknoxnot sure
16:29Raynesibdknox: Howdy friend.
16:29pandeiroi tried to build the cljs-template scaffolding in an existing project by copying stuff over manually
16:29pandeiroi guess i can eventually create the template and migrate my work over
16:29mattmitchelli have a ring/compojure app here, and I want to test that one of my handlers properly sets a session value... anyone know how i can do that?
16:30ibdknoxRaynes: hola
16:30ibdknoxpandeiro: can you put up the full stack trace?
16:31TimMcdevn: What are you on about.
16:34pandeiroibdknox: son of a bitch is working now, i am completely baffled... sorry...
16:34ibdknoxhaha
16:34ibdknoxyay!
16:34ibdknox:)
16:34weavejestermattmitchell: You can just check the :session key on the response
16:34alfborge#(do [(sort %) %]) <- Is this right or is this atrocious?
16:35alfborgeAs opposed to (fn [s] [(sort s) s])
16:35samaaroni much prefer the latter
16:35alfborgeAny rules or style guides saying what's more apropriate?
16:35mfexalfborge, that do thing is imho nasty and for golf only
16:36alfborgegolf?
16:36samaaronalfborge: golf - writing the shortest program possible
16:36TimMcalfborge: (juxt sort identity)
16:37mfexwhen you want #() to return a vector use #(vector key value) or instead of map use (for [i items] [key value])
16:37mattmitchellweavejester: that's what I thought, but it's not there. I must be doing something wrong hmm.
16:37alfborgeTimMc: interesting, thanks. :)
16:37TimMcoy, that's mine!
16:38Somelauwgoldcode?
16:38Raynesgloldcode.
16:38weavejestermattmitchell: I'm not sure how it can not be there if you're setting the session on the response...
16:38johnkpaulusing clojurescript, is there a way to use the closure compiler to give type warnings for unimplemented protocols?
16:38zamaterianle
16:38weavejestermattmitchell: I mean, you've added a :session key to the response map you're returning, right?
16:39weavejestermattmitchell: And you're then saying that the response map you've added the :session key to doesn't have the :session key?
16:39mattmitchellweavejester: yes. It must be the app test helper I'm using
16:39TimMcRaynes: Well, I guess xe's been juxted. Close enough.
16:39weavejestermattmitchell: Hm… Are you testing before or after the standard middleware?
16:40mattmitchellweavejester: i believe its after, but clearly i'm needing to dig a bit on this one
16:41weavejestermattmitchell: If it's after, then the session middleware will have already consumed the :session key.
16:41mattmitchellweavejester: ahh ok
16:41weavejestermattmitchell: If you're using an in-memory session, you can supply your own atom and look inside it.
16:42beffbernardAnyone know if nth on a string is constant time?
16:43weavejesterOn a completely different topic, I really hate how Google documents things sometimes. Or rather doesn't. :(
16:43mattmitchellweavejester: hey thanks for your help!
16:43maiohow should I write InputStream to file?
16:44weavejestermaio: clojure.java.io/copy
16:44maioweavejester: thanks
16:47alfborgeI'm off. Thanks a lot for all the help. Wish I'd come here sooner :)
16:48pandeirowhat do most of you use for use/require substitutes at the cljs repl?
16:49ibdknoxpandeiro: just re-evaluate the ns form
16:50pandeiroibdknox: that's what i figured, thanks
16:51espringeI have a clojure.lang.Cons of characters, and I'd like to create a string. How is this possible?
16:51espringeI can't find a 'flatmap' style function, and flatten doesn't do anything
16:52eggsbyflatmap... catmap?
16:52eggsbymapcat
16:52eggsbyor (apply str [\a \b \c \d \e \f \g])
16:53eggsby&(apply str '(\a \b \c \d \e \f \g))
16:53lazybot⇒ "abcdefg"
16:53espringeAh, great. Thanks eggsby
16:53espringemapcat is really what im after
16:53espringethanks again
16:54eggsbynp espringe
17:00dnolensamaaron: cool!
17:00samaarondnolen: it's beautifully written
17:00samaaroni'm only at p20 though
17:00samaaronit takes a lot of brain power to push through
17:00dnolenibdknox: not my own stuff, but it's great for presentations - the no-distraction mode is great for focusing on code during presentation.
17:01dnolensamaaron: it is beautiful written and incredibly deep. I had to read it 4 or 5 times I think.
17:02samaarondnolen: I have the feeling I'll have to do the same
17:03dnolensamaaron: it's a radically different way of thinking about programs - you have to unlearn quite a bit I think. Once you do it seems obvious and simple :)
17:03samaaronyep, i get that feeling already
17:05dnolensamaaron: I think we'll be able to get a lot of mileage out of core.logic - jim duey's work on getting it to work under fork/join is still blowing my mind.
17:05samaaronwhat's he up to?
17:06eggsbywhat are you guys discussing? the reasoned schemer?
17:06jaenHuh, I just googled for st2 not realizing you mean sublime text and found a REPL plugin for it, how cool is that ; D
17:06samaaroneggsby: yup :-)
17:06dnolensamaaron: he figured out how to make core.logic run it's goal in parallel. Will & Dan et al have been working on that problem for a long time. jim duey got it working well enough for most tests to pass and not cause zebrao to take a perf hit - which is insane IMO.
17:06samaaronwoah
17:06eggsbyah, I am just reading 'The Seasoned Schemer', only just finished The Little Schemer last month
17:07samaaronis he seeing any performance improvements?
17:08dnolensamaaron: no, I think he's taking a break I think it required a lot of hammock time - even though in the end the modifications seem simple.
17:08dnolensamaaron: there's a fork-join branch on the main repo so anyone can take a look and he has a good blog post on it - http://www.clojure.net/2012/03/26/Messin-with-core.logic/
17:09samaaroni guess it's a granularity problem
17:10dnolensamaaron: probably - but it's promising that perf didn't decrease which is usually the case.
17:14samaarondnolen: for sure :-)
17:29jsabeaudryWhat is the appropriate way to access /dev/mem from clojure?
17:29jsabeaudryFrom what I have read you can't mmap device files
17:30pandeirowould it be possible to run a browser repl and a noir server in the same java process?
17:33TimMcDoes this still represent a sane way of using Clojure in a Jetty + Maven context? http://cemerick.com/2010/01/08/sane-web-development-with-compojure-jetty-and-maven/
17:34cemerickTimMc: not really
17:34LajlaChousuke, mitä perkeleen vittua on ##(let [some-datum (list (symbol "Minä palvon Hänen Varjoansa"))] (= some-datum (read-string (print-str some-datum))))?
17:34lazybot⇒ false
17:35TimMcWhat has changed?
17:35RaynesEverything.
17:35TimMc*Other* than that.
17:35TimMc&"ping"
17:35lazybot⇒ "ping"
17:36mkwhat are the various notations for the bots?
17:36weavejester& and ,
17:36lazybotjava.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and
17:36weavejester&(+ 1 1)
17:36lazybot⇒ 2
17:36weavejester,(+ 1 1)
17:36amalloyand also ##(inc 1)
17:36lazybot⇒ 2
17:36clojurebot2
17:37mk~help
17:37clojurebothttp://www.khanacademy.org/
17:37TimMchahaha
17:37cemerickTimMc: depends on what your environment is
17:37amalloy(inc clojurebot)
17:37lazybot⇒ 9
17:38mkthat does not seem functional
17:38cemerickif you are starting maven from the command-line, then it's pretty straightforward to ensure that your webapp starts an nREPL or swank server when it is loaded, whichyou can then connect to using emacs+SLIME or Counterclockwise or leiningen or repl-y or vimclojure, etc.
17:38TimMcoooh, nREPL, right
17:39TimMcI'd basically like to be able to stand up a noir instance and hack on it live, but also have a Maven-y way of packaging it up for use with a launcher, in this case Tanuki
17:40mkso &atstart and # #anywhere trigger the 1.3 bot, while ,atstart triggers the older one. ~ is the dictionary, and (inc name) does something inappropriate with usernames
17:40mkis that all?
17:41TimMcmk: And $ is the command trigger for lazybot
17:41TimMc$fire
17:41mk$isthatlike~
17:41TimMc$kill
17:41lazybotKILL IT WITH FIRE!
17:42mk$google clojure
17:42lazybot[Clojure - home] http://clojure.org/
17:42mkso not just a string-string map
17:42cemerickTimMc: Any ring app is amenable to packaging as necessary; I wouldn't let those requirements impact your interactive development objectives
17:43cemericki.e. if you like hacking with SLIME, keep doing that, and leave the packaging bits off to the side
17:43TimMcI think I've some homework and archaeology to do.
17:44TimMc(to learn about how this stuff is done in the standard Java case)
17:47wei_is there a "time" function that returns the time elapsed instead of printing it out? (I'm writing an http load test client)
17:47Iceland_jack(time (def a (printing-function))?
17:48Iceland_jacks/printing-//
17:50amalloywei_: http://groups.google.com/group/clojure/browse_thread/thread/47b2cf43e404c906/876d8f439b3a8334?show_docid=876d8f439b3a8334
17:53wei_amalloy: ty! exactly what i needed
17:56prasadguys, is there semantic difference between (first (filter #(not (bit-test 2r000000000 %)) [4 3 1 5 7 0 2 6 8])) and replacing a vector with one defined earlier in the code
18:01chouserno
18:02prasad&((first (filter #(not (bit-test 2r000000000 %)) [4 3 1 5 7 0 2 6 8])))
18:02lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
18:02chouser&(first (filter #(not (bit-test 2r000000000 %)) [4 3 1 5 7 0 2 6 8]))
18:02lazybot⇒ 4
18:02prasad&(first (filter #(not (bit-test 2r000000000 %)) [4 3 1 5 7 0 2 6 8]))
18:02lazybot⇒ 4
18:03prasadchouser, if I replace the vector with one defined before as (def moves [4 3 1 5 7 0 2 6 8])
18:03prasadit returns 0
18:03prasadinstead of 4
18:03prasadm I going wrong somewhere
18:04chouseryeah, the problem must be elsewhere, or 'moves' doesn't have the value you think it does.
18:05prasadchouser, i think i got it, i had changed some stuff, and forgot to recompile things
18:05prasadworking with counterclockwise
18:05prasadthnkx
18:06prasadchouser, is there any way to display the binary value upto 8 bits for number returned by this expr ?
18:08chouserwhat do you mean?
18:08chouser&[1 0 0 1 1 0 1 0]
18:08lazybot⇒ [1 0 0 1 1 0 1 0]
18:09chouser&(apply str [1 0 0 1 1 0 1 0])
18:09lazybot⇒ "10011010"
18:09chousersorry, gotta run.
18:14prasadchouser, i mean from 4 get 100
18:15prasadchouser, ok c ya l8r
18:26jblomoif you try to add metadata to an object not implementing IMeta, it'll be silently ignored?
18:28amalloyit'll explode violently
18:28amalloybut surely it's easier to just try it than to ask
18:29jblomo,^:has-meta Class
18:29clojurebotjava.lang.Class
18:29jblomo,(meta ^:has-meta Class)
18:29clojurebotnil
18:29jblomo,(meta ^:has-meta [])
18:29clojurebot{:has-meta true}
18:29jblomofair enough
18:31ipostelnikwill code like this (doseq [n (take 1000000 (iterate inc 0))] ....) actually create an internal list 1M entries while doseq runs?
18:35technomancyZoka: hey, having some fun with ringmon; thanks
18:35technomancydo you know why I'd periodically get org.codehaus.jackson.JsonGenerationException: Cannot JSON encode object of class: class javax.management.ObjectName: java.lang:type=OperatingSystem?
18:35ipostelnikapparently the answer is yes
18:35technomancyipostelnik: it will create a lazy seq
18:35ipostelnikwhy can't leading entries of of lazy-seq get gc'ed?
18:36technomancythey will get GC'ed if no references exist to them
18:36technomancyyou must be holding on to the head of the seq
18:39amalloyjblomo: you're not attaching metadata to the object java.lang.Class, you're attaching it to the symbol Class
18:40amalloy&(meta (with-meta Class {:has-meta true}))
18:40lazybotjava.lang.ClassCastException: java.lang.Class cannot be cast to clojure.lang.IObj
18:41ipostelniktechnomancy, the simple case does work as expected
18:41ipostelnikwhat qualifies as holding onto the head?
18:42jblomoamalloy: oh interesting. so why is the return value java.lang.Class in the first example?
18:42amalloybecause that's what the symbol Class resolves to once you eval it
18:42amalloy&Class
18:42lazybot⇒ java.lang.Class
18:42jblomoaah
18:42jblomocool, thanks
18:42arohneripostelnik: that means you have a reference to the beginning of an infinite seq
18:43technomancyipostelnik: http://stackoverflow.com/questions/5698122/explanation-of-lose-your-head-in-lazy-sequences
18:43amalloy&' ^:has-meta Class
18:43lazybot⇒ Class
18:43amalloy&(meta (quote ^:has-meta Class))
18:43lazybot⇒ {:has-meta true}
18:47samaarontechnomancy: so this is what i ended up with w.r.t. binary file slurping: https://gist.github.com/2231226
18:48technomancysamaaron: man... that sucks
18:49technomancysamaaron: I think at my last job we ended up copying to-byte-array out of clojure.contrib.io
18:49samaarontechnomancy: i'm not proud of it - but it does work
18:49samaaroni just ended up translating an java algorithm
18:49technomancyis it worth opening a bug re: c.j.io/copy?
18:50technomancyseems reasonable to expect it to work with an input-stream arg
18:50samaarongood question
18:50samaarondo you have any idea how i might go about that - i've not used any of the jira nonsense
18:50samaaronperhaps an email do the dev mailing list might be a good start?
18:51technomancyjust opening a bug is not too horrible
18:52technomancybut yeah, probably emailing clojure-dev first would be good
18:59slyrustechnomancy: fwiw, trying to do java interop from abcl makes me appreciate lein :)
19:01technomancyslyrus: heh; cool
19:17technomancyis passing :join? false in the opts map of run-jetty supported by other ring handlers?
19:17technomancyor is it specific to ring?
19:18weavejesterIt's not part of a standard, but other adapters might implement it.
19:18technomancyweavejester: thanks; good to know
19:18technomancybetter not rely on it here then
19:29ForSparePartsCould anyone answer a noob question?
19:30aperiodiconly if you ask it
19:30ForSparePartsfair enough
19:30ForSparePartsI'm working through some simple exercises to get a handle on Clojure
19:30ForSparePartsand I want to try storing some functions in a map
19:31ForSparePartsI'm not exactly sure what the right syntax is to pull them out (or to store them, I guess)
19:31ForSparePartsI've tried something like
19:31ForSpareParts{"a" (+) "b" (-)}
19:31ForSparePartsand various similar things
19:32ForSparePartsI'd like to be able to look up a function in the map and apply it to args somewhere else. How should I do that?
19:32arohnerForSpareParts: + refers to the fn itself. (+) tries to call the fn with no args
19:32arohnerif you have the fn, you can call (apply + [1 2 3])
19:32arohner,(apply + [1 2 3])
19:32clojurebot6
19:32arohnerapply takes a fn, and a seq of args to use
19:33ForSparePartsarohner: brilliant, thanks!
19:34ForSparePartsI'm still a little confused about apply, though -- why would I use that instead of just invoking the function?
19:34eggsbysometimes you need to because the context demands it
19:35eggsbywhat if a function generates something that you want to use as parameters for a function?
19:36ForSparePartsOK. So I'd use if, say, a function returned a sequence, and I wanted to feed that sequence into another function?
19:36eggsby(apply custom-fn (gen-params my-data))
19:36eggsbyyes
19:36ForSparePartscool
19:36ForSparePartsthanks again, guys
19:36eggsbyif you have a list like [1 2 3 4] and you want to sum them you couldn't sum [1 2 3 4] since summing a vector with nothing makes no sense
19:36eggsbyhowever, (apply sum [1 2 3 4]) makes perfect sense
19:37eggsbytoodles ForSpareParts
19:37ForSparePartslater!
19:40mkincidentally, summing a vector with anything makes no sense as well
19:41qbgmk: Unless it is a vector sum function
19:41mkqbg: right, or the map function
19:42mkanother way to explain apply is to say that it injects the function into the start of the given list
19:43qbgOr tacks on the seq as extra arguments
19:43mkyeah, that's the other way to see it
19:43qbgEspecially the vararg form of apply
19:45mkqbg: the vararg form?
19:45qbg&(apply + 1 2 [3 4])
19:45lazybot⇒ 10
19:47mkI see what you mean, though I'd say (apply + [1 2]) is the 0-vararg form
19:48mkanyway, in that case it injects everything on the left into the list on the right
19:58LajlaIs there a difference in expensiveness to (apply + [1 2 3]) and (apply + '(1 2 3)) ?
20:00amalloyno
20:05alexyakushevMeh, this {{set}} thing is not even funny anymore
20:08emezeskealexyakushev: Yeah, no kidding
20:08alexyakushevI wonder why some people love to complicate things so much
20:09aperiodici haven't followed many mailing lists, but it seems like the clojure mailing list is fairly easy to troll
20:10technomancyaperiodic: either that or the trolls who have decided to infest it are just damn good at what they do
20:10FrozenlockIs there a way to empty a namespace without restarting slime/swank?
20:10lynaghkdon't get any big ideas aperiodic, I live right down the street.
20:10technomancyFrozenlock: remove-ns, I think
20:10FrozenlockSeems like it, thanks!
20:10emezeskeI lean toward technomancy's idea. The perpetrator on the set thread is, otherwise, very intelligent seeming (from his other posts to the ML)
20:15aperiodicI usually just ignore any thread that gets more than five or six replies in a day
20:22amalloy"looks like a great idea. don't waste your time discussing it on the mailing list: put together a patch and attach it to a jira issue so core can tell you what they think of it"
20:26cemerickaperiodic: that probably describes any group of generally well-meaning folk
20:29aperiodiccemerick: good point. the clojure community's general helpfullness and enthusiasm leads to troll-feeding.
20:32cemerickthat, and the newness of the language leaves open a whole new set of attack vectors
20:33cemerickand lispers are notoriously trollable anyway, it seems
20:39halarnold2000does anyone know where one should put certain files using lein's uberjar? I have a configuration file that has def's for vars, the I use with load-file. I put this file at the root of the project and it works fine with lein run. But the file doesn't get into the uberjar. Any help? should I put the configuration file under src, say in the resource dir?
20:39zakwilsonIf I want to spit a string and have it escaped, is there an easy way to do that?
20:40technomancyhalarnold2000: highly recommend doing config with (read-string (slurp (io/resource "config.clj"))) instead of load-file
20:40technomancybut yeah, it goes in the resource/ dir
20:41halarnold2000and the "config.clj" should be in the src/recource somewhere?
20:41technomancyright
20:41halarnold2000thanks..I'll look at read-string
20:42halarnold2000any clue as to why (read-string (slurp (io/resource "config.clj"))) is mo betta than load-file? technomancy?
20:43technomancyhalarnold2000: it's a clearer separation of declarative files vs executable
20:44halarnold2000ah..thx
20:44ivanthis is one of those little things, but the implementation of drop-last surprised me and continues to amuse
20:52technomancyZoka: https://github.com/technomancy/lein-webrepl/blob/webrepl-client/src/leiningen/webrepl_client.clj
20:52technomancynot ready for prime-time yet, but this should allow you to do an inferior-lisp connection to a running heroku dyno
20:56ibdknoxwoah, what?
20:56technomancyibdknox: have you seen ringmon?
20:57ibdknoxoh, not tcp
20:57ibdknoxyeah
20:57technomancyaye, a CLI client for ringmon basically
21:04halarnold2000technomancy: I'm getting a funny exception when trying the io/resource : IllegalArgumentException No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil clojure.core/-cache-protocol-fn (core_deftype.clj:495)
21:04halarnold2000Can I assume that I have some dependency clash? I'm on 1.3 of core
21:04halarnold2000hmm "class nil"
21:04technomancyif io/resource returns nil it means it couldn't find the file on the classpath
21:04technomancymaybe restart your repl if the resources/ dir is newly-created
21:05halarnold2000got this also at the lein compile stage
21:05halarnold2000but you've gotten me further
21:07Zokatechnomancy: it looks interesting! By the way I have cheshire embedded, since I had problems with clj-json
21:08Zokatechnomancy: so you can get out of the dependevies in project.clj
21:18Zokatechnomancy: I am in the middle of adding some new stuff, as soon as I fisnish I will try out webrepl-client with the latest (not yet on github) .
21:20cemerickZoka: I think I found the source of the rogue threads you found
21:22seancorfieldanyone using lein expectations?
21:22seancorfieldit seems to "hang" for about a minute at the end of its run before exiting...
21:23Zokacemerick: was it not closin properly?
21:23amalloyseancorfield: sounds very much like an agent threadpool problem
21:23cemerickZoka: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/transport.clj#L38 :-P
21:24cemerickHaven't confirmed it, but that expr stinks bad.
21:24cemerickI think I probably intended for the close fn to be wrapped with one that stopped the future.
21:25amalloyi don't see anything obvious after a quick scan of the source, but they're probably starting up a future or an agent somewhere
21:34FrozenlockI toyed a little with webserver in clojure, enough to send a file to the webserver using the browser (wrap-multipart-params). Now I'm more interested in sending directly to a clojure webserver from a desktop clojure application. Is this relatively straightforward?
21:35seancorfieldamalloy: thanx, i'll go digging
21:36xeqiFrozenlock: have you looked at clj-http or http.async.client?
21:37FrozenlockNo, will do immediately, thanks!
21:54Frozenlockhttp://neotyk.github.com/http.async.client/docs.html looks like an org-mode user :)
22:04methodmissinGood evening, friends
22:05jweissI'm trying to do an interviewstreet.com problem in clojure, just for fun. Here is the code, it fails because of slow performance. I tried turning on *warn-on-reflection*, didn't get any warning. Turned on jvisualvm and see clojure.lang.Reflector.getMethods() eating 98% of cpu time. what do i do to narrow it down? https://refheap.com/paste/1466
22:05echo-areamethodmissin: Good evening. I read that as ``good night'' :-P
22:06methodmissinI have a question! I can't figure out Refs, Atoms, and ^:dynamic definitions. I'm working on Land of Lisp and it calls for a *big* and *small* that get updated by (bigger) and (smaller) functions.
22:07methodmissinFor a binary search, guess-my-number game. The simplest game in the book. :P
22:08emacsenmethodmissin, That book's written for CL I think
22:09methodmissinYep. I'm doing it in clojure.
22:09methodmissinNot easy.
22:09methodmissinBut very instructive.
22:09autodidaktohi method. still working on Land of lisp?
22:09emacsenmethodmissin, sadly Conrad doesn't come on iRC
22:09methodmissinautodidakto, Thanks for remembering me. :) Yeah, It keeps me blogging, even if my blogs aren't very insightful, I need the practice to work up to the insightful stuff.
22:09autodidaktoemacsen: Do you know why not?
22:10autodidaktomethodmissin: what's your blog link?
22:10emacsenautodidakto, because he has a life?
22:10methodmissinhttp://carlthuringer.com
22:10autodidaktoemacsen: ahh, the normal excuse for not being on IRC
22:12autodidaktomethodmissin: SecurityNow fan? :)
22:13methodmissinOf course! A PDP8 emulator lies in my future for poking and learning machine code when I get past a couple more practical languages. Clojure's popular among my peers and I've been excited about it since attending SCNA and seeing Aaron Bedra last year.
22:15autodidaktomethodmissin: gibson keeps saying he's going to retire and write the pdp8 OS from scratch :P
22:15autodidaktomethodmissin: I think the world needs a secure, open source VoIP solution first though
22:15methodmissinautodidakto, I think some months ago he said he'd grown tired of pdp8s after building like 40 of them and programming the blinkenlights. :D
22:16autodidakto(another project he once mentioned but put to the side)
22:16autodidaktomethodmissin: and recently he discovered javascript and was like "oh wow this is easy and fun". Welcome to the 90s, gibson
22:16autodidaktodownloading the lastest SN as we speak, hehe
22:17methodmissinHeh, yep. Javascript is something else I fiddle with a lot but never devote much serious time to.
22:18methodmissinAt least I try not to write any that I'm embarassed about.
22:18autodidaktomethodmissin: yeah i've been avoiding it for 10 years... something about crufty languages that should have died a long time ago...
22:18methodmissinLooking forward to a talk next week on ClojureScript. The future!
22:18autodidaktomethodmissin: your magic hat rails app could use some jquery/ajax magic when you add a task, though :)
22:19autodidaktoOh, next week?
22:19methodmissinLol, it still works, of course. It has a few outstanding problems.
22:19methodmissinYeah, a co-worker is presenting.
22:20autodidaktoCool, where do you guys work at? Presenting where?
22:21methodmissinGroupon, Chicago
22:22autodidaktoGroup -> users in this group, no back button. I just removed myself, hehe
22:22autodidaktomethodmissin: I remembered your name, btw, because me comes from the rubies too
22:22methodmissinYeah, that's one of the issues. Is that so, autodidakto?
22:22methodmissinZomg I'm famous!
22:23autodidaktoI think rubyist are sympathetic to clojure/lisp in general because of ruby's heritage, and because of our shared quest of Real Ultimate Programming Power (and Happiness)
22:25methodmissinIndeed. And learning clojure makes me happy even if it's frustrating. There's a time learning any language when you have to get over the hump of basic syntax and core functions.
22:26autodidaktomethodmissin: and just stupid basic things like trying to get out of the repl
22:26methodmissinWell, I can clj my way out of a paper bag, a wet one.
22:26autodidaktoI'm typing (quit), (exit), :q, contrl x, control d, heh
22:27methodmissinCtrl-D works for Lein for me, but yeah. Glad my general knowledge of UNIX has grown since I became a full-time mac user and programmer.
22:27methodmissinTry all exit-program things
22:28methodmissinOoh, Just thought of Ctrl-z
22:28methodmissinThat might be useful.
22:28autodidaktoAlso about ruby: we're more tolerate of using primitive data structures (hashes, arrays) and their useful and varied API instead of always jumping to making a class for it.
22:28autodidaktomethodmissin: ah yeah. mac user here too. power of unix when you need it, but good design for everyday stuff
22:29methodmissinYes. I've read a few cool blog posts that suggest just that. Why use a class when a Hash is just as good? That sort of thing.
22:30autodidaktomethodmissin: I've even occasionally seen people go crazy and subclass hash and add a method or two. But I don't know about that.
22:32autodidaktoIt's liberating though, to just use powerful primitives. and not think about constructing the perfect noun
22:33autodidaktosimple, flexible concepts like namespaces make a lot of sense. Using a module to namespace methods, comes with baggage (making sure the methods are in the singleton-class, etc).
22:33autodidakto</rant>
22:34methodmissinHah, yes, I'm just starting to figure out module patterns, but getting a lot of exercise with core ruby.
22:35methodmissinAnd Rails, which confounds me daily.
22:35methodmissinDid you know that {:foo => "bar"}.first returns [:foo, "bar"]?
22:35methodmissinI guess that makes more sense when working with a hash with more than one key, actually, but only slightly more sense.
22:36autodidaktohehe, well, I guess it could return a hash
22:37methodmissinI'd expect that more than a different type, but anyways, I want to talk about Land of Lisp
22:38autodidaktomethodmissin: Ok one last thing though while no one is complaining about being offtopic: go grab Metaprogramming in Ruby and earn your name :)
22:39methodmissinGood advice.
22:40methodmissinI'll see if it's in the library tomorrow
22:40methodmissinAnd if not, request it
22:40autodidaktomethodmissin: i doubt I can be of much help with LoL, but ask away
22:41technomancyZoka: the webrepl-client is a bit strange because I don't really think it's much use outside the context of something like heroku, so maybe it should be in its own plugin
22:41methodmissinFolks, excuse me reposting what I said just before autodidakto arrived. :)
22:41methodmissinI can't figure out Refs, Atoms, and ^:dynamic definitions. I'm working on Land of Lisp and it calls for a *big* and *small* that get updated by (bigger) and (smaller) functions.
22:42methodmissinI tried a bunch of permutations and read some about each, and dug around in Joy of Clojure for alternatives/explanations, but it's in the later chapters and I can't understand most of what is written there.
22:42autodidaktomethodmissin: also, there are some other blog/projects about translating lisp into clojure, they might give you clues (there's one on On Lisp, and another that hasnt begun yet, but will try to do SICP)
22:43autodidaktomethodmissin: oh, you're trying to have a global var hold state for the guessing game
22:43methodmissinYeah
22:43meiji11I'm struggling through that book right now. joy of closure.
22:43autodidaktoRefs and Atoms and dynamic definitions go way beyond that, that's why the explanations are confusing you
22:44methodmissinWhich, it occurs to me, is kinda un-Clojure, and I also noticed that the guessing game exploits the repl for its functionality, so it's a pretty hard use case to find example code for.
22:44autodidaktomeiji11: is it your first clojure book?
22:44meiji11sure is.
22:45meiji11i read a lisp book by seibel years ago, which I've long since forgotten.
22:45autodidaktomethodmissin: and to tell you the truth, it's really bad style, the guessing game. Conrad said he had to do messing bad practices to keep the reader's motivation high, and then show the better practices later
22:45autodidaktomeiji11: Joy of Clojure should be your second or third book
22:45meiji11heh, I thought it would be easy to pick up a lisp again.. any recommendations for a first?
22:46autodidaktomeiji11: Right now there's the partially out of date "practical clojure" the slightly out of date "Clojure in Action", and new editions of the "Programming Clojure" and "Clojure Programing" (or something) are abouth to come out this month
22:46autodidaktoonline vers already out
22:46meiji11right, I was thinking of buying the rough cuts of programming closure.. you say the full version's out online?
22:47autodidaktoI think the (print?) release date is this month, which means it should be finalized or nearly so
22:47emacsenautodidakto, will it be more up to date than the other clojure book? For someone like me, I knew clojure pre-1 and now there's a lot that's unfamiliar
22:48autodidaktoahh, Programming Clojure is out April 5th. so I think it should be ready to read...
22:48autodidaktohttp://pragprog.com/book/shcloj2/programming-clojure
22:48autodidaktoemacsen: That's the word
22:48methodmissinautodidakto, I'm glad he acknowledged that in the Ruby Rogues podcast that inspired me to pick up the book.
22:49meiji11ah, okay. here I thought you were referring to the one by christophe grand or whomever.
22:49technomancyemacsen: 90% of the changes since pre-1.0 can be summed up by "don't use monolithic contrib" =)
22:49autodidaktomeiji11: A, "Clojure Programming" by oreilly
22:50meiji11right.
22:50autodidaktomeiji11: that's about to come out even sooner. this month it says -> http://shop.oreilly.com/product/0636920013754.do
22:50cemerickautodidakto: it's at the printers now, AFAIK
22:50meiji11I'm feeling a little like mr. burns in the supermarket aisle with bottles of "ketchup" and "catsup" right now..
22:51methodmissinmeiji11, They both taste the same
22:51autodidaktomethodmissin: ah, you're way ahead of me then. But yeah, I don't know clojure best practices for setting global state
22:51methodmissinHow about worst practices? :D
22:51methodmissinAnother of my goals is to work back through old chapters and revise the projects into better clojure code
22:52FrozenlockOh I can write that!
22:52autodidaktomeiji11: I think "Programming Clojure" (prag programmers / Stuart Halloway) has been the defacto first book
22:52technomancymeiji11: at least you don't have to choose between "Programming Scala", "Programming Scala", and "Programming in Scala" (all different books)
22:52autodidaktocemerick: Thanks, good to hear
22:52meiji11I'll go with Halloway then. Thanks.
22:53cemerickmeiji11: just FWIW: http://www.clojurebook.com
22:53autodidaktomeiji11: np
22:54autodidaktocemerick: hehe why shilling?
22:54emacsentechnomancy, keyword args, interfaces, and some function renames
22:54technomancyemacsen: renames?
22:55cemerickautodidakto: I'm a coauthor of the afore-linked book. Most tech folks are allergic to self-promotion. :-)
22:55emacsentechnomancy, I would swear some funtions have had a renam
22:55emacsenbut what do I know
22:55technomancyemacsen: only contrib functions
22:55technomancyoh, and the metadata syntax changed
22:55emacsentechnomancy, plus, the workflow is different now, lein and friends didn't exist back then :)
22:55autodidaktocemerick: ahh. makes sense. Yeah well, tech guys need to get better at marketting :)
22:56cemerickI'd agree. I certainly have no problem with it, as you can see.
22:57technomancyemacsen: yeah, it's the ecosystem that's changed the most
22:57technomancywe have libraries now =D
22:57emacsenthe ecosystem?
22:57autodidaktocemerick: well, i mentioned that Programming Clojure has been the defacto, but yours (Clojure Programming) is new effort, right? Coming out at the same time, it remains to be seen which will be better (we should all get both of course :P)
22:57meiji11eh, I'll support the new book. not often you run across one of the authors.
22:57oakwise_cemerick: there's a difference between off topic spam and very relevant references that just happen to be self authored!
22:58emacsentechnomancy, yeah now we just need a fancy name for serialized clojure and we'll be all set
22:58autodidaktoyeah, I'm checking out the text on clojurebook.com and it sounds compelling
22:58cemerickoakwise_: sure. I never hesitate to toss out the link. I just ask for forgiveness afterwards to cover my social-signaling bases. :-P
23:00cemerickautodidakto: Yeah, we're the new authors on the block. Our focus (i.e. focusing on on-boarding Ruby/Python/Java devs via their existing skills) is unique AFAIK.
23:00cemerickIt's either going to flop or fly :-)
23:01meiji11that sounds appealing. I'm coming at this from more of a python thing, ie an imperative languages with lispy features..
23:01eggsbywhen you have hard text file dependencies in a lein project, is there any way to get them to bundle with the uberjar it builds?
23:03autodidaktocemerick, meiji11: yeah, that's angle i'm coming from too
23:03autodidakto*that's the
23:04cemerickautodidakto, meiji11: there are direct comparisons between the four languages throughout the book as appropriate, e.g. http://twitpic.com/92nsxr
23:04technomancyeggsby: try the resources/ dir
23:04methodmissincemerick, Neato
23:05eggsbytechnomancy: ya, I got it to work a few seconds after I asked the question... :p
23:08methodmissineggsby, The best kind of proactive question asking. :)
23:09amalloyseancorfield: is the resultset-seq created by with-query-results lazy/dynamically-scoped? i'm trying to transition from clojureql and i can't tell if i can do something like (do-stuff-with (with-query-results rows ["SELECT ..."] rows)), or if i have to do all my processing inside the dynamic scope of with-query-results (like with with-open
23:09amalloy)
23:09autodidaktoI've noticed that articulating my question often leads me right to the thing i've overlooked
23:13autodidaktomethodmissin: Have you tried Atoms for your global var hack thingie? (def *high-guess* (atom 100), @*high-guess*, (reset! *high-guess* 50)
23:14methodmissinautodidakto, I was trying that, gimme a few minutes with that example in the REPL. :)
23:14methodmissinFound a stackoverflow on the subject too
23:16autodidaktomethodmissin: If you do figure it out, be sure to rewrite as a proper functional program (i mean, passing the low and high guess around as parameters :) )
23:17methodmissinautodidakto, We'll see. :D
23:18autodidaktocemerick: in your twitter avatar, you kind of look like mr bean with that face you're making
23:18cemerickheh, yeah
23:18cemerickI've been told multiple times I should update the avatar…
23:22seancorfieldamalloy: sorry, was away reading stuff... resultset-seq is such that, yes, you need to do all your processing inside with-query-results otherwise you'll get an exception
23:22seancorfieldit's part of what i really don't like about c.j.jdbc at the moment
23:22amalloythanks. not surprised, was just hoping i wouldn't have to deal with that
23:22methodmissinautodidakto, Getting a fn as the return value from (bigger)... Even though the last statement is @*big*
23:22seancorfieldafter using it extensively at world singles, there are lots of changes to the API i plan to add :)
23:23amalloyreally? given the difficulty of managing resources/scopes in a dynamic context, it seems like you can't do anything much better
23:23methodmissinhold on, refheap...
23:24methodmissinhttps://refheap.com/paste/1468
23:24methodmissin@*big* is #<ch2$bigger$fn__279 ch2$bigger$fn__279@17a73d30>
23:25autodidakto,(def *big* (atom 50))
23:25clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
23:25autodidaktothen @*big*
23:25seancorfieldamalloy: a functional API - SQL operations that take an optional function to apply to the result set or to the rows but whose result is non-lazy is much easier to use
23:25autodidaktogives you fn?
23:25autodidaktochecking refheap..
23:25methodmissinI'm using a (fn [] stuff...) to set the new value of *big*
23:25methodmissinor try to
23:26methodmissinmmm (fn) returns a function, not the return value of the function....
23:26methodmissinwhat to do.
23:28amalloyare you trying to learn clojure, or common lisp? all the unnecessary side effects in that code make me want to cry, irrespective of the fact that currently it doesn't work
23:28autodidaktoamalloy: it's a long story
23:29autodidaktoamalloy: he's trying to translate some beginner, nonfunctional clisp code into clojure
23:29amalloyright, i remember
23:29autodidakto(as a translation of the Land of Lisp book, which starts out this way)
23:29cemerickseancorfield: You could always ape what I did in clutch to make the dynamic scope optional. It's worked out well, I think.
23:30amalloycemerick: are you talking about the dynamic/optional database-connection var?
23:30cemerickamalloy: I think we're talking about the same thing, yes.
23:31sholvahey
23:31amalloyi don't think that's really germane to the issue of returning a lazy-seq that depends on a result-set, though. yours is about the user needing to establish a dynamic scope, but the jdbc issue is that the db returns a lazy-seq depending on some resources that it needs to somehow clean up "when you're done"
23:31autodidaktomethodmissin: this is painful lol. can you paste in the LoL clisp code?
23:31autodidaktosholva: hi
23:31methodmissinautodidakto, Sure! just a moment
23:31methodmissinDead Tree Format, gotta type
23:32autodidaktomethodmissin: ouch sorry
23:32amalloyif you want to fake some common-lisp with lots of setfs, don't try to use any of clojure's advanced concurrency constructs. just use atoms and reset!/deref them
23:32seancorfieldamalloy: you could always wrap your entire program in with-connection :) :) :)
23:33amalloyseancorfield: does that work, though? you're closing the resultSet anyway
23:33autodidaktoamalloy: yeah that's i'm having him do. (i was just guessing at the time. nice to see your confirm that :) )
23:36methodmissinCLISP code: https://refheap.com/paste/1470
23:37autodidaktomethodmissin: dear god, that ash function... hrm
23:38autodidaktomethodmissin: I dont think making your own ash counts as a translation
23:38autodidaktomethodmissin: is more like trying to embed clisp in clojure :P
23:38methodmissinash: https://refheap.com/paste/1471
23:39methodmissinI could've just used bit-shift-right instead of ash, since it never shifts left.
23:39methodmissinI implemented it because it was fun. :)
23:39autodidaktomethodmissin: i think he's just using it as a "cleaner" hack to get an average, no?
23:39methodmissinYeah, that too...
23:41autodidaktomethodmissin: it's BASIC written in clisp... hehe
23:41methodmissinlol
23:43autodidaktoi think ash and the 1- 1+ stuff could be replaced with call to average + rounding/floor/truncate (wutever)
23:44choffsteinIs it possible to add pre/post conditions to anonymous functions?
23:47aperiodicchoffstein: not with #(...) syntax, i'd think, but with the (fn [x ..] ..) form, i don't see why not
23:49methodmissinI'm stumped.
23:51mbriggsmethodmissin: still trying to work through that clisp?
23:51autodidaktombriggs: talk some sense into him
23:51methodmissinmbriggs, Hahah
23:51methodmissinYes
23:52choffsteinaperiodic: okay, thanks
23:53mbriggsmethodmissin: land of lisp is a neat book for learning clisp, but clojure is a bit of a different beast
23:53mbriggsmethodmissin: you just wouldnt take the same approaches to those kinds of problems
23:54methodmissinmbriggs, Yes, I know you're right.
23:54methodmissinI was encouraged to see http://www.adrianmouat.com/bit-bucket/2011/02/common-lisp-clojure-and-evolution/ apparently made it though.
23:54technomancyclisp is actually a particular implementation of common lisp
23:54autodidaktombriggs: the author uses certain ugly hacks that you can get away with with multiparadigm-swiss-army-knife clisp that clojure just outright rejects
23:54technomancyprobably not what you meant to say
23:55mbriggsyeah s/clisp/common lisp/
23:57autodidaktomethodmissin: that book is stressing you out, you need to have a little fun. checkout my practicing of multimethods -> https://refheap.com/paste/1473
23:58mbriggsmethodmissin: the thing is, if your goal is to learn clojure, check out joy of clojure or clojure in action
23:58mbriggsmethodmissin: both are really good books, and will get you there way easier then land of lisp
23:58autodidaktomethodmissin: yeah, learn good clojure first, then come back and translate LoL for fun :)
23:59methodmissinmbriggs, Joy of clojure is underneath Land of Lisp on my desk right now. ;) I've been poking into it for answers and explanations. I read the first couple of chapters already but it gets heavy, fast. There's a lot of recommendations for books in the scrollback.