2013-10-12
| 00:05 | uvtc | Well, ahem, anyhow, I see that trying it works. :) |
| 00:06 | indigo | bitemyapp: http://i.imgur.com/64wFIu7.jpg :P |
| 00:08 | uvtc | indigo, classy black ring on top. Hm. I don't see a "swag" or similar link at clojure.org for any merch though. |
| 00:08 | indigo | uvtc: It's the Clojure way to compose everything |
| 00:08 | indigo | So what you need to do is grab this http://nbeloglazov.github.io/clojure-mug-template/ |
| 00:08 | indigo | And then go to your custom mug seller of choice |
| 00:09 | indigo | ;) |
| 00:09 | uvtc | I recall at one point there were tee-shirts or mugs or something available, and it was mentioned on the ML.... |
| 00:10 | uvtc | Oh, there it is. On the community page. Looks like just stickers available though. |
| 00:11 | indigo | Clojure definitely needs more swag |
| 00:11 | indigo | I looked at the community page first |
| 00:22 | echo-area | It occurs to me that StaticMethodExpr is not used anymore for dot-expressions e.g. (. obj method). |
| 00:22 | echo-area | Am I right? |
| 00:25 | echo-area | amalloy: Do you know any bit of it? |
| 00:27 | amalloy | i don't |
| 00:28 | echo-area | Okay, thanks |
| 00:29 | coventry | echo-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:31 | ruzu | would clojure be as awesome if someone other than sir hickey made it? |
| 00:32 | echo-area | coventry: I'm trying to address this problem: http://pastebin.com/AYqzXy6Q |
| 00:33 | echo-area | The JVM couldn't even be started in that case |
| 00:33 | echo-area | It signals about the exceptions when initializing the genclass generated class and then quit |
| 00:34 | echo-area | I then see the generated clinit method via javap |
| 00:35 | echo-area | And I found exact the invocation to internPrivate for -main, -equals, -toString etc |
| 00:36 | echo-area | Such invocations will cause RT to initialize, which loads clojure/core.clj in classpath |
| 00:36 | echo-area | Then when def'ing `meta' at line 205, the exceptions are thrown |
| 00:37 | echo-area | That's basically what happened there. |
| 00:38 | echo-area | But I find it difficult to explain why a StaticMethodExpr object is created when analyzing (. ^clojure.lang.IMeta x (meta)) |
| 00:39 | coventry | I don't know why, but a StaticMethodExpr is constructed in clojure.lang.Compiler.HostExpr.Parser, which is where . expressions are processed. |
| 00:40 | echo-area | Sure it is constructed in HostExpr |
| 00:41 | echo-area | The expression being processed is (. ^clojure.lang.IMeta x (meta)), or (. x (meta)) (meta added to symbol `x') seen by the compiler |
| 00:43 | echo-area | Where 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:43 | echo-area | maybeClass(x, false) |
| 00:45 | coventry | Why should maybeClass always return null? |
| 00:47 | echo-area | Because in this case the form is a symbol its namespace is null, then the result can be deducted from the code |
| 00:50 | tim | mdrogalis: ping |
| 00:54 | coventry | echo-area: Pretty sure that's not the case. Good luck. |
| 01:34 | allenj12 | hey |
| 01:34 | allenj12 | can you have a case within a let binding |
| 01:34 | allenj12 | ? |
| 01:36 | uvtc | allenj12, Sure. |
| 01:36 | allenj12 | ahh kk cool! |
| 01:37 | uvtc | allenj12, <http://clojuredocs.org/clojure_core/clojure.core/case> |
| 01:39 | muhoo | way OT, but for some reason i figure folks here might enjoy: https://www.usenix.org/system/files/1309_14-17_mickens.pdf |
| 01:47 | amalloy | allenj12: you can let-bind any expression |
| 01:47 | allenj12 | i think so? |
| 01:55 | uvtc | allenj12, Clojure's swonderful ... it's smarvelous. :) |
| 01:55 | allenj12 | uvtx, i see that more and more |
| 01:55 | allenj12 | uvtc, i see that more and more |
| 01:59 | uvtc | muhoo, hehehehe I like his writing style. :) |
| 02:47 | bitemyapp | indigo: I am jealous of your mug on two accounts. 1. I want the damn mug 2. I cannot partake of caffeine. |
| 02:47 | indigo | bitemyapp: Make it, and I only drink tea anyway |
| 02:47 | oakaz | hi all |
| 02:48 | oakaz | I'm an absolute beginner: how can I fetch a web page with Clojure, without using the Java libraries? |
| 02:48 | oakaz | I'd like to go through the Clojure way of doing this |
| 02:48 | bitemyapp | indigo: I can't drink tea either, still has caffeine. |
| 02:48 | bitemyapp | oakaz: clj-http is simple enough. |
| 02:48 | indigo | Oh lame |
| 02:48 | bitemyapp | oakaz: dakrone/clj-http |
| 02:49 | indigo | I tried going without caffeine for a while due to withdrawal headaches, but I couldn't seem to get that focus I needed |
| 02:49 | uvtc | oakaz, I think `slurp` will do that... |
| 02:50 | bitemyapp | indigo: I've been working on that. Exercise is helping. |
| 02:50 | indigo | I should also start on an exercise regime... a standing desk isn't really a replacement for that :P |
| 02:51 | uvtc | oakaz, yes, `(def content (slurp "http://example.com/stuff.html"))` |
| 02:51 | oakaz | thanks for the answers! so, we add that [clj-http "0.7.7"] to project.clj and it becomes available ? |
| 02:52 | oakaz | I also need to use the noir-async thing :) |
| 02:52 | oakaz | I'm familiar with lisp but don't know this platform yet :) |
| 02:54 | oakaz | clojars looks really nice, every project has its snapshot there as it seems |
| 02:54 | oakaz | I wish golang had the same thing |
| 02:54 | uvtc | oakaz, clojars.org is galactic hq for Clojure libs. |
| 02:55 | oakaz | fantastic |
| 02:56 | oakaz | is there any lein command for creating a project similar to lein new noir ? |
| 02:56 | oakaz | *creating a new lein-async project* |
| 02:58 | uvtc | oakaz, 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:00 | indigo | 'Night, people |
| 03:00 | uvtc | 'night |
| 03:01 | frozenlock | I want to count how many times a file is downloaded via compojure... any advice on how to do it? |
| 03:01 | oakaz | indigo: hey, I saw you wanna start exercising, |
| 03:01 | oakaz | you can try: 7min.io |
| 03:19 | amalloy | frozenlock: wrap the handler that serves the file with something that writes to a file or updates an atom? seems pretty straightforward |
| 03:25 | frozenlock | amalloy: adding another wrap seemed a little overkill... ie using a function on every request, only to count one file access in particular. :-/ |
| 03:25 | frozenlock | I might be overthinking it. |
| 03:25 | frozenlock | Or underthinking it. |
| 03:25 | amalloy | frozenlock: if you're writing an operating system from scratch, you can worry about the overhead of calling a function |
| 03:25 | amalloy | if you're working at the C level or higher, forget about it |
| 03:26 | frozenlock | Understood |
| 03:26 | frozenlock | Thanks :) |
| 03:36 | allenj12 | what is the difference between get and nth |
| 04:22 | sritchie | technomancy, do you have any advice for gpg: cancelled by user |
| 04:22 | sritchie | gpg: decryption failed: secret key not available |
| 04:22 | sritchie | on a call to lein deploy? |
| 04:23 | amalloy | sritchie: did you, the user, cancel gpg because you don't have the secret key for your clojars credentials file? |
| 04:23 | sritchie | well, I'm trying to deploy to an s3 bucket using s3-private-wagon |
| 04:23 | sritchie | I have gpg-agent running, but I did not cancel |
| 04:24 | sritchie | if I DON'T use gpg agent |
| 04:24 | sritchie | I get this error: |
| 04:24 | sritchie | "gpg: can't query passphrase in batch mode" |
| 04:24 | sritchie | with multiple failures, then it returns to me |
| 04:26 | amalloy | hm. 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:27 | sritchie | amalloy: I think this is a leiningen thing, |
| 04:27 | sritchie | since it's happening without that plugin as well |
| 04:27 | sritchie | just accessing credentials |
| 04:28 | bitemyapp | sritchie: you know it's 0053 in technomancy's timezone right? |
| 04:28 | bitemyapp | perhaps a github issue? |
| 04:28 | oakaz | I have an HTML page that I'd like to extract data between <b></b> |
| 04:28 | sritchie | bitemyapp: I'm in that tz :) |
| 04:28 | sritchie | he's on, was just checking if he's around |
| 04:28 | oakaz | what library should I use? or should I just do regex ? |
| 04:30 | bitemyapp | oakaz: there's a number of libraries for turning HTML/XML into something traversable. clojure.zip and enlive come to mind. |
| 04:30 | bitemyapp | oakaz: and laser. |
| 04:30 | oakaz | which one is the handier ? |
| 04:31 | oakaz | what I need is extremely simple: just the text between <b> and </b> |
| 04:36 | oakaz | just used subs :) |
| 06:53 | namccarty | So 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:15 | echo-area | I understand my problem now |
| 07:17 | echo-area | The directory I added to classpath contains a single class whose name is `x' |
| 07:18 | echo-area | This makes Clojure resolve (. ^clojure.lang.IMeta x (meta)) as invoking this class' method `meta' |
| 07:18 | echo-area | Hence the exception. |
| 07:19 | echo-area | And indeed this is my fault to name a class such a short and unidiomatic name |
| 07:28 | echo-area | coventry: BTW, in that case, maybeClass should return null for form (. ^clojure.lang.IMeta x (meta)), as I said. |
| 07:37 | john2x | how do I enforce a fn parameter that's a vector with an even number of items. (like in `let` bindings) |
| 07:38 | john2x | just even? and then throw exception? |
| 08:10 | rurumate1 | bbloom: 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:35 | rurumate1 | Oh nvm it needed another (require '[goog.string.format]) because that function is in a separate namespace or so. |
| 08:44 | sm0ke | like hiccup is there something similar for css in clojure? |
| 09:29 | gfredericks | easy 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:53 | rcarmo | I need help with implementing a shared counter (yeah, yeah, I know) |
| 10:33 | hyPiRion | (def counter (ref 0)) |
| 10:33 | hyPiRion | to increment, (dosync (commute counter inc)) |
| 10:34 | hyPiRion | to decrement, (dosync (commute counter dec). To read, use deref |
| 10:36 | gfredericks | hyPiRion: what's the reasoning for the ref? |
| 10:37 | gfredericks | is there an argument for refs by default just in case somebody's using a transaction? |
| 10:37 | hyPiRion | shared use of mutable storage? |
| 10:38 | hyPiRion | I guessed a shared counter is shared |
| 10:38 | gfredericks | o_O? |
| 10:38 | gfredericks | no idea what you're talking about; why not an atom? |
| 10:39 | gfredericks | (defmacro ->is [val & exprs] `(let [x# ~val] (is (-> x# ~@exprs)) x#)) |
| 10:40 | hyPiRion | gfredericks: maximal safety guards, I guess? Don't know if the counter will be used along with some other mutable variable. |
| 10:40 | hyPiRion | *maximize |
| 10:42 | hyPiRion | gfredericks: Although I guess a counter would just be used to, well, count. |
| 10:42 | gfredericks | ,(let [a (atom nil)] (dosync (swap! a conj 42))) |
| 10:43 | clojurebot | (42) |
| 10:43 | gfredericks | hm |
| 10:44 | gfredericks | don't think you want to mix it with dosync though. I was hoping that would crash. |
| 11:13 | mattrepl | any 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:17 | hyPiRion | mattrepl: 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:18 | hyPiRion | (I know because I bought one a couple of minutes after they opened the sale) |
| 11:18 | mattrepl | huh, not sure how I missed it. maybe they were sold out back then too. =) |
| 11:20 | hyPiRion | I was fairly sure there still were a couple left after 24 hours, but don't quote me on that. |
| 11:20 | gfredericks | hyPiRion: you're coming to 'murica? |
| 11:20 | hyPiRion | gfredericks: yus |
| 11:20 | gfredericks | dangit you're tempting me to be tempted to consider going |
| 11:21 | hyPiRion | gfredericks: Yeah, now you have to come to the conj |
| 11:23 | hyPiRion | Oh, only two weeks until Swearjure video is out |
| 11:56 | sm0ke | hey guys what is a sane vim setting for t_Co? |
| 11:56 | sm0ke | oh sorry |
| 11:59 | Foxboron | sm0ke: 256 i believe |
| 12:02 | sm0ke | Foxboron: people over vim say not to set it at all |
| 12:02 | sm0ke | its really dangerous setting |
| 12:14 | avishai | hi |
| 12:14 | avishai | is there a way to import/use protocols/record methods in another namespace? |
| 12:17 | `cbp | avishai: sure |
| 12:17 | avishai | i mean, do i have to define a protocol in the same namespace i'll be using its methods? |
| 12:18 | `cbp | avishai: nope |
| 12:18 | `cbp | http://www.youtube.com/watch?v=R3PZMIwXN_g&feature=youtu.be&a <3 |
| 12:18 | avishai | if not, how do import it? |
| 12:19 | avishai | (require '[protocols-ns :refer :all]) doesn't help |
| 12:19 | `cbp | avishai: are you trying to extend the protocol in another namespace or call the methods in another namespace? |
| 12:20 | avishai | call the methods on a record in another namespace |
| 12:20 | `cbp | avishai: to call the methods you have to require the namespace methods and import the record |
| 12:20 | avishai | isn't :refer :all enough? |
| 12:21 | `cbp | avishai: records have to be imported |
| 12:21 | `cbp | also deftypes for that matter |
| 12:27 | `cbp | avishai: also only importing the record isn't enough, you have to require the namespace so it 'compiles' :) |
| 12:28 | `cbp | the defrecord i mean |
| 12:33 | avishai | darn it |
| 12:33 | avishai | still can't get it to work |
| 12:33 | avishai | i'm missing something |
| 12:35 | avishai | when i import i get class not found |
| 12:39 | avishai | huh |
| 12:39 | avishai | works with :refer :all |
| 12:39 | avishai | but not with import |
| 12:44 | avishai | completely unrelated noob question |
| 12:44 | avishai | i've been playing around with clojure for some time now |
| 12:45 | avishai | i tried using idea, lighttable and sublime |
| 12:45 | avishai | can't say i'm too happy |
| 12:45 | avishai | i want to try emacs |
| 12:46 | avishai | can anybody recommend an emacs setup for interactive development? |
| 12:49 | `cbp | avishai: emacs live |
| 12:50 | `cbp | avishai: you need to require before you import for the class to compile |
| 12:51 | `cbp | avishai: maybe you can share a paste |
| 12:51 | `cbp | so I can stop trying to guess :P |
| 12:54 | avishai | `cbp, any thought about prelude? |
| 12:55 | ruzu | honda stopped making them, sadly |
| 12:55 | `cbp | avishai: never used it |
| 13:06 | Pupnik__ | my housemate has a prelude :p |
| 13:06 | Pupnik__ | good question avishai ive been looking for a satisfactory clojure tool too |
| 13:06 | Pupnik__ | im just about down to emacs or vim |
| 13:28 | coventry | `cbp: Thanks for the youtubue link. Great stuff. |
| 13:43 | coventry | Pupnik__, avishai: I haven't used either (I use emacs), but there's also counterclockwise and intellij. |
| 13:45 | muhoo | namccarty: 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:46 | muhoo | i forget who said that, since debugging is harder than coding, if you've written clever cod you've made it impossible to debug. |
| 13:49 | Pupnik__ | yeah CCW is pretty good and has a nice repl but I don't like eclipse |
| 13:51 | gfredericks | do 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:52 | gfredericks | the important difference being in the former case you could safely load multiple versions of the secondary lib |
| 14:08 | ruzu | is anyone familiar with datomic? |
| 14:09 | gfredericks | I am. and I'm on the #datomic channel which might be more appropriate |
| 14:19 | avishai | question |
| 14:20 | gfredericks | Unable to resolve symbol: question in this context, compiling |
| 14:20 | avishai | is there a reason to use monads rather then function composition? |
| 14:20 | gfredericks | in clojure in particular? |
| 14:20 | sm0ke | monads are the nomads of functional ages. |
| 14:20 | avishai | yes |
| 14:21 | gfredericks | monads are less usable in clojure than in static languages |
| 14:22 | gfredericks | due to lack of compiler assistance |
| 14:23 | avishai | so monads primary function is to build pipelines which compatible wrapper types? |
| 14:23 | gfredericks | some quote somewhere says that monads are for changing the behavior of the semicolon operator |
| 14:23 | jkj | going to euroclojure anyone? |
| 14:24 | avishai | much to learn.... |
| 14:25 | coventry | "She speaks with programmable semicolons. She's that kind of smart." |
| 14:26 | gfredericks | monads are for abstracting the unabstractable |
| 14:26 | Chousuke | avishai: monads are just an abstraction among others. it just happens that they are useful for modeling all sorts of effects |
| 14:28 | lodin | avishai: 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:31 | coventry | Konrad 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:31 | avishai | thanks! |
| 14:34 | cemerick | dnolen: what gave you the impression that checkout deps were deprecated? |
| 15:07 | dnolen | cemerick: that's what technomancy said |
| 15:13 | rhg135 | can 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:17 | gfredericks | rhg135: bitbucket is failing me; are you using advanced compilation? do you get the same result without it? |
| 15:17 | rhg135 | its simple |
| 15:17 | rhg135 | ya, i found that issue out the hard way D: |
| 15:18 | rhg135 | i think bitbucket was failing a while ago |
| 15:18 | cemerick | dnolen: huh, ok; news to me |
| 15:19 | dnolen | cemerick: fairly old news, effective since Lein 2 |
| 15:20 | rhg135 | i 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:21 | cemerick | dnolen: 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:23 | dnolen | cemerick: maybe we're not talking about the same thing - https://github.com/clojure/clojurescript/wiki/Patches |
| 15:24 | dnolen | cemerick: 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:24 | dnolen | s/go/got |
| 15:24 | coventry | dnolen: 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:24 | cemerick | dnolen: yeah, extra-classpath-dirs has been on its way out for a while, I can imagine it being toast at this point. |
| 15:25 | dnolen | coventry: yes I might have gotten confused, anyways, if people have better instructions for testing patches update wiki |
| 15:25 | cemerick | dnolen: 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:26 | dnolen | cemerick: so update the instructions - I don't know how it should be done |
| 15:26 | cemerick | I very rarely use them, so I wouldn't want to go changing wikis at this point. |
| 15:26 | rhg135 | ok then, any ideas to make this more clojurish? https://bitbucket.org/rhg135/jimpy |
| 15:26 | `cbp | I can't find a binding in the nrepl.el readme :P |
| 15:26 | dnolen | cemerick: sure, but again I don't know anything about it, these the instructions I know works. |
| 15:26 | dnolen | these are the |
| 15:27 | coventry | `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:27 | dnolen | cemerick: sorry for the confusion about checkouts |
| 15:27 | `cbp | coventry: I wanna do something like C-c C-c but have it appear on the repl |
| 15:27 | rhg135 | in theory python is sort of functional |
| 15:28 | `cbp | instead of the silly minibuffer :P |
| 15:28 | cemerick | dnolen: no worries :-) |
| 15:29 | `cbp | like this guy does it in this video http://www.youtube.com/watch?v=R3PZMIwXN_g&feature=youtu.be&a |
| 15:30 | coventry | Yeah, I was wondering about that. Pretty sure he's using emacs-live there. |
| 15:32 | `cbp | it would help because autocomplete always messes me up and prints a ton of whitespace when i'm on the repl |
| 15:41 | jonasen | So I added a "console" to http://cljsfiddle.net, next I'll work on a real repl :) |
| 15:45 | cemerick | dnolen: Dunno if you're keeping a tally on it, but you can mark me down as -1 re: dropping `format` from core.cljs |
| 15:45 | dnolen | cemerick: it's not coming back |
| 15:45 | dnolen | cemerick: unless someone does it right |
| 15:46 | cemerick | dnolen: you mean, a reimplementation of printf-style interpolation in cljs? |
| 15:46 | dnolen | cemerick: yep |
| 15:47 | dnolen | cemerick: so many things about the GClosure implementation is completely botched |
| 15:47 | dnolen | cemerick: even GClosure itself doesn't recommend it's use! |
| 15:49 | cemerick | dnolen: 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:50 | dnolen | cemerick: it's not going to happen until someone submits a proper format |
| 15:50 | cemerick | The host has what it has. Reimplementing everything in cljs soup to nuts can't be an answer. |
| 15:50 | dnolen | cemerick: it's a minor missing thing, you aren't going to convince me to include it |
| 15:50 | dnolen | it's too broken |
| 15:50 | jonasen | dnolen: cemerick: did it interfere with advanced compilation? |
| 15:52 | dnolen | jonasen: 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:53 | cemerick | dnolen: what was the nature of the interference? I've been using it w/ advanced for a long time. |
| 15:54 | dnolen | cemerick: it mutates a hash at runtime, it cannot be eliminated if you don't use it. |
| 16:05 | cemerick | dnolen: *shrug* I'd prefer easy(ier) portability over marginal code footprint improvements any day. |
| 16:05 | cemerick | Anyway, I guess it's time for me to bring my << string interpolation macro out of the attic. :-) |
| 16:06 | brainproxy | recommendation for set that preserves insertion order in clojurescript? |
| 16:08 | dnolen | cemerick: 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:09 | bbloom | dnolen: latest chrome runs the Epic Citadel demo capped at 60fps on my box: http://www.unrealengine.com/html5/ |
| 16:10 | bbloom | dnolen: i don't think v8 explicitly respects "use asm" but it seems to be fully optimized for those code paths now |
| 16:10 | dnolen | bbloom: yeah cool stuff, I also heard Brendan Eich arguing for threads in ES 7 o_0 |
| 16:10 | dnolen | at JSConfEU |
| 16:10 | dnolen | cool for us |
| 16:10 | dnolen | if that happens |
| 16:11 | bbloom | dnolen: all i want is for javascript to die |
| 16:11 | jonasen | cemerick: porting your strint to cljs has been on my todo list :) I think it would be useful |
| 16:11 | bbloom | dnolen: and if that means i need to compile a full VM to typed arrays |
| 16:11 | bbloom | fine by me. |
| 16:11 | bbloom | adding features to JS just seems like a bad plan to me |
| 16:12 | cemerick | jonasen: should just work...it's a macro |
| 16:12 | dnolen | bbloom: yeah I don't really care, wherever the web goes we'll compile to it |
| 16:12 | bbloom | gonna 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:16 | dnolen | bbloom: eh, I suspect browsers will win out in the end, worse is better and all that. |
| 16:17 | bbloom | dnolen: i don't believe in worse is better. there's just a high correlation between better engineering and inferior marketing :-P |
| 16:20 | sm0ke | hey guys |
| 16:21 | sm0ke | does lein 2.3.3 removes with-profile? |
| 16:21 | dnolen | bbloom: JS multimethods for ES7 would be great for fixing JS numerics |
| 16:21 | dnolen | bbloom: another thing Eich mentioned |
| 16:22 | technomancy | sm0ke: no |
| 16:22 | bbloom | dnolen: i just can't get excited about new ES features when the core is still so broken |
| 16:23 | sm0ke | wtf.. i gave some one my code..he claims he cant do 'lein with-profile package uberjar' ... |
| 16:23 | sm0ke | i have package defined as a profile |
| 16:23 | sm0ke | weird |
| 16:37 | sm0ke | haha ok lein version was old |
| 16:49 | muhoo | hmm, why does this not work? (as-> "msg" <> (.getElementById js/document <>) (.-innerHTML <>) (set! <> "fooobar")) |
| 16:50 | muhoo | it's complaining about local vars on set! |
| 16:51 | dnolen | muhoo: you can't set locals |
| 16:53 | muhoo | i wasn't trying to. i was trying to use the as-> macr |
| 16:53 | frozenlock | I'm trying to get myself (somehow) up to date. Is there a nice little tutorial for core.async? :) |
| 16:54 | muhoo | interestingly, this DOES work: (-> (.getElementById js/document "msg") .-innerHTML (set! "fooobar")) |
| 16:54 | muhoo | so. something is wacky with as-> , because -> works, but as-> does not |
| 16:54 | dnolen | muhoo: think about how as-> it probably uses let |
| 16:55 | dnolen | how as-> works |
| 16:55 | muhoo | right, i'll have to macroexpand and see |
| 16:55 | muhoo | bummer |
| 16:56 | dnolen | muhoo: you can probably make as-> work with some tweaks |
| 16:56 | muhoo | dunno if that's be called a bug in as->, or just an undocumented limitation |
| 16:56 | dnolen | muhoo: not a bug, or a limitation |
| 16:56 | brainproxy | seeing a bunch of "Error: Doesn't support name: ↵ ... " errors during clojurescript compile... intermittent, sometimes triggering another compile makes it disappear |
| 16:57 | muhoo | well for me it's a limitation. i just need to remember not use as-> in cljs :-) |
| 17:05 | dnolen | brainproxy: need a minimal case, the only place we emit a error string like that is in the standard library, nowhere in the compiler |
| 17:14 | gfredericks | muhoo: I don't think you can use set! like that in clj-jvm either |
| 17:16 | gfredericks | even with -> |
| 17:19 | gfredericks | muhoo: 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:28 | danneu | muhoo: yeah, as-> just feels like "-> but you choose the insertion point" so it'd surprise me as well |
| 17:30 | gfredericks | as-> could be rewritten to not use let when avoidable, but that would make it rather more complicated |
| 17:30 | danneu | as-> could be rewritten as a macro that changes position |
| 17:30 | danneu | yeah |
| 17:31 | gfredericks | ,(as-> 7 <> (+ <> <> <> (* 2 <>) <>)) |
| 17:31 | clojurebot | 42 |
| 17:31 | gfredericks | ^ obviously requires let |
| 17:33 | danneu | why does it require let? why couldn't you build that list in a macro |
| 17:33 | gfredericks | you don't want to eval multiple times |
| 17:35 | danneu | oh, like if we imagined it was instead (as-> (db/find-number-by-string "seven") _ (+ _ _ _ (* 2 _) _)) ? |
| 17:35 | gfredericks | yep |
| 17:35 | danneu | i didnt' even know you could have multiple substitutions in a form with as-> |
| 17:36 | gfredericks | that's part of its usefulness |
| 17:36 | gfredericks | ,(as-> (* 2 3 6) <> (do (print <>) <>)) |
| 17:36 | clojurebot | 3636 |
| 17:36 | danneu | well, i'm weak. i just use it because i always 'guess wrong' between -> and ->> |
| 17:38 | danneu | the last form always switches its argument order on me |
| 18:13 | dobry-den | I'm writing a library where you declare a map of options and then each function behaves differently depending on what options are set. |
| 18:13 | dobry-den | What's the general pattern for something like that |
| 18:15 | dobry-den | What comes to mind is a dynamic var for the *options* map |
| 18:15 | bbloom | much better idea to just take an options parameter and thread it through |
| 18:16 | bbloom | a little uglier in some places, but avoids a bunch of problems |
| 18:18 | dobry-den | bbloom: I could do that in my library code. But that's too painful for the end-user for this. |
| 18:18 | bbloom | why? |
| 18:18 | clojurebot | bbloom: because you can't handle the truth! |
| 18:18 | dobry-den | What's the next step down from that? |
| 18:19 | bbloom | you'll have to be more specific about your use case |
| 18:21 | dobry-den | bbloom: 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:21 | bbloom | so surely you have inert data that you later pass to a single compile function, right? |
| 18:22 | bbloom | isn't your API like two functions? 1) compile this object 2) register this mixin/plugin/function/whatever |
| 18:23 | dobry-den | well, 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:24 | bbloom | i don't know anything about how garden works, so i can't comment |
| 18:24 | bbloom | but explicit paremeters aren't so bad. use them :-P |
| 18:24 | bbloom | or use a dynamic variable, but make it overridable with an explicit parameter |
| 18:24 | bbloom | either way: do the explicit parameter version first |
| 18:30 | bitemyapp | alexbaranosky: Want me to just push a release without pocket's PR? his thing looks a little sketchy. |
| 18:30 | bitemyapp | I planned on trying it today anyway. |
| 18:43 | bitemyapp | bbloom: can do closures too if you don' twant to repeat yourself. |
| 18:43 | bitemyapp | that's what I do in bulwark. |
| 18:47 | bbloom | bitemyapp: but then you need an object to hold on to the closures… which is essentially the same as an options parameter |
| 19:00 | brainproxy | dnolen: 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:00 | brainproxy | *an example |
| 19:00 | brainproxy | also clj->js seems to be behaving strangely |
| 19:01 | dnolen | brainproxy: namespaces must match the directory layout - 1933 and on now emit warnings if things don't line up. |
| 19:02 | brainproxy | dnolen: I'm pretty sure they line up |
| 19:02 | coventry | Has there been any work in clojure in the direction of Haskell's Hat tracing suite? |
| 19:03 | dnolen | brainproxy: I tested 1933 on core.async, and dommy project - I didn't see any issues about multiple namespaces or requiring |
| 19:04 | dnolen | brainproxy: it might be something else, also you need to put your ClojureScript directory in :source-paths |
| 19:04 | cemerick | dnolen: I'm getting namespace warnings when using 1934 and HEAD with e.g. cljs.core.PersistentQueue/EMPTY |
| 19:05 | dnolen | :source-paths in cljsbuild options is not enough |
| 19:05 | dnolen | cemerick: fixed in master |
| 19:05 | cemerick | dnolen: I just pulled 90s ago :-) |
| 19:05 | dnolen | cemerick: clean build? |
| 19:06 | cemerick | dnolen: yeah; I'll make a separate clone to be sure |
| 19:07 | dnolen | cemerick: I just grepped master, no /EMPTY |
| 19:08 | cemerick | dnolen: no, I mean, any "static field" expression like that, or on the REPL |
| 19:08 | dnolen | cemerick: oh, yeah that's not allowed anymore |
| 19:08 | cemerick | wat? |
| 19:08 | dnolen | cemerick: otherwise it's problematic to identify namespaces |
| 19:09 | dnolen | just do .EMPTY |
| 19:11 | bbloom | dnolen: it shouldn't exist at all |
| 19:11 | bbloom | dnolen: why not just cljs.core/empty-queue |
| 19:11 | cemerick | dnolen: Leaving aside all the libraries for now (!!), that's some seriously core Clojure sugar that just got tossed. :-( |
| 19:12 | dnolen | cemerick: with that change namespace & var resolution is considerably simpler and more accurate |
| 19:12 | bbloom | cemerick: it was always broken sugar |
| 19:12 | dnolen | cemerick: which is more important for errors than the convenience of / |
| 19:12 | bbloom | cemerick: slash just got converted to dot, which was bogus if you ever want to reify namespaces |
| 19:13 | dnolen | cemerick: 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:13 | cemerick | I'm not arguing the feature on its merits, I've just some serious breakage whiplash. |
| 19:13 | cemerick | I'm just having* |
| 19:13 | dnolen | cemerick: it's a warning, nothing breaks, and trivial search & replace. |
| 19:14 | cemerick | Is this going to percolate over to Clojure like field access? |
| 19:14 | bbloom | cemerick: it's different in clojure b/c the host has static fields |
| 19:14 | dnolen | cemerick: I doubt it, but what bbloom said |
| 19:15 | bbloom | cemerick: so classes act as namespaces for static field resolution |
| 19:15 | bbloom | javascript has no such notion, so it doesn't need any notation for it |
| 19:15 | cemerick | bbloom: yeah, I'm just talking about the notation, not the respective host capabilities |
| 19:15 | bbloom | right, but javascript has no capability and thus does not need the notation |
| 19:16 | dnolen | cemerick: but it's tied to what can be identified on the host |
| 19:16 | dnolen | cemerick: CLJS has no such reflective capabilities |
| 19:17 | dnolen | cemerick: if you see some clever way to make it work I'm listening. |
| 19:17 | bbloom | dnolen: 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:17 | bbloom | like empty queues & whatnot |
| 19:19 | gfredericks | probably queue would be more useful than empty-queue, eh? |
| 19:19 | gfredericks | I guess we still use empty versions of other collections... |
| 19:19 | bbloom | sure, just like (list) |
| 19:19 | bbloom | ,(list) |
| 19:19 | clojurebot | () |
| 19:19 | bbloom | ,(set) |
| 19:19 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$set> |
| 19:19 | bbloom | grrr |
| 19:19 | cemerick | dnolen: 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:19 | gfredericks | ,(hash-set) |
| 19:19 | clojurebot | #{} |
| 19:20 | cemerick | I have a couple of problems: |
| 19:20 | dnolen | cemerick: 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:20 | dnolen | ? |
| 19:20 | dnolen | cemerick: and for that convenience we have several tickets where people complain about the fact that we weren't identifying non-existent namespaces |
| 19:20 | dnolen | common typo |
| 19:21 | cemerick | (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:22 | cemerick | (b) I have nontrivial, portable Clojure/ClojureScript codebases, others do too, and stuff as fundamental as dropping syntax *hurts*. |
| 19:22 | dnolen | cemerick: there's wasn't any promise documented anywhere about that convention, internally used as implementation detail |
| 19:22 | dnolen | cemerick: people use js* too, nothing we can do about that |
| 19:23 | cemerick | dnolen: which convention, around warnings, or /? |
| 19:23 | dnolen | cemerick: / |
| 19:24 | bitemyapp | bbloom: 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:24 | cemerick | dnolen: it's been part of Clojure (and ClojureScript) host interop from the start of both projects. |
| 19:24 | bitemyapp | bbloom: from there it's down to the server to manage its thread pool and call the composed handlers. |
| 19:24 | bitemyapp | you don't retain them separately of that, anyway. |
| 19:24 | dnolen | cemerick: 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:26 | cemerick | dnolen: s/part of/available in/g, whatever |
| 19:27 | coventry2 | Anyone 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:28 | cemerick | dnolen: do you have any notion of when the usage will stop working, vs. just producing a warning? |
| 19:28 | dnolen | cemerick: it will probably always just produce a warning, like all the other resolution checking stuff. |
| 19:29 | bbloom | bitemyapp: 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:29 | dnolen | cemerick: but I'm also happy to take a patch that makes it work for data types. |
| 19:30 | bbloom | dnolen: what's a "data type"? |
| 19:30 | dnolen | bbloom: cemerick wants to support that convention on deftypes, this seems easy to do. |
| 19:30 | bbloom | cemerick: why do you want that? |
| 19:31 | cemerick | bbloom: to be clear, I haven't said I want to support anything in particular. |
| 19:31 | bbloom | static 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:32 | bbloom | if there is a static field that is useful in core that we want to be portable, it should be assigned to a var |
| 19:32 | bbloom | simple as that |
| 19:33 | cemerick | Sure, I'll go sed all of clojars, brb. |
| 19:33 | bbloom | no, i'm saying for writing portable code going forward |
| 19:33 | bbloom | code 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:33 | cemerick | right, which I'm 100% cool with |
| 19:34 | bbloom | i've genuinely considered writing a lein plugin to run a C preprocessor, but realized that clojure uses # for too much stuff :-P |
| 19:34 | bbloom | i mean, that's literally what haskell does, which is kinda sad |
| 19:35 | cemerick | bbloom: that's roughly what cljx does |
| 19:35 | bbloom | yeah, i realize that |
| 19:36 | ruzu | madness?! this. is. clojure!! |
| 19:40 | bitemyapp | bbloom: Haskell has gone a little too far with the preprocessor/TH/type-system madness. |
| 19:41 | bbloom | bitemyapp: agreed |
| 19:41 | bitemyapp | I 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:41 | bitemyapp | which then ruins libraries because people use them as weird experiments instead of a way to get something done. |
| 19:41 | echo-area | When you guys talking about 1933/1934, what does that mean? |
| 19:42 | ruzu | the fine years in earth history |
| 19:42 | echo-area | I don't think so, I think it means a project repo's revision |
| 19:43 | bitemyapp | echo-area: pretty sure it's cljs |
| 19:43 | dnolen | well 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:46 | bbloom | dnolen: negative 100 points man |
| 19:46 | brainproxy | dnolen: weirdly enough, bumping my java version to a later point release of 1.7.0 has cleared up a bunch of weirdness |
| 19:46 | brainproxy | :/ |
| 19:47 | ruzu | nothing is weird in java-land |
| 19:52 | dnolen | bbloom: 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:52 | bbloom | dnolen: no sense speculating. let's see if additional people complain |
| 19:58 | echo-area | bitemyapp: Is it https://github.com/clojure/clojurescript? How to interpret 1933? |
| 20:00 | dnolen | echo-area: we announce releases on the mailing lists with dependency info, 1933 is just based on the git commit |
| 20:00 | dnolen | [org.clojure/clojurescript "0.0-1933"] |
| 20:00 | ruzu | ,(* 3 23) |
| 20:00 | clojurebot | 69 |
| 21:03 | allenj12 | can someone tell me what is wrong with my recur call for a loop here https://www.refheap.com/19713 |
| 21:06 | llasram | allenj12: 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:06 | llasram | allenj12: If you make that a `do` containing the `println` call then the `recur`, you should fix that problem |
| 21:07 | allenj12 | llasram, TY! seems weird tho ill have to play with it to understand i guess |
| 21:08 | llasram | allenj12: Just keep in mind that (<anything> ...) w/in regular code means calling <anything> as a function |
| 21:08 | amalloy | allenj12: (foo bar) "always" means "call foo as a function with bar as an argument", even when foo is itself a function call |
| 21:08 | amalloy | the quotes around always are because you will eventually discover exceptions, but they aren't anything you need to think about yet |
| 21:09 | frozenlock | Where can I find the lastest clojurescript version for my project dependencies? |
| 21:09 | frozenlock | (It doesn't seem to be on clojars) |
| 21:09 | allenj12 | llarsam, but arent they in different scopes? |
| 21:09 | allenj12 | llasram, but arent they in different scopes? |
| 21:10 | llasram | allenj12: I'm not sure what you mean by "different scopes" |
| 21:10 | amalloy | $google clojurescript maven |
| 21:10 | lazybot | [Maven Repository: org.clojure » clojurescript] http://mvnrepository.com/artifact/org.clojure/clojurescript |
| 21:10 | allenj12 | llasram, i guess im confused because recur is not within the end parenthesis of the println |
| 21:11 | frozenlock | amalloy: thanks |
| 21:12 | amalloy | allenj12: it's within the closing paren of the thing surrounding both it and the printlny |
| 21:13 | amalloy | you 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:13 | allenj12 | amalloy, O I SEE! so since println outputs nil its like im say (nil (recur)) which makes recur not in tail position? |
| 21:13 | arrdem | allenj12: bingo |
| 21:13 | arrdem | allenj12: well... no... |
| 21:13 | amalloy | allenj12: yes |
| 21:14 | allenj12 | im confused one no and one yes :P |
| 21:14 | llasram | allenj12: yes |
| 21:14 | arrdem | allenj12: yes |
| 21:14 | llasram | Now there's a majority :-) |
| 21:14 | amalloy | arrdem is wrong, we've outvoted him |
| 21:14 | allenj12 | hurray! thnx |
| 21:14 | arrdem | everyone outvotes me Q_Q |
| 21:15 | dnolen | frozenlock: http://search.maven.org/#search%7Cga%7C1%7Cclojurescript |
| 21:15 | arrdem | allenj12: the issue here is that "in the tail position" means that (recur) can't occur as a parameter to some other function call |
| 21:16 | arrdem | allenj12: what you want is (do (println ...) (recur ...)) |
| 21:16 | arrdem | allenj12: alternatively change the (if) to (when) and get the do for "free". |
| 21:16 | allenj12 | arrdem, ahhh kk |
| 21:17 | frozenlock | Oh boy, now I get "No such var: json/pprint, compiling:(cljs/source_map.clj:193:7)" :-( |
| 21:19 | frozenlock | Hmmm http://dirk.net/2013/05/29/caused-by-javalangruntimeexception-no-such-var-jsonpprint/. I wonder if it's a bug |
| 21:20 | allenj12 | the recur works! but is it the case you can not read-line in a loop binding? |
| 21:20 | allenj12 | it just keeps assuming the not case lol |
| 21:22 | arrdem | allenj12: paste it. I have the feeling that your (if) is wrong. |
| 21:23 | allenj12 | https://www.refheap.com/19713 seems possible but should still call read-line no? https://www.refheap.com/19713 |
| 21:23 | allenj12 | o wai |
| 21:23 | allenj12 | thats old |
| 21:23 | allenj12 | one sec |
| 21:24 | dnolen | frozenlock: you probably have multiple versions of data.json somehow, use lein deps tree |
| 21:24 | allenj12 | arrdem, here it is https://www.refheap.com/19713 |
| 21:26 | frozenlock | dnolen: I only see the one I just added... :-/ |
| 21:26 | dnolen | frozenlock: you shouldn't have to add it, it's a declared dep |
| 21:27 | llasram | allenj12: Is your `when` condition inverted? |
| 21:28 | arrdem | llasram: yes it is |
| 21:28 | arrdem | allenj12: when-not |
| 21:28 | dpathakj | allenj12: 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:30 | allenj12 | llasram, huh dosnt it return true if the input is in that list and returns it? |
| 21:30 | allenj12 | hmmm |
| 21:30 | Raynes | allenj12: Oh God what am I in a room with? |
| 21:30 | arrdem | Raynes: chord |
| 21:31 | arrdem | Raynes: have fun |
| 21:31 | llasram | allenj12: 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:31 | allenj12 | Raynes, lol |
| 21:32 | llasram | allenj12: So I think you really do need an `if` + `do` |
| 21:32 | allenj12 | llasram, i tried that to same result and also the weird thing is it is not waiting for input from the terminal |
| 21:33 | arrdem | llasram: yes, if .. input (do println recur) |
| 21:33 | llasram | allenj12: Terminal input I'm afraid I cannot help you with... |
| 21:33 | allenj12 | llasram, well i mean isnt that what read-line does in this scenario? |
| 21:35 | llasram | allenj12: Maybe? Terminal input on the JVM is fraught with peril. Or at least engenders some level of complication |
| 21:36 | allenj12 | llasram, hm yea this ir rly weird im starting to think you can not take in input during a loop binding |
| 21:37 | allenj12 | https://www.refheap.com/19713 yea changed it back to this same problem |
| 21:38 | llasram | allenj12: In general from a normal stream that would not be a problem. I don't know the idiosyncrasies of terminal input though |
| 21:39 | allenj12 | llasram, hmm kk ill keep playin with it |
| 21:46 | allenj12 | llasram, i think i figurd it out if i used with-open before to open a file do i have to close it? |
| 21:46 | arrdem | allenj12: I found your problem. |
| 21:46 | arrdem | allenj12: you are -> read-line as a _function_ |
| 21:46 | allenj12 | arrdem, yea? |
| 21:47 | arrdem | allenj12: (read-line) != read-line |
| 21:47 | llasram | allenj12: `with-open` is kind of poorly named -- what it actually does is close the file when exiting the dynamic scope of the form :-) |
| 21:47 | llasram | arrdem: Oh, dur |
| 21:47 | arrdem | llasram: iknowrite |
| 21:47 | allenj12 | arrdem, oooo so can i keep the -> and just change it to (read-line) |
| 21:48 | arrdem | allenj12: totally |
| 21:48 | arrdem | llasram: I didn't see that until I did a "fuckit prn everything" |
| 21:48 | Raynes | arrdem: https://github.com/flatland/useful/blob/develop/src/flatland/useful/debug.clj |
| 21:49 | allenj12 | arrdem, IT WORKS! |
| 21:49 | arrdem | Raynes: I did a prn-let a while back myself... this one's nicer tho. |
| 21:54 | arrdem | Raynes: what on earth did you use flatland.useful.fn/rate-limited for? |
| 21:54 | Raynes | amalloy: ^ |
| 21:57 | amalloy | arrdem: i wrote rate-limited for 4clojure, actually |
| 21:58 | arrdem | amalloy: ah. I was expecting some slow system side-effect case. |
| 21:58 | amalloy | we 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:59 | amalloy | thus, a function that returns "#clojure " sometimes, and nil other times |
| 21:59 | arrdem | amalloy: whole lot of cool stuff in this toolkit! .seqs is awesome. |
| 22:01 | bitemyapp | arrdem: if you want web-app-oriented rate limiting there's bulwark. |
| 22:08 | dpathakj | What's the mode line for an nrepl buffer in emacs supposed to be? |
| 22:10 | dpathakj | more 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:12 | dpathakj | M-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:12 | cemerick | dnolen: sorry for dropping off before, just weaving some cljs work in between other stuff this weekend |
| 22:12 | dpathakj | and eval gives "No Lisp subprocess; see variable `inferior-lisp-buffer'" |
| 22:12 | bitemyapp | dpathakj: don't use nji |
| 22:13 | dpathakj | what should I use instead? |
| 22:15 | arrdem | bitemyapp: nji totally works... what are you on about? |
| 22:15 | llasram | Yeah -- first I've heard this advice |
| 22:16 | llasram | That said, I did just upgrade to 0.2.0, and noticed at least my paredit-activation hook didn't work |
| 22:16 | dpathakj | http://blog.worldcognition.com/2012/07/setting-up-emacs-for-clojure-programming.html is what I used to get my setup up and running. |
| 22:17 | arrdem | dpathakj: what isn't working about this? it's basically the same setup I'm using... |
| 22:17 | dpathakj | yeah, worked for me too until recently. |
| 22:20 | dpathakj | i installed a bunch of packages/added to my .emacs to get slime + sbcl to work. it's something to do with that. |
| 22:21 | arrdem | I 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:22 | bitemyapp | arrdem: I was trying to get him to help me debug the problem |
| 22:22 | bitemyapp | arrdem: but if you'd like to help him instead go for it |
| 22:22 | dpathakj | M-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:22 | bitemyapp | dpathakj: fire up a repl in the terminal, connect to it from emacs instead of using nrepl-jack-in |
| 22:24 | arrdem | bitemyapp: I'm just curious.. go for it. |
| 22:24 | bitemyapp | arrdem: I've had nji get into a bad state and break for me before. |
| 22:26 | dpathakj | done. 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:28 | hiredman | dnolen: you know, if you had a value that unified with everything without extending the substitution map you wouldn't need macrolet and _ |
| 22:28 | konr | How 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:29 | arrdem | konr: (let [inc ..] (map #(...))) |
| 22:29 | hiredman | a. #(inc %) is inc b. it has nothing to do with inc being inside an anonymous function |
| 22:30 | hiredman | the clojure compiler inlines certain function calls, mostly to do with math for performance |
| 22:31 | konr | arrdem: still [1 2 3 |
| 22:31 | konr | arrdem: with (let [inc #(+ 3 %)] (foo)) |
| 22:32 | arrdem | konr: the way that clojure does symbol resolution that won't work. |
| 22:32 | arrdem | konr: you could _locally_ rebind inc using let, but the inc usage has to be directly wrapped by the let. |
| 22:33 | arrdem | konr: eg. (defn foo [] (let [inc #(+ 3 %1)] (map inc (range 3)))) |
| 22:34 | arrdem | konr: 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:35 | amalloy | arrdem: user/inc doesn't exist, in real life or in your example |
| 22:36 | amalloy | the point about locally binding inc is fine, but it doesn't do anything to the user/ namespace |
| 22:37 | arrdem | ,(let [x] (print 'x)) |
| 22:37 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in sandbox:> |
| 22:38 | arrdem | amalloy: ah. let doesn't create ns level symbols. right. |
| 22:41 | konr | so 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:46 | dnolen | hiredman: huh, not a bad idea! |
| 22:46 | dnolen | cemerick: here's a partial solution (bbloom didn't approve) http://github.com/clojure/clojurescript/compare/static-field-convention |
| 22:47 | dnolen | cemerick: would probably need to be extended to handle :use :only / :require :refer |
| 22:47 | satshaba2 | Clojure is awesome! |
| 22:47 | arrdem | konr: 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:47 | Raynes | This is an accurate statement. |
| 22:48 | satshaba2 | one thing though... It seems difficult to just write a little clojure script for a one off thing |
| 22:48 | satshaba2 | like I wanted to do some math homework with clojure |
| 22:48 | satshaba2 | So i look up the math library |
| 22:49 | satshaba2 | and then i realize I need to make a new project with lein |
| 22:49 | satshaba2 | I guess it wasn't that painfull |
| 22:50 | coventry | arrdem: 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:50 | Raynes | satshaba2: 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:50 | Raynes | Unfortunately. |
| 22:51 | satshaba2 | huh, 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:51 | satshaba2 | Kinda over kill but I love the instarepl |
| 22:53 | frozenlock | Arg... 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:53 | arrdem | satshaba2: have you used emacs+nrepl or just LT? |
| 22:54 | frozenlock | Any workaround, other than forking this old version and correcting the alias thingy? |
| 22:54 | satshaba2 | arrdem: sorry I'm a vim guy |
| 22:54 | satshaba2 | just LT so far |
| 22:54 | satshaba2 | trying out fireplace.vim too |
| 22:54 | arrdem | satshaba2: ok, just curious. |
| 22:58 | cemerick | dnolen: 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:59 | cemerick | dnolen: thanks for entertaining the notion, though :-) |
| 23:03 | dnolen | cemerick: let me know if you encounter anything else you think is major - the only real significant change IMO was the keyword-identical? bit |
| 23:04 | konr | coventry, arrdem: even changing to a function with no inline metadata, the behavior stays consistent, vide http://7fc871fb5f2266d6.paste.se/ |
| 23:04 | hiredman | ~map |
| 23:05 | clojurebot | map is an evil genius. |
| 23:05 | hiredman | ~map |
| 23:05 | clojurebot | map is *LAZY* |
| 23:06 | arrdem | ,(macroexpand '(defn bar [] (map vector (range 3)))) |
| 23:06 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 23:06 | arrdem | goddamnit clojurebot. |
| 23:06 | satshaba2 | hey 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:06 | satshaba2 | and maybe the docs for those functions |
| 23:10 | arrdem | satshaba2: you want https://github.com/clojure/algo.generic, I suspect. |
| 23:11 | satshaba2 | i do? |
| 23:11 | satshaba2 | arrdem: Not sure I see the connection |
| 23:11 | arrdem | satshaba2: that library is where contrib.generic.math-functions seems to have landed with the deprication of contrib.* |
| 23:12 | satshaba2 | I 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:12 | satshaba2 | ah I say, so you're saying th best way is to just look it up online? |
| 23:12 | dpathakj | got it. |
| 23:13 | coventry | konr: Huh, there must be something more going on, then. |
| 23:13 | dpathakj | bitemyapp: arrdem: it was possibly some combination of an old nrepl.el and a new leiningen. |
| 23:13 | arrdem | satshaba2: so if you _know_ that the library in question is in your classpath then (use ..) and (require ..) will load it in for you. |
| 23:13 | satshaba2 | yes, but after that. Like for exploring that api |
| 23:14 | arrdem | satshaba2: oh. google is your best bet IME. |
| 23:14 | dpathakj | anyway, uninstalled packages I got from melpa and installed from marmalade and that fixed things. |
| 23:14 | satshaba2 | like if I was in Eclipse and I hit Math.<autocomplete> |
| 23:14 | satshaba2 | OK cool |
| 23:14 | arrdem | satshaba2: there are namespace tools for enumerating symbols in an ns.. but I don't use them. |
| 23:16 | arrdem | satshaba2: one could use clojure.core/ns-interns, along with clojure.repl/doc |
| 23:17 | satshaba2 | nice. Yes I was repl/doc |
| 23:17 | satshaba2 | that seems to work alright |
| 23:17 | satshaba2 | also just going to source is pretty easy |
| 23:23 | frozenlock | Am 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:24 | allenj12 | hey 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:24 | allenj12 | if that makes sense |
| 23:32 | allenj12 | if v is '(inc 5) how do i unquote that ~v ~ v or (~ v ) dont seem to work |
| 23:33 | llasram | allenj12: Er, what are you trying to do? |
| 23:33 | dnolen | frozenlock: yep |
| 23:33 | coventry | allenj12: Do you mean (eval '(inc 5))? Probably not a good direction to go in. |
| 23:34 | allenj12 | llasram, isnt it possible to unquote that list so its called as a function instead of being a list |
| 23:34 | llasram | allenj12: Kind-of-but-not-really-depending-on-what-you-mean? But you can just use functions as values |
| 23:34 | allenj12 | llasram, http://clojuredocs.org/clojure_core/clojure.core/unquote |
| 23:35 | llasram | ,(map #(% 1) [inc dec #(+ 2 %)]) |
| 23:35 | clojurebot | (2 0 3) |
| 23:35 | llasram | allenj12: Yeah, `unquote` only has meaning inside of a syntax-quote |
| 23:36 | llasram | So ##(let [x 'foo] `(x ~x)) |
| 23:36 | lazybot | ⇒ (clojure.core/x foo) |
| 23:36 | allenj12 | o thats lame |
| 23:36 | llasram | Er, why? |
| 23:37 | frozenlock | dnolen: 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:37 | allenj12 | llaram, :) 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:38 | allenj12 | llasram, thought that would be cool is there a practical way to do that? |
| 23:38 | dnolen | frozenlock: I've asked for a more recent GClosure build, hopefully we can get that in the next release |
| 23:38 | allenj12 | llasram, or is that not idiomatic at all |
| 23:38 | frozenlock | dnolen: That would be great! :D |
| 23:39 | frozenlock | But meanwhile, I suppose my alternative is the best way? |
| 23:39 | frozenlock | (as in hassle free) |
| 23:39 | llasram | allenj12: 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:40 | allenj12 | llassram, lemme paste it with comments to explain |
| 23:43 | dnolen | giving 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:43 | allenj12 | llasram, https://www.refheap.com/19717 does that make things more clear |
| 23:45 | llasram | allenj12: 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:45 | llasram | I 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:47 | allenj12 | llasram, 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:52 | allenj12 | someone said before eval is bad? why is that? |
| 23:54 | llasram | ~eval |
| 23:55 | clojurebot | eval is sometimes useful - but only sometimes |
| 23:55 | llasram | Except 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:56 | allenj12 | llasram, i see |
| 23:58 | coventry | You almost never want eval unless the problem you're ultimately trying to solve inherently involves source code. |