2014-10-03
| 00:00 | handojin | now FUBAR |
| 00:00 | handojin | :( |
| 00:00 | justin_smith | that sucks |
| 00:00 | justin_smith | the sad thing about all this is often setting up cider is one of the first things people do when trying clojure - bad first impression when it goes that bad |
| 00:01 | TEttinger | I had similar issues with lighttable, none with nightcode |
| 00:01 | handojin | well - i've kind of invested some time in emacs so i want this relationship to work |
| 00:02 | handojin | :P |
| 00:02 | TEttinger | it's understandable :) |
| 00:02 | justin_smith | handojin: sounds like you and emacs need to spend some time with M-x eliza for some couples councelling :) |
| 00:02 | handojin | why do you say that? |
| 00:02 | justin_smith | sorry, bad pun about "wanting the relationship to work" |
| 00:03 | justin_smith | and I should have said M-x doctor |
| 00:03 | justin_smith | which runs the eliza algorithm |
| 00:03 | handojin | do you want to make the relationship work? |
| 00:03 | justin_smith | rofl |
| 00:03 | handojin | <- runs it too |
| 00:04 | handojin | ok, time to die |
| 00:07 | mdeboard | lighttable and nightcode? |
| 00:07 | mdeboard | huh |
| 00:07 | mdeboard | Cursive is pretty good, still has plenty of rough spots |
| 00:09 | TEttinger | nightcode is a lot smaller than, say, eclipse or IntelliJ, so there's less I need to worry about going wrong :) |
| 00:09 | TEttinger | and it's very closely integrated with lein, which is nice |
| 00:09 | mdeboard | intellij really, like, I am not an IDE person at all. emacs til i die, but intellij is really good |
| 00:10 | cfleming | (inc mdeboard) |
| 00:10 | lazybot | ⇒ 9 |
| 00:11 | handojin | prelude-update-packages & lein upgrade and I'm back in business |
| 00:13 | handojin | still on 0.7.0-snapshot though |
| 00:17 | cfleming | Is anyone here using piggieback? |
| 00:18 | mdeboard | yeah |
| 00:18 | mdeboard | well, not directly |
| 00:18 | mdeboard | but via figwheel |
| 00:18 | cfleming | Ok, do you know if there's a setting in project.clj that controls where it writes out generated js? |
| 00:18 | cfleming | Does it even write the generated js to disk? |
| 00:18 | mdeboard | there definitely is |
| 00:19 | mdeboard | i don't thin kit has to do with piggieback tho |
| 00:19 | cfleming | I can't find it in the doc anywhere or find an example. |
| 00:19 | mdeboard | sec |
| 00:20 | mdeboard | cfleming: https://gist.github.com/mattdeboard/744d597fa5d155d4d94f |
| 00:20 | mdeboard | ctrl-f :compiler |
| 00:20 | cfleming | So piggieback just uses the cljsbuild settings? |
| 00:20 | mdeboard | yeah I think so |
| 00:21 | cfleming | Someone told me they had generated js being written somewhere else. |
| 00:21 | mdeboard | but i have no idea for sure |
| 00:21 | cfleming | Ok, thanks. |
| 00:21 | mdeboard | i prob misunderstod your question on further reflectin |
| 00:22 | cfleming | No, I don't think so - piggieback has to generate js from the cljs it receives. I'm not sure if that gets written to disk or if it's just done in memory and sent over the wire. |
| 00:22 | cfleming | I assumed there would be a project.clj setting to control where that went. |
| 00:26 | arrdem | idle musing... would y'all think Grimoire's PR based contribution process is better or worse than clojuredocs? |
| 00:29 | cfleming | arrdem: I'd say it's pretty difficult to beat reading the docs, clicking a link and entering your example. |
| 00:30 | cfleming | arrdem: Having to clone grimoire, find the file, paste my example, check it, commit, push, create PR (I'm assuming that's more or less the process) is a pretty significant barrier IMO |
| 00:30 | cfleming | arrdem: It seems less API-friendly too. |
| 00:31 | arrdem | cfleming: it's a little better than that becuase I use GH's "new" URLs that let you fork and create a file for PRing all from the web |
| 00:31 | arrdem | cfleming: but it does take you somewhere else to submit a (trivial) PR |
| 00:31 | cfleming | arrdem: Ah, ok - that sounds better then. I must admit I haven't tried it |
| 00:32 | arrdem | showing source not examples by default is a mistake.. |
| 00:32 | cfleming | arrdem: I think that's ok. Are the results displayed right away or after some batch process? |
| 00:32 | arrdem | cfleming: there is no DB lookup here, it just stats directories. |
| 00:32 | cfleming | arrdem: And could you create an API to allow tools to provide "Upload example to Grimoire" functionality? |
| 00:33 | mdeboard | web scale |
| 00:33 | arrdem | cfleming: defeats the point of having the entire datastore in git IMO |
| 00:33 | arrdem | mdeboard: filesystems are indeed web scale |
| 00:33 | mdeboard | i wasn't being sarcastic |
| 00:33 | cfleming | arrdem: Ok, cool - so it's pushed right to the prod repo? That sounds ok then. |
| 00:33 | mdeboard | :P |
| 00:34 | cfleming | arrdem: I do like the idea of all the content being available in a git repo. |
| 00:35 | arrdem | cfleming: I hope that either this release or next I'll go beyond that and break it out into a standard package format that anyone can read/write/host |
| 00:35 | arrdem | but that's a lot of ... thinking to make a good spec |
| 00:35 | TEttinger | arrdem, needs more xml |
| 00:36 | arrdem | TEttinger: quiet in the peanut galery |
| 00:36 | TEttinger | I saw that! |
| 00:36 | TEttinger | it's so awful |
| 00:36 | arrdem | I would almost work for IBM because of their SPARK stuff. |
| 00:36 | arrdem | but shit like that is painful |
| 00:36 | cfleming | arrdem: That would be nice - I'll need something like that to show the Cursive API docs if I ever release it. |
| 00:37 | cfleming | Seriously |
| 00:37 | arrdem | I should write a Clojure datastructure to filesystem serializer/deserializer |
| 00:40 | mdeboard | what do you mean "to filesystem" |
| 00:40 | kristof | He means a data serialization format. |
| 00:41 | mdeboard | there's so many already |
| 00:41 | mdeboard | insert xkcd about competing standards |
| 00:41 | arrdem | mdeboard: a map becomes a folder with a file .type = "map\EOF" and then each file/folder is a key where the value is the data stored etc. |
| 00:42 | arrdem | mdeboard: the point is that it's a reasonable WYSIWYG and GIT managable structure, unlike say a JSON encoded blob of the same data |
| 00:42 | arrdem | or even an XML blob of the same data |
| 00:43 | mdeboard | oh |
| 00:43 | mdeboard | huh |
| 00:43 | mdeboard | that's interesting |
| 00:44 | arrdem | it's all just files maaaaaaaan |
| 00:44 | cfleming | And you've even partitioned your data - truly web scale! |
| 00:44 | arrdem | rofl |
| 00:45 | arrdem | https://github.com/grimradical/clj-semver |
| 00:45 | arrdem | proof that Clojure code can survive bit rot |
| 00:46 | arrdem | almost unchanged since 1.3 |
| 00:46 | cfleming | arrdem: Amazingly, that is actually something I need soon - thanks! |
| 00:47 | arrdem | cfleming: :D I was gonna just write one... then I read that one and it was perfect |
| 00:47 | cfleming | The irony of it being a snapshot release is not lost either |
| 00:47 | arrdem | yeah... the "eh it's a stable snapshot" thing seems pretty common |
| 00:47 | mdeboard | lol |
| 00:53 | mdeboard | arrdem: I feel like the serialization thing you mentioned would get unwieldy quick |
| 00:53 | arrdem | mdeboard: how so? |
| 00:54 | arrdem | mdeboard: you can totally slurp it into a DB if you want... the point is that it's a WYSIWYG intermediary store/exchange standard |
| 00:54 | sir_pinecone | hey guys, noobie here. Can anyone tell me if it's possible to pass around a namespace in some form and then call functions that are in that namespace? here's a silly example of what I want to do https://gist.github.com/anonymous/84649fdd3dfcfbb215be |
| 00:55 | mdeboard | you'd hav eto do some really start structure sharing or it'd get nuts |
| 00:55 | mdeboard | at some point it'd just coalesce into an inverted index or something |
| 00:55 | mdeboard | odds are basically 1:1 I'm talking out of my ass |
| 00:55 | arrdem | mdeboard: meh depends on the structure you're working with. for what I have in mind I'm doing it already and it works out OK |
| 00:56 | arrdem | but I really just have a DB in a FS, not an arbitrary datastructure |
| 00:57 | mdeboard | yeah i'm down with the idea in general |
| 00:57 | mdeboard | i've fantasiezd about replacing mongodb with flat files |
| 00:57 | mdeboard | but who has the time |
| 00:57 | arrdem | lol |
| 00:58 | arrdem | https://github.com/ibdknox/simpledb |
| 00:58 | mdeboard | pretty much every uh |
| 00:58 | arrdem | please don't actually use that for anything |
| 00:58 | arrdem | but I have |
| 00:58 | mdeboard | person i've talked to ince moiving here has the same "i used mongodb " horror tostry |
| 00:58 | mdeboard | Wow |
| 00:58 | mdeboard | Nice typing |
| 00:58 | arrdem | works juuuuust fine when you really just need a temporary "dev" datastore |
| 00:58 | mdeboard | horror story* |
| 00:59 | cfleming | sir_pinecone: No, you can't do that - namespaces are not first-class objects you can pass around |
| 01:00 | sir_pinecone | cfleming: ok, thank you |
| 01:00 | arrdem | simpledb would actually work really well for another project I have in mind... |
| 01:00 | mdeboard | just no |
| 01:00 | mdeboard | lol |
| 01:00 | mdeboard | postgres all day |
| 01:00 | arrdem | datastores are all too much work |
| 01:01 | mdeboard | pfft |
| 01:01 | mdeboard | so easy nowadays |
| 01:03 | dbasch | Someone should create RRDB: Russian Roulette DB |
| 01:04 | mdeboard | they did, it's called "MongoDB under network partition" |
| 01:04 | arrdem | dbasch: 1/6 chance to not actually persist your data? |
| 01:04 | dbasch | I was thinking more like 1e-6 every second |
| 01:04 | mdeboard | also pretty sure what's his face's Jepsen series of blog posts show they're all RRDBs |
| 01:04 | dbasch | yes, I mean on purpose. Make it a feature. |
| 01:05 | mdeboard | lol |
| 01:05 | joshuafcole | market it as a "Probabilistic Data Store" |
| 01:05 | mdeboard | I ... think that is a thing already |
| 01:05 | joshuafcole | it'll be all the rage in the big data secor |
| 01:05 | joshuafcole | sector* |
| 01:05 | dbasch | It’s like the idea I had back in the day when China’s population was growing out of control: randomly exploding cars with adaptive probability |
| 01:05 | arrdem | lolwut |
| 01:06 | metellus | RRDB solves cache invalidation |
| 01:06 | joshuafcole | on average, anyway |
| 01:06 | arrdem | metellus: but only for problems where serving old data is OK |
| 01:06 | dbasch | RRDB is good for startups, because they have greater risks already |
| 01:06 | arrdem | metellus: turns out not to work for CPU caches |
| 01:07 | metellus | darn |
| 01:07 | joshuafcole | although |
| 01:07 | joshuafcole | if you combine it with probabilistic registers |
| 01:07 | joshuafcole | you probably couldn't tell the difference |
| 01:07 | arrdem | joshuafcole: now you have a machine that's worthless. actually. |
| 01:07 | joshuafcole | RRReg |
| 01:07 | joshuafcole | Nah, see |
| 01:07 | joshuafcole | because you hook it up to another, regular computer |
| 01:08 | joshuafcole | and that regular computer in turn |
| 01:08 | joshuafcole | checks all of it's computations the normal way, however long that takes |
| 01:08 | joshuafcole | and if it detects an incorrect answer |
| 01:08 | joshuafcole | it detonates the nuclear warhead it's connected to |
| 01:08 | joshuafcole | Then, using quantum immortality, you're golden |
| 01:08 | joshuafcole | hell, you can even implement all of your ops as single cycle randoms |
| 01:09 | mdeboard | well |
| 01:09 | arrdem | joshuafcole: you have to destroy the universe. a simple nuke won't do ot |
| 01:09 | arrdem | *it |
| 01:09 | mdeboard | according to quantum physics there's a non-zero probability it's already happened |
| 01:09 | joshuafcole | arrdem: No? I thought quantum immortality applied individually |
| 01:09 | joshuafcole | so so long as you sat next to the machine |
| 01:09 | joshuafcole | for however long it would take |
| 01:09 | joshuafcole | for *your* universe, call it U', the machines output should always be valid right? |
| 01:10 | arrdem | pretty sure in this universe you can in fact nuke yourself |
| 01:10 | joshuafcole | however, for people outside the blast radius it probably wouldn't work very well |
| 01:10 | joshuafcole | I'd try it to prove you wrong if quantum immortality didn't seem like obvious quackery. |
| 01:10 | joshuafcole | :P |
| 01:11 | joshuafcole | U_1: "Hah arrdem: I told you so!" "What are you talking about?" |
| 01:11 | joshuafcole | U_2: "In other news, San Francisco detonated in a completely out of the blue nuclear explosion this morning..." |
| 01:11 | mdeboard | this is a #emacs quality conversation |
| 01:12 | arrdem | lol mdeboard |
| 01:12 | joshuafcole | M-x rely-on-quantum-immortality really improves startup times |
| 01:12 | mdeboard | to be fair #emacs is my favorite channel |
| 01:12 | joshuafcole | (inc mdeboard) |
| 01:12 | lazybot | ⇒ 10 |
| 01:13 | arrdem | someone give me a schema for a documentation datastore that houses symbols, namespaces and classes |
| 01:13 | arrdem | I've got a bunch of ideas but none of them seem sane |
| 01:18 | joshuafcole | arddem: namespace = db (nestable) classes = collections (+ a global collection for stuff outside classes), symbols = rows? |
| 01:19 | joshuafcole | the real trick is making it import from existing sources just as javadocs |
| 01:19 | mdeboard | Hold-My-Beer-driven development |
| 01:20 | arrdem | hey i'll take M-x hold-my-beer RET HACKING over M-x ponder RET heat-death RET |
| 01:21 | arrdem | is there a javadocs engine for Clojure...? |
| 01:21 | joshuafcole | hard to argue with that |
| 01:22 | arrdem | https://github.com/clojure/clojure/blob/master/src/clj/clojure/java/javadoc.clj |
| 01:22 | arrdem | why is this shit in core... |
| 01:22 | joshuafcole | with hardcoded urls and subdomains |
| 01:23 | joshuafcole | I like it |
| 01:23 | mdeboard | futureproof |
| 01:23 | arrdem | one of these days I'm gonna have a beer |
| 01:23 | arrdem | and fork Clojure |
| 01:23 | mdeboard | that's a good project name |
| 01:23 | arrdem | mdeboard: rofl |
| 01:23 | dbasch | &(clojure.java.javadoc/javadoc "wtf") |
| 01:23 | lazybot | java.lang.ClassNotFoundException: clojure.java.javadoc |
| 01:24 | arrdem | &(require 'clojure.java.javadoc) |
| 01:24 | lazybot | java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.specification.version" "read") |
| 01:25 | dbasch | I want to add transmorphers to clojure |
| 01:25 | arrdem | http://www.imdb.com/title/tt0960835/ |
| 01:26 | arrdem | dbasch: you only get to do that if you're rhicky |
| 01:26 | mdeboard | transmorphers? LOL |
| 01:26 | mdeboard | I'm working on a teledildonics library |
| 01:26 | mdeboard | based on some really advanced research |
| 01:26 | joshuafcole | while we're adding transformers, can we please get dinobot into core? |
| 01:26 | mdeboard | GRIMLOCK SMASH |
| 01:27 | arrdem | I would get a beer |
| 01:27 | arrdem | and late-night #clojure with yall |
| 01:27 | arrdem | but I have class in the morning |
| 01:27 | arrdem | T_T |
| 01:27 | joshuafcole | heh |
| 01:27 | mdeboard | my cat has a vet appointment, so |
| 01:27 | joshuafcole | well, goodnight all |
| 01:28 | joshuafcole | maybe now I'll get some code written. :) |
| 01:46 | a13x | is there a way to make `lein run` exit after a standalone app ends? thanks |
| 01:47 | jeremyheiler | a13x: what's keeping it alive? |
| 01:48 | arrdem | a13x: add (shutdown-agents) to the end of your -main? |
| 01:48 | a13x | jeremyheiler: I'm not really sure... in -main I do have a println that is reached but then the JVM continues to run |
| 01:49 | dbasch | a13x: do you have any other threads running? What if you explicitly add a System/exit after the println? |
| 01:49 | a13x | arrdem: I see no changes with shutdown-agents |
| 01:51 | arrdem | I should torrent iron sky one of these days... |
| 01:51 | arrdem | thinking of bad movies |
| 01:52 | a13x | System/exit works... but I'd like to understand why the app continues to run |
| 01:52 | jeremyheiler | are you using futures, agents, threads? |
| 01:53 | dbasch | a13x: any code you can share (via refheap / gist / pastebin)? |
| 01:53 | dbasch | you may be using a library that launches its own threads |
| 01:54 | mdeboard | cutting edge teledildonic technology |
| 01:54 | a13x | http://pastebin.com/2D8h96Mb |
| 01:55 | a13x | dbasch that's what I'm starting to suspect... I'm using twitter-api lib that makes http calls, but that should really spawn non daemon threads |
| 01:56 | jeremyheiler | a13x: as a side note, you're not invoking the destroy function |
| 01:57 | a13x | jeremyheiler right (still that's not the cause :) |
| 01:58 | jeremyheiler | i know |
| 02:01 | a13x | ok... I see more threads that I expected, so I guess twitter-api lib is spawning |
| 02:02 | dysfun | is there a leiningen plugin for running ant tasks? |
| 02:03 | arrdem | $google lein ant |
| 02:03 | lazybot | [Leiningen Versus the Ants - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Leiningen_Versus_the_Ants |
| 02:03 | dysfun | i did |
| 02:03 | dysfun | i get a lot of that, even if i put 'clojure' in |
| 02:03 | dysfun | it's all very clever and everything, but it's not helpful :( |
| 02:04 | a13x | found it https://github.com/adamwynne/twitter-api/issues/6 |
| 02:05 | dbasch | dysfun: leiningen is a build tool that pretty much everyone here uses, because it’s the most convenient way to manage dependencies |
| 02:06 | dbasch | I’d say it’s probably one of the main drivers behind clojure’s adoption at this point |
| 02:06 | dysfun | yes, i understand lein is brilliant, but i also want to build something java that's only buildable with ant |
| 02:06 | dysfun | (javafx) |
| 02:06 | dbasch | oh, I misunderstood your question |
| 02:07 | a13x | I was looking earlier today for something similar... a way to run custom build steps |
| 02:08 | a13x | I really like lein's automation, but if there's something custom it looks like the only way to go is to create your own plugin |
| 02:09 | a13x | in my case what triggered this was that I wanted to test a webapp on GAE; lein ring uberwar includes the jetty libs and these are conflicting with GAE's version, so I wanted to clean those up |
| 02:09 | dysfun | you can exclude them in your deps |
| 02:11 | dysfun | https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L48 |
| 02:16 | a13x | thanks dysfun. I'll try that once I get back to that |
| 02:34 | gtmacdonald | Hi Everyone! So I was curious, you know how you have to do (shutdown-agents) for the agent thread pool? Does anyone know why that's not necessary for core.async threads? Specifically if you do a (thread (while true ...)). |
| 03:36 | crocket | Is clojure suitable for running a CMS? |
| 03:37 | crocket | It runs on JVM which might not be a suitable execution environment for a CMS. |
| 03:37 | arrdem | lolwut |
| 03:37 | crocket | CMS means content management system like wordpress. |
| 03:37 | crocket | I think nodejs is a better execution environment for a CMS. |
| 03:38 | crocket | maybe not |
| 03:54 | avishai | hi all |
| 03:55 | avishai | i have a problem with midje prerequisites |
| 03:55 | avishai | i get java.lang.ClassCastException: clojure.lang.AFunction$1 cannot be cast to clojure.lang.IFn$OLO |
| 03:55 | avishai | when trying to stub a function with type hinting |
| 04:00 | crocket | Does clojure come with sane exceptions? |
| 04:01 | crocket | Java exceptions drive you insane. |
| 04:01 | arrdem | fuck off chare |
| 04:04 | domokato | does creating a transient do anything for me if I'm only performing one mutation? |
| 04:05 | arrdem | domokato: no |
| 04:05 | domokato | kthx |
| 04:05 | arrdem | s/no/almost certainly not, benchmark it yourself/g |
| 04:06 | domokato | just trying to understand what they're for |
| 04:06 | domokato | i think i get it now |
| 04:11 | domokato | man, in order to eliminate allocations in my render loop, i had to switch to using java ArrayLists. Everything was creating seqs, even "empty?", and doseq |
| 04:12 | domokato | i had to start using .isEmpty and i wrote a "foreach" macro with similar syntax to doseq but operates on java Lists |
| 04:12 | domokato | and had to use the primitive-math lib to prevent boxing |
| 04:15 | pepijndevos | domokato, sounds like fun |
| 04:16 | borkdude | good morning |
| 04:16 | domokato | pepijndevos: actually kinda was. learned a lot about the implementation of clojure in the process. so many allocations everywhere tho... |
| 04:17 | domokato | it would be nice if the compiler was smart enough to remove unnecessary allocations if the invocation doesn't need them |
| 04:18 | arrdem | the JVM has no way to express that concept. |
| 04:18 | arrdem | unless you manually implement instance recycling somehow |
| 04:20 | domokato | yeah, i think that would work too. object pools maybe |
| 04:20 | arrdem | why. most JVMs will do generationed (memory pooled) GC anyway |
| 04:21 | domokato | what does that mean? |
| 04:22 | arrdem | JVM JITs can and will trace the lifetime of a given allocation point, and will use different pools of different sizes for objects with different lifetimes. |
| 04:22 | arrdem | so short lived allocations will go in one frequently collected pool, intermediary and long lived objects get their own pools |
| 04:22 | arrdem | ultra-short term objects may be optimized out altogether depending on the JIT. |
| 04:23 | domokato | hm, but the GC still has to pause the process and run occassionally? |
| 04:23 | arrdem | sure, but that's relatively cheap and you're amortizing it by minimizing the scope over which it needs to run |
| 04:25 | kyrre | How can I declare that a method returns ArrayList<String> ? (gen-class) |
| 04:25 | domokato | not so cheap if it causes stuttering in a skill-based game |
| 04:26 | arrdem | kyrre: Generics don't actually exist at the JVM level. The type templating is a feature of the Java language, and is not reflected in the bytecode. This is for backwards compat. |
| 04:26 | domokato | but maybe if i limit the frame rate the gc will be smart enough to run when all the threads are asleep |
| 04:26 | arrdem | kyrre: consequently you aren't really -> ArrayList<String>, you're -> ArrayList |
| 04:27 | arrdem | kyrre: that's what ArrayList<String> becomes if you write it in Java anyway |
| 04:28 | kyrre | mhm, that makes sense |
| 04:31 | domokato | anyway, thanks for the discussion. gnite |
| 04:42 | domokato | hm, looks like dalvik (android) uses mark and sweep anyway |
| 04:47 | domokato | ooo, except ART (upcoming android JVM) looks like it uses concurrent gc. should help |
| 04:52 | mercwithamouth | hmm so what should be my expectations of SICP? What do you all get out of this book? |
| 04:55 | arrdem | totally depends on you. It's a solid introduction to scheme... shows off some of what can be done with macros for language extensions... delves into the metacircular evaluator and hints at what a lisp CPU would look like |
| 04:56 | mercwithamouth | ok, fair enough |
| 04:56 | arrdem | the more you work the examples and toy with them the more you'll understand it... I never ran a single example and it took me several rereadings of each chapter to really grock what was going on |
| 04:56 | mercwithamouth | that's about where i am =P |
| 04:57 | arrdem | =P in fairness SCIP was my breakfast time reading for a semester... |
| 04:58 | mercwithamouth | ahh gotcha. i'm trying to decide if it's a book that i really should sit down with and go through religiously. i'm wondering how much of a better developer it'll make me |
| 04:58 | arrdem | if you arlready grock FP I wouldn't expect to get much out of it |
| 04:58 | mercwithamouth | no i'm fairly new |
| 04:58 | arrdem | it really is like a freshman/sophomore level CS textbook in scheme by The Scheme Guyts |
| 04:58 | arrdem | *Guys |
| 04:59 | mercwithamouth | gotcha. i'll work through it over time then |
| 04:59 | arrdem | $seen rubygeek |
| 04:59 | lazybot | rubygeek was last seen quitting 17 hours and 6 minutes ago. |
| 04:59 | mercwithamouth | ^ learn something new every day |
| 04:59 | arrdem | ^^ he has my SCIP copy :P |
| 04:59 | mercwithamouth | lol |
| 05:11 | amalloy | arrdem: it's grok, by the way, no C. you should read stranger in a strange land - it's a classic |
| 05:32 | hyPiRion | bbloom_: no, I didn't find anything obvious sadly |
| 06:02 | borkdude | awesome: https://github.com/wit-ai/duckling |
| 06:13 | borkdude | vijaykiran I just registered #clojure.nl |
| 06:19 | vijaykiran | borkdude: ? channel ? |
| 06:20 | borkdude | vijaykiran yes, channel |
| 06:27 | borkdude | cfleming it would be nice to have an overview of what is possible in cursive and not in other editors (like counter clockwise, emacs). do you think this will exist at some point? |
| 06:28 | cfleming | borkdude: Yes, probably. I'm going to be speaking about Cursive at the conj, and I'll mostly be talking about what differentiates Cursive from the other editors, since they mostly work in the same way (i.e. are REPL based) |
| 06:28 | borkdude | :-D |
| 06:28 | borkdude | cfleming will the conj videos be available for streaming? |
| 06:29 | cfleming | borkdude: I assume so, they usually are. |
| 06:29 | borkdude | kewl |
| 06:51 | vijaykiran | borkdude: :) cool - I guess I need to brush-up on dutch then |
| 06:56 | dysfun | is there a way to instantiate a lein repl in my code? apparently javafx is quite pernickety about what thread stuff runs on, so i'd like to run the lein repl on another thread |
| 07:00 | borkdude | dysfun maybe look at jvm break glass |
| 07:00 | borkdude | dysfun for inspiration |
| 07:01 | dysfun | hrm, interesting |
| 07:10 | cfleming | dysfun: You want to start a REPL server? Sure, the nREPL page has details on how to do that. |
| 07:28 | dysfun | oh brilliant, thanks |
| 08:00 | justin_smith | arrdem: re: your exchange with domokato - lifetime-aware gc may be cheap, but with real time constraints like a framerate nothing beats cache locality, which means primitive arrays (I am well aware you will only see this much later in scrollback when you wake up) |
| 08:29 | borkdude | cfleming when typing a docstring with a function, can I indent the "paragraph" to keep within 80 cols, like in emacs? |
| 08:29 | cfleming | borkdude: No, there's nothing like that right now sorry. IntelliJ has a "Fill paragraph" but it never works for me. |
| 08:58 | borkdude | cfleming I would like to attach a debugger to lein test, is that possible with cursive? |
| 09:02 | justin_smith | borkdude: you can load a namespace and run its tests in a normal repl - deftest creates a function of no arguments that you can call |
| 09:02 | borkdude | justin_smith I know |
| 09:02 | justin_smith | and of course there is clojure.test/run-tests for proper running of all tests in an ns with their fixtures |
| 09:02 | justin_smith | OK |
| 09:06 | borkdude | I think with a "leiningen" run configuration it could work |
| 09:51 | borkdude | cfleming another feature: when cursor is on fully qualified symbol, offer to add a require + refer |
| 10:19 | chitofan | has anybody used clojure for developing embedded software? |
| 10:24 | lavokad | :vs |
| 10:25 | Illusioneer | Is anybody familiar with nginx-clojure? |
| 10:28 | justin_smith | Illusioneer: it's weird, just use nginx as a reverse proxy |
| 10:29 | justin_smith | maybe try it if you find that per-request-overhead is your bottleneck. It probably won't be though. |
| 10:30 | Illusioneer | justin_smith: not even gotten nearly that far but is that an issue with it? |
| 10:30 | justin_smith | the improvement you would hypothetically get is less overhead per request since it is not proxying but clojure is in process |
| 10:31 | justin_smith | in return, deployment is more complex |
| 10:31 | tvanhens | is there a way to do a reduce and? |
| 10:31 | justin_smith | easier to make an uberjar, run it, and reverse proxy |
| 10:31 | Illusioneer | more complex? Id have thought that would simplify it |
| 10:31 | justin_smith | deploying clojure is really easy |
| 10:32 | tvanhens | I have a list of predicates and I want to check if they are all true. I can think of ways to do that but I feel like there has to be a quick and easy way to do that |
| 10:32 | justin_smith | ,(every? even [0 2 4 6]) |
| 10:32 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: even in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 10:32 | justin_smith | ,(every? even? [0 2 4 6]) |
| 10:32 | clojurebot | true |
| 10:33 | tvanhens | every thats what I was looking for thanks |
| 10:36 | edw | `mapcat` is very nice, but so is `for`; how do folks deal with situations where you want to flatten the results of a `for` form but don't want an ugly `->>` form or a surrounding `(apply concat ... )`? |
| 10:37 | gfredericks | edw: for can flatten further with another clause |
| 10:37 | gfredericks | for is flatteningest |
| 10:39 | gfredericks | ,(for [x (range 5) y (range x)] [x y]) |
| 10:39 | clojurebot | ([1 0] [2 0] [2 1] [3 0] [3 1] ...) |
| 10:39 | mdeboard | ->> is gorgeous tbh |
| 10:39 | mdeboard | you're missing out |
| 10:40 | mdeboard | i miss threadng macros in all the work I do |
| 10:41 | legittalon | wait. ->> is different from ->? |
| 10:41 | mdeboard | yes |
| 10:42 | mdeboard | &(-> 1 (+ 2)) |
| 10:42 | lazybot | ⇒ 3 |
| 10:42 | mdeboard | &(-> 1 (- 2)) |
| 10:42 | lazybot | ⇒ -1 |
| 10:42 | mdeboard | &(->> 1 (- 2)) |
| 10:42 | lazybot | ⇒ 1 |
| 10:43 | legittalon | &(->> (-2) 1) |
| 10:43 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn |
| 10:43 | gfredericks | &(-2) |
| 10:43 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn |
| 10:43 | legittalon | I'm such a noob. |
| 10:44 | justin_smith | legittalon: pretty much everything is a valid constituent of a symbol in clojure, so use whitespace to separate functions from arguments |
| 10:45 | justin_smith | ,(let [<-? 2 *_' 3] (+ <-? (* <-? *_'))) |
| 10:45 | clojurebot | 8 |
| 10:46 | razum2um | is there any way to make it more concise https://gist.github.com/razum2um/dc78032ef76778ac6a38 ? |
| 10:47 | justin_smith | by shortening the function name? :) |
| 10:47 | Bronsa | razum2um: (zipmap (map (partial apply f) xs) xs) |
| 10:47 | razum2um | Bronsa: thx |
| 10:47 | mdeboard | transducers |
| 10:47 | mdeboard | I think |
| 10:47 | Bronsa | mdeboard: uh? how would they help? |
| 10:48 | mdeboard | I have no idea |
| 10:48 | mdeboard | I just wanted to sound smart, I guess it backfired |
| 10:48 | justin_smith | (into {} (map (juxt #(apply f %) identity) xs)) |
| 10:49 | justin_smith | err, swap the order on the identity and the #() of course |
| 10:49 | mdeboard | &(doc zipmap) |
| 10:49 | lazybot | ⇒ "([keys vals]); Returns a map with the keys mapped to the corresponding vals." |
| 10:50 | mdeboard | what's the diff between (partial apply f) and #(apply f %) |
| 10:50 | mdeboard | there |
| 10:50 | justin_smith | the zipmap version has to walk the input twice (not a huge deal of course, but always feels a bit less than ideal) |
| 10:50 | mdeboard | Bronsa: |
| 10:50 | Bronsa | mdeboard: none |
| 10:50 | justin_smith | partial creates a varargs fn, #() does not |
| 10:50 | justin_smith | it's a small difference |
| 10:50 | Bronsa | justin_smith: your version too, once for map, the second time for into |
| 10:50 | justin_smith | ahh, you are right :) |
| 10:50 | gfredericks | #() creates another damn class, partial does not |
| 10:51 | mdeboard | huh |
| 10:51 | mdeboard | today I learned, interesting |
| 10:51 | mdeboard | why is that bad |
| 10:51 | mdeboard | I'm sure that's a dumb question but.. |
| 10:51 | gfredericks | it might not be :) |
| 10:51 | gfredericks | it makes stack traces easier actually |
| 10:51 | mdeboard | oh |
| 10:51 | mdeboard | you damned the notion of creating another class |
| 10:52 | mdeboard | I figured it was objectively bad |
| 10:52 | Bronsa | he was just being overly dramatic |
| 10:52 | gfredericks | the communication method language is the difficulty level hard |
| 10:52 | mdeboard | wat |
| 10:52 | mdeboard | did I have a stroke |
| 10:52 | justin_smith | (persistent! (reduce (fn [m v] (assoc! m v (apply f v))) (trainsent {}) xs)) |
| 10:53 | edw | mdeboard: I have nothing against threading; I love it. But a two element threading form is ugly IMO. |
| 10:53 | mdeboard | edw: fair |
| 10:53 | edw | gfredericks: Ah, good point. |
| 10:54 | justin_smith | my last is no longer more concise, but it only walks the input once |
| 10:54 | Bronsa | ,(defn trainsent [coll] (println "chuff")) |
| 10:54 | clojurebot | #'sandbox/trainsent |
| 10:54 | justin_smith | heh |
| 10:54 | mdeboard | lol |
| 10:54 | justin_smith | good catch on the typo, I need my coffee |
| 10:54 | justin_smith | (inc Bronsa) |
| 10:54 | lazybot | ⇒ 51 |
| 10:54 | mdeboard | &(doc trainsent?) |
| 10:54 | lazybot | java.lang.RuntimeException: Unable to resolve var: trainsent? in this context |
| 10:55 | justin_smith | the train sent my coffee that I have not yet consumed. Thanks Thomas! |
| 10:55 | Bronsa | justin_smith: I use that idiom all the time for building maps, I don't think there's a faster way to do it |
| 10:56 | mdeboard | which idiom is that |
| 10:56 | mdeboard | justin_smith's original? |
| 10:56 | mdeboard | or the trainsent gambit |
| 10:56 | Bronsa | reduce+assoc! w/ (transient {}) as init |
| 10:56 | mdeboard | ah |
| 10:56 | justin_smith | transient transient transient (too much more of that typo and it will become infections) |
| 10:57 | mdeboard | I love it |
| 10:57 | mdeboard | It almost sounds like a technical term |
| 10:57 | mdeboard | The trainsent pattern |
| 10:57 | justin_smith | heh |
| 10:58 | mdeboard | I'll give up the ghost, though. |
| 10:58 | mdeboard | I'm just stalling before I have to dive into work |
| 10:58 | justin_smith | mock all you want, I just have to make sure I don't imprint mentally on the misspelling :) |
| 10:58 | gfredericks | justin_smith: Bronsa: that's plumbing.core/map-from-keys I think |
| 10:59 | Bronsa | dunno, I don't get to use any utils library because of contribs :< |
| 10:59 | gfredericks | oh noes |
| 10:59 | justin_smith | gfredericks: looks like it |
| 10:59 | gfredericks | Bronsa: just rhickey's util library (clojure.core) |
| 10:59 | justin_smith | gfredericks: adding plumbing to my "util libraries" category |
| 11:00 | Bronsa | gfredericks: heh yeah |
| 11:00 | justin_smith | soon we will need a "all the utils" meta lib |
| 11:00 | gfredericks | justin_smith: it's the one I settled on |
| 11:00 | gfredericks | the included graph stuff is pretty useful for certain things too |
| 11:01 | justin_smith | looking at that now |
| 11:01 | justin_smith | http://blog.getprismatic.com/prismatics-graph-at-strange-loop/ |
| 11:01 | Bronsa | https://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.cljx#L35-L39 this is kinda ugly |
| 11:01 | justin_smith | woah |
| 11:02 | justin_smith | yeah I take back that "it's basically the same" |
| 11:02 | Bronsa | I guess they had to do it that way to avoid rewriting the for/doseq syntax |
| 11:02 | Bronsa | (:let/:when etc) |
| 11:03 | gfredericks | ah right I bet that was the point |
| 11:04 | justin_smith | could have used an array of length one instead of an atom |
| 11:05 | justin_smith | whether that's better or worse... |
| 11:05 | gfredericks | would be interesting to compare the speed |
| 11:05 | gfredericks | I can't think of any downside; they're just using reset! anyhow |
| 11:05 | Bronsa | one 1.7 is out we get volatiles for that |
| 11:05 | justin_smith | not any different semantics wise |
| 11:06 | justin_smith | and it's in a safe lexical env anyway |
| 11:06 | justin_smith | Bronsa: yeah, exactly |
| 11:06 | gfredericks | the entire use case for volatiles is such local enhancements? |
| 11:06 | justin_smith | hell, the let bindings inside the doseq could safely be one element arrays / volatiles defined outside the doseq |
| 11:07 | Bronsa | gfredericks: yes |
| 11:07 | gfredericks | like transients but for reference types? |
| 11:07 | zot | newb question: i have a set of keys, and want to gen a map with same keys, but vals as result of function taking the key as input. is there an idiomatic way to do this? so far i didn't see it in the set api, but some of the lingo there is confusing to me still... |
| 11:07 | Bronsa | gfredericks: they were introduced to replace atoms for the mutable state inside transducers |
| 11:07 | Bronsa | http://dev.clojure.org/jira/browse/CLJ-1512 |
| 11:07 | gfredericks | Bronsa: yeah I know how they came up; just trying to figure out what else they might be used for |
| 11:08 | Bronsa | and I will keep complaining till the end of days about vswap! being a macro. |
| 11:08 | gfredericks | why? |
| 11:08 | clojurebot | because that's not how macros work |
| 11:08 | gfredericks | O_O |
| 11:08 | gfredericks | clojurebot: you are eerie |
| 11:08 | clojurebot | No entiendo |
| 11:08 | justin_smith | zot: seems like a job for reduce-kv |
| 11:08 | justin_smith | (doc reduce-kv) |
| 11:08 | clojurebot | "([f init coll]); Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, the first key and the first value in coll, then applying f to that result and the 2nd key and value, etc. If coll contains no entries, returns init and f is not called. Note that reduce-kv is supported on vectors, where the keys will be the ordinals." |
| 11:08 | zot | that sounds like exactly what i would want! |
| 11:09 | zot | justin_smith: tnx :) |
| 11:09 | gfredericks | zot: justin_smith: what? I thought this was just map-from-keys as described above? |
| 11:09 | Bronsa | gfredericks: because there is no good reason why it couldn't be a function |
| 11:09 | gfredericks | Bronsa: oh with :inline stuff? |
| 11:09 | Bronsa | yes |
| 11:09 | tim___ | Bronsa, well it could have :inline, but that stuff is pretty buggy apparently. |
| 11:10 | Bronsa | tbaldridge: no it isn't |
| 11:10 | zot | hrm. yes as i read ths descr (came after typing) i think it's not quite it |
| 11:10 | gfredericks | Bronsa: probably you're a weirdo if you need it to be a function :P |
| 11:10 | zot | i mean, i can use assoc as the top level of the inner func, but i wonder if there's something tighter |
| 11:10 | gfredericks | zot: there was code given above for map-from-keys, which is in plumbing if you like util libs |
| 11:10 | tbaldridge | Bronsa: http://dev.clojure.org/jira/browse/CLJ-1227 ? |
| 11:11 | Bronsa | tbaldridge: the "bug" was on definline, but it turned out it wasn't related to the :inline part at all, it was a bug on the fn munging |
| 11:11 | justin_smith | ,(reduce-kv (fn [m k v] (assoc m k (inc v))) {} {:a 0 :b 1 :c 2}) ; zot |
| 11:11 | clojurebot | {:a 1, :b 2, :c 3} |
| 11:12 | Bronsa | tbaldridge: even if the bug was in definline, that would have only affected definlines, manual :inline was never broken |
| 11:12 | justin_smith | or you could map over it and use what we were talking about above |
| 11:12 | Bronsa | tbaldridge: if you scroll at the end of that ticket there's the fn munging ticket linked that solves it btw |
| 11:12 | justin_smith | zot: oh, never mind, misread your question - you don't have a map coming in, just the keys |
| 11:13 | justin_smith | zot: which means gfredericks was right, it's exactly the function we were just talking about at length |
| 11:13 | zot | yeah, it's an actual set (or could be a list/vector, but currently a set) |
| 11:13 | tbaldridge | Bronsa: from what I understand, :inline would be superseded by this: http://dev.clojure.org/display/design/Inlined+code |
| 11:13 | Bronsa | tbaldridge: right, but that doesn't exist yet :) |
| 11:13 | tbaldridge | Bronsa: just saying, I could imagine it changing to a function at some point. |
| 11:14 | justin_smith | zot: (persistent! (reduce (fn [m v] (assoc! m v (apply f v))) (transient {}) xs)) |
| 11:14 | justin_smith | f and xs are your function and your set |
| 11:14 | Bronsa | tbaldridge: sure, I'd like it if you were right |
| 11:17 | zot | justin_smith/gfredericks: tnx :) |
| 11:20 | squidz | does anybody know a good way to shift an entry in a collection left or right like (shift coll el :left) |
| 11:21 | modulus | when i use lein repl from outside a project directory under windows it refuses to recognise []s - inside a project it does. this is really really really strange. |
| 11:22 | modulus | any idea how to fix? |
| 11:22 | justin_smith | it won't recognize literal vectors? |
| 11:22 | modulus | it won't recognise the character |
| 11:22 | squidz | like (shift [{:id 0} {:id 1} {:id 2}] 1 :right) >>> [{:id 0} {:id 2} {:id 1}] |
| 11:22 | modulus | it refuses to register it |
| 11:24 | squidz | or (shift [{:id 0} {:id 1} {:id 2}] 1 :left) >>> [{:id 1} {:id 0} {:id 2}] |
| 11:24 | gfredericks | modulus: so if you type (first [1 2 3]) into your repl, what happens? |
| 11:25 | modulus | it interprets it as (first 2 3) |
| 11:25 | modulus | the []s don't appear on the text and it doesn't capture the character right after the [ |
| 11:25 | modulus | so wrong arity |
| 11:26 | modulus | this is seriously super-weird, never happened before |
| 11:26 | gfredericks | I feel like nothing I know about clojure is remotely related to this problem |
| 11:27 | modulus | what's really strange is that it will correctly read when inside a project |
| 11:27 | modulus | hmm let me think, maybe it's running a different version of clojure |
| 11:27 | gfredericks | easy to check |
| 11:27 | gfredericks | ,*clojure-version* |
| 11:27 | clojurebot | {:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"} |
| 11:29 | modulus | no, that isn't it, i shifted the project's clojure to 1.6.0 and it works in it but not out of it |
| 11:29 | modulus | how do i even go about diagnosing this? i don't know where to start |
| 11:30 | d0ky | hello i want to find out how to implement red-black tree, is there any option to do it in java like in clojure style http://goo.gl/NMoAMf or any other advice ? |
| 11:30 | gfredericks | modulus: windows is probably pretty rare around here, so there might be a scarcity of ideas |
| 11:32 | technomancy | modulus: probably a jline bug related to locale? |
| 11:32 | justin_smith | squidz: interesting problem, here's my solution https://www.refheap.com/91106 |
| 11:32 | modulus | ok, i see one distinction |
| 11:33 | justin_smith | squidz: weird thing is it returns false if no match is found - that could be fixed by changing the second arg to reduce in the binding of position |
| 11:33 | modulus | on the project i get RPLY-y 0.3.0 while outside i get RPLY-y 0.3.5, nRPL 0.2.6. |
| 11:33 | modulus | could it be a regression on REPL-y? |
| 11:34 | justin_smith | (inc technomancy) |
| 11:34 | lazybot | ⇒ 137 |
| 11:34 | justin_smith | yeah jline windows bug is my guess too |
| 11:35 | Frozenlock | Somehow I feel dirty by doing the following... (filter identity [nil nil "string" 13]) ---> ["string" 13] |
| 11:35 | justin_smith | remove nil? |
| 11:35 | Frozenlock | yeah |
| 11:35 | justin_smith | ,(remove nil? [nil nil "string" 13]) |
| 11:35 | clojurebot | ("string" 13) |
| 11:35 | lvh | So, it appears that a (core.async/take! c f) on a channel that gets closed at some point, f doesn't fire synchronously with the close |
| 11:35 | justin_smith | funny how the suggestion to use it looks like a verification that is what you are doing? |
| 11:36 | lvh | that's making it pretty annoying to test my fn |
| 11:36 | justin_smith | heh |
| 11:36 | Frozenlock | justin_smith: Is it more efficient? |
| 11:36 | justin_smith | reads more straightforwardly |
| 11:36 | Frozenlock | true |
| 11:36 | justin_smith | should be just about identical in performance |
| 11:37 | justin_smith | maybe faster? easy to micro-benchmark with criterium |
| 11:38 | Morgawr | it returns a list rather than a vector, it looks |
| 11:38 | justin_smith | Morgawr: what does? |
| 11:38 | Morgawr | the remove nil? vs filter identity |
| 11:38 | Frozenlock | Morgawr: filter/remove always do that |
| 11:39 | justin_smith | both filter and remove return lazy seqs |
| 11:39 | Morgawr | oh nevermind |
| 11:39 | modulus | technomancy - so any clue what to do about this, if it's jline related as you say? |
| 11:39 | Morgawr | I saw Frozenlock's output and I thought it was the bot's output |
| 11:39 | Morgawr | because he wrote [ ] |
| 11:39 | modulus | should i file a bug against repl-y? |
| 11:39 | Morgawr | ignore me then :) |
| 11:39 | Frozenlock | Yeah, I wrote it by hand, sorry about that :-p |
| 11:39 | technomancy | modulus: sure. maybe try changing your locale too? |
| 11:39 | Morgawr | you got me confused :P |
| 11:40 | modulus | not very sure how to do that on win32 |
| 11:40 | modulus | er win64 |
| 11:41 | technomancy | modulus: hang on, you get a different reply version when running in a project? |
| 11:42 | technomancy | same lein version? |
| 11:42 | squidz | justin_smith: yeah I see, interesting, never knew abot clojures (reduced function. I wonder if there are other ways |
| 11:42 | modulus | correct |
| 11:42 | modulus | yes, same line version |
| 11:42 | technomancy | modulus: reply actually runs inside lein itself, not inside the project |
| 11:42 | technomancy | so I don't understand how that's possible, but I guess it is |
| 11:42 | technomancy | anyway, a bug report is warranted |
| 11:42 | squidz | justin_smith: how would you implement it if the id's weren't the indexes? |
| 11:43 | justin_smith | squidz: same |
| 11:43 | modulus | hmm let me check something |
| 11:43 | justin_smith | squidz: I am only using the id for matching, it works for any matching function |
| 11:43 | modulus | maybe i'm running two different leins due to path issues |
| 11:43 | justin_smith | squidz: notice I allow any matching function for selecting a swappable element |
| 11:44 | squidz | oh right you get the index by the range, not by the map values |
| 11:44 | modulus | ok, when outside the project i was running another lein |
| 11:44 | modulus | unfortunately i believe it's the more modern lein that has this issue |
| 11:45 | squidz | thanks, I was wondering how I could solve it simply. I tried recursion, and I tried reduce, but your solution seems to be just what I was looking for |
| 11:45 | justin_smith | squidz: look out for edge cases |
| 11:45 | justin_smith | maybe check before trying to shift element 0 to the left |
| 11:45 | justin_smith | or trying to shift the rightmost to the right |
| 11:46 | justin_smith | otherwise, you are welcome, it was a fun morning programming puzzle :) |
| 11:46 | technomancy | modulus: reply bugs are like bubbles in wallpaper |
| 11:46 | justin_smith | squidz: also, maybe return the collection unmodified if position is false |
| 11:46 | technomancy | at least the locale issues are |
| 11:46 | technomancy | push one down and it's just going to pop up somewhere else |
| 11:47 | squidz | yeah i'm modifyfing your version for the edge cases now |
| 11:47 | Bronsa | squidz: I implemented it with zippers http://sprunge.us/YFcD?clj. probably highly inefficient and bugged on the edge cases but fun :P |
| 11:48 | modulus | technomancy - i see, it's just that this seems a pretty basic input thing |
| 11:48 | justin_smith | interesting- one of these days I will grok zippers... |
| 11:48 | modulus | and it was working before. anyway i'll file. |
| 11:48 | Bronsa | slightly better http://sprunge.us/MUUB?clj |
| 11:49 | modulus | i mean being able to type brackets is kind of important lol |
| 11:49 | justin_smith | modulus: sounds like a really anemic version of sweajure - roundjure |
| 11:49 | justin_smith | clojure without vector literals |
| 11:50 | modulus | where do i file? googling for reply has ... issues |
| 11:50 | justin_smith | haha |
| 11:51 | squidz | Bronsa: cool, I never thought about using zippers i'll have to take a look and try to understand |
| 11:51 | modulus | yeah, theoretically one could do everything with (vec bla bla bla) i guess. |
| 11:51 | modulus | but it would get old fast |
| 11:51 | justin_smith | and #() instead of fn / defn |
| 11:51 | justin_smith | lol |
| 11:51 | modulus | hah |
| 11:51 | justin_smith | good luck getting by without let :) |
| 11:52 | Bronsa | #() dont even nest |
| 11:52 | modulus | yes, this does make it unusable really |
| 11:52 | justin_smith | right, but still easier than swearjure |
| 11:52 | modulus | i wonder if i'm the only person using it on win or no-one else noticed or what |
| 11:53 | borkdude | cfleming another nice feature for cursive: warning / special color when calling a function with wrong arity |
| 11:54 | martinklepsch | hey. I'm trying to get started writing cassowary in clj/cljs — I assume if I dig into core.logic I'll be able to make use of that later or at least better understand the domain of constraint solvers. Is that an ok assumption to make or should I approach that project from another direction? |
| 11:56 | squidz | Bronsa: never used zippers so now's a good time to see what they are about. Would you be able to use them if you were 'matching' on something else besides the index in the collection? For example if the collection was [{:id "a"}{:id "b"} ... ] and you wanted to shift element {:id "b"} for example? |
| 12:00 | Bronsa | squidz: sure, but zippers are mostly useful for walking nested datastructures, kind of an overkill for your use case I think |
| 12:00 | squidz | okay I see |
| 12:02 | borkdude | cfleming do you want me to put those features to github? |
| 12:03 | borkdude | cfleming requests that is ;) |
| 13:05 | m1dnight | Hm, (java.util.ArrayList. [1 2 3]) works, but when I pass [1 2 3] to a java function and call x = new ArrayList<Object>([1 2 3]); it fails? |
| 13:05 | m1dnight | Any ideas? |
| 13:05 | m1dnight | casting! silly me! |
| 13:10 | gfredericks | are there any util libs that define min/max/>/</>=/<= using clojure.core/compare? |
| 13:11 | bbloom_ | gfredericks: i don't think that'd be useful at all b/c you can't parameterize other modules to use those operators |
| 13:11 | bbloom_ | minus with-redefs or similar hackery |
| 13:11 | justin_smith | m1dnight: I don't think arrays in java implement the Collection interface |
| 13:12 | gfredericks | bbloom_: why isn't it useful for me to use myself? |
| 13:12 | bbloom_ | gfredericks: *shrug* you mean just for the syntax benefit of variadic < instead of explicit compares in your own code? |
| 13:12 | bbloom_ | yeah i guess you can do that :-P |
| 13:13 | gfredericks | bbloom_: it's semantic too; calling compare and looking at the sign of the return value is kind of klunky |
| 13:13 | gfredericks | not to mention error-prone |
| 13:14 | bbloom_ | gfredericks: sure, i gotcha. was just saying that it's a bummer the built in operators aren't generic |
| 13:14 | justin_smith | m1dnight: try new ArrayList<Object>(Arrays.asList([1, 2, 3])) |
| 13:15 | d0ky | hello i want to find out how to implement red-black tree, is there any option to do it in java like in clojure style http://goo.gl/NMoAMf or any other advice ? |
| 13:15 | gfredericks | I might just write a dang library |
| 13:15 | justin_smith | d0ky: so you want to write a red black tree in java, imitating the style of that clojure code? |
| 13:16 | d0ky | justin_smith: yes, thats it |
| 13:20 | justin_smith | it should be pretty straightforward - probably easiest if you use the Clojure persistent datatypes |
| 13:20 | justin_smith | though that relies on core.match - which will turn into a switch statement in java I guess |
| 13:21 | d0ky | justin_smith: and without clojure persistent data types ? is also possible ? |
| 13:22 | justin_smith | it's possible, you just don't get the immutiblity / structural sharing |
| 13:23 | d0ky | justin_smith: ah ok i will search how to use clojure persistent DS in java |
| 13:32 | danneu | i have a range from 1 to 100. it's divided into 4 equal buckets. i want to determine the bucket a given number lands in: (get-bucket 24)=> 1. (get-bucket 25)=>2. (get-bucket 100)=>4. i'm blanking out, here |
| 13:32 | TimMc | Did everyone else know that contains? works on Java Collections in general and also on arrays? 'Cause I just found out, and I'm pretty happy. |
| 13:33 | danneu | how could you implement get-bucket? |
| 13:33 | TimMc | danneu: quot |
| 13:34 | TimMc | ,(map #(inc (quot (dec %) 25)) [1 24 25 100]) |
| 13:34 | clojurebot | (1 1 1 4) |
| 13:34 | nkoza | somebody is experimenting weird hiccups with latest melpa cider? |
| 13:34 | TimMc | almost |
| 13:34 | TimMc | danneu: Wait, 25 => 2? |
| 13:35 | dbasch | TimMc: it’s 1 to 100, not 0 - 99 |
| 13:35 | TimMc | OK, but then 25 should land in the first bucket |
| 13:35 | gfredericks | okay I think technomancy is forcing me to bite the GPG bullet |
| 13:36 | luxbock | nkoza: yes, there's an issue with eldoc and company mode, but I think at least the eldoc problem issue was closed, but I don't know if it's in the latest MELPA build yet |
| 13:36 | dbasch | TimMc: and it does |
| 13:36 | luxbock | I upgraded and haven't noticed the slowdowns yet so I think it probably worked |
| 13:37 | dbasch | your buckets are 1-4 |
| 13:39 | TimMc | dbasch: Earlier you said (get-bucket 25)=>2 |
| 13:39 | TimMc | and I disagree with that |
| 13:39 | dbasch | TimMc: it wasn’t me :) |
| 13:39 | TimMc | All you d.* people are the same! I can't be expected to keep track. |
| 13:40 | TimMc | danneu: ^ :-P |
| 13:40 | dbasch | TimMc: maybe you should group us into buckets by the second letter |
| 13:40 | TimMc | (group-by second (:users @channel)) |
| 13:40 | xeqi | hi, I'm \e |
| 13:41 | gfredericks | hi, I'm \g |
| 13:42 | danneu | TimMc: thanks. yeah, i was wrong |
| 13:44 | technomancy | gfredericks: because of https deploy? |
| 13:44 | gfredericks | yeah |
| 13:45 | gfredericks | also `lein tag` |
| 13:45 | TimMc | ,(map #(inc (quot (dec %) 25)) [1 25 26 100]) |
| 13:45 | clojurebot | (1 1 2 4) |
| 13:45 | technomancy | sure, blame me and not your own professional dignity |
| 13:46 | gfredericks | I just don't like having two different crypto identity systems |
| 13:47 | technomancy | wait, do you not like having two, or do you not like having more than one? |
| 13:47 | technomancy | because we could easily make it three =) |
| 13:47 | gfredericks | http://en.wikipedia.org/wiki/Zero_one_infinity_rule |
| 13:48 | gfredericks | technomancy: what I'm saying is we need infinity crypto identity systems |
| 13:48 | technomancy | clojurebot: the number two is ridiculous and can't exist. |
| 13:48 | clojurebot | Ik begrijp |
| 13:49 | technomancy | ,(ns-unmap 'clojure.core 'second) |
| 13:49 | clojurebot | nil |
| 13:49 | TEttinger | the number two~ |
| 13:49 | TEttinger | ~the number two |
| 13:49 | clojurebot | the number two is ridiculous and can't exist. |
| 13:50 | dbasch | infinity is the loneliest number |
| 13:50 | technomancy | gfredericks: on that note though, you can run the same program as gpg-agent and ssh-agent |
| 13:50 | gfredericks | technomancy: I'm so foggy about these issues that I have no idea what that means |
| 13:51 | gfredericks | I know what ssh-agent does |
| 13:51 | technomancy | gfredericks: it means from a "caching your passphrase" perspective, the tools you use for both systems are the same |
| 13:51 | gfredericks | i.e., one tool does both? |
| 13:51 | technomancy | yeah |
| 13:53 | gfredericks | do I need to go setup this gpg key on clojars |
| 13:53 | technomancy | gfredericks: no |
| 13:53 | gfredericks | https asks me to login though |
| 13:53 | gfredericks | that's what I always liked about scp |
| 13:54 | gfredericks | it used my ssh key |
| 13:54 | technomancy | gfredericks: the plans for verifying signatures server-side are on-hold |
| 13:54 | technomancy | gfredericks: right; the idea is you encrypt your HTTPS credentials, and then it uses your gpg key to decrypt them on-demand. |
| 13:55 | technomancy | https client certs would be an improvement, but there's no gpg-agent equivalent for them |
| 13:55 | technomancy | so you'd have to enter the passphrase every time |
| 13:55 | gfredericks | my HTTPS credentials being my clojars username & password? |
| 13:55 | technomancy | yeah |
| 13:55 | xeqi | I'm probably going to pull turn the promotion stuff off for now, and then re-enable it once I fix the sig verifications |
| 13:56 | gfredericks | okay. I think I've got it all straight then. |
| 13:56 | technomancy | xeqi: I should have done that long ago; sorry |
| 13:56 | gfredericks | (inc technomancy) |
| 13:56 | lazybot | ⇒ 138 |
| 13:56 | technomancy | gfredericks: it's confusing because gpg can be used for 3 distinct things |
| 13:56 | gfredericks | oh and clojars has a field for my PGP public key |
| 13:56 | gfredericks | I assume GPG isa PGP |
| 13:57 | xeqi | true |
| 13:57 | technomancy | gfredericks: that's totally optional; skip it for now |
| 13:57 | gfredericks | hey I just set a new password and clojars didn't tell me it had to be less than 12 characters. hooray. |
| 13:58 | gfredericks | the internet isn't all crazy |
| 13:58 | xeqi | technomancy: glad you're not opposed. then I'll include it in the next deployment |
| 13:58 | verma | ,(seq? [1 2 3]) |
| 13:58 | clojurebot | false |
| 13:58 | verma | ,(seq? '(1 2 3)) |
| 13:58 | clojurebot | true |
| 13:58 | verma | so IPersistantVector and ISeq are not sort of compatible? |
| 13:58 | verma | ,(vector? [1 2 3]) |
| 13:58 | clojurebot | true |
| 13:59 | jeremyheiler | ,(every? sequential? [[] '()]) |
| 13:59 | clojurebot | true |
| 13:59 | verma | nice |
| 13:59 | verma | ,(sequential? []) |
| 13:59 | clojurebot | true |
| 13:59 | verma | nice |
| 13:59 | verma | (inc jeremyheiler) |
| 13:59 | lazybot | ⇒ 3 |
| 14:04 | verma | is there an interface I can implement to get str function showing the right stuff for my defrecord? |
| 14:05 | Bronsa | verma: Object/toString |
| 14:06 | Bronsa | ,(defrecord x [] Object (toString [_] "1")) |
| 14:06 | clojurebot | sandbox.x |
| 14:06 | Bronsa | ,(str (x.)) |
| 14:06 | clojurebot | "1" |
| 14:06 | verma | nice! |
| 14:06 | verma | thanks! |
| 14:07 | avishai | hi, i need a hand with midje |
| 14:08 | avishai | i'm getting java.lang.ClassCastException: clojure.lang.AFunction$1 cannot be cast to clojure.lang.IFn$OLO |
| 14:08 | avishai | when trying to stub a function with type hinting |
| 14:09 | technomancy | clojure.lang.IFn$YOLO |
| 14:09 | Bronsa | avishai: it probably has nothing to do with midje, are you using with-redefs? |
| 14:09 | verma | (inc Bronsa) |
| 14:09 | lazybot | ⇒ 52 |
| 14:09 | verma | Bronsa, println doesn't pick it up though |
| 14:10 | Bronsa | verma: yeah you have to extend print-method for that |
| 14:10 | hiredman | avishai: you are replacing a function that clojure has determined should be called in a way that takes primitive arguments with one that does not |
| 14:11 | Bronsa | by the fact atht he's getting an AFunction$1 I believe he might be rebounding it with something like ^long (fn [] ..) instead of (fn ^long [] ..) |
| 14:11 | verma | thanks Bronsa |
| 14:12 | trc | What's the meaning of @ before stuff-to-do symbol in this code http://hastebin.com/suladuluja.clj? |
| 14:12 | Bronsa | verma: np |
| 14:14 | justin_smith | trc: it's a reader-macro that expands to deref |
| 14:14 | cbp | trc: ~@ inside a macro is unquote-splice (or something like that), it "explodes" a list inside another list |
| 14:14 | puredanger | trc: ~@ is unquote-splice http://clojure.org/reader |
| 14:15 | justin_smith | I should have looked at that code before answering, d'oh |
| 14:15 | trc | Got it. Thanks guys :) |
| 14:16 | puredanger | trc: http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ may also be useful |
| 14:18 | trc | puredanger: Thanks. That very helpful |
| 14:19 | mdeboard | puredanger: Oh, nice |
| 14:19 | mdeboard | Very glda it exists |
| 14:19 | mdeboard | glad, too |
| 14:22 | cfleming | borkdude: No, currently you can't debug lein tasks - issue welcome. Auto-import is partially there, does it not work for you? Wrong arity is coming very soon. |
| 14:24 | cfleming | puredanger: the next cursive drop contains a keybinding panel, so you'll have no excuse :-) |
| 14:24 | puredanger | sweet |
| 14:24 | puredanger | I have no excuse now, I'm just lazy :) |
| 14:24 | puredanger | (inc cfleming) |
| 14:24 | lazybot | ⇒ 1 |
| 14:24 | cfleming | hehe |
| 14:24 | puredanger | wat |
| 14:25 | cfleming | I'm new around these parts |
| 14:25 | puredanger | y'all are slacking |
| 14:26 | Bronsa | (inc cfleming) |
| 14:26 | lazybot | ⇒ 2 |
| 14:26 | mdeboard | cfleming: When's that happening anyhoo |
| 14:26 | mdeboard | keybinds aren't really that big a deal for me atm |
| 14:26 | cfleming | What's that, the next drop? |
| 14:26 | mdeboard | yeah |
| 14:27 | cfleming | hopefully today, just waiting for confirmation that I actually fixed a bug from someone with a dev build. |
| 14:28 | avishai | Bronsa, i'll try with-redefs |
| 14:29 | Bronsa | avishai: don't, that wasn't a suggestion :) I just wanted to know if you were using it in order to help you |
| 14:29 | avishai | not using it |
| 14:30 | avishai | midje is creating the replacement function in `provided` block |
| 14:30 | avishai | don't really have control on how its created |
| 14:30 | Bronsa | I don't know any midje, it probably is using with-redefs itself under the hood then |
| 14:31 | Bronsa | avishai: can you control what the replacement function will be? |
| 14:31 | Bronsa | e.g. do you provide a (fn ..) form? |
| 14:31 | avishai | not really |
| 14:31 | Bronsa | avishai: can you nopaste the bit of relevant code so I can get a better idea? |
| 14:31 | mdeboard | arrdem: I was thinking, you should really get a different domain for your grimoire to help results on the google |
| 14:32 | mdeboard | clojuregrimoire.plumbing or something |
| 14:33 | gfredericks | technomancy: omg it worked |
| 14:33 | mdeboard | this is already taken http://grimoire.io/ |
| 14:33 | mdeboard | So is foo.bar |
| 14:33 | Bronsa | puredanger: we were talking about this issue yesterday, primInvoke breaks with-redefs -- should this be in scope with build profiles? |
| 14:33 | mdeboard | and clojure.foo |
| 14:34 | puredanger | Bronsa: eh? |
| 14:34 | Bronsa | puredanger: i.e. make dev/test profiles compile primInvokes to (if (instance? the-f primInterface) (.invokePrim the-f ..) (.invoke the-f ..)) and have the direct callpath in the production |
| 14:34 | Bronsa | puredanger: by we I mean me and other people in #clojure, not me and you :) |
| 14:35 | puredanger | you mean to get errors at dev time? |
| 14:35 | puredanger | or to catch a redef that changes prim-ness? |
| 14:35 | Bronsa | puredanger: right now if we have (defn x ^long [] 1) (defn y [] (x)) to with-redefs x the fn must be properly hinted or invoking y will produce a classcast exception |
| 14:37 | Bronsa | puredanger: I was suggesting making clojure dev profiles compile to include a check at the invoke site rather than directly to invokePrim calls |
| 14:37 | Bronsa | I'm asking because I see build profiles are in Release.Next |
| 14:38 | puredanger | they are in their specifically with respect to the fastload / direct ideas. All of that has been pretty dormant since transducers. And I would categorize the results of those as inconclusive. |
| 14:38 | puredanger | s/their/there/ |
| 14:38 | Bronsa | ah |
| 14:39 | puredanger | which is not to say they won't come back up but I think it's more likely 1.7 will proceed w/o them right now |
| 14:39 | Bronsa | got it |
| 14:39 | puredanger | popping the stack... |
| 14:39 | puredanger | I think there are many things that could potentially be done in a dev profile |
| 14:39 | puredanger | to give more feedback on errors etc |
| 14:40 | puredanger | what is your intention in this case? (I may just need more coffee :) |
| 14:41 | gfredericks | Bronsa: interesting point I think puredanger made about doing it in a dev profile -- you wouldn't want e.g. to have your dev code work perfectly because it's more flexible but then fail in production or something |
| 14:41 | puredanger | that's what I was trying to understand |
| 14:41 | Bronsa | puredanger: I'm more interested in solving inconsistencies in the current "profile", currently there are things like ^:inline & primInvoke that break with-redefs |
| 14:42 | gfredericks | puredanger: we weren't talking in terms of dev profiles specifically yesterday, so that aspect didn't come up |
| 14:42 | gfredericks | so I think Bronsa is talking about a different sort of use case than "dev" |
| 14:43 | gfredericks | I don't know what it is exactly though |
| 14:43 | Bronsa | it is my impression (I'm probably wrong though) that with-redefs was primarily intended for temporarily stubbing functions, for testing |
| 14:44 | puredanger | generally, I think that's the common case |
| 14:45 | justin_smith | I wouldn't mind at all if with-redefs only worked with a dev profile, that seems a sane arrangement actually |
| 14:45 | justin_smith | (and then I'll find out half the libraries I rely on are misusing with-redefs...) |
| 14:45 | puredanger | http://crossclj.info/fun/clojure.core/with-redefs.html |
| 14:45 | gfredericks | Bronsa: oh yeah I guess if it's just something that affects with-redefs then it's less of a danger |
| 14:45 | Bronsa | I see in the confluence page that there's mentioned a "dyn" profile, that might probably be a better fit for what I had in mind |
| 14:45 | puredanger | "den" is approximately what we have now |
| 14:45 | puredanger | arg autocorrect |
| 14:45 | Bronsa | (I'm probably screwing myself here since I depend on with-redefs for prod in tools.emitter.jvm :P) |
| 14:45 | puredanger | dyn |
| 14:46 | gfredericks | superdyn then |
| 14:46 | danneu | TimMc: alright, i think i got it. i was implementing x-rate-limit middleware https://gist.github.com/danneu/1d4c2f6a8e47935dbfb0 since https://github.com/myfreeweb/ring-ratelimit doesnt let you specify the rate limit window |
| 14:49 | gfredericks | ,(defmacro without-redefs [bindings & body] (cons `do body)) |
| 14:49 | clojurebot | #'sandbox/without-redefs |
| 14:50 | justin_smith | haha |
| 14:50 | gfredericks | everybody start using ` on your special forms so we can futureproof against special forms getting namespaced |
| 14:50 | Bronsa | if only |
| 14:55 | gfredericks | haha! "if"! get it! |
| 14:55 | stuartsierra | ,`do |
| 14:55 | clojurebot | do |
| 14:57 | TimMc | danneu: Wrong nick, I think. :-) |
| 14:58 | danneu | TimMc: nah, there's your work, dude: https://gist.github.com/danneu/1d4c2f6a8e47935dbfb0#file-ratelimit-clj-L27 |
| 14:59 | gfredericks | okay I wrote those comparison functions I was whining about: https://github.com/gfredericks/compare |
| 14:59 | danneu | resume filler |
| 14:59 | TimMc | Oh, I see -- I read too quickly. |
| 15:16 | doctorm | What am I doing wrong with this simple protocol test? https://www.refheap.com/91122 |
| 15:16 | gfredericks | doctorm: too many args to formal |
| 15:17 | gfredericks | clojure throws a totally different error messages on arity problems with protocols vs normal functions |
| 15:17 | doctorm | gfredericks: Ah, I see |
| 15:17 | justin_smith | doctorm: you need an explicit this arg |
| 15:17 | gfredericks | oh yeah that's the other side of the problem |
| 15:18 | gfredericks | should there be a ticket about that error message? |
| 15:18 | gfredericks | it pretty much always means "wrong arity" amirite? |
| 15:19 | doctorm | gfredericks: Looks like there is one - http://dev.clojure.org/jira/browse/CLJ-735 |
| 15:19 | puredanger | I'm still waiting on that one :) |
| 15:20 | puredanger | one of the first tickets I ever filed |
| 15:21 | gfredericks | puredanger: waiting on what? |
| 15:21 | puredanger | for *someone* to approve it :) |
| 15:21 | puredanger | thx |
| 15:24 | puredanger | Rich bumped this one way up in priority today http://dev.clojure.org/jira/browse/CLJ-1315 btw, not sure what prompted that |
| 15:28 | llasram | Awesome |
| 15:29 | allenj12 | anyone wanna help me with this macro im trying to make? https://www.refheap.com/91123 |
| 15:29 | llasram | Well, you know the first rule of macro club |
| 15:30 | allenj12 | llasram: no what is it? |
| 15:30 | puredanger | thx to Bronsa, CLJ-1330 is now in the Screened list too http://dev.clojure.org/jira/browse/CLJ-1330 |
| 15:31 | puredanger | allenj12: don't write a macro :) |
| 15:32 | puredanger | not that I think he was serious :) |
| 15:33 | llasram | allenj12, puredanger: well, half-serious. Hadn't looked at refheap yet |
| 15:33 | llasram | And now that I'm have, I'm afraid I don't understand :-) |
| 15:33 | johnny_mck | quit |
| 15:33 | llasram | allenj12: "overwrites the namespace of a function" -- not sure what you mean |
| 15:34 | llasram | allenj12: And, why does this need to be a macro vs just a higher-order function? |
| 15:34 | allenj12 | llasram: its for overtone, i wanna be able to evaluate the macro and it to regenerate the function... its mainly for speed when im live coding music |
| 15:35 | doctorm | So for defprotocol, the first argument is always assumed to be something that implements the protocol? |
| 15:35 | llasram | allenj12: WHy not just e.g. `(def whatever-name (loopy-as-a-hof ...))` ? |
| 15:35 | allenj12 | llasram: because currently say if i call a recurring function called loop if i do (loop (some midi notes here)) i cant really change those notes since its stuck in the temporal recursion then |
| 15:36 | llasram | allenj12: Oh, it re-schedules itself via the var |
| 15:36 | allenj12 | yes |
| 15:36 | allenj12 | its very domain specific, i wouldnt do this for anything but live coding music |
| 15:37 | allenj12 | i wanna be able to change the parameters of the function... by calling the function again... why its recurring... if that makes sense |
| 15:37 | llasram | allenj12: Ok. I'd still suggest separating out the part which defines the function to a higher-order function, then having a wrapper macro which does the `def` and passes the `def`d var as one of the parameters |
| 15:37 | llasram | Is the part missing just that you need to unquote `fname` and accessing the var? |
| 15:37 | clojurebot | It's greek to me. |
| 15:38 | llasram | allenj12: That should be just `~fname` and `(var ~fname)` respectively |
| 15:38 | llasram | (with the '`' characters in this case being me indicating code, not part of the program text) |
| 15:39 | llasram | Well, or `fnname` as you currently have the parameter |
| 15:41 | allenj12 | llasram: yea i keep getting unable to resolve symbol fname :( |
| 15:41 | justin_smith | llasram: allenj12: would using intern remove the need to use a macro? |
| 15:41 | justin_smith | ,(doc intern) |
| 15:41 | clojurebot | "([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var." |
| 15:41 | llasram | allenj12: your macro parameter is `fnname` (with an extra "n") |
| 15:42 | llasram | Make them match and you should be good |
| 15:42 | llasram | (Well, you still need to change #'fname -> (var ~fname), but otherwise) |
| 15:43 | allenj12 | justin_smith: maybe actually i think i might need to play with that more for an intuiton on that |
| 15:43 | llasram | justin_smith: I'd argue that that would be grosser, because you'd have a function which mucked with the namespace |
| 15:43 | llasram | I think a macro is the right approach for handling that aspect |
| 15:44 | allenj12 | llasram: its now complaining beat is not supported arg for *metro* which it def should be |
| 15:46 | llasram | allenj12: This is where separating out the function vs macro portions will make your code much simpler. As-is you've got a whole boatload of namespaced symbols |
| 15:47 | allenj12 | llasram: yea |
| 15:47 | llasram | That particular error is probably because you're passing the literal namespaced symbol `beat to whatever *metro* is, but still |
| 15:49 | amalloy | llasram: by the way, #'~fname is the same as (var ~fname). you don't actually need to use the long form just because you're in a macro |
| 15:50 | llasram | amalloy: Oh, that is obvious in hindsight. Thank you |
| 15:59 | justin_smith | llasram: why is a function messing with a namespace worse than a macro that mucks with a namespace? |
| 16:00 | justin_smith | (asking as a legitimate question) |
| 16:02 | llasram | justin_smith: So you can just call `def`, which is more common and thus easier to understand :-) |
| 16:03 | llasram | I think you have a point -- the big thing for me would be separating definition of the function from the namespace-mucking part |
| 16:05 | aaelony | having a bit of a time with mysql with java.jdbc and running out of memory when trying to execute a query that dumps to a delimited file. This despite among other things using ideas/code as suggested here http://stackoverflow.com/questions/19728538/clojure-java-jdbc-query-large-resultset-lazily where it appears to have worked correctly for the author. I'm able to use the mysql client to easily and quickly extract the data I need, but would |
| 16:05 | aaelony | much rather like to be able to do this in Clojure with not more than 2GB RAM. The example makes use of clojure.java.jdbc/query and clojure.java.jdbc/prepare-statement. I'm also don't think I'm "holding onto the head" of anything that would interfere with laziness. Just stumped. Any help appreciated. thanks. |
| 16:07 | amalloy | aaelony: how can anyone help without any idea what your code is doing? you've posted a link to code that works but is not yours, so the best answer i can give right now is "do what that guy does" |
| 16:07 | aaelony | amalloy: it's exactly as in the link I posted |
| 16:07 | aaelony | please see the link |
| 16:07 | aaelony | the error I get is: java.lang.OutOfMemoryError: GC overhead limit exceede |
| 16:07 | aaelony | d |
| 16:08 | llasram | aaelony: What version of clojure.java.jdbc are you using? |
| 16:08 | amalloy | i see the link. it is to code that the author, and you, say works. if you claim your code is the same byte-for-byte but doesn't work, then call an exorcist |
| 16:08 | aaelony | clojure 1.6.0 |
| 16:09 | llasram | aaelony: No. clojure.java.jdbc, not clojure |
| 16:09 | aaelony | clojure.java.jdbc 0.3.5 |
| 16:09 | aaelony | (slow to type) |
| 16:09 | aaelony | mysql/mysql-connector-java "5.1.25" |
| 16:10 | llasram | Then I'm going to need to agree with amalloy if you are literally running exactly the same code with different results |
| 16:10 | aaelony | what can I post that would help |
| 16:10 | aaelony | ? |
| 16:11 | llasram | (although that honestly seems unlikely, as the answer in that post references postgres and you say you are using mysql) |
| 16:11 | llasram | The actual code that you are using |
| 16:11 | aaelony | I will refheap it. give me a minute... |
| 16:13 | aaelony | https://www.refheap.com/91126 |
| 16:16 | llasram | aaelony: So I honestly haven't used clojure.java.jdbc, but it seems like there is a `result-set-fn` which defaults to being either `vec` or `doall`, neither of which seem to be what you cant here |
| 16:17 | llasram | s,cant,want, |
| 16:17 | llasram | aaelony: Maybe try adding `:result-set-fn dorun` to the `jdbc/query` arguments |
| 16:17 | aaelony | It *will* output data, but only when the I give it a query with a small limit, e.g. select * from bigtable limit 100 |
| 16:18 | aaelony | llasram: I will try your recommendation... |
| 16:18 | justin_smith | aaelony: small style thing, string/join is already eager, so you don't need to wrap the arg in doall |
| 16:18 | justin_smith | also, it already returns a string, so the wrapping str is redundant too |
| 16:18 | aaelony | justin_smith: ok, at this point I was just trying to do exactly what the stackoverflow post author had found to work |
| 16:19 | justin_smith | ahh, OK |
| 16:19 | amalloy | aaelony: your row-fn returns a string, so unless you change result-set-fn, you're returning a vector of strings |
| 16:19 | justin_smith | like I said, not correctness issues, just style |
| 16:19 | amalloy | if you have a large number of rows, you'll have a large vector |
| 16:19 | llasram | amalloy: If you look, they then actually do `#(.write writr (row-fn %))` |
| 16:19 | llasram | So it'll actually be a large vector of `nil`s |
| 16:19 | llasram | But potentially same problem |
| 16:19 | llasram | (which I think `:result-set-fn` will fix) |
| 16:20 | amalloy | ah, right |
| 16:20 | aaelony | amalloy: that's probably it. Everything is really large, so I don't want anything that may overflow... |
| 16:21 | andyf_ | technomancy: Did you intentionally change the email address on your JIRA acct? Ok if so. It just looked odd |
| 16:21 | aaelony | trying it now with :result-set-fn dorun ... |
| 16:23 | technomancy | andyf_: yeah, it seemed easier than hunting down everything I'm getting notifications for and unsubscribing individually |
| 16:23 | aaelony | another thing is that I would expect it to report every 1000 rows, but it is silent... |
| 16:24 | andyf_ | technomancy: Understood. Good to know JIRA isn't under attack yet |
| 16:25 | amalloy | no-thanks@technomancy.com? |
| 16:27 | technomancy | close enough =) |
| 16:27 | andyf_ | Clojure-jira-updates-are-bursty@cant-keep-up.com |
| 16:29 | hiredman | I use the rss feed |
| 16:29 | hiredman | it is great |
| 16:30 | technomancy | I'm allergic to Dave Winer. |
| 16:30 | dagda1 | what does the hash symbol in this expression mean (inc (#'levenshtein-distance (rest seq1) seq2)) |
| 16:30 | justin_smith | ,#'+ |
| 16:30 | clojurebot | #'clojure.core/+ |
| 16:31 | justin_smith | ,+ |
| 16:31 | clojurebot | #<core$_PLUS_ clojure.core$_PLUS_@77e40c> |
| 16:31 | justin_smith | it points to the var, rather than the thing the var resolves to |
| 16:31 | justin_smith | ,#'*clojure-version* |
| 16:31 | clojurebot | #'clojure.core/*clojure-version* |
| 16:31 | justin_smith | ,*clojure-version* |
| 16:31 | clojurebot | {:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"} |
| 16:31 | justin_smith | better example |
| 16:32 | amalloy | it's hard to believe (inc (#'levenshtein-distance (rest seq1) seq2)) actually needs the #', though |
| 16:33 | amalloy | i guess they're probably memoizing it later on, and want to indirect through the memoized var |
| 16:33 | dagda1 | I don't think I understand this, is there a name for this so I can look at the docs |
| 16:33 | justin_smith | dagda1: var |
| 16:33 | amalloy | ,'#'foo |
| 16:33 | clojurebot | (var foo) |
| 16:33 | alejandro1 | amalloy: what do you mean "indirect through the memoized var"? |
| 16:36 | amalloy | i mean like this: (defn fib [n] (if (<= n 1) n, (+ (#'fib (- n 1)) (#'fib (- n 2))))), (alter-var-root #'fib memoize) (fib 50) |
| 16:36 | amalloy | ie, instead of making a direct recursive call to the "dumb" fib that's currently being defined, they make a call to the memoized fib that will later be stored in the var |
| 16:43 | allenj12 | my brain hurts now, might take a nap from all these macros :) |
| 16:49 | aaelony | that was with (jdbc/query db-connection [statement] :as-arrays? true :result-set-fn dorun :row-fn ... |
| 16:49 | aaelony | update... re-tried dumping a large resultset (this time at the repl, not in emacs). after 12 minutes the error message is "OutOfMemoryError GC overhead limit exceeded com.mysql.jdbc.MysqlIO.nextRowFast (MysqlIO.java:2222)" that was with (jdbc/query db-connection [statement] :as-arrays? true :result-set-fn dorun :row-fn ... |
| 16:50 | justin_smith | aaelony: connect a profiler and see what's using up the heap |
| 16:50 | justin_smith | the jvm comes with one (jvisualvm) but there are other options too, like yourkit, etc. |
| 16:50 | clojurebot | Cool story bro. |
| 16:50 | justin_smith | ~botsmack |
| 16:50 | clojurebot | clojurebot evades successfully! |
| 16:51 | aaelony | justin_smith: yeah, I'll try that next I. I guess I need to :aot everything first? |
| 16:51 | amalloy | no |
| 16:51 | justin_smith | no, you don't |
| 16:52 | justin_smith | you do need to add a jvm opt to open a dt-socket |
| 16:52 | aaelony | justin_smith: ok, I'll look that up ... |
| 16:52 | justin_smith | "-agentlib:jdwp=transport=dt_socket" in :jvm-opts in project.clj |
| 16:53 | justin_smith | that allows a debugger full access to the vm |
| 16:53 | justin_smith | if that's your only opt, it goes in a vector |
| 16:53 | aaelony | justin_smith: thank-you.. finding that would've taken me a while!! |
| 16:53 | justin_smith | err... to be more clear, opts go in a vector :) |
| 16:53 | amalloy | yeah, or just don't do that and let the profiler attach manually, which works fine as long as it's running on your local machine |
| 16:54 | justin_smith | amalloy: really? thought it was neccessary but I guess I was cargo-culting it because I needed it once upon a time |
| 16:54 | amalloy | justin_smith: there are a few minor features that you can get if you attach before starting up, but nothing i've ever needed to use |
| 16:59 | puredanger | I don't usually set any options to attach with visualvm |
| 16:59 | puredanger | I do with yourkit but usually I'm setting something that way |
| 17:01 | aaelony | ok, I will first try re-running with VisualVM (mac os x mavericks) with a lein repl and see what happens... it will take 10 min or so.. |
| 17:02 | puredanger | by the way all, planning to open up the 2014 State of Clojure/ClojureScript survey next week |
| 17:03 | puredanger | Chas asked me to give him a hand due to his newborns but it is essentially the same |
| 17:03 | technomancy | puredanger: cool; thanks for taking that up |
| 17:04 | puredanger | np |
| 17:04 | puredanger | I'm very interested in seeing the jvm usage data this year |
| 17:04 | puredanger | given that java 1.7 is EOL in a few months |
| 17:04 | technomancy | whoa; really? |
| 17:05 | puredanger | yeah, I think it's March? |
| 17:05 | mrcheeks | heh, I haven't even use either 1.7 or 1.8 in prod yet |
| 17:05 | mrcheeks | used* |
| 17:05 | technomancy | 1.6 is still getting security updates, just from redhat instead of oracle iirc |
| 17:05 | puredanger | http://www.oracle.com/technetwork/java/eol-135779.html |
| 17:05 | justin_smith | I swear debian and osx have conspired to freeze everyone on 1.6 |
| 17:05 | technomancy | which is arguably better? =) |
| 17:06 | technomancy | puredanger: lein survey from march: http://lein-survey-2014.herokuapp.com/afc8dc1d80cd2468dee533a795610f.png |
| 17:06 | puredanger | I saw that, thx |
| 17:06 | technomancy | 1.8 was pretty new in march though, I think? |
| 17:06 | puredanger | that was right after 1.8 came out right? |
| 17:06 | technomancy | I think so |
| 17:08 | borkdude | really cool that lein test :only also supports test-ns-hook |
| 17:09 | borkdude | I tried to understand the code which takes care of that, but I'll just believe it works |
| 17:10 | borkdude | is there anything to stop after the first error or failure instead of lein fail fast anno 2014? |
| 17:11 | technomancy | borkdude: if lein-fail-fast doesn't work with 2.x I bet it would be an easy fix |
| 17:11 | borkdude | technomancy I wondered why retest is built in, but something like fail fast not |
| 17:12 | technomancy | retest is harder to do in a plugin |
| 17:12 | technomancy | well |
| 17:12 | technomancy | yeah, it would require some monkeypatching |
| 17:12 | borkdude | I see |
| 17:12 | technomancy | which fail-fast would too, but it hardly matters since by the time the monkeypatching is hit, the JVM is already exiting =) |
| 17:13 | bbloom_ | gfredericks: did you mean "use"? https://github.com/gfredericks/compare#usage |
| 17:16 | gfredericks | bbloom_: no, I meant to prefix the usages with `compare/`; but yes it's wrong, thanks :) |
| 17:17 | gfredericks | fixed |
| 17:18 | bbloom_ | />= seems so haskell |
| 17:18 | bbloom_ | "not bind" maybe? |
| 17:18 | bbloom_ | or is that />== |
| 17:18 | gfredericks | just like without-redefs |
| 17:18 | bbloom_ | or >/= |
| 17:18 | bbloom_ | without-redefs? |
| 17:18 | gfredericks | without-redefs is dangerous to use in development, please only use it in production |
| 17:19 | gfredericks | it's like with-redefs but it doesn't redefine anything |
| 17:19 | puredanger | I assume I can find this in core.uncontrib |
| 17:19 | gfredericks | lol |
| 17:19 | bbloom_ | heh |
| 17:20 | koreth_ | If I want mapcat-style semantics from "for", is the best way to do it to wrap a regular "for" in "mapcat identity"? |
| 17:20 | bbloom_ | puredanger: libraries contributed by the united nations? |
| 17:20 | gfredericks | koreth_: use more clauses |
| 17:20 | bbloom_ | ,(for [x (range 3) y (range 3) [x y]) ; koreth_ |
| 17:20 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )> |
| 17:20 | hiredman | ,(for [i (range 3) ii (range i)] ii) |
| 17:20 | clojurebot | (0 0 1) |
| 17:20 | bbloom_ | ,(for [x (range 3) y (range 3)]/ [x y]) ; koreth_ ( i suck) |
| 17:20 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/for> |
| 17:20 | gfredericks | bbloom_: puredanger: that got me imagining a library that specifically has everything rich hickey has rejected |
| 17:20 | puredanger | heh |
| 17:21 | bbloom_ | i can't type, but you get the idea koreth_ |
| 17:21 | puredanger | clojurebot should really just re-run the previous statement with more parens when it gets Unmatched delimiter :) |
| 17:21 | bbloom_ | didn't rich already propose the "yes" language? |
| 17:21 | hiredman | that was steve |
| 17:21 | hiredman | (yegge) |
| 17:22 | borkdude | ,(for [x [1 2 3 :let y [(inc x) (dec x)] result y] result) |
| 17:22 | bbloom_ | or thought it was rich to mock (or some more polite word) yegge |
| 17:22 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )> |
| 17:22 | borkdude | lol |
| 17:22 | amalloy | i thought steve said clojure should be a yes language, and rich said look man, go make your own yeslang |
| 17:23 | koreth_ | bbloom_: I'm not sure I see how that helps. |
| 17:23 | koreth_ | ,(for [x (range 3) y (range 3)] [x y]) |
| 17:23 | clojurebot | ([0 0] [0 1] [0 2] [1 0] [1 1] ...) |
| 17:23 | koreth_ | ,(mapcat identity (for [x (range 3)] [x (str x)])) |
| 17:23 | clojurebot | (0 "0" 1 "1" 2 ...) |
| 17:23 | aaelony | ok, silly question... what should I be looking for from visualvm? I see byte[] at 72% live bytes and byte[][] at 23 %, and com.mysql.jdbc.ByteArrayRow at 3.9% live bytes. Does that mean that writing to file is the bottleneck rather than jdbc? |
| 17:23 | bbloom_ | koreth_: nested for is the same as mapcat or "flatmap" |
| 17:23 | technomancy | gfredericks: isn't that just potemkin? |
| 17:24 | cfleming | puredanger: CLJ-1315 might be a fastload thing? Either way I'm stoked to see it getting some love. |
| 17:24 | hiredman | ,(for [x (range 3) i [x (str x)] i) |
| 17:24 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )> |
| 17:24 | koreth_ | By "mapcat semantics" I mean that the body of the for returns a list, and I want the result of the "for" to be the concatenation of those lists. |
| 17:24 | hiredman | ,(for [x (range 3) i [x (str x)]] i) |
| 17:24 | clojurebot | (0 "0" 1 "1" 2 ...) |
| 17:24 | gfredericks | technomancy: :P |
| 17:24 | puredanger | cfleming: I've been looking at it for the last hour |
| 17:24 | cfleming | And many thanks to Bronsa for CLJ-1330 too |
| 17:24 | koreth_ | hiredman: Ah, okay, that makes sense. Thanks. |
| 17:25 | puredanger | cfleming: I've run a patched version of Clojure on many oss clojure projects, have yet to find a place where it causes new failures (which is a good sign) |
| 17:25 | hiredman | koreth_: btw mapcat identity is apply mapcat |
| 17:25 | hiredman | err |
| 17:25 | hiredman | apply concat |
| 17:25 | koreth_ | hiredman: Doesn't apply break laziness? |
| 17:25 | hiredman | try it and see |
| 17:25 | aaelony | I also see used heap size increasing until a plateau and then a crash |
| 17:25 | cfleming | puredanger: I've been running that patch since it came out. Everyone running Cursive has been using it since then. |
| 17:25 | cfleming | puredanger: Although I realised later that I only really need it to compile. |
| 17:26 | aaelony | have screenshots... |
| 17:26 | borkdude | ,(for [x [1 2 3] :let [y [(inc x) (dec x)]] result y] result) |
| 17:26 | clojurebot | (2 0 3 1 4 ...) |
| 17:26 | cfleming | puredanger: I had a horrible Heath Robinson contraption set up to compile before that. |
| 17:27 | bbloom_ | puredanger: while we're discussing tickets, what can i do to help CLJ-803 along? :-) |
| 17:27 | puredanger | bbloom_: nothing, it's waiting for Rich |
| 17:27 | bbloom_ | ok |
| 17:28 | puredanger | I'm just waiting for ztellman to pop up and ask me about unrolled collections now |
| 17:28 | bbloom_ | that's the only ticket that affects me which i can't work around easily by copy pasting code in to my own project (because it affects the API of my project, people need to use my swap) |
| 17:28 | bbloom_ | gvec transients and stuff were easily remedied by good ol' copy paste |
| 17:30 | puredanger | Bloom Hypothesis: "a sufficiently wide copy and paste can solve any problem" ? :) |
| 17:30 | bbloom_ | puredanger: yes, but add "...up to but not including other people refusing to run my copy pasted code" |
| 17:31 | bbloom_ | and then add "....minus class loader voodoo" |
| 17:43 | amalloy | "Monads are in danger of becoming a bit of a joke: for every person who raves about them, there’s another person asking what in the world they are, and a third person writing a confusing tutorial about them. Well, forget all that! In this pragmatic article we'll..." [...writes confusing tutorial] |
| 17:43 | technomancy | hehe |
| 17:47 | bbloom_ | amalloy: they've forgotten the 4th person who understands them and genuinely thinks that they're a waste of mental energy |
| 17:49 | amalloy | bbloom_: sorry, i can't accept responses that aren't in the form of a pun on words like Just, Nothing, bind, or return |
| 17:50 | bbloom_ | amalloy: the've forgotten the Suc (Suc (Suc (Suc 0))) person who Just understands but binds to the thought that the _return_ on investment is Nothing |
| 17:51 | amalloy | not bad at all. ten points to ravenclaw |
| 17:51 | bbloom_ | oh, and something about burritos |
| 17:51 | amalloy | though i don't think the peano numbers are relevant to monads |
| 17:52 | technomancy | "It's math" |
| 17:52 | bbloom_ | i'll go with technomancy's explaination |
| 17:52 | gfredericks | (inc technomancy) ;; low latency |
| 17:52 | lazybot | ⇒ 139 |
| 17:52 | bbloom_ | haha |
| 17:52 | bbloom_ | (inc team) |
| 17:52 | lazybot | ⇒ 1 |
| 17:52 | bbloom_ | really? just one? |
| 17:52 | bbloom_ | from now on all group effort points will be awarded to team. |
| 17:53 | gfredericks | $karma #clojure |
| 17:53 | lazybot | #clojure has karma 7. |
| 17:53 | bbloom_ | $karma clojure |
| 17:53 | lazybot | clojure has karma 20. |
| 17:53 | bbloom_ | $karma bbloom |
| 17:53 | lazybot | bbloom has karma 45. |
| 17:53 | gfredericks | $karma rhickey |
| 17:53 | lazybot | rhickey has karma 2. |
| 17:53 | bbloom_ | i'm clearly at least twice as good as clojure. |
| 17:53 | bbloom_ | aw, boo |
| 17:53 | bbloom_ | (inc rhickey) |
| 17:53 | lazybot | ⇒ 3 |
| 17:53 | gfredericks | $karma rich |
| 17:53 | lazybot | rich has karma 0. |
| 17:54 | gfredericks | $karma richhickey |
| 17:54 | lazybot | richhickey has karma 0. |
| 17:54 | gfredericks | huh. |
| 17:57 | amalloy | well it's not like he's on here much. certainly not since lazybot started tracking karma |
| 17:57 | amalloy | and wouldn't you feel silly inc'ing him? he doesn't need your acknowledgment |
| 18:04 | bbloom_ | amalloy: yeah, but i do feel like somebody should special case that to return Long/MAX_VALUE |
| 18:04 | bbloom_ | :-P |
| 18:05 | amalloy | i could set it to over nine thousand |
| 18:06 | amalloy | $karma rhickey |
| 18:06 | lazybot | rhickey has karma 9003. |
| 18:07 | amalloy | this way it's absurdly high but incs still matter |
| 18:08 | bbloom_ | (inc amalloy) ; excellent |
| 18:08 | lazybot | ⇒ 173 |
| 18:09 | bbloom_ | amalloy: you still need acknowledgement, right? |
| 18:09 | amalloy | bbloom_: twice a day or i wither and die |
| 18:14 | aaelony | well, one complicating issue was that my data contains 00-00-00 00:00:00 dates that may have been silently accumulating. Adding to the JDBC URL "?zeroDateTimeBehavior=convertToNull" seems to correct this. Probably not the **only** problem, but one less at least ;) |
| 18:19 | gfredericks | that's an exciting JDBC URL option I didn't know about |
| 18:20 | aaelony | lol, I could do without that kind of exciting ;) |
| 18:22 | aaelony | http://stackoverflow.com/questions/11133759/0000-00-00-000000-can-not-be-represented-as-java-sql-timestamp-error |
| 18:30 | asQuirreL | hey guys, I'm looking to create something similar to a map in which two keys point to the same identity, is there an idiomatic way to achieve that? |
| 18:32 | dbasch | asQuirreL: you mean, for every value in the map there are always exactly two keys pointing to it? |
| 18:33 | dbasch | what is it that you want to enforce? |
| 18:33 | asQuirreL | suppose the keys are `x`, or `y` in `m`, then `(update-in m [x] f)` and `(update-in m [y] f)` modify the same object in memory |
| 18:33 | asQuirreL | I want to maintain the invariant `(= (m x) (m y))` always. |
| 18:34 | asQuirreL | if it helps, the structure I am actually trying to create is, for a context free grammar, a map from non-terminals to rules they occur in. |
| 18:35 | asQuirreL | so two non-terminals may appear in the same rule, but I want that rule to actually be the exact same rule in memory so that if I access it through one non-terminal in the map and modify it, the version seen by the other non-terminal is also modified. |
| 18:36 | asQuirreL | I could perhaps achieve this by using atoms as values in the map, but, this adds thread synchronisation which I am not interested in, so I was wondering if there was a way of getting the indirection without the synchronisation |
| 18:37 | dbasch | asQuirreL: you could have the keys point to the var instead of the value |
| 18:37 | asQuirreL | yep, I looked into that, but couldn't find a way to create anonymous vars for the purpose |
| 18:37 | asQuirreL | would I just use gensym? |
| 18:39 | dbasch | you could also have your key be the set of all the keys that point to a value, and use that in your map |
| 18:39 | dbasch | that’s logically what you want |
| 18:40 | dbasch | the indirection comes from the key side |
| 18:41 | asQuirreL | dbasch the issue with that is that it makes lookup more cumbersome |
| 18:41 | asQuirreL | I plan on querying this map using non-terminals |
| 18:41 | dbasch | asQuirreL: create a lookup function for that |
| 18:42 | dbasch | but logically you have a bunch of equivalent terminals for which any of them is a key |
| 18:42 | dbasch | sorry, non-terminals |
| 18:43 | asQuirreL | dbasch, well not quite, the real data structure is a map of sets, keyed by non-terminals, where each set is the set of rules it occurs in (it is not a straight 1-1 map) |
| 18:43 | amalloy | asQuirreL: have another canonicalizing function c, and then instead of (update-in m [x] f), you write (update-in m [(c x)] f) |
| 18:44 | amalloy | and use c when you read as well |
| 18:44 | amalloy | then as long as (= (c x) (c y)), this acts like a map where x and y are indistinguishable |
| 18:46 | asQuirreL | amalloy that's an interesting idea |
| 18:46 | amalloy | if instead you insist on a "map" where updating x magically makes the same change to the value under y, then what you have won't be a map anymore: it's violating the most basic requirements of a map |
| 18:47 | asQuirreL | does it? |
| 18:48 | asQuirreL | I would've thought, seeing as it does not touch the keyset, that the map properties are preserved |
| 18:48 | asQuirreL | there's no chance of a key collision, I mean |
| 18:49 | asQuirreL | the fact that the map is not injective is not an issue, is it? |
| 18:49 | amalloy | errrrr, i don't think you've defined things formally enough for injective to be relevant |
| 18:50 | tuft | is there any way to make the reader/writer deal in tagged literals for java objects instead of the weird #<Foo SomeFooRepr> strings it spits out by default? |
| 18:50 | asQuirreL | I just don't understand which fundamental property of maps it violates? |
| 18:50 | asQuirreL | (Really the mapping I want is from non-terminals to sets of identities (of rules)) |
| 18:50 | amalloy | but an immutable map should have the property that (let [m some-map] (= (get m x) (get (update-in m [y] f) x))), as long as (not= y x). the value for each key is distinct. it's really confusing if that's not true |
| 18:50 | dbasch | all you really want is a level of indirection, where a and b point to k, and k is a key in a different map |
| 18:50 | tuft | specifically I'm working with DateTimes, which end up printed as e.g. #<DateTime 2014-10-03T22:47:46.243Z> |
| 18:51 | amalloy | dbasch: right, which is my c function (another map) |
| 18:51 | dbasch | yes, that’s what I’ve been saying |
| 18:51 | tuft | trying to debug some test.check test failures and it gives me back the generated dates in those terms (not using #inst as joda stuff has more utility) |
| 18:51 | asQuirreL | dbasch exactly |
| 18:51 | asQuirreL | amalloy, that is not a fundamental property of maps, and simultaneously, is definitely the property of injectivity |
| 18:52 | amalloy | that doesn't sound like injectivity at all to me, if you are talking about injective relations |
| 18:52 | asQuirreL | injectivity with respect to identities |
| 18:53 | amalloy | injective means that the same value is never stored under two different keys, which is not at all what i said |
| 18:54 | asQuirreL | but if I were to rephrase that as "injectivity with respect to identities is the property that the same identity is never stored under two different keys" then that is what you said, right? The issue is only the codomain that we are both referring to |
| 18:54 | asQuirreL | which is by-the-by in my opinion, because identities are themselves values |
| 18:55 | tuft | looks like this is relevant http://stackoverflow.com/questions/1288877/what-would-be-the-correct-way-to-serialize-this-java-object-in-clojure |
| 18:57 | amalloy | i am checking out of this conversation: i don't have anything more productive to say about these maps |
| 19:00 | asQuirreL | it's true, I could convert the sequence of rules into a vector, thus keyed by index, and then uses the indices into the vector as my level of indirection |
| 19:00 | asQuirreL | I was just wondering if there was language level support for indirection |
| 19:00 | asQuirreL | (without the thread safety) |
| 19:14 | tuft | is there any way to set a dynamic variable globally for lein repl sessions? |
| 19:16 | hiredman | https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L255 |
| 19:17 | hiredman | (I don't think it actually uses binding, but it may work fine) |
| 19:17 | tuft | sweet thanks =) |
| 19:19 | ed-g | random question. I'm creating JSON using data.json. Some values in my clojure map contain already-formatted JSON. Currently I'm using (json/write-str my-clojure-map :value-fn (fn [k v] (if (= k :key-whose-value-is-json-format) (json/read-str v) v))) which converts the JSON to a data structure, so that data.json can convert it back. Is there a better way? |
| 19:21 | tuft | hiredman: yeah doesn't seem to work due to not using bindings i believe. "Can't change/establish root binding of: *print-dup* with set" |
| 19:23 | hiredman | ed-g: if you Box your json data with a custom type(so it isn't just a string), you can tell data.json how to emit that type, and I am pretty sure when you do that data.json hands you something you can write to directly, so you can just write whatever you want |
| 19:29 | ed-g | hiredman: thanks! |
| 20:08 | giant_g2 | Check out my new app! https://play.google.com/store/apps/details?id=com.blogspot.techandtopics.alcoholpartyfree |
| 20:10 | justin_smith | giant_g2: did you use clojure in making it? |
| 20:11 | giant_g2 | No :( |
| 20:17 | giant_g2 | But it will tell you how much alchol to buy if you're having a clojure party! |
| 21:03 | tuft | is there any way to query for entities that lack a particular attribute in datomic? |
| 21:04 | small-chimp | hi everyone can someone help me to program some lickable software with clojure |
| 21:04 | small-chimp | or should i use microsoft office for that |
| 21:05 | tuft | hah |
| 21:07 | xeqi | I think the swiss-arrows library gives you fish and lollipops |
| 21:07 | small-chimp | but |
| 21:08 | amalloy | i don't use or like swiss arrows, but the trystero furcula sounds undeniably like a magical artifact |
| 21:09 | small-chimp | how can i import winsock.dll and use telephony netowork with my clojure project in windows 95 |
| 21:09 | JCvex | Is anyone familiar with creating a lein uberjar and calling it from a hadoop or java command line? I run uberjar but I don't see the main class in the file. I've added the :main and :aot in the project.clj and I also have (ns project.name (:gen-class :name project.name)) in the name.clj as well as a (defn -main []) |
| 21:10 | small-chimp | is lein midje good for a newbie |
| 21:11 | dbasch | JCvex: if you’re doing all that then it should work, can you paste your project.clj somewhere? |
| 21:11 | JCvex | sure... where? |
| 21:11 | small-chimp | i am so anygry because of functional programming i like much more languages like lisp and c which are not functional |
| 21:11 | dbasch | ~refheap |
| 21:11 | clojurebot | https://www.refheap.com/ |
| 21:13 | tuft | turns out datomic has missing? now =) |
| 21:13 | JCvex | done |
| 21:14 | small-chimp | MICROSOFT BINDER IS GREAT APPLICATION |
| 21:14 | dbasch | JCvex: ok, can you share it with us? |
| 21:15 | JCvex | https://www.refheap.com/91137 |
| 21:16 | JCvex | I'm trying to call this from bin/hadoop but regardless I keep getting of that I keep getting a missing main class error |
| 21:17 | dbasch | JCvex: if you type java -jar youruberjar.jar what happens? |
| 21:17 | xeqi | JCvex: whats the :gen-class line look like in hdfshelloworld.core? |
| 21:18 | small-chimp | MICROSOFT WINDOWS IS GOOD |
| 21:18 | JCvex | (:gen-class :name hdfshelloworld.core) |
| 21:20 | JCvex | if I type java -jar... I get a Exception in thread "main" java.lang.ClassNotFoundException: hdfshelloworld.core |
| 21:20 | dbasch | JCvex: you don’t need :name, it could be just (:gen-class) |
| 21:20 | xeqi | JCvex: I'd remove the ":name hdfshelloworld.core" part |
| 21:20 | JCvex | yea.. I tried that |
| 21:20 | JCvex | still doesn't make the right .class file |
| 21:21 | JCvex | creates and core__init.class |
| 21:21 | dbasch | then build the uberjar, and uncompress it to check that the class is there |
| 21:21 | JCvex | it's not |
| 21:21 | xeqi | what version of lein? |
| 21:21 | dbasch | e.g. jar tvf youruberjar |grep hdfshelloworld.core |
| 21:21 | JCvex | dbasch: lein 2.4.2 |
| 21:22 | dbasch | and it’s (ns hdfshelloworld.core … )? |
| 21:22 | JCvex | yup |
| 21:22 | JCvex | ... I'll be back online later.. getting kicked out from cafe. :-/ |
| 21:23 | JCvex | thanks |
| 22:04 | devn | best way to split a coll into two colls based on pred? ex: [1 2 3 4] => even? => [[2 4] [1 3]] |
| 22:06 | technomancy | separate |
| 22:06 | technomancy | from clojure.contrib.seq-utils |
| 22:06 | technomancy | I ... I'll see myself out |
| 22:06 | technomancy | (hint: use juxt) |
| 22:06 | justin_smith | devn: ,((juxt true false) (group-by even? [1 2 3 4])) |
| 22:06 | justin_smith | ,((juxt true false) (group-by even? [1 2 3 4])) |
| 22:06 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn> |
| 22:07 | justin_smith | ,(map (group-by even? [1 2 3 4]) [true false]) ; almost |
| 22:07 | clojurebot | ([2 4] [1 3]) |
| 22:09 | TEttinger | ,(juxt #(filter even? %) #(filter odd? %) [1 2 3 4]) |
| 22:09 | clojurebot | #<core$juxt$fn__4309 clojure.core$juxt$fn__4309@1e6cda2> |
| 22:09 | TEttinger | haha |
| 22:09 | TEttinger | ,((juxt #(filter even? %) #(filter odd? %)) [1 2 3 4]) |
| 22:09 | clojurebot | [(2 4) (1 3)] |
| 22:26 | devn | TEttinger: nono, i needed the more generic version |
| 22:26 | devn | justin_smith: why did you say almost? that's what i was after |
| 22:26 | TEttinger | it didn't use juxt |
| 22:26 | TEttinger | we were all trying to decipher technomancy's comment |
| 22:27 | Atlanis | question about core.async: i'm pulling down a bunch of data from a rest API that is paginated. I want to end up with all of the data on the same channel for me to consume at will locally. should I have the http calls put the data onto the channel directly or have them return channels which are combined using mix/admix (or maybe something else)? |
| 22:36 | gtk_ | back when clojure-test-mode was a thing, I used to clojure-jump-to-test a lot |
| 22:36 | gtk_ | is there an equivalent in the cider 0.7.0 testing that replaces clojure-test-mode? |
| 22:39 | gtk_ | maybe it should all be done from the Test Report |
| 22:39 | Atlanis | gtk_: don't have something handy to test this with, but look at cider-test-jump. docstring for it is unclear (or im not familiar enough with it) |
| 22:54 | danneu | Can someone point out why (js->clj x {:keywordize-keys true}) doesn't work but (js->clj x :keywordize-keys true) works given the source code? Demo: https://www.refheap.com/91142 |
| 22:54 | danneu | Source: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L8359-L8389 |
| 22:55 | danneu | Especially since js->clj arity-1 impl is `(js->clj x {:keyowrdize-keys false})` |
| 23:02 | justin_smith | danneu: it takes varargs, and then shoved them into a map on line 8368 |
| 23:02 | justin_smith | I think |
| 23:03 | danneu | rofl |
| 23:06 | justin_smith | I mean that is what (apply array-map opts) does |
| 23:06 | danneu | how does the arity-1 impl work then? |
| 23:07 | danneu | i bet it doesn't and it's just nil |
| 23:08 | justin_smith | hmm, that's weird, yeah |
| 23:08 | justin_smith | ,(apply array-map '({:x true})) |
| 23:08 | clojurebot | #<ArrayIndexOutOfBoundsException java.lang.ArrayIndexOutOfBoundsException: 1> |
| 23:08 | justin_smith | yeah, that's what it should do for that one arg case :P |
| 23:10 | justin_smith | unless x doesn't satisfy IEncodeClojure, but I don't see what classes satsify that |
| 23:54 | devn | What do people do in this scenario: You're gonna call first on something I'm handing you, because you literally just want the one thing inside of it, but you don't know if I'm going to pass you nil, empty coll, or [1 2]. If I pass you anything except [1], which is all you'd ever expect, what do you do? |
| 23:55 | devn | Would you throw on anything that isn't [1], or...? |
| 23:58 | devn | like: ,(filter #(= "3df4cbf" (:id %)) [{:id "3df4cbf"} {:id "foo"}]) |
| 23:58 | devn | ,(filter #(= "3df4cbf" (:id %)) [{:id "qqq"} {:id "foo"}]) |
| 23:58 | clojurebot | () |
| 23:58 | devn | ,(first (filter #(= "3df4cbf" (:id %)) [{:id "qqq"} {:id "foo"}])) |
| 23:58 | clojurebot | nil |
| 23:59 | JCvex | Hi... I had to step out... could anyone help? |