2014-07-18
| 00:04 | BorisKourt | Hi, I have been following this Stasis guide: http://cjohansen.no/building-static-sites-in-clojure-with-stasis and am almost at the end with everything running smoothly. Unfortunately I hit a snag with Optimus exporting: |
| 00:04 | BorisKourt | Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration missing, compiling:(cjohansen_no/web.clj:13:43) |
| 00:04 | BorisKourt | This is in the ns statement |
| 00:05 | BorisKourt | It appeared when I added [optimus.export] into the :require |
| 00:23 | BorisKourt | Got messed up thinking that it was in the NS as the line number pointed to the end of that. It was a defn instead of dfn. |
| 00:23 | BorisKourt | err def* |
| 03:53 | hhenkel | Good morning all. Anyone able to tell me what I'm missing here: https://www.refheap.com/88320 |
| 03:54 | hhenkel | I would expect to get a String as well in the "TRACE given-bean" |
| 03:58 | hhenkel | Sorry, I meant "TRACE type given-bean:" |
| 04:00 | mthvedt | hhenkel: looks like you’re mapping onto a String? |
| 04:00 | mthvedt | a string is a seq of chars |
| 04:04 | hhenkel | mthvedt: Ah yes, absolutely....request is a list and I'm trying to map every item (which holds different values) to the function |
| 04:07 | hhenkel | mthvedt: I'm currently not getting it how to map two values of every item...I'm makeing a coffee break, will be back in about 20 min. |
| 04:12 | mthvedt | hhenkel: not sure what you’re trying to do, but it looks like you want to make a closure, and map that to one seq |
| 04:13 | mthvedt | something like (map #(get-read-request mbean %) seq-of-attributes) |
| 04:40 | hhenkel | mthvedt: The break helped...I figured it out. It is totally unnecessary to use map there in my code.... :( |
| 04:40 | mthvedt | coffee solves everything |
| 05:18 | wombawomba | how do I thread a list? I tried (apply (-> "a b c d") [.toUpperCase (.replace "A" "X")]) but it doesn't seem to work |
| 05:22 | hyPiRion | wombawomba: (-> "a b c d" .toUpperCase (.replace "A" "X")) |
| 05:22 | bsteuber | ,(-> "a b c d" .toUpperCase (.replace "A" "X")) |
| 05:22 | clojurebot | "X B C D" |
| 05:23 | hyPiRion | If you want to thread an arbitrary list, you have to use thrush. |
| 05:23 | hyPiRion | $google fogus trush |
| 05:23 | lazybot | [fogus: Thrush in Clojure – Redux] http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/ |
| 05:24 | wombawomba | yeah the problem is that I want to do this in a function that takes the list |
| 05:25 | hyPiRion | the -> macro is a macro, so it cannot be applied or reduced -- it's not a function |
| 05:25 | bsteuber | wombawomba: you'll need a macro for this, since -> is a macro too |
| 05:26 | wombawomba | right |
| 05:27 | bsteuber | (defmacro thread-abcd [actions] `(-> "a b c d" ~@actions)) |
| 05:27 | wombawomba | perhaps there's a way to achieve the same effect without using ->? |
| 05:27 | pyrtsa | ,(reduce #(%2 %1) "a b c d" [#(.toUpperCase %) #(.replace % "A" "X")]) |
| 05:27 | clojurebot | "X B C D" |
| 05:27 | pyrtsa | wombawomba: ^ |
| 05:27 | wombawomba | yeah, I'll just do that then :) |
| 05:28 | wombawomba | I guess that's what the thrush thing does too |
| 05:28 | wombawomba | thanks |
| 05:28 | bsteuber | yes but then you need to use functions and not just .toUpperCase |
| 05:28 | pyrtsa | Yep, that's thrush written out. |
| 05:28 | wombawomba | right. I think I can avoid using methods |
| 05:51 | AeroNotix | is there a library for common lisp which implements core.clj? |
| 06:06 | sandbags | I am trying to use the Java library Twitter4J. I found it on Maven as {:group-id "org.twitter4j" :artefact-id "twitter4j" :version "4.0.2"} and have [org.twitter4j/twitter4j "4.0.2"] as a depedenency in project.clj but lein deps is saying it can't retrieve org/twitter4j/twitter4j/4.0.2/twitter4j-4.0.2.pom from central |
| 06:06 | sandbags | any hints as to where i went wrong? |
| 06:07 | stevenfx | sandbags: I seem to be having issues with downloading any deps at the moment including clojure itself |
| 06:07 | sandbags | stevenfx: same error? or something different? |
| 06:08 | sandbags | hrmm clojars.org isn't actually loading for me ... maybe a coincidence |
| 06:08 | stevenfx | I just created a test project and this is what I get https://www.refheap.com/88284 |
| 06:08 | sandbags | not sure how clojars could affect my error anyway since the pom is coming from maven |
| 06:08 | stevenfx | possible |
| 06:09 | stevenfx | yeah I think lien checks central first |
| 06:09 | stevenfx | not sure |
| 06:09 | sandbags | your error looks much the same as mine |
| 06:10 | stevenfx | But oddly I can download the file with my browser |
| 06:10 | sandbags | not sure why it's not working for me though... mine is on maven |
| 06:10 | stevenfx | sandbags: what system you on? |
| 06:10 | sandbags | system? |
| 06:10 | stevenfx | OS |
| 06:10 | sandbags | OSX |
| 06:10 | sandbags | 10.9.3 |
| 06:10 | stevenfx | yeah same here |
| 06:11 | stevenfx | maybe there some issue with jvm, Im looking for a fix so I can continue working |
| 06:13 | sandbags | this doesn't feel like a jvm issue to me |
| 06:13 | sandbags | i'd be suspecting some of the plumbing that is used for dependency resolution is b0rked |
| 06:13 | sandbags | odd if you can download the file by hand |
| 06:14 | sandbags | clojars not loading is a bit of a smell |
| 06:14 | stevenfx | yeah I see the same now, clojars is blank |
| 06:14 | stevenfx | but central is still fine so it should still work? |
| 06:15 | sandbags | one would hope but that's a big assumption that clojars isn't a central part of the whole resolution process |
| 06:24 | sandbags | so the question is, who is responsible for clojars.org? I'm sure that info is on the clojars website :) |
| 06:25 | stevenfx | sandbags: technomancy and ato i think? |
| 06:25 | stevenfx | https://github.com/ato/clojars-web/wiki/Contact |
| 06:25 | stevenfx | Not sure if its still like that |
| 06:27 | stevenfx | I think central gets searched first http://goo.gl/DI4tlx |
| 06:27 | sandbags | odd that it fails for me as the POM i need is on central |
| 06:30 | stevenfx | whats your dep again? Let me add it to my test project |
| 06:30 | sandbags | [org.twitter4j/twitter4j "4.0.2"] |
| 06:33 | sandbags | i'm not 100% sure that's right, i'm not very au fait with Maven |
| 06:33 | sandbags | but my other attempts failed in a different way telling me the dependency couldn't be found, rather than couldn't be downloaded |
| 06:34 | stevenfx | Nope, same issue wont work https://www.refheap.com/88328 |
| 06:34 | stevenfx | No you are correct http://search.maven.org/#artifactdetails|org.twitter4j|twitter4j|4.0.2|pom |
| 06:35 | sandbags | okay that's useful to know... took a bit of guesswork on my part |
| 06:35 | stevenfx | Let me check on another system to see if the issue is the same brb |
| 06:41 | stevenfx | sandbags: Same issue on my linux laptop |
| 06:42 | stevenfx | technomancy: You there? |
| 06:44 | sandbags | unlikely now, he's in US |
| 06:44 | stevenfx | yeah, was worth a try :) |
| 06:49 | stevenfx | I added a issue to https://github.com/ato/clojars-web/issues/231 |
| 06:49 | stevenfx | Not sure if it should have gone somewhere else? |
| 06:51 | jelfs | Disclaimer - I have very little idea what I'm doing |
| 06:51 | stevenfx | sandbags: see if this page loads - https://clojars.org/org.clojure/clojure |
| 06:51 | jelfs | I have some code accessing mongdb via monger ... |
| 06:51 | jelfs | and some tests that exercise this code |
| 06:51 | stevenfx | The main webpage does not load but that loads for me |
| 06:51 | jelfs | I had an idea that I might benefit from a data access protocol |
| 06:52 | jelfs | so I could swap out the monger with some in memory atom to speed up tests |
| 06:52 | jelfs | Is this insane or sensible? |
| 06:53 | sandbags | stevenfx: yes that loads for me as well |
| 06:53 | jelfs | If sensible do I have a single defrecord that implements the protocol and decides what method to use |
| 06:53 | jelfs | or do I have two implementations of the protocol and somehow decide which one to use at runtime |
| 06:53 | jelfs | is reify an appropriate solution? |
| 06:54 | hyPiRion | Is there any parsec port in Clojure? |
| 06:55 | ssideris | is instaparse a good candidate? |
| 06:58 | hyPiRion | ssideris: Oh, it was just out of curiosity. |
| 07:01 | hyPiRion | But no, not for streaming parsers, which I am working on now. |
| 07:03 | ssideris | oh ok, didn't know that parsec was streaming |
| 07:10 | sandbags | i'm trying to work out what on earth i should download if i want to install this lib myself |
| 07:10 | sandbags | but the POM file is just an XML document, it's not the code |
| 07:10 | sandbags | hrmm... i have a feeling i've been here before |
| 07:11 | stevenfx | sandbags: there is two ways |
| 07:11 | sandbags | and you can't depend on POM's in project.clj |
| 07:11 | sandbags | yes... i think i've been here before, you can only add artefacts |
| 07:11 | sandbags | (or whatever the word is that isn't a POM) |
| 07:11 | sandbags | yes |
| 07:11 | sandbags | i can successfully require twitter4j-core |
| 07:12 | sandbags | of course i have no idea which of these artefacts i actually need :) |
| 07:13 | stevenfx | yeah that seems to be a pain |
| 07:13 | stevenfx | I feel like I just arrived in the stone age :b |
| 07:14 | sandbags | bundler and rubygems have their warts, but it feels a lot less of a pain than this :) |
| 07:14 | sandbags | on the other hand we could just be amazed that such a Heath-Robinson machine works at all when it works :-) |
| 07:14 | stevenfx | but I think we might be the only two with this issue? |
| 07:15 | stevenfx | because no one else has complained yet |
| 07:15 | sandbags | i no longer have an issue per se |
| 07:15 | stevenfx | lol I still have issues getting deps from maven central or clojars :) |
| 07:16 | sandbags | if i could just remember next time that you can't depend on a POM i will be in good shape |
| 07:16 | stevenfx | but I have a fresh lein install with no cached deps |
| 07:17 | stevenfx | maybe thats why no one has realized? |
| 07:17 | sandbags | i feel your pain |
| 07:17 | sandbags | could be |
| 07:17 | stevenfx | oh well, maybe its time for coffee and a break :D |
| 07:17 | sandbags | it's not unusual for bootstrap cases to be less well tested |
| 07:18 | stevenfx | true |
| 07:19 | stevenfx | Il bug one of the maintainers to check if its just me when they come online |
| 07:19 | stevenfx | if I am online still :) |
| 07:19 | sandbags | if you gist your steps, if i'm around later and you aren't i'll bring it up |
| 07:20 | hhenkel | Hi all, any hint what the problem is: https://www.refheap.com/88333 ? |
| 07:20 | stevenfx | Thanks sandbags, let me do that after my break |
| 07:22 | agarman | hhenkel: looks like trying to use a function as a number |
| 07:23 | hhenkel | agarman: yes that is what I understand from the exception but I don't understand why at the moment. |
| 07:23 | hhenkel | Is there something wrong with the doall ? |
| 07:24 | hhenkel | server-config is a lazySeq |
| 07:24 | agarman | hhenkel: without seeing the pos?, I can't really say |
| 07:25 | agarman | hhenkel: there's no call to pos? in the snippet here, but that's what's failing |
| 07:26 | agarman | hhenkel: nvm, dorun has pos? call, I'm looking there...a moment |
| 07:26 | agarman | yeah, you're calling the wrong version of doall |
| 07:26 | hhenkel | agarman: I don't have any pos? in my code. |
| 07:27 | hhenkel | From the stack trace the error is within the snippet. |
| 07:27 | hhenkel | That would explain things....so how to call a "different" version? |
| 07:27 | agarman | if doall has two arguments, the first is a number, second a collection |
| 07:29 | hhenkel | But the exception is that the function could not be casted to a number or am O wrong? |
| 07:29 | agarman | hhenkel: are you trying to schedule requests for each server config? |
| 07:30 | hhenkel | yes I do |
| 07:30 | agarman | then do you mean to do (doall (#(map schedule-requests % data-channel atat-pool) server-config))? |
| 07:31 | hhenkel | But that will happen later on, I'm allready failing to call my function "schedule-requests" |
| 07:36 | hhenkel | agarman: That looks "better" though I get a different error now. |
| 07:37 | hhenkel | agarman: I now see an error "java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core.async.impl.channels.ManyToManyChannel" |
| 07:38 | hhenkel | agarman: I guess I need a (repeat data-channel) ? |
| 07:38 | hhenkel | And also for the atat-pool thing. It looks like it is working with that now. |
| 07:43 | agarman | hhenkel: good :-) |
| 07:50 | hhenkel | agarman: Are you familar with async? I'm seeing an "IllegalArgumentException" but there is no stacktrace so I'm not sure where it happens |
| 07:51 | hhenkel | Here is the error |
| 07:51 | hhenkel | https://www.refheap.com/88335 |
| 07:52 | hhenkel | The part after "TRACE response" is what I'd like to put into the channel. |
| 07:58 | agarman | hhenkel: can't really help w/o more context, all I can tell is that somewhere there's code trying to take! or <! from an arraylist |
| 07:59 | hhenkel | agarman: hmm, I guess the response gives me a java.arraylist and I need to cast it to somethin clojure like |
| 08:02 | hhenkel | agarman: Casting with (into [] (...)) seems to help |
| 08:06 | luxbock | could anyone here explain what the => macro in Prismatic's schema does? I don't understand the documentation |
| 08:06 | hhenkel | agarman: Hmm I've been glad too soon. Seems like I need to figure out what datatype I can put on the channel first. |
| 08:10 | hhenkel | agarman: Okay, figured out that I just copied stuff from "old" code where I was handling https reponse data. There is no need to do a !< at all... |
| 08:49 | stevenfx_ | would look good with a clojure icon :) http://vorillaz.github.io/devicons/ |
| 08:51 | CookedGr1phon | does anyone know if I can include aliases with a leiningen plugin? |
| 09:14 | hyPiRion | CookedGr1phon: you can with middleware, I think. But couldn't you provide the functionality within the plugin task you define? |
| 09:16 | CookedGr1phon | hyPiRion: yeah, but it feels clunkier calling set-profile and executing subtasks when I could express it in an alias in a way that the user could look at it and change the steps/profile they want to execute with |
| 09:16 | CookedGr1phon | i want to set the profile and do three subtasks |
| 09:16 | CookedGr1phon | I've done that now anyway |
| 09:51 | moses | This question has to come up a lot, but Om, Reagent or Quiescent? |
| 09:51 | moses | Anyone with experience in all three care to offer an opinion? |
| 10:33 | boxed | anyone know of a pprint version that can handle output that is largeish.. like ~200k? |
| 10:33 | hcumberdale | hi |
| 10:33 | stuartsierra | boxed: dunno, but brandonbloom has a pprint that's supposed to be faster than core's. |
| 10:34 | hcumberdale | (apply (fn [_ w _ wo] {:w w :wo wo}) [true '((a b) (c)) false '((d) (e f))]) << is there a better way |
| 10:34 | hcumberdale | trying to split a structure by some fn with group-by, want to dismiss the "true" "false" and directly get the two resulting structures |
| 10:35 | arrdem | $google github bbloom fipp |
| 10:35 | lazybot | [brandonbloom/fipp · GitHub] https://github.com/brandonbloom/fipp |
| 10:35 | stuartsierra | hcumberdale: vals ? |
| 10:36 | boxed | stuartsierra: hmmm… java.lang.ClassNotFoundException: jsr166y.ForkJoinPool :( |
| 10:37 | hcumberdale | thx stuartsierra !! |
| 10:37 | stuartsierra | boxed: Sounds like you're trying to use Clojure reducers on JDK 1.6 |
| 10:37 | boxed | well crap |
| 10:38 | boxed | thanks |
| 10:38 | stuartsierra | You can add a dependency on jsr166y (http://search.maven.org/#artifactdetails%7Corg.codehaus.jsr166-mirror%7Cjsr166y%7C1.7.0%7Cjar) or get a JDK 1.7 |
| 10:39 | boxed | stuartsierra: cool, thanks |
| 10:39 | stuartsierra | On a related note, it would be awesome to teach a bot how to query search.maven.org and Clojars. |
| 10:40 | arrdem | yeah, that'd be nice. maybe if I ever get around to building a clojurebot clone that doesn't ignore me and has a grimoire command that'll happen. |
| 10:41 | boxed | stuartsierra: that worked and is pretty damn fast, thanks again |
| 10:41 | stuartsierra | http://search.maven.org/#api |
| 10:41 | boxed | arrdem: well I’m currently working on making the cheatsheet usable from other code :P |
| 10:42 | arrdem | boxed: 's legit. I'm gonna try and spend some quality time with Grimoire later today if I can get this hello world demo working. |
| 10:43 | arrdem | gotta figure out a way to modularize examples so that I can take example PRs without having to re-apply the patches by hand every time I blow the whole site away. |
| 10:44 | Glenjamin | are they not one file per example at the mo? |
| 10:45 | arrdem | Glenjamin: nope, it's one file with an include prefix for every version. |
| 10:45 | arrdem | sadly. |
| 10:45 | arrdem | it needs to be one file per example |
| 10:45 | arrdem | https://raw.githubusercontent.com/arrdem/grimoire/master/_includes/1.4.0/clojure.core/DASH__GT/examples.md |
| 10:45 | arrdem | case in point |
| 10:45 | Glenjamin | i see |
| 10:46 | boxed | what’s the plan? to have a non-versioned filename and if there’s a specific version file use that instead? |
| 10:47 | Glenjamin | can you use yaml frontmatter perhaps? |
| 10:47 | Glenjamin | i dunno how flexible jekyll is, but being able to tag files as version X+ would be neat |
| 10:48 | arrdem | jekyll's not that flexible. |
| 10:48 | arrdem | I suspect this is gonna be the thing that forces me to build a "real" static site gen from one of the Clojure frameworks. |
| 10:48 | arrdem | but we'll see. |
| 10:50 | arrdem | I really don't want to go to a db backed site, both for performance and for ease of contribution/management. |
| 10:52 | _alejandro | Is it possible to use project.clj to force a jdk version? e.g. fail if JDK < 1.7 ? |
| 10:52 | Glenjamin | yeah, i think github pages + PRs is a solid model |
| 10:52 | Glenjamin | especially as the number of people who can merge PRs goes up |
| 10:53 | arrdem | Right. Besides, GH/PRs provides "auth" at zero cost/effort to me :P |
| 10:53 | boxed | yea, the key is to have a lot of committers |
| 11:00 | deathknight | Got my feet wet with clj-amazon...realized I must learn the way of the macro *_* |
| 11:01 | wink | If you stare into the macro, the macro stares back at you. |
| 11:01 | arrdem | of macros and basilisks? |
| 11:02 | deathknight | hah! |
| 11:02 | deathknight | given enough time, a macro will compile itself |
| 11:02 | arrdem | I don't think that's how deterministic pattern engines work :P |
| 11:03 | deathknight | given enough time! |
| 11:41 | gfredericks | does the JVM not have any mechanism for globally setting an uncaught exception handler? |
| 11:42 | arrdem | does the JVM have a mechanism for entering arbitrary code execution at global scope? |
| 11:42 | gfredericks | the jvm has scope? |
| 11:43 | arrdem | I apologize I'm snarking. No. There shouldn't be such a thing. All exception handling is installed on a per-code block basis in an exception handler table that's part of each individual method. |
| 11:44 | bbloom | arrdem: um no |
| 11:44 | bbloom | gfredericks: yes |
| 11:44 | arrdem | bbloom: rly? |
| 11:45 | stevenfx | devicons that’s trending on HN will add a clojure icon :) http://goo.gl/LcSKxG |
| 11:45 | bbloom | http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.UncaughtExceptionHandler.html |
| 11:46 | gfredericks | bbloom: that's per thread |
| 11:46 | arrdem | (inc bbloom) |
| 11:46 | lazybot | ⇒ 37 |
| 11:46 | bbloom | gfredericks: read the "see also" |
| 11:46 | bbloom | you can also do it per thread group |
| 11:46 | bbloom | and thread groups form a hierarchy |
| 11:47 | bbloom | you can also set the "default" handler which will affect threads that don't override the handler |
| 11:49 | stevenfx | well its time to go home, have a good weekend everyone |
| 11:54 | gfredericks | bbloom: oh I missed that static method -- cool, thanks! |
| 12:12 | CookedGr1phon | I'm running clojure on android, trying to get it up and running on the newer ART runtime |
| 12:12 | CookedGr1phon | and I have been successful... if I remove all uses of the locking macro |
| 12:13 | CookedGr1phon | I'm tempted to put it down to an ART runtime bug, but if anyone has any insights I'd appreciate it |
| 12:13 | boxed | fucking midje “no such namespace” bullshit >_< |
| 12:31 | boxed | arrdem: 250k for the EDN with all the metadata etc… compresses to 47k |
| 12:32 | andyf | boxed: I am an atheist, but IMO the serenity prayer contains useful advice (see e.g. Wikipedia) |
| 12:32 | boxed | :P |
| 12:33 | boxed | the vast majority is the meta info like the doc string etc |
| 12:34 | sritchie | dnolen_: hmm, running into an odd thing - I’ve got a dropdown component that’s successfully triggering a state update via om/update! (actually, passing its value through a channel to an upper component that does the update!), |
| 12:34 | sritchie | but the update doesn’t trigger a re-render |
| 12:35 | sritchie | so the dropdown component’s value doesn’t change, even though the state is indeed changed |
| 12:35 | dnolen_ | sritchie: my experience is that 90% of the time there's a mistake somewhere in case like this |
| 12:35 | sritchie | :) I believe it |
| 12:36 | dnolen_ | sritchie: otherwise you need to show me a minimal example that has nothing to do w/ your project |
| 12:36 | sritchie | yup, understood… let me see if I can isolate it |
| 12:37 | seangrove | dnolen_: Some cljs webgl art https://www.dropbox.com/s/vgw61ivobkx597f/glint_webgl_abstract_art.mp4 |
| 12:37 | elben | Is there a way to *not* include the clojurescript deps when using hickory (https://github.com/davidsantiago/hickory)? The project.clj has clojurescript listed in the main :dependencies |
| 12:37 | sritchie | this is the thing I was doing yestsreday that I worried would screw up the re-rendering |
| 12:37 | sritchie | https://gist.github.com/sritchie/1d202fc672ddf905cd13 |
| 12:37 | seangrove | dnolen_: It's been pretty fun combining cljs and webgl so far |
| 12:37 | sritchie | “static” and “dynamic” are cursors |
| 12:37 | sritchie | and this is what’s changing in the global state: :selection (-> dynamic :entries (get (:id e))) |
| 12:37 | dnolen_ | seangrove: pretty :) |
| 12:37 | arrdem | elben: lein's documentation specifies how to write dependency exclusions. |
| 12:38 | sritchie | I’ll keep playing with it |
| 12:38 | elben | arrdem: oh that’s right, thank you for pointint that out |
| 12:38 | sritchie | dnolen_: ah! the higher level re-render does get triggered. I’ll figure this one out, on track now |
| 12:42 | munderwo | Hi all. Im trying a really simple split string with question mark form and its not working. see https://www.refheap.com/88343 for what Im trying to do and what Im getting. |
| 12:42 | munderwo | Any help? I can split on other things but obviously the ? is a special character? |
| 12:43 | justin_smith | munderwo: ^ matches the beginning of a line |
| 12:44 | munderwo | *facepalm* |
| 12:44 | nbeloglazov | munderwo: also you don't need to use 2 slashes: "\?" |
| 12:44 | munderwo | thanks justin_smith I know it would be something easy.. damn regex's that I never learnt... |
| 12:44 | boxed | andyf: without the metadata: 46k uncompressed :P |
| 12:45 | justin_smith | ,(clojure.string/split "/2010-04-01/Accounts/ACe248350937deb36e8f5e19c882d1679b/Messages.json?PageSize=50&Page=5" #"\?") munderwo |
| 12:45 | clojurebot | ["/2010-04-01/Accounts/ACe248350937deb36e8f5e19c882d1679b/Messages.json" "PageSize=50&Page=5"] |
| 12:45 | munderwo | nice thanks! |
| 12:45 | justin_smith | you were also escaping the '?' wrong, with an extra \ |
| 12:46 | justin_smith | munderwo: also, there are classes available that do proper URL deconstruction |
| 12:46 | arohner_ | munderwo: you can probably also use something like https://github.com/cemerick/url |
| 12:47 | munderwo | Oh cool. I found a different one, but that one looks better. In this case I just need the url part, but probably later on construction and deconstruction will be helpful. Also in this case I dont have the host or protocol part so I thought that might be difficult. Thanks! |
| 12:48 | justin_smith | munderwo: in my experience when I don't have the host or protocol part that is because I am serving the request, and ring breaks up the parts for me (and my routing library makes sure it gets sent to the right code) |
| 12:49 | munderwo | Yeah, this in particular is a client for a third-party api. So I only have what they give me :) |
| 12:54 | sritchie | dnolen_: yeah, was a stupid misnamed key |
| 12:54 | dnolen_ | sritchie: k cool |
| 13:22 | arrdem | Bronsa: t.e.jvm.transform/get-class has to do classloading, right? |
| 13:27 | Bronsa | arrdem: well it returns a Class instance so it does load it |
| 13:27 | arrdem | mmk. That's what I thought. |
| 13:28 | arrdem | there's reordering weirdness happening here... classes are being generated out of order and it's not good. |
| 13:29 | Bronsa | arrdem: tej or oxcart? |
| 13:29 | arrdem | oxcart. your code is working fine. |
| 13:29 | Bronsa | phew |
| 14:24 | augustl | in "components", what exactly is map->Database in the new-database function in the readme? https://github.com/stuartsierra/component |
| 14:24 | augustl | I don't understand how to implement the component/system-map since it operates on these magic map->Database thingies |
| 14:25 | gfredericks | um |
| 14:25 | stuartsierra | map->Database is a constructor function generated automatically by `(defrecord Database …)` |
| 14:26 | augustl | ah, I haven't used records all that much, thanks |
| 14:26 | augustl | (map->Database {:host host :port port}) will be the same as (Database. host port) then I guess |
| 14:26 | stuartsierra | yes |
| 14:27 | stuartsierra | With the map->Record form you can omit some of the keys and they will get nil values. |
| 14:28 | augustl | for me, it would have been useful if the first component/system-map call in the README had something like (ExampleComponent. x y) instead of (new-scheduler) |
| 14:30 | stuartsierra | Noted. My use cases almost always have custom constructor functions. |
| 14:31 | stuartsierra | Maybe I'll add something like "Keys in the system map are usually keywords. Values in the system map are *instances* of components, usually records or maps." |
| 14:34 | augustl | it was really just the map->RecordName that confused me, wasn't aware it existed :) |
| 14:37 | gfredericks | it doesn't get a lot of publicity outside of component |
| 14:44 | PigDude | korma seems to not support composing queries at all |
| 14:45 | PigDude | at a superficial level it does, but the API doesn't allow you to work with a naked (where CONDS), etc. |
| 14:45 | PigDude | please somebody tell me i'm wrong about this ... |
| 14:45 | amalloy | PigDude: korma is famous for being easy right up until it's impossible |
| 14:45 | cbp | that is what happens when your api is all macros |
| 14:46 | PigDude | amalloy: :( i was going to use plain jdbc but the guy i'm working with pushed really hard for korma backend |
| 14:46 | amalloy | who is this guy? push him in the back end |
| 14:46 | PigDude | the docs example (-> (select* users) (where {:first "john" :last "doe"})) is deceptive because the (where) is getting (and needs) two args |
| 14:46 | technomancy | now you get bonus i-told-you-so points |
| 14:46 | PigDude | amalloy: somebody smarter than me? :) |
| 14:47 | PigDude | ok, thanks guys |
| 14:47 | cbp | when a lib's api is just macros it just mostly spells trouble |
| 14:47 | PigDude | i had misgivings about korma first time i used it and looked at its code |
| 14:47 | arrdem | macros |are| misgivings |
| 14:47 | PigDude | haha |
| 14:47 | PigDude | yea, it really makes the api clumsy |
| 14:47 | PigDude | makes me miss django orm :P |
| 14:48 | PigDude | or sqlalchemy. i'm not going full orm but are there projects like this in clojure? |
| 14:48 | PigDude | that will allow you to compose queries this way |
| 14:48 | cbp | I use strings |
| 14:48 | amalloy | PigDude: that's not really deceptive: it's blatantly clear that where gets two args there |
| 14:49 | PigDude | amalloy: that's why i asked here, maybe i am wrong, but docs say "You can also call the (where) and (having) predicates like any normal function, allowing you to compose your predicate clauses as if they were standard Clojure code." and i cannot achieve this usage |
| 14:50 | PigDude | i'm pretty sure this line is misleading |
| 14:51 | bbloom | i've just given up on trying to "compose" sql |
| 14:51 | bbloom | $google yesql |
| 14:51 | lazybot | [krisajenkins/yesql · GitHub] https://github.com/krisajenkins/yesql |
| 14:52 | arrdem | not yasql? |
| 14:52 | bbloom | copy/paste reuse tends to work just fine for sql :-/ |
| 14:52 | bbloom | that, or you can build your .sql file from a .sql.cat script |
| 14:53 | bbloom | weeee cat<<! heredocs |
| 14:54 | PigDude | bbloom: :\ |
| 14:54 | PigDude | bbloom: i've worked on large projects that take the sql-as-string approach and it has certain limitations |
| 14:54 | PigDude | bbloom: and in my experience, more defects |
| 14:55 | PigDude | bbloom: it would work fine for this application though |
| 14:55 | bbloom | PigDude: that's the beauty of the catscript & yesql (or similar) approach: you can visually inspect the generated sql, which is static at program start |
| 14:55 | cbp | man that sounds like a pretty bad idea to me |
| 14:55 | bbloom | and you can commit the generated code to see if your generator breaks it |
| 14:55 | cbp | sql is hard to read therefore let's stuff it in randomly named files all over the place |
| 14:55 | PigDude | neat, will have to take a look |
| 14:55 | arrdem | cbp: /resources/sql/*? |
| 14:55 | bbloom | i've seen LOTS of rails apps w/ serious security flaws b/c a tiny change in one place causes a where clause or join to disappear or something like that |
| 14:56 | bbloom | i much rather have manually written sql per use case, then do custom generation where i actually need abstraction |
| 14:56 | bbloom | if your table scheme is static (and it is 99% of the time) your queries should be static too |
| 14:56 | cbp | arrdem: that's not that much better than / |
| 14:56 | bbloom | schema* |
| 14:57 | arrdem | cbp: sure, but you're also not mashing it into src/ |
| 14:57 | PigDude | bbloom: shouldn't conflate ActiveRecord with all db/schema/query abstraction |
| 14:57 | PigDude | bbloom: sqlalchemy is very low-level, for isntance |
| 14:57 | cbp | now your sql queries probably have to follow some directory structure and some naming conventions and ugh what a pita |
| 14:57 | bbloom | PigDude: i've used sqlalchemy before as well, it's much nicer than active record and also much nicer than arel (the internals of active record which copied sqlalchemy) |
| 14:58 | bbloom | but as far as i can tell, if you're not going to pull a full Linq, you might as well not even try |
| 14:58 | cbp | If syntax highlighting is so important surely you can just use IDEA |
| 14:58 | PigDude | bbloom: i'll tell that to all the projects using sqlalchemy :) |
| 14:58 | bbloom | PigDude: there are plenty of good use cases for query abstraction |
| 14:58 | bbloom | PigDude: and you could do far worse than sqlalchemy |
| 14:58 | PigDude | bbloom: at my last job we were using it on small facility servers, i don't know how easy it would be to use linq in such a context |
| 14:59 | bbloom | and you can do far better: https://en.wikipedia.org/wiki/Language_Integrated_Query |
| 14:59 | PigDude | hehe you mean FORCE.COM? :) |
| 14:59 | bbloom | PigDude: don't get me started on SOQL |
| 14:59 | PigDude | aka SOQL |
| 14:59 | bbloom | what a disaster |
| 14:59 | PigDude | hehe |
| 14:59 | PigDude | yea |
| 15:00 | bbloom | sqlalchemy also has quite a few subprojects |
| 15:00 | bbloom | the query generation is fine, but the schema generation is just as bad an idea as activerecord |
| 15:00 | bbloom | although scheme reflection is not terrible |
| 15:01 | bbloom | s/scheme/schema again |
| 15:01 | bbloom | argh |
| 15:02 | amalloy | bbloom: just add an autocorrect rule for scheme->schema. it will prove entertaining in future discussions anyway |
| 15:02 | PigDude | bbloom: hehe i gave a presentation last week on clojurescript and closure tools, so much ambiguity |
| 15:25 | jcromartie | I can't get lein cljsbuild to compile the simplest possible cljs file |
| 15:26 | cbp | an empty file? |
| 15:26 | augustl | when creating jar files for folks to self-host, I suppose having a plain old properties file in the same dir as the jar is a sane way of providing configurability? |
| 15:35 | jcromartie | well just a js/alert |
| 15:35 | jcromartie | it might be my project's insane deps |
| 15:35 | jcromartie | but I just get a massive stack trace from the clojurescript compiler… I'm trying to make a minimal test case |
| 15:35 | jcromartie | I'm adding cljs to my existing app |
| 15:35 | jcromartie | which is quite large |
| 15:37 | cbp | cljs gives pretty massive stack traces |
| 15:37 | bryanmaass | PigDude: is that talk avaliable online anywhere? |
| 15:40 | jcromartie | (ns app.core) |
| 15:40 | jcromartie | (js/alert "loaded") |
| 15:40 | jcromartie | that's my file |
| 15:41 | jcromartie | I don't even feel bad pasting it here |
| 15:41 | jcromartie | now, the stack trace... |
| 15:41 | jcromartie | https://gist.github.com/jcromartie/6153611f4ef070b51738 |
| 15:41 | jcromartie | :) |
| 15:42 | cbp | shouldn't the path be src/cljs/app/core.cljs? |
| 15:44 | cbp | mm actually i guess it might not say the whole path |
| 15:59 | stuartsierra | That's not a Clojure stack trace. That's not even a Java stack trace. It's something generated by a library trying to make the Java stack trace "pretty." |
| 15:59 | stuartsierra | And probably losing information on the way. |
| 15:59 | amalloy | jcromartie: are you sure that's the source file you're compiling? the stacktrace for that suggests your ns form has an empty :use-macros clause in it or something |
| 16:00 | stuartsierra | ~seen talios |
| 16:00 | clojurebot | talios was last seen joining #clojure, 888 minutes ago |
| 16:00 | amalloy | $seen talios |
| 16:00 | lazybot | talios was last seen quitting 14 hours and 1 minute ago. |
| 16:01 | stuartsierra | thanks amalloy |
| 16:01 | amalloy | cause math is hard |
| 16:08 | stuartsierra | Fun with class loaders http://dev.clojure.org/jira/browse/CLASSPATH-6 |
| 16:09 | mdrogalis | Fun. Sure. D: |
| 16:10 | mdrogalis | Haha. |
| 16:16 | stuartsierra | Or, ways in which `java -jar` is not the same as `java -cp` for $800, please, Alex. |
| 16:16 | amalloy | stuartsierra: this is sorta a symptom of pretending that all classloaders use the classpath, right? that is, the real, general mechanism is this opaque "i need the class or resource named X, please find it", but we've built stuff assuming that it's based on a list of resource paths to look in? |
| 16:16 | stuartsierra | amalloy: yes |
| 16:21 | amalloy | stuartsierra: i'm curious, since you tested this ticket: does loading the resources by name with c.j.io/resource work? or are they totally unobtainable? |
| 16:23 | stuartsierra | amalloy: interesting question, trying it ... |
| 16:24 | amalloy | i'd guess that they are in fact loadable by name |
| 16:25 | stuartsierra | amalloy: Yes, loading resources still works. |
| 16:27 | PigDude | bryanmaass: only slides http://oinksoft.com/closure-tools/sgdg-jul14/ |
| 16:31 | mikerod | stuartsierra: I like this line "There is no obvious API for getting the Class-Path property of the manifest file without opening and reading the contents of the JAR file." |
| 16:31 | mikerod | Why must Java make the ClassLoader API so hard to deal with. |
| 16:31 | stuartsierra | This particular case looks like it might be an oversight. |
| 16:31 | mikerod | it always comes back to opening jars and digging things out yourself. :( |
| 16:32 | stuartsierra | Obviously, internally there's some code that reads the manifest. |
| 16:32 | stuartsierra | In OpenJDK I can find it in sun.misc.URLClassPath. |
| 16:32 | mikerod | ah |
| 16:33 | stuartsierra | But the Launcher class doesn't use that when you call .getURLs. |
| 16:35 | augustl | in "components", does it make sense to create a bunch of threads when creating the component, and start them in Lifecycle/start? /cc stuartsierra |
| 16:35 | alandipert | jcromartie, that's the error you get when clojure 1.6 and 1.5 are in play and you're trying to cljs with a version using 1.6 |
| 16:36 | stuartsierra | augustl: sure |
| 16:36 | augustl | I suppose creating a Thread object doesn't have any special overhead |
| 16:36 | stuartsierra | Or create & start the threads in Lifecycle/start, not much difference. |
| 16:37 | augustl | the reason I want to split it up is that I want the threads in shutdown, so I can kill them. That way the start method only starts, it's not responsible for also returning that collection of thread objects as well |
| 16:37 | augustl | s/shutdown/stop |
| 16:37 | stuartsierra | `start` still has to return the component containing all the thread instances. |
| 16:39 | augustl | ah, right |
| 16:40 | martinklepsch | can I alias a function in a way that preserves metadata and it's signature? |
| 16:41 | amalloy | martinklepsch: you can, and ztellman/potemkin contains such a feature. i'd advise against doing it without a strong reason, but i no longer think it's as unspeakably evil as i used to |
| 16:41 | ztellman | amalloy: good, goooooood, give into the namespace aliasing |
| 16:42 | aperiodic | amalloy: do you mind explaining what changed your mind? |
| 16:43 | martinklepsch | amalloy: the reason is that a library maps very directly to methods of annother API and not having the function gives the impression it's not implemented |
| 16:43 | martinklepsch | amalloy: more here: https://github.com/clojurewerkz/elastisch/issues/96 |
| 16:43 | stuartsierra | (refer 'clojure.set :rename {'union 'u}) |
| 16:43 | alandipert | i used to think everything ztellman did was evil until started using it all |
| 16:44 | martinklepsch | (I'm not sure either if it's the best way to go, so feel free to enlight me with your opinions :) |
| 16:44 | amalloy | one of ztellman's READMEs somewhere arguing that you shouldn't have to make your public api mirror your internal structure. so you have the real internal structure for use within your library, and some set of hand-curated external api namespaces to make using it possible without knowing the internal structure |
| 16:44 | ztellman | alandipert: thanks for providing the anchor quote for my three part series: "Fall and Decline of the Clojure Emprie" |
| 16:45 | bacon1989 | ,(def x (atom nil))(not= @x nil) |
| 16:45 | clojurebot | #'sandbox/x |
| 16:45 | ztellman | that would be https://github.com/ztellman/potemkin#import-vars |
| 16:45 | bacon1989 | ,(println (not= @x nil)) |
| 16:45 | clojurebot | false\n |
| 16:45 | bacon1989 | ? |
| 16:46 | bacon1989 | man, i'm getting different results, maybe it's something else |
| 16:46 | amalloy | ztellman: it was actually the factual api server. i wouldn't be caught dead reading potemkin's readme |
| 16:46 | ztellman | amalloy: I'll get right on open sourcing that |
| 16:47 | stuartsierra | martinklepsch: If it's just for local use, `refer` does what you need. |
| 16:47 | Zekka | Hey: I'm a Haskell programmer who's using Clojure for a work project and finding it kind of hard to debug -- do any of you have suggestions for how I ought to be doing it? |
| 16:48 | Zekka | I'm mostly upset because it seems like the bulk of the errors I get occur at runtime and don't get to the heart of the issue -- because of the lack of type constraints they occur as soon as a problem actually happens, not i.e. at the entry point to the part of the code where the problem first happens |
| 16:48 | Zekka | (so if I accidentally pass a widget to a function expecting a string, for instance, but which stores it instead of operating on it immediately, it'll gleefully store it and then fail when operating on it instead of failing at the point of storing it) |
| 16:49 | gfredericks | Zekka: there's a spectrum of tactics |
| 16:49 | stuartsierra | Zekka: assertions and pre/post conditions are generally your friend in these cases. |
| 16:49 | Zekka | I know Clojure has optional type-annotations but when I'm using libraries that don't use them or encourage you to use them it seems to me like there's not a reasonable way of going about it |
| 16:49 | martinklepsch | stuartsierra: basically I want to define a fun-b in the same namespace that looks exactly like fun-a including (doc fun-b) etc |
| 16:50 | martinklepsch | stuartsierra: sure that refer is the way to go still? reading the documentation I'm not sure how I'd accomplish that |
| 16:50 | Zekka | stuartsierra: Do you have any docs you can recommend? |
| 16:51 | stuartsierra | martinklepsch: No, refer won't do that. I wouldn't do that either. |
| 16:51 | Zekka | (actually, in general I wish I was better at debugging code in dynamic languages: it's really hard!) |
| 16:52 | arrdem | $google fogus :pre :post |
| 16:52 | lazybot | [fogus: Clojure's :pre and :post] http://blog.fogus.me/2009/12/21/clojures-pre-and-post/ |
| 16:52 | martinklepsch | stuartsierra: so in respect to that issue (https://github.com/clojurewerkz/elastisch/issues/96) could you give me any advice what you think would be a good idea to do? just leave it as is? /cc amalloy |
| 16:52 | Zekka | Thanks! |
| 16:53 | augustl | stuartsierra: btw, just wanted to say nice job on actually managing to sell dependency injection as a _good_ thing at euroclojure :) |
| 16:53 | gfredericks | unrelated: I am uncomfortable using lazy seqs in such a way that realizing one extra element is catastrophic |
| 16:54 | stuartsierra | martinklepsch: I don't understand the issue, sorry. |
| 16:54 | stuartsierra | augustl: thanks! |
| 16:54 | Zekka | arrdem: Would an idiomatic usage be to define an i.e. takes-widget function that adds an 'is really a widget' precondition to the function's argument? |
| 16:54 | augustl | stuartsierra: ended up doing something similar at current client which is a Groovy shop - spring-context stand-alone in a small Gradle based app does the same job |
| 16:55 | Zekka | (in general, is using higher-order functions to wrap existing functions with assertions the 'correct' approach?) |
| 16:55 | arrdem | Zekka: I do that sort of thing all the time. Write a static type sig, and pre/post validate it. |
| 16:55 | amalloy | Zekka: clojure doesn't really have optional type annotations. typehints are optimization tips for the compiler, not safety constraints |
| 16:55 | arrdem | Zekka: introspecting fns to say "is this really the kind of fn I expect" doesn't really work tho unless you're willing to manually manage metadata |
| 16:56 | Zekka | arrdem: It's less introspecting and more writing higher-order functions that add the pre/post tags as in the example |
| 16:56 | Zekka | Do you usually put the pre/post tags directly onto your functions or do you add them using separate higher-order functions to keep them general? |
| 16:57 | amalloy | martinklepsch: i don't understand what question you're asking either |
| 16:57 | Zekka | I can pastebin an example if it's not clear what I'm getting at. |
| 16:58 | Zekka | actually, not sure how to write an exaxmple that's clearer than what I already said |
| 16:59 | arrdem | I mean... you seem to be asking if it's idiomatic to write {:pre [(is-my-complex-type? foo)]}.. |
| 16:59 | Zekka | arrdem: That's not quite it |
| 17:00 | mikerod | Zekka: I like Prismatic schema a lot |
| 17:00 | Zekka | The article you linked defines a function that takes an existing function and wraps it to add those checks, which it didn't have before |
| 17:00 | mikerod | $google prismatic schema |
| 17:00 | lazybot | [Prismatic/schema · GitHub] https://github.com/Prismatic/schema |
| 17:00 | celwell | I have a clojure web app on Amazon Beanstalk, and I"m using Amazon RDS for a mysql db I'm connectin to. Does clojure have an equivalent of phpMyAdmin that I can use to manage the database efficiently, or am I stuck with the command line? |
| 17:01 | alandipert | celwell, you could just use phpMyAdmin, no? |
| 17:01 | Zekka | Is it ordinary style to write functions of that kind so that you can write code that's 'polymorphic over functions that meet this group of assertions' |
| 17:01 | Zekka | polymorphic over 'functions that meet this group of assertions'* |
| 17:02 | systemfault | celwell: Not sure why you couldn’t use mysqlworkbench or phpmyadmin. |
| 17:02 | martinklepsch | amalloy: hah, ok. Let me try again: there is an API the elasticsearch clojurewerkz library implements. This API contains the various query types for querying elasticsearch. Two query types are almost identical ("term" & "terms" query) and implemented in one function, therefore they don't show up in the codox documentation and someone could falsely assume that the "terms" query is not implemented. That's what I did. Is |
| 17:02 | martinklepsch | there any way to get it into the API docs without duplicating code or do you think it should just not be in there then? |
| 17:02 | martinklepsch | amalloy: (I'm sorry for the very long text) |
| 17:02 | celwell | alandipert: then I would have to create another beanstalk instance, right? (or are you saying run phpmyadmin locally but connect remotely to aws?) |
| 17:02 | augustl | any suggestions on how to fix this code so the component start adds a list of all the created threads to the component? https://gist.github.com/augustl/3e9ecb8fc813b72ec402 |
| 17:02 | Zekka | More generally I'm trying to ask if there are other ways to express that kind of polymorphism which are preferred, or whether that polymorphism typically comes about |
| 17:02 | amalloy | i would just do what everyone else in that issue thread is saying: define another function that calls it |
| 17:02 | amalloy | if you want to instead alias it and copy the metadata, then go ahead i guess, but i don't see the value in it |
| 17:03 | alandipert | celwell, ah, right - i see what you mean now. no, not aware of JVM resident phpmyadmin options in or out of clj |
| 17:03 | augustl | thinking of looking into ways of using zeromq that doesn't involve all this manual thread creation, but perhaps just a single executor that I can return and kill in stop |
| 17:03 | Zekka | mikerod: This looks interesting! |
| 17:03 | stuartsierra | augustl: (doall (for [n (range 4) (doto (Thread. …)))) |
| 17:03 | augustl | stuartsierra: ah, doall, thanks :) |
| 17:04 | stuartsierra | augustl: I gave up on ZeroMQ for this reason. |
| 17:04 | Zekka | Once I make sure there aren't glaring bugs in my current program I'll see if I can integrate this |
| 17:04 | augustl | stuartsierra: it's nice for rpc though :) |
| 17:04 | alandipert | Zekka, you can group implementations around a single function ("precondition") with multimethods, or you can group types by capability with protocols (similar to typeclasses) |
| 17:05 | augustl | apparently there are ways to create a single poller thread that dispatches to a thread pool |
| 17:05 | alandipert | Zekka, what you're asking for sounds like perl subset types or maybe dependent types, is that what you're looking for? |
| 17:05 | Zekka | alandipert: Do Clojure's contracts work for protocol and multimethods? |
| 17:05 | mikerod | Zekka: I have found the Prismatic schema to be easy to throw on top of my existing structure. I like how it allows you to "minimally" specific constraints for fn. Also, the schema representation is built-in good and uniform documentation. |
| 17:05 | alandipert | Zekka, implementations of either can have conditions, yes |
| 17:05 | alandipert | Zekka, what isn't possible is type-level conditions on either |
| 17:06 | Zekka | alandipert: Not really: it's more that I'm trying to use pre/postconditions to approximate what I usually get from types in a pure language |
| 17:06 | Zekka | I'm trying to make specific statements about behavior but those statements aren't the sort of thing that would necessarily require dependent types to make |
| 17:06 | technomancy | I wonder how horrible it would be to write something that doseqs over the current namespace's ns-publics and wraps everything that isn't metadata opted-out with a "this function should never take/return nil" pre/post |
| 17:06 | technomancy | kinda tempted |
| 17:07 | Zekka | i.e. you don't need dependent types in a pure language to say 'and this feature of the environment isn't changed', but you probably need pre/post conditions to check that in a dynamic language with side effects |
| 17:07 | stuartsierra | Aha! Re earlier discussion of CLASSPATH-6, URLClassLoader reads JAR manifest files lazily, as needed, to load resources. |
| 17:07 | Zekka | So I'm trying to see if I can express polymorphism constrained by pre/postcondition groups |
| 17:07 | stuartsierra | So it would be tricky to get a list of *all* the URLs it might eventually read. |
| 17:07 | Zekka | alandipert: Sorry if I'm not too clear for what it's worth |
| 17:07 | alandipert | Zekka, for modeling domain objects you may consider defrecord, which would allow your domain maps to participate in protocols |
| 17:08 | alandipert | Zekka, well, afaict nobody understands eachother in this arena :-) |
| 17:08 | alandipert | Zekka, i would just encourage you to explore the various clojure approaches to polymorpism and get a feel, one will stick out at the end to you i bet |
| 17:08 | Zekka | Alright |
| 17:09 | Zekka | Right now I'm a little cross because I told my boss 'I hear Clojure is pretty reliable and stable and more concise than Java for this application' etc. and so far I'm a little frustrated |
| 17:09 | augustl | is there a function like this around? Take varargs of lists and vals, return a single flattened list (x [1 2 3] "b" [1] 2) -> [1 2 3 "b" 1 2] |
| 17:09 | Zekka | hopefully I'll either get so frustrated I can motivate a rewrite or I'll get used to it and stop complaining |
| 17:10 | Zekka | (For what it's worth Java is actually very bad in the regard I'm describing: it has static types but you can't use them at all for reasoning about behavior the way I'm describing: at least Clojure apparently has cheap assertions) |
| 17:10 | augustl | Zekka: I haven't followed the discussion, but have you seen core.typed? |
| 17:10 | Zekka | augustl: No, I haven't |
| 17:10 | Jaood | Zekka: but haskell |
| 17:10 | augustl | Schema is also a nice alternative to preconditions |
| 17:10 | augustl | Zekka: ^^ |
| 17:11 | Zekka | I'm thinking I might introduce schema |
| 17:11 | technomancy | if you're used to programming with a type system, it's normal for getting adjusted to clojure to take a while. |
| 17:11 | mikerod | Prismatic schema really dominates pre/post conditions from what I've seen. Once I have that in place, I haven't really seem too many issues with delayed errors due to invalid data (and types) passed around |
| 17:12 | Zekka | augustl: Right now my major priorities are 'stop annoying bugs that I could ordinarily use the type system to deal with (as much as is possible)' and 'don't screw up my ability to work with library code that doesn't know or care about types' |
| 17:12 | Zekka | Can you evaluate core.typed and schema in those dimensions? (Schema looks very good in them from a distance.) |
| 17:12 | mikerod | The advantages are just reusable structures to express your conditions, well-structured error messages, automatically adds some doc strings to schema.macros/defn, etc |
| 17:12 | technomancy | there's more you need to keep in your head since you don't have the compiler backing you up, it also forces you to design simpler data models *because* you have to keep more in your head |
| 17:13 | mikerod | Zekka: I'd imagine core.typed is a bit more invasive since you need to use it extensively to gain benefits out of the static type checking. |
| 17:13 | Zekka | I don't really expect to be able to catch type-related bugs statically: it'd be nice but I don't expect it |
| 17:13 | Zekka | mikerod: I feel like assertions is more appropriate for a usecase like this |
| 17:13 | Zekka | one of the libraries we use (Seesaw) really loves coercion and other sticky things that are probably hard to express with a sensibly anal type system |
| 17:14 | mikerod | Zekka: schema can have assertions turned on. |
| 17:14 | mikerod | if that's what you are getting at |
| 17:14 | Zekka | but assertions/pre/postconditions probably wouldn't break anything |
| 17:14 | Zekka | mikerod: I got the impression that schema mostly used assertions/pre/postconditions while core.typed performed some kind of deeper static analysis |
| 17:15 | mikerod | schema is an opt-in runtime-checked assertions |
| 17:15 | Zekka | although that might be partially based just on my preconceived, half-baked notions of what it means when someone says "we're giving you a type system" |
| 17:15 | mikerod | core.typed is static analysis for type-correctness |
| 17:15 | Zekka | mikerod: That's about what I figured |
| 17:15 | mikerod | so with schema, you can annotate a single fn |
| 17:16 | mikerod | without considering anything else |
| 17:16 | arrdem | I suspect that schema or a hand rolled equivalent is what you want.. |
| 17:16 | arrdem | core.typed can be really hard to work with and relatively limited. |
| 17:16 | Zekka | arrdem: I'm thinking the same |
| 17:16 | mikerod | My impression for core.typed is you really need to "buy in" and annotate a lot, so that there can be meaningful static analysis done between the interaction points between fn's. |
| 17:16 | arrdem | I've caught real errors with core.typed.. |
| 17:16 | arrdem | but it can be a real pain |
| 17:17 | arrdem | yeah I'm with mikerod here. |
| 17:17 | Zekka | Unless I can make a ton of random library maintainers also commit to core.typed I don't think I can probably make it work here |
| 17:17 | arrdem | I built a typechecked CPU simulator with core.typed but there was a _lot_ of buy-in involved. |
| 17:17 | arrdem | and that for was a sub-1k LOC project |
| 17:17 | Zekka | What's the advantage of working in Clojure with core.typed over a language designed around typesafety from the start? |
| 17:17 | mikerod | arrdem: I have been interested in core.typed, but I haven't been in position to go to the lengths it would require to switch to it |
| 17:18 | Zekka | (like, I don't know, Scala -- disclaimer being that I haven't worked in Scala) |
| 17:18 | mikerod | Zekka: I think that is a good question. I do not know the answer. :P |
| 17:18 | mikerod | It's a Lisp on the JVM! - that's why |
| 17:18 | arrdem | Zekka: I think that's an open research question :P |
| 17:18 | mikerod | (joking) |
| 17:18 | martinklepsch | amalloy: sounds fair. thank you for guiding me :) |
| 17:18 | arrdem | but seriously. |
| 17:19 | technomancy | Zekka: the canonical answer is that the JVM's use of subclassing is incompatible with hindley-milner, and type systems that aren't HM are kind of a pain in the neck. |
| 17:19 | mikerod | The idea of an add-on type system is very interesting to me. I'm definitely torn on these things. |
| 17:19 | technomancy | "canonical" |
| 17:19 | mikerod | like add-on type system vs built-in and based around like Haskell |
| 17:19 | Zekka | technomancy: What do people say when other people say "that's fine, don't allow subclassing"? |
| 17:19 | Zekka | Because that's the sort of thing I would say. |
| 17:20 | technomancy | meaning "what people tell me when I complain that none of the JVM-hosted languages have good inference" |
| 17:20 | Zekka | (maybe it's just because I find inheritance very confusing most of the time when I encounter it) |
| 17:20 | technomancy | Zekka: because that means "don't use all these libs that are half the point of being on the JVM in the first place" |
| 17:20 | Zekka | (the basics are fairly simple but I feel like I run into a lot of semantic potholes) |
| 17:20 | technomancy | "don't create subclasses yourself" isn't enough |
| 17:20 | mikerod | I think subclasses are evil |
| 17:21 | catern | i think classes are evil |
| 17:21 | amalloy | Zekka: i would say core.typed is a really cool effort, but i wouldn't use it as a newcomer to clojure. better to drink the kool-aid of the new language until you can program in it and *then* decide whether you want an add-on like core.typed. don't try to make clojure like haskell until you're comfortable with clojure already (and for my part, i try not to make haskell like clojure) |
| 17:21 | mikerod | :) |
| 17:21 | catern | I think OO is evil |
| 17:22 | technomancy | yeah, what amalloy said. force yourself to use nothing but maps for like a month to get rid of your typed habits before making a judgment =) |
| 17:22 | Zekka | amalloy: Generally I'd agree: it's mostly the case here that I'm actually accountable to someone for the code I produce here |
| 17:22 | Zekka | meaning that if while experimenting I produce crappy code I'll have billed them for crappy code, which isn't ethical |
| 17:22 | amalloy | well. decide whether you're learning or building. if you can't do both productively, pick one |
| 17:23 | amalloy | like, learning is great, but if you're making tons of compromises on the learning in order to build something you think is billable, what you're learning is counterproductive |
| 17:23 | technomancy | being able to throw away learning code is a wonderful luxury =) |
| 17:23 | Zekka | I'm actually guilty of a misdecision much earlier: we weren't originally going to use Clojure, but when I suggested it folks agreed because they didn't think there would be very much of it |
| 17:24 | Zekka | currently about 10% of our project is Clojure now because many of the things we planned to do in Java were much quicker in Clojure and paring away the interface to be small/simple to work with involved adding much more responsibility to the Clojure code |
| 17:24 | amalloy | it sounds like you decided to bill someone for a project you write while clojure, without knowing whether you could build anything in it; it's a bit unfair to call it unethical *now* when someone suggests you prioritize learning it |
| 17:25 | Zekka | It's a quantity we could probably rewrite but I have a feeling that in this case, good clojure > bad clojure > Java |
| 17:25 | amalloy | *while learning |
| 17:25 | Zekka | amalloy: That's pretty accurate. |
| 17:25 | dnolen_ | Zekka: bad Clojure is probably at least as bad if not worse than bad Java |
| 17:25 | alandipert | imo a new prog. language is nothing compared the learning typically involved for a domain, which few would argue is unethical to bill for |
| 17:26 | dnolen_ | Clojure gives lots of shotguns pointed at all limbs |
| 17:26 | jcromartie | alandipert: so, what is the fix for the 1.5/1.6 cljs issue? |
| 17:26 | jcromartie | alandipert: sorry that was a long time ago, I was AFK |
| 17:26 | Zekka | dnolen_: I'd say from current experience it's pretty bad but not in the same ways |
| 17:26 | alandipert | jcromartie, downgrade cljs or upgrade/exclude whatever in your project is bringing in 1.5 |
| 17:26 | dnolen_ | Zekka: yeah |
| 17:26 | Zekka | It's harder to debug and harder to pick apart for overall structure because unlike Java it's not really very uniform |
| 17:26 | amalloy | dnolen_: i'm now imagining television ads for "Crazy Rich's Limb and Shotgun Emporium" |
| 17:26 | dnolen_ | amalloy: lol |
| 17:26 | jcromartie | alandipert: oh, that would probably be [org.clojure/clojure "1.5.1"] :) |
| 17:27 | Zekka | On the other hand it's quicker to refactor and I don't feel like I'm running into as many 'correct way/reasonable way' tradeoffs as I do when I work in Java |
| 17:27 | Zekka | (Java's verbosity and poor facilities for abstraction have made significant parts of the project much larger and much less flexible than they could have been, IMHO) |
| 17:27 | jcromartie | THANKS LEININGEN |
| 17:29 | nullptr | (inc leiningen) |
| 17:29 | lazybot | ⇒ 3 |
| 17:29 | amalloy | 3??????? |
| 17:29 | amalloy | (inc leiningen) |
| 17:29 | lazybot | ⇒ 4 |
| 17:29 | arrdem | (inc leiningen) |
| 17:29 | lazybot | ⇒ 5 |
| 17:29 | catern | (inc leiningen) |
| 17:29 | lazybot | ⇒ 6 |
| 17:29 | jcromartie | I was being sarcastic |
| 17:29 | jcromartie | (dec leiningen) |
| 17:29 | lazybot | ⇒ 5 |
| 17:29 | arrdem | 0_0 |
| 17:29 | amalloy | jcromartie: you were probably being wrong too, for what it's worth |
| 17:30 | jcromartie | hah |
| 17:30 | catern | (inc technomancy) |
| 17:30 | lazybot | ⇒ 123 |
| 17:30 | Zekka | dnolen_: IMHO we're better off with the bad clojure than the bad java, and that's not me arguing from the 'Clojure is an allegedly better language' stance |
| 17:30 | dnolen_ | Zekka: well good Clojure is a thing a beauty so you have something to work towards ;) |
| 17:30 | jcromartie | I would like to be able to "lein new" and get clojure 1.6.0 |
| 17:31 | nullptr | a lot of the most common mistakes are common across languages -- misunderstanding/misuse of "lazy" is one i see everywhere |
| 17:31 | Zekka | (I have trouble saying "Clojure is a better language" because it seems to depend very heavily on who is writing it: it's not like Haskell where it's really hard to screw things up beyond repair, even if you're inexperienced) |
| 17:31 | alandipert | can't argue taste anyway |
| 17:31 | amalloy | dnolen_: a clojure program is like a sculpture by michaelangelo: you start with ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))), and gradually carve off the parts that aren't part of your program |
| 17:32 | dnolen_ | amalloy: haha |
| 17:32 | arrdem | amalloy: but how do I get a (()()) from that... |
| 17:32 | Zekka | (in certain hands I bet the Clojure implementation's usually much better than the Java implementation, though) |
| 17:32 | technomancy | the only meaningful definition of "better language" is "tends to produce better programs" which is ridiculously context-dependent |
| 17:32 | jcromartie | oh it does now |
| 17:32 | jcromartie | but just a bit late |
| 17:33 | Zekka | technomancy: I'm using it very informally here, in the sense of "would I tell a friend he should totally do his next project in it?" |
| 17:33 | catern | blub man |
| 17:33 | catern | clojure is better than java, no contest |
| 17:33 | amalloy | Zekka: well, in haskell it's really hard to screw things up beyond repair as a newbie because it's really hard to do *anything* |
| 17:33 | arrdem | $karma blub |
| 17:33 | lazybot | blub has karma 0. |
| 17:33 | catern | likewise, haskell is better than java, and go is better than java |
| 17:33 | amalloy | how good programs in language X are will depend on the person writing them no matter what X is |
| 17:34 | technomancy | same as my gripe over people saying "a faster language" |
| 17:34 | technomancy | languages aren't fast or slow, programs are |
| 17:34 | mikerod | Java is just the assembly language of the JVM |
| 17:34 | Zekka | amalloy: I'd say one of its major design features is "you're not allowed to do the wrong thing" |
| 17:34 | catern | says the person in the IRC channel of a slow language :) |
| 17:35 | shanemhansen | My favorite quote ever from a phd student who was a haskeller "I love haskell because every time I try and do anything it's like a research project". |
| 17:35 | amalloy | clojure, haskell, java, php - they're all great at what they want to do. you just have to drown yourself in koolaid |
| 17:35 | Zekka | And it accomplishes that by turning all the normal techniques for doing anything into wrong things |
| 17:35 | Zekka | shanemhansen: It's either a shame or a benefit |
| 17:35 | Zekka | I mean on one hand you have really ingenious designs like lens, but you also have a lot of work-in-progress designs like monad transformers |
| 17:36 | Zekka | where there are still a lot of sharp edges and unpleasant bits |
| 17:36 | Zekka | So a lot of things you ordinarily take for granted are still areas of research, even though the research is pretty complete in a lot of cases |
| 17:36 | Zekka | (Monad transformers do 90% of what you wouuld like them to do, but they really suck at 10%) |
| 17:36 | hiredman | php even has goto now, so you can write a proper compiler targeting it |
| 17:37 | arrdem | oh dear... |
| 17:37 | Zekka | also sometimes the 'correct' design is actually super scary and requires you to squat over some research papers: i.e. Pipes and streaming IO |
| 17:38 | Zekka | (Pipes eliminates a lot of drawbacks of standard IO approaches, but the disadvantage is you'll drown in types) |
| 17:38 | Zekka | (it's not really about IO but about coroutines) |
| 17:41 | Zekka | I might port some of my old Haskell code to Clojure, I've got some really dense projects that I bet would be a lot simpler |
| 17:43 | technomancy | Zekka: people say that Java IDEs allow you to use more complicated class hierarchies than you normally would with an un-aided human intellect; I wonder if there is a parallel to good type systems. |
| 17:43 | technomancy | seems like a double-edged sword |
| 17:43 | Zekka | technomancy: I'd say that a lot of the time when I run into Haskell types, there's the unfortunate problem that they're very hard to understand, but also as small as they can be |
| 17:43 | Zekka | I brought up monad transformers, which are conceptually pretty simple |
| 17:43 | technomancy | like, when you're writing C, you are forced into a sort of ruthless simplicity |
| 17:44 | Zekka | the problem is that for the things they *don't* do, there's no way to express them |
| 17:44 | Zekka | There's a structure that's general enough to express the things they don't do, but it's really complicated |
| 17:44 | Zekka | And as far as I know nobody knows a simpler one |
| 17:45 | Zekka | So I feel like it basically comes down to the problem that some things are just very hard to reason about -- if you're in a purely functional language then you have to think about those things, types or not, and if you're in an impure language you can ignore a lot of the rough edges |
| 17:46 | Zekka | and I generally prefer being required to reason about those things than the alternative of letting them happen by magic |
| 17:47 | arrdem | damnit where's gtrak when you need him.. |
| 17:47 | Zekka | Of course, a lot of what imperative languages already expose are among the simpler things that you can do in Haskell |
| 17:47 | Zekka | They basically have one monad that's pretty expressible in one monad transformer stack |
| 17:48 | Zekka | but if you want to define a language that doesn't choke on corners when you want, I don't know, extensible flow control maybe, then things get a little rough |
| 17:52 | Zekka | technomancy: Here's what some of the problems look like: 'how can you turn pure things into effectful things, treating all effectful things as essentially the same kind of thing and allowing various kinds of effectfulness to be composed', 'how can you turn mutation, modification, and access into the same kind of thing such that composing accessors yields an accessor' |
| 17:52 | Zekka | They're not intrinsically about types but they make types pretty valuable |
| 17:59 | akurilin | quick question: has anybody figured out a good approach for multi-database access in Korma? As in, say I have an OLTP and an OLAP instance, right now korma's choice of target DB is determined through global state |
| 18:05 | Jaood | akurilin: I hear the approach to korma is to not use it |
| 18:08 | mr-foobar | is there a protocol for Symbol ? |
| 18:11 | technomancy | mr-foobar: symbols predate protocols |
| 18:12 | amalloy | they implement clojure.lang.Named, if that's any help |
| 18:13 | mr-foobar | amalloy: do you mean https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Named.java ? |
| 18:46 | gfredericks | mr-foobar: yes that's what he meant |
| 18:47 | augustl | does it make sense to have a "component" (Stuart Sierra's stuff) that just starts doing some stuff when the app starts up, such as migrating a database, starting workers, etc? |
| 18:48 | mr-foobar | gfredericks: i need a subset of symbols/namespaces apis. lang.Named won't do it. |
| 18:49 | gfredericks | mr-foobar: what's your higher level goal? |
| 18:50 | gfredericks | augustl: ...sure? what aspect are you worried about? |
| 18:50 | augustl | gfredericks: no idea :) |
| 18:50 | arrdem | happy weekend people. I'm gone. |
| 18:50 | augustl | are you telling me I get to choose/have to design my own system?? |
| 18:50 | lazybot | augustl: Definitely not. |
| 18:50 | gfredericks | augustl: the thing I've found the most awkward is batch stuff |
| 18:50 | cbp | rip arrdem |
| 18:51 | arrdem | r i p volvo |
| 18:51 | augustl | gfredericks: hmm, what kind of batch stuff for example? |
| 18:51 | mr-foobar | gfredericks: state machine using a dispatch table. |
| 18:52 | gfredericks | augustl: ETL, e.g. |
| 18:52 | gfredericks | error handling in a batch context is different from a steady state context |
| 18:54 | akurilin | Jaood: what do you mean? |
| 19:01 | augustl | akurilin: isn't there a lower level API where you can pass in the conn? |
| 19:02 | augustl | been a while since I did sql from clojure.. But I would also imagine that it's possible to have korma just return the sql statement objects you can pass to jdbc |
| 19:06 | jcromartie | phew |
| 19:06 | jcromartie | now that I have lein-cljsbuild and lein-ring humming along smoothly, this is quite nice |
| 19:07 | jcromartie | with some middleware for edn back and forth |
| 19:10 | mi6x3m | any out-of-the-box html formatter for clojure? |
| 19:26 | Raynes | mi6x3m: 'html formatter' |
| 19:26 | jcromartie | clojure.lang.ExceptionInfo: Could not locate cljs/core/async/macros__init.class or cljs/core/async/macros.clj on classpath |
| 19:27 | jcromartie | why not? |
| 19:27 | jcromartie | never mind |
| 19:27 | jcromartie | needed to reload after project.clj change |
| 19:27 | jcromartie | I should really take 5 seconds before posting to IRC |
| 19:28 | AWizzArd | jcromartie: happens to the best |
| 19:29 | jcromartie | this must be The Right Way™ to do web development… core.async on the client and server, EDN going back and forth… damn |
| 19:29 | jcromartie | I mean seriously |
| 19:29 | AWizzArd | jcromartie: btw, what are you doing with core.async? |
| 19:30 | jcromartie | well since dnolen's client-side core.async demos made me cry, I just wanted to try it |
| 19:30 | jcromartie | I have a big Clojure web app, and so far it's very traditional: the server renders HTML and sometimes we throw some JS up that makes it fancy |
| 19:30 | mi6x3m | Raynes: what compojure used to do |
| 19:31 | AWizzArd | I would like to know if CSP is equivalent to FRP. |
| 19:31 | jcromartie | I've steered away from single page web apps in general because of JS callback hell |
| 19:31 | mi6x3m | jcromartie: wise :) |
| 19:31 | jcromartie | but now that I've seen Om and core.async on the client in general, I feel like it's powerful enough to make the teetering tower of abstraction worth it |
| 19:31 | mi6x3m | single page is doomed |
| 19:32 | jcromartie | mi6x3m: you think? that's not what I'm saying |
| 19:32 | jcromartie | I love URLs |
| 19:32 | jcromartie | don't get me wrong |
| 19:32 | clojurebot | excusez-moi |
| 19:32 | mi6x3m | I am saying it :) |
| 19:32 | AWizzArd | jcromartie: if you use Om you will probably need a slider widget too. |
| 19:32 | mi6x3m | single page creates hell for everyone |
| 19:32 | AWizzArd | mi6x3m: why is that? |
| 19:33 | jcromartie | I might agree… it depends |
| 19:33 | mi6x3m | AWizzArd: take search engines for starters |
| 19:33 | jcromartie | it breaks a lot of good things about the web |
| 19:33 | nullptr | good point -- everytime i use gmail i'm just like "ugh, why can't you be more like '98 hotmail?!" |
| 19:33 | mi6x3m | then URL generation, JS managing etc. |
| 19:33 | mi6x3m | it's hard to analize content when the content is not static |
| 19:34 | nullptr | and seriously, google maps? mapquest was good enough. |
| 19:35 | jcromartie | there are some great single page apps for sure |
| 19:35 | jcromartie | Google Maps is where it works nicely |
| 19:36 | jcromartie | I don't want to click on a city and wait for the load |
| 19:36 | jcromartie | but for Wikipedia, it would probably be a huge mistake |
| 19:37 | AWizzArd | but there is pushState |
| 19:38 | AWizzArd | We have a single page app, but fully indexable by search engines. |
| 19:38 | AWizzArd | Direct links are supported, browser navigation |
| 19:38 | AWizzArd | It’s pretty easy to do with CLJS+Om. |
| 19:41 | AWizzArd | Is CSP a superset of FRP? Are they both semantically equivalent? |
| 19:42 | AWizzArd | tbaldridge: maybe you know it? :) |
| 19:59 | akurilin | augustl: Oh I see, hm yeah that's fair |
| 19:59 | akurilin | augustl: good idea |
| 21:39 | benkay | does anyone have a hack to prevent cider from popping up an os x java applet when jacking in? |
| 21:44 | amalloy | benkay: see https://developer.apple.com/library/mac/documentation/java/Reference/Java_PropertiesRef/Articles/JavaSystemProperties.html - you can probably set apple.awt.UIElement or java.awt.headless |
| 22:00 | mackin | does anyone know of any clojure startup jobs |
| 22:08 | uvtc | I've got a fairly large set of maps; what's the best way to find one of them based on the value of some particular key? Here's what I've got: <https://gist.github.com/uvtc/c1c4cbd6f57c85466e7e>. |
| 22:33 | ambrosebs | uvtc: filter is lazy, both those methods look identical. |
| 22:34 | uvtc | ambrosebs, Ah! Thanks for that observation! Didn't realize that (no pun intended). :) |
| 22:34 | ambrosebs | :) |
| 22:42 | TimMc | Haha, best project name: https://github.com/kimhyunkang/r5.rs |
| 22:42 | TimMc | (Scheme implemented in Rust.) |
| 22:42 | uvtc | Hehehe |
| 22:43 | uvtc | .oO(would be nice to see a clojure.rs...) |
| 22:44 | Frozenlock | .oO(would be nice to see a clojure.clj...) |
| 22:54 | TimMc | snrk |