#clojure logs

2014-10-16

00:17amalloydopamean_: as long as it's hard to mistake an error-response map for a success map, returning a map in both cases seems fine to me
00:22dopamean_thanks amalloy
00:35cddrWith reference to this gist: https://gist.github.com/cddr/ac89b88f93f92b6b913b
00:36cddrIs there a better way to write encrypt so that the returned value inherits the behavior of the input value?
00:37cddrfor all behaviors except IFn
00:39cddrHm, maybe proxy is better for my use-case
00:50amalloycddr: no, you cannot create a forwarding wrapper to an arbitrary object, without knowing what methods to forward
00:52amalloyclasses and their methods are static things on the jvm, which must be known at compile time
00:56cddrOne alternative I can think of is to use metadata to store the encryptor. Does that seem insane?
00:58cddrwah! you can't add metdata to keywords
00:58amalloycddr: the things you are saying do in general sound insane, but it's hard to be confident without some idea of why you think this is stuff you should do
01:00cddrTrying to implement the encryption part of what I describe here: https://github.com/cddr/crud/README
01:01cddrI thought the elements of the :storage attribute could be either keywords or functions that operated on an input map (as keywords already do)
01:02cddrIt would be nice if when it was a function, it behaved as a keyword in every other way
01:04cddrAlso "the things you are saying do in general sound insane". Have you been talking to my wife?
01:04cddr:)
01:06amalloyi think you should just have a distinction between two things that are different: a keyword for looking things up, a function for encrypting things. why do you wish they were the same thing?
01:07cddrI need the name of the attr that the function will wrap for when I'm generating a datomic fact
01:07cddrIt's probably fine to just implement named as I did in the gist
01:09cddrThanks for taking the time to look at this. I appreciate it.
01:12amalloycddr: you can also just use a pair, containing a keyword and a function, instead of a function which is named. there's nothing grotesquely wrong with your reify, but it seems simpler to break things apart
01:13cddrYeah that's a good point
01:30arrdemis there a way to make lein dump the project booting command?
01:31arrdemtrying to find a way (besides uberjar, there are reasons) for getting lein out of the loop in deployment
01:33arrdemnvm got it
01:38amalloyarrdem: proposed names for this feature: lein out-of-my-way; lein self-obsolesce; lein never-mind
01:38arrdemamalloy: lein cp-and-gtfo
01:45tomjackI wonder if a partition transducer is planned?
01:45justin_smitharrdem: lein don't
01:45tomjackclojure.core.async/partition got the deprecation notice
02:01arrdemGrimoire back online, mod DNS update latency
02:01arrdemnow on its own VM and subject to less weirdness
02:02sridyears ago i stumbled upon the blog of a >50 yr old clojure consultant. i can't seem to remember his blog or name. does anyone remember?
02:05JaoodRich Hickey?
02:07Jaoodarrdem: so you made the clojuredocs step it up?
02:07arrdemJaood: I don't think so, but it's possible
02:08arrdemJaood: there was already a rewrite in progress. if anything I just husled it a bit.
02:09sridfound it. http://www.markwatson.com
02:12tomjackah, I see that partition-all got a transducer, but not with step
03:50vise890hi guys, how do you deal with storing and reading secret variables (like an API token) from code that will be in a public repo?
03:51arrdemenvironment variables ftw
03:52vise890is there something similar to dotenv for ruby? (https://github.com/bkeepers/dotenv)
03:53arrdemI'm sure there isn't
03:55arrdemYou could either pass your configuration as Java system properties, as environment variables or have a config file that you don't put in VC
03:55arrdemwhich one is appropriate depends on your use case
03:55arrdemI'd lean towards the config file, but I've done the shell/environment value thing before as well
03:56vise890OK thanks, I've actually just found this http://yobriefca.se/blog/2014/04/29/managing-environment-variables-in-clojure/ which seems to be exactly what I'm looking for
03:56vise890thanks anyway arrdem!
03:57arrdemnp
03:57hyPiRionI usually prefer config files too, due to ACL.
03:58hyPiRion`cat /proc/<pid>/environ | tr '\0' '\n'` is surprisingly easy to do.
05:01cka3ycHello, is there an easy way to zip folder with all its content?
05:22mpingcka3yc: you mean with clojure?
05:24cka3ycyes
05:27TEttingercka3yc: you could use the JVM's built-in .zip support http://www.java2s.com/Code/Java/File-Input-Output/CompressfilesusingtheJavaZIPAPI.htm
05:28TEttingerthere's some convenience methods here http://stackoverflow.com/a/17966479 cka3yc
05:30cka3ycthanks
05:38visofhi
05:38visofi'm trying to use lein s4-deploy from this page, i got 's4-deploy' is not a task. See 'lein help'., what should i do ?
05:38visofhttps://github.com/antoniogarrote/clj-s4
05:38visofis there anybody tried clj-s4
05:43TEttingerhave you followed the steps at https://github.com/antoniogarrote/clj-s4#running-the-sample-application , visof?
05:43TEttingerlein deps may be needed to download the plugin first
05:44visofhi?
05:45visof_i'm trying to use lein s4-deploy from this page, i got 's4-deploy' is not a task. See 'lein help'., what should i do ? https://github.com/antoniogarrote/clj-s4
05:45visof_is there anybody using clj-s4
05:45visof_?
05:46weavejesterIt looks very old
05:46weavejesterSeems like it predates Leiningen 2
05:47weavejesterYou could try putting it in “plugins” rather than “dependencies” but it might be too old to work with modern versions of Lein
05:48visof_weavejester: but clj-s4 as plugin in ~/.lein/profile.clj ?
05:49weavejestervisof_: Why put it in profile.clj?
05:50ddellacostavisof_: I think weavejester was suggesting to put it in the plugins section of your project's project.clj file (vs. the dependencies section of that file)
05:50weavejesterYep
05:50visof_okay
05:51weavejesterBut don’t know whether it will work. It might, but the plugin/library is very out of date
05:51ddellacostayeah, Clojure 1.2, last update Jan 2011? Good luck...
05:51ddellacostayou never know I guess
05:55weavejesterIs the latest melpa cider broken for anyone else?
06:01CookedGryphoncider is always broken
06:02CookedGryphonI found one that is not quite as broken as the others in a snapshot about a month ago, and haven't dared update since
06:03weavejesterI think mine might be broken because I don’t have the GNU ELPA repo explicitly mentioned in Cask
06:04weavejesterMaybe I should use melpa-stable as well :)
06:04CookedGryphondon't think that helps, 0.7.0 is in melpa-stable, and I couldn't get that to work at all
06:04CookedGryphonI was better with the snapshots
06:05weavejesterEvery so often I check out alternative editors, but they don’t have good vim keybindings
06:05martinklepschWhen I have a ":profiles {:dev {:env {:yolo "abc"}}}" in my project.clj and a profiles.clj containing: "{:dev {:env {:test "test"}}}" — only the content of the :env key in the profiles file will remain in the merged result right?
06:07martinklepschweavejester: have you seen this: http://martintrojer.github.io/clojure/2014/10/02/clojure-and-emacs-without-cider/
06:08weavejestermartinklepsch: I think my problem is more with emacs generally
06:08weavejestermartinklepsch: I love it’s functionality
06:08weavejestermartinklepsch: Hate its slowness and general iffyness
06:09martinklepschdo you use it in a terminal?
06:09weavejesterNope
06:10martinklepschHm, it's fast for me but my setup is "young" as well
06:10martinklepschmy vim takes 5 seconds to start :D (probably very bloated setup)
06:12clgvmartinklepsch: profiles are merged by leiningen
06:12clgvmartinklepsch: you can check with "lein pprint"
06:14martinklepschthe documentation said it'd merge recursively, that's why I was expecting both keys to be in the :env map
06:17weavejesterLein profiles are merged recursively, though if you have the same profile declared in two locations, only one version is used.
06:19noncom|2does anyone use overtone here?
06:21daniel__noncom|2: i've dabbled
06:21clgvweavejester: really? that's unexpected when everything else is merged and ^:replace metadata can be used as well
06:22noncom|2when i require overtone, it first says "--> Loading Overtone..." and then "CompilerException java.lang.Exception: Can't connect to native server - no compatible libraries for your system are available., compiling:(overtone/live.clj:4:38)
06:22noncom|2"
06:22noncom|2though i have sc installed
06:22weavejesterclgv: Yeah, it’s a bit of a gotcha
06:22noncom|2sc 3.6.6 on win
06:22weavejesterclgv: For example, if you have a :dev profile in your project.clj and a local profiles.clj
06:22clgvnoncom|2: some path problem?
06:23clgvweavejester: indeed
06:23weavejesterSo I tend to have :local/dev and :repo/dev profiles
06:23clgvweavejester: and then aliases in the project.clj?
06:23weavejesterThough maybe I should call them :profiles/dev and :project/dev
06:23weavejesterYeah, :dev [:repo/dev :local/dev]
06:23clgvok
06:24weavejesterThen I keep profiles.clj out of source control and use it for local overrides
06:24clgvweavejester: we should come up with a project.clj programming challenge - sometimes just the configuration options seem almost turing comlete ;) :P
06:24noncom|2clgv: probably... i just dont see anything about paths in the getting started man.. looks like i am to investigate more then.. :)
06:25noncom|2weavejester: hi! what's about your jmonkeyengine project? how is it going?
06:25clgvnoncom|2: it was probably written from a linux/mac user(?) ;)
06:26noncom|2clgv: that is for sure :) everybody around uses linux or mac :) that's... umm... funny :)
06:26weavejesternoncom|2: Oh, I realised that the 3D work I was doing wasn’t the problem I wanted to solve.
06:26weavejesternoncom|2: So I switched to a ClojureScript/Clojure architecture.
06:26noncom|2weavejester: so you have continued with reagi but not with jme ?
06:27weavejesternoncom|2: For a while, yes. But I couldn’t find a good way of coordinating timing in a reactive system
06:28weavejesternoncom|2: So I built Ittyon instead, which is an in-memory database a little inspired by Datomic, but designed for realtime work
06:30clgvweavejester: you didn't announce it, yet?
06:31weavejesterclgv: It didn’t seem like something that would be that useful beyond my usecase, and the API was a little in flux.
06:31clgvweavejester: ok ;)
06:31weavejesterclgv: I was planning on announcing it sometime though
06:33noncom|2weavejester: ah, so you have gone to a completely different project.. wow, Ittyon looks interesting! will take a look into it.. just recently was thinking of a in-memory db to use :)
06:33weavejesterBut I imagine those who need a Clojure/ClojureScript distributed database designed for communicating game state across a client/server architecture are kinda niche
06:33weavejesterI mean, it might have other uses
06:33weavejesterBut it was made so I could have a multiplayer game on a website :)
06:36martinklepschweavejester: in a project.clj with :env {:is-dev true} it wouldn't make much sense to go the :profiles/dev :project/dev route, right?
06:37martinklepschyou could just commit profiles.clj with that single entry and add it to .gitignore afterwards
06:39weavejestermartinklepsch: Well, you really only need to go down the :profiles/dev route if (a) you want to have local overrides to your project that aren’t in source control, and (b) you already have a :dev profile you don’t want to overwrite, but merge into
06:41martinklepschok, thanks
06:44CookedGryphonis there a reason there's a keep-indexed transducible but map-indexed isn't?
06:44CookedGryphonor is that just a "it hasn't been done yet"
06:45clgvCookedGryphon: ah well these consistencey issues are all over clojure.core
06:45clgvCookedGryphon: but probably you can raise attention to it right now (Jira ticket)
06:46clgvCookedGryphon: though maybe a separate `index` transducer would be great...
06:48TEttingermap-indexed is a weird fn to even have because it's equivalent to map with an extra collection passed to it, (range)
06:48clgvTEttinger: but then keep-indexed is weird as well (at least to some extent)
06:49TEttingerdoes keep take multiple collections?
06:49TEttingerI rarely use it
06:49CookedGryphonTEttinger: that's true, I'd never thought of it like that... it's not implemented like that though
06:49CookedGryphonand no it doesn't take multiple collections
06:49clgvTEttinger: no
06:49CookedGryphonI might just stop using it and start doing map (range) ... instead
06:50TEttingermap-indexed may be more efficient
06:50TEttingerwho knows
06:50CookedGryphonyeah probably is if you're feeding in a vector
06:50CookedGryphonclgv: how would you see an index transducer working?
06:50clgvwell for an eager mapv it makes sense to have a specialized mapv-indexed which does not need a (range) seq since that would destroy the performance improvements of the eager variant...
06:51CookedGryphonwould it make tuples, or actually call the next thing with multiple arguments
06:51clgvCookedGryphon: that was just a thought since it would avoid the combinatorial explosion of adding indexed to multiple seq functions. I am not sure if it is really realizable
06:52clgvCookedGryphon: I'd prefer it to work somehow similar to partial with respect to the mapping function
06:53clgvCookedGryphon: that's maybe a puzzle challenge for this evening ;)
06:53CookedGryphonclgv: could be fun when applied to chans
06:53CookedGryphonshouldn't take long to do and make itwork like map with multiple args
06:53CookedGryphonyou'd get a unique id for each message passing through a chan... could be useful
06:54clgvCookedGryphon: ah right. the multi arity impl for map transducer is probably the blue print for that
06:54CookedGryphonthen all you need is a volative incrementing integer
06:55martinklepschAre there any great ways to test leiningen templates?
06:55CookedGryphonand bob's your proverbial
06:55clgvhumm are you sure? when you have something like that as goal (def map-indexed (comp (map f) (indexed)))
06:56clgvyou can't really access `f` that way
06:56CookedGryphon it would need to be the other way round
06:56clgvyeah more like (comp (map (indexed f)))
06:57clgvscratch the comp ;)
06:57CookedGryphonthat's still not right though
06:57clgvhuh why?
06:58clgvwhat is your idea?
06:58CookedGryphonwell, it could work, you'd just be implementing a function which adds an index rather than fitting teh transducer pattern
06:58CookedGryphoni don't know whether that matters as a distinction
06:58clgvtrue, but maybe it's only realizable like that. how'd you do it?
07:00clgvCookedGryphon:I have to admit that I did not try to implement any transducer so far - so I have a lack of intuition for that ;)
07:00CookedGryphonI have only implemented one, so I'm not much better off
07:02CookedGryphonyeah, dunno
07:02CookedGryphonmy concern with yours is when the index would get set to 0
07:02CookedGryphonor rather when it would be called and start counting again
07:21clgvCookedGryphon: I guess I'll take that as learning exercise ;)
07:25CookedGryphoncool, I'd be interested to know how that goes, composable indexed would be much nicer to use than having all the different variations
07:34justin_smithnoncom|2: https://github.com/overtone/overtone/issues/277
07:36noncom|2justin_smith: thanks! for some reason google did not show this page when i was searching... i will try it out :)
07:37noncom|2i wish i could help with 64 bits thoug, but i am not really a c/c++ man...
07:39justin_smithnoncom|2: it was the top google hit for "supercollider native server" - because I remembered there being such thing as internal, and external servers from my time using sc, but the term native server was unfamiliar
07:40justin_smithturns out it is a terminology specific to overtone
07:42noncom|2justin_smith: alright, that clears things up :) but ther is one more issue - i have installed sc into a non-default folder and (boot-external-server) cannot find it.. is there any way to make it look in a different location?
07:42noncom|2or i could just make some invasive surgery on overtone..
07:43justin_smithfrankly, I have used supercollider but I have never used overtone - I assume there is some configuration available either to your $PATH variable or directly in overtone which would fix this
07:43noncom|2well, ok, this problem is much simpler anyway :)
07:53martinklepschhey weavejester, maybe you have any thoughts on this: https://github.com/plexus/chestnut/pull/30 — we're trying to find a good env var setup for a leiningen template..
07:56weavejestermartinklepsch: Sure
07:56weavejesterLet me add a comment
07:57KototamaHi, any idea how to access context parameters with ring?
07:58weavejesterKototama: context parameters? Like via a servlet?
07:59Kototamaweavejester: yes, tomcat context parameters
08:00Kototamahttps://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Context_Parameters
08:01KototamaI would like to access them when the servlet is initialized
08:01weavejesterKototama: If compiled as a servlet, a Ring handler has access to the ServletContext via the :servlet-context key
08:01Kototamabut this is accessible only in a request
08:01weavejesterInitialisation is outside the scope of Ring. Lein-Ring has an init method, but I don’t think that currently includes the ServletContext.
08:02Kototamayes, i think that's the problem
08:02Kototamai need that before the first request, to configure the app
08:04justin_smithKototama: what about using a promise to hold the configuration, and delivering to it when the first request is received?
08:04justin_smithless than ideal, yes
08:06Kototamajustin_smith: i need to dynamically give a pathfile to the servlet from the external environment
08:06Kototamaso that the app can read the configuration file
08:09justin_smithwouldn't you also see that info vi (System/getenv "key")?
08:10justin_smithif you are in a container's vm, you should see it's env right?
08:10CookedGryphonwhen using transduce... you always have to define an arity-1 version of the function as well as the one which takes the accumulator? reduce doesn't do that does it? I found this surprising
08:10Kototamait would be a solution but that's not super clean as it pollutes the env
08:11mdrogalisCookedGryphon: I think Rich talks about that during his SL talk. I can't recall why though
08:11justin_smithKototama: maybe I misunderstood what you meant by "from the external environment" - I thought you meant the config would already be in the env
08:13justin_smithKototama: anyway, my initial proposal using a promise for the config is basically late binding: you get the info needed with your first request, and that fills in your config (of course this would likely need to happen before routing happens)
08:14Kototamajustin_smith: thank you , i will see if i can do this solution with our system
08:14Kototamathere is also this https://github.com/laurentpetit/ring-java-servlet
08:14Kototamanot sure if it's compatible with ring
08:15justin_smithwell, it's a ring servlet - it may not be compatible with your container, but it implements ring
08:15weavejesterKototama: It should be. That might be your best solution.
08:16Kototamait's a bit overcomplicated, maybe i'll try to just use java env parameters
08:17justin_smithyou mean system properties? changing env in java is non-portable and hackish
08:17Kototamathe thing you pass with -D :-)
08:17justin_smithyeah, properties
08:17Kototamathanks :-)
09:19sudodokiHello channel, sorry to bother, but have really simple vector iteration question: how to apply operation to each element in vector & collect the result? Have this gist not working: https://gist.github.com/sudodoki/5f61b4decfe3445b6cf2#file-vector_stuff-cljs-L6
09:20sudodokiAs result I get the sum vector without operation being applied
09:22justin_smithsudodoki: I recommend a basic clojure intro
09:23sudodokiOkay, nvrm, just missing parens
09:23justin_smith,(let [v [1 2 3]] mapv println v)
09:23clojurebot[1 2 3]
09:23justin_smith,(let [v [1 2 3]] (mapv println v))
09:23clojurebot1\n2\n3\n[nil nil nil]
09:24justin_smith,(mapv + [1 2] [3 4]) ; sudodoki: your addVector could be #(mapv + %&)
09:24clojurebot[4 6]
09:24sudodokijustin_smith: I did some clojure/clojurescript koans & have started with clojure for brave, just doing some novice errors when learning to write code on my own.
09:24justin_smithsure
09:25justin_smithjust making sure you are checking out basic level materials if you have a mistake like that
09:26sudodokiThanks, appreciate your time.
09:26justin_smith,(#(mapv + %&) [1 2 3] [4 5 6] [7 8 9])
09:26clojurebot#<ClassCastException java.lang.ClassCastException: Cannot cast clojure.lang.PersistentVector to java.lang.Number>
09:26justin_smithoops
09:26justin_smith,(#(apply mapv + %&) [1 2 3] [4 5 6] [7 8 9])
09:26clojurebot[12 15 18]
10:06dysfun_is there a renaming import macro somewhere
10:07dysfun_something like (import-renaming '[foo.bar :refer [bar :as baz]])
10:08dysfun_er, s/import/require/
10:09dysfun_oh, :rename
10:09dysfun_right, it's not documented
10:10dysfun_where's the correct place to report that?
10:10Bronsadysfun_: (require '[foo :refer [bar] :rename {bar baz})
10:10Bronsadysfun_: it's documetned in refer
10:10vijaykiranhttp://clojuredocs.org/clojure.core/refer
10:10dysfun_":refer takes a list of symbols to refer from the namespace or the :all keyword to bring in all public vars.
10:10Bronsadysfun_: in the refer function
10:10dysfun_it's not documented in 'require'
10:11dysfun_yes, i understand what you're saying, but it sounds like it can't be done
10:11dysfun_it makes no reference to the refer function
10:11dysfun_it just says it refers them
10:11Bronsaok
10:11Bronsadysfun_: open a ticket on dev.clojure.org/jira then
10:11dysfun_okay, thanks both
10:12Bronsadysfun_: if you have signed the CA you can attach a patch yourself
10:12Bronsaif not, it takes a minute to do it
10:12dysfun_is it all online or do i have to print one off?
10:12Bronsait's online now
10:12dysfun_brilliant. got a link handy?
10:13Bronsahttps://secure.echosign.com/public/hostedForm?formid=95YMDL576B336E
10:14dysfun_thanks
10:15Bronsanp
10:17dysfun_and signed
10:17dysfun_right, let's get this patched then
10:21TimMcHaha, that e-sign thing is so funny.
10:21dysfun_the ui is...tedious
10:21dysfun_but less tedious than anything involving printers
10:21TimMcYou know what makes it official? When you type in your name, it renders it in cursive!
10:21dysfun_the point where software has to touch hardware is where it all goes horribly, horribly wrong
10:21dysfun_hahaha yeah
10:21TimMcOh god yes, I'm not complaining -- it's better than printing and mailing.
10:22dysfun_they've added a drawing option now
10:22TimMcI just find it highly amusing.
10:22dysfun_you can draw it on yourself
10:22dysfun_you know, they probably paid someone a lot of money to do that crappy handwriting font
10:23TimMcAnd to be honest, that's what makes it official: Money changed hands, so it must be more binding, official, and reliable than any other e-signature.
10:23vijaykiranor just used - http://www.myscriptfont.com
10:23dysfun_yes, but this is adobe. they don't just use someone else's font
10:23dysfun_they've churned out more fonts over the years than just about anyone
10:29dysfun_i'm not clear exactly what to update these docs to, to be honest
10:29clgv,(require '[clojure.string :rename {join magic} :refer [join]])
10:29clojurebotnil
10:29clgv,(magic "," (range 5))
10:29clojurebot"0,1,2,3,4"
10:29clgvdysfun_: did you mean that use case? ^^
10:30dysfun_yes
10:30clgvit's weird that you need to refer `join` although you already added it to `rename`...
10:30dysfun_i'm not entirely clear what to put in the docs, because it doesn't just pass it to refer
10:32clgvdysfun_: it does transitively https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5666
10:32dysfun_i would have thought it would do something like (require '[clojure.string :refer [join :as magic]])
10:32dysfun_that would make more sense
10:33dysfun_you've already got :as for aliasing namespaces
10:33clgvbut that holds as reason not to use ":as" as well
10:34dysfun_you don't think it's more confusing to choose two different words for the concept of aliasing?
10:34clgvdysfun_: I wouldnt use that syntax with keywords there
10:34dysfun_why?
10:34clojurebotwhy is the ram gone
10:35dysfun_that too :)
10:35dysfun_it's got a nice analogue with destructuring bind
10:36clgvI'd stay with the :rename approach but make it work such that in the above example `join` is not needed in :refer
10:37clgvminimal and backwards compatible change ;)
10:37dysfun_make it reliant on positioning?
10:37dysfun_that sounds awful. you're putting two related pieces of data separately
10:37clgvhuh what?
10:38clgvcan you state again what exactly you want to achieve. maybe I misunderstood something
10:38dysfun_well we're now in the realms of 'how could that look nicer?'
10:38dysfun_i've already got the solution to my problem
10:39clgvI find the redundant use of `join` in my example suboptimal and would just fix that
10:39dysfun_yes, but how would you fix that?
10:40clgvdysfun_: adding a new syntax is not very likely to succeed if the current syntax is pretty minimal and suffices
10:40dysfun_think of it less as a matter of practical interest and more a theoretical thing
10:40clgveasiest fix is to add they keys in :rename to the :refer list internally within load-lib
10:41clgvdone ;)
10:41dysfun_oh i see, so you'd just not have to specify them in :refer ?
10:41clgvyes.
10:41dysfun_that sounds like a reasonable option
10:41dysfun_i might look into it when i've finished updating these docs
10:41clgvand one that has a high chance to be merged ,)
10:42sveriHi, when creating a new project with luminus I get the reload feature for free, in code it looks like this: http://pastebin.com/NXmD8fBr Now, what I want is to pass some params to my routes, but I don't know how to do that give the current structure, how can that passing of arguments be achieved in this case?
10:42clgvsveri: instead of (def app ...) you need a function (defn app [...] ...)
10:43dysfun_there are some examples here that show how the destructuring bind works https://github.com/weavejester/compojure/blob/master/test/compojure/core_test.clj
10:43clgvsveri: but maybe that fails if luminus is automagically starting your application and expects a value
10:44svericlgv: yea, that's what I tried, but its not working when it loads the app
10:44clgvsveri: maybe you can specify a custom startup handler?
10:44clgvsveri: otherwise you wont be able to achieve that...
10:45dysfun_yeah, i'm not fond of frameworks where they expect to control startup and just call back into you
10:45svericlgv: I am not sure how to do that without loosing the ability to reload the code
10:45dysfun_javafx is hell to use through clojure
10:45AeroNotix_Caused by: java.lang.IllegalArgumentException: Not a file: jar:file:/home/xeno/dev/gat/target/uberjar/gat.jar!/VERSION I'm having a problem when using lein-ver. It can't find the file inside the jar, but when I `jar -tf gat.jar | grep VERSION` it's there. Any ideas?
10:46AeroNotix_that gat.jar! exclamation point is suspicious.
10:46clgvsveri: I dont know luminus, so you need to find someone who does or try to find projects which also need parameterized routes
10:47svericlgv: ok, thank you
10:54danneusveri: have you tried http://ring-clojure.github.io/ring/ring.middleware.reload.html
10:55donbonifacioI created a project, deployed it to clojars, referenced it on another project, but I can't load a namespace from the other project. What could I be messing?
10:55donbonifacio*missing
10:55inad922Hello
10:56jphxthis is dog
10:56inad922I'm new to the language. If I defined a PersistentArrayMap via {:a 1 :b 2} does this create some efficient balanced binary tree like and rbt or avl?
10:58sveridanneu: yea, but it seems to have problems with route changes
10:58sveriand maybe some other stuff like protocols
11:02justin_smithdonbonifacio: is the dependency successfully pulled in?
11:02donbonifaciojustin_smith: yes, lein deps brings it
11:03donbonifacioit's a snapshot versions, don't know if that matters
11:04justin_smithhow are you requiring the namespace?
11:04AeroNotix_Caused by: java.lang.IllegalArgumentException: Not a file: jar:file:/home/xeno/dev/gat/target/uberjar/gat.jar!/VERSION I'm having a problem when using lein-ver. It can't find the file inside the jar, but when I `jar -tf gat.jar | grep VERSION` it's there. Any ideas?
11:06donbonifaciojustin_smith: fuck, typo. thanks for helping me!
11:07btcNeverSleepsWhen I run "lein test" I get lots of "garbage" output from my program which makes the results of "lein tests" harder to read (I need to scroll, it's harder to see which test(s) failed, etc.). Is there some "best practice" as to what to do to not run into this issue? (I'm using "timbre" for logging btw)
11:07AeroNotix_woops
11:07justin_smithbtcNeverSleeps: turn off logging during tests maybe?
11:07justin_smithor log to a file
11:07btcNeverSleepsjustin_smith: sounds great, how do I do that? Is this some lein configuration?
11:08justin_smithit's a timbre config
11:08AeroNotix_Btw, is the leiningen s3 bucket not working?
11:08AeroNotix_https://leiningen.s3.amazonaws.com/downloads/leiningen-2.5.0-standalone.jar
11:10justin_smithbtcNeverSleeps: there are various appender examples in the timbre docs https://github.com/ptaoussanis/timbre you would want to create a file appender
11:10justin_smithbtcNeverSleeps: another option is to set the TIMBRE_LOG_LEVEL env var
11:10visofhi
11:10justin_smithif you want to just turn the logging off or make it quieter
11:11btcNeverSleepsjustin_smith: great, thanks... And can I somehow configure "lein test" to set the TIMBRE_LOG_LEVEL to a quieter mode everytime "lein test" is called? (I realize it's a noobish question but both Clojure / lein timbre / etc.) are quite new to me
11:12visofis the best way to deal with my local java jars to local mvn repo, or create s3 mvn remote repo and push my jars there and add the url of repo in project.clj?
11:12visofwhat do you think guys about this?
11:14mdrogalisvisof: Are you working with others on this project?
11:14visofmdrogalis: yeah
11:15justin_smithbtcNeverSleeps: you can use environ for that https://github.com/weavejester/environ
11:15mdrogalisvisof: Definitely get yourself a Maven repo with S3.
11:15mdrogalisVery announcing to have to do local installs on a team, IMO
11:15mdrogalisannoying, rather*
11:15btcNeverSleepsjustin_smith: thanks, a lot, reading and bookmarked : )
11:16visofmdrogalis: and then refer to this repo in project.clj and this are going to work, right?
11:16mdrogalisvisof: Correct.
11:16visofmdrogalis: thanks
11:17mdrogalisvisof: Np!
11:17lambdahandsHi, all. I was fascinated by the self-documenting code found here: https://github.com/tylerneylon/termtris
11:18lambdahandsIs it taboo to use an ignore form (#_) on a string of multiple lines to do the same?
11:19justin_smithlambdahands: #_ still needs balanced forms
11:19justin_smithlambdahands: you can do proper literate programming in clojure https://github.com/gdeer81/marginalia
11:21justin_smiththe official site is also an output of marginalia http://gdeer81.github.io/marginalia/
11:22dysfun_hrm, that's odd. :verbose on (require) seems to only work in the repl if you also use :reload
11:22lambdahandsjustin_smith: This is awesome! Thank you!
11:23justin_smithdysfun_: require does nothing if something has already been loaded and you don't specify :reload
11:23justin_smithlambdahands: np, this reminds me I meant to use marginalia myself :)
11:23dysfun_it's a fresh repl in a presumed nonexistent namespace 'bar'
11:23dysfun_or at least presumed not loaded
11:24justin_smithrequire doesn't load anything if the ns is already loaded somewhere else though - did maybe lein or nrepl load the ns?
11:24dysfun_oh, no, i know where that's coming from :/
11:34dysfun_clgv: so you can use :rename without :refer, it's just that it defaults to importing everything then
11:34dysfun_clgv: so your change would be breaking
11:43clgvdysfun_: no you cant. (require '[clojure.string :rename {join magic}]) does not refer anything to the current namespace
11:43clgvdysfun_: start a fresh repl and see yourself (Clojure 1.6.0 here)
11:45clgv,join
11:45clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: join in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:45clgv,(require '[clojure.string :rename {join magic}])
11:45clojurebotnil
11:45clgv,magic
11:45clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: magic in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:45clgv,join
11:45clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: join in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:45clgvq.e.d. ;)
12:24upwardindexI updated cider and cannot connect anymore, it hangs at “Establishing SSH tunnel connection…” Is that a new feature?
12:27technomancycider's #1 feature is to be full of surprises, always
12:29nullptrthere are "good cider days" and "bad cider days" in approximately equal measure
12:30technomancyupwardindex: using an unstable version of cider is a really bad idea unless you're actively developing it
12:30mgaarelike an aging relative with dementia
12:30upwardindextechnomancy: is melpa cider unstable?
12:30technomancyverma: is this your comment? https://github.com/technomancy/leiningen/issues/1721
12:31technomancyupwardindex: everything in melpa is unstable
12:31technomancyavoid
12:31technomancyit really boggles me as to why people use it =\
12:31technomancyI guess it's because they are not clear about the fact that it contains a lot of broken crap
12:31upwardindexfml, I just pressed U x in list-packages, all my packages are unstable now
12:31technomancy._.
12:32technomancyfirst thing to do is take melpa off your package list
12:32technomancyback up your elpa/ directory, then delete all your packages and reinstall the ones you care about from a stable source
12:33technomancy~melpa
12:33clojurebotmelpa is not what you want.
12:33nullptrtechnomancy: and install nyan-mode manually? bah.
12:34justin_smithtechnomancy: someone should do a sketch comedy where someone goes to a restaurant, and the waiter tells them they should take random items off the stove in the kitchen. Person then complains about the various ways they are not edible (this is still cold / this is raw / how am I supposed to eat this without a sauce ...).
12:34technomancyjustin_smith: haha; nice
12:35justin_smithit's the waiter's fault for telling them to just grab things from the kitchen, and the diner's fault for thinking that is reasonable
12:36technomancyexcept maybe the kitchen is disguised as a vending machine
12:36justin_smithhmm...
12:36justin_smithyeah, kind of falls apart there
12:37justin_smithtechnomancy: hangs a sign reading "restaurant" on a grocery store, fast forward to people eating uncooked noodles out of the box
12:37technomancyhehe
12:46mdeboardmelpa-stable is... serviceable
12:46mdeboardI have avoided most of the headaches since switching
12:47mdeboardOf course, some of the same people who don't see the point of having melpa-stable are also maintaining critical emacs libraries for me
12:47mdeboardSo they don't do granular release management which means e.g. CIDER goes a really long time between updates
12:47mdeboard(which is good given some of its recent turbulence)
12:48mdeboardmelpa does a good job
12:48mdeboarderrrr magit*
12:55TimMcupwardindex: Once you have everything back in working order, put your .emacs.d under source control.
12:56upwardindexTimMc: that is a very wise suggestion, I have gotten lazy in my emacs administration since I discovered prelude
12:57technomancythat should be qualified though. you want all the .el files checked in, but not the .elcs
12:57upwardindexJust for the record, latest cider managed to connect when given the ip (I usually just use the hostname)
12:59justin_smithtechnomancy: will package generate new elc files if you have cleaned them out?
13:00technomancyjustin_smith: only on fresh installs, I think
13:00technomancyI mean, don't delete them, just don't check them in
13:00technomancyyou can regenerate them if you move your dotfiles to a fresh machine
13:00technomancyor something
13:02justin_smithtechnomancy: I was just thinking it would be good to know about package clean / package compile if such commands existed
13:16TimMctechnomancy: Why not the elcs?
13:16technomancyTimMc: they're not portable across emacs versions
13:17justin_smithalso, they are compiled artifacts, and shouldn't be in version control
13:17TimMcjustin_smith: This is a different kind of version control. It's more like... dependency management, where you want to lock in versions of things.
13:17nullptrmv **/*.elc ~/.m2
13:18TimMcIf I'm worried that I might not be able to generate binaries in the future, I'll include them.
13:19TimMc(I don't think that applies here, though.)
13:20justin_smithTimMc: which is why I asked about clean / compile tasks
13:21technomancyM-x byte-compile-directory is a thing
13:21technomancynot sure if it's recursive
13:23clgvnullptr: mv **/*.elc /dev/null would fit your name better ;)
13:24nullptrclgv: true indeed! not sure i'd really notice if my elcs were got, fwiw -- computers are pretty fast these days.
13:24justin_smithis there a version of apropos that returns the var of the result? or at least a namespaced symbol?
13:24justin_smith,(apropos "base64")
13:24clojurebot()
13:25justin_smith,(apropos "str")
13:25clojurebot(clojure.core/char-escape-string clojure.core/char-name-string clojure.core/construct-proxy clojure.core/create-struct clojure.core/defstruct ...)
13:25justin_smithwoah - that's the version I want...
13:25justin_smith,*clojure-version*
13:25clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
13:25justin_smith,#'apropos
13:25clojurebot#'clojure.repl/apropos
13:26mikerodI asked in the #leiningen channel, but no luck: I have a macro used in some of my namespaces that def's a var, but prevents redefs - e.g. someone tries to re-compile the file or redefs a var with the same name later in the same ns.
13:26mikerodThe macro throws an exception in this case. Leiningen apparently is redef'ing some vars in my test namespaces, so the tests fail with compile errors.
13:27mikerodAnyone familiar with this and have any advice on how you'd address it?
13:28hiredmanmikerod: leinigen doesn't do that
13:28technomancyactually lein test requires your tests with :reload
13:28technomancyotherwise it wouldn't work in persistent settings; you'd just run your old tests over and over
13:28justin_smithyeah, require reload would do that
13:28hiredmanugh
13:29hiredmananyway, that'll do it
13:30mikerodtechnomancy: that's the problem I think. It goes like: (a) I have a "test resource namespace" in my test resources that a test uses - this gets compiled on its own at some point
13:30technomancymikerod: so you never run your tests in the repl?
13:30mikerod(b) my actual test namespace comes along and it compiles the dependency again? wait no, that doesn't make sense if it is just a :reload on each namespace
13:31mikerodtechnomancy: repl is fine, it is a dependency namespace of a test that is getting loaded 2 times. I get it now
13:31mikerodThe test compiles first
13:31technomancyhm; yeah it's not :reload-all
13:31mikeroda) the test compiles first, compiling its dependency (b) the dependency namespace is picked up as its a test of its own and is :reload required
13:31stuartsierraMore to the point, why do you have such a macro?
13:32mikerodstuartsierra: We have a DSL. Some of what the DSL defines are stored in vars. It was a common mistake for users of the DSL to accidentally name 2 vars the same.
13:32stuartsierramikerod: okay, fair enough. Might be easier to do that with a pre-processing pass instead.
13:33mikerodstuartsierra: within the same file. Clojure doesn't complain about this. I think it is a similar issue with like `clojure.test/deftest`. People often name 2 tests the same name on mistake and then that means only one really runs
13:33technomancyyeah, you could work around this in your tests, but it would be better to make your code reload-safe
13:33technomancymikerod: shouldn't you be blocking redefs that have a different file/line rather than redefs in general?
13:34mikerodtechnomancy: yeah, it'd be nice if we just silently didn't redef. except from the DSL perspective that would just confuse people since they wouldn't know their 2nd definition did not do anything. It is really a user-error that we found nice to throw at compile-time
13:34mikerodtechnomancy: I guess that is a good point
13:34mikerodI mean that would work
13:35mikerodIt'd make development nicer, that's for sure
13:35mikerodOne hook we had in at one point was just a *debug* sort of dynamic var. I wasn't sure if I could scope a dynamic var for the `lein test` time though. I also wasn't sure I liked that approach anyways. :P
13:36mikerodWe actually have these files logically separated though as, "test resources" and "test namespaces". The issue is leiningen treats both paths as "test namespaces", so they all get their require :reload done. If the order goes the real "test namespace" first, then later its "test resource" dep, the error shows up.
13:37technomancyare they all under test/ ?
13:37mikerodI agree that maybe I should just change the macro. But does Leiningen not have the concept of a "test resource" dir? - Maybe I just make it :resource-paths in a test profile.
13:37technomancystuff under dev-resources won't get reloaded
13:38technomancythe test profile won't work in the repl, but dev-resources will
13:38mikerodok, I may just try that to understand what lein does better. Although I'm now a fan of your line # filename approach, so I'll probably change to that.
13:38mikerod(inc technomancy)
13:38lazybot⇒ 148
13:38mikerod(inc stuartsierra)
13:38lazybot⇒ 11
13:39mikerodand nope, we have the classic maven style directory layout here - src/test/resources src/test/clojure src/test/java
13:39technomancyk, just use :dev instead of :test
13:40mikerodok, thanks for the advice
13:53mskoudnormaly a ring handler is created with a (def app ...) but what if i needed to define it as a function (defn make-app [system] ...) , how should serve be called?
13:53weavejestermskoud: How should serve be called?
13:54weavejestermskoud: Could you explain that sentence a little more?
13:55mskoudI'm using [ring.server.standalone :as server] , and calling (server/serve (make-app system)) seems to fail when the url is requested.
13:55Bronsauhm. I can generate at runtime (fn [] (b (c))) as (comp b c), is there a way to express (fn a [] (b (c a)))?
13:56weavejesterBronsa: Is that (fn a [] …) or (fn [a] …) ?
13:56justin_smithBronsa: (fn [a] (b (c a))) is (comp b c)
13:57Bronsaweavejester: justin_smith (fn a [] ..)
13:57weavejestermskoud: Hm, that should work. Is make-app returning a function?
13:58mskoudit returns a nesting of middleware: (wrap-edn-params (wrap ... (routes cms-routes)))
13:58justin_smith,((comp inc (constantly 1))) ; or did you mean this case Bronsa?
13:58clojurebot2
13:59Bronsajustin_smith: no, I definitely mean it as I said :) I need to pass the "this" local to one of the function I compose
13:59justin_smithBronsa: just saying (fn [] (b (c))) is not (comp b c) unless you are calling with no args
13:59justin_smithbut that's beside your point, clearly
14:00weavejesterBronsa: Sounds like you might want the y-combinator
14:00Bronsajustin_smith: suyre it is. (fn [] (seq (conj)) == (comp seq conj)
14:01weavejestermskoud: That looks like it returns a handler function… What error are you getting?
14:01gfredericksBronsa: ##((fn [] (seq (conj))) [] 1 2)
14:01lazybotclojure.lang.ArityException: Wrong number of args (3) passed to: sandbox5671$eval11395$fn
14:01gfredericks&((comp seq conj) [] 1 2)
14:01lazybot⇒ (1 2)
14:01mskoudjava.lang.IllegalArgumentException
14:01mskoudcontains? not supported on type: compojure.core$routes$fn__512
14:01mskoudRT.java:724 clojure.lang.RT.contains
14:01mskoudcore.clj:1415 clojure.core/contains?
14:01mskoudflash.clj:19 ring.middleware.flash/flash-response
14:01mskoudflash.clj:36 ring.middleware.flash/wrap-flash[fn]
14:01Bronsagfredericks: I never said I have to pass args to that
14:02Bronsa,(seq (conj))
14:02clojurebotnil
14:02gfredericksBronsa: yeah but justin_smith said "unless you are calling with no args"
14:02daniel___i want to write a library with some configurable vars that can be configured from the project importing the library
14:02Bronsaah, missed that
14:02daniel___can anyone share some techniques
14:02gfredericksBronsa: I think we all know how clojure works though so I'm not sure why I'm going this far out of my way to emphasize that
14:03weavejestermskoud: I think I’d need to see the app in more detail. Is it online?
14:06mskoudYes, http://pastebin.com/AjtgAcVD lin 235 , 254.
14:18justin_smithBronsa: would something in a letfn context count? that's all I can think of without maybe some ugly tricks
14:22Bronsajustin_smith: I don't think letfn would work, I might just end up using a dynamic var and be done with it. ugly solution but it's better than what I'm doing now (composing the functions every time the fn is invoked)
14:23Bronsajustin_smith: or a promise.
14:25bbloomBronsa: what do you need it for?
14:27Bronsabbloom: https://github.com/clojure/tools.analyzer/blob/master/src/main/clojure/clojure/tools/analyzer/passes.clj#L198-L199
14:27Bronsabbloom: I'd like to compose the passes just once rather than each time they are invoked
14:28Bronsathere might be some stupid easy way to do this that I'm missing
14:28bbloomBronsa: there's lots of crap going on in there, i gotta study it a sec
14:29Bronsabbloom: yeah, I'm in the process of refactoring & commenting the weird bits :P
14:30bbloomBronsa: why do you need to actually compose the passes? why not just have a vector of them?
14:30bbloomBronsa: presumably they are actually all tail calls to the next pass, right?
14:32Bronsabbloom: actually, no. (schedule #{#'pass-a, #'bass-b ..}) generates something like (fn [ast] (-> ast (prewalk (comp pass-a pass-c)) (postwalk pass-b ..) ..))
14:33Bronsabbloom: it composes together all the passes it can to reduce the number of complete tree traversals
14:34Bronsabbloom: doing a full tree traversal for each logical pass would be way too expensive
14:34bbloomok i think i understand now
14:35bbloomBronsa: when do you dynamically need to generate a fix-point like that? you're doing it statically here
14:37Bronsabbloom: maybe I explained myself badly, but you can see that I'm doing the reduce comp in line 199 -- that is inside the pass. this means it will be invoked every time that function is invoked and it will generate a bunch of functions again
14:37Bronsabbloom: it's the difference between (let [a (comp x y)] (fn [] (a))) and (fn [] (comp x y))
14:38BronsaI'm doing the latter, I'd like to do the former. the issue is that in my case, y might need to take `this` as a parameter
14:38bbloomBronsa: oh ok, ... well what if you define your fn as curried? so instead of (fn a [] (b (c a))) you have (fn a [] ((b (c)) a))
14:39bbloommy parens may be off there
14:39bbloombut anyway, you basically omit the recursive argument and return a function of that pending recursive argument
14:39bbloomthen you just call that and give it itself
14:40BronsaI see, that might work
14:40bbloomBronsa: also a fun read: http://okmij.org/ftp/Computation/fixed-point-combinators.html
14:41bbloomBronsa: see the section on the U combinator
14:41Bronsabbloom: thanks!
14:42justin_smithlein marg (the margenalia plugin) is hanging every time I use it - is that normal? do I need to make a pr that calls (shutdown agents) if it is called on its own?
14:44dysfun_do all bindings in a let show as being on the line the let starts on?
14:44justin_smithdysfun_: yes, it is sequential
14:45justin_smith,(let [a 0 b (inc a) c (inc b) d (inc c)] d)
14:45dysfun_okay, cool
14:45clojurebot3
14:45SagiCZ1i need a function that returns true if a string contains given substring, how would i do that?
14:46SagiCZ1(foo "hello" "ell") => true
14:47SagiCZ1(re-find #"ell" "hello")
14:47SagiCZ1,(re-find #"ell" "hello")
14:47clojurebot"ell"
14:48noonian,(.contains "hello" "ell")
14:48clojurebottrue
14:48SagiCZ1noonian: thats javas method right?
14:48noonian,(map #(.contains #"ell" %) ["foobar" "hello"]))
14:48clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: contains for class java.util.regex.Pattern>
14:48noonian,(map #(.contains % "ell") ["foobar" "hello"]))
14:48clojurebot(false true)
14:49noonianSagiCZ1: yes
14:49SagiCZ1noonian: thank you
14:49nooniannp
15:15SagiCZ1does anyone have any experience with incanter? or where would i find people who do?
15:18RaynesNobody knows anythin about incanter. Nobody on the planet.
15:18Raynes(It's best to just ask your question and see if anyone bites.)
15:18Raynes(Your question may not require an incanter expert, and if it does require one they're unlikely to volunteer to assist with an issue they know nothing about, due to time constraints and such)
15:19SagiCZ1i have a bunch of points plotted by scatter-plot and displayed by (view) .. i want to redefine the data and see the change interactively in the jframe.. as is possible when interactively working with swing
15:22xemdetiaSagiCZ1, I would look for some sort of way to trigger a repaint of the widget
15:22sqdwould core.async channels be suitable for reconfiguring in a max/msp like interface? or is something about them fundamentally different
15:23sqd(max/msp as in visual dataflow programming, connecting nodes etc)
15:23SagiCZ1xemdetia: yeah.. some things trigger the repaint.. like adding more data
15:24xemdetiaSagiCZ1, this is normal behaviour of any widget. If something triggers a redraw it redraws. You just need to find out a way to force a redraw whenever you change your data.
15:27justin_smithsqd: they should work very nicely for that - though you would have to implement splits (where to outputs come from the same place) explicitly
15:27justin_smithsqd: one adaptation would be to have a dedicated "splitter" that is used explicitly
15:29justin_smithsqd: one thing that comes to mind is using a data graph representation to track units as edges, and connections between them as vertices, and then constructors that make each unit and return the input and output channels for that unit
15:29sqdjustin_smith: cool, then i've got myself a little hobby project :-) currently programming with arduino and channels, could use something like this
15:29justin_smithcool
15:31justin_smithI forget the name for it, but there is that flattened representation of graphs, where you have a map from id to edge, and then a map from id to collection ids (the set of vertexes from that edge)
15:32justin_smiththe sparse representation that is
15:33justin_smithbut I guess in this case it would be a mapping from the id of some processing unit to its input channels
15:34justin_smithhow complex this ends up being depends on whether you would compile and run, or leave things running and modify the graph while it runs
15:34TimMcjustin_smith: adjacency list
15:34TimMchttps://en.wikipedia.org/wiki/Graph_%28abstract_data_type%29#Representations
15:34sqdthe live modification would be coolest, a use case now is to experiment with different parameters for feedback loops etc
15:34sudodokiSo, beginner clojure question: I have canvas context, and I have dot as a (list x y)
15:34justin_smithTimMc: ahh, that's the one, thanks
15:35justin_smithsqd: oh, so you want to actually route audio too?
15:36justin_smithsqd: in that case, check out pink, it's a modular dsp engine written in clojure, by one of the authors of csound
15:36sqdjustin_smith: i'm currently just using two motors as feedback to input from the hand
15:36justin_smithahh, that kind of feedback :)
15:41upwardindexIs it possible to do something tlike this: (. (symbol "System") (getProperties))
15:41TimMcNope.
15:42upwardindexTimMc: not even in cljs? (crosses fingers)
15:42justin_smithupwardindex: you could find the class / method from a string using reflection, but not like that
15:42justin_smithoh, cljs, never mind, I have no idea
15:42Bronsaupwardindex: in clj you can use reflection, in cljs you can use js*
15:43Bronsabut I wouldn't reccomend to do either
15:43upwardindexBronsa: I was hoping not having to use js* but I guess thats where I have come
15:43TimMcWhat's the use-case?
15:43upwardindexI need to implement some kind of “call this method on the object” for interaction with awesomium
15:44Bronsaupwardindex: why doesn't normal interop work for you?
15:47upwardindexBronsa: I need to provide an abstraction for async calls to awesomium, so I need to call methods of the awesomium object that is bound on the c++ side. When I simply call the function cljs does a “.call(null, …)” which is not appropriate and it seems I can’t resolve the symbol inside the abstration
16:04bbloomhey jvm perf wizards... how much impact does the dynamic-ness of vars have on escape analysis?
16:05bbloomer not really :dynamic *earmuffed* vars, just normal getRawRoot or whatever it is
16:10stuartsierrabbloom: I've heard that Escape Analysis hardly does anything anyway.
16:10hiredmanbbloom: I think the issue is vars is the volatile read
16:11bbloomstuartsierra: is that b/c it's too hard to do well, or b/c bump pointer allocation w/ a GC nursery is "fast enough"
16:11hiredmanwith vars
16:11stuartsierrabbloom: It's hard, and I recall someone like Goetz saying it doesn't work in as many cases as was originally hoped.
16:12bbloomhiredman: hm, i understand the meaning of volatile, but i'm not sure i really understand what the jvm physically *does* or *does not do* differently in response to it
16:12hiredmanbbloom: same boat pretty much
16:12stuartsierraVolatile read isn't particularly special. Volatile *write* is a memory barrier that busts caches.
16:13bbloomstuartsierra: is it doing some voodoo w/ the kernel's memory manager or some cpu instructions i don't know much about? ie, man $WHAT_DO_I_TYPE_HERE
16:13bbloom:-)
16:13hiredmanstuartsierra: well, the reads have to be ordered
16:13bbloomi need apropos-by-smart-people
16:14stuartsierrabbloom: You have IRC don't you? ;)
16:14bbloomapropos volatile
16:14bbloomgo.
16:15stuartsierraThe JVM says a write to a `volatile` variable must be visible on all threads by the time it completes.
16:15bbloomhow does that happen without a read barrier? and what is the write barrier implemented in terms of?
16:16stuartsierrabbloom: OutOfKnowledgeException :)
16:16hiredmanhuh, according to the internet the i386 memory model is strong enough to not need a fence on read
16:16hiredmanhttp://www.infoq.com/articles/memory_barriers_jvm_concurrency is what I landed on googling
16:16stuartsierraI think a volatile write has the effect of forcing the CPU to synchronize any cached copies of that variable.
16:17bbloomstuartsierra: if you had restartable exceptions, i could pass you back more knowledge or something
16:18bbloomsoooo you're saying that the write barrier just triggers some secret internal private ubiquitous read barrier? heh
16:18stuartsierrabbloom: Sadly I am not implemented in Common Lisp.
16:19hiredmanhttp://brooker.co.za/blog/2012/09/10/volatile.html actually as some experiments run timing volatile operations
16:22bbloomhmm interesting
16:31hiredmanI wonder if the root field for vars could just be made non-volatile, I mean, no one is mutating vars and using that to coordinate multiple threads, right?
16:31technomancythat's not something you can change with a system property, is it?
16:32hiredmannot really
16:32technomancymaybe you could have two paths, and have a system property to select for newly-compiled code, but not retroactively
16:32technomancybut it's probably not worth it
16:32hiredmanand you'd end up with the overhead of checking the system property
16:33technomancyeh; I think that could be done at compile time?
16:33hiredmanI suppose that is true
16:33hiredman(defn ^:non-volatile foo [...] ...)
16:33technomancysimilar to definline, I guess
16:34hiredmanwell, no, you could still redefine stuff without having to recompile callers
16:34hiredmanjust not a strong guarantee of when those changes become visible to other threads
16:35technomancyyou'd pick up the changes in content but not the changes in volatility
16:35hiredmanwell, no
16:36hiredmanchanges in volatility would be inadvisable and require recompiling callers
16:36hiredmanchanges of content would be at the whim of the processor caches I believe
16:36stuartsierraThere's been some work to make non-mutable Vars, like `^:static`
16:37hiredmansure, but those suck :)
16:38technomancywas that when every var in a namespace starting with "clojure" got opted into staticness?
16:38stuartsierraI don't think it ever did that, but lots of defs in clojure.core were annotated ^:static.
16:38hiredmantechnomancy: I vaguely recall that
16:39technomancyit never made it into a release, but we had master giving static behaviour to clojure-http-client at one point
16:39technomancythat was fun
16:39hiredmanyeah
16:39stuartsierraSomeone (Rich, Stu, Alex M?) was working on bringing it back as a compile-time flag.
16:39technomancyyeah, this one wasn't applied by metadata iirc
16:42technomancybut the result was similar
16:42Bronsashould be the direct branch
16:43hiredmanthe fastload branch is also messing with this stuff, but changin vars directlly it looks like, instead the compiler puts a stub in the var that loads the fns class on first use
16:46hiredman(no idea how that is going to work with invokePrim)
16:46hiredmanI guess it just doesn't
16:46hiredmanhttps://github.com/clojure/clojure/commit/32760085c1d72ee676927109e9ba804ee4983247#diff-f17f860d14163523f1e1308ece478ddbR3941
16:48Bronsahiredman: do you have any idea what the !hasEnclosingMethod is there for btw? I could never figure it out
16:49hiredmanBronsa: maybe for :static?
16:50hiredmanor maybe for defuns inside fns or something crazy like that
16:50hiredman(who does that?)
16:50Bronsahiredman: as I read it, it's there to ensure that only defns get through the static invoke, but I don't understand why a local fn couldn't
16:52hiredmanoh, sure, right
16:52hiredmanBronsa: well a local fn doesn't have a nice mutable binding(var) to swap in to
16:53Bronsano wait, that's inside emitForDefn, I didn't notice that
16:53Bronsaso yeah, looks like it's preventing forms like (fn [] (defn x []))
16:53Bronsabah, whatever. I'll look into it when/if it gets into master
17:36literaryjohnwalker
17:54weihow do i clear the cache of a memoized function?
17:55sritchiewei: you can’t with the usual memoize -
17:55sritchiewei: core.memoize gives you a bunch of options
17:56weioh, didn’t realize they were different
17:56sritchieyeah, core.memoize is a library that gives you a bunch of different strategies for memoization
17:56weican i use memo-clear! on a normal memoized function?
17:56Bronsano
17:56weikk
18:33mdeboardroasted
18:33mdeboardThey must not know about you
18:34mdeboardThey don't know who they're messing with.
18:35nullptrlein'd
19:09hiredmantechnomancy: your patch was silly, if I recall
19:10hiredmanmemoizing a function is generally supposed to speed it up, function metadata wraps the function in an AFunction metadata holder deal, which slows down invocation
19:14tieTYThi i'm maintaining some old clojure code. I'm not very good at the language anymore. I have some java code calling the clojure code and if it's called in a certain way it gives an error the first time but never again. The error is an IllegalAccessException
19:14BronsaI never realized the AFunction withMeta reify is a RestFn w/o direct invoke instances
19:14irctchi, wondering why does ((symbol ".toString") "hello") returns nil , while (.toString "hello") returns "hello"?
19:14tieTYTit's re: the interval method I've required here: (:require [clj-time.core :refer [interval overlaps?]])
19:15tieTYTi can paste the stack trace
19:15tieTYThttp://pastebin.com/2RrcSqsN
19:17turbofailirctc: ((symbol ".toString") "hello") is calling a symbol object as a function
19:18turbofail,((symbol ".toString") {".toString" :foo})
19:18clojurebotnil
19:18turbofail,((symbol ".toString") {'.toString :foo})
19:18clojurebot:foo
19:19BronsatieTYT: the error is pretty clear, there is no "interval" Var in the clj-time.core namespace
19:19justin_smithtieTYT: are you sure there is a public interval function in the version of clj-time you have required?
19:19turbofailirctc: that does an entirely different thing than the method call syntax. if you want to call a method that you're selecting at run-time, you'll have to use reflection yourself
19:21irctcturbofail: ok, thanks
19:24tieTYTit must be there because the code works fine every time after the first time, right?
19:25tieTYTi mean it only fails the first time, so it must be there, right?
19:26justin_smithtieTYT: that's weird - have you looked at the namespace in the jar being used?
19:26tieTYTlooked at it in what way?
20:07TimMctechnomancy: Feels bad, man.
20:11technomancyhmm?
20:13technomancyoh, yeah not having a reasonable way to put metadata on functions is a drag
20:24TimMcI meant the WONTFIX, actually.
20:24TimMcIt's not so bad if there's a reason given, of course.
20:24technomancyI don't recall anything about performance mentioned
20:41bacon1989Damn, I wish chestnut was a thing before I started my clojurescript project
20:41bacon1989I still don't have a proper cljs repl
21:52ToxicFrogNot again
21:52ToxicFrogIt would be really nice if, when I screw up somewhere, I didn't get something completely useless like this: https://gist.github.com/ToxicFrog/fdff8babd1b0062d4c60
21:53danneubacon1989: yeah, i have yet to evolve from my primitive cljs workflow
22:00amalloywell uh...you have a null pointer exception at line 13 of ifirc/core.clj, inside the main function. does that not help narrow it down?
22:00amalloylooking at https://github.com/ToxicFrog/ifirc/blob/master/src/ifirc/core.clj, i conclude you forgot to pass the three arguments your -main requires
22:01amalloysupposition substantiated by https://gist.github.com/ToxicFrog/fdff8babd1b0062d4c60#file-gistfile1-txt-L1
22:01amalloyso i'd say that stacktrace contains all the information you needed to debug the problem, ToxicFrog
22:19ToxicFrogamalloy: oh wow, I'm so used to the information being in the first stack trace or nowhere that I didn't actually read the second one.
22:19ToxicFrogSorry about that.
22:19amalloyit's usually in the last one
22:19ToxicFrog(the root cause was actually completely different, as it happens; this is the commit that completely rewrites command line handling)
22:19amalloyif you don't know where to look, look at the topmost lines of the last trace
22:20seangroveamalloy: Absolute last, or just the last you look at?
22:21amalloyfurthest down on the page
22:22ToxicFrogThat has not, historically, been my experience.
22:23ToxicFrogSyntax errors in particular always seem to have the file:line in the first line of the first stack trace or not at all anywhere, but this is true of runtime errors as well.
22:25vermasup dnolen_
22:27amalloyoh, that's true, ToxicFrog. compiler errors are different
22:27amalloyruntime errors in your own code behave the way i was saying; compiler errors because your code isn't runnable at all are a little different
22:28amalloyi always forget about that, and look at the lowest one first. i guess i get more runtime errors than compiler errors. three cheers for paredit
23:24mdeboardIs there an idiom when destructuring hashmaps like `[{:keys [foo :as bar, baz :as qux]} some-map]'
23:28scottjmdeboard: give an example some-map and what bar and qux would be?
23:28mdeboardIn this case I'm drawing events from a channel in clojurescript
23:28mdeboardand want to have descriptive variable names
23:29mdeboardin a particular function, but the data is best described in one way in the map, and another way in the function.
23:31scottjmdeboard: why does (let [{bar :foo qux :baz} some-map}] ...) not work?
23:32mdeboardIs that a thing?
23:32mdeboardIf so, it would
23:32mdeboardThanks :P
23:32scottjmdeboard: :keys is the more advanced version
23:32mdeboardthere's such a wide variety of syntax for destructuring binds
23:32mdeboardhard to keep them all straight
23:49ddellacostaanyone know of any decent metrics libraries for Clojure?
23:49amalloymdeboard: {:keys [...]} is shorthand for the more general map destructuring form, which is {x :x, y :y}
23:49amalloythere are also :strs and :syms, which see much less frequent use
23:51ddellacostathis looks promising: https://github.com/sjl/metrics-clojure
23:52eggheadddellacosta: i have used that lib, works as advertised
23:53ddellacostacool, thanks egghead
23:58rntz^2hey, can anyone explain to me why this doesn't work: (eval `('~list 1 2 3))
23:58rntz^2I'd expect it to do the same as (eval `(list 1 2 3))
23:58rntz^2but it raises an error instead