#clojure logs

2014-10-03

00:00handojinnow FUBAR
00:00handojin:(
00:00justin_smiththat sucks
00:00justin_smiththe 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:01TEttingerI had similar issues with lighttable, none with nightcode
00:01handojinwell - i've kind of invested some time in emacs so i want this relationship to work
00:02handojin:P
00:02TEttingerit's understandable :)
00:02justin_smithhandojin: sounds like you and emacs need to spend some time with M-x eliza for some couples councelling :)
00:02handojinwhy do you say that?
00:02justin_smithsorry, bad pun about "wanting the relationship to work"
00:03justin_smithand I should have said M-x doctor
00:03justin_smithwhich runs the eliza algorithm
00:03handojindo you want to make the relationship work?
00:03justin_smithrofl
00:03handojin<- runs it too
00:04handojinok, time to die
00:07mdeboardlighttable and nightcode?
00:07mdeboardhuh
00:07mdeboardCursive is pretty good, still has plenty of rough spots
00:09TEttingernightcode is a lot smaller than, say, eclipse or IntelliJ, so there's less I need to worry about going wrong :)
00:09TEttingerand it's very closely integrated with lein, which is nice
00:09mdeboardintellij really, like, I am not an IDE person at all. emacs til i die, but intellij is really good
00:10cfleming(inc mdeboard)
00:10lazybot⇒ 9
00:11handojinprelude-update-packages & lein upgrade and I'm back in business
00:13handojinstill on 0.7.0-snapshot though
00:17cflemingIs anyone here using piggieback?
00:18mdeboardyeah
00:18mdeboardwell, not directly
00:18mdeboardbut via figwheel
00:18cflemingOk, do you know if there's a setting in project.clj that controls where it writes out generated js?
00:18cflemingDoes it even write the generated js to disk?
00:18mdeboardthere definitely is
00:19mdeboardi don't thin kit has to do with piggieback tho
00:19cflemingI can't find it in the doc anywhere or find an example.
00:19mdeboardsec
00:20mdeboardcfleming: https://gist.github.com/mattdeboard/744d597fa5d155d4d94f
00:20mdeboardctrl-f :compiler
00:20cflemingSo piggieback just uses the cljsbuild settings?
00:20mdeboardyeah I think so
00:21cflemingSomeone told me they had generated js being written somewhere else.
00:21mdeboardbut i have no idea for sure
00:21cflemingOk, thanks.
00:21mdeboardi prob misunderstod your question on further reflectin
00:22cflemingNo, 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:22cflemingI assumed there would be a project.clj setting to control where that went.
00:26arrdemidle musing... would y'all think Grimoire's PR based contribution process is better or worse than clojuredocs?
00:29cflemingarrdem: I'd say it's pretty difficult to beat reading the docs, clicking a link and entering your example.
00:30cflemingarrdem: 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:30cflemingarrdem: It seems less API-friendly too.
00:31arrdemcfleming: 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:31arrdemcfleming: but it does take you somewhere else to submit a (trivial) PR
00:31cflemingarrdem: Ah, ok - that sounds better then. I must admit I haven't tried it
00:32arrdemshowing source not examples by default is a mistake..
00:32cflemingarrdem: I think that's ok. Are the results displayed right away or after some batch process?
00:32arrdemcfleming: there is no DB lookup here, it just stats directories.
00:32cflemingarrdem: And could you create an API to allow tools to provide "Upload example to Grimoire" functionality?
00:33mdeboardweb scale
00:33arrdemcfleming: defeats the point of having the entire datastore in git IMO
00:33arrdemmdeboard: filesystems are indeed web scale
00:33mdeboardi wasn't being sarcastic
00:33cflemingarrdem: Ok, cool - so it's pushed right to the prod repo? That sounds ok then.
00:33mdeboard:P
00:34cflemingarrdem: I do like the idea of all the content being available in a git repo.
00:35arrdemcfleming: 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:35arrdembut that's a lot of ... thinking to make a good spec
00:35TEttingerarrdem, needs more xml
00:36arrdemTEttinger: quiet in the peanut galery
00:36TEttingerI saw that!
00:36TEttingerit's so awful
00:36arrdemI would almost work for IBM because of their SPARK stuff.
00:36arrdembut shit like that is painful
00:36cflemingarrdem: That would be nice - I'll need something like that to show the Cursive API docs if I ever release it.
00:37cflemingSeriously
00:37arrdemI should write a Clojure datastructure to filesystem serializer/deserializer
00:40mdeboardwhat do you mean "to filesystem"
00:40kristofHe means a data serialization format.
00:41mdeboardthere's so many already
00:41mdeboardinsert xkcd about competing standards
00:41arrdemmdeboard: 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:42arrdemmdeboard: the point is that it's a reasonable WYSIWYG and GIT managable structure, unlike say a JSON encoded blob of the same data
00:42arrdemor even an XML blob of the same data
00:43mdeboardoh
00:43mdeboardhuh
00:43mdeboardthat's interesting
00:44arrdemit's all just files maaaaaaaan
00:44cflemingAnd you've even partitioned your data - truly web scale!
00:44arrdemrofl
00:45arrdemhttps://github.com/grimradical/clj-semver
00:45arrdemproof that Clojure code can survive bit rot
00:46arrdemalmost unchanged since 1.3
00:46cflemingarrdem: Amazingly, that is actually something I need soon - thanks!
00:47arrdemcfleming: :D I was gonna just write one... then I read that one and it was perfect
00:47cflemingThe irony of it being a snapshot release is not lost either
00:47arrdemyeah... the "eh it's a stable snapshot" thing seems pretty common
00:47mdeboardlol
00:53mdeboardarrdem: I feel like the serialization thing you mentioned would get unwieldy quick
00:53arrdemmdeboard: how so?
00:54arrdemmdeboard: you can totally slurp it into a DB if you want... the point is that it's a WYSIWYG intermediary store/exchange standard
00:54sir_pineconehey 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:55mdeboardyou'd hav eto do some really start structure sharing or it'd get nuts
00:55mdeboardat some point it'd just coalesce into an inverted index or something
00:55mdeboardodds are basically 1:1 I'm talking out of my ass
00:55arrdemmdeboard: 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:56arrdembut I really just have a DB in a FS, not an arbitrary datastructure
00:57mdeboardyeah i'm down with the idea in general
00:57mdeboardi've fantasiezd about replacing mongodb with flat files
00:57mdeboardbut who has the time
00:57arrdemlol
00:58arrdemhttps://github.com/ibdknox/simpledb
00:58mdeboardpretty much every uh
00:58arrdemplease don't actually use that for anything
00:58arrdembut I have
00:58mdeboardperson i've talked to ince moiving here has the same "i used mongodb " horror tostry
00:58mdeboardWow
00:58mdeboardNice typing
00:58arrdemworks juuuuust fine when you really just need a temporary "dev" datastore
00:58mdeboardhorror story*
00:59cflemingsir_pinecone: No, you can't do that - namespaces are not first-class objects you can pass around
01:00sir_pineconecfleming: ok, thank you
01:00arrdemsimpledb would actually work really well for another project I have in mind...
01:00mdeboardjust no
01:00mdeboardlol
01:00mdeboardpostgres all day
01:00arrdemdatastores are all too much work
01:01mdeboardpfft
01:01mdeboardso easy nowadays
01:03dbaschSomeone should create RRDB: Russian Roulette DB
01:04mdeboardthey did, it's called "MongoDB under network partition"
01:04arrdemdbasch: 1/6 chance to not actually persist your data?
01:04dbaschI was thinking more like 1e-6 every second
01:04mdeboardalso pretty sure what's his face's Jepsen series of blog posts show they're all RRDBs
01:04dbaschyes, I mean on purpose. Make it a feature.
01:05mdeboardlol
01:05joshuafcolemarket it as a "Probabilistic Data Store"
01:05mdeboardI ... think that is a thing already
01:05joshuafcoleit'll be all the rage in the big data secor
01:05joshuafcolesector*
01:05dbaschIt’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:05arrdemlolwut
01:06metellusRRDB solves cache invalidation
01:06joshuafcoleon average, anyway
01:06arrdemmetellus: but only for problems where serving old data is OK
01:06dbaschRRDB is good for startups, because they have greater risks already
01:06arrdemmetellus: turns out not to work for CPU caches
01:07metellusdarn
01:07joshuafcolealthough
01:07joshuafcoleif you combine it with probabilistic registers
01:07joshuafcoleyou probably couldn't tell the difference
01:07arrdemjoshuafcole: now you have a machine that's worthless. actually.
01:07joshuafcoleRRReg
01:07joshuafcoleNah, see
01:07joshuafcolebecause you hook it up to another, regular computer
01:08joshuafcoleand that regular computer in turn
01:08joshuafcolechecks all of it's computations the normal way, however long that takes
01:08joshuafcoleand if it detects an incorrect answer
01:08joshuafcoleit detonates the nuclear warhead it's connected to
01:08joshuafcoleThen, using quantum immortality, you're golden
01:08joshuafcolehell, you can even implement all of your ops as single cycle randoms
01:09mdeboardwell
01:09arrdemjoshuafcole: you have to destroy the universe. a simple nuke won't do ot
01:09arrdem*it
01:09mdeboardaccording to quantum physics there's a non-zero probability it's already happened
01:09joshuafcolearrdem: No? I thought quantum immortality applied individually
01:09joshuafcoleso so long as you sat next to the machine
01:09joshuafcolefor however long it would take
01:09joshuafcolefor *your* universe, call it U', the machines output should always be valid right?
01:10arrdempretty sure in this universe you can in fact nuke yourself
01:10joshuafcolehowever, for people outside the blast radius it probably wouldn't work very well
01:10joshuafcoleI'd try it to prove you wrong if quantum immortality didn't seem like obvious quackery.
01:10joshuafcole:P
01:11joshuafcoleU_1: "Hah arrdem: I told you so!" "What are you talking about?"
01:11joshuafcoleU_2: "In other news, San Francisco detonated in a completely out of the blue nuclear explosion this morning..."
01:11mdeboardthis is a #emacs quality conversation
01:12arrdemlol mdeboard
01:12joshuafcoleM-x rely-on-quantum-immortality really improves startup times
01:12mdeboardto be fair #emacs is my favorite channel
01:12joshuafcole(inc mdeboard)
01:12lazybot⇒ 10
01:13arrdemsomeone give me a schema for a documentation datastore that houses symbols, namespaces and classes
01:13arrdemI've got a bunch of ideas but none of them seem sane
01:18joshuafcolearddem: namespace = db (nestable) classes = collections (+ a global collection for stuff outside classes), symbols = rows?
01:19joshuafcolethe real trick is making it import from existing sources just as javadocs
01:19mdeboardHold-My-Beer-driven development
01:20arrdemhey i'll take M-x hold-my-beer RET HACKING over M-x ponder RET heat-death RET
01:21arrdemis there a javadocs engine for Clojure...?
01:21joshuafcolehard to argue with that
01:22arrdemhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/java/javadoc.clj
01:22arrdemwhy is this shit in core...
01:22joshuafcolewith hardcoded urls and subdomains
01:23joshuafcoleI like it
01:23mdeboardfutureproof
01:23arrdemone of these days I'm gonna have a beer
01:23arrdemand fork Clojure
01:23mdeboardthat's a good project name
01:23arrdemmdeboard: rofl
01:23dbasch&(clojure.java.javadoc/javadoc "wtf")
01:23lazybotjava.lang.ClassNotFoundException: clojure.java.javadoc
01:24arrdem&(require 'clojure.java.javadoc)
01:24lazybotjava.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.specification.version" "read")
01:25dbaschI want to add transmorphers to clojure
01:25arrdemhttp://www.imdb.com/title/tt0960835/
01:26arrdemdbasch: you only get to do that if you're rhicky
01:26mdeboardtransmorphers? LOL
01:26mdeboardI'm working on a teledildonics library
01:26mdeboardbased on some really advanced research
01:26joshuafcolewhile we're adding transformers, can we please get dinobot into core?
01:26mdeboardGRIMLOCK SMASH
01:27arrdemI would get a beer
01:27arrdemand late-night #clojure with yall
01:27arrdembut I have class in the morning
01:27arrdemT_T
01:27joshuafcoleheh
01:27mdeboardmy cat has a vet appointment, so
01:27joshuafcolewell, goodnight all
01:28joshuafcolemaybe now I'll get some code written. :)
01:46a13xis there a way to make `lein run` exit after a standalone app ends? thanks
01:47jeremyheilera13x: what's keeping it alive?
01:48arrdema13x: add (shutdown-agents) to the end of your -main?
01:48a13xjeremyheiler: I'm not really sure... in -main I do have a println that is reached but then the JVM continues to run
01:49dbascha13x: do you have any other threads running? What if you explicitly add a System/exit after the println?
01:49a13xarrdem: I see no changes with shutdown-agents
01:51arrdemI should torrent iron sky one of these days...
01:51arrdemthinking of bad movies
01:52a13xSystem/exit works... but I'd like to understand why the app continues to run
01:52jeremyheilerare you using futures, agents, threads?
01:53dbascha13x: any code you can share (via refheap / gist / pastebin)?
01:53dbaschyou may be using a library that launches its own threads
01:54mdeboardcutting edge teledildonic technology
01:54a13xhttp://pastebin.com/2D8h96Mb
01:55a13xdbasch 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:56jeremyheilera13x: as a side note, you're not invoking the destroy function
01:57a13xjeremyheiler right (still that's not the cause :)
01:58jeremyheileri know
02:01a13xok... I see more threads that I expected, so I guess twitter-api lib is spawning
02:02dysfunis there a leiningen plugin for running ant tasks?
02:03arrdem$google lein ant
02:03lazybot[Leiningen Versus the Ants - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Leiningen_Versus_the_Ants
02:03dysfuni did
02:03dysfuni get a lot of that, even if i put 'clojure' in
02:03dysfunit's all very clever and everything, but it's not helpful :(
02:04a13xfound it https://github.com/adamwynne/twitter-api/issues/6
02:05dbaschdysfun: leiningen is a build tool that pretty much everyone here uses, because it’s the most convenient way to manage dependencies
02:06dbaschI’d say it’s probably one of the main drivers behind clojure’s adoption at this point
02:06dysfunyes, i understand lein is brilliant, but i also want to build something java that's only buildable with ant
02:06dysfun(javafx)
02:06dbaschoh, I misunderstood your question
02:07a13xI was looking earlier today for something similar... a way to run custom build steps
02:08a13xI 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:09a13xin 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:09dysfunyou can exclude them in your deps
02:11dysfunhttps://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L48
02:16a13xthanks dysfun. I'll try that once I get back to that
02:34gtmacdonaldHi 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:36crocketIs clojure suitable for running a CMS?
03:37crocketIt runs on JVM which might not be a suitable execution environment for a CMS.
03:37arrdemlolwut
03:37crocketCMS means content management system like wordpress.
03:37crocketI think nodejs is a better execution environment for a CMS.
03:38crocketmaybe not
03:54avishaihi all
03:55avishaii have a problem with midje prerequisites
03:55avishaii get java.lang.ClassCastException: clojure.lang.AFunction$1 cannot be cast to clojure.lang.IFn$OLO
03:55avishaiwhen trying to stub a function with type hinting
04:00crocketDoes clojure come with sane exceptions?
04:01crocketJava exceptions drive you insane.
04:01arrdemfuck off chare
04:04domokatodoes creating a transient do anything for me if I'm only performing one mutation?
04:05arrdemdomokato: no
04:05domokatokthx
04:05arrdems/no/almost certainly not, benchmark it yourself/g
04:06domokatojust trying to understand what they're for
04:06domokatoi think i get it now
04:11domokatoman, 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:12domokatoi had to start using .isEmpty and i wrote a "foreach" macro with similar syntax to doseq but operates on java Lists
04:12domokatoand had to use the primitive-math lib to prevent boxing
04:15pepijndevosdomokato, sounds like fun
04:16borkdudegood morning
04:16domokatopepijndevos: actually kinda was. learned a lot about the implementation of clojure in the process. so many allocations everywhere tho...
04:17domokatoit would be nice if the compiler was smart enough to remove unnecessary allocations if the invocation doesn't need them
04:18arrdemthe JVM has no way to express that concept.
04:18arrdemunless you manually implement instance recycling somehow
04:20domokatoyeah, i think that would work too. object pools maybe
04:20arrdemwhy. most JVMs will do generationed (memory pooled) GC anyway
04:21domokatowhat does that mean?
04:22arrdemJVM 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:22arrdemso short lived allocations will go in one frequently collected pool, intermediary and long lived objects get their own pools
04:22arrdemultra-short term objects may be optimized out altogether depending on the JIT.
04:23domokatohm, but the GC still has to pause the process and run occassionally?
04:23arrdemsure, but that's relatively cheap and you're amortizing it by minimizing the scope over which it needs to run
04:25kyrreHow can I declare that a method returns ArrayList<String> ? (gen-class)
04:25domokatonot so cheap if it causes stuttering in a skill-based game
04:26arrdemkyrre: 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:26domokatobut maybe if i limit the frame rate the gc will be smart enough to run when all the threads are asleep
04:26arrdemkyrre: consequently you aren't really -> ArrayList<String>, you're -> ArrayList
04:27arrdemkyrre: that's what ArrayList<String> becomes if you write it in Java anyway
04:28kyrremhm, that makes sense
04:31domokatoanyway, thanks for the discussion. gnite
04:42domokatohm, looks like dalvik (android) uses mark and sweep anyway
04:47domokatoooo, except ART (upcoming android JVM) looks like it uses concurrent gc. should help
04:52mercwithamouthhmm so what should be my expectations of SICP? What do you all get out of this book?
04:55arrdemtotally 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:56mercwithamouthok, fair enough
04:56arrdemthe 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:56mercwithamouththat's about where i am =P
04:57arrdem=P in fairness SCIP was my breakfast time reading for a semester...
04:58mercwithamouthahh 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:58arrdemif you arlready grock FP I wouldn't expect to get much out of it
04:58mercwithamouthno i'm fairly new
04:58arrdemit really is like a freshman/sophomore level CS textbook in scheme by The Scheme Guyts
04:58arrdem*Guys
04:59mercwithamouthgotcha. i'll work through it over time then
04:59arrdem$seen rubygeek
04:59lazybotrubygeek was last seen quitting 17 hours and 6 minutes ago.
04:59mercwithamouth^ learn something new every day
04:59arrdem^^ he has my SCIP copy :P
04:59mercwithamouthlol
05:11amalloyarrdem: it's grok, by the way, no C. you should read stranger in a strange land - it's a classic
05:32hyPiRionbbloom_: no, I didn't find anything obvious sadly
06:02borkdudeawesome: https://github.com/wit-ai/duckling
06:13borkdudevijaykiran I just registered #clojure.nl
06:19vijaykiranborkdude: ? channel ?
06:20borkdudevijaykiran yes, channel
06:27borkdudecfleming 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:28cflemingborkdude: 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:28borkdude:-D
06:28borkdudecfleming will the conj videos be available for streaming?
06:29cflemingborkdude: I assume so, they usually are.
06:29borkdudekewl
06:51vijaykiranborkdude: :) cool - I guess I need to brush-up on dutch then
06:56dysfunis 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:00borkdudedysfun maybe look at jvm break glass
07:00borkdudedysfun for inspiration
07:01dysfunhrm, interesting
07:10cflemingdysfun: You want to start a REPL server? Sure, the nREPL page has details on how to do that.
07:28dysfunoh brilliant, thanks
08:00justin_smitharrdem: 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:29borkdudecfleming when typing a docstring with a function, can I indent the "paragraph" to keep within 80 cols, like in emacs?
08:29cflemingborkdude: No, there's nothing like that right now sorry. IntelliJ has a "Fill paragraph" but it never works for me.
08:58borkdudecfleming I would like to attach a debugger to lein test, is that possible with cursive?
09:02justin_smithborkdude: 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:02borkdudejustin_smith I know
09:02justin_smithand of course there is clojure.test/run-tests for proper running of all tests in an ns with their fixtures
09:02justin_smithOK
09:06borkdudeI think with a "leiningen" run configuration it could work
09:51borkdudecfleming another feature: when cursor is on fully qualified symbol, offer to add a require + refer
10:19chitofanhas anybody used clojure for developing embedded software?
10:24lavokad:vs
10:25IllusioneerIs anybody familiar with nginx-clojure?
10:28justin_smithIllusioneer: it's weird, just use nginx as a reverse proxy
10:29justin_smithmaybe try it if you find that per-request-overhead is your bottleneck. It probably won't be though.
10:30Illusioneerjustin_smith: not even gotten nearly that far but is that an issue with it?
10:30justin_smiththe improvement you would hypothetically get is less overhead per request since it is not proxying but clojure is in process
10:31justin_smithin return, deployment is more complex
10:31tvanhensis there a way to do a reduce and?
10:31justin_smitheasier to make an uberjar, run it, and reverse proxy
10:31Illusioneermore complex? Id have thought that would simplify it
10:31justin_smithdeploying clojure is really easy
10:32tvanhensI 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:32justin_smith,(every? even [0 2 4 6])
10:32clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: even in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:32justin_smith,(every? even? [0 2 4 6])
10:32clojurebottrue
10:33tvanhensevery thats what I was looking for thanks
10:36edw`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:37gfredericksedw: for can flatten further with another clause
10:37gfredericksfor is flatteningest
10:39gfredericks,(for [x (range 5) y (range x)] [x y])
10:39clojurebot([1 0] [2 0] [2 1] [3 0] [3 1] ...)
10:39mdeboard->> is gorgeous tbh
10:39mdeboardyou're missing out
10:40mdeboardi miss threadng macros in all the work I do
10:41legittalonwait. ->> is different from ->?
10:41mdeboardyes
10:42mdeboard&(-> 1 (+ 2))
10:42lazybot⇒ 3
10:42mdeboard&(-> 1 (- 2))
10:42lazybot⇒ -1
10:42mdeboard&(->> 1 (- 2))
10:42lazybot⇒ 1
10:43legittalon&(->> (-2) 1)
10:43lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
10:43gfredericks&(-2)
10:43lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
10:43legittalonI'm such a noob.
10:44justin_smithlegittalon: pretty much everything is a valid constituent of a symbol in clojure, so use whitespace to separate functions from arguments
10:45justin_smith,(let [<-? 2 *_' 3] (+ <-? (* <-? *_')))
10:45clojurebot8
10:46razum2umis there any way to make it more concise https://gist.github.com/razum2um/dc78032ef76778ac6a38 ?
10:47justin_smithby shortening the function name? :)
10:47Bronsarazum2um: (zipmap (map (partial apply f) xs) xs)
10:47razum2umBronsa: thx
10:47mdeboardtransducers
10:47mdeboardI think
10:47Bronsamdeboard: uh? how would they help?
10:48mdeboardI have no idea
10:48mdeboardI just wanted to sound smart, I guess it backfired
10:48justin_smith (into {} (map (juxt #(apply f %) identity) xs))
10:49justin_smitherr, swap the order on the identity and the #() of course
10:49mdeboard&(doc zipmap)
10:49lazybot⇒ "([keys vals]); Returns a map with the keys mapped to the corresponding vals."
10:50mdeboardwhat's the diff between (partial apply f) and #(apply f %)
10:50mdeboardthere
10:50justin_smiththe zipmap version has to walk the input twice (not a huge deal of course, but always feels a bit less than ideal)
10:50mdeboardBronsa:
10:50Bronsamdeboard: none
10:50justin_smithpartial creates a varargs fn, #() does not
10:50justin_smithit's a small difference
10:50Bronsajustin_smith: your version too, once for map, the second time for into
10:50justin_smithahh, you are right :)
10:50gfredericks#() creates another damn class, partial does not
10:51mdeboardhuh
10:51mdeboardtoday I learned, interesting
10:51mdeboardwhy is that bad
10:51mdeboardI'm sure that's a dumb question but..
10:51gfredericksit might not be :)
10:51gfredericksit makes stack traces easier actually
10:51mdeboardoh
10:51mdeboardyou damned the notion of creating another class
10:52mdeboardI figured it was objectively bad
10:52Bronsahe was just being overly dramatic
10:52gfredericksthe communication method language is the difficulty level hard
10:52mdeboardwat
10:52mdeboarddid I have a stroke
10:52justin_smith (persistent! (reduce (fn [m v] (assoc! m v (apply f v))) (trainsent {}) xs))
10:53edwmdeboard: I have nothing against threading; I love it. But a two element threading form is ugly IMO.
10:53mdeboardedw: fair
10:53edwgfredericks: Ah, good point.
10:54justin_smithmy last is no longer more concise, but it only walks the input once
10:54Bronsa,(defn trainsent [coll] (println "chuff"))
10:54clojurebot#'sandbox/trainsent
10:54justin_smithheh
10:54mdeboardlol
10:54justin_smithgood catch on the typo, I need my coffee
10:54justin_smith(inc Bronsa)
10:54lazybot⇒ 51
10:54mdeboard&(doc trainsent?)
10:54lazybotjava.lang.RuntimeException: Unable to resolve var: trainsent? in this context
10:55justin_smiththe train sent my coffee that I have not yet consumed. Thanks Thomas!
10:55Bronsajustin_smith: I use that idiom all the time for building maps, I don't think there's a faster way to do it
10:56mdeboardwhich idiom is that
10:56mdeboardjustin_smith's original?
10:56mdeboardor the trainsent gambit
10:56Bronsareduce+assoc! w/ (transient {}) as init
10:56mdeboardah
10:56justin_smithtransient transient transient (too much more of that typo and it will become infections)
10:57mdeboardI love it
10:57mdeboardIt almost sounds like a technical term
10:57mdeboardThe trainsent pattern
10:57justin_smithheh
10:58mdeboardI'll give up the ghost, though.
10:58mdeboardI'm just stalling before I have to dive into work
10:58justin_smithmock all you want, I just have to make sure I don't imprint mentally on the misspelling :)
10:58gfredericksjustin_smith: Bronsa: that's plumbing.core/map-from-keys I think
10:59Bronsadunno, I don't get to use any utils library because of contribs :<
10:59gfredericksoh noes
10:59justin_smithgfredericks: looks like it
10:59gfredericksBronsa: just rhickey's util library (clojure.core)
10:59justin_smithgfredericks: adding plumbing to my "util libraries" category
11:00Bronsagfredericks: heh yeah
11:00justin_smithsoon we will need a "all the utils" meta lib
11:00gfredericksjustin_smith: it's the one I settled on
11:00gfredericksthe included graph stuff is pretty useful for certain things too
11:01justin_smithlooking at that now
11:01justin_smithhttp://blog.getprismatic.com/prismatics-graph-at-strange-loop/
11:01Bronsahttps://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.cljx#L35-L39 this is kinda ugly
11:01justin_smithwoah
11:02justin_smithyeah I take back that "it's basically the same"
11:02BronsaI guess they had to do it that way to avoid rewriting the for/doseq syntax
11:02Bronsa(:let/:when etc)
11:03gfredericksah right I bet that was the point
11:04justin_smithcould have used an array of length one instead of an atom
11:05justin_smithwhether that's better or worse...
11:05gfrederickswould be interesting to compare the speed
11:05gfredericksI can't think of any downside; they're just using reset! anyhow
11:05Bronsaone 1.7 is out we get volatiles for that
11:05justin_smithnot any different semantics wise
11:06justin_smithand it's in a safe lexical env anyway
11:06justin_smithBronsa: yeah, exactly
11:06gfredericksthe entire use case for volatiles is such local enhancements?
11:06justin_smithhell, the let bindings inside the doseq could safely be one element arrays / volatiles defined outside the doseq
11:07Bronsagfredericks: yes
11:07gfrederickslike transients but for reference types?
11:07zotnewb 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:07Bronsagfredericks: they were introduced to replace atoms for the mutable state inside transducers
11:07Bronsahttp://dev.clojure.org/jira/browse/CLJ-1512
11:07gfredericksBronsa: yeah I know how they came up; just trying to figure out what else they might be used for
11:08Bronsaand I will keep complaining till the end of days about vswap! being a macro.
11:08gfrederickswhy?
11:08clojurebotbecause that's not how macros work
11:08gfredericksO_O
11:08gfredericksclojurebot: you are eerie
11:08clojurebotNo entiendo
11:08justin_smithzot: seems like a job for reduce-kv
11:08justin_smith(doc reduce-kv)
11:08clojurebot"([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:08zotthat sounds like exactly what i would want!
11:09zotjustin_smith: tnx :)
11:09gfrederickszot: justin_smith: what? I thought this was just map-from-keys as described above?
11:09Bronsagfredericks: because there is no good reason why it couldn't be a function
11:09gfredericksBronsa: oh with :inline stuff?
11:09Bronsayes
11:09tim___Bronsa, well it could have :inline, but that stuff is pretty buggy apparently.
11:10Bronsatbaldridge: no it isn't
11:10zothrm. yes as i read ths descr (came after typing) i think it's not quite it
11:10gfredericksBronsa: probably you're a weirdo if you need it to be a function :P
11:10zoti mean, i can use assoc as the top level of the inner func, but i wonder if there's something tighter
11:10gfrederickszot: there was code given above for map-from-keys, which is in plumbing if you like util libs
11:10tbaldridgeBronsa: http://dev.clojure.org/jira/browse/CLJ-1227 ?
11:11Bronsatbaldridge: 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:11justin_smith,(reduce-kv (fn [m k v] (assoc m k (inc v))) {} {:a 0 :b 1 :c 2}) ; zot
11:11clojurebot{:a 1, :b 2, :c 3}
11:12Bronsatbaldridge: even if the bug was in definline, that would have only affected definlines, manual :inline was never broken
11:12justin_smithor you could map over it and use what we were talking about above
11:12Bronsatbaldridge: if you scroll at the end of that ticket there's the fn munging ticket linked that solves it btw
11:12justin_smithzot: oh, never mind, misread your question - you don't have a map coming in, just the keys
11:13justin_smithzot: which means gfredericks was right, it's exactly the function we were just talking about at length
11:13zotyeah, it's an actual set (or could be a list/vector, but currently a set)
11:13tbaldridgeBronsa: from what I understand, :inline would be superseded by this: http://dev.clojure.org/display/design/Inlined+code
11:13Bronsatbaldridge: right, but that doesn't exist yet :)
11:13tbaldridgeBronsa: just saying, I could imagine it changing to a function at some point.
11:14justin_smithzot: (persistent! (reduce (fn [m v] (assoc! m v (apply f v))) (transient {}) xs))
11:14justin_smithf and xs are your function and your set
11:14Bronsatbaldridge: sure, I'd like it if you were right
11:17zotjustin_smith/gfredericks: tnx :)
11:20squidzdoes anybody know a good way to shift an entry in a collection left or right like (shift coll el :left)
11:21moduluswhen 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:22modulusany idea how to fix?
11:22justin_smithit won't recognize literal vectors?
11:22modulusit won't recognise the character
11:22squidzlike (shift [{:id 0} {:id 1} {:id 2}] 1 :right) >>> [{:id 0} {:id 2} {:id 1}]
11:22modulusit refuses to register it
11:24squidzor (shift [{:id 0} {:id 1} {:id 2}] 1 :left) >>> [{:id 1} {:id 0} {:id 2}]
11:24gfredericksmodulus: so if you type (first [1 2 3]) into your repl, what happens?
11:25modulusit interprets it as (first 2 3)
11:25modulusthe []s don't appear on the text and it doesn't capture the character right after the [
11:25modulusso wrong arity
11:26modulusthis is seriously super-weird, never happened before
11:26gfredericksI feel like nothing I know about clojure is remotely related to this problem
11:27moduluswhat's really strange is that it will correctly read when inside a project
11:27modulushmm let me think, maybe it's running a different version of clojure
11:27gfrederickseasy to check
11:27gfredericks,*clojure-version*
11:27clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
11:29modulusno, 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:29modulushow do i even go about diagnosing this? i don't know where to start
11:30d0kyhello 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:30gfredericksmodulus: windows is probably pretty rare around here, so there might be a scarcity of ideas
11:32technomancymodulus: probably a jline bug related to locale?
11:32justin_smithsquidz: interesting problem, here's my solution https://www.refheap.com/91106
11:32modulusok, i see one distinction
11:33justin_smithsquidz: 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:33moduluson the project i get RPLY-y 0.3.0 while outside i get RPLY-y 0.3.5, nRPL 0.2.6.
11:33moduluscould it be a regression on REPL-y?
11:34justin_smith(inc technomancy)
11:34lazybot⇒ 137
11:34justin_smithyeah jline windows bug is my guess too
11:35FrozenlockSomehow I feel dirty by doing the following... (filter identity [nil nil "string" 13]) ---> ["string" 13]
11:35justin_smithremove nil?
11:35Frozenlockyeah
11:35justin_smith,(remove nil? [nil nil "string" 13])
11:35clojurebot("string" 13)
11:35lvhSo, 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:35justin_smithfunny how the suggestion to use it looks like a verification that is what you are doing?
11:36lvhthat's making it pretty annoying to test my fn
11:36justin_smithheh
11:36Frozenlockjustin_smith: Is it more efficient?
11:36justin_smithreads more straightforwardly
11:36Frozenlocktrue
11:36justin_smithshould be just about identical in performance
11:37justin_smithmaybe faster? easy to micro-benchmark with criterium
11:38Morgawrit returns a list rather than a vector, it looks
11:38justin_smithMorgawr: what does?
11:38Morgawrthe remove nil? vs filter identity
11:38FrozenlockMorgawr: filter/remove always do that
11:39justin_smithboth filter and remove return lazy seqs
11:39Morgawroh nevermind
11:39modulustechnomancy - so any clue what to do about this, if it's jline related as you say?
11:39MorgawrI saw Frozenlock's output and I thought it was the bot's output
11:39Morgawrbecause he wrote [ ]
11:39modulusshould i file a bug against repl-y?
11:39Morgawrignore me then :)
11:39FrozenlockYeah, I wrote it by hand, sorry about that :-p
11:39technomancymodulus: sure. maybe try changing your locale too?
11:39Morgawryou got me confused :P
11:40modulusnot very sure how to do that on win32
11:40moduluser win64
11:41technomancymodulus: hang on, you get a different reply version when running in a project?
11:42technomancysame lein version?
11:42squidzjustin_smith: yeah I see, interesting, never knew abot clojures (reduced function. I wonder if there are other ways
11:42moduluscorrect
11:42modulusyes, same line version
11:42technomancymodulus: reply actually runs inside lein itself, not inside the project
11:42technomancyso I don't understand how that's possible, but I guess it is
11:42technomancyanyway, a bug report is warranted
11:42squidzjustin_smith: how would you implement it if the id's weren't the indexes?
11:43justin_smithsquidz: same
11:43modulushmm let me check something
11:43justin_smithsquidz: I am only using the id for matching, it works for any matching function
11:43modulusmaybe i'm running two different leins due to path issues
11:43justin_smithsquidz: notice I allow any matching function for selecting a swappable element
11:44squidzoh right you get the index by the range, not by the map values
11:44modulusok, when outside the project i was running another lein
11:44modulusunfortunately i believe it's the more modern lein that has this issue
11:45squidzthanks, 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:45justin_smithsquidz: look out for edge cases
11:45justin_smithmaybe check before trying to shift element 0 to the left
11:45justin_smithor trying to shift the rightmost to the right
11:46justin_smithotherwise, you are welcome, it was a fun morning programming puzzle :)
11:46technomancymodulus: reply bugs are like bubbles in wallpaper
11:46justin_smithsquidz: also, maybe return the collection unmodified if position is false
11:46technomancyat least the locale issues are
11:46technomancypush one down and it's just going to pop up somewhere else
11:47squidzyeah i'm modifyfing your version for the edge cases now
11:47Bronsasquidz: I implemented it with zippers http://sprunge.us/YFcD?clj. probably highly inefficient and bugged on the edge cases but fun :P
11:48modulustechnomancy - i see, it's just that this seems a pretty basic input thing
11:48justin_smithinteresting- one of these days I will grok zippers...
11:48modulusand it was working before. anyway i'll file.
11:48Bronsaslightly better http://sprunge.us/MUUB?clj
11:49modulusi mean being able to type brackets is kind of important lol
11:49justin_smithmodulus: sounds like a really anemic version of sweajure - roundjure
11:49justin_smithclojure without vector literals
11:50moduluswhere do i file? googling for reply has ... issues
11:50justin_smithhaha
11:51squidzBronsa: cool, I never thought about using zippers i'll have to take a look and try to understand
11:51modulusyeah, theoretically one could do everything with (vec bla bla bla) i guess.
11:51modulusbut it would get old fast
11:51justin_smithand #() instead of fn / defn
11:51justin_smithlol
11:51modulushah
11:51justin_smithgood luck getting by without let :)
11:52Bronsa#() dont even nest
11:52modulusyes, this does make it unusable really
11:52justin_smithright, but still easier than swearjure
11:52modulusi wonder if i'm the only person using it on win or no-one else noticed or what
11:53borkdudecfleming another nice feature for cursive: warning / special color when calling a function with wrong arity
11:54martinklepschhey. 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:56squidzBronsa: 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:00Bronsasquidz: sure, but zippers are mostly useful for walking nested datastructures, kind of an overkill for your use case I think
12:00squidzokay I see
12:02borkdudecfleming do you want me to put those features to github?
12:03borkdudecfleming requests that is ;)
13:05m1dnightHm, (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:05m1dnightAny ideas?
13:05m1dnightcasting! silly me!
13:10gfredericksare there any util libs that define min/max/>/</>=/<= using clojure.core/compare?
13:11bbloom_gfredericks: i don't think that'd be useful at all b/c you can't parameterize other modules to use those operators
13:11bbloom_minus with-redefs or similar hackery
13:11justin_smithm1dnight: I don't think arrays in java implement the Collection interface
13:12gfredericksbbloom_: why isn't it useful for me to use myself?
13:12bbloom_gfredericks: *shrug* you mean just for the syntax benefit of variadic < instead of explicit compares in your own code?
13:12bbloom_yeah i guess you can do that :-P
13:13gfredericksbbloom_: it's semantic too; calling compare and looking at the sign of the return value is kind of klunky
13:13gfredericksnot to mention error-prone
13:14bbloom_gfredericks: sure, i gotcha. was just saying that it's a bummer the built in operators aren't generic
13:14justin_smithm1dnight: try new ArrayList<Object>(Arrays.asList([1, 2, 3]))
13:15d0kyhello 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:15gfredericksI might just write a dang library
13:15justin_smithd0ky: so you want to write a red black tree in java, imitating the style of that clojure code?
13:16d0kyjustin_smith: yes, thats it
13:20justin_smithit should be pretty straightforward - probably easiest if you use the Clojure persistent datatypes
13:20justin_smiththough that relies on core.match - which will turn into a switch statement in java I guess
13:21d0kyjustin_smith: and without clojure persistent data types ? is also possible ?
13:22justin_smithit's possible, you just don't get the immutiblity / structural sharing
13:23d0kyjustin_smith: ah ok i will search how to use clojure persistent DS in java
13:32danneui 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:32TimMcDid 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:33danneuhow could you implement get-bucket?
13:33TimMcdanneu: quot
13:34TimMc,(map #(inc (quot (dec %) 25)) [1 24 25 100])
13:34clojurebot(1 1 1 4)
13:34nkozasomebody is experimenting weird hiccups with latest melpa cider?
13:34TimMcalmost
13:34TimMcdanneu: Wait, 25 => 2?
13:35dbaschTimMc: it’s 1 to 100, not 0 - 99
13:35TimMcOK, but then 25 should land in the first bucket
13:35gfredericksokay I think technomancy is forcing me to bite the GPG bullet
13:36luxbocknkoza: 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:36dbaschTimMc: and it does
13:36luxbockI upgraded and haven't noticed the slowdowns yet so I think it probably worked
13:37dbaschyour buckets are 1-4
13:39TimMcdbasch: Earlier you said (get-bucket 25)=>2
13:39TimMcand I disagree with that
13:39dbaschTimMc: it wasn’t me :)
13:39TimMcAll you d.* people are the same! I can't be expected to keep track.
13:40TimMcdanneu: ^ :-P
13:40dbaschTimMc: maybe you should group us into buckets by the second letter
13:40TimMc(group-by second (:users @channel))
13:40xeqihi, I'm \e
13:41gfrederickshi, I'm \g
13:42danneuTimMc: thanks. yeah, i was wrong
13:44technomancygfredericks: because of https deploy?
13:44gfredericksyeah
13:45gfredericksalso `lein tag`
13:45TimMc,(map #(inc (quot (dec %) 25)) [1 25 26 100])
13:45clojurebot(1 1 2 4)
13:45technomancysure, blame me and not your own professional dignity
13:46gfredericksI just don't like having two different crypto identity systems
13:47technomancywait, do you not like having two, or do you not like having more than one?
13:47technomancybecause we could easily make it three =)
13:47gfrederickshttp://en.wikipedia.org/wiki/Zero_one_infinity_rule
13:48gfrederickstechnomancy: what I'm saying is we need infinity crypto identity systems
13:48technomancyclojurebot: the number two is ridiculous and can't exist.
13:48clojurebotIk begrijp
13:49technomancy,(ns-unmap 'clojure.core 'second)
13:49clojurebotnil
13:49TEttingerthe number two~
13:49TEttinger~the number two
13:49clojurebotthe number two is ridiculous and can't exist.
13:50dbaschinfinity is the loneliest number
13:50technomancygfredericks: on that note though, you can run the same program as gpg-agent and ssh-agent
13:50gfrederickstechnomancy: I'm so foggy about these issues that I have no idea what that means
13:51gfredericksI know what ssh-agent does
13:51technomancygfredericks: it means from a "caching your passphrase" perspective, the tools you use for both systems are the same
13:51gfredericksi.e., one tool does both?
13:51technomancyyeah
13:53gfredericksdo I need to go setup this gpg key on clojars
13:53technomancygfredericks: no
13:53gfrederickshttps asks me to login though
13:53gfredericksthat's what I always liked about scp
13:54gfredericksit used my ssh key
13:54technomancygfredericks: the plans for verifying signatures server-side are on-hold
13:54technomancygfredericks: right; the idea is you encrypt your HTTPS credentials, and then it uses your gpg key to decrypt them on-demand.
13:55technomancyhttps client certs would be an improvement, but there's no gpg-agent equivalent for them
13:55technomancyso you'd have to enter the passphrase every time
13:55gfredericksmy HTTPS credentials being my clojars username & password?
13:55technomancyyeah
13:55xeqiI'm probably going to pull turn the promotion stuff off for now, and then re-enable it once I fix the sig verifications
13:56gfredericksokay. I think I've got it all straight then.
13:56technomancyxeqi: I should have done that long ago; sorry
13:56gfredericks(inc technomancy)
13:56lazybot⇒ 138
13:56technomancygfredericks: it's confusing because gpg can be used for 3 distinct things
13:56gfredericksoh and clojars has a field for my PGP public key
13:56gfredericksI assume GPG isa PGP
13:57xeqitrue
13:57technomancygfredericks: that's totally optional; skip it for now
13:57gfrederickshey I just set a new password and clojars didn't tell me it had to be less than 12 characters. hooray.
13:58gfredericksthe internet isn't all crazy
13:58xeqitechnomancy: glad you're not opposed. then I'll include it in the next deployment
13:58verma,(seq? [1 2 3])
13:58clojurebotfalse
13:58verma,(seq? '(1 2 3))
13:58clojurebottrue
13:58vermaso IPersistantVector and ISeq are not sort of compatible?
13:58verma,(vector? [1 2 3])
13:58clojurebottrue
13:59jeremyheiler,(every? sequential? [[] '()])
13:59clojurebottrue
13:59vermanice
13:59verma,(sequential? [])
13:59clojurebottrue
13:59vermanice
13:59verma(inc jeremyheiler)
13:59lazybot⇒ 3
14:04vermais there an interface I can implement to get str function showing the right stuff for my defrecord?
14:05Bronsaverma: Object/toString
14:06Bronsa,(defrecord x [] Object (toString [_] "1"))
14:06clojurebotsandbox.x
14:06Bronsa,(str (x.))
14:06clojurebot"1"
14:06vermanice!
14:06vermathanks!
14:07avishaihi, i need a hand with midje
14:08avishaii'm getting java.lang.ClassCastException: clojure.lang.AFunction$1 cannot be cast to clojure.lang.IFn$OLO
14:08avishaiwhen trying to stub a function with type hinting
14:09technomancyclojure.lang.IFn$YOLO
14:09Bronsaavishai: it probably has nothing to do with midje, are you using with-redefs?
14:09verma(inc Bronsa)
14:09lazybot⇒ 52
14:09vermaBronsa, println doesn't pick it up though
14:10Bronsaverma: yeah you have to extend print-method for that
14:10hiredmanavishai: 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:11Bronsaby 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:11vermathanks Bronsa
14:12trcWhat's the meaning of @ before stuff-to-do symbol in this code http://hastebin.com/suladuluja.clj?
14:12Bronsaverma: np
14:14justin_smithtrc: it's a reader-macro that expands to deref
14:14cbptrc: ~@ inside a macro is unquote-splice (or something like that), it "explodes" a list inside another list
14:14puredangertrc: ~@ is unquote-splice http://clojure.org/reader
14:15justin_smithI should have looked at that code before answering, d'oh
14:15trcGot it. Thanks guys :)
14:16puredangertrc: http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ may also be useful
14:18trcpuredanger: Thanks. That very helpful
14:19mdeboardpuredanger: Oh, nice
14:19mdeboardVery glda it exists
14:19mdeboardglad, too
14:22cflemingborkdude: 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:24cflemingpuredanger: the next cursive drop contains a keybinding panel, so you'll have no excuse :-)
14:24puredangersweet
14:24puredangerI have no excuse now, I'm just lazy :)
14:24puredanger(inc cfleming)
14:24lazybot⇒ 1
14:24cfleminghehe
14:24puredangerwat
14:25cflemingI'm new around these parts
14:25puredangery'all are slacking
14:26Bronsa(inc cfleming)
14:26lazybot⇒ 2
14:26mdeboardcfleming: When's that happening anyhoo
14:26mdeboardkeybinds aren't really that big a deal for me atm
14:26cflemingWhat's that, the next drop?
14:26mdeboardyeah
14:27cfleminghopefully today, just waiting for confirmation that I actually fixed a bug from someone with a dev build.
14:28avishaiBronsa, i'll try with-redefs
14:29Bronsaavishai: don't, that wasn't a suggestion :) I just wanted to know if you were using it in order to help you
14:29avishainot using it
14:30avishaimidje is creating the replacement function in `provided` block
14:30avishaidon't really have control on how its created
14:30BronsaI don't know any midje, it probably is using with-redefs itself under the hood then
14:31Bronsaavishai: can you control what the replacement function will be?
14:31Bronsae.g. do you provide a (fn ..) form?
14:31avishainot really
14:31Bronsaavishai: can you nopaste the bit of relevant code so I can get a better idea?
14:31mdeboardarrdem: I was thinking, you should really get a different domain for your grimoire to help results on the google
14:32mdeboardclojuregrimoire.plumbing or something
14:33gfrederickstechnomancy: omg it worked
14:33mdeboardthis is already taken http://grimoire.io/
14:33mdeboardSo is foo.bar
14:33Bronsapuredanger: we were talking about this issue yesterday, primInvoke breaks with-redefs -- should this be in scope with build profiles?
14:33mdeboardand clojure.foo
14:34puredangerBronsa: eh?
14:34Bronsapuredanger: 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:34Bronsapuredanger: by we I mean me and other people in #clojure, not me and you :)
14:35puredangeryou mean to get errors at dev time?
14:35puredangeror to catch a redef that changes prim-ness?
14:35Bronsapuredanger: 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:37Bronsapuredanger: I was suggesting making clojure dev profiles compile to include a check at the invoke site rather than directly to invokePrim calls
14:37BronsaI'm asking because I see build profiles are in Release.Next
14:38puredangerthey 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:38puredangers/their/there/
14:38Bronsaah
14:39puredangerwhich 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:39Bronsagot it
14:39puredangerpopping the stack...
14:39puredangerI think there are many things that could potentially be done in a dev profile
14:39puredangerto give more feedback on errors etc
14:40puredangerwhat is your intention in this case? (I may just need more coffee :)
14:41gfredericksBronsa: 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:41puredangerthat's what I was trying to understand
14:41Bronsapuredanger: I'm more interested in solving inconsistencies in the current "profile", currently there are things like ^:inline & primInvoke that break with-redefs
14:42gfrederickspuredanger: we weren't talking in terms of dev profiles specifically yesterday, so that aspect didn't come up
14:42gfredericksso I think Bronsa is talking about a different sort of use case than "dev"
14:43gfredericksI don't know what it is exactly though
14:43Bronsait is my impression (I'm probably wrong though) that with-redefs was primarily intended for temporarily stubbing functions, for testing
14:44puredangergenerally, I think that's the common case
14:45justin_smithI wouldn't mind at all if with-redefs only worked with a dev profile, that seems a sane arrangement actually
14:45justin_smith(and then I'll find out half the libraries I rely on are misusing with-redefs...)
14:45puredangerhttp://crossclj.info/fun/clojure.core/with-redefs.html
14:45gfredericksBronsa: oh yeah I guess if it's just something that affects with-redefs then it's less of a danger
14:45BronsaI 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:45puredanger"den" is approximately what we have now
14:45puredangerarg autocorrect
14:45Bronsa(I'm probably screwing myself here since I depend on with-redefs for prod in tools.emitter.jvm :P)
14:45puredangerdyn
14:46gfrederickssuperdyn then
14:46danneuTimMc: 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:49gfredericks,(defmacro without-redefs [bindings & body] (cons `do body))
14:49clojurebot#'sandbox/without-redefs
14:50justin_smithhaha
14:50gfrederickseverybody start using ` on your special forms so we can futureproof against special forms getting namespaced
14:50Bronsaif only
14:55gfrederickshaha! "if"! get it!
14:55stuartsierra,`do
14:55clojurebotdo
14:57TimMcdanneu: Wrong nick, I think. :-)
14:58danneuTimMc: nah, there's your work, dude: https://gist.github.com/danneu/1d4c2f6a8e47935dbfb0#file-ratelimit-clj-L27
14:59gfredericksokay I wrote those comparison functions I was whining about: https://github.com/gfredericks/compare
14:59danneuresume filler
14:59TimMcOh, I see -- I read too quickly.
15:16doctormWhat am I doing wrong with this simple protocol test? https://www.refheap.com/91122
15:16gfredericksdoctorm: too many args to formal
15:17gfredericksclojure throws a totally different error messages on arity problems with protocols vs normal functions
15:17doctormgfredericks: Ah, I see
15:17justin_smithdoctorm: you need an explicit this arg
15:17gfredericksoh yeah that's the other side of the problem
15:18gfredericksshould there be a ticket about that error message?
15:18gfredericksit pretty much always means "wrong arity" amirite?
15:19doctormgfredericks: Looks like there is one - http://dev.clojure.org/jira/browse/CLJ-735
15:19puredangerI'm still waiting on that one :)
15:20puredangerone of the first tickets I ever filed
15:21gfrederickspuredanger: waiting on what?
15:21puredangerfor *someone* to approve it :)
15:21puredangerthx
15:24puredangerRich bumped this one way up in priority today http://dev.clojure.org/jira/browse/CLJ-1315 btw, not sure what prompted that
15:28llasramAwesome
15:29allenj12anyone wanna help me with this macro im trying to make? https://www.refheap.com/91123
15:29llasramWell, you know the first rule of macro club
15:30allenj12llasram: no what is it?
15:30puredangerthx to Bronsa, CLJ-1330 is now in the Screened list too http://dev.clojure.org/jira/browse/CLJ-1330
15:31puredangerallenj12: don't write a macro :)
15:32puredangernot that I think he was serious :)
15:33llasramallenj12, puredanger: well, half-serious. Hadn't looked at refheap yet
15:33llasramAnd now that I'm have, I'm afraid I don't understand :-)
15:33johnny_mckquit
15:33llasramallenj12: "overwrites the namespace of a function" -- not sure what you mean
15:34llasramallenj12: And, why does this need to be a macro vs just a higher-order function?
15:34allenj12llasram: 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:35doctormSo for defprotocol, the first argument is always assumed to be something that implements the protocol?
15:35llasramallenj12: WHy not just e.g. `(def whatever-name (loopy-as-a-hof ...))` ?
15:35allenj12llasram: 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:36llasramallenj12: Oh, it re-schedules itself via the var
15:36allenj12yes
15:36allenj12its very domain specific, i wouldnt do this for anything but live coding music
15:37allenj12i wanna be able to change the parameters of the function... by calling the function again... why its recurring... if that makes sense
15:37llasramallenj12: 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:37llasramIs the part missing just that you need to unquote `fname` and accessing the var?
15:37clojurebotIt's greek to me.
15:38llasramallenj12: That should be just `~fname` and `(var ~fname)` respectively
15:38llasram(with the '`' characters in this case being me indicating code, not part of the program text)
15:39llasramWell, or `fnname` as you currently have the parameter
15:41allenj12llasram: yea i keep getting unable to resolve symbol fname :(
15:41justin_smithllasram: allenj12: would using intern remove the need to use a macro?
15:41justin_smith,(doc intern)
15:41clojurebot"([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:41llasramallenj12: your macro parameter is `fnname` (with an extra "n")
15:42llasramMake them match and you should be good
15:42llasram(Well, you still need to change #'fname -> (var ~fname), but otherwise)
15:43allenj12justin_smith: maybe actually i think i might need to play with that more for an intuiton on that
15:43llasramjustin_smith: I'd argue that that would be grosser, because you'd have a function which mucked with the namespace
15:43llasramI think a macro is the right approach for handling that aspect
15:44allenj12llasram: its now complaining beat is not supported arg for *metro* which it def should be
15:46llasramallenj12: 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:47allenj12llasram: yea
15:47llasramThat particular error is probably because you're passing the literal namespaced symbol `beat to whatever *metro* is, but still
15:49amalloyllasram: 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:50llasramamalloy: Oh, that is obvious in hindsight. Thank you
15:59justin_smithllasram: why is a function messing with a namespace worse than a macro that mucks with a namespace?
16:00justin_smith(asking as a legitimate question)
16:02llasramjustin_smith: So you can just call `def`, which is more common and thus easier to understand :-)
16:03llasramI think you have a point -- the big thing for me would be separating definition of the function from the namespace-mucking part
16:05aaelonyhaving 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:05aaelonymuch 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:07amalloyaaelony: 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:07aaelonyamalloy: it's exactly as in the link I posted
16:07aaelonyplease see the link
16:07aaelonythe error I get is: java.lang.OutOfMemoryError: GC overhead limit exceede
16:07aaelonyd
16:08llasramaaelony: What version of clojure.java.jdbc are you using?
16:08amalloyi 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:08aaelonyclojure 1.6.0
16:09llasramaaelony: No. clojure.java.jdbc, not clojure
16:09aaelonyclojure.java.jdbc 0.3.5
16:09aaelony(slow to type)
16:09aaelonymysql/mysql-connector-java "5.1.25"
16:10llasramThen I'm going to need to agree with amalloy if you are literally running exactly the same code with different results
16:10aaelonywhat can I post that would help
16:10aaelony?
16:11llasram(although that honestly seems unlikely, as the answer in that post references postgres and you say you are using mysql)
16:11llasramThe actual code that you are using
16:11aaelonyI will refheap it. give me a minute...
16:13aaelonyhttps://www.refheap.com/91126
16:16llasramaaelony: 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:17llasrams,cant,want,
16:17llasramaaelony: Maybe try adding `:result-set-fn dorun` to the `jdbc/query` arguments
16:17aaelonyIt *will* output data, but only when the I give it a query with a small limit, e.g. select * from bigtable limit 100
16:18aaelonyllasram: I will try your recommendation...
16:18justin_smithaaelony: small style thing, string/join is already eager, so you don't need to wrap the arg in doall
16:18justin_smithalso, it already returns a string, so the wrapping str is redundant too
16:18aaelonyjustin_smith: ok, at this point I was just trying to do exactly what the stackoverflow post author had found to work
16:19justin_smithahh, OK
16:19amalloyaaelony: your row-fn returns a string, so unless you change result-set-fn, you're returning a vector of strings
16:19justin_smithlike I said, not correctness issues, just style
16:19amalloyif you have a large number of rows, you'll have a large vector
16:19llasramamalloy: If you look, they then actually do `#(.write writr (row-fn %))`
16:19llasramSo it'll actually be a large vector of `nil`s
16:19llasramBut potentially same problem
16:19llasram(which I think `:result-set-fn` will fix)
16:20amalloyah, right
16:20aaelonyamalloy: that's probably it. Everything is really large, so I don't want anything that may overflow...
16:21andyf_technomancy: Did you intentionally change the email address on your JIRA acct? Ok if so. It just looked odd
16:21aaelonytrying it now with :result-set-fn dorun ...
16:23technomancyandyf_: yeah, it seemed easier than hunting down everything I'm getting notifications for and unsubscribing individually
16:23aaelonyanother thing is that I would expect it to report every 1000 rows, but it is silent...
16:24andyf_technomancy: Understood. Good to know JIRA isn't under attack yet
16:25amalloyno-thanks@technomancy.com?
16:27technomancyclose enough =)
16:27andyf_Clojure-jira-updates-are-bursty@cant-keep-up.com
16:29hiredmanI use the rss feed
16:29hiredmanit is great
16:30technomancyI'm allergic to Dave Winer.
16:30dagda1what does the hash symbol in this expression mean (inc (#'levenshtein-distance (rest seq1) seq2))
16:30justin_smith,#'+
16:30clojurebot#'clojure.core/+
16:31justin_smith,+
16:31clojurebot#<core$_PLUS_ clojure.core$_PLUS_@77e40c>
16:31justin_smithit points to the var, rather than the thing the var resolves to
16:31justin_smith,#'*clojure-version*
16:31clojurebot#'clojure.core/*clojure-version*
16:31justin_smith,*clojure-version*
16:31clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
16:31justin_smithbetter example
16:32amalloyit's hard to believe (inc (#'levenshtein-distance (rest seq1) seq2)) actually needs the #', though
16:33amalloyi guess they're probably memoizing it later on, and want to indirect through the memoized var
16:33dagda1I don't think I understand this, is there a name for this so I can look at the docs
16:33justin_smithdagda1: var
16:33amalloy,'#'foo
16:33clojurebot(var foo)
16:33alejandro1amalloy: what do you mean "indirect through the memoized var"?
16:36amalloyi mean like this: (defn fib [n] (if (<= n 1) n, (+ (#'fib (- n 1)) (#'fib (- n 2))))), (alter-var-root #'fib memoize) (fib 50)
16:36amalloyie, 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:43allenj12my brain hurts now, might take a nap from all these macros :)
16:49aaelonythat was with (jdbc/query db-connection [statement] :as-arrays? true :result-set-fn dorun :row-fn ...
16:49aaelonyupdate... 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:50justin_smithaaelony: connect a profiler and see what's using up the heap
16:50justin_smiththe jvm comes with one (jvisualvm) but there are other options too, like yourkit, etc.
16:50clojurebotCool story bro.
16:50justin_smith~botsmack
16:50clojurebotclojurebot evades successfully!
16:51aaelonyjustin_smith: yeah, I'll try that next I. I guess I need to :aot everything first?
16:51amalloyno
16:51justin_smithno, you don't
16:52justin_smithyou do need to add a jvm opt to open a dt-socket
16:52aaelonyjustin_smith: ok, I'll look that up ...
16:52justin_smith"-agentlib:jdwp=transport=dt_socket" in :jvm-opts in project.clj
16:53justin_smiththat allows a debugger full access to the vm
16:53justin_smithif that's your only opt, it goes in a vector
16:53aaelonyjustin_smith: thank-you.. finding that would've taken me a while!!
16:53justin_smitherr... to be more clear, opts go in a vector :)
16:53amalloyyeah, 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:54justin_smithamalloy: really? thought it was neccessary but I guess I was cargo-culting it because I needed it once upon a time
16:54amalloyjustin_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:59puredangerI don't usually set any options to attach with visualvm
16:59puredangerI do with yourkit but usually I'm setting something that way
17:01aaelonyok, 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:02puredangerby the way all, planning to open up the 2014 State of Clojure/ClojureScript survey next week
17:03puredangerChas asked me to give him a hand due to his newborns but it is essentially the same
17:03technomancypuredanger: cool; thanks for taking that up
17:04puredangernp
17:04puredangerI'm very interested in seeing the jvm usage data this year
17:04puredangergiven that java 1.7 is EOL in a few months
17:04technomancywhoa; really?
17:05puredangeryeah, I think it's March?
17:05mrcheeksheh, I haven't even use either 1.7 or 1.8 in prod yet
17:05mrcheeksused*
17:05technomancy1.6 is still getting security updates, just from redhat instead of oracle iirc
17:05puredangerhttp://www.oracle.com/technetwork/java/eol-135779.html
17:05justin_smithI swear debian and osx have conspired to freeze everyone on 1.6
17:05technomancywhich is arguably better? =)
17:06technomancypuredanger: lein survey from march: http://lein-survey-2014.herokuapp.com/afc8dc1d80cd2468dee533a795610f.png
17:06puredangerI saw that, thx
17:06technomancy1.8 was pretty new in march though, I think?
17:06puredangerthat was right after 1.8 came out right?
17:06technomancyI think so
17:08borkdudereally cool that lein test :only also supports test-ns-hook
17:09borkdudeI tried to understand the code which takes care of that, but I'll just believe it works
17:10borkdudeis there anything to stop after the first error or failure instead of lein fail fast anno 2014?
17:11technomancyborkdude: if lein-fail-fast doesn't work with 2.x I bet it would be an easy fix
17:11borkdudetechnomancy I wondered why retest is built in, but something like fail fast not
17:12technomancyretest is harder to do in a plugin
17:12technomancywell
17:12technomancyyeah, it would require some monkeypatching
17:12borkdudeI see
17:12technomancywhich fail-fast would too, but it hardly matters since by the time the monkeypatching is hit, the JVM is already exiting =)
17:13bbloom_gfredericks: did you mean "use"? https://github.com/gfredericks/compare#usage
17:16gfredericksbbloom_: no, I meant to prefix the usages with `compare/`; but yes it's wrong, thanks :)
17:17gfredericksfixed
17:18bbloom_ />= seems so haskell
17:18bbloom_"not bind" maybe?
17:18bbloom_or is that />==
17:18gfredericksjust like without-redefs
17:18bbloom_or >/=
17:18bbloom_without-redefs?
17:18gfrederickswithout-redefs is dangerous to use in development, please only use it in production
17:19gfredericksit's like with-redefs but it doesn't redefine anything
17:19puredangerI assume I can find this in core.uncontrib
17:19gfrederickslol
17:19bbloom_heh
17:20koreth_If I want mapcat-style semantics from "for", is the best way to do it to wrap a regular "for" in "mapcat identity"?
17:20bbloom_puredanger: libraries contributed by the united nations?
17:20gfrederickskoreth_: use more clauses
17:20bbloom_,(for [x (range 3) y (range 3) [x y]) ; koreth_
17:20clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
17:20hiredman,(for [i (range 3) ii (range i)] ii)
17:20clojurebot(0 0 1)
17:20bbloom_,(for [x (range 3) y (range 3)]/ [x y]) ; koreth_ ( i suck)
17:20clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/for>
17:20gfredericksbbloom_: puredanger: that got me imagining a library that specifically has everything rich hickey has rejected
17:20puredangerheh
17:21bbloom_i can't type, but you get the idea koreth_
17:21puredangerclojurebot should really just re-run the previous statement with more parens when it gets Unmatched delimiter :)
17:21bbloom_didn't rich already propose the "yes" language?
17:21hiredmanthat was steve
17:21hiredman(yegge)
17:22borkdude,(for [x [1 2 3 :let y [(inc x) (dec x)] result y] result)
17:22bbloom_or thought it was rich to mock (or some more polite word) yegge
17:22clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
17:22borkdudelol
17:22amalloyi thought steve said clojure should be a yes language, and rich said look man, go make your own yeslang
17:23koreth_bbloom_: I'm not sure I see how that helps.
17:23koreth_,(for [x (range 3) y (range 3)] [x y])
17:23clojurebot([0 0] [0 1] [0 2] [1 0] [1 1] ...)
17:23koreth_,(mapcat identity (for [x (range 3)] [x (str x)]))
17:23clojurebot(0 "0" 1 "1" 2 ...)
17:23aaelonyok, 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:23bbloom_koreth_: nested for is the same as mapcat or "flatmap"
17:23technomancygfredericks: isn't that just potemkin?
17:24cflemingpuredanger: CLJ-1315 might be a fastload thing? Either way I'm stoked to see it getting some love.
17:24hiredman,(for [x (range 3) i [x (str x)] i)
17:24clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
17:24koreth_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:24hiredman,(for [x (range 3) i [x (str x)]] i)
17:24clojurebot(0 "0" 1 "1" 2 ...)
17:24gfrederickstechnomancy: :P
17:24puredangercfleming: I've been looking at it for the last hour
17:24cflemingAnd many thanks to Bronsa for CLJ-1330 too
17:24koreth_hiredman: Ah, okay, that makes sense. Thanks.
17:25puredangercfleming: 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:25hiredmankoreth_: btw mapcat identity is apply mapcat
17:25hiredmanerr
17:25hiredmanapply concat
17:25koreth_hiredman: Doesn't apply break laziness?
17:25hiredmantry it and see
17:25aaelonyI also see used heap size increasing until a plateau and then a crash
17:25cflemingpuredanger: I've been running that patch since it came out. Everyone running Cursive has been using it since then.
17:25cflemingpuredanger: Although I realised later that I only really need it to compile.
17:26aaelonyhave screenshots...
17:26borkdude,(for [x [1 2 3] :let [y [(inc x) (dec x)]] result y] result)
17:26clojurebot(2 0 3 1 4 ...)
17:26cflemingpuredanger: I had a horrible Heath Robinson contraption set up to compile before that.
17:27bbloom_puredanger: while we're discussing tickets, what can i do to help CLJ-803 along? :-)
17:27puredangerbbloom_: nothing, it's waiting for Rich
17:27bbloom_ok
17:28puredangerI'm just waiting for ztellman to pop up and ask me about unrolled collections now
17:28bbloom_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:28bbloom_gvec transients and stuff were easily remedied by good ol' copy paste
17:30puredangerBloom Hypothesis: "a sufficiently wide copy and paste can solve any problem" ? :)
17:30bbloom_puredanger: yes, but add "...up to but not including other people refusing to run my copy pasted code"
17:31bbloom_and then add "....minus class loader voodoo"
17:43amalloy"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:43technomancyhehe
17:47bbloom_amalloy: they've forgotten the 4th person who understands them and genuinely thinks that they're a waste of mental energy
17:49amalloybbloom_: sorry, i can't accept responses that aren't in the form of a pun on words like Just, Nothing, bind, or return
17:50bbloom_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:51amalloynot bad at all. ten points to ravenclaw
17:51bbloom_oh, and something about burritos
17:51amalloythough i don't think the peano numbers are relevant to monads
17:52technomancy"It's math"
17:52bbloom_i'll go with technomancy's explaination
17:52gfredericks(inc technomancy) ;; low latency
17:52lazybot⇒ 139
17:52bbloom_haha
17:52bbloom_(inc team)
17:52lazybot⇒ 1
17:52bbloom_really? just one?
17:52bbloom_from now on all group effort points will be awarded to team.
17:53gfredericks$karma #clojure
17:53lazybot#clojure has karma 7.
17:53bbloom_$karma clojure
17:53lazybotclojure has karma 20.
17:53bbloom_$karma bbloom
17:53lazybotbbloom has karma 45.
17:53gfredericks$karma rhickey
17:53lazybotrhickey has karma 2.
17:53bbloom_i'm clearly at least twice as good as clojure.
17:53bbloom_aw, boo
17:53bbloom_(inc rhickey)
17:53lazybot⇒ 3
17:53gfredericks$karma rich
17:53lazybotrich has karma 0.
17:54gfredericks$karma richhickey
17:54lazybotrichhickey has karma 0.
17:54gfrederickshuh.
17:57amalloywell it's not like he's on here much. certainly not since lazybot started tracking karma
17:57amalloyand wouldn't you feel silly inc'ing him? he doesn't need your acknowledgment
18:04bbloom_amalloy: yeah, but i do feel like somebody should special case that to return Long/MAX_VALUE
18:04bbloom_:-P
18:05amalloyi could set it to over nine thousand
18:06amalloy$karma rhickey
18:06lazybotrhickey has karma 9003.
18:07amalloythis way it's absurdly high but incs still matter
18:08bbloom_(inc amalloy) ; excellent
18:08lazybot⇒ 173
18:09bbloom_amalloy: you still need acknowledgement, right?
18:09amalloybbloom_: twice a day or i wither and die
18:14aaelonywell, 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:19gfredericksthat's an exciting JDBC URL option I didn't know about
18:20aaelonylol, I could do without that kind of exciting ;)
18:22aaelonyhttp://stackoverflow.com/questions/11133759/0000-00-00-000000-can-not-be-represented-as-java-sql-timestamp-error
18:30asQuirreLhey 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:32dbaschasQuirreL: you mean, for every value in the map there are always exactly two keys pointing to it?
18:33dbaschwhat is it that you want to enforce?
18:33asQuirreLsuppose 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:33asQuirreLI want to maintain the invariant `(= (m x) (m y))` always.
18:34asQuirreLif 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:35asQuirreLso 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:36asQuirreLI 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:37dbaschasQuirreL: you could have the keys point to the var instead of the value
18:37asQuirreLyep, I looked into that, but couldn't find a way to create anonymous vars for the purpose
18:37asQuirreLwould I just use gensym?
18:39dbaschyou could also have your key be the set of all the keys that point to a value, and use that in your map
18:39dbaschthat’s logically what you want
18:40dbaschthe indirection comes from the key side
18:41asQuirreLdbasch the issue with that is that it makes lookup more cumbersome
18:41asQuirreLI plan on querying this map using non-terminals
18:41dbaschasQuirreL: create a lookup function for that
18:42dbaschbut logically you have a bunch of equivalent terminals for which any of them is a key
18:42dbaschsorry, non-terminals
18:43asQuirreLdbasch, 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:43amalloyasQuirreL: have another canonicalizing function c, and then instead of (update-in m [x] f), you write (update-in m [(c x)] f)
18:44amalloyand use c when you read as well
18:44amalloythen as long as (= (c x) (c y)), this acts like a map where x and y are indistinguishable
18:46asQuirreLamalloy that's an interesting idea
18:46amalloyif 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:47asQuirreLdoes it?
18:48asQuirreLI would've thought, seeing as it does not touch the keyset, that the map properties are preserved
18:48asQuirreLthere's no chance of a key collision, I mean
18:49asQuirreLthe fact that the map is not injective is not an issue, is it?
18:49amalloyerrrrr, i don't think you've defined things formally enough for injective to be relevant
18:50tuftis 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:50asQuirreLI just don't understand which fundamental property of maps it violates?
18:50asQuirreL(Really the mapping I want is from non-terminals to sets of identities (of rules))
18:50amalloybut 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:50dbaschall 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:50tuftspecifically I'm working with DateTimes, which end up printed as e.g. #<DateTime 2014-10-03T22:47:46.243Z>
18:51amalloydbasch: right, which is my c function (another map)
18:51dbaschyes, that’s what I’ve been saying
18:51tufttrying 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:51asQuirreLdbasch exactly
18:51asQuirreLamalloy, that is not a fundamental property of maps, and simultaneously, is definitely the property of injectivity
18:52amalloythat doesn't sound like injectivity at all to me, if you are talking about injective relations
18:52asQuirreLinjectivity with respect to identities
18:53amalloyinjective means that the same value is never stored under two different keys, which is not at all what i said
18:54asQuirreLbut 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:54asQuirreLwhich is by-the-by in my opinion, because identities are themselves values
18:55tuftlooks like this is relevant http://stackoverflow.com/questions/1288877/what-would-be-the-correct-way-to-serialize-this-java-object-in-clojure
18:57amalloyi am checking out of this conversation: i don't have anything more productive to say about these maps
19:00asQuirreLit'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:00asQuirreLI was just wondering if there was language level support for indirection
19:00asQuirreL(without the thread safety)
19:14tuftis there any way to set a dynamic variable globally for lein repl sessions?
19:16hiredmanhttps://github.com/technomancy/leiningen/blob/master/sample.project.clj#L255
19:17hiredman(I don't think it actually uses binding, but it may work fine)
19:17tuftsweet thanks =)
19:19ed-grandom 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:21tufthiredman: 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:23hiredmaned-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:29ed-ghiredman: thanks!
20:08giant_g2Check out my new app! https://play.google.com/store/apps/details?id=com.blogspot.techandtopics.alcoholpartyfree
20:10justin_smithgiant_g2: did you use clojure in making it?
20:11giant_g2No :(
20:17giant_g2But it will tell you how much alchol to buy if you're having a clojure party!
21:03tuftis there any way to query for entities that lack a particular attribute in datomic?
21:04small-chimphi everyone can someone help me to program some lickable software with clojure
21:04small-chimpor should i use microsoft office for that
21:05tufthah
21:07xeqiI think the swiss-arrows library gives you fish and lollipops
21:07small-chimpbut
21:08amalloyi don't use or like swiss arrows, but the trystero furcula sounds undeniably like a magical artifact
21:09small-chimphow can i import winsock.dll and use telephony netowork with my clojure project in windows 95
21:09JCvexIs 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:10small-chimpis lein midje good for a newbie
21:11dbaschJCvex: if you’re doing all that then it should work, can you paste your project.clj somewhere?
21:11JCvexsure... where?
21:11small-chimpi am so anygry because of functional programming i like much more languages like lisp and c which are not functional
21:11dbasch~refheap
21:11clojurebothttps://www.refheap.com/
21:13tuftturns out datomic has missing? now =)
21:13JCvexdone
21:14small-chimpMICROSOFT BINDER IS GREAT APPLICATION
21:14dbaschJCvex: ok, can you share it with us?
21:15JCvexhttps://www.refheap.com/91137
21:16JCvexI'm trying to call this from bin/hadoop but regardless I keep getting of that I keep getting a missing main class error
21:17dbaschJCvex: if you type java -jar youruberjar.jar what happens?
21:17xeqiJCvex: whats the :gen-class line look like in hdfshelloworld.core?
21:18small-chimpMICROSOFT WINDOWS IS GOOD
21:18JCvex (:gen-class :name hdfshelloworld.core)
21:20JCvexif I type java -jar... I get a Exception in thread "main" java.lang.ClassNotFoundException: hdfshelloworld.core
21:20dbaschJCvex: you don’t need :name, it could be just (:gen-class)
21:20xeqiJCvex: I'd remove the ":name hdfshelloworld.core" part
21:20JCvexyea.. I tried that
21:20JCvexstill doesn't make the right .class file
21:21JCvexcreates and core__init.class
21:21dbaschthen build the uberjar, and uncompress it to check that the class is there
21:21JCvexit's not
21:21xeqiwhat version of lein?
21:21dbasche.g. jar tvf youruberjar |grep hdfshelloworld.core
21:21JCvexdbasch: lein 2.4.2
21:22dbaschand it’s (ns hdfshelloworld.core … )?
21:22JCvexyup
21:22JCvex... I'll be back online later.. getting kicked out from cafe. :-/
21:23JCvexthanks
22:04devnbest way to split a coll into two colls based on pred? ex: [1 2 3 4] => even? => [[2 4] [1 3]]
22:06technomancyseparate
22:06technomancyfrom clojure.contrib.seq-utils
22:06technomancyI ... I'll see myself out
22:06technomancy(hint: use juxt)
22:06justin_smithdevn: ,((juxt true false) (group-by even? [1 2 3 4]))
22:06justin_smith,((juxt true false) (group-by even? [1 2 3 4]))
22:06clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>
22:07justin_smith,(map (group-by even? [1 2 3 4]) [true false]) ; almost
22:07clojurebot([2 4] [1 3])
22:09TEttinger,(juxt #(filter even? %) #(filter odd? %) [1 2 3 4])
22:09clojurebot#<core$juxt$fn__4309 clojure.core$juxt$fn__4309@1e6cda2>
22:09TEttingerhaha
22:09TEttinger,((juxt #(filter even? %) #(filter odd? %)) [1 2 3 4])
22:09clojurebot[(2 4) (1 3)]
22:26devnTEttinger: nono, i needed the more generic version
22:26devnjustin_smith: why did you say almost? that's what i was after
22:26TEttingerit didn't use juxt
22:26TEttingerwe were all trying to decipher technomancy's comment
22:27Atlanisquestion 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:36gtk_back when clojure-test-mode was a thing, I used to clojure-jump-to-test a lot
22:36gtk_is there an equivalent in the cider 0.7.0 testing that replaces clojure-test-mode?
22:39gtk_maybe it should all be done from the Test Report
22:39Atlanisgtk_: 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:54danneuCan 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:54danneuSource: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L8359-L8389
22:55danneuEspecially since js->clj arity-1 impl is `(js->clj x {:keyowrdize-keys false})`
23:02justin_smithdanneu: it takes varargs, and then shoved them into a map on line 8368
23:02justin_smithI think
23:03danneurofl
23:06justin_smithI mean that is what (apply array-map opts) does
23:06danneuhow does the arity-1 impl work then?
23:07danneui bet it doesn't and it's just nil
23:08justin_smithhmm, that's weird, yeah
23:08justin_smith,(apply array-map '({:x true}))
23:08clojurebot#<ArrayIndexOutOfBoundsException java.lang.ArrayIndexOutOfBoundsException: 1>
23:08justin_smithyeah, that's what it should do for that one arg case :P
23:10justin_smithunless x doesn't satisfy IEncodeClojure, but I don't see what classes satsify that
23:54devnWhat 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:55devnWould you throw on anything that isn't [1], or...?
23:58devnlike: ,(filter #(= "3df4cbf" (:id %)) [{:id "3df4cbf"} {:id "foo"}])
23:58devn,(filter #(= "3df4cbf" (:id %)) [{:id "qqq"} {:id "foo"}])
23:58clojurebot()
23:58devn,(first (filter #(= "3df4cbf" (:id %)) [{:id "qqq"} {:id "foo"}]))
23:58clojurebotnil
23:59JCvexHi... I had to step out... could anyone help?