#clojure logs

2014-08-19

00:01andrewchambersgreenznc:
00:02andrewchambersI dont understand why you are sending and reading from same coroutine
00:02greenzncandrewchambers, I'm new to core.async
00:02greenzncwhy not the same (go)?
00:03andrewchambersI haven't really used it. But... if its an unbuffered channel i dont understand how that can work
00:03andrewchamberssince it will send then pause waiting for someone to recieve
00:04andrewchamberstrying reading from 1 go, and sending from another go andsee what happens
00:05greenzncandrewchambers, it still alerts six times
00:06greenzncquite strange
00:06andrewchambersxD im confused as to how it alerted one time
00:06andrewchambershaha
00:06andrewchambersI dont have clojure setup on this machine otherwise i'd try it out xD
00:07greenzncwell there's a site called cljsfiddle
00:08greenzncandrewchambers, http://cljsfiddle.net/
00:08greenzncno more setup
00:08andrewchambersdoes that have core.async ?
00:09greenzncyes
00:09clojurebotHuh?
00:13andrewchambersgreenznc: server doesnt seem to be working
00:14greenzncandrewchambers, what do you mean by 'server'?
00:14andrewchamberswell, the ckjsfiddle run button does nothing
00:14andrewchambersthats all i mean
00:15greenzncmine works
00:15andrewchambersmust be my version of firefox
00:17andrewchambersgreenznc: http://pastebin.com/4Z0fTVNu
00:17andrewchambersi was just gonna try that and see what hapens
00:18andrewchambershopefully i havent made an error, since i havent checked it
00:18andrewchambersoh yup i made a bunch
00:19andrewchambershttp://pastebin.com/wfmEXugm
00:19greenznclet me see
00:21andrewchamberscore.async is pretty sweet when i understood how it works
00:21andrewchambersI think its alot simpler than some of the tutorials made it seem
00:22greenzncandrewchambers, it calls those three times which is correct
00:22andrewchambersI just took your code
00:22andrewchambershmm
00:22greenzncbut I have no idea what's wrong with my code
00:23andrewchambersif you print in your doseq
00:24andrewchambersdoes it print 3 times or 6 times?
00:24andrewchambersthats my question haha
00:24andrewchambersbtw, im not sure if that code is a memory leak, it might be. Since the while true loop never terminates
00:25andrewchambersafter the first 3 sends
00:25andrewchambersit will just sit there forever
00:26greenzncandrewchambers, I know it
00:26andrewchamberscool
00:26andrewchambers:P let me know if you work out why its sending 6 times haha
00:27andrewchambersim curious now
00:27andrewchambersmaybe your code is just running twice
00:27greenzncin the future I'd love to re-queue timeout-ed requests
00:27andrewchambersis it in your top level?
00:27andrewchambersor you just copied out of a function
00:28greenzncno, in an om's (will-mount []) component
00:28greenzncI meant in an compont's will-mount
00:29andrewchambersyeah i understood that
00:29andrewchambersI dunno, i think the code is just running twice for some reason
00:30andrewchambersbut i think having two go statements is needed just because sending can block until it succeeds, and it cant succeed if there are no live go blocks reading it
00:30andrewchambersand by block, i mean cause the javascript to idle or whatever.
00:32greenzncandrewchambers, I move the code to the top level and it works as expected
00:32andrewchambersmust just be called twice
00:33greenzncyup
00:33andrewchamberscool, now work out how om works :P
00:33andrewchambershehe
00:33greenzncwell, I execute the component twice for experiment purpose
00:34greenzncand forget it XD
00:34andrewchamberslol
00:34andrewchambershmm, put! might not actually block ever
00:34andrewchambersaccording to the docs
00:34andrewchambersim not sure
00:34andrewchambers:P
00:34andrewchambersi dont know how much space there is in a default chan
00:35greenzncI'm thinking of how to close the channel when three requests are complete
00:36greenzncandrewchambers, any suggestions?
00:36andrewchambersjust send :done
00:36andrewchambersor something
00:36andrewchambersthen terminate loop
00:36greenzncbut how to figure out all of them are complete?
00:37andrewchambersoh, i understand
00:37greenznccount them and store somewhere?
00:38greenzncor is there any existing mechanism?
00:38andrewchambershmm
00:38andrewchamberswell you know how many you expect
00:39andrewchambersbecause of the length of the map
00:39andrewchambersso you could replace the while true
00:39andrewchamberswith a loop / recur
00:39andrewchamberswhere you decrement a value
00:39andrewchambersuntil it hits zero
00:39greenzncandrewchambers, yeah
00:39greenzncmany thanks
00:40andrewchambersyeah, you might need code to handle if there is an error
00:40andrewchambersbut i suppose an error can just be passed through
00:40andrewchambersin :status or whatever
00:41andrewchambersI want to build something with core.async and om
00:42andrewchambersseems really powerful
02:23reiIf I wanted to build a hash-map from varying levels of another hash-map, some form of multiple (assoc my-hash) be best? An example hash-map would be {:one :a :two ["hello" "world] :three #{1 2}}.
02:25amalloyrei: huh?
02:28reiamalloy: Well, to be more explicit, I'm scraping a website and I'm getting a hash-map of tags with the content I need. I want to build a final hash-map with only the relevant information at the top-level.
02:28reiI'm trying to find the most idiomatic way of doing that.
02:31amalloyokay, so something like ##((fn [m keypaths] (into {} (for [[k path] keypaths] [k (get-in m path)]))) {:foo 1, :a 2, :b {:c 3}} {:x [:a], :y [:b :c]})
02:31lazybot⇒ {:y 3, :x 2}
02:36reiamalloy: It took me a minute to wrap my head around it. Yes, that seems not only ideal but reusable.
02:36reiI didn't think to be able to list off keypaths, as you've declared them.
02:48amalloyrei: anytime you're considering writing out multiple calls to the same function, consider whether you can write out a list of arguments to it, reformulate it into a reduce or a map or something
03:07reiamalloy: Thanks. I'll definitely look at that way in the future. Sorry for the delay, I was trying to amend your snippet to my code, and I realized I need to apply an arbitrary function and not always a path.
03:07reiBut it worked like a charm.
04:35zanestechnomancy: Would you advise against using Robert Hooke at this point?
05:52lvhHi :)
05:53lvhI have some recursive structured data (specifically, a "spec" which is a map with some stuff OR an unordered collection of specs OR an ordered collection of specs)
05:54lvhI was wondering if there's any tools for actually checking that based on a declarative description of what it looks like
05:54lvhI know of prismatic/schema, and typed clojure
05:54lvhalso, importantly, these specs will be stored (they're immutable) and then read/executed later
05:55lvhso it's important that I can verify them separately from actually running the code that uses them
05:55lvh(because it has side effects)
05:55lvh(does that make any sense?)
05:57llasramIf they're just data, then I believe you can use prismatic schema
05:57llasramI've only played with it, but that's what it does -- verify some data matches an expected structure
05:58llasramThey have convenient ways to wire that up to common times you'd like to check such structure, but the base checking is available on its own as well
06:14spradnyeshwhat is "Ljava.io.PrintStream" in "ClassCastException java.io.PrintStream cannot be cast to [Ljava.io.PrintStream"
06:14llasramspradnyesh: array of PrintStreams
06:15llasramYou'll most frequently see that when trying to invoke a Java varargs method. Java varargs is a fiction -- really you need to create an array to pass as the last argument
06:16spradnyeshllasram: where can i find documentation to understand more about it? and thanks for the help :)
06:18llasramGood question. The official documentation doesn't seem to cover it.
06:18llasramHere's a relevant StackOverflow question, but doesn't say much more than I've already said: http://stackoverflow.com/questions/11702184/how-to-handle-java-variable-length-arguments-in-clojure
06:20llasramI think Clojure considers that an interop issue, with the attitude "if you're doing interop, you need to understand the platform you're interoping with"
06:20spradnyeshllasram: thanks for the pointer; i'll go through it
06:20llasramNot optimal, but there you go
06:21spradnyeshi (mildly put) don't like Java. but in my current project am forced to use a java lib (not on clojars :( )
06:24llasramWell at least (hopefully) beats needing to re-write the features of the library yourself from scratch
06:25spradnyeshagreed
06:25spradnyeshhow can i add java-source to project so that i can "jump-to-source" (from emacs + cider) on exception?
06:47kitallisdoes 'lein repl' or 'lein test' know to pick up the right profiles from profiles.clj if you have a map like: {:dev {:env {:database-url-foo "jdbc:postgres://localhost/dev"}}
06:47kitallis :test {:env {:database-url-foo "jdbc:postgres://localhost/test"}}}
07:24spradnyeshkitallis: try https://github.com/weavejester/environ
07:29laurioI'm having an issue requiring clj-time.coerce namespace in my project because the project at the same time also depends on amazonica library - lein repl prints "Exception in thread "main" java.lang.NoClassDefFoundError: clj_time/core/DateTimeProtocol" because amazonica declares joda-time dependency as [joda-time "[2.2,)"], i think.. This is my namespace declaration: (ns myproject.core (:gen-class) (:require [clj-tim
07:29laurioe.coerce]))
07:29laurioIs there an easy workaround?
07:30drbobbeatylaurio: Look at the ":exclusions" in the leiningen project file. That might help you.
07:31drbobbeatylaurio: it's a way to exclude certain dependencies in the jars/libs that are being pulled in. You only need one copy of Joda, and it may be conflicts in the different versions that are hurting you.
07:32laurioI tried to declare the dependency in project.clj like so: [amazonica "0.2.24" :exclusions [joda-time]] but unfortunately it doesn't seem to help even after lein clean.
07:32Bronsalaurio: I don't see what joda-time has to do with that error
07:32laurioamazonica and clj_time both depend on joda-time library
07:32Bronsalaurio: try to replace your require line with (:require [clj-time] [cljs-time.coerce])
07:34Bronsalaurio: ok bu the error only talks about an issue finding a clj-time protocol, it never mentions joda-time. what made you think it hasto do with your error?
07:37drbobbeatylaurio: When you do a 'lein deps :tree' - does it have any suggestions at the top about conflicts in the dependencies?
07:41lauriodrbobbeaty, unfortunately 'lein deps :tree' doesn't seem to suggest about any conflicts
07:42hyPiRionlaurio: ah, that's problematic. Which version of clj-time are you using?
07:43drbobbeatylaurio: Hmmm... OK... when you look at the tree, what does it say for the version of clj-time? Where is it in the tree? If you read the tree, it should make a lot of sense about how things depend on one another.
07:43lauriohyPiRion, [clj-time "0.8.0"]
07:43laurioTried with lower versions also but this issue remained
07:44hyPiRionlaurio: Could you try to check if [clj-time "[0.8.0]"] works? Also, would love to get the output from `lein deps :tree` too – might help
07:46lauriohyPiRion, [clj-time "[0.8.0]"] didn't help. here is the `lein deps :tree` output: [amazonica "0.2.24" :exclusions [[joda-time]]]
07:46laurio [com.amazonaws/amazon-kinesis-client "1.1.0"]
07:46laurio [com.amazonaws/aws-java-sdk "1.8.5"]
07:46laurio [com.fasterxml.jackson.core/jackson-annotations "2.1.1"]
07:46laurio [com.fasterxml.jackson.core/jackson-core "2.1.1"]
07:48drbobbeatylaurio: there should be an entry for clj-time in the output - I don't see it...
07:50lauriodrbobbeauty, probably the text was too long - the relevant part is: [clj-time "0.8.0"] [joda-time "2.3"]
07:52drbobbeatylaurio: Well, if clj-time is using joda-time 2.3 - is there a problem with the other wanting to use 2.2? I don't know the other library, but I've used clj-time a lot.
07:52llasramlaurio: Generally for pasting in content longer than one line it's best to use a paste site, such as refheap.com
07:55lauriothanks, llasram, I'll send a link instead next time
07:56drbobbeatylaurio: The 'lein deps :tree' should have reported the conflict in the different versions of joda-time.
07:56llasramNah, they've got an exclusion
07:57llasramBut as Bronsa mentioned a while ago, the exception mentioned is a problem finding the backing interface for a clj-time protocol, so probably has zilch to do with the joda-time dependency
07:57llasramlaurio: Could you refheap a full exception
07:57llasram+ stacktrace of what you see when you get your error?
07:58lauriollasram, how can I print that?
07:59llasramOh, are you just getting the exception in your REPL, w/ no stack trace?
07:59llasramIf so, try: (clojure.repl/pst)
08:07lauriollasrm, this is the output: http://pastebin.com/20LVNC4a
08:16llasramlaurio: You've definitely got something weird going on with AOT. You said you did a `lein clean` already? Could you post your project file?
08:17llasramThe problem is that there's somehow an AOT-compiled version of clj-time.coerce on your classpath, and that AOT-compiled version is being loaded & expecting to find the AOT-compiled classes for clj-time.core, but they somehow are not there
08:21laurioI thik you are right, llasram - think i didn't have this issue yesterday.. will investigate further. Thanks a lot for the help!
08:43martinklepschI'm running a large-ish job on my macbook and would like to save the result directly to S3 — would I save that as a stream to S3 on the fly or would it be better to save it locally and then do a multipart upload to S3?
08:48martinklepschseems to me that stream uploading might be better since I don't know how big exactly the result is going to be and uploading can be started while it's still running
09:39justin_smithmartinklepsch left, but he should really just do multipart from a stream (and use a lib that supports that)
09:43lvhwhat's the good url parsing thing? https://github.com/michaelklishin/urly
09:43lvh?
09:59justin_smithif java.net.URL doesn't work for you, yeah, looks like urly is easier to use
09:59justin_smithI'm not sure what is best though, I have typically found java.net.URL to be good enough for my usage
10:06lvhjustin_smith: since Date I just kind of assume the java thing is terrible
10:06lvhjustin_smith: probably usually wrogn though :)
10:06justin_smithI have had no issues with URL
10:06virmundiHello. I'm new to Clojure in general. I'd like to web develop with it. I'm not sure what libs/frameworks are current. I want to use Ring as the core to replace adapter.jetty with Parallel Universe's COMSAT when it comes out. I want to use bootstrap with it. Not horribly familiar with that. Where should I start?
10:07llasramWell, the java.net.URL hashCode implementation requires network access
10:07llasramSo that's not good
10:07justin_smithvirmundi: you would make html that serves bootstrap, that part is identical regardless of the server you use
10:07llasramlvh: What's your particular use-case?
10:07lvhllasram: what? that's ridiculous!
10:08justin_smithllasram: huh, I never would have known - my entire app is dead in the water without network access :)
10:08lvhllasram: well, amongst other things randomly store stuff in hash maps ;)
10:08lvhjustin_smith: so's mine but that doesn't mean hashCode doing IO is acceptable :(
10:08justin_smithsure
10:08lvhllasram: I am parsing a URL and checking the scheme
10:08virmundijustin_smith: which frameworks support plugging into the bootstrap html? I'm use to the JSP/.NET fragment concepts.
10:09llasramlvh: If all your URLs are well-formed (and/or you can reject once which are not), then you can use the java.net.URI class
10:09justin_smithvirmundi: most people in clojure land don't use frameworks - we prefer small composible libs for the most part
10:09llasramIt's just a URI as a structured identifier, vs a handle to the representation of a resource the URL class tries to be
10:10lvhllasram: huh, interesting
10:10lvhllasram: my things are definitely UR*L*s though
10:10llasramAny URL is also a URI
10:10llasramURLs are the subset of URIs which also describe how to locate a representation of the identified resource
10:10virmundijustin_smith: that's a fair assessment. Is there a lib that supports that? My understanding is the noir and mustache are dead. Compojure looks to have a really steep learning curve.
10:10lvhsure; no problems with using the URI class :)
10:11Glenjamincompojure is pretty simple
10:11Glenjaminwhich is both a shallow and steep curve, dependning on what you're doing
10:11justin_smithvirmundi: compojure has nothing to do with bootstrap - it is simple, all it does is route requests to request handling functions
10:13justin_smithvirmundi: there are a few templating options, which is where the bootstrap integration would come in. For the caribou project (which is actually kind of a framework) we made a templating lib called antlers, which can use arbitrary helper functions embedded in the markup, and is similar to mustache.
10:14justin_smithbut I am sure you will get a bunch of other good templating recommendations
10:14justin_smithif the person making the templates knows clojure, enlive is great
10:14virmundiI'm looking at caribou now
10:14virmundithanks
10:15justin_smithwe made caribou as an in-house migration target from using ruby
10:15justin_smithso we wanted something that matched the RoR workflows as much as possible for our agency
10:15justin_smithbut it isn't neccessarily the best way to do a webapp in clojure
10:15justin_smiththat said, it makes it very easy to make a database backed dynamic site with a cms
10:18virmundijustin_smith: I'm trying to piecemeal my libs, as you said. I want to use arangodb for the backend. Ring/* for routing and a template engine for the view. Bootstrap is just to get a simple mobile site without having to work. I'm purposely trying to avoid dynatism in the site. Full page reloads and all that.
10:19justin_smithring doesn't do routing at all btw
10:19justin_smithit gives you a request as clojure data, some other code can use that for routing
10:20justin_smith(compojure for example, another alternative is caribou/polaris, there are other good ones too)
10:24virmundijustin_smith: so looking at polaris, it sits on Ring and provides routing; antler provides templating. But each is fairly independent. If I wanted to use Compojure I could with antler.
10:24virmundi?
10:24justin_smithabsolutely
10:24justin_smithor you could use polaris plus some other routing lib
10:24justin_smitherr. templating lib :)
10:25justin_smiththough in practice I have been able to antlers for templating, but also pass in some pre-rendered enlive generated html (effectively using both templating engines at once - it actually made things simpler in a couple cases, believe it or not)
10:26lvhhow do I figure out which exception prismatic/schema raises when validation fails? the traceback says ExceptionInfo Value does not match schema: (not (some (check % a-clojure.lang.PersistentHashMap) schemas)) schema.core/validate (core.clj:165)
10:26lvhis it an ExceptionInfo? that doesn't sound like an exception type
10:27justin_smithlvh: ExceptionInfo is used to pass extra data along with an exception
10:27lvhjustin_smith: right
10:27lvhjustin_smith: I'm writing a test though, and want to see that it fails
10:27justin_smithit could be that something you wanted to validate threw an exception and it's like "maybe we can validate the exception" then it's all like "nope"
10:27justin_smithjust speculating
10:28llasramlvh: Or to elaborate: it is an Exception subclass provided by Clojure as an alternative to the Java RuntimeException, allowing delivery of a map of additional information about the exception
10:28justin_smithlvh: are you using the thrown / thrown-with-error features of clojure.test?
10:28llasram,ex-info
10:28clojurebot#<core$ex_info clojure.core$ex_info@187514a>
10:28llasramEr
10:28llasram(doc ex-info)
10:28lvhjustin_smith: I'm trying to use thrown?, but it requires me to tell it which exception is thrown
10:28clojurebot"([msg map] [msg map cause]); Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data."
10:28lvhjustin_smith: so that's what I'm trying to discover :)
10:28justin_smithlvh: just give it Throwable
10:28justin_smithit's all subclasses of Throwable :)
10:29justin_smiththen you can check the actual class inside a catch on Throwable for example
10:29justin_smithbtw do not catch Throwable in real (non test) code, that is way too expansive
10:29lvhjustin_smith: I was hoping to discover the real class from the error :)
10:29llasramlvh: You know it -- ExceptionInfo
10:32lvhhuh, why isn't that available by default
10:32lvh Unable to resolve classname: ExceptionInfo
10:36johnwalkerjustin_smith: i might use caribou for my next project. it looks outstanding
10:38justin_smithjohnwalker: it's very big, but if you want a framework, it's definitely a framework
10:41johnwalkerit seems to have aws built in
10:42johnwalkeris there a lot involved in using other providers ?
10:42johnwalkerseems like this could be abstracted away with jclouds
10:51sdegutisarrdem: wow you're one for holding a grudge aren't you?
10:51sdegutisarrdem: look, your choice, but if I were you I'd give it up; grudges are poison
10:52justin_smithjohnwalker: I am sure it could be - I put aws in as an option because that was the service we used (so it is set to go for s3 / beanstalk / aws instance integration)
10:52sdegutisarrdem: anyway I done my apologizing, and I meant it sincerely; it's all on you now
10:52justin_smithjohnwalker: but I frequently talked about wanting something more general / openstack compatible. I am sure it would be possible.
10:53justin_smithjohnwalker: and further, if you have specific questions about how that would work, what the gotchas would be, feel free to contact me (I am noisesmith on github / caribou repo, or you can find me here)
10:53lvhI have a schema; I want RequestSpecs that are either SimpleRequests, or ordered collections of RequestSpecs, or unodered collections of RequestSpecs https://github.com/lvh/icecap/blob/master/src/icecap/schema.clj
10:53lvhit appears to work, but the error handling is not what I want it to be
10:55lvhhere's the github gist explaining why I'm unhappy: https://gist.github.com/lvh/f2d743b02c8cccd4410b
10:56mdeboardMELPA's down :(
10:56johnwalkerok, thanks :)
11:01clgvlvh: wild guess defrecord vs deftype/java class?
11:02lvhclgv: the code is here: it's just (def SimpleRequest {:target ... something} )
11:02lvherr, https://github.com/lvh/icecap/blob/master/src/icecap/schema.clj
11:02clgvlvh: ah wait I confused the camelcase name with classnames ;)
11:02lvhthere ^ ;)
11:02llasramlvh: Is that just the error you get when none of the cases match?
11:02lvhllasram: but the first case is supposed to match
11:02llasramOh, I see
11:03johnwalkermdeboard: melpa is up
11:03lvhllasram: and if I use a thing that does match, it works fine: (s/validate RequestSpec {:target "http://www.google.com&quot;})
11:03lvhso it is really the error case
11:03johnwalkeri'm using it now, and there have been no tears in #emacs
11:03lvhI just don't know why the error reporting is so bad
11:04llasramlvh: Wait, what -- no, it doesn't match the first case. The scheme is `ftp` still.
11:04mdeboardYeah melpa is up
11:04mdeboardI fail at the internet
11:04mdeboardI was typing .com
11:04johnwalkerahh
11:04lvhllasram: oh, derp
11:04johnwalker;)
11:04lvhllasram: right, so it doesn't match the first case
11:04llasramI agree the error could be better, but it can't give you anything terribly specific, because all it knows is none of them matched
11:05lvhllasram: I wish it could give the error messages for *why* it didn't match those cases though
11:05llasramlvh: But it could be a different reason for each case
11:07llasramIf you look at the code, the error means that the value being checked at that point was a map (it reports the type of the value the `either` failed to validate)
11:10hugodIs it possible to get a Var to pprint without its deref'ed value? i.e. #<Var@478f4a71> instead of #<Var@478f4a71: {:a :b}>
11:16lvhllasram: s/conditional apparently does more of what I want :)
11:18Bronsahugod: with-pprint-dispatch & defining a dispatch for Var
11:35AWizzArdI have those two files: src/footest/core.clj and test/test/footest/core.clj In my project.clj I want to specify :jar-exclusions so that the test/ folder will be excluded, but not the file in the src folder. #"test/" as arg fails. Ideas?
11:37AWizzArdWith #"test/(?=footest)" I was partially successful, but it still included the empty folder "test/" in the resulting .jar.
11:37hugodBronsa: thanks
11:40Bronsanp
12:07greghendershottIf Racket can pollinate Clojure (e.g. Typed Racket), what's the biggest to-do for the reverse? Clojure's immutable lazy collections?
12:08technomancygreghendershott: applicable associative data types
12:08technomancyand persistent vectors, I guess
12:09lvhI'm using prismatic/schema; (s/check RequestSpec []) ;; => [(not (present? "at least one"))]
12:09greghendershotttechnomancy: Also as I work on racket-mode I notice I have most of the same open items as you do, here: https://github.com/technomancy/dotfiles/blob/master/.gripes.org#racket :)
12:09lvhactually, writing it down made me figure it out.
12:09greghendershottThe ones not already addressed by rackjure ;)
12:10technomancygreghendershott: great minds think alike =D
12:10greghendershottArg lists, doc strings, doc sigs...
12:10lvhactually, wait, nope, that's still not it
12:10greghendershottThe good news is DrR is awesome. Maybe the only downside is there's been less motivation to make that stuff for 3rd party tooling. (Just my guess why)
12:10lvhis there an easy way to get... something.. that allows me to put that value in a test, without guesswork?
12:11technomancygreghendershott: it's a bit of a category killer
12:11technomancybut emacs will find a way
12:11greghendershottOh god, I'm sorry, I thought I was on the #racket channel.
12:11technomancy^ imagine that said in David Attenborough's accent
12:11lvh actual: (not (= [(not (present? "at least one"))] [(not (present? "at least one"))]))
12:11greghendershottI'm so sorry. Switching over.
12:11lvhnot the greatest error message :(
12:11technomancyit's cool; we're pro-racket here
12:12lvhegads; that is a ValidationError!
12:12TEttingergreghendershott: there's already clj data structures for racket
12:13greghendershottTEttinger: Where?
12:15TEttingergreghendershott, at least some are here https://github.com/technomancy/rackjure
12:15technomancyhehe
12:15technomancyTEttinger: that's a fork of greghendershott's lib =)
12:15TEttingerindeed!
12:15TEttingerI just saw
12:17vermahey guys, can anyone please review my mini blog post https://gist.github.com/verma/a15dea0689089e1287e3
12:19lvhOkay, so, I'm writing tests, and I want to compare the output of prismatic.schema.core.validate against something. How can I get the output of s/check in my test source?
12:19lvhIt looks something like: {:target (not ("supported-scheme?" "ftp://example.test"))}
12:20lvhquoting the list doesn't work.
12:23rweirclojre.test?
12:23lvhyeah
12:23lvhrweir: apparently it's an exception made to look like a map that doesn't really work like a map, or something
12:23rweiroh, that's the 'repr' of the exception?
12:26jakecraigeverma: Then only thing I notice off a quick look is that you just throw in route/resources "/" and route/not-found but don't mention them
12:26milos_co1agenverma: happy to give feedback but without knowing intended audience, it's hard. for now, mis-spelled convenience and json inconsistently capitalized.
12:28TEttingerjsON all the way
12:28milos_cohagenlol
12:29justin_smithTEttinger: differentiates it from its dual, jsOFF
12:30jakecraigehahah
12:31TEttingerjavascript? Old, Fugly, Fetid.
12:31milos_cohagenverma: i'd include some links / references to where some of the magic comes from.. eg the lein new template, the embedded jetty, maybe how to start/stop via repl, the middleware code, etc. so a reader can explore more.
12:34dnolen_core.async release today w/ cljs tranducers support
12:35tvanhensAnyone experienced with riddley or clojure.walker? I'm trying to make a function that transforms edn into a validation and I'm running into a bit of trouble
12:41mdeboardKind of random question, I thought nREPL was a general network protocol-type thing that was language agnostic
12:41mdeboardis that totally wrong?
12:42mgaarenot totally wrong, no. but I'm not aware of nrepl servers for any other language
12:44tvanhenshow could I convert all vectors in a nested data structure to lists?
12:44gfredericksclojure.walk/postwalk
12:45vermajakecraige, milos_cohagen thanks for the feedback :)
12:45gfrederickswith #(cond-> % (vector? %) (list*))
12:45tvanhensgiving it a go, had been trying with riddley before
12:45vermajakecraige, the route/resources stuff was generate by lein template stuff so I didn't think I need to explain that, but you're right, a little explanation won't hurt
12:46tvanhenswow, perfect thanks gfredericks
12:47vermamilos_cohagen, I will include some more links and some repl stuff as well. Thanks for catching typos, I guess the intended audience is beginner to intermediate level clojure people
12:53mdeboardmgaare: I'm interested in creating one
12:54mgaarefor which language?
13:18PigDudemgaare: erlang software runs from a networked repl
13:18PigDudemgaare: i'm sure there are others
13:19mdeboardmgaare: I had to restart my IRC bouncer, I missed any response you may have given
13:20mdeboardPigDude: Elixir is actually the language I'm asking about nREPL for
13:20mdeboardnot nREPL specifically, maybe, but just where to learn more
13:21mdeboardI'd like to have a `jack-in` command for elixir-mode
13:22technomancymdeboard: are you aware of distel?
13:23mdeboardtechnomancy: negative
13:23technomancymdeboard: supposedly it's possible to get emacs to speak the erlang distribution protocol natively
13:23mdeboardInteresting
13:24mdeboardhow does that help here? I'm clueless.
13:24mdeboardstarting from scratch here knowledge-wise
13:24PigDudemdeboard: I can't speak to elixir but it uses the erlang vm and creates beam files, so erlang emacs tooling should work
13:24justin_smithtechnomancy: btw, I saw your tweet about Midas Flesh, bought the bundle, found it to be excellent. Also the "ben franklinstein" gag from the bravest warriors comic in the bundle caused much amusement
13:24mdeboardPigDude: True, I guess I need to look into exactly what tooling they have.
13:24mdeboardfor emacs, that is.
13:25PigDudemdeboard: erlang provides an official emacs distribution
13:25mdeboardI am laboring under the impression that Clojure is kind of cutting edge on the integrated REPL/code evaluation front. Maybe I'm wrong
13:25PigDudemdeboard: http://www.erlang.org/doc/apps/tools/erlang_mode_chapter.html
13:25technomancyjustin_smith: the bundle is a bit intimidating; barely scratched the surface beyond midas =)
13:25PigDudemdeboard: as an end-user, it isn't particularly cutting edge, but i'm sure it has some nice things i don't notice
13:26mdeboardPigDude: It's cutting edge among the languages I use, anyway. I'm speaking specifically about emacs integration, not general tooling
13:27technomancymdeboard: afaict erlang's distribution protocol is more advanced than clojure's, but the repl-specific parts of it tend to be total junk
13:27mdeboardI see
13:28mdeboardI refactored elixir-mode very heavily yesterday and now I can worry about niceties like better REPL & code evaluation... instead of syntax highlighting & indentation.
13:29justin_smithtechnomancy: on linux, the "comix" program is handy, (if you use the cbz files)
13:29technomancyhttp://p.hagelb.org/antipathy.jpg <- re: the fact that erlang just yells at you when you do ctrl-d
13:29mdeboardlol
13:30PigDudei hope that isn't the part you think is total junk ...
13:30technomancyPigDude: no, just the highest wtf level due to the frustration:difficulty-to-fix ratio
13:31PigDudeheh
13:32mdeboardI actually don't even use Elixir at all now, I get way more satisfaction out of working on the language mode :P
13:32PigDudeTools Developer Problems
13:35justin_smithmdeboard: some kind of Monty Python skit "you want the elixer toolchain development toolchain developer, down the hall on the left, I am the elixer toolchain documentation toolchain developer"
13:35mdeboardhaha
13:36mdeboardI'm just waiting to find a project that's actually a good fit for OTP
13:36mdeboard"generic website" ain't it
13:36technomancydefinitely the hardest thing about learning erlang
13:36justin_smithjust think how many telephone line switchboards we could have by now if erlang was more popular, heh
13:37mdeboardI have a computer vision thing I think could be sped up via paralellization w/ Elixir
13:37mdeboardit would actually be a good fit too, I think
13:37mdeboardbut I know nothing
13:39splunkAnyone know any tools for unit testing that a function has reasonably constant memory usage, e.g. no head-holding?
13:41justin_smith,(. (Runtime/getRuntime) freeMemory) ; splunk - maybe this helps?
13:41clojurebot#<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>
13:41SegFaultAXIs there an easy way to override the formatter that c.j.jdbc uses for a specific type?
13:41SegFaultAXSpecifically, jodatime datetimes
13:42justin_smithsplunk: I would think you could check the freeMemory, run the code, then check that the delta in freeMemory is small enough?
13:43justin_smiththough you may also need to check availableMemory (to see if it bumped up the allocated size in the meantime)
13:48splunkjustin_smith: thanks
14:21TimMcI generally use WeakReference ot solve this problem.
14:21ahoenigmannif a function has this parameter list: [executor {:keys [fn interval]}]
14:21ahoenigmannwhat does it mean
14:21ahoenigmannit takes a executor yes
14:21justin_smithahoenigmann: that's a destructuring
14:22ahoenigmannbut {:keys [fn inteval]}
14:22TimMcIt's not guaranteed, but I've always been able to use it to demonstrate that an object is GC'able
14:22ahoenigmannthanks justin
14:22justin_smith,((fn [{:keys [:a :b]}] (+ a b)) {:a 40 :b 2})
14:22clojurebot42
14:23justin_smith,((fn [{:keys [a b]}] (+ a b)) {:a 40 :b 2}) ; identical, closer to your case
14:23clojurebot42
14:24ahoenigmannhmm not getting it
14:24justin_smiththe args to :keys are turned from keywords in the map, into bindings in the local scope
14:24gfredericksahoenigmann: do you know what [executor {fn :fn, interval :inteval}] means?
14:24gfrederickswithout the misspelling
14:24joshuafcoleahoenigmann: destructuring is a way of taking arguments in one form and converting them into an easier to use form.
14:25joshuafcoleninja'd
14:25justin_smithso {:keys [x y z]} is like (let [x (:x m) y (:y m) z (:z m)] ...) inside your function
14:25ahoenigmannok so keys will take the keys from the map passed in
14:25ahoenigmann:keys will return a list of keys
14:25justin_smithno
14:26justin_smithit's just a syntax for binding locals
14:26justin_smith(keys m) returns all keys
14:26justin_smithbut that's different
14:27gfredericks,(macroexpand '(fn [executor {:keys [fn interval]}] ...))
14:27clojurebot(fn* ([executor p__83] (clojure.core/let [{:keys [fn interval]} p__83] ...)))
14:27gfredericks,(macroexpand '(let [executor e {:keys [fn interval]} m] ...))
14:27clojurebot(let* [executor e map__108 m map__108 ...] ...)
14:27gfredericks,(macroexpand '(let [{:keys [fn interval]} m] ...))
14:27clojurebot(let* [map__133 m map__133 (if (clojure.core/seq? map__133) (clojure.lang.PersistentHashMap/create (clojure.core/seq map__133)) map__133) interval ...] ...)
14:27gfredericksgeez whiz.
14:28justin_smithyeah, the expansions don't help much here do they
14:28gfredericksI can map destructure any seq?
14:28gfredericks,(let [{:keys [x y z]} '(:x 7 :z 10)] [x y z])
14:28clojurebot[7 nil 10]
14:28gfredericksha
14:28justin_smithgfredericks: I guess that makes sense, for like & key args
14:28amalloygfredericks: yes, that's how & keys works
14:28gfredericksOH I SEE.
14:28amalloyyou're not really *supposed* to do it
14:29gfredericksso every map destructuring involves that check just in case
14:29amalloyyes
14:29gfredericksokay okay okay okay okay
14:30ahoenigmannok
14:30ahoenigmannseeing [fn through me off
14:30joshuafcoleMan. The more I learn the more I love macroexpand.
14:31ahoenigmannits not the same as (fn
14:31ahoenigmann(fn …
14:31gfredericksahoenigmann: yeah it coulda been [interval fn] and meant the same
14:31justin_smithyeah it is a confusing local binding name
14:31amalloyahoenigmann: yeah, i don't recommend using fn as the name of a local
14:31ahoenigmann:)
14:31amalloythen someone writes (fn x) and i'm like...augh, what is going on
14:31justin_smithit's more common to see f used (and then g for the next one)
14:32justin_smithso we can pretend we are doing math and shit
14:32gfredericksin this case it's the name of a key, so you have to destructure differently to name it something else
14:32ahoenigmannits a neat destructuring of being able to call a function on the destructed map
14:33gfrederickshuh?
14:33ahoenigmannThe fact that you can call :keys on the {}
14:34justin_smith:keys isn't a call there, it's a binding expression
14:34ahoenigmannah
14:35gfredericks,(let [{:fake []} {}] {})
14:35clojurebot{}
14:35gfredericks,(let [{:keys [x]} {:x 1}] x)
14:35clojurebot1
14:35gfredericks,(let [{:keyss [x]} {:x 1}] x)
14:35clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:36gfredericksI guess it's a difficult typo to make
14:36gfredericks(without noticing)
14:38pyrtsa,(let [x :foo, {:keyss [x]} {:x 1}] x) ;; Unless you tried to shadow previous bindings
14:38clojurebot:foo
14:38gfredericksyeah that's why it's not impossible :)
14:45amalloy&(let [{:keyss [x]} {:x 1}] x)
14:45lazybotjava.lang.Exception: Unsupported binding form: :keyss
14:45amalloyan unfortunate side effect of the change to namespaced-keys destructuring made in 1.6
14:45amalloyit used to be a typo that was impossible to make
14:46TimMcahoenigmann: (let [{:keys [a b]} m] ...) is macroexpanded to something like (let [val m, a (get val :a), b (get val :b)] ...)
14:48ahoenigmannis see
14:48ahoenigmanni see
14:49TimMcThe let macro uses the binding macro to do all the heavy lifting, there; the fn macro does the same thing.
14:50joshuafcole,#({:key %})
14:50clojurebot#<sandbox$eval26$fn__27 sandbox$eval26$fn__27@457235>
14:50joshuafcole,#(hash-map :key %)
14:50clojurebot#<sandbox$eval53$fn__54 sandbox$eval53$fn__54@1166179>
14:51TimMcahoenigmann: Err, rather, the destructure macro. Here it is: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4237
14:51amalloyTimMc: the destructure function
14:52TimMcOh, so it is!
14:52gfredericks,(let [{:x :x} {:x 1}] x)
14:52clojurebot1
14:52TimMcMakes sense.
14:52gfredericks&(let [{:x :x} {:x 1}] x)
14:52lazybotjava.lang.Exception: Unsupported binding form: :x
14:55amalloyTimMc: i said, bad change that got introduced in 1.6
14:55amalloyor, at least, good change with bad side effects
14:56amalloyit came along with the ability to
14:56amalloy,(let [{:keys [foo/bar]} {:foo/bar 1}] bar)
14:56clojurebot1
15:01TimMcI don't see how the :x thing works.
15:02amalloyTimMc: it calls clojure.core/name on the left-hand side of the pair
15:02amalloyso as to discard the namespace part
15:03amalloyand in doing so, fails to notice it was erroneously a keyword instead of a symbol
15:05TimMcOuch.
15:12amalloyTimMc: now, i hadn't actually looked at the code; i'm just presuming this based on its behavior. i'm looking now, and the code is hard to follow, but i see (cond ... (keyword? b) (-> bvec (conj (symbol (name b))) (conj v)))
15:35martinklepschI'm running a large-ish job on my macbook and would like to save the result directly to S3 — would I save that as a stream to S3 on the fly or would it be better to save it locally and then do a multipart upload to S3?
15:35martinklepschseems to me that stream uploading might be better since I don't know how big exactly the result is going to be and uploading can be started while it's still running
15:37hiredmanmartinklepsch: I would do something where you chunk up the stream as comes in and upload each chunk as an object to s3
15:40martinklepschhiredman: so sort of like partition-all the incoming sequence?
15:41justin_smithmartinklepsch: well, it won't be a sequence, it will be a byte stream right?
15:42akhudekmartinklepsch: consider what happens when your connection inevitably goes down for a moment
15:42martinklepschhiredman: when in general should one use regular put/stream uploading/multipart uploading? I don't fully understand except that multipart is resumable
15:42martinklepsch*understand the differences
15:42justin_smithmartinklepsch: stream and multipart are orthogonal
15:43justin_smithyou can do multipart stream or or you can do a file all in one put
15:44martinklepschjustin_smith: so when would you use what?
15:44justin_smithmultipart for things that are big or unknown total size
15:44justin_smithregular put for small things
15:45martinklepschah, I thought multipart would requrie the size to be known
15:45justin_smithno, the opposite in fact
15:45justin_smithfor a regular put, it complains if you do not specify a size
15:45justin_smithbut with multipart, all it needs to know is the chunk size
15:48martinklepschjustin_smith: ah thats cool. so mutlipart with clj-aws-s3 requires the uploaded object to be a java.io.File object
15:49justin_smithright - that's just a limitation in the wrapper lib
15:49justin_smithyou can use hiredman's lib, or mine, to get around that
15:49martinklepschjustin_smith: do I remember correctly that you forked it for that reason?
15:49justin_smithright
15:49justin_smithcaribou/clj-aws-s3
15:49martinklepschyeah, looked at hiredman ones
15:51justin_smithI actually implemented the feature because I was doing async upload (a resized image) where I did not want to wait until I knew the total size of the output image before uploading (and I didn't want to put it on disk either - I don't need it on local disk at all, I just want to put it on s3)
15:52justin_smithI may not have fully gotten the "upload bytes before image is done resizing" part working iirc, but I definitely got "upload without knowing the total size first, and without creating a file" working
16:08SagiCZ1hey guys do you know if the author of braveclojure.com is #clojure channel regular?
16:08justin_smithI know he posts on reddit/r/clojure
16:10SagiCZ1justin_smith: thanks
16:35SagiCZ1anyone using LightTable? just stumbled upon it..
16:38joegallodo you have a question about it, or are you just looking for a show of hands?
16:39SagiCZ1joegallo: i am looking for someone who uses it to tell me if its any good
16:39SagiCZ1joegallo: before i investigate more
16:41TEttingerSagiCZ1, I used it but never tried too hard to learn the intricacies
16:41TEttingerI ended up having an easier time learning in NightCode
16:41SagiCZ1TEttinger: NightCode?
16:42TEttingerhttps://nightcode.info/
16:42SagiCZ1looks reasonable
16:42SagiCZ1lighttable has the instant code eval.. not sure if i need it
16:43TEttingerI could never get it working
16:43TEttingerit seemed temperamental for Swing and other graphical apps
16:43TEttingernightcode has a repl in a pane at the botton
16:43TEttingerbottom
16:43clojurebotHuh?
16:43TEttingerand another to the side, actually
16:44SagiCZ1i see.. well so far i am using Cursive but its just a plugin which might be not-free in the future.. looks very similar to nightcode. also has REPL on the
16:44SagiCZ1bottom
16:45SagiCZ1btw are you happy with Paredit? i dont know how to learn it.. seems so alien to me
16:45amalloySagiCZ1: it took a little while to get used to, but it's hard to imagine living without it
16:45TEttingerI turned it off in nightcode, it's easy to switch
16:45TEttingeryou can turn it back on with a checkbox
16:45martinklepschhiredman: I'm giving your S3 lib a spin but running this https://gist.github.com/mklappstuhl/c5cfef977252455fefb9 results in a few 400 errors without much more information. is there any way to get more information out of it?
16:46SagiCZ1amalloy: so were you just trying really hard? or did you study some kind of tutorial? i will do anything to reduce keyboard to mouse transtitions
16:46SagiCZ1TEttinger: i see.. cool stuff.. i might give NightCode a shot then
16:46martinklepschSagiCZ1: I used lighttable for a few months and I think it's pretty awesome if you're starting out with clojure
16:47amalloySagiCZ1: i referred to the paredit cheat sheet a lot at first
16:47amalloy$google paredit cheat sheet
16:47lazybot[EmacsWiki: Paredit Cheatsheet] http://www.emacswiki.org/emacs/PareditCheatsheet
16:47SagiCZ1how is the integration of leiningen.. light table or night code both?
16:47hiredmanmartinklepsch: there is definitely more, you get a whole stacktrace (your paste is a partial stacktrace)
16:47SagiCZ1amalloy: ok that might be helpful, thank you for the link
16:47TEttingerSagiCZ1, yeah both are fully integrated to lein
16:48SagiCZ1TEttinger, i see
16:48SagiCZ1amalloy: wait and these are emacs commands?
16:48hiredmanmartinklepsch: likely you are using some tool that is hiding information about the exception in a misguided attempt to be friendly to beginners
16:48TEttingerI liked the rainbow parens option in lighttable, which isn't available in nightcode
16:48martinklepschhiredman: using cider in emacs & showed all frames
16:48amalloySagiCZ1: of course; paredit is an emacs mode
16:49TEttingerit's also the same in nightcode
16:49SagiCZ1amalloy: i know but its implemented into many other editors, such as nightcode or cursive
16:49amalloyif you're using some other implementation of paredit, the commands probably mostly exist but will have different bindings
16:49hiredmanmartinklepsch: but the message in the exception will tell you about the error from s3
16:49SagiCZ1amalloy: so they would be like keyboard shorcuts or something.. depending on the implementation
16:49TimMcSagiCZ1: Warning: Once you get used to paredit, it will be infuriating to try to write Clojure without it.
16:50TimMckind of a red pill sort of thing
16:50SagiCZ1TEttinger, rainbow parens are cool and all.. except it was quite a challenge to find enough colors i can safely distinguish... being colorblind and all... :D
16:50martinklepschhiredman: this is everything I've got in the stacktrace buffer: https://gist.github.com/mklappstuhl/6ce2a1f4caef0a2f6cc5
16:50SagiCZ1TimMc: you use paredit in emacs too?
16:50martinklepschdid I oversee something?
16:50TEttingerI type my parens with a weird stroke, shift 9 0, let go of shift, left arrow
16:51TEttingerand it's such a habit now
16:51amalloySagiCZ1: i don't really find rainbow parens very compelling. they make you focus on matching up the parens, when you really should be letting your editor deal with that and just pay attention to indentation
16:51amalloyTEttinger: i just type 9
16:51TEttinger9 or shift 9?
16:51amalloy(having remapped that key to produce the ( character)
16:51TEttingeroh ok
16:51SagiCZ1amalloy: well paren matching is a breeze with paredit right
16:52amalloySagiCZ1: sure. which is why you don't need rainbow parens
16:52SagiCZ1got it
16:52mgaarerainbow parens do make your source look a bit less monotonous at least
16:52TEttingeramalloy, heh you should see some of my code that DID need some visual indicator (it was terrible)
16:52SagiCZ1as i am typing without paredit i have the feeling there must be a better way
16:52hiredmanmartinklepsch: you need to get the contents of the body of the error
16:53hiredmanmartinklepsch: so *e in the repl will be the last uncaught exception
16:54hiredman(doc ex-info)
16:54clojurebot"([msg map] [msg map cause]); Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data."
16:54hiredman(-> *e ex-data :object :body slurp) or something like that
16:55martinklepschhiredman: oh! that perfectly shows me an error
16:55hiredmanlike magic
17:01martinklepschhiredman: hehe
17:07martinklepschIf I have a long lazy sequence and want to split that into chunks of bytes to upload them to S3, could I do this? I assume calling .getBytes on a lazy seq will first fully realize it? Should I use something like partition-all and call .getBytes on this?
17:08gfredericksit's a lazy sequence of what?
17:09martinklepschgfredericks: maps
17:10justin_smithso you want the pr-str representation of those maps?
17:10justin_smithor maybe json?
17:10martinklepschjustin_smith: pr-str
17:11martinklepschbut that would best come after the splitting, right?
17:11gfredericksdepends on what you're trying to split into
17:11gfrederickse.g., some max number of bytes?
17:12martinklepschgfredericks: Oh, right. For multipart uploading I'd need to split at exact bytes so splitting with partition-all is not really an option I guess
17:13justin_smithseems like you want something that takes a lazy seq of strings and turns it into an OutputStream
17:13justin_smithonce it's an OutputStream, the lib you are using can do the chunking part
17:14justin_smithI wonder if that function exists? if not you can likely make it via proxy or reify
17:15gfredericksare you sure an inputstream wouldn't work?
17:15justin_smiththe right way to make it of course would be so that it does not consume more of the lazy-seq coming in than is needed for the number of bytes read
17:15gfredericksbecause there is ##java.io.SequenceInputStream
17:15justin_smithgfredericks: sorry, I mean inputstream
17:15gfredericks,(def my-strs ["foo" "bar" "baz"])
17:15clojurebot#'sandbox/my-strs
17:16gfredericks,(def is (->> my-strs (map #(java.io.ByteArrayInputStream (.getBytes %))) (java.io.SequenceInputStream.)))
17:16clojurebot#<CompilerException java.lang.ClassCastException: Cannot cast clojure.lang.LazySeq to java.util.Enumeration, compiling:(NO_SOURCE_FILE:0:0)>
17:16gfredericks,(def is (->> my-strs (map #(java.io.ByteArrayInputStream (.getBytes %))) (clojure.lang.SeqEnumeration.) (java.io.SequenceInputStream.)))
17:16clojurebot#<CompilerException java.lang.reflect.InvocationTargetException, compiling:(NO_SOURCE_FILE:0:0)>
17:17justin_smithgfredericks: it takes a collection of inputstreams and returns their concatenation
17:17justin_smithso you probably need the string->stream conversion there too
17:17gfredericksI forgot a dot
17:17justin_smith(mapped)
17:17gfredericks,(def is (->> my-strs (map #(java.io.ByteArrayInputStream. (.getBytes %))) (clojure.lang.SeqEnumeration.) (java.io.SequenceInputStream.)))
17:17clojurebot#'sandbox/is
17:17gfredericks,(slurp is)
17:17clojurebot"foobarbaz"
17:17justin_smiththere we go
17:17justin_smith(inc gfredericks)
17:17lazybot⇒ 82
17:18martinklepschand so this is lazy?
17:18gfredericksshould be
17:19gfredericksbecause of map, SeqEnumeration, and SequenceInputStream all being lazy
17:19gfrederickslet's make an infinite one
17:19gfredericks,(def is (->> (range) (map str) (map #(java.io.ByteArrayInputStream. (.getBytes %))) (clojure.lang.SeqEnumeration.) (java.io.SequenceInputStream.)))
17:19clojurebot#'sandbox/is
17:20gfredericks,(-> is (clojure.java.io/reader) ((fn [r] (apply str (map char (repeatedly 20 #(.read r)))))))
17:20clojurebot"01234567891011121314"
17:20justin_smithyup, that would have hung if it wasn't lazy, I'd reckon
17:21gfredericks"(apply str (map char (repeatedly 20 #(.read r))))" rhymes a bit if you read it out loud
17:21ClariceOnly the char and r.
17:22martinklepschthats awesome
17:22martinklepschthanks gfredericks & justin_smith, would have probably taken me ages to figure that out :)
17:22gfredericksClarice: I'm looking forward to your better clojure poem
17:23Claricegfredericks: See you at the poetry slam later tonight
17:24justin_smithhttp://en.wikipedia.org/wiki/Shakespeare_(programming_language) why not use this instead of clojure
17:25justin_smiththe hello world is awesome http://en.wikipedia.org/wiki/Shakespeare_(programming_language)#Example_code
17:26justin_smith"Thou art as disgusting as the quotient between Romeo and twice the
17:26justin_smithdifference between a mistletoe and an oozing infected blister! Speak
17:26justin_smithyour mind!" <- that statement has arithmatic and IO in it
17:34ahoenigmannin emacs how do you get start a new clojure project?
17:34ahoenigmannI would like the path to get: cider repl + all files in project loaded + paredit mode started on all .clj buffers
17:35justin_smith(add-hook 'clojure-mode-hook 'paredit-mode) ; for the paredit part
17:36justin_smithfor the rest, I typically just open one of the files in the project, and then run jack-in, then open others as I need them
17:37afhammadin core.asyc, when do you use a (put! c "hello") vs (go (!> c "hello")) ?
17:37justin_smithahoenigmann: you can use speedbar, but you have to configure speedbar to pay attention to .clj files (it ignores them by default)
17:38justin_smiththat's done by setting speedbar-show-unknown-files to a truthy value
17:39ahoenigmannspeedbar looks cool kind of sublime like
17:39justin_smithit's much older, and a bit weird
17:39justin_smithbut it works, if you want a file tree kind of thing
17:39martinklepschone last question :) is there anything specific I need to be aware of when splitting up a SequenceInputStream or do I just use partition-all kinda like this to get 5mb chunks? (map #(apply str %) (partition-all (* 5 1024 1024) (repeat "xxx ")))
17:39justin_smithfor some modes, it gives clickable targets for individual functions
17:40justin_smithI don't know if there is anything that intigrates that with clojure awareness so you could get hyperlinks to jump to def / defn though
17:40justin_smithmartinklepsch: don't partition it, let the uploader partition the bytes itself, it will take as many bytes from your stream as it likes at a time
17:41martinklepschjustin_smith: in propS3t?
17:41justin_smithit should - or do you have to do that part manually?
17:42justin_smithclj-aws-s3 does the chunking, you just tell it how big the chunks would be
17:42justin_smithif you have to create the chunks yourself, definitely don't use partition, just read the amount of bytes you need for each chunk into a byte array or whatever the lib expects
17:42martinklepschjustin_smith: I think in propS3t you need to write parts manually
17:43justin_smithOK. so like I said, don't use partition.
17:44justin_smithmartinklepsch: unless I am misreading the code, you should just pass the stream to write part
17:45justin_smithwrite-part will read as much of the stream as it needs
17:45justin_smithand streams are stateful
17:45justin_smithso just repeatedly call write-part until the stream has no more data left to give you
17:45justin_smiththen call end-multipart
17:46martinklepschjustin_smith: write-part is done manually in the tests or am I misreading that? https://github.com/hiredman/propS3t/blob/master/test/propS3t/test/core.clj
17:47justin_smithyes, you need to call it manually, unless he has a higher level function that abstracts over the multi-part process
17:47martinklepschah, yeah, got it
17:47justin_smiththis is all done auto-magically in clj-aws-s3 - you give it a stream and a chunk size, it does the rest
17:48justin_smithalso, mind that each call to write-part returns a "part", and you need to keep those "parts" as a sequence to pass to end-multipart
17:48justin_smiththough the test probably makes that clear
17:48martinklepschjustin_smith: yeah, saw that
17:48martinklepschmaybe I'll play with clj-aws-s3 again as well
17:49martinklepschIt's sort of surprising that there is no de-facto S3 lib out there
17:52ahoenigmannso i just added a new dependency in the project.clj
17:52ahoenigmannis there any way to pull it in from with emacs? or do I have to do lein ....
17:53justin_smithyou can add new deps without restarting if you use alembic/still
17:53justin_smithotherwise, you need to restart your repl
17:53ahoenigmannwhat is that?
17:53justin_smith(or use pomegranate, but alembic is much easier)
17:53justin_smithit's a lib that adds deps at runtime
17:53justin_smithincluding reloading your project.clj to add new deps
17:53ahoenigmannwhoa
17:54justin_smithor just finding and loading arbitrary whatever into your repl
17:54ahoenigmannthe tooling is harder than the language x10
17:54justin_smithhttps://github.com/pallet/alembic
17:54ahoenigmannthanks
17:54justin_smithahoenigmann: easier - how many other languages give you reliable per-project dep management?
17:54ahoenigmannhmm ok
17:54justin_smithand reliable deployment to an environment with exactly the deps you have locally
17:55justin_smithit's not hard, it is just different
17:55justin_smithbut it's much better
17:55ahoenigmanndoes restarting/starting a cider repl jack in download dependencies?
17:55justin_smithsure, if you have new ones
17:55justin_smithbut you can also use alembic, as I mentioned
17:57justin_smithI think clojure tooling is harder if you expect it to act like tooling does in other languages. But if you let it be what it is, in the long term you realize it's much better.
18:05turbofaili dunno i found the clojure tooling way simpler than all the other tooling i'd used previously
18:05brand0same, I really like it
18:06justin_smithahoenigmann: it sounds like you are new to emacs? if so that may be the extra complexity
18:06justin_smithemacs is definitely weird
18:08martinklepsch+1 on finding clojure tooling good (esp. lein)
18:11shanemhansenemacs and cider-jack-in are a revelation.
18:12brand0now if oxcart would just hurry up ....
18:12shanemhansenBut not necessarily the simplest thing to learn.
18:17gfredericks(inc justin_smith) ;; for shakespeare PL
18:17lazybot⇒ 60
18:17danielcomptonThere was a time when I'd use alembic so infrequently that I had to look up the docs every time I needed to use it, but now it's a daily tool for me
18:18danielcomptonIs there an emacs equivalent of https://github.com/blog/1877-folder-jumping ?
18:18martinklepschshanemhansen: lighttable makes you not even need to think about that sort of stuff
18:19danielcomptonmartinklepsch: The last time I used light table with beginners it was easy to start them but every now and then they would run into a weird bug and the simplest solution was to just tell them to restart it
18:19joshuafcoleYeah
18:19joshuafcolewell, it's open sourced now
18:19joshuafcoleSo I can track down the bugs when I run into them
18:20justin_smithdanielcompton: in dired, you can hit the "i" key while the cursor is on a directory to expand it inline
18:20joshuafcolebut it's still kind of wild west, versus the polish of time on the more venerable editors of yore
18:20martinklepschI agree that you might want to try emacs+cider later though, but for beginners things are incredibly simple with lighttable. I mean even with ruby, python and other kind of beginner friendly languages it's not that simple
18:20justin_smithdanielcompton: not as automatic and convenient, but reaches a similar end
18:20martinklepschgood night everyone!
18:20joshuafcoleciao
18:20danielcomptonjustin_smith: that's pretty cool
18:22justin_smithdanielcompton: yeah, I had to figure out a project with an extremely hairy directory structure (where for each feature I had to change a template, some js, and some backend controller code, and each was under a totally separate path), and that feature was a total gamechanger
18:22justin_smithI was just lucky I didn't need to update the css too...
18:24danielcomptonjustin_smith: sounds painful
18:24justin_smithyeah, but being able to expand things inline in dired made it at least possible
18:25justin_smithalso, of course, it was one of those file-heirarchy heavy projects where an overdone OO inheritance tree like thing is modeled using dirs and subdirs
18:25justin_smithwaaaaay over-engineered
18:31ThinkRusty87If anyone needs help with anything let me know.
18:40CaptainLexI seem to be having an issue where Compojure is munging special characters
18:41justin_smithin the body?
18:42justin_smithor wait, you said compojure, so you mean routing strings are being munged?
18:42justin_smithbecause that would make sense, it should be a valid URL after all
18:43CaptainLexjustin_smith: Maybe I'm misunderstanding what Compojure is doing. I mean special characters in the body
18:43justin_smithOK, that would be ring
18:43CaptainLexOh okay thanks
18:43CaptainLexSo I guess
18:43justin_smithfirst off, check that your content types are right all around
18:43CaptainLexRing is munging special characters :)
18:43CaptainLexOkay, one moment
18:43justin_smithie. are you setting the right character encoding on your requests
18:45CaptainLexChrome says text/html
18:46justin_smithcharacter encoding?
18:46CaptainLex(For the record, I've tried replacing the special characters with their HTML encondings to the same effect)
18:46CaptainLexI'll check the template
18:46CaptainLexone moment
18:47CaptainLexThe charset in the meta is utf-8, if that was what you meant
18:47justin_smithCaptainLex: oh, and just to be clear - is it the data going from server to browser that is corrupted, or coming back?
18:47justin_smithCaptainLex: yeah, sorry, I had the wrong term
18:48CaptainLexjustin_smith: No worries. These are characters that are in raw HTML.
18:48CaptainLexI've tested the various enlive functions so I know the characters are still valid after that stage
18:48justin_smithso is it getting corrupted in the server->browser direction or in the browser->server direction?
18:48CaptainLexserver->browser
18:48justin_smithOK
18:48justin_smithyou may want to check what the result looks like in curl
18:49CaptainLexHmmmm
18:49CaptainLexgood idea!
18:49justin_smithto rule out weird behavior in the browser
18:49justin_smithand simplify verifying the actual data going through
18:49CaptainLexWell, actually
18:49CaptainLexwoops!
18:49justin_smith?
18:49jumblemuddleAnyone around here worked with titanium? If so, do I need to get a titan server up and running, which it connect to, or does it do that itself? Also, do I need to choose which storage backend to use? Right now embeded-cassandra looks the best.
18:50CaptainLexI forgot that last time I debugged this issue (some months ago, and then I put thew project on hold)
18:50CaptainLexI figured out my console didn't display those characters either
18:50CaptainLexI could redirect curl though
18:50CaptainLexI'll do that
18:50justin_smithor wget
18:50justin_smithsee if it looks right in your $EDITOR
18:50justin_smithemacs has rest-client-mode which lets you specify a request and then see the reply below it
18:51justin_smith(it's a package you can install)
18:51justin_smithit could also be that you are telling the other end that it is utf8, but ring is creating some other content-type
18:52CaptainLexjustin_smith: I guess it's a browser thing! I curled > test.txt and open that in Geany and it worked
18:52CaptainLexLemme test Firefox
18:52justin_smithwhat does Geany think the encoding of the file is?
18:52justin_smithor does it have an option to show you that
18:53justin_smiththe linux "file" utility should also show you encoding
18:54CaptainLexI wasn't able to read that setting, but I was able to tell it to use UTF-8 and it didn't break it
18:54CaptainLexOooh I'll try that
18:54danielszmulewiczAm I killing my 1gig VPS with 5 JVM instances?
18:54justin_smithCaptainLex: I think I misremembered that actually
18:55danielszmulewiczIt looks like starting one instance kills another one. Is that even possible?
18:55CaptainLexjustin_smith: the output of running file actually did tell me an enconding
18:55justin_smithdanielszmulewicz: I am sure it could handle 500 simultaneous helloworld.java instances
18:55justin_smithCaptainLex: ahh, I must have double checked on the wrong file here :)
18:55CaptainLexISO-8859
18:56justin_smithso yeah, you need to tell your ring adaptor that you want to send utf8, or tell the client you are sending ISO-8859
18:56danielszmulewiczjustin_smith: Good to know. I must look elsewhere then. I don't get it.
18:57justin_smithdanielszmulewicz: that was sort of a joke - point being, what you are running matters more than whether it is jvm or not
18:57CaptainLexjustin_smith: Thanks! I'll look into it
18:57justin_smithCaptainLex: unless you are serving mostly Chinese text or something, utf8 will likely be your best option
18:58danielszmulewiczjustin_smith: Fair enough.
18:58justin_smithI mean what can you know without profiling all the apps?
18:59Jaooddanielszmulewicz: five lein repls will definite kill it ;)
18:59danielszmulewiczjustin_smith: I suck at devops. What tool should I use to measure memory on my VPS and get a picture of how much mem each instance uses?
18:59justin_smithdanielszmulewicz: I like htop, for real time monitoring at least
18:59justin_smithdanielszmulewicz: you can get snapshots using ps
18:59danielszmulewiczJaood: Yeah. Lein is a beast. But I'm running the standalone jars.
19:00amalloydanielszmulewicz: if you start up 5 JVMs without doing any configuration of them, then yeah, that probably takes up more than 1g
19:00danielszmulewiczMy instances are your typical ring web applications. Nothing fancy.
19:00justin_smithdanielszmulewicz: also, since we are using uberjars, you can get really good profiling data locally using something like jvisualvm or yourkit, and it should mostly reflect the behavior online (modulo load)
19:00amalloybut you should tell the jvm not to use more than X amount of memory, which for a simple ring webapp can be just a couple dozen megs
19:01danielszmulewiczamalloy: Should I use a small maximum heap setting (XmX)?
19:01amalloyyes. -Xmx40m is reasonable for a simple webapp
19:01amalloyi think that's what lazybot has. maybe he has 60m these days. either way it's more than he really needs
19:06danielszmulewicz(inc amalloy)
19:06lazybot⇒ 160
19:06danielszmulewicz(inc justin_smith )
19:06lazybot⇒ 3
19:07justin_smiththat makes three times someone has added an extraneous space after my name in an inc
19:09TEttinger(inc justin_smith)
19:09lazybot⇒ 61
19:12cbp(inc)
19:13justin_smith(inc ✈)
19:13lazybot⇒ 1
19:17technomancyis clojure-doc.org's vim coverage good? http://clojure-doc.org/articles/tutorials/vim_fireplace.html
19:25technomancygfredericks: hey, what's your favourite joke library?=
19:26technomancybesides lein-lein
19:26technomancy(or anyone really)
19:27mdeboardSorry but programming is a very serious matter
19:27mdeboardI do not download or even talk about "joke" libraries
19:27amalloytechnomancy: https://github.com/mattdiamond/fuckitjs ?
19:28technomancyamalloy: sorry, has to be a clj lib that I can use from a trivial web app
19:28technomancyoh, maybe that kebab snake one
19:28amalloycamel snake kebab
19:28technomancymmmm delicious https://github.com/qerub/camel-snake-kebab
19:28justin_smithhttps://github.com/rodnaph/clj-php (more for the concept than the execution, which I am ignorant of)
19:28joshuafcoleThere isn't a fuckit.cljs yet?
19:28joshuafcoleIf not we should get on that.
19:28mdeboardI started to but I was like
19:28mdeboard"fuck it"
19:28joshuafcole:)
19:28justin_smithclearly fuckit.hs would be the best
19:29joshuafcoleHonestly, you should probably just bootstrap it
19:29jumblemuddleLet me know when you've got it finished. I'd be happy to use it... :)
19:29joshuafcoleget it close enough to working and then run it on itself until it's "good"
19:29justin_smitha "guess what I mean and suppress errors" haskell extension, who would not love that
19:29joshuafcole"guess what I mean"? Whoah, fuckit.xyz doesn't /care/ what you mean. It just wants the compiler/runtime checker to shut up.
19:30justin_smithheh
19:30amalloyjustin_smith: i dunno, i think it would go the opposite direction. fuckitjs works because that's the javascript mindset. a haskell version would take the opposite approach: "this code looks a little weird. maybe it would compile if i tried, but...fuck it, let's throw a type error"
19:31justin_smithfile doesn't end with a newline? type error
19:31joshuafcolehaha
19:31justin_smithmixed tabs and spaces? type error
19:31amalloyexactly
19:31justin_smithI love it
19:31bridgethillyertechnomancy: on clojure-doc.org’s vim coverage: I just reviewed it quickly
19:31joshuafcoleDon't stop there!
19:31joshuafcoleterribly cliche variable names?
19:31bridgethillyerIt’s not perfect, but it’s generally accurate based on my quick read
19:32joshuafcoleShadowing of any variable names?
19:32joshuafcole:P
19:32justin_smithjoshuafcole: variables with more than one letter in the name: type error
19:32technomancybridgethillyer: thanks!
19:32joshuafcoleThough, now it's getting complex. Maybe just throw a type error on anything that's not "Hello World" to be safe.
19:33justin_smithbbl
19:33joshuafcoleciao
19:33bridgethillyersure thing. Now that I have done that, I’d like to go back and review it for current accuracy. Thanks for the inspiration
19:37aperiodictechnomancy: re: joke libraries: https://github.com/fxn/i-told-you-it-was-private
19:40xeqiharsh
19:41joshuafcoleIt might seem harsh, but down the road of projects like this and fuckit lies the zen of 0 sloc
19:43technomancyaperiodic: <3
19:50gfrederickstechnomancy: is system-slash-exit a joke?
19:50gfredericksI also have https://github.com/gfredericks/flexnum but it's rubby
19:50gfrederickskind of surprised that one doesn't have a readme
19:51gfredericksneeds an example of truncating your database table via MyModel.all.length.zero!
19:58danielcomptonDoes Spring qualify as a joke library?
20:00mdeboardzing
20:00mdeboardice cold, sick burn
20:07taliosdanielcompton - surely you mean scala
20:07danielcomptonIs that a gas torch from a flame war starting up that I hear?
20:17danielcomptontechnomancy: have things like esk-cleanup-buffer been moved to another emacs package now that emacs-starter-kit has been sort of deprecated?
20:25amalloyesk sounds like some kind of fantastical forest creature
20:27blimpsIf I evaluate "(and true true)" I get "true", but if try "((fn [& x] (and x)) true true)" I get "(true true)". What's happening here?
20:28Bronsa,((fn [& x] x) 1 2 3)
20:28clojurebot(1 2 3)
20:28Bronsa,((fn [a b & x] x) 1 2 3)
20:28clojurebot(3)
20:28Bronsa,((fn [a b & x] [a b x]) 1 2 3 4)
20:28clojurebot[1 2 (3 4)]
20:30danielcomptonwhile not strictly a joke library, https://github.com/ztellman/proteus has a funny readme
20:33Bronsa"That's it. That's the end of the library." Just imagine if there was more to it
20:35tuftany idea how this could possibly come up? java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$vector
20:35tuft,(seq [1 2 3])
20:35clojurebot(1 2 3)
20:35justin_smithtuft: seq knows how, the jvm doesn't I guess?
20:35aperiodictuft: I think it's saying it doesn't know how to make a seq from that function
20:35amalloy,(seq vector)
20:35clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$vector>
20:35justin_smithahh
20:35tuftahh i see, thanks
20:36blimpsOk, I think I see what you're saying. How could I get a function to apply "and" to an argument list resulting from "&"?
20:37tuftjust needed a ->> instead of -> =)
20:37AimHereblimps, sadly, 'and' and 'or' are macros, so you can't.
20:38amalloyAimHere: well, it's not exactly "sadly". the point is you're supposed to use a function that operates on a list, such as `every?` or `some`
20:38blimpsYeah, I just read about that. Is there some sort of workaround for this sort of situation?
20:39AimHereYou could write some sort of function that does the same job - even a mere wrapper around 'and' would do
20:40justin_smithamalloy: is there an alternative to every? that returns the last arg like and would?
20:40justin_smithof course that would be easy to write...
20:40amalloyAimHere: that function already exists. it is every?. you do not want to wrap and
20:41gfredericks,(every? inc [1 2 3])
20:41clojurebottrue
20:41gfrederickser nm
20:41justin_smith,(and 1 2 3)
20:41clojurebot3
20:41gfredericksI thought he meant like some
20:41justin_smith,(every? identity [1 2 3])
20:41clojurebottrue
20:41brehaut,(and 4)
20:41clojurebot4
20:42amalloyjustin_smith: i mean, i guess you could do it. there's not much point; i don't imagine you want to get the last answer very often, when you've got a list of arbitrary size
20:42brehaut,(+ 4)
20:42clojurebot4
20:42amalloy,(partial 4)
20:42clojurebot4
20:42brehauthmm i thought suffusion of yellow occured with results greater than 3?
20:42brehaut,(+ 1 2)
20:42clojurebot3
20:42amalloy(+ 2 2)
20:42clojurebot4
20:42brehaut,(+ 1 2 3)
20:42clojurebot6
20:42justin_smithamalloy: I often use and in cases where I only want to use the last value if the preceding are all truthy
20:42brehautnow its just being devious
20:42amalloybrehaut: he doesn't mess with results of actual eval requests starting with ,
20:43brehaut(+ 1 2 3)
20:43clojurebot*suffusion of yellow*
20:43amalloyhe has/had some joke responses if you tried to use him for math without starting with ,
20:43brehautamalloy: aha
20:43brehautamalloy: for some reason i thought it was a both situation
20:43gfredericksjustin_smith: do you have an example use case with a non-static set of things?
20:43amalloyjustin_smith: sure, and that's very common. but that was a fixed set of tests/values
20:43amalloywith a list that you get from somewhere else? it's not at all common
20:44justin_smithright, with varargs thats a bit weirder, yeah
20:44gfredericksclojurebot: amalloy |says| your use case is contrived.
20:44clojurebotYou don't have to tell me twice.
20:44amalloy(inc gfredericks) ; very good
20:44lazybot⇒ 83
20:45amalloyi look forward to the roulette of ~amalloy generating things i don't remember saying
20:45amalloy~amalloy
20:45clojurebotamalloy was right again in a blazing show of total predictability
20:45Bronsahah
20:45joshuafcole_bahaha
20:45justin_smith~amalloy
20:45clojurebotamalloy has an (obsessive) posse
20:46amalloyhuh, i don't even remember that one
20:46gfredericksyour posse does
20:47amalloylazybot doesn't have it anywhere in his logs. i wonder if someone taught clojurebot that via pm
20:47gfredericksit feels familiar to me; maybe only because it's randomly come up before
20:47amalloyoh, no, i see
20:47amalloyi forgot it would look like |has| in the logs
20:47justin_smithgfredericks: the intersection of posse commitatus and the insane clown posse is the empty posse
20:48amalloyllasram taught him in june
20:48amalloyhttp://logs.lazybot.org/irc.freenode.net/%23clojure/2014-06-20.txt
20:49amalloygfredericks was apparently the posse member in question
20:49blimpsOk, I was about to do what I needed with some and every? Thanks. :)
20:50blimpsable to, that is
20:50gfredericksthat was back in the day when amalloy would sometimes use the same string of words twice in one day just to see what would happen
20:51xeqimust be an imposter
20:52BronsaI can never remember teh order of args to isa?/instance?
20:52Bronsathe*
20:53justin_smithgourd?
20:53PigDudeBronsa: the solution is clearly `infix`
20:53aperiodic~gourds
20:53justin_smithas in pumpkins and such?
20:53clojurebotSQUEEZE HIM!
20:53gfredericksaperiodic: PHEW
20:54gfredericksthat was exactly what I wanted to do and now it is done.
20:54aperiodicI got your back
20:54gfredericks(inc aperiodic) ;; back possession
20:54lazybot⇒ 8
20:54amalloyreminds me of the classic gourdian knot
20:55Bronsa,(isa? String Object)
20:55clojurebottrue
20:55Bronsa,(instance? Object String)
20:55clojurebottrue
20:55Bronsathis doesn't help
20:56amalloyman, http://en.wikipedia.org/wiki/Gordian_Knot is an amazingly bad description of the myth
20:57amalloyi guess the words are all there, it's just weirdly abrupt
23:24mdeboardwith nREPL, am I understanding correct that the "cider-jack-in" buffer is sending forms to be evaluated out to the socket over which it is communicating with the nREPL server?
23:24mdeboardand then the server is doing the computation, and responding with the result?
23:25Jaoodyes, its a server-client model
23:25Jaoodcider is an nrepl client just like the lein repl is too
23:25mdeboardYeah, I just put 2 and 2 together about what exactly the traffic is between the two. In hindsight it's obvious
23:27mdeboardOh wow Github just pushed a really nice UI/UX improvement live
23:27mdeboardlets you skip over empty directories
23:28mdeboardhttps://github.com/clojure/tools.nrepl/tree/master/src/main
23:28ClariceDefine "just"
23:28mdeboardidk, in the past 24 hours
23:28ClariceOh
23:28ClariceYes, I see what you're saying
23:28mdeboardmaybe sooner
23:28ClariceThat's niiiiiifty
23:29mdeboardyarly
23:46ClariceHow are clojure vectors constant time if they're represented by tries?
23:48mdeboardClarice: What do you mean by "how are they constant time"? What operations do you mean?
23:48ClariceGetting the value at an index.
23:48mdeboard(I do not know right off the top of my head which ops are O(1))
23:48ClariceI imagine that becomes a pointer chasing exercise for values near the tail of the vector
23:49danielcomptonWhat's the difference between comp and -> ?
23:49Claricedanielcompton: One is the composition of two or more functions.
23:50Claricedanielcompton: which returns a new function. The other is a macro which operates on forms and pipelines the results.
23:50danielcomptonClarice: where could you use one but not the other?
23:51Claricedanielcompton: I encourage you to macroexpand -> and see what you get
23:51mdeboardClarice: I don't kow the answer to your question but I'd guess it has some kind of hashmap like {idx: val} no?
23:52Claricemdeboard: That defeats the purpose of structure sharing.
23:53Claricedanielcompton: (-> x (form) (form) (form)) is essentially the same as (apply (compose f f f f) x). But they're slightly different.
23:53danielcomptonClarice: hmm, think I'm getting it
23:54Claricedanielcompton: You'd use compose if you want to talk about "the function you get when you compose these other functions". You want to use -> when you want to describe a pipeline process.
23:54mdeboardwouldn't the hashmap of positions also be updated when the vector is "updated"
23:54Claricedanielcompton: Have you used F#? There's a |> operator, which basically means "take whatever's on the left and shove it as the input of the function on the right." -> does the same thing, but as a macro and by rearranging the list structure of your code.
23:54mdeboardI'm talking out of my ass for the most part.
23:55mdeboards/ for the most part.//
23:55danielcomptonClarice: never used F# but it makes sense
23:55reiClarice: I believe it's just due to really shallow tries, but this post may explain it better. http://hypirion.com/musings/understanding-persistent-vector-pt-1
23:56Claricerei: Oh! I remember bookmarking that and never getting around to reading it. Thank you for reminding me it exists.