#clojure logs

2013-02-13

00:06FrozenlockI have a limited understanding of java, but I think this is where everything begins https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L229 Two little missing .setDynamic.
00:11abpamalloy: quite comprehensive.. https://www.refheap.com/paste/11239 any more to shave off?
00:23abpIs there a function that turns a val or a seq into a seq?
00:37jibbleHow can I append to a vector that's a couple of levels deep in a map?
00:37jibbleI want the whole map, plus a new thing added to a vector that's nested within
00:38jeremyheilerjibble, use update-in
00:38jibblejeremyheiler: thx, will look at it
00:38abp,(update-in {:a {:b {:c [1 2]}}} [:a :b :c] conj 3)
00:38clojurebot{:a {:b {:c [1 2 3]}}}
00:39abp^ jibble
00:40xeqiRaynes: https://www.refheap.com/paste/11240 ; should that work?
00:40jibbleabp: thanks, that's it
00:41Raynesxeqi: Nope, fragment-to-html.
00:41Raynesxeqi: Or you can map to-html, I think. If you just wanted the individual strings.
00:47xeqiRaynes: ah. I'm really trying to do something like https://www.refheap.com/paste/11242
00:48Raynesxeqi: Use html-content instead of content and I think it'll work.
00:50xeqihtml-content + fragment-to-html works, thanks
00:50xeqiis there an equivalent for replace?
00:52Raynesxeqi: I think replace replaces the :content vector in place. If you pass it a seq, it should just put it there, so it should Just Work.
00:53RaynesLike, IIRC ((laser/replace (laser/parse-fragment "<a></a") {:content []}) should = {:content [{node for a}]}
00:54yediis there a function for getting a submap of a map containing only the specific key-value pairs that you want
00:54xeqi&(doc select-keys)
00:54lazybot⇒ ------------------------- clojure.core/select-keys ([map keyseq]) Returns a map containing only those entries in map whose key is in keys nil
00:54Raynesxeqi: Also, you can probably use the 'nodes' function instead of parse-fragment. It delegates to it when given a string.
00:55Raynes&(select-keys {:a 1 :b 2 :c 3} [:a :b])
00:55lazybot⇒ {:b 2, :a 1}
00:55yedicool, thanks
00:55Raynesxeqi: You don't *have* to, but it is shorter than 'parse-fragment' so I thought I'd mention it. :)
00:57xeqiRaynes: https://www.refheap.com/paste/11243 ; nodes work where parse-fragment doesn't, thanks!
00:58RaynesThat's weird.
00:58RaynesI guess I've forgotten how it works already.
00:58RaynesOh.
00:58xeqiheh
00:59Raynesxeqi: Okay, so the problem is that parse-fragment turns the parsed nodes into a zipper.
00:59RaynesUsually you just want to pass the nodes themselves.
00:59RaynesSo there is parse-fragment* for that.
00:59RaynesAnd that's what nodes delegates to.
00:59RaynesSo yeah, just use that.
01:01Raynesxeqi: And in case you're curious as to why nodes exists, it's because it is the 'normalizing' function of sorts. If you pass it a string, it calls parse-fragment* on it to give you a collection of nodes; if you call it with something sequential, it assumes it is already a seq of nodes and is identity; and if you pass it something that is not a string or sequential, it assumes it is a single node (a map) and wraps it in a vector and returns it. Yay, no
01:01Raynesrmalization!
01:02abpCoding is done, now comes the hard-part: Naming. Those functions, maps and immediate values are all the same. :(
01:12cliftonhehe, hello world clojurescript file 750kb
01:20abpIs it normal not to put /bin into .gitignore?
01:40xeqiRaynes: I got everything working, thanks
01:40Raynesxeqi: Coolio. Happy to hear it.
01:42michaelr525good morning
01:58sturnerAnyone have much experience embedding nRepl in java applications or using closure as a plugin/scripting language within java? I'm attempting to extend and enhance a java applications plugin architecture with clojure. So far, I've successfully passed context/state via intern to the repl and I am now exploring how to use gen-class to fully implement the plugin api in clojure.
02:20Phonatacidoh hey, I've almost finished a project of mine (my first in clojure) and I released it via uberjar. Since it includes sing-based UIs usng seesaw (and some other libraries) the uberjar I get from it weighs 12mo. To really have an idea of how heavy is seesaw i built a dummy project that just displays a jdialog (using seesaw's dialog function). And it turns out it weighs 8mo. How can I minimize it and trash all the unused
02:20Phonatacidclasses (it appears this jar also embeds swing examples!)
02:25noidiPhonatacid, I haven't tried it, but maybe ProGuard could help? http://proguard.sourceforge.net/
02:25noidi"It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions."
02:26Phonatacidyes I'm currently trying to achieve "something" with it. Quite an heavy piece of software. I think a proguard leiningen plugin would be welcome.
02:28FrozenlockPhonatacid: do it now! :)
02:29PhonatacidI was considering it actually ! But i'm still a baby when it comes to clojure !
07:03borkdudeWhich Python version does clojure-py assume
07:05Foxboronborkdude: looking at the source, i see "print x, y" so i assume 2.7.3
07:05borkdudeFoxboron yes, hm
07:05Foxboronborkdude: it uses optparser, but it still got new objects. So its 2.7 :P
07:06Foxboronnew style classes*
07:07borkdudeI wonder why this isn't made explicit
07:10Foxboronborkdude: dunno tbh :/
07:10lucianborkdude: it's the default anyway
07:10lucianit's what people mean when they say "python"
07:10Foxboronlucian: naaahhhh
07:10FoxboronIt would be true a few months ago. But lately Python3 is on the march.
07:11lucianit's still not practically usable
07:11lucianit will be in a few years, but 2.7 is what we all use
07:11Foxboronlucian: no, but it's getting more and more common.
07:11luciani'd say very slightly more common that it has been. there are still many useful libraries missing, and more importantly PyPy
07:12lucianportability between CPython 2.7 and PyPy is more useful
07:12lucianand is likely to require similar effort
07:13Foxboroni totally agree.
07:13FoxboronBut again. saying python nowdays dosnt explicitly mean python2.7.
07:17borkdudePython 3 was my first real introduction to Python ;)
07:17borkdudeso it's my default anyway
07:17Foxboronborkdude: virtualenv is awsome if you encounter some problems with 2 and 3 :P
07:18borkdudeFoxboron yup, I have one env for 3.0 and one for 2.7 :)
07:18borkdudeFoxboron also I like Pycharm, which supports virtualenv
07:25cemerickdoes anyone else get compilation warnings w/ defprotocol in a cljs repl? No warnings are emitted when compiling outside of a REPL...
07:28ChongLihmm
07:29ChongLican't even bring up the repl right now
07:29ChongLicaching jvm class names forever
07:29cemerickhah
07:29cemerickactually, I only get warnings if I've moved the repl outside of cljs.user
07:29ChongLiI don't rely on the cljs repl too much
07:30cemerickyikes
07:30Bronsacemerick: Use of undeclared Var?
07:30cemerickBronsa: yeah, for each of the fn/method names of the protocol
07:30Bronsayep
07:30Bronsame too
07:30cemerickis that expected?
07:30BronsaI have no idea
07:30ChongLiit's been difficult to deal with
07:30cemericklol
07:30BronsaI wouldn't think so
07:31ChongLiI'm not sure how to get it to bring new macros in after they've been added
07:31ChongLiI mostly use cljsbuild auto and reloading the browser :(
07:32ChongLiand I can't figure out how to get a browser-connected repl working since my application depends on XHR
07:32ChongLiand that requires a server
07:32ChongLiobviously
07:32cemerickyou end up needing using two http servers
07:33cemerickyour one for ring, and then another that the browser repl starts
07:33ChongLican the browser one make XHRs to the ring server?
07:33cemerickChongLi: as a result of a REPL evaluation? sure.
07:34ChongLihmmm
07:34ChongLiI'll take another look
07:34cemerickI've been picking away at "fixing" all of these things, but every one I knock down, a new one pops up.
07:34ChongLifor some reason I had it stuck in my mind that the cross origin policy required the same server, but that doesn't make sense
07:35ChongLia lot of sites use multiple servers; scaling wouldn't be possible otherwise
07:35ChongLialright, time to take another crack at piggieback
07:36ChongLihmm, emacs is locked up hard on caching jvm class names
09:42SurlyFrog1Okay, I think I've made progress on my understanding of laziness. I would really appreciate it if someone could take a brief look at this code: http://pastebin.com/ub5p2aTq It is an iteration on the code I wrote yesterday (http://pastebin.com/BQLSEvBs) which amalloy and gfredericks properly pointed out looks like a straight port from Common Lisp and was not actually lazy.
09:49clgvSurlyFrog1: is this a training exercise? otherwise you should use `concat`
09:50alexnixonSurlyFrog1: looks good, minor points: in the "one seq has data" case you can just return that seq, there's no need to recurse; I believe it's more conventional to use :else rather than :done
09:50clgvalexnixon: yes thats righ
09:50SurlyFrog1alexnixon: thanks, I was wondering about that.
09:51clgvand you could end the `cond` with :else (seq b)
09:51SurlyFrog1clgv: not sure `concat` does what I need it to. I want to merge two already sorted seqs (as in a merge-sort)
09:52SurlyFrog1clgv: sure, that's shorter
09:52clgvSurlyFrog1: oh, I did not read your predicate in the if statement
09:53clgvwell then I would end the statement with: (cond ... (seq a) a :else (seq b))
09:54SurlyFrog1clgv: yep, that makes sense
10:12amphtroxI need some help :( http://pastebin.com/xMXQ2bzs
10:15Chousukeamphtrox: bindings gets bound to the list you pass it as parameter there
10:22jeremyheileramphtrox, Are you trying to re-create with-open?
10:23amphtroxkind of
10:24amphtroxbut this is a simpler, flawed version
10:25jeremyheilerOne problem, as Chousuke said, when you cons onto a vector it becomes a seq, and let only allows a vector for the bindings.
10:38amphtroxjeremyheiler ok thank you, do you have any idea of an alternative solution?
10:38amphtroxim getting nowhere with this :(
10:39jeremyheilerWhat's your reasoning for not using with-open?
10:45amphtroxi got this as an assignment is class, to make this macro
10:46TimMcamphtrox: Best to note that up-front when asking for help.
10:47amphtroxthey expect us to write this macro after one lecture in clojure? is that reasonable?
10:47Chousukeamphtrox: make sure you understand what each parameter is getting bound to for each call you make to the macro.
10:47amphtroxnever touched functional languages before
10:47Chousukebasically all you're doing is data structure transformation
10:48Chousukeyou get the macro parameters, and produce a data structure that corresponds to whatever you want.
10:48Chousukea good way to get started is to just write down a few invocations of the macro
10:48Chousukeand then the code that the invocations should expand to
10:50SurlyFrog1Is there a clean way to interrupt a computation in an nrepl buffer inside emacs? I've told my REPL to do something amazingly dumb that will take forever…. o_O
10:51lucianamphtrox: there are lectures in clojure? cool
10:51jeremyheilerSurlyFrog1, C-c C-b
10:52SurlyFrog1jeremyheiler: thanks
10:53amphtroxChousuke ok thank you, ill try that
10:53amphtroxlucian its a part in a course where we try different programming paradigms
10:54lucianamphtrox: i see. interesting
11:00Frozenlocktechnomancy: I can't reproduce your serializable example... I obtain (serializable.fn/fn [x] (+ 1 2)) instead of (fn [x] (+ 1 2)). How do you get rid of the namespace prefix?
11:01FrozenlockI did (use '[serializable.fn :only (fn)]) beforehand to bring it in the current namespace.
11:09technomancyFrozenlock: I actually haven't used serializable-fn since I wrote it at a seajure meeting, sorry.
11:14luxbockhow does one use clojure.java.shell/with-sh-dir?
11:14luxbockI can't find any examples of how to use it and nothing I try seems to work
11:16jeremyheilerluxbock, Looking at the source, it appears the variables you can bind are *sh-dir* and *sh-env* ... is that what is troubling you?
11:17jeremyheilererr... I suppose you just need to pass a string or File as the binding for with-sh-dir, so nevermind.
11:17jeremyheilerWhat is your problem?
11:18luxbocksay I have a file called file.exe in C:\Stuff and I want to access its output from Clojure
11:18luxbockhow do I do that?
11:22jeremyheilerI assume it woud be like this: (with-sh-dir "C:\\Stuff" (sh "file.exe"))
11:22jeremyheilerThe output would be a map with the :out key
11:24luxbockyeah that's what I tried but it doesn't appear to work
11:24jeremyheilerThat doesn't help me help you. What is your problem?
11:25luxbockahhhh, it was working, I just misinterpreted the message I was getting
11:25luxbockthanks
11:27jeremyheilerluxbock, no problem.
11:34Frozenlock(def my-fn clojure.core/fn) ---> CompilerException java.lang.RuntimeException: Can't take value of a macro
11:34Frozenlocko_O
11:36TimMc,@#'fn
11:36clojurebot#<core$fn clojure.core$fn@69e9764a>
11:36TimMc...but you'd still need to copy over the var's metadata.
11:37FrozenlockWell at this point it's not a big deal. What is '@' for?
11:37magopianhello there
11:37TimMc,'@#'fn
11:37clojurebot(clojure.core/deref (var fn))
11:37FrozenlockI usually just use it with atoms, or in macro ~@
11:37TimMc@ and ~@ are unrelated
11:38FrozenlockOk so it's really just the @ as with atoms
11:39TimMcYeah.
11:40FrozenlockWell now it works, thanks a lot :)
11:45TimMcFrozenlock: There may be some more complexity, such as .setMacro on the var. I think flatland/useful might have a var aliasing utility.
12:00olenhadHey folks, whats the best way to deal with audio buffers in clojure? I'm writing a thin layer over java's AudioSystem for basic sound IO, and was thinking of what the clojurian way would be to copy buffers?
12:12dnolenolenhad: not really a best way, it's common to write a thin layer around Java interop to make it more fun to use. Some people get ambitious and write DSLs.
12:24jonasendnolen: what's your take on http://dev.clojure.org/jira/browse/CLJS-470?focusedCommentId=30583&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-30583 ?
12:25jonasenLooking at what defprotocol expands to: Is the else-part only evaluated if (defprotocol...) is entered via the repl? I guess the "then" part is the fast-path of protocol dispatch?
12:25olenhad@dnolen: Yeah I was thinking of the former. My concern though is that Java uses subclasses(AudioInput/OutputStream) of Input/OutputStreams in idiomatic AudioSystem code. I could do a literal translation of the code, which in most cases is copying from AudioInputStream to a byte array using a while loop. But that seems unclojurey.
12:26olenhadLike here's a sample of what I mean:https://gist.github.com/olenhad/4309581
12:26oriig* TODO Fix MLA alert map duplication.
12:26oriig* TODO Convert the old configuration file of the alert hints* TODO Fix MLA alert map duplication.
12:27olenhadWhich I think you might agree is pretty ugly code :(
12:27Chousukeconsidering it's just java calls, I don't think you can get it much neater.
12:28dnolenolenhad: well if you're doing audio stuff, you probably care about perf so that code seems conceptually fine to me.
12:29oriigops
12:29oriigsorry about that
12:29dnolenjonasen: fqn is nothing special, that was what the original code did I believe and I simply moved it to a function to avoid code duplication
12:31dnolenjonasen: in fact the top case in your comment is definitely wrong - you access properties on the fn, not the protocol
12:32jonasendnolen: ok
12:32olenhadAh. thanks then.
12:39cemerickgiven a fully-qualified symbol, is there a standard cljs function that will "resolve" that to the corresponding fn?
12:39gfredericksis it weird to want ring middleware that opens a db connection and then closes it only once the response has fully finished sending?
12:40Bronsadnolen: ping
12:40dnolenBronsa: pong
12:40technomancycemerick: wouldn't that break with munging and dead code removal?
12:40Bronsare: cljd-470
12:40Bronsaare you asking for this? http://sprunge.us/iaHP?diff
12:40dnolenBronsa: yes
12:40weavejestergfredericks: Is that because you want a streaming response?
12:40Bronsacljs*
12:40gfredericksweavejester: exactly
12:40dnolencemerick: no and it's not really possible under advanced compilation
12:41jonasendnolen: The warning is "WARNING: Use of undeclared Var foo/f at line 2". The protocol name is Foo (with capital F), maybe we should expand to something like foo/Foo$f and not foo/f?
12:41gfredericksweavejester: it seems to be an awkward thing to implement
12:41cemericktechnomancy: ignoring tree-shaking for now; such a thing would have to account for the munging, yeah
12:41gfredericksweavejester: though I guess you could have a lazy seq of DB results that closes the connection itself once it's been realized
12:41cemerickdnolen: right, there's *that* munging, too. :-/
12:42weavejestergfredericks: Yes, or create an InputStream wrapper around it.
12:42weavejesterI wonder if there should be a dedicated protocol for Ring bodies
12:42Bronsadnolen: updated the patch
12:42gfredericksweavejester: that might be pretty cool
12:43weavejesterAlthough that might be re-inventing the wheel, considering libraries like lamina
12:43cemerickbugger
12:44weavejesterLamina might be a bit heavy though
12:44dnolenjonasen: I still don't really understand why this only happens at REPL
12:44dnolenBronsa: on the ticket?
12:44Bronsadnolen: yes
12:45gfredericksweavejester: so in what way would it differ from the InputStream interface? e.g., what would the protocol methods be?
12:45dnolenBronsa: I don't see anything changed?
12:46Bronsawait, I didn't read about adding a comment
12:47dnolenBronsa: and you can just explain it to me now :)
12:47jonasendnolen: Is '(. x -foo$Foo$f$arity$1)' null (or undefined) in a repl and not when compiling from file?
12:47Bronsadnolen: regarding the whitespace change, I changed the indentation level, did you notice I changed the "assoc-in .. (merge" to update-in .. merge
12:48ravster1say, is everything in clojure lazy-evaluated by default?
12:48dnolenBronsa: yes, but I still don't see why.
12:48weavejestergfredericks: I'm not certain. next/close would be the obvious ones, but next what? Perhaps just a seq extended with a close method?
12:49Bronsawell. before (get-in @namespaces [ns-name :defs sym]) would return nil and taht's why you'd need assoc-in
12:49gfredericksI guess responses can be closed prematurely, so that prevents assuming you can just implicitely close when the whole thing has been read?
12:49Bronsanow, at that point, (get-in @namespaces [ns-name :defs sym]) returns {:name name}
12:50weavejestergfredericks: Yes, if you have some open resource to clean up, lazy seqs don't have a way of handling that.
12:51BronsaI moved that before "(analyze (assoc env :context :expr) (:init args) sym))" because that analyze call would try to analyze namespace.proto-fn before that is added in the namespace
12:51Bronsayou can see it as a (declare proto-fn)
12:51dnolenjonasen: I don't see why that matters, that's property access.
12:52gfrederickslazy seq extensions are interesting. I was thinking core.logic could use a lazy seq with a "step" extension
12:53FrozenlockGrrr... I had a redifining function that made the serialization working for both fn and defn, but the '#()' reader macro doesn't listen.
12:53gfredericksFrozenlock: they can't can they? clojure.core gets loaded by a reader that already has them?
12:53Frozenlockredefining even.
12:54TimMc,'#()
12:54clojurebot(fn* [] ())
12:54TimMcFrozenlock: #() expands to fn*, not fn.
12:54dnolenBronsa: still not following - why does this affect proto fns and not other fns.
12:54FrozenlockAh... that would have been too easy -_-
12:55TimMcAnd I guess that's a compiler literal.
12:55FrozenlockSo no redefining of fn*?
12:56TimMc,(let [fn* list] (fn* [] 5))
12:56clojurebot#<sandbox$eval53$fn__54 sandbox$eval53$fn__54@6b281ec1>
12:56TimMc,(let [fn list] (fn [] 5))
12:56clojurebot([] 5)
12:56Bronsadnolen: this is not specific to protocol fns, this makes so that "(def foo (fn [] (aget *ns*.foo bar)))" doesn't throw
12:57Bronsadefprotocol expands to something like that, that's why it was printing a warning
12:57Bronsaas to why it only happens using the repl, i have no idea :)
12:59Bronsas/throw/print a warning/ that is
13:01dnolenBronsa: ok I see now. thanks.
13:09jonasendnolen: There is a warning only for single segment namespaces: (ns foo.bar) (defprotocol Foo (f [x])) does not generate a warning
13:11atyzhey guys, i'm trying to deploy a composure/ring app with immutant
13:11atyzi get the error No :main namespace specified in project.clj. however i'm not entirely sure what the main method needs
13:12tcrawleyatyz: come see us in #immutant and we'll see if we can get you sorted out
13:13atyztcrawley: i will do! thanks
13:15dnolenjonasen: Bronsa: hmm, I'm going to have to think about this some more - it's not clear to me that foo.bar.-baz should trigger a resolution warning, anything in that form is about interop/implementation details.
13:16dnolenit's a bit strange that we get foo/-bar warnings when we emit foo.-bar
13:18Frozenlockhttp://blog.n01se.net/blog-n01se-net-p-41.html what happened to clojure-in-clojure?
13:20dnolenjonasen: Bronsa: yes, in the RELP, (ns foo) (fn [] foo.-bar) triggers the same warning
13:20dnolener REPL
13:21Bronsaright
13:22dnolenI think line 132 in analyzer.clj should never warn - if there's not a namespace and the symbol contains a '.', we have some kind of interop thing happening.
13:22Bronsaso probably where to look for a fix is the (.contains s ".") branch of the analyzer
13:22dnolenyeah
13:22Bronsas/analyzer/resolve-var
13:27dnolenok that fixes it for me, and all test pass. Any objects jonasen Bronsa?
13:27dnolenobjections
13:27Bronsasounds right to me
13:31ieurecemerick, I'm having a super weird issue with friend.
13:31ieurecemerick, I'm using the http-basic workflow, but when auth fails I get a 302 to /login instead of a 401.
13:32cemerickieure: sounds like a recently-fixed bug....one sec
13:32cemerickieure: what version are you using?
13:32Frozenlockweavejester: I see that hiccup-bootstrap has bootrap.min.js included, but doesn't use it. Is there a reason?
13:32ieurecemerick, 0.1.3.
13:33ieurecemerick, So the weird part is that I wrote a unit test. It works correctly in the test, but not when I run the service.
13:33ieureSoooooo
13:34weavejesterFrozenlock: hiccup-bootstrap is pretty incomplete at the moment
13:34ieurecemerick, Yeah, so; If I pass in credentials, right or wrong, I get the correct response (200 from my route or 401 for wrong creds).
13:34magopianguy, i'm very new with clojure (even though i have done 100-or-so problems on 4clojure), very noob, and am looking for where to go from there, to code/read some actual real code
13:34ieurecemerick, No creds at all gives me 302.
13:34magopianthinking about github, open source projects i could read (and even maybe cntribute to), any advices?
13:35cemerickieure: see https://github.com/cemerick/friend/issues/38 and the link to :unauthenticated-handler usage in the mock app
13:35magopian(on project names)
13:35weavejesterFrozenlock: I haven't had a lot of time to work on it lately
13:35ieureOkay cemerick.
13:35cemerickieure: no creds at all should get an auth challenge
13:36cemerickThat's what the :unauthenticated-handler allows you to force
13:36ieurecemerick, Right; but a 401 _is_ a HTTP Basic auth challenge.
13:36dnolenhttp://github.com/clojure/clojurescript/commit/e33a6ba9c4b6e8d744e1ac2f3e784822459a5530
13:36weavejestermagopian: What are your interests, in terms of programming? e.g. web design, networking, distributed computing, graphics, etc.
13:37Frozenlockweavejester: What?! You mean that with the SMALL libraries like ring and compojure, you don't have the time to make another one! Sheeesh!
13:37weavejestermagopian: A project in an area you're interested in might grab your attention more than a random one
13:37magopianweavejester: i'm a web (django) developper at the moment, and have been for several years
13:37cemerickieure: but unless you force it, the http-basic workflow doesn't know that it's the only one in play, so it's not going to send back a 401 in case the request can be auth'ed by another workflow later on
13:37weavejesterFrozenlock: I'm such a slacker :)
13:37Frozenlock:P
13:37magopianweavejester: sure, i had a look (very quickly) at compojure, ring, lib-noir
13:38magopiani'm also looking for recommendation on "clean" (and if possible "simple") code to read
13:38FrozenlockI guess I'll have to learn bootstrap then. :/
13:38magopianfor example in the python world, it's well known that code from KEnneth Reitz or Armin Ronacher are awesome, perfect to read/learn
13:38weavejesterFrozenlock: It's basically just a bunch of CSS classes for making pages look pretty.
13:38magopianwondering if there's something like those advices for clojure )
13:39magopiani was two videos from james reeves and got mind blown
13:39ieurecemerick, Yeah, I get it. But in practice, do people really have >1 workflow for the same endpoint?
13:39magopianthat's what led me to compojure/ring, not sure if it's a good start though for a beginner
13:40weavejestermagopian: I'm glad you enjoyed the videos. I'm not sure what would be a good project to look at for a beginner, as I think I'd find it hard to judge what would be easy code to follow from a beginners point of view.
13:41ieurecemerick, How do you feel about having authenticate* count the workflows and use the unauth'd response if (= (count workflows) 1)?
13:41weavejestermagopian: I like to think Ring is fairly easy to follow, and people have mentioned that in the past, but I have something of a bias when it comes to Ring/Compojure :)
13:41magopianhahaha, totally didn't get that you were james reeves, sorry ;) (btw sent you a "thank you" email this afternoon ;)
13:42weavejestermagopian: Ah, that was you? I was going to send a response later.
13:42magopianweavejester: yup ;)
13:42magopianas i said, it blew my mind
13:42n_bmagopian: Look at raynes' library tentacles
13:42magopiancoming from OOP and MVC and all that stuff...
13:42cemerickieure: sure; an API endpoint that is also used by a web frontend needs to support e.g. HTTP basic + a user-interactive login
13:42n_bIt's quite easy to understand and is well documented
13:43magopiann_b: https://github.com/Raynes/tentacles#readme ? awesome, i'll look at that too then ;)
13:43magopianthanks, that's two good starting points, thanks people
13:43ieurecemerick, Honestly I don't think I've ever seen that in practice either. But, whatever, would you be okay with the change I suggested?
13:43weavejestermagopian: You might want to try writing some code, and then asking on #clojure what you could do to improve it (if anything)
13:43weavejesterOr the clojure google group, perhaps
13:43n_bThe pastebin he works on is quite nice too, but the name is escaping me atm
13:44ieurecemerick, Alternately the first/last of the workflow unauth responses could be used as the default if no specific handler is specified.
13:44cemerickieure: if a workflow returns a ring response, authenticate* always sends that through
13:44maiois there some way to make clojure startup faster? it takes 15 seconds to "lein run" empty ring app
13:44ieurecemerick, I really don't see how this design works in practice, though. If you have multiple auth methods but only one unauth handler, won't N of them always get an inappropriate response?
13:45ieurecemerick, So if you use OAuth / interactive-form, your OAuth consumer would get the wrong flow, or your interactive would.
13:45n_bmagopian: Refheap! Is the one. That's a good ring sample IMO.
13:45weavejestermaio: There's drip, but I didn't have much luck with that.
13:46cemerickieure: only if you try to put them both on the same URI or something
13:46magopiann_b: perfect, i'll add that to the list ;)
13:46magopianweavejester: will do that ;) is https://github.com/ring-clojure/ring the "official" repository for ring?
13:46weavejestermagopian: Yep
13:47ieurecemerick, Isn't that the exact usecase you were just suggesting?
13:48magopianawesome, thanks again ;)
13:49cemerickieure: No, because interactive-form sits on one URI, whereas http-basic can sprawl across any (and trying to http-basic auth against e.g. /login would be dumb and pointless from the client's perspective)
13:49ieurecemerick, Right, but wouldn't it make more sense to use different routes with one workflow per in that case?
13:49weavejestercemerick: In bandalore, is there a way of making a polling-receieve poll indefinitely?
13:50ieureYou can put the same endpoints in multiple routes if you need to reuse that code.
13:51cemerickieure: Perhaps, but your app routing isn't friend's concern.
13:51cemerickMaybe it should be, and maybe it will be for some friend-friendly add-on (esp. for establishing route-level access policies, for example), but that's not here now.
13:52cemerickweavejester: I barely remember that I wrote something called 'bandalore' at this point. ;-|
13:52weavejestercemerick: Haha :)
13:52cemerickweavejester: is that the fn that returns a lazy seq of messages?
13:52weavejesterI might be submitting some pull requests for it, although it's pretty complete
13:52cemerickshould carry on indefinitely, if memory serves
13:53cemerickweavejester: it's actually not; there's a bunch of SQS features that were released some time after my attention drifted
13:53weavejestercemerick: Yeah. There's an example where a :max-wait is set to Integer/MAX_VALUE, but as far as I can tell, it's in milliseconds, so that's a maximum of 24.85 days.
13:54weavejestercemerick: So for queues that aren't used much, the process might randomly end :)
13:54cemerickweavejester: that's got to be the strangest humblebrag of all time ;-)
13:55weavejestercemerick: humblebrag?
13:56cemerickdon't worry about it, I barely know what it means :-P
13:56weavejesterAh, okay
13:56cemerickweavejester: :max-wait is millis, but doesn't correspond with any AWS api -- that's just limiting the cumulative Thread/sleep'ing that'll be done between receiving messages.
13:56cemerickToss Long/MAX_VALUE at it, and you'll be good for a while
13:57weavejestercemerick: Ah, so it doesn't have to be an int
13:57cemerickweavejester: nope; not sure why I used an int...
13:57weavejestercemerick: That'll probably solve it. I only noticed it because a worker watching a test queue died.
13:58weavejesterIt hadn't received any data in a while.
14:02Frozenlockamalloy: Last week you gave me link to a middleware in ring to get the current URI. I... lost it... Could you, in your infinite generosity, give it again?
14:03amalloyFrozenlock: i could, but instead i'll just give you a hint to encourage future foraging: most of the interesting middlewares i use or wrote are in 4clojure
14:03FrozenlockGood enough, thanks!
14:03Raynesamalloy: And most of them get moved to lib-noir.
14:04amalloygood point. i wonder if you stole that one
14:04cemerickweavejester: I made the slightest possible change to the bandalore readme :-P
14:04amalloynope
14:05FrozenlockRaynes: Really? I just checked lib-noir and assumed the requested part had been removed: http://www.luminusweb.net/noir-api/noir.request.html
14:06weavejestercemerick: Thanks :)
14:07RaynesFrozenlock: https://github.com/noir-clojure/lib-noir/blob/master/src/noir/util/middleware.clj is our collection of middleware.
14:07RaynesRelatively small middleware, anyways.
14:16nishantHi! Does anyone know which namespaces are loaded in the 4clojure REPL?
14:56muhoohas someone already written a macro to deal with java patterns like (let [foo (Constructor.)] (.init foo) foo) ? or is it in clojure core already?
14:56amalloy&(doc doto)
14:56lazybot⇒ ------------------------- clojure.core/doto ([x & forms]) Macro Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.uti... https://www.refheap.com/paste/11259
14:56muhoodoh
14:56muhoothanks
14:57amalloynishant: you should behave as though all you have is clojure.core, clojure.string, and clojure.set, since those are the namespaces that the repl auto-loads for you. in practice, you might accidentally have access to some others
14:58muhoohmm, hot to chain them will be interesting, when i get crap like this: https://www.refheap.com/paste/11258
15:03amalloymuhoo: -> and doto go together like two things that go really well together
15:03muhoothis is what i got so far, doesn't compile, i'll figure it out https://www.refheap.com/paste/11260
15:05RaynesThat doesn't do at all what you think it does, muhoo.
15:05amalloyi don't recommend actually doing it this way, but https://www.refheap.com/paste/11262 should be equivalent
15:05muhooRaynes: yeah, it throws an exception, is what it does :-)
15:06amalloyoh, i don't need the -> there at all
15:06muhooamalloy: wow, if you can do in 15 seconds what takes me 2 hours to do, how will i learn to do it in less than 2 hours? :-)
15:07muhooamalloy: thanks though
15:12Raynesmuhoo: The secret is that you don't need to learn to, since you can just ask amalloy. That's what I do. I actually know nothing at all, I just top off when I need it.
15:13muhooi used to work at a place where the answer to almost every question was "ask jerry"
15:14Rayneslol
15:14magopianRaynes: do you need some kind of token to "ask amalloy" ? or is it free for all? :)
15:14Raynesmuhoo: I work with Alan in person. In fact, he is right across the room from me. I'm blessed, sir.
15:14RaynesIt's like having an encyclopedia I don't have to actually look things up in.
15:14muhoooh, you're in la now? awesome!
15:15Raynesindeed
15:15magopianhey Raynes btw i read your post on "moving away from noir" this afternoon, very clear ;)
15:16RaynesExcellent.
15:16RaynesGlad to hear it.
15:16muhooheh, the source of doto is exactly what i typed.
15:17magopianand you've been advised (with refheap) as the "code you should read because it's clear and clean" to me (as a newbie)
15:18RaynesOh stop, you're making me blush.
15:18magopianthat wasn't my aim, but eh, let it be ;)
15:19magopianit's so easy to see/read/give negative comments on the internet (especially in the OSS world?)
15:19magopiani believe it's as (much more?) important to give good feedback and thanks
15:20RaynesWell, it is certainly appreciated.
15:20muhooit seems it's changed oer the years. i find people a lot nicer these days than a decade or two ago
15:20magopianmuhoo: is that true?
15:20magopiani keep seeing a**holes spitting out venom at everything
15:21muhoomagopian: for a very limited value of "true", my personal experience
15:21muhoowell, don't hang out in #anonymous then :-)
15:21magopianand in general, educated and clever people dissing each other
15:21magopianhaha :)
15:21magopiani believe i'm part of a pretty "cool" community (django and python devs)
15:22muhoothe era of the brilliant a-hole working alone i[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[Cs pretty much over. the world is big and complex, and people need to work together. that's what i've seen.
15:22magopianso there isn't too much meanies, but still, you more often hear advice _against_ than _for_ libraries, for example
15:22magopians/too much/too many/
15:26muhoomagopian: anyway, i've found the clojure world very supportive. nice people. enjoy.
15:26magopianmuhoo: thanks ;)
15:27magopianlet's see how it goes, i had a short stay here a few months ago when i first started learning clojure (by solving problems on 4clojure <3)
15:27magopianbut my day job (and young daughter ;) ate away my free time
15:28magopianwe'll see how it goes this time around
16:16canweriotnowAny advice for testing fns with verbose text output?
16:16canweriotnowlike, say one that uses hiccup to generate an html table?
16:26ivanround-trip it back to hiccup
16:29Seba51Having a function with a rest param &foo, How can I pass it a list or vector?
16:30ivanapply, if I assume correctly
16:30canweriotnowivan can you elaborate?
16:31ivancanweriotnow: presumably the main annoyance is having all that ugly HTML in your test files, and perhaps this can be avoided by turning the HTML back into hiccup structures
16:31ivane.g. http://stackoverflow.com/questions/11094837/is-there-a-parser-for-html-to-hiccup-structures
16:31canweriotnowsweet, thanks!
16:31Seba51Thanks, you assumed correctly.
16:33ivanso does anyone have a fork of hiccup that doesn't require (h ) to avoid XSS?
16:34ivanpresumably by keeping the entire structure until it's time to output HTML
16:34TimMcivan: clojars
16:34TimMcTheir fork screws around with protocols a bit.
16:36ivantheir project.clj points to [hiccup "1.0.1"]
16:41xeqiivan: https://github.com/ato/clojars-web/blob/master/src/clojars/web/safe_hiccup.clj
16:41ivanawesome, thanks
16:41xeqiI haven't pulled it out into its own fork yet
16:42gfredericksis the inverse of interleave in clojure.core?
16:43TimMcgfredericks: partition
16:43TimMcsort of
16:43gfrederickspartition is the inverse of concat
16:43amalloy$google 4clojure reverse interleave
16:43lazybot[public jamiltron / 4clojure-solutions - GitHub] https://github.com/jamiltron/4clojure-solutions/blob/master/solutions.clj
16:44gfredericksthat solution has quote in it O_O
16:45ivaraasendnolen: ping
16:45dnolenivaraasen: pong
16:48ivaraasendnolen: looking at paraconsistent logic formalisms. I wonder if it would be possible to do something similar in core.logic. would be nice for inconsistent data sets
16:49ivaraasendnolen: there appears to have been a Prolog dialect for this (Paralog e)
16:51TimMcgfredericks: Yeah, I have some concerns about that solution.
16:52dnolenivaraasen: I've never looked at paraconsistent logic, but Google seems to show that some people seem interested in the topic in relation to Prolog
16:54dnolenivaraasen: you could probably put create a core.logic extension to support paraKanren or some such - but I can't give any guidance on that
16:56ivaraasendnolen: I'll give it a shot this weekend
16:58dnolenivaraasen: might be worth prototyping against miniKanren first
17:15sisciahey guys, I need a little hit
17:15sisciait is something pretty stupid I guess...
17:15sisciaI have a function defined like so:
17:16siscia(defn a [f a & more] (map f a more))
17:16sisciabut I have problem with the more...
17:17Iceland_jacksiscia: Do you intend on using the identifier `a' twice?
17:17siscianope, sorry
17:17siscia(defn function [f a & more] (map f a more))
17:19siscia(defn function [f a & more] (map f a more))
17:19siscia#'parallel-colt-matrix.core/function
17:19sisciaparallel-colt-matrix.core> (function + [1 2] [3 4])
17:19sisciaClassCastException clojure.lang.PersistentVector cannot be cast to java.lang.Number clojure.lang.Numbers.add (Numbers.java:126)
17:19sisciaim pretty sure the problem is the rest argument (& more)
17:19sisciabut i don't know how to solve it...
17:19sisciaany ideas ?
17:21rckwhat is the eta for 1.5?
17:22hugodis map destructuring on protocol function arguments removed in 1.5?
17:25dnolenhugod: works for me
17:26hugod1.5 RC15 refuses to compile such a protocol for me
17:29amalloyhugod: paste? i don't think anything like that has changed recently
17:30hugodhttps://www.refheap.com/paste/11264
17:31hugodpasses in 1.4, but not in 1.5 RC15
17:31hugodcode added in CLJ-1024 to reject this case
17:36dnolenhugod: oh, I don't think putting destructuring in the protocol def was ever really supported
17:36dnolenonly in implementations
17:37hugodseems to work fine in 1.4
17:38dnolenhugod: which doesn't mean it was supported
17:39hugodI never saw anything saying don't use it
17:40dnolenhugod: I think Clojure has enough cases like that where if there's isn't explicit documentation saying it's supported, it's probably not
17:41hugodwhat's the best way of getting clarification?
17:42amalloyi don't think this was a good patch to accept. throwing an exception for & makes sense, because otherwise you get subtly confusing behavior; but destructuring the argument name causes no problems, and can be useful as documentation
17:43hiredmanhttp://books.google.com/books?id=I8KdEKceCHAC&amp;pg=PA265&amp;lpg=PA265&amp;dq=protocol+destructuring+clojure&amp;source=bl&amp;ots=wNkKSbT7f4&amp;sig=F_PiZFJbFfPbuRxSbJr97-vVpQ4&amp;hl=en&amp;sa=X&amp;ei=2RYcUfOoFca6iwLz7IBw&amp;ved=0CE4Q6AEwAzgK#v=onepage&amp;q=protocol%20destructuring%20clojure&amp;f=false not that I accept this as authority, but it is in ink
17:43gfredericksamalloy: could it be confusing?
17:43gfredericksi.e., give the impression that it's more than documentation?
17:43dnolenhugod: when in doubt, ask on the dev list - submit a docstring enhancement. In CLJS we like and accept warning patches to the analyzer.
17:45dnolenI think malformed defprotocol/type/record should be errors.
17:49hugodI agree the malformed protocols should error - I don't see this is as malformed though. It's specifying an arglist which is valid.
17:51SurlyFrogI have a list of files to operate on. I can (map io/reader (map io/resource ["file1" "file2" …])) to get them all open, however, I'd like to use that list inside a `with-open` form. Any ideas on how that could be done?
17:52SurlyFrogMeaning, I'd like to programmatically construct `(with-open [x (io/reader x) y (io/reader y) …]…)` without having prior knowledge about how many files might be in that list.
17:54dnolenhugod: I don't really have a strong opinion about it. I don't really think of destructuring as being part of the fn signature (unlike rest args), but I might be in the minority here.
17:58borkdudewhen did the original clojure.core/read(-string) evaluate code?
17:59technomancyborkdude: whenever *read-eval* wasn't rebound to false
17:59borkdudetechnomancy so, (clojure.core/read-string "(System/exit 0)") should exit my program?
18:00technomancyoh, no that'd be (read-string "#=(System/exit 0)")
18:00technomancystill does that, fwiw
18:01borkdudetechnomancy I see.
18:03borkdudetechnomancy so the problem would arise in for example a web application if someone entered #=(System/exit 0) in a text field where you expected some other string
18:03technomancysure, if you're lucky
18:04borkdude(clojure.core/read-string "#=(System/exit 0)") ;;=> ClassNotFoundException System java.net.URLClassLoader$1.run (URLClassLoader.java:202)
18:04technomancyoh, that'd be java.lang.System
18:04arrdemclojurebot anyone?
18:04borkdudeah yes
18:04technomancyif you're not lucky they make off with sensitive user data; wipe your DB and backups, and send rude letters to upper management
18:06borkdude(clojure.edn/read-string "#=(java.lang.System/exit 0)") ;;=> RuntimeException No dispatch macro for: = clojure.lang.Util.runtimeException (Util.java:219)
18:07amalloytechnomancy: as rhickey pointed out, read-string runs [some] code regardless of the read-eval settings, eg via the #my.record[1 2 3] syntax
18:07technomancyamalloy: yeah, borkdude was specifically asking about the "original" read-string
18:07technomancythat stuff was a later addition
18:08amalloywell, 1.3
18:08technomancyback when the reader was cool, and before all this new nonsense =\
18:08pjstadigtechnomancy: you're such a reader hipster
18:08arrdemtechnomancy: our reader is still pretty dang cool... no reader macros and "fun stuff"
18:09technomancypjstadig: it used to be you could trust the reader!
18:09dnolenborkdude: even w/ *read-eval* set to false too many loop holes in read - the subtleties of http://tenderlovemaking.com/2013/02/06/yaml-f7u12.html is a good analogy
18:10technomancytrying to come up with a metafictional/fourth-wall joke here but I'm having a hard time, sorry
18:10SegFaultAXtechnomancy: Are you not a fan of ednor reader literals?
18:10SegFaultAXedn or*
18:11borkdudeamalloy do you mean "read macros" still form a security issue in the edn/read-string?
18:11technomancySegFaultAX: I'm fairly horrified by the fact that the reader can return mutable objects; the fact that they can be java.util.Date (the worst class in the entire JDK) is salt on the wound. the uuid literals aren't horrible so much as silly.
18:12borkdudeamalloy readER macros
18:12technomancySegFaultAX: edn strikes me as just an attempt to get back what we had before reader literals complicated things.
18:13technomancywell, that's the charitable explanation that doesn't ascribe it to an attempt to drum up support for community-created datomic drivers in other languages anyway
18:13borkdudedoes anyone really use custom reader literals?
18:13dnolenborkdude: yes
18:14SegFaultAXWhy is the reader returning mutable objects a bad thing necessarily?
18:15technomancyit used to be you could make assumptions about the stability of what the reader returned; now you can't
18:15hiredmantechnomancy uses a monkey patched version of jdbc that doesn't return java.sql.Date or java.sql.Timestamp
18:15technomancyassuming you're dealing primarily with values is one of the major draws of Clojure
18:16technomancyhiredman: well, nobody claims jdbc is particularly good
18:17technomancyif a database is involved, you necessarily already have to start paying more attention because things are going to be messy
18:18borkdudeit is one giant mutable thing, scary
18:18technomancymutability on its own is a problem, but j.u.Date is an incredible case of bad API design on multiple fronts
18:19hiredmanwe use dates (java.util and java.sql) all over at work, in large part because they come from jdbc, guess how many bugs we've have due to java.util.Date being mutable?
18:19borkdudetechnomancy I agree. I didn't work in Java for a long time, but was used to Dates in C#. When I returned to Java, this was the first thing that put me off.
18:19technomancyzero means 1900 now, didn't you get the memo? ugh.
18:19hiredman(ask about simpledateparser bugs and it is another story)
18:20amalloyugh, dateformat. why would you not make that class thread-safe?
18:20hiredmancause you hate freedom
18:22SurlyFrogCan you not have a `doseq` in a `finally` block? Something about being able to recur from a catch/finally
18:22SurlyFrog 'Cannot recur from catch/finally'
18:23borkdudethanks for the info and good night
18:23gfredericksSurlyFrog: sounds right
18:23SurlyFrogthat's a bummer...
18:24Frozenlocktechnomancy: ping when you'll come up with your reader implementation, I'd like to not be afraid to use a read function
18:24technomancySurlyFrog: I think you can use dorun+for. bit ugly but it works
18:24technomancyFrozenlock: heh, well it sounds like they're spinning off a safe tools.reader contrib
18:24SurlyFrogtechnomancy: thanks, I'll try it.
18:25hiredmantools.reader is based on blind, and turning it to a contrib was started some time ago
18:25hiredmanhttps://github.com/Bronsa/blind
18:26technomancyI was thinking the edn bits might come from clojure, but actually I have no idea
18:27hiredmanhttps://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader/edn.clj#L101 :(
18:28hiredmanlets around top level forms make me sad
18:28Bronsame too. but hardcoding constants that are not self-explanatory makes me more sad than that
18:28SurlyFrogtechnomancy: nope, same compiler issue using `dorun` and `for`
18:29hiredmanthey should be defs obviously
18:30SurlyFrogI'm trying to write my own `with-open` that will take a seq of files. So I thought I'd wrap it in a `try/finally` block. Using the finally to run down the seq and call close on each file.
18:30SurlyFrogbut it doesn't appear possible
18:31technomancymapv maybe?
18:31SurlyFroghmmm…let me look
18:31Bronsahiredman: meh. I kinda prefer it that way honestly.
18:32technomancyBronsa: jump-to-definition doesn't work on locals =\
18:32technomancyneither does eval-at-point
18:32Bronsa:(
18:32enquorahttp://clojurescriptone.com/getting-started.html purports to provide a guide to getting started with clojurescript but the first lein command, 'lein bootstrap' is unknown/invalid. Is this for real? can anyone explain?
18:32SurlyFrogtechnomany: Thanks! That works!
18:33technomancySurlyFrog: cool
18:33technomancyenquora: clojurescriptone isn't actively maintained from what I can tell. they assume you use a very old version of leiningen.
18:33Bronsatechnomancy: you just reminded me how an emacs noob I am. thanks.
18:33technomancyheh
18:33enquorathks. not for real, then
18:33SurlyFrogSo, it looks like this: http://pastebin.com/Z28ktkfz
18:34SurlyFrogThat's a testing stub, but hopefully the right idea
18:34hiredmandef is always prefered, "encapsulation" and "information hiding" is how you build non-reusable components
18:34technomancySurlyFrog: maybe a comment saying "I know, I know; mapv isn't right for this, but the compiler disallows doseq"
18:34SurlyFrogtechnomancy: oh yeah, this one is going to have an essay above it :-)
18:34technomancyheh
18:35Bronsahiredman: right, but that's only ever used in read-char* and only to avoid hardwriting a constant, but meh. I can change that to a def.
18:36hiredmanBronsa: code doesn't exist in vacuum, jsut because you only use magic constants in one place doesn't mean other people won't want access to them
18:37hiredmanin a, just, etc
18:38enquoraam looking for examples of a distributed client/server app using both clojurescript and clojure. Clojurescript examples seem thin on the ground in any form - anything out there?
18:40xeqicemerick: did you use any clojure libraries for the stripe integration on clojureatlas?
18:48Frozenlock... ok this one surely is obvious... what is the function like `for', but which isn't lazy?
18:48FrozenlockI'm always doing (into [] (for... and I'm pretty sure there must be another solution.
18:56pbostromFrozenlock: doseq
18:57Frozenlockbut doseq returns nil
18:57jaodoall
18:57Frozenlockas in (doall (for... ?
18:57jaoyes
18:58FrozenlockWell... yes I gain 1 character over into []
18:58Frozenlock:P
18:58jao(defmacro for* [& body] `(doall (for ~@body)))
18:58jao:)
19:29finnjwhy does the filter function require key in a map to be integer?
19:30amalloy&(get [] :a)
19:30lazybot⇒ nil
19:30amalloy&([] :a)
19:30lazybotjava.lang.IllegalArgumentException: Key must be integer
19:30finnjYes, thats the one
19:32cemerickxeqi: just clj-http; the stripe API is basically too simple to bother writing a Library™
19:33TimMcamalloy: I don't understand how you got from the stated problem to the actual problem like that.
19:33Frozenlockxeqi: https://github.com/abengoa/clj-stripe
19:33amalloyTimMc: practice
19:33hiredmanit obviously isn't a map, becuase maps don't require integer keys
19:34amalloya thorough memory of the error messages clojure produces, i suppose
19:34TimMcI fixated on "filter".
19:35finnjhiredman: ok, could you just look at this gist? https://gist.github.com/finnjohnsen/4949716
19:35finnjswore I made a map, but I may very well be getting it wrong :)
19:36hiredmanfinnj: I think you should put (prn person) in the body of strong, and the result will surprise you
19:36hiredman(until you realize what you are doing)
19:41finnjhiredman: ah yes
19:41finnjthanks mate
19:42finnjmap of maps made me confused :D
20:04xeqiFrozenlock: thanks, I saw that but it was a bit too wrapped for me, was hoping for something more map based
20:05xeqicemerick: k, was what I was leaning to as well, though I played with the java api a bit
20:07Raynesibdknox: pppppppppiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnngggggggggggggg
20:07ibdknoxRaynes: pong
20:07Raynesibdknox: https://github.com/noir-clojure/noir/commit/570029409f54f4ecc45b8295a6260b4b28d58346 why did you add (remove :_flash) here? yogthos and I are too astupid to figure it out.
20:08RaynesWe're trying to figure out why wrap-noir-flash has to come before wrap-noir-session in a handler.
20:09yogthosyeah kind of stumped on that one :)
20:10ibdknoxRaynes: yogthos: I think that's an artifact of trying to use ring's flash stuff. I don't think it actually matters in this implementation.
20:10yogthosibdknox: that was my suspicion, I tried it without it and seemed ok, ring uses it to check the :flash from the request part I think
20:11ibdknoxyeah
20:11ibdknoxand that was causing issues when I tried using it
20:11ibdknoxbut I just went around it since it didn't have the same semantics as what we were shooting for
20:12yogthosyeah that makes sense
20:12yogthosso is it something in initializing the ring session wrapper that messes up the noir flash
20:12yogthosthat's the only thing I can see wrap-noir-session doing that could cause it
20:13yogthosthey look pretty independent otherwise
20:14ibdknoxwait, what's the problem you're running into?
20:14ibdknoxoh I remember now
20:15ibdknoxso rings flash stuff uses the session with that key, which isn't part of your actual session information so I removed it. The flash stuff reads and writes to the :flash key in the request and then sticks it into the session
20:15ibdknoxso the session has to be there
20:15yogthosahhh
20:17yogthosit's all coming together now :)
20:18rboydis there destructuring syntax to bind to the last n elements of a seq? or should I just reverse
20:19jeremyheilerrboyd, No. That wouldn't be good for lazy seqs.
20:20jeremyheilerWell, infinite lazy seqs to be more precise.
20:21rboydah
20:47FrozenlockSweet... wasted 2 hours trying to debug why my computer was behaving strangely when entering http://my-site.com instead of http://www.my-site.com. Turns out I had a configuration for it in my host file.
20:47Frozenlock(dec Frozenlock)
20:47lazybotYou can't adjust your own karma.
20:48FrozenlockOh... lazybot evolved?
20:51gozaboruis there an idiomatic way to represent subsequent pairs of a seq? (e.g. [1 2 3 4] to ['(1 2) '(2 3) '(3 4)])
20:51amalloy~partition
20:51clojurebotpartition is probably not what you want; see partition-all.
20:51amalloyhmph
20:51amalloy(partition 2 1 [1 2 3 4])
20:52gozaboruoh cool, I read the step as step after the last value, not the first
20:52gozaboruthanks!
21:00dxehwhat is the closest thing to structs from C in clojure?
21:00amalloymaps
21:01dxehamalloy: wat
21:01dxehyou know what i mean by struct right? and if so then ok ill go look up maps
21:01amalloyof course
21:01amalloyhash maps are what we use for structs
21:02dxehamalloy: alright, because im looking to rewrite this in clojure https://github.com/dxeh/svm/blob/master/src/clsfile.h
21:03dxehmaps still the best way?
21:04ieuredxeh: You might want to use a structmap if you're going to be creating a lot of those: http://clojure.org/data_structures#toc19
21:05ieuredxeh: But, yeah, Clojure has a much more dynamic type system, so you basically just use hash-maps for this kind of thing.
21:06dxehalright ieure :P i know many languages but none like clojure so i was like "map...? " lol
21:06amalloystructmaps have been dead for longer than michael jackson
21:06dxehmj hasnt been dead THAT long
21:06dxehwell
21:06dxehi guess he has
21:06dxehbut not in the literal term
21:07ieuredxeh: Python and Ruby are similar in terms of data structures.
21:07TimMcieure: Records are the new structmap.
21:08ieureTimMc, amalloy, Sure, okay.
21:09dxehieure: oh, well i actually only know C,java,javascript,C++,C#,groovy and html lol i dont exactly know either of those languages (although i've heard of them obviously and seen snippets)
21:09TimMcdxeh: Well, what would you do in JS for a struct?
21:10amalloyit turns out i was actually wrong about MJ. struct-maps survived him by almost a year
21:10TimMcLet that be a lesson.
21:11amalloyi guess "random guessing" isn't always the best approach to historical allusions
21:11TimMc(And if you figure out what the lesson is, I'm very curious to know what you come up with.)
21:11amalloysee above
21:11dxehTimMc: i would probably just create a new class file
21:11dxehdepending on the size of struct/situtation etc
21:12TimMcamalloy: I meant the "struct-maps outliving MJ" part. Meh.
21:12TimMcdxeh: JS doesn't have classes. You mean a prototype?
21:12amalloyoh, i see
21:13TimMcdxeh: And that prototype would just be an Object... which is a hash map.
21:13cemerickamalloy: "almost a year"? struct-maps are alive and well, no?
21:13dxehwell yes Timmc in literal form i meant i would create a new javascript source file and handle it tha way with a prototype
21:13amalloycemerick: they still exist as a deprecated feature, but as far as i know new code is supposed to act like they don't exist
21:13TimMcWait, you'd create a new source file for every struct?
21:14cemerickoh, sure
21:14amalloyhah
21:14amalloyalas no
21:14dxehTimMc: as i said depending on the situtation (and size of the struct)
21:14cemerick"Four more years!" :-P
21:14amalloyno feature will ever be removed from clojure, except the ones that cause rich a problem someday
21:15dxehanyways where can i learn about records in clojure
21:15cgagI pulled some code out of one of my projects into its own project, ran `lein install`, then added the new project as a dependency of the old. When I run my project now I end up hitting runtime errors for missing dependencies, though I have these listed in the new projects project.clj. Am I doing anything obviously wrong (if you can tell from this vague description)?
21:27TimMccgag: The new dependency, is it a SNAPSHOT version?
21:29dxehTimMc: how can i store an array value within a record?
21:29warzis there a better way to pluck a key out of each map in a collection than using map? i can just do (map :key [ ... ]) and it seems to do what i want
21:29warzbut idk if theres a better way
21:31gfrederickswarz: that's it
21:31gfredericksI can't imagine a denser way of communicating that idea
21:32warzwell me either, but ya never know! :)
21:32warzi tried (:key [ ... ])
21:32TimMcdxeh: Clojure is dynamically typed, just like JS. You can just do {:foo ["bar" "baz"]}
21:33gfrederickswarz: good point
21:33gfredericksif clojure were ruby I expect that would work
21:33TimMcdxeh: That's a map of one key-value pair, where the key is a keyword and the value is a vector (array-like thing).
21:34warzi dont really know ruby, i was just going off of my beginner's experience which is that "clojure seems to work as id expect"
21:34warzi didnt know if map would work because i didnt know if itd treat :key as a function, or whatever
21:34warzbut it does
21:34gfrederickswell that's not a feature of map
21:34gfredericksthat's a feature of keywords
21:34gfredericks,(ifn? :foo)
21:34clojurebottrue
21:34warzah, i see
21:34warzwell that explains it
21:35gfrederickswarz: also note ##(:foo {:bar 12, :foo 16})
21:35lazybot⇒ 16
21:35xeqidakrone: is there an example of using try+/catch with clj-http?
21:36warzyea thats why i tried (:foo [{ ... }, ... ])
21:36gfredericks,(:foo [])
21:36clojurebotnil
21:37warzi think its just the difference between applying :foo to each item in that collection versus the whole collection
21:37gfrederickswarz: vectors are quasi-maps (with integer keys), so it's conceivable that somebody might try looking up a keyword in a vector
21:42tommo,(re-seq #"(.+)\\1+" "apple")
21:42clojurebotnil
21:43tommowhy doesn't it match "pp"?
21:43gfredericks,(re-seq #"(.+)\1+" "apple")
21:43clojurebot(["pp" "p"])
21:43tommoahh ok
21:44tommoso it was escaping the literal 1?
21:44tommowhy does that work in other languages then o.O
21:44andyfingerhutOne gets so accustomed to double-backslashes in strings that it is easy to forget you don't need them in Clojure regexes
21:44andyfingerhutClojure has special parsing for regexes that is different than how it does for strings.
21:44tommofantastic, thanks alot
21:45dxehwhy would (if (not= (.magic file) -889275714) be true and (if (not= (.magic file) 0xCAFEBABE) be false when -889275714 is equal to 0xCAFEBABE...?
21:46gfredericks,0xCAFEBABE
21:46clojurebot3405691582
21:46tommo3405691582
21:46gfredericks,(type 0xCAFEBABE)
21:46clojurebotjava.lang.Long
21:47dxehah maybe its because in java its represented by 32 bit int but in clojure is int sized as 16?
21:48cgagTimMc, it's not a snapshot version
21:48warzi have a hard time figuring out when to insert new lines into my code, lol. my functions end up being all on the same line.
21:48gfredericksdxeh: it's a 64-bit long
21:48TimMccgag: (I was thinking you might be getting Maven lookup failures if the dep only existing locally, and it *would* check for newer snapshots.)
21:48cgagif i run a repl for the library i made and call the function it works fine, when I call it from the code that depends on it, i get the dependency errors
21:49TimMcgfredericks: I always have to think "byte, short, int, long" to remember the number of bits in a long.
21:49gfredericksTimMc: that's weird; int/long have absolute meanings for me. byte and short I'd probably have to think about for a second.
21:49TimMccgag: Are you sure you saved project.clj? :-P
21:50warzyea int/long same for me
21:50TimMcgfredericks: I just know that those double in size with each step. :-)
21:50warzthats why they easy to visualize though
21:50hyPiRionI have trouble with nibbles.
21:50TimMcByte (thank god) has absolute meaning these days unless otherwise specified.
21:50tommogotta love dat 4bit nipple
21:51gfredericksTimMc: I was wondering why bytes mattered anymore until I remembered that file sizes are based on them
21:51dxeh8 16 32 64, byte short int long respectively (and usually)
21:51hyPiRiongfredericks: they're based on bits as well. Or longs, for that matter
21:52hyPiRionit's just a perspective
21:52warzjust think in bits
21:53dxeh11101001
21:53warzand youll have an anjoyable time :p
21:53dxehthat twos compliment gets me every time xd
21:53gfredericksonce you work out your endianness
21:53hyPiRionit's not that hard if you convert to hex
21:55hyPiRion1110 -> E, 1001 -> 9, E*16+9 = 224 + 9 = 233
21:56dxehwhats the BITWISE and operator in clojure
21:56TimMc,(use 'clojure.repl)
21:56clojurebotnil
21:56TimMc,(apropos "bitwise")
21:56clojurebot()
21:56hyPiRion,(bit-and 1 3)
21:56clojurebot1
21:57TimMc,(apropos "bit-")
21:57clojurebot(bit-or bit-set bit-xor bit-flip bit-and ...)
21:57dxeho cool
21:57dxehthanks
21:59dxeherr
21:59dxehshift operators are ? hyPiRion
21:59dxehnvm bit-shift-left i guess
21:59tommobit-shift
22:00tommo,(apropos "bit-shift")
22:00clojurebot(bit-shift-left bit-shift-right)
22:01cgagTimMc, where i put the dependency on my library in project.clj seems to matter, does that make any sense?
22:02cgagIt's on the classpath either way, but I don't get class not found errors if i put the dep first in the list
22:05hyPiRiondxeh: you're sharp
22:07TimMcdxeh: And if you're looking for the *other* bit-shift-right, it's not there.
22:08TimMcI opened a ticket for it and attached a patch, but no luck so far.
22:08dxehlol TimMc :(
22:08dxehyou mean unsigned right shift
22:08dxeh>>>
22:09tommo_who even uses dat
22:09TimMcdxeh: Yeah.
22:09dxehtommo_: its basically the same as doing >> & 0xFF (or FFFF, or FFFFFFFF etc depending on size of sign extension)
22:10TimMctommo_: *shrug* It's missing, everybody else supports it, and there's no reason not to have it.
22:10TimMcHow often do you use *any* of the bit shift operators?
22:10dxehquite often actually
22:10tommo_TimMic: gotta shift dem rgb bits
22:10tommo_!
22:11dxehaddin dat alpha
22:11tommo_packin dem bits
22:11hyPiRionOh right.
22:11hyPiRion,0xFFFFFFFF
22:12clojurebot4294967295
22:12hyPiRion^- Java return -1 there
22:12hyPiRionBe aware when you port stuff using e.g. RGBA.
22:12tommo_,(Integer/toBinaryString 0xFFFFFFFF)
22:12clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: 4294967295>
22:16dxehjust wrote
22:16dxehthe most confusing line of my life
22:16dxehhttp://pastebin.com/xT312bUW
22:19cgaglooks like friend is importing an older version of one of the dependencies i use, so mine only worked if i played it before friend in the classpath
22:19cgagwhat would the proper way to have discoverd that have been?
22:19cemerickcgag: lein-pedantic
22:19cgagi just manually shifted the dep around until i isolated it and looked at friends project.clj
22:19cgagi'll check that out, thanks
22:21amalloy&(unchecked-int 0xCAFEBABE)
22:21lazybot⇒ -889275714
22:31dxehhey amalloy
22:31dxehhow would i use an unchecked int to check if .magic == 0xcafebabe
22:33cgagthat pedantic plugin found like a dozen other potential problems, good stuff
22:34FrozenlockRaynes: any plan to make clojurebot post a link to refheap whenever he sees a link to pastebin?
22:36ChongLione thing that's annoying about refheap is that I can't paste with middle-mouse button into it
22:36ChongLipastebin doesn't have that problem
22:37ChongLiI guess it's a codemirror problem?
22:37FrozenlockChongLi: one thing I like about refheap is that I don't even need to use the mouse with refheap.el :P
22:37ChongLiah, I wasn't aware of that
22:38FrozenlockIf you use emacs, you can M-x refheap-paste-region and that's it!
22:45callenbotFrozenlock: didn't work last time I tried it.
22:47FrozenlockPaste-region?
22:47callenbotFrozenlock: da comrade
22:47FrozenlockHmm no, it works :)
22:47Frozenlockhttps://www.refheap.com/paste/11271
22:48FrozenlockEmacs, it just works™
22:50amalloyFrozenlock: Raynes is never going to change clojurebot. and as for changes to lazybot, i think that would be an unwelcome source of extra noise
22:51callenbotspeaking of noise, I need to ignore PARTs and JOINs in here
22:51callenbottoo many pikers.
23:05dxehare there anything like unions from C in clojure?
23:05dxehor is it a type of map once again
23:06callenbotdxeh: whoa, you're comparing Clojure directly with C?
23:06callenbotdxeh: what book have you used to learn Clojure so far?
23:06callenbotI need to have a word with the author.
23:06dxehnot directly obviously but im looking to rewrite some of my C code and not sure the best way
23:07dxehand i havent read any books, on anything really (other than a bit on compilers before)
23:07callenbotdxeh: are you a student?
23:07callenbotdxeh: you need to get a book and read it, performing all the exercises. You are seriously lost.
23:07dxehyeah in highschool, been devving for 6 years
23:07callenbotdxeh: it's not the years, it's what you put in them.
23:07dxehim not lost... im trying to find a way to rewrite some code
23:07tmciverdxeh: no unions in clojure and be thankful for it.
23:08callenbotdxeh: they're not languages used interchangeably, you're doing something very strange and alien and you *need a book*
23:08dxehyou can't be trying to tell me that just because i suck atm at clojure means i suck in every other language
23:08callenbotdxeh: get a goddamn book
23:08tmcivercallenbot: settle down
23:08callenbotdxeh: http://www.clojurebook.com/ this is the best one out right now.
23:09tmcivercallenbot: he's in high school, he knows C, learning clojure and on IRC . . . he's doing great!
23:10cemericksounds like the next Raynes ;-D
23:10callenbottmciver: needs a book. I used to be him, now I am helping him.
23:10dxehnot only C ^_^ multiple other languages
23:10callenbotcemerick: Raynes is more experienced.
23:10dxehjust never learned lisp
23:10callenbotcemerick: more meaningfully so.
23:11callenbotcemerick: and thanks for writing that book btw. It's still my favorite. I even used it as a reference to refresh myself from time to time.
23:11cemerickcallenbot: Maybe, who knows. Perhaps dxeh can run circles around all of us.
23:11cemerickcallenbot: thanks for recommending it, glad you enjoyed it :-)
23:11tmcivercemerick: coming to the Boston Clojure Meetup on Thursday?
23:12cemericktmciver: Dunno, didn't realize it was scheduled yet, even.
23:14tmcivercemerick: I had to re-check but it is tomorrow night. Doesn't look like there's any info about speakers though.
23:14cemerickwell, I shan't be there, then
23:15tmciverWait a minute, I think it's cancelled anyway. :(
23:15cgaggood or not you should get that book
23:15tommo_callenbot were you trying to imply that dxeh was lost in the sense that he shouldnt be rewriting C in lisp
23:16tommo_and that he should learn to write lisp
23:17llasramNot to speak for collenbot, but I do think the question "are there C-style unions in this garbage-collected language?" suggests that one might be wanting some pointers back to civilization
23:18llasramcallenbot even
23:18Raynesdxeh: You trying to step on my turf, boy?
23:18dxehperhaps you are stepping on my turf !@!
23:18dxehlol
23:18RaynesI guess since I'm not in high school anymore someone has to take up the reins.
23:18RaynesWelcome to Clojureland!
23:18RaynesThey're very accepting of us youngsters.
23:18RaynesYou'll be right at home.
23:19cgagdid you have to restrain yourself from saying raynes there or do i pronounce it wrong in my head
23:19cemerickIf dxeh is in some remote locale (upstate Idaho?), then it's settled.
23:19Raynescallenbot: refheap.el doesn't work for you?
23:19dxehnah near ottawa
23:19dxehlol
23:19RaynesChongLi: Something is wrong with codemirror on refheap?
23:19ChongLiRaynes: I can't paste with middle mouse button
23:19RaynesPeople suddenly complained about all my stuff but I missed the context!
23:19RaynesChongLi: Yeah, that's a known problem in firefox, iirc.
23:20cemerickdxeh: Depending on who you talk to, that's roughly the same. :-P
23:20RaynesFirefox doesn't give you a way to grab the middle mouse click event.
23:20RaynesIt should work in Chrome, IIRC.
23:20callenbotRaynes: it didn't a long time ago.
23:20dxehllasram: and no that was not the case, i was looking for the best alternative to the c style'd union
23:20dxehstyled* lol
23:20ChongLiRaynes: it works fine on pastebin
23:20Raynescallenbot: If you try it again and it still doesn't work, let me know and I'll take a look.
23:20RaynesChongLi: pastebin doesn't use codemirror.
23:20callenbotdxeh: get a book
23:20ChongLicodemirror must be doing some weird stuff then
23:21callenbotdxeh: the whole question is misconcieved. Get a book.
23:21dxehstop telling me to get a book callenbot i wouldnt read it even if i had a book
23:21callenbotRaynes: hokay.
23:21RaynesCodemirror is not just a textarea. Firefox's textareas handle middleclicks themselves, of course.
23:21callenbotdxeh: you want to learn?
23:21dxehbecause i dont _need_ a book, i never have,
23:21dxehthe only time i needed a book was when i was reading up on compilers a while ago
23:21ChongLiahh, hmmm
23:21callenbotdxeh: impetuous fool. You're slowing yourself down with that stupidity.
23:21callenbotdxeh: you'd learn faster and more completely if you GOT A BOOK
23:22ChongLifirefox's gotta get on the ball!
23:22dxehnot sure if you are a troll or what but sometimes if you are truely intelligent you dont need a book
23:22nightflydxeh: Someday you'll reach a point where you realize your knowledge is full of tiny little holes
23:22RaynesIt's weird that they don't let you do anything with that event. IIRC, the codemirror guy had to use a hack to get it in chrome though too.
23:22dxehif you can just pick things up quickly
23:22callenbotdxeh: that's a crock of shit.
23:22callenbotdxeh: I was you, 10 years ago. Comprende? I'm telling you how you can make better and faster progress than I did if you drop the prideful ignorance and GET A BOOK.
23:22callenbotdxeh: I did the same exact shit. I asked the same questions.
23:22tmcivercallenbot: this is how you help?
23:23callenbotI wasted a huge chunk of my life being more ignorant than I needed to be because I thought I knew it all and didn't need a book
23:23RaynesYes, this is how he helps.
23:23callenbottmciver: ask Raynes how it looks when I don't care about helping.
23:23RaynesIt looks bad, guys.
23:23RaynesReal bad.
23:23dxehthe question i had was only because i dont know clojure well yet, obviously i am aware there are different ways to do it and i wanted an alternative
23:23ChongLiyeah seriously
23:23ChongLiread all the books you can get your hands on
23:23dxehsuch as there are no structs in java but you can easily get the same effect
23:23callenbotdxeh: the only answer you need is to get a book.
23:23ChongLiI think it's worth reading all of the clojure books
23:23callenbotdxeh: the most valuable thing you can do to learn is to get a book.
23:23antares_callenbot: calm down
23:24dxehyou need to stop being so arrogant because you are getting no where with your petty little trolls
23:24callenbotdxeh: your next step should be logging into Amazon, not bickering on IRC.
23:24RaynesDRAMA
23:24cemerickas the coauthor of the book being recommended, can everyone please stop talking about books?
23:24ChongLiyou can't force someone to buy a book, though
23:24Rayneso/
23:24RaynesGo cemerick, it's ya birthday.
23:24cemerick\o
23:25cemerickdxeh: since I'm mostly a HLL fool, and don't remember what c unions are, could you describe what you're trying to accomplish?
23:25antares_happy birthday cemerick :)
23:26tommoi heard a reference to Raynes, are you the current young prodigy or something :p?
23:26callenbotcemerick: he wants a map.
23:26callenbotcemerick: and dynamic typing.
23:26callenbotcemerick: incidentally, Clojure has both.
23:26cemerickantares_: it's actually not my birthday, I have no idea what Raynes is talking about :-)
23:26Rayneslol
23:26callenbotcemerick: too bad it's an incredibly malformed question indicative of severe brain damage.
23:26callenbotor lack of exposure...to books...
23:26cemerickcallenbot: oh, honestly, please.
23:26antares_cemerick: oh. Happy not-your-birthday then ;)
23:27tommocemerick a union is where multiple elements can share the same memory, e.g. there can only be one variable residing in memory at one time
23:27dxehcallenbot i forgot you must be so smart cause you read 9000 books, o wait im 16 and still am intellectually superior to you without reading a single book
23:27Raynestommo: I was pretty popular in 2010-11 because I was in high school and cemerick held a fundraiser to get me to the first Clojure conference. And I lived in a very small town in Alabama… And apparently I have a lot of popular projects.
23:27dxehplease explain your logic behind books = better
23:27dxehand yes
23:27callenbotdxeh: your ignorant question says all it needs to.
23:27dxehi just called you an idiot
23:27callenbotdxeh: I don't want to not be called an idiot, call me what you like.
23:27callenbotdxeh: I just want you to get a book.
23:27callenbotdxeh: I'll take all the abuse in the world - if you get a book.
23:27dxehand you can want me to get a book, but it's not happening
23:27Raynestommo: I'm still pretty popular. But now it's because I'm so darn awesome.
23:27Raynes;)
23:27cgagyou're better off reading a book that gives you a bigger picture idea than looking to piecemeal translate c code
23:27tommosounds cool raynes, how old are you, and was clojure your first language?
23:28callenbotdxeh: well then you're going to have to put up with Diogenes of Sinope.
23:28Raynestommo: I am 19 now. Haskell was my first language.
23:28callenbotRaynes: christ you're lucky
23:28ChongLiRaynes: oh nice
23:28ChongLiHaskell's a great first language
23:28cemerickRaynes: look, stop acting like you're so baller with your 'haskell was my first language' bit
23:28RaynesHahaha
23:28dxehand you will have to put up with the insanity of knowing how much time you wasted reading books once i'm superior in clojure as well
23:28callenbottook me ages to shake off the C-brain.
23:28FrozenlockGuys, stop being so entertaining :)
23:28Raynescemerick: My secret is that nobody ever asks "How *good* were you with Haskell?" when they ask that question.
23:29tommocool, i'm 17 atm and spent my programming upbringing in java, wish i was lucky enough to start with haskell/clojure lol
23:29ChongLiit's a lot easier to learn functional programming when you're not bogged down with an imperative mindset
23:29callenbotRaynes: did you get anything to compile?
23:29Raynescemerick: I learned monads a couple of months ago. ;)
23:29Raynescallenbot: Sure, I wrote some stuff.
23:29cemerickhah, I knew it!
23:29tmciverdxeh: callenbot's advice to read books is certainly good even if he's being a jerk about it.
23:29callenbotRaynes: good enough.
23:29cemerickcallenbot: waitaminute, you must be a common lisp fan, right?
23:29callenbottmciver: you say that as if it's somehow the exception to the rule.
23:29Raynestommo: You're fine. Still plenty young enough to shove it in your brain.
23:29callenbotcemerick: how'd you know?
23:29cemerickdamn
23:29cemerick~guards
23:29clojurebotSEIZE HIM!
23:29callenbotcemerick: no seriously...how'd you know?
23:29cgagtommo, you're lucky enough to be getting into it at 17
23:30callenbotcemerick: I went from to C to CL, and stayed in CL for a long time until I started using Python professionally.
23:30tommoRaynes: hope so:P came to clojure to basically widen my perspective and learn how to now java'ise everything i write lol
23:30RaynesI got into Clojure at around 14-15 or something like that.
23:30tommonot*
23:31dxehtmciver: it all depends on the person, i've learned everything i know about computers without reading a single book and i currently have a job at a professional android development country and will be having my code presented at droidcon 2013 in spain, im 16
23:31RaynesI was *almost* one of the "I remember when the IRC channel had 6 people in it" people.
23:31RaynesBut not quite.
23:31callenbotRaynes: I can say that I remember when rhickey would help people unfuck their classpath.
23:31callenbotRaynes: but not that small, no.
23:31cemerickcallenbot: there's a certain Je ne sais quoi about interactions with CL-ers and former CL-ers online. ;-)
23:31dxehso, all this book talk is really not helping me
23:31Raynescallenbot: Heh, I remember that too.
23:31callenbotcemerick: they were my tribe. >:)
23:31dxehi just wanted to know the answer to a simple question
23:31RaynesI was probably one of those people.
23:32callenbotRaynes: I was too, I'd avoided the JVM as much as possible until Clojure.
23:32Raynesdxeh: What was the question, again? I don't think I saw it.
23:32cemerickdxeh: my Q probably got lost in the noise, but: what are you trying to do, specifically?
23:32cemerickcallenbot: My condolences. :-)
23:32dxehbest alternative to C unions, in clojure, what would it be
23:32cemerickdxeh: assume I know nothing of c unions
23:32cemericky'know, just for ha-has
23:32callenbotcemerick: they were good years man. Good years. I was more productive than most people I knew despite the janky stack.
23:33callenbot"just for ha-has" <--- I lol'd
23:33cemerickI also don't write bytes with a needle and a steady hand, so...
23:33callenbotcemerick: magnetic needle.
23:33cemerickcallenbot: see, pedantry like that is a classic CL-er tell
23:33antares_dxeh: probably a map (dictionary-like data structure). Getting all the memory layout efficiency aspects of C unions in a GC-ed language is not possible.
23:33callenbotcemerick: good ole (LOOP-MAGNETIC-NEEDLE ...)
23:34cemerickoh christ, ALL CAPS
23:34callenbotit's CL.
23:34callenbotof course it's all-caps.
23:34cemerickcallenbot: bah, I found the way to make lispworks case-sensitive, so there :-P
23:34Frozenlockiirc CL could work in lowercaps.
23:34cemerickstupid read-table bollocks
23:34callenbotCL is a powerful language, so powerful, you can stop the heart of a programmer just by showing him a stacktrace.
23:34llasramdxeh: What are you doing with our current use of unions in C, vs e.g. just using a struct with the same members?
23:35callenbotFrozenlock: it was case-insensitive but the default canonical names were all-caps.
23:35llasrams,our,your,
23:35cemerickantares_: wait, we're talking about bit-packing or something similar?
23:35dxeherr antares_ basically the way i was using the union was a tagged union inside of a struct which would represent a type of constant pool entry, in java this can easily be represented by class abstraction/inheritance, in clojure, im not so sure
23:36antares_cemerick: in C there's a way to have "polymorphic" data structures that are compiled efficiently
23:37antares_dxeh: see http://clojure-doc.org/articles/language/polymorphism.html :)
23:37llasramcemerick: Yeah, basically you can access the same hunk of memory as different types
23:37callenbotguys don't start him down protocols and multimethods already
23:37ChongLiyeah if you love sum types and want functional programming with them try ML or Haskell
23:38Frozenlock"This website was developed by the Clojure Documentation Team." Wow, sounds like a group of superheroes.
23:38llasramdxeh: Although antares_'s link has merit, potentially more relevant -- a map is a map, no matter what keys it has.
23:38cemericktommo: so you're a young'un as well?
23:39tommocemerick: yeah i am, 17 :p
23:39dxehwe've got some prodigies up in this irccccccccc
23:39tmciverget off my lawn!
23:39cemerickexcellent, new blood
23:39antares_Frozenlock: just mere mortals who are fed up with clojure.org's documentation and contribution process
23:39tommotrying to wipe this java slate clean and start fresh
23:39cgagwhat site is that? is that on clojure-docs?
23:39Frozenlockantares_: At this point I was sure that #clojure was the official documentation.
23:40antares_cgag: no, clojure-docs.org is API reference, http://clojure-doc.org is for guides
23:40dxehanyways antares_ thanks for the link looks like it might be what i need
23:40antares_Frozenlock: clojure-doc.org is not official
23:40technomancyFrozenlock: #clojure is way better than the official documentation =)
23:40antares_Frozenlock: so you are basically correct :)
23:41antares_dxeh: you are welcome. Sorry about the book thing earlier, people here are usually pretty nice
23:41cgagah, i'll have to check that out, it looks good from a glance
23:41cemerickFrozenlock: were you the one that came up with 'don't get #=ed'?
23:41cgagparticularly having a good ecosystem section
23:41antares_cgag: if something does not, you can contribute to it on github ;)
23:41antares_cgag: are you relatively new to clojure?
23:41Frozenlockcemerick: yeah. Pretty proud of it :p
23:42cemerickwell done :-)
23:42cgagnot really, but the ecosystem stuff was the biggest hurdle for me when i started
23:42dxehno problem antares_ some people just arent open minded enough to see that some learn differently than others
23:42antares_cgag: ok. I hope you are aware of http://clojurewerkz.org and http://www.clojuresphere.com
23:43ChongLidxeh: if you really must have union types you can do that in typed clojure
23:43cgagclojurewerkz yeah, don't think i've seen clojuresphere
23:43dxehChongLi: its not a must have lol
23:44dxehi was using the unions in C as a way to somewhat represent class polymorphism
23:44ChongLiah ok
23:44amalloyhaha, don't get #='ed? how do you pronounce that?
23:44ChongLiI thought you needed the type safety for something
23:44amalloyhasheq'ed?
23:44ChongLisharp-equals
23:44dxehnah for example ChongLi, in an expression tree, you have a left node and a right node
23:45antares_dxeh: then maybe Scala or Haskell is what you want ;)
23:45dxehnow these nodes can have multiple different properties
23:45dxehi was using a union to represent the different types of nodes in the syntax tree
23:45ChongLisure
23:47ChongLiand a tree is effectively the product of the left and right node types, right?
23:47ChongLiHaskell allows you to express these things explicitly
23:48dxehChongLi: https://github.com/dxeh/sslick/blob/master/src/compiler.c https://github.com/dxeh/sslick/blob/master/src/syntaxtree.h
23:48ChongLiwhereas in Clojure it's basically anything goes
23:49dxehthats like a half done expression tree thats in an unstable state but you can get the idea of what im doing there
23:51ChongLiin haskell you might do something like this:
23:51ChongLidata Tree a = Leaf a | Branch (Tree a) (Tree a)
23:52Rich_Morinhttp://blip.tv/clojure/clojure-sequences-740581 (Clojure sequences) seems to be broken - how should I report this?
23:53ChongLiRich_Morin: all the blip stuff is gone
23:53antares_Rich_Morin: blip.tv pulled the plug on Clojure videos. See http://www.youtube.com/ClojureTV.
23:54Rich_MorinActually, quite a few videos are working just fine on blip