#clojure logs

2014-11-25

00:06kenrestivoah, the dark dot is use/used, the pale dot is transitively use/used
00:07kenrestivoif the code is on github, i should submit a patch that shows that as a mouseover on those circles
00:07bbloom_do any former common-lispers know enough about how CL implementations handle line numbers? i'm curious where/how they store line numbers for stack traces w/o general purpose clojure-like metadata
00:08kenrestivospeaking of stacktraces, here's what youtube is showing: https://www.refheap.com/93921
00:08kenrestivoit's not base64, apparently
00:09bbloom_could be url-safe base64
00:09bbloom_probably encrypted :-P
00:09ggreerthey just changed + and / to - and _
00:09ggreerand yes, it's encrypted
00:20bbloom_as best i can tell, line numbers are calculated from "code-location" on the "compiled-frame" structs -- seems that that's calculated from the program counter in the compiled code output, such that only compiled forms get line numbers
00:21bbloom_i guess if you eval some definition later, you either won't get a line number or it will be the location of the eval, not the place that produced the forms, since the objects themselves can't have metadata really
00:21bbloom_interesting....
00:21bbloom_sorry, i meant to add: that's in SBCL
00:22bbloom_which google suggested has line numbers in backtraces, unlike many other CL impls :-)
04:13agumonkhostcglv: the issue with remote lein repl was that by default lein listens to 127.0.0.1, so one needs to lein repl :host 0.0.0.0 :port ... to enable remoting
04:13rritochDoes clojure.core/require automatically reload sources if the source code has been modified since it was last loaded (clojur.core/load)?
04:14SagiCZ1rritoch: no, you have to call require again
04:14SagiCZ1or otherwise reload the file using your repl tools
04:15agumonkhostcglv: pretty much 'duh' but alas. this was offered to me by the RTFM association.
04:15rritochSagiCZ1: But every time you call require it checks if the file has been modified?
04:17rritochSagiCZ1: Currently I'm using ns-find & load to load namespaces in this particular case, but I'm looking for the easiest solution to reload if the file has been modified since it was last loaded.
04:18ucbit seems like cider comes with a set of keybindings for reloading namespaces and their dependencies
04:18ucbI've pressed them by chance (trying to switch buffers, etc.) but never really found what they are
04:18ucbanybody knows what they are? ^_^
04:21rritochSagiCZ1: Ex. (if (not (find-ns 'my.namespace)) (load "my.namespace")) but I'm looking for something that will also re-load the namespace if the sources have been modified since it was last loaded.
04:25SagiCZ1rritoch: i see, i am not sure how to do that from the program itself, but other people might know
04:32mavbozoe
04:41agumonkhosthey back
04:42agumonkhostwith this project.clj http://pastebin.com/y4wCxqk0 , lein deps fetching core.async (found in ~/.m2/*), yet (require '[core.async ...]) fails with "FileNotFoundException Could not locate core/async__init.class or core/async.clj on classpath ..."
04:46clgvagumonkhost: the full namespace is "clojure.core.async" right?
04:46clgvyeah it is, I checked
04:47agumonkhosthi clgv IIRC I tried both, time to try again
04:54agumonkhostclgv: ok, wrong path for running lein, thus no deps, thus no async
04:54agumonkhostthanks
04:55clgvyeah you must be within the project ;)
05:10agumonkhostclgv: I'm ashamed of my own nooberie here
05:10clgvagumonkhost: no problem, now you will remember it better ;)
06:13the_freyhas anybody used the JavaMail mboxstore in a clojure project?
06:19clgvhow do I specify which protocols jetty can use and must not use? is there an option in "ring"?
06:20weavejesterclgv: By default the Jetty adapter will just use HTTP unless you supply a keystore
06:20clgvweavejester: yeah, I already have it running HTTPS
06:20weavejesterclgv: I tend to use nginx to handle SSL, however.
06:20clgvweavejester: that is not an option in that scenario.
06:21weavejesterclgv: If you have it running HTTPS, I'm not sure I understand your question.
06:21clgvweavejester: I want to configure which protocols are allowed, e.g. forbid SSLv3 and previous versions
06:22weavejesterclgv: Oh I see
06:22weavejesterclgv: That might require some Jetty black magic :)
06:23clgvweavejester: ok, I gotta check the jetty api
06:23weavejesterclgv: 'fraid so
07:00ordnungswidrigclgv. http://wiki.eclipse.org/Jetty/Howto/Configure_SSL is pretty complete, I think
07:01clgvordnungswidrig: thanks :)
07:02clgvordnungswidrig: though I need to configure it via API for my embedded jetty
07:03ordnungswidrigThe XML maps directly to the API, IIRC
07:03ordnungswidrigIn the beginning jetty could only be configured by the API
07:08pandeiroif i have portions of my project.clj that are repeated in different sections, can i (def repeated-part [...]) and then reference that instead of repeating the vector in different places?
07:10hellofunkdoes core.logic recognize basic math as part of unification for doing things like solving a system of equations?
07:13ordnungswidrigpandeiro: you can do this with profiles to some extend
07:14pandeiroordnungswidrig: stick it in a profile, then make an alias that uses that profile to do some task? that sort of thing?
07:16ordnungswidrigmore like thath: https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#composite-profiles
07:19pandeiroordnungswidrig: ok thanks
07:38SagiCZ1~lazy-logs
07:38clojurebotlazy-logs is http://logs.lazybot.org/
08:54skratl0x1I have a macro that takes a vector, I want to pass this vector to a function during macro expansion time, but it contains forms that need to be evaluated, how do I do that?
08:57gfredericksskratl0x1: actual examples would be helpful here
08:59ordnungswidrigskratl0x1: you cannot expand the forms during macro expansion, at that time it's only lists of lists and symbols
09:00skratl0x1no eval?
09:01gfredericksyou can technically call eval but that has all sorts of edge cases and is not how macros are meant to work
09:03hyPiRionfear no eval
09:07llasramPremature optimization is the root of all eval
09:09sqdany idea why my usage of [serial-port “1.1.2”] with (serial/on-byte port f true) gets messages with a delay, compared to using the built-in serial monitor from the arduino IDE?
09:10Jkersomeone here is a programmer ?
09:10ToxicFrogJker: I suspect most are.
09:11Jkerwho is ?
09:11sqdor: is there a recommended way to get notified of the last byte read from a serial port?
09:12Jkersomeone here is a unity 3d programmer ?
09:34edwIs there any way to get the this of a function? I'd like to be able to write a function that accesses its own metadata.
09:35hyPiRion,(^:foo (fn f [] (meta f))) ; <-- edw
09:35clojurebot{:foo true}
09:35edwAh! Duh. Thanks!
09:54visofhi guys
09:54visof,(into {} [{:a {:hello :World}} {:a {}}])
09:54clojurebot{:a {}}
09:54visof,(into {} [{:a {}} {:a {:hello :World}}])
09:54clojurebot{:a {:hello :World}}
09:54gfredericksoh geez
09:54visofhow can i get the same last effect for all situation?
09:54jeremyheiler,(-> {} (assoc :a 1) (assoc : b))
09:54clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :>
09:55jeremyheiler,(-> {} (assoc :a 1) (assoc :b 2))
09:55clojurebot{:b 2, :a 1}
09:55jeremyheilerah
09:55gfredericks,(reduce into {} [{:a {:hello :World}} {:a {}}])
09:55clojurebot{:a {}}
09:55jeremyheilernvm
09:55visofgfredericks: the values gone
09:55gfredericksoh um
09:55gfredericksvisof: the logic here is not clear
09:56jeremyheilervisof: my point is that the last one wins because it's like your associating a new value of the old
09:56clrndhe wants to keep "truthy" values in a dict
09:56gfredericks{} is truthy
09:56clrndthen he is just confused :P
09:56gfredericks,(apply merge-with merge [{:a {:hello :World}} {:a {}}])
09:56clojurebot{:a {:hello :World}}
09:56clrndsorry I thought this was #javascript
09:57gfredericksvisof: is maybe that ^ what you're going for?
09:57gfredericks,(apply merge-with merge [{:a {:hello :World}} {:a {:other :entries}}])
09:57clojurebot{:a {:other :entries, :hello :World}}
09:57gfrederickshas ^ that behavior
09:57visof,(apply merge-with merge [{:a {:hello :World}} {:a {}} {:a {:clojure :nice}}])
09:57clojurebot{:a {:clojure :nice, :hello :World}}
09:57visofgfredericks: great, thanks!
09:58gfredericksnp
11:00crash_epopinion question: should a transducer serve purely as a transformation of its inputs, or is it idiomatic for a transducer to have externally-visible side effects?
11:00crash_ep(note I am not talking about the inherent statefulness of certain kinds of transducers, like `partition`)
11:02clrndthat's almost a philosophical question, but I'd argue that they should be pure
11:04clgvcrash_ep: transducers are intended for channels as well, or does that not count as side effect?
11:05crash_epclgv: that's the use case I am asking after. Should I write a transducer that can "do something" to the values that are sent through a channel? Or are transducers intended purely for stream transformations.
11:06crash_epan example of a side-effecting transducer like the one I am asking about is in this blog post: http://www.martinklepsch.org/posts/using-coreasync-and-transducers-for-direct-s3-upload.html
11:06crash_epwhich does an excellent job of explaining how to use transducers. I'm just curious because it's the first time I've seen them used this way.
11:07clgvcrash_ep: the transducer write-ups and videos usually name channels as another scenario where the general functionality defined via a transducer is useful
11:07clgvso you can have eager, lazy and channel ops with the same transducer definition
11:09crash_epclgv: I may be misunderstanding what you are saying, but that sounds orthogonal to what I'm after? :)
11:19clgvcrash_ep: I am not entirely sure what you are after ;)
11:21crash_epclgv: imagine I create a transducer using this code: (map #(write-to-file my-file %))
11:21crash_epclgv: and then I give that transducer to a channel that delivers strings or input streams
11:22crash_epclgv: That would result in writing the strings or input streams to my-file every time the channel delivers a new value.
11:22l1x_hi
11:22crash_epclgv: but is that the intended use case for transducers?
11:23l1xwhat is the best way to send data for processing to async/threads ?
11:24l1xi was thinking either have 1 channel across everything and threads are listening to their on thread-name or have N channels one for each thread
11:25justin_smithl1x: why do you care which thread takes your task? why not just let them all listen to the same channel
11:26l1xhmm ok
11:26justin_smithand you can't listen to a channel but only take certain messages, core.async does not work that way
11:26l1xno selective receive? :)
11:26justin_smithno, not an option
11:26l1xok
11:27l1xhow do i make sure my "producer" does not overload the channel?
11:27l1xaka how do you do flow control
11:27justin_smithl1x: by making a channel with no buffer
11:27teslanickjustin_smith: doesn't filter work like that? Pipe a channel through a filter (getting a new channel), messages that obey the filter are drained from the input channel.
11:28l1xjustin_smith: and what happens than?
11:28justin_smithteslanick: and other messages stay on the channel? or do they get discarded?
11:28l1xthe write waits for the read?
11:28teslanickjustin_smith: True, you'd need a 'blowoff valve' to pull messages that don't match the filter off the input channel.
11:29justin_smithteslanick: yeah, my point is - you take all the channel gives you if you take at all, and it is your job to decide how to handle things that "aren't for you" - or you only read channels that are for you
11:30justin_smithl1x: yeah, the channel will block the message coming on if it isn't buffered
11:30stuartsierraThere's also pub/sub, which lets you do some filtering.
11:30teslanickUnderstood. So if you need a subset of a channel "just for you", you want to use a topic-based chan
11:30l1xohh
11:30teslanickYeah, a pub/sub
11:30l1xjustin_smith: thanks!! this is really useful
11:30l1xi wish there was better doc around core/async
11:31teslanickBTW, I've found these two pieces very useful for the not-well-documented features of core.async
11:31teslanickhttp://yobriefca.se/blog/2014/06/04/publish-and-subscribe-with-core-dot-asyncs-pub-and-sub/
11:31teslanickhttp://yobriefca.se/blog/2014/06/01/combining-and-controlling-channels-with-core-dot-asyncs-merge-and-mix/
11:31justin_smithteslanick: stuartsierra: right, but that's a whole other can of worms, because then everybody sees all the published contents
11:31daniel___everytime anyone says teslanick, my irssi lights up
11:31justin_smithmodulo the filtering and topics of course
11:32teslanickdaniel___ ??
11:32lazybotteslanick: What are you, crazy? Of course not!
11:32teslanicklazybot: quiet you.
11:32justin_smithlazybot - can you even help it??
11:32lazybotjustin_smith: Definitely not.
11:34teslanickjustin_smith: Do you mean that you can "duplicate" messages by subbing multiple channels to the same topic?
11:35justin_smithright - if your logic is "which listener gets each of these messages on onechannel" then you need all your filters on your subscribers to be mutually consistent, or you get messages acted on twice or more, or dropped
11:36justin_smithso the real fix is - read a channel, act on every message you get. And design other things around that.
11:36teslanick(aside, "duplicate" as a verb is an awkward word)
11:37justin_smithso, as I initially suggested, if you want threads working on tasks in parallel, put all tasks on one channel, and have all threads listening to that channel, each message will go to a thread that is ready
11:37justin_smithmuch simpler
11:40l1xjustin_smith: and when the "consumer" reads the queue it blocks it too
11:40l1xright?
11:40l1xso I could have N threads with while true; read queue
11:41l1xor there is a more idiomatic way to do that?
11:41l1xteslanick: thanks!
11:41daniel___there it goes again
11:43justin_smithl1x: yeah, if all threads are doing the same thing, just have each one reading from the same channel and executing on what they get, in a loop
11:44justin_smithif they do different things, give them each a channel, and decide which channel to put onto based on what you want done
11:45d0kyhello how can i achieve that when i insert into hash-map new hash-map item: (into path new-path) i need to have new-path to be the last item in path ... i know that vector would do the job but hash-map suitable for working with it , thanks for any help
11:45justin_smithd0ky: hash-maps are not ordered
11:46d0kyso the only way is to use vector ?
11:46justin_smithor a sorted-map, but that is sorted by key and sort function, not insertion order
11:46l1xjustin_smith: thanks, this is very helpful
11:47Glenjaminhttps://github.com/amalloy/ordered would work
11:47Bronsathere is an ordered map somewhere
11:47Bronsa^ there
11:47justin_smithI don't know if there is anything off the shelf that respects insertion order, and also allows ~constant time lookup
11:47justin_smithoh, nice!
11:47Glenjaminordered just wraps a map + vector together
11:47justin_smith(inc Glenjamin)
11:47lazybot⇒ 10
11:47justin_smithmakes sense :)
11:48d0kyGlenjamin: justin_smith: thanks you both
11:49cityspiritanyone have any strong opinions on korma vs yesql?
11:50clgvcrash_ep: sounds totally reasonable
11:51justin_smithcityspirit: korma is semi-abandoned at this point, right?
11:51justin_smithalso, I like yesql because sql is already a good dsl for doing sql :)
11:53mikosyesql is ace
11:53mikosdid i read somewhere that it will support passing a hashmap soon?
11:53cityspiritjustin_smith: is it? I wasn't aware. I like yesql a little better too, but with yesql you'd probably want to integrate like c3p0 on your own right?
11:54justin_smithcityspirit: that's fairly easy actually, but yeah.
11:55justin_smithcityspirit: callen/bitemyapp, who was the last really active maintainer of korma I know of, kind of hates Clojure now. But I don't follow korma closely so there well may be more going on than I know of.
11:56mikerodDoes leiningen have some "default" repositories it looks in for artifacts?
11:56mikerode.g. If I have a :plugins dependency, I have noticed it is fetched without me specifying any :repositories
11:57technomancymikerod: sure; clojars and central
11:57justin_smithcityspirit: and regarding c3p0, the way to do that with yesql is to provide a :datasource key in your db-spec, which has the c3p0 object in it. There are interop libs, but it is straightforward enough to use the class directly.
11:57mikerodtechnomancy: I figured that was the case. I was just curious what the defaults were.
11:57cityspiritjustin_smith: great, thanks for the info. I'll give that a whirl
11:58mikerodI suppose leiningen has some tool to show the "effective" project configuration map for a given project?
11:58mikerodSimilar to the idea of the "effective pom" in Maven
11:58mikerodthis is a better google question
11:59technomancymikerod: check out the lein-pprint plugin
11:59justin_smithcityspirit: you may want org.tobereplaced.jdbc-pool - that makes it really easy
11:59technomancy`lein pprint :repositories`
11:59justin_smithcityspirit: but if you look at the lib, it also doesn't have a lot of meat to it :)
12:00mikerodtechnomancy: thanks for the info. I'll check that out.
12:00justin_smithcityspirit: very simple https://github.com/ToBeReplaced/jdbc-pool/blob/master/src/org/tobereplaced/jdbc_pool.clj
12:01crash_epclgv: thanks!
12:04sdegutisweavejester: sorry to bother you by being over-playful about your secret project
12:05sdegutisweavejester: anyway we guessed it's some sort of Clojure code reformatter
12:05weavejestersdegutis: It's not really secret, just not ready for release, and it is indeed a Clojure code formatter.
12:05weavejesterI wanted something like gofmt
12:06sdegutisWho is the intended audience?
12:06cityspiritjustin_smith: thanks! I might just use that as example code to work off of
12:06justin_smithweavejester: awesome idea, I look forward to trying it when it is ready
12:06weavejestersdegutis: Me ;)
12:06sdegutisI personally just do C-x h M-q TAB
12:06weavejestersdegutis: Or anyone who happens to need a Clojure formatter.
12:06justin_smithcityspirit: he is using some macro magic to derive setter methods for map keys
12:06justin_smithsdegutis: that won't insert line breaks
12:07sdegutisjustin_smith: true
12:07weavejestersdegutis: Sure, but that won't work with CI
12:07sdegutisweavejester: true
12:07Glenjaminthe problem's i've had with formatters are mostly deciding when to line break, and with-* style methods that don't start with with-
12:07weavejesterI want to be able to say: lein clofor :check
12:07justin_smithweavejester: technically you can script with emacs - but who wants command line emacs in their CI
12:07weavejesterAnd then for it to fail CI if the code isn't formatted right
12:07Glenjaminso if you can solve those two, great job :D
12:08weavejesterjustin_smith: Yeah, but the clojure-mode indenter isn't really intended as a full code reformatter
12:08justin_smithright
12:08justin_smithso that's the real issue - it won't do smart line breaks, etc.
12:08weavejesterYep. I want something which can tell me if a Clojure source file is formatted according to the Clojure style guide.
12:09weavejesterSomething extensible, with optional formatters, in the same way Eastwood has optional linters
12:09sdegutisThere are some times when I want a ")" on its own line, namely when I have a really long defroutes.
12:09sdegutisI don't know how to tell a code formatter that one pattern.
12:09sdegutis:(
12:10Glenjaminweavejester: how have you approached it knowing that GET/POST etc are binding forms ?
12:10weavejesterGlenjamin: It'll be extensible, so you'll be able to add more rules.
12:10weavejesterGlenjamin: I haven't figured out all the details yet, but I think they might be similar to Clojure's routes.
12:11weavejesteri.e. just a long list of rules. if a rule returns nil it's ignored.
12:11weavejesterHard to do it any other way with things like backtracking indents
12:11justin_smithGlenjamin: if you look at clojure mode, it has a small set of rules (representing various macro / special form types and how they differ) and then a bunch of symbols are assigned to be indented according to each of those rules
12:11weavejestersdegutis: Fortunately I'm happy never having a ) on it's own line.
12:12sdegutis:)
12:12justin_smithsdegutis: ITYM :
12:12justin_smith)
12:12weavejesterBut the rules will be customisable.
12:12Glenjaminjustin_smith: yeah, i was thinking of that as 1 rule, which there'd need to be a way to add more symbols to
12:12technomancyweavejester: the one exception I can think of is when you have a long list of data and you want to make it easy to insert a new entry
12:12Glenjaminalways add in the second-last position :p
12:12technomancyhaha, yeah not bad
12:13Glenjaminalso helps for avoiding merge conflicts, add into a random position
12:13justin_smithtechnomancy: Glenjamin: clearly this calls for a new paredit command
12:13technomancythis is actually condoned in the hallowed text of riastradh's style guide
12:13weavejestertechnomancy: I personally care more about the appearance of the source than the diffs :)
12:13justin_smith"add new item at end of this list on its own line"
12:13technomancyweavejester: it's not the diff; it's hunting for the right number of parens to split off
12:13technomancyhttp://mumble.net/~campbell/scheme/style.txt
12:14technomancy"Exceptions to the Above Rule Concerning Line Separation"
12:14weavejestertechnomancy: paredit surely solves that problem?
12:14technomancyweavejester: hm, true. what about the comment one though?
12:15weavejestertechnomancy: #_ ?
12:15technomancyI guess just always use #_?
12:15technomancyright
12:15technomancythat sucks because you don't get font-lock
12:15Glenjaminmaps are annoying in that sense
12:15justin_smithtechnomancy: paredit already fixes ; to add a line break for closing parens to work
12:15weavejesterAnyway, I figure the rules can be customisable.
12:15technomancyjustin_smith: yup yup. but it breaks the rules
12:15weavejesterSo you can set the rules you want in your project.clj file
12:16Glenjamin,{:a 1 :b 2 #_(:key val)} ; i guess
12:16clojurebot{:b 2, :a 1}
12:16weavejesterOr use two #_#_
12:16Glenjaminwhat
12:16technomancythe formatter will certainly encounter ;; etc etc \n)) and needs to behave gracefully in its presence
12:16Glenjamin,{:a 1 :b 2 #_#_:key val}
12:16clojurebot{:b 2, :a 1}
12:16Glenjaminoh wow, i had no idea
12:17weavejestertechnomancy: it could be smart about it
12:17weavejesterI have a few ideas about smart formatting.
12:17weavejesterLike automatically adding in threading if a form is too deep.
12:17justin_smithGlenjamin: you can make really weird obfuscated code with stacked #_#_#_ without much effort
12:17justin_smithif you are trying to obfuscate, at least
12:17weavejesterSmart newlines to split up lines over 80 chars
12:17weavejesteretc.
12:18justin_smithweavejester: reiterating my interest :) godspeed
12:18weavejesterI figure the first step is just to get something on parity with clojure-mode though
12:18weavejesterThen add a lein plugin
12:19weavejesterWith a :check and :fix option
12:19weavejesterSo it can be used in CI to validate that a person's commit adheres to the project's format.
12:20Glenjaminif it can run as a server of some sort it'd be a neat way to negate the startup time
12:20Glenjaminassuming you're writing it in jvm clojure
12:20weavejesterIncidentally, we need a protocol for reporting tests/linting. Currently we just have STDOUT
12:20weavejesterYeah, it's in jvm clojure.
12:20weavejesterBut it might work okay with lein-auto
12:20weavejesterBecause it doesn't do a project eval
12:21weavejesterSo "lein auto format :check"
12:21weavejesterWhich again means that a protocol for reporting tests/lints would be nice.
12:21Glenjaminauto format :fix would be trickier i imagine
12:21weavejesterThat just sounds like a bad idea :)
12:22weavejesterBetter to follow the slamhound route for that, I think
12:22Glenjaminbeing able to curl some text to a local server and get new text back would be neat
12:22weavejesterHm, I guess so
12:22weavejesterFormatting as a service
12:23Glenjaminalias format='curl localhost:1234 -d @$1 > $1' or however you get pipes to rewrite a file
12:33clgvweavejester: using :configurator to modify (setIncludeProtocols) the SslContexFactory of the SslSelectChannelConnector instances of the jetty instance worker
12:34weavejesterclgv: okay
12:34sdegutisweavejester: your auto-threading idea could be very problematic if any of the subforms are non-comformative
12:35weavejestersdegutis: What do you mean?
12:35sdegutisweavejester: unless I'm horrifyingly mistaken, there are several times when a form cannot be threaded based on whether the form is a macro or a function which can only be known at runtime
12:36technomancyit has to be ...
12:36technomancythread-safe
12:36technomancy( •_•) ( -_-)~⌐■-■ (⌐■_■)>
12:36weavejestertechnomancy: :P
12:36Glenjaminoh dear, i laughed heartily at that
12:36sdegutis(alter technomancy + 1000000000)
12:36weavejestersdegutis: Do you have an example? Threading is a source transformation, so I don't see why it isn't safe.
12:37sdegutisweavejester: there are also things like (fn [] ...) which can't be put into a threading macro directly, but those are more easily spottable at the source level
12:37sdegutisweavejester: not off the top of my head
12:37sdegutisI was kind of hoping saying it might jog someone else's memory (mine is not very good) and they would jump in.
12:37weavejesterThe only way I can think of threading being unsafe is if it was in another source transformation macro.
12:38sdegutisOh right, that's it.
12:38sdegutisYou can't embed -> into ->>
12:38sdegutisOr compojure.core/GET too iirc.
12:39sdegutisEssentially any arbitrary form might happen to be a source-transforming macro.
12:39Bronsa,(-> [1 2] (->> (map inc) (reduce +)) inc)
12:39weavejesterYou can, you just need to be aware how it transforms the code.
12:39clojurebot6
12:39weavejesterThere's nothing special about (fn []) or (GET ...) that would stop them from being threaded
12:39weavejesterThe rules are always the same
12:40luxbock,((->> coll (map inc) (fn [coll])) [1 2 3])
12:40clojurebot(2 3 4)
12:40sdegutisweavejester: right, so unless I'm hideously mistaken, it would require a whitelist of known good forms, or at the very least a blacklist of known bad forms, when doing auto-threading
12:40weavejesterNot really...
12:40sdegutisok :)
12:40Glenjaminif it can be written as (f (g (h x))) it should always work as ->
12:41technomancyjust make all your code point-free always
12:41weavejesterFormatters don't need to be fullproof, firstly, especially if they're optional.
12:41sdegutis:)
12:41weavejesterI'm sure I could write something that would break any formatter with macros if I tried.
12:41weavejesterUnless the formatter was macro aware I guess
12:41sdegutisI have been known to be insidiously mistaken in the past, so I'll assume I'm wrong here.
12:42weavejesterI agree it's possible, but since a formatter is just an aid, it shouldn't matter that I can craft a form that breaks it.
12:42weavejesterOff the top of my head, I can't think of any deeply nested code transformation where you can't use threading.
12:43teslanickAs long as crafting the form that breaks the formatter causes it to fail loudly
12:43Glenjamini get this with my current lint tool, sometimes a rule breaks on some code where i disagree, occasionally i'll write my code differently because i still want the rule in general - or sometimes i'll go turn off the rule
12:43sdegutisweavejester: your lib sounds neat im curious to see how it plays out good luck
12:44technomancyyeah, glad to see this happening =)
12:45weavejesterGlenjamin: yeah, I figure I'll take a similar approach with the formatter
12:45Glenjamini've been very happy with eslint recently
12:45sdegutiswhat about eastwood?
12:45Glenjaminthe level of configuration it provides is great
12:45Glenjaminper-file overrides are awesome too
12:46weavejesterI'll try and get something released by this weekend. I just have defun-style indents and backtracking (i.e. protocol, type, proxy, reify) indents to sort out.
12:48sdegutis$dict great
12:48lazybotsdegutis: adjective: Very large in size.
12:48sdegutisGlenjamin: oh
12:49Glenjaminoh?
12:49justin_smithI am going to regret showing sdegutis the dict command
12:50sdegutis$dict going
12:50lazybotsdegutis: noun: Departure: comings and goings.
12:50sdegutisjustin_smith: oh
12:51sdegutisjustin_smith: cya when you get back then i guess
12:51justin_smith$dict lol
12:51lazybotjustin_smith: interjection: Alternative form of LOL.
12:52weavejester$dict decomplect
12:52lazybotweavejester: Word not found.
12:52sdegutis$dict inorite
12:52lazybotsdegutis: Word not found.
12:52weavejesterlazybot, you disappoint me
12:52weavejester$dict complect
12:52lazybotweavejester: verb-transitive: To join by weaving or twining together; interweave.
12:52weavejesterlazybot knows only how to complect things.
12:53jaaqo$dict transducer
12:53lazybotjaaqo: noun: A substance or device, such as a piezoelectric crystal, microphone, or photoelectric cell, that converts input energy of one form into output energy of another.
12:53sdegutisWow lazybot. So wrong.
12:53justin_smithI may at least update that plugin to tell you other def's exist
12:53sdegutisjustin_smith: but hopefully not to access them?
12:54weavejesterlazybot should have a Clojure definition dictionary that it prefers
12:54sdegutis$dict have
12:54lazybotsdegutis: verb-transitive: To be in possession of: already had a car.
12:54clojurebotTitim gan éirí ort.
12:54justin_smithweavejester: yeah, right now it just does a simple wordnick api call
12:54sdegutisoh
12:55justin_smith$wotd
12:55lazybotjustin_smith: abactinal: Pertaining to the surface or end opposite to the mouth in a radiate animal.
12:55sdegutis$wotd = perilous
12:55lazybotsdegutis: abactinal: Pertaining to the surface or end opposite to the mouth in a radiate animal.
12:55sdegutisIt seems broken.
12:57weavejesterI assume the word of the day is fixed
12:57weavejesterper day
12:57alpheusI'm destructuring deeply nested maps where the keys (and structure) aren't known until run time. The code's getting cumbersome. Is there something that would help me do this?
12:57justin_smithhttps://www.wordnik.com/
12:58justin_smithalpheus: get-in
12:58Glenjaminalpheus: use let & get-in instead of destructuring?
12:58alpheusYes, that's probably what I missed. Thanks!
12:59sdegutisweavejester: oh right, immutable; blech
12:59sdegutiswe need a mutable subclass of WOTD
13:00GlenjaminWOTD is an identity that changes over time
13:01justin_smith&(let [data {:a 0 :b 1 :c {:d {:e 3}}} path '(:c :d :e)] (get-in data path))
13:01lazybot⇒ 3
13:01sdegutisalpheus: Clojure's motto is "work smaerter not harder"
13:01sdegutisalpheus: Clojure's motto is "use streams not recursion"
13:01llasram$dict smaerter
13:01lazybotllasram: Word not found.
13:01sdegutisalpheus: Clojure's motto is "immutable decomplection"
13:02weavejesterI think Clojure's more about aggressive simplification.
13:02technomancyI thought it was "simple yet powerful"
13:02technomancyor is that just the sdegutis motto
13:02sdegutisalpheus: Clojure's motto is "simple, yet powerful"
13:02Glenjamini thought it was "always be decomplecting"
13:02sdegutistechnomancy: no, it's just that probably about 2/3 of all projects have that phrase in their readme
13:02alpheusalpheus's motto is "I'm not smart like you people are"
13:02teslanickalpheus: That's my motto too.
13:02weavejesterPower comes from simplification, I think :)
13:03Glenjaminaha, here we go: https://pbs.twimg.com/profile_images/1630228544/fakerichhickey.jpg
13:03sdegutisllasram: oh sorry, i meant smærter
13:03danielcomptonRich is nice so we are nice?
13:03technomancymy motto http://www.funnyjunk.com/funny_pictures/1906060/I
13:03sdegutisdanielcompton: no that is not our motto
13:03weavejesterThe new transducers are effectively a simplification, by factoring out the conj
13:03sdegutisalpheus: Clojure's motto is "Rich is hipster so we are hipster"
13:03teslanickI'm curious if this is an insane idea: I want to put to a channel and get some value back when a consumer processes the message I sent it. I played with callback functions and a "callback channel" -- is there an idiomatic way of doing something like this?
13:04sdegutisweavejester: well they're also a decomplexion
13:04justin_smithteslanick: pass in a channel to put the result onto
13:04weavejesterOr return a channel, perhaps
13:04mdrogalisweavejester: Maybe 2 steps forward in terms of simplicity, 1 step back. You still need to be aware of stateful transducers in certain contexts.
13:04weavejester(<! (do-something foo))
13:05weavejesterLike a promise
13:05weavejestermdrogalis: Yes, maybe.
13:05mdrogalisNot complaining though. :)
13:05sdegutisI want to add a maybe-monad to Clojure.
13:05teslanickOk. I wrote a function called putback! that takes a channel to put to and a value. It returns a channel upon which a result will be passed. The other side knows how to interact with the "chan-back"
13:07weavejesterMonads are a bit tricky without dispatch on return.
13:08technomancyyou need pattern matching or it's just going to be super tedious
13:11sdegutisAt about 3:07 into it, the Graduation song gets really epic.
13:12sdegutisIt goes on until about 3:34... It may be needful to put that sub-section on repeat a few times for maximum effect.
13:12sdegutisAnyway, I'm abusing Clojure metadata within defn.
13:13sdegutisI've got a meta-handler which looks at a route fn's metadata, so that I can just define (defn ^:login view-page-route [] ...) and it requires the user to login first, or redirects them.
13:14weavejestersdegutis: Why not use middleware?
13:14tickingdoes anybody know at the to of their head if nRepl is designed to handle multiple evals in parallel in one session?
13:15sdegutisweavejester: That's what I mean by a metahandler :)
13:16weavejestersdegutis: But why not apply the middleware directly to the routes?
13:17sdegutisweavejester: you mean instead of putting ^:login on the end-point route handler fn's var?
13:18sdegutisweavejester: because unless I'm appallingly mistaken, wrapping a route in the middle of a routes-chain is going to short-circuit the rest of the routes if it matches it halfway but not the remainder of the way
13:18weavejestersdegutis: Yes, you could wrap-requires-login over the group of routes that require logins.
13:18weavejestersdegutis: I don't understand what you mean by that.
13:20sdegutisweavejester: for example, I have (defroutes foo (GET "/" ...) (wrap-require-admin (GET "/admin" ...)) (GET "/cart" ...)) -- this is going to prevent /cart from ever being valid for non-admins, even though it's outside wrap-require-admin, unless I'm disgustingly mistaken
13:20justin_smithticking: I don't know this for a fact, but my expectation is that it would not parallelize for one session (connection) but if you opened another connection on the same server, that would run in parallel -- checking now
13:20sdegutisI ran into this a year ago and tracked it down to something like that.
13:23justin_smithhttps://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/server.clj#L43 ticking: the logic is here - each connection is in its own future, and each message in the handler is also a future in a block that uses (recur) after spawning the request in a future.
13:23justin_smithI used "future" one too many times describing the handler, but the code should be clear (see accept-connection and handle)
13:23tickingjustin_smith: nice thanks, so sending many :op :eval in succession should not break nrepl right?
13:24justin_smithdoesn't look like it from that code
13:24justin_smithticking: unless you send enough requests to starve the thread-pool I guess...
13:24tickingjustin_smith: I'm currently trying to add interrupt to gorilla repl, it's really about time :D
13:25justin_smithnice
13:25tickingso thanks a lot :D
13:25weavejestersdegutis: You can use the `wrap-routes` function in Compojure to wrap *inside* of routes.
13:25sdegutisweavejester: Thanks.
13:25weavejestersdegutis: It was made specifically with the idea of authentication failing in mind, though it's applicable for a lot more.
13:30sdegutisweavejester: That is a very useful feature.
13:31weavejestersdegutis: I thought so, but I don't know anyone who's using it yet :)
13:31sdegutisweavejester: I would have used it a year ago except I didn't know it existed, and when I found it in the source, I didn't understand how/why/when to use it.
13:32weavejestersdegutis: I didn't think it was a year old...
13:32sdegutisOh maybe not?
13:32sdegutisweavejester: And right now I'm not sure I can use it, because I've restructured my app to decomplect the route handling function from the route itself.
13:34sdegutisweavejester: Currently I have a list of tuples which I transform into handlers (partially using (make-route)) and then pass to (apply routes).
13:35sdegutisIt allows me to write a routes.clj file very similarly to a routes.rb file, containing [[:get "/" :home/show-home-page] [:get "/videos" :home/redirect-to-home-page] [:get "/admin" :admin/show-admin-page]] etc
13:41weavejestersdegutis: Hm, okay, but why would that stop wrap-routes from working?
13:41sdegutisweavejester: because I would need to wrap a subset of them -- oh wait, I can manipulate collections in Clojure.
13:44weavejesterbbl
14:56andyfBronsa: Clj-1591 comment discussion had a small test case that has symptoms like clj-1241 even after that fix was applied. No need for you to look at it, but in case you are interested ...
14:58andyfDifferent exception, so not identical symptoms, but var that is bound without aot is unbound when using aot
14:59Bronsaandyf: ah, AOT is involved. might be a completely different issue then, I'll take a look
15:00andyfTom Crayford created the test case, linked in comments
15:17daniel___i wonder if anyone can help me with a friend problem https://gist.github.com/danielstockton/649ceff075b793007e27 ?
15:17daniel___my workflow ring handler is never called
15:17daniel___and i can't work out why
15:18daniel___im trying a POST to the /api/session endpoint
15:22justin_smithdaniel___: that call to run-jetty won't see redefinitions of app, but if you change it to (run-jetty #'app ...) it will
15:22justin_smithdaniel___: not that that neccissarily caused your problem though
15:23daniel___that includes redefinitions of middleware and things that make up app?
15:23daniel___i seemed to be seeing changes when i made them further up without needing a restart
15:23justin_smithright, it won't see any of those redefinitions
15:23justin_smithhmm...
15:26daniel___justin_smith: changed it, now it logs all the calls to static resources
15:26justin_smithOK, I guess that's proof it's reloading.
15:27daniel___interested in why thats the case, but dont want to detract from my friend workflow issue
15:28justin_smithfrankly, I have only been confused by friend and never got it working
15:28justin_smithhopefully someone else can help you
15:28daniel___i read through the documentation when i had some time earlier, away from the code, and i thought i got the concepts
15:29daniel___but apparently not
15:30daniel___"Incoming requests are always run through the configured workflows prior to potentially being passed along to the secured Ring application" mine don't seem to be..
15:36raboidwhat does @() do in Clojure? Having a hard time finding any documentation for it
15:37joegallolooks for deref
15:37llasramraboid: It's a reader macro:
15:37andyfraboid: @form turns into (deref form)
15:37joegallo,`@foo
15:38llasram,`(@example)
15:38clojurebot(clojure.core/deref sandbox/foo)
15:38clojurebot((clojure.core/deref sandbox/example))
15:38llasramYeah, joegallo's was better
15:38llasram(inc joegallo)
15:38lazybot⇒ 6
15:38andyfClojure cheatsheet has a section on these
15:39andyfWhich could be better at linking to more details
15:40raboidOkay thanks ya'll
15:44raboidCould anyone familiar with aleph explain why this only handles the first request sent to it? https://gist.github.com/raboid/b9629fc24f3524fbdec4
15:44raboidWorks perfect on the first request, but after that it never seems to call the handler anymore?
16:02Bronsaandyf: I have a fix
16:03andyfBronsa: Your awesomeness level is up to its usual high, then :-)
16:04Bronsaandyf: it requires generating 7 more instructions for every interned Var though :/ but I don't think there's another way to fix it
16:05andyfTom says he will be creating a separate ticket for this issue, perhaps today, but mgr may not mind if you do
16:05andyfIt does seen independent of original ticket
16:05Bronsayeah it's unrelated-ish
16:06Bronsaah I think I can make this better.
16:12aaelonyI am reading data from a file that contains delimited text, one column of which is JSON. Using cheshire.core/parse-string on the JSON column gives me an error like "com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'I': was expecting 'null', 'true', 'false' or NaN ". I'm able to copy/paste a raw line from the file, then replace " with \" and run parse-string just fine. Wondering how to correctly prepare JSON data column such t
16:12aaelonyhat parse-string will read it correctly.
16:13aaelonyI've tried clojure.string/escape but that hasn't helped yet...
16:13aaelonye.g. (clojure.string/escape s { \" "\"" } )
16:13aaelonyany help appreciated
16:14notostraca~refheap
16:14clojurebotrefheap is a sufficiently large margin
16:14notostraca~pastebin
16:14clojurebotCool story bro.
16:15notostracasigh
16:15notostracaclojurebot: refheap |is| a pastebin. https://www.refheap.com/
16:15clojurebotRoger.
16:15notostracaclojurebot: pastebin |how about| refheap? https://www.refheap.com/
16:15clojurebotIk begrijp
16:16notostraca~pastebin
16:16clojurebotpastebin how about refheap? https://www.refheap.com/
16:16Bronsayup andyf http://sprunge.us/XNNg?diff -- creating a ticket now
16:16notostracaaaelony, can you pastebin a line of sample data?
16:17aaelonysec, almost done
16:17aaelonyhttps://www.refheap.com/93968
16:21aaelonyI wish I could pastebin a line of sample data, but I'm not allowed to do that :(
16:21aaelonyI think it's a matter of escaping the incoming string
16:22aaelonyfor example, if I manually replace " with \" at the repl for a line of data, parse-string works just fine
16:23aaelonythe input text contains valid json in all cases, but some of the fields within quotations may contain crazy characters...
16:24aaelonyI understand that it's hard to help without seeing the data...
16:44Bronsaandyf: http://dev.clojure.org/jira/browse/CLJ-1604
17:11cflemingBronsa: I had a question for you
17:11cflemingBronsa: I'd dearly love forms like reify and deftype, but which allow me to extend abstract classes
17:12cflemingBronsa: Not being able to do that kills me in Cursive
17:12Bronsacfleming: you can either change like 3 lines in the Compiler to allow that or you'll need to use genclass/proxy
17:12cflemingBronsa: To do that in Clojure proper I'd have to fork and modify the compiler - could I do that with tools.* in a macro?
17:13vermawhat's the difference between :hello and ::hello ?
17:13cflemingIt's only 3 lines? I'd assumed I'd need new forms for that.
17:13weavejesterverma: ::hello includes the current namespace
17:13weavejester,::hello
17:13clojurebot:sandbox/hello
17:13vermaoh what? nice
17:13vermaTIL
17:13vermathanks weavejester
17:13verma(inc weavejester)
17:13lazybot⇒ 11
17:13Bronsacfleming: no I mean, you can make deftype/reify extend an abstract class rather easily
17:14weavejesterverma: You can also use it to include namespace aliases as well
17:14weavejesterverma: So ::str/foo might become :clojure.string/foo
17:14weavejester,::str/foo
17:14clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: ::str/foo>
17:14vermaoh
17:14weavejesterLooks like lazybot doesn't include clojure.string
17:14vermaas long as str can be resolved?
17:14weavejesteryeah
17:14justin_smith&(require '[clojure.string :as s])
17:14lazybot⇒ nil
17:14cflemingBronsa: Interesting, that might be a good approach since I can bundle my own Clojure. In fact I'd only need to use that for compilation, right? Since I'm AOT'ing.
17:15justin_smith&s/foo
17:15lazybotjava.lang.RuntimeException: No such var: s/foo
17:15justin_smith&::s/foo
17:15lazybotjava.lang.RuntimeException: Invalid token: ::s/foo
17:15justin_smitherm
17:15weavejester&(do (require '[clojure.string :as s]) ::s/foo)
17:15lazybotjava.lang.RuntimeException: Invalid token: ::s/foo
17:15Bronsacfleming: or you could do that with t.a/t.e.jvm withouth forking yeah but I'd just patch the Compiler if I were you
17:15justin_smithweird
17:15weavejesterProbably because they're in the same form.
17:15weavejesterAnd the separate forms are sandboxed
17:15Bronsacfleming: right. I actually already implemented that years ago, let's see if I can find that patch
17:15vermabrewing up a repl and trying it
17:15weavejesterIt works in an actual Clojure file anyway ;)
17:16cflemingBronsa: Ok thanks - a patch would be fantastic, if not I can probably work it out.
17:16vermaso I would use to create a namespaced keyword sort of?
17:16justin_smith&(namespace ::foo/bar)
17:16lazybotjava.lang.RuntimeException: Invalid token: ::foo/bar
17:16cflemingBronsa: I'm also going to modify them to allow requiring their namespace in clinit.
17:16justin_smithwat
17:16vermatest.clj -> ::hello is the same as :test/hello in a separate file?
17:16justin_smith&(namespace :foo/bar)
17:16lazybot⇒ "foo"
17:17justin_smithverma: yes, it is precisely making a keyword that has a namespace
17:17vermanice
17:17vermagot it
17:17verma(inc justin_smith)
17:17lazybot⇒ 147
17:17cflemingBronsa: Of course, it'll need more work to allow superclass method invocation.
17:17Bronsacfleming: https://github.com/Bronsa/clojure/commit/915aadc0cb8a604b6ef4976d2f19a2b1dfb994f5
17:17Bronsadon't know if that still applies
17:18cflemingBronsa: That's fine, I can modify it - thanks so much, that might just save my life.
17:21cflemingBronsa: I'm still not sure what a good syntax would be for superclass invocation, but I don't always need to do that.
17:21cflemingBronsa: Just being able to extend is really helpful.
17:23Bronsacfleming: yeah with that patch only it'll only work for abstract classes that don't declare a constructor -- it simply invokes the no-arg super ctor
17:26cflemingBronsa: Ohhh... right, I'll definitely need the super constructor call. I'd have to add syntax similar to proxy for that, but that's probably a pretty simple modification to your patch.
17:28cflemingBronsa: If I decide I do want a separate form, t.a/t.e.jvm should allow it in a macro, right? Does t.e.jvm support AOT compilation yet? I know that wasn't there a while back.
17:30Bronsacfleming: we're not there yet unfortunately. I still have a major bug to fix in t.a.jvm before I get to start playing with t.e.jvm again
17:31Bronsacfleming: I'll be honest, right now it's probably less work to patch Compiler.java than implement that by extending t.e.jvm (without patching it)
17:32augustlin the name of interop and legacy, is there a way to get a servlet handler object implementation from a ring handler function?
17:33weavejesteraugustl: You can get the ServletContext, Request and Response objects when running in a servlet container.
17:33augustlweavejester: the other way around, so to speak :) I'm in a setting where I have some servlets and map them to a servlet context with Java code, and want to do that with a ring handler as well
17:34l1xis there a way to get to know the name of the thread I am in that was created with (async/thread ... ) ?
17:34weavejesteraugustl: Oh, well you can create a servlet object using the ring/ring-servlet library.
17:34augustlweavejester: ah, nice. Thanks!
17:34Bronsacfleming: it's not summer and I have lessons now, I don't have the time to actively work on all the 5 tools.* libraries so I gave priority to t.a/t.a.jvm since those are the more useful -- t.e.jvm is on the bottom of the list i.e. I'll work on it when there will be no more issues with the other libs.
17:34weavejesteraugustl: There are functions for creating a servlet via a proxy, and via gen-class
17:35justin_smith,(.getName Thread/currentThread)
17:35clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: currentThread in class java.lang.Thread, compiling:(NO_SOURCE_PATH:0:0)>
17:35augustlweavejester: very nice
17:36justin_smith&(.getName (Thread/currentThread))
17:36lazybot⇒ "Thread-5691"
17:36justin_smithl1x: ^^^
17:37l1xthanks!
17:37l1xjustin_smith: your suggested way of dealing with concurrency works
17:37l1xi am testing it on stage now
17:37cflemingBronsa: Sure, no problem - just wondering where it was at. Thanks for the help!
17:37justin_smithl1x: cool, it has worked for me in that past :)
17:37cflemingBronsa: I'll fix the compiler since I more or less understand that.
17:38Bronsa"fix" :) let me know if you have any issues -- happy to help
17:38l1xjustin_smith: i might poke you to review my code (few lines really) if you have time because it is opensauce
17:39justin_smithl1x: I am in and out today (at a pub on my laptop right now) but happy to look at it if yo catch me at a good time
17:39l1x:d
17:39l1xnice tahnks
17:40Bronsacfleming: btw don't know if this could help but I wrote https://github.com/Bronsa/neurotic a while ago. IIRC ztellman also has a lib that does something similar.
17:40l1xCannot find field currentThread for class class java.lang.Thread
17:40l1xhmm
17:40l1xohh
17:40TEttinger2aaelony: still there?
17:40TEttinger2my connection is not great
17:41aaelonyTEttinger2: hi
17:41justin_smithl1x: notice my second example, the one that worked
17:41justin_smithl1x: not a static field, but a method call
17:41l1xyes! :)
17:41TEttinger2(clojure.string/escape "hello there, \"friend-o\"" { \" "\"" } )
17:41TEttinger2,(clojure.string/escape "hello there, \"friend-o\"" { \" "\"" } )
17:41clojurebot"hello there, \"friend-o\""
17:42TEttinger2,(clojure.string/escape "hello there, \"friend-o\"" { \" "\\\"" } ) ; may be what you want
17:42clojurebot"hello there, \\\"friend-o\\\""
17:42aaelonyTEttinger2: I was playing around with clojure.string/escape but I didn't try that exactly. Let me give it a shot.
17:42TEttinger2,(println (clojure.string/escape "hello there, \"friend-o\"" { \" "\\\"" } ))
17:42clojurebothello there, \"friend-o\"\n
17:42TEttinger2,(print (clojure.string/escape "hello there, \"friend-o\"" { \" "\"" } ))
17:42clojurebothello there, "friend-o"
17:43TEttinger2substituting "\"" for \" is the same as "\"" for "\""
17:44aaelonyTEttinger2: Actually, looking at the things I had tried, what you mention was among them.
17:45aaelonyTEttinger2: and produces the error "com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'I': was expecting 'null', 'true', 'false' or NaN"
17:45TEttinger2can you just make up some names-changed sample data?
17:45TEttinger2like change any keys like :name to :foo
17:46aaelonyTEttinger2: I call (last) on the line before, I think that may not always be valid. In any case, it is something silly in the data that is causing this. It will be found...!
17:48TEttinger2null, true, false, or NaN should probably mean that it's trying to get a boolean and it's getting something like "I wish I had a pony", just with the quotes not read correctly
17:48cflemingBronsa: That does look really useful, thanks - I'll investigate that too.
17:50TEttinger2if ztellman and Bronsa combined their powers we'd have an unstoppable Clojure juggernaut
17:54andyfThat has already occurred
17:55aaelonyperhaps I can hint it to expect a string....
17:57dbaschaaelony: do you know if your json is well formed? i.e. if you paste into a json validator does it validate?
17:58dbaschit looks like you’re reading a string that’s missing a quote, so the parser doesn’t know what to make of it
17:58aaelonydbasch: it is well formed for the rows I have tried. If I manually replace " with \" for the cases I have tested, it works just fine
18:00hiredmangithub's highlighting seems to thing most of the code in tools.reader is a string literal :/
18:00dbaschaaelony: what happens if you try to parse {"a":1,"b":2}
18:00bbloom_hiredman: i think they've switched github's highlighter to use the same codebase as atom as a ploy to get ppl to contribute better highlighting for their editor
18:01TEttinger2aaelony, so there are strings like this in your data: "key": "Quoth the raven, "Nevermore." And he was totes right."
18:01aaelonyIt is certainly true that the data contains semi-colons, punctuation, and all sorts of stuff. I'm in the process of adding things to escape as I find them.
18:01hiredmanbbloom_: :|
18:02TEttinger2semicolons are fine in strings... how are you parsing this...
18:02aaelonyTEttinger2: There are strings like "a":"Out out darn spot. ;)"
18:03TEttinger2that shouldn't be any problem
18:03aaelonyat some level, it's likely true that some kind of preprocessing or cleaning will have to act on this before the json parser will work.
18:04TEttinger2that should parse as the string "Out out darn spot. ;)"
18:04aaelonyit's just not easy to identify from the error messages what the offending problem strings are
18:04dbaschaaelony: it’s either well formed json or it’s not. If it is, it should parse
18:04aaelonyI will half the data until it works. then backtrack.
18:04dbaschyou should not need to escape anyything
18:05aaelonyI've used this library before, without issues.
18:05dbaschwhich library?
18:05aaelonyIt's a data thing. Thanks guys. I'll just hunt for the data problem.
18:05aaelonyjackson
18:05dbaschif it’s not well-formed json and you say it is, we can’t help you
18:06aaelonydbasch: thanks
18:07aaelonyThere are multiple foreign languages in the data as well that may be interfering as well.
18:07dbaschaaelony: it’s either json or it isn’t
18:08aaelonythanks dbasch: It is supposed to be. I didn't produce it. I'll take this offline now. thanks to everyone.
18:09dbaschaaelony: keep in mind that foreign characters have nothing to do with it
18:10aaelonythere may be lots of things in there, unicode, etc... I'm not as certain as you are.
18:11dbaschaaelony: unicode is absolutely fine. I hate to repeat myself, but your json is well-formed or malformed and the rules are pretty simple.
18:12aaelonyI'm leaving this conversation now
18:18dbasch{"a":"v̛̼̰̳͎̟̹ͥ̈ͅo̡͗ͩ́͏̘̰̳̲͎k̵̨͕̩ͬͥ̉̌̓̏͐ḛ̫̟̠̳̖͎͇ͭ́ͭ̌̾̈́͟ ̷̭̲͙̤̯͙͓̄̄͡t̡̞̿̿ͯͪ͌͋̌͡h̵̯̒ͬ͌̌ͪ̇̀͘e̡̥̹͉͆̍̈́̏ͮ̿ͬ̀ ̵͓̫̥̱̌̈̌̈́ͅh̩̪̭̰ͩ̏̎̀͛̅̓̚i͓̝̦̎̈́ͤͦ̅̑̔ͫv̞͖̜̓̅ͥ̍e̶̮͈͒̆͌̎̉͆̋̒̚-̥͎͂̽͋̓̒ͨ̊̌m͇̱̭͈̹͇͕͌ͨ̓ͬ͡ͅi͙ͣ̍n̸͚̖ͧ͛̋̔͌͜d̪̈́͂ͬ͆͂̓
18:18dbasch{"a":"v̛̼̰̳͎̟̹ͥ̈ͅo̡͗ͩ́͏̘̰̳̲͎k̵̨͕̩ͬͥ̉̌̓̏͐ḛ̫̟̠̳̖͎͇ͭ́ͭ̌̾̈́͟ ̷̭̲͙̤̯͙͓̄̄͡t̡̞̿̿ͯͪ͌͋̌͡h̵̯̒ͬ͌̌ͪ̇̀͘e̡̥̹͉͆̍̈́̏ͮ̿ͬ̀ ̵͓̫̥̱̌̈̌̈́ͅh̩̪̭̰ͩ̏̎̀͛̅̓̚i͓̝̦̎̈́ͤͦ̅̑̔ͫv̞͖̜̓̅ͥ̍e̶̮͈͒̆͌̎̉͆̋̒̚-̥͎͂̽͋̓̒ͨ̊̌m͇̱̭͈̹͇͕͌ͨ̓ͬ͡ͅi͙ͣ̍n̸͚̖ͧ͛̋̔͌͜d̪̈́͂ͬ͆͂̓
18:18dbasch{"a":"v̛̼̰̳͎̟̹ͥ̈ͅo̡͗ͩ́͏̘̰̳̲͎k̵̨͕̩ͬͥ̉̌̓̏͐ḛ̫̟̠̳̖͎͇ͭ́ͭ̌̾̈́͟ ̷̭̲͙̤̯͙͓̄̄͡t̡̞̿̿ͯͪ͌͋̌͡h̵̯̒ͬ͌̌ͪ̇̀͘e̡̥̹͉͆̍̈́̏ͮ̿ͬ̀ ̵͓̫̥̱̌̈̌̈́ͅh̩̪̭̰ͩ̏̎̀͛̅̓̚i͓̝̦̎̈́ͤͦ̅̑̔ͫv̞͖̜̓̅ͥ̍e̶̮͈͒̆͌̎̉͆̋̒̚-̥͎͂̽͋̓̒ͨ̊̌m͇̱̭͈̹͇͕͌ͨ̓ͬ͡ͅi͙ͣ̍n̸͚̖ͧ͛̋̔͌͜d̪̈́͂ͬ͆͂̓
18:19dbasch{"a":"v̛̼̰̳͎̟̹ͥ̈ͅo̡͗ͩ́͏̘̰̳̲͎k̵̨͕̩ͬͥ̉̌̓̏͐ḛ̫̟̠̳̖͎͇ͭ́ͭ̌̾̈́͟ ̷̭̲͙̤̯͙͓̄̄͡t̡̞̿̿ͯͪ͌͋̌͡h̵̯̒ͬ͌̌ͪ̇̀͘e̡̥̹͉͆̍̈́̏ͮ̿ͬ̀ ̵͓̫̥̱̌̈̌̈́ͅh̩̪̭̰ͩ̏̎̀͛̅̓̚i͓̝̦̎̈́ͤͦ̅̑̔ͫv̞͖̜̓̅ͥ̍e̶̮͈͒̆͌̎̉͆̋̒̚-̥͎͂̽͋̓̒ͨ̊̌m͇̱̭͈̹͇͕͌ͨ̓ͬ͡ͅi͙ͣ̍n̸͚̖ͧ͛̋̔͌͜d̪̈́͂ͬ͆͂̓
18:19dbasch{"a":"v̛̼̰̳͎̟̹ͥ̈ͅo̡͗ͩ́͏̘̰̳̲͎k̵̨͕̩ͬͥ̉̌̓̏͐ḛ̫̟̠̳̖͎͇ͭ́ͭ̌̾̈́͟ ̷̭̲͙̤̯͙͓̄̄͡t̡̞̿̿ͯͪ͌͋̌͡h̵̯̒ͬ͌̌ͪ̇̀͘e̡̥̹͉͆̍̈́̏ͮ̿ͬ̀ ̵͓̫̥̱̌̈̌̈́ͅh̩̪̭̰ͩ̏̎̀͛̅̓̚i͓̝̦̎̈́ͤͦ̅̑̔ͫv̞͖̜̓̅ͥ̍e̶̮͈͒̆͌̎̉͆̋̒̚-̥͎͂̽͋̓̒ͨ̊̌m͇̱̭͈̹͇͕͌ͨ̓ͬ͡ͅi͙ͣ̍n̸͚̖ͧ͛̋̔͌͜d̪̈́͂ͬ͆͂̓
18:19sdegutisHow did you know?
18:20sdegutisdbasch: not even 20 minutes before you did that, someone else did that in #swift-lang
18:20sdegutisIs that just spreading across IRC right now?
18:20dbaschsdegutis: what, zalgo?
18:21dbaschoops, I pasted it too many times
18:21sdegutisdbasch: yeah
18:21dbaschbut each line is parseable json
18:21sdegutis,{"a":"v̛̼̰̳͎̟̹ͥ̈ͅo̡͗ͩ́͏̘̰̳̲͎k̵̨͕̩ͬͥ̉̌̓̏͐ḛ̫̟̠̳̖͎͇ͭ́ͭ̌̾̈́͟
18:21clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :>
18:22sdegutis,(def s "Z̷̡̥̹̗͉̖ͨͬͥA̬͍̲ͪ̌̂̕͟L͖͕̯̳͚̜͖͙͍̉͑̄͐ͯ̆̚G̢̪͙̬̤̦̺̍͒ͧ̄̉̐Ō̻̥͉̼̃̋̿̍̀͟!̲̻̰̳͊̐ͥ̎̎͢͜͠")
18:22clojurebot#'sandbox/s
18:22sdegutis,s
18:22clojurebot"Z̷̡̥̹̗͉̖ͨͬͥA̬͍̲ͪ̌̂̕͟L͖͕̯̳͚̜͖͙͍̉͑̄͐ͯ̆̚G̢̪͙̬̤̦̺̍͒ͧ̄̉̐Ō̻̥͉̼̃̋̿̍̀͟!̲̻̰̳͊̐ͥ̎̎͢͜͠"
18:22llasramHuh
18:23sdegutisidunno
18:24llasram"Huh" -> "Not what I expected to see in my terminal Emacs session upon returning to it"
18:24llasramI imagine something is lost in the rendering
18:25andyfI'm amazed it renders so far outside of a normal line's "boundaries" in so many rendered
18:25andyfRenderers, that is
18:29sdegutisllasram: this is all i see https://www.dropbox.com/s/ms1q0byzn27gquq/Screen%20Shot%202014-11-25%20at%205.27.46%20PM.png?dl=0
18:30sdegutisllasram: i imagine there are secret words hidden in there which are evil or inappropriate or something
18:30llasramWow
18:31technomancythe sepiroth
18:31dbaschthat is what Pi looks like if you start reading it from the other end
18:32gfredericks:)
19:55marcuscreo #clojure
19:55marcuscreooops
21:15danielcompton,s
21:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: s in this context, compiling:(NO_SOURCE_PATH:0:0)>
21:16danielcomptondoes Clojurebot reset it's vars after a while?
21:16vermadoes the bot clearup stuff
21:16verma?
21:16verma:)
21:16danielcomptonclojurebot: do you?
21:16clojurebotHuh?
21:16danielcomptonclojurebot: answer the question
21:16clojurebotexcusez-moi
21:16vermaclojurebot: kind sir, did you just take a shower?
21:16clojurebotTitim gan éirí ort.
21:17vermacan I copy that weird text
21:17verma,(def s "Z̷̡̥̹̗͉̖ͨͬͥA̬͍̲ͪ̌̂̕͟L͖͕̯̳͚̜͖͙͍̉͑̄͐ͯ̆̚G̢̪͙̬̤̦̺̍͒ͧ̄̉̐Ō̻̥͉̼̃̋̿̍̀͟!̲̻̰̳͊̐ͥ̎̎͢͜͠")
21:17clojurebot#'sandbox/s
21:17vermazelol
21:18vermaZ̷̡̥̹̗͉̖ͨͬͥ
21:18vermaL͖͕̯̳͚̜͖͙͍̉͑̄͐ͯ̆̚
21:18verma L͖͕̯̳͚̜͖͙͍̉͑̄͐ͯ̆̚
21:21kenrestivowhat is this, unicode torture day?
21:21danielcomptonkenrestivo: international unicode torture day
21:31danielcomptontake your unicode child to work day
21:39kenrestivoi've been having strange problems with clojure.tools.namespace.repl/refresh blowing "namespace not found" errors
21:39kenrestivowhere, the namespaces are definitely there, the source is all there, and i can load them manually no problem
21:49akkadanyone here using newrelic with clojure?
21:51devnGiven {:foo [{:bar 1} {:bar 2}], :baz [{:bar 3} {:bar 4} {:bar "hello"}] ...}, I want [[1 3] [1 4] [1 "hello"], [2 3] [2 4] [2 "hello"]]
21:52kenrestivosomeone just asked almost that exact question yesterday
21:52kenrestivoi think it was a reduce-kv answer
21:53justin_smithsomething like (map #(map bar %) (vals data)) I think
21:53justin_smithmakes those mapvs if you really need vectors
21:54justin_smitherr wait
21:54justin_smiththere is structure there I did not notice, never mind, that is wrong
21:54justin_smithbrb
21:55kenrestivothe :foo and :baz seem almost superfluous.
21:55devnyou can treat them that way, sure
21:56mgaareI don't know what I'm doing wrong with cljx. I've got a .clj ns that requires a .cljx ns, and it complains it can't find it and exceptions out even of the lein cljx once task
21:58danielcomptonmgaare: do you have code samples you can share?
21:58andyfkenrestivo: Shot in the dark: do any of your source files contain namespace names that do not correspond to the file names? Eastwood can quickly tell you if so (1st check it does)
21:59mgaaredanielcompton: yeah, hangon
21:59kenrestivoandyf: ooh, cool, will try. i'm pretty sure not because lein-check is copacetic
21:59andyfI don't think Lein check will tell you that
21:59kenrestivobut running it through the eastwood/kibit gauntlet sounds like a fine idea
22:00danielcomptonkenrestivo: kibit will blow up if you're doing anything too weird so there's that
22:00andyfIt is a not uncommon mistake that can lead to subtle problems or un executed tests
22:05kenrestivowow, eastwood is pretty damn cool.
22:05kenrestivotho it is very upset about timbre log/info, complaining about: (clojure.core/not= file__5335__auto__ "NO_SOURCE_PATH")
22:06kenrestivospecifically constant-test: Test expression is always logical true or always logical false: (clojure.core/not= file__5335__auto__ "NO_SOURCE_PATH")
22:06andyfkenrestivo: I just verifies that Lein check does not catch all cases of file name / namespace mismatch. It did on a core.clj file in a new project I created , but not on another file I created with bad namespace
22:06mgaaredanielcompton: https://gist.github.com/mgaare/7118a0975c13099ef29d
22:08kenrestivoeastwood also complained about a missing var, which wasn't. i had (:require [foo.bar :as bar]) and then (bar/baz ...) later, and it complained that bar was not found
22:08andyfkenrestivo: Yeah, since it macro expands first then does its checks, some macros lead to too many warnings. I have a thought on a semi-convenient way to selectively shut those off, but not yet implemented
22:08kenrestivoit thought bar was a var not a namespace alias
22:09danielcomptonmgaare: what happens if you remove literal
22:09andyfkenrestivo: Open source project? If so, a github issue would be welcome
22:09mgaaredanielcompton: remove as a dep from jena?
22:10kenrestivono, sadly, not. if i can get a minimum repro i will tho
22:10andyfWas bar/baz inside back quoted form ?
22:11kenrestivonope
22:11danielcomptonmgaare: I mean just remove the file
22:11kenrestivohmm, actually, it was first arg to swap! so maybe there's some macro magick in swap!
22:11danielcomptonmgaare: temporarily delete it
22:12andyfOk. Then it might be a case I haven't seen before.
22:13kenrestivoandyf: cool tool though. if it wasn't blowing so many spurious warnings about constant-test, i'd probably run it often
22:14andyfI'll create a test case like that - could be significant. Swap! is not a macro, but I am often finding new cases I have not seen before like this
22:15mgaaredanielcompton: ok, I just removed all references to .cljx namespaces from .clj namespaces, ran lein cljx once, reinstated the references, and now a repl starts up properly.... this doesn't seem like how cljx is spose to work though
22:15andyfI tend to err on the side of "warn if not sure" and then quiet down new cases that are too noisy as I discover them
22:15danielcomptonmgaare: did you try doing a lein clean before the lein cljx once?
22:15mgaareyea
22:16andyfSorry, I guess not much help on the tools.namespace weirdness, though
22:18kenrestivoyeah, it's very odd. it's dying on every required namespace
22:19andyfDo you have example timbre logging call that gives warning for me to reproduce ?
22:21kenrestivoit's just log/info
22:23andyfYou can now disable constant-test linter globally in your project either on cmd line or in project.clj file. E.g. Lein Eastwood '{:exclude-linters [:constant-test]}'
22:23kenrestivointerestingly, the namespace problem goes away if i gut ALL the files, removing everything except the ns decl :-/
22:23mgaareah, I think user.clj was at fault
22:23kenrestivoso now it's a house-of-cards situation, i'll start adding stuff in do a bifurcation check to find where it breaks
22:24andyfThe part in quotes can be value of :eastwood key in your project.clj file
22:24kenrestivooh cool
22:26zRecursiveIs it convenient using Clojure to create a Maxima-like software ?
22:29andyfProbably as convenient as it would be in scheme, Common Lisp, etc
22:29andyfStill work :-)
22:29zRecursivehope so
22:31andyfThere is a library called expresso on github that is a start, but not sure how much is there
22:32zRecursivethanks