#clojure logs

2014-11-03

00:01andyfTwylo: Also, wouldn't you want two separate arguments to your map-once besides the sequence? One for the predicate function, and a separate function to calculate what to replace the matching item with?
00:02Twyloandyf: Great idea about looking at 'map'. And yeah, I think for general use I'd want two arguments, predicate and replacement function
00:03andyfTwylo: I just looked at clojure.core/map source, and there is an extra complicating factor in its implementation involving chunked sequences that you probably want to ignore. It is a performance optimization, not something for correct behavior.
00:04kenrestivodoes compojure do something weird when defining routes? like... execute at compile time instead of runtime? because... this https://www.refheap.com/92630
00:05andyfTwylo: Ignore the 'then' part of the (if (chunked-seq? s) ...) expression. Remove that if, replacing it with its "else" part, which is simpler and works correctly in all cases.
00:06andyfkenrestivo: Someone else can probably give a more authoritative answer, but aren't compojure route definitions implemented as Clojure macros, not Clojure functions?
00:07kenrestivothey are
00:07kenrestivoi'm macroexpand-1'ing right now tryign to figure out wtf
00:08Twyloandyf: Looking at it now. It's nice and simple.
00:08kenrestivoit's funny, just a few days ago someone was in here asking why not use macros. i'd say, this is why not.
00:10andyfkenrestivo: I don't know enough to give suggestions on what to change here, but in general it is good in Clojure to use functions when a function will do.
00:10kenrestivoyep. thanks. i've been around this block before with compojure and some other web things. it's just frustrating; i'll figure it out.
00:11nestastubbsthe issue is not wether is it a macro or a function, in the case of compojure
00:12TwyloHuh, acutally I just noticed that "map" is defined recursively, but not using (recur). It just calls itself directly, no tail call optimization. Interesting.
00:13nestastubbsit's that the servers handler fn won't get updates
00:14nestastubbsit would not matter if it was a macro or a function that defind the routes...
00:15kenrestivoi don't mind, this is something that needs to be fixed at start-time, meaning, at handler-define time
00:15kenrestivobut not at compile time.
00:16nestastubbsif you restart the request handler...
00:16nestastubbssorry I can't be mroe specific, just nuked workstation with new OS install, and don't have any of my projects handy with code
00:17kenrestivono prob, i appreciate the perspective. seems you have a bit more familiarity with the internals of compojure than i have
00:18kenrestivoi'm looking at the macroexpand-1 and can't see any reason why this would not work, it looks fine. hmm.
00:19kenrestivoi have seem some syntax-quote trickery in for example lein, which i should study up on, might fix this
00:19nestastubbsno it won't
00:19nestastubbshow do you start your request handler?
00:20nestastubbsyour ring server...
00:21kenrestivocomponents start
00:22Twyloandyf: Pefect, I have a working function now. Thanks for your help
00:23andyfTwylo: np
00:24andyfTwylo: The lazy-seq in map makes the implementation lazy. Only as much of the answer will be computed as is 'demanded' by later code that tries to examine the result.
00:25TwyloI admit, that's sort of black magic to me. I'd like to understand lazy-seq better
00:26kenrestivothe baddness seems to be coming from the let-request macro, still tracing...
00:32nestastubbskenrestivo: how is app-routes being called?
00:33kenrestivonestastubbs: https://www.refheap.com/92632
00:34kenrestivothe end game here is to have different html for :dev and :release :-/
00:36nestastubbskenrestivo: so it's the mode check?
00:36kenrestivothere are 3 substitutions, yeah mode is the main one
00:37kenrestivoi was thinking of blowing off stencil completely and just doing this all in hiccup
00:37kenrestivobut i don't think stencil is the problem. it's some conceptual barrier i have with the way compojure operates
00:37nestastubbsI would expect that code to work 8)
00:38nestastubbswhat if you do (:playing-url settings)
00:38nestastubbsinstead of using the keyword binding
00:39nestastubbskenrestivo: are you calling make-handler every time you make an edit?
00:39kenrestivoooh, interesting. will try.
00:39kenrestivonope, make-handler is called only at start/stop time (in components)
00:39nestastubbsok, so what does make-handler return?
00:39nestastubbsI'm being pedantic ... that is your problem
00:40nestastubbsthe handler that is serving up the web requests has an old value of app-routes
00:41nestastubbsmake-handler returns a function that wrapped the value that app-routes returned at the time it was called
00:41nestastubbsnot a fn that calls app-routes each time
00:42kenrestivohmm
00:43kenrestivoi actually do want to close over that stuff.
00:43nestastubbsthis happens in our app dev all the time
00:43kenrestivowhat's frustrating is that it isn't an old value. it's an EMPTY value. there's nothin in it
00:43nestastubbswhen we want to add a new route
00:44kenrestivomode, playing-url, chat-url, those are all nil at whatever time let-request is called
00:44kenrestivowhich is confusing me because everythign i thought about clojure's lexical scope is violated by this
00:44nestastubbshave you restarted your entire world yet?
00:44kenrestivomany times :-/
00:44kenrestivolike, whole jvm restarts
00:45nestastubbsok, if you have done that since you wrote the version of app-routes in the paste, then my theory is toast 8)
00:45kenrestivothe value of mode, at the time render-file is called, is nil.
00:45kenrestivowhereas, at the time app-routes is called, mode has a value, and i can prove it with log output
00:46kenrestivoso, macro magick
00:46nestastubbsnothign to do with macros
00:47nestastubbsyou are printing the value of settings
00:47nestastubbstry accessing it (:mode settings)
00:47kenrestivodid that. didn't help.
00:48kenrestivowas a good idea tho.
00:48nestastubbsok, so it's not the destructuring
00:53nestastubbsdo you have reloading on?
00:53nestastubbsif so, make sure you are saved out to disk
00:53nestastubbstry changing the wording of the log message to confirm it's getting your latest edit
00:53nestastubbsthose are all the ways I have been hosed in the past 8)
00:56nestastubbsok, I'm out of ideas without checking out the whole project and trying, and I'm falling asleep 8)
00:56nestastubbsgood luck site!
00:56nestastubbssir!
00:56nestastubbssee, I told you I was falling asleep
01:06kenrestivonestastubbs: thanks, i think i got it sorted
01:07kenrestivoit's working. i will have to look through my git thrash history to find out exactly WHY and HOW
01:08kenrestivoi've gotten in the habit in recent months of generating tons of git branches with names like dead-end1, dead-end2, dead-end3, stash them go back to master, try something else, git checkout -b dead-end4, commit, back to master..
02:22mindbender1What's the fundamental difference between a library like d3.js and react.js?
02:26borkdudemindbender1 d3 works directly on the real DOM
02:26borkdudemindbender1 and if focussed on data viz.
02:26borkdudemindbender1 ReactJS is a general library that utilizes a virtual DOM
02:32mindbender1borkdude: ok
02:33mindbender1How does using them both sound?
02:35mindbender1When I read some part of d3 docs I tend to see functionalities that are typical of a full js framework
02:35mindbender1making me think of `or` rather than `and`
02:39borkdudemindbender1 some people use them both
03:20dc_would it be faster to use filter or to use reduce and build up objects with transients/persistents?
03:22dc_kind of a generic question and it probably depends on the circumstances, i know
03:24cydc_: why not benchmark it?
03:25dc_alright, i'll try both and see
03:49SagiCZ1can i spread my namespaces into more folders without reflecting it in the ns name? or is it like in java where packages have to correspond with file path?
03:52schmirSagiCZ1: I think you could use clojure.core/load from within the namespace.
03:53schmirSagiCZ1: https://github.com/ztellman/potemkin#import-vars may be a better solution
03:53schmirSagiCZ1: haven't used any of those...so don't blame me.
03:59SagiCZ1schmir: no i want it to work out of the box, if it isnt possible i can stick to the regular structure
04:26mbacso does anyone do 3d graphics games in clojure?
04:26mbaci wrote something in quil to do 2d graphics and it was surprisingly slow
04:27mbaci had a draw function doing a bar graph in realtime over 800 points and the framerate dropped to about <10fps
04:41ssiderismbac: you could try opengl with penumbra (although it's no longer maintained as a library): https://github.com/ztellman/penumbra
04:46Glenjaminthere's that new ClojureCLR unity thing
04:46Glenjaminhttps://github.com/arcadia-unity/Arcadia
04:51mnngfltgI have a question about the typical workflow with core.async (on the server). As I understand it, using blocking calls should be avoided. However, SQL calls (jdbc) are always blocking. How can I make SQL queries from core.async-based code?
04:54ddellacosta_mnngfltg: where in the core.async workflow are you talking about?
04:55mnngfltgddellacosta_, so I use http-kit's server to accept tcp connections
04:55mnngfltgif I run an sql query using jdbc, that blocks the thread that is making the request
04:57mnngfltgbut isn't the whole point of running in an event loop (like with http-kit) that you eliminate all synchronous calls?
04:57ddellacosta_mnngfltg: I don't know why you are using core.async, or what the problem is with blocking. What is the problem you are trying to solve?
04:58ddellacosta_mnngfltg: and http-kit supports both modes
04:59mnngfltgddellacosta_, I guess I'm not clear about the way you would typically implement a web service that does both http calls and sql queries
04:59mnngfltgusing node.js I suppose you would never do a blocking call, anywhere
05:00mnngfltgI know that http-kit does both synchronous and async, but jdbc is synchronous only
05:02mnngfltgso wouldn't it be useful to fire off (clojure.java.jdbc/query "....") in a non-blocking way? So your flow is resumed once the SQL query finishes.
05:05ddellacosta_mnngfltg: if you need to initialize a job that does something and immediately return to execution without waiting for the result, Clojure has many mechanisms to support that. I think it's confusing matters a bit to talk about http-kit in the context of how blocking and SQL queries work
05:06ddellacosta_mnngfltg: sorry, I'm a bit fuzzy on what you're trying to do--if you have a specific use-case I may be able to offer more help. As it is, I'm not sure exactly what the problem is that you're trying to solve.
05:08ddellacosta_mnngfltg: and as far as how you'd implement a web service, I don't see why synchronous execution is a problem
05:08mbacssideris, thanks
05:14dc_cy: filter building vectors, nested under a reduce seems much much faster than using a reduce nested in a reduce.
05:15dc_i'm getting hamming-distance for lots and lots of data
05:17dc_like 2 orders of magnitude faster. wow
05:17dc_also, i set the hamming-distance to use recur and to terminate early if it passed the threshold of the distance i'm filtering on
05:29mnngfltgddellacosta_, point taken, I'm a bit confused about the whole business :)
05:31ddellacosta_mnngfltg: re-reading your questions, it sounds a bit like you're conflating the synchronous/asynchronous modes of http-kit w/the threading model provided by the JVM. But consider that you can have a synchronous HTTP request trigger a job that asynchronously executes a SQL query, for example, the result of which you can check again using another synchronous HTTP request
05:32ddellacosta_(not that this is necessarily a good idea, but depends on your architecture I suppose)
05:34ddellacosta_mnngfltg: I suppose the bottom line is, Clojure gives you the tools to build a lot of different architectures, you aren't constrained to some thing like the "everything is a big event loop" or whatever it is that node provides (sorry, I know nothing about node really)
05:39mnngfltgyeah, I don't know much about node.js either
05:40mnngfltgright now my code is perfectly synchronous, which is perfectly fine by me. However, I'm trying to add a feature that talks to other web services, and I expect that these calls block for 1000ms or more.
05:41mnngfltgSo I thought it would be a good idea to use clore.async's channels as a means to fire "background jobs"
05:42ddellacosta_mnngfltg: are you talking about the web server firing off jobs, or the web client?
05:42ddellacosta_mnngfltg: that is, where is the "talking to other web services" thing happening?
05:42mnngfltga web server accepts HTTP requests, but then fires off a notification to another http host, in the background
05:43mnngfltgit's all in the JVM, if that's what you're talking about
05:43cbryanis the response dependent on the notification?
05:43ddellacosta_mnngfltg: and then does something have to handle the response to that notification?
05:43ddellacosta_jinx
05:44cbryanhaha
05:44ddellacosta_:-)
05:44mnngfltgno it's not, I can return the response without waiting for the result of the notification
05:44cbryanwell then "fire and forget", yeah? :)
05:44ddellacosta_mnngfltg: so, what do you do with the result of that notification?
05:44mnngfltgcbryan, yes, except that I need to re-try a notification if it fails
05:45mnngfltgso I can't just do (future (http-client/get "..."))
05:45mnngfltgand I also need to write the result of the notification to a database
05:45cbryan(http-client/get) accepts a callback
05:46cbryanhttp://http-kit.org/client.html#async
05:46ddellacosta_this seems like it happens entirely the HTTP request cycle though
05:46mnngfltgcbryan, but if I do that, does it create a new thread?
05:46ddellacosta_this doesn't have anything to do with the client, no?
05:46ddellacosta_oh, sorry, I misread that--sorry cbryan
05:47ddellacosta_yeah, mnngfltg, seems like what cbryan is proposing is perfect, no?
05:47cbryanmnngfltg: so you want to avoid creating a new thread, or? i might be misunderstanding your actual question!
05:48mnngfltgcbryan, yes that's what I mean, though maybe that not a sensible concern, Isn't it inefficient to fire off a new thread constantly like that?
05:49mnngfltghmm looking at https://github.com/http-kit/http-kit/blob/master/src/org/httpkit/client.clj it looks like it's using a worker pool
05:50cbryanmnngfltg: sounds like a case of premature optimization, honestly. try it and profile? :)
05:50mnngfltga worker pool would be perfect actually :)
05:51mnngfltgSo actually I don't need core.async at all?
05:52ddellacosta_mnngfltg: well, the worker pool is just threads anyways, right? No, not sure you need core.async here, unless you have some higher level abstraction you want to implement using it
05:52cbryanhttp-kit is handling that for you, yeah
05:53mnngfltgddellacosta_, it's threads, but it's a limited pool of threads, so I don't risk running out of threads if a lot of requests block for a long time
05:53ddellacosta_mnngfltg: ah.
05:54mnngfltgI'm just going to go with http-kit and see if it's enough
05:54mnngfltgone more thing, I need to wait between notification requests (say 10 seconds, 30 seconds, 60 seconds)
05:55mnngfltgThread/sleep seems like it might end up blocking everything again
05:55mnngfltgis there some way to block "asynchronously" for lack of a better term?
05:56cbryanhttp://http-kit.org/timer.html
05:56ddellacosta_yeah, schedule-task looks perfect, huh?
05:57mnngfltgright!
05:57mnngfltgit is perfect :)
05:58mnngfltgthanks !!
05:59mnngfltgschedule-task uses a "Timer-service thread", so that's how that works
06:05borkdudeis enlive pronounced as en-liv or en-lie-v
06:06borkdudeas in "I live" or "live performance"
06:31kungiborkdude: as far as I remember the talk about enlive it's pronounces as in "live performance"
06:39borkdudek
07:13ucbgood day all
07:13ucbI'm trying to write a macro that'll take the body of the expression and use it as the key in a hashmap
07:13ucbhowever I'm not getting it quite right
07:13clgvucb: example?
07:14ucbyes, creating it :)
07:14ucb1s
07:14clgvbest with call example and desired expansion
07:16ucbhere https://gist.github.com/ulises/b34d5bae94e8cf8006e9
07:18clgvucb: ok, what exactly does not work? the fullqualified "do-more*" ?
07:19ucbthe (quote ~f) actually gets evaluated
07:19clgvhuh? not really
07:19ucbso instead of getting '(fn [] :foo) as a key, I get user$eval3687$fn__3692 as key
07:20clgv,(defmacro thing [f] `(hash-map (quote ~f) ~f))
07:20clojurebot#'sandbox/thing
07:20clgv,(thing (fn [] :foo))
07:20clojurebot{(fn [] :foo) #<sandbox$eval52$fn__53 sandbox$eval52$fn__53@1716c3d>}
07:20clgvlooks about right
07:20ucbhrm
07:20clgvmaybe do-more* confuses the parameters?
07:21ucbwell, let me paste the do-more* equiv I'm working with
07:22ucbhere https://gist.github.com/975b1843c13888a95ff7
07:23ucboh, silly silly boy
07:23clgvucb: why don't you use the same "quote" form there?
07:23ucbwhere?
07:23clojurebotwhere is log
07:24clgvin "rich-stream" first arg
07:24ucbhow do you mean?
07:24ucbheh, it works now
07:24clgvit is constructing a list with 'quote as first arg and the evaluated function as second arg. line 15
07:24ucbit wasn't the macro that was the problem :)
07:24ucbyeah, list there is wrong
07:24ucbthat's an old paste
07:24clgvucb: did you change it to (quote ~f) as well?
07:25ucbyes
07:25clgvok
07:25ucbthe bug is here https://gist.github.com/ulises/975b1843c13888a95ff7#file-streams-clj-L10
07:25ucbassoc f
07:25ucbshould be assoc name
07:25clgvhaha ok ;)
07:25ucbthanks for prodding me!
08:21nondisclosureI'm trying to use a let with selenium to grab a value from the page i'm currently on, then proceed to the next page, then return that value. the let isn't storing that value until my function tries to return it. what's the best way to deal with this problem? i've tried using eval and doall to no avail.
08:22justin_smithnondisclosure: what does "the let isn't storing that value" mean?
08:23nondisclosurethe let is pointing to a selenium function, so i'm under the impression it's storing that function unevaluated and then evaluating when i return that value
08:24justin_smithnondisclosure: let is greedy
08:24justin_smithor I should say, it is sequential, and is not itself lazy
08:24justin_smithis the function you are calling lazy?
08:25nondisclosurei'm actually not sure, so you're saying if i do (let [a (+ 1 1)]) let is storing a 2 rather than a (+ 1 1)?
08:25justin_smithright
08:26nondisclosureahh i see
08:26nondisclosurethanks, that points me in a good direction, i'll try to figure out what that function is doing
08:48CookedGryphonDoes anyone know of a handy core.async/chan -> InputStream converter
08:49CookedGryphonI want to stream data to a javascript EventSource in a wrapped WebView through the WebRequestResponse api, in which I can give it an InputStream
08:49CookedGryphonI set it up with a PipedInputStream. PipedOutputStream, but that doesn't seem to do anything on the receiving end until the buffer fills up
08:49CookedGryphonand apparently has a number of other pitfalls
08:51CookedGryphonI'm trying to wrap the InputStream interface directly, but it doesn't quite fit with the core.async model, as it has an available() method which should return the number of bytes available, and then a separate read(byte buffer[], off, len)
08:51CookedGryphonso I can't just have read doing <!! available-data
08:55jeffterrell[news] Clojure is currently the highest-paid programming language, according to this analysis: http://bit.ly/13zeP2x . Relatively low demand, though.
08:55justin_smithCookedGryphon: yeah, it seems like you need an abstraction between the channel and the InputStream proxy
08:55craigglennieI get a ClassCastException trying to use one of my namespaces in nREPL. Subsequent attempts to use the namespace generate a “namespace […] not found” exception, and I have to restart nREPL to try again - is this normal? https://www.refheap.com/92645
08:55craigglennieAlso using Cursive, if it matters
08:56justin_smithcraigglennie: after a require throws an exception, you need to specify :reload for the require to rettry
08:56justin_smith*retry
08:56justin_smithas far as clojure is concerned, it already required it once, so it is done :)
08:56justin_smith(require 'my.ns :reload)
08:58justin_smithassumedly you fixed the "string isn't a regex" issue so the ns would actually load this time, of course
08:59craigglenniejustin_smith: thanks, that worked!
09:15clgvI want to get a short string representation of a byte array similar to a hexadecimal representation but with more characters to reduce the length. is there something Java built-in I can use? some option to a formatter or similar?
09:18justin_smithclgv: what about base64?
09:18justin_smiththe encoding returns a byte-array, but it is easy to apply String. to that
09:19clgvjustin_smith: hmm would work I guess
09:19clgvjustin_smith: did you have a clojure lib in mind for that?
09:21justin_smith,(require '[clojure.data.codec.base64 :as b64])
09:21clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/data/codec/base64__init.class or clojure/data/codec/base64.clj on classpath: >
09:21justin_smith (b64/encode (.getBytes "hello"))
09:21clgvok the contrib one ^^
09:21justin_smiththat would work, if the previous did :)
09:21justin_smithwell, really you want (String. (b64/encode (.getBytes "hello")))
09:22justin_smithin my repl that returns "aGVsbG8="
09:22justin_smith(.getBytes "hello") is just a placeholder for a byte array, of course
09:23hyPiRionurgh
09:23clgvdamn two additional deps for debugging this strange error scenario...
09:25justin_smithyou don't need the dep
09:25justin_smith,(String. (.encode (java.util.Base64/getEncoder) (.getBytes "hello")))
09:25clojurebot#<CompilerException java.lang.ClassNotFoundException: java.util.Base64, compiling:(NO_SOURCE_PATH:0:0)>
09:25justin_smithwat
09:26justin_smithoh, that is new with java 8
09:26justin_smithso it works in my repl :)
09:26clgvyeah well, I have the dep now ;)
09:27justin_smithI was hoping there was a simple way to not need the dep
09:27sveriHi, when creating a new project with leining, is there a way to add a generic namespace for all generated classes?
09:32jzinedinehey guys, I'm trying to build a simple pedestal service using stencil but got a weird exception, java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Associative
09:32jzinedinehere is the complete stacktrace: https://gist.github.com/jzinedine/acc68a83e6164aa77b98
09:32jzinedineappreciate any help
09:34clgvjustin_smith: yeah no problem I just added it
09:34justin_smiththat exception means that someone is trying to treat a string as an associative datastructure (likely ussing assoc or get)
09:35justin_smithyeah, assoc-in is finding a string instead of a vector or map at some level
09:36justin_smithit looks like it is happening in the header creation
09:36jzinedineyeah, I'm trying to understand what's happening in ~/.m2/repository/io/pedestal/pedestal.service/0.3.1/pedestal.service-0.3.1.jar!/io/pedestal/http/secure_headers.clj
09:37justin_smithjzinedine: one guess - it is being handed a string rather than a response map?
09:37jzinedine (fn [{response :response :as context}]
09:37jzinedine (assoc-in context [:response :headers] (merge sec-headers (:headers response)))
09:38justin_smithso what is context? is it a string?
09:38justin_smithor perhaps headers is a string
09:38jzinedineit's a map actually
09:38jzinedinebut response is string
09:39justin_smiththere you go
09:39justin_smithresponse should likely be a map, with :body containing said string
09:39justin_smithjzinedine: clojure.trace is helpful for this kind of stuff in my experience
09:39jzinedineyeah maybe it should be a ring response map
09:40jzinedinethanks a bunch buddy for your help
09:40justin_smithjzinedine: yeah, tools like compojure will automatically turn a string into a response map I think, maybe pedastal is more finicky
09:40jzinedineI'm a clojure newbie and just trying to develop my first app using clojure
09:40justin_smithcool
09:41daniel___pedestal is pretty hard to get your head around, there aren't really many parallels with conventional frameworks in other languages
09:41daniel___at least thats how it seemed to me
09:41daniel___i don't know if it's worth it
09:41justin_smithI'll just reiterate tools.trace is great for finding out what is actually going on
09:44jzinedinedaniel___ I think most of what it does remind me of spring aspects, here we have interceptors, a familiar idea, but I'm not good at language nor tools to debug and browse apis
09:45daniel___jzinedine: that might be the case, im really unfamiliar with Java frameworks
09:46jzinedinehowever I think when I get my head around it I can be very productive , yet everything is simple to understand
09:51lazylambdafolks, I am currently using cider on emacs to work with clojure. Are there alternatives that provide better code formatting?
09:52ARM9what about clojure mode
09:53mwfoglemanlazylambda: https://github.com/sanel/monroe/ is a new cider alternative. i haven't tried it, so i'm not sure about it's code formatting.
09:53justin_smithARM9: cider uses clojure mode
09:54mwfoglemanactually,
09:54mwfoglemanyeah
09:54mwfoglemanit uses clojure mode too :D
09:54mwfoglemannot sure about any clojure mode alternatives.
09:54llasramlazylambda: What do you mean by "better"?
09:55lazylambdallasram: well, I am happy with clojure-mode. I just like how slime indents code better
09:55lazylambdallasram: for example cond forms
09:55justin_smithmwfogleman: monroe does not replace clojure mode in any way
09:55mwfoglemanyeah
09:56mwfoglemanlazylambda: sounds like it might be doing a compare and contrast between clojure mode and slime.
09:56llasramlazylambda: You may just be seeing differing standard formatting for CL vs Clojure?
09:56mwfoglemanah, that may be true.
09:58schmirlazylambda: https://github.com/schmir/.emacs.d/blob/master/lisp/setup-clojure.el#L17 may be relevant
09:58lazylambdaschmir: that looks good. Thank you
09:59mwfoglemanschmir: what exactly does your snippet do?
09:59lazylambdaIn general, is there a standardised way of formatting clojure code?.
10:00mwfoglemanlazylambda: https://github.com/bbatsov/clojure-style-guide may be helpful
10:00schmirmwfogleman: it fixes cond formatting for me :)
10:00mwfoglemanschmir: :) i tried evaling your code and looking at a before and after with a cond that i have locally, but i couldn't tell a difference.
10:01schmirI'm not sure if it's still needed...
10:01mwfoglemanschmir: that's possible. it's also possible that I am blind, or that the eval needs to happen at boot or something.
10:03schmirmwfogleman: if I comment it out, cond formatting is broken for me
10:03mwfoglemanschmir: interesting. maybe i'm blind then.
10:04schmir:)
10:04mwfoglemanschmir: on the other hand, i really like your advice to cider-load-current-buffer.
10:04mwfoglemanschmir: that looks really handy.
10:04lazylambdamy problem with the cond formatting is that if the action code is too long and I decide to put it on a separate line, it is placed right under and aligned with the action which makes it harder to read sometimes
10:04mwfoglemanlazylambda: interesting. i'll try that out.
10:05schmirlazylambda: then try my code. it fixes that issue!
10:05mwfoglemanlazylambda: with schmir's code ;) with the cond i was checking out, everything was on one line.
10:05lazylambdaschmir: sweet, i'll give it a shot
10:08mwfoglemanschmir: wow, that defadvice is great :D
10:22jzinedinesorry for bothering again, but anyone knows about a way to reload/auto-reload resource files (css/js/html) in repl?
10:24mwfoglemanjzinedine: https://github.com/bhauman/lein-figwheel ?
10:24mwfoglemannot sure.
10:27jzinedinemwfogleman: thanks I'll check it out
10:28jzinedineseems to be a clojurescript plugin, don't know if I can use it in a clojure project
10:28mwfoglemanjzinedine: i don't do anything with browser stuff right now, so that might not be what you're looking for.
10:28mwfoglemanjzinedine: right.
10:28jzinedinemwfogleman: yeah thanks anyway
10:29jzinedineI think I should look for a way to disable stencil caching in dev mode
10:32jzinedineyeah, I just need to eval this line in repl: (stencil.loader/set-cache (clojure.core.cache/ttl-cache-factory {} :ttl 0))
10:44csd_Does it make sense to incorporate macros into compojure views to factor out the (let [binding param]) stuff? I have a ton of it cluttering my code but am having trouble thinking of a good way to consolidate it
10:47CookedGryphonCan anyone think of a decent pattern for piping the string contents of a channel into an InputStream that stays open for a long time receiving occasional appends
10:47CookedGryphonas in a core.async channel with core.async take semantics
10:48mr_rmhaving trouble understanding the seed arguments to memo. if i try this: (def foo (clojure.core.memoize/memo + {[42 1] 99})) and then call (foo 42 1) I get an error trying to cast Long to Future. I thought the map value should simply be the return value. What am I doing wrong here?
10:48CookedGryphonI'm struggling to wire up appropriate input/output streams, tried implementing Inputstream directly myself and hit all sorts of snags
10:48weavejestercsd_: Could you explain a little more what you mean?
10:48klyed2CookedGryphon: i know very little clojure, but cues maybe?
10:48CookedGryphonPipedInputStream and PipedOutputStream sort of work, but don't flush immediately, I need to fill the buffer before anything goes through
10:49csd_weavejester: sure
10:49csd_(defn add-link! [request]
10:49csd_ (let [{session :session} request
10:49csd_ {params :params} request
10:49csd_ {link :link} params
10:49csd_ {description :description} params
10:49csd_ {username :username} session]
10:49csd_I have a ton of that
10:49Bronsacsd_: do you know about :keys?
10:50Bronsa(let [{session :session} request {params :params} request] ..) can be rewritten as (let [{:keys [session params]} request] ..)
10:50weavejestercsd_: {{:keys [username]} :session, :keys [link description] :params}
10:51Bronsa^ and they can nest
10:51csd_I guess my hangup is I feel like there should be a way to make a wrapper that makes it so that each view doesn't require a let statement to access request parameters
10:51weavejesterI’d also be tempted to use Compojure’s binding forms
10:52weavejesterIt’s often a good idea to restrict what data your functions have access to.
10:52weavejesterThe less they know, the less that can affect them.
10:53weavejesterYou can also make use of closures
10:53csd_By clojure binding forms you mean the binding during defroutes?
10:53weavejesterNo, the binding forms in GET, POST, etc.
10:53csd_I think that's what I mean
10:53csd_How would you do that in the case of multiple vars?
10:54weavejesterLet me put together a gist
10:57weavejestercsd_: https://gist.github.com/weavejester/b7388f5626f5bfa512a5
10:58weavejesterThere’s potentially a better way of getting the username from the session, I think…
10:58weavejesterMaybe dumping it into the request map
10:58clgvoh `gen/elements` from test.check behaves pretty badly for a list of 56 entities when performing 100 runs - in the last runs the only the last element of the collection is used
10:58csd_weavejester: Is that something that would need to be done on the library side?
10:59weavejestercsd_: No, you could add the username to the request with middleware
11:00weavejestercsd_: But I’m considering improving the efficiency of the context macro when the route is “/“…
11:01csd_this gist is helpful, thanks
11:02CookedGryphonDoes anybody know of an alternative to PipedInputStream/PipedOutputStream which doesn't wait for the buffer to be full/closed before it writes to the consumer?
11:03mr_rmCookedGryphon: can you call flush at opportune times?
11:05justin_smithCookedGryphon: isn't there one like that in java.nio somewhere?
11:06mr_rmhaving trouble understanding the seed arguments to memo. if i try this: (def foo (clojure.core.memoize/memo + {[42 1] 99})) and then call (foo 42 1) I get an error trying to cast Long to Future. I thought the map value should simply be the return value. What am I doing wrong here?
11:06EvanR,({:a 1} :a)
11:06clojurebot1
11:06EvanR,(:a {:a 1})
11:06clojurebot1
11:06EvanRo_O no wonder im having hard time remembering the order
11:07mr_rmEvanR: the second version won't give you nullpointerexceptions if you have no map though
11:08mr_rm,(nil :a)
11:08clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
11:08mr_rm,(:a nil)
11:08clojurebotnil
11:08EvanRnull pointer exceptions are good for you, they build character
11:08mwfogleman:D
11:10arrdem&(char nul)
11:10lazybotjava.lang.RuntimeException: Unable to resolve symbol: nul in this context
11:10arrdem&(char nil)
11:10lazybotjava.lang.NullPointerException
11:10arrdem^ not building character
11:10EvanRlol
11:12Glenjaminhahaha
11:12Glenjamin(inc arrdem)
11:12lazybot⇒ 39
11:12mr_rm((clojure.core.memoize/memo + {[42 1] 99}) 42 2)
11:12mr_rm,((clojure.core.memoize/memo + {[42 1] 99}) 42 2)
11:12clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.core.memoize, compiling:(NO_SOURCE_PATH:0:0)>
11:13mr_rm,(require 'clojure.core.memoize)
11:13clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/memoize__init.class or clojure/core/memoize.clj on classpath: >
11:13mr_rm,((clojure.core.memoize/memo + {[42 1] 99}) 42 2)
11:13clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.core.memoize, compiling:(NO_SOURCE_PATH:0:0)>
11:16justin_smith,(Character. nil)
11:16clojurebot#<NullPointerException java.lang.NullPointerException>
11:22mr_rm_*clojure-version*
11:22mr_rm_,*clojure-version*
11:22clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
11:26mwfoglemanbots.
11:37EvanR,(first nil)
11:37clojurebotnil
11:37EvanR,(ffirst nil)
11:37clojurebotnil
11:38justin_smith,(get-in nil [:we :must :go :deeper :inception])
11:38clojurebotnil
11:43clgvO_o
11:44CookedGryphonmr_rm_: flush doesn't seem to do anything at all, it still waits for the buffer to fill or the outputstream to close
11:44CookedGryphonjustin_smith: not that I can find, and I have looked. Pointers appreciated
11:45mr_rm_http://clojure.github.io/core.memoize/#clojure.core.memoize/memo is there a bug in the documentation here? you can't actually provide just a simple number here as the return value. you need to use a (delay 42) or something similar
11:45clgvCookedGryphon: hmm usually .flush should do that
11:45CookedGryphonclgv: that's what I thought
11:45CookedGryphonI spent ages sending one message then a flush and thinking I didn't have it wired up correctly
11:46CookedGryphonbut actually I just need to send ~1k messages and it all streams out
11:46mr_rm_i can see that the source code derefs the value and you can't do that on a simple number. the documentation is what threw me in the first place. simply wrapping those values in the seed map with a (delay) works fine
11:47mr_rm_CookedGryphon: personally, i would suspect a bug in your code because that's how flush works :) maybe you're doing something with a lazy seq that isn't getting realized... or something
11:47CookedGryphonI'm literally calling (.write ostream (.getBytes "Hello" "UTF-8")) (.flush ostream)
11:47clgvCookedGryphon: do you use other streams wrapped around or within?
11:48CookedGryphonand if I do the same in a dotimes [n 10000] it comes through
11:48CookedGryphonnope, I have (let [istream (PipedInputStream.), ostream (PipedOutputStream. istream)] ...
11:48CookedGryphonhanding the PipedInputStream to the WebView API
11:49CookedGryphonthat's expecting an InputStream
11:49CookedGryphonI wonder....
11:50CookedGryphonlet me make a gist, I just had a thought
11:51CookedGryphonhttps://gist.github.com/AdamClements/27948417027275d08f06
11:51mr_rm_does anyone else agree that the documentation of the seed values here is a bug because it shows using a simple number? i can submit a PR but i want to be sure i'm not just misinterpreting: http://clojure.github.io/core.memoize/#clojure.core.memoize/memo
11:52clgvCookedGryphon: looks good over here: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/io/PipedOutputStream.java#PipedOutputStream.flush%28%29
11:53CookedGryphonIs it that doing <!! waiting for more data in the same thread is not allowing the InputStream to be read because my thread is blocked or something?
11:53Bronsamr_rm_: "where keys are a vector
11:53Bronsamapping expected argument values to arity positions"
11:53Bronsamr_rm_: it seems pretty clear to me that the numbers are example inputs
11:54mr_rm_Bronsa: if you use a number as the VALUE though, calling the memoized function will blow up (can't cast a Long to a Future)
11:54EvanR,(first "foo")
11:54clojurebot\f
11:55mr_rm_Bronsa: that is, this will work: ((clojure.core.memoize/memo + {[42 1] (future 99)}) 42 1) but this won't: ((clojure.core.memoize/memo + {[42 1] 99}) 42 1)
11:55Bronsamr_rm_: gotcha
11:58Bronsamr_rm_: I'd say, rather than changing the docstring, the impl should change
11:58Bronsahttps://github.com/clojure/core.memoize/blob/master/src/main/clojure/clojure/core/memoize.clj#L148-L152
11:58CookedGryphonI think it must be something to do with which thread I'm doing things on...
11:58csd_weavejester: I think there is an error in the gist you wrote. `username` actually appears to be the request map
12:00Bronsamr_rm_: btw it expects an IDeref, not necessarily a future, you can use an atom/delay/var whatever
12:00mr_rm_Bronsa: i also feel it would be a simpler api if you could just pass the actual return value. that threw me at first when i was trying to use it as documented. feels artificial to have to pass a delay or something
12:00weavejestercsd_: What do you mean?
12:00csd_I'm doing basically (str username) and it's returning the entire request map
12:01mr_rm_Bronsa: yes i figured that out afterward. i should have just looked at the source first but the doc seems to straightforward i thought i must be doing something stupid :)
12:01weavejestercsd_: Could I take a look at your code? I don’t see how destructuring could fail like that
12:02csd_sure one sec
12:02Bronsamr_rm_: http://dev.clojure.org/jira/browse/CMEMOIZE here's the bug tracker for core.memoize if you want to open a ticket reporting the bug
12:05EvanRfunction to get the only value out of a map known to have exactly one entry
12:05EvanR,(second (first {:a 0}))
12:05clojurebot0
12:06csd_weavejester: sorry looks like i had a syntax error
12:06weavejestercsd_: No problem :)
12:09CookedGryphonthis is really infuriating. I tried moving the PipedOutputStream creation into the thread that's reading off the channel, no luck. It's still not getting read. I wonder if this is something wrong with the way the webview is reading the InputStream...
12:12clgvCookedGryphon: just try it, make a debug thread that just consumes and prints your input stream
12:14mr_rm_Bronsa: done. http://dev.clojure.org/jira/browse/CMEMOIZE-18 thanks for your response
12:19csd_weavejester: if keys aren't present in the request map but are being destructured, will that cause problems with route processing at all?
12:19mr_rm_,(val (first {:a 0}))
12:19clojurebot0
12:19borkdudewhat is the technical term for getting a value out of a map by key?
12:20weavejestercsd_: I don’t believe so. Destructuring a missing key just ends up with nil
12:20Bronsaborkdude: looking up?
12:20weavejester,(let [{{:keys [session]} :request} {}] session)
12:20clojurebotnil
12:21csd_weavejester: i'm really stumped at this point. my login function wasn't getting called anymore, so i stripped out all the parameters and made the response just a simple str, and then a print to console, and it doesn't even seem like it's getting called.
12:21csd_ (POST "/login" [] (views/login))
12:21csd_only thing i can think of is that somehow the destructuring above is causing it
12:22borkdudeBronsa yeah ok
12:22weavejestercsd_: Let me double-check I’m not mistaken about context
12:23weavejestercsd_: Hm, seems to work on my end
12:24weavejestercsd_: What does your code look like? And which version of Compojure/Ring are you using?
12:24csd_compojure 1.1.9; ring 1.3.1
12:25csd_i'll put on pastebin, one moment
12:25weavejestercsd_: I don’t think there are any bugs in 1.1.9 that would cause a problem, but it might be worth updating to 1.2.1
12:27EvanRfunction to run a function on each value, which does IO, and get the list of results of each one, like a foreach which gives the results in a list/seq
12:28csd_weavejester: http://pastebin.com/yQeXDuHA
12:31weavejestercsd_: There are a couple of odd things in that code. You’re using the deprecated handler/site *and* wrap-defaults simultaneously.
12:31justin_smithmr_rm_: EvanR: how about ##(first (vals {:a 0}))
12:31lazybot⇒ 0
12:31EvanR##?
12:32justin_smith## is just inline lazybot syntax
12:32weavejestercsd_: You also have a parameter called “session”, which leaves me to think that’s a mistake?
12:32mr_rm_justin_smith: sure, why not? :)
12:32cbryanit's a super-anonymous function, duh
12:32csd_session is in there because the function i'm passing it to needs to be able to add :username to the session
12:32justin_smithmr_rm_: I like it because it does not rely on implicit seq / map overloading
12:33csd_i don't know how else to do the assoc otherwise
12:33csd_as for handler/site, can i just remove it since i'm using wrap-defaults?
12:34mr_rm_justin_smith: not sure i understand... vals basically turns it into a seq of values right?
12:34mr_rm_then you're just using a seq function
12:34weavejestercsd_: You can remove handler/site, because you’re using wrap-defaults instead.
12:35mr_rm_justin_smith: whereas my way is just getting the first MapEntry and then retrieving the val of that entry
12:35weavejestercsd_: The context destructuring looks okay, but maybe try updating your Compojure version to the latest one?
12:35mr_rm_justin_smith: not that i think it makes much diff :)
12:35csd_ok
12:35weavejestercsd_: The session binding you have just binds to a *parameter* called session, not the actual session.
12:35EvanRi think doall map is what im trying to think of
12:36weavejestercsd_: For that you’d want :as {:keys [session]}
12:36weavejestercsd_: Or take advantage of Compojure’s handling of returned functions
12:36csd_how do you mean?
12:37mr_rm_EvanR: maybe reduce?
12:37weavejestercsd_: (GET “/“ [] (fn [req] (assoc (:session req {}) :foo “bar”)))
12:37justin_smithmr_rm_: vals is a function that takes a map and returns a seq - that is what it explicitly does. first when called on a map returns a map entry, but this is less explicit. For example imagine reading the code in a context where the map was not a literal, but was an argument passed in - with first vals I would know to expect a map in that place, with val first it's slightly more ambiguous
12:37weavejestercsd_: Well, that won’t work exactly because the return value is wrong…
12:38mr_rm_justin_smith: this is why i'm slightly uncomfortable with dynamic languages :)
12:38weavejestercsd_: But the idea is that you can return a function and using that to regrab the request map, without needing to pull in the request map explicitly.
12:38justin_smithmr_rm_: my discomfort grows
12:38csd_which do you view as being better style?
12:39EvanRim going with first vals for that, it makes sense
12:39EvanRand easier to read
12:39EvanRwithout already knowing all the clojure tricks
12:39weavejestercsd_: Returning a handler function that modifies the request would be my choice, I think.
12:39EvanR,(de-dupe [1 1 2 2 1 1])
12:40clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: de-dupe in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:40EvanR,(dedupe [1 1 2 2 1 1])
12:40clojurebot(1 2 1)
12:40weavejestercsd_: Although I’m not sure it’s necessary - I typically just keep a user identifier in the session, so there’s only ever one value anyway.
12:41mr_rm_EvanR: (reduce #(conj %1 (do (prn %2) 99)) [] ["hi" "there"])
12:41csd_weavejester: yeah i think its just more an issue of setting it though--i only set session with user too
12:42weavejestercsd_: {:session {:username username}} then
12:42EvanRmr_rm_: doesnt doall already do this
12:42mr_rm_EvanR: added a (do) just to get a return value more interesting than nil :)
12:43mr_rm_EvanR: i thought you wanted it to collect the return values from the i/o function
12:43Glenjaminanyone around familar with reagent (this may apply to Om too) - if i redef a component in the repl, but it's in a part of my UI tree that shouldComponentUpdate is false - is there a way to reload it?
12:44EvanRmr_rm_: the io function already returns the result, and im applying it to a list of inputs, so (doall (map proc) inputs) ?
12:44EvanRer
12:44EvanRmr_rm_: the io function already returns the result, and im applying it to a list of inputs, so (doall (map proc inputs)) ?
12:44csd_java.lang.IllegalAccessError: rfn does not exist, compiling:(route.clj:1:1)
12:45EvanR,(sort [1 3 2 1])
12:45clojurebot(1 1 2 3)
12:45bordatouehi can anyone please help me, I'm trying to read some funtion written in a txt file using read-string and using eval create a fn which i invoke dynamically. The problem is it works in repl but when i run it outside repl all the string losses its quotes
12:45bordatoueis there any way accomplish this using read-string
12:47ohpauleezbordatoue: You are reading in the file using `slurp`?
12:47bordatoueyes
12:47mr_rm_EvanR: map is really better for applying pure functions to data.
12:47bordatoueohpauleez: yes
12:47EvanRmr_rm_: yeah, that would make sense
12:49EvanRmake it seems like this would work and theres no alternative, and if there was one would be indistinguishable from map
12:49bordatoueohpauleez: actually i got my main clj program which reads a txt file ; the txt file contains some fn defined in clj. I read in the txt file using (eval (read-string (slurp "text")) ==> fn
12:49EvanRs/^make //
12:49ohpauleezbordatoue: You should be able to pass that directly to `read-string`
12:50mr_rm_(reduce #(conj %1 (myfunc %2) [] inputs) would be ok right?
12:50ohpauleezbordatoue: Be careful though, you want to make sure you that text file is fully trusted
12:50bordatoueohpauleez: but read-string seems to get rid of all the quotes , so when i have something in the function "." using read-string it becomes .
12:50EvanRmr_rm_: right, you can also implement map the same way
12:51EvanRmap and reduce to me same equally as "pure"
12:51bordatoueohpauleez: I really don't care about trust , I just want the implementation to work
12:51EvanRseem*
12:51mr_rm_EvanR: yes, agreed. it just feels icky to use map to generate side effects. side effects are always messy :)
12:52EvanRit feels icky to produce it with reduce, actually side effects are icky. however in this case i am dealing with non-side effects, they are the main point of this computation ;)
12:52BronsaEvanR: you should prefer doseq to map to iterate over a sequence performing side-effects
12:52mr_rm_EvanR: the problem is you want to both generate the effects AND collect up the results so it's ugly no matter what
12:52EvanRfront effects
12:53EvanRBronsa: but i dont get the results right
12:53BronsaEvanR: ah you want the results, ok
12:53EvanRmr_rm_: head scratch, why is that more icky than throwing the results away? IO actions often result in a response value
12:53BronsaEvanR: sorry I mix dorun and doall in my head every time
12:54borkdudehistory question: what led to clojurescript one being abandoned
12:54EvanRyeah so doall seems the most appropriate, it even has a do in the name
12:54ohpauleezborkdude: The creation of Pedestal App (just a guess)
12:55borkdudeohpauleez can pedestal app be seen as the successor of clojurescript one?
12:55ohpauleezI'd imagine so, to some degree
12:55borkdudeohpauleez interesting, didn't know that
12:55EvanRwhere is dedupe defined ...
12:56cbryanin 1.7 ;)
12:56ohpauleezLineage looks like Brenton on CLJS:One, Chris on Pinot, Myself on Shoreleave
12:56EvanRff
12:56EvanRs
12:56ohpauleezBrenton then doing Pedestal App (with others), Pinot being broken up
12:56justin_smith$source dedup
12:56lazybotSource not found.
12:56cbryanhttp://crossclj.info/fun/clojure.core/dedupe.html
12:57ohpauleezThen walking away from Pedestal App to collect our thoughts on React and core.async some more
12:57mr_rm_EvanR: what throws the results away?
12:57mr_rm_EvanR: but yeah... probably best to have doall on the outermost call to make it obvious
12:58bordatoueis there any alternative to read-string
12:58bordatouehow do i know which name same read-string belong to
12:59justin_smithbordatoue: there is clojure.edn/read-string
13:01EvanRthat dedupe code is now stoled
13:03ohpauleezborkdude: You can also just use `read`
13:03ohpauleezand you already said it worked in the REPL, right?
13:03ohpauleezso if it works in the REPL, it'll work in your file. It's unclear what you're really trying to do
13:04ohpauleezbut you're essentially doing the same thing the repl does (Read, eval)
13:04EvanRvolatile! not defined...
13:04justin_smithohpauleez: I think you meant to reply to bordatoue
13:04ohpauleezjustin_smith: borkdude: bordatoue: Yes, sorry about that
13:04ohpauleez:)
13:06EvanRgah getting stuck on this dedupe thing, using old clojure strikes back
13:07{blake}OK, I need some help with partition-by. Like, maybe I'm misusing it. I'm using hiccup to convert a collection ("FieldName1" {:thing "value1" :group "group1"}, "FieldName2" {:thing1 "value3" :group...) into a Bootstrap table. This works.
13:08{blake}But I now want to partition the controls by the ":group" key in the associated map. So I use "(partition-by #(:group(val %))" which returns a list of lists for each partition.
13:09justin_smith{blake}: are you sure you want partition-by and not group-by?
13:10justin_smithpartition-by is for ordered things, maps are not ordered
13:10{blake}justin_smith, I think so. Besides :group, I also have a :row. The controls have to come out in row order, but they need to break by group. (Which, theoretically, should be continuous.)
13:10justin_smithoh, I misunderstood, that is not a map
13:10justin_smithsorry
13:10{blake}justin_smith, Well, maybe that's where I'm going wrong.
13:11ohpauleezbordatoue: you can also look at `load-file` - http://clojuredocs.org/clojure.core/load-file
13:11{blake}justin_smith, Well, it =could= be. I'm not even sure why it's a list, actually. The field names are unique.
13:11justin_smith(partition-by (comp :group second) (partition 2 coll)) ?
13:11{blake}Oh, I know why: because I sort it.
13:11{blake}justin_smith, The partition-by works. The problem is I can't figure out how to work with the results.
13:12{blake}Like, when it's just a straight list, I have "(map input-to-control inputs)". Easy
13:12justin_smith(for [inputs partitioned input inputs] (input-to-control input))
13:12{blake}Once it's partitioned, I've got (first (map #(map input-to-control %) inputs) to get the FIRST group. But I can't figure out how to apply that to ALL the groups.
13:12bordatoueohpauleez: but load-file is from repl, what if i want to work output side of repl
13:13ohpauleezNothing is repl-specific
13:13ohpauleezYou have access to whatever piece of Clojure code you want
13:13{blake}justin_smith, There it is. Thanks.
13:21bordatoueohpauleez: clojure.core/read-string works in repl but outside of repl it doesn't parser double quotes so "abcd" become abcd
13:21bordatouei don't know why that is
13:22justin_smithbordatoue: I don't think that is true
13:22justin_smithbordatoue: how are you verifying this?
13:22bordatouewell ;you create a clj project read some fn from an external file with double quotes using read-string
13:22bordatoueit gets messed up
13:23justin_smithbordatoue: is the function definition inside double quotes?
13:23bordatouejustin_smith: no
13:23justin_smithand what does "messed up" mean?
13:23TimMcYou're saying that if I create a file with these 3 characters: \" \a \" and call slurp and read-string on it, I will get... what?
13:24bordatouejustin_smith: it means all the double quotes are gone so if i have a (.split "abcd" ".") it becomve (.split abcd .)
13:24TimMcI would expect String "a"
13:24{blake}(inc justin_smith)
13:24lazybot⇒ 114
13:24TimMcbordatoue: Please create a SSCCE. This doesn't seem right/
13:24justin_smithbordatoue: how do you know that happened?
13:25Bronsabordatoue: http://sprunge.us/bdVi
13:25bordatouei printed it to the console
13:25justin_smithbordatoue: that's your problem
13:25justin_smithuse prn
13:25justin_smith,(print "abcd")
13:25clojurebotabcd
13:25justin_smith,(prn "abcd")
13:25clojurebot"abcd"\n
13:25justin_smithI knew it
13:25TimMc,(print 'abcd)
13:25clojurebotabcd
13:26TimMc,(prn 'abcd)
13:26clojurebotabcd\n
13:26bordatouejustin_smith: ok will use prn
13:32successHi
13:33successunder downloads there is lot of stuff
13:33successwhat do I need to do to just test some clojure
13:33justin_smithsuccess: most projects use lein
13:33justin_smithsuccess: and either lein test or lein midje will run the tests in most clojure projects, if you literally mean running the unit tests
13:34justin_smithif you mean "try using clojure" just download lein and run lein repl
13:36lynaghkhiredman: I've been looking at your datalog implementation (https://github.com/hiredman/datalog): do you have any writeups or references about the algorithm it uses?
13:37bbloom_is there any notion of an optional dependency?
13:37lynaghkhiredman: I just did a naive bottom-up implementation, but yours is about twice as fast on my toy dataset---not sure if it's a difference in algorithm or just some well placed code optimizations. I'm having a hard time following the code, so I thought I'd pop in and ask = )
13:37bbloom_ie do one thing if some dependency is available, do something else otherwise
13:38justin_smithbbloom_: you could hack something with resolve I guess...
13:39cbryan,(if (nil? (find-ns 'blah)) (println "nope, do A") (println "ok do something, B"))
13:39clojurebotnope, do A\n
13:39bbloom_justin_smith: i'm trying to figure out how to structure a development environment for a multi-component system. i don't want to require every dev run every service all the time while developing
13:39justin_smithbbloom_: yeah, makes sense
13:39justin_smithfind-ns is a nice idea for that too
13:40bbloom_(doc find-ns)
13:40clojurebot"([sym]); Returns the namespace named by the symbol or nil if it doesn't exist."
13:40bbloom_hm
13:40cbryanbbloom_: my example was for you ;)
13:40justin_smithso you could wrap code in find-ns / resolve
13:40justin_smithyou still need resolve, or the compilation will fail
13:41bbloom_thanks, i'll think about this a bunch
13:41cbryanjustin_smith: why would resolve be needed?
13:41nestastubbsbbloom_: use a services/component model at runtime
13:41cbryan(not saying it wouldn't, i just don't immediately see why)
13:41nestastubbsbbloom_: and provide mocks/stubs
13:41justin_smithcbryan: because your attempt to call things in that ns would fail at compilation time
13:41nestastubbsfor the components
13:41bbloom_nestastubbs: in past projects i've relied on dns, hosts files, etc
13:41cbryanjustin_smith: oh, duh. ha
13:42bbloom_nestastubbs: jetty configs, etc
13:42justin_smithcbryan: it's not enough that the code referencing it not be called, it is still looked for when compiling
13:42nestastubbssure, you could have teh system builder look at those to decide how to proceed
13:42nestastubbswe use sfnks
13:42bbloom_well, i have the added problem of evolving a relatively monolithic app
13:42nestastubbsand then a configuration map and a service definition map are combined to make the running system
13:42justin_smithbbloom_: when I have made similar things, I opted for passing everything in explicitly rather than using things via their ns.
13:42clojurebotExcuse me?
13:42justin_smithbbloom_: which is clumsy in its own way
13:43nestastubbsbbloom_: highly localized solution then 8)
13:44bbloom_would be nice to have only one jvm running, if i can help it
13:45bbloom_since it's all clojure and repl-friendly
13:47cbryanwhat's the difference between a function and a "special form"? I assume special forms do something that works with the innards of clojure? http://clojure.org/special_forms#Special Forms
13:47justin_smithcbryan: special forms are implemented in java
13:47Bronsacbryan: they have custom evaluation semantics
13:47cbryanmakes sense. thanks!
13:48Bronsajustin_smith: some functions are too though
13:48Bronsae.g. in-ns
13:48justin_smithBronsa: good point, thanks
13:52successlein is short for leiningen
13:53justin_smithyes, the executable is called lein
13:55mi6x3mBronsa: hey, in tools-analyzer, would resolve-var return nil if the symbol is not a variable?
13:56Bronsami6x3m: no. resolve-sym would have been a better name but it's too late to change now
13:57mi6x3mBronsa: well what would it do if the symbol is not a var?
13:57mi6x3mjust return nil to the caller?
13:58Bronsami6x3m: not sure I understand what you're asking
13:58mi6x3mhm, this won't make any sense actually
13:58mi6x3mno, wait, was just a bit mind-blurred
13:59Bronsami6x3m: resolve-var returns whatever the symbol maps to in the namespace
13:59Bronsami6x3m: if it doesn't map to anything, it will return nil
13:59Bronsami6x3m: in case of t.a.jvm, resolve-var can return a Var or a Class
14:00mi6x3myes, this was the issue more or less
14:00mi6x3mabout classes
14:01Bronsami6x3m: what's the issue? just test with `var?`
14:01mi6x3mresolver_"var" is really tricky name :)
14:02Bronsami6x3m: yes, definitely. it used to actually resolve Vars only back when t.a and t.a.j were still a single entity
14:02Bronsami6x3m: in the process of making t.a modular & host agnostic foreseeing the implementation of t.a.js resolve-var was changed to return whatever the mapping was but the name remained the same
14:04mi6x3myes that clarifies it
14:04mi6x3mit returns a mapping, not a var
14:04mi6x3mfor jvm :)
14:04Bronsami6x3m: well in the docstring I talk about a var, not about a Var
14:05mi6x3mthat's the truth!
14:05successshould I really put lein in ~/bin and make it executable? i dont know much about security yet, I use ubuntu.
14:06cbryanyeah, you can trust it
14:06cbryanas long as you got it from https://github.com/technomancy/leiningen i should say
14:07cbryanalso, ubuntu has it in its repos. try "apt-get install leiningen"
14:07successhttp://leiningen.org/
14:08successwill sudo apt-et install leiningen put it under bin?
14:08justin_smithsuccess: cbryan: ubuntu's version is old isn't it?
14:10amalloysuuuuper old
14:10cbryan[...] Version: 1.7.1-
14:10cbryaneesh
14:11amalloysuccess: download lein from github. putting stuff in ~/bin is a pretty normal thing to do and doesn't have any security issues i'm aware of
14:11cbryan^ yeah, ignore the apt-get line :)
14:11justin_smithamalloy: well the security issue would have to do with the provenance of the thing you put in ~/bin
14:12csd_spending over an hour getting frustrated until realizing i need to `lein clean`, priceless
14:12justin_smithbut we all use the lein from technomancy's github, so there's that
14:12cbryantechnomancy's playing the long game
14:12cbryan;)
14:13amalloyjustin_smith: well, that's more an issue of putting stuff anywhere on your PATH, not of ~/bin
14:20justin_smithamalloy: right
14:22successwhy are there 3 places to download it from+github?
14:22success+ packet manage si mean
14:23cbryanto try to make it easy as possible to get started
14:23cbryans/easy/as easy
14:25successwhat editor is the most popular? please dont say emacs :)
14:25hfaafbemacs
14:27amalloysuccess: well, if you didn't want emacs as the answer, you asked the wrong question
14:27successno eclipse plugin?
14:27amalloythe question you may have meant is "what editor should i use?", which has quite a different answer
14:27Bronsasuccess: cursive clojure is great
14:27cbryani use sublime text personally
14:27joshuafcoleIf you really don't want to go with emacs, Light Table isn't nearly as popular (it's very young and has a few rough edges to iron out), but it has a really solid feature set for working with clj/cljs
14:27hfaafbLIGHT TABLE
14:27successhow do i quit the repl
14:27cbryanctrl + d
14:28joshuafcoleSublime Text is also popular, though it wasn't flexible enough for my tastes
14:28justin_smith(System/exit 0) works too
14:28cbryanyeah, im planning to learn emacs asap
14:29amalloysuccess: use whatever editor you're already comfortable with. as long as it's not notepad.exe, there's decent clojure support for it
14:29amalloyand you don't really *need* any editor support anyway: you can load files from the repl, or copy-paste snippets to it, whatever
14:30amalloythe important thing is to have as little irrelevant nonsense in the way of learning clojure, and there's little benefit to picking the editor used by clojure experts if you don't know how to use it
14:32successhow do I run my clojure file as a program rather than run the repl?
14:33cbryanhttps://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md read that
14:35dbaschsuccess: the easiest way is probably “java -cp path/to/clojure.jar clojure.main yourfile.clj”
14:35dbaschbut it’s much better to have a leiningen project
14:36successyeah, using leinengen bow
14:36success ty all
14:36successunforetuneately the status of clojure on android is depressing
14:36mwfoglemanYeck, refactoring a file has exposed a circular dependency.
14:42dbaschclojure jobs supposedly pay well these days: https://msgooroo.com/GoorooTHINK/Article/16225/Programming-languages--salaries-and-demand-October-2014/17081#.VFfalfTF8a4
14:43justin_smithsuccess: yeah, clojure is great but it is kind of resource-hungry
14:43Glenjamininteresting, i'm surprised to see fortran so low
14:43Glenjaminleft-side skewed by lack of data i guess
14:51EvanRnice clojure stats there, most expensive, nearly lowest demand
14:52EvanRcan i haz average clojure weight salary plz
14:52borkdudeEvanR 60 euros per gram
14:53mi6x3mgood one
14:54EvanRcan imagine most job ads literally saying c/c++ which would account for the coincidence of C and "C++ Developer"
14:55EvanRwonder where Swift is ;)
14:55mi6x3mEvanR: this is non-sense anyhow. a proper job ad should say "experienced developer with some common sense" without mention of any languages
14:55amalloymi6x3m: "strong background in english recommended"
14:55mi6x3mhehe
14:56AimHereAlternatively other job adverts could follow suit. "Housepainter required. Must have had 3-5 years experience of brown paint"
14:56borkdude"should be able to port clojure's persistent vectors in C "
14:56joshuafcole(inc AimHere)
14:56lazybot⇒ 3
14:56joshuafcoleheh
14:57EvanR"if programming languages were colors of paint"
14:58EvanRdoes polka dot, striped, and plaid count
14:58borkdudeHackers and Painters
14:59cbryanwhat if i've mixed other colors together and it ended up brown, but i've never really worked with brown directly...?
15:00EvanR3-5 years spaghetti code
15:00dbaschhttps://www.dropbox.com/s/dn6fktq73fxzapk/Screenshot%202014-11-03%2011.59.06.png?dl=0 “if programming languages were…"
15:00csd_is spaghetti code still bad if you are working for food service companies
15:01joshuafcoleheh
15:01joshuafcoleDepends on the ratio of meatballs
15:01borkdudespaghetti's no problem if you can just cut right through it
15:01joshuafcoleeven in the food industry, if it's all spaghetti you're not doing to hot
15:01csd_i like my code al dente, mostly
15:01joshuafcoles/to/too
15:02teslanickThat would be a good food service industry startup name: SpaghettiCode.
15:02joshuafcolequick tip: If you add a sprinkle of salt to the water before adding the code to the pot, you get improved security for free.
15:02csd_haha
15:04mwfoglemanhuzzah, i have resolved this circular dependency. how does everyone here prevent and handle prevent circular dependencies?
15:05dbaschmwfogleman: modular design?
15:06EvanRrefactor
15:06EvanR,(distinct [1 1 2 2 1 1])
15:06clojurebot(1 2)
15:07success(defn -main
15:07success "I don't do a whole lot."
15:07success [& args]
15:07success (println "Hello, World!"))
15:07successJava is still a good bet, I mean Clojure might be high in pay but it is low on#jobs
15:08cbryanmwfogleman: if i'm where i am now, with incomplete structs :(
15:09m1dnight_+go info
15:09m1dnight_sorry 'bout that
15:10successorg.apache.maven:super-pom:pom:2.0
15:10justin_smithmwfogleman: usually, by pulling commonalities into something more abstract, like a protocol or defmethod that both sides can refer to
15:11justin_smithmwfogleman: or when things are super bad (like fixing someone else's code and things are way tangled and wanting to alter as little as possible while still cleaning up) I may use resolve. It feels dirty when I do that though.
15:12dbaschresolve, courage and determination are useful when cleaning other people’s code
15:13EvanRluck
15:13dbaschluck is useful even when not cleaning someone else’s code
15:13justin_smithheh
15:14Glenjaminintegration/acceptance tests are also handy
15:14mgaareit's like cleaning a hotel room after a rock band has been there
15:14SagiCZ1hi, anyone know clj-time? i have a datetime object, and i want to have a copy of that object just with a different minutes for example 1970-1-1-16-36 ->1970-1-1-16-n. How can i do that?
15:14mgaareif you're lucky, it wasn't John Bonham
15:15successafter installing lein, how do i install all the necessary java stuff?
15:15success1 required artifact is missing.
15:15successfor artifact:
15:15success org.apache.maven:super-pom:pom:2.0
15:15success3
15:16justin_smithsuccess: lein does it. If it doesn't work then the project.clj or your .lein/profiles.clj should be fixed
15:16EvanRSagiCZ1: you can add a number of minutes equal to the difference of 36 and n
15:17success1 required artifact is missing.
15:17successfor artifact:
15:17success org.apache.maven:super-pom:pom:2.0
15:17successoops
15:17success(defproject app "1.0.0-SNAPSHOT"
15:17success :description "FIXME: write description"
15:17success :dependencies [[org.clojure/clojure "1.3.0"]])
15:17mgaareSagiCZ1: either add or build a new object from your old one d like, (date-time (year d) (month d) (day d) (hour d) n)
15:17SagiCZ1EvanR: i know, but the difference is what i want to find out.. i have one date, and i want to know how many minutes till some n number of minutes. I can use t/interval for that, but i dont know how to construct the other day
15:17Bronsasuccess: it loks like you're using a super old version of lein if it defaults to clojure 1.3
15:17SagiCZ1mgaare: yeah thats what i figured, but thats so ugly
15:18EvanRSagiCZ1: the literal difference in minutes if given by subtracting one minutes x from the other minutes x
15:18EvanRah but thats another story entirely
15:19SagiCZ1i am basically trying to implement "rounding" of dates to some predefined time periods.. (like tens of minutes, days.. etc) .. cant believe joda doesnt have it
15:19EvanRSagiCZ1: if you convert to unix time, truncate mod 60, 3600, or 86400 then this might get you closer
15:19llasram(inc EvanR)
15:19lazybot⇒ 2
15:20llasramJust what I was about to suggest
15:20mwfogleman(inc EvanR)
15:20lazybot⇒ 3
15:20mgaareSagiCZ1: you can also drop down to java, to set: .withMinuteOfHour
15:20mr_rmSagiCZ1: use the plus function?
15:20mwfoglemanjustin_smith: can you say more about how resolve is helpful in such a situation?
15:20mgaareSagiCZ1: joda has more stuff than clj-time exposes directly
15:20SagiCZ1EvanR: that's not a bad idea.. some math though :)
15:21justin_smithmwfogleman: it's a hack - resolve takes a keyword and returns the var it reresolves to, so you can call something that was not defined when your code was compiled
15:21SagiCZ1mgaare: sounds good
15:21justin_smithmwfogleman: it's a sign of bad design, but it can just make things work
15:21EvanRhopefully .withMinuteOfHour doesn't modify the Date object in place
15:22SagiCZ1doubt it.. isnt joda all about how traditional java date is horrible because it is mutable
15:22mgaareEvanR: it does not.
15:22EvanRSagiCZ1: to find the number of minutes between to timestamps, you do a time diff, which gives a number of seconds, and round to nearest 60 (div by 60, times 60)
15:22EvanRer, forget the times 60
15:23EvanRgive or take one minute
15:23mgaarebtw, cider's inspect functionality is great for this kind of thing
15:23SagiCZ1EvanR: i know i can find out the difference between two timestamps, but first i have to generate the other timestamps.. for example if i want to round to quarter hours, i have to take the timestamp i want to round, and generate the same timestamp with 00 15 30 45 minutes, then i can do the diff and find the minimal
15:24mwfoglemanjustin_smith: i tried to use resolve to get around the bug i was bumping into with user.clj and defrecord. it was not sustainable.
15:25joshuafcoleHmm you can get the minutes, take the mod of the interval as previously recommended, then scale it to 1 and round it
15:25joshuafcoleto get the nearest
15:25EvanRSagiCZ1: what are the special times you are diffing against?
15:25EvanRquarter hours?
15:25joshuafcole(or just (> (mod minutes interval) (/ interval 2))
15:25SagiCZ1EvanR: they are passed as parameter.. it can be anything.. 1 minute, 5 minutes, 15 minutes, 1 hour, 5 hours, 1 week.. so on
15:26EvanRinteger math on the seconds should work fine
15:26joshuafcoleI think it still works without focusing on minutes if you use it as a timestamp like mentioned
15:26EvanRthe next 15 minute timestamp after t is ((t / (15 * 60)) + 1) * (15 * 60)
15:27EvanR(integer division)
15:27SagiCZ1where t is number of seconds?
15:27EvanRyeah
15:27csd_,(let [m {:a {:aa 1 :ab 1} :b 2}] (assoc (:a m) :c {:b (:b m)}))
15:27clojurebot{:c {:b 2}, :aa 1, :ab 1}
15:27justin_smithmwfogleman: well, yeah, resolve would help with vars but I don't think it would help for classes
15:28arrdemWhy is NaN not a reader sybol...
15:28EvanRSagiCZ1: the 15*60 can be your parameter, 1 minute is 60, 1 hours is 3600 etc
15:28Bronsaarrdem: it is in tools.reader :3
15:28justin_smith,Double/NaN
15:28clojurebotNaN
15:28arrdemBronsa: and it is in Oxlang too :P
15:28EvanRSagiCZ1: "1 week" works, but note that "1 month" doesnt really
15:28Bronsaarrdem: also [+-]Infinity
15:29llasramBronsa: yay!
15:29EvanRtechnically, neither does a year ;)
15:29llasramThat one has also hit me in the past
15:29SagiCZ1EvanR: i am not sure i understand the formula, how did you come up with it?
15:29SagiCZ1EvanR: seems robust though
15:29Bronsallasram: arrdem http://dev.clojure.org/jira/browse/CLJ-1074 vote!
15:29arrdemBronsa: pretty much convinced this is worthless but sure
15:30Bronsaarrdem: me too but it never hurts
15:30llasramBronsa: I need to remember what other tickets I voted for and remove my votes from there first....
15:30EvanRSagiCZ1: well, it relies on properties of integer division
15:30Bronsallasram: I voted so many tickets my vote is worth nothing right now
15:31TEttingerEvanR, so it would need some changes from the / fn in clojure
15:31EvanRSagiCZ1: maybe you should study the formula (t / d) * d
15:31rplacaSagiCZ1: man, it seems a whole lot easier just to stay in joda time and not switch to unix time
15:31EvanRTEttinger: guess so
15:31rplacajoda time has all the primitives that you need
15:31TEttinger,(div 15 60)
15:31clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: div in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:31SagiCZ1rplaca: really? i dont think you are correct.. since i need to handle kinds of time units
15:31TEttinger,(quot 15 60)
15:31clojurebot0
15:32SagiCZ1*all kinds of
15:32EvanR,(quot 1234 60)
15:32clojurebot20
15:32EvanR,(quot-rem 1234 60)
15:32clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: quot-rem in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:32SagiCZ1rplaca: i would need to have different cases to call different functions if i wanted to stick to joda primitives
15:32TEttingerlooks like quot is what we're after
15:32EvanR,(rem 1234 60)
15:32clojurebot34
15:32rplacaSagiCZ1: joda time has primitives for that, look at DateTimeFieldType
15:33rplacaand the use .withField
15:33EvanRrplaca: i think that makes his job harder
15:34rplacaSagiCZ1: do what feels best to you, though, but rounding to arbitrary units should be really easy
15:34EvanR"the next even time mod X" isnt just about zeroing out a field
15:35rplacaEvanR: of course. joda has aggregates.
15:36SagiCZ1the approach evanR suggested solves all overflows pretty well
15:36rplacabut if you feel more comfortable converting to seconds and rounding, go for it
15:37justin_smithwoo, almost done verifying everything in lazybot/plugins/util.clj
15:37successhow did you instsall cider?
15:37mr_rmwill simple rounding work for cases like leap year, daylight savings time, etc?
15:37EvanRits not really rounding, but doing this field by field is like trying to do decimal arithmetic by specifically checking the ones place, tens places, etc rather than treating the numbers as an arithmetic field of their own, which timestamps are
15:37arrdemsuccess: M-x package-install RET cider RET
15:37EvanRmr_rm: yes
15:37successnope
15:38arrdemsuccess: you'll also need to add cider to your .lein/profile.clj
15:38successno match
15:38arrdemsuccess: what emacs package repos do you have?
15:38TEttingersuccess, did you type out RET or actually hit newline?
15:38successhiw enter
15:38TEttingerk
15:39andyfBronsa: arrdem: Alex Miller has said that he often looks at unweighted vote counts on tickets, too, so no need to unvote when voting unless you really want to
15:39arrdemBronsa: yo do you still have ns->sym kicking around somewhere? I seem to have lost it
15:39EvanRmr_rm: leap years is a detail of a calendar, this is about time diffs. DST is about certain local times, but i assume hes doing this all in UTC
15:40arrdemBronsa: nvm got it
15:41Bronsaandyf: yeah I don't unvote tickets
15:42andyfBronsa: I look at those reports when I regenerate them, so was fully aware :-)
15:42Bronsaheh
15:44mr_rmEvanR: i missed part of the conversation so sorry if i missed the relevant pieces but it seems like zeroing out the low order fields and using clj-time.periodic does what he wants. or using the plus function after starting from (now). i wasn't sure what you were rounding
15:45EvanRmr_rm: which fields are the low order fields?
15:45mr_rmanything below the one he wants to use to iterate on
15:46EvanRseems like a roundable way to go about it
15:46EvanRroundabout
15:48arrdemBronsa: andyf: is there an open ticket for Named over c.l.Namespace?
15:49successthreading is with Java thread?
15:49mr_rmEvanR: it can be but then every leap year and every switch to and from DST seems to cause a lot of issues in large companies where i've worked. sometimes it's actually simpler to just use a well-debugged library.
15:49EvanRmr_rm: well, depending on what you think is supposed to happen during DST, my way might be more robust and obviously has less code
15:50EvanRattempting to operate on the mixed-base 6-place local time rep as if it was arithmetic could land you directly in an invalid or ambiguous time value
15:50Bronsaarrdem: didn't you open one this summer?
15:50arrdemBronsa: that's Named over Vars
15:50EvanRmr_rm: and leap years do not apply at all
15:50successhow would I override a java method from clojure?
15:51Bronsaarrdem: ah
15:51cbryansuccess: i would run through this great guide: braveclojure.com
15:51andyfarrdem: Not that I recall. Your ticket for Named on vars is the only one related to Named that comes to mind. Caveat: despite rumors to the contrary, I don't have all the tickets in my head :-)
15:51Bronsaarrdem: I don't think named over namespace makes sense either :P
15:51Bronsaarrdem: there's already ns-name
15:51mr_rmEvanR: depends on whether you are trying to manually roll over hours, months, years, etc. but if you're doing it manually you're probably doing it wrong :)
15:51arrdem(inc Bronsa)
15:51lazybot⇒ 66
15:52EvanRmr_rm: head scratch. if the question is how long until X, then theres no rolling over anythin
15:53SagiCZ1EvanR: so how would converting time from unix to some joda time handle leap years? why should that be an issue? i assumed it would just work
15:53mr_rmEvanR: well he did say he was trying to generate something like a periodic sequence from the current time
15:53EvanRSagiCZ1: so far, you havent seemed to need to convert from unix time to joda time
15:54mr_rmoh i see... nm... you're going from the epoch, moving it to and from a joda object
15:54EvanRSagiCZ1: heh, are you doing a recurring event calendar / scheduler ;)
15:54SagiCZ1EvanR: i tested the method you offered but it's not exactly what i need
15:55SagiCZ1for example this (align (t/date-time 1970 1 1 15 31) (* 60 5))
15:55SagiCZ1results in this #<DateTime 1970-01-01T15:36:00.000Z>
15:55SagiCZ1but when i specify period of 5 minutes, i mean 00 05 10 15 20 25 30 35 ... etc
15:55EvanRwell, what i suggested wouldnt be doing that
15:56SagiCZ1https://www.refheap.com/92663
15:57EvanRyou cant literally use /, thats floating point division
15:57EvanRtry quot
15:58SagiCZ1EvanR: oh.. now its better
15:58amalloySagiCZ1: are you doing something like https://github.com/flatland/chronicle ?
15:58EvanRalign as you defined it would give you the next such timestamp, aligned to period, in UTC
15:58arrdemtechnomancy: is there a good trick for dropping a REPL in a plugin's dependency injected context rather than in the leiningen bootstrap context?
15:59SagiCZ1EvanR: it works well, thank you.. it looks very elegant and robust. i would introduce too many bugs if i went another way
15:59SagiCZ1(inc EvanR)
15:59lazybot⇒ 4
15:59EvanRthat chronicle thing also looks good, letting the user specify something more complex
15:59EvanRbut make sure you understand what happens during DST
16:00EvanRand days 29-31
16:00SagiCZ1amalloy: Actually, this is an alignement of candlesticks on a stock chart.. i need to always align the first candle to some whole number of periods
16:00SagiCZ1EvanR: i think the correct thing happens
16:01EvanRhehe the correct thing regarding period across dst change ;)
16:01EvanRwhatever that is
16:01EvanRi think most crons do something unexpected, and no one cares
16:02SagiCZ1EvanR: i will test it in the production, no worries ;)
16:11SagiCZ1,(disj #{:A :B :D :W} #{:D :W :M})
16:11clojurebot#{:A :W :D :B}
16:12SagiCZ1why doesnt it remove :D and :W ?
16:12llasram(doc disj)
16:12clojurebot"([set] [set key] [set key & ks]); disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s)."
16:12justin_smithSagiCZ1: maybe you want clojure.set/difference
16:12llasramSagiCZ1: Try (apply disj ...)
16:12noonianSagiCZ1: because you are trying to remove an element which *is* a set
16:12justin_smithor that
16:13SagiCZ1oh i see.. thanks
16:17TEttinger,(apply disj #{:A :B :D :W} #{:D :W :M})
16:17clojurebot#{:A :B}
16:17SagiCZ1TEttinger: yeah, i used that
16:17TEttingercool
16:20mr_rm(disj #{:A :B :D :W} :D :W :M)
16:20mr_rm,(disj #{:A :B :D :W} :D :W :M)
16:20clojurebot#{:A :B}
16:20mr_rmyou are supposed to supply 1 or more keys after the set
16:20EvanRSagiCZ1: drawing markers are regular intervals comes up a lot when drawing guis, its easy with integer arithmetic. i just realized all that stuff has not much to do with time ;)
16:22SagiCZ1EvanR: i realized the formula is really elementary math, i hope i would be able to come up with that if i focused on unix time... yeah im glad there is incanter so i won't be drawing any ticks on axises by hand
16:30successcan I not use println with recur?
16:30SagiCZ1success: how would you want to use it? println returns nil btw
16:32successif (cond) ((println val) (recur (+ val 1))) (println "done"))
16:32justin_smithsuccess: you have an extra set of parens
16:32amalloysuccess: () is not a grouping construct; it calls functions
16:32justin_smithotherwise it looks decent
16:32justin_smithmaybe you want (do ...)
16:32SagiCZ1try this (if (cond) (println val) (recur (+ val 1)) (println "done"))
16:33justin_smithdepends if it should print before every recur, it's ambiguous
16:33amalloySagiCZ1: no. (if cond (do (println val) (recur (inc val))) (println "done"))
16:34amalloyyes, i suppose SagiCZ1's is a possible interpretation. it seems unlikely to me, but it's not impossible
16:34SagiCZ1sorry, i meant it amalloy's way
16:37successhttp://lpaste.net/113712
16:37successthe println i is never printed
16:37successand then i get a nullpointerexception
16:37successhttp://lpaste.net/113712
16:38amalloysuccess: the NPE is because main is trying to use () for grouping again
16:39dbaschsuccess: you’re calling the value of (println …) which is nil
16:39dbaschactually run-thread
16:39dbaschno, println on run-thread
16:39dbasch(nil (run-thread))
16:40successso how should I do?
16:40dbaschsuccess: why do you have that ( on line 25?
16:42successOk that got rid of the nullpointer
16:42successbut the value of i is never written
16:43dbaschsuccess: you never increment i
16:43nooniansuccess: thats because in thread-loop, you only recur if i equals 10, so i never is 10 and you just print done
16:44successhehe oops
16:44successnow it works
16:44dbaschsuccess: btw, you want dotimes in that situation
16:50sdegutisAre there any functionality in Clojure that can't be performed reliably when you deploy the app as an uberjar?
16:51nestastubbsreliably?
16:51nestastubbsnot sur what that means
16:51nestastubbscrashes?
16:51Glenjaminyou can't set jvm opts via project.clj
16:51nestastubbsyou have to make sure you access resources and not files
16:52noonianthats the biggest thing i've ran into
16:52borkdudesdegutis logging to a directory outside resources
16:53borkdudejust logging, to a configurable directory that is
16:54Glenjaminstdout 4 life
16:54successso how is STM better than locking? you cant have deadlocks?
16:55SagiCZ1success: there are no locks
16:56sdegutisWhen I asked that question, I had dynamic features in mind.
16:56justin_smithsuccess: it can be faster, because in the common case there is no concurrent change so little overhead
16:56sdegutisSuch as finding namespaces dynamically at runtime via constructed strings and loading them.
16:56sdegutisI am very fond of the convention-over-configuration approach and find it to be very senseful, thus I wish to applicate it to my website.
16:56llasramsdegutis: That will work fine as long as the namespace source is actually there
16:56llasramsdegutis: OTOH, ewwwwwww
16:57successjustin_smith, you mean that most of the time when you use locks there will be very few times where it will actually block another thread but it still locks?
16:57sdegutisllasram: I too once preferred explicit-over-implicit as the Clojure community favors.
16:57sdegutisllasram: But over time, though, I have seen the merit in not writing nearly so much code.
16:57successis acquiring a lock expensive? isnt it just reading a bit or two?
16:58justin_smithsuccess: a write that can be seen by other threads is expensive, the fewer of them the better
16:59sdegutis,(def transdeuce transduce)
16:59clojurebot#'sandbox/transdeuce
16:59justin_smithsuccess: with a ref, you read, optimistically perform the calculation, compare, (set or retry) - there is only one cross thread visible write
16:59dbaschsuccess: if you’re asking that question, you may want to read about locks http://en.wikipedia.org/wiki/Lock_(computer_science)
17:00sdegutis,(transdeuce (comp (filter odd?) (map inc)) + (range 10))
17:00clojurebot30
17:01sdegutisFrom an API point of view, I don't see why (transduce) isn't just (reduce).
17:01Glenjamin(doc transduce)
17:01clojurebot"([xform f coll] [xform f init coll]); reduce with a transformation of f (xf). If init is not supplied, (f) will be called to produce it. f should be a reducing step function that accepts both 1 and 2 arguments, if it accepts only 2 you can add the arity-1 with 'completing'. Returns the result of applying (the transformed) xf to init and the first item in coll, then applying xf to that result and the 2nd item, etc. If
17:02Glenjaminsounds like reduce :s
17:02justin_smithexcept for the xform arg
17:02Bronsasdegutis: there's no "transducer" type, reduce wouldn't be able to understand whether it had to act like transduce or like reduce
17:02sdegutisOk.
17:05SagiCZ1is something wrong with
17:05SagiCZ1,(doall (concat (conj [1 2 3 4] 42) [99 101]))
17:05SagiCZ1?? can it do anything unexpectd? like not adding the [99 101] coll for some reason?
17:05clojurebot(1 2 3 4 42 ...)
17:05SagiCZ1,(doall (concat (conj [] 42) [99 101]))
17:05clojurebot(42 99 101)
17:07noonian,(doc concat)
17:07clojurebot"([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."
17:07noonianSagiCZ1: you don't need the doall unless you are printing it or something
17:08noonianyou don't need to worry about lazy seqs losing data if thats what you are asking
17:09SagiCZ1noonian: i need the doall, because this call is in a recur and i was getting a stack overflow without it.. i guess the lazinnes was chaining and then tried to explode it in the end..... i found my mistake though, it was something else, thanks
17:10amalloySagiCZ1: just use into instead of concat, and then the doall problem never arises
17:10SagiCZ1amalloy: cool, forgot about into
17:11Bronsaamalloy: gah I suck at regex
17:11SagiCZ1amalloy: into is also 6 times faster than doall concat
17:12EvanRgotta love constant factor speed up ;)
17:13amalloyBronsa: do you know about the ?x flag? it can help you organize your thoughts a bit, by adding whitespace and comments to hairy regexes
17:14amalloyeg, https://github.com/Factual/drake/blob/develop/src/drake/core.clj#L34-L43
17:14Bronsaah, nice
17:20amalloyi forget how you actually include a \space character in ?x mode, actually. i wonder if it's just `\ `
17:20Glenjamin[ ] ?
17:21amalloy,(re-find #"(?x)[ ]" " ")
17:21clojurebot#<SecurityException java.lang.SecurityException: denied>
17:21Glenjaminwhat
17:21amalloyWHAT
17:21amalloy&(re-find #"(?x)[ ]" " ")
17:21lazybotjava.util.regex.PatternSyntaxException: Unclosed character class near index 6(?x)[ ] ^
17:21amalloy&(re-find #"(?x)" " ")
17:21EvanRregex security you know
17:21lazybot⇒ ""
17:21amalloyoops
17:21Glenjamini guess it's not [ ]
17:21amalloy&(re-find #"(?x)\ " " ")
17:21lazybot⇒ " "
17:22amalloyGlenjamin: no, that would be no good. it's supposed to ignore whitespace so you can put it in whenever you want
17:23Bronsaarrdem: FYI not all dynamic Vars have :dynamic true :/
17:23Bronsa,(remove (comp :dynamic meta) (filter #(and (var? %) (.isDynamic %)) (vals (ns-map *ns*))))
17:23clojurebot(#'clojure.core/*source-path* #'clojure.core/*command-line-args* #'clojure.core/*read-eval* #'clojure.core/*file* #'clojure.core/*use-context-classloader* ...)
17:24TimMcAre those the early ones in core?
17:24arrdemBronsa: I'll take a patch :P doing testing rn
17:24BronsaTimMc: I believe those are the ones set as dynamic in Compiler.java or RT.java, I don't remember
17:25arrdemtrying to coordinate three artifacts into simultaneous releases...
17:26TimMc,(filter #(and (var? %) (not (.isDynamic %)) (:dynamic (meta %))) (vals (ns-map *ns*)))
17:26clojurebot()
17:27BronsaTimMc: :dynamic implies .isDynamic, it's the opposite that's not true
17:28amalloyBronsa: well, you can go the other way as well, by altering the metadata to have dynamic after compilng the var as not-dynamic
17:28amalloyi don't know if that happens in clojure.core, but i've definitely seen people make that mistake
17:28successwhy is thread 1 only printing stuff? http://lpaste.net/113717
17:29Bronsaamalloy: you mean like (def a 1) (defn x [] a) (alter-meta! #'a assoc :dynamic true) ?
17:29amalloyBronsa: yeah
17:29Bronsaah, I guess that's easy to do with declare
17:30justin_smithsuccess: the argument to Thread should be callable
17:31arrdemfuck yeah lein-grim totally works from 0.1.0 on Clojars
17:31justin_smithsuccess: thread-loop is callable, but (thread-loop) does not return a callable I don't think
17:31Bronsauhm, declare might not be problematic after all
17:31arrdemokay. Bronsa. you were telling me I'm wrong.
17:31justin_smithsuccess: similarly with calling thread-1 with an arg
17:31Bronsaarrdem: was I?
17:31arrdemsomething dynamic vars...
17:31Bronsaarrdem: ah, pr incoming
17:32justin_smithsuccess: so what is happening is that clojure runs your funciton - and the return value of that function is passed to Thread as its constructor argument
17:32justin_smithand I think you just want to pass the function itself as the constructor of the thread
17:33justin_smithin the case of (thread-1 r) #(thread-1 r) is a zero argument function that should do what you want
17:33justin_smith,'#(thread-1 r)
17:33clojurebot(fn* [] (thread-1 r))
17:34Bronsaarrdem: let me know if you want different indentation
17:34arrdemBronsa: that makes no functional change.
17:35arrdemwell unless you have a dynamic var with a fn value..
17:35arrdemfine
17:35Bronsaarrdem: I have no idea what that code is used for, feel free to reject the PR if it's useless :P
17:36arrdemBronsa: it may be functionally dead code :P
17:36successjustin_smith, ty that worked
17:37Glenjaminis there a good way to remove a single item from a vector?
17:37SagiCZ1what function would write datastructures to a file, so i could later load them back?
17:37postpunkjustinBy value or index?
17:37Bronsaamalloy: altering :dynamic meta should still make isDynamic return true though, it's just that compiled code won't use it as a dynamic var
17:38SagiCZ1(some-write-foo {:a 0 :b 1} "filepath") --- > (def m (load "filepath"))
17:38Glenjaminby index ideally
17:39justin_smithsuccess: np
17:39justin_smithSagiCZ1: (spit "some-file.edn" (pr-str data))
17:39SagiCZ1justin_smith: and the loading?
17:40justin_smith(clojure.edn/read-string (slurp "some-file.edn"))
17:40SagiCZ1justin_smith: thank you
17:40justin_smithnp
17:40amalloyGlenjamin: best solution is time-travel back to before you decided to use vectors
17:40amalloysince they are not good at this
17:40Glenjamini'm just pondering that myself
17:41Glenjaminthis is for a todomvc sample for a cljs workshop
17:41Glenjaminso trying to keep things simple :s
17:41amalloyalthough, really, any time you use indexes in clojure is a giant honkin' code smell
17:41Glenjaminif i use a map/sorted-map then i have to generate keys
17:42TEttingerordered map?
17:42TEttingeruses a lib, but hey
17:43Glenjamini'd still need a key though
17:43Glenjamini need append, random-access modify & random-access delete
17:44Glenjaminso map + key is probably sensible
17:44EvanRyou dont have a key?
17:44EvanRis this some sort of queue of values
17:44Glenjaminits this: http://todomvc.com/examples/react/#/
17:44EvanRpossible dups
17:45{blake}I'm trying to figure out how hiccup-bootstrap's wrap-bootstrap and include-bootstrap routines manage to point to a particular version of bootstrap (2.2.2) that I don't seem to actually have.
17:45{blake}I presume they must be pointing to somewhere on that Internet the kids are all hopped up on, but I can't figger it out.
17:45EvanRGlenjamin: so these todos, they are just strings. but surely theres some sort of key associated with them in this framework?
17:46Glenjamini can make one, but there's nothing intrinsic, it's just a client demo
17:46EvanRok
17:46Glenjamini suppose in a server-driven app there'd be an autoinc, so i should do that
17:47{blake}What's especially weird is that hiccup-bootstrap-3 ALSO seems to point to 2.2.2, which makes me think that it must be something I've put in somewhere.
17:47EvanRand i would imagine a list of todos is... a list. but clojure may have its own sensibilities here. literally lists seem to be unpopular
17:48Glenjaminlist would work, but edit/remove is then O(n), which implies lists aren't a great fit
17:48EvanRtheres the presentation and the data storage, among others. they dont all have to be the same
17:50SagiCZ1justin_smith: i am getting Underadable form exception when trying to read the file
17:50justin_smithSagiCZ1: you probably put objects in the form that are not valid edn
17:50Glenjaminbah, now i need fmap
17:50justin_smithSagiCZ1: you may want to filter and turn unprintable objects into a placeholder?
17:50justin_smithSagiCZ1: some things just can't be read in by the clojure reader
17:50SagiCZ1justin_smith: oh i totally did.. joda timestamp object cant be serialized like this
17:50amalloyGlenjamin: eh? when are you mapping over a bunch of todos?
17:51Glenjamintick-all
17:51justin_smithSagiCZ1: right, but a java.util.Date can be
17:51SagiCZ1cool
17:51justin_smithSagiCZ1: so you may want to convert before / after saving
17:51Glenjamintodos are apparently the worst data-structure
17:51SagiCZ1thanks, i could do that
17:51justin_smithGlenjamin: clearly a todo should be a prioqueue
17:51justin_smiths/todo/todo-list
17:52EvanRdo you have to update the priority when inserting ?
17:52SagiCZ1justin_smith: btw is there a way to dynamicly find out if the object is unprintable?
17:52EvanRon a lot of elements?
17:53Glenjamin(defn fmap [f m] (reduce-kv (fn [k v] [k (f v)]) m m)) ; is that reasonable?
17:54justin_smithSagiCZ1: (try (read-string (prn x)) true (catch Exception _ false))
17:54justin_smithwhich is terrible because exceptions should not be control flow
17:54justin_smithbut I can't think of any other reliable way to do it?
17:55EvanRcheck if it satisfies the printable interface
17:55cespareHow can I detect whether something is a function for the purposes of multimethod dispatch?
17:56nooniancespare: you can use the fn? and ifn? functions, i'm not sure how that applies to multimethod dispatch
17:57Bronsafn? is not that useful
17:58justin_smithEvanR: which interface is that?
17:58cesparecan someone direct me to the docs for fn?
17:58cespareit's not really googleable
17:58EvanRjustin_smith: yeah i dont know
17:58noonian,(doc fn?)
17:58clojurebot"([x]); Returns true if x implements Fn, i.e. is an object created via fn."
17:58noonian,(doc ifn?)
17:58clojurebot"([x]); Returns true if x implements IFn. Note that many data structures (e.g. sets and maps) implement IFn"
17:59EvanRGlenjamin: for insertion into a long list there is the finger tree based list, though im not sure if it applies to however your framework does lists
18:01justin_smithis there a way to check if a multimethod has an impl for a specific arg?
18:01justin_smiththe thing wanted is the print-dup multimethod
18:01amalloyjustin_smith: kinda. there's get-method, which usually turns out not to be what you want
18:03justin_smith(get-method print-dup java.util.Date)
18:03justin_smith,(get-method print-dup java.util.Date)
18:03clojurebot#<instant$fn__6393 clojure.instant$fn__6393@5a311d>
18:03justin_smith,(get-method print-dup Object
18:03clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
18:03justin_smith,(get-method print-dup Object)
18:03clojurebotnil
18:03justin_smithlooks good!
18:04Glenjaminin case anyone was wondering, that was not a correct implementation of fmap
18:04justin_smith,(defn is-readable [x] (or (nil? x) (boolean (get-method print-dup (class x)))))
18:04clojurebot#'sandbox/is-readable
18:04amalloyhaha, no, i guess it wasn't, was it, Glenjamin
18:04justin_smith,(is-readable (java.util.Date.))
18:04clojurebottrue
18:04amalloylooked good, though
18:04Glenjaminvery close
18:04justin_smith,(is-readable (Object.))
18:04clojurebotfalse
18:04justin_smith,(is-readable 1)
18:04clojurebottrue
18:05justin_smith,(is-readable {)
18:05clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
18:05justin_smith,(is-readable {})
18:05clojurebottrue
18:05Glenjaminsomewhere between the (reduce-kv) and the (into) version
18:05justin_smithEvanR: looks like the above def for is-readable is the right thing
18:05amalloyjustin_smith: you're assuming that printable things are also readable? that's questionable
18:05justin_smithamalloy: print-dupable
18:05justin_smiththat's the point of print-dup
18:06EvanRjustin_smith: wasnt it "is printable" ?
18:06EvanRwhat is "fmap" ?
18:06justin_smithEvanR: anything can be printed, we want the things that can be read in again from a pr form
18:06Glenjamin(defn fmap [f m] "Given a map `m`, apply `f` to each value, maintaining keys" (reduce-kv (fn [acc k v] (assoc acc k (f v))) m m))
18:06Glenjamin,(defn fmap [f m] "Given a map `m`, apply `f` to each value, maintaining keys" (reduce-kv (fn [acc k v] (assoc acc k (f v))) m m))
18:06clojurebot#'sandbox/fmap
18:07amalloymmmm, print-dup is very rarely used, justin_smith
18:07amalloyusually it's just print-method
18:07Glenjamin(fmap inc {:a 1 :B 2})
18:07Glenjamin,(fmap inc {:a 1 :B 2})
18:07justin_smithamalloy: it's the basis for prn
18:07clojurebot{:B 3, :a 2}
18:07amalloyjustin_smith: no it's not
18:07justin_smithamalloy: he was talking about using prn to a file
18:07justin_smith$source clojure.core/pr-on
18:07lazybotclojure.core/pr-on is http://is.gd/jApwbc
18:08amalloyright. and *print-dup* is ~never set to true, so it always goes to print-method
18:08justin_smithoh
18:09amalloy,(binding [*print-dup* true] (prn [1 2 3]))
18:09clojurebot[1 2 3]\n
18:09amalloy,(binding [*print-dup* true] (prn {1 2}))
18:09clojurebot#=(clojure.lang.PersistentArrayMap/create {1 2})\n
18:09justin_smithahh, OK
18:09amalloysome of these #= methods emitted by print-dup don't even work anymore. the code has moved on, methods in clojure.lang have been renamed, but the print-methods remain
18:10justin_smiththanks, so I guess there is no good heuristic for whether a value could be read in after prn
18:10amalloyjustin_smith: no, not really. i mean, print-dup isn't a terrible guess
18:11dbaschjustin_smith: I don’t have all the context, but why would you want to “serialize” via prn?
18:12justin_smithdbasch: to output a data structure as edn
18:12amalloydbasch: it's kinda the default way to serialize stuff
18:13dbaschI usually serialize stuff via java objectoutputstream
18:13amalloyfor srs?
18:13dbaschusually = the few times I needed to serialize huge maps
18:33justin_smith.*clojure-version*
18:33anybot⇒ {:major 1, :minor 7, :incremental 0, :qualifier "alpha1"}
18:33justin_smithWOO
18:33justin_smithlazybot working with clojure 1.7 and the updated irclj
18:33justin_smithwithout clojail failing
18:34justin_smith@botsnack
18:34anybotjustin_smith: Thanks! Om nom nom!!
18:34arrdem@botsmack
18:35justin_smith@guards
18:35anybotSEIZE HIM!
18:35arrdem@gourds
18:36justin_smithI think I haven't fixed and whitelisted the "silly" plugin yet
18:36justin_smith@bf ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
18:36anybot{:ptr 6, :cells {6 10, 5 33, 4 87, 3 100, 2 72, 1 0, 0 0}}
18:36anybot[72 101 108 108 111 32 87 111 114 108 100 33 10]
18:36anybotHello World!
18:37justin_smith(depending on definitions of silly)
18:37arrdemlols
18:37amalloythere's only one silly plugin?
18:37justin_smithamalloy: why of course!
18:38justin_smithamalloy: so I had some issues where refs were treated as associative (I think this is a clj version thing?) but clojail just worked
18:38amalloyjustin_smith: refs treated as associative?
18:38justin_smithin lazybot's codebase
18:38amalloyyou mean like, (get (ref 1) 0)?
18:39justin_smithlike (get (ref {:a 0}) :a)
18:39amalloyi don't think that's worked in any version of clojure
18:39justin_smithor maybe something else entirely was going on...
18:39justin_smithyeah, probably
18:39amalloyit might just be a coincidence
18:39amalloylike, lazybot does that, and it fails silently, but everything keeps working
18:39justin_smithI probably misunderstood the source of some bug
18:39postpunkjustinI've seen something like that work before with refs
18:39postpunkjustinIt was weird and upsetting.
18:40amalloy@bf +[]
18:40postpunkjustinBut it was definitely a ref pointing to a map that was being implicitly dereferenced
18:40anybotExecution timed out.
18:40justin_smithamalloy: it's here https://github.com/Raynes/lazybot/blob/master/src/lazybot/irc.clj#L19 irc is a ref
18:40amalloyaw, good boy, anybot. i wasn't sure if that was inside the timeout context
18:41justin_smithamalloy: it's *all* inside the timeout context :)
18:42justin_smithpostpunkjustin: thanks for the validation - I was lost in the version update bugs when it happened
18:42dbasch@bf >++++++++++>>+<+[[+++++[>++++++++<-]>.<++++++[>--------<-]+<<]>.>[->[
18:42dbasch<++>-[<++>-[<++>-[<++>-[<-------->>[-]++<-[<++>-]]]]]]<[>+<-]+>>]<<]
18:42postpunkjustin,(let [foo (ref {:bar "baz"})] (foo :bar))
18:42clojurebot"baz"
18:42Bronsajustin_smith: look what you've done now
18:42dbasch@bf >++++++++++>>+<+[[+++++[>++++++++<-]>.<++++++[>--------<-]+<<]>.>[->[<++>-[<++>-[<++>-[<++>-[<-------->>[-]++<-[<++>-]]]]]]<[>+<-]+>>]<<]
18:42justin_smithdbasch: Caused by: java.lang.Exception: invalid commands: missing ]
18:42justin_smithhaha
18:42justin_smithBronsa: sorry
18:43arrdemlol
18:43anybotExecution timed out.
18:43arrdemBronsa: hey man it's just fun with a stack machine :D
18:43arrdemwhat to name a test artifact...
18:43amalloyjustin_smith: what makes you think irc-map is a ref there? it should be the dereffed value
18:44justin_smithamalloy: it may be an incompatibility with what we got back from irclj now that I think about it
18:44amalloybut it's certainly rather muddy and i can believe the wrong thing might be happening
18:44Bronsawtf refs are actually IFn like Var
18:44BronsaTIL
18:44dbascharrdem: cattiest fart
18:44postpunkjustinYeah, I have no idea why refs implement IFn but atoms do not
18:44justin_smitharrdem: the ark of foo
18:45Bronsapostpunkjustin: I wouldn't wish atoms implemented IFn tbh
18:45arrdemheh
18:46postpunkjustinI agree! But I think the inconsistency is even worse.
18:46justin_smith&(let [a (ref {:a 0})] (a :a))
18:46postpunkjustinI hate this: ,(let [foo (ref {:bar "baz"})] (foo :bar))
18:46lazybot⇒ 0
18:46Bronsawell I guess I'll continue to ignore refs as I've done til now
18:46justin_smithpostpunkjustin: jynx
18:46postpunkjustinhaha
18:46amalloyRaynes: we should remove the brainfuck plugin. that implementation from rosetta code doesn't look super good
18:46postpunkjustinbut yours worked. I'm not super familiar with this lazybot thing.
18:46Bronsayeah well, they are IFn but not ILookup or IKeywordLookup or whatever the interface
18:47Raynesamalloy: We should remove like all of them
18:47justin_smithpostpunkjustin: ##(println "hi")
18:47anybot⇒ hi nil
18:47lazybot⇒ hi nil
18:47justin_smithhaha
18:47Bronsalol
18:47bbloom_amalloy: too bad you can't have a befunge plugin. would need 2D irc input
18:47amalloybbloom_: i would rather have a snusp interpreter. more fun than befunge
18:48arrdemOOH QUICK DOES anybot ignore lazybot?
18:48bbloom_http://esolangs.org/wiki/SNUSP
18:48bbloom_craziness ^^ amalloy
18:48justin_smithamalloy: there is a syntax extension to haskell that looks remarkably like snusp
18:48justin_smithhaha
18:48arrdem##(println "##(println :foo)")
18:48anybot⇒ :foo nil
18:48lazybot⇒ :foo nil
18:48arrdemdamnit
18:49amalloybbloom_: i know. https://github.com/amalloy/clusp
18:49arrdemwell played bots, well played
18:49bbloom_amalloy: haha weee
18:49justin_smitharrdem: there may be some trick you could pull with int / char conversion and building the trigger string
18:49amalloywrote that on the plane back from the 2011 conj, iirc
18:49justin_smithor even just str to fool the regex
18:49joshuafcolejustin_smith: http://scrambledeggsontoast.github.io/2014/09/28/needle-announce/ ?
18:49bbloom_amalloy: a befunge interpreter was one of my first C programs
18:50arrdem##(println \# \# "(println :foo)")
18:50anybot⇒ # # (println :foo) nil
18:50lazybot⇒ # # (println :foo) nil
18:50arrdem##(println (str \# \# "(println :foo)"))
18:50anybot⇒ ##(println :foo) nil
18:50lazybot⇒ ##(println :foo) nil
18:50anybot⇒ :foo nil
18:50lazybot⇒ :foo nil
18:50arrdemHAHA
18:50arrdemI wonder if you could quine that..
18:50justin_smithjoshuafcole: yeah, that is the one
18:51joshuafcoleLooked fun to play with, though I imagine refactoring it in a text-based interface might not be. :)
18:51Raynesarrdem: I will hurt you physically.
18:51justin_smithjoshuafcole: that's the kind of code where you want a point-and-click editor for sure
18:51arrdemRaynes: if you fly out to Texas to do so, beer's on me
18:51RaynesThat's illegal.
18:51RaynesI'm calling the cops.
18:52arrdem<3 Raynes
18:52justin_smithRaynes: ##(println *clojure-version*)
18:52anybot⇒ {:major 1, :minor 7, :incremental 0, :qualifier alpha1} nil
18:52Raynes<3
18:52joshuafcoleHe's got you there, this chat room is logged and you just offered alcohol to a minor.
18:52lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil} nil
18:52RaynesLiterally got the FBI on the line right now
18:52amalloy##(println (str \# \# "(println :foo)"))
18:52anybot⇒ ##(println :foo) nil
18:52lazybot⇒ ##(println :foo) nil
18:52RaynesAlso, I'm not a minor.
18:52anybot⇒ :foo nil
18:52RaynesJust (dec 21)
18:52amalloyarrdem: lazybot ignores anybot now
18:52amalloyyou were too slow
18:52justin_smithheh
18:52arrdemamalloy: lol
18:53arrdemamalloy: I have yet to write my own quine anyway 's k
18:53amalloy$logout
18:53lazybotYou've been logged out.
18:53technomancyincf
18:53technomancyoops, wrong window
18:54justin_smithreally, a bot should probably have an ignore on #".*bot$"
18:54technomancyyou didn't see that
18:54amalloyjustin_smith: that sounds like it would lead to a scunthorpe problem
18:54mwfoglemananyone doing exercism in clojure?
18:55justin_smithmwfogleman: I've had some fun on 4clojure, but not actively doing it now
18:55justin_smithoh, exirorcisms, I misread
18:55mwfoglemanjustin_smith: no worries. that's http://exercism.io/
18:56mwfoglemani've done a bunch of 4clojure, although i too have stopped for now.
18:56postpunkjustinI've done some exercism problems
18:56postpunkjustinIt was fun, but there's not much activity there on the Clojure side, which makes it kind of sad
18:56amalloymwfogleman: the fact that i can't see anything useful on their website without logging in means i will just never do anything there
18:57amalloyit's great that they support github login, i was very pleased to see that. but it's just user-unfriendly to make me log in right away
18:57dbaschamalloy: it says that you can check out the command line client if you don’t want to log in
18:57amalloyyes, i saw that too
18:58amalloybut that's about ninety times harder than clicking a link
18:58mwfoglemanamalloy: yes, their ui is pretty cruddy. still, it's already a great companion to 4clojure (implicit hat tip)
18:58dbaschamalloy: I’d expect the exercises to be 100x harder than checking out the cli
18:58dbaschor I’d be disappointed
18:58amalloythat's okay. if i go to that site it's because i *want* to do exercises, or at least to read them
18:59amalloyi don't *want* to clone some github project and run code i know nothing about
18:59mwfoglemanamalloy: they are careful to prevent you from looking at code for problems you haven't solved yet
18:59mwfogleman**solutions to
18:59dbaschamalloy: also you can donate money without logging in
18:59amalloyhah
19:00mwfoglemananyway, i just asked because i'm working on the beer problem and was wondering if anyone had finished it.
19:00dbaschmwfogleman: you have a beer problem?
19:00amalloythe problem of someone having finished your beer?
19:00mwfoglemani knew that was coming. generating x-y verses of the song 99 bottles of beer.
19:00mwfoglemane.g. 99 to 0
19:02klyed2...but don't you go to the store and buy some more?
19:02anybotjava.lang.RuntimeException: Unable to resolve symbol: ..but in this context
19:02amalloygo home, anybot, you are drunk
19:02mwfogleman:D
19:02amalloysrsly though justin_smith, i'd rather you didn't bring in-development versions of lazybot in here except for the briefest of demos. i test mine out in #4clojure or #()
19:02justin_smithOK
19:03amalloythanks. the default config conflicts with lazybot and clojurebot bindings, as you saw
19:03justin_smithamalloy: it was going to be a brief demo and then the whole part the channel part kind of slipped my mind
19:04amalloyyeah
19:04amalloyi forget why now, but i have my lazybot instance set its nick to buttered-toast
19:05dbaschamalloy: so that it lands butter-side down?
19:05justin_smithI don't really plan on running it long term, really this is about updating the clojure version / irclj version so lazybot is better at staying online
19:06amalloyyeah
19:06dbaschamalloy: semi-relevant https://www.youtube.com/watch?v=Z8yW5cyXXRc
19:09amalloyugh, i left my lazybot-dev configuration at my last job
19:10justin_smithI bet they were all like "anybody lose a lazybot?" and then nobody claimed it and then it ended up in the drawer with the left-behind tupperware
19:11justin_smithevery workplace has that drawer, right?
19:11justin_smith$dict hello
19:11lazybotjustin_smith: interjection: Used to greet someone, answer the telephone, or express surprise.
19:11justin_smithTIL
19:12amalloyi'm surprised you managed to get by for so long without knowing about "hello"
19:12justin_smith$dict foo
19:12lazybotjustin_smith: noun: A metasyntactic variable used to represent an unspecified entity. If part of a series of such entities, it is often the first in the series, and followed immediately by bar.
19:13dbasch$dict dict
19:13lazybotdbasch: noun: A saying; a dictum.
19:13joshuafcoleI think lazybot wins this round
19:13dbasch$dict dictum
19:13lazybotdbasch: noun: An authoritative, often formal pronouncement: "He cites Augustine's dictum that 'If you understand it, it is not God'” ( Joseph Sobran).
19:13dbaschlazybot has spoken
19:14justin_smith$should I keep demonstrating random lazybot commands?
19:14lazybotjustin_smith: Very doubtful.
19:14justin_smithOK
19:15amalloyjustin_smith: i like the unix-jokes
19:16justin_smithespecially because they are easy to find accidentally
19:16amalloyusually it's just echo and ls that get triggered in here
19:16amalloybut the one time someone actually typed "mutt"...that was glorious
19:17joshuafcoleBuilt in unix jokes?
19:17{blake}OK, so, it looks like both bootstrap and bootstrap-3 link to a particular web version of bootstrap rather than a local one.
19:17joshuafcoleTime to get this running in #lighttable so I have something to banter with
19:17{blake}Though I still don't see where.
19:18{blake}Oh, wait, they include their own versions which are hidden. Duh.
19:18{blake}Crap.
19:19{blake}I wonder how disastrous it would be to shoehorn 3.3 in there.
19:20justin_smith$will ##(do :it :yes) evaluate?
19:20lazybotjustin_smith: It is certain.
19:20lazybot⇒ :yes
19:26TEttinger$will ##(doto (JFrame. "Minor Annoyance") (.setSize 400 300) (.setVisible true)) spawn a window?
19:26lazybotTEttinger: My sources say no.
19:26lazybotjava.lang.IllegalArgumentException: Unable to resolve classname: JFrame
19:26TEttinger$will ##(doto (javax.swing.JFrame. "Minor Annoyance") (.setSize 400 300) (.setVisible true)) spawn a window?
19:26lazybotTEttinger: Outlook good.
19:26lazybotjava.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it.
19:27TEttingerha
19:27joshuafcoleit was doing so well
19:27justin_smithnice try
19:27TEttingerit spawned one on my lapserver before I fixed the vulnerability using clojail
19:27TEttingerI can send you the changes I made, if you want it to run on non-headless servers
19:30justin_smithTEttinger: just tried that, it did seem to create a jframe, but I don't see it anwhere
19:30TEttingerweird
19:30TEttingerit might have deleted it
19:30justin_smithhttps://www.refheap.com/92669
19:31TEttingercan you def, currently? like with clojurebot
19:31justin_smithnope, security exception
19:32amalloythat feature does exist in clojail, lazybot just doesn't enable it
19:32justin_smithTEttinger: it's on ##anyone if you want to poke at it, but that's where I am testing so expect banal spammy stuff in that room
19:32justin_smith(and frequent bot reboots, of course)
19:35justin_smithamalloy: do you recall what the "embedded" plugin does? I got a weird error when I try input based on trying to reverse engineer what the regex expects
19:36amalloyjustin_smith: it's supposed to let you do commands like $will inline
19:37amalloylike uh, $#will this work?#$, i dunno if it's enabled in lazybot
19:37justin_smithyeah, the version I have macroexpands to a form which calls second with two args and just stacktraces
19:38justin_smith,(macroexpand '(->> x second (-> @bot :config :prepends first str) (assoc irc-map :message) registry/try-handle))
19:38clojurebot(registry/try-handle (assoc irc-map :message (-> (clojure.core/deref bot) :config :prepends first ...)))
19:39amalloyyeah. it looks broken
19:39justin_smith,(macroexpand '(-> (clojure.core/deref bot) :config :prepends first str (second x)))
19:39clojurebot(second (str (first (:prepends (:config (clojure.core/deref bot))))) x)
19:39amalloywhich is fine, nobody uses it or wants to
19:39justin_smithheh
19:43justin_smith$addfortune You would have inherited a larg sum, but the will was stored in mongodb.
19:43lazybotFortune cookie eaten.
19:44justin_smith$fortune
19:44lazybotDifficulty at the beginning usually means ease at the end...except in bed
19:45joshuafcoleAh, good point lazybot
19:45dbaschjustin_smith: but mongodb is a document store, it doesn’t get much more document-y than a will
19:45joshuafcoleI think I'll write my next webserver in whitespace
19:46justin_smithdbasch: it was meant to be a bit of cleverness about "fortune" and the way the fortunes are stored
19:46amalloyjustin_smith: s/larg/large, though
19:47dbaschjustin_smith: :)
19:48justin_smithoops!
20:16razum2um1how can i insert macros-1 into another macros-2 expanding 1st with for 2nd' given body?
20:19justin_smithrazum2um1: did you use a macro to construct that question?
20:20dbaschis this a meta question about the two previous questions?
20:20justin_smithrazum2um1: can you rephrase that? I had a hard time parsing the question
20:21razum2um1justin_smith: https://gist.github.com/razum2um/16e285945288089dd07a
20:22dbaschrazum2um1: why is the first one a macro?
20:24razum2um1dbasch: it's simplification, it's way longer ))
20:24razum2um1but the aim is the same, i want to have try-safe version of the m1
20:27dbaschrazum2um1: post the whole code, because as it is there isn’t enough information
20:27dbaschor at least a reproducible case
20:49justin_smithamalloy: Raynes: do you guys know anything about this socrates api in lazybot? lazybot.plugins.knowledge - did it ever work? where does one look for an api key? I'll keep moving on to check other plugins, but I am at a loss with that one
20:50RaynesIt did work
20:50amalloyjustin_smith: Raynes wrote that, i think. he probably committed his API key to github at least once
20:50justin_smithheh
20:50RaynesDie in a fire
20:50RaynesI don't think I did write that one
20:50RaynesAnyways
20:50RaynesDon't worry about it
20:50amalloy"die in a fire" is probably his current password
20:50RaynesIf it were it'd be in github somewhere by now.
20:50justin_smithRaynes: OK, just doing due dilligance before calling this done
20:51TEttingerhm, let's check this against lazybot
20:51TEttinger,(doto (java.awt.Robot.) (.keyPress java.awt.event.KeyEvent/VK_CONTROL) (.keyPress java.awt.event.KeyEvent/VK_C) (.keyRelease java.awt.event.KeyEvent/VK_CONTROL))
20:51clojurebot#<CompilerException java.lang.ExceptionInInitializerError, compiling:(NO_SOURCE_PATH:0:0)>
20:52amalloyhm, weird. the current lazybot instance does have a username and password for $know, but when i ask him questions he just times out
20:52TEttinger##(doto (java.awt.Robot.) (.keyPress java.awt.event.KeyEvent/VK_CONTROL) (.keyPress java.awt.event.KeyEvent/VK_C) (.keyRelease java.awt.event.KeyEvent/VK_CONTROL))
20:52lazybotjava.lang.SecurityException: You tripped the alarm! clojail.testers.ClojailWrapper@474528f5 is bad!
20:53TEttingernice
20:53amalloy$know who is the current president?
20:53lazybotExecution timed out.
20:54hiredman~apropos president
20:54clojurebotPresident of Chile is a Presidential office. (http://www.freebase.com/view//m/0hqlf)
20:56nestastubbsconfused by the state of clojure results, specifically "what has been most frustrating"
20:56nestastubbsfuture staffing concerns?
20:56nestastubbslanguage viable over long term?
20:57nestastubbsavailability of editors?
20:58nestastubbsthere is no shortage of hackers who want to learn clojure, and there are good ones out there too
20:58nestastubbsI guess hiring QA, and support staff?
21:14arrdemnestastubbs: "good hackers" are not always cultural/budget fits :P
21:14amalloynor are there a limitless supply of them
21:21yediso what do yall think of boot
21:21amalloyseems good if your feet would otherwise get wet
21:23dbaschamalloy: but you’d need two, or exceptional hopping skills
21:24yedi-______-
21:25dbaschyedi: why the long face?
21:25yedihahahhah aiight that gets a pass
21:25amalloy+b dbasch
21:31amalloyreiddraper: i have a generator that produces a list of things, like integers, and then i'm fmapping a function over that generator, which just maps over those integers and inc's them all. however, i now want to insert an arbitrary letter after each number which is divisible by ten (silly simplification, not my actual generator)
21:31amalloyi see how i could do this by switching from fmap to bind, and then reducing over the list with more calls to bind, most of which just terminate in return, but some of which use a generator for letters
21:33amalloybut that seems like an awful lot of manual plumbing in the calls to bind. is there something like (sequence :: (Monad m) => [m a] -> m [a]), such that i can just mapcat over the list, returning N generators, and let sequence bind them together for me?
21:36amalloyman, sequence is the first dang function in clojure.test.check.generators. but i didn't notice it because it's private
21:37amalloyokay well thanks for writing it; consider this a feature request to expose it, i guess
21:40kenrestivosomeone has written an alternative to lein? :-0
21:52Rayneskenrestivo: lol we did that once
21:54RaynesWe called it cack or cork or something like that
22:09justin_smith$max
22:09lazybotThe most users ever in #clojure is 831
22:11rpaulothat's a lot of people
22:23justin_smith$metacritic movie alien-re-release
22:23lazybotI'm a little drunk. Can't find my keys.
23:21dgellowhi guys
23:22dgellowis there a way to pprint from within a defrecord method ?
23:24sm0kedgellow: using `pprint` directly has problems?
23:24amalloydgellow: i mean, you just call pprint like you would anywhere. is there something you've tried that doesn't work?
23:25sm0kedgellow: you would need to import it though
23:25sm0kei think its only available in repl, not in core ##(pprint 1)
23:25lazybotjava.lang.RuntimeException: Unable to resolve symbol: pprint in this context
23:25dgellowYeah, i'm already using pprint but I cannot see any output
23:27justin_smithsm0ke: that's because you have to require or use pprint
23:27gfredericksdgellow: are you sure it's an issue with defrecord?
23:27justin_smith,(use 'clojure.pprint)
23:27clojurebotnil
23:27sm0kejustin_smith: yes thats what it said
23:27dgellow
23:27amalloymy guess is your code is running on some other thread which doesn't have *out* bound to anything
23:28sm0keor may be he is printing nil
23:28dgellowI'm using pprint. it works. But, when I'm using it from within a method implemented in a defrecord, I cannot see any output. I think there is something to do with the stdout ?
23:28justin_smithdgellow: is this running in a thread other than your top level repl thread?
23:29dgellowamalloy: How can I check that, as I cannot pprint *out* ?
23:29gfredericks(.println System/out ...) is one way
23:29justin_smith*out* is thread local
23:29gfredericksyou can also do side-effecty things with atoms, for example
23:30gfredericks,(def my-outs (atom [])) (then later) (swap! my-outs conj *out*)
23:30clojurebot#'sandbox/my-outs
23:31sm0kedgellow: does normal `print` works?
23:33dgellowsm0ke: nop
23:34sm0kedgellow: how about a `log/info` if you have it?
23:35sm0keand for record reloading new changes into a running rep wont work
23:37justin_smithdgellow: you should be able to explicitly pass in or bind *out* (for example in the way gfredericks suggests, or make it an argument passed to the function) and then use (binding [*out* out-target] ...) or use the optional second arg (pprint val out-target)
23:38sm0kei highly doubt the code is being reached at all, why would the stdout be not binded
23:38justin_smithsm0ke: it is common for it to be bound to a place you are not looking
23:38justin_smithespecially in emacs, for example
23:39justin_smithand println / pprint don't use stdout, they use *out*, which is a dynamic var, these things act can unintuitively when you have threads
23:40sm0ke,*out*
23:40clojurebot#<StringWriter >
23:41sm0keyeah well it is better to use loggers, but if its simple enough case this should not happen
23:41sm0keyou are assuming he is using emacs and spwaning threads
23:42justin_smithemacs is an example - any env where you aren't directly in the owning console can have the same issue
23:43justin_smithand yes, I could be wrong, just suggesting a way to deal with it if that is the case
23:44quizmeIs it possible to use defmethod to make clojure.data.json/write-str to know how to print clj-time.core/now ?
23:44justin_smithquizme: there is a protocol you can extend
23:44justin_smithquizme: or you can convert the value to a java.util.Date - it knows how to handle that iirc
23:45quizmejustin_smith: ow... how do i do it by extending the protocol ?
23:46justin_smithhttps://github.com/dakrone/cheshire/blob/master/src/cheshire/generate.clj#L17
23:46justin_smithcheshire.generate.JSONable
23:46justin_smithhas one method, to-json
23:47justin_smiththere is a convenience function for that: https://github.com/dakrone/cheshire/blob/master/src/cheshire/generate.clj#L229
23:47justin_smithadd-encoder
23:47nestastubbsoh, that reminds me
23:47nestastubbsAnyone have a nice clj abstraction for a event based JSON parser?
23:48nestastubbskinda like SAX for JSON
23:48nestastubbsthe idea is to manipulate parts of a stream of json without having to parse it all into a clojure object
23:48justin_smithnestastubbs: cheshire can parse streams lazily
23:49nestastubbslazily won't quite cut it here
23:49justin_smithparse-stream
23:49justin_smithOK
23:49nestastubbsI want to avoid consing massive objects
23:49nestastubbsI eventually have to pass the entire stream thru, so lazy won't do it
23:49sm0kenestastubbs: how do you define a `part` in json without actually parsing it?
23:50nestastubbsdon't treat it as an object, treat is a a sequence of transition events
23:50justin_smithnestastubbs: tigris does stream-to-stream escaping https://github.com/dakrone/tigris
23:51nestastubbsobjec_start, key, sep, value ... object_end ....
23:52nestastubbsthe idea is you pass thru the events (which have the original string attached to them
23:52sm0keintriguing idea
23:52nestastubbsand only muck with the ones you want to change
23:52nestastubbsso, if it's a key i want to filter out, I ditch that key event, and then the sep and value event after it...
23:52sm0kebut is still think you have parsd it already when you say "objec_start, key, sep, value ... object_end ...."
23:53nestastubbsthat's a sequence of events, not a list itself
23:53nestastubbsyou ever used a SAX parser for XML?
23:53nestastubbsit's like that
23:53nestastubbsSAX parsers didn't produce ELEMENT objects
23:53nestastubbsanyways, we throw around large JSON documents, I need one. I guess I'll write one
23:54nestastubbsthe cost of parsing, manipulating, and then re-JSONing is high
23:54nestastubbssame reason why I don't use enlive for large HTML documents
23:54nestastubbsuse JSoup instead, way faster
23:54sm0keyep i got that part but not quite convinced how you will get those events just by reading a json string
23:55nestastubbsby writing a parser?
23:55sm0kenestastubbs: :D
23:55sm0kedoesnt that defeat the whole purpose
23:56nestastubbswell, I suppose it's really more of a lexer
23:56nestastubbshaha
23:56nestastubbsactually, a lexer would be sufficient
23:57sm0keyep then a regex-seq should be good enough
23:57nestastubbswonder if writing it in ragel would be performant
23:57nestastubbsspeaking of regex-seq...
23:58nestastubbsre-seq would not be sufficient