#clojure logs

2014-07-11

00:03trptcolinhttps://groups.google.com/forum/#!topic/clojure/n25aZ5HA7hc/discussion
00:06puredanger_generally things like this are nice to fix but we tend to prioritize "things don't work as they should" over "does not reject bad input" or "asymmetries in the library". I know liras are not moving real fast right now - we've been prioritizing various feature-related efforts instead. I expect at some point to get back to focusing on moving existing tickets and patches forward more diligently.
00:07puredanger_as always, writing great tickets http://dev.clojure.org/display/community/Creating+Tickets and patches http://dev.clojure.org/display/community/Developing+Patches makes everything smoother
00:07trptcolinyep, 100% support :)
00:09hiredmanpuredanger_: so fixing aot compilation is high on the list then, since it destroys homes and eats children and small pets?
00:12puredanger_it is. it's also hard and complicated. are you talking about http://dev.clojure.org/jira/browse/CLJ-322 or something else?
00:14hiredmanpuredanger_: given how many things break given aot, I think the existing issues are sort of whack-a-mole
00:16puredanger_I know of a few specific issues. I need help with collating a more comprehensive set of issues on the design wiki, and assessing their importance and how to address them.
00:20puredanger_here's the list tagged in jira currently: http://dev.clojure.org/jira/secure/IssueNavigator.jspa?reset=true&jqlQuery=project+%3Dclj+and+labels+%3D+aot+and+status+in+%28+open%2C+%22in+progress%22%2C+reopened%29
00:23puredanger_CLJ-1241 is screened and waiting for Rich. CLJ-1330 is on the work list for 1.7 and needs more evaluation. A couple others are in various stages of the pipeline.
00:23puredanger_I have no idea how to prioritize those though or what's NOT in that list
00:34jephreedoes anyone know if its possible to change both variable delimiters "{{" in selmar?
00:35puredanger_hiredman: I made a page with those here http://dev.clojure.org/display/design/AOT+Problem+Overview - please add more info
01:32abaranoskywhat's the new hotness these days?
01:51cespare|homeDoes clojure.walk/macroexpand-all not handle macros that use &env?
01:51cespare|homeand is there an alternative that does?
01:59hiredmancespare|home: it depends a lot on what the macros do with &env
02:00hiredman&env can leak compiler internals, which if a macro uses, it is going to be really hard to provide via some other macro expander
02:00lazybotjava.lang.RuntimeException: Unable to resolve symbol: env in this context
02:07ddellacosta_,(println "test")
02:07clojurebottest\n
02:07ddellacosta,(println "test")
02:07clojureboteval service is offline
02:07ddellacostahiredman: testing ignore list status. can you enable clojurebot for me? thanks
02:08ddellacosta\nick ddellacosta_
02:08ddellacostad'oh
02:08ddellacosta_hiredman: testing ignore list status. can you enable clojurebot for me? thanks
02:10ddellacosta_well, lovely to be dealing with adults here
02:15cespare|homehiredman: my macro is only looking at the keys in &env (checking the type tags)
02:56hhenkelGood morning all...I'm still haveing an issue using jolokia-client-java within clojure. I tried to reproduce the issue from java but there it seems to work.
02:57hhenkelI created an easy to follow clojure "test-case" and also added the java stuff here: https://www.refheap.com/88077
02:57hhenkelAnyone able to tell me what is the difference between the clojure stuff and the java stuff?
02:58hhenkelFor reference this is (in my understanding) the relevant class that is used for the execute part: https://www.refheap.com/88049
04:54mnngfltgIs there something like "partial" that applies the argument to the end (rather than the beginning) of arg list of the target function?
04:56mnngfltgBasically, I want to turn a fn with optional arguments into a predicate (that takes only one argument).
04:57hyPiRionmnngfltg: sounds like you can just use anonymous functions then
04:58hyPiRion,(let [f #(- % 1)] (f 10))
04:58clojurebot9
05:06mnngfltghyPiRion, true; I was just wondering if there's an equivalent of `partial` for that
05:07hyPiRionmnngfltg: not that I know of, unfortunately.
05:30swiHello. I'm new to clojure so excuse me for maybe stupid question. I can't figure out perfectly what the 'real-world-usage' of (delay)? I understand that it define some function but not execute it before we (force) it to get answer, and then it cache answer. But, in that way, this function have only one returned value for whole tim eprogram is running. What the meaning than ?
05:32hyPiRionswi: One immediate example I can give you is how Leiningen works: We do it to delay loading of files from startup until we really need them. If we don't need them, we don't have to load them, and we save time.
05:34swihyPiRion: so it' realy one-time function in program life cycle?
05:37hyPiRionswi: Right, it's an expression which is only performed once, and only the first time you need the value it returns.
05:44mnngfltghyPiRion, thanks, I'll use #(apply ...) then
05:47hyPiRionmnngfltg: yeah, if you want something general, I'd suspect that's the easiest
05:48mnngfltghyPiRion, that seems to work: (defn partial-opt [f & more] (fn [x] (apply f x more)))
05:50hyPiRionmnngfltg: yeah, looks good if you only need to support single argument functions.
05:51mnngfltghyPiRion, yes, I want to generate predicates, for use with (some-fn)
05:53hyPiRionright
05:55mnngfltgbeing net to clojure (or functional programming) I have to say I'm enjoying working with higher order functions immensely :)
06:00hyPiRionYeah, it's a nice change from imperative languages. Really good for your brain with a bit of variation =)
06:08Glenjamini've been trying to write clojure in javascript lately, its much more clunky :(
06:08Glenjaminit's amazing how much of a difference being able to use keywords as functions makes
06:11gfixler,(:indeed {:indeed :truedat})
06:11clojurebot:truedat
06:13swihyPiRion: Thanks :)
06:16hhenkelI'll poll once again....anyone able to explain what goes wrong here: https://www.refheap.com/88077 ?
06:20pyrtsahhenkel: Wild guess, (.execute client [HeapMemoryUsage PeakThreadCount]) should be (.execute client HeapMemoryUsage PeakThreadCount)?
06:21vijaykiranhhenkel: did you see my message yesterday about it not working either in Java Program ?
06:22hhenkelpyrtsa: Constructor is: J4pReadRequest(String pObjectName, String... pAttribute)
06:22hhenkelvijaykiran: Yes, I did also added working code at the refheap stuff.
06:23hhenkelvijaykiran: Did not see you comming back online.
06:23vijaykiranhhenkel: oh - sorry. I didn't see the channel log yet
06:23hhenkelvijaykiran: https://www.refheap.com/88077
06:24hhenkelpyrtsa: Also as shown in the link the requests are working for a single execute.
06:24pyrtsahhenkel: You have `client.execute(req1,req2);` in the Java counterpart. That translates to (.execute client req1 req2), not (.execute client [req1 req2])
06:26hhenkelpyrtsa: I'll give it a try. The source for the execute is here: https://www.refheap.com/88049 L180
06:26hhenkelCalls L196 afterwards
06:27hhenkelpyrtsa: I get a IllegalArgumentException No matching method found: execute for class org.jolokia.client.J4pClient clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)
06:28pyrtsaSo many overloads... which one are you trying to call? Maybe adding the correct type hint might help the Clojure compiler choose the right one.
06:29pyrtsaI don't have many more ideas to help.
06:29hhenkelpyrtsa: The trace shows: at org.jolokia.client.J4pClient.execute(J4pClient.java:182)
06:32vijaykiranhhenkel: strange - I get exception with your Java class too
06:35hhenkelvijaykiran: What kind of exception? You wrote about https status 302...
06:35hhenkelimho this is for a redirection
06:35vijaykiranhhenkel: https://gist.github.com/vijaykiran/f8ff6636d4ec84fd0c60
06:36vijaykiranhhenkel: yes, 302 is for redirect - I was tracing through the code and somewhere there was a 302 when I tried last time
06:36vijaykiranhhenkel: https://gist.github.com/vijaykiran/2397f3a004206031a57f this is what I tried yesterday
06:39hhenkelvijaykiran: That's strange...
06:40hhenkelvijaykiran: I started adding some output to the jolokia-client-java to see if stuff is passed allong correct.
06:40vijaykiranhhenkel: see the comment on the gist for 302
06:41hhenkelvijaykiran: So far I see that the requests reach the L199 in https://www.refheap.com/88049 in the list.
06:42hhenkelvijaykiran: The 302 was in the jetty log?
06:42vijaykiranhhenkel: can you try with http://localhost:8080/Jolokia/ as url ?
06:42vijaykiranhhenkel: damn - that's the problem
06:43hhenkelvijaykiran: Hmm?
06:44vijaykiranhhenkel: one sec
06:46vijaykiranhhenkel: https://gist.github.com/vijaykiran/936752f6ba00f19252bc << fixed
06:50hhenkelvijaykiran: hmm, I'm trying but something is wrong...
06:53vijaykiranhhenkel: well - this https://gist.github.com/vijaykiran/af2e46da2c178831bf26 works for me, as expected
06:58hhenkelvijaykiran: Yes, I got it working as well...I'm currently trying to understand why...?
06:59vijaykiranhhenkel: well - without / there's a redirect to / - which returns 302 and the JSON Parser inside jolokia-client chokes on that
07:00hhenkelvijaykiran: aaarrrgghhhh.
07:01vijaykiranhhenkel: looks like .execute(1-req) and .execute(req1 ...) follow different code paths
07:01vijaykiranhhenkel: anyway - that's an exercise for you ;)
07:01hhenkelvijaykiran: Thank you very much for your time and help!
07:03vijaykiranhhenkel: yw
07:04vijaykiranhhenkel: you should probably ask the jolokia guys for more detailed error message or file a bug, perhaps
07:07hhenkelvijaykiran: Yes, that might be a good idea, hopefully one out of the 10 people ideling in the channel will wake up...
07:13hhenkelvijaykiran: I'm testing that currently against a weblogic server now and I got more strange behaviour...
07:17hhenkelvijaykiran: https://www.refheap.com/88082
07:21vijaykiranhhenkel: so if you don't have first two printlns - it fails ?
07:21hhenkelvijaykiran: correct...
07:22hhenkelvijaykiran: One execute is enough to have it working...
07:22vijaykiranhhenkel: hmm - that's strange indeed.
07:23vijaykiranhhenkel: I don't have weblogic installed for trying out though
07:24hhenkelvijaykiran: One thing that is different is the version of the jolokia on the weblogic
07:24hhenkelMaybe something is broken in the old version on the weblogic.
07:25hhenkelI will try to update that first.
07:25vijaykiranhhenkel: could be
07:29mbacso, sticking, say, 15 million integers into a sequence OOMs my laptop pretty quickly
07:30mbacshould i expect this to be efficient or do i need to make an actual array if i want this to not eat 500MB of RAM?
07:35dhruvasagarHi guys, has anybody used apache spark with clojure ?
07:37vijaykiranmbac: do you really need all of them in memory ?
08:22Glenjaminmbac: how much memory do you have? i've had more than that in memory without issues before
08:23Glenjamingenerally if you have that much data in memory you've chosen to trade memory use for cpu time :)
08:52rritochHi, does leiningen provide a way to deploy to a maven branch? I've been using lein deploy releases and lein deploy snapshots which are configured in the project.clj :repositories but I don't see any place to specify a branch name.
08:57stuartsierrarritoch: I don't think Maven has a notion of "branch" names. Do you mean a "qualifier"?
08:57rritochstuartsierra: I'm referring to the releases:branch plugin
08:58rritochhttp://maven.apache.org/maven-release/maven-release-plugin/examples/branch.html
08:58stuartsierrarritoch: oh, no idea then, sorry
08:58rritochstuartsierra: I've also seen this "qualifier", is that functionally similar to a branch?
08:59stuartsierrarritoch: No, "qualifier" is just an extra identifier that gets tacked on to the Maven groupId / artifactId / version.
08:59rritochI'm working on a project that's using git for source control and maven for binary releases and it would be bad if releases on the branch conflict with releases from the master.
09:01stuartsierrarritoch: You may want to try asking in #leiningen later today when the U.S. West Coast comes online :)
09:01rritochstuartsierra: Thanks, I didn't know they had their own channel
09:01rritochstuartsierra: the line between leiningen and clojure is fairly blurry
09:03stuartsierrarritoch: It's quite clear, really. Clojure is the language, maintained by Rich Hickey and contributors under the contributor agreement. Leiningen is a project management tool, maintained by Phil Hagelberg on GitHub.
09:04TimMc...and contributors. Phil quite encourages that.
09:07rritochstuartsierra: Thanks for the clairification, though I've never tried running any clojure applications on anything other than leiningen.
09:08whodidthisi heard its possibl to create jar out of a clojure application and run it on java runtime environment
09:08TimMcrritoch: All lein does is set up classpaths, really.
09:08mbacGlenjamin,
09:08mbacvijaykiran,
09:09ToxicFrogwhodidthis: yes. You probably want the 'lein uberjar' command?
09:09mbacthe question is, should clojure be able to represent 15 million integers in less than 500M of heap
09:10vijaykiranmbac: http://www.javamex.com/tutorials/memory/object_memory_usage.shtml should answer your question
09:10mbacof course i can tweak the dynamic with time-space tradeoffs, but i'm surprised that i seem to OOM when i try to force a 15 million int sequence
09:10mbacso i wonder if i'm doing something horrible, like using a non-tail recursive algorithm
09:11Glenjaminlazy sequences are relatively expensive memory-wise
09:11Glenjaminas theres a lot of intermediate computations that are wrapped in an object
09:12Glenjaminyou can use reducers to optimise object allocation, which reduces memory footprint and increases throughput
09:13TimMcrritoch: If you wanted, you could bundle your .clj files up into a zip file (renamed with a .jar extension, perhaps) and run java -cp your-stuff.jar:clojure.jar:etc clojure.main -e '(require 'your.ns) (your.ns/-main)' or something like that.
09:13TimMcBut why would you? :-)
09:14mbacyeah, i might just stuff them all into an array and resign myself to unsexy imperative loops
09:14mbac:'(
09:15TimMcrritoch: Actual example I just tried, using `lein cp` to build the classpath for me: java -cp `lein cp` clojure.main -e "(require 'adhoc.core) (adhoc.core/-main)"
09:17TimMc(And I'm wrong about needing to jar up the files; they can just live in an unpacked source directory.)
09:20Glenjaminmbac: have a look at core.reducers, you may find this is sufficient
09:20rritochTimMc: So leiningen also handles all dependency loading? I'm looking at the output of lein CP and most of them are pointing to my ~/.m2 folder
09:20mbachmm
09:20mbacwill do
09:28stuartsierraTimMc: `java … clojure.main -m adhoc.core` will also work.
09:29mbacGlenjamin, it's not clear to me from the description that reducers should be more space efficient
09:37Glenjaminmbac: if you are using lazy sequences, they will be
09:37Glenjaminthe storage-at-rest is unchanged though
09:47mbacif i do [lein repl] and then (def x (doall (take 12345678 (range)))) my heap hits 1G and i get java.lang.OutOfMemoryError: GC overhead limit exceeded
09:48mbacso, you contend something like doall with reducers would make that not happen?
09:50stuartsierra`doall` forces the entire sequence to be realized in memory.
09:50mbacagree
09:50mbaci don't understand why 12345678 numbers should consume 1G of memory
09:50Glenjaminif you do (into [] (take 12345678 (range)) what do you get?
09:52stuartsierrambac: A couple of reasons. A realized sequence will be stored in something like a linked list. And because generic containers in Java can't hold primitive numbers, each number has to be boxed in a Java Object.
09:53mbacno doubt
09:54mbacbut if you could represent each number in 8 bytes, that implies 10x overhead per number to stick it into a sequence
09:55stuartsierraA Java Object is around 17 bytes of overhead, at least. Integers in Clojure are Longs, so that's 8 bytes per number. That's over 300 MB right there. Add in the sequence overhead, heap fragmentation, and the extra space Java needs in the heap for GC regions, you could get to 1 GB pretty easily.
09:55mbacyikes. welp, that explains it.
09:56mbacso i guess i do want to stuff these into an array
09:57Glenjaminif you can avoid realising the whole sequence at once you'd be ok too
09:57Glenjaminwhat is it you're building?
09:58stuartsierrambac: Yes. You could also check out primitive vectors (`vector-of`).
09:58mbaci'm comparing mp3s
09:59mbacand the compare involves several passes. i could conceivably re-arrange things to make it one pass but, if that's not as sexy
10:00mbacand if it won't be sexy i may as well just stuff them into an array
10:00stuartsierrambac: You may be interested in https://github.com/candera/dynne as a source of examples for handling audio data in Clojure.
10:01mbacsweet, thank you!
10:02mbacstuartsierra, btw, glad to run into you again! we met once at your lisp-nyc presentation in 2009 on implementing altlaw.org :)
10:02stuartsierrambac: Oh wow, that takes me back. :)
10:05mbaci had the (somewhat trolly) question about when will clojure get monads because monads are like the haskell programmer's version of blub paradox vs lisp
10:05mbac;)
10:08hhenkelvijaykiran: I updated the jolokia version on weblogic but I'm still failing. :(
10:13hhenkelvijaykiran: I sniffed with wireshark and I see that if I request a single value that there is a jsessionid in the post (multiple requests).
10:14vijaykiranhhenkel: are the versions in sync ? May be debugging and stepping through will help (?)
10:14hhenkelIf I only do a post I see the request to authenticate, then I see the reply only containing auth data but no request data.
10:15TimMcstuartsierra: Yeah, but I think lein actually uses -e since the main ns may not be AOT'd.
10:15hhenkelYes, the versions are both 1.2.2
10:15TimMcJust demo'ing that it's totally doable by hand.
10:15vijaykiranhhenkel: difficult to guess what's wrong without installing Weblogic for me .. I think :(
10:16hhenkelvijaykiran: Yes, I guess so.
10:16stuartsierraTimMc: `clojure.main -m` doesn't require the main ns to be AOT-compiled either.
10:16hhenkelvijaykiran: I could try and deploy without the need to authenticate I guess.
10:17TimMcstuartsierra: Oh! Point.
10:17vijaykiranhhenkel: hmm yeah - that's a good point
10:17stuartsierraI forget when that was added, maybe 1.3 or 1.4.
10:19TimMcrritoch: Yes, lein also pulls down the dependencies that you specify in your project.clj (which is a lein-specific file).
10:20TimMcI think you could write a fairly small Makefile to capture the core leiningen functionality (although that would be a bad idea.)
10:24hhenkelvijaykiran: Okay, looks like there is an issue with the authentication.
10:25hhenkelvijaykiran: Or to be more precise there seems to be an issue with auth and post requests.
10:26vijaykiranhhenkel: ok - perhaps time to poke jolokia channel - looks like this is slightly OT for this channel :)
10:29hhenkelvijaykiran: I guess I found the problem...
10:31hhenkelvijaykiran: For the auth stuff to work I need to add the org.jolokia.client.BasicAuthenticator to the ClientBuilder.
10:32hhenkelvijaykiran: It looks like everything is fine now.
10:32vijaykiranhhenkel: cool :) but what exactly are you trying to build ?
10:32vijaykiranhhenkel: analytics ? monitoring
10:36hhenkelvijaykiran: JVM Montitoring - more or less
10:36hhenkelvijaykiran: We got around 80 JVMs running weblogic + around 140 - 180 other jvms
10:37hhenkelvijaykiran: I want to have some base line data of different values and jolokia got the ability to run within every jvm.
10:38hhenkelI allready got a script fetching data from jolokia, but not with the official java client jar ( the one that drove me nuts).
10:39hhenkelCurrent PoC is to fetch data from jolokia, transform it and send it to riemann.
10:39hhenkelFrom there it is send to graphite at the moment with grafana as a frontend.
10:40hhenkelI also got a implementation of a zabbix connector to send data there.
10:40hhenkelvijaykiran: that's the main idea.
10:41vijaykiranhhenkel: sounds like fun - jolokia seems to have "REST" like api - why not just use the normal httpclient with JSON payloads ?
10:42hhenkelvijaykiran: Yes, it is quite easy to get data out of it. Idea to switch to the jolokia client was, that they add features from time to time.
10:43hhenkelAnd instead of reinventing the wheel over and over it might be easier just to use their jar.
10:44hhenkelFor example with java 1.7.06 or something oracle added the possibility to subscribe to gc events
10:44vijaykiranhhenkel: ah - that makes sense
10:44hhenkelOne of the big planned features of jolokia 2.0 is to provide subscription via websockets
10:45vijaykiranhhenkel: hmm - nice, then you can build a direct UI on top of it then
10:45hhenkelSo it would be much easier to get notified of events instead of pulling.
10:46hhenkelvijaykiran: Yes, some people use it with javascript: http://www.nurkiewicz.com/2011/03/jolokia-highcharts-jmx-for-human-beings.html
10:46hhenkelBut I want to have historical data so that I'm able to see what the values looked alike in the paste
10:46hhenkels/paste/past
10:47jjwattdoes anyone have a good core.async example for writing to a file from a channel? I have it working with blocking takes in a loop, but that's probably just one little record off my channel at a time. I'd kind of like to build up a buffer and blast everything from that buffer to a file every so often.
10:47hhenkelThat's the reason why I want to go with riemann (different backends / alarming / etc) and something like grahpite + grafana
10:48vijaykiranhhenkel: okay - I'm working on a system which emits events as well - but we are using ELK (ElasticSearch/Logstash/Kibana) for visualizing the events
10:49hhenkelvijaykiran: What kind of events? Only log data or jmx values as well? I would love to play around with it but we allready got splunk in place...
10:51hhenkelvijaykiran: Ah, you also joined #jolokia... :) There is not much happening there...from time to time rhuss joins he is the main dev behind it.
10:52vijaykiranhhenkel: the events are logged by different components - we log them as JSON and push to logstash
10:52vijaykiranhhenkel: or logstash "tails" them rather
10:53vijaykiranhhenkel: it is more of a BI dashboard for users
10:56hhenkelvijaykiran: That also sound interessting. Mine is more for devs + ops people - maybe somtime in the future we got some monitor showing stuff
10:57hhenkelvijaykiran: I gotta leave...friday evening...I should not stay to long in the office. :)
10:57hhenkelvijaykiran: Thanks again for your help.
10:57vijaykiranhhenkel: :) ok - have fun
11:26mnngfltgI seem to remember reading somewhere that I should only "memoize" pure functions. But now I'm wondering if that makes any sense at all.
11:27justin_smithmnngfltg: if what makes any sense?
11:27dnolen_mnngfltg: that is correct
11:27justin_smithmnngfltg: what happens if you memoize a call to println?
11:28mnngfltgjustin_smith, yes of course, the second call won't print anything
11:28mnngfltgjustin_smith, but how about caching database queries?
11:28justin_smiththat's because println is impure
11:28justin_smithis your db immutible?
11:28justin_smithif not, it is impure
11:28mnngfltgno, it's nut immutable
11:29mnngfltgnot :)
11:29justin_smithselect from users limit 1 order by last_visited
11:29mnngfltgbut I still might want to cache DB queries for some time, might I not?
11:29justin_smithclearly I would not want to cache that
11:29Glenjaminif your DB connection can fail, it is impure :)
11:29justin_smiththere is that too
11:30mnngfltgGlenjamin, ah... good point
11:30Glenjamini would say you can't safely memoize an impure function
11:30Glenjaminbut you can cache it sensibly, which amounts to about the same thing
11:30justin_smithmnngfltg: you can't just cache results - you would need some logic that decides which results are cachible, and likely some logic to clear caches under specific conditions. I work on a project where we do things like that, but it is error prone and not just a question of using memoize.
11:30dnolen_mnngfltg: the main takeaway you don't want to use standard lib `memoize` for that - you need caching far more fine grained
11:31mnngfltgokay, so I'll have to write my own caching function (say, by storing it in an atom)
11:31dnolen_`memoize` is for pure functions - nothing else to know
11:31mnngfltghow about core.cache then?
11:32Glenjamincore.cache is probably reasonable
11:33mnngfltgok
11:33mnngfltgmemoization is only useful for caching expensive computations then, not for expensive I/O
11:34justin_smithmnngfltg: core.cached has other cachine variants
11:34mnngfltgjustin_smith, you're right of course, but often very simple caching behavior is enough
11:36mnngfltgjustin_smith, I'll look into it, thanks (and thanks to everyone else)
11:37arrdemjustin_smith: you did see the core.cache race condition thread on clj-dev, right?
11:38justin_smithoh, no I didn't
11:39arrdemjustin_smith: nevermind me I'm just a stormcrow. that was a core.memoize issue not a core.cache issue
11:40justin_smithhttps://github.com/clojure/core.cache link btw
11:42mnngfltgarrdem, looks like it was fixed: http://dev.clojure.org/jira/browse/CMEMOIZE-5
11:43arrdemmnngfltg: http://dev.clojure.org/jira/browse/CMEMOIZE-15 is the active one it seems
12:26daniel__[
12:26daniel__sry
12:26trptcolin]
12:26daniel__:)
12:27trptcolinwhew that was close
12:28pedrosantosquit
12:42daniel__whats the idiomatic way to check if a string is in another string (case insensitive)?
12:42daniel__filter re-matches?
12:43arrdem(fn [x y] (= (clojure.string/lower x) (clojure.string/lower y))) ?
12:44daniel__arrdem: not =, if its a substring
12:47arrdemdaniel__: I'd do a string lower on both and then use re-matches. no need to filter.
12:48arrdemdaniel__: remember to use re-pattern to get a regex from a string.
12:48daniel__i have a vector and want to filter it for maps with a certain matching property
12:49daniel__anyway, thanks arrdem, think i got it
13:00bryanmaassI dropped off after that funcgo page was posted last night.
13:01bryanmaasshttps://github.com/eobrain/funcgo#using-vectors
13:01bryanmaass“Getting cleaner syntax using infix notation” with +, maybe I get it.. but with into? really?
13:03bbloombryanmaass: especially because "into" reads backwards
13:04jfcaronIs there a general consensus on the best Clojure book for someone new to lispy and functional languages, but not new to programming in other languages like C++ and Python?
13:04jfcaronI'm interested in learning clojure for hobby video game making.
13:06Shayanjmjfcaron: I'm learning as well, and Clojure for the brave & true was a nice introductory book
13:08jfcaronOh, and it assumes emacs too. I guess that should be expected for a lispy language?
13:08jfcaronThanks Shayanjm, I'll look into it.
13:08Shayanjmjfcaron: clojure for the brave & true doesn't assume it
13:08Shayanjmand I actually don't use emacs. I use st3
13:08aperiodicjfcaron: take a look at the foreword of Joy of Clojure and see if it appeals to you: http://joyofclojure.com/foreword/index.html
13:09aperiodicI really enjoyed the book, but I also picked it up after a few months of playing with clojure
13:12bryanmaassShayanjm: how is your experience with clojure in st3? I used st3 when picking up clojure before packing up shop and learning emacs.
13:12Shayanjmfine-ish
13:12ShayanjmThe tools haven't really matured to the level necessary for long term work I imagine
13:12Shayanjmthings like SublimeREPL are fine for small testing, but if you need features like nREPL that works with the latest lein you're out of luck
13:13Shayanjmbut the added benefit: I don't have to deal with reconfiguring another editor/relearning hotkeys
13:13bryanmaassYeah, emacs is a beast imho
13:13Shayanjmyeah I imagine if I started out using emacs for everything
13:13Shayanjmlife would've been much simpler
13:13bryanmaasslearning it was its own paralell struggle.
13:13bryanmaassagree, Shayanjm
13:13Shayanjmbut tbh, I'm fine with SublimeREPL for now
13:14Shayanjmif i need nREPL to connect to a running instance, I just pull up a terminal window next to my code
13:14Shayanjmofc I lose the ability to hotkey my code into the window
13:14Shayanjmbut what're you going to do
13:14Frozenlocknrepl in the terminal :-/
13:14ShayanjmYeah I know Frozenlock :\
13:14FrozenlockEmacs is absolutely worth it.
13:14bryanmaassI’d agree Frozenlock
13:14ShayanjmI can see that
13:14Shayanjmbut I don't think i'm ready to part with ST3 yet
13:15bryanmaassSad that there’s not a super awesome guide to picking it up, that i’m aware of.
13:15FrozenlockProgramming languages come and go, but Emacs remains.
13:15ShayanjmI'll probably end up learning emacs down the road
13:15Shayanjmbut as of right now: I don't have a big enough push to really dive in
13:15arrdemFrozenlock speaks the truth
13:15Shayanjmalso good news lol - I think I have access to a super computer so I can keep developing this thing lol
13:15arrdemShayanjm: which one? (TACC user)
13:16Shayanjmarrdem: TACC. I'm a UT student so apparently I need to get a faculty member to sponsor me
13:16duck1123Now that it's so easy to include packages, Emacs is so much easier than when I first started learning it
13:16ShayanjmTrying to get access to stampede
13:16arrdemShayanjm: YISSSSSS
13:16bryanmaassduck1123: what do you mean?
13:16duck1123I first started learning emacs before elpa was a thing
13:17arrdemShayanjm: what are you working on?
13:17bryanmaassduck1123 wow, I see.
13:17ShayanjmNLP stuff with articles, arrdem
13:17Shayanjmbasically a really intelligent news reader
13:17Shayanjmextracts topics/keywords from article contents, sentiment analysis, etc.
13:18Shayanjmthen builds categories around live-news which are (or will be?) subscribable
13:18bryanmaassShayanjm: do you work at prismatic? :P
13:18arrdemShayanjm: cool! lemme know what your experience running Clojure on Stampeed's like. I'm on the UT-SCC team so most of what I get to run on Stampeed or our cluster is fortran stuff not my own code.
13:18Shayanjmbryanmaass: haha no but interestingly enough I had a meeting with someone two days ago who knows the founder
13:19arrdemShayanjm: I've been threatening to build some really resource intensive Clojure program just so I can say I threw Stampeed at Clojure for a while tho :D
13:19Shayanjmhahahaha arrdem: "Chris" @ TACC just got back with me saying I need to find a professor whose research will benefit from the work I'm doing
13:20Shayanjmand definitely will let you know arrdem. I'm still trying to figure out approximately what resource I'm going to need
13:20arrdemShayanjm: odds are you can just abuse condor for what you're working on. TACC is really tight fisted with Stampeed access and billing.
13:20arrdemShayanjm: I assume you have a UTCS account.
13:20Shayanjmarrdem: what's the difference between condor & stampeed
13:20ShayanjmI do, but I'm a EE student
13:20Shayanjmtook a CS class for shits
13:20arrdemShayanjm: heathen.
13:21Shayanjmheh heh heh
13:21Shayanjmsecret agent
13:21arrdemShayanjm: Condor runs on the CS lab boxes. Stampeed has its own cluster of such amaze wow very seekret up to date l8est from intel hardware
13:21ShayanjmYeah so as of this moment: I'm like maxing my MBP
13:22Shayanjmand I haven't even scaled functionality to user-level yet
13:22Shayanjmso I'm going to have to figure out some new development cycle for building this thing locally and live-testing it elsewhere
13:22Shayanjmwhich I suppose would be my big push to get a better nREPL workflow going...
13:23arrdemeh... have you hit a wall where your dev box can't handle the app anymore?
13:23Shayanjmyep
13:23arrdemor do you just have a friggin enormous dataset.
13:23ShayanjmActually I'm running against a neural net
13:23Shayanjmso the data set is just realtime streamed data, nothing persisted
13:23Shayanjmit just takes up a shitton of RAM though
13:23arrdemdo you have a sense for the extent to which you're RAM bound rather than CPU bound?
13:24ShayanjmI'm hitting >4GB currently. I could probably optimize down to the 3-4 range for this current set of features
13:24Shayanjmbut once I start scaling to user-level
13:24ShayanjmI'm probably just going to need to get more boxes
13:24Shayanjmthe problem isn't so much 'getting' the data, it's allocating enough resources to process so much of it in parallel
13:24arrdemyeah. and due to UT AUPs you could probably get away with doing dev on Condor, but you totally can't do that for production.,
13:25ShayanjmI could throw everything in series and have it take up much less mem, but then it'll also take FOREVER to do anything half-useful
13:25ShayanjmYeah exactly
13:25Shayanjmso for production, I was thinking of an interesting solution
13:25Shayanjmthe neural net is really what powers this - so I'd need to persist it to some central location that's visible to all nodes
13:25ShayanjmI could then have a set of scrape nodes, and a set of process nodes, each handling requests in a round-robin fashion
13:26Shayanjmthe problem is going to managing these actions though
13:26arrdem:D
13:26Shayanjmand I really really hope clojure has some nice libraries that I can use specifically for that sort of scale.
13:27arrdemmy experience has been that Clojure doesn't actually have amazing tooling for cluster operations sadly. it's not hard, but I didn't find a good go-to solution last time I looked.
13:27ShayanjmI found this: https://github.com/amitrathore/swarmiji
13:27Shayanjmbut not really sure about its state since the last commit was in 2011.
13:28arrdemoh damn that was written against Clojure 1.1.0
13:28arrdemyeah... don't use that.
13:28Shayanjmyeahhhh
13:28ShayanjmI could just do a really dumb scale
13:28Shayanjmabstract it to the network layer
13:28Shayanjmthrow a bunch of nodes up behind a loadbalancer
13:29Shayanjmpersist state with a central DB/node or something
13:29Shayanjmbut then that's no fun
13:29arrdem"fun" :D
13:29arrdemShayanjm: this a student start up or are you just honking around?
13:29Shayanjmjust learning Clojure + ML at the same time lol
13:30arrdemlol nice
13:30Shayanjmbut I guess it could technically become a 'thing'
13:30ShayanjmI sold my first startup when I was a freshman so I'm not really looking to dive into anything just yet haha
13:31Shayanjmlolol it wasn't a big company or anything, just a little side thing I had since I was like a sophomore in HS
13:31ShayanjmNow I just consult
13:31Shayanjmwhich is fun, because the people who hire me tend to have really really interesting problems
13:32arrdemyou in town for the summer man?
13:32jollygoodis there a function that returns true if one string is a contained within another?
13:32ShayanjmYup, until mid august
13:33arrdemsweet. I gotta drag you out for coffee sometine.
13:33Shayanjmfor sure. You live near campus?
13:34arrdemI'm at my folks in westlake for the summer but it's easy for me to get in to campus.
13:34Shayanjmah gotcha
13:34ShayanjmCool, I'll pm you my number. Text me whenever you want to grab a coffee :P
13:34arrdemballin
13:39jollygoodhow to find if s1 is contained (is a substring of) in s2? (something "foo" "..foobar..") => true
13:40MarcInNYC@jollygood Use re-find or String#contains
13:41MarcInNYC(.contains "...foorbar..." "foo")
13:41MarcInNYC(re-find #"foo" "...foobar...")
13:47jollygood,(.contains "...foorbar..." "foo")
13:47clojurebottrue
13:47jollygoodcool thanks
14:39xy86is there a recommended form validation library?
14:40Farevalidate what?
14:40xy86html/http forms
14:41arrdemxy86: what property of form data was Fare's question.
14:42xy86arrdem: sorry i dont understand the question
14:43arrdemhttp://yogthos.github.io/lib-noir/noir.validation.html
14:43amalloyxy86: arrdem is telling you that Fare is asking you what about your data you'd like to validate
14:43amalloyi figured involving a fourth person would make this practically a sitcom
14:43arrdem(inc amalloy)
14:43lazybot⇒ 149
14:44amalloy(i would have left out the explanation and let a *fifth* person accuse me of sitcommery, but i love that juicy karma)
14:44arrdemwill inc for lulz
14:46xy86ha. im feeling kind of stupid right now. regardless, im not looking to validate any one specific thing, it is just that in python there are general purpose form validation libraries that let you specify 'this field is a number', this is a zipcode, etc
14:46xy86im not sure that gives any more relevant information...
14:47xy86i saw multiple libraries if i google, it is just they are not the same ones used 3 years ago and id rather pick one that is maintained and preferrably widely used
14:51xy86can anyone vouch for formative in particular?
14:53zamaterianprismatic's schema
14:55xy86zamaterian: i like what i see, good suggestion
14:56aaelonyLearning more about defrecords. ...but stuck on the seemingly simple issue of how to flatten the vector I am trying to pass to the defrecord. https://www.refheap.com/88095
15:01gfredericksaaelony: apply
15:02amalloyi'm sure he'd figure it out if he only applied himself more
15:02clojurebotI don't understand.
15:02teslanick,(defrecord Foo [a b c d])
15:02clojurebotsandbox.Foo
15:02aaelonyI always forget apply.
15:02teslanick,(apply ->Foo [ 1 2 3 4 ])
15:02clojurebot#sandbox.Foo{:a 1, :b 2, :c 3, :d 4}
15:02amalloy~clojurebot |would| figure it out if he only applied himself more
15:02clojurebotAck. Ack.
15:02aaelonygfredericks: thank you
15:03teslanickArrow-constructor syntax is weird to me.
15:03aaelonyme too
15:03teslanickmap-> constructor syntax makes more sense because it's saying what it intends: map to record-of-this-name.
15:03gfredericksteslanick: it's just a function name, not special syntax
15:04teslanickSuppose that's true. It seems weird to me that using defrecord declares a magically-named function.
15:04teslanickAnd that there are multiple entry points for creating records.
15:04gfredericksteslanick: in any case, what would you say ->Foo is creating a Foo from?
15:04gfredericksfields->Foo?
15:06teslanickDunno. Seems like (new Foo 1 2 3 4) is ok, or (apply Foo [1 2 3 4]). I'm sure that's the JS programmer in me talking, and that there are other considerations that make that behavior untenable.
15:07teslanickBut whatever, I'm just commenting that defrecord makes multiple symbols, and I consider that surprising behavior
15:09gfredericksteslanick: well that first one works
15:09gfredericksbut it's not a var, and vars are useful for some things
15:09gfredericksthe latter couldn't work because Foo is a class
15:40bacon1989So I was wondering, is there an easy way to eval something only within the context of a given namespace, and return to a former namespace?
15:40stuartsierrabacon1989: not really
15:41stuartsierraWhat is it you want to do?
15:41bacon1989hmm, I want to have some sort of repl
15:41bryanmaassDoes anyone have an argument for using large-ish lets?
15:42bacon1989but where i'm calling load-string doesn't have access to certain (require... 'd stuff I want loaded at runtime
15:42stuartsierrabacon1989: You can set the "current" namespace with `in-ns`, but it doesn't always do what you think.
15:43mikerodstuartsierra: I've been using clojure.tools.namespace.parse
15:43bacon1989well, I juse want a separate namespace when I perform the evaluation
15:43mikerodHowever, we recently stumbled on a use-case
15:43mikerodwhere we want the ns transitive deps
15:43mikerodto be in order
15:44bacon1989but I want to require some nifty things that would be useful from the commandline
15:44mikerodas they would be loaded - so like top-to-bottom as they are declared
15:44bacon1989i'm wondering if maytbe I should jsut write a separate file containing the repl, call the function, and check to see if the certain things I want are required beforehand
15:45mikerodI've noticed that clojure.tools.namespace.parse may *almost* maintain this order with `deps-from-ns-decl`, but it puts it in a set in the end so we lose it.
15:47stuartsierramikerod: Given all the bizarre forms of `ns` in the wild, I don't think I could ever guarantee to preserve order, but you could define your own `deps-from-ns-decl` that doesn't call `set`.
15:48stuartsierraThe actual load-order is undefined anyawy.
15:49mikerodstuartsierra: I thought about that. I noticed `deps-from-ns-form` is private. I wasn't sure that any sort of order was guaranteed. So I didn't know where to go from there.
15:50mikerodWe want the lexical ordering top-to-bottom as namespace deps are declared. We are trying to use that order for some sort of initialization we are doing.
15:50stuartsierraThe private def means I'm not making any promises to keep that function there. But you can still call a private function with @#'foo or fork it to customize the behavior to suit your needs.
15:52mikerodwhat didd you mean "load-order" is undefined?
15:53stuartsierramikerod: I mean there's nothing in Clojure that promises that files will be loaded in any particular order. That's just an implementation detail. For example, if a namespace already exists, `require` will not reload it unless you specify `:reload`.
15:55mikerodstuartsierra: ah yes, I know about the ns not reloading files. What we are really trying to get is transitive ns deps vars in their order they are declared
15:55mikerodso, top-to-bottom ns deps, top-to-bottom var defs
15:56mikerodSo in the end we get all vars as they are "def"ed in order as you walk the ns depenendency chain
15:56mikeroddependency*
15:56stuartsierratools.namespace only parses `ns` forms, not var definitions. You may want something like tools.analyzer.
15:58mikerodYeah, we were going to manually order the vars
15:58mikerodonce we had the the ns's in order
15:59mikerodperhaps tools.analyzer has something
15:59mikerodI appreciate the feedback on this.
16:07stuartsierramikerod: In that case, my feedback is not to base any assumptions on the order in which files are loaded. :)
16:14Bronsastuartsierra: that's unrealistic when you have i.e. a defmulti on a namespace and a defmethod for that same multimethod on another namespace
16:14Bronsayou *need* to load the namesace with the defmulti before the other one
16:17andyf_arrdem: Ping
16:17arrdemandyf_: pong
16:17mi6x3mhey clojure, any way to check if a NS exists other than find-ns?
16:18andyf_arrdem: Thanks for the cheatsheet generator updates. Tweaking them more now so that new vars added since Clojure 1.3 also point to Grimoire pages
16:18andyf_arrdem: Should I just leave special forms pointing at Clojure official docs for now, I guess?
16:19mikerodstuartsierra: hah, I guess that sounds good. However, we were trying to do some delayed-initialization stuff to var values. We wanted to do this in the "natural" order that var dependencies work in at compile time.
16:19mikerodWhich is top-to-bottom in their ns, and top-to-bottom in ns decls.
16:19arrdemandyf_: my pleasure. yeah I'd leave special forms and reader stuff pointing to the official docs. still not sure how I want to get that stuff into grimoire, but there are blank pages waiting for ink.
16:20arrdemandyf_: thanks for the search version btw. you partially solved #18 for free :D
16:21andyf_arrdem: Have you considered adding contrib libs to Grimoire? If ClojureDocs.org really does update soon, they might update that, too, so not necessarily high priority
16:21stuartsierramikerod: Sounds like a compiler to me. :) You might be interested in https://github.com/clojure/clojure/tree/fastload
16:22arrdemandyf_: clojure.tools.* and friends? I hadn't thought about it and I think I'd need to redesign some stuff to be more inline with what crossclj does in order to support that.
16:22arrdemandyf_: with all due respect to the contrib maintainers, contrib docs are worse on average than core's docs so I probably wouldn't bother.
16:22mikerodstuartsierra: we are doing DSL stuff. It is compiler-like here.
16:23andyf_Also thanks for search is due to Francois du Toit, who implemented it
16:24arrdemandyf_: if you think that'd be valuable I'm open to it, I just think it's a ton more work to replicate something that the "official" clojure autodocs already do.
16:24arrdemnot that those have a ton of google-foo
16:25andyf_The main potential advantage over official docs are user contributed examples. Gotten many of those yet, other than initial copy from ClojureDocs.org?
16:25arrdemnot a one sir go fish
16:26arrdemand the clojuredocs.org import was kinda janky.. I think I'll wind up reworking the way I did that as part of 0.2.0.
16:26arrdemsince apparently there's interest in an examples API and right now examples are monolithic.
16:27mikerodWhat is this fastload? looks like clj's github to me. Maybe this was a joke? hah
16:27arrdemalso right now examples have the bloody user=> prompt and aren't valid Clojure source so I can't use TANAL to create links to used vars.
16:27andyf_You should suggest 'git clone' and file io as an API :-)
16:27arrdemlol I may yet do this. api.grimoire.arrdem.com doesn't exactly roll off the tongue :P
16:28lodinI'm trying to use tools.analyzer(.jvm) to analyze clojure expressions. I want to maintain separate environments, but when using (with-env ...) I haven't found a way to "resume" analysis when I have a new chunk of code. Does anyone have any clue?
16:28stuartsierramikerod: `fastload` is an experimental branch of Clojure designed to improve startup time, mostly by deferring compilation of Vars, I think.
16:28mikerodOh, I just realized this is a branch... interesting
16:30PigDudei know the other clojure cool kids are laughing when i refer to a protocol method implementation as Foo#bar ... how do you write this out?
16:31PigDude(bar Foo)? )
16:31PigDude:)
16:31puredangermikerod: yes, it also caches classes. I find it's generally ~10% faster for startup type things
16:32amalloyPigDude: the clojure notation for class methods is Foo/bar, but it's not really used much for protocol functions
16:32puredangerbeing evaluated (along with the direct branch, which goes further) for future Clojure
16:32amalloyi think it would be understood, though
16:32PigDudearent' the two very differen though?
16:32stuartsierraamalloy: I'd read Foo/bar as a static method.
16:33PigDudemy misgiving about Foo#bar notation is that Foo#bar, Foo/bar etc puts the Foo first
16:33mikerodpuredanger: Oh nice. This is definitely interesting. I'm going to look through some of the diff here.
16:33PigDudenote i'm talking about implementations, so Foo is a record/type name, not a protocol name
16:33hiredmanprotocols don't have methods
16:34hiredmanthey are collection of functions
16:34stuartsierraYeah. I think the protocol isn't really part of the name.
16:34puredangerPigDude: protocol functions are functions in the namespace, just like other functions
16:34bacon1989,(ns foo)(defn test [] "test")(ns bar)(use 'clojure.repl)(dir foo)
16:34clojurebotnil
16:34bacon1989huh
16:35bacon1989is there a way to reference the namespace of something declared as ':as' etc
16:35PigDudepuredanger: sure, but namespaces have no place in this discussion afaik
16:36PigDudehiredman: i know that
16:36PigDudehiredman: but nobody read my first message?
16:36PigDudehiredman: i asked: how do you refer to protocol method implemtnation? Foo#bar (ruby-style) is ugly to me
16:36PigDude*method implementation*, not specification in protocol definition
16:37hiredmanPigDude: how do you refer to different multimethod implementations?
16:37stuartsierraOh, I see, 'Foo' is the record in this case
16:40PigDudeyea :)
16:40stuartsierraI just point and say "that thing"
16:40PigDudehiredman: don't know! right now i'd probably refer to the namespace where it is implemted
16:41PigDudehiredman: but that depends on how it's being used. i was just curious if any shorthand around this stuff had crystalized
16:46lodinhiredman: (get-method meth dispatch-val) gives you the method for a dispatch value, but it doesn't work for protocol methods it seems.
16:47sdegutisHello.
16:47sdegutisIs Clojure 6.0 the current version?
16:47abpsdegutis: yup
16:47justin_smithyou mean 1.6.0?
16:48sdegutisabp: thanks
16:48sdegutisjustin_smith: I thought the 1. was implied.
16:48abpHi, i'm writing a webapp with om and want to show a selection of "strategies"
16:48abpavailable in the clojurescript client. The strategies are clojurescript
16:48abpfunctions with metadata.
16:48abpSo I thought about analyzing modified cljs-files for new functions with metadata and push those fn infos to the browser, to render a list.
16:48abpThen I could use sourcemaps to get from function ns+names to js functions. Are there better approaches? It should be editor but not necessarily browser-repl/auto-push-library independent.
16:48sdegutisHmm I should look into Om.
16:49abpyup
16:49justin_smithsdegutis: I had a bad mixup recently, where I was supposed to be using a version 2.0 and was using 1.2.0
16:49sdegutisSorry I can't be more help than wondering something aloud.
16:49sdegutisjustin_smith: Ouch.
16:50sdegutisThis feels like it should be Clojure's theme song: https://www.youtube.com/watch?v=GihSA4V2UYw
16:50abpsdegutis: What the hell happened in #clojure-social? Also, pleeease recreate.
16:50sdegutisabp: #clojure-offtopic
16:50sdegutisand I can't go there I'm banned.
16:50abpaww
16:50abplol
16:50abpwhy?
16:50clojurebotbecause that's not how macros work
16:50lodinabp: How do you plan to analyze the cljs files?
16:50abp:D
16:50sdegutisabp: Because I asked to be banned.
16:50abpsdegutis: you're a macro, bot said so
16:51sdegutisbots never lie
16:51sdegutisit's one of their rules
16:51abpYea basically they can't.
16:52sdegutis"Rest assured that all lethal military androids have been taught to read and provided with one copy of the Laws of Robotics. To share."
16:54sdegutis"If you feel that a lethal military android has not respected your rights as detailed in the Laws of Robotics, please note it on your self-reporting form."
16:54sdegutisI believe that qualifies as on-topic because someone mentioned robots.
16:56dbellI've run into this a few times lately, and it's been eating at me---what's the idiomatic way to treat a map sequentially? I've had a few cases where I want both the key-value random access of a map, but the sequentialness of a vector
16:57hiredmanwhat you want is a database with multiple indices, so build a composite structure of two maps indexing different things
16:57sdegutisdbell: maps have no order; you can turn it into a vector of 2-element vectors and sort it if you want
16:57abpsdegutis: Actually 'bots, but "Laws of 'botics" takes some of your quotes sound.
16:58sdegutisdbell: sort-by should do that just fine iirc
16:58sdegutisabp: syntax error: near line 1: "'bots, but"
16:58abpdbell: reduce?
16:59sdegutisdbell: &(sort-by first {:a 1 :b 2 :c 3})
16:59sdegutisdbell: &&(sort-by first {:a 1 :b 2 :c 3})
16:59lodindbell: Can you elaborate? maps are seqable.
16:59abpsdegutis: errnr: 56724 , not allowed in symbols?
16:59sdegutisuhh clojurebot
16:59sdegutisabp: error code: 2
16:59sdegutis,(sort-by first {:a 1 :b 2 :c 3})
16:59clojurebot([:a 1] [:b 2] [:c 3])
17:00dbellyeah, sorry, didn't mean to ask and bail
17:00sdegutislazybot: why didn't you eval the thing that started with &&?
17:01dbelli'm particularly caught up w/an Om project, where the data structure has to be a map or a vector, and I want to map rendering across a collection, but i want to preserve call-by-id
17:01TEttingersdegutis ##(sort-by first {:a 1 :b 2 :c 3})
17:01lazybot⇒ ([:a 1] [:b 2] [:c 3])
17:02sdegutisoh that one
17:02sdegutisthnkas
17:02dbellI probably just need to learn about cursors more thoroughly
17:02abpdbell: have you considered core.async for centralized state updates?
17:02sdegutisdbell: what cursors?
17:02dbellabp: how does that play nicely w/the tranaction-oriented nature of om's state-change model?
17:03mikerodWhy does this work? (def x x)
17:03abpdbell: https://github.com/KitchenTableCoders/immutable-stack/blob/master/contacts/src/cljs/contacts/core.cljs#L135
17:03mikerodThe var is then just Unbound
17:03dbellsdegutis: https://github.com/swannodette/om/wiki/Cursors
17:04mikerodDoes the compiler consider the x being def'ed in scope of its init expr?
17:04dbellabp: reading...
17:04amalloymikerod: well, consider (defn f [x] (inc (f x)))
17:04mikerodAnd is this specifically implemented to support "corecursion"
17:04mikerodamalloy: oh... good point
17:04lodinmikerod: Also consider (def x) (def y x).
17:05amalloymikerod: it's actually a misleading point, because that expands to (def f (fn f [x] (inc (f x)))), but it does sound good
17:05mikerod:P
17:05abpmaybe reducers are going to be the new channel comprehension lib :)
17:06dbellabp:
17:06mikerodYeah, I knew that (fn f [<args>] <body>) would put the fn name `f` in scope of the <body>
17:06amalloyanyway, when an expr is compiled, first it's scanned for var definitions, then those vars are created, then the form is compiled with them in scope
17:06amalloyor something like that
17:06dbellI kind of jumped at what you said b/c I've been thinking about this, but
17:06lodin /whois mikerod
17:06dbellI'm actually trying to figure out how to mesh reactive data structures and om's state model
17:06mikerodamalloy: Interesting. I just never expected this to work, until I saw the classic fibonacci example.
17:07mikerodlodin: not sure how that example relates. That is 2 separate var defs?
17:07abpdbell: reactive as in rx?
17:07dbellyeah
17:08abpdbell: no idea
17:08dbellso I think we may have miscommunicated there
17:08dbellnp
17:08abpdbell: it's about observables
17:08dbellrx? yeah
17:08dbellbut yeah
17:09dbelli'm using channels on components which trigger transactions on the central state
17:09Bronsaamalloy: (defn x [] x) expands to (def x (fn [] x)) not to (def x (fn x [] x))
17:09amalloyreally? i thought there was a self-name in there somewhere
17:10mikerodIf that is the case, then the ex is a relevant one again.
17:10lodinmikerod: Sure. But since that works, it is not unreasonable for (def x x) to work, since any (def x ...) can be rewritten to (do (def x) (def x ...)).
17:10Bronsaamalloy: it changed a while ago
17:10mikerodlodin: fair enough
17:10mikerodI guess I'd like to read through some of how the compiler deals with that.
17:11abpdbell: Then you probably should use atom-state and channels?
17:11Bronsamikerod: there's nothing much to know, once the compiler parses a def expression it interns the var before analyzing the var expr
17:12amalloyBronsa: more than that, even: it interns the var before analyzing any of the top-level form the var is in
17:12amalloyi think. right?
17:13Bronsauhm, not exactly
17:13lodinmikerod: I realized that this is a bit unfortunate. Try (def x (recur)). Will give compiler error, but an x has still been created and is unbound. Doesn't feel good.
17:13abpdbell: There's also https://github.com/tonsky/datascript but I never tried that.
17:13Bronsa,(let [a x] (def x))
17:13clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:13Bronsaamalloy: ^
17:13dbellyeah i haven't either
17:13mikerodBronsa: ah, yeah I see
17:13dbellhoping to stay more lightweight, but that might not be an option
17:14Bronsaamalloy: what makes you say something like that?
17:14Bronsaamalloy: there's some confusing behaviour where the var is interned before its metadata is analyzed I guess
17:14dbellabp: for state/channels, yeah, maybe
17:14amalloyi guess i'm just wrong, unless this changed recently too
17:14Bronsanot AFAIK
17:15abpdbell: a few channels and om with https://github.com/Prismatic/om-tools should be lightweight and convenient enough.
17:15Bronsa,(def ^{:foo x} x)
17:15clojurebot#'sandbox/x
17:15dbellthe graph topography changes as part of the application, so I'm kind of intimidated by shuffling all those channels around all the time
17:15Bronsaamalloy: ^ that's probably what you were thinking about
17:15mikerod,(meta x)
17:15clojurebotnil
17:15amalloynah, you give me too much credit
17:15Bronsa,(meta #'x)
17:15clojurebot{:ns #<Namespace sandbox>, :name x, :file "NO_SOURCE_PATH", :column 0, :line 0, ...}
17:15dbello hey
17:15mikerodwoops, thanks...
17:15Bronsa,(:foo (meta #'x))
17:15dbellprismatic to the rescue again
17:15clojurebot#<Unbound Unbound: #'sandbox/x>
17:15abpdbell: prismatics graph and schema are cljs compatible too
17:15abpdbell: om with graph would work
17:15mikerodBronsa: that is weird
17:16amalloyi think i'm mixing it up with stuff like (when false (def x 1)) causing x to be def'd
17:16mikerodbut cool I guess? hah
17:16abpdbell: yep, ai lipe to the recue :)
17:16abp*lisp
17:16mikerodamalloy: that is news to me...
17:16Bronsaamalloy: ah, yeah
17:16mikerodIt is def'ed but not initialized it seems.
17:16amalloymikerod: var creation is unconditional
17:17amalloyit happens when the def form is compiled, not when it's run
17:17mikerodYeah, I guess that is why you should always follow the advice of not trying to do weird nested var def's
17:21amalloy@@(def x (delay @x))
17:26mikerodthat one is painful to think about
17:27mikerodwell, I guess not so bad
17:30TimMc,@@(def x (delay @x))
17:30clojurebot#<StackOverflowError java.lang.StackOverflowError>
17:30TimMc*nod*
17:31Bronsa,@(def x (delay @x))
17:31clojurebot#<Delay@ade1b6: :pending>
17:31Bronsawut.
17:31Bronsaah.
17:32metellus,x
17:32clojurebot#<Delay@ade1b6: :pending>
17:32metellus,@x
17:32clojurebot#<StackOverflowError java.lang.StackOverflowError>
17:32TimMc,@x
17:32clojurebot#<StackOverflowError java.lang.StackOverflowError>
17:33lodinThe imperative semantics of def irk me a bit.
17:36mikerodlodin: I can't think what specifically is "imperative semantics" about it
17:37lodinmikerod: Typically you use it for its side effects and you don't care about the return value. And the side effect persists even if you have a compilation error in the form.
17:38kristofI don't follow why that's a bad thing.
17:39TimMclodin: If that makes you twitch, you should look at the source for defonce.
17:42lodinkristof: I haven't really considered the implications of this, but I guess you could have that def returns a data structure, that, when "returned" to the top level, was added to a namespace.
17:47hiredmanyou get a statically linked top level environment, something like mls repl
17:47hiredmannot very appealing
17:47lodinhiredman: What do you mean by statically linked top level?
17:48lodinhiredman: (and what's mls repl?)
17:49hiredmanwell the "imperative semantics of def" means def creates vars that operate as mutable reference cells, and for things in the top level enviroment you link via the mutable refence cell, so if the mutable refence cell changes the next time you get the updated value
17:49wildnuxhi, what does the & { :as opts } mean in this function: (defn character [name & {:as opts}] (ref (merge {:name name :items #{} :health 500} opts)))
17:49hiredmanthe "more functional" approach would be to model the top level enviroment as basically a special case of let
17:50mikerodlodin: ok, I see what you mean by that
17:50mikerodI wish all of Namespaces worked in a persistent map sort of wya
17:50mikerodway*
17:50hiredmanso if you def something, and then use it, then redef it, the uses will not see updated values, like (let [x 1 f (fn [] x) x 2] (f))
17:51michaniskin~korks
17:51clojurebotkorks is keywords or a seq of keywords (like update or update-in) used in om i.e. transact! and update!
17:51michaniskinROFL
17:51lodinhiredman: Why is is desirable to be able to redefine the vars? REPLs?
17:51hiredmanlisp in small pieces has a section on choosing a linking strategy for the toplevel which constrasts different approaches
17:51hiredmanlodin: sure
17:52dbelloh cool
17:52dbellwildnux: all arguments after name will be treated as kvkvkvkvkv of a map
17:52wildnuxdbell: oh that is for the implicit let binding?
17:53dbellso (character "joe" :occupation :protagonist :nemesis :villain)
17:53dbellyeah
17:53hiredmanml (the language) takes the "treat top level things as a special kind of let" approach
17:53lodinhiredman: Nice, will look it up.
17:53kristoflodin: because vars are variables
17:53hiredmanthe book is like a million dollars on amazon though
17:53kristofwhich should be... variable
17:54wildnuxdbell: what does #{} signify?
17:54dbell#{} is the clojure shorthand for a set literal
17:54lodinhiredman: But the shipping is FREE! ;-)
17:54dbelljust like [] makes vectors and () makes lists
17:54hiredmanI think I actually had rich recommend it to me when I asked him about implementing a lisp, and then my eyes kind of bugged out
17:54dbell#{} makes sets
17:54hiredman~logs
17:54clojurebotlogs is http://clojure-log.n01se.net/
17:54wildnuxdbell: got it
17:54wildnuxdbell: thanks
17:55dbellnp
17:55lodinkristof: Usually, outside the repl, I never use the vars as variables.
17:56mikerodhiredman: eyes bugged out due to the price or the content?
17:56wildnuxdbell: one quick question, can we not just say [name & {}] instead of [name & {:as opts}] ?
17:56lodinkristof: I guess if you need that functionality you can put an atom in the var? (Never actually used atoms, but I reckon that's what they're for, right?)
17:57dbellwildnux: the problem is then you have no binding to the map
17:57amalloyi remember being unpleasantly surprised by code like (defprotocol IFoo (foo [this])) (def multifoo (partial map foo)) (extend-protocol IFoo nil (foo [this] nil)) (multifoo [nil nil nil])
17:57hiredmanmikerod: the price
17:57amalloy(re: the discussion on var mutation and saving old values)
17:59arrdemdo we have a parallel doseq form?
17:59hiredmanamalloy: do a see a jira issue in the future with "protocol functions shouldn't be used as HOFs" in it?
18:00amalloyhiredman: it's actually more specific than that. (defn multifoo [xs] (map foo xs)) would work fine
18:00mikerodhiredman: ah, I see it now
18:00hiredmanamalloy: sure
18:00mikerodamalloy: so this is an issue with what partial is doing?
18:00amalloymikerod: no, partial doesn't do anything relevant
18:01mikerodThis seems scary to me
18:01mikerodI'm not sure what causes the problem though.
18:01amalloythe issue is that when you call partial with foo, you get a snapshot of the value of the var #'foo, and partial saves that. but when you extend-protocol, the var #'foo is updated with a new value
18:01hiredmanfoo takes the value of the var foo, which extend the protocol mutates, but in the top level call it takes the value of the var before the extend has mutated it
18:02kristoflodin: changing vars for dynamic binding, then
18:03mikerodMakes me curious for: (defprotocol IFoo (foo [this])) (defn multifoo [] (partial map foo)) (extend-protocol IFoo nil (foo [this] nil)) ((multifoo) [nil nil nil])
18:03amalloywould work fine
18:03mikerodSo the fn bodies are safe
18:04amalloywat
18:04mikerodstupid question? hah
18:04ybit3i think i've asked this before, but i'm looking for a way to do something like lein install "org.clojure/clojure '1.6.0'" --save and have the dependency installed into the project.clj dependencies
18:05ybit3is there something like this in lein?
18:05mikerod(defn multifoo [] (partial map foo)) -- I guess this doesn't take the "snapshot" version of foo
18:05kristoflodin: Is that not a legitimate use-case? Defing something and then using (binding . . .) in some code where you need implicit vars for context
18:05amalloymikerod: well, it snapshots every time multifoo is called
18:05mikerodok
18:05amalloyso like, (let [f (multifoo)] (extend-protocol ...) (f [nil nil nil])) would fail
18:06lodinkristof: Yes. But I guess you wouldn't be surprised if I'm not a fan of dynamic bindings either? ;-)
18:07mikerodGot it. Good example.
18:11ybit3recommended server framework for clojure?
18:12kristoflodin: Sometimes you need them
18:12kristoflodin: Well, sometimes I need them. :P
18:12lodinkristof: Like when? (Other than redirecting output.)
18:13kristoflodin: Try writing an editor like emacs without dynamic binding!
18:13kristofDescending a abstract data type and keeping track of the context
18:14kristoflodin: Really, a lot of the code in emacs depends on the ability to stack a binding onto the env and popping it off
18:15kristofAnd the only way you can handle that is either with dynamic scope or explicitly passing things in as arguments. Which are equivalent, but one is unwieldy, the other is useful because it's implicit.
18:15lodinkristof: I don't think they're really equivalent.
18:16kristofI believe in implicit vars for the exact same reason I don't make every function expect something like a Maybe monad that could be an error
18:16lodinkristof: lazy seqs at least used to be an issue. Don't know about current versions.
18:16boxedhow do I call ArrayList.remove(int)? I can’t get clojure to not box the int so it calls ArrayList.remove(Object) instead
18:16ybit3i can't decide between caribou, luminus, moustache, compojure, or pedestal?
18:16ybit3i'm mostly accustomed to writing apps in rails and express
18:17amalloyappropriate username, boxed
18:17kristoflodin: They certainly are! You can either lob that binding as far down as possible or you can hand it off gently. It's certainly the same thing. But if you use that var a lot farther down the callstack than you bound it, are you really going to want to pass it manually?
18:17boxedamalloy: heh, didn’t think of that
18:17amalloyshould just be (.remove ^ArrayList xs (int 1)), no?
18:17arrdemcan't have raw integers running around now can we? machine primitives are so unsightly...
18:17lodinkristof: I'm be inclined to say yes, but I haven't implemented any emacs. :-)
18:18lodins/I'm/I'd/
18:18kristoflodin: That was just a good, complicated example. The point is that it happens. It's the reason Common Lisp implemented both dynamic and lexical binding.
18:18mikerodArrayList.remove(int) being overloaded with Object seems nasty to me
18:18kristofAnd clojure, in tandem.
18:19mikerodThat is very funny that boxed had a question about boxing though
18:21Frozenlock,(sort ["a1" "a2" "a10"])
18:21clojurebot("a1" "a10" "a2")
18:22FrozenlockAny function to sort with the numbers?
18:22Frozenlock*as well
18:22lodinkristof: If you just use them as implicit variables you need to keep track of when the expression they're used in is evaluated though.
18:23boxedamalloy: thanks, that works… is that a way to avoid going through the reflection system or something?
18:23FrozenlockFor emacs I have this https://www.refheap.com/88097, but I'd be nice if it's already somewhere in Clojure.
18:23lodinkristof: like in (let [f (bindings [*x* 3] (fn [y] (+ *x* y)))] ...).
18:24amalloyboxed: well, if the compiler has sufficient type information, it will emit non-reflective method calls. type-hinting is one way to give it type information, although not the only way
18:24lodins/bindings/binding/
18:28ohpauleezybit3: It really comes down to what are you building and what are your needs?
18:28kristoflodin: That looks fine to me and I don't see anyone needing to keep track of anything
18:28ohpauleezOh those, Pedestal is the only one that is truly async
18:29ohpauleezit also embraces the "data over functions over macros" found in other Clojure systems, like Datomic
18:29ohpauleezAnd if you need something like url-for, I think it may be the only one that supports that
18:29kristoflodin: Imagine that instead of *x* being 3, *x* is something like current-working-directory
18:30kristoflodin: I think it's good to trust the most recent function call to have the most up-to-date and specific information. So if it gets rebound later, I won't care.
18:33lodinkristof: OK I see what you're getting at.
18:34ybit3ohpauleez: i've narrowed it to luminus, compojure, pedestal
18:34kristofAnd I see why you might be wary of using a dynamically scoped variable!
18:34ybit3i'm building a POS system
18:35ybit3it's going to auth users, store payments, fetch payment history
18:35lodinkristof: Maybe a key part of your last line is "up-to-date". I read that as you have (informally anyway) an external state that changes.
18:39kristoflodin: By up-to-date, I didn't mean external state, I meant context of computation. But yes, you might have a ref floating around somewhere that you can occasionally read from in calls.
18:39arrdemandyf_: http://grimoire.arrdem.com/ live!
18:40kristofNo actually, I don't think that's a good use of dynamic vars. I dunno!
18:40kristoflodin: In common lisp, you often use defparameter for dynamically scoped variables. The name "parameter" should be clear about what kinds of situations you use it for.
18:40lodinkristof: I got that. That's why I said informally. What is defined as "external" is kind of arbitrary, I guess.
18:41andyf_ arrdem: email sent to Clojure group about new cheatsheet variants
18:41lodinkristof: True. Does parameterized functions not sound a lot like objects though? (Not talking about Java classes and objects here.)
18:42arrdemandyf_: just saw it. thanks!
18:43kristoflodin: If by parameterized functions you mean functions that make use of dynamically scoped variables then no, they sound nothing like objects.
18:45lodinkristof: Of course not dynamically :-), just parameterized. Like a record that implements protocol functions. The protocol functions are parameterized over the record's fields.
18:47Jaoodarrdem: http://grimoire.arrdem.com/1.6.0/clojure.core/some/#example-0 - some html problems?
18:47amalloyyour repl doesn't automatically print </pre> after each expression, Jaood?
18:48arrdemJaood: yeah thanks for that. I won't bother fixing it for now because I expect to blow the entire examples system as currently implemented away in the next version.
18:48Jaooddarn, my repl is broked ;)
18:48lodinkristof: Of course you need to pass the records explicitly then, but you also conceptualize the computation context (and make that dependency explicit).
18:51seancorfieldGershwin looks interesting... hybrid of Clojure and Factor... wondering if it's possible to mix .gwm Gershwin files and .clj Clojure files easily in a single project...
18:53arrdemJaood: just looked at the source, that's weirdness I'm getting from ClojureDocs. Those examples have the <pre> </pre> on Clojuredocs they're just actually rendering there.
18:54technomancyhuh, is liquid decent?
18:55arrdemeh... it's a toss up for me between Liquid and Org.
18:56kristoflodin: Then sure
18:56technomancywait, what is this for?
18:56technomancyorg for HTML templating?
18:56kristoflodin: Actually, yes
18:56clojurebotGabh mo leithscéal?
18:57kristoflodin: Many OO languages have effective methods as function pointers stored in the object's struct. Or something.
18:57kristoflodin: So you could consider those function pointers to be the "dynamic" bindings.
19:20andyf_arrdem: Note that cheatsheet has never had a complete list of all vars yet. The current most conspicuous absence are the vars in clojure.core.reducers. Suggested additions are welcome there
19:24arrdemandyf_: yeah that's something cbp has been saying for a while that we need a "real" whole var set search. Maybe 0.3.0 material but I'm not super motivated to write some javascript.
19:26arrdemandyf_: I've needed to take a serious look at reducers for a while anyway so that may be something I throw you this weekend but who knows.
19:26stuartsierraI wouldn't expect the cheatsheet to have *every* Var.
19:27Bronsaat least it includes fnext
19:27andyf_No rush, but certainly a welcome addition if someone has a good suggestion. Alex Miller has updated clojure.org/reducers recently and is looking for feedback there
19:28andyf_stuartsierra: Me, neither, but there may still be a few reasonable additions other than reducers.
19:28stuartsierrasure
19:30jdkealyHi I was wondering if anyone would dissuade me from storing all my dates as timestamps (ints) as i consider the querying possibilities possably easier to use
19:31arrdemclocks are totally monotonic I have no idea what you're talking about
19:31technomancyjdkealy: as long as they're in UTC, seems legit
19:31Bronsaandyf_: what version of t.a.j does eastwood use?
19:31andyf_Complete list of vars not on the cheatsheet is at the end of this file, in case anyone is curious: https://github.com/jafingerhut/clojure-cheatsheets/blob/master/src/clj-jvm/TODO.txt
19:32andyf_Bronsa: 0.2.2
19:32andyf_Bronsa: Not so easy to tell now that it is copied in as source code :-)
19:33stuartsierraI think of the cheatsheet as a pointer to the most commonly-used functions, not an exhaustive reference.
19:33jdkealyok. so everything needs to be converted to UTC.. damn, why the hell are dates so confusing!
19:33Bronsaandyf_: uhm ok, there was a performance regression since 0.2.0 that'll get fixed in the next release
19:34stuartsierraWe have API docs for reference, the cheat sheet is useful to help people find the stuff they need to know.
19:34andyf_Bronsa: I intend to keep the file copy-dep-scripts/deps/project.clj up to date to help me keep track
19:34dbaschjdkealy: you don't *need* to convert them, but might as well use the standard
19:34dbaschjdkealy: if anyone sees a date as an int, they will assume seconds since the unix epoch
19:35jdkealyright that makes sense... but in a library like moment.js, if i had a user select their timezone, date, and time, getting a timestamp should be UTC, no ?
19:35jdkealyahh ok
19:35andyf_stuartsierra: I am sure it is beyond "most commonly used" now, but in my mind the grouping into categories is one of its nicest features
19:35jdkealyok will test that, and that's a question for another channel. thanks!
19:36Bronsa,(meta ^:foo (fn [])) ;; does anybody know if this is documented behaviour?
19:36clojurebot{:foo true}
19:38andyf_Bronsa: I've been away from Eastwood for a month due to work busy-ness, but should get time for some updates in a few weeks. I really would like to add the ability to disable warnings at a per-expression level next, with no affect on compiled code
19:40amalloyBronsa: what part of it are you wondering about?
19:41jdkealyi have a follow up question. if had an event with a start date (for simplicity, i'm using overtly simplified timestamps)... start-date = 2, end-date = 10... client queries for any event happening between 5 and 9... because the event is happening on 6,7,8 it should return true. considering the vars were set to ?start, ?end, ?query-start, ?query-end, how would i detect there is an intersection there
19:41Bronsaamalloy: ##(meta ^:foo (vector 1))
19:41lazybot⇒ nil
19:42Bronsaamalloy: metadata on the fn* form is attached to the fn method
19:42Bronsas/method/object
19:42jdkealyactually... a better case is client queries for between 1 and 3 (query start date being before the event start date... the area of my confusion)
19:42BronsaI haven't seen that documented anywhere
19:43amalloyBronsa: it's probably an accident
19:43Bronsaamalloy: on reify that behaviour is actually documented
19:43arrdemBronsa: as Fns are IObj this seems like the obvious behavior..
19:43amalloyor, well, actually the macro fn is going out of its way to preserve that meta
19:44Bronsaarrdem: not really, ^:foo (fn []) is different from (with-meta (fn []) {:foo true})
19:44amalloyarrdem: not so! because ^:foo is hinting, not the function, but the *list* '(fn []]), which is consumed by the compiler
19:44Bronsayeah, that
19:44Bronsaarrdem: so my example above, ^:foo (vector 1), the returned vector doesn't have the meta attached
19:45Bronsaamalloy: yeah both the fn macro and the fn* special form in the compiler are explicitely preserving that metadata
19:45amalloyit'd actually be impossible for ^:foo (vector 1) to get its meta attached, since vector is a function rather than a macro
19:46Bronsaamalloy: you could implement that in the compiler
19:46Bronsabut that wouldn't make any sense and would be broken
19:46amalloyyeah
19:47Bronsait was just a silly example of a call returning an IObj
19:47amalloythis is vaguely related to http://dev.clojure.org/jira/browse/CLJ-865, and i use any excuse to link to that
19:48Bronsat.a does The Right Thing™ there
19:49amalloythank goodness. i couldn't even quite figure out what the right thing is, let alone convince clojure/core of it. what is the right thing?
19:50Bronsa(https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm.clj#L160-L162
19:51kristofClojure uses a single FixedThreadPool to manage async blocks
19:51Bronsait doesn't break any existing code
19:51kristofGo tried something similar to this before 2012 and found that accessing the global lock was a pretty central point of contention
19:52Bronsaamalloy: wait, the ticket makes preserving metadata opt-in?
19:52Bronsathat's kinda useless.
19:52amalloyBronsa: opt-out, iirc. i haven't touched it in years
19:53amalloyoh
19:53amalloyyes, rich asked me to add an opt-in version of the patch, which you'll see in the comments i said is totally useless
19:54Bronsait totally is
19:54Bronsawhatever
20:05amalloydoes anyone know why clojure.core/list is defined as an IFn in clojure.lang.PersistentList, instead of in clojure.core? it's like the only function i know of that is built that way
20:06amalloy,list
20:06clojurebot#<clojure.lang.PersistentList$1@1dfacc4>
20:07amalloythis also means it's the only function you can't put metadata on
20:08andyf_Wild guess, which you probably have a better idea how to answer than I do: some early bootstrap use of it in core.clj ?
20:08Bronsausually when I have those kinds of questions I make the change and see if/what breaks when compiling clojure
20:10amalloyandyf_: i don't think so - it should be possible to just write (def list (fn* [& args] (PersistentList/create args))). but sure, good advice, Bronsa
20:11Bronsaamalloy: there's probably no reason why it can't be redefined in core, but if it's defined in RT it probably means it's required somewhere for bootstrapping
20:11Bronsaor that it's just a leftover.
20:15amalloyso it looks like PersistentList.create assumes you don't give it nil, and PersistentList.creator.invoke includes a nil check. if clojure.core/list checks for nil, and then delegates to create, that's a correct implementation
20:16amalloyhowever, PersistentList.creator.invoke has some optimizations in it that would be no fun to include in clojure.core
20:19arrdemandyf_: someone just got referred to my / by your github.io page. bug?
20:20andyf_arrdem: Probably. Let me check all the generated links
20:37andyf_Do you mean a URL of http://grimoire.arrdem.com/ ?
20:38arrdemandyf_: I appologize I think that the report was in error and that I was seeing two different people on different sources
20:38andyf_No prob. I don't see any links like that in my HTML
20:41seangroveUsing core.typed, how can I annotate that an argument is hash-map with 3 required keys?
20:41seangroveTrying to use the core.typed/ann form, I suppose that could be wrong
20:43seangroveAh, nvm, believe I got it
21:56drusellerstrying to do an 'update-in' into an array - i feel like I am missing something obvious as my solution seems overly complex. any help would be appreciated https://gist.github.com/drusellers/dca7bc2f46ae9ecb6785
22:03gfredericksdrusellers: you can pass `conj` and `athlete` as args to update-in instead of making a custom function
22:04gfredericksbut I think the main thing is that if you want to be updating by :id you should probably use a map from :id to division instead of a vector
22:05drusellersgfredericks: yup, that's what i am thinking too.
22:05drusellerskind of a palm to face
22:05gfredericksit's kind of surprising how rarely you need to use the indexed lookup/update on vectors
22:06gfredericksit's kind of unnatural for application data
22:08gfredericksit's kind of my third statement that starts with "it's kind of"
22:20onrplease tell me Clojure seemed tooo alien at first, then you eventually found it useful
22:21onri'm looking at clojure codes, everything seems weird
22:21eggsbyya onr and the first clj I wrote was horrifying
22:23onrglad to hear :)
22:24nathan7Hey humans
22:24nathan7I'm trying to use ClojureScript
22:24onrhi
22:24nathan7and for some reason, defmacro appears to be entirely absent
22:26nathan7ah, found it
22:26jollygoodhi. i am curious why did clojure opt for unhygienic macros like the ones in common lisp and not hygienic macros like in scheme? did Hickey discuss this somewhere?
22:27nathan7no idea about the latter, but most Clojure macros use automatic gensyms and such as not to interfere with their place of use
22:27nathan7syntax-quote respecting namespaces also helps
22:28nathan7,`(fn)
22:28clojurebot(clojure.core/fn)
22:28nathan7so, effectively you get everything true hygiene would give you
22:28eggsbydoesn't proper use gensym make macros hygienic?
22:28nathan7Yeah, effectively
22:28nathan7,`(fn [x#] x#)
22:28clojurebot(clojure.core/fn [x__49__auto__] x__49__auto__)
22:28nathan7jollygood: ^
22:29eggsbylike, not clobbering binding names
22:29nathan7You have to do your best to clobber
22:29nathan7,`~'clobber
22:29clojurebotclobber
22:29nathan7or, for a better example
22:29nathan7,`(fn [~'clobber] ~'clobber)
22:29clojurebot(clojure.core/fn [clobber] clobber)
22:32eggsbyya, sometimes it's useful to borrow things like binding names from the outside scope :)
22:34cespareis it possible from a class to its namespace?
22:35jollygoodI see.. so what would capturing an identifier look like in clojure?
22:36nathan7jollygood: I'm not sure what 'capturing' means here
22:39jollygoodreferring to the variable name defined outside of our macro
22:40arrdemjollygood: what do you mean "variable". A def outside of the macro? a let bound symbol outside of the macro?
22:41jollygoodeither a let or a def outside of the macro, whatever is in the scope at the place macro is used
22:43jollygoodbasically, how would we avoid using gensym?
22:43jollygoodif we needed to
22:49halogenandtoastIs there any better way to do this: (merge ball { :x (+ (:x_speed ball) (:x ball)) :y (+ (:y_speed ball) (:y ball)) })
22:49arrdemhalogenandtoast: get the some implementation of `update`.
22:49arrdems/the/thee/g
22:50arrdem$google flatland useful update
22:50lazybot[useful 0.11.2 - Clojars] https://clojars.org/org.flatland/useful
22:50arrdemhttps://github.com/arrdem/oxcart/blob/master/src/oxcart/util.clj#L80
22:51arrdem(-> ball (update :x + (x_speed ball)) (update :y + (:y_speed ball)))
22:52halogenandtoastHmm
22:53halogenandtoastBeing relatively green, I’m not sure I get everything that is happening there. Are you claiming I should use “useful” or “oxcart” here.
22:54halogenandtoastoxcart seems like not the answer.
22:54halogenandtoastAnd perhaps that’s just an example usecase?
22:55halogenandtoastbut the thread-first macro is probably a good idea here.
22:57amalloyalternatively, something like (into ball (for [[pos speed] [[:x :x_speed] [:y :y_speed]]] [pos (+ (pos ball) (speed ball))]))
23:00halogenandtoastThanks guys, I have some direction now.
23:07kegundSo new guy on Win7. I'm long on emacs.. linux.. and just finished SICP. I'm not getting stable repls inside of emacs. What route should I take for full clojure??? cygwin&emacs-live? ssh to: CentOS+bash+emacs... Native windows? Any pointers accepted kindly.
23:09platzI've tried the cygwin route in the past and I'm done with it
23:09platzwhy doesn't the repl work
23:09kegunddone with it? you run it now or never again.
23:09caterni'd recommend ssh to CentOS
23:09caternor you could ssh to a VM
23:10kegundMy Cent is a VM... though remote
23:10caterna local VM
23:10kegundI'll see what I can do...
23:11caternthe remote CentOS presumably would work, but CentOS 6 is so old and old
23:19amalloykegund: i do my at-home coding in a local ubuntu vm
23:21caternugh, you people not running Linux
23:21caternhow do you survive?
23:22eggsbycatern: it's fine, really
23:30kegundAhhh. So I got sh#t from screen about fake ttys... I'm on local bash << via VMw << via RDC... Oh well. my souped up laptop isn't geared for storage... so no local VMs :(
23:32kegund;;;; show key!!!
23:32Jaoodwhat is VMw?
23:33kegundSet of VMware VMs.
23:33Jaoodwhy are you not sshing to the vm?
23:38kegundJaood (still figuring out IRC again). I can't ssh to the VM because I'm local private IP and VM is another local private IP. No port work done.
23:46caterneggsby: i don't believe you, you've just developed coping mechanisms
23:46caternkegund: how do you usually connect to the vm?
23:54kegundSo I can't get Lein installed without a --no-check-certificate .... is that legit?