2014-08-19
| 00:01 | andrewchambers | greenznc: |
| 00:02 | andrewchambers | I dont understand why you are sending and reading from same coroutine |
| 00:02 | greenznc | andrewchambers, I'm new to core.async |
| 00:02 | greenznc | why not the same (go)? |
| 00:03 | andrewchambers | I haven't really used it. But... if its an unbuffered channel i dont understand how that can work |
| 00:03 | andrewchambers | since it will send then pause waiting for someone to recieve |
| 00:04 | andrewchambers | trying reading from 1 go, and sending from another go andsee what happens |
| 00:05 | greenznc | andrewchambers, it still alerts six times |
| 00:06 | greenznc | quite strange |
| 00:06 | andrewchambers | xD im confused as to how it alerted one time |
| 00:06 | andrewchambers | haha |
| 00:06 | andrewchambers | I dont have clojure setup on this machine otherwise i'd try it out xD |
| 00:07 | greenznc | well there's a site called cljsfiddle |
| 00:08 | greenznc | andrewchambers, http://cljsfiddle.net/ |
| 00:08 | greenznc | no more setup |
| 00:08 | andrewchambers | does that have core.async ? |
| 00:09 | greenznc | yes |
| 00:09 | clojurebot | Huh? |
| 00:13 | andrewchambers | greenznc: server doesnt seem to be working |
| 00:14 | greenznc | andrewchambers, what do you mean by 'server'? |
| 00:14 | andrewchambers | well, the ckjsfiddle run button does nothing |
| 00:14 | andrewchambers | thats all i mean |
| 00:15 | greenznc | mine works |
| 00:15 | andrewchambers | must be my version of firefox |
| 00:17 | andrewchambers | greenznc: http://pastebin.com/4Z0fTVNu |
| 00:17 | andrewchambers | i was just gonna try that and see what hapens |
| 00:18 | andrewchambers | hopefully i havent made an error, since i havent checked it |
| 00:18 | andrewchambers | oh yup i made a bunch |
| 00:19 | andrewchambers | http://pastebin.com/wfmEXugm |
| 00:19 | greenznc | let me see |
| 00:21 | andrewchambers | core.async is pretty sweet when i understood how it works |
| 00:21 | andrewchambers | I think its alot simpler than some of the tutorials made it seem |
| 00:22 | greenznc | andrewchambers, it calls those three times which is correct |
| 00:22 | andrewchambers | I just took your code |
| 00:22 | andrewchambers | hmm |
| 00:22 | greenznc | but I have no idea what's wrong with my code |
| 00:23 | andrewchambers | if you print in your doseq |
| 00:24 | andrewchambers | does it print 3 times or 6 times? |
| 00:24 | andrewchambers | thats my question haha |
| 00:24 | andrewchambers | btw, im not sure if that code is a memory leak, it might be. Since the while true loop never terminates |
| 00:25 | andrewchambers | after the first 3 sends |
| 00:25 | andrewchambers | it will just sit there forever |
| 00:26 | greenznc | andrewchambers, I know it |
| 00:26 | andrewchambers | cool |
| 00:26 | andrewchambers | :P let me know if you work out why its sending 6 times haha |
| 00:27 | andrewchambers | im curious now |
| 00:27 | andrewchambers | maybe your code is just running twice |
| 00:27 | greenznc | in the future I'd love to re-queue timeout-ed requests |
| 00:27 | andrewchambers | is it in your top level? |
| 00:27 | andrewchambers | or you just copied out of a function |
| 00:28 | greenznc | no, in an om's (will-mount []) component |
| 00:28 | greenznc | I meant in an compont's will-mount |
| 00:29 | andrewchambers | yeah i understood that |
| 00:29 | andrewchambers | I dunno, i think the code is just running twice for some reason |
| 00:30 | andrewchambers | but 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:30 | andrewchambers | and by block, i mean cause the javascript to idle or whatever. |
| 00:32 | greenznc | andrewchambers, I move the code to the top level and it works as expected |
| 00:32 | andrewchambers | must just be called twice |
| 00:33 | greenznc | yup |
| 00:33 | andrewchambers | cool, now work out how om works :P |
| 00:33 | andrewchambers | hehe |
| 00:33 | greenznc | well, I execute the component twice for experiment purpose |
| 00:34 | greenznc | and forget it XD |
| 00:34 | andrewchambers | lol |
| 00:34 | andrewchambers | hmm, put! might not actually block ever |
| 00:34 | andrewchambers | according to the docs |
| 00:34 | andrewchambers | im not sure |
| 00:34 | andrewchambers | :P |
| 00:34 | andrewchambers | i dont know how much space there is in a default chan |
| 00:35 | greenznc | I'm thinking of how to close the channel when three requests are complete |
| 00:36 | greenznc | andrewchambers, any suggestions? |
| 00:36 | andrewchambers | just send :done |
| 00:36 | andrewchambers | or something |
| 00:36 | andrewchambers | then terminate loop |
| 00:36 | greenznc | but how to figure out all of them are complete? |
| 00:37 | andrewchambers | oh, i understand |
| 00:37 | greenznc | count them and store somewhere? |
| 00:38 | greenznc | or is there any existing mechanism? |
| 00:38 | andrewchambers | hmm |
| 00:38 | andrewchambers | well you know how many you expect |
| 00:39 | andrewchambers | because of the length of the map |
| 00:39 | andrewchambers | so you could replace the while true |
| 00:39 | andrewchambers | with a loop / recur |
| 00:39 | andrewchambers | where you decrement a value |
| 00:39 | andrewchambers | until it hits zero |
| 00:39 | greenznc | andrewchambers, yeah |
| 00:39 | greenznc | many thanks |
| 00:40 | andrewchambers | yeah, you might need code to handle if there is an error |
| 00:40 | andrewchambers | but i suppose an error can just be passed through |
| 00:40 | andrewchambers | in :status or whatever |
| 00:41 | andrewchambers | I want to build something with core.async and om |
| 00:42 | andrewchambers | seems really powerful |
| 02:23 | rei | If 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:25 | amalloy | rei: huh? |
| 02:28 | rei | amalloy: 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:28 | rei | I'm trying to find the most idiomatic way of doing that. |
| 02:31 | amalloy | okay, 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:31 | lazybot | ⇒ {:y 3, :x 2} |
| 02:36 | rei | amalloy: It took me a minute to wrap my head around it. Yes, that seems not only ideal but reusable. |
| 02:36 | rei | I didn't think to be able to list off keypaths, as you've declared them. |
| 02:48 | amalloy | rei: 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:07 | rei | amalloy: 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:07 | rei | But it worked like a charm. |
| 04:35 | zanes | technomancy: Would you advise against using Robert Hooke at this point? |
| 05:52 | lvh | Hi :) |
| 05:53 | lvh | I 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:54 | lvh | I was wondering if there's any tools for actually checking that based on a declarative description of what it looks like |
| 05:54 | lvh | I know of prismatic/schema, and typed clojure |
| 05:54 | lvh | also, importantly, these specs will be stored (they're immutable) and then read/executed later |
| 05:55 | lvh | so it's important that I can verify them separately from actually running the code that uses them |
| 05:55 | lvh | (because it has side effects) |
| 05:55 | lvh | (does that make any sense?) |
| 05:57 | llasram | If they're just data, then I believe you can use prismatic schema |
| 05:57 | llasram | I've only played with it, but that's what it does -- verify some data matches an expected structure |
| 05:58 | llasram | They 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:14 | spradnyesh | what is "Ljava.io.PrintStream" in "ClassCastException java.io.PrintStream cannot be cast to [Ljava.io.PrintStream" |
| 06:14 | llasram | spradnyesh: array of PrintStreams |
| 06:15 | llasram | You'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:16 | spradnyesh | llasram: where can i find documentation to understand more about it? and thanks for the help :) |
| 06:18 | llasram | Good question. The official documentation doesn't seem to cover it. |
| 06:18 | llasram | Here'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:20 | llasram | I 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:20 | spradnyesh | llasram: thanks for the pointer; i'll go through it |
| 06:20 | llasram | Not optimal, but there you go |
| 06:21 | spradnyesh | i (mildly put) don't like Java. but in my current project am forced to use a java lib (not on clojars :( ) |
| 06:24 | llasram | Well at least (hopefully) beats needing to re-write the features of the library yourself from scratch |
| 06:25 | spradnyesh | agreed |
| 06:25 | spradnyesh | how can i add java-source to project so that i can "jump-to-source" (from emacs + cider) on exception? |
| 06:47 | kitallis | does '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:47 | kitallis | :test {:env {:database-url-foo "jdbc:postgres://localhost/test"}}} |
| 07:24 | spradnyesh | kitallis: try https://github.com/weavejester/environ |
| 07:29 | laurio | I'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:29 | laurio | e.coerce])) |
| 07:29 | laurio | Is there an easy workaround? |
| 07:30 | drbobbeaty | laurio: Look at the ":exclusions" in the leiningen project file. That might help you. |
| 07:31 | drbobbeaty | laurio: 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:32 | laurio | I 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:32 | Bronsa | laurio: I don't see what joda-time has to do with that error |
| 07:32 | laurio | amazonica and clj_time both depend on joda-time library |
| 07:32 | Bronsa | laurio: try to replace your require line with (:require [clj-time] [cljs-time.coerce]) |
| 07:34 | Bronsa | laurio: 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:37 | drbobbeaty | laurio: When you do a 'lein deps :tree' - does it have any suggestions at the top about conflicts in the dependencies? |
| 07:41 | laurio | drbobbeaty, unfortunately 'lein deps :tree' doesn't seem to suggest about any conflicts |
| 07:42 | hyPiRion | laurio: ah, that's problematic. Which version of clj-time are you using? |
| 07:43 | drbobbeaty | laurio: 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:43 | laurio | hyPiRion, [clj-time "0.8.0"] |
| 07:43 | laurio | Tried with lower versions also but this issue remained |
| 07:44 | hyPiRion | laurio: 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:46 | laurio | hyPiRion, [clj-time "[0.8.0]"] didn't help. here is the `lein deps :tree` output: [amazonica "0.2.24" :exclusions [[joda-time]]] |
| 07:46 | laurio | [com.amazonaws/amazon-kinesis-client "1.1.0"] |
| 07:46 | laurio | [com.amazonaws/aws-java-sdk "1.8.5"] |
| 07:46 | laurio | [com.fasterxml.jackson.core/jackson-annotations "2.1.1"] |
| 07:46 | laurio | [com.fasterxml.jackson.core/jackson-core "2.1.1"] |
| 07:48 | drbobbeaty | laurio: there should be an entry for clj-time in the output - I don't see it... |
| 07:50 | laurio | drbobbeauty, probably the text was too long - the relevant part is: [clj-time "0.8.0"] [joda-time "2.3"] |
| 07:52 | drbobbeaty | laurio: 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:52 | llasram | laurio: Generally for pasting in content longer than one line it's best to use a paste site, such as refheap.com |
| 07:55 | laurio | thanks, llasram, I'll send a link instead next time |
| 07:56 | drbobbeaty | laurio: The 'lein deps :tree' should have reported the conflict in the different versions of joda-time. |
| 07:56 | llasram | Nah, they've got an exclusion |
| 07:57 | llasram | But 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:57 | llasram | laurio: Could you refheap a full exception |
| 07:57 | llasram | + stacktrace of what you see when you get your error? |
| 07:58 | laurio | llasram, how can I print that? |
| 07:59 | llasram | Oh, are you just getting the exception in your REPL, w/ no stack trace? |
| 07:59 | llasram | If so, try: (clojure.repl/pst) |
| 08:07 | laurio | llasrm, this is the output: http://pastebin.com/20LVNC4a |
| 08:16 | llasram | laurio: 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:17 | llasram | The 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:21 | laurio | I thik you are right, llasram - think i didn't have this issue yesterday.. will investigate further. Thanks a lot for the help! |
| 08:43 | martinklepsch | I'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:48 | martinklepsch | seems 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:39 | justin_smith | martinklepsch left, but he should really just do multipart from a stream (and use a lib that supports that) |
| 09:43 | lvh | what's the good url parsing thing? https://github.com/michaelklishin/urly |
| 09:43 | lvh | ? |
| 09:59 | justin_smith | if java.net.URL doesn't work for you, yeah, looks like urly is easier to use |
| 09:59 | justin_smith | I'm not sure what is best though, I have typically found java.net.URL to be good enough for my usage |
| 10:06 | lvh | justin_smith: since Date I just kind of assume the java thing is terrible |
| 10:06 | lvh | justin_smith: probably usually wrogn though :) |
| 10:06 | justin_smith | I have had no issues with URL |
| 10:06 | virmundi | Hello. 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:07 | llasram | Well, the java.net.URL hashCode implementation requires network access |
| 10:07 | llasram | So that's not good |
| 10:07 | justin_smith | virmundi: you would make html that serves bootstrap, that part is identical regardless of the server you use |
| 10:07 | llasram | lvh: What's your particular use-case? |
| 10:07 | lvh | llasram: what? that's ridiculous! |
| 10:08 | justin_smith | llasram: huh, I never would have known - my entire app is dead in the water without network access :) |
| 10:08 | lvh | llasram: well, amongst other things randomly store stuff in hash maps ;) |
| 10:08 | lvh | justin_smith: so's mine but that doesn't mean hashCode doing IO is acceptable :( |
| 10:08 | justin_smith | sure |
| 10:08 | lvh | llasram: I am parsing a URL and checking the scheme |
| 10:08 | virmundi | justin_smith: which frameworks support plugging into the bootstrap html? I'm use to the JSP/.NET fragment concepts. |
| 10:09 | llasram | lvh: 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:09 | justin_smith | virmundi: most people in clojure land don't use frameworks - we prefer small composible libs for the most part |
| 10:09 | llasram | It's just a URI as a structured identifier, vs a handle to the representation of a resource the URL class tries to be |
| 10:10 | lvh | llasram: huh, interesting |
| 10:10 | lvh | llasram: my things are definitely UR*L*s though |
| 10:10 | llasram | Any URL is also a URI |
| 10:10 | llasram | URLs are the subset of URIs which also describe how to locate a representation of the identified resource |
| 10:10 | virmundi | justin_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:10 | lvh | sure; no problems with using the URI class :) |
| 10:11 | Glenjamin | compojure is pretty simple |
| 10:11 | Glenjamin | which is both a shallow and steep curve, dependning on what you're doing |
| 10:11 | justin_smith | virmundi: compojure has nothing to do with bootstrap - it is simple, all it does is route requests to request handling functions |
| 10:13 | justin_smith | virmundi: 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:14 | justin_smith | but I am sure you will get a bunch of other good templating recommendations |
| 10:14 | justin_smith | if the person making the templates knows clojure, enlive is great |
| 10:14 | virmundi | I'm looking at caribou now |
| 10:14 | virmundi | thanks |
| 10:15 | justin_smith | we made caribou as an in-house migration target from using ruby |
| 10:15 | justin_smith | so we wanted something that matched the RoR workflows as much as possible for our agency |
| 10:15 | justin_smith | but it isn't neccessarily the best way to do a webapp in clojure |
| 10:15 | justin_smith | that said, it makes it very easy to make a database backed dynamic site with a cms |
| 10:18 | virmundi | justin_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:19 | justin_smith | ring doesn't do routing at all btw |
| 10:19 | justin_smith | it gives you a request as clojure data, some other code can use that for routing |
| 10:20 | justin_smith | (compojure for example, another alternative is caribou/polaris, there are other good ones too) |
| 10:24 | virmundi | justin_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:24 | virmundi | ? |
| 10:24 | justin_smith | absolutely |
| 10:24 | justin_smith | or you could use polaris plus some other routing lib |
| 10:24 | justin_smith | err. templating lib :) |
| 10:25 | justin_smith | though 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:26 | lvh | how 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:26 | lvh | is it an ExceptionInfo? that doesn't sound like an exception type |
| 10:27 | justin_smith | lvh: ExceptionInfo is used to pass extra data along with an exception |
| 10:27 | lvh | justin_smith: right |
| 10:27 | lvh | justin_smith: I'm writing a test though, and want to see that it fails |
| 10:27 | justin_smith | it 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:27 | justin_smith | just speculating |
| 10:28 | llasram | lvh: 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:28 | justin_smith | lvh: are you using the thrown / thrown-with-error features of clojure.test? |
| 10:28 | llasram | ,ex-info |
| 10:28 | clojurebot | #<core$ex_info clojure.core$ex_info@187514a> |
| 10:28 | llasram | Er |
| 10:28 | llasram | (doc ex-info) |
| 10:28 | lvh | justin_smith: I'm trying to use thrown?, but it requires me to tell it which exception is thrown |
| 10:28 | clojurebot | "([msg map] [msg map cause]); Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data." |
| 10:28 | lvh | justin_smith: so that's what I'm trying to discover :) |
| 10:28 | justin_smith | lvh: just give it Throwable |
| 10:28 | justin_smith | it's all subclasses of Throwable :) |
| 10:29 | justin_smith | then you can check the actual class inside a catch on Throwable for example |
| 10:29 | justin_smith | btw do not catch Throwable in real (non test) code, that is way too expansive |
| 10:29 | lvh | justin_smith: I was hoping to discover the real class from the error :) |
| 10:29 | llasram | lvh: You know it -- ExceptionInfo |
| 10:32 | lvh | huh, why isn't that available by default |
| 10:32 | lvh | Unable to resolve classname: ExceptionInfo |
| 10:36 | johnwalker | justin_smith: i might use caribou for my next project. it looks outstanding |
| 10:38 | justin_smith | johnwalker: it's very big, but if you want a framework, it's definitely a framework |
| 10:41 | johnwalker | it seems to have aws built in |
| 10:42 | johnwalker | is there a lot involved in using other providers ? |
| 10:42 | johnwalker | seems like this could be abstracted away with jclouds |
| 10:51 | sdegutis | arrdem: wow you're one for holding a grudge aren't you? |
| 10:51 | sdegutis | arrdem: look, your choice, but if I were you I'd give it up; grudges are poison |
| 10:52 | justin_smith | johnwalker: 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:52 | sdegutis | arrdem: anyway I done my apologizing, and I meant it sincerely; it's all on you now |
| 10:52 | justin_smith | johnwalker: but I frequently talked about wanting something more general / openstack compatible. I am sure it would be possible. |
| 10:53 | justin_smith | johnwalker: 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:53 | lvh | I 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:53 | lvh | it appears to work, but the error handling is not what I want it to be |
| 10:55 | lvh | here's the github gist explaining why I'm unhappy: https://gist.github.com/lvh/f2d743b02c8cccd4410b |
| 10:56 | mdeboard | MELPA's down :( |
| 10:56 | johnwalker | ok, thanks :) |
| 11:01 | clgv | lvh: wild guess defrecord vs deftype/java class? |
| 11:02 | lvh | clgv: the code is here: it's just (def SimpleRequest {:target ... something} ) |
| 11:02 | lvh | err, https://github.com/lvh/icecap/blob/master/src/icecap/schema.clj |
| 11:02 | clgv | lvh: ah wait I confused the camelcase name with classnames ;) |
| 11:02 | lvh | there ^ ;) |
| 11:02 | llasram | lvh: Is that just the error you get when none of the cases match? |
| 11:02 | lvh | llasram: but the first case is supposed to match |
| 11:02 | llasram | Oh, I see |
| 11:03 | johnwalker | mdeboard: melpa is up |
| 11:03 | lvh | llasram: and if I use a thing that does match, it works fine: (s/validate RequestSpec {:target "http://www.google.com"}) |
| 11:03 | lvh | so it is really the error case |
| 11:03 | johnwalker | i'm using it now, and there have been no tears in #emacs |
| 11:03 | lvh | I just don't know why the error reporting is so bad |
| 11:04 | llasram | lvh: Wait, what -- no, it doesn't match the first case. The scheme is `ftp` still. |
| 11:04 | mdeboard | Yeah melpa is up |
| 11:04 | mdeboard | I fail at the internet |
| 11:04 | mdeboard | I was typing .com |
| 11:04 | johnwalker | ahh |
| 11:04 | lvh | llasram: oh, derp |
| 11:04 | johnwalker | ;) |
| 11:04 | lvh | llasram: right, so it doesn't match the first case |
| 11:04 | llasram | I 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:05 | lvh | llasram: I wish it could give the error messages for *why* it didn't match those cases though |
| 11:05 | llasram | lvh: But it could be a different reason for each case |
| 11:07 | llasram | If 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:10 | hugod | Is it possible to get a Var to pprint without its deref'ed value? i.e. #<Var@478f4a71> instead of #<Var@478f4a71: {:a :b}> |
| 11:16 | lvh | llasram: s/conditional apparently does more of what I want :) |
| 11:18 | Bronsa | hugod: with-pprint-dispatch & defining a dispatch for Var |
| 11:35 | AWizzArd | I 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:37 | AWizzArd | With #"test/(?=footest)" I was partially successful, but it still included the empty folder "test/" in the resulting .jar. |
| 11:37 | hugod | Bronsa: thanks |
| 11:40 | Bronsa | np |
| 12:07 | greghendershott | If Racket can pollinate Clojure (e.g. Typed Racket), what's the biggest to-do for the reverse? Clojure's immutable lazy collections? |
| 12:08 | technomancy | greghendershott: applicable associative data types |
| 12:08 | technomancy | and persistent vectors, I guess |
| 12:09 | lvh | I'm using prismatic/schema; (s/check RequestSpec []) ;; => [(not (present? "at least one"))] |
| 12:09 | greghendershott | technomancy: 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:09 | lvh | actually, writing it down made me figure it out. |
| 12:09 | greghendershott | The ones not already addressed by rackjure ;) |
| 12:10 | technomancy | greghendershott: great minds think alike =D |
| 12:10 | greghendershott | Arg lists, doc strings, doc sigs... |
| 12:10 | lvh | actually, wait, nope, that's still not it |
| 12:10 | greghendershott | The 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:10 | lvh | is there an easy way to get... something.. that allows me to put that value in a test, without guesswork? |
| 12:11 | technomancy | greghendershott: it's a bit of a category killer |
| 12:11 | technomancy | but emacs will find a way |
| 12:11 | greghendershott | Oh god, I'm sorry, I thought I was on the #racket channel. |
| 12:11 | technomancy | ^ imagine that said in David Attenborough's accent |
| 12:11 | lvh | actual: (not (= [(not (present? "at least one"))] [(not (present? "at least one"))])) |
| 12:11 | greghendershott | I'm so sorry. Switching over. |
| 12:11 | lvh | not the greatest error message :( |
| 12:11 | technomancy | it's cool; we're pro-racket here |
| 12:12 | lvh | egads; that is a ValidationError! |
| 12:12 | TEttinger | greghendershott: there's already clj data structures for racket |
| 12:13 | greghendershott | TEttinger: Where? |
| 12:15 | TEttinger | greghendershott, at least some are here https://github.com/technomancy/rackjure |
| 12:15 | technomancy | hehe |
| 12:15 | technomancy | TEttinger: that's a fork of greghendershott's lib =) |
| 12:15 | TEttinger | indeed! |
| 12:15 | TEttinger | I just saw |
| 12:17 | verma | hey guys, can anyone please review my mini blog post https://gist.github.com/verma/a15dea0689089e1287e3 |
| 12:19 | lvh | Okay, 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:19 | lvh | It looks something like: {:target (not ("supported-scheme?" "ftp://example.test"))} |
| 12:20 | lvh | quoting the list doesn't work. |
| 12:23 | rweir | clojre.test? |
| 12:23 | lvh | yeah |
| 12:23 | lvh | rweir: apparently it's an exception made to look like a map that doesn't really work like a map, or something |
| 12:23 | rweir | oh, that's the 'repr' of the exception? |
| 12:26 | jakecraige | verma: 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:26 | milos_co1agen | verma: happy to give feedback but without knowing intended audience, it's hard. for now, mis-spelled convenience and json inconsistently capitalized. |
| 12:28 | TEttinger | jsON all the way |
| 12:28 | milos_cohagen | lol |
| 12:29 | justin_smith | TEttinger: differentiates it from its dual, jsOFF |
| 12:30 | jakecraige | hahah |
| 12:31 | TEttinger | javascript? Old, Fugly, Fetid. |
| 12:31 | milos_cohagen | verma: 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:34 | dnolen_ | core.async release today w/ cljs tranducers support |
| 12:35 | tvanhens | Anyone 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:41 | mdeboard | Kind of random question, I thought nREPL was a general network protocol-type thing that was language agnostic |
| 12:41 | mdeboard | is that totally wrong? |
| 12:42 | mgaare | not totally wrong, no. but I'm not aware of nrepl servers for any other language |
| 12:44 | tvanhens | how could I convert all vectors in a nested data structure to lists? |
| 12:44 | gfredericks | clojure.walk/postwalk |
| 12:45 | verma | jakecraige, milos_cohagen thanks for the feedback :) |
| 12:45 | gfredericks | with #(cond-> % (vector? %) (list*)) |
| 12:45 | tvanhens | giving it a go, had been trying with riddley before |
| 12:45 | verma | jakecraige, 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:46 | tvanhens | wow, perfect thanks gfredericks |
| 12:47 | verma | milos_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:53 | mdeboard | mgaare: I'm interested in creating one |
| 12:54 | mgaare | for which language? |
| 13:18 | PigDude | mgaare: erlang software runs from a networked repl |
| 13:18 | PigDude | mgaare: i'm sure there are others |
| 13:19 | mdeboard | mgaare: I had to restart my IRC bouncer, I missed any response you may have given |
| 13:20 | mdeboard | PigDude: Elixir is actually the language I'm asking about nREPL for |
| 13:20 | mdeboard | not nREPL specifically, maybe, but just where to learn more |
| 13:21 | mdeboard | I'd like to have a `jack-in` command for elixir-mode |
| 13:22 | technomancy | mdeboard: are you aware of distel? |
| 13:23 | mdeboard | technomancy: negative |
| 13:23 | technomancy | mdeboard: supposedly it's possible to get emacs to speak the erlang distribution protocol natively |
| 13:23 | mdeboard | Interesting |
| 13:24 | mdeboard | how does that help here? I'm clueless. |
| 13:24 | mdeboard | starting from scratch here knowledge-wise |
| 13:24 | PigDude | mdeboard: I can't speak to elixir but it uses the erlang vm and creates beam files, so erlang emacs tooling should work |
| 13:24 | justin_smith | technomancy: 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:24 | mdeboard | PigDude: True, I guess I need to look into exactly what tooling they have. |
| 13:24 | mdeboard | for emacs, that is. |
| 13:25 | PigDude | mdeboard: erlang provides an official emacs distribution |
| 13:25 | mdeboard | I am laboring under the impression that Clojure is kind of cutting edge on the integrated REPL/code evaluation front. Maybe I'm wrong |
| 13:25 | PigDude | mdeboard: http://www.erlang.org/doc/apps/tools/erlang_mode_chapter.html |
| 13:25 | technomancy | justin_smith: the bundle is a bit intimidating; barely scratched the surface beyond midas =) |
| 13:25 | PigDude | mdeboard: as an end-user, it isn't particularly cutting edge, but i'm sure it has some nice things i don't notice |
| 13:26 | mdeboard | PigDude: It's cutting edge among the languages I use, anyway. I'm speaking specifically about emacs integration, not general tooling |
| 13:27 | technomancy | mdeboard: afaict erlang's distribution protocol is more advanced than clojure's, but the repl-specific parts of it tend to be total junk |
| 13:27 | mdeboard | I see |
| 13:28 | mdeboard | I refactored elixir-mode very heavily yesterday and now I can worry about niceties like better REPL & code evaluation... instead of syntax highlighting & indentation. |
| 13:29 | justin_smith | technomancy: on linux, the "comix" program is handy, (if you use the cbz files) |
| 13:29 | technomancy | http://p.hagelb.org/antipathy.jpg <- re: the fact that erlang just yells at you when you do ctrl-d |
| 13:29 | mdeboard | lol |
| 13:30 | PigDude | i hope that isn't the part you think is total junk ... |
| 13:30 | technomancy | PigDude: no, just the highest wtf level due to the frustration:difficulty-to-fix ratio |
| 13:31 | PigDude | heh |
| 13:32 | mdeboard | I actually don't even use Elixir at all now, I get way more satisfaction out of working on the language mode :P |
| 13:32 | PigDude | Tools Developer Problems |
| 13:35 | justin_smith | mdeboard: 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:35 | mdeboard | haha |
| 13:36 | mdeboard | I'm just waiting to find a project that's actually a good fit for OTP |
| 13:36 | mdeboard | "generic website" ain't it |
| 13:36 | technomancy | definitely the hardest thing about learning erlang |
| 13:36 | justin_smith | just think how many telephone line switchboards we could have by now if erlang was more popular, heh |
| 13:37 | mdeboard | I have a computer vision thing I think could be sped up via paralellization w/ Elixir |
| 13:37 | mdeboard | it would actually be a good fit too, I think |
| 13:37 | mdeboard | but I know nothing |
| 13:39 | splunk | Anyone know any tools for unit testing that a function has reasonably constant memory usage, e.g. no head-holding? |
| 13:41 | justin_smith | ,(. (Runtime/getRuntime) freeMemory) ; splunk - maybe this helps? |
| 13:41 | clojurebot | #<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)> |
| 13:41 | SegFaultAX | Is there an easy way to override the formatter that c.j.jdbc uses for a specific type? |
| 13:41 | SegFaultAX | Specifically, jodatime datetimes |
| 13:42 | justin_smith | splunk: I would think you could check the freeMemory, run the code, then check that the delta in freeMemory is small enough? |
| 13:43 | justin_smith | though you may also need to check availableMemory (to see if it bumped up the allocated size in the meantime) |
| 13:48 | splunk | justin_smith: thanks |
| 14:21 | TimMc | I generally use WeakReference ot solve this problem. |
| 14:21 | ahoenigmann | if a function has this parameter list: [executor {:keys [fn interval]}] |
| 14:21 | ahoenigmann | what does it mean |
| 14:21 | ahoenigmann | it takes a executor yes |
| 14:21 | justin_smith | ahoenigmann: that's a destructuring |
| 14:22 | ahoenigmann | but {:keys [fn inteval]} |
| 14:22 | TimMc | It's not guaranteed, but I've always been able to use it to demonstrate that an object is GC'able |
| 14:22 | ahoenigmann | thanks justin |
| 14:22 | justin_smith | ,((fn [{:keys [:a :b]}] (+ a b)) {:a 40 :b 2}) |
| 14:22 | clojurebot | 42 |
| 14:23 | justin_smith | ,((fn [{:keys [a b]}] (+ a b)) {:a 40 :b 2}) ; identical, closer to your case |
| 14:23 | clojurebot | 42 |
| 14:24 | ahoenigmann | hmm not getting it |
| 14:24 | justin_smith | the args to :keys are turned from keywords in the map, into bindings in the local scope |
| 14:24 | gfredericks | ahoenigmann: do you know what [executor {fn :fn, interval :inteval}] means? |
| 14:24 | gfredericks | without the misspelling |
| 14:24 | joshuafcole | ahoenigmann: destructuring is a way of taking arguments in one form and converting them into an easier to use form. |
| 14:25 | joshuafcole | ninja'd |
| 14:25 | justin_smith | so {:keys [x y z]} is like (let [x (:x m) y (:y m) z (:z m)] ...) inside your function |
| 14:25 | ahoenigmann | ok so keys will take the keys from the map passed in |
| 14:25 | ahoenigmann | :keys will return a list of keys |
| 14:25 | justin_smith | no |
| 14:26 | justin_smith | it's just a syntax for binding locals |
| 14:26 | justin_smith | (keys m) returns all keys |
| 14:26 | justin_smith | but that's different |
| 14:27 | gfredericks | ,(macroexpand '(fn [executor {:keys [fn interval]}] ...)) |
| 14:27 | clojurebot | (fn* ([executor p__83] (clojure.core/let [{:keys [fn interval]} p__83] ...))) |
| 14:27 | gfredericks | ,(macroexpand '(let [executor e {:keys [fn interval]} m] ...)) |
| 14:27 | clojurebot | (let* [executor e map__108 m map__108 ...] ...) |
| 14:27 | gfredericks | ,(macroexpand '(let [{:keys [fn interval]} m] ...)) |
| 14:27 | clojurebot | (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:27 | gfredericks | geez whiz. |
| 14:28 | justin_smith | yeah, the expansions don't help much here do they |
| 14:28 | gfredericks | I can map destructure any seq? |
| 14:28 | gfredericks | ,(let [{:keys [x y z]} '(:x 7 :z 10)] [x y z]) |
| 14:28 | clojurebot | [7 nil 10] |
| 14:28 | gfredericks | ha |
| 14:28 | justin_smith | gfredericks: I guess that makes sense, for like & key args |
| 14:28 | amalloy | gfredericks: yes, that's how & keys works |
| 14:28 | gfredericks | OH I SEE. |
| 14:28 | amalloy | you're not really *supposed* to do it |
| 14:29 | gfredericks | so every map destructuring involves that check just in case |
| 14:29 | amalloy | yes |
| 14:29 | gfredericks | okay okay okay okay okay |
| 14:30 | ahoenigmann | ok |
| 14:30 | ahoenigmann | seeing [fn through me off |
| 14:30 | joshuafcole | Man. The more I learn the more I love macroexpand. |
| 14:31 | ahoenigmann | its not the same as (fn |
| 14:31 | ahoenigmann | (fn … |
| 14:31 | gfredericks | ahoenigmann: yeah it coulda been [interval fn] and meant the same |
| 14:31 | justin_smith | yeah it is a confusing local binding name |
| 14:31 | amalloy | ahoenigmann: yeah, i don't recommend using fn as the name of a local |
| 14:31 | ahoenigmann | :) |
| 14:31 | amalloy | then someone writes (fn x) and i'm like...augh, what is going on |
| 14:31 | justin_smith | it's more common to see f used (and then g for the next one) |
| 14:32 | justin_smith | so we can pretend we are doing math and shit |
| 14:32 | gfredericks | in this case it's the name of a key, so you have to destructure differently to name it something else |
| 14:32 | ahoenigmann | its a neat destructuring of being able to call a function on the destructed map |
| 14:33 | gfredericks | huh? |
| 14:33 | ahoenigmann | The fact that you can call :keys on the {} |
| 14:34 | justin_smith | :keys isn't a call there, it's a binding expression |
| 14:34 | ahoenigmann | ah |
| 14:35 | gfredericks | ,(let [{:fake []} {}] {}) |
| 14:35 | clojurebot | {} |
| 14:35 | gfredericks | ,(let [{:keys [x]} {:x 1}] x) |
| 14:35 | clojurebot | 1 |
| 14:35 | gfredericks | ,(let [{:keyss [x]} {:x 1}] x) |
| 14:35 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 14:36 | gfredericks | I guess it's a difficult typo to make |
| 14:36 | gfredericks | (without noticing) |
| 14:38 | pyrtsa | ,(let [x :foo, {:keyss [x]} {:x 1}] x) ;; Unless you tried to shadow previous bindings |
| 14:38 | clojurebot | :foo |
| 14:38 | gfredericks | yeah that's why it's not impossible :) |
| 14:45 | amalloy | &(let [{:keyss [x]} {:x 1}] x) |
| 14:45 | lazybot | java.lang.Exception: Unsupported binding form: :keyss |
| 14:45 | amalloy | an unfortunate side effect of the change to namespaced-keys destructuring made in 1.6 |
| 14:45 | amalloy | it used to be a typo that was impossible to make |
| 14:46 | TimMc | ahoenigmann: (let [{:keys [a b]} m] ...) is macroexpanded to something like (let [val m, a (get val :a), b (get val :b)] ...) |
| 14:48 | ahoenigmann | is see |
| 14:48 | ahoenigmann | i see |
| 14:49 | TimMc | The let macro uses the binding macro to do all the heavy lifting, there; the fn macro does the same thing. |
| 14:50 | joshuafcole | ,#({:key %}) |
| 14:50 | clojurebot | #<sandbox$eval26$fn__27 sandbox$eval26$fn__27@457235> |
| 14:50 | joshuafcole | ,#(hash-map :key %) |
| 14:50 | clojurebot | #<sandbox$eval53$fn__54 sandbox$eval53$fn__54@1166179> |
| 14:51 | TimMc | ahoenigmann: Err, rather, the destructure macro. Here it is: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4237 |
| 14:51 | amalloy | TimMc: the destructure function |
| 14:52 | TimMc | Oh, so it is! |
| 14:52 | gfredericks | ,(let [{:x :x} {:x 1}] x) |
| 14:52 | clojurebot | 1 |
| 14:52 | TimMc | Makes sense. |
| 14:52 | gfredericks | &(let [{:x :x} {:x 1}] x) |
| 14:52 | lazybot | java.lang.Exception: Unsupported binding form: :x |
| 14:55 | amalloy | TimMc: i said, bad change that got introduced in 1.6 |
| 14:55 | amalloy | or, at least, good change with bad side effects |
| 14:56 | amalloy | it came along with the ability to |
| 14:56 | amalloy | ,(let [{:keys [foo/bar]} {:foo/bar 1}] bar) |
| 14:56 | clojurebot | 1 |
| 15:01 | TimMc | I don't see how the :x thing works. |
| 15:02 | amalloy | TimMc: it calls clojure.core/name on the left-hand side of the pair |
| 15:02 | amalloy | so as to discard the namespace part |
| 15:03 | amalloy | and in doing so, fails to notice it was erroneously a keyword instead of a symbol |
| 15:05 | TimMc | Ouch. |
| 15:12 | amalloy | TimMc: 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:35 | martinklepsch | I'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:35 | martinklepsch | seems 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:37 | hiredman | martinklepsch: I would do something where you chunk up the stream as comes in and upload each chunk as an object to s3 |
| 15:40 | martinklepsch | hiredman: so sort of like partition-all the incoming sequence? |
| 15:41 | justin_smith | martinklepsch: well, it won't be a sequence, it will be a byte stream right? |
| 15:42 | akhudek | martinklepsch: consider what happens when your connection inevitably goes down for a moment |
| 15:42 | martinklepsch | hiredman: when in general should one use regular put/stream uploading/multipart uploading? I don't fully understand except that multipart is resumable |
| 15:42 | martinklepsch | *understand the differences |
| 15:42 | justin_smith | martinklepsch: stream and multipart are orthogonal |
| 15:43 | justin_smith | you can do multipart stream or or you can do a file all in one put |
| 15:44 | martinklepsch | justin_smith: so when would you use what? |
| 15:44 | justin_smith | multipart for things that are big or unknown total size |
| 15:44 | justin_smith | regular put for small things |
| 15:45 | martinklepsch | ah, I thought multipart would requrie the size to be known |
| 15:45 | justin_smith | no, the opposite in fact |
| 15:45 | justin_smith | for a regular put, it complains if you do not specify a size |
| 15:45 | justin_smith | but with multipart, all it needs to know is the chunk size |
| 15:48 | martinklepsch | justin_smith: ah thats cool. so mutlipart with clj-aws-s3 requires the uploaded object to be a java.io.File object |
| 15:49 | justin_smith | right - that's just a limitation in the wrapper lib |
| 15:49 | justin_smith | you can use hiredman's lib, or mine, to get around that |
| 15:49 | martinklepsch | justin_smith: do I remember correctly that you forked it for that reason? |
| 15:49 | justin_smith | right |
| 15:49 | justin_smith | caribou/clj-aws-s3 |
| 15:49 | martinklepsch | yeah, looked at hiredman ones |
| 15:51 | justin_smith | I 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:52 | justin_smith | I 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:08 | SagiCZ1 | hey guys do you know if the author of braveclojure.com is #clojure channel regular? |
| 16:08 | justin_smith | I know he posts on reddit/r/clojure |
| 16:10 | SagiCZ1 | justin_smith: thanks |
| 16:35 | SagiCZ1 | anyone using LightTable? just stumbled upon it.. |
| 16:38 | joegallo | do you have a question about it, or are you just looking for a show of hands? |
| 16:39 | SagiCZ1 | joegallo: i am looking for someone who uses it to tell me if its any good |
| 16:39 | SagiCZ1 | joegallo: before i investigate more |
| 16:41 | TEttinger | SagiCZ1, I used it but never tried too hard to learn the intricacies |
| 16:41 | TEttinger | I ended up having an easier time learning in NightCode |
| 16:41 | SagiCZ1 | TEttinger: NightCode? |
| 16:42 | TEttinger | https://nightcode.info/ |
| 16:42 | SagiCZ1 | looks reasonable |
| 16:42 | SagiCZ1 | lighttable has the instant code eval.. not sure if i need it |
| 16:43 | TEttinger | I could never get it working |
| 16:43 | TEttinger | it seemed temperamental for Swing and other graphical apps |
| 16:43 | TEttinger | nightcode has a repl in a pane at the botton |
| 16:43 | TEttinger | bottom |
| 16:43 | clojurebot | Huh? |
| 16:43 | TEttinger | and another to the side, actually |
| 16:44 | SagiCZ1 | i 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:44 | SagiCZ1 | bottom |
| 16:45 | SagiCZ1 | btw are you happy with Paredit? i dont know how to learn it.. seems so alien to me |
| 16:45 | amalloy | SagiCZ1: it took a little while to get used to, but it's hard to imagine living without it |
| 16:45 | TEttinger | I turned it off in nightcode, it's easy to switch |
| 16:45 | TEttinger | you can turn it back on with a checkbox |
| 16:45 | martinklepsch | hiredman: 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:46 | SagiCZ1 | amalloy: 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:46 | SagiCZ1 | TEttinger: i see.. cool stuff.. i might give NightCode a shot then |
| 16:46 | martinklepsch | SagiCZ1: I used lighttable for a few months and I think it's pretty awesome if you're starting out with clojure |
| 16:47 | amalloy | SagiCZ1: i referred to the paredit cheat sheet a lot at first |
| 16:47 | amalloy | $google paredit cheat sheet |
| 16:47 | lazybot | [EmacsWiki: Paredit Cheatsheet] http://www.emacswiki.org/emacs/PareditCheatsheet |
| 16:47 | SagiCZ1 | how is the integration of leiningen.. light table or night code both? |
| 16:47 | hiredman | martinklepsch: there is definitely more, you get a whole stacktrace (your paste is a partial stacktrace) |
| 16:47 | SagiCZ1 | amalloy: ok that might be helpful, thank you for the link |
| 16:47 | TEttinger | SagiCZ1, yeah both are fully integrated to lein |
| 16:48 | SagiCZ1 | TEttinger, i see |
| 16:48 | SagiCZ1 | amalloy: wait and these are emacs commands? |
| 16:48 | hiredman | martinklepsch: likely you are using some tool that is hiding information about the exception in a misguided attempt to be friendly to beginners |
| 16:48 | TEttinger | I liked the rainbow parens option in lighttable, which isn't available in nightcode |
| 16:48 | martinklepsch | hiredman: using cider in emacs & showed all frames |
| 16:48 | amalloy | SagiCZ1: of course; paredit is an emacs mode |
| 16:49 | TEttinger | it's also the same in nightcode |
| 16:49 | SagiCZ1 | amalloy: i know but its implemented into many other editors, such as nightcode or cursive |
| 16:49 | amalloy | if you're using some other implementation of paredit, the commands probably mostly exist but will have different bindings |
| 16:49 | hiredman | martinklepsch: but the message in the exception will tell you about the error from s3 |
| 16:49 | SagiCZ1 | amalloy: so they would be like keyboard shorcuts or something.. depending on the implementation |
| 16:49 | TimMc | SagiCZ1: Warning: Once you get used to paredit, it will be infuriating to try to write Clojure without it. |
| 16:50 | TimMc | kind of a red pill sort of thing |
| 16:50 | SagiCZ1 | TEttinger, 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:50 | martinklepsch | hiredman: this is everything I've got in the stacktrace buffer: https://gist.github.com/mklappstuhl/6ce2a1f4caef0a2f6cc5 |
| 16:50 | SagiCZ1 | TimMc: you use paredit in emacs too? |
| 16:50 | martinklepsch | did I oversee something? |
| 16:50 | TEttinger | I type my parens with a weird stroke, shift 9 0, let go of shift, left arrow |
| 16:51 | TEttinger | and it's such a habit now |
| 16:51 | amalloy | SagiCZ1: 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:51 | amalloy | TEttinger: i just type 9 |
| 16:51 | TEttinger | 9 or shift 9? |
| 16:51 | amalloy | (having remapped that key to produce the ( character) |
| 16:51 | TEttinger | oh ok |
| 16:51 | SagiCZ1 | amalloy: well paren matching is a breeze with paredit right |
| 16:52 | amalloy | SagiCZ1: sure. which is why you don't need rainbow parens |
| 16:52 | SagiCZ1 | got it |
| 16:52 | mgaare | rainbow parens do make your source look a bit less monotonous at least |
| 16:52 | TEttinger | amalloy, heh you should see some of my code that DID need some visual indicator (it was terrible) |
| 16:52 | SagiCZ1 | as i am typing without paredit i have the feeling there must be a better way |
| 16:52 | hiredman | martinklepsch: you need to get the contents of the body of the error |
| 16:53 | hiredman | martinklepsch: so *e in the repl will be the last uncaught exception |
| 16:54 | hiredman | (doc ex-info) |
| 16:54 | clojurebot | "([msg map] [msg map cause]); Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data." |
| 16:54 | hiredman | (-> *e ex-data :object :body slurp) or something like that |
| 16:55 | martinklepsch | hiredman: oh! that perfectly shows me an error |
| 16:55 | hiredman | like magic |
| 17:01 | martinklepsch | hiredman: hehe |
| 17:07 | martinklepsch | If 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:08 | gfredericks | it's a lazy sequence of what? |
| 17:09 | martinklepsch | gfredericks: maps |
| 17:10 | justin_smith | so you want the pr-str representation of those maps? |
| 17:10 | justin_smith | or maybe json? |
| 17:10 | martinklepsch | justin_smith: pr-str |
| 17:11 | martinklepsch | but that would best come after the splitting, right? |
| 17:11 | gfredericks | depends on what you're trying to split into |
| 17:11 | gfredericks | e.g., some max number of bytes? |
| 17:12 | martinklepsch | gfredericks: 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:13 | justin_smith | seems like you want something that takes a lazy seq of strings and turns it into an OutputStream |
| 17:13 | justin_smith | once it's an OutputStream, the lib you are using can do the chunking part |
| 17:14 | justin_smith | I wonder if that function exists? if not you can likely make it via proxy or reify |
| 17:15 | gfredericks | are you sure an inputstream wouldn't work? |
| 17:15 | justin_smith | the 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:15 | gfredericks | because there is ##java.io.SequenceInputStream |
| 17:15 | justin_smith | gfredericks: sorry, I mean inputstream |
| 17:15 | gfredericks | ,(def my-strs ["foo" "bar" "baz"]) |
| 17:15 | clojurebot | #'sandbox/my-strs |
| 17:16 | gfredericks | ,(def is (->> my-strs (map #(java.io.ByteArrayInputStream (.getBytes %))) (java.io.SequenceInputStream.))) |
| 17:16 | clojurebot | #<CompilerException java.lang.ClassCastException: Cannot cast clojure.lang.LazySeq to java.util.Enumeration, compiling:(NO_SOURCE_FILE:0:0)> |
| 17:16 | gfredericks | ,(def is (->> my-strs (map #(java.io.ByteArrayInputStream (.getBytes %))) (clojure.lang.SeqEnumeration.) (java.io.SequenceInputStream.))) |
| 17:16 | clojurebot | #<CompilerException java.lang.reflect.InvocationTargetException, compiling:(NO_SOURCE_FILE:0:0)> |
| 17:17 | justin_smith | gfredericks: it takes a collection of inputstreams and returns their concatenation |
| 17:17 | justin_smith | so you probably need the string->stream conversion there too |
| 17:17 | gfredericks | I forgot a dot |
| 17:17 | justin_smith | (mapped) |
| 17:17 | gfredericks | ,(def is (->> my-strs (map #(java.io.ByteArrayInputStream. (.getBytes %))) (clojure.lang.SeqEnumeration.) (java.io.SequenceInputStream.))) |
| 17:17 | clojurebot | #'sandbox/is |
| 17:17 | gfredericks | ,(slurp is) |
| 17:17 | clojurebot | "foobarbaz" |
| 17:17 | justin_smith | there we go |
| 17:17 | justin_smith | (inc gfredericks) |
| 17:17 | lazybot | ⇒ 82 |
| 17:18 | martinklepsch | and so this is lazy? |
| 17:18 | gfredericks | should be |
| 17:19 | gfredericks | because of map, SeqEnumeration, and SequenceInputStream all being lazy |
| 17:19 | gfredericks | let's make an infinite one |
| 17:19 | gfredericks | ,(def is (->> (range) (map str) (map #(java.io.ByteArrayInputStream. (.getBytes %))) (clojure.lang.SeqEnumeration.) (java.io.SequenceInputStream.))) |
| 17:19 | clojurebot | #'sandbox/is |
| 17:20 | gfredericks | ,(-> is (clojure.java.io/reader) ((fn [r] (apply str (map char (repeatedly 20 #(.read r))))))) |
| 17:20 | clojurebot | "01234567891011121314" |
| 17:20 | justin_smith | yup, that would have hung if it wasn't lazy, I'd reckon |
| 17:21 | gfredericks | "(apply str (map char (repeatedly 20 #(.read r))))" rhymes a bit if you read it out loud |
| 17:21 | Clarice | Only the char and r. |
| 17:22 | martinklepsch | thats awesome |
| 17:22 | martinklepsch | thanks gfredericks & justin_smith, would have probably taken me ages to figure that out :) |
| 17:22 | gfredericks | Clarice: I'm looking forward to your better clojure poem |
| 17:23 | Clarice | gfredericks: See you at the poetry slam later tonight |
| 17:24 | justin_smith | http://en.wikipedia.org/wiki/Shakespeare_(programming_language) why not use this instead of clojure |
| 17:25 | justin_smith | the hello world is awesome http://en.wikipedia.org/wiki/Shakespeare_(programming_language)#Example_code |
| 17:26 | justin_smith | "Thou art as disgusting as the quotient between Romeo and twice the |
| 17:26 | justin_smith | difference between a mistletoe and an oozing infected blister! Speak |
| 17:26 | justin_smith | your mind!" <- that statement has arithmatic and IO in it |
| 17:34 | ahoenigmann | in emacs how do you get start a new clojure project? |
| 17:34 | ahoenigmann | I would like the path to get: cider repl + all files in project loaded + paredit mode started on all .clj buffers |
| 17:35 | justin_smith | (add-hook 'clojure-mode-hook 'paredit-mode) ; for the paredit part |
| 17:36 | justin_smith | for 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:37 | afhammad | in core.asyc, when do you use a (put! c "hello") vs (go (!> c "hello")) ? |
| 17:37 | justin_smith | ahoenigmann: you can use speedbar, but you have to configure speedbar to pay attention to .clj files (it ignores them by default) |
| 17:38 | justin_smith | that's done by setting speedbar-show-unknown-files to a truthy value |
| 17:39 | ahoenigmann | speedbar looks cool kind of sublime like |
| 17:39 | justin_smith | it's much older, and a bit weird |
| 17:39 | justin_smith | but it works, if you want a file tree kind of thing |
| 17:39 | martinklepsch | one 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:39 | justin_smith | for some modes, it gives clickable targets for individual functions |
| 17:40 | justin_smith | I 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:40 | justin_smith | martinklepsch: 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:41 | martinklepsch | justin_smith: in propS3t? |
| 17:41 | justin_smith | it should - or do you have to do that part manually? |
| 17:42 | justin_smith | clj-aws-s3 does the chunking, you just tell it how big the chunks would be |
| 17:42 | justin_smith | if 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:42 | martinklepsch | justin_smith: I think in propS3t you need to write parts manually |
| 17:43 | justin_smith | OK. so like I said, don't use partition. |
| 17:44 | justin_smith | martinklepsch: unless I am misreading the code, you should just pass the stream to write part |
| 17:45 | justin_smith | write-part will read as much of the stream as it needs |
| 17:45 | justin_smith | and streams are stateful |
| 17:45 | justin_smith | so just repeatedly call write-part until the stream has no more data left to give you |
| 17:45 | justin_smith | then call end-multipart |
| 17:46 | martinklepsch | justin_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:47 | justin_smith | yes, you need to call it manually, unless he has a higher level function that abstracts over the multi-part process |
| 17:47 | martinklepsch | ah, yeah, got it |
| 17:47 | justin_smith | this is all done auto-magically in clj-aws-s3 - you give it a stream and a chunk size, it does the rest |
| 17:48 | justin_smith | also, 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:48 | justin_smith | though the test probably makes that clear |
| 17:48 | martinklepsch | justin_smith: yeah, saw that |
| 17:48 | martinklepsch | maybe I'll play with clj-aws-s3 again as well |
| 17:49 | martinklepsch | It's sort of surprising that there is no de-facto S3 lib out there |
| 17:52 | ahoenigmann | so i just added a new dependency in the project.clj |
| 17:52 | ahoenigmann | is there any way to pull it in from with emacs? or do I have to do lein .... |
| 17:53 | justin_smith | you can add new deps without restarting if you use alembic/still |
| 17:53 | justin_smith | otherwise, you need to restart your repl |
| 17:53 | ahoenigmann | what is that? |
| 17:53 | justin_smith | (or use pomegranate, but alembic is much easier) |
| 17:53 | justin_smith | it's a lib that adds deps at runtime |
| 17:53 | justin_smith | including reloading your project.clj to add new deps |
| 17:53 | ahoenigmann | whoa |
| 17:54 | justin_smith | or just finding and loading arbitrary whatever into your repl |
| 17:54 | ahoenigmann | the tooling is harder than the language x10 |
| 17:54 | justin_smith | https://github.com/pallet/alembic |
| 17:54 | ahoenigmann | thanks |
| 17:54 | justin_smith | ahoenigmann: easier - how many other languages give you reliable per-project dep management? |
| 17:54 | ahoenigmann | hmm ok |
| 17:54 | justin_smith | and reliable deployment to an environment with exactly the deps you have locally |
| 17:55 | justin_smith | it's not hard, it is just different |
| 17:55 | justin_smith | but it's much better |
| 17:55 | ahoenigmann | does restarting/starting a cider repl jack in download dependencies? |
| 17:55 | justin_smith | sure, if you have new ones |
| 17:55 | justin_smith | but you can also use alembic, as I mentioned |
| 17:57 | justin_smith | I 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:05 | turbofail | i dunno i found the clojure tooling way simpler than all the other tooling i'd used previously |
| 18:05 | brand0 | same, I really like it |
| 18:06 | justin_smith | ahoenigmann: it sounds like you are new to emacs? if so that may be the extra complexity |
| 18:06 | justin_smith | emacs is definitely weird |
| 18:08 | martinklepsch | +1 on finding clojure tooling good (esp. lein) |
| 18:11 | shanemhansen | emacs and cider-jack-in are a revelation. |
| 18:12 | brand0 | now if oxcart would just hurry up .... |
| 18:12 | shanemhansen | But not necessarily the simplest thing to learn. |
| 18:17 | gfredericks | (inc justin_smith) ;; for shakespeare PL |
| 18:17 | lazybot | ⇒ 60 |
| 18:17 | danielcompton | There 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:18 | danielcompton | Is there an emacs equivalent of https://github.com/blog/1877-folder-jumping ? |
| 18:18 | martinklepsch | shanemhansen: lighttable makes you not even need to think about that sort of stuff |
| 18:19 | danielcompton | martinklepsch: 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:19 | joshuafcole | Yeah |
| 18:19 | joshuafcole | well, it's open sourced now |
| 18:19 | joshuafcole | So I can track down the bugs when I run into them |
| 18:20 | justin_smith | danielcompton: in dired, you can hit the "i" key while the cursor is on a directory to expand it inline |
| 18:20 | joshuafcole | but it's still kind of wild west, versus the polish of time on the more venerable editors of yore |
| 18:20 | martinklepsch | I 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:20 | justin_smith | danielcompton: not as automatic and convenient, but reaches a similar end |
| 18:20 | martinklepsch | good night everyone! |
| 18:20 | joshuafcole | ciao |
| 18:20 | danielcompton | justin_smith: that's pretty cool |
| 18:22 | justin_smith | danielcompton: 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:22 | justin_smith | I was just lucky I didn't need to update the css too... |
| 18:24 | danielcompton | justin_smith: sounds painful |
| 18:24 | justin_smith | yeah, but being able to expand things inline in dired made it at least possible |
| 18:25 | justin_smith | also, 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:25 | justin_smith | waaaaay over-engineered |
| 18:31 | ThinkRusty87 | If anyone needs help with anything let me know. |
| 18:40 | CaptainLex | I seem to be having an issue where Compojure is munging special characters |
| 18:41 | justin_smith | in the body? |
| 18:42 | justin_smith | or wait, you said compojure, so you mean routing strings are being munged? |
| 18:42 | justin_smith | because that would make sense, it should be a valid URL after all |
| 18:43 | CaptainLex | justin_smith: Maybe I'm misunderstanding what Compojure is doing. I mean special characters in the body |
| 18:43 | justin_smith | OK, that would be ring |
| 18:43 | CaptainLex | Oh okay thanks |
| 18:43 | CaptainLex | So I guess |
| 18:43 | justin_smith | first off, check that your content types are right all around |
| 18:43 | CaptainLex | Ring is munging special characters :) |
| 18:43 | CaptainLex | Okay, one moment |
| 18:43 | justin_smith | ie. are you setting the right character encoding on your requests |
| 18:45 | CaptainLex | Chrome says text/html |
| 18:46 | justin_smith | character encoding? |
| 18:46 | CaptainLex | (For the record, I've tried replacing the special characters with their HTML encondings to the same effect) |
| 18:46 | CaptainLex | I'll check the template |
| 18:46 | CaptainLex | one moment |
| 18:47 | CaptainLex | The charset in the meta is utf-8, if that was what you meant |
| 18:47 | justin_smith | CaptainLex: oh, and just to be clear - is it the data going from server to browser that is corrupted, or coming back? |
| 18:47 | justin_smith | CaptainLex: yeah, sorry, I had the wrong term |
| 18:48 | CaptainLex | justin_smith: No worries. These are characters that are in raw HTML. |
| 18:48 | CaptainLex | I've tested the various enlive functions so I know the characters are still valid after that stage |
| 18:48 | justin_smith | so is it getting corrupted in the server->browser direction or in the browser->server direction? |
| 18:48 | CaptainLex | server->browser |
| 18:48 | justin_smith | OK |
| 18:48 | justin_smith | you may want to check what the result looks like in curl |
| 18:49 | CaptainLex | Hmmmm |
| 18:49 | CaptainLex | good idea! |
| 18:49 | justin_smith | to rule out weird behavior in the browser |
| 18:49 | justin_smith | and simplify verifying the actual data going through |
| 18:49 | CaptainLex | Well, actually |
| 18:49 | CaptainLex | woops! |
| 18:49 | justin_smith | ? |
| 18:49 | jumblemuddle | Anyone 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:50 | CaptainLex | I forgot that last time I debugged this issue (some months ago, and then I put thew project on hold) |
| 18:50 | CaptainLex | I figured out my console didn't display those characters either |
| 18:50 | CaptainLex | I could redirect curl though |
| 18:50 | CaptainLex | I'll do that |
| 18:50 | justin_smith | or wget |
| 18:50 | justin_smith | see if it looks right in your $EDITOR |
| 18:50 | justin_smith | emacs has rest-client-mode which lets you specify a request and then see the reply below it |
| 18:51 | justin_smith | (it's a package you can install) |
| 18:51 | justin_smith | it could also be that you are telling the other end that it is utf8, but ring is creating some other content-type |
| 18:52 | CaptainLex | justin_smith: I guess it's a browser thing! I curled > test.txt and open that in Geany and it worked |
| 18:52 | CaptainLex | Lemme test Firefox |
| 18:52 | justin_smith | what does Geany think the encoding of the file is? |
| 18:52 | justin_smith | or does it have an option to show you that |
| 18:53 | justin_smith | the linux "file" utility should also show you encoding |
| 18:54 | CaptainLex | I 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:54 | CaptainLex | Oooh I'll try that |
| 18:54 | danielszmulewicz | Am I killing my 1gig VPS with 5 JVM instances? |
| 18:54 | justin_smith | CaptainLex: I think I misremembered that actually |
| 18:55 | danielszmulewicz | It looks like starting one instance kills another one. Is that even possible? |
| 18:55 | CaptainLex | justin_smith: the output of running file actually did tell me an enconding |
| 18:55 | justin_smith | danielszmulewicz: I am sure it could handle 500 simultaneous helloworld.java instances |
| 18:55 | justin_smith | CaptainLex: ahh, I must have double checked on the wrong file here :) |
| 18:55 | CaptainLex | ISO-8859 |
| 18:56 | justin_smith | so yeah, you need to tell your ring adaptor that you want to send utf8, or tell the client you are sending ISO-8859 |
| 18:56 | danielszmulewicz | justin_smith: Good to know. I must look elsewhere then. I don't get it. |
| 18:57 | justin_smith | danielszmulewicz: that was sort of a joke - point being, what you are running matters more than whether it is jvm or not |
| 18:57 | CaptainLex | justin_smith: Thanks! I'll look into it |
| 18:57 | justin_smith | CaptainLex: unless you are serving mostly Chinese text or something, utf8 will likely be your best option |
| 18:58 | danielszmulewicz | justin_smith: Fair enough. |
| 18:58 | justin_smith | I mean what can you know without profiling all the apps? |
| 18:59 | Jaood | danielszmulewicz: five lein repls will definite kill it ;) |
| 18:59 | danielszmulewicz | justin_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:59 | justin_smith | danielszmulewicz: I like htop, for real time monitoring at least |
| 18:59 | justin_smith | danielszmulewicz: you can get snapshots using ps |
| 18:59 | danielszmulewicz | Jaood: Yeah. Lein is a beast. But I'm running the standalone jars. |
| 19:00 | amalloy | danielszmulewicz: if you start up 5 JVMs without doing any configuration of them, then yeah, that probably takes up more than 1g |
| 19:00 | danielszmulewicz | My instances are your typical ring web applications. Nothing fancy. |
| 19:00 | justin_smith | danielszmulewicz: 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:00 | amalloy | but 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:01 | danielszmulewicz | amalloy: Should I use a small maximum heap setting (XmX)? |
| 19:01 | amalloy | yes. -Xmx40m is reasonable for a simple webapp |
| 19:01 | amalloy | i think that's what lazybot has. maybe he has 60m these days. either way it's more than he really needs |
| 19:06 | danielszmulewicz | (inc amalloy) |
| 19:06 | lazybot | ⇒ 160 |
| 19:06 | danielszmulewicz | (inc justin_smith ) |
| 19:06 | lazybot | ⇒ 3 |
| 19:07 | justin_smith | that makes three times someone has added an extraneous space after my name in an inc |
| 19:09 | TEttinger | (inc justin_smith) |
| 19:09 | lazybot | ⇒ 61 |
| 19:12 | cbp | (inc) |
| 19:13 | justin_smith | (inc ✈) |
| 19:13 | lazybot | ⇒ 1 |
| 19:17 | technomancy | is clojure-doc.org's vim coverage good? http://clojure-doc.org/articles/tutorials/vim_fireplace.html |
| 19:25 | technomancy | gfredericks: hey, what's your favourite joke library?= |
| 19:26 | technomancy | besides lein-lein |
| 19:26 | technomancy | (or anyone really) |
| 19:27 | mdeboard | Sorry but programming is a very serious matter |
| 19:27 | mdeboard | I do not download or even talk about "joke" libraries |
| 19:27 | amalloy | technomancy: https://github.com/mattdiamond/fuckitjs ? |
| 19:28 | technomancy | amalloy: sorry, has to be a clj lib that I can use from a trivial web app |
| 19:28 | technomancy | oh, maybe that kebab snake one |
| 19:28 | amalloy | camel snake kebab |
| 19:28 | technomancy | mmmm delicious https://github.com/qerub/camel-snake-kebab |
| 19:28 | justin_smith | https://github.com/rodnaph/clj-php (more for the concept than the execution, which I am ignorant of) |
| 19:28 | joshuafcole | There isn't a fuckit.cljs yet? |
| 19:28 | joshuafcole | If not we should get on that. |
| 19:28 | mdeboard | I started to but I was like |
| 19:28 | mdeboard | "fuck it" |
| 19:28 | joshuafcole | :) |
| 19:28 | justin_smith | clearly fuckit.hs would be the best |
| 19:29 | joshuafcole | Honestly, you should probably just bootstrap it |
| 19:29 | jumblemuddle | Let me know when you've got it finished. I'd be happy to use it... :) |
| 19:29 | joshuafcole | get it close enough to working and then run it on itself until it's "good" |
| 19:29 | justin_smith | a "guess what I mean and suppress errors" haskell extension, who would not love that |
| 19:29 | joshuafcole | "guess what I mean"? Whoah, fuckit.xyz doesn't /care/ what you mean. It just wants the compiler/runtime checker to shut up. |
| 19:30 | justin_smith | heh |
| 19:30 | amalloy | justin_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:31 | justin_smith | file doesn't end with a newline? type error |
| 19:31 | joshuafcole | haha |
| 19:31 | justin_smith | mixed tabs and spaces? type error |
| 19:31 | amalloy | exactly |
| 19:31 | justin_smith | I love it |
| 19:31 | bridgethillyer | technomancy: on clojure-doc.org’s vim coverage: I just reviewed it quickly |
| 19:31 | joshuafcole | Don't stop there! |
| 19:31 | joshuafcole | terribly cliche variable names? |
| 19:31 | bridgethillyer | It’s not perfect, but it’s generally accurate based on my quick read |
| 19:32 | joshuafcole | Shadowing of any variable names? |
| 19:32 | joshuafcole | :P |
| 19:32 | justin_smith | joshuafcole: variables with more than one letter in the name: type error |
| 19:32 | technomancy | bridgethillyer: thanks! |
| 19:32 | joshuafcole | Though, now it's getting complex. Maybe just throw a type error on anything that's not "Hello World" to be safe. |
| 19:33 | justin_smith | bbl |
| 19:33 | joshuafcole | ciao |
| 19:33 | bridgethillyer | sure thing. Now that I have done that, I’d like to go back and review it for current accuracy. Thanks for the inspiration |
| 19:37 | aperiodic | technomancy: re: joke libraries: https://github.com/fxn/i-told-you-it-was-private |
| 19:40 | xeqi | harsh |
| 19:41 | joshuafcole | It might seem harsh, but down the road of projects like this and fuckit lies the zen of 0 sloc |
| 19:43 | technomancy | aperiodic: <3 |
| 19:50 | gfredericks | technomancy: is system-slash-exit a joke? |
| 19:50 | gfredericks | I also have https://github.com/gfredericks/flexnum but it's rubby |
| 19:50 | gfredericks | kind of surprised that one doesn't have a readme |
| 19:51 | gfredericks | needs an example of truncating your database table via MyModel.all.length.zero! |
| 19:58 | danielcompton | Does Spring qualify as a joke library? |
| 20:00 | mdeboard | zing |
| 20:00 | mdeboard | ice cold, sick burn |
| 20:07 | talios | danielcompton - surely you mean scala |
| 20:07 | danielcompton | Is that a gas torch from a flame war starting up that I hear? |
| 20:17 | danielcompton | technomancy: have things like esk-cleanup-buffer been moved to another emacs package now that emacs-starter-kit has been sort of deprecated? |
| 20:25 | amalloy | esk sounds like some kind of fantastical forest creature |
| 20:27 | blimps | If 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:28 | Bronsa | ,((fn [& x] x) 1 2 3) |
| 20:28 | clojurebot | (1 2 3) |
| 20:28 | Bronsa | ,((fn [a b & x] x) 1 2 3) |
| 20:28 | clojurebot | (3) |
| 20:28 | Bronsa | ,((fn [a b & x] [a b x]) 1 2 3 4) |
| 20:28 | clojurebot | [1 2 (3 4)] |
| 20:30 | danielcompton | while not strictly a joke library, https://github.com/ztellman/proteus has a funny readme |
| 20:33 | Bronsa | "That's it. That's the end of the library." Just imagine if there was more to it |
| 20:35 | tuft | any idea how this could possibly come up? java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$vector |
| 20:35 | tuft | ,(seq [1 2 3]) |
| 20:35 | clojurebot | (1 2 3) |
| 20:35 | justin_smith | tuft: seq knows how, the jvm doesn't I guess? |
| 20:35 | aperiodic | tuft: I think it's saying it doesn't know how to make a seq from that function |
| 20:35 | amalloy | ,(seq vector) |
| 20:35 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$vector> |
| 20:35 | justin_smith | ahh |
| 20:35 | tuft | ahh i see, thanks |
| 20:36 | blimps | Ok, I think I see what you're saying. How could I get a function to apply "and" to an argument list resulting from "&"? |
| 20:37 | tuft | just needed a ->> instead of -> =) |
| 20:37 | AimHere | blimps, sadly, 'and' and 'or' are macros, so you can't. |
| 20:38 | amalloy | AimHere: 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:38 | blimps | Yeah, I just read about that. Is there some sort of workaround for this sort of situation? |
| 20:39 | AimHere | You could write some sort of function that does the same job - even a mere wrapper around 'and' would do |
| 20:40 | justin_smith | amalloy: is there an alternative to every? that returns the last arg like and would? |
| 20:40 | justin_smith | of course that would be easy to write... |
| 20:40 | amalloy | AimHere: that function already exists. it is every?. you do not want to wrap and |
| 20:41 | gfredericks | ,(every? inc [1 2 3]) |
| 20:41 | clojurebot | true |
| 20:41 | gfredericks | er nm |
| 20:41 | justin_smith | ,(and 1 2 3) |
| 20:41 | clojurebot | 3 |
| 20:41 | gfredericks | I thought he meant like some |
| 20:41 | justin_smith | ,(every? identity [1 2 3]) |
| 20:41 | clojurebot | true |
| 20:41 | brehaut | ,(and 4) |
| 20:41 | clojurebot | 4 |
| 20:42 | amalloy | justin_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:42 | brehaut | ,(+ 4) |
| 20:42 | clojurebot | 4 |
| 20:42 | amalloy | ,(partial 4) |
| 20:42 | clojurebot | 4 |
| 20:42 | brehaut | hmm i thought suffusion of yellow occured with results greater than 3? |
| 20:42 | brehaut | ,(+ 1 2) |
| 20:42 | clojurebot | 3 |
| 20:42 | amalloy | (+ 2 2) |
| 20:42 | clojurebot | 4 |
| 20:42 | brehaut | ,(+ 1 2 3) |
| 20:42 | clojurebot | 6 |
| 20:42 | justin_smith | amalloy: I often use and in cases where I only want to use the last value if the preceding are all truthy |
| 20:42 | brehaut | now its just being devious |
| 20:42 | amalloy | brehaut: he doesn't mess with results of actual eval requests starting with , |
| 20:43 | brehaut | (+ 1 2 3) |
| 20:43 | clojurebot | *suffusion of yellow* |
| 20:43 | amalloy | he has/had some joke responses if you tried to use him for math without starting with , |
| 20:43 | brehaut | amalloy: aha |
| 20:43 | brehaut | amalloy: for some reason i thought it was a both situation |
| 20:43 | gfredericks | justin_smith: do you have an example use case with a non-static set of things? |
| 20:43 | amalloy | justin_smith: sure, and that's very common. but that was a fixed set of tests/values |
| 20:43 | amalloy | with a list that you get from somewhere else? it's not at all common |
| 20:44 | justin_smith | right, with varargs thats a bit weirder, yeah |
| 20:44 | gfredericks | clojurebot: amalloy |says| your use case is contrived. |
| 20:44 | clojurebot | You don't have to tell me twice. |
| 20:44 | amalloy | (inc gfredericks) ; very good |
| 20:44 | lazybot | ⇒ 83 |
| 20:45 | amalloy | i look forward to the roulette of ~amalloy generating things i don't remember saying |
| 20:45 | amalloy | ~amalloy |
| 20:45 | clojurebot | amalloy was right again in a blazing show of total predictability |
| 20:45 | Bronsa | hah |
| 20:45 | joshuafcole_ | bahaha |
| 20:45 | justin_smith | ~amalloy |
| 20:45 | clojurebot | amalloy has an (obsessive) posse |
| 20:46 | amalloy | huh, i don't even remember that one |
| 20:46 | gfredericks | your posse does |
| 20:47 | amalloy | lazybot doesn't have it anywhere in his logs. i wonder if someone taught clojurebot that via pm |
| 20:47 | gfredericks | it feels familiar to me; maybe only because it's randomly come up before |
| 20:47 | amalloy | oh, no, i see |
| 20:47 | amalloy | i forgot it would look like |has| in the logs |
| 20:47 | justin_smith | gfredericks: the intersection of posse commitatus and the insane clown posse is the empty posse |
| 20:48 | amalloy | llasram taught him in june |
| 20:48 | amalloy | http://logs.lazybot.org/irc.freenode.net/%23clojure/2014-06-20.txt |
| 20:49 | amalloy | gfredericks was apparently the posse member in question |
| 20:49 | blimps | Ok, I was about to do what I needed with some and every? Thanks. :) |
| 20:50 | blimps | able to, that is |
| 20:50 | gfredericks | that 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:51 | xeqi | must be an imposter |
| 20:52 | Bronsa | I can never remember teh order of args to isa?/instance? |
| 20:52 | Bronsa | the* |
| 20:53 | justin_smith | gourd? |
| 20:53 | PigDude | Bronsa: the solution is clearly `infix` |
| 20:53 | aperiodic | ~gourds |
| 20:53 | justin_smith | as in pumpkins and such? |
| 20:53 | clojurebot | SQUEEZE HIM! |
| 20:53 | gfredericks | aperiodic: PHEW |
| 20:54 | gfredericks | that was exactly what I wanted to do and now it is done. |
| 20:54 | aperiodic | I got your back |
| 20:54 | gfredericks | (inc aperiodic) ;; back possession |
| 20:54 | lazybot | ⇒ 8 |
| 20:54 | amalloy | reminds me of the classic gourdian knot |
| 20:55 | Bronsa | ,(isa? String Object) |
| 20:55 | clojurebot | true |
| 20:55 | Bronsa | ,(instance? Object String) |
| 20:55 | clojurebot | true |
| 20:55 | Bronsa | this doesn't help |
| 20:56 | amalloy | man, http://en.wikipedia.org/wiki/Gordian_Knot is an amazingly bad description of the myth |
| 20:57 | amalloy | i guess the words are all there, it's just weirdly abrupt |
| 23:24 | mdeboard | with 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:24 | mdeboard | and then the server is doing the computation, and responding with the result? |
| 23:25 | Jaood | yes, its a server-client model |
| 23:25 | Jaood | cider is an nrepl client just like the lein repl is too |
| 23:25 | mdeboard | Yeah, I just put 2 and 2 together about what exactly the traffic is between the two. In hindsight it's obvious |
| 23:27 | mdeboard | Oh wow Github just pushed a really nice UI/UX improvement live |
| 23:27 | mdeboard | lets you skip over empty directories |
| 23:28 | mdeboard | https://github.com/clojure/tools.nrepl/tree/master/src/main |
| 23:28 | Clarice | Define "just" |
| 23:28 | mdeboard | idk, in the past 24 hours |
| 23:28 | Clarice | Oh |
| 23:28 | Clarice | Yes, I see what you're saying |
| 23:28 | mdeboard | maybe sooner |
| 23:28 | Clarice | That's niiiiiifty |
| 23:29 | mdeboard | yarly |
| 23:46 | Clarice | How are clojure vectors constant time if they're represented by tries? |
| 23:48 | mdeboard | Clarice: What do you mean by "how are they constant time"? What operations do you mean? |
| 23:48 | Clarice | Getting the value at an index. |
| 23:48 | mdeboard | (I do not know right off the top of my head which ops are O(1)) |
| 23:48 | Clarice | I imagine that becomes a pointer chasing exercise for values near the tail of the vector |
| 23:49 | danielcompton | What's the difference between comp and -> ? |
| 23:49 | Clarice | danielcompton: One is the composition of two or more functions. |
| 23:50 | Clarice | danielcompton: which returns a new function. The other is a macro which operates on forms and pipelines the results. |
| 23:50 | danielcompton | Clarice: where could you use one but not the other? |
| 23:51 | Clarice | danielcompton: I encourage you to macroexpand -> and see what you get |
| 23:51 | mdeboard | Clarice: I don't kow the answer to your question but I'd guess it has some kind of hashmap like {idx: val} no? |
| 23:52 | Clarice | mdeboard: That defeats the purpose of structure sharing. |
| 23:53 | Clarice | danielcompton: (-> x (form) (form) (form)) is essentially the same as (apply (compose f f f f) x). But they're slightly different. |
| 23:53 | danielcompton | Clarice: hmm, think I'm getting it |
| 23:54 | Clarice | danielcompton: 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:54 | mdeboard | wouldn't the hashmap of positions also be updated when the vector is "updated" |
| 23:54 | Clarice | danielcompton: 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:54 | mdeboard | I'm talking out of my ass for the most part. |
| 23:55 | mdeboard | s/ for the most part.// |
| 23:55 | danielcompton | Clarice: never used F# but it makes sense |
| 23:55 | rei | Clarice: 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:56 | Clarice | rei: Oh! I remember bookmarking that and never getting around to reading it. Thank you for reminding me it exists. |