2012-08-02
| 00:05 | emezeske | ro_st: I think if you just use the latest clojurescript compiler version it brings in a pretty new version of the google closure library |
| 00:06 | ro_st | so how do i set that? i'm using your advanced-example project.clj almost verbatim |
| 00:06 | emezeske | well, typically lein-cljsbuild just pulls in the latest tagged release of the compiler |
| 00:06 | emezeske | So if your lein-cljsbuild is up-to-date, then so is your compiler |
| 00:07 | emezeske | If you want to get something newer than the latest release (e.g. head of git), that is possible too (see the lein-cljsbuild wiki) |
| 00:07 | ro_st | i'm on cljsbuild 0.2.4 |
| 00:08 | ro_st | how do i check which version of cljs i'm using? |
| 00:08 | ro_st | i don't see it in either lib or .lein-plugins |
| 00:09 | emezeske | That would be r1443 |
| 00:09 | emezeske | I don't know how to find that out easily, other than looking at the cljsbuild project.clj |
| 00:09 | ro_st | just by using cljsbuild 024 i have goog-jar 1.0.0 in my deps |
| 00:09 | emezeske | Not goog-jar |
| 00:10 | emezeske | You probably don't want goog-jar, that is old and icky |
| 00:10 | ro_st | correct :-) |
| 00:10 | emezeske | See this: https://github.com/clojure/clojurescript/blob/master/pom.template.xml |
| 00:10 | emezeske | In there is the latest version of the google-closure-library that clojurescript pulls in |
| 00:11 | emezeske | So maybe just get rid of goog-jar? |
| 00:11 | ro_st | ok i'll try that, thanks |
| 00:47 | ThatOneGuy | are cookie strings supposed to be percent encoded? |
| 00:56 | amalloy | $google http spec rfc cookie |
| 00:56 | lazybot | [RFC 2965 - HTTP State Management Mechanism] http://tools.ietf.org/html/rfc2965 |
| 00:58 | ThatOneGuy | what section? |
| 00:59 | amalloy | i dunno, mate. this isn't #http |
| 00:59 | emezeske | amalloy: I thought amalloy stood for http bot |
| 01:01 | dakrone | ThatOneGuy: they aren't, I just had to do a fix to make sure they aren't |
| 01:01 | dakrone | ThatOneGuy: according to the RFC anyway |
| 01:01 | dakrone | ThatOneGuy: they can be either encoded, or plain text |
| 01:02 | ThatOneGuy | well in clj-http it percent encodes it |
| 01:02 | ThatOneGuy | and the API im interfacing with seems to be thinking that im not logged in even though I'm sending the session cookie |
| 01:03 | dakrone | ThatOneGuy: clj-http should not: https://github.com/dakrone/clj-http/commit/a704e8576cd30647e9b8f526fc0edeb2494e8a6b |
| 01:03 | dakrone | unless you're using an old version |
| 01:14 | akhudek | is clojurescriptone a good example of how to use the google closure library from clojurescript? |
| 01:14 | akhudek | In particular, how they use extend-type with events and other things |
| 01:14 | akhudek | http://clojurescriptone.com/documentation.html |
| 01:15 | ThatOneGuy | I was using 0.5.0 |
| 01:16 | ThatOneGuy | but I just updated leinengen to use 0.5.1 |
| 01:16 | ThatOneGuy | when I look at the debug output, its percent encoded |
| 01:16 | ThatOneGuy | its percent encoded in the cookie-store |
| 01:25 | TheBusby | any tricks for helping to deal with things like cyclic maps with the repl? Everytime one is accidentally output to the screen emacs/slime locks up :( |
| 01:25 | ThatOneGuy | cyclic maps? |
| 01:26 | TheBusby | a map within a map that refers to it's "parent" |
| 01:27 | ThatOneGuy | how does it refer to its parent? |
| 01:28 | TheBusby | terrible example but: (def a {}) (def b (assoc {} :a a)) (def a (assoc {} :b b) |
| 01:28 | TheBusby | er, well failed at that |
| 01:28 | ThatOneGuy | off the top of my head I can't think of a use case for that |
| 01:29 | TheBusby | A tree where you a leaf can reference it's parent |
| 01:31 | akhudek | TheBusby: that doesn't create a cyclic map |
| 01:31 | TheBusby | akhudek: no it doesn't, I don't have a simple example do you? |
| 01:32 | akhudek | I may be tired, but I can't see how it's possible. |
| 01:32 | akhudek | You can generate infinite lazy lists though |
| 01:32 | TheBusby | is there a trick to prevent printing that from causing problems? |
| 01:32 | TheBusby | lazy-lists I mean |
| 01:33 | akhudek | I think it depends on the repl. |
| 01:33 | akhudek | Some are supposed to truncate long lists. |
| 01:33 | akhudek | Which would work. |
| 01:33 | TheBusby | would you happen to know which repls may support this? |
| 01:34 | akhudek | I seem to remember the Netbeans + Enclojure repl did, but that project isn't updated. |
| 01:35 | TheBusby | akhudek: thanks! Will check out my repl and see if I can impose a max-length or something ;) |
| 01:37 | amalloy | &(doc *print-length*) |
| 01:37 | lazybot | ⇒ "; *print-length* controls how many items of each collection the printer will print. If it is bound to logical false, there is no limit. Otherwise, it must be bound to an integer indicating the maximum number of items of each collection to print. If a collection... https://www.refheap.com/paste/3980 |
| 01:37 | amalloy | &(doc *print-depth*) |
| 01:37 | lazybot | java.lang.RuntimeException: Unable to resolve var: *print-depth* in this context |
| 01:37 | amalloy | well, there's something depth-based too |
| 01:37 | TheBusby | amalloy: awesome! thank you!!! |
| 01:38 | amalloy | TheBusby: better advice, which you will probably ignore, is to stop making mutually-referring data structures |
| 01:38 | TheBusby | amalloy: that's actually the direction I'm headed, but I need to pull apart some working code to make that happen first. |
| 01:39 | TheBusby | without the repl, I'm finding that much harder than first appeared (due to this print issue) |
| 02:28 | francis | test for dupes messages in eirc |
| 02:29 | francis | ,(println "eric functioning") |
| 02:29 | clojurebot | eric functioning |
| 02:33 | ro_st | emezeske: i killed goog-jar, and then 'lein cljsbuild once' redownloaded it |
| 02:34 | ro_st | i haven't explicitly installed clojurescript at all. i'm not even sure where it is on my system |
| 02:35 | ro_st | all i did was grab cljsbuild and start using it |
| 02:37 | ro_st | i'll try the git checkout method |
| 02:38 | emezeske | ro_st: Did you remove goog-jar from your project.clj? |
| 02:38 | emezeske | ro_st: If not, maybe one of your other dependencies depends on it |
| 02:38 | ro_st | i never had it in my project.clj |
| 02:38 | emezeske | ro_st: The git checkout will do you no good |
| 02:39 | emezeske | So, goog-jar is not being downloaded due to anything to do with lein-cljsbuild or clojurescript |
| 02:39 | emezeske | That much you can be certain of |
| 02:39 | ro_st | i grabbed your advanced-example and started using it |
| 02:39 | emezeske | Let me look at that |
| 02:39 | emezeske | one sec |
| 02:39 | ro_st | might it be enfocus, then? |
| 02:40 | ro_st | it's enfocus :-( |
| 02:40 | emezeske | Okay, if you know which dep is pulling it in, you can override it with lein |
| 02:40 | emezeske | There's no guarantee that enfocus will work with the new google closure library, but you can try |
| 02:41 | emezeske | Something vaguely like this should do the trick: [enfocus "x.x.x" :exclusions [goog-jar]] |
| 02:41 | emezeske | Obviously, fix the lib names and version as appropriate |
| 02:41 | ro_st | yeah. just did a clean and doing a build now |
| 02:42 | ro_st | ok, now i'm getting: required "goog.dom.query" error |
| 02:42 | ro_st | which means that it's no longer using goog-jar |
| 02:42 | ro_st | and now some other goog library |
| 02:43 | emezeske | Hmm... I thought goog.dom.query was included in the newer google closure library versions |
| 02:44 | ro_st | it's something that enfocus wants |
| 02:44 | ro_st | i've got closure-library r1978 downloaded and goog.dom.query doesn't appear to be in there |
| 02:44 | emezeske | So, historically, there was a "third_party" directory included in the "goog-jar" |
| 02:44 | emezeske | That dir contained the query stuff |
| 02:45 | emezeske | Maybe you need another dep, let's see |
| 02:45 | emezeske | Maybe try this: [org.clojure/google-closure-library-third-party "0.0-1376"] |
| 02:45 | ro_st | ahh that makes sense |
| 02:46 | emezeske | I wish I could go back in time and kill the goog-jar |
| 02:46 | emezeske | so badly |
| 02:46 | emezeske | with fire |
| 02:46 | ro_st | i just searched the svn and i found query in third_part/dojo |
| 02:46 | ro_st | ok. cleaned, compiling again... |
| 02:47 | emezeske | Hopefully the new google closure library is fairly backwards-compatible |
| 02:47 | ro_st | even worse. loads of errors now. can i not just give it the svn checkout i have instead? |
| 02:48 | emezeske | So, ultimately, your problem is that enfocus is waaaaaaaaaaaaaaaaaaaay out of date |
| 02:48 | ro_st | oh wait, it seems like the thirdparty jar only has the thirdparty stuff, none of the main lib |
| 02:48 | emezeske | The clojurescript compiler includes all of the main closure library |
| 02:48 | emezeske | By "includes" I mean "depends on" |
| 02:49 | ro_st | looks like a new enfocus is coming this weekend |
| 02:49 | ro_st | the reason for all this hopscotch is so that i can use shoreleave-pubsub which needs the html5localstorage stuff |
| 02:50 | emezeske | You would be a champion of champions if you pinged the author and mentioned that goog-jar is evil and ancient |
| 02:50 | ro_st | i totally will. can i quote you? |
| 02:50 | emezeske | As long as I didn't say anything offensive, sure |
| 02:51 | emezeske | This may be of interest: https://groups.google.com/forum/?fromgroups#!topic/clojure/EGmc95gRaH0 |
| 02:52 | ro_st | -tries that- |
| 02:54 | ro_st | :whitespace is building ok |
| 02:55 | emezeske | whoa |
| 02:55 | ro_st | but for some daft reason :advanced has loads of required "goog.xxx" namespace never provided |
| 02:56 | ro_st | oh. :whitespace is simply not adding any goog.* |
| 02:56 | ro_st | no goog.provide("goog. present in the file |
| 02:56 | emezeske | huh |
| 02:58 | ro_st | should i have [org.clojure/google-closure-library + -third-party] in :dependencies? |
| 02:58 | ro_st | or somewhere else? |
| 02:58 | ro_st | because i see both those jars in ./lib/. |
| 02:59 | emezeske | You don't need the non-third-party one, as the clojurescript compiler depends on that |
| 02:59 | kral | namaste |
| 02:59 | emezeske | You *should* only need the third party one. |
| 02:59 | ro_st | https://www.refheap.com/paste/3981 |
| 03:00 | ro_st | does cljsbuild fetch clojurescript and put it somewhere if it's not present? |
| 03:00 | ro_st | perhaps i need to find and murder cljs and get a fresh install. i just don't know where it is |
| 03:00 | emezeske | So lein-cljsbuild depends on a JAR called cljsbuild, which depends on org.clojure/clojurescript |
| 03:00 | ro_st | found it. killing it |
| 03:01 | emezeske | Your project.clj looks good to me |
| 03:01 | ro_st | ok i deleted cljsbuild and clojuresciprt |
| 03:02 | ro_st | got cljsbuild 0.2.4 and clojurescript 0.0-1443 after doing a lein deps |
| 03:02 | emezeske | That seems appropriate. |
| 03:02 | emezeske | I'm not sure what deleting them would do, though |
| 03:05 | ro_st | trying again with no enfocus in play |
| 03:06 | emezeske | I wish you the best of luck with that. I'm out for the night |
| 03:07 | ro_st | thanks. no joy. still no goog js appearing. weird!! |
| 03:07 | ro_st | will hunt |
| 03:09 | ro_st | and thanks for your patience and support :-) |
| 03:52 | ro_st | is there a convenient way to get a seq of all the public fns in a namespace? |
| 03:54 | ro_st | … in clojurescript |
| 03:55 | ro_st | looks like clojurescript doesn't have any of the ns_ fns |
| 04:11 | aperiodic | i remember hearing that clojurescript doesn't have first-class namespaces, so... probably not? |
| 04:22 | ro_st | yeah. just checked the cljs source. nothing there |
| 04:23 | augustl | which JVM are most people using for Clojure dev and prod? I'm currently on openjdk7 on my dev machine. |
| 04:23 | augustl | disclaimer: I've got no prior JVM experience |
| 04:39 | ro_st | is there some way to map over a collection with awareness of the previous item? kinda like reduce, but i dont' want to return a single value |
| 04:40 | ro_st | i need to compare N against N-1 to see if they have a differing value, and if so, inject additional stuff into the returned element for N |
| 04:41 | liwp | ro_st: (map #(+ %1 %2) (rest coll) coll) |
| 04:41 | ro_st | oooh |
| 04:42 | ro_st | so %1 will be N+1 and %2 will be N |
| 04:42 | liwp | ro_st: yep |
| 04:42 | ro_st | will it execute all the way to nil, last-item? |
| 04:43 | Fossi | ,(doc map) |
| 04:43 | clojurebot | "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments." |
| 04:43 | ro_st | ,(map irc://irc.freenode.org:6667/#(+ %1 %2) (rest [1 2 3]) [1 2 3]) |
| 04:43 | clojurebot | #<CompilerException java.lang.RuntimeException: No such namespace: irc://irc.freenode.org:6667, compiling:(NO_SOURCE_PATH:0)> |
| 04:43 | ro_st | crap |
| 04:43 | liwp | ro_st: it'll stop when one of the two collections ends, so I think you'll miss the last element |
| 04:43 | ro_st | ,(map #(+ %1 %2) (rest [1 2 3]) [1 2 3]) |
| 04:43 | clojurebot | (3 5) |
| 04:44 | ro_st | ok so i'll have to add a spurious nil on |
| 04:44 | ro_st | ,(map #(+ %1 %2) (rest [1 2 3 nil]) [1 2 3 nil]) |
| 04:44 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NullPointerException> |
| 04:44 | ro_st | damnit |
| 04:44 | ro_st | easy to sort out |
| 04:44 | ro_st | thanks for that liwp, super handy! |
| 04:44 | liwp | ,(map #(+ %1 %2) (concat (rest [1 2 3]) nil) [1 2 3]) |
| 04:44 | clojurebot | (3 5) |
| 04:44 | liwp | blah |
| 04:44 | liwp | ro_st: np |
| 04:44 | Fossi | nil isn't so smart ;) |
| 04:45 | liwp | ,(map #(+ %1 %2) (concat (rest [1 2 3]) [0]) [1 2 3]) |
| 04:45 | clojurebot | (3 5 3) |
| 04:45 | liwp | that's better |
| 04:45 | ro_st | yeah |
| 04:45 | liwp | ,(doc append) |
| 04:45 | clojurebot | Pardon? |
| 04:45 | ro_st | in my case the coll is of maps, and i'm producing enlive templates |
| 04:46 | amalloy | &(partition 2 1 [1 2 3]) |
| 04:46 | ro_st | so i'll just wrap with a check for nil |
| 04:46 | lazybot | ⇒ ((1 2) (2 3)) |
| 04:46 | djcoin | map with multiples list as arg is kinda map with zipped lists ? |
| 04:47 | broquaint | ,(doc fnil) |
| 04:47 | clojurebot | "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched." |
| 04:48 | ro_st | amalloy: partition - awesome! |
| 04:48 | ro_st | that's much cleaner |
| 04:53 | ro_st | conj'ing onto a sequence puts the added item at the beginning, right? |
| 04:58 | Raynes | &(conj (seq []) 1) |
| 04:58 | lazybot | ⇒ (1) |
| 04:58 | Raynes | &(conj (seq [2]) 1) |
| 04:58 | lazybot | ⇒ (1 2) |
| 05:00 | ro_st | tx |
| 05:18 | Jeon | hey guys I have a simple question. how come (#(apply map * %&) [1 2 3]) works but (apply map * [1 2 3]) doesn't? |
| 05:19 | ro_st | ,(apply map * [1 2 3]) |
| 05:19 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long> |
| 05:19 | ro_st | ,(apply map * [[1 2 3]]) |
| 05:19 | clojurebot | (1 2 3) |
| 05:19 | ro_st | because apply is tearing the vector apart |
| 05:21 | Jeon | in function literal form then? no tearing? |
| 05:24 | aperiodic | no, because you're implicitly wrapping the arg to apply there in a seq by using the rest-args destructuring for anon functions (%&) |
| 05:25 | aperiodic | so your anonymous function literal there expands to (fn [& x] (apply map * x)), which when invoked on [1 2 3], results in x taking on the value '([1 2 3]) |
| 05:26 | ro_st | took the words right out of my mouth -grin- |
| 05:26 | aperiodic | so the two things you compared aren't actually equivalent, hence it's no surprise they don't both work :) |
| 05:26 | ro_st | maybe i'm just high on caffeine, but i think clojure is -ing awesome. enjoying it thoroughly |
| 05:29 | aperiodic | i love clojure. it's just such a pleasure to think in compared to other languages. so clean. |
| 05:29 | Jeon | thank you, and wow. |
| 05:29 | aperiodic | of course, it's my main language both at work and on the side, so perhaps i've just lost touch ;) |
| 05:29 | aperiodic | you're welcome |
| 05:30 | Jeon | i'm new to clojure and reading a book called programmin clojure and it is interesting but little confusing so far. |
| 05:30 | ro_st | i still have to spend time in ruby and php codebases, and occasionally actionscript/flex |
| 05:30 | ro_st | you have not lost touch, trust me |
| 05:31 | ro_st | Jeon: this one? clojurebook.com |
| 05:31 | Jeon | yes |
| 05:31 | ro_st | great book |
| 05:37 | aperiodic | Jeon: it's probably very different from what you're used to, but it's so worth sticking it out |
| 05:37 | ro_st | +1 |
| 05:38 | aperiodic | Jeon: a little confusion is totally natural; I was quite disoriented for my first few weeks |
| 05:43 | Jeon | yeah, i've heard so many great things about lisp. and it is very simple and powerful compared to other languages i've learn so far. |
| 05:46 | ro_st | almost always you're having to unlearn stuff |
| 05:46 | ro_st | it's like starting with svn and then moving to git |
| 05:46 | ro_st | i know (lucky) guys who never had to use svn, and git feels completely normal for them |
| 05:48 | ro_st | cvs! jeez |
| 05:49 | broquaint | Yep, the bad old days. |
| 05:50 | aperiodic | git is the only source control system i've ever used |
| 05:51 | ro_st | i started with VSS -barf- |
| 05:51 | broquaint | Yow. |
| 05:51 | ro_st | c'est horrible |
| 05:53 | aperiodic | so how is using git after svn like using clojure after more 'traditional' (that is, c-style) languages? |
| 05:54 | ro_st | unlearning the inferior ways of doing things. trying to fit git in the svn box as compared to learning git fresh makes git a lot more confusing to understand (at least, it was like this for me) |
| 05:55 | djcoin | ro_st: c'est horrible -> are you french ? :) |
| 05:55 | ro_st | so too coming from static typing and OOP to clojure |
| 05:56 | ro_st | djcoin: nope, but taking french classes |
| 05:56 | djcoin | :) all right |
| 06:00 | aperiodic | i do miss static typing a bit. mainly haskell's type system. it lets you refactor without fear in a way i find almost intoxicating. |
| 06:00 | broquaint | aperiodic: Similar in learning experience - understanding new concepts and paradigms then applying them in (initially) novel ways. |
| 06:01 | aperiodic | typed-clojure might provide me some of that, though (or trammel) |
| 06:03 | djcoin | Yeah static typing really is a feature. |
| 06:05 | ro_st | i like static typing. i hate the crap OOP makes you do as a result |
| 06:07 | djcoin | Yep |
| 06:07 | djcoin | I look(ed) (not very close) at Scala but it seems overcomplicated/bloated |
| 06:07 | djcoin | But flexible |
| 06:09 | aperiodic | its flexibility makes me a little wary, honestly. i like how clojure has strong opinions, and Scala doesn't really strike me as having any |
| 06:10 | _nmmn | good overview, hehe =] |
| 06:11 | aperiodic | i haven't used it, though; that's just my impression from the light research i've done on it (i.e. looking at scala-lang.org for a bit) |
| 06:25 | leoncamel | hey, how can I do a exponetiation with bigint type ? in clojure 1.4 |
| 07:12 | ro_st | struggling with setting an input text's value with enfocus. set-attr :value "foo" shows a change in Chrome's Dev Tools, but the actual html display doesn't update. weird |
| 07:19 | haspaker | Clojure Textbooks really lack syntax highlighting |
| 07:19 | haspaker | |
| 07:28 | ro_st | haha yes |
| 07:28 | ro_st | my biggest complaint reading it on the ipad |
| 07:28 | ro_st | clojure needs syntax highlighting, especially rainbow parens |
| 07:29 | depy | rainbow parent FTW!!! WOOOO! |
| 07:29 | depy | parens* not parents... Ô_o |
| 07:41 | meenal | Hi, is there an equivalent for org.antlr.stringtemplate.StringTemplate in clojure? |
| 07:51 | ro_st | cemerick mentioned something that does string template interpolation the other day. buggered if i can remember what it was |
| 07:51 | ro_st | stich or sew or something like that |
| 07:51 | ro_st | a clj library |
| 07:52 | hyPiRion | Speaking of which, is there any html highlighter for clojure with rainbow parens? |
| 07:52 | hyPiRion | I know pygments can output Clojure, but not rainbow parens afaik. |
| 07:52 | cemerick | meenal: StringTemplate is quite usable from Clojure as-is. Alternatives include clojure.core.strint (https://github.com/clojure/core.incubator/) and comb (https://github.com/weavejester/comb). |
| 07:53 | ro_st | comb! |
| 07:53 | ro_st | hyPiRion: the only place i've seen rainbow-parens is inside of vim and emacs |
| 07:54 | hyPiRion | ro_st: I know CCW for Eclipse has it as well. |
| 07:54 | hyPiRion | But it's not html :( |
| 07:54 | meenal | thanks cemerick and rost! i wil have a look at comb |
| 07:56 | cemerick | hyPiRion: you can produce HTML exports of editor contents in Eclipse, though you'd need to write a plugin for it AFAIK. Maybe one exists already? |
| 07:56 | cemerick | *really* long way around just to get a particular syntax highlighting treatment, though. |
| 07:57 | hyPiRion | yeah, and I don't want to be dependent of Eclipse to format clojure code. |
| 08:07 | cshell | intellij/la clojure has rainbow parens |
| 08:12 | cshell | cemerick: does your book talk anything about best practices with regards to keywords? I use them everywhere and I'm afraid if I change one it will have impact across the program - are we supposed to use a 'keywords' file and all refernce them via var? |
| 08:13 | ro_st | you mean :these ? |
| 08:13 | cshell | right |
| 08:13 | ro_st | they evaluate to themselves |
| 08:13 | cshell | I know |
| 08:13 | cshell | but what if you use :these in 20 places |
| 08:13 | ro_st | functionally the same as "these" |
| 08:13 | cshell | I know, but refactoring becomes problematic |
| 08:14 | cshell | I'm wondering if (def these :these) is better |
| 08:14 | ro_st | regex search and replace? \b:name\b |
| 08:14 | cshell | because you will get compile warnings if you don't change |
| 08:14 | ro_st | i think that'll add too much noise to the code, personally |
| 08:14 | cshell | ro_st: that is problematic if any of your other files use :these - so I'd say it's almost better to have ::ns/these than just :these |
| 08:15 | ro_st | regex search and replace in files? :-) |
| 08:15 | cshell | if you use :these in a different context, yes |
| 08:15 | ro_st | i get your point, though |
| 08:15 | ro_st | can you use namespace/:foo ? |
| 08:16 | cshell | yeah |
| 08:16 | cshell | it's something like :ns/foo |
| 08:16 | ro_st | so that it's clear which :foo you mean (even though all :foo s are the same) |
| 08:16 | cshell | ,:foo |
| 08:16 | clojurebot | :foo |
| 08:16 | cshell | yep, exactly |
| 08:16 | cemerick | cshell: No, we don't talk about that. In practice, it's not really a problem. |
| 08:17 | cshell | cemerick: okay, thanks - I didn't know if it would be I just saw the possibility |
| 08:17 | cemerick | The refactoring issue is shared by nearly every dynamic language (e.g. python, ruby, etc) though. |
| 08:18 | cemerick | cshell: The Typed Clojure effort seems to have gotten a fair ways along in providing some degrees of safety in this area, though I've not used it myself. |
| 08:18 | cshell | and they don't like to use vars for keywords and have everyone use vars? |
| 08:19 | cshell | wouldn't typed clojure be adding complexity? I thought i saw types in the complex list in hickeys simple/vs/easy talk - but that mmight have been objects |
| 08:30 | cemerick | cshell: hardly; most lookups in e.g. python use strings. |
| 08:49 | somecljguy | So what are people's opinions on wrapper libraries? I have seen some people say that they generally don't think they are necessary, but I have a couple libs that use Thrift that would take much less code to use if they had a wrapper lib |
| 08:50 | meenal | I would like to read a properties file and getits contents as a key value pair, just like java.util.properties. is there a way in clojure for the same? |
| 08:51 | somecljguy | another thing... there are a bunch of java objects/collection types that get created by Thrift, which are what you have to pass around inside of thrift. Is there a common pattern to translating to/from these Java objects from things that are easier to use in Clojure (maps)? |
| 08:54 | XPherior | Here's my situation. Two projects, A and B. A depends on B. B is proprietary, and can't be put on a public Maven repo. I've seen that you can add the jar for B to a Maven repo within A's project, but I don't want to have jars in the repo. Can B be depended on and built from source? |
| 08:54 | XPherior | That might need some clarification, heh. |
| 08:54 | somecljguy | meenal: have you seen this http://stackoverflow.com/questions/7777882/loading-configuration-file-in-clojure-as-data-structure |
| 08:55 | hyPiRion | meenal: Like a config file? I use clj-config |
| 08:55 | somecljguy | meenal: the top answer just uses the usual java Properties utils to load it into a Clojure map |
| 08:56 | cshell | put B in your local repository |
| 08:56 | cshell | or put B in a private repository |
| 08:56 | XPherior | cshell: Then A's source tree will get huge. (To your first statement) |
| 08:57 | XPherior | Private repository? Need to explore that. Haven't heard of it. |
| 08:57 | cshell | XPherior: Not source repository |
| 08:57 | cshell | XPherior: Put the B jar in your local maven repository (.m2) |
| 08:57 | cshell | XPherior: Until you put it in a private repository ( cloudbees.com gives you them for free) |
| 08:58 | XPherior | cshell: Right, can do that. But I don't want to move the B jar into .m2 every time I change it. I want it to be built and updated dynamically |
| 08:58 | XPherior | cshell: Handy to know! |
| 08:58 | ro_st | XPherior: lein install will install the lib from source into .m2 |
| 08:58 | XPherior | I think what I'm asking for is probably ridiculous |
| 08:58 | cshell | every time you change B's source, you'll have to do an install to install it to .m2 |
| 08:58 | cshell | lein and maven will do it for you with lein install or mvn install |
| 08:58 | ro_st | if you're in B, you lein install to compile and publish it to .m2. then A will use it when compiling next |
| 08:59 | ro_st | cloudbees: awesome! |
| 08:59 | XPherior | ro_st and cshell: Hm.. That sounds like a reasonable solution. |
| 08:59 | ro_st | was wondering how to do private shared maven repo |
| 08:59 | cshell | ro_st: Yep, they'll even give you free jenkins which will build and deploy there if you like |
| 08:59 | ro_st | XPherior: i'm just parroting what people have told me. never done it before -grin- |
| 09:00 | XPherior | That's how you learn, ro_st :) |
| 09:00 | XPherior | Isn't lein install a Lein 1 feature though? |
| 09:00 | cshell | no |
| 09:00 | XPherior | Or I'm thinking of install plugin? |
| 09:00 | cshell | it's in both |
| 09:00 | cshell | probably |
| 09:01 | XPherior | Ah. Okay, I think this is a good start. |
| 09:01 | XPherior | Thanks for the thoughts guys. I'll let you know how it goes. |
| 09:01 | ro_st | you'd better :-) |
| 09:01 | cshell | It's one command, and you're in control of when to rebuild the B artifact, not automatically upon file modification |
| 09:01 | ro_st | it counts on your Permanent Record |
| 09:01 | XPherior | Oh ro_st. Lemme Gist you something.. |
| 09:02 | XPherior | cshell: That does seem more ideal. |
| 09:02 | XPherior | Wouldn't want to always update in case I'm doing a refactoring or something |
| 09:02 | cshell | XPherior: exactly |
| 09:02 | cshell | XPherior: You'll need private remote repository if you are working with a team |
| 09:03 | XPherior | Sure am, cshell. |
| 09:03 | XPherior | I think they'll like this solution. |
| 09:03 | XPherior | ro_st: This was how I managed to swap out the development DBs (defined with defdb and defentity) for the test DB. https://gist.github.com/351b9e031c8b457ca2ab |
| 09:04 | cshell | Checko out cloudbees, it can even detect source code changes that have been committed and can push your artifacts to the remote repo |
| 09:04 | XPherior | Inside a Midje fact, just use (with-test-db) macro. |
| 09:04 | XPherior | cshell: It looks like a good solution. Will almost certainly use it. I'm refactoring a PHP project into Clojure web services, some of which depend on each other. |
| 09:04 | XPherior | So we're gonna need good deps management. |
| 09:05 | ro_st | that's awesome, XPherior! |
| 09:05 | XPherior | Thanks ro_st! It took me many hours, but it's a super clean solution. |
| 09:06 | meenal | thanks somecljguy and hyPiRion |
| 09:06 | ro_st | do you have to wrap all your facts with (with-test-db), or are you able to use (background (around :facts (with-test-db ?form))) |
| 09:06 | meenal | but i am looking for a clojure-way to do it |
| 09:06 | ro_st | the latter is way preferrable because then your facts are toplevel and midje-mode can work |
| 09:06 | XPherior | ro_st: I haven't tried that. I didn't know it exists. Hah. |
| 09:06 | ro_st | https://github.com/marick/Midje/wiki/Setup%2C-Teardown%2C-and-State |
| 09:06 | ro_st | boom |
| 09:07 | XPherior | Facts look like: (fact "Explanation" (with-test-db ...) => result) |
| 09:07 | ro_st | ah |
| 09:07 | meenal | somecljguy: just like i found now from cemerickk that comb is an equivalent for StringTemplate in clojure |
| 09:07 | ro_st | try the background thing. you might be able to dry your facts up quite a bit |
| 09:07 | XPherior | I definitely will. Thanks for the info! |
| 09:08 | ro_st | background works really well. you can specify :contents (whole file), :facts (whole fact) and :checks for individual () => () checker sets |
| 09:08 | XPherior | Hot dang. I like that |
| 09:08 | ro_st | so you can have stuff happening before/after/around at each of those granularities |
| 09:08 | XPherior | That fits the bill. We have macros around all facts, so that'll work. |
| 09:09 | ro_st | what i love about it is that it's all neatly tucked away at the top |
| 09:09 | ro_st | and your facts are all about the test you're performing |
| 09:09 | XPherior | Can't beat that. I'll be back in a minute, need to go talk to someone. |
| 09:22 | cshell | If i have a sequence of maps, how do I extract the maps so that I can pass the maps into merge? |
| 09:24 | ro_st | with apply, maybe? |
| 09:25 | ro_st | reduce over the maps and merge in the reducer |
| 09:26 | cshell | apply worked |
| 09:26 | cshell | thanks ro-st |
| 09:26 | cshell | I've actually never used apply |
| 09:26 | ro_st | it's very handy |
| 09:28 | jsnikeris | Is there an easy way to reconstruct the absolute URL that resulted in a given Ring request? |
| 09:28 | hxiao | the :uri key in the request object should help you |
| 09:29 | jsnikeris | hxiao: That doesn't include the scheme, server, port etc |
| 09:29 | hxiao | ah, apologies |
| 09:30 | jsnikeris | hxiao: I can definitely reconstruct it from the request, but I'm wondering if there is an easier way |
| 09:33 | hxiao | i don't think you're going to be able to just get it from one place |
| 09:33 | jsnikeris | hxiao: why not? |
| 09:34 | hxiao | http://clojuredocs.org/ring/0.2.3/ring.util.servlet/build-request-map |
| 09:34 | hxiao | meh, which version of ring you using? |
| 09:34 | jsnikeris | The most recent |
| 09:35 | hxiao | a normal HttpServletRequest object allows you to getRequestURL which contains pretty much everything except query string params but ... |
| 09:36 | hxiao | i'll poke around |
| 09:37 | jsnikeris | hxiao: I don't think the HttpServletRequest available though. Ring translates that into a request map |
| 09:37 | hxiao | yeah that's what i mean, ring pulls stuff out of that so i'm looking through the src to see if it calls that anywhere |
| 09:38 | jsnikeris | hxiao: I can just str together the values from the request map I suppose |
| 09:38 | hxiao | yeah that build request map function doesn't look like it's changed much through the versions |
| 09:39 | jsnikeris | (str (:scheme req) (:host req) ... etc) |
| 09:39 | hxiao | nah, getRequestURL isn't called anywhere in ring's src code, only getRequestURI |
| 09:39 | hxiao | i'm afraid you'll have to string it together |
| 09:39 | jsnikeris | I'm just surprised that nobody has ever needed the absolute URL of a request |
| 09:39 | jsnikeris | I think I'll write a middleware that adds it to the request |
| 09:40 | hxiao | or pull request it =) |
| 09:40 | hxiao | shouldn't be hard |
| 09:40 | jsnikeris | hxiao: Thanks for the help |
| 09:41 | hxiao | np |
| 09:43 | pjstadig | because of the conversation with mk yesterday, I have filed a bug http://dev.clojure.org/jira/browse/CLJ-1036 |
| 09:57 | somecljguy | So what are people's opinions on wrapper libraries? I have seen some people say that they generally don't think they are necessary, but I have a couple libs that use Thrift that would take much less code to use if they had a wrapper lib |
| 09:57 | somecljguy | another thing... there are a bunch of java objects/collection types that get created by Thrift, which are what you have to pass around inside of thrift. Is there a common pattern to translating to/from these Java objects from things that are easier to use in Clojure (maps)? |
| 09:58 | cshell | isn't it about building a dsl for your domain? so if you could wrap things to create a valuable abstraction, that speeds development later? |
| 09:58 | cshell | somecljguy: use teh bean function to create a map from a java object |
| 09:59 | somecljguy | is there a way to reverse the bean function? |
| 09:59 | somecljguy | or will I need to write one |
| 10:00 | somecljguy | I mean I guess it should be straightforward-ish to (reify with the class property of the map |
| 10:00 | somecljguy | or can I somehow use that AND keep a reference to the object itself? |
| 10:01 | somecljguy | without cluttering things up.. |
| 10:01 | cshell | I don't know, I'd make all your java contact points take/return a map |
| 10:01 | cshell | if you start passing around objects in clojure you'll probably get a lot of runtime errors |
| 10:04 | somecljguy | cshell: it would definitely be nice to only have to use maps in the clojure code. that is part of why I am doing this |
| 10:05 | cshell | yep, that would be idiomatic |
| 10:05 | cshell | but remember java idioms are to have immutable |
| 10:05 | cshell | data structures |
| 10:05 | cshell | so you'd probably just want to take your map and invoke a new constructor |
| 10:06 | somecljguy | yeah, I think I will try that out first. seems like the most straightforward way for now |
| 10:20 | naeg | Hi. I started learning Common Lisp some time ago, but my actual goal is to learn Clojure. I've read 10/32 chapters of Practical Common Lisp, but I'm unsure whether I should finish the book or start learning Clojure right away? |
| 10:20 | ro_st | clojure++ |
| 10:20 | somecljguy | naeg: if your end goal is learning Clojure, you should definitely just start learning Clojure |
| 10:20 | ro_st | (-> 'clojure inc inc) |
| 10:20 | ro_st | :) |
| 10:20 | mdeboard | naeg: I strongly recommend http://www.clojurebook.com/ ... the best (with respect to authors of other great Clojure books) resource for learning Clojure as a beginning |
| 10:20 | naeg | somecljguy: so the payoff of learning CL first is not worth the time? |
| 10:21 | ro_st | naeg: i don't think so, because you'd have to unlearn stuff to learn clojure |
| 10:22 | naeg | my uncertainty arised because of this: http://missingfaktor.blogspot.de/2012/07/tour-through-land-of-lisp.html |
| 10:22 | ro_st | arose* -duck- |
| 10:23 | naeg | in this case I'll start with Clojure right away - thanks |
| 10:23 | naeg | ro_st: sorry :P |
| 10:23 | mdeboard | naeg: Have no uncertainty, learning Clojure will give you sufficient grounding in why so many parens, prefix notation and functional concepts. Dive right into Clojure. |
| 10:23 | somecljguy | naeg: I am not really sure what you would gain by learning CL first, given that your goal is Clojure |
| 10:23 | naeg | and clojurebook.com is the place to start, as suggested by mdeboard |
| 10:23 | naeg | ? |
| 10:24 | gtrak | naeg: Joy Of Clojure is the most serious book |
| 10:24 | ro_st | clojurebook.com is the newest, and aside from that advantage, it's also comprehensive and (i think) it does a great job |
| 10:24 | somecljguy | naeg: Joy of Clojure and clojurebook.com are both good books to use to learn |
| 10:24 | mdeboard | naeg: In my own personal experience it is the most well-grounded and basic, aimed as it is as people who are coming to Clojure from other high-level languages :) (Disclaimer: I also own Joy of Clojure and Programming Clojure books) |
| 10:30 | bryanl | I'm trying to get randum data out of a csv file. My code mostly works, but isn't very idiomatic (this is my first clojure app™). Right now, this returns a LazySeq, but I just want to return a string. I'm using a for block to cycle through the code, but definitely don't think that is the proper solution. https://gist.github.com/3237459 |
| 10:32 | Wild_Cat | how do I tell Leiningen's repl to reload the current project? |
| 10:33 | ro_st | code reloading isn't built in |
| 10:33 | cshell | lol, good question - I just ctrl-c and then restart lein repl |
| 10:33 | ro_st | i believe noir does its own reloading |
| 10:33 | pjstadig | bryanl: for returns a seq, so you need to call first on it before returning from your fn |
| 10:33 | mdeboard | bryanl: (fir-- ... what pjstadig said |
| 10:33 | ro_st | automatic reloading via filesystem watcher, i mean |
| 10:34 | ro_st | surely there's a lein plugin that does this, by now? |
| 10:34 | pjstadig | Wild_Cat: you could probably (in the repl) do something like (require ['foo.bar :reload-all]) |
| 10:35 | bryanl | pjstadig, mdeboard: thanks! |
| 10:35 | pjstadig | or maybe it's (require 'foo.bar :reload-all)? |
| 10:35 | drewr | bryanl: presumably you want to return hetero/samesex for each line, or is it an aggregate calculation? |
| 10:35 | bryanl | drewr: no, just for one line that matches the argument to the defn |
| 10:36 | drewr | ah, yes, I see that now |
| 10:36 | drewr | bryanl: I would pass orientation-data and lookup in as args too |
| 10:37 | bryanl | drewr: that's the plan. i'm stumbling here trying to figure language semantics and core libs at the same time |
| 10:55 | bryanl | i showed someone some code yesterday, and they said defrecords were being deprecated. I can't find anything on it, is it true? |
| 10:55 | drewr | bryanl: they will likely never be deprecated; they're too important to the lang at this point |
| 10:55 | drewr | however |
| 10:56 | drewr | they're not always the best thing to use in application code |
| 10:56 | drewr | if you just need dispatch, use multimethods or even a map |
| 10:57 | drewr | you can still use structmaps too |
| 11:14 | ro_st | ohpauleez: i was able to compile enfocus and shoreleave-pubsub by using org.clojars.lypanov/google-closure-library-repackaged and org.clojars.lypanov/google-closure-library-third-party-repackaged |
| 11:14 | ro_st | and excluding goog-jar from enfocus |
| 11:15 | ohpauleez | That would indeed do the trick (it has the LocalStorage wrapper in it) thanks for the heads up! |
| 11:15 | ohpauleez | I was going to hit up the dev mailing list today and ask for a new goog-jar |
| 11:16 | ro_st | it'd be lovely if the clojurescript folks would pay attention to http://dev.clojure.org/jira/browse/CLJS-276?focusedCommentId=29073#comment-29073 |
| 11:16 | ro_st | so that the official lib jars work the same way |
| 11:17 | ro_st | and for enfocus to drop goog-jar entirely |
| 11:17 | ro_st | which i've asked creighton to consider |
| 11:17 | cmajor7 | what is the way to step into jar sources (using lein/VimClosure)? |
| 11:17 | cmajor7 | *Clojure (well, that's a bad misspell :) ) |
| 11:18 | ro_st | ohpauleez: so, it compiles, but i still get the "Cannot set property 'shoreleave$pubsubs$protocols$IPublishable$' of undefined" error when trying to run the gist from the pubsub github issue |
| 11:19 | ohpauleez | ro_st: ah, ok. Thanks for the heads up. |
| 11:21 | ro_st | ohpauleez: https://www.refheap.com/paste/3991 |
| 11:21 | ro_st | so, we're using the same goog lib that the latest stable clojurescript does |
| 11:22 | ro_st | are you using something else/something newer? |
| 11:30 | naeg | one more thing: Clojure is not less usable for AI-related tasks than Common Lisp, right? |
| 11:32 | hyPiRion | naeg: I believe it is more usable, with core.logic. |
| 11:33 | ohpauleez | ro_st: I'm just using straight CLJS, but I do hand pack my goog jar, so I'll delete it from my .m2 today |
| 11:33 | ro_st | ohpauleez: i have to run now. i really hope you manage to find a gap to sort this issue out. i'm eager to put pubsub solidly to use |
| 11:33 | ro_st | ah, awesome :-) |
| 11:34 | naeg | hyPiRion: as long as it's not less usable, I'm fine with it :) |
| 11:34 | hyPiRion | I've been using it for some AI-tasks at university, and as of right now I have had no issues with it. |
| 11:34 | naeg | hyPiRion: what do others use for this tasks? |
| 11:34 | ro_st | naeg: https://vimeo.com/46163091 and https://vimeo.com/45128721 |
| 11:35 | hyPiRion | naeg: Python, usually. Or Java, but it's mostly because they know Java well and want to test the waters. |
| 11:35 | naeg | ro_st: will take a look at them later, thanks |
| 11:35 | hyPiRion | *don't want to test the waters |
| 11:36 | naeg | hyPiRion: are your solutions much shorter and simpler than others? |
| 11:37 | naeg | or at least tend to be or whatever :P |
| 11:38 | naeg | hehe, #clojure is even mentioned in the acknowledgments |
| 11:38 | hyPiRion | naeg: Probably, but I don't know whether it's because of the language I use. |
| 11:39 | hyPiRion | I usually generate shorter/readable code than others in my subjects. |
| 11:40 | naeg | cool. can't wait to start studying at a university myself |
| 11:41 | hyPiRion | naeg: I really recommend trying out both, and pick the one you prefer to write in. |
| 11:41 | naeg | both = common lisp and clojure? |
| 11:41 | hyPiRion | yeah |
| 11:43 | naeg | at some corners CL seemed a bit...cumbersome to me (maybe because I didn't grasp all the details behind it yet), but the actual reason why I wanted to learn clojure is deployment and JVM/CLR |
| 11:47 | hyPiRion | Yeah, Clojure is nice in that regard. Just type in "lein uberjar", and you've got a runnable version of your code. |
| 12:04 | kaoD_ | https://www.refheap.com/paste/3994 what am I doing wrong? |
| 12:06 | ThatOneGuy | reading... |
| 12:06 | kaoD_ | works fine if I implement only Object's toString |
| 12:07 | kaoD_ | the problem is IFn |
| 12:07 | ThatOneGuy | sorry man I'm not at the level of recods |
| 12:07 | ThatOneGuy | records* |
| 12:07 | ThatOneGuy | still learning HOFs |
| 12:08 | kaoD_ | HOF? |
| 12:08 | clojurebot | HOF is Higher-Order Function |
| 12:08 | kaoD_ | lol |
| 12:08 | kaoD_ | (inc clojurebot) |
| 12:08 | lazybot | ⇒ 12 |
| 12:09 | kaoD_ | records are easy actually, check em |
| 12:10 | kaoD_ | (there are several typos in that paste, btw) |
| 12:11 | S11001001 | kaoD_: record already implements IFn, you can't do it again |
| 12:11 | S11001001 | the only exception to the general "you can't reimplement things implied by record" rule is Object |
| 12:13 | kaoD_ | well, I just did implement IFn and it worked (it turns out the typos were the problem) |
| 12:14 | S11001001 | hmm. |
| 12:14 | kaoD_ | https://www.refheap.com/paste/3995 |
| 12:15 | eph3meral | is there something simpler/easier than java -cp clojure-1.4.0.jar clojure.main to start up an "interactive clojure" ? |
| 12:15 | kaoD_ | eph3meral: leiningen |
| 12:15 | kaoD_ | it will bring you joy and pleasure |
| 12:15 | eph3meral | kaoD_, ok cool thanks I'll look in to it |
| 12:16 | kaoD_ | eph3meral: it's not just a repl (as easy as "lein repl" under your project's dir) but a whole build tool |
| 12:17 | kaoD_ | more like... general automation |
| 12:17 | ThatOneGuy | more like AWESOME |
| 12:19 | solussd_ | is it possible to get emacs to indent my macros the same way it indents clojure.core/if-let, let, etc. (i.e., two spaces for args on new lines)? |
| 12:20 | Frozenlo` | Everything is possible in emacs :P |
| 12:20 | Frozenlo` | Although in this case I don't know hoe to do that... |
| 12:20 | Frozenlo` | *how |
| 12:21 | solussd_ | I'm not sure why it does it for library macros and not my macros.. :/ |
| 12:21 | clojurebot | Holy Crap. |
| 12:21 | Frozenlo` | solussd_: Just checked one of my macros; the indentation seems correct. |
| 12:22 | Frozenlo` | Could you paste yours? |
| 12:22 | S11001001 | solussd_: if it's anything like common lisp and emacs lisp approach, you set a property on the similarly-named elisp symbol indicating indent rules |
| 12:22 | solussd_ | sure |
| 12:22 | muhoo | when i add :dev {:dependencies to a project.clj, is it supposed to completely override and wipe out the :dev {:dependencies in ~/.lein/profiles.clj ? |
| 12:22 | muhoo | or are they supposed to merge? |
| 12:22 | technomancy | muhoo: yeah, you shouldn't set :dev in ~/.lein/profiles.clj |
| 12:22 | technomancy | muhoo: you want :user in that case |
| 12:23 | muhoo | oh, ok, thanks |
| 12:23 | nickmbailey | k |
| 12:26 | solussd_ | ha, ref heap does the same thing. must be exceptions carved out for certain symbols |
| 12:26 | solussd_ | Frozenlock: https://www.refheap.com/paste/019541365e34bdafec6564612 |
| 12:26 | muhoo | there was some discussion about nohup earlier, i figured something out. "lein2 repl :headless &" does NOT work-- the process stops and refuses to run without stdin-- but "nohup lein2 repl :headless &" DOES work |
| 12:27 | technomancy | muhoo: that's kind of crappy; can you open an issue? |
| 12:27 | muhoo | sure |
| 12:27 | technomancy | :headless should work without stdin |
| 12:29 | kaoD_ | is it possible to override deftype's constructor? |
| 12:30 | kaoD_ | I want to keep a transformed argument along with the type |
| 12:30 | kaoD_ | (realized) |
| 12:31 | kaoD_ | I don't want to realize it again and again |
| 12:35 | Frozenlock | solussd_: I just realized that my macros are starting with "with-", which seems to automatically indent them as expected. |
| 12:35 | technomancy | solussd_: in general there's no good way to do it |
| 12:36 | kaoD_ | I guess I'll stick with the factory function |
| 12:36 | technomancy | because you have to eval arbitrary elisp code to change the indentation |
| 12:36 | technomancy | so if you have half the committers using the new indentation rules and half of them not, you're going to have a mess on your hands. |
| 12:37 | technomancy | and allowing eval of arbitrary elisp when you visit a file belonging to a project is a really bad idea |
| 12:37 | muhoo | ok, so lein2 is ignoring my :user profile completely |
| 12:38 | solussd_ | technomancy: makes sense |
| 12:38 | Frozenlock | technomancy: Depending on the project, having an org-babel file for this purpose could be interesting |
| 12:38 | technomancy | Frozenlock: I don't follow |
| 12:40 | muhoo | what am i missing here? do i have to explicitly invoke "with-profile user,dev" ? or does user get implicitly invoked? |
| 12:41 | muhoo | (sorry for the dumb-ass questions, i'm only a day into lein2) |
| 12:42 | Frozenlock | Project.clj, Readme.org, Custom-project-rules.org... Where Custom-project-rules.org (or custom-project-rules.el, whatever float your boat) has the necessary elisp to customize the identation. I don't see this used everywhere, but in specialized project it could be useful. |
| 12:42 | technomancy | muhoo: user gets applied by default for everything except things producing downstream artifacts (like pom, jar, and uberjar) |
| 12:42 | technomancy | because your personal config is not supposed to affect what others consume |
| 12:42 | Frozenlock | But in my case I'm too lazy to ever do it. I would just accept the default indent :) |
| 12:43 | technomancy | or you could just eval a single file at the project root if you're going to go to all that trouble =) |
| 12:44 | Frozenlock | Sure. But the more I think about it, the more I think it's a bad idea. Please disregard what I've been saying for the last few minutes :) |
| 12:55 | jsabeaudry | If anyone else is always wondering (about cljsbuild) when did that "Successfully compiled" line was printed? Here is a neat little trick: lein cljsbuild auto | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; }' |
| 13:06 | TimMc | Does that just print the time that the command finished? |
| 13:07 | nDuff | TimMc: Looks like it prints the time of each line of output |
| 13:07 | nDuff | TimMc: ...so one can get an idea of how much time each individual piece of the process is taking. |
| 13:18 | jsabeaudry | TimMc, yes exactly, so when you switch to that window you get a indication of whether or not that last "Successfully compiled" line is from the save you just did or the previous one 5 minutes ago. |
| 13:21 | TimMc | Ah! I see. |
| 13:32 | KirinDave | Ugh. Storm's macros in its clojure binding are pretty scary |
| 13:33 | KirinDave | The instant you try and use macros to call storm's macros you run into all kinds of problems. |
| 13:34 | KirinDave | To get the reader happy about "can't let qualified symbols" I had to quote nearly every symbol. |
| 13:34 | KirinDave | https://gist.github.com/05477f0c92eec4f9c4fb |
| 13:35 | KirinDave | I couldn't find an alternative way to fix that. Anyone have advice when you run into that kind of situation? |
| 13:35 | raek | KirinDave: why can't you use auto-gensym'ed symbols here? |
| 13:35 | emezeske | KirinDave: I think that's when you normally use gensym |
| 13:35 | KirinDave | Yeah but normally I shouldn't have to. |
| 13:35 | emezeske | KirinDave: e.g. symbol-name# |
| 13:36 | raek | (at all places except for "name") |
| 13:36 | KirinDave | So I dunno if that'd actually do anything other than radically obfuscate the code. |
| 13:36 | emezeske | KirinDave: You're using syntax-quote, so without using gensym or regular quoting, your macro is writing code like (let [my.namespace/foo ...] ...) |
| 13:36 | raek | gensyms are made for this scenario |
| 13:37 | KirinDave | I suspect people do not understand the error I am trying to correct here. :\ |
| 13:37 | KirinDave | I'm not introducing these symbol names into the binding because I want to. |
| 13:37 | emezeske | KirinDave: See my message above -- "cannot let qualified symbols" is exactly what I am talking about |
| 13:37 | KirinDave | emezeske: Right, but that's not me doing it. |
| 13:37 | emezeske | KirinDave: I see no less than two lets in your code |
| 13:38 | emezeske | KirinDave: Plus, I'd assume the defbolt arguments are used as bindings (subject to the same restrictions as let) |
| 13:38 | KirinDave | emezeske: Yeah |
| 13:38 | raek | https://gist.github.com/fd7c827a7502f9222d1f |
| 13:38 | KirinDave | That's what the problem is. |
| 13:40 | raek | KirinDave: you can't assume that the defbold macro does not use names like "tuple" or "collection" internally. |
| 13:40 | emezeske | You almost never want to use ~' , unless your specific goal is to create an unhygenic macro, which is almost never your goal |
| 13:40 | KirinDave | raek: Actually the reason it asks for them is that so it uses my binding. |
| 13:40 | raek | therefore you need to make new unique symbols that won't collide |
| 13:40 | KirinDave | emezeske: I use it to introduce names for anaphoric macros periodically. |
| 13:41 | emezeske | KirinDave: That's what I meant by unhygenic, your term is more correct |
| 13:41 | raek | KirinDave: do you know about "symbol capture"? |
| 13:41 | hiredman | KirinDave: "can't let qualified symbols" has nothing to do with the reader |
| 13:41 | emezeske | KirinDave: Unless you're doing that, you want gensym I think |
| 13:41 | KirinDave | raek: Yes. |
| 13:42 | XPherior | lein install is putting my jar in the target folder of the project. How can I make it publish to .m2? |
| 13:42 | KirinDave | raek: The problem is that the underlying macro is asking for bindings instead of making new ones. My complaint is that the storm macros are hairy in this way. :) |
| 13:43 | KirinDave | raek: And also the gensym approach breaks in one place which is why I went quote-crazy. |
| 13:43 | cgag | you could change the storm macros |
| 13:43 | raek | where does it break? |
| 13:43 | KirinDave | raek: let me rever this goofy change back to the normal way and show you, one sec. |
| 13:44 | raek | KirinDave: what do you mean by "asking for bindings"? the same thing as let does (let [<here> foo] ...)? |
| 13:44 | KirinDave | raek: yeah, defbolt actually creates a few methods and an object definition and it uses this one name in multiple places. |
| 13:45 | KirinDave | I've been meaning to re-write the bindings and contribute back for awhile now. |
| 13:45 | KirinDave | I've just been busy actually building topologies. |
| 13:46 | raek | so the actual names of the symbols are meaningful here? (and not only for "name"?) |
| 13:47 | KirinDave | raek: Not sure actually. I sort of despair at debugging clojure macros when they get too deep. |
| 13:47 | raek | I would at least use foo# for the doseq, let, and catch bindings |
| 13:47 | KirinDave | Yeah |
| 13:48 | raek | (I assumed that the third argument to defbolt worked like fn) |
| 13:48 | KirinDave | No actually that's the output name field. |
| 13:49 | KirinDave | Honestly i sort of wish this macro WOULD just introduce the bindings "tuple" & "collector" and tell you to deal with it. |
| 13:49 | KirinDave | Because all it does is clutter up the macro and also if you ever do name them anything other than "tuple" and "collector" you should be taken to the wall and shot. |
| 13:51 | raek | did you get what the "can't let qualified symbols" problem was about? |
| 13:51 | KirinDave | No I do. |
| 13:51 | KirinDave | It's just what was breaking was an inner let. |
| 13:51 | KirinDave | Not mine. |
| 13:51 | KirinDave | But yes, I do understand variable capture. |
| 13:52 | mprentice | happy thursday folks! |
| 13:52 | mprentice | aquamacs users: i'm using a nightly build (2012-07-17) and when my cursor is after a ), it's not highlighting the matching ( like it used to |
| 13:52 | mprentice | is anyone else experiencing this? |
| 13:53 | mprentice | when i'm on the (, it highlights the matching ) fine |
| 13:53 | mprentice | very weird bug |
| 13:53 | mprentice | or i have weird settings, always possible |
| 13:53 | KirinDave | Ah, okay. I can make it work if I just don't use this form of defbolt. |
| 13:53 | KirinDave | The non-prep version is too magical. |
| 13:53 | KirinDave | Good. I felt pretty dirty doing all that quoting and saying, "Good luck with your composition" to future generations. |
| 13:58 | pepijndevos | is there an up to date tutorial about how to set up vimclojure with leiningen? |
| 13:58 | cgag | i just followed this: https://github.com/daveray/vimclojure-easy |
| 14:12 | tutysra_ | anyone know what happened to clojure.contrib .java-utils package |
| 14:13 | tutysra_ | I am looking for the method - as-properties |
| 14:13 | xeqi | ~contrib |
| 14:13 | clojurebot | Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 14:14 | xeqi | doesn't look like anyone step up to bring it forward and maintain it |
| 14:16 | tutysra_ | ok...so if i wanted to use some code that uses them then I have to copy the relevant code from the libs and make them work with 1.3? |
| 14:21 | xeqi | tutysra_: as-properties looks like it might work as is - https://github.com/clojure/clojure-contrib/blob/master/modules/java-utils/src/main/clojure/clojure/contrib/java_utils.clj#L85 |
| 14:22 | KirinDave | hey just curious |
| 14:22 | KirinDave | I've got some code I use at work for our internal ring api endpoints |
| 14:23 | KirinDave | it makes it trivial to add metrics and healthchecks to ring servers |
| 14:23 | KirinDave | and also lets you automatically add zookeeper registration into the lifecycle of a jetty server. |
| 14:23 | KirinDave | I'm considering open sourcing it but I dunno if there is already a ring-bootstrapper like that. |
| 14:24 | KirinDave | If someone knows of something like that, could they point? Just so I mention it in the readme as I open source. |
| 14:25 | muhoo | now that's interesting. lein2 is definitely picking up my :init and :plugins from my ~/.lein/profiles.clj :user profile, but it's totally ignoring the :dependencies in that profile |
| 14:26 | muhoo | sorry, :repl-options and :plugins from :user profile are coming in, but :dependencies are not |
| 14:26 | muhoo | doh, nevermind, i am a moron. misplaced } |
| 14:27 | antares_ | KirinDave: I am not aware of anything like that, maybe ask on the mailing list? And thank you and your company for open sourcing good stuff. |
| 14:27 | muhoo | yay, lein-pprint :-) |
| 14:28 | KirinDave | antares_: it is entirely selfish. You can't hire good engineers without a good reputation as a shop that does interesting and/or quality work. |
| 14:28 | KirinDave | antares_: And we want to hire good engineers. Lost too many to other "sexier" job offers. |
| 14:29 | antares_ | KirinDave: sure, that's in part why I started clojurewerkz.org, too |
| 14:29 | antares_ | but still :) |
| 14:45 | muhoo | emezeske: still grinding along trying to get cljs repl working. even doing it this way https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments (browser/repl) the browser hangs while trying to POST 0 bytes, weird. |
| 14:46 | muhoo | http://bace.s3.amazonaws.com/weirdbrowse.png |
| 14:46 | ibdknox | hopefully in the next couple weeks light table might make all of that painless |
| 14:50 | jbarrios | does 'lein uberjar' include the JVM options defined in project.clj? |
| 14:50 | muhoo | if i switched from emacs to lighttable, in the long term, probably |
| 14:52 | ynniv | it would take a lot to move me from emacs to light table |
| 14:53 | ynniv | easier to make light table vi-like |
| 14:54 | muhoo | it's a whole different way of looking at development. very exciting. but, i have projects to complete NOW, and that means emacs, which is muscle-memory for me. |
| 14:57 | muhoo | also, this browser repl communication in cljs with a streaming GET and a bunch of XHR POSTS feels really janky and fragile to me, no matter what is laid on top of it. |
| 15:01 | pbostrom | muhoo: have you already tried repl-listen? https://github.com/emezeske/lein-cljsbuild/blob/0.2.5/doc/REPL.md |
| 15:01 | muhoo | pbostrom: i'm trying to do it from within nrepl.el :-) |
| 15:02 | muhoo | took me a while to upgrade to an emacs that supports lein2, upgrade to lein2, get regular nrepl.el going, all good now. |
| 15:03 | muhoo | so next step was baby steps: try just running the cljs browser repl from within a regular repl session (through nrepl), using this (repl/repl env) method in the cljs docs. and that's hanging. |
| 15:03 | muhoo | it's probably something obvious. time for a break. :-) |
| 15:10 | muhoo | er, sorry, had to upgrade to emacs24 to support nrepl.el. *defnitely* time for a break |
| 15:18 | azkesz | Hi guys(and gals), what IDE are you using for clojure ? does it have find all references or definition? (ie. just like eclipse has for java) |
| 15:18 | ThatOneGuy | im using eclipse with the CC plugins |
| 15:18 | ThatOneGuy | its really great |
| 15:19 | azkesz | counterclockwise? |
| 15:19 | clojurebot | counterclockwise is eclipse plugin |
| 15:19 | ThatOneGuy | yup |
| 15:19 | ThatOneGuy | => (str "a" "b") |
| 15:19 | ThatOneGuy | (str "a" "b") |
| 15:19 | azkesz | alright I'll check that, is there other plugins ? |
| 15:19 | azkesz | are* |
| 15:19 | ThatOneGuy | im guessing clojurebot isn't actually a bot |
| 15:19 | ThatOneGuy | for eclipse I don't think so |
| 15:20 | Wild_Cat | ,(str "a" "b") |
| 15:20 | clojurebot | "ab" |
| 15:20 | ThatOneGuy | but there are plugins for other IDEs |
| 15:20 | azkesz | ThatOneGuy what do you do to find all uses of a function in your project, with eclipse+cc ? |
| 15:20 | ThatOneGuy | good old find |
| 15:20 | ThatOneGuy | but it supposedly has symbol look-up |
| 15:20 | azkesz | from the Search menu? |
| 15:21 | ThatOneGuy | Ctrl-F |
| 15:21 | azkesz | does that search in all files? |
| 15:21 | azkesz | symbol look-up sounds good, I'll keep an eye out for that |
| 15:22 | ThatOneGuy | if you hold CTRL it turns all symbols into links. but I just tried it and it says cannot find declaration for symbol on a use of one of my functions |
| 15:22 | cemerick | ccw will navigate to var definitions, but won't find uses |
| 15:22 | ThatOneGuy | can it navigate to function definitions? |
| 15:23 | azkesz | cemerick what do you use to find uses? |
| 15:23 | cemerick | ThatOneGuy: Yes, but you need a REPL open for the project and have the source file loaded. |
| 15:24 | cemerick | azkesz: as ThatOneGuy, simple text search |
| 15:24 | azkesz | ThatOneGuy the Ctrl+click works for 'range' |
| 15:24 | azkesz | cemerick alright |
| 15:25 | cmajor7 | cemerick, glad to see you on irc! I have a question regarding friend: http://bit.ly/N1Hpy9 |
| 15:25 | ThatOneGuy | yeah works on core functions |
| 15:26 | azkesz | ThatOneGuy how do you make the source code show error when it's an error ie. a typo for a core function that doesn't exist? |
| 15:26 | azkesz | in eclipse |
| 15:26 | ThatOneGuy | umm Ctrl-Alt-S |
| 15:26 | ThatOneGuy | the repl tells me the errors |
| 15:28 | ThatOneGuy | typos are an easy catch as it says cannot find symbol and gives the line number. but usually after that you rarely get line numbers as it has already been parsed by the reader. |
| 15:28 | azkesz | That works, but I was hoping that eclipse would too, for me it's Ctrl+Alt+L load into repl |
| 15:28 | ThatOneGuy | and for me at least most of my errors happen in incorrect usage of core functions |
| 15:28 | ThatOneGuy | ctrl-alt-s switches to the repl also |
| 15:28 | ThatOneGuy | oh you changed from the default? |
| 15:29 | azkesz | you're right, ctrl+alt+s works also, but I had a desktop shortcut bound to that which would run sync |
| 15:29 | azkesz | I kept the defaults |
| 15:30 | ThatOneGuy | supposedly there are two edit modes |
| 15:30 | ThatOneGuy | i haven't tried the other one yet |
| 15:30 | azkesz | unrestricted and parens? |
| 15:30 | azkesz | strict/paredit edit mode, i like this one |
| 15:30 | ThatOneGuy | ohhh wow.. |
| 15:30 | ThatOneGuy | ive been typing both parens this whole time |
| 15:31 | azkesz | xD |
| 15:31 | ThatOneGuy | I thought it was kind of wierd why it didn't do it auto like curly braces |
| 15:32 | cemerick | cmajor7: I'm afraid I know nearly nothing about noir. |
| 15:33 | cemerick | However, you almost certainly don't want to have the :login-uri and :unauthorized-redirect-uri be the same |
| 15:33 | cemerick | And, you don't pass username/password to friend at all, you need to POST them to whatever is configured as the :login-uri |
| 15:34 | cemerick | cmajor7: ^^ |
| 15:37 | ThatOneGuy | https://gist.github.com/3239978 feedback? |
| 15:38 | cmajor7 | cemerick: great, thanks a lot. I do have it working for some time, using a regular POST (no ClojureScript). As far as username/password, they are there in the request, and I could see that Ring combines those params. Do they absolutely need to be in a :query-params of the request? |
| 15:38 | cmajor7 | (as to noir, it just takes a ring handler and a current request and passes it over to the server side in this case) |
| 15:45 | ThatOneGuy | https://gist.github.com/3239978 feedback? |
| 15:48 | xeqi | &(map boolean [nil false '()]) |
| 15:48 | lazybot | ⇒ (false false true) |
| 15:48 | xeqi | why remove emptys ? |
| 15:49 | ThatOneGuy | because it corresponds to no useful data at that key |
| 15:50 | ThatOneGuy | &(:important-data {:important-data {}}) |
| 15:50 | lazybot | ⇒ {} |
| 15:50 | ThatOneGuy | &(:important-data {}) |
| 15:50 | lazybot | ⇒ nil |
| 15:55 | xeqi | do you want to remove keywords and symbols? |
| 15:56 | cemerick | cmajor7: as long as you're using standard compojure site middleware, they'll end up as mapped via keywords in :params (so you can POST with them in the query string or as form params) |
| 15:58 | cmajor7 | cemerick: right, so my request already has ":form… params" with username/password |
| 15:59 | cmajor7 | cemerick: I am not sure how to debug a "(handler request)" that is called from under friend/authenticate* and throws a StackOverflow.. |
| 15:59 | cmajor7 | cemerick: could it be something in the request it expects but does not find? |
| 16:02 | cemerick | cmajor7: I'd run without ring.middleware.reload, if that's the last frame prior to the repeating one that overflows. |
| 16:26 | cmajor7 | cemerick: looking on how to do that.. it seems that noir has a list of middleware(s) it applies to the handler: http://bit.ly/MfwNHW (under "wrap-noir-middleware"). "wrap-route-updating" is a wrapper around "ring.middleware.reload", what would be a (pure Clojure) way to remove that from a chain.. e.g… "override the method" excluding "(wrap-route-updating)", or there is a different cleaner way? thank you. |
| 16:26 | Raynes | There isn't a way to remove middleware that is already applied. |
| 16:27 | cemerick | cmajor7: I really have no idea how noir works, sorry. |
| 16:27 | Raynes | If you're having middleware scenario issues, you're probably better off using Compojure. |
| 16:27 | cemerick | Could you maybe post the full stack trace, however long it is? |
| 16:27 | cmajor7 | sure.. one sec |
| 16:28 | xeqi | cmajor7: I think changing :mode will stop reload |
| 16:30 | cmajor7 | stacktrace: https://www.refheap.com/paste/4005 |
| 16:30 | cmajor7 | xeqi: let me try that.. changing it to anything but empty or dev, right? |
| 16:30 | xeqi | anything but :dev |
| 16:33 | cemerick | cmajor7: There's some bad mojo going on there. What are you calling at auth.clj:60? |
| 16:33 | xeqi | though I don't think it will help judging by the stacktrace |
| 16:39 | cmajor7 | cemerick: https://www.refheap.com/paste/4006 |
| 16:39 | cmajor7 | (it is auth:61 now, I moved it one line, since the last exception) |
| 16:39 | cmajor7 | so it is: "61 :workflows [(workflows/interactive-form)] " |
| 16:40 | cemerick | Well, that probably explains the stack overflow. |
| 16:41 | cemerick | or, probably |
| 16:41 | cemerick | friend/authenticate is middleware; you almost certainly don't want to be wrapping handlers within the course of handling a request (which I assume login is doing?). |
| 16:42 | cemerick | login is probably part of the `handler` chain itself, which would cause the stack overflow. |
| 16:43 | cmajor7 | cemerick: "friend/authenticate" is commented out of myapp's middleware chain, since I wanted to switch to ClojureScript's way of login in. |
| 16:44 | cemerick | I don't think this has anything to do with friend; i.e. what is this `handler` parameter that login is receiving? |
| 16:46 | cemerick | technomancy: so, debian is a sane distro for a tender don't-know-don't-want-to-know desktop linux noob? |
| 16:47 | cmajor7 | cemerick: it is a "gen-handler" from here: http://bit.ly/Ou9bnE |
| 16:47 | cemerick | right, and `login` is presumably rolled into that handler as a mapped route somehow? |
| 16:48 | cmajor7 | it should be yes.. via noir's "defpage" |
| 16:48 | cmajor7 | good catch, let me try to rename that |
| 16:48 | cemerick | Right; so, you're receiving a handler, that includes login, and calling it again, just with friend/authenticate wrapped around it. |
| 16:49 | cemerick | handler -> login -> handler |
| 16:49 | emezeske | cemerick: For a linux noob, I would definitely recommend ubuntu over debian |
| 16:50 | tos9 | Eh, debian's not that much harder to learn to use to be fair. |
| 16:50 | cemerick | emezeske: I have ubuntu installed in a vm now, but it's instantly irritating. The mystery meat menu bar game is not fun so far. |
| 16:51 | cemerick | worse, I still haven't found out how to get a listing of the apps that are installed, etc. |
| 16:51 | emezeske | I don't think that will be easier in debian... |
| 16:52 | emezeske | The latest Unity GUI for ubuntu is pretty dumb, though. I definitely would use gnome3, but I guess that's another step |
| 16:52 | pandeiro_ | cemerick: it's you you're talking about when you say, 'dont know, dont wanna know'?? |
| 16:52 | lazybot | pandeiro_: Uh, no. Why would you even ask? |
| 16:53 | amalloy | i found ubuntu 10.04 pretty manageable as a first linux distro. i haven't really liked anything after it, with all the unity nonsense |
| 16:53 | cemerick | emezeske: huh, I thought I *was* using gnome3 :-P |
| 16:53 | ToxicFrog | cemerick: dpgk --get-selections, apt-cache search --installed .*, or aptitude/some other frontend and filter by "installed" |
| 16:53 | ToxicFrog | (note: this is the same as on debian) |
| 16:53 | cemerick | ToxicFrog: I mean, click an icon/menu/whatever, get a list of apps installed I can open. |
| 16:53 | ToxicFrog | Oh |
| 16:54 | cemerick | meh, I shouldn't have gone OT here anyway, sorry :-) |
| 16:54 | ToxicFrog | Upper left corner? It's been a while since I used Unity |
| 16:54 | emezeske | cemerick: I think if you switch to using gnome3 you will be happy |
| 16:54 | cmajor7 | cemerick: same exception after the rename.. :( |
| 16:54 | emezeske | cemerick: Basically that's what you'd get by switching to debian |
| 16:54 | ToxicFrog | If you want ubuntu's features/polish with a more traditional UI, you might check out Mint, or one of the Ubuntu respins with a different DE like xubuntu |
| 16:55 | xeqi | cmajor7: I have a feeling you're going to need some sort of custom workflow for this |
| 16:55 | xeqi | fetch sends everything to uri "/_fetch" |
| 16:55 | xeqi | working on trying to build a working example atm |
| 16:56 | cemerick | xeqi: the objective here is to be able to log in via an xmlhr? |
| 16:56 | xeqi | yeah |
| 16:56 | cmajor7 | cemerick: re: Ubuntu.. I just use Gnome with nothing on the desktop, but an OS/X like dock: http://www.glx-dock.org/ |
| 16:57 | pandeiro_ | cemerick: arch may seem intimidating, but it's way less crufty than the 'big' distros and i would think it would appeal to a veteran programmer new to linux; very simple architecture, newest software w/o the need for compilation, great package manager |
| 16:57 | cmajor7 | xeqi: why would a workflow be different? |
| 16:57 | cgag | i like arch, but it doesn't really seem to fit in with "don't know, don't wanna know" |
| 16:58 | cemerick | xeqi: the equivalent of $.post("/login", {"username" "…" "password" "…"}) will set up the logged-in session, which the browser (and thus cljs) will re-send on each request after that. |
| 16:59 | emezeske | I've gotta say, "don't know don't wanna know" is in polar opposition to Arch. |
| 16:59 | ToxicFrog | Yeah, Arch is very much the "I want to set up every part of my system by hand and know how it all works" distro |
| 16:59 | ToxicFrog | Fantastic documentation, though. |
| 17:00 | cmajor7 | cemerick: so theoretically, I can leave "friend/authenticate" as a middleware, and just check the session for an identity at the time of a response? |
| 17:00 | emezeske | Oh, I looooooove arch, it's my distro of choice, easily. But it requires constant maintenance. |
| 17:00 | cemerick | cmajor7: friend/authenticate *is* middleware :-) |
| 17:00 | xeqi | cemerick: sorry, he's trying to use fetch, not raw xhr |
| 17:01 | cmajor7 | cemerick: right, but it needs to be "added" with noir. that is what I meant |
| 17:01 | cemerick | xeqi: Dunno what fetch is…but it boils down to an xhr eventually, and thus sends the session. |
| 17:01 | cmajor7 | cemerick: but I am not sure if xhr will hit that middleware, you are saying it will? |
| 17:02 | cemerick | cmajor7: that's a routing and app config question, that I have no business attempting to answer w.r.t. noir. :-) |
| 17:02 | emezeske | cmajor7, cemerick: So the problem with fetch is that you don't have easy access to the routes it creates, to wrap them with your own middleware |
| 17:02 | emezeske | cmajor7, cemerick: I think it's possible, but it's a big hassle |
| 17:03 | cmajor7 | emezeske: I don't mind a hassle.. show me the way :) |
| 17:03 | cemerick | emezeske: Oh, is fetch that thing that implements quasi-RMI? |
| 17:03 | emezeske | cmajor7: Well, I don't know the way. When I hit that, I decided I didn't like fetch, and built my own system that exposed the routes directly without using atoms in the background |
| 17:03 | emezeske | cemerick: Yes |
| 17:04 | cemerick | well, surely it gives you a single top-level handler you can decorate with the middleware you want? |
| 17:04 | emezeske | It's all magic behind the scenes |
| 17:05 | cemerick | emezeske: Coming from you, that means there's *too* much magic! ;-) |
| 17:05 | emezeske | cemerick: Haha |
| 17:06 | emezeske | With fetch, when you define remote callable methods, it updates an atom behind the scenes, and that atom contains the route handler |
| 17:06 | emezeske | I believe |
| 17:07 | cmajor7 | cemerick: what is the minimal input friend needs to authenticate an account? e.g. I do have a handler and I do have a request with username/password in it, are you saying that my current "handler" is no good? |
| 17:09 | pandeiro_ | emezeske: is that system somewhere i can look at it? :) |
| 17:10 | cemerick | cmajor7: for interactive, just username and password in a post to the configured uri. But all bets are off `login` is just a sub-handler within `handler`. |
| 17:10 | emezeske | pandeiro_: which system? |
| 17:10 | cemerick | cmajor7: it's really pretty simple: https://github.com/cemerick/friend/blob/master/test/test_friend/mock_app.clj#L100 |
| 17:10 | pandeiro_ | what you decided to use instead of fetch? |
| 17:11 | emezeske | pandeiro_: Oh, hehe, it's not open source (yet) |
| 17:11 | cemerick | cmajor7: oh, and I was mistaken about :login-uri and :unauthorized-redirect-uri needing to be different. o.0 |
| 17:11 | emezeske | pandeiro_: It's not really hard to write such a thing; basically just wrapping an XHR in pr-str/read-string on both ends |
| 17:12 | xeqi | pandeiro_: make sure to bind *read-eval* false for read-string if you build one |
| 17:13 | pandeiro_ | emezeske: yeah that's exactly why i decided to use fetch, to avoid that |
| 17:14 | emezeske | pandeiro_: That's why I used fetch too |
| 17:14 | emezeske | pandeiro_: And noir, for that matter |
| 17:14 | pandeiro_ | xeqi: right, hit that already |
| 17:14 | emezeske | pandeiro_: But both fetch and noir are less flexible than compojure, and they don't add *that* much |
| 17:14 | duck1123 | is fetch still good if you don't use noir? |
| 17:14 | pandeiro_ | emezeske: yeah i realize that |
| 17:15 | duck1123 | I've kinda avoided it so far |
| 17:15 | emezeske | duck1123: You can't use fetch without noir |
| 17:15 | pandeiro_ | i would like something compojure-like for defining ajax routes |
| 17:15 | pandeiro_ | i like the visual layout of compojure routes |
| 17:16 | emezeske | It's not just visual -- building up all the routes directly lets you control access very carefully |
| 17:16 | emezeske | And conditionally, etc |
| 17:17 | pandeiro_ | sure but it also gives you a site outline for free |
| 17:17 | pandeiro_ | or an API outline |
| 17:17 | cmajor7 | cemerick: yep that is how I have it working for several days with no XHR, but with XHR, it drops into a StackOverflow dance.. I can't seem to pinpoint the reason though.. :( |
| 17:17 | emezeske | pandeiro_: I agree :) |
| 17:18 | cmajor7 | I feel the approach is right, since it does work for non XHR.. and I have all the data needed handy (handler, config, request) |
| 17:20 | cemerick | pandeiro_: I haven't used it personally, but bishop looks promising. |
| 17:24 | pandeiro_ | cemerick: thanks, interesting |
| 17:24 | muhoo | hehehe, the cljs broowser repl is breaking because firefox is trying to grab robots.txt on port 9000 |
| 17:25 | pandeiro_ | muhoo: that happened to me once |
| 17:25 | muhoo | pandeiro_: how did you fix it? |
| 17:25 | pandeiro_ | it was something i was doing |
| 17:25 | pandeiro_ | but i cant remember :) |
| 17:26 | pandeiro_ | muhoo: maybe i upgraded clojurescript? |
| 17:26 | pandeiro_ | or cleaned it out |
| 17:26 | pandeiro_ | or something silly like that |
| 17:26 | pandeiro_ | ah no |
| 17:26 | pandeiro_ | are you forgetting the /repl ? |
| 17:26 | pandeiro_ | (portion of the url) |
| 17:27 | muhoo | i dunno, i'm not doing any of this (repl/repl env) is |
| 17:27 | pandeiro_ | you have to connect to a url though |
| 17:27 | muhoo | but yes, sniffing the wire, it's posting to "/" not "/repl" |
| 17:27 | pandeiro_ | that will be in your cljs code |
| 17:27 | pandeiro_ | bam |
| 17:27 | pandeiro_ | cmon, localhost:9000, that could be _anything_ ;) |
| 17:28 | muhoo | oh, DOH, that is me then |
| 17:28 | muhoo | pandeiro_: THANKS! |
| 17:29 | pandeiro_ | muhoo: btw if you ever play with phantomjs/casperjs, i wrote a wrapper yesterday https://github.com/pandeiro/ghost |
| 17:30 | pandeiro_ | still has some issues but just scraped google translate successfully for the first time :) |
| 17:31 | muhoo | nice! well, i'm still down in the plumbing here, my objective is a working/reliable cljs repl from inside nrepl.el somehow |
| 17:31 | muhoo | i get less specific on the "somehow" the longer it takes :-) |
| 17:32 | pandeiro_ | muhoo: ah yeah i remember you mentioning that the other day, very cool |
| 17:32 | muhoo | it'll be cool once it works :-P |
| 17:32 | devth | anyone know a nice way to format a time interval (- now start-time) in human readable? trying to calculate `uptime` |
| 17:32 | pandeiro_ | would the use case be something similar to himera though? |
| 17:32 | pandeiro_ | or are the possibilities truly endless? ;) |
| 17:33 | duck1123 | devth: are you trying to get it in the form of "minutes ago" |
| 17:33 | devth | duck1123: no, just the most appropriate unit. |
| 17:34 | duck1123 | ok, if so, I'd say ocpsoft-pretty-time |
| 17:34 | devth | I found clj-time with in-minutes, in-hours, etc. |
| 17:34 | cpinera | Hi all. Corporate overlords are requiring static code analysis to be run on my Clojure code. Does anyone have any experience with that? |
| 17:34 | nDuff | cpinera: there _is_ a tool that exists for the purpose. Haven't used it. |
| 17:34 | TimMc | cpinera: kibit? |
| 17:34 | nDuff | ...ahh, yup, that's the one. |
| 17:35 | cpinera | Oh cool. I'll give it a try. Thanks! |
| 17:35 | S11001001 | cpinera: I think read loop over file, report read errors counts |
| 17:36 | eggsby | anyone here familiar with clojure.java.jdbc? I'm getting a 'invalid host/bind variable name' error from this: https://www.refheap.com/paste/4009 |
| 17:36 | hiredman | cpinera: have they also defined what static analysis they want? |
| 17:36 | cpinera | S11001001: haha nice |
| 17:36 | hiredman | static analysis is or could be a bunch of different things |
| 17:37 | cpinera | hiredman: the requirement comes from the security group, so I guess they are focused on that. |
| 17:37 | hiredman | kibit, at least what I've seen, is about idioms |
| 17:37 | hiredman | cpinera: stil lthat is very vague, like, what are they looking for from static analysis? |
| 17:37 | S11001001 | (inc hiredman) |
| 17:37 | lazybot | ⇒ 12 |
| 17:38 | hiredman | the biggest security related static analysis is buffer overflows, but the jvm (and clojure) have bounds checking on arrays |
| 17:39 | hiredman | cpinera: I would definitely go back, and ask what kind analysis they want, what do they want it to look for? |
| 17:39 | cpinera | hiredman: I totally agree with you. I don't know what they're looking for. I'll ask for the specific requirements. If they have none, then kibit will do fine. If they have something specific they perhaps one of the JVM bytecode static analysis tools would work for Clojure code? |
| 17:39 | S11001001 | potential nulls? concatting dirty data to sql? |
| 17:39 | amalloy | you could statically analyze: "yep, still runs on the jvm, should be fine" |
| 17:41 | S11001001 | you could compare your dependency tree to the latest releases on clojars/maven-central, complain about out-of-dateness (could be security updates?) |
| 17:43 | duck1123 | what about lein check? |
| 17:45 | cpinera | S11001001: dependency check is a good idea! |
| 17:46 | cpinera | duck1123: The poor man version, yes, that's a good starting point. Thanks! |
| 17:57 | cmajor7 | cemerick: whenever you have time is it possible to upload friend..-sources.jar side by side with friend jars to https://clojars.org/repo/com/cemerick/friend/ ? |
| 17:59 | hiredman | cmajor7: the jar should include the sources |
| 17:59 | cmajor7 | hiredman: oh.. sorry about that. how do I hook these sources with lein, so I can step through the code? |
| 17:59 | hiredman | cmajor7: unless you configure it otherwise, lein always includes the .clj files in the jar |
| 18:00 | hiredman | cmajor7: lein is a build tool |
| 18:00 | hiredman | cmajor7: what do you mean look through the sources? |
| 18:02 | cmajor7 | hiredman: I am using VimClojure.. and usually I travel through sources in different files via a shortcut (e.g. \gw). But for friend/xyz, it tells me: "Vim(echoerr):cemerick/friend.clj not found in 'path'" |
| 18:02 | cmajor7 | I know it is on a path, since the file does compile |
| 18:04 | hiredman | cmajor7: right, most likely you need to restart vimclojure or whatever |
| 18:05 | hiredman | friend wasn't on the classpath when it was started |
| 18:05 | cmajor7 | hiredman: I've been restarting it several times a day for various reasons, the error is still the same |
| 18:05 | cmajor7 | lein classpath has friend, and so nailgun-server classpath |
| 18:06 | hiredman | cmajor7: *shrug* it is either the classpath issue, or something specific to vimclojure |
| 18:14 | muhoo | cmajor7: i usually grab the github sources and browse those in $EDITOR |
| 18:15 | muhoo | rather than opening and browsing around in ~/.m2/repository/dig/around/for/thing.jar |
| 18:16 | muhoo | pandeiro_: ahahaha! that "hanging" POST in the browser is normal operation. |
| 18:17 | muhoo | it POSTs the response to the last command, then hangs, waiting for someone to type something in the repl which is basically the next command for it to eval |
| 18:17 | cmajor7 | muhoo: how does it work with navigation between sources? I browse them on github otherwise |
| 18:18 | muhoo | cmajor7: depends on the value of "it" |
| 18:18 | cmajor7 | vim + your code + lib code |
| 18:19 | muhoo | i don't use vim, but i keep a directory /foo/clojure/src, and in there i have a metric shit-tonne of stuff i've git cloned. when i want to read source, i just open those in my editor, and have a look around |
| 18:21 | muhoo | actually, correction, i *do* use vim, for sysadmin tasks when i need to edit stuff in sudo as root. i use emacs for development. |
| 18:22 | cmajor7 | muhoo: I see. I there is also a github plugin for lein you can use.. not to pull down sources though |
| 18:24 | pandeiro_ | muhoo: ah long-polling? |
| 18:28 | hiredman | .win 15 |
| 18:29 | mtkoan | korma makes me happy |
| 18:30 | mtkoan | but I'm no leet developer! |
| 18:32 | xeqi | I like the map -> sql part of korma. not so much the rest |
| 18:38 | arrdem | are local jars in lib/ still supported under lein2? |
| 18:43 | muhoo | it's funny how cljs turns java in to an assembly language |
| 18:43 | muhoo | sorry javascript |
| 18:44 | muhoo | it turns java into a compiler, and js into an assembler, kinda |
| 18:45 | muhoo | https://www.refheap.com/paste/4012 , it's like reading disassembled .asm |
| 18:49 | muhoo | cmajor7: dunno, might be useful tho |
| 18:49 | cmajor7 | muhoo: https://github.com/tobyhede/lein-git-deps |
| 18:50 | muhoo | arrdem: lein2 seems to not copy stuff into lib/ anymore. it seems to pull them from ~/.m2/repository directly, based on the classpath i'm seeing. |
| 18:53 | arrdem | muhoo: yeah... I dug through the docs and I didn't see a good way to have a local *.jar library path |
| 18:54 | arrdem | I guess I just need to add them to m2 and require them... |
| 19:11 | akhudek | arrdem: that's correct, you need to install them locally with mvn |
| 19:13 | arrdem | akhudek: raaah.... that's what I' |
| 19:13 | arrdem | d just confirmed. |
| 19:13 | arrdem | oh well.. bash script to add 400 jars... |
| 19:13 | akhudek | that's a lot of jars! |
| 19:14 | arrdem | that's why I was really wishing I didn't have to maven them all.. |
| 19:14 | aperiodic | or a bash script to merge 400 jars into one jar... |
| 19:14 | arrdem | and yeah. working on an Eclipse plugin which has a personal record for number of dependancies |
| 19:14 | arrdem | aperiodic: ..... yes. or that. |
| 19:15 | hiredman | arrdem: or find the deps in a maven repo |
| 19:15 | arrdem | hiredman: if I ever meet you IRL I owe you a beer. |
| 19:16 | arrdem | there does indeed exist a maven repo for the Eclipse SDK. |
| 19:26 | muhoo | arrdem: lein local-repo |
| 19:28 | muhoo | heh, reading the network sniff back-and-forth between cljs and the repl, is bizarre. it's javascript, wrapped in clojure, wrapped in javascript. syntax highlighting is... challenging |
| 19:28 | muhoo | it reminds me of... dare i say it... reading HTML with embedded PHP, JS, and CSS |
| 19:29 | muhoo | https://www.refheap.com/paste/4013 |
| 19:33 | gerundde` | Can I turn off warnOrFailOnReplace with lein + nrepl? |
| 19:34 | Raynes | Awww! |
| 19:34 | Raynes | refheap's 4000th paste was private. :( |
| 19:34 | muhoo | Raynes: are you giving awards? |
| 19:34 | Raynes | Nope. |
| 19:34 | Raynes | Just curious. |
| 19:35 | hiredman | no |
| 19:35 | muhoo | gerundde`: getting too many popups? |
| 19:36 | Raynes | I could look at it, but that'd be a violation of my ethics. |
| 19:37 | gerundde` | I'm using core.logic, and trying to use nrepl's compile the current buffer. |
| 19:37 | muhoo | gerundde`: oh nevermind, i thought you meant nrepl.el. looks like warnonfailorreplace is buried deep in here https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Namespace.java |
| 19:37 | gerundde` | Yeah I'm using nrepl.el |
| 19:38 | hiredman | gerundde`: use :exclude like it is used in all the examples |
| 19:38 | gerundde` | I'd have to exclude == and I kinda need that :) |
| 19:39 | hiredman | you can still use it |
| 19:39 | muhoo | Raynes: what, the "private" pastes aren't stored as a sha1 hash? :-) |
| 19:39 | Raynes | Heh |
| 19:39 | hiredman | either by using the fully qualified name, or rename it as documented in the docs for require and use |
| 19:39 | gerundde` | hiredman: Yeah I have :as logic |
| 19:39 | hiredman | so what is the problem? |
| 19:40 | Raynes | muhoo: People don't really understand that 'private' only means 'not listed in public pastes and with a not easily guessable url'. |
| 19:40 | gerundde` | :refer-clojure :exclude [==] is working now |
| 19:40 | hiredman | if you are using :require :as you don't need the exclude |
| 19:40 | gerundde` | hiredman: ah, ok I was using :use |
| 19:41 | gerundde` | hiredman: Actually use + refer-clojure works, require - refer-clojure doesn't. |
| 19:43 | muhoo | Raynes: TOS might be a good place for that info. or, call it "Public" and "Non-Public" |
| 19:45 | hiredman | gerundde`: it does, you are just doing it incorrectly |
| 19:46 | gerundde` | hiredman: You sure with nrepl.el and repeatedly compiling the current buffer? |
| 19:47 | gerundde` | hiredman: :require [clojure.core.logic :as logic] What's to get wrong? |
| 19:48 | hiredman | gerundde`: namespaces are stateful things, so depending how you did stuff before you can screw up that state |
| 19:50 | gerundde` | hiredman: Nothing else in the namespace. Restarted nrepl-server, no problems. |
| 19:51 | gerundde` | must have messed up the repl previously |
| 19:52 | hiredman | by "messed up the repl" you mean "messed up the namespace" the namespace is basically a map which is the compile time environment for code in the namespace |
| 19:52 | hiredman | the map is mutable state, and you can get it into a state where things don't work like you want |
| 19:52 | gerundde` | I had compiled that buffer previously |
| 19:53 | gerundde` | with use and without the refer exclude. |
| 20:13 | holo | hi |
| 20:15 | holo | using clj-time library, there isn't the "to-sql-date" available in the namespace. where is it? there is a reference to it on github: https://github.com/seancorfield/clj-time |
| 20:17 | benedikt | technomancy: have you found any solution (or workaround) to the repl issue in emacs? |
| 20:17 | seanm | holo: clj-time.coerce |
| 20:17 | seanm | https://github.com/seancorfield/clj-time/blob/master/src/clj_time/coerce.clj#L60 |
| 20:19 | muhoo | ok it's starting to make sense. very strange. it's not a streaming GET, it GETs the iframe with all the clojure repl code that it needs, then it does all the rest via streaming POSTs, or rather POSTS with what appear to be very long timeouts |
| 20:20 | muhoo | send a response as a POST, then wait for the next command as the POST response-- it's exactl backwards |
| 20:23 | holo | seanm, that was fast. how did you find it? |
| 20:23 | holo | seanm -.-' oh, you don't happen to be the developer right? |
| 20:24 | seanm | just went through the source |
| 20:24 | seanm | ha no, different sean |
| 20:25 | holo | seanm, so you skimmed the source by random means and found it? heh.. i'm really curious about the method because i was searching for it some time |
| 20:25 | amalloy | if you have the source checked out it's pretty easy with something like `find -name '*.clj' | xargs grep to-sql-date` |
| 20:25 | amalloy | or in emacs, M-x find-grep will construct that command line for you |
| 20:25 | seanm | holo: I don't have it checked out locally, otherwise I would have done what amalloy mentioned, or used ack |
| 20:25 | holo | offline search i see |
| 20:26 | hiredman | rgrep! |
| 20:26 | seanm | Instead I went to the webview and used browser find |
| 20:26 | hiredman | amalloy: what is this find-grep nonsense? |
| 20:26 | seanm | there's only 4 source files |
| 20:26 | amalloy | hiredman: is rgrep just grep -r? i've had trouble with that when it tries to follow the .git dir |
| 20:27 | seanm | I just end up using 'ack' |
| 20:27 | duck1123 | that's why I add | grep -v git |
| 20:27 | hiredman | amalloy: never seen that happen, (decent in to hidden directories) |
| 20:27 | seanm | so I don't shoot myself in the foot when I forget to exclude massive files/dirs |
| 20:27 | hiredman | amalloy: you should try rgrep |
| 20:28 | hiredman | it generates a hyper-linked buffer of grep results for easy jumping to hits |
| 20:28 | amalloy | so does find-grep |
| 20:28 | holo | seanm, which search engine? |
| 20:28 | hiredman | also paging through hits via , and . |
| 20:28 | seanm | holo: not a search engine |
| 20:28 | seanm | just ctrl+f |
| 20:28 | seanm | went here https://github.com/seancorfield/clj-time/blob/master/src/clj_time/coerce.clj |
| 20:28 | holo | haha |
| 20:28 | seanm | ctrl+f |
| 20:29 | seanm | "sql" |
| 20:29 | hiredman | I've never used anything but rgrep, the emacs manual says "The commands M-x lgrep (local grep) and M-x rgrep (recursive grep) are more user-friendly versions of grep and grep-find" |
| 20:29 | amalloy | hiredman: rgrep looks like a version of find-grep with more prompting and less command-line options |
| 20:30 | hiredman | "Directories listed in the variable grep-find-ignored-directories are automatically skipped by M-x rgrep. The default value includes the data directories used by various version control systems. " |
| 20:30 | amalloy | emacs's rgrep certainly looks smarter than the command-line rgrep |
| 20:30 | hiredman | http://www.gnu.org/software/emacs/manual/html_node/emacs/Grep-Searching.html |
| 20:30 | holo | seanm, i see. i was using just the .core namespace from clj-time. thank you for your patience. i should have suspected |
| 20:30 | amalloy | which is what i thought you referred to at first |
| 20:30 | seanm | holo: np |
| 20:31 | gert | We're running into http://dev.clojure.org/jira/browse/JDBC-11 -- java.jdbc committing transactions after errors, because it catches Exception, not Throwable. We're using preconditions in certain functions and want our transaction to roll back if a precondition isn't met - but that throws an AssertionError, not an Exception. How should we handle this? |
| 20:31 | hiredman | gert: don't use preconditions like that |
| 20:32 | gert | hiredman: what's the right use for preconditions? |
| 20:32 | seanm | could try using something like google's preconditions |
| 20:32 | hiredman | no idea |
| 20:32 | seanm | dunno if there's a nice clojure wrapper for 'em |
| 20:32 | muhoo | korma? |
| 20:33 | hiredman | which is largely why I don't use them |
| 20:33 | gert | hmm. |
| 20:33 | amalloy | preconditions don't really get used much in clojure, but they generate assertions. some general advice for assertions is "they should only catch serious errors in programming, not something that should ever come up at runtime" |
| 20:33 | hiredman | they are a neat idea in theory |
| 20:34 | hiredman | but not flexible enough in practive (determining the text of errors, the type of errors, how they are handled, etc) |
| 20:34 | gert | but using preconditions during development is a valid use, right? |
| 20:35 | hiredman | *shrug* |
| 20:35 | seanm | I tend not to, lest I forget to remove them |
| 20:35 | seanm | and I always forget |
| 20:36 | gert | also, this leaves the issue that you really don't want to *commit* a transaction on an Error - even when in the real world Errors shouldn't happen and all bets are off. |
| 20:37 | hiredman | gert: well, there is an issue open for it, do you want to write a patch to fix it (have you submitted a ca?) |
| 20:37 | gert | the issue is closed and marked as resolved |
| 20:37 | hiredman | are you using the latest version of java.jdbc? |
| 20:38 | gert | 0.2.3 yes |
| 20:39 | amalloy | huh? that code surely isn't committing on Error |
| 20:39 | hiredman | gert: are you sure? is 0.2.3 the only java.jdbc jar on your classpath? |
| 20:39 | devn | use an existing solr client library or just write my own? |
| 20:39 | amalloy | (try (stuff) (commit) (catch Exception (rollback))) is the skeleton, right? an Error in stuff causes neither commit nor rollback to happen |
| 20:40 | devn | Seems like the ones that exist are designed for whatever the author intended and not the general use case... |
| 20:40 | hiredman | https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L348 |
| 20:41 | devn | i like using preconditions, fwiw. |
| 20:41 | gert | amalloy: we're seeing commits, with this code. I'm confused now |
| 20:41 | devn | the lack of flexibility is sort of the reason i use them -- they're anchors |
| 20:41 | devn | it's like rock climbing |
| 20:42 | hiredman | gert: check to make sure the version of jdbc you are loading is the correct one |
| 20:42 | hiredman | make sure no other library is stomping on your requirements somehow |
| 20:43 | gert | hiredman: good point. project.clj says 0.2.3 - but we're checking the classpath |
| 20:43 | devn | hiredman: whaddya think about (range 9 3 0), (range 3 9 0), and (range 0 0 0) -- how should 0 step behave? |
| 20:44 | gert | hiredman: classpath says 0.2.3 and only one occurrence of java.jdbc |
| 20:44 | hiredman | devn: I don't care, a step of 0 is nonsensical, so don't do it |
| 20:45 | devn | hiredman: yeah, but a program could have a function which takes inputs that determine the step of range -- if once in a great while it allows an infinite seq of start, that seems weird |
| 20:45 | hiredman | devn: validate inputs |
| 20:45 | devn | i know you just said you dont care, but do you have any preference for infinite seq of start or would you disallow 0 altogether? |
| 20:46 | hiredman | no preference |
| 20:47 | hiredman | someone might have some super elegent algorithm that relies on generating a infinite seq that way using a recursive call over a counter that decrements to 0 or something, but I don't care one way or the other |
| 20:48 | gfredericks | can anybody explain to me why cKanren only deals with finite domains? e.g., why would infinite domains of integers be harder? |
| 20:48 | devn | that's cool, just trying to get some input because of the inconsistency w/r/t 0 step currently |
| 20:50 | hiredman | gfredericks: because the nature of relational program would require you to be able to enumerate all integers |
| 20:50 | gfredericks | hiredman: why is that hard? |
| 20:50 | hiredman | it is surprisingly easy, it jsut takes forever so nothing else gets done |
| 20:51 | gfredericks | but (fresh [coll] (membero x coll)) is infinite... |
| 20:51 | gfredericks | so clearly we're not opposed to that |
| 20:51 | hiredman | you end up with search trees that are infinitely wide |
| 20:51 | hiredman | gfredericks: how is that infinite? |
| 20:52 | gfredericks | [x . _.0], [_.0 x . _.1], [_.0 _.1 x . _.2], etc |
| 20:53 | gfredericks | (defn naturalo ([x] (naturalo 0 x)) ([n x] (conde ((== x n)) ((naturalo (inc n) x))))) |
| 20:53 | gfredericks | ^ I imagine that would be functional |
| 20:53 | hiredman | ah, sure an infinite set of results is fine, but a search tree of infinite width is a problem |
| 20:53 | hiredman | yeah, but inc is not relational |
| 20:53 | gfredericks | no but I can imagine it being done differently so it is |
| 20:54 | gfredericks | (defn inco ...) wouldn't be hard |
| 20:54 | gfredericks | I guess (naturalo 100000000) would take a while, eh? |
| 20:54 | gfredericks | well that part could be avoided |
| 20:54 | amalloy | gfredericks: what do you mean, defn inco wouldn't be hard? |
| 20:55 | gfredericks | well if both args are ground, check; if one is, compute the other; if neither, enumerate |
| 20:55 | xeqi | peano arithmetic successor function ? |
| 20:55 | hiredman | there is a reason the reasoned schemer guys invented their binary numical representation |
| 20:55 | gfredericks | I'm assuming things can be defined at a lower level where you can check if things are ground or not |
| 20:56 | gfredericks | hiredman: that's why I'm asking. I don't know what that reason is. |
| 20:56 | arkh | is there a common clojure funcation that's similar java's .indexOf? I'm using re's but they seem overkill for something so simple |
| 20:57 | hiredman | arkh: just use .indexOf |
| 20:57 | amalloy | gfredericks: how do you even enumerate? start at 0? only work for non-negative integers? |
| 20:57 | gfredericks | amalloy: anything can be enumerated |
| 20:58 | xeqi | gfredericks: not true |
| 20:58 | gfredericks | &(take 10 (interleave (range) (map - (rest (range))))) |
| 20:58 | lazybot | ⇒ (0 -1 1 -2 2 -3 3 -4 4 -5) |
| 20:58 | gfredericks | xeqi: anything with a finite representation which is everything we deal with |
| 20:58 | arkh | hiredman: ok, though it'd be nice to have it work across clojure + clojurescript |
| 20:58 | arkh | (sorry, scope creep) |
| 20:58 | hiredman | arkh: nothing works in clojurescript, so don't worry about it |
| 20:58 | gfredericks | surely core.logic works fine with (interval 0 100000000), so (interval 0 :infinity) should be performantly equivalent? |
| 20:58 | arkh | haha |
| 20:59 | xeqi | gfredericks: really? cause the reals are an uncountable set |
| 20:59 | gfredericks | xeqi: but most of them have no finite rep |
| 20:59 | amalloy | i think gfredericks is arguing we don't need to work with the reals, because our computers only pretend to anyway |
| 20:59 | gfredericks | yep |
| 21:00 | gfredericks | integers and rationals I'd be happy with |
| 21:00 | xeqi | ah, no PI then |
| 21:00 | hiredman | gfredericks: if you let X being a value in the domain of integers, and Y also being a value in the range of intergers, Z being a set that contains a Y, write me a generic search function that returns all the Xs that are members of Zs |
| 21:00 | xeqi | trig will be hard |
| 21:01 | aperiodic | xeqi: your computer doesn't really use Pi |
| 21:01 | gfredericks | hiredman: that sounds like all integers to me |
| 21:02 | hiredman | you can replace Y with any value of an infinite domain |
| 21:02 | gfredericks | \forall X \exists Z (Y \in Z && X \in Z) |
| 21:02 | hiredman | Y could be a member from an inifinite collection |
| 21:03 | gfredericks | you're saying (fresh [x y z] (is-int x) (is-int y) (everyo is-int z) (membero y z) (membero x z))? |
| 21:03 | gfredericks | that's what I understood |
| 21:05 | gfredericks | I'm sure that some things will involve infinite search, but that's already a problem in logic programming |
| 21:08 | hiredman | gfredericks: I would suggest trying to write an is-int relation that works forward and backward, and then trying to use it in some queries |
| 21:29 | gfredericks | hiredman: what sort of queries? the basics seem to be working |
| 21:36 | gfredericks | I don't know how to leave things unbound until later, since I'm not very familiar with the core.logic internals, but I imagine there's a similar mechanism in the new fd stuff |
| 21:37 | gfredericks | not even sure if leaving them unbound would be appropriate |
| 21:37 | xeqi | aperiodic: I was thinking something like a theorem prover, where reasoning about a non-rational might be useful |
| 21:37 | xeqi | wonder if core.logic would make it easier to build one of those |
| 21:38 | gfredericks | xeqi: algebraics are conceivable, as well as algebraic multiples of special transcendentals, but that's about all you can do with finite representations |
| 21:39 | gfredericks | anything else would have to be some higher level of abstraction, which theorem provers probably inhabit |
| 21:54 | gfredericks | https://gist.github.com/3243373 |
| 22:00 | Roxxi | Is there an analogous statement to scheme's (begin ...) in Clojure, that runs several statements and returns the last? |
| 22:00 | brehaut | do |
| 22:00 | Roxxi | One that isn't "let" that is :) |
| 22:00 | Roxxi | Thanks |
| 22:25 | devn | Is pair.io gone? |
| 22:55 | amalloy | &'#(#_%& %) |
| 22:55 | lazybot | ⇒ (fn* [p1__28600# & rest__28599#] (p1__28600#)) |
| 22:56 | gfredericks | o_O |
| 22:57 | gfredericks | I bet that would be fun to fix |
| 22:59 | gfredericks | &(#(#_%2 + %1 7) 8) |
| 22:59 | lazybot | clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox20922$eval28615$fn |
| 23:00 | gfredericks | amalloy: is there a ticket for it yet? |
| 23:00 | nDuff | Does kona try to retrieve all select results at once rather than returning them lazily (even chunked)? I'm trying to do a select from a very large table, and I'm running out of memory before even getting the first result back. |
| 23:01 | nDuff | s/kona/korma/ |
| 23:02 | amalloy | i wonder what crazy implementation #() has that makes that happen |
| 23:04 | TimMc | nDuff: So that's a yes? |
| 23:04 | TimMc | amalloy: WTF. |
| 23:04 | nDuff | TimMc: ...default behavior is non-lazy, there's a recently merged pull request that allows that to be changed on-demand. |
| 23:05 | TimMc | &(#(#_%)()) |
| 23:05 | lazybot | ⇒ () |
| 23:06 | gfredericks | &(#()()) |
| 23:06 | lazybot | clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox20922$eval28679$fn |
| 23:06 | nDuff | ...err, no, _not_ recently merged, still outstanding. *sigh*. |
| 23:07 | TimMc | amalloy: You've just given me a new weapon for my obfuscation arsenal. |
| 23:08 | amalloy | TimMc: i found it in a recent SO answer |
| 23:08 | TimMc | Is this captured in Jira? |
| 23:09 | amalloy | so far jira does not automatically convert SO questions to tickets, no |
| 23:09 | TimMc | o\__/o |
| 23:12 | amalloy | ah. the % reader macro has the side effect of registering an arg |
| 23:12 | amalloy | so when #_ reads the form prior to discarding it, the arg is still registered |
| 23:15 | gfredericks | #() could be a macro without breaking anything important I would think |
| 23:15 | gfredericks | i.e., just blindly expand #(...) to (reader-fn ...) |
| 23:16 | gfredericks | maybe that would make it harder to detect nesting |
| 23:16 | gfredericks | or that could still be detected at read-time probably |
| 23:17 | amalloy | gfredericks: that's true of most java-based reader stuff |
| 23:17 | muhoo | cljs does some strange stuff. like, it returns nil instead of a stacktrace if you give it a var that doesn't exist |
| 23:17 | amalloy | i imagine it's legacy and/or bootstrap related |
| 23:17 | muhoo | also, it will give nil if you give it a function without parens, instead of returning core$extend-type or stuff |
| 23:18 | gfredericks | amalloy: while we're at it, is there any reason it needs to convert to gensyms? |
| 23:18 | gfredericks | &'% |
| 23:18 | lazybot | ⇒ % |
| 23:18 | ThatOneGuy | &% |
| 23:18 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: % in this context |
| 23:19 | ThatOneGuy | &#'% |
| 23:19 | lazybot | java.lang.RuntimeException: Unable to resolve var: % in this context |
| 23:21 | amalloy | gfredericks: the only excuse i can think of is to prevent stuff like (defmacro alter-my-args [& body] `(let [~'% 10] ~@body)) |
| 23:22 | amalloy | but perhaps there are others |
| 23:24 | gfredericks | amalloy: man the hackers are always deffing those macros |
| 23:24 | gfredericks | but yeah that's a good point |
| 23:27 | amalloy | right, symbol capture is pretty hard to do accidentally, but it *can* happen |
| 23:35 | TimMc | &'#(+ #_ #_ (+ #_ %3) %& %) |
| 23:35 | lazybot | ⇒ (fn* [p1__28736# p2__28737# p3__28734# & rest__28735#] (+ p1__28736#)) |
| 23:39 | ToxicFrog | Docs say it can take "a string naming a URI", but whenever I try to use it as such, it hangs. |
| 23:39 | ToxicFrog | Oh wait no |
| 23:39 | ToxicFrog | It just takes about five minutes to process a small page. |
| 23:39 | ToxicFrog | Ouch. |
| 23:44 | akhudek | I take it that when you compile all ClojureScript functions into a single file, you don't need to use goog.require in the html file? |
| 23:46 | akhudek | It's bit confusing, since the docs for goog.require state that it loads the relevant namespace. However, it seems that all namespaces are loaded regardless of any goog.require in the main html. |
| 23:53 | nDuff | Hmm. |
| 23:53 | nDuff | clojure.jdbc's with-query-results* uses resultset-seq, and thus should in theory be lazy regardless. |
| 23:54 | nDuff | ...but that's very much not the behavior I'm getting out of korma |
| 23:55 | technomancy | is it chunked? |
| 23:55 | technomancy | could be using a cursor behind the scenes |
| 23:56 | nDuff | technomancy: I wouldn't mind a little chunking -- but I'm running out of RAM trying to get only the first element. |
| 23:57 | akhudek | are you sure you are on the latest versions of both? |
| 23:57 | akhudek | until recently, korma used a fairly old version of jdbc |
| 23:58 | technomancy | maybe try it in raw c.j.jdbc? |