#clojure logs

2013-10-12

00:05uvtcWell, ahem, anyhow, I see that trying it works. :)
00:06indigobitemyapp: http://i.imgur.com/64wFIu7.jpg :P
00:08uvtcindigo, classy black ring on top. Hm. I don't see a "swag" or similar link at clojure.org for any merch though.
00:08indigouvtc: It's the Clojure way to compose everything
00:08indigoSo what you need to do is grab this http://nbeloglazov.github.io/clojure-mug-template/
00:08indigoAnd then go to your custom mug seller of choice
00:09indigo;)
00:09uvtcI recall at one point there were tee-shirts or mugs or something available, and it was mentioned on the ML....
00:10uvtcOh, there it is. On the community page. Looks like just stickers available though.
00:11indigoClojure definitely needs more swag
00:11indigoI looked at the community page first
00:22echo-areaIt occurs to me that StaticMethodExpr is not used anymore for dot-expressions e.g. (. obj method).
00:22echo-areaAm I right?
00:25echo-areaamalloy: Do you know any bit of it?
00:27amalloyi don't
00:28echo-areaOkay, thanks
00:29coventryecho-area: Do you mean the paths where a StaticMethodExpr is constructed in Compiler.java no longer get executed, or that that's no longer idiomatic clojure?
00:31ruzuwould clojure be as awesome if someone other than sir hickey made it?
00:32echo-areacoventry: I'm trying to address this problem: http://pastebin.com/AYqzXy6Q
00:33echo-areaThe JVM couldn't even be started in that case
00:33echo-areaIt signals about the exceptions when initializing the genclass generated class and then quit
00:34echo-areaI then see the generated clinit method via javap
00:35echo-areaAnd I found exact the invocation to internPrivate for -main, -equals, -toString etc
00:36echo-areaSuch invocations will cause RT to initialize, which loads clojure/core.clj in classpath
00:36echo-areaThen when def'ing `meta' at line 205, the exceptions are thrown
00:37echo-areaThat's basically what happened there.
00:38echo-areaBut I find it difficult to explain why a StaticMethodExpr object is created when analyzing (. ^clojure.lang.IMeta x (meta))
00:39coventryI don't know why, but a StaticMethodExpr is constructed in clojure.lang.Compiler.HostExpr.Parser, which is where . expressions are processed.
00:40echo-areaSure it is constructed in HostExpr
00:41echo-areaThe expression being processed is (. ^clojure.lang.IMeta x (meta)), or (. x (meta)) (meta added to symbol `x') seen by the compiler
00:43echo-areaWhere the compiler tries to see what the class for `x' is by calling maybeClass(x), it shall always return null. That's why I think it's impossible to create a StaticMethodExpr for that expression
00:43echo-areamaybeClass(x, false)
00:45coventryWhy should maybeClass always return null?
00:47echo-areaBecause in this case the form is a symbol its namespace is null, then the result can be deducted from the code
00:50timmdrogalis: ping
00:54coventryecho-area: Pretty sure that's not the case. Good luck.
01:34allenj12hey
01:34allenj12can you have a case within a let binding
01:34allenj12?
01:36uvtcallenj12, Sure.
01:36allenj12ahh kk cool!
01:37uvtcallenj12, <http://clojuredocs.org/clojure_core/clojure.core/case&gt;
01:39muhooway OT, but for some reason i figure folks here might enjoy: https://www.usenix.org/system/files/1309_14-17_mickens.pdf
01:47amalloyallenj12: you can let-bind any expression
01:47allenj12i think so?
01:55uvtcallenj12, Clojure's swonderful ... it's smarvelous. :)
01:55allenj12uvtx, i see that more and more
01:55allenj12uvtc, i see that more and more
01:59uvtcmuhoo, hehehehe I like his writing style. :)
02:47bitemyappindigo: I am jealous of your mug on two accounts. 1. I want the damn mug 2. I cannot partake of caffeine.
02:47indigobitemyapp: Make it, and I only drink tea anyway
02:47oakazhi all
02:48oakazI'm an absolute beginner: how can I fetch a web page with Clojure, without using the Java libraries?
02:48oakazI'd like to go through the Clojure way of doing this
02:48bitemyappindigo: I can't drink tea either, still has caffeine.
02:48bitemyappoakaz: clj-http is simple enough.
02:48indigoOh lame
02:48bitemyappoakaz: dakrone/clj-http
02:49indigoI tried going without caffeine for a while due to withdrawal headaches, but I couldn't seem to get that focus I needed
02:49uvtcoakaz, I think `slurp` will do that...
02:50bitemyappindigo: I've been working on that. Exercise is helping.
02:50indigoI should also start on an exercise regime... a standing desk isn't really a replacement for that :P
02:51uvtcoakaz, yes, `(def content (slurp "http://example.com/stuff.html&quot;))`
02:51oakazthanks for the answers! so, we add that [clj-http "0.7.7"] to project.clj and it becomes available ?
02:52oakazI also need to use the noir-async thing :)
02:52oakazI'm familiar with lisp but don't know this platform yet :)
02:54oakazclojars looks really nice, every project has its snapshot there as it seems
02:54oakazI wish golang had the same thing
02:54uvtcoakaz, clojars.org is galactic hq for Clojure libs.
02:55oakazfantastic
02:56oakazis there any lein command for creating a project similar to lein new noir ?
02:56oakaz*creating a new lein-async project*
02:58uvtcoakaz, I'm not familiar with lein-async, but if you want to create a barebones web project, try `lein new compojure my-webapp`, or else maybe look at [Luminus](http://www.luminusweb.net/).
03:00indigo'Night, people
03:00uvtc'night
03:01frozenlockI want to count how many times a file is downloaded via compojure... any advice on how to do it?
03:01oakazindigo: hey, I saw you wanna start exercising,
03:01oakazyou can try: 7min.io
03:19amalloyfrozenlock: wrap the handler that serves the file with something that writes to a file or updates an atom? seems pretty straightforward
03:25frozenlockamalloy: adding another wrap seemed a little overkill... ie using a function on every request, only to count one file access in particular. :-/
03:25frozenlockI might be overthinking it.
03:25frozenlockOr underthinking it.
03:25amalloyfrozenlock: if you're writing an operating system from scratch, you can worry about the overhead of calling a function
03:25amalloyif you're working at the C level or higher, forget about it
03:26frozenlockUnderstood
03:26frozenlockThanks :)
03:36allenj12what is the difference between get and nth
04:22sritchietechnomancy, do you have any advice for gpg: cancelled by user
04:22sritchiegpg: decryption failed: secret key not available
04:22sritchieon a call to lein deploy?
04:23amalloysritchie: did you, the user, cancel gpg because you don't have the secret key for your clojars credentials file?
04:23sritchiewell, I'm trying to deploy to an s3 bucket using s3-private-wagon
04:23sritchieI have gpg-agent running, but I did not cancel
04:24sritchieif I DON'T use gpg agent
04:24sritchieI get this error:
04:24sritchie"gpg: can't query passphrase in batch mode"
04:24sritchiewith multiple failures, then it returns to me
04:26amalloyhm. well, i don't know how s3 or s3-private-wagon works. seems like it ought to not do things in "batch mode", whatever that is
04:27sritchieamalloy: I think this is a leiningen thing,
04:27sritchiesince it's happening without that plugin as well
04:27sritchiejust accessing credentials
04:28bitemyappsritchie: you know it's 0053 in technomancy's timezone right?
04:28bitemyappperhaps a github issue?
04:28oakazI have an HTML page that I'd like to extract data between <b></b>
04:28sritchiebitemyapp: I'm in that tz :)
04:28sritchiehe's on, was just checking if he's around
04:28oakazwhat library should I use? or should I just do regex ?
04:30bitemyappoakaz: there's a number of libraries for turning HTML/XML into something traversable. clojure.zip and enlive come to mind.
04:30bitemyappoakaz: and laser.
04:30oakazwhich one is the handier ?
04:31oakazwhat I need is extremely simple: just the text between <b> and </b>
04:36oakazjust used subs :)
06:53namccartySo far I have notcied that even though serious bugs, beyond the realm of typos and mispellings, don't occur often in my clojure code, the ones that do are really hard to find the source of. Is the the case with anyone else, or am I just looking at a bad sample?
07:15echo-areaI understand my problem now
07:17echo-areaThe directory I added to classpath contains a single class whose name is `x'
07:18echo-areaThis makes Clojure resolve (. ^clojure.lang.IMeta x (meta)) as invoking this class' method `meta'
07:18echo-areaHence the exception.
07:19echo-areaAnd indeed this is my fault to name a class such a short and unidiomatic name
07:28echo-areacoventry: BTW, in that case, maybeClass should return null for form (. ^clojure.lang.IMeta x (meta)), as I said.
07:37john2xhow do I enforce a fn parameter that's a vector with an even number of items. (like in `let` bindings)
07:38john2xjust even? and then throw exception?
08:10rurumate1bbloom: regarding the goog.string.format problem with latest clojurescript (I mentioned it sometimes this week); I uploaded an attachment to the existing bug http://dev.clojure.org/jira/browse/CLJS-324 that should demonstrate the problem.
08:35rurumate1Oh nvm it needed another (require '[goog.string.format]) because that function is in a separate namespace or so.
08:44sm0kelike hiccup is there something similar for css in clojure?
09:29gfrederickseasy way to confuse yourself by having your test print failure but not register in the aggregate test results: (def foo-test ...) instead of (deftest foo-test ...)
09:53rcarmoI need help with implementing a shared counter (yeah, yeah, I know)
10:33hyPiRion(def counter (ref 0))
10:33hyPiRionto increment, (dosync (commute counter inc))
10:34hyPiRionto decrement, (dosync (commute counter dec). To read, use deref
10:36gfrederickshyPiRion: what's the reasoning for the ref?
10:37gfredericksis there an argument for refs by default just in case somebody's using a transaction?
10:37hyPiRionshared use of mutable storage?
10:38hyPiRionI guessed a shared counter is shared
10:38gfrederickso_O?
10:38gfredericksno idea what you're talking about; why not an atom?
10:39gfredericks(defmacro ->is [val & exprs] `(let [x# ~val] (is (-> x# ~@exprs)) x#))
10:40hyPiRiongfredericks: maximal safety guards, I guess? Don't know if the counter will be used along with some other mutable variable.
10:40hyPiRion*maximize
10:42hyPiRiongfredericks: Although I guess a counter would just be used to, well, count.
10:42gfredericks,(let [a (atom nil)] (dosync (swap! a conj 42)))
10:43clojurebot(42)
10:43gfrederickshm
10:44gfredericksdon't think you want to mix it with dosync though. I was hoping that would crash.
11:13mattreplany clojure/conj planners around? I'm curious if any more student tickets will open up. I had checked months back and didn't see a student option, and now I checked and they're sold out. I'm also happy to volunteer; I live in the area and can help with setup or teardown
11:17hyPiRionmattrepl: The student option was there since they began selling tickets. Regardless of that, I'd guess you'll have more luck getting contact if you email them.
11:18hyPiRion(I know because I bought one a couple of minutes after they opened the sale)
11:18mattreplhuh, not sure how I missed it. maybe they were sold out back then too. =)
11:20hyPiRionI was fairly sure there still were a couple left after 24 hours, but don't quote me on that.
11:20gfrederickshyPiRion: you're coming to 'murica?
11:20hyPiRiongfredericks: yus
11:20gfredericksdangit you're tempting me to be tempted to consider going
11:21hyPiRiongfredericks: Yeah, now you have to come to the conj
11:23hyPiRionOh, only two weeks until Swearjure video is out
11:56sm0kehey guys what is a sane vim setting for t_Co?
11:56sm0keoh sorry
11:59Foxboronsm0ke: 256 i believe
12:02sm0keFoxboron: people over vim say not to set it at all
12:02sm0keits really dangerous setting
12:14avishaihi
12:14avishaiis there a way to import/use protocols/record methods in another namespace?
12:17`cbpavishai: sure
12:17avishaii mean, do i have to define a protocol in the same namespace i'll be using its methods?
12:18`cbpavishai: nope
12:18`cbphttp://www.youtube.com/watch?v=R3PZMIwXN_g&amp;feature=youtu.be&amp;a <3
12:18avishaiif not, how do import it?
12:19avishai(require '[protocols-ns :refer :all]) doesn't help
12:19`cbpavishai: are you trying to extend the protocol in another namespace or call the methods in another namespace?
12:20avishaicall the methods on a record in another namespace
12:20`cbpavishai: to call the methods you have to require the namespace methods and import the record
12:20avishaiisn't :refer :all enough?
12:21`cbpavishai: records have to be imported
12:21`cbpalso deftypes for that matter
12:27`cbpavishai: also only importing the record isn't enough, you have to require the namespace so it 'compiles' :)
12:28`cbpthe defrecord i mean
12:33avishaidarn it
12:33avishaistill can't get it to work
12:33avishaii'm missing something
12:35avishaiwhen i import i get class not found
12:39avishaihuh
12:39avishaiworks with :refer :all
12:39avishaibut not with import
12:44avishaicompletely unrelated noob question
12:44avishaii've been playing around with clojure for some time now
12:45avishaii tried using idea, lighttable and sublime
12:45avishaican't say i'm too happy
12:45avishaii want to try emacs
12:46avishaican anybody recommend an emacs setup for interactive development?
12:49`cbpavishai: emacs live
12:50`cbpavishai: you need to require before you import for the class to compile
12:51`cbpavishai: maybe you can share a paste
12:51`cbpso I can stop trying to guess :P
12:54avishai`cbp, any thought about prelude?
12:55ruzuhonda stopped making them, sadly
12:55`cbpavishai: never used it
13:06Pupnik__my housemate has a prelude :p
13:06Pupnik__good question avishai ive been looking for a satisfactory clojure tool too
13:06Pupnik__im just about down to emacs or vim
13:28coventry`cbp: Thanks for the youtubue link. Great stuff.
13:43coventryPupnik__, avishai: I haven't used either (I use emacs), but there's also counterclockwise and intellij.
13:45muhoonamccarty: i've found that. because problems in my clojure code are due to problems in my mental capacity. or my unerstanding of the jvm and java weirdness underneath, occasionally, or the problem domain itself.
13:46muhooi forget who said that, since debugging is harder than coding, if you've written clever cod you've made it impossible to debug.
13:49Pupnik__yeah CCW is pretty good and has a nice repl but I don't like eclipse
13:51gfredericksdo dependency management systems ever distinguish between a library using another library for itself (e.g., utils) vs using another library to coordinate with other code?
13:52gfredericksthe important difference being in the former case you could safely load multiple versions of the secondary lib
14:08ruzuis anyone familiar with datomic?
14:09gfredericksI am. and I'm on the #datomic channel which might be more appropriate
14:19avishaiquestion
14:20gfredericks Unable to resolve symbol: question in this context, compiling
14:20avishaiis there a reason to use monads rather then function composition?
14:20gfredericksin clojure in particular?
14:20sm0kemonads are the nomads of functional ages.
14:20avishaiyes
14:21gfredericksmonads are less usable in clojure than in static languages
14:22gfredericksdue to lack of compiler assistance
14:23avishaiso monads primary function is to build pipelines which compatible wrapper types?
14:23gfrederickssome quote somewhere says that monads are for changing the behavior of the semicolon operator
14:23jkjgoing to euroclojure anyone?
14:24avishaimuch to learn....
14:25coventry"She speaks with programmable semicolons. She's that kind of smart."
14:26gfredericksmonads are for abstracting the unabstractable
14:26Chousukeavishai: monads are just an abstraction among others. it just happens that they are useful for modeling all sorts of effects
14:28lodinavishai: If you don't just have a specific question, but looking to understand monads in general, I would recommend http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html.
14:31coventryKonrad Hinsen's monad tutorial is good too. I still haven't found a good explanation for why you would want to use the monad abstraction as opposed to thinking directly about the computations they represent, though.
14:31avishaithanks!
14:34cemerickdnolen: what gave you the impression that checkout deps were deprecated?
15:07dnolencemerick: that's what technomancy said
15:13rhg135can anybody please help me with https://bitbucket.org/rhg135/jim-js/src? i keep getting https://www.refheap.com/19702 i really don't want to go back to my python implementation
15:17gfredericksrhg135: bitbucket is failing me; are you using advanced compilation? do you get the same result without it?
15:17rhg135its simple
15:17rhg135ya, i found that issue out the hard way D:
15:18rhg135i think bitbucket was failing a while ago
15:18cemerickdnolen: huh, ok; news to me
15:19dnolencemerick: fairly old news, effective since Lein 2
15:20rhg135i would use vanilla clojure but this will go in a gui and the jvm is too heavy for it(think like hexchat but on js+JIM)
15:21cemerickdnolen: I've been away from lein head for a while, but not that long. Are you sure we're talking about the same thing, https://github.com/technomancy/leiningen/blob/preview/doc/TUTORIAL.md#checkout-dependencies
15:23dnolencemerick: maybe we're not talking about the same thing - https://github.com/clojure/clojurescript/wiki/Patches
15:24dnolencemerick: sorry maybe it's :extra-classpath-dirs that go deprecated, if there's a better way for people to test patches please feel free to update the wiki
15:24dnolens/go/got
15:24coventrydnolen: cemerick: several weeks ago technomancy took a PR from me concerning a minor amendment to the checkout dependency docs. He didn't mention anything about it being deprecated.
15:24cemerickdnolen: yeah, extra-classpath-dirs has been on its way out for a while, I can imagine it being toast at this point.
15:25dnolencoventry: yes I might have gotten confused, anyways, if people have better instructions for testing patches update wiki
15:25cemerickdnolen: if cljs has a suitable project.clj, then a regular checkout dep should work, without the extra-classpath-dirs junk
15:26`cbp mm on emacs how can i send clojure code from a clojure buffer into the repl
15:26dnolencemerick: so update the instructions - I don't know how it should be done
15:26cemerickI very rarely use them, so I wouldn't want to go changing wikis at this point.
15:26rhg135ok then, any ideas to make this more clojurish? https://bitbucket.org/rhg135/jimpy
15:26`cbpI can't find a binding in the nrepl.el readme :P
15:26dnolencemerick: sure, but again I don't know anything about it, these the instructions I know works.
15:26dnolenthese are the
15:27coventry`cbp: C-M-x, C-x C-e, C-c C-c. Or do you mean send the source code to be displayed in the repl at the same time?
15:27dnolencemerick: sorry for the confusion about checkouts
15:27`cbpcoventry: I wanna do something like C-c C-c but have it appear on the repl
15:27rhg135in theory python is sort of functional
15:28`cbpinstead of the silly minibuffer :P
15:28cemerickdnolen: no worries :-)
15:29`cbplike this guy does it in this video http://www.youtube.com/watch?v=R3PZMIwXN_g&amp;feature=youtu.be&amp;a
15:30coventryYeah, I was wondering about that. Pretty sure he's using emacs-live there.
15:32`cbpit would help because autocomplete always messes me up and prints a ton of whitespace when i'm on the repl
15:41jonasenSo I added a "console" to http://cljsfiddle.net, next I'll work on a real repl :)
15:45cemerickdnolen: Dunno if you're keeping a tally on it, but you can mark me down as -1 re: dropping `format` from core.cljs
15:45dnolencemerick: it's not coming back
15:45dnolencemerick: unless someone does it right
15:46cemerickdnolen: you mean, a reimplementation of printf-style interpolation in cljs?
15:46dnolencemerick: yep
15:47dnolencemerick: so many things about the GClosure implementation is completely botched
15:47dnolencemerick: even GClosure itself doesn't recommend it's use!
15:49cemerickdnolen: Well, same thing applies to all sorts of js stuff vs. what Clojure has on the JVM. Removing it is just another portability hitch.
15:50dnolencemerick: it's not going to happen until someone submits a proper format
15:50cemerickThe host has what it has. Reimplementing everything in cljs soup to nuts can't be an answer.
15:50dnolencemerick: it's a minor missing thing, you aren't going to convince me to include it
15:50dnolenit's too broken
15:50jonasendnolen: cemerick: did it interfere with advanced compilation?
15:52dnolenjonasen: it did interfere with advanced compilation, could not be sensibly imported, is inefficient, and not recommended for regular usage by Google Closure - which is why it's likely bit rotting
15:53cemerickdnolen: what was the nature of the interference? I've been using it w/ advanced for a long time.
15:54dnolencemerick: it mutates a hash at runtime, it cannot be eliminated if you don't use it.
16:05cemerickdnolen: *shrug* I'd prefer easy(ier) portability over marginal code footprint improvements any day.
16:05cemerickAnyway, I guess it's time for me to bring my << string interpolation macro out of the attic. :-)
16:06brainproxyrecommendation for set that preserves insertion order in clojurescript?
16:08dnolencemerick: you may want that, but it's important for anyone hacking on the compiler to know and reason about the call dependency graph - it took two years to clean up the codebase so that hello world is 2 lines - which isn't about *code size*, it's about knowing what depends on what
16:09bbloomdnolen: latest chrome runs the Epic Citadel demo capped at 60fps on my box: http://www.unrealengine.com/html5/
16:10bbloomdnolen: i don't think v8 explicitly respects "use asm" but it seems to be fully optimized for those code paths now
16:10dnolenbbloom: yeah cool stuff, I also heard Brendan Eich arguing for threads in ES 7 o_0
16:10dnolenat JSConfEU
16:10dnolencool for us
16:10dnolenif that happens
16:11bbloomdnolen: all i want is for javascript to die
16:11jonasencemerick: porting your strint to cljs has been on my todo list :) I think it would be useful
16:11bbloomdnolen: and if that means i need to compile a full VM to typed arrays
16:11bbloomfine by me.
16:11bbloomadding features to JS just seems like a bad plan to me
16:12cemerickjonasen: should just work...it's a macro
16:12dnolenbbloom: yeah I don't really care, wherever the web goes we'll compile to it
16:12bbloomgonna take *years* for browsers to catch up and you can use them, so might as well just start over w/ something like what they are doing w/ portable native client
16:16dnolenbbloom: eh, I suspect browsers will win out in the end, worse is better and all that.
16:17bbloomdnolen: i don't believe in worse is better. there's just a high correlation between better engineering and inferior marketing :-P
16:20sm0kehey guys
16:21sm0kedoes lein 2.3.3 removes with-profile?
16:21dnolenbbloom: JS multimethods for ES7 would be great for fixing JS numerics
16:21dnolenbbloom: another thing Eich mentioned
16:22technomancysm0ke: no
16:22bbloomdnolen: i just can't get excited about new ES features when the core is still so broken
16:23sm0kewtf.. i gave some one my code..he claims he cant do 'lein with-profile package uberjar' ...
16:23sm0kei have package defined as a profile
16:23sm0keweird
16:37sm0kehaha ok lein version was old
16:49muhoohmm, why does this not work? (as-> "msg" <> (.getElementById js/document <>) (.-innerHTML <>) (set! <> "fooobar"))
16:50muhooit's complaining about local vars on set!
16:51dnolenmuhoo: you can't set locals
16:53muhooi wasn't trying to. i was trying to use the as-> macr
16:53frozenlockI'm trying to get myself (somehow) up to date. Is there a nice little tutorial for core.async? :)
16:54muhoointerestingly, this DOES work: (-> (.getElementById js/document "msg") .-innerHTML (set! "fooobar"))
16:54muhooso. something is wacky with as-> , because -> works, but as-> does not
16:54dnolenmuhoo: think about how as-> it probably uses let
16:55dnolenhow as-> works
16:55muhooright, i'll have to macroexpand and see
16:55muhoobummer
16:56dnolenmuhoo: you can probably make as-> work with some tweaks
16:56muhoodunno if that's be called a bug in as->, or just an undocumented limitation
16:56dnolenmuhoo: not a bug, or a limitation
16:56brainproxyseeing a bunch of "Error: Doesn't support name: ↵ ... " errors during clojurescript compile... intermittent, sometimes triggering another compile makes it disappear
16:57muhoowell for me it's a limitation. i just need to remember not use as-> in cljs :-)
17:05dnolenbrainproxy: need a minimal case, the only place we emit a error string like that is in the standard library, nowhere in the compiler
17:14gfredericksmuhoo: I don't think you can use set! like that in clj-jvm either
17:16gfrederickseven with ->
17:19gfredericksmuhoo: maybe for what you're doing a helper function that does the interop for you would be good? interop in general isn't often syntactically flexible
17:28danneumuhoo: yeah, as-> just feels like "-> but you choose the insertion point" so it'd surprise me as well
17:30gfredericksas-> could be rewritten to not use let when avoidable, but that would make it rather more complicated
17:30danneuas-> could be rewritten as a macro that changes position
17:30danneuyeah
17:31gfredericks,(as-> 7 <> (+ <> <> <> (* 2 <>) <>))
17:31clojurebot42
17:31gfredericks^ obviously requires let
17:33danneuwhy does it require let? why couldn't you build that list in a macro
17:33gfredericksyou don't want to eval multiple times
17:35danneuoh, like if we imagined it was instead (as-> (db/find-number-by-string "seven") _ (+ _ _ _ (* 2 _) _)) ?
17:35gfredericksyep
17:35danneui didnt' even know you could have multiple substitutions in a form with as->
17:36gfredericksthat's part of its usefulness
17:36gfredericks,(as-> (* 2 3 6) <> (do (print <>) <>))
17:36clojurebot3636
17:36danneuwell, i'm weak. i just use it because i always 'guess wrong' between -> and ->>
17:38danneuthe last form always switches its argument order on me
18:13dobry-denI'm writing a library where you declare a map of options and then each function behaves differently depending on what options are set.
18:13dobry-denWhat's the general pattern for something like that
18:15dobry-denWhat comes to mind is a dynamic var for the *options* map
18:15bbloommuch better idea to just take an options parameter and thread it through
18:16bblooma little uglier in some places, but avoids a bunch of problems
18:18dobry-denbbloom: I could do that in my library code. But that's too painful for the end-user for this.
18:18bbloomwhy?
18:18clojurebotbbloom: because you can't handle the truth!
18:18dobry-denWhat's the next step down from that?
18:19bbloomyou'll have to be more specific about your use case
18:21dobry-denbbloom: I've been porting Compass for use with the Hiccup-like Garden library. For an example of how I'd use those options, check out the source of this inline-block mixin http://compass-style.org/reference/compass/css3/inline_block/#mixin-inline-block-source
18:21bbloomso surely you have inert data that you later pass to a single compile function, right?
18:22bbloomisn't your API like two functions? 1) compile this object 2) register this mixin/plugin/function/whatever
18:23dobry-denwell, i actually have a hard-coded ad-hoc port of Compass for one project that i'd like to extract so i'm thinking about how i should do it
18:24bbloomi don't know anything about how garden works, so i can't comment
18:24bbloombut explicit paremeters aren't so bad. use them :-P
18:24bbloomor use a dynamic variable, but make it overridable with an explicit parameter
18:24bbloomeither way: do the explicit parameter version first
18:30bitemyappalexbaranosky: Want me to just push a release without pocket's PR? his thing looks a little sketchy.
18:30bitemyappI planned on trying it today anyway.
18:43bitemyappbbloom: can do closures too if you don' twant to repeat yourself.
18:43bitemyappthat's what I do in bulwark.
18:47bbloombitemyapp: but then you need an object to hold on to the closures… which is essentially the same as an options parameter
19:00brainproxydnolen: it appears to be related to requiring other namespaces, will see if I can craft and example later, for now I just moved everything back into one namespace
19:00brainproxy*an example
19:00brainproxyalso clj->js seems to be behaving strangely
19:01dnolenbrainproxy: namespaces must match the directory layout - 1933 and on now emit warnings if things don't line up.
19:02brainproxydnolen: I'm pretty sure they line up
19:02coventry Has there been any work in clojure in the direction of Haskell's Hat tracing suite?
19:03dnolenbrainproxy: I tested 1933 on core.async, and dommy project - I didn't see any issues about multiple namespaces or requiring
19:04dnolenbrainproxy: it might be something else, also you need to put your ClojureScript directory in :source-paths
19:04cemerickdnolen: I'm getting namespace warnings when using 1934 and HEAD with e.g. cljs.core.PersistentQueue/EMPTY
19:05dnolen:source-paths in cljsbuild options is not enough
19:05dnolencemerick: fixed in master
19:05cemerickdnolen: I just pulled 90s ago :-)
19:05dnolencemerick: clean build?
19:06cemerickdnolen: yeah; I'll make a separate clone to be sure
19:07dnolencemerick: I just grepped master, no /EMPTY
19:08cemerickdnolen: no, I mean, any "static field" expression like that, or on the REPL
19:08dnolencemerick: oh, yeah that's not allowed anymore
19:08cemerickwat?
19:08dnolencemerick: otherwise it's problematic to identify namespaces
19:09dnolenjust do .EMPTY
19:11bbloomdnolen: it shouldn't exist at all
19:11bbloomdnolen: why not just cljs.core/empty-queue
19:11cemerickdnolen: Leaving aside all the libraries for now (!!), that's some seriously core Clojure sugar that just got tossed. :-(
19:12dnolencemerick: with that change namespace & var resolution is considerably simpler and more accurate
19:12bbloomcemerick: it was always broken sugar
19:12dnolencemerick: which is more important for errors than the convenience of /
19:12bbloomcemerick: slash just got converted to dot, which was bogus if you ever want to reify namespaces
19:13dnolencemerick: if you can figure out how to make it work with new accuracy around ns identification and var resolution, I'm happy to take a enhancement
19:13cemerickI'm not arguing the feature on its merits, I've just some serious breakage whiplash.
19:13cemerickI'm just having*
19:13dnolencemerick: it's a warning, nothing breaks, and trivial search & replace.
19:14cemerickIs this going to percolate over to Clojure like field access?
19:14bbloomcemerick: it's different in clojure b/c the host has static fields
19:14dnolencemerick: I doubt it, but what bbloom said
19:15bbloomcemerick: so classes act as namespaces for static field resolution
19:15bbloomjavascript has no such notion, so it doesn't need any notation for it
19:15cemerickbbloom: yeah, I'm just talking about the notation, not the respective host capabilities
19:15bbloomright, but javascript has no capability and thus does not need the notation
19:16dnolencemerick: but it's tied to what can be identified on the host
19:16dnolencemerick: CLJS has no such reflective capabilities
19:17dnolencemerick: if you see some clever way to make it work I'm listening.
19:17bbloomdnolen: we should push to get explicit vars added to clojure.core for any commonly useful static fields, so then the notation will be portable between clj and cljs
19:17bbloomlike empty queues & whatnot
19:19gfredericksprobably queue would be more useful than empty-queue, eh?
19:19gfredericksI guess we still use empty versions of other collections...
19:19bbloomsure, just like (list)
19:19bbloom,(list)
19:19clojurebot()
19:19bbloom,(set)
19:19clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$set>
19:19bbloomgrrr
19:19cemerickdnolen: I'm uninterested in wedging stuff into cljs that you and bbloom have already considered to be too hard / not possible / not worth it.
19:19gfredericks,(hash-set)
19:19clojurebot#{}
19:20cemerickI have a couple of problems:
19:20dnolencemerick: the problem is that allowing cljs.core.foo.bar/BLAH, how do you know which part is the namespace?, is that cljs.core with a type foo, with a property bar, with a property BLAH
19:20dnolen?
19:20dnolencemerick: and for that convenience we have several tickets where people complain about the fact that we weren't identifying non-existent namespaces
19:20dnolencommon typo
19:21cemerick(a) I'm trained to treat cljs warnings as errors, but the notation apparently still works, but warns as part of a deprecation process?
19:22cemerick(b) I have nontrivial, portable Clojure/ClojureScript codebases, others do too, and stuff as fundamental as dropping syntax *hurts*.
19:22dnolencemerick: there's wasn't any promise documented anywhere about that convention, internally used as implementation detail
19:22dnolencemerick: people use js* too, nothing we can do about that
19:23cemerickdnolen: which convention, around warnings, or /?
19:23dnolencemerick: /
19:24bitemyappbbloom: an object to hold onto the closure? maybe. You don't retain closed over functions with Ring middleware, they just get composed into a final handler that's handed off to the server.
19:24cemerickdnolen: it's been part of Clojure (and ClojureScript) host interop from the start of both projects.
19:24bitemyappbbloom: from there it's down to the server to manage its thread pool and call the composed handlers.
19:24bitemyappyou don't retain them separately of that, anyway.
19:24dnolencemerick: it wasn't a part of anything, it doesn't take much poking around to realize that namespaces & var resolution in ClojureScript was half-baked forever
19:26cemerickdnolen: s/part of/available in/g, whatever
19:27coventry2Anyone around who's used haskell's hat? Does hat-detect live up to its promise in real debugging problems? http://projects.haskell.org/hat/
19:28cemerickdnolen: do you have any notion of when the usage will stop working, vs. just producing a warning?
19:28dnolencemerick: it will probably always just produce a warning, like all the other resolution checking stuff.
19:29bbloombitemyapp: sure, but if you're building up some data structure, like the final handler your passing off, then you can store data or closures or objects to protocol dispatch on or whatever. the bottom line is that there is some thing some where that has some context on which you hang your data. that's the point i was making, so any approach works more or less the same
19:29dnolencemerick: but I'm also happy to take a patch that makes it work for data types.
19:30bbloomdnolen: what's a "data type"?
19:30dnolenbbloom: cemerick wants to support that convention on deftypes, this seems easy to do.
19:30bbloomcemerick: why do you want that?
19:31cemerickbbloom: to be clear, I haven't said I want to support anything in particular.
19:31bbloomstatic field resolution is a java interop feature & the fact that clojure proper has some documented / widely-used functionality that depends on static fields of implementation detail classes is the problem
19:32bbloomif there is a static field that is useful in core that we want to be portable, it should be assigned to a var
19:32bbloomsimple as that
19:33cemerickSure, I'll go sed all of clojars, brb.
19:33bbloomno, i'm saying for writing portable code going forward
19:33bbloomcode is *not portable* now. if we want code to be more portable, then we need to make changes on both sides of the fence
19:33cemerickright, which I'm 100% cool with
19:34bbloomi've genuinely considered writing a lein plugin to run a C preprocessor, but realized that clojure uses # for too much stuff :-P
19:34bbloomi mean, that's literally what haskell does, which is kinda sad
19:35cemerickbbloom: that's roughly what cljx does
19:35bbloomyeah, i realize that
19:36ruzumadness?! this. is. clojure!!
19:40bitemyappbbloom: Haskell has gone a little too far with the preprocessor/TH/type-system madness.
19:41bbloombitemyapp: agreed
19:41bitemyappI really like HM type systems, but people overextend them beyond our ability to do a "good job" at present and it just ruins things.
19:41bitemyappwhich then ruins libraries because people use them as weird experiments instead of a way to get something done.
19:41echo-areaWhen you guys talking about 1933/1934, what does that mean?
19:42ruzuthe fine years in earth history
19:42echo-areaI don't think so, I think it means a project repo's revision
19:43bitemyappecho-area: pretty sure it's cljs
19:43dnolenwell cemerick's gone but here's the 6 lines change to make the static-field / convention work for deftypes http://github.com/clojure/clojurescript/compare/static-field-convention
19:46bbloomdnolen: negative 100 points man
19:46brainproxydnolen: weirdly enough, bumping my java version to a later point release of 1.7.0 has cleared up a bunch of weirdness
19:46brainproxy:/
19:47ruzunothing is weird in java-land
19:52dnolenbbloom: eh I'm not particularly opinionated about it, people may very well be using this convention everywhere, though I haven't seen that much of it in the wild.
19:52bbloomdnolen: no sense speculating. let's see if additional people complain
19:58echo-areabitemyapp: Is it https://github.com/clojure/clojurescript? How to interpret 1933?
20:00dnolenecho-area: we announce releases on the mailing lists with dependency info, 1933 is just based on the git commit
20:00dnolen[org.clojure/clojurescript "0.0-1933"]
20:00ruzu,(* 3 23)
20:00clojurebot69
21:03allenj12can someone tell me what is wrong with my recur call for a loop here https://www.refheap.com/19713
21:06llasramallenj12: The code you have now is trying to use the return value of your `println` call as a function which gets called with the result of the `recur` as a parameter
21:06llasramallenj12: If you make that a `do` containing the `println` call then the `recur`, you should fix that problem
21:07allenj12llasram, TY! seems weird tho ill have to play with it to understand i guess
21:08llasramallenj12: Just keep in mind that (<anything> ...) w/in regular code means calling <anything> as a function
21:08amalloyallenj12: (foo bar) "always" means "call foo as a function with bar as an argument", even when foo is itself a function call
21:08amalloythe quotes around always are because you will eventually discover exceptions, but they aren't anything you need to think about yet
21:09frozenlockWhere can I find the lastest clojurescript version for my project dependencies?
21:09frozenlock(It doesn't seem to be on clojars)
21:09allenj12llarsam, but arent they in different scopes?
21:09allenj12llasram, but arent they in different scopes?
21:10llasramallenj12: I'm not sure what you mean by "different scopes"
21:10amalloy$google clojurescript maven
21:10lazybot[Maven Repository: org.clojure » clojurescript] http://mvnrepository.com/artifact/org.clojure/clojurescript
21:10allenj12llasram, i guess im confused because recur is not within the end parenthesis of the println
21:11frozenlockamalloy: thanks
21:12amalloyallenj12: it's within the closing paren of the thing surrounding both it and the printlny
21:13amalloyyou want (if t x (y z)) to mean "if t is false, then do y and then z", but of course it actually means "if t is false, then call y as a function with z as an argument"
21:13allenj12amalloy, O I SEE! so since println outputs nil its like im say (nil (recur)) which makes recur not in tail position?
21:13arrdemallenj12: bingo
21:13arrdemallenj12: well... no...
21:13amalloyallenj12: yes
21:14allenj12im confused one no and one yes :P
21:14llasramallenj12: yes
21:14arrdemallenj12: yes
21:14llasramNow there's a majority :-)
21:14amalloyarrdem is wrong, we've outvoted him
21:14allenj12hurray! thnx
21:14arrdemeveryone outvotes me Q_Q
21:15dnolenfrozenlock: http://search.maven.org/#search%7Cga%7C1%7Cclojurescript
21:15arrdemallenj12: the issue here is that "in the tail position" means that (recur) can't occur as a parameter to some other function call
21:16arrdemallenj12: what you want is (do (println ...) (recur ...))
21:16arrdemallenj12: alternatively change the (if) to (when) and get the do for "free".
21:16allenj12arrdem, ahhh kk
21:17frozenlockOh boy, now I get "No such var: json/pprint, compiling:(cljs/source_map.clj:193:7)" :-(
21:19frozenlockHmmm http://dirk.net/2013/05/29/caused-by-javalangruntimeexception-no-such-var-jsonpprint/. I wonder if it's a bug
21:20allenj12the recur works! but is it the case you can not read-line in a loop binding?
21:20allenj12it just keeps assuming the not case lol
21:22arrdemallenj12: paste it. I have the feeling that your (if) is wrong.
21:23allenj12https://www.refheap.com/19713 seems possible but should still call read-line no? https://www.refheap.com/19713
21:23allenj12o wai
21:23allenj12thats old
21:23allenj12one sec
21:24dnolenfrozenlock: you probably have multiple versions of data.json somehow, use lein deps tree
21:24allenj12arrdem, here it is https://www.refheap.com/19713
21:26frozenlockdnolen: I only see the one I just added... :-/
21:26dnolenfrozenlock: you shouldn't have to add it, it's a declared dep
21:27llasramallenj12: Is your `when` condition inverted?
21:28arrdemllasram: yes it is
21:28arrdemallenj12: when-not
21:28dpathakjallenj12: you are inside an implicit 'do' block. the last form in this block is the return value of the whole thing. you're unconditionally evaluating three forms in sequence, the final one being 'recur'.
21:30allenj12llasram, huh dosnt it return true if the input is in that list and returns it?
21:30allenj12hmmm
21:30Raynesallenj12: Oh God what am I in a room with?
21:30arrdemRaynes: chord
21:31arrdemRaynes: have fun
21:31llasramallenj12: I think you were led astray about `when` earlier. When the condition is false, `when` returns `nil`. When the condition is true, `when` evaluates all of it's body forms (usually for side-effects), then returns the value of the last form
21:31allenj12Raynes, lol
21:32llasramallenj12: So I think you really do need an `if` + `do`
21:32allenj12llasram, i tried that to same result and also the weird thing is it is not waiting for input from the terminal
21:33arrdemllasram: yes, if .. input (do println recur)
21:33llasramallenj12: Terminal input I'm afraid I cannot help you with...
21:33allenj12llasram, well i mean isnt that what read-line does in this scenario?
21:35llasramallenj12: Maybe? Terminal input on the JVM is fraught with peril. Or at least engenders some level of complication
21:36allenj12llasram, hm yea this ir rly weird im starting to think you can not take in input during a loop binding
21:37allenj12https://www.refheap.com/19713 yea changed it back to this same problem
21:38llasramallenj12: In general from a normal stream that would not be a problem. I don't know the idiosyncrasies of terminal input though
21:39allenj12llasram, hmm kk ill keep playin with it
21:46allenj12llasram, i think i figurd it out if i used with-open before to open a file do i have to close it?
21:46arrdemallenj12: I found your problem.
21:46arrdemallenj12: you are -> read-line as a _function_
21:46allenj12arrdem, yea?
21:47arrdemallenj12: (read-line) != read-line
21:47llasramallenj12: `with-open` is kind of poorly named -- what it actually does is close the file when exiting the dynamic scope of the form :-)
21:47llasramarrdem: Oh, dur
21:47arrdemllasram: iknowrite
21:47allenj12arrdem, oooo so can i keep the -> and just change it to (read-line)
21:48arrdemallenj12: totally
21:48arrdemllasram: I didn't see that until I did a "fuckit prn everything"
21:48Raynesarrdem: https://github.com/flatland/useful/blob/develop/src/flatland/useful/debug.clj
21:49allenj12arrdem, IT WORKS!
21:49arrdemRaynes: I did a prn-let a while back myself... this one's nicer tho.
21:54arrdemRaynes: what on earth did you use flatland.useful.fn/rate-limited for?
21:54Raynesamalloy: ^
21:57amalloyarrdem: i wrote rate-limited for 4clojure, actually
21:58arrdemamalloy: ah. I was expecting some slow system side-effect case.
21:58amalloywe wanted a link users could click on to tweet their solution, and i wanted it to include the #clojure tag at most once an hour, because a couple people complained 4clojure was flooding that channel
21:59amalloythus, a function that returns "#clojure " sometimes, and nil other times
21:59arrdemamalloy: whole lot of cool stuff in this toolkit! .seqs is awesome.
22:01bitemyapparrdem: if you want web-app-oriented rate limiting there's bulwark.
22:08dpathakjWhat's the mode line for an nrepl buffer in emacs supposed to be?
22:10dpathakjmore generally, does anyone have tips on how to debug problems with nrepl+emacs? i broke my configuration today and can't seem to figure out what's wrong.
22:12dpathakjM-x nrepl-jack-in usually pops up an nrepl buffer with a prompt, but now it's just an empty buffer. don't know why.
22:12cemerickdnolen: sorry for dropping off before, just weaving some cljs work in between other stuff this weekend
22:12dpathakjand eval gives "No Lisp subprocess; see variable `inferior-lisp-buffer'"
22:12bitemyappdpathakj: don't use nji
22:13dpathakjwhat should I use instead?
22:15arrdembitemyapp: nji totally works... what are you on about?
22:15llasramYeah -- first I've heard this advice
22:16llasramThat said, I did just upgrade to 0.2.0, and noticed at least my paredit-activation hook didn't work
22:16dpathakjhttp://blog.worldcognition.com/2012/07/setting-up-emacs-for-clojure-programming.html is what I used to get my setup up and running.
22:17arrdemdpathakj: what isn't working about this? it's basically the same setup I'm using...
22:17dpathakjyeah, worked for me too until recently.
22:20dpathakji installed a bunch of packages/added to my .emacs to get slime + sbcl to work. it's something to do with that.
22:21arrdemI must confess that I've yet to figure out a good way to debug .emacs issues... last time I got some I basically nuked from orbit, rebuilt and everything worked :/
22:22bitemyapparrdem: I was trying to get him to help me debug the problem
22:22bitemyapparrdem: but if you'd like to help him instead go for it
22:22dpathakjM-x nrepl gives me "error in process sentinel: Wrong type argument: stringp, nil" which I can't help but feel would be a big clue if I knew a little more
22:22bitemyappdpathakj: fire up a repl in the terminal, connect to it from emacs instead of using nrepl-jack-in
22:24arrdembitemyapp: I'm just curious.. go for it.
22:24bitemyapparrdem: I've had nji get into a bad state and break for me before.
22:26dpathakjdone. this buffer's acting similarly to the one I had before. entirely blank, and when i write (+ 1 2)<RET> the resulting message is 'Wrong type argument: stringp, nil'
22:28hiredmandnolen: you know, if you had a value that unified with everything without extending the substitution map you wouldn't need macrolet and _
22:28konrHow can I redefine inc in (defn foo [] (map #(inc %) (range 3)))? (with-redefs [inc ...] (foo)) won't do it, because `inc` is inside an anonymous function
22:29arrdemkonr: (let [inc ..] (map #(...)))
22:29hiredmana. #(inc %) is inc b. it has nothing to do with inc being inside an anonymous function
22:30hiredmanthe clojure compiler inlines certain function calls, mostly to do with math for performance
22:31konrarrdem: still [1 2 3
22:31konrarrdem: with (let [inc #(+ 3 %)] (foo))
22:32arrdemkonr: the way that clojure does symbol resolution that won't work.
22:32arrdemkonr: you could _locally_ rebind inc using let, but the inc usage has to be directly wrapped by the let.
22:33arrdemkonr: eg. (defn foo [] (let [inc #(+ 3 %1)] (map inc (range 3))))
22:34arrdemkonr: here the compiler will resolve inc to user/inc and all will be well, otherwise as in your example inc will resolve to clojure.core/inc and it won't behave as you expect.
22:35amalloyarrdem: user/inc doesn't exist, in real life or in your example
22:36amalloythe point about locally binding inc is fine, but it doesn't do anything to the user/ namespace
22:37arrdem,(let [x] (print 'x))
22:37clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in sandbox:>
22:38arrdemamalloy: ah. let doesn't create ns level symbols. right.
22:41konrso the problem is compiler inlining the call? If instead of (map #(inc %) ...) I do (map inc ...) and then redefine inc in the same way, I do get the expected behavior
22:46dnolenhiredman: huh, not a bad idea!
22:46dnolencemerick: here's a partial solution (bbloom didn't approve) http://github.com/clojure/clojurescript/compare/static-field-convention
22:47dnolencemerick: would probably need to be extended to handle :use :only / :require :refer
22:47satshaba2Clojure is awesome!
22:47arrdemkonr: I suspect that what you are seeing is an artifact of when the compiler does symbol resolution, but I don't know for sure.
22:47RaynesThis is an accurate statement.
22:48satshaba2one thing though... It seems difficult to just write a little clojure script for a one off thing
22:48satshaba2like I wanted to do some math homework with clojure
22:48satshaba2So i look up the math library
22:49satshaba2and then i realize I need to make a new project with lein
22:49satshaba2I guess it wasn't that painfull
22:50coventryarrdem: You are right. (inc)'s :inline metadata is `(. clojure.lang.Numbers (~(if *unchecked-math* 'unchecked_inc 'inc) ~x)), which is expanded at compile time, so #'clojure.core/inc is not referenced at runtime, meaning with-redefsing it has no impact on the calculation.
22:50Raynessatshaba2: Most people purposely avoid doing that sort of thing because Clojure takes a while to startup. It's usually not very suited for one off scripts.
22:50RaynesUnfortunately.
22:51satshaba2huh, I see now. Well I was looking for a kind of Ipython notebook kind of thing. I have something good going with LightTable's insarepl connecting to a lein project that manages deps.
22:51satshaba2Kinda over kill but I love the instarepl
22:53frozenlockArg... again a cljs problem. I just moved to the lastest version and now enfocus (1.0.0) doesn't work :( ----> clojure.lang.ExceptionInfo: :as alias must be unique; offending spec: [goog.events :as events]
22:53arrdemsatshaba2: have you used emacs+nrepl or just LT?
22:54frozenlockAny workaround, other than forking this old version and correcting the alias thingy?
22:54satshaba2arrdem: sorry I'm a vim guy
22:54satshaba2just LT so far
22:54satshaba2trying out fireplace.vim too
22:54arrdemsatshaba2: ok, just curious.
22:58cemerickdnolen: yeah, I saw. I can't say I have an opinion yet, will look more closely tomorrow. Still picking through the more significant changes since the version that cljsbuild implies currently.
22:59cemerickdnolen: thanks for entertaining the notion, though :-)
23:03dnolencemerick: let me know if you encounter anything else you think is major - the only real significant change IMO was the keyword-identical? bit
23:04konrcoventry, arrdem: even changing to a function with no inline metadata, the behavior stays consistent, vide http://7fc871fb5f2266d6.paste.se/
23:04hiredman~map
23:05clojurebotmap is an evil genius.
23:05hiredman~map
23:05clojurebotmap is *LAZY*
23:06arrdem,(macroexpand '(defn bar [] (map vector (range 3))))
23:06clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
23:06arrdemgoddamnit clojurebot.
23:06satshaba2hey so say I do something like (:use clojure.contrib.generic.math-functions) in my repl, what's the easiest way to see the functions that library exports?
23:06satshaba2and maybe the docs for those functions
23:10arrdemsatshaba2: you want https://github.com/clojure/algo.generic, I suspect.
23:11satshaba2i do?
23:11satshaba2arrdem: Not sure I see the connection
23:11arrdemsatshaba2: that library is where contrib.generic.math-functions seems to have landed with the deprication of contrib.*
23:12satshaba2I mean: Say I want to do some math. So I get the math library. it's in my repl. How do I tell what functions I have to use without leaving the repl?
23:12satshaba2ah I say, so you're saying th best way is to just look it up online?
23:12dpathakjgot it.
23:13coventrykonr: Huh, there must be something more going on, then.
23:13dpathakjbitemyapp: arrdem: it was possibly some combination of an old nrepl.el and a new leiningen.
23:13arrdemsatshaba2: so if you _know_ that the library in question is in your classpath then (use ..) and (require ..) will load it in for you.
23:13satshaba2yes, but after that. Like for exploring that api
23:14arrdemsatshaba2: oh. google is your best bet IME.
23:14dpathakjanyway, uninstalled packages I got from melpa and installed from marmalade and that fixed things.
23:14satshaba2like if I was in Eclipse and I hit Math.<autocomplete>
23:14satshaba2OK cool
23:14arrdemsatshaba2: there are namespace tools for enumerating symbols in an ns.. but I don't use them.
23:16arrdemsatshaba2: one could use clojure.core/ns-interns, along with clojure.repl/doc
23:17satshaba2nice. Yes I was repl/doc
23:17satshaba2that seems to work alright
23:17satshaba2also just going to source is pretty easy
23:23frozenlockAm I reading this correctly? The google closure library used for cljs is a snapshot of 2013-02-12 http://mvnrepository.com/artifact/org.clojure/google-closure-library
23:24allenj12hey i have an idea an wanna know if it will work. if i have a function that has 3 conditions to recur it.. could i just store the function names and values in a vector and the change the value needed when needed so i dont need a case or cond
23:24allenj12if that makes sense
23:32allenj12if v is '(inc 5) how do i unquote that ~v ~ v or (~ v ) dont seem to work
23:33llasramallenj12: Er, what are you trying to do?
23:33dnolenfrozenlock: yep
23:33coventryallenj12: Do you mean (eval '(inc 5))? Probably not a good direction to go in.
23:34allenj12llasram, isnt it possible to unquote that list so its called as a function instead of being a list
23:34llasramallenj12: Kind-of-but-not-really-depending-on-what-you-mean? But you can just use functions as values
23:34allenj12llasram, http://clojuredocs.org/clojure_core/clojure.core/unquote
23:35llasram,(map #(% 1) [inc dec #(+ 2 %)])
23:35clojurebot(2 0 3)
23:35llasramallenj12: Yeah, `unquote` only has meaning inside of a syntax-quote
23:36llasramSo ##(let [x 'foo] `(x ~x))
23:36lazybot⇒ (clojure.core/x foo)
23:36allenj12o thats lame
23:36llasramEr, why?
23:37frozenlockdnolen: If I want a function that was introduced in more recent version of goog closure, should I just take the js and use it as any other external js library?
23:37allenj12llaram, :) nothing i just had an idea to shorten some line see i have a function with 3 conditions that change different parameters when recuring so i thought it would be cool to quote the list and change the value in that list unquote and recur it then
23:38allenj12llasram, thought that would be cool is there a practical way to do that?
23:38dnolenfrozenlock: I've asked for a more recent GClosure build, hopefully we can get that in the next release
23:38allenj12llasram, or is that not idiomatic at all
23:38frozenlockdnolen: That would be great! :D
23:39frozenlockBut meanwhile, I suppose my alternative is the best way?
23:39frozenlock(as in hassle free)
23:39llasramallenj12: I don't fully understand what you're saying, but you can probably have a set of three functions you dispatch to one of based on the condition, then destructure + recur once
23:40allenj12llassram, lemme paste it with comments to explain
23:43dnolengiving a talk on Monday about the CLJS compiler, maybe someone else will find this interesting - https://github.com/swannodette/hs-compilers/blob/master/src/hs_compilers/core.clj
23:43allenj12llasram, https://www.refheap.com/19717 does that make things more clear
23:45llasramallenj12: Yeah, so you can have a `let` where you bind the new values you want to recur with to the result of evaluating some conditional expression, then recur w/ those new values
23:45llasramI think that's possibly what you want? I'm still not 100% sure, but I think that's because you still need to experiment a bit :-)
23:47allenj12llasram, hmm possible but only one value will change i was hoping to have only the one needed to change. and your right i do need to experiment so much fun to explore seems like so many possibilities
23:52allenj12someone said before eval is bad? why is that?
23:54llasram~eval
23:55clojureboteval is sometimes useful - but only sometimes
23:55llasramExcept in rare circumstances using `eval` means you didn't arrange for your code to be evaluated at the right time in the first place
23:56allenj12llasram, i see
23:58coventryYou almost never want eval unless the problem you're ultimately trying to solve inherently involves source code.