2013-10-02
| 00:13 | akurilin | Yeah, connecting to the same nrepl as my server actually allows me to edit the thing's state without necessarily relying on lein ring's auto-reload |
| 00:14 | akurilin | and now I actually know what the heck people talk about when they say state can get fubarred. |
| 00:14 | akurilin | Next step I guess is to use Stuart Sierra's approach. |
| 00:15 | logic_prog | yeah |
| 00:15 | logic_prog | I think people should not be allowed to use clojure unless they've read what Rich Hickey / Sauart Sierra have written |
| 00:15 | logic_prog | would have saved me much more time |
| 00:15 | logic_prog | instead of bumbling around |
| 00:16 | akurilin | Well I can tell you that whatever Stuart Sierra wrote made absolutely no sense to me at first. |
| 00:16 | akurilin | Took a bit to be able to relate at least a bit. |
| 00:16 | logic_prog | it's like the matrix |
| 00:16 | logic_prog | what do you mean a function that recreates a full state? |
| 00:16 | akurilin | What did Hickey write on the subject btw? |
| 00:16 | logic_prog | I was referring mostly to his tech talks |
| 00:17 | ddellacosta | akurilin: I interpreted that as a more general statement on what Rich Hickey has publicly said, in talks and whatnot |
| 00:17 | ddellacosta | right |
| 00:17 | akurilin | okie dokie |
| 00:17 | logic_prog | ddellacosta: stop reading my mind |
| 00:17 | ddellacosta | logic_prog: heh |
| 00:18 | akurilin | Supposedly tools.trace is also supposed to blow my mind once I grok it |
| 00:18 | akurilin | Every day is Christmas in Clojure land. |
| 00:18 | logic_prog | (refresh) is awesome |
| 00:19 | logic_prog | Hickey, Sierra, and Techomancy = 3 wise men? :-D |
| 00:20 | SegFaultAX | I'm unclear on Sierra's approach when it comes to the production system. At some point you still need a couple of globals for the top level system state. |
| 00:21 | tbaldrid_ | SegFaultAX: yep, but it's all in one place (an atom perhaps) instead of 20,000 places all in different namespaces |
| 00:21 | ddellacosta | SegFaultAX: I didn't think he was eschewing all use of globals, just minimizing them to manage complexity |
| 00:22 | Raynes | logic_prog: Well, I've been doing this for like 5 years and I don't even know what " a function that recreates a full state" is without context. :p |
| 00:22 | ddellacosta | er, what tbaldrid_ sez |
| 00:22 | SegFaultAX | Well yea, I guess his focus was also more on the development side of things anyway. |
| 00:26 | technomancy | Raynes: pretty much |
| 00:26 | akurilin | So "wrap-" is the unwritten convention for middleware naming as per weavejester's libraries? |
| 00:27 | SegFaultAX | Well it describes what is logically occuring. |
| 00:29 | bitemyapp | akurilin: c.t.t is a good idea. |
| 00:33 | akurilin | bitemyapp, my understanding is that tracing functions is where most of the bang is for the library? |
| 00:35 | bitemyapp | akurilin: da |
| 00:35 | bja | is there some way that lein classpath might not be telling me the whole truth in terms of what I'm actually including? |
| 00:35 | bja | asking because it seems to claim I only have tools.reader 0.7.8 yet it is obviously finding an earlier version to load up the interface for |
| 00:36 | technomancy | bja: someone just reported that earlier; haven't gotten a chance to investigate |
| 00:36 | technomancy | lein issue 1337 |
| 00:36 | akurilin | btw totally appreciate you trying to beat loving middleware into my thick skull. Makes stuff so much nicer. |
| 00:37 | technomancy | bitemyapp: is http://simonides.clojurecup.com/dashboard/feed supposed to be live? |
| 00:38 | bja | technomancy: thanks. short term solution for me is to patch clj-http I guess |
| 00:38 | technomancy | yeah, if you can get it to work with the latest version that's obviously the best |
| 00:38 | technomancy | why does an HTTP client need a reader though? |
| 00:39 | bja | technomancy: uses it for reading/sending EDN |
| 00:40 | bja | (at least that's my guess. it magically knows how to handle EDN) |
| 00:40 | technomancy | huh; is it really that much work to do your own serialization? |
| 00:41 | bja | technomancy: well. not really. it's just built into the library. And as long as the version bump doesn't break clj-http, it seems less effort to decouple tools.reader vs incrementing the dependency version |
| 00:41 | bja | err |
| 00:41 | bja | I said that backwards. |
| 00:41 | akurilin | Can you no longer sign up for Mozilla Persona? |
| 00:42 | akurilin | Wanted to log into refheap. |
| 00:45 | akurilin | Nvm, their help docs are out of date. Also usability... oh well. |
| 00:45 | technomancy | akurilin: the account confirmation was broken when I tried it yesterday for a clojurecup entry |
| 00:46 | bitemyapp | technomancy: I'm expert level at avoiding saying "complected" since having to explain things to coworkers often lately. |
| 00:46 | technomancy | bitemyapp: teach me your ways |
| 00:46 | akurilin | My current word to avoid is "conflated" |
| 00:46 | boccato | hello |
| 00:46 | akurilin | You guys take conflated, I use complected. |
| 00:47 | technomancy | I like conflated, but I think "coupled" does the job for this |
| 00:47 | clojurebot | Huh? |
| 00:47 | boccato | what is a good book to learn clojure for someone with some experience in common lisp? |
| 00:47 | bitemyapp | technomancy: conflated, coupled, complicated/mutual complication, tangled together |
| 00:47 | bitemyapp | boccato: Clojure Programming |
| 00:51 | technomancy | I think of conflated as "using one term to mean multiple things" |
| 00:52 | bitemyapp | technomancy: th |
| 00:52 | bitemyapp | technomancy: that's more precise, but it can be a conflation or terms of concepts |
| 00:52 | bitemyapp | an incorrect "collapsing together" rather than a braiding of things that can be separate. |
| 00:52 | technomancy | I think you accidentally a M-t twice? |
| 00:54 | boccato | bitemyapp: thats the one by Emerick, right? what about "the joy of clojure"? |
| 00:55 | technomancy | https://github.com/technomancy/leiningen/pull/1324 <- anyone familiar with pom structure care to chime in on this issue? |
| 00:57 | muhoo | avoiding saying complected is easy. avoiding doing it, well... |
| 01:09 | bitemyapp | boccato: read Clojure Programming |
| 01:13 | mullr | technomancy: As you say, a more general 'add this stuff to the XML' facility would be far more useful (i.e. useful at all) |
| 01:16 | mullr | boccato: watch http://www.youtube.com/watch?v=cPNkH-7PRTk |
| 01:29 | lgs32a | For the interested: I spent the night writing a microlib to manage state event-driven in small nodes using async channels: https://github.com/lgrapenthin/state-node . Feedback very welcome. |
| 01:48 | BlankVerse | (sel (matrix (range 9) 3) :filter #(> (sum %) 15)) |
| 01:48 | BlankVerse | shouldn;t it return the rows whose sum is > 15 |
| 01:50 | lgs32a | BlankVerse: what matrix are you using |
| 01:50 | BlankVerse | incanter? |
| 01:51 | lgs32a | ah ofc |
| 01:57 | BlankVerse | it looks as if filter function is noop |
| 01:57 | lgs32a | BlankVerse: it does not seem like it invokes the filter-fn at all |
| 01:57 | BlankVerse | ya |
| 01:57 | BlankVerse | , what to do? |
| 01:57 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: what in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 01:58 | lgs32a | BlankVerse: try passing a number as filter-fn, will not complain |
| 01:59 | lgs32a | BlankVerse: cast ur matrix using to-dataset |
| 01:59 | lgs32a | BlankVerse: seems to work in my repl |
| 02:18 | akurilin | Note to self: redact passwords if logging request params, bcypt doesn't save you here.. |
| 02:18 | bitemyapp | akurilin: good call |
| 02:19 | bitemyapp | akurilin: that's sorta why I didn't plan on blackwater being used outside of development... |
| 02:34 | yedi | anyone feel like helping me with my problems getting ansible up and running |
| 02:38 | TEttinger | yedi: ansible? |
| 02:38 | yedi | yea |
| 02:38 | TEttinger | are you on windows? |
| 02:39 | TEttinger | https://github.com/ansible/ansible this? |
| 02:39 | TEttinger | I thought it was an ANSI formatting lib, which wouldn't work on windows. sadly console libs are more my area of expertise |
| 02:42 | TEttinger | have you tried #ansible ? |
| 02:45 | akurilin | bitemyapp, that's fair. We have some regulations too here, namely COPPA. The prob though is that if you're on our box, you already access to everything but the cleartext passwords. |
| 02:46 | akurilin | So there's only so much that sanitizing log PII would gain you. |
| 02:48 | akurilin | but I imagine people out there like to move / store / analyze their prod logs outside of the server box's disk, unlike us starving startup :P |
| 02:48 | sm0ke | Is it sane to (swap!) another atom when you are inside the body of one atoms (swap!) argument function? |
| 02:50 | sm0ke | is it a common thing to do? |
| 02:51 | akurilin | bbl |
| 02:52 | yedi | TEttinger: i've tried #ansible, it's a ghosttown right now |
| 02:53 | yedi | i'm trying to get ansible to work with my vagrant vm, but i have no idea what i'm doing |
| 02:53 | TEttinger | I have no idea either |
| 02:53 | yedi | ansible's ping returns https://gist.github.com/yedi/6789630 |
| 02:54 | TEttinger | the fanciest server admin I have done was on sun netra x1 servers with a 600 MHz SPARC processor |
| 02:55 | yedi | ugh, it's been really difficult trying to learn sysadmin / devops |
| 02:59 | ivan | yedi: does /Users/yedianyansi/.ssh/id_rsa exist and have permission 0600? |
| 03:00 | yedi | ivan: yes indeed |
| 03:04 | ivan | oh, I didn't realize that message was not an error |
| 03:05 | ivan | yedi: it looks like an SSH client is timing out, does this happen when you `ssh` into the host yourself? |
| 03:12 | yedi | ivan: so i'm getting a new error now, https://gist.github.com/yedi/6789630 |
| 03:13 | yedi | i decided to use private network for the vm instead, and i seem to be able to ssh into it ok, but for some reason ansible has an issue |
| 03:13 | ivan | yedi: it looks like you're trying to connect to a host that isn't accepting your key, so it's asking for a password, and ansible doesn't like that |
| 03:13 | ivan | is your public key in the remote's authorized_keys? |
| 03:15 | yedi | i don't believe so, i don;t remember doing anything like that |
| 03:16 | ivan | you can send it over with ssh-copy-id |
| 03:17 | ivan | (just once, I mean; it'll append to ~/.ssh/authorized_keys) |
| 03:21 | yedi | ivan: sweeet, it worked |
| 03:21 | yedi | thanks so very much |
| 03:21 | ivan | cool |
| 03:31 | BlankVerse | I have a misclassify function which filters to either all or emptyhttps://gist.github.com/pankajmore/6789961 |
| 03:32 | BlankVerse | but it should somtimes give a proper subset also |
| 04:01 | muhoo | sysadmin/ops stuff i find easy, but what makes it hard is all the automation people wrap around it that obfuscates what's really goign on, sometimes |
| 04:03 | utkarsh | what's the best way to "change" some keys of a map, if they exist? e.g., I have {:a 10, :b 20} and I want to change :a to :x and :c to :z, so I should get {:x 10, :b 20} |
| 04:05 | noidi | utkarsh, clojure.set/rename-keys |
| 04:05 | ta479 | how are you supposed to know what types a function takes and outputs without any compiler information? |
| 04:06 | utkarsh | noidi: perfect, thanks! |
| 04:08 | muhoo | ta479: the doc string usually tells you. but clojure isn't typed and many functions can accept many diffferent types |
| 04:09 | ta479 | and if there is no doc string? |
| 04:09 | muhoo | then the source, i guess |
| 04:09 | ta479 | or if the doc string is incorrect |
| 04:09 | muhoo | ta479: what function are you trying to get a docstring for? |
| 04:10 | ta479 | I'm speaking hypothetically |
| 04:10 | ta479 | does clojure.typed provide documentation generation of types? |
| 04:10 | muhoo | i dunno, but if you want strongly-typed clojure, that's the place to get it |
| 04:11 | muhoo | https://github.com/clojure/core.typed |
| 04:11 | ta479 | :( relying on a docstring feels like such a turn off for me |
| 04:11 | clgv | ta479:in the namespaces shipped with clojure there are docstrings on the public functions |
| 04:12 | clgv | ta479: well, it is dynamically typed. |
| 04:13 | clgv | ta479: when you come from typed OOP languages then you have to get used to it. |
| 04:13 | muhoo | or from haskell, i bet |
| 04:14 | clgv | muhoo: hehe, or that. I just chose main stream for higher success probability ;) |
| 04:16 | ta479 | I'm trying to decide on whether I should learn scala or clojure. Clojure looks simpler, readable, elegant but scala has a type system |
| 04:16 | ro_st | ta479: do you need a type system for the problem domains you'll work in? |
| 04:17 | ro_st | nice thing about clojure is you can go dynamic until you need types, and then use core.typed for the area that needs types. gradually typed ftw :-) |
| 04:17 | ta479 | I don't think type systems are necessary to be turing complete |
| 04:18 | ta479 | I just think it would be easier for the compiler to catch mistakes of me using the wrong types or generating docs |
| 04:18 | ta479 | it's just convenience really |
| 04:18 | CoconutCrab | (and optimization) |
| 04:19 | clgv | ta479: what is your background? coming from c++, delphi, java I overrated the type system as well in the beginning |
| 04:19 | ta479 | java, C++, some haskell |
| 04:19 | ro_st | is it convenient to declare type information 100% of the time to catch that class of errors some of the time? |
| 04:19 | clgv | ta479: and you certainly underestimate the influence of developing on the REPL |
| 04:20 | ro_st | yup. interactive dev cuts out a lot of the churn. fast feedback helps tremendously |
| 04:20 | l3dx | I saw a talk recently where the dude had done some research on type errors. On github, of issues listed for projects using dynamicly typed languages, only 1% are type errors. |
| 04:20 | l3dx | quite interesting |
| 04:24 | clgv | ta479: you definitely have to shift from coding a big bunch of functionality without trying it out when you use clojure. but with the repl and the functional programming paradigm it is so easy to try out small bits of your implementation |
| 04:25 | ro_st | in fact, it's preferred. you develop bottom-up, building the bits and then composing bigger and bigger bits until you have a working system |
| 05:01 | kaw | l3dx: Sounds very interesting, is that online somewhere? |
| 05:12 | l3dx | kaw: https://vimeo.com/74354480 |
| 05:25 | ddellacosta | ta479: there is also a lot of activity lately on the typed clojure front. Some stuff to check out: http://frenchy64.github.io http://adambard.com/blog/core-typed-vs-haskell |
| 05:26 | turbopape | Hi there, I have a pretty "strange" question... |
| 05:27 | ddellacosta | turbopape: definitely, it's 42 |
| 05:27 | turbopape | Why is the vast majority of Clojure projects, including Clojure Itself |
| 05:27 | turbopape | licensed under eclipse ? |
| 05:27 | turbopape | ddellacosta, 42 ? |
| 05:28 | turbopape | I mean, even lein default projects are EPL ... |
| 05:28 | turbopape | why is that ? |
| 05:28 | ddellacosta | turbopape: nevermind, joke. https://groups.google.com/forum/#!topic/clojure/fCwLL9EnoI4 |
| 05:28 | ddellacosta | turbopape: and, linked from there: https://groups.google.com/forum/#!topic/clojure/TuojEIsu1G4 |
| 05:28 | turbopape | ddellacosta, I got it it was a joke dude :) but wanted to understand it :) |
| 05:28 | turbopape | excus my n00bness :) |
| 05:29 | ddellacosta | turbopape: ah, sorry--no, that was a Hitchhiker's Guide to the Galaxy joke. :-) http://en.wikipedia.org/wiki/42_(number)#The_Hitchhiker.27s_Guide_to_the_Galaxy |
| 05:29 | kaw | l3dx: Thanks, I'll check it out later |
| 05:30 | ddellacosta | turbopape: I was taking advantage of the pause between you stating you had a question, and asking a question to be a smarts. |
| 05:30 | ddellacosta | *smartass |
| 05:31 | turbopape | :) No, actually, If I ask, is to become smarter, actually, not the other way around :) |
| 05:33 | turbopape | and sorry ddellacosta, it is definitely not 42 :) |
| 05:33 | ddellacosta | turbopape: yes, of course. ;-) |
| 05:34 | turbopape | :) |
| 05:34 | ddellacosta | clgv: that would be awesome. |
| 05:34 | clgv | ddellacosta: damn there is no literal 42 there |
| 05:35 | ddellacosta | turbopape: to clarify, I meant, I was being a smartass…I missed a comma in there ("I was taking advantage of the pause between you stating you had a question, and asking a question, to be a smartass") |
| 05:35 | ddellacosta | but, now I've really killed the joke dead. |
| 05:36 | ddellacosta | clgv: yah, well, what are ya gonna do. Clearly we don't know what the question was in the first place |
| 05:36 | turbopape | Actually, I liked it too, and I learned two things in the process. That made my day :) |
| 05:36 | ddellacosta | excellent. :-) |
| 05:38 | clgv | adding up all digits didnt work either ;) |
| 05:39 | clgv | it didn't even sum up to 23 :( |
| 05:42 | yedi | lein uberjar is creating jars without a manifest file, from my research, I found out that -main needs to be defined in order to the uberjar to have the manifest set |
| 05:42 | yedi | how would I go about converting this compojure webapp to using a -main function as it's entry point? https://gist.github.com/yedi/6791051 |
| 05:45 | clgv | yedi: you usually need to start an embedded server such as jetty yourself |
| 05:47 | clgv | yedi: with [ring.adapter.jetty :as jetty] you can use (jetty/run-jetty routes option-map) |
| 05:53 | dobry-den | yedi: https://gist.github.com/yedi/6791051#comment-920291 |
| 05:54 | clgv | dobry-den: wow, all-round service ;) |
| 05:56 | dobry-den | haha |
| 05:56 | dobry-den | that kind of stuff is annoying til you've done it your first time |
| 05:56 | yedi | dorby-den && clgv: thanks a lot |
| 05:56 | yedi | so it seems lein ring server no longer works when i try that: Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword |
| 05:57 | yedi | (dobry-den: been doing sysadmin/ops stuff all night and it really really really sucks for a first timer) |
| 05:57 | dobry-den | yedi: post the problem line. it's just a bad form |
| 05:58 | dobry-den | prob've got a :abc instead of [:abc] |
| 06:00 | dobry-den | i dont know if :aot is necessary there |
| 06:05 | yedi | dobry-den: updated: https://gist.github.com/yedi/6791051 |
| 06:05 | yedi | not sure how to find the problematic line |
| 06:06 | dobry-den | oh |
| 06:06 | dobry-den | :gen-class to (:gen-class) |
| 06:06 | dobry-den | yeah neither do i |
| 06:07 | dobry-den | i have yet to arrive at a strategy for parsing java stack traces |
| 06:10 | dobry-den | god forbid you have to read one in a tmux window. painstakingly arrowkey your ass to the top |
| 06:19 | dobry-den | yedi: I think you generally want the handler/site middleware to wrap the other middleware |
| 06:19 | yedi | what do you mean? |
| 06:20 | dobry-den | hander/site does a lot of helpful things to the request map, so if the request hits it first, your other middleware get the result |
| 06:21 | dobry-den | in other words it would come last in the (def app (-> app-routes ... handler/site)) usually unless you have a middleware that needs the request before it |
| 06:21 | yedi | right |
| 06:23 | yedi | currently dealing with differences in how lein ring server runs my app, and just running the uberjar. The uberjar can't seem to find the db i want to connect to |
| 06:27 | dobry-den | what database are you using |
| 06:31 | yedi | i think i know what the issue is, I pass in some jvm args by setting jvm-opts in my project.clj, obviously running the server without lein won't leverage those |
| 06:31 | yedi | how do you set jvm arguments when just running normal java -jar |
| 06:31 | dobry-den | well you can just pass em in. java -Xmx1g -jar _.jar |
| 06:33 | yedi | thats what i thought but |
| 06:33 | dobry-den | im no sysadmin guru but i just have a boot script that i commit in my project's repo that Upstart or Capistrano/Mina will read |
| 06:34 | dobry-den | that has whatever magical java incantation i use for that proj |
| 06:38 | yedi | dobry-den: got it to work, i was setting those opts after setting -jar, so it thought they were args to my program. (plus, I forgot to prepend the args with "D" since you need to do that to set systemProperties) |
| 06:38 | vmarcinko | hi, noob question here ... I have a collection of elements on which I have to do some side-effecting function...So, i can most easily do that using doseq: (doseq [x coll] (do-some-side-effecton-x x)) |
| 06:38 | dobry-den | ahh |
| 06:39 | vmarcinko | but I have a need that in case this side-effect function raised exception, i need to perform some other side-ffect function on all elements that have pased successfuly before the exception was raised |
| 06:39 | vmarcinko | in other words |
| 06:40 | vmarcinko | (doseq [x coll] (try (do-some-side-effecton-x x) (catch Throwable th (do-some-other-side-effect successful-elements-coll)) |
| 06:40 | dobry-den | vmarcinko: could drop processed items in a collection that will get processed on exception |
| 06:41 | vmarcinko | dobry-den: yeah, that's my question - do you have some idea how to collect these processed items? are we talking about some reduce here, or loop-recurd then? |
| 06:42 | vmarcinko | in mutable/imperative languages I know how to do it, but im stil lfresh in clojrue so... |
| 06:42 | dobry-den | vmarcinko: yeah, off the top of my head you could do it with loop/recur. |
| 06:43 | dobry-den | (loop [unprocessed things, processed []] ...) |
| 06:44 | vmarcinko | yeah, i need some construct that allows me to "accumulate" while looping...and i knowin general that reduce is accumulator, and that it should be preferred instead of loop/recur whenever possible, but i guess its not always feasible |
| 06:45 | dobry-den | i dont know about "whenever possible" |
| 06:46 | dobry-den | loop/recur is just clojure's "low level" loop. sometimes it's more clear to break things apart in a loop/recur imo |
| 06:48 | vmarcinko | i looked at docs, and (take-while pred coll) seemed as a way to go maybe, its just that it says predicate should be side-effect free, so I dunno if I will break something if I put for predicate some fucntion that does side-effect and returns false when exception occured |
| 06:49 | dobry-den | vmarcinko: https://gist.github.com/danneu/6791614 |
| 06:50 | vmarcinko | dobry-den: thanx a bunch |
| 06:55 | Jarda | anyone with expeirence of core.async here? I would need feedback regarding https://gist.github.com/nnarhinen/6786086 |
| 07:11 | dobry-den | Jarda: i think it becomes easier to think about if that (go ...) at the bottom is wrapped with a (defn start-process [...]) and you pass in its starting state as args |
| 07:14 | dobry-den | i dont have much experience but it might be easier to reason about if, for instnace, that hashchange-chan def is instead a channel initializer that you feed into a start-process mechanism instead of a global var |
| 07:19 | BlankVerse | how do i rebind vars in a while loop? |
| 07:20 | Jarda | dobry-den: thanks |
| 07:22 | llasram | BlankVerse: In an abstract-loop, or in a `loop`? |
| 07:23 | BlankVerse | (while (> Y 0) .... ) |
| 07:23 | BlankVerse | where Y is being rebound |
| 07:23 | BlankVerse | inside |
| 07:23 | BlankVerse | making Y constant in while |
| 07:24 | s4muel | ,(doc loop) |
| 07:24 | clojurebot | "([bindings & body]); Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein. Acts as a recur target." |
| 07:24 | llasram | BlankVerse: You use `loop`, which "rebinds" via recursion. Although in practice you usually actually structure your problem to use `reduce` instead |
| 08:38 | ddellacosta | not really clojure specific, but how can I get a lquery working with postgres via JDBC (c.j.j)? I have a PGobject with type lquery, but it's just not giving me the same results I get in the console. |
| 08:51 | ivan | never add 'build' to your IDEA -> File Types -> Ignore files and folders, if you ever want to build La Clojure (it's got a build.ClojureBuilder) |
| 09:29 | borkdude | why is (seq? [1 2 3]) false? |
| 09:30 | `cbp | borkdude: because seq is another kind of data structure. |
| 09:30 | `cbp | borkdude: you can use sequential? on vectors and other such things |
| 09:36 | borkdude | maybe coll? is more what I want then |
| 09:37 | mdrogalis | borkdude: Typically, yes. |
| 09:39 | borkdude | mdrogalis btw I still haven't got an answer on my datomic mailing list question |
| 09:40 | mdrogalis | Which question was that, borkdude? |
| 09:40 | borkdude | mdrogalis about being able to copy the data files of free storage at any time |
| 09:43 | mdrogalis | borkdude: Why don't you get the value of the database you want, then make a back up of that? |
| 09:43 | mdrogalis | You can use those back ups for testing. |
| 09:43 | borkdude | mdrogalis yes, but the question was, does datomic flush immedially or periodically |
| 09:44 | borkdude | mdrogalis after transacting |
| 09:44 | mdrogalis | *Shrug* I'd just avoid it and try something different. I don't know. |
| 09:54 | borkdude | I wish I would have some kind of static check to see if some function would always be called with a collection and never with a single thing |
| 09:54 | borkdude | o no, (coll? {:a 1}) => true |
| 09:55 | borkdude | ehm, I want a function that returns true for only sequences and vectors |
| 09:55 | rkneufeld | borkdude: I'm not sure what context you mean, but couldn't you use seq? |
| 09:55 | borkdude | rkneufeld that's what I used, but it returns false for vectors |
| 09:56 | borkdude | probably sequential? then |
| 10:17 | Morgawr | mm... I fixed my problem (it seems) at last... a question, how does clojure store objects in sets? Does it call the hashCode() function of the object? |
| 10:18 | opqdonut | Morgawr: there are both hash-sets and tree-sets |
| 10:18 | hyPiRion | Morgawr: it's commonly a hash set, yes |
| 10:18 | opqdonut | which correspond roughly to javas HashSet and TreeSet |
| 10:18 | opqdonut | ,(class #{:a :b :c}) |
| 10:18 | clojurebot | clojure.lang.PersistentHashSet |
| 10:18 | mdrogalis | Is there a way to go from a clj data structure to an iterator? |
| 10:18 | opqdonut | ,(class (tree-set #{:a :b :c})) |
| 10:18 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: tree-set in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 10:19 | mdrogalis | The reverse of iterator-seq |
| 10:19 | opqdonut | oh, hmm, I wonder what the function was |
| 10:19 | llasram | opqdonut: `sorted-set` |
| 10:19 | hyPiRion | mdrogalis: (.iterator #{:a :b :c}) ? |
| 10:19 | mdrogalis | hyPiRion: Bingo. Thank you! |
| 10:19 | hyPiRion | All the Clojure-collections implement the interfaces, so you can just use them |
| 10:19 | opqdonut | llasram: right |
| 10:20 | opqdonut | ,(class (sorted-set #{:a :b :c})) |
| 10:20 | clojurebot | clojure.lang.PersistentTreeSet |
| 10:20 | Morgawr | any reason why doing stuff like (conj myset object) is different from doing (conj myset (.hashCode object)) ? |
| 10:20 | hyPiRion | e.g. ##(supers (class #{:a :b :c})) |
| 10:20 | lazybot | ⇒ #{clojure.lang.IPersistentCollection clojure.lang.IObj clojure.lang.Seqable clojure.lang.APersistentSet clojure.lang.IPersistentSet clojure.lang.IEditableCollection clojure.lang.AFn java.lang.Object clojure.lang.Counted java.lang.Runnable clojure.lang.IFn java.io.Ser... https://www.refheap.com/19241 |
| 10:20 | opqdonut | Morgawr: in the first case you are adding the object, in the second case the hashcode |
| 10:20 | Morgawr | yes but |
| 10:20 | opqdonut | ,(conj #{"x"} (.hashCode "abc")) |
| 10:20 | clojurebot | #{96354 "x"} |
| 10:20 | llasram | Morgawr: Because one adds teh object and one adds whatever the integer hashcode is...? |
| 10:20 | Morgawr | In my algorithm I had the bug where I was just testing the hashCode in the set and apparently on very very very large number of hashcodes the set had collisions |
| 10:20 | opqdonut | ,(conj #{"x"} "abc") |
| 10:20 | clojurebot | #{"abc" "x"} |
| 10:21 | Morgawr | isn't the "conj" operation in the set storing the actual hashCode of the object as hash? |
| 10:21 | hyPiRion | Morgawr: no |
| 10:21 | Morgawr | it's storing the object + lookup for the hashcode, yes? |
| 10:21 | Morgawr | and hashcodes may collide? |
| 10:22 | hyPiRion | It uses the hashCode to avoid collisions, and when it finds the object(s), check for equality |
| 10:22 | Morgawr | ah okay |
| 10:22 | Morgawr | this makes sense then |
| 10:22 | Morgawr | I see what my problem was, derp |
| 10:22 | Morgawr | thanks for clarifying this |
| 10:24 | Morgawr | now, onto the next question... I have something like 5-10 futures spawned and I want to find out the first one that returns, how do I make sure I return as soon as one of them returns instead of having to wait for all of them? |
| 10:25 | llasram | Sounds like you want a queue, or maybe a promise, depending on what you intend to do w/ the results of the other futures |
| 10:25 | Morgawr | mmm.. basically I have these futures and want to return as soon as one of them returns true (doesn't matter who) and if none of them returns true then I wait till they all return false |
| 10:26 | Morgawr | I was thinking about a promise... yeah |
| 11:09 | dublindan | Hey, I'm starting a new web project and am trying to decide between using enlive or laser for templating - any recommendations? |
| 11:09 | dublindan | Also, does anyone know if laser has the equivalent of enlive's auto-reload? |
| 11:20 | Morgawr | I can't figure out how to elegantly listen on multiple futures and return as soon as one of them returns |
| 11:20 | seangrov` | Morgawr: core.async and alt! ? |
| 11:20 | Morgawr | even if I make a single promise shared by all futures, if that promise returns false I need to reset it and re-listen on it (I want the first future that returns true) |
| 11:20 | Morgawr | I'm not going to use core.async |
| 11:20 | seangrov` | Well, good luck then |
| 11:20 | seangrov` | Just a tab in the dark |
| 11:20 | seangrov` | stab* |
| 11:22 | seangrov` | Is there some tool to print out all of the compojure routes in an app, a la rails' `rake routes` or django's `show_urls`? |
| 11:23 | tbaldrid_ | Morgawr: care to expound? This is exactly that core.async was designed for. |
| 11:26 | klrr | anyone know if there are practical use-cases of monads in a non-pure functional language? |
| 11:27 | Morgawr | tbaldridge: I'm just implementing a small clojure test inside a java application and it's very self-contained, don't want to add external dependencies (it's just a personal test, nothing fancy and it's definitely not the best way of doing it, I am aware of that) |
| 11:28 | Morgawr | anyhow I found a solution, I just have a shared promise and as soon as some thread returns I check that promise, if it's false I reset until it's true or until all threads have returned |
| 11:28 | Morgawr | and it's working fine atm |
| 11:29 | mdrogalis | Morgawr: I tried to do something like that before core.async came out. I had a race condition where in the window of time when the promise was being reset, the thing I was waiting for happened. |
| 11:29 | mdrogalis | It was a real B >_> |
| 11:29 | tbaldridge | Morgawr: what happens if the 2nd future completes before you check the promise? |
| 11:30 | Morgawr | mdrogalis: if you deliver to a promise that has been realized already it throws an exception, I capture that exception and try again until the promise has not been delivered by other threads.. and in the main thread I just deref the promise and wait, as soon as it's deref'd I check and if necessary I reset it (So the next thread can deliver) |
| 11:30 | mdrogalis | I'm dizzy just reading that - but whatever works for you :o |
| 11:31 | Morgawr | tbaldridge: there are N futures and I wait for the first one to realize the promise, all the others that realize the promise at "the same time" will throw the exception and will keep throwing it until the promise is reset so there should be no contention |
| 11:31 | boodle | Hi all, I v.new to macros (and awful!), can you tell me how I might go about solving this? https://www.refheap.com/19251 |
| 11:31 | llasram | Morgawr: Huh, what version of Clojure are you using? IIRC the current version doesn't actually throw |
| 11:32 | Morgawr | llasram: I'm using 1.5 |
| 11:32 | Morgawr | and seriously? It doesn't throw? |
| 11:32 | llasram | Anyway, easy-peasy: just have the futures not deliver non-truthy values. Then have a final future which waits on the others and delivers false |
| 11:32 | ToxicFrog | boodle: I think the question needs more context. How would this be used? What would you want the macro to look like? |
| 11:33 | Morgawr | llasram: mmm.. this might be a nice idea |
| 11:33 | boodle | ToxicFrog: well I'm only mentioning macros because I think it may be needed but all I want to actually do is use the ':fieldname' value within the map defn (in the ':val' assignment) |
| 11:34 | mdrogalis | Anyone know of a Websocket client that I can run server-side? Aleph might do it, but I can't find any examples. |
| 11:34 | Morgawr | llasram: looks like the latest version of clojure actually returns "nil" upon delivery of an already realized promise |
| 11:34 | Morgawr | so I can just test on that |
| 11:35 | Morgawr | instead of the exception |
| 11:35 | Morgawr | no big deal |
| 11:35 | Morgawr | (and much cleaner imo, no need to spawn additional threads) |
| 11:35 | ToxicFrog | Like, (defmacro foo [fieldname] `{ :fieldname ~fieldname :val ~(do-something-with fieldname) }) or thereabouts? (disclaimer: not tested, my macros are rusty) |
| 11:35 | tbaldridge | Morgawr: yeah, I'm not sure why, but I can't get (deliver p val) to ever throw an exception. |
| 11:35 | tbaldridge | in 1.4 or 1.5.1 |
| 11:36 | Morgawr | in repl I did (def a (promise)) (deliver a 4) (deliver a 3) |
| 11:36 | boodle | ToxicFrog: probably, will try it out, ty |
| 11:36 | Morgawr | (deliver a 4) returns the promise |
| 11:36 | Morgawr | (deliver a 3) and subsequient calls return nil |
| 11:36 | Morgawr | so it's fine |
| 11:36 | `cbp | boodle: why does a function not work? |
| 11:37 | Morgawr | can't wait to test this algorithm on a 48-core machine and see how it performs |
| 11:38 | boodle | `cbp: well I'm defining an array of maps and want to simplify my ':val' defns.. happy to use fn's if that's do-able.. not sure how |
| 11:39 | `cbp | boodle: when you say defns you mean definitions or clojure's defn? |
| 11:40 | `cbp | boodle: if you wanna use the same value on multiple places just use a local binding. But I'm still not sure what you really want. |
| 11:40 | boodle | `cbp: definitions.. what I really mean is where I assign a value to ':val'. If I could do something like ':val (get record ~fieldname)' |
| 11:41 | Morgawr | bitemyapp: I forgot tell you the reason why my algorithm wasn't working. Turns out I was erroneously saving the hashCode() of the object in a set instead of the object itself and that created collisions. Now it works properly :) |
| 11:42 | `cbp | boodle: like (defn make-map [fieldname] {:fieldname fieldname :val (get record fieldname)}) ? |
| 11:43 | boodle | `cbp: I can't really use of function I think because some of my map entries have other varying key/val pairs and some don't have ':vals' etc. |
| 11:44 | boodle | `cbp: but maybe with '& otherargs' in the parameter I could... ty |
| 11:46 | boodle | `cbp: I was trying to learn about the reader and if I could refer to a map key's value within the map's definition.. looks like I should just go up with another function like you suggested.. no biggie |
| 11:48 | `cbp | boodle: oh like a `this` variable? Yeah there's no such thing |
| 11:48 | sm0ke | hello any library in clojure for maps with expiry values on keys? |
| 11:49 | TimMc | Like a cache? |
| 11:49 | sm0ke | TimMc: Yes sort of |
| 11:49 | `cbp | sm0ke: theres a cache library where you can set a time |
| 11:49 | boodle | `cbp: yes.. again just trying to hack the reader a little for convenience but a helper fn's the way to go |
| 11:49 | sm0ke | `cbp: what is it called? |
| 11:49 | `cbp | clojure.tools.cache i think |
| 11:49 | mpenet | sm0ke: core.cache and core.memoize |
| 11:49 | `cbp | no clojure.tools.memoize |
| 11:49 | `cbp | er |
| 11:49 | `cbp | core |
| 11:50 | `cbp | https://github.com/clojure/core.memoize |
| 11:51 | sm0ke | thanks |
| 11:53 | sm0ke | hey guys i have this sticky situaition where i want to read of a atom/agent/ref seq ( i dont know whats fits) ..and then set it to []..but i want to avoid the situation that anyone else changes it in between..how do i handle this |
| 11:54 | tbaldridge | sm0ke: compare-and-swap! on an atom |
| 11:55 | mdrogalis | sm0ke: Or use a transaction with a ref. |
| 11:55 | sm0ke | tbaldridge: ,(doc compare-and-swap!) |
| 11:55 | mdrogalis | I think it's compare-and-set! |
| 11:56 | logic_prog | does core.async support any type of "sorting" |
| 11:56 | logic_prog | i.e. we define a field/parameter to sort on, and the messages are in an order that minimizes that field |
| 11:57 | nDuff | logic_prog: ...so you want a priority queue? Plenty of ways to implement that. |
| 11:57 | logic_prog | nDuff: yes, I want a priority queue |
| 11:57 | logic_prog | nDuff: what do you have in mind? |
| 11:58 | nDuff | logic_prog: ...well, you can have a JVM-implemented priority queue from the standard library, and connect each end to a channel. |
| 11:58 | nDuff | that's the easiest approach. |
| 11:58 | logic_prog | I need it to work in clojurescript too |
| 11:58 | logic_prog | in fact, I need it to work in both clojure and clojurescript |
| 11:58 | logic_prog | actualy, let me talk about my real problem |
| 11:58 | logic_prog | cljs and clj are talking ove ra websocket |
| 11:58 | nDuff | in that case I'd probably do something with nested channels. |
| 11:58 | logic_prog | I need to ensure that the messages arrive "in-order" |
| 11:59 | logic_prog | err, are evaluted "in-order" |
| 11:59 | tbaldridge | logic_prog: that doesn't make sense, sort is a set operation, channels are streams of data. |
| 12:00 | logic_prog | server (clj) is sending client (cljs) streams of data |
| 12:00 | logic_prog | I wnat this stream processed in the order it is sent |
| 12:00 | logic_prog | so I need a way to detect out of order packets |
| 12:00 | logic_prog | I was thinking of attaching an id to every packet and "sorting" |
| 12:00 | mdrogalis | logic_prog: So artibrary access to the stream ordering, kinda? |
| 12:00 | llasram | logic_prog: Not just TCP? |
| 12:00 | logic_prog | llasram: yeah, I think basically I need to re-implement a TCP-like in cljs/clj |
| 12:01 | mdrogalis | s/stream ordering/stream contents |
| 12:01 | llasram | logic_prog: Er. What are you doing which could cause things to occur out-of-order? |
| 12:01 | logic_prog | javascript delays |
| 12:01 | tbaldridge | logic_prog: you could probably hack this via a custom buffer, could be tricky, but it could work. |
| 12:01 | logic_prog | between the ".-onMessage" and pushing it onto a queue, |
| 12:01 | llasram | I see |
| 12:01 | llasram | Interesting |
| 12:02 | logic_prog | llasram: I think JS can fuck me up by switching out a thread after it reserives the msg from websocket, but before it >! it onto a go channel. |
| 12:02 | logic_prog | we love JS. |
| 12:02 | logic_prog | alright, TCP it is |
| 12:04 | tbaldridge | logic_prog: I don't see how that can be the case. onMessage and put! will do what you want. No way they can arrive out of order |
| 12:04 | tbaldridge | logic_prog: if you use go and >! to put the message into the channel, then yeah, this could happen. Don't do that. :-P |
| 12:47 | dobry-den | For fun, I've been implementing Clojure functions in Emacs Lisp. How would yall handle the fact that '() is the same as nil in elisp? |
| 12:48 | technomancy | dobry-den: it's symptomatic of the lack of laziness in general |
| 12:48 | technomancy | have you seen dash.el? |
| 12:48 | dobry-den | My approach was to just make everything return vectors by default |
| 12:48 | technomancy | ahahahaah |
| 12:48 | technomancy | sorry, no one told you |
| 12:48 | technomancy | vectors in elisp and CL are a joke |
| 12:49 | dobry-den | what do you mean? aside from the fact that elisp's main collection fns are on lists |
| 12:49 | hyPiRion | They are very nice for mutability |
| 12:49 | technomancy | the syntax for vectors implicitly quotes them |
| 12:49 | hyPiRion | That's essentially it |
| 12:50 | technomancy | so [(+ 1 2 3)] doesn't eval to [6] |
| 12:50 | technomancy | and you have to learn a whole new set of functions that operate on vectors |
| 12:50 | technomancy | usually their names don't even match up with the list equivalents |
| 12:50 | dobry-den | haha that explains why my (vconcat coll [x]) returned [1 2 x] |
| 12:50 | bbloom | :-/ |
| 12:50 | dobry-den | dang |
| 12:51 | technomancy | it is really boggling how bad they are |
| 12:51 | dobry-den | of course i just use (vector _) |
| 12:51 | bbloom | data structure literals and the evaluation of elements in them is pretty damn brilliant |
| 12:52 | technomancy | bbloom: it's difficult for me to see it as anything other than obvious, but you're probably right =) |
| 12:52 | bbloom | technomancy: all the best ideas are obvious in hindsight |
| 12:52 | bbloom | just like symbols vs keywords |
| 12:53 | dobry-den | i learned a lot of elisp last night though. like how much i appreciate clojure vs what seems to be elisp's different binding lookups for functions vs other symbols |
| 12:53 | bbloom | and if you think about why symbols v keywords is so brilliant, than lists vs vectors w/ their differing evaluation rules are precisely the same |
| 12:53 | bbloom | it's an obvious idea: |
| 12:53 | bbloom | anytime you add implicit evaluation, you need to add explicit elimination of that implicit evaluation |
| 12:54 | bbloom | and if you have multiple kinds of evaluation, you need multiple kinds of quoting |
| 12:54 | rasmusto | bbloom: are you saying that's what keywords do? |
| 12:54 | rasmusto | the explicit elimination of eval I mean |
| 12:54 | bbloom | keywords are basically always quoted symbols |
| 12:54 | technomancy | I wouldn't say you ever *add* implicit evaluation |
| 12:54 | bbloom | ignoring the differences in data structures, vectors are always quoted lists |
| 12:54 | technomancy | you remove implicit quoting |
| 12:55 | technomancy | but yeah |
| 12:55 | bbloom | but vectors have special quoting rules. it's a different type of quoting than the general purpose quote primitive |
| 12:56 | rasmusto | I dunno if I've fully understood keywords and their benefit over something like a quoted symbol, is it just that they can't be unquoted? |
| 12:56 | bbloom | rasmusto: a keyword is simply a symbol that always refers to itself |
| 12:56 | bbloom | importantly: you never need to worry about quoting or unquoting them |
| 12:56 | gfredericks | ,''''':foo |
| 12:56 | clojurebot | (quote (quote (quote (quote :foo)))) |
| 12:56 | rasmusto | okay, right. |
| 12:56 | dobry-den | If you were implementing Clojure functions in Elisp, do you know of a sensible way to implement a difference between '() and nil? |
| 12:57 | bbloom | but more importantly: they are keyword types when they get through the reader |
| 12:57 | bbloom | technomancy: do you (or anybody else) know of a lisp that has a built in "quote the datatype, but not the members" operator of sorts? |
| 12:57 | bbloom | like all of clojure's data structures? |
| 12:58 | technomancy | quote the data type? |
| 12:59 | bbloom | i mean like: (whatever-quote (vector-ish-thing 5 10 15)) |
| 12:59 | bbloom | i mean like: (whatever-quote (vector-ish-thing 5 (+ 10 2) 15)) |
| 12:59 | bbloom | where you'd get out a vectorish thing with 5 12 15 instead of a literal + in it |
| 13:00 | arrdem | is refheap having heartburn for anyone else today? |
| 13:01 | technomancy | bbloom: I don't see how that's a form of quoting |
| 13:01 | bbloom | technomancy: for lack of a better word |
| 13:01 | bbloom | i think thatematica would call it HoldHead |
| 13:03 | bbloom | s/thatematica/mathematica/ |
| 13:03 | bbloom | weird typeo |
| 13:03 | wedr | nice |
| 13:04 | technomancy | but I don't know of any other lisps that get it right; no |
| 13:06 | llasram | Oh man -- how are people not using ASM to create macros around custom Java class generation *all the time*? |
| 13:15 | arrdem | Raynes: not sure what's up but I'm generating 500 errors on refheap.com/paste repeatably. |
| 13:16 | arrdem | Raynes: across chrome, firefox and refheap.el :/ |
| 13:22 | pjstadig | llasram: do tell |
| 13:27 | arrdem | hum... is (clojure.core.typed/Seq <type>) no longer provided? |
| 13:29 | llasram | pjstadig: I used ASM to write a macro to generate some classes with interfaces (in the abstract sense) not well-supported by existing Clojure mechanisms |
| 13:29 | gfredericks | llasram: not well-supported? meaning impossible? |
| 13:29 | llasram | pjstadig: the ASM library includes a class called ASMifierClassVisitor which you can run over an existing .class file, and it'll spit out the (Java) ASM API calls to generate that class file |
| 13:31 | llasram | gfredericks: I believe so. I needed a custom constructor w/ a particular type signature and implementing a generics-using interface w/ the types right on the final class |
| 13:32 | llasram | Oh, and with annotations on everything |
| 13:41 | Raynes | arrdem: Seems to be fine at the moment. |
| 13:42 | dobry-den | technomancy: last night i started reading about maven (no java background). i am seeing if i can write a lein plugin that lets me drop 3rd party jars in a local folder, specify "local/<artifactID" in dependencies, and have lein install it for me |
| 13:42 | arrdem | Raynes: yay. okay thanks for looking. |
| 13:42 | dobry-den | is there any obvious hangup with that |
| 13:42 | Raynes | arrdem: Let me know if you have any issues and I'll take a look. |
| 13:43 | arrdem | Raynes: so my desktop 500s on everything as mentioned above, but my laptop works fine so I'm not sure what's up either. |
| 13:43 | master_op | #regex |
| 13:43 | dobry-den | Raynes: does laser 2.0.0-SNAPSHOT on clojars work? I haven't dug into the error that i get when i require it in a file but it says something about hickory.core. |
| 13:44 | dobry-den | but i probably will soon since i've been using as old version of laser for a while |
| 13:45 | Raynes | dobry-den: Theoretically it should, yes. |
| 13:45 | Raynes | arrdem: Your desktop is silly. |
| 13:46 | technomancy | dobry-den: you mean like lein-localrepo? |
| 13:46 | TimMc | Whee, I get to write a macro! |
| 13:46 | TimMc | Macros are like dessert. |
| 13:47 | gfredericks | lol |
| 13:47 | gfredericks | clojurebot: macros are like dessert |
| 13:47 | clojurebot | It's greek to me. |
| 13:47 | gfredericks | clojurebot: macros is <reply> macros are like dessert |
| 13:47 | clojurebot | In Ordnung |
| 13:48 | TimMc | gfredericks: You could also put |pipes| around the verb. |
| 13:48 | gfredericks | pipes! |
| 13:48 | gfredericks | ~macros |
| 13:48 | clojurebot | Barking spiders! |
| 13:48 | gfredericks | lol whatever know what you want clojurebot |
| 13:48 | technomancy | ... |
| 13:48 | dobry-den | my macro-writing experiences always turns into randomly spackling symbols with ~ and ' until it works |
| 13:49 | srruby | How do I control which functions are "exported" by my namespace? defn- ?? |
| 13:49 | lazybot | srruby: Definitely not. |
| 13:49 | gfredericks | dobry-den: once I got good at writing macros that experience got promoted to when I try to write metamacros |
| 13:49 | technomancy | arrdem: I think with clojurebot it's intentional. part of the charm. |
| 13:50 | TimMc | I can confirm this. |
| 13:50 | dobry-den | macrofactories? |
| 13:50 | gfredericks | I guess so |
| 13:50 | TimMc | srruby: lazybot is wrong this time -- that is correct |
| 13:50 | dobry-den | i feel like i'm not getting better at writing macros |
| 13:50 | TimMc | srruby: defn- is just defn + ^:private, which can be put on any def |
| 13:50 | gfredericks | "I feel like I'm not getting better at eating pie." |
| 13:51 | TimMc | ?! |
| 13:51 | srruby | Can I declare in the ns form which functions are "exported" ? |
| 13:51 | `cbp | fatty |
| 13:51 | `cbp | srruby: no |
| 13:51 | technomancy | srruby: unfortunately not |
| 13:52 | srruby | Thanks everybody. I'm surprised.. |
| 13:52 | TimMc | srruby: vars are public ("exported") by default; putting ^:private on the var's name prevents this (but does not make it truly inaccessible.) |
| 14:08 | glosoli | Which of Emacs Kits include Clojure Mode ? |
| 14:10 | technomancy | glosoli: just use package.el |
| 14:11 | glosoli | technomancy: what's package.el umm ? |
| 14:11 | technomancy | it's not worth pulling in a bunch of unrelated stuff just for one file |
| 14:11 | glosoli | technomancy: aaa that I am doing it already |
| 14:11 | technomancy | http://marmalade-repo.org/ |
| 14:11 | glosoli | Was just curious to check what else people do :) |
| 14:11 | glosoli | To learn something from their configs or such |
| 14:11 | seangrov` | arrdem: Same here, refheap seems to be broken on insert |
| 14:11 | technomancy | ah cool gotcha |
| 14:12 | arrdem | seangrov`: yay I'm not totally insane! |
| 14:12 | gf3 | seangrov`, arrdem: WFM |
| 14:12 | dobry-den | if you have that kind of time it's pretty cool to spend a day setting up your .emacs.d from scratch |
| 14:13 | seangrov` | gf3: You can paste and save? |
| 14:13 | gf3 | seangrov`: Yarp |
| 14:13 | gf3 | https://www.refheap.com/116dd69edd6daeaed2b68ba20 |
| 14:15 | arrdem | dobry-den: eh you only really have to do that twice... once to find the tools you like and one more time to shave the yacc into a modular config file set. |
| 14:19 | TimMc | Heh, "yacc-shaving". |
| 14:19 | arrdem | TimMc: we already shaved yacc, it's called instaparse :D |
| 14:20 | llasram | heh |
| 14:21 | wink | badumtsh :P |
| 14:22 | TimMc | :-D |
| 14:22 | arrdem | ~rimshot |
| 14:22 | clojurebot | Badum, *tish* |
| 14:33 | dobry-den | instaparse is a definitive tool for the pathological yak-shaver |
| 14:34 | rasmusto | dobry-den: instaparse seemed like overkill for the shaving I had to do |
| 14:34 | dobry-den | and its readme does a good job of lulling you into a false sense of this-won't-take-long |
| 14:35 | wink | come to the dark side, we have grammars |
| 14:36 | dobry-den | hmm, i'm really getting this first instaparse example. i'll just write my own markdown parser for my blog |
| 14:36 | bitemyapp | dobry-den: instaparse is awesome. |
| 14:36 | dobry-den | i agree |
| 14:37 | dobry-den | the top few most popualr clj markdown parsers are all regex i believe |
| 14:38 | arrdem | I mean the original markdown "spec" was really a case of "here's what I regex match and what it transforms to"... |
| 14:38 | bitemyapp | arrdem: it's more complicated than that, the perl script he wrote violates a regular grammar IIRC |
| 14:39 | bitemyapp | as a result, a fully "compliant with original implementation" markdown parser has to be a parser, not just regex. |
| 14:39 | arrdem | bitemyapp: well perl regular expressions aren't regular so... |
| 14:40 | dobry-den | i tried writing my own markdown grammar. |
| 14:40 | clojurebot | Gabh mo leithscéal? |
| 14:40 | bitemyapp | There's that too, but I don't just mean Perl regex backtracking. |
| 14:40 | dobry-den | i dont visit that folder anymore |
| 14:40 | arrdem | dobry-den: yep. basically. |
| 14:40 | utkarsh | I'm probably missing something small here, but in clojure-mode and nrepl, how do I *send* the current sexp into the nREPL buffer I have opened in a window? C-x C-e evaluates and shows the result in that little line below the mode line. |
| 14:42 | bitemyapp | utkarsh: C-h m |
| 14:42 | dobry-den | utkarsh: i usually c-x c-e all day. but if i want to port code to the repl, M-- C-c C-z or whatever will load the file namespace into repl window |
| 14:42 | hiredman | utkarsh: they may be something to do that, but I don't think most people work like that, so it seems unlikely |
| 14:43 | dobry-den | i think i only use the repl window when i want quick visual feedback on unwieldy/larger datastructures |
| 14:48 | honza | lol at dobry-den :) |
| 14:49 | bitemyapp | rkneufeld: do you have a minute to discuss the Korma chapter? |
| 14:49 | bitemyapp | rkneufeld: I've been working on it and need to make a decision. |
| 14:53 | rkneufeld | bitemyapp: I do, private message? |
| 15:29 | logic_prog | is there a way to tell emacs to indent my-defn with the same rules as defn? |
| 15:31 | technomancy | logic_prog: yes, but your indentation rules won't apply to anyone else editing your code |
| 15:32 | logic_prog | taht's fine |
| 15:32 | logic_prog | how do I do this? |
| 15:32 | technomancy | there's a put-clojure-indent function |
| 15:33 | logic_prog | hmm |
| 15:33 | logic_prog | I sholud be using clojure-emacs isntead of starter-kit? |
| 15:33 | bitemyapp | logic_prog: you should be using Emacs. |
| 15:33 | technomancy | what is clojure-emacs? |
| 15:34 | logic_prog | the first thing I find on google for put-clojure-indent |
| 15:34 | logic_prog | seems to be an emacs mode |
| 15:34 | bitemyapp | gf3: dem carpenter abs. |
| 15:35 | technomancy | logic_prog: don't use the starter kit; do use clojure-mode, nrepl.el, and paredit at least |
| 15:35 | gf3 | bitemyapp: Topless roof Jesus |
| 15:35 | Raynes | gf3: Did I ever tell you that my toilet'd iPhone eventually recovered after about 5 days? |
| 15:36 | Raynes | I imagine your phone had less luck, so I thought I'd rub it in. |
| 15:36 | logic_prog | is this due to the ios7 water proof update? |
| 15:36 | Raynes | Yes. |
| 15:38 | gf3 | Raynes: So did mine. Bag of rice, works every time → http://cloud.gf3.ca/Rjh6 |
| 15:38 | clojurebot | Huh? |
| 15:38 | Raynes | gf3: dat rice |
| 15:39 | TimMc | Raynes: Mozilla Persona status: Still useless. |
| 15:39 | Raynes | TimMc: Still waiting for your github auth pull request, bro. |
| 15:40 | TimMc | This has been your scheduled quarterly reminder. |
| 15:40 | gf3 | Oh shi— |
| 15:40 | Raynes | gf3: Also, still waiting for your redesigns you slacker. |
| 15:40 | TimMc | I can't believe it's still incompatible with Mozilla Firefox's password manager. |
| 15:40 | bitemyapp | Raynes: fuck auth, you should integrate bulwark :) |
| 15:40 | gf3 | Raynes: I was thinking about that yesterday ❤ |
| 15:40 | Raynes | bitemyapp: Still waiting for your bulwark pull request bro. |
| 15:40 | bitemyapp | TimMc: Mozilla people don't know how to implement services. |
| 15:41 | bitemyapp | Raynes: I have too much to do. :( |
| 15:41 | Raynes | bitemyapp: So do I!!1! |
| 15:41 | logic_prog | so put-clojure-indent seems to work sith (put-clojure-indent 'unify 2), but not (put-clojure-indent 'util/unify 2) |
| 15:41 | TimMc | bulwark, eh? |
| 15:41 | logic_prog | why does the / break things? |
| 15:41 | Raynes | bitemyapp: A friend said last night: "I remember when Raynes was jobless and worked on random projects constantly." |
| 15:41 | bitemyapp | Raynes: you know what my queue looks like. It's horrific. |
| 15:42 | Raynes | It actually made me sad enough that I'll probably hop back on some projects soon. |
| 15:42 | Raynes | Laser 2.0.0 needs to get finished, some features in refheap master need tweaked and released, some plugins in lazybot need fixed, etc. |
| 15:42 | bitemyapp | Raynes: http://i.imgur.com/1zTP0cc.gif |
| 15:42 | bitemyapp | ^^ that's how busy I am. |
| 15:43 | technomancy | Raynes: that feeling when you are reluctant to hire someone because you know it will impact their community output =( |
| 15:43 | scriptor | damn, that's dark |
| 15:43 | bitemyapp | I'm pretty sure my output increased after I started at the company I'm at now. |
| 15:43 | Raynes | technomancy: Well, it isn't just work affecting my community output. |
| 15:44 | Raynes | I think I needed a bit of a break anyways. |
| 15:44 | technomancy | it's a thing people do |
| 15:46 | bitemyapp | Raynes: not like you gotta be a superhero. Just make things. :) |
| 15:46 | bitemyapp | you don't have to be an ecosystem-unto-yourself. |
| 15:46 | Raynes | bitemyapp: But I am a superhero. |
| 16:37 | Raynes | ifesdjeen: Darn you. |
| 16:38 | Raynes | ifesdjeen: I had just typed out an answer. :P |
| 16:38 | ifesdjeen | Raynes: :) |
| 16:38 | ifesdjeen | thanks <3 |
| 16:38 | Raynes | <3 |
| 16:38 | ifesdjeen | sorry i bothered you before i read the code ;) |
| 16:38 | ifesdjeen | couldn't figure it out for 2 hours :) |
| 16:38 | Raynes | It's fine. max-defs isn't even documented apparently. |
| 16:38 | Raynes | It should be mentioned in the docstring. |
| 16:38 | ifesdjeen | :) |
| 16:39 | ifesdjeen | probably |
| 16:39 | ifesdjeen | implemented workshop server on top of clojails, btw |
| 16:39 | ifesdjeen | we're using it for http://clojureworkshop.com |
| 16:39 | Raynes | Cool, cool. |
| 16:39 | SegFaultAX | ifesdjeen: I dig the logo. |
| 16:40 | SegFaultAX | Oh is that just the clojurewerkz logo? |
| 16:40 | ifesdjeen | SegFaultAX: it's somewhat similar to ClojureWerkz logo ;) |
| 16:40 | ifesdjeen | it's a part of it, let's say ;) |
| 16:40 | SegFaultAX | Heh |
| 16:40 | ifesdjeen | Raynes: do you want a couple of @clojurewerkz stickers? |
| 16:40 | ifesdjeen | actually, does anyone want some? :D |
| 16:41 | Raynes | ifesdjeen: I never turn down stickers. |
| 16:41 | antares_ | hey Raynes |
| 16:41 | Raynes | Greetings, sir. |
| 16:41 | ifesdjeen | Raynes: where are you located? |
| 16:41 | Raynes | Los Angeles, CA. |
| 16:41 | ifesdjeen | ah |
| 16:42 | Raynes | International shipping is no fun. |
| 16:42 | mdrogalis | Stickers are awesome. |
| 16:42 | antares_ | Raynes: how is SoCal treating you? |
| 16:42 | mdrogalis | Oh, read up :( |
| 16:42 | ifesdjeen | Raynes: they're currently in USA actually :) |
| 16:42 | Raynes | antares_: Wondrously. I love it here. |
| 16:42 | ifesdjeen | Raynes: although in SF :P |
| 16:42 | Raynes | :p |
| 16:43 | ifesdjeen | i know that Zach Tellman will be @ EuroClojure |
| 16:43 | Raynes | Everything is in SF. Angels are used to this fact. |
| 16:43 | ifesdjeen | not sure if he's anywhere close to you though |
| 16:43 | ifesdjeen | ah, SF, too |
| 16:43 | ifesdjeen | shoo |
| 16:44 | Raynes | Zach frequently visits LA. We (Geni) frequently have lunch with the Factual crew when Zach is in town. |
| 16:44 | ifesdjeen | Raynes: oh, great! I'll just give him some for you |
| 16:44 | Raynes | Cool. |
| 16:45 | antares_ | Raynes gets ClojureWerkz stickers before I do :/ |
| 16:46 | Raynes | :3 |
| 16:46 | Raynes | antares_: Well, I don't actually know when I'll see Zach. |
| 16:46 | antares_ | it's OK |
| 16:46 | ifesdjeen | antares_: no worries, Russia is on the list :) |
| 16:47 | antares_ | ifesdjeen: Russian customs are ridiculously understaffed |
| 16:47 | ifesdjeen | i think there'll be some people on EuroClojure from MSK |
| 16:47 | Raynes | I seem to recall that he wants to be here when we do a telemetry-related Clojure meetup (we're hosting our first meetup at the Geni office on the 10th, and a future one will feature some telemetry-related shenanigans) so it could be a month or two before I see him again. |
| 16:47 | antares_ | ifesdjeen: like you don't know that I'm not really in Moscow any more :P |
| 16:48 | ifesdjeen | :D |
| 16:48 | bitemyapp | antares_: elastisch is killing me man. |
| 16:48 | bitemyapp | (doc/search events-index events-type |
| 16:48 | bitemyapp | :query {:match_all {}} |
| 16:49 | bitemyapp | antares_: ^^ only ever seems to return 10 documents in an index that contains 31 |
| 16:51 | antares_ | bitemyapp: 10 is the default page size |
| 16:51 | bitemyapp | fFFFFFFFFFFFFFFFFFFFF |
| 16:51 | antares_ | use scroll requests or pass a different limit |
| 16:51 | bitemyapp | I passed a limit filter. |
| 16:51 | antares_ | I don't think it's a filter |
| 16:51 | bitemyapp | antares_: value 50 limit filter. |
| 16:51 | antares_ | filters are applied to a result set |
| 16:51 | antares_ | it has to be a search request option |
| 16:52 | antares_ | (that's how ES works) |
| 16:52 | bitemyapp | antares_: you might be talking about something else but: http://clojureelasticsearch.info/articles/querying.html#limit_filter |
| 16:54 | antares_ | filters are applied after the documents were retrieved from the index |
| 16:54 | bitemyapp | antares_: that fixed it. yeesh. |
| 16:54 | antares_ | it's like HAVING in SQL, not WHERE |
| 16:54 | bitemyapp | antares_: that fucked us hard in ClojureCup :P |
| 16:54 | bitemyapp | I've used ES before, but it was awhile ago. |
| 16:54 | bitemyapp | Forgot about that. |
| 16:54 | antares_ | hilariously I cannot find the query option that sets the limit |
| 16:54 | antares_ | in ES docs (which are far from perfect) |
| 16:55 | bitemyapp | antares_: far far |
| 17:16 | logic_prog | in clojurescript, when I get an error, is there anyway to get a stacktrace ? |
| 17:18 | nDuff | logic_prog: if you mean that one refers to your actual Clojure code, you need source maps, which are new and experimental. |
| 17:21 | Batai | hello, how the highly experimental library for proper tco called i've forgot |
| 17:21 | ambrosebs | Batai: ctco IIRC |
| 17:22 | ambrosebs | https://www.google.com.au/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CC4QFjAA&url=https%3A%2F%2Fgithub.com%2Fcjfrisz%2Fclojure-tco&ei=9oZMUo6sDoqulQWS34DQCA&usg=AFQjCNE1A6-fxzX1R2QZnIYECX5f6FBxyQ&sig2=0fUF9w-p5_dnF81qwSkA3Q&bvm=bv.53537100,d.dGI |
| 17:22 | ambrosebs | whoops! |
| 17:22 | ambrosebs | https://github.com/cjfrisz/clojure-tco |
| 17:23 | Batai | yeah, thanks. |
| 17:23 | bitemyapp | ambrosebs: whooooaaaaa. Does that work? |
| 17:23 | ambrosebs | bitemyapp: I don't think it's quite ready |
| 17:24 | ambrosebs | bitemyapp: need to bug cjfrisz more! |
| 17:24 | bitemyapp | still, having safe mutual recursion would be awesome. |
| 17:24 | bbloom | it's a lexical transform, so you might as well just use trampoline |
| 17:25 | technomancy | if you don't mind having wrappers everywhere it shouldn't be a big deal, right |
| 17:25 | technomancy | ? |
| 17:25 | bbloom | it doesn't enable you to do anything you couldn't do before, it just makes it a tiny bit more automatic :-) |
| 17:25 | gfredericks | there's a bug in reduce due to lack of TCO |
| 17:25 | technomancy | right, it's not like it's possible to suddenly get TCO for free |
| 17:25 | bitemyapp | trampoline annoys me. |
| 17:25 | bitemyapp | gfredericks: what's the bug? |
| 17:26 | bbloom | everywhere? you only need it at the mutually recursive call sites, which is probably only a few more places than wrapping the declaration sites |
| 17:26 | gfredericks | bitemyapp: stack overflow when reducing seqs that transition type frequently |
| 17:26 | gfredericks | ,(->> (cons 1 [2]) (repeat 10000) (apply concat) (reduce +)) |
| 17:26 | clojurebot | #<StackOverflowError java.lang.StackOverflowError> |
| 17:26 | gfredericks | ^ TCO would fix that immediately |
| 17:28 | gfredericks | that sequence is perfectly usable in other contexts, just not with reduce |
| 17:52 | hyPiRion | oh, hah, that fun thingy |
| 18:04 | rasmusto | bogdanp needs to be bogdamped |
| 18:04 | Batai | rasmusto: Lol. |
| 18:09 | technomancy | has anyone touched a 32-bit computer in the last 2 years? |
| 18:09 | technomancy | apart from mobile devices, phones, gaming, etc |
| 18:09 | bbloom | is that like a mainframe or something? |
| 18:09 | _freenode | I've been mostly running 32-bit VMs |
| 18:10 | rasmusto | technomancy: does an 8-bit computer count? |
| 18:10 | technomancy | rasmusto: only for hipster cred |
| 18:10 | `cbp | I sell software for stores that runs on 32 bits |
| 18:10 | `cbp | 32 bit xp |
| 18:10 | rasmusto | technomancy: yeah, robots w/ micros are pretty hipster |
| 18:10 | technomancy | I'm thinking for machines you do dev on |
| 18:11 | rasmusto | I had a command line on my robot |
| 18:11 | `cbp | oh :P only for testing |
| 18:11 | _freenode | Realistically, there's no excuse for my laptop to be 64-bit |
| 18:12 | technomancy | _freenode: those VMs aren't for clojure dev though right? |
| 18:12 | _freenode | Dammit. |
| 18:12 | hyPiRion | technomancy: I made a 16 bit machine. Does that count? |
| 18:12 | jimrthy | technomancy: Those VMs are for all *sorts* of dev. Including clojure |
| 18:13 | `cbp | when i used ubuntu it was a 32 bit machine if that counts, that was my main de machine |
| 18:13 | `cbp | dev* |
| 18:13 | `cbp | 32 bit vm |
| 18:13 | technomancy | hyPiRion: see my response to rasmuto |
| 18:14 | rasmusto | I liked to think my my robot as "prod" |
| 18:14 | jimrthy | technomancy: I've also done a little dev on my chromebook, which is 32-bits. Pretty much all SSH'd into my 32-bit server VM...but that was really just personal web-site cheap hosting stuff |
| 18:14 | rasmusto | s/my/of |
| 18:14 | hyPiRion | oh. Well, we made game of life and video filters on it. Not exactly general purpose. |
| 18:14 | technomancy | man, all the things you don't have to think of when you're on a VM |
| 18:15 | technomancy | I mean, the JVM |
| 18:18 | hyPiRion | I'd guess that counts for many VMs though |
| 18:18 | bja | so if I'm not supposed to use the format function in clojurescript, is there an alternative? |
| 18:19 | hyPiRion | is cl-format ported over to cljs? |
| 18:19 | technomancy | hyPiRion: but not virtualbox =) |
| 18:19 | bja | referring to https://github.com/clojure/clojurescript/commit/48c8d0fafc18375876e10caf960a7c7da27ac308 |
| 18:20 | hyPiRion | technomancy: heh, right |
| 18:22 | jimrthy | Is there an idiomatic way to poll a core.async channel? Right now I'm trying an alts read w/ a 1 ms timeout, but I'd rather skip that ms if possible. |
| 18:23 | bbloom | jimrthy: you can provide a default |
| 18:24 | bbloom | https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L243 |
| 18:24 | jimrthy | bbloom: Sweet, thanks |
| 18:26 | dobry-den | What does an asterisk* at the end of a function name tend to represent? |
| 18:28 | technomancy | it means either "internal implementation detail" or "sorry but I couldn't think of a better name for this function" |
| 18:29 | bja | I guess "internal implementation detail" is close enough to "function version of a macro named the same minus the *" |
| 18:29 | danlentz | sorry to ask what I'm sure is a du,b question but I'm a little confused as to the use of (.method args) vs (. method args) and how .. fits in. Is there a quick expln or a good webpage anyone that covers this? |
| 18:36 | technomancy | danlentz: (. obj method args) is mostly just for macroexpansion |
| 18:37 | technomancy | use (.method obj args) for single method calls and generally -> for chains |
| 18:39 | danlentz | why for instance is it not corect to say (.digest (java.security.MessageDigest/getInstance "SHA1")) but seems to require (doto (java.security.MessageDigest/getInstance "SHA1") (.digest ……)) |
| 18:40 | technomancy | danlentz: doto means "ignore the return value" |
| 18:40 | technomancy | it's a totally different call |
| 18:40 | akurilin | Is there any way of suppressing exceptions being dumped to the terminal when running tests that make them get thrown? |
| 18:40 | akurilin | In my case they're SQL exceptions that I'm intentionally hitting. |
| 18:41 | hyPiRion | akurilin: (is (thrown? ExceptionName body)) |
| 18:41 | hyPiRion | for clojure.test |
| 18:43 | danlentz | ah. so what Im looking for is (-> (make-digest +sha1+) |
| 18:43 | danlentz | (.digest (.getBytes "sss"))) |
| 18:44 | akurilin | hyPiRion, just to clarify, I'm not actually to interested in check that they were thrown, I check the result of the API call to see how many concurrent calls failed. I just want to avoid spammin the test log so that when exceptions are thrown, I do end up looking at them |
| 18:44 | akurilin | (real exceptions, not the expected ones) |
| 18:44 | danlentz | sorry (-> (make-digest +sha1+) |
| 18:44 | danlentz | (.digest (.getBytes "sss"))) |
| 18:46 | hyPiRion | akurilin: oh, then you could probably bind *err* or *out* to a StringWriter and ignore its content |
| 18:46 | hyPiRion | Look at e.g. how with-out-str and how it handles it: (source with-out-str) |
| 18:47 | akurilin | hyPiRion, ok that's cool, I just to redef it for a few specific tests, so this is probably not too hackish |
| 18:48 | technomancy | danlentz: when in doubt, macroexpand |
| 18:48 | danlentz | also, is there an equivalent Class or unboxed primateve in clojure/java to the common-lisp bit-vector? |
| 18:49 | technomancy | danlentz: also, don't use +foo+ for constants; everything that isn't a reference type is a constant |
| 18:49 | danlentz | ah good point. |
| 18:49 | danlentz | :) +culture-shock+ |
| 18:49 | technomancy | heh |
| 18:51 | Def`1 | Hi |
| 18:51 | Def`1 | said somebody here on the Russian? |
| 18:53 | Def`1 | means by which you can write a gui clojure |
| 18:53 | akurilin | hyPiRion, well *err* didn't do it, but *out* did. Either I'm manually logging that exception from somewhere, or it's not beign saved to *err* by default. |
| 18:53 | danlentz | common-lisp has just so many facilities for working with bytes, bits, bit-vectors, and ESPECIALLY unsigned numbers which I feel like I've been really grappling with. |
| 18:54 | akurilin | hyPiRion, in any case I learned something new today thanks to you :) |
| 18:54 | Def`1 | ty |
| 18:54 | hyPiRion | akurilin: np |
| 18:54 | akurilin | hyPiRion, btw, is foo# some kind of naming convention for overridden dynamic vars? |
| 18:55 | hyPiRion | akurilin: no, it's macro sugar. It's for generating symbols not colliding with other symbol names |
| 18:55 | danlentz | but a bit vector facility would go a long way toward implementing some, if there is such a thing in java/clojure? |
| 18:55 | technomancy | danlentz: byte arrays are common, but unsigned numbers are not a thing on the JVM |
| 18:55 | hyPiRion | ,`(let [val# (some computation)] (do-something-with val#)) |
| 18:55 | clojurebot | (clojure.core/let [val__29__auto__ (clojure.core/some sandbox/computation)] (sandbox/do-something-with val__29__auto__)) |
| 18:56 | akurilin | hyPiRion, oh I see. Yeah I'm not yet at macro-fu yet, so I won't be able to appreciate it at this point. Soon though. |
| 18:57 | bitemyapp | akurilin: don't use macros. |
| 18:57 | hyPiRion | akurilin: heh, just think of it as a way to "hide" names of variables |
| 18:57 | technomancy | danlentz: only other thing I'm aware of is https://github.com/ztellman/immutable-bitset |
| 18:57 | danlentz | y. I'm been using a vector of shorts to represent an "octet-vector" and escape the signed-arithmatic hassles. Its not a huge concern to me space wise as I'm only working with 128 bit UUIDs but I have a nagging doubt about performance vs byte-arrays |
| 18:58 | akurilin | bitemyapp, are there really no situations you can think of where macros would be very useful, even as an advanced clojure user? |
| 18:58 | akurilin | *not useful, "the right choice" is what I meant |
| 18:58 | danlentz | ooh. not what I was looking for at the moment but very cool! |
| 18:59 | akurilin | hyPiRion, got it! |
| 18:59 | akurilin | Got to use pmap for the first time today to test a pretty simple race condition I was having, woot. |
| 19:00 | danlentz | actually it implements "bit-seq" which might be exactly what I'm looking for |
| 19:00 | bitemyapp | akurilin: I tell people not to use macros until they know when to stop listening to me. |
| 19:00 | bitemyapp | akurilin: when they know enough to know they shouldn't use macros, then they're ready for macros. |
| 19:00 | hyPiRion | Macros are nice if you use them properly, but that require experience |
| 19:00 | danlentz | technomancy: thank you very much. quite helpful! |
| 19:00 | bitemyapp | You won't be ready to decide when to use macros until you've decided not to use macros. |
| 19:00 | bitemyapp | Then you can use macros. |
| 19:00 | technomancy | danlentz: good luck |
| 19:00 | bitemyapp | Or we can skip the zen koan and you can just take my word for it when I say, "don't use macros" |
| 19:01 | hyPiRion | bitemyapp: Sounds like some lisp zen. |
| 19:01 | hyPiRion | ah, right, you got to that point. |
| 19:01 | AimHere | hyPiRion, surely you need to use macros improperly to get that experience! |
| 19:01 | bitemyapp | AimHere: yeah but you're better off making those mistakes when you have a stronger foundation. |
| 19:02 | akurilin | The problem is that you won't learn not to use macros until you've made enough mistakes by using them. |
| 19:02 | hyPiRion | AimHere: As long as you don't include them in your library you open source :) |
| 19:02 | bitemyapp | macros won't really help establish that foundation and you need to get a good nose for how macro expansion works and what it means in terms of the "time" code gets evaluated. |
| 19:02 | technomancy | you can learn from trying to use other libs that misuse macros too =) |
| 19:02 | bitemyapp | akurilin: you learn macros faster the longer you wait to use them. |
| 19:02 | technomancy | though that's not as easy as it once was |
| 19:05 | akurilin | I'll do that. |
| 19:07 | danlentz | ztellman/primitive-math has quite a number of usefull arithmetic operations imllemented -- byte->ubyte long->ulong bitwise-ops. This guy is a star! :) |
| 19:11 | hiredman | danlentz: long->ulong is something of a misnomer, the jvm has no unsigned primitive types, what happens there is transforms the long in to bytes, and creates a heap allocated BigInteger from those bytes |
| 19:14 | Apage43 | man |
| 19:15 | bitemyapp | Apage43: yes? |
| 19:15 | Apage43 | the no unsigned thing is a killer |
| 19:15 | Apage43 | because I easily forget about it most of the tim |
| 19:15 | Apage43 | *time |
| 19:15 | Apage43 | but every once in a while it consumes my whole *day* |
| 19:15 | danlentz | i've been wrestling with unsigned all day |
| 19:15 | SegFaultAX | Ugh, circleci keeps dying. |
| 19:15 | Apage43 | cause i'm fiddling with file formats, protocols, or such |
| 19:15 | bitemyapp | SegFaultAX: :( |
| 19:16 | bitemyapp | SegFaultAX: going to the Clojure Community Night? |
| 19:16 | danlentz | my soon is to represent unsigned long as a vector of 8 shorts |
| 19:16 | hiredman | SegFaultAX: seems unlikely, they have a type system |
| 19:16 | danlentz | unsigned int as 4 shorts |
| 19:16 | SegFaultAX | bitemyapp: As prismatic? |
| 19:16 | SegFaultAX | At* |
| 19:16 | danlentz | unsigned byte as 1 short |
| 19:16 | SegFaultAX | hiredman: Sweet burn. |
| 19:16 | Apage43 | of course, I can always say to my self "hey, it could be Javascript" |
| 19:16 | hiredman | danlentz: clojure vectors (and almost all jvm collections) will box primitive values |
| 19:17 | bitemyapp | SegFaultAX: yes, at Prismatic. |
| 19:17 | bitemyapp | hiredman: nice burn. |
| 19:17 | danlentz | so if i say (octets -1) i get [255 255 255 255 255 255 255 255] |
| 19:17 | SegFaultAX | bitemyapp: Yea, Jason Wolfe pinged me about it. |
| 19:17 | SegFaultAX | Is that tonight? |
| 19:18 | Apage43 | si |
| 19:18 | hiredman | [], cojure vectors, box primitives, so those numbers are heap allocated |
| 19:18 | clojurebot | Titim gan éirí ort. |
| 19:18 | danlentz | (octets 0x80a0a0a0a) [8 10 10 10 10]) |
| 19:19 | danlentz | oh yeah? well that pretty much means I've totally wasted my time … :-/ |
| 19:19 | danlentz | grrrrr |
| 19:19 | danlentz | jesus what are you supposed to do? |
| 19:19 | technomancy | what are you trying to do? |
| 19:21 | danlentz | trying to augment the java.util.UUID class with a number of additional features which I'm accustomed to having in my CL environment. |
| 19:21 | technomancy | and you're having performance problems? |
| 19:21 | hiredman | generally the way you deal with unsigned types on the jvm is you byte the bullet and use the next up size of signed type, but you can't do that with longs |
| 19:22 | danlentz | so there is a need for representation of 128 bit values with extensive bit-twiddling assembly , dissssembly, and general manipulation |
| 19:22 | hiredman | java.util.UUID uses two longs |
| 19:23 | technomancy | bit-twiddling on the JVM is possible, but it's a terrible place to start learning a new language |
| 19:23 | danlentz | right will Java uuid is 2 longs. so i most importantly need to transform those into a 128 bit or 16 (unsigned) byte representation |
| 19:24 | danlentz | y its been educational but really aggravating. |
| 19:25 | danlentz | i had looked to avoid byte vector b/c of the signedness of the individual elements was driving me crazy, but I am getting the picture it might beg the only way |
| 19:26 | danlentz | i am totally disheartened that my vector of shorts wind up heap allocated |
| 19:26 | technomancy | you can have primitive vectors iirc |
| 19:26 | technomancy | they just don't work that way by default |
| 19:26 | danlentz | it was working so well |
| 19:27 | danlentz | really? via metadata? |
| 19:27 | technomancy | I forget the details because I've never needed primitives ever but it was one of the original POCs for deftype |
| 19:27 | danlentz | a POCs on all their houses :) |
| 19:27 | technomancy | http://clojuredocs.org/clojure_core/1.2.0/clojure.core/vector-of |
| 19:28 | danlentz | hey that might be what i need |
| 19:30 | mlb- | I want to have a test which uses a file's contents. How can I access this file without hardcoding the path to my clojure project/test/namespace/filename ? |
| 19:31 | rasmusto | mlb-: clojure.java.io/resource ? |
| 19:32 | mlb- | rasmusto: I'm new to clojure/JVM, is there a simple example somewhere (I don't see on clojuredocs.org) |
| 19:32 | danlentz | the java UUID stuff seems really meager and simpleminded -- much of what functionality it has works via some really ugly conversions to and form strings. If I can work out the basic issues of how to represent and manipulate the uuid bits as unboxed values it seems to me I should be able to do a whole lot better performance wise as well as augment the protocol with a number of capsbilities that make working with UUIDs a real pleasant experience |
| 19:33 | bitemyapp | uuids aren't usually in the middle of performance-centric code. |
| 19:33 | technomancy | heh, I've always worked with uuids as strings; pleasant enough for me. |
| 19:34 | danlentz | there is a common-lisp library repo: mon-key/unicly that does an incredibly meticulous job of implementing and optimizing rfc4122 down to the most minute detail |
| 19:34 | rasmusto | mlb-: make a directory called resources in your project root, then do (slurp (resource "somedir/myfile.txt")) |
| 19:34 | technomancy | how is it different? |
| 19:34 | bitemyapp | technomancy: maybe if you needed to generate sequences of them or something? I don't know. |
| 19:35 | bitemyapp | danlentz: does that make a difference? |
| 19:35 | danlentz | orders of magnitude faster than working with strings. One can cheaply generate millions per second. This opens the door to a lot of creative uses for them as they become quite economical |
| 19:36 | technomancy | I guess that's a thing people do? |
| 19:37 | seangrov` | bitemyapp: You going to the prismatic meetup tonight? |
| 19:37 | bitemyapp | seangrov`: I'm presenting |
| 19:37 | danlentz | I've used them in a number of ways… for example in a transaction system for graph database, where the "next" transaction is represented as a v5 uuid of the current uuid and a sequence number or some other type of designator |
| 19:38 | bitemyapp | seangrov`: in person, not via disembodied hologram - so yes I will be there. |
| 19:38 | seangrov` | bitemyapp: I see, suppose that's a good answer |
| 19:38 | bitemyapp | I have many answers, all of them good, not many of them correct. |
| 19:38 | seangrov` | I'll probably be there as well, just a tiny bit late. Have to meet my old CEO at Lava Lounge first |
| 19:39 | bitemyapp | seangrov`: cool, look forward to seeing you. Hopefully you get to see my talk. |
| 19:40 | Apage43 | I have approximate knowledge of many things |
| 19:40 | Apage43 | i have to get my self to the train at some point |
| 19:47 | danlentz | you can use this technique to implement a linked list ior other structure in a data store where the only way you can follow it is if you have knowedede if the initial namespace, key, or both. This can be a very useful technique that is easy to use but totally invisible if its not the structure you are dealing with. The entries otherwise are basically just background static you'll never wind up seeing. |
| 19:49 | danlentz | useful for representation of versioned resources, especially in a clojure model where values are (ideally) represented persistently. |
| 19:52 | danlentz | useful for modeling dynamic context where one might wish to resolve identifiers by working backward through some dynamic chain of environments. |
| 19:53 | danlentz | or "lexical" type context too i guess |
| 19:54 | coventry | What sort of problems are these kinds of data structures useful for? |
| 19:54 | danlentz | but this is another technique that is extremely useful for building on a graph-database abstraction |
| 19:55 | danlentz | coventry: me? |
| 19:55 | coventry | yeah |
| 19:55 | danlentz | ah. scroll back i've just been ratting them off for about 10 minutes now! |
| 19:56 | danlentz | but in a less abstract and immediate sense I |
| 19:57 | coventry | danlentz: I read it. What's a practical problem you can apply this framework to? |
| 19:59 | danlentz | see them as quite a nice means for implementing a diatomic model to support "projection" of specific "contexts" (or graphs i guess you might say) from diatomic as a graph model to an ephemeral OWL model and back again. |
| 19:59 | danlentz | anyway its not a framework its a uuid |
| 20:00 | coventry | Conceptual framework. |
| 20:00 | danlentz | a mechanism of calculation of (effectively) 128 bit integers |
| 20:02 | danlentz | but I forget the figure something lile if each atom in the universe calculated continuously these numbers at 1 million per second it wold be 1 trillion years until a repeat |
| 20:02 | danlentz | or something roughly that astounding. |
| 20:03 | danlentz | so by using this mechanism we can do things in a very very very large address space. |
| 20:03 | danlentz | and in a number of useful ways |
| 20:04 | danlentz | check out mon-key/unicly repo on github i believe there are some use-cases albeit fairly trivial. |
| 20:04 | coventry | Yeah, I was mildly curious about what novel things we can do this way. |
| 20:06 | danlentz | or check out repo lisp/de.setf.resource for an example using them for real as the basis of management of a completely lock-free concurrent distributed tranaction model based on these techniques for a distributed graph database |
| 20:06 | danlentz | painlessly i might add |
| 20:07 | coventry | Thanks. |
| 20:09 | danlentz | although de.setf.resource uses a somewhat fierier uuid library to unicly that isn't nearly as fast. the both implement the same interface or protocol or whatever you guys would call it, so it could be trivially updated to resolve that |
| 20:10 | danlentz | it uses dardoria/uuid which is an older lib |
| 20:11 | danlentz | not as meticulous or precise with regards to the minute detail or optimized in any way compatible to monk-key/unicly but otoh somewhat more forgiving and easier to pick up and start using. |
| 20:13 | danlentz | anyway my goal is to get some (hopefully significant) portion of their capability implemented for clojure. |
| 20:17 | akurilin | What's the DB record validation philosophy in Clojure? As in, I have the (perhaps bad?) habit of doing pre-emptive checking in the app layer for stuff like record uniqueness, etc as a way of generating helpful error messages. Now, the PG people tell me that it's wrong and I should just do whatever insertion I need to, and then interpret the SQL exception accordingly and use that for error reporting. |
| 20:17 | akurilin | The latter seems like a neater approach, but I'm wondering if anybody is actually doing it here. |
| 20:17 | danlentz | and after that maybe turn to have a whack at more serious optimization and performance matters. Compiler macro type facilities are not available for java/clojure as far as i can see so that may preclude some measures available in common-lisp |
| 20:29 | technomancy | akurilin: you can go overboard with logic in the DB, but enforcing record uniqueness there is very reasonable |
| 20:29 | repsca | I think david nolen made at post at one point where he implemented a protocol so that a regular expression could be called like a funtion |
| 20:29 | repsca | i can't find the post, so anyone know how I would go about doing it? |
| 20:30 | akurilin | technomancy, so would it be pretty idiomatic to wrap a DB insertion call with a try-catch and return the results "monadically" to the caller? |
| 20:30 | akurilin | technomancy, for a uniqueness scenario |
| 20:30 | akurilin | [results, error] kind of business |
| 20:31 | technomancy | akurilin: personally I wrap the whole request in a try/catch and turn it into a 4xx/5xx in one place |
| 20:31 | technomancy | https://github.com/technomancy/syme/blob/master/src/syme/web.clj#L112 |
| 20:31 | technomancy | ex-info is your friend here |
| 20:31 | technomancy | some people hate that |
| 20:32 | akurilin | technomancy, I have that as well for the cases where something slipped through my other checks. However if I want to report a very specific error like "this insertion failed because this field is not unique" then the umbrella catch might be too generic.l |
| 20:32 | technomancy | akurilin: right; in my example I don't make an effort to come up with better messages, but you could certainly add it |
| 20:33 | geoffeg | is there a simpler way to write this? '[(last loc) (first loc)] |
| 20:33 | technomancy | geoffeg: without the quoting? |
| 20:33 | technomancy | (juxt last first) |
| 20:33 | technomancy | ((juxt last first) loc) ; rather |
| 20:34 | geoffeg | ah, i had forgotten about juxt |
| 20:34 | technomancy | clojurebot: tell us about juxt |
| 20:34 | clojurebot | Excuse me? |
| 20:34 | technomancy | clojurebot: juxt? |
| 20:34 | clojurebot | if you think 'complement is great, wait till you see 'juxt |
| 20:35 | geoffeg | heh |
| 20:35 | geoffeg | technomancy: thanks |
| 20:35 | technomancy | np; always happy to talk about juxt |
| 20:36 | akurilin | technomancy, that's great, thanks. |
| 20:36 | mlb- | rasmusto: Is there a way to refer to a different directory than "resources"? I'd like to be able to uberjar my project without packaging unit test fixtures |
| 20:37 | technomancy | mlb-: dev-resources or test-resources |
| 20:37 | rasmusto | mlb-: this might be a use-case for a profile or somesuch ^ |
| 20:39 | mlb- | rasmusto, technomancy: Oh, very cool. That would allow me to change where resources addresses? Does "lein test" automatically choose a :test profile, if defined in the project.clj? |
| 20:40 | technomancy | mlb-: yeah basically |
| 20:40 | technomancy | dev-resources is available in the repl but not the uberjar; test-resources is only available when running `lein test` |
| 20:40 | technomancy | the latter which can be crappy when running tests in the repl, so I don't advise it |
| 20:41 | mlb- | Is that available due to leiningen magic, or is there a required form to be added to project.clj? |
| 20:41 | technomancy | mlb-: it's the default; you can make your own :test profile if you like |
| 20:45 | llasram | I like test-resources for adding a logging configuration which only prints ERROR+ |
| 21:35 | akurilin | Do Clojurians favor making a separate little function for each distinct sql query, on the DAL layer, or do they prefer to make something like one single SELECT function that internally uses korma/whatever to account for all possible permutations of parameter |
| 21:35 | akurilin | s |
| 21:36 | akurilin | it's kind of a complexity vs duplication tradeoff |
| 21:41 | danlentz | i really like clojur protocols |
| 21:41 | danlentz | it seems like they really outdid themselves with that concept |
| 21:43 | danlentz | makes java reasonably tolerable which imo is a remarkable achievement :) |
| 21:44 | oich | is enlive what I should look into for parsing xml with namespaces, or is there something else? |
| 21:45 | ddellacosta | akurilin: I have a macro that lets you generate common prepared queries by passing in specific where clauses and whatnot, and then I handle special cases…specially. |
| 21:45 | danlentz | combines the extensibility and dynamism of CL generic function approach with the structure and cohesion of java interfaces -- just fantastic |
| 21:45 | ddellacosta | akurilin: but I use clojure.java.jdbc so it's a bit different |
| 21:46 | akurilin | ddellacosta, so a bit of a hybrid approach, huh? |
| 21:47 | ddellacosta | akurilin: yeah…it works just fine and DRYs stuff up well enough, but honestly I still don't feel like I know The Right Way to do things. |
| 21:49 | alandipert | danlentz: i know, big fan also! clojurescript has them at the bottom and it's great |
| 22:03 | akurilin | Need a sanity check. Ring's cookie session store places a URL-encoded string in the cookies under ring-session key. When I call back into the ring app, I pretty much return the cookie as-is, since it decodes it on read. |
| 22:03 | akurilin | However ruby's rest-client insists on unescaping cookies before making a HTTP request |
| 22:04 | akurilin | I monkey-patched that behavior out, but it's just odd that it'd be hardcoded in there. |
| 22:05 | akurilin | Isn't the whole point of URL-escaping to make sure characters aren't lost as part of the request? Why decode the string? |
| 22:52 | ddellacosta | bitemyapp: ping |
| 22:52 | bitemyapp | ddellacosta: hai |
| 22:53 | ddellacosta | bitemyapp: howdy. question about blackwater. This is super weird, no? CompilerException java.lang.RuntimeException: No such var: time/in-millis, compiling:(black/water/jdbc.clj:18:20) |
| 22:54 | ddellacosta | bitemyapp: obviously it's something with my app, but I've added exclusions for clj-time on everything that showed up in lein deps :tree, so I'm a bit stumped |
| 22:54 | ddellacosta | bitemyapp: was just wondering if you had any ideas. :-/ |
| 22:56 | ddellacosta | bitemyapp: I even added a dependency on clj-time explicitly just now. Same annoying exception. |
| 23:16 | chare | hi |
| 23:16 | chare | so can i get unmuted on my other account |
| 23:19 | mtp | probably not |
| 23:22 | mtp | gfredericks is that like sync\nsync\nsync on ye olde unix |
| 23:23 | gfredericks | is it? I don't know what that does |
| 23:25 | mtp | well |
| 23:26 | mtp | back before they invented /sbin/shutdown |
| 23:26 | mtp | you had to take the unix to single user and kill it yourself |
| 23:27 | mtp | "sync" would flush the cache to disk, and the other two syncs were there to give the rest of the cache time to flush |
| 23:27 | mtp | or so goes the legend |
| 23:31 | xeqi | gfredericks: https://github.com/technomancy/leiningen/pull/688/files |
| 23:31 | ta479 | any FRP libraries in clojure? |
| 23:32 | ddellacosta | ta479: clojurescript, but: https://github.com/tailrecursion/javelin |
| 23:33 | gfredericks | mtp: ah no this was a heisenbug. It would come up about every 5 test runs. So I was saving some typing. |
| 23:33 | ta479 | there isn't one for regular clojure yet? |
| 23:34 | gfredericks | xeqi: that'd be cool |
| 23:34 | mercwithamouth | o_O |
| 23:34 | ddellacosta | ta479: also, https://github.com/weavejester/reagi |
| 23:34 | mtp | gfredericks i was mostly being silly :) |
| 23:35 | ddellacosta | ta479: I saw another CLJS one too but not finding it in my starred repos at the moment |
| 23:35 | gfredericks | xeqi: oh it got merged in and then removed? |
| 23:35 | gfredericks | also I don't understand amalloy's PR message |
| 23:37 | amalloy | gfredericks: well it's a joke PR, obviously, and i know technomancy hates it when people's blogs contain advice that you should run lein clean a few times just in case |
| 23:38 | xeqi | gfredericks: yep, joke |
| 23:38 | ddellacosta | ta479: one I just found poking around, more a demo than a lib: https://github.com/leonardoborges/frp-code |
| 23:39 | gfredericks | amalloy: oh I didn't think of it wrt clean in particular |
| 23:39 | gfredericks | ~repeatability |
| 23:39 | clojurebot | repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability |
| 23:39 | gfredericks | ^ taken at face value you'd think he'd be in favor of such a task :) |
| 23:39 | amalloy | hah |
| 23:41 | gfredericks | :aliases {:scrub ["do" "clean" "clean" "clean"]} |
| 23:41 | ddellacosta | the motherlode FRP post, verra nice: http://kevinoncode.blogspot.jp/2013/05/a-short-survey-on-state-of-functional.html |
| 23:51 | right1 | does anyone else have a problem with lein repl being much slower to start up on windows versus osx |
| 23:54 | geoffeg | today i discovered https://github.com/egamble/let-else thanks to a coworker. |
| 23:58 | Foxboron | right1: sadly, you just have to live with it :/ |
| 23:58 | Foxboron | right1: the JVM startup time is horrible on windows |
| 23:58 | right1 | :( |
| 23:58 | right1 | also, you want to see something funny with windows? |
| 23:59 | right1 | https://www.youtube.com/watch?v=0okmEqTKiDY |
| 23:59 | right1 | title: lein repl and japanese locale not playing nice |