2012-05-07
| 00:10 | technomancy | I have some cljs code where I try to call a constructor that takes an object, and I'm passing it a map. it gets compiled to a cljs.core.ObjMap.fromObject call, which bombs on "Error: No property strobj on this GObject StLabel" |
| 00:10 | technomancy | any idea what's going on there? |
| 00:18 | Raynes | Dear ladies and gentleman of the night's watch: if you've ever tried typing a let on refheap and have any idea what I'm saying when I talk about an indentation bug, you'll be pleased to hear that it is now fixed. Carry on. |
| 00:19 | devn | technomancy: sounds familiar -- maybe you're requires for goog.* something or other? |
| 00:20 | devn | technomancy: it reminds me of a problem requiring goog.string and/or goog.string.StringBuffer |
| 00:20 | technomancy | I'm not using any goog classes on purpose here |
| 00:21 | devn | technomancy: that's all i had handy, but it reminded me of when I took StringBuffer out of the mix because it seemed to be working fine without it, but chouser ran into trouble |
| 00:21 | devn | (in core.cljs) |
| 00:26 | mmarczyk | technomancy: wild guess -- if that constructors loops over the properties of the object it is passed and assumes they correspond to its own properties of some sort, it could end up trying to set its nonexistent strobj property when passed an ObjMap |
| 00:29 | mmarczyk | technomancy: I'm assuming by "passing it a map" you mean doing something like (Foo. {"asdf" 1}) in place of (Foo. (js-object "asdf" 1)) -- that simply won't work -- you'll need to write a map->obj function and perform a conversion *or* use js-object as above (the version which takes arguments is only available on master, though -- (doto (js-object) (aset ...)) in releases) *or* rely on ObjMap's strobj by extracting it from the map |
| 00:29 | mmarczyk | (hacky, kludgey, to be avoided etc.) |
| 00:29 | mmarczyk | technomancy: (btw, removing (.-strobj some-obj-map) kludges from TwitterBuzz made it quite a lot faster) |
| 00:30 | yoklov | mmarczyk: you mean js-obj, right? |
| 00:30 | technomancy | yeah, I was just trying an explicit strobj call |
| 00:30 | technomancy | it looks like that does the trick |
| 00:30 | mmarczyk | yoklov: technomancy: yeah, thanks |
| 00:30 | technomancy | I don't care about speed here |
| 00:31 | mmarczyk | technomancy: incidentally, are you doing gnome gui scripting in cljs? :-) |
| 00:31 | technomancy | mmarczyk: trying to =) |
| 00:31 | mmarczyk | technomancy: cooooool 8-) |
| 00:31 | technomancy | mmarczyk: yeah, it's the first use I've had for Clojurescript |
| 00:33 | mmarczyk | technomancy: any chance at all you might consider blogging about the experience? |
| 00:33 | mmarczyk | technomancy: I've been thinking about writing some X-related stuff in cljs, could use a nice intro :-) |
| 00:33 | technomancy | mmarczyk: I'll definitely post about it if I get it working |
| 00:34 | mmarczyk | technomancy: looking forward to it! |
| 00:34 | yoklov | it's easy to forget that javascript is a scripting language for so many things, can't wait to see where people using it for non-browser stuff goes |
| 00:34 | technomancy | gnome 3 has some problems, but it's the first "mainstream" desktop that "gets it" as far as user-level extensions |
| 00:34 | technomancy | (FSVO mainstream) |
| 00:35 | muhoo | um, is there a select form element in noir? |
| 00:36 | muhoo | oh, nm, i see, it's all in hiccup |
| 00:36 | muhoo | i think |
| 00:37 | mmarczyk | really? well that's encouraging, might actually try it then |
| 00:38 | technomancy | I'm hoping as a first step to port devilspie to clojurescript |
| 00:38 | mmarczyk | I shouldn't be bothered much with any UI issues, I'll be replacing the WM first thing... but I hardly expected any benefit |
| 00:38 | technomancy | if that goes well possibly porting xmonad-type behaviour |
| 00:38 | technomancy | shouldn't be too difficult; xmonad is only 1200 LOC =) |
| 00:39 | mmarczyk | :-) |
| 00:39 | muhoo | ah, it's called "drop-down", not select |
| 00:40 | mmarczyk | I was actually trying to decide whether I'd want to implement a WM in CLJS... on the one hand, that would be simply very cool and probably the most convenient WM configuration experience for me, on the other, I'd lose my no. 1 occasion to use Haskell :-P |
| 00:40 | yoklov | haha, i'm always upset when i have to touch my xmonad config |
| 00:40 | technomancy | the lack of runtime eval reeeeeeally sucks when writing something with dotfiles |
| 00:40 | yoklov | i always upset haskell's compiler |
| 00:41 | mmarczyk | well, I'm mostly bothered by Cabal |
| 00:42 | yoklov | oh, definitely |
| 00:42 | meiji11 | I'm trying to create & manipulate a PersistentQueue in the REPL, but it just spits back a PersistentQueue object, when it should return a popped item. what is going on.. |
| 00:43 | yoklov | but i feel like whenever i write a new function i manage to piss off the type system |
| 00:43 | mmarczyk | :-) |
| 00:43 | yoklov | meiji11: pop returns the new queue, peek returns the top item |
| 00:44 | yoklov | err, wait, maybe first? |
| 00:45 | yoklov | both work |
| 00:46 | Raynes | mmarczyk: Cabal is the best thing ever. |
| 00:47 | Raynes | Obviously. |
| 00:47 | technomancy | Raynes: I thought mix was |
| 00:47 | Raynes | Mix is just leiningen 3. |
| 00:47 | technomancy | haha |
| 00:52 | mmarczyk | Raynes: if you believe only members of the Cabal should be allowed to build largish projects in Haskell, whereas the uninitiated should be prevented from doing so in such a way that they think they are being helped |
| 00:55 | meiji11 | yoklov: right, just like with vectors.. duh. thanks. |
| 00:57 | yoklov | meiji11: yup, no problem! |
| 01:11 | technomancy | mmarczyk: what I've got so far, if you're curious: http://p.hagelb.org/syme.cljs.html |
| 01:11 | technomancy | the individual functions work if I call them on their own, but put together as an extension for some reason it doesn't click |
| 01:13 | mmarczyk | looks very cool nevertheless |
| 01:13 | mmarczyk | what compilation options are you using? |
| 01:13 | mmarczyk | also, release or master cljs? |
| 01:38 | ivan | Windows users without SLIME/Swank might be interested in the new and improved https://github.com/alandipert/clj-swingrepl |
| 01:38 | ivan | (thanks to conhost being unusable) |
| 03:08 | mrphoebs | Hi guys, I'm n00b. I'm trying to integrate clojure into a java project. I'm using the "gen-class" function to generate classes. In the :methods vector how do I write the signature of a method whose return type is a list of strings eg ":method [ methodname [] <????> ]" |
| 03:08 | mrphoebs | I'm a n00b* |
| 03:13 | hoeck1 | mrphoebs: you need to use weird jvm array type literal, see http://stackoverflow.com/questions/2398478/declare-array-as-return-type-in-gen-class-method-declaration-in-clojure |
| 03:14 | mrphoebs | Thanks @hoeck1 that helps |
| 03:15 | hoeck1 | mrphoebs: your're welcome :) |
| 03:29 | jondot | anyone here doing both clojure and erlang? |
| 03:38 | Raynes | jondot: I've done some Elixir, which is... at least an Erlang derivative. |
| 03:39 | jondot | Raynes, that's also interesting. i'm kinda wondering if to get into erlang. how mature is elixir? |
| 03:42 | Raynes | jondot: Admittedly not very. It's still in the "everything can change" state. |
| 03:42 | Raynes | It's a fun language though. I know that the language author at least as some code in production in his company. |
| 03:42 | Raynes | has* |
| 03:45 | jondot | i see |
| 03:56 | ivan | how do I use require inside a function/macro? I keep getting "RuntimeException: No such namespace: " |
| 03:56 | ivan | do I have to poke at namespaces manually? |
| 04:00 | ivan | I'm trying to write a function for my REPL :init that loads some libraries and does things |
| 04:01 | emezeske | ivan: (defn f [] (require 'clojure.string)) |
| 04:01 | emezeske | ivan: I'm pretty sure that works |
| 04:02 | ivan | I'm using :as, maybe that breaks things? |
| 04:02 | ivan | user=> (defn f [] (require 'cljs.repl) (repl/repl)) |
| 04:02 | ivan | CompilerException java.lang.RuntimeException: No such namespace: repl, compiling:(NO_SOURCE_PATH:12) |
| 04:03 | emezeske | No, :as is fine |
| 04:03 | ivan | oh, I see what I did wrong above, let me try again |
| 04:04 | ivan | user=> (defn f [] (require '[cljs.repl :as repl]) (repl/repl (rhino/repl-env) :warn-on-undeclared true)) |
| 04:04 | ivan | CompilerException java.lang.RuntimeException: No such namespace: repl, compiling:(NO_SOURCE_PATH:23) |
| 04:04 | emezeske | What is rhino/ ? Do you require that namespace? |
| 04:05 | ivan | yeah, I did; omitted in my paste |
| 04:05 | emezeske | Well, this works fine for me: (defn f [] (require '[clojure.string :as s]) (s/blank? "")) |
| 04:06 | emezeske | So I'd be suspicious of the rhino/ before I was suspiciuos of the repl/ |
| 04:06 | emezeske | Err, it says repl |
| 04:06 | emezeske | NM |
| 04:06 | ivan | user=> (defn x [] (require '[clojure.string :as s]) (s/blank? "")) |
| 04:06 | ivan | CompilerException java.lang.RuntimeException: No such namespace: s, compiling:(NO_SOURCE_PATH:4) |
| 04:07 | samrat1 | what's the best way to run a single .clj file? (not a project, but just a script) |
| 04:07 | emezeske | ivan: I'm running against clojure 1.4, not sure if that makes a difference? |
| 04:07 | ivan | same. maybe my REPL env is messed up |
| 04:07 | emezeske | ivan: I dunno, but that seems very weird. Wish I could help more, but I'm stumped! :) |
| 04:08 | ivan | totally vanilla Clojure 1.3.0 REPL started with java -jar: user=> (defn x [] (require '[clojure.string :as s]) (s/blank? "")) |
| 04:08 | ivan | CompilerException java.lang.RuntimeException: No such namespace: s, compiling:(NO_SOURCE_PATH:1) |
| 04:10 | emezeske | ivan: Yeah, I restarted my REPL and saw that |
| 04:11 | emezeske | ivan: I must have run f with just the require one time |
| 04:11 | ivan | yep |
| 04:11 | emezeske | don't listen to me! ^_^ |
| 04:12 | emezeske | ivan: So I think in your situation you might need to use (resolve) |
| 04:12 | emezeske | ivan: Or maybe just use all fully-qualified names |
| 04:12 | ivan | fully-qualified names don't work either inside the function |
| 04:12 | ivan | I'll check out resolve, thanks |
| 04:13 | emezeske | ivan: This works on a fresh REPL for me: (defn f [] (require '[clojure.string]) ((resolve 'clojure.string/blank?) "")) |
| 04:13 | ivan | cool, thanks |
| 04:13 | emezeske | good luck, sir, I'm outta here! :) |
| 04:17 | ivan | that works because clojure.string/blank? is available without requiring :) |
| 04:18 | ivan__ | ivan: damn i keep looking at the bottom window of limechat and seeing 'myself' talking.... |
| 04:18 | ivan | I found a defmacro locally-using on the mailing list |
| 04:19 | ivan | ivan__: I see myself joining channels I'm already in |
| 04:19 | ivan__ | heh |
| 04:22 | ivan | I wonder if I can do a different horrible thing: spawn a thread that requires the libraries that take 10 seconds to load |
| 04:25 | ivan__ | ivan: seems like a good idea, although i have no idea how loading works in clojure |
| 04:25 | ivan__ | i would assume it would work though |
| 04:27 | ivan | On OSes with fork, it would be cool to automatically create zygote REPLs with everything loaded, then fork them when the user wants a REPL |
| 04:27 | ivan | (I hope the JVM will not complain) |
| 04:33 | ivan | is there some way to feed forms into an already-running REPL, so that the (require) is at run outside of a function? |
| 04:34 | ivan | alright, I'm just going to make a different :init for CLJS :) |
| 04:40 | michaelr525 | hey |
| 04:52 | ivan | anyone else see EvaluatorException unterminated comment (goog/deps.js#1) with ClojureScript and Closure Library trunk? |
| 04:52 | ivan | seems that Rhino can't handle files that end with a /* block comment */ |
| 05:29 | ivan | filed a Closure Library bug, hopefully they'll remove the block comment making Rhino break |
| 05:31 | calvados | is there clojure lib works with couchbase ? |
| 05:33 | forsakendaemon | I've just used clj-http... |
| 05:46 | robertstuttaford | i'm struggling with Korma. "CannotAcquireResourceException A ResourcePool could not acquire a resource from its primary factory or source." the details i've given to defdb work 100% with MySQLWorkbench |
| 05:46 | robertstuttaford | what can i try? |
| 05:49 | hoeck1 | robertstuttaford: does a plain JDBC connection work? |
| 05:50 | kral | namaste |
| 05:50 | robertstuttaford | i've no idea. apologies, but i also have no idea how to try that. not a java person |
| 05:50 | robertstuttaford | found some code to try... |
| 05:51 | michaelr525 | maybe try connecting with squirelsql, it's a java (jdbc) client to test your connection details under jdbc |
| 06:01 | robertstuttaford | straight jdbc works; i can query data |
| 06:05 | robertstuttaford | but when i switch back to korma and attempt a (select) i get the CannotAcquireResourceException |
| 06:07 | hoeck1 | robertstuttaford: never used korma too, the CannotAcquireResourceException originates from the resource pool used by korma, c3p0 |
| 06:07 | robertstuttaford | i hate problems like this. takes the wind out of my sails :-| |
| 06:08 | hoeck1 | robertstuttaford: there should be some additional info or a wrapped exception,maybe paste the full stacktrace of your exception somewhere |
| 06:08 | hoeck1 | robertstuttaford: I know, I know :) |
| 06:10 | robertstuttaford | ok, i used ccw's print-full-exception |
| 06:10 | robertstuttaford | wrapped exception is "Connections could not be acquired from the underlying database!" |
| 06:10 | robertstuttaford | i'm using precisely the same hash passed to jdbc directly and it's giving me this |
| 06:14 | michaelr525 | maybe wrong driver? |
| 06:15 | robertstuttaford | i added (database nameofdatabase) to each (defentity) and now it works |
| 06:15 | robertstuttaford | docs say it automatically uses the last provided defdb, i guess not in my case! |
| 06:16 | michaelr525 | oh |
| 06:16 | robertstuttaford | i think i'm also struggling with understanding what changes when i send the whole .clj file to ccw's repl |
| 06:17 | robertstuttaford | well, i'm up and away now :) -phew- thanks hoeck1 and michaelr525 for your help |
| 06:21 | michaelr525 | something that annoys me is the one-compile-error-a-time thing |
| 06:22 | michaelr525 | i'd rather have a list of all errors |
| 06:47 | michaelr525 | err |
| 06:48 | michaelr525 | any way in webnoir to get the part after "/n/" in a url like this: "http://localhost/n/10/20/30"? What comes after "/n/" can vary in the number of URI element. |
| 06:49 | michaelr525 | for example it can also be |
| 06:49 | michaelr525 | "http://localhost/n/1/2/3/4/5/6/7/8/8" |
| 06:56 | clgv | michaelr525: since that cant be a fixed route you probably have to catch all routes matching a given prefix and parse the rest yourself |
| 06:56 | faust45 | hi guys |
| 06:56 | faust45 | have a question |
| 06:56 | clgv | michaelr525: or is there regexp support? |
| 06:57 | faust45 | how i can include to my project this lib http://commons.apache.org/fileupload/apidocs/index.html |
| 06:57 | clgv | faust45: you should just ask it ;) |
| 06:57 | faust45 | [org.apache.commons/fileupload "1.2.1"] |
| 06:57 | faust45 | not working |
| 06:58 | clgv | faust45: these are in the maven repo: http://search.maven.org/#search|ga|1|fileupload |
| 06:58 | faust45 | sorry i don't familiar with java libs |
| 06:58 | faust45 | so how i can use http://search.maven.org/#search%7Cga%7C1%7Cfileupload |
| 06:58 | clgv | faust45: hence [commons-fileupload "1.2.2"] should work |
| 06:59 | faust45 | clgv: yes looks good ) thanks |
| 07:00 | cemerick | am I right that js-obj was broken until a couple of days ago? |
| 07:00 | faust45 | clgv: but which name space i need to use in :import section ? |
| 07:00 | clgv | faust45: the javanamespace plus classname |
| 07:01 | faust45 | clgv: (org.apache.commons.fileupload ServletFileUpload) ? |
| 07:01 | clgv | faust45: yeah, looks good if the class exists ^^ |
| 07:02 | faust45 | clgv: thanks |
| 07:11 | michaelr525 | clgv: yeah regex did it :) |
| 07:12 | michaelr525 | thanks |
| 07:12 | clgv | michaelr525: how does it look like now? |
| 07:12 | michaelr525 | (defpage node [:get ["/n/:path" :path #".*"]] {:keys [path]} |
| 07:12 | michaelr525 | hairy :) |
| 07:13 | clgv | ah ok. so it's supported within the routes :) |
| 07:13 | michaelr525 | yup |
| 07:14 | michaelr525 | i could also get it like this: (defpage node "/n/*" [& path] |
| 07:15 | michaelr525 | but then path was a list with a vector inside it |
| 07:16 | clgv | michaelr525: humm (defpage node "/n/*" [& path] ..) should get only the vector in 'path |
| 07:16 | clgv | args that I meant: (defpage node "/n/*" [path] ..) |
| 07:19 | robertstuttaford | with korma, is it possible to define a has-one with a conditional to use when querying it? eg, say i have document has-many versions. i want to document has-one current-version and define the query for how to get just one version |
| 07:19 | robertstuttaford | kinda like active-record does it |
| 07:42 | faust45 | how i can import javax.servlet.http.HttpServletRequest in my app? |
| 07:44 | clgv | faust45: the class? |
| 07:44 | faust45 | clgv: yes |
| 07:44 | clgv | clgv: like the other java class before - it's always the same scheme |
| 07:44 | clgv | faust45: (:import javax.servlet.http.HttpServletRequest) |
| 07:45 | faust45 | clgv: but (javax.servlet.http HttpServletRequest) not working |
| 07:45 | faust45 | ClassNotFoundException |
| 07:45 | clgv | faust45: so either the namespace is false or you need a library for that class |
| 07:45 | faust45 | clgv: did you know with lib? |
| 07:46 | clgv | no idea |
| 07:47 | michaelr525 | faust45: what are you trying to do? |
| 07:48 | faust45 | michaelr525: simple web server with handle file uploading |
| 07:49 | michaelr525 | why aren't you using something like webnoir/ring/compojure? |
| 07:49 | michaelr525 | the class you are looking for seems to come with a servlet container: http://www.jarfinder.com/index.php/java/info/javax.servlet.http.HttpServletRequest |
| 07:50 | faust45 | michaelr525: just what make this by hands |
| 07:51 | michaelr525 | if you are using leiningen you can try to add jetty to your project.clj |
| 07:51 | michaelr525 | otherwise just throw it's jar in your classpath |
| 07:51 | faust45 | michaelr525: but how i can include my project http://www.jarfinder.com/index.php/java/info/javax.servlet.http.HttpServletRequest ? |
| 07:53 | michaelr525 | are you using leiningen? |
| 07:55 | michaelr525 | faust45: check this https://github.com/mmcgrana/ring/blob/master/ring-jetty-adapter/project.clj |
| 07:56 | michaelr525 | or this: https://github.com/mmcgrana/ring/blob/master/ring-servlet/project.clj |
| 08:02 | faust45 | michaelr525: thanks! |
| 08:03 | robertstuttaford | any folks using korma here? |
| 08:05 | Borkdude | cemerick: I have a student with the same macbook air, he downloaded eclipse, installed leiningen+ccw, worked fine. I copied his entire eclipse folder to my machine |
| 08:06 | robertstuttaford | for some reason a (with thing) for a has-many association is coming up with [] instead of actual rows |
| 08:06 | Borkdude | cemerick: keep getting those wonky errors… https://gist.github.com/2627392 <- could it be a system global thing that is in the way and if so, where should I look? any clues? |
| 08:06 | robertstuttaford | using dry-run shows me sql that, when used in mysql console, works |
| 08:07 | cemerick | Borkdude: Try using the known-good eclipse from a dummy user account. |
| 08:08 | cemerick | The errors you've gotten have changed, with presumably no clear reason. I've never seen any of them, and don't have any good theories at the moment. |
| 08:08 | Borkdude | cemerick: will try that |
| 08:17 | Borkdude | cemerick: it works under a dummy account!! |
| 08:17 | Borkdude | cemerick: now I still have to find out what could be troubling lein/ccw |
| 08:17 | cemerick | Borkdude: well, you're getting closer :-) |
| 08:18 | cemerick | Try a new eclipse workspace (not in the dummy account) |
| 08:23 | Borkdude | have tried that, but will try again later, gtg now again (work) |
| 08:23 | Borkdude | cemerick: tnx so far |
| 08:31 | Borkdude | got a few minutes left |
| 08:31 | Borkdude | cemerick: no luck in new workspace with the known-good one, it must be something in my settings, global jars, or smth? |
| 08:32 | Borkdude | cemerick: could it be smith in my .m2 dir? |
| 08:32 | Borkdude | cemerick: known-good one + new workspace under my normal user account that is |
| 08:34 | cemerick | I can't imagine .m2 being involved. |
| 08:35 | cemerick | Borkdude: In *your* copy of eclipse, uninstall all of ccw and the lein plugin. The re-install. |
| 08:35 | cemerick | I'd almost hope that that wouldn't work. :-P |
| 08:35 | Borkdude | cemerick: tried it several times…. |
| 08:35 | Borkdude | it must be something in my home environment, but what... |
| 08:37 | Borkdude | gtg now again |
| 08:46 | mmarczyk | has anybody encountered a "No such var: useful.utils/Adjoin" exception (apparently originating in protobuf.core, which does indeed refer to that protocol in this way) when using clojure-protobuf? it's driving me crazy atm :-( |
| 08:50 | clgv | mmarczyk: is using a previous release an option? maybe it's an inconsistent snapshot? |
| 08:55 | mmarczyk | clgv: hm, it might be an option |
| 08:57 | mmarczyk | clgv: it's 0.6.0-beta16 though... also, the only version of useful on the classpath is the one depended on by protobuf. so, no idea what's going on :-/ |
| 09:02 | kzar | I've been messing around with clojurescript one via inferior-lisp in Emacs and I've found that sometimes the repl gets in weird state whereby every time I try to eval something it just hangs until I abort. (It seems to happen when I've messed up somehow, problem is I can never seem to recover without killing the process and firing it up again.) |
| 09:03 | kzar | Also I've found the result of what I eval at the repl isn't always returned |
| 09:07 | mattfredwill | Anyone have any experience using clojure for (Simple) 3d game dev? |
| 09:07 | kzar | (If I eval 1 it's not returned to the repl, if I eval (+ 1 1) 2 _is_ returned.) |
| 09:09 | mattfredwill | clojure-games.org seems a little light on content so I'm wondering if its just a dead site or if clojure game dev is a bad idea |
| 09:15 | jwr7 | The lack of a complete, stable and current Redis client library for Clojure is becoming a problem... |
| 09:16 | jwr7 | There is redis-clojure (recently brought back from the dead), clj-redis and accession, none of which are complete. I don't even know where to contribute :-) |
| 09:35 | robertstuttaford | cemerick: friend looks awesome! how plug-n-play is it for doing something like supporting a local-database signin along with facebook and twitter? |
| 09:35 | babilen | How can I test if a map is present in a collection? (Something like "(contains? [{:foo "bar"}] {:foo "bar"}) → true) |
| 09:36 | cemerick | robertstuttaford: once there's a library offering an oauth workflow for friend, then…very plug and play :-P |
| 09:36 | cemerick | I'm idly evaluating the options in the oauth area this week. |
| 09:36 | rhc | babilen: maybe (== (select-keys my-map (keys smaller-map)) smaller-map) |
| 09:36 | robertstuttaford | ok, great. i want to use friend to secure my rest json api |
| 09:36 | fliebel | babilen: Like any value, using.. some unexpected name, like ony? or something, can;t remember |
| 09:36 | robertstuttaford | but the userbase already has direct and facebook accounts in it |
| 09:38 | fliebel | babilen: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/some |
| 09:38 | cemerick | robertstuttaford: yup, definitely working on it. |
| 09:38 | robertstuttaford | awesomesauce! |
| 09:38 | cemerick | Currently considering using scribe for the guts of the oauth impl. |
| 09:38 | fliebel | &(some #{{:a 1}} [1 2 {:a 1} {:a 2}]) |
| 09:38 | lazybot | ⇒ {:a 1} |
| 09:38 | babilen | fliebel: Yeah, I found some, but I find it ... well ... ugly. Just wanted to see if there is a better solution. (fsvo better) |
| 09:39 | robertstuttaford | i've been reading the book non-stop. i can vaguely remember roughing out a design for some upcoming work in clojure in a dream last night. i might be a little too interested in clojure :) |
| 09:39 | babilen | fliebel: Thanks a lot! :) (/me thinks that contains? should work for that (just like it should work for lists, but meh)) |
| 09:40 | fliebel | yea, it should.. |
| 09:40 | fliebel | &(contains? [{:a 1} {:a 2}] {:a 1}) |
| 09:40 | lazybot | ⇒ false |
| 09:41 | babilen | &(contains? '(1 2 3) 1) |
| 09:41 | lazybot | ⇒ false |
| 09:41 | babilen | *shrug* |
| 09:42 | fliebel | huh |
| 09:42 | cemerick | robertstuttaford: I'm glad you're liking it. :-) Nothing wrong with enthusiasm, of course |
| 09:43 | jwr7 | cemerick: your book is good. It's among the top-2 clojure books (alongside "The Joy of Clojure"). I should know, I own all Clojure books published so far :-) |
| 09:44 | fliebel | why on earth would that be... |
| 09:45 | cemerick | jwr7: Thanks :-D |
| 09:45 | foxdonut | jwr7: do you have programming clojure 2nd edition? if so, what do you think of it? |
| 09:36 | kzar | ,(.contains '(1 2 3 "babilen") 1) |
| 09:36 | clojurebot | true |
| 09:37 | dnolen | xb |
| 09:37 | dnolen | oops |
| 09:37 | jwr7 | foxdonut: I read the first edition, never looked closely at the second one. The first one was too basic for me, I couldn't find much in it. Also, I didn't like the choice of examples (a build system ...). |
| 09:37 | fliebel | kzar: ? |
| 09:38 | fliebel | Ok, so contains? only tests for indexed things, like vectors, maps, etc. |
| 09:38 | fliebel | ruturns false otherwise |
| 09:38 | fliebel | &(contains? [:a :b :c] 2) |
| 09:38 | lazybot | ⇒ true |
| 09:38 | babilen | contains? is, well, horribly named |
| 09:38 | fliebel | yea |
| 09:38 | kzar | fliebel: contains? is for the key not value, so (contains? ["a" "b"] 0) would return true but (contains? ["a" "b"] 10) would return false |
| 09:38 | kzar | ,(contains? {:a 1} :a) |
| 09:38 | clojurebot | true |
| 09:39 | dnolen | jwr7: yeah the 1st edition of PC dates itself :) |
| 09:39 | fliebel | kzar: Yea, I figured that our, but what does the java method you use? |
| 09:40 | kzar | fliebel: I can't tell you so much about it, I just remembered it's often what you want instead |
| 09:40 | fliebel | I avoided contains? for so lang, I forgot why I avoided it. |
| 09:40 | babilen | I will probably never use it again :) |
| 09:42 | kzar | babilen: Yea I feel something like contains-key? and contains-value? would be better names |
| 09:42 | babilen | +1 |
| 09:42 | fliebel | wow, you can use it to test the length of a string? ##(contains? "abc" 5) |
| 09:42 | lazybot | ⇒ false |
| 09:42 | fliebel | kzar: That's what the underlying java methods are called. |
| 09:42 | fliebel | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L698 |
| 09:43 | kzar | fliebel: "... fools seldom differ." eh? |
| 09:43 | fliebel | kzar: Not familiar with that saying? |
| 09:43 | robertstuttaford | it's better than patrick :-) |
| 09:55 | echo-area | Had anyone ever seen "java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn" for expression (count {"k3" 467})? |
| 09:55 | echo-area | What could be the reason? |
| 09:56 | echo-area | It's Clojure 1.2 |
| 09:56 | echo-area | Is that a known bug? |
| 09:58 | fliebel | echo-area: Are you sure it's that? |
| 09:58 | fliebel | I mean, if you enter that at the repl, it gives the same error? |
| 09:58 | echo-area | Yes, I'm 100% sure. I can't believe it. |
| 09:58 | jcromartie | ,(count {"k3" 467}) |
| 09:58 | clojurebot | 1 |
| 09:59 | mmarczyk | dnolen: hi! CLJS-241 looks extremely promising :-) |
| 09:59 | fliebel | ,*clojure-version* |
| 09:59 | clojurebot | {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"} |
| 09:59 | echo-area | I'm using storm. |
| 09:59 | vijaykiran | echo-area: I can't reproduce it .. |
| 09:59 | echo-area | Well, I can't reproduce it in the repl too. |
| 09:59 | jcromartie | echo-area: I think you're mistaken |
| 09:59 | echo-area | But I compiled a uberjar and it can't pass that. |
| 09:59 | echo-area | jcromartie: I wish I could have made any mistake. |
| 10:00 | fliebel | echo-area: What happens when your replace the count with prn ? |
| 10:00 | jcromartie | it's gotta be a loading issue or something else |
| 10:00 | echo-area | jcromartie: I've spent ~2 hours on this and finally tracked down to here. |
| 10:00 | jcromartie | echo-area: what is the full stack trace? |
| 10:01 | jcromartie | and if it *is* that code that's failing, then count is somehow scoped to an integer… (def count 1) (let [count …] …) etc. , but I wouldn't head down that path quite yet |
| 10:03 | echo-area | http://pastebin.com/9s0fPEJF |
| 10:05 | echo-area | You can see that the first failure comes from (println (count (keys {"k3" 467}))) |
| 10:06 | echo-area | It's a literal map, but runs very strangely |
| 10:08 | echo-area | Hmm, putting that expr outside the definition of `add-keywords' won't result in an error |
| 10:10 | dmi3y | Hi, everyone. I just wrote a small Clojure app which uses clj-http and htmlunit. I was surprised that the standalone jar of it ended up weighting ~13M. Is there a way I can trim it down? |
| 10:10 | echo-area | Why, it looks that the problem is along with the destruction. |
| 10:10 | echo-area | If I don't use destruction but use (first ...) and (second ...), there won't be any error. |
| 10:11 | gf3 | _ato: Ping? |
| 10:12 | kzar | With js/setTimeout in Clojurescript is it safe to recurse? |
| 10:13 | xeqi | echo-area: you're shadowing count in the destructoring |
| 10:13 | echo-area | Oh, why didn't I notice that. What a PIIIITTTTYYY... :'( |
| 10:14 | dakrone | dmi3y: if you aren't using any of the json stuff, you can exclude cheshire from clj-http and trim it down a little |
| 10:14 | echo-area | Forgot that Clojure is a Lisp-1.... |
| 10:15 | dmi3y | dakrone: thanks |
| 10:15 | echo-area | xeqi: Thanks for pointing me that! |
| 10:19 | robertstuttaford | korma. have resource has-many resource-version. when selecting resource with resource-version, resource-version comes back as an empty vector. executing the dry-run sql manually correctly returns results for resource-version. what could i be doing wrong? |
| 10:22 | bubimir | How can I combine macros with type hints? For instance, why doesn't something like (defmacro get-first-byte [^bytes bs] `(aget ~bs 0)) help me avoid reflection? |
| 10:23 | nDuff | bubimir: you can put (with-meta) in your macro output |
| 10:24 | nDuff | bubimir: ...re: why what you first tried doesn't work, the reader applies metadata directly to the macro definition, which doesn't get propagated when the macro is expanded |
| 10:24 | nDuff | (if my own understanding is correct) |
| 10:24 | bubimir | Type hints are just metadata? (I'm new. :) |
| 10:24 | nDuff | bubimir: correct. |
| 10:25 | bubimir | Thanks! I'll look into that. |
| 10:25 | nDuff | bubimir: see also http://stackoverflow.com/questions/7754429/clojure-defmacro-loses-metadata |
| 10:26 | bubimir | Ahh, great! That helps lots. |
| 10:31 | robertstuttaford | does korma do any pluralisation of association names? |
| 10:32 | robertstuttaford | weird. if i stop telling the base model which fields to return, then the (with resource-version) starts working |
| 10:33 | robertstuttaford | ibdknox: ping |
| 10:39 | bubimir | Is "bytes" not a class name? I can use it as a hint (^bytes), but don't know how to use it with something like vary-meta. Clojure says "unable to resolve classname". When I ack for a (class <a byte array>), I get a strange "[B". |
| 10:39 | robertstuttaford | my korma issue: https://gist.github.com/2628135 |
| 10:40 | clgv | bubimir: tag that "[B". thats java's strange naming^^ |
| 10:41 | TimMc | &(.getCanonicalName (class (byte-array []))) |
| 10:41 | lazybot | ⇒ "byte[]" |
| 10:41 | TimMc | &(.getName (class (byte-array []))) |
| 10:41 | lazybot | ⇒ "[B" |
| 10:42 | bubimir | clgv and TimMc: Thanks! Using just "[B" seems to do the trick. |
| 10:42 | foxdonut | robertstuttaford: what if you have (fields :id :title :resource_version.version) ? |
| 10:43 | robertstuttaford | foxdonut: it complains that resource_version isn't in the table list for the query |
| 10:43 | robertstuttaford | rightly so resource has-MANY resource-version |
| 10:43 | pyninja | when I do (in-ns 'my.name.space), and then (use 'another.name.space), it says "java.lang.Exception: Unable to resolve symbol: use in this context". what am I doing wrong? |
| 10:44 | clgv | pyninja: thats because you went in a non-existing namespace which then was created on the fly but no (refer-clojure) was executed in it |
| 10:45 | robertstuttaford | just updated the gist to show the dry-runs for each case |
| 10:45 | nDuff | pyninja: ...any particular reason for using (in-ns) rather than (ns) there? |
| 10:46 | echo-area | Bye folks! |
| 10:46 | djpowell | hmm - i can't do jira... |
| 10:46 | djpowell | how do you mark something 'ready to test' |
| 10:46 | robertstuttaford | foxdonut: i'm not going nuts, it should work the way i think it should, right? |
| 10:46 | foxdonut | robertstuttaford: what if you have (with resource_version ...) *before* (fields :id :title :resource_version.version) ? |
| 10:47 | pyninja | clgv: hm, but it should exist. it works fine if I do (use 'my.name.space) with the same namespace |
| 10:47 | clgv | pyninja: it exists after you did 'use since 'use is loading it ;) |
| 10:47 | pyninja | nDuff: i want to get inside an existing namespace, not declare a new one |
| 10:47 | robertstuttaford | foxdonut: that works. why? |
| 10:47 | kzar | dnolen: Is it safe to recurse with js/setTimeout? I wrote some code in a similar way to the example that you showed me but it slows down after a while |
| 10:47 | pyninja | clgv: no, if I start a new repl it still works |
| 10:48 | nDuff | pyninja: if you use (ns) with an existing namespace, it does just that. |
| 10:48 | clgv | pyninja: 'use loads namespaces 'in-ns does not |
| 10:48 | robertstuttaford | foxdonut: just figured it out, i think. :id wasn't in my field list before |
| 10:48 | pyninja | clgv: i declared the namespace in a file |
| 10:48 | pyninja | wait, what does in-ns do then? |
| 10:48 | foxdonut | robertstuttaford: I just started looking at korma last night, so I'm no expert. But, looking at the docs, I'm guessing that the (with ...) coming first tells korma to join, and *then* (fields :resource_version.version) works. |
| 10:49 | clgv | switch to that ns and create it if it does not exist, i.e. was not loaded |
| 10:49 | robertstuttaford | i think korma relies on me to ensure that the join columns are present in the fields lists |
| 10:51 | foxdonut | robertstuttaford: I'm guessing that the order matters. |
| 10:51 | pyninja | clgv, nDuff: ns doesn't seem to work for me in that way either: https://gist.github.com/44014b4285e8f5400970 |
| 10:52 | clgv | pyninja: do a (require 'my.ns) and then (in-ns 'my-ns) |
| 10:53 | clgv | pyninja: a IDE can support you there ;) |
| 10:53 | pyninja | clgv: ah, now I see! thanks |
| 10:54 | clgv | pyninja: fyi use = require + refer |
| 11:05 | robertstuttaford | newbie question: https://gist.github.com/2628257 |
| 11:08 | clgv | robertstuttaford: ##(update-in [:resource_version 0] :version {:resource_version [{:version 351}], :id 1, :title "Partition"}) |
| 11:08 | lazybot | java.lang.UnsupportedOperationException: nth not supported on this type: Keyword |
| 11:08 | clgv | oops |
| 11:08 | clgv | robertstuttaford: ##(update-in {:resource_version [{:version 351}], :id 1, :title "Partition"} [:resource_version 0] :version) |
| 11:08 | lazybot | ⇒ {:title "Partition", :id 1, :resource_version [351]} |
| 11:08 | robertstuttaford | update-in, thank you! |
| 11:08 | clgv | ah not entirely. |
| 11:09 | clgv | ##(update-in {:resource_version [{:version 351}], :id 1, :title "Partition"} [:resource_version] (comp :version first)) |
| 11:09 | lazybot | ⇒ {:title "Partition", :id 1, :resource_version 351} |
| 11:10 | robertstuttaford | thank you clgv |
| 11:13 | robertstuttaford | can i use update_in to remove an element entirely? |
| 11:13 | robertstuttaford | so in this case, i want to remove :id |
| 11:13 | S11001001 | robertstuttaford: no, use dissoc |
| 11:14 | clgv | robertstuttaford: use dissoc or select-keys |
| 11:14 | robertstuttaford | gotcha |
| 11:15 | nDuff | Hmm.\ |
| 11:15 | robertstuttaford | this is more of a style question. i have (map #(update-in …) (korma query)). i could just wrap this all with another (map #(dissoc :id …) |
| 11:15 | TimMc | robertstuttaford: You can combine update-in with dissoc. |
| 11:15 | robertstuttaford | i guess i could put both #() into a comp as the function that maps? |
| 11:17 | robertstuttaford | this works: (map (comp #(update-in % [:resource_version] (comp :version first)) #(dissoc % :id)) (…korma…)) |
| 11:18 | S11001001 | nDuff: ns is set during module loading, not execution |
| 11:19 | faust45 | can anyone suggest mime http parse lib? |
| 11:25 | nDuff | Hmm. I have a module in which I'm setting a value to an atom; however, when a new module requires the old one, that atom appears to get re-def'd over |
| 11:26 | nDuff | (the resulting object has not just a different value [reinitialized to nil], but also a different memory location) |
| 11:29 | mmarczyk | nDuff: check if there's a :reload / :reload-all option on any of your requires and consider using defonce for the atom |
| 11:40 | nDuff | mmarczyk: no :reloads present, but using defonce does the Right Thing; thanks! |
| 11:56 | dnolen | lynaghk: ooh, is profile-cljs runnable? |
| 11:57 | kzar | cool my clojurescript drum machine is coming along |
| 11:59 | Borkdude | finally, solved…. |
| 12:06 | ambrosebs | I'm trying to build my own version of clojure, but I can't seem to change the artifact name |
| 12:06 | ambrosebs | is there some convention I need to follow? |
| 12:09 | johnkpaul | is there an equivalent to javascript's arguments.callee in clojure? |
| 12:09 | johnkpaul | or something like recur but without being in the tail position |
| 12:09 | johnkpaul | I have an let bound function that I am trying to make call itself |
| 12:09 | brainproxy | dnolen: is the idea with string-print in clojurescript that it prints a string with a newline automatically appended, or should it print the string as-is (i.e. no newline on the end)? |
| 12:10 | brainproxy | dnolen: the reasons I ask is that in nodejs.cljs that ships with clojurescript, string-print is pointing to node's sys.puts |
| 12:10 | brainproxy | but sys.puts is long since deprecated |
| 12:11 | brainproxy | and i'm wondering whether to point string-print instead to console.log (which appends a newline) or process.stdout.write (which doesn't append a newline) |
| 12:11 | foxdonut | johnkpaul: do you mean something like (fn foo [] (foo)) ? |
| 12:11 | dnolen | brainproxy: don't know that bit very well - but feel free to submit a ticket that suggests a fix. |
| 12:11 | dnolen | brainproxy: as just let us know which lib to call. |
| 12:11 | johnkpaul | foxdonut: yes |
| 12:12 | johnkpaul | I keep getting unable to resolve symbol: foo in this context |
| 12:12 | dnolen | johnkpaul: in Clojure or ClojureScript? |
| 12:12 | johnkpaul | clojure |
| 12:12 | foxdonut | johnkpaul: paste code in gist? |
| 12:12 | johnkpaul | :) decided that I need to learn clojure first |
| 12:13 | dnolen | johnkpaul: nice! :) |
| 12:13 | johnkpaul | sure foxdonut, one second |
| 12:13 | johnkpaul | foxdonut: https://gist.github.com/9a675e94ef72b901210b |
| 12:13 | johnkpaul | working through 4clojure.com |
| 12:13 | foxdonut | johnkpaul: try (fn fib [x] ...) instead |
| 12:13 | ambrosebs | nvm, I fixed my problem building clojure |
| 12:14 | johnkpaul | ah, great, thanks foxdonut! |
| 12:14 | johnkpaul | found a different problem, but one that makes sense |
| 12:14 | johnkpaul | damn needing all of those base cases |
| 12:14 | foxdonut | johnkpaul: you're welcome |
| 12:27 | lynaghk | dnolen: yep. |
| 12:27 | lynaghk | it's pretty janky right now, and there aren't any visualizations |
| 12:27 | dnolen | lynaghk: hmm having trouble getting it to work, when I try to open public/index.html I get a bunch of error about missing JS files. |
| 12:27 | lynaghk | also if you want to reset the timings, you'll have to open up the js console and remove the localstoage key yourself |
| 12:27 | lynaghk | did you run ./make.sh |
| 12:28 | dnolen | lynaghk: oops no |
| 12:28 | lynaghk | also your webserver needs to follow symlinks (I use the "serve" rubygem) |
| 12:28 | lynaghk | dnolen: readme, bro! =P |
| 12:29 | dnolen | lynaghk: yeah the ./make.sh wasn't highlighted as code so I missed it while scanning :) |
| 12:30 | dnolen | lynaghk: k, I get a list of nils :) |
| 12:31 | lynaghk | dnolen: in the viewer? Hmm. |
| 12:32 | dnolen | lynaghk: oh I'm getting a microbenchmarks/seqs.js missing error in run.html |
| 12:34 | lynaghk | dnolen: that's through a symlink: how are you running the page? |
| 12:34 | dnolen | lynaghk: should that have been generated for me? |
| 12:34 | dnolen | lynaghk: just open public/index.html |
| 12:34 | dnolen | lynaghk: I guess I should open it via local web server? |
| 12:35 | lynaghk | I just tried it via file:// and it worked fine |
| 12:35 | lynaghk | let me clone and start from scratch. |
| 12:37 | dnolen | lynaghk: hmm I don't have a microbenchmarks folder, what creates that/ |
| 12:37 | dnolen | ? |
| 12:39 | brainproxy | dnolen: figured it out w/ ref to the cljs repl.. string-print is for printing strings w/o newline appended, println appends \n |
| 12:39 | lynaghk | ahh, forgot to check that in. |
| 12:40 | brainproxy | I'll submit an issue once I see how it works out w/ how I've set it up in ncljs's nodejs.js |
| 12:40 | brainproxy | *nodejs.cljs |
| 12:40 | lynaghk | dnolen: fix pushed, sorry about that. I have a bad habit of adding "pubilc/" to .gitignore and then adding a bunch of symlinks into public. |
| 12:40 | dnolen | brainproxy: cool, thx |
| 12:42 | dnolen | lynaghk: cool! got it working, how do I reset the data? localStorage.clear()? |
| 12:43 | lynaghk | dnolen: awesome! you can reset with: localStorage.removeItem("timings") |
| 12:43 | lynaghk | dnolen: I'll add a button to the viewer later and then some datavis stuff. Going hiking today, so it'll be closer to Wednesday |
| 12:43 | dnolen | lynaghk: so I see a list of nils + count up + map inc |
| 12:44 | lynaghk | the nils should be timings. hmm. |
| 12:44 | lynaghk | what's in localStorage["timings"]? |
| 12:45 | dnolen | lynaghk: to a bit more clear, I see a list of nils at the very top of page |
| 12:45 | dnolen | then map inc (6 5 5) |
| 12:46 | lynaghk | oh, so timings are working fine. Are you seeing the source code? |
| 12:46 | dnolen | er count up (6 5 5) |
| 12:46 | dnolen | lynaghk: yes |
| 12:47 | dnolen | lynaghk: in anycase, neat thanks for starting this. Will be very useful. |
| 12:48 | lynaghk | dnolen: oh, I see those nils too. Looks like something is throwing in empty objects |
| 12:49 | lynaghk | I'll figure it out and fixup. This isn't ready yet anyway; github giving away my secrets. =P |
| 12:50 | lynaghk | dnolen: yeah, ideally there'd be more infrastructure and persistence so we can actually compare different cljs compiler or cljs library revisions. |
| 12:51 | dnolen | lynaghk: haha |
| 12:51 | dnolen | lynaghk: yes I'm keen for a community contributed set of benchmarks is all |
| 12:52 | dnolen | lynaghk: a lot of what we do right now is ad hoc stuff at the command line |
| 12:52 | lynaghk | dnolen: well feel free to throw some more in and send me a pull request. The format is pretty general |
| 12:52 | clojurebot | Alles klar |
| 12:53 | lynaghk | dnolen: I was planning on having an optional :tags kwarg to the profile cmd so that once we have a ton of different microbenchmarks it'd be easy to search |
| 12:54 | lynaghk | gotta go hiking, catch you later dnolen. |
| 12:54 | dnolen | lynaghk: later |
| 12:55 | Raynes | "MUST. GO. HIKING." |
| 13:12 | jasonkolb | hey everyone... pretty new to Clojure and I'm struggling with the syntax for something I'm trying to port from Java, hoping someone can give me a pointer |
| 13:13 | jasonkolb | (let [result (@id->result id)] |
| 13:13 | jasonkolb | (cleanup id) |
| 13:13 | jasonkolb | (log-debug "Returning DRPC result for " function " " args " at " (System/currentTimeMillis)) |
| 13:13 | jasonkolb | (if (instance? DRPCExecutionException result) |
| 13:13 | jasonkolb | (throw result) |
| 13:13 | jasonkolb | (let [strResult |
| 13:13 | jasonkolb | (.toString |
| 13:13 | jasonkolb | (.decode( result ) |
| 13:13 | jasonkolb | (.newDecoder (defaultCharset Charset) |
| 13:13 | jasonkolb | ) |
| 13:13 | jasonkolb | ) |
| 13:13 | jasonkolb | ] |
| 13:13 | jasonkolb | strResult |
| 13:13 | jasonkolb | ) |
| 13:13 | clgv | jasonkolb: first, use a paste next time. ~paste |
| 13:14 | clgv | ~paste |
| 13:14 | clojurebot | paste is http://refheap.com |
| 13:14 | jasonkolb | oops, sorry about that |
| 13:14 | clgv | secondly, you should state your problem ;) |
| 13:15 | mrakana | I don't understand definline. How exactly does it differ from a regular macro? When should I use it? If I want to create an alias for a function, is using definline better than just doing (def alias some-func)? |
| 13:16 | mrakana | Using alias instead of some-func after (def alias some-func) seems to slow down things considerably. |
| 13:16 | clgv | mrakana: it's expanded if you call it directly but passed as a function if used as a parameter |
| 13:16 | foxdonut | jasonkolb: can you paste the Java code you are trying to port? |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-1 |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-2 |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-3 |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-4 |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-5 |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-6 |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-7 |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-8 |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-9 |
| 13:17 | jasonkolb | https://www.refheap.com/paste/2630#L-10 |
| 13:17 | jasonkolb | (let [strResult |
| 13:17 | jasonkolb | (.toString |
| 13:17 | jasonkolb | (.decode( result ) |
| 13:17 | jasonkolb | (.newDecoder (defaultCharset Charset) |
| 13:17 | jasonkolb | ) |
| 13:17 | jasonkolb | ) |
| 13:17 | foxdonut | are you serious? |
| 13:17 | S11001001 | er... |
| 13:17 | jasonkolb | was trying to do the right thing there with the paste from refheap |
| 13:17 | antares_ | jasonkolb: just paste a URL, not the content |
| 13:17 | foxdonut | one link is enough :) |
| 13:18 | S11001001 | str not tostring |
| 13:18 | jasonkolb | gotcha... my bad |
| 13:18 | foxdonut | jasonkolb: please paste your original Java code in refheap and put one link here |
| 13:19 | jasonkolb | ok, java code is at https://www.refheap.com/paste/2631 |
| 13:20 | mrakana | clgv: I see. So it's something between a function and a macro. It also allows regular ^type hinting unlike a macro. |
| 13:20 | muhoo | question about dynamic bindings: i do a (binding [*foo* :bar] (somefunc)). that somefunc calls down a stack that eventually has stuff that does (:use [bar.baz :only [*foo*]]) in it. which *foo* gets used down in there? the one i bound or the original one? |
| 13:21 | muhoo | i should say: the one bound with binding or the one use'd in the ns decl? |
| 13:22 | S11001001 | muhoo: bindings don't exist in the ns mappings, so the latter |
| 13:22 | S11001001 | that is, you use a var, not a particular binding of it |
| 13:22 | muhoo | damn. |
| 13:23 | cmcbride | jasonkolb: to call a static method in clojure you do (defaultCharset/Charset) |
| 13:23 | muhoo | ok, thanks. i'll have to find another strategy then. |
| 13:23 | foxdonut | jasonkolb: perhaps (-> (.newDecoder (Charset/defaultCharset)) (.decode result) str) |
| 13:24 | foxdonut | jasonkolb: or perhaps (-> (Charset/defaultCharset) (.newDecoder) (.decode result) str) |
| 13:24 | jasonkolb | thanks foxdonut, I'll give that a try |
| 13:24 | antares_ | jasonkolb: https://www.refheap.com/paste/2633 |
| 13:26 | foxdonut | antares_: cool, didn't know you could use .something bare |
| 13:27 | foxdonut | antares_: but why doesn't .something work with map? |
| 13:27 | foxdonut | is it a macro-related thing? |
| 13:28 | antares_ | foxdonut: it does if there is a method you are calling on IPersistentMap |
| 13:28 | antares_ | .something is a Java method call |
| 13:28 | foxdonut | antares_: I mean why does (-> 5 .toString) work but (map .toString [4 2]) doesn't? |
| 13:28 | jasonkolb | that worked beautifully thanks foxdonut & antares_ |
| 13:29 | antares_ | foxdonut: because .toString is not a function, it's a special form |
| 13:29 | foxdonut | antares_: oic, and -> takes forms, while map takes a function, right.. |
| 13:29 | foxdonut | jasonkolb: you're welcome |
| 13:30 | antares_ | foxdonut: -> is a macro, it takes anything that can be evaluated at compile time |
| 13:30 | antares_ | while map takes a function |
| 13:31 | foxdonut | antares_: I understand now.. thanks for the explanation |
| 13:56 | technomancy | so Leiningen honors the $CLASSPATH environment variable, but I have only ever heard of people using this by accident |
| 13:56 | technomancy | would anyone be horrified if we just dropped it entirely? |
| 13:56 | technomancy | you can still customize lein's classpath with pomegranate and the .lein-classpath file |
| 13:57 | joegallo | i would not be horrified, i think $CLASSPATH is basically a horrible idea. |
| 13:58 | joegallo | but, then again, that probably means i'm not the target audience for $CLASSPATH ;) |
| 13:58 | technomancy | motion passes |
| 13:58 | Borkdude | technomancy: would this seem logical to you? is the profiles.clj not ok maybe? https://groups.google.com/forum/?fromgroups#!topic/clojuredev-users/-SnAC7g-vpI |
| 14:00 | fliebel | technomancy: I used it once, when i did some naughty things with dependencies that where not in maven. |
| 14:00 | technomancy | Borkdude: the swank-clojure version is wrong, but that's the only issue |
| 14:01 | technomancy | oh shiiiiiiit--I got the new groups interface forced on me =( |
| 14:01 | Borkdude | technomancy: wrong as in? |
| 14:01 | technomancy | Borkdude: that version only works with lein1 |
| 14:02 | technomancy | you want lein-swank 1.4.2 |
| 14:02 | Borkdude | apparently the eclipse leiningen plugin is based on lein2 |
| 14:03 | technomancy | fliebel: another good reason to get rid of it! =) |
| 14:04 | fliebel | technomancy: Hah, only if you find a better alternative to RxTx. |
| 14:05 | technomancy | pretty sure that's been converted since samaaron switched to lein? |
| 14:07 | fliebel | technomancy: What do you mean? Sam did package a version of the thing, but with only half of the native deps. |
| 14:08 | technomancy | I wasn't following it too closely; could have missed some of the details |
| 14:08 | Borkdude | hmm, some other plugin must ruin leiningen/eclipse, when I change it to {:user {:plugins []}} it works |
| 14:08 | technomancy | anyway, preview4 will have an equivalent of mvn install:install-file |
| 14:08 | Borkdude | not if I change swank-clojure to 1.4.2 though |
| 14:09 | technomancy | not swank-clojure, lein-swank |
| 14:10 | Borkdude | ah fuck yes |
| 14:11 | gtrak | does there exist a good library for file operations? |
| 14:12 | gtrak | something as handy as python's os.walk? |
| 14:13 | technomancy | no idea what that does, but it sounds somewhat like file-seq |
| 14:13 | technomancy | (doc file-seq) |
| 14:13 | technomancy | ,(doc file-seq) |
| 14:13 | ieure | Yes. |
| 14:13 | clojurebot | "([dir]); A tree seq on java.io.Files" |
| 14:13 | clojurebot | "([dir]); A tree seq on java.io.Files" |
| 14:13 | technomancy | oops |
| 14:13 | gtrak | ah, nice |
| 14:15 | ibdknox | gtrak: checkout fs by raynes |
| 14:15 | ibdknox | gtrak: https://github.com/Raynes/fs |
| 14:15 | ibdknox | for more features |
| 14:15 | gtrak | ah, neat |
| 14:16 | Borkdude | ok, with lein-swank 1.4.2 it now works correctly, so some other thing must have caused the error then |
| 14:17 | gtrak | ibdknox, that's very useful, thanks |
| 14:17 | uvtc | Updated my "brief beginner's guide" to use Lein 2 and Clojure 1.4. |
| 14:17 | uvtc | http://www.unexpected-vortices.com/clojure/brief-beginners-guide/ |
| 14:17 | XPherior | Can anyone point me towards an understanding on how to use lazy-seq without blowing the stack? Doesn't seem like you can recur from inside of that function, obviously. |
| 14:18 | amalloy | XPherior: mostly it Just Works |
| 14:19 | XPherior | amalloy: I must be doing something horribly wrong. Let me show you an example of what I tried, one sec. |
| 14:19 | amalloy | $google stackoverflow dbyrne prime sieve clojure |
| 14:19 | lazybot | [recursion - Recursive function causing a stack overflow - Stack ...] http://stackoverflow.com/questions/2946764/recursive-function-causing-a-stack-overflow |
| 14:19 | amalloy | is a good answer about the most common cause of problems |
| 14:21 | XPherior | https://gist.github.com/2629447 |
| 14:21 | Borkdude | lein-noir 1.2.0 also seems to break it |
| 14:21 | XPherior | I've seen that question by the way, amalloy |
| 14:21 | amalloy | okay. your gist will never blow the stack |
| 14:22 | foxdonut | In a new Clojure project with an SQL database, what do people use to create the database schema? I've tried clojure.data.jdbc and lobos, both work but neither seems ideal. Would be nice to define the schema in code and have a safe "create schema only if it doesn't already exist" function to call on startup. |
| 14:22 | XPherior | amalloy: Wait. I swear it did last night. I mean, that was a quick rewrite.. But that was basically it. |
| 14:23 | foxdonut | Or should I just write the DDL in SQL, execute it on the database, and be done with it? |
| 14:23 | technomancy | foxdonut: I recommend writing it using SQL |
| 14:23 | TimMc | technomancy: How do you run the SQL? |
| 14:23 | xeqi | foxdonut: thats still an open area for clojure |
| 14:23 | technomancy | TimMc: finding a link; hang on |
| 14:23 | XPherior | amalloy: I guess I'm wrong. I'm not sure why it wasn't working last night. Thanks anyhow |
| 14:23 | amalloy | &(letfn [(inf-nums-from [n] "A sequence of n to infinity." (lazy-seq (cons n (inf-nums-from (inc n)))))] (nth (inf-nums-from 0) 500000)) |
| 14:23 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: in this context |
| 14:23 | TimMc | I don't want to be in the business of SQL-parsing. |
| 14:24 | technomancy | foxdonut: I'm not sure how polished this is, but this seems like the right approach: https://github.com/weavejester/ragtime |
| 14:24 | amalloy | &(letfn [(inf-nums-from [n] (lazy-seq (cons n (inf-nums-from (inc n)))))] (nth (inf-nums-from 0) 500000)) |
| 14:24 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: in this context |
| 14:24 | amalloy | wat. some copy-paste issue, i guess |
| 14:24 | XPherior | Yeah |
| 14:24 | XPherior | &(letfn [(inf-nums-from [n] (lazy-seq (cons n (inf-nums-from (inc n)))))] (nth (inf-nums-from 0) 500000)) |
| 14:24 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: � in this context |
| 14:25 | XPherior | Hmmkay, I'm stumped. |
| 14:25 | amalloy | there's probably a non-breaking space character in there somewhere |
| 14:26 | muhoo | foxdonut: try korma? |
| 14:26 | solussd | using lein-marginalia, when I run 'lein marg' I get: an exception: Caused by: java.lang.IllegalAccessError: escape-html does not exist, every time. any ideas? The trace isn't very helpful- nothing in my code at least. :) |
| 14:26 | ieure | Has anyone gotten clj-logging-config / tools.logging to, like, actually work? |
| 14:26 | foxdonut | technomancy: thanks for the pointers, I'll have a closer look at Ragtime. I guess also just running the SQL on the database remains a decent solution. |
| 14:27 | ieure | Because no matter how I configure it, I don't seem to get anything but a NOPLogger. |
| 14:27 | foxdonut | muhoo: my understanding is korma doesn't support DDL |
| 14:27 | technomancy | foxdonut: most existing solutions try to do too much |
| 14:28 | ieure | e.x. (use 'clj-logging-config.log4j) (set-loggers! :root {:level :debug :out :console}) (log/debug "test") |
| 14:28 | ieure | -> I get nothing |
| 14:28 | technomancy | I don't think trying to pretend you can seamlessly switch migration code between different SQL implementations is ever going to work |
| 14:29 | TimMc | technomancy: This still doesn't answer the question of how to take a SQL file full of DDL statements and shove it into a DB. |
| 14:30 | technomancy | TimMc: did you see the ragtime link? |
| 14:30 | foxdonut | technomancy: I agree. It also depends on what you are doing, e.g. maintaining an application in production vs. distributing a standalone example that "just works on startup", etc. |
| 14:30 | TimMc | technomancy: I've seen it in the past... |
| 14:31 | duck1123 | solussd: the recent version of hiccup renamed escape-html to h |
| 14:31 | TimMc | technomancy: Are you recommending that I split up my SQL schema file into a series of ragtime migrations? :-/ |
| 14:31 | duck1123 | escape-html is now in hiccup.util IIRC |
| 14:31 | solussd | duck1123: thanks! |
| 14:32 | technomancy | TimMc: honestly I haven't used a relational database in years, so I can't say whether ragtime covers all the bases. but it's on the right track compared to something like activerecord |
| 14:32 | XPherior | One more question. I saw Rich's talk about Simplicity at the Rails Conference.. I just don't understand why ORM's are complex. Maybe I've been doing it too long that I'm ignoring something |
| 14:33 | solussd | duck1123: now I wonder why marginalia isn't depending on the correct version of hiccup. :/ |
| 14:33 | TimMc | technomancy: The specific issue I'm dealing with is that JDBC does not seem to have a way to take a SQL *script* and run it. |
| 14:33 | TimMc | It can only take one DDL command at a time, as far as I've seen. |
| 14:33 | technomancy | TimMc: oh, I see. so the problem is that of delimiting commands? |
| 14:33 | TimMc | right |
| 14:34 | TimMc | And every suggestion I've seen on the web so far is: Parse it yourself. |
| 14:34 | TimMc | EW. |
| 14:34 | foxdonut | technomancy, TimMc: FWIW what we use now in a production Java app, is we have a series of plain SQL files and a tool that runs them in order. So we can modify the schema by adding a new file and the tool figures out which ones haven't been run yet. There is value in that IMHO. |
| 14:34 | amalloy | someone asked about that a month or two ago. i think the suggestion was "split-at ; lololol hope you don't have any semicolons in your data" |
| 14:35 | foxdonut | TimMc: and yes the tool allows for multiple statements within a single file. |
| 14:35 | duck1123 | I seem to remember hearing that lein was going to get something akin to mvn's dependency:tree. Is that a plugin I'm missing, or is it best to just use mvn for now? |
| 14:35 | Borkdude | uvtc: tnx for your link, will read it later |
| 14:35 | uvtc | Borkdude, sure, y/w |
| 14:35 | uvtc | ibdknox, thanks for the tip about Raynes/fs. Looks handy. |
| 14:36 | technomancy | amalloy: couldn't you just make up a delimiter? |
| 14:36 | amalloy | duck1123: lein2 deps :tree |
| 14:36 | uvtc | Though, I'm curious to know how I'm even able to use it... |
| 14:36 | uvtc | I'm using lein 2, and have specified that one of my dependencies is org.clojure/clojure "1.4.0". |
| 14:36 | uvtc | But fs appears to depend upon Clojure 1.3.0. |
| 14:36 | Borkdude | uvtc: gouda… is a city from Holland, but your name doesn't seem Dutch to me |
| 14:36 | gtrak | if you specify a dep in your project.clj, it'll override a transitive dep |
| 14:36 | gtrak | uvtc, ^ |
| 14:36 | amalloy | uvtc: dependency versions are basically mild preferences :P |
| 14:37 | uvtc | gtrak, "transitive dep"? |
| 14:37 | gtrak | yes, in maven-jargon, a dependency pulled in by a dependency |
| 14:38 | amalloy | technomancy: you could, although probably none exists that can't technically be a part of the SQL statement |
| 14:38 | foxdonut | technomancy, amalloy, TimMc: if it's just executing several SQL statements in a single SQL file with JDBC, one option is Spring: https://www.refheap.com/paste/2634 |
| 14:38 | uvtc | gtrak, Ah. I see. Thanks. And thanks, amalloy. I'd have guessed that lein would pull in Clojure 1.3.0 into my local repository, but then maybe it wouldn't be used. |
| 14:39 | technomancy | amalloy: ! |
| 14:39 | gtrak | speaking of which, why does lein need a lib/ folder at all? maven doesn't. I guess it's convenient though. |
| 14:39 | technomancy | gtrak: lein2 doesn't |
| 14:39 | amalloy | TimMc: what about having a migrations directory, with each file a separate statement? |
| 14:39 | gtrak | ah, neat |
| 14:39 | amalloy | heh, that's the one i was thinking of too, technomancy |
| 14:40 | technomancy | gtrak: it was initially there for compatibility with existing tooling which has since thankfully been abandoned |
| 14:40 | Borkdude | amalloy: lein2 reps :tree only shows a tree, but doesn't pull in reps? |
| 14:40 | technomancy | amalloy: big fan of the ol' page break |
| 14:40 | Borkdude | deps |
| 14:40 | Borkdude | fucking spelling correction, haven't found how I can turn it off by default |
| 14:40 | foxdonut | technomancy: anyway, perhaps Ragtime will be a good fit for what I need. I'll try it out. Thanks again. |
| 14:40 | amalloy | iunno |
| 14:40 | technomancy | Borkdude: it can't show the tree without walking the deps, which fetches them |
| 14:40 | uvtc | Borkdude, gouda, as in, the cheese. Also, it kinda' sounds like italian "gooda' docs, capiche?" (oh man) |
| 14:41 | Borkdude | uvtc: Gouda is the city where the cheese is from, some 50 km from here |
| 14:41 | gtrak | technomancy, deleting code is one of my favorite things, I understand :-) |
| 14:49 | TimMc | foxdonut: Is XML really needed to make JDBC do that? |
| 14:54 | foxdonut | TimMc: no, you could certainly do it in code instead. I was just offering the possibility of using JDBC to execute multiple SQL statements within a single file -- because I've had that frustration before and a home-grown solution with strange delimiters etc. isn't very nice. |
| 14:56 | achin | Am I doing something wrong, or does the repl in lein 2.0.0-preview3 only give you the top frame of a stacktrace? |
| 14:56 | nDuff | If I call (keys some-map) and (vals some-map), is it guaranteed that these will be serialized in the same order for all Clojure's map implementations? |
| 14:57 | technomancy | nDuff: it's guaranteed the order will be the same on the same map object |
| 14:57 | technomancy | it's not guaranteed across serialization boundaries iirc |
| 14:57 | nDuff | *nod*, thanks |
| 14:57 | ivan | achin: that's how the normal REPL works too, no? (pst) prints the stack trace |
| 14:58 | achin | ivan: Maybe I'm remembering wrong, but I thought it printed out more than the last frame. |
| 15:02 | TimMc | achin: (pst) is the way to go, but (.printStackTrace *e) will give you the whole (ugly) thing. |
| 15:02 | achin | TimMc, ivan: Thanks. |
| 15:05 | amalloy | nDuff: it's guaranteed, and so you can rely upon it, but in my experience code that relies on it can generally be rewritten in a nicer way |
| 15:08 | TimMc | foxdonut: Cool, I'll check that out! |
| 15:10 | halarnold2000 | &(+ 1 2) |
| 15:10 | lazybot | ⇒ 3 |
| 15:10 | ivan | how do I load my own deps.js file in a ClojureScript REPL? |
| 15:10 | ivan | or perhaps before I start the REPL |
| 15:15 | foxdonut | TimMc: FWIW, the docs are here: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/jdbc.html#d0e25689 and the Java API is here: http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/jdbc/datasource/init/package-summary.html |
| 15:15 | foxdonut | (it's Java so the links are really verbose ;) |
| 15:17 | creese | How do I do multi-line docstrings? |
| 15:17 | Raynes | Hit return. |
| 15:18 | uvtc | creese, You can have newlines in your docstrings. |
| 15:23 | S11001001 | uvtc: C |
| 15:24 | uvtc | S11001001, C? |
| 15:24 | S11001001 | uvtc: for further evidence, eval ("hello, " "world") in python |
| 15:25 | Wild_Cat | uvtc: yeah, in Python, string literals are collapsed together, meaning you can write your strings as multiline by using parens. |
| 15:26 | Wild_Cat | ("hello" "world") == "helloworld" |
| 15:26 | S11001001 | just like C |
| 15:26 | uvtc | Oh, right. :) "like C" |
| 15:26 | muhoo | has someone already written something that'll turn a flat list like {:foo.bar.baz 1, foo.bar.baz.quux 2} into a tree like {:foo {:bar {:baz 1 {:quux 2}}}} ? |
| 15:26 | Wild_Cat | and thanks to implicit line continuations, you can use parens to spread your string over multiple lines |
| 15:27 | Wild_Cat | however, note that ("hello " <newline> "world") == "hello world", not "hello \nworld" |
| 15:29 | uvtc | Wild_Cat, S11001001 : still though, as soon as I saw that Clojure strings could span multiple lines, I thought, "hey, wait a minute, why can't I do that in Python?" |
| 15:29 | Wild_Cat | uvtc: agreed, it is a weird choice to SyntaxError, especially when the parser supports triple-quoted strings. |
| 15:30 | Wild_Cat | OTOH, one thing I sorely miss in Clojure: Python's raw strings. |
| 15:31 | Wild_Cat | (it had me, in fact, running back to Python screaming last time I attempted to use Clojure, because it turned out there were a lot of literal backslashes in the stuff I had to do) |
| 15:31 | creese | I want to refer to java methods in documentation. I know in Ruby its class#method. What is best practice for java? |
| 15:32 | TimMc | &(str #"\backslash") |
| 15:32 | lazybot | ⇒ "\\backslash" |
| 15:32 | TimMc | Wild_Cat: ^ :-P |
| 15:32 | Wild_Cat | TimMc: isn't that a regex? |
| 15:33 | TimMc | Yeah, but then I extract the pattern string from it. |
| 15:33 | Wild_Cat | (or is that a new Clojure 1.4 thing I've missed?) |
| 15:33 | Bronsa | neat |
| 15:33 | TimMc | It's a dirty trick. |
| 15:33 | Wild_Cat | &(str #"\hello(") |
| 15:33 | lazybot | java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 1\hello( ^ |
| 15:33 | TimMc | I don't guarantee that it works on all inputs... |
| 15:33 | Wild_Cat | TimMc: yeah, that's what I thought ;) |
| 15:33 | Wild_Cat | it only works when your string is actually a valid regex |
| 15:34 | TimMc | &(str #"\Q\h\E") |
| 15:34 | lazybot | ⇒ "\\Q\\h\\E" |
| 15:35 | uvtc | creese, y'know, I'm not sure I've ever seen any other notation than the one you mention. It's been a while since I've looked at the PickAxe. You use the dot for instance methods, right? |
| 15:35 | creese | I want to know what it is for java. Ruby, I know. |
| 15:36 | creese | Ruby is # for instance :: for class, I think, but neither is Ruby syntax. |
| 15:36 | uvtc | creese, Whoops. right right. |
| 15:36 | raek | I think . is more common in Java-land, but the javadoc syntax uses #, IIRC |
| 15:37 | duck1123 | creese: does this help? http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#see |
| 15:37 | Wild_Cat | TimMc: okay, so it works when your string is sort-of something that looks like a valid regex? Or do Java regexes auto-escape backslashes that aren't followed by a correct escaping char? |
| 15:38 | creese | duck1123: thanks |
| 15:39 | amalloy | muhoo: that is an impossible desire to fulfill, because baz cannot be both an integer and a map |
| 15:42 | TimMc | Wild_Cat: \Q and \E pairs allow raw stuff inside Java Patterns. |
| 15:42 | TimMc | Anyway, yes -- we should have raw strings. |
| 15:42 | Wild_Cat | &(str #"\Qhello(\E") |
| 15:42 | lazybot | ⇒ "\\Qhello(\\E" |
| 15:42 | Wild_Cat | I see. |
| 15:42 | Wild_Cat | still, yeah. Thanks. |
| 15:43 | TimMc | &(java.util.regex.Pattern/quote "foo") ;; IIRC |
| 15:43 | lazybot | ⇒ "\\Qfoo\\E" |
| 15:43 | jwr7 | Is there a Clojure-1.3/1.4 compatible continuation of clojure.contrib.lazy-xml? clojure.data.xml has a different interface and does not parse some of my files. |
| 15:47 | ivan | dnolen_: I've loaded my own deps.js into the rhino REPL via rhino/-eval, but when I do something like (ns mystuff (:require [cw.env :as env])) that form returns `nil`; then doing (env/someFunc) results in org.mozilla.javascript.EcmaError: ReferenceError: "cw" is not defined. |
| 15:47 | ivan | how should I debug that? |
| 15:49 | dnolen_ | ivan: as far as I know, an ns form doesn't actually trigger loading of anything. |
| 15:49 | muhoo | amalloy: or something like that {:baz [1 {:quux 2}]}, etc |
| 15:50 | ivan | dnolen_: thanks, I guess have more work to do |
| 15:50 | jwr7 | I have to say, the migration from Clojure 1.2+monolithic contrib to anything newer is a major disaster. I still haven't finished the work on our codebase. I hope nothing like this ever happens again. |
| 15:50 | dnolen_ | ivan: I could be wrong about that of course. But I think ns forms get converted into goog.provide and goog.require |
| 15:51 | canweriotnow | has anyone else had issues with `lein repl` ignoring project.clj and not loading the project into the repl session? |
| 15:51 | dnolen_ | ivan: in the browser those will work |
| 15:51 | ivan | okay |
| 15:51 | amalloy | muhoo: you also complect string-parsing with map-building; either task on its own is simple (and easy), and the two can be composed without any real trouble |
| 15:51 | dnolen_ | ivan: but normally we are generating a single file, so goog.provide and goog.require get eliminated. |
| 15:51 | muhoo | jwr7: indeed, the problem with batteries included, is when the batteries go stale and start leaking acid all over the place |
| 15:51 | dnolen_ | ivan: that said, the lack of a require and load at the REPL kinda stinks. Would be nice if someone worked on that. |
| 15:52 | muhoo | amalloy: ahhm, so splitting the strings into vectors does indeed get me more than halfway there, thanks |
| 15:52 | ivan | dnolen_: thanks, now I know it's missing |
| 15:53 | canweriotnow | I guess it might be a versioning thing? It *used* to load the project just fine, and now it doesn't. |
| 15:53 | muhoo | then a little assoc-in and i'm probably good |
| 15:53 | jwr7 | muhoo: Well, I'm fine with change, but not too much at once. Changing Clojure and splitting monolithic contrib into modules would be fine, but some libraries were effectively abandoned and replaced with ones with a completely different API, functionality and problems. |
| 15:54 | amalloy | &((fn [paths] (reduce (fn [m [path value]] (assoc-in m `(~@path ::self) value)) {} paths)) '([(:foo :bar :baz) 1], [(:foo :bar :baz :quux) 2])) |
| 15:54 | lazybot | ⇒ {:foo {:bar {:baz {:quux {:clojure.core/self 2}, :clojure.core/self 1}}}} |
| 15:54 | amalloy | muhoo: this is the other half, more or less |
| 15:58 | muhoo | ooh, macro quoting, nice |
| 15:58 | TimMc | jwr7: The maintenance of the old libs was an illusion. |
| 16:00 | beffbernard | I'm dynamically building a string with the intention of evaluating it later.. but I'm not having any luck.. "userevents.thrift.TList$_Fields/values" where TList is a generated Thrift class and _Fields is a java Enum |
| 16:01 | jwr7 | TimMc: yes, I realize that -- and I think overall this was a good decision. But I'm not happy about the fact that a) it was done together with the switch to 1.3 and b) some libs (lazy-xml in my case) were replaced with something different. As I write this I'm trying to find out why data.xml fails when parsing some XML documents... |
| 16:02 | beffbernard | So my desired output is I want to call the values method on _Fields |
| 16:02 | muhoo | when it comes to xml, i've had good luck with necessary-evil |
| 16:02 | jwr7 | muhoo: I like the name already |
| 16:03 | muhoo | jwr7: https://github.com/brehaut/necessary-evil |
| 16:04 | jwr7 | muhoo: ...but it's not what I need. I need a lazy XML parser, capable of dealing with huge data files. Ah well. I'll stop complaining now and go back to yak shaving. |
| 16:04 | muhoo | granted, i was dealing with RPC's, not files. |
| 16:05 | muhoo | have fun. i'll take a break from dealing with openid :-) fun for everyone. |
| 16:12 | uvtc | muhoo, I like your comment about battery acid leaking out. Might have to quote you sometime. :) |
| 16:14 | uvtc | Oh, just missed him. |
| 16:14 | uvtc | $mail muhoo I like your comment about battery acid leaking out. Might have to quote you sometime. :) |
| 16:14 | lazybot | Message saved. |
| 16:20 | Raynes | I get chils when people use that feature. |
| 16:20 | Raynes | chills even |
| 16:21 | uvtc | Raynes, I noted its use here: http://www.unexpected-vortices.com/clojure/brief-beginners-guide/getting-help.html . |
| 16:22 | uvtc | If you've got any other choice lazybot tips, I'm all ears. :) |
| 16:23 | amalloy | is it worth noting how to coerce lazybot into giving a snarky answer?? |
| 16:23 | lazybot | amalloy: What are you, crazy? Of course not! |
| 16:23 | gtrak | is there a way to make emacs not hang when I do something stupid? like printing a file-seq of thousands of files? |
| 16:23 | uvtc | lazybot, tell me your secrets! |
| 16:23 | uvtc | lazybot is a tough nut to crack. |
| 16:24 | Raynes | uvtc: It also has a timer. |
| 16:24 | uvtc | A timer you say? |
| 16:24 | Raynes | $timer 0 0 5 Hi, uvtc |
| 16:24 | lazybot | Timer added. |
| 16:25 | lazybot | Hi, uvtc |
| 16:25 | uvtc | Egads! |
| 16:25 | jwr7 | gtrak: not that I know of. I once waited 2 days. |
| 16:25 | Raynes | That doesn't always work properly, unfortunately. |
| 16:25 | Raynes | It sometimes gets times all wonky and amalloy is too lazy to fix it. |
| 16:25 | uvtc | Raynes, what are the first two integers for? |
| 16:25 | gtrak | jwr7, that's absurd :-) |
| 16:25 | Raynes | hours, days, seconds. |
| 16:25 | jwr7 | gtrak: it's all relative and depends on the value of your unsaved changes :-) |
| 16:25 | amalloy | ...days |
| 16:26 | Raynes | Bahahahaha |
| 16:26 | Raynes | Minutes. |
| 16:26 | Raynes | Sorry, preoccupied. |
| 16:26 | gtrak | jwr7, maybe we need to make a slime-proxy |
| 16:26 | Raynes | amalloy: Maybe that's why the times are screwed up, minutes are days. |
| 16:26 | raek | Raynes: been using java.util.Date recently :-) |
| 16:26 | gtrak | swank-proxy, rather |
| 16:27 | jwr7 | Unfortunately, these days most editors suck badly. Just try opening a 500MB XML file -- both Emacs and vim will take ages. With my 16 cores and 24GB of RAM I can't really see why. |
| 16:28 | gtrak | algorithms |
| 16:28 | felideon | jwr7: emacs is nice enough to warn you! |
| 16:28 | felideon | (dunno about vim) |
| 16:28 | jwr7 | It recently took me a couple of minutes just to remove a trailing comma in a broken JSON file in vim. The file was 100MB or so. That's just sad. |
| 16:28 | jwr7 | felideon: yeah, unless you dump something in the repl :-/ |
| 16:29 | felideon | ah right |
| 16:29 | felideon | C-c C-c a few times, q q q, pray. |
| 16:33 | amalloy | refusing to edit a 500MB text file is probably a protection for your sanity. nothing good can come of doing that |
| 16:33 | babilen | Is there a way in which I can use maps as keys in maps? (and get their values back? (e.g. (get {:a 1} {{:a 1} 0}))) Or do I have to use something else as key and "somehow" look up that identifier for every map that I want to use as key? |
| 16:37 | amalloy | that works fine. you're passing the args to get in the wrong order |
| 16:40 | babilen | amalloy: Wonderful (doh!) -- Guess I take a break now :) |
| 16:43 | S11001001 | unfortunately clojure maps only work with strings, keywords, and typeglob references, of course |
| 16:43 | S11001001 | and integers < 28 bits |
| 16:44 | michaelr525 | hello |
| 16:45 | ivan | S11001001: would be funny if people didn't have such low expectations |
| 16:47 | amalloy | S11001001: is that the state of things in CL or something? i don't recognize the language you're referring to |
| 16:48 | TimMc | amalloy: What's wrong with editing giant files? |
| 16:49 | ivan | some hex editors are good at editing giant files, they can even insert |
| 16:49 | S11001001 | amalloy: perl5 hashes only support strings; CL hashtables support anything supported by eq, eql, equal, or equalp |
| 16:49 | TimMc | ivan: Oooh, good call. |
| 16:50 | gtrak | is teco good at large files? |
| 16:50 | S11001001 | and php silly arrays support strings and numbers, and I think objects (compared and hashed by stringification, because that's what php *would* do) |
| 16:51 | Wild_Cat | S11001001: don't be so sure. PHP doesn't compare strings by stringification. :p |
| 16:51 | Wild_Cat | (if they sort of look like numbers) |
| 16:53 | S11001001 | I'm glad I don't remember the exact details |
| 16:53 | S11001001 | php arrays are the worst things |
| 16:53 | jonaskoelker | how the ... do you guys parse stuff? |
| 16:53 | jonaskoelker | [sorry if I'm butting in] |
| 16:54 | Wild_Cat | PHP everything appears to have been carefully designed so as to be the worst possible design *and* implementation of the task at hand. |
| 16:54 | jonaskoelker | Wild_Cat: tell me more about the train wreck I've managed to avoid, please :) |
| 16:55 | Wild_Cat | jonaskoelker: eevee did it better than I can ever hope to: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ |
| 16:55 | ivan | gtrak: don't know, but HxD (Windows) is |
| 16:55 | ivan | haven't looked at others |
| 16:56 | jonaskoelker | S11001001: so in pythonese, str(myob) == repr(myob) or else (myob == myob) == False ? |
| 16:57 | S11001001 | jonaskoelker: no, I mean at the silly-array level; basic equality is a whole other mess |
| 16:57 | Wild_Cat | jonaskoelker: but the string thing comes down to this: if you're trying to compare two strings together and they look like numbers, PHP will parse them as numbers and compare the results, even if the conversion overflows. Meaning that if you compare 2 strings that are 2 huge, but different, numbers (bigger than can fit in a ... I think it's a 32-bit int), they can compare as equal. |
| 16:58 | Wild_Cat | ...all of this without a single error message, warning or anything else. |
| 16:58 | jonaskoelker | :O |
| 16:58 | jonaskoelker | teh fuque... |
| 16:59 | LauJensen | lol. I can't seem to find any corner of the internet where PHP shortcomings aren't discussed |
| 17:00 | TimMc | These are the stories the tribe tells its young in order to warn them from making the same mistakes. |
| 17:02 | jonaskoelker | "... and, reading between the lines, non-programs ..." :-) |
| 17:02 | jonaskoelker | I guess those don't not-crash |
| 17:03 | brehaut | im sure someone has a fast templating library that is halfway between enlive and hiccup, but i cant remember what its called |
| 17:03 | Wild_Cat | I suppose the point here was that it was initially a templating language, not the application programming language people perverted it as. |
| 17:03 | Raynes | brehaut: tinsel |
| 17:04 | brehaut | aha thanks |
| 17:17 | dnolen_ | benchmark illustrating the benefit of the property + bit and implementation of satisfies? http://jsperf.com/direct-vs-chain/4 |
| 17:22 | TimMc | Wild_Cat: And that is why my PL prof at NEU impressed upon us the importance of realizing when one is writing a nascent programming language. |
| 17:24 | ForSpareParts | Hey, how do you guys debug? |
| 17:24 | jonaskoelker | loudly, swearingly |
| 17:24 | ForSpareParts | I'm working in IDEA with La Clojure right now, and it won't stop on breakpoints... |
| 17:25 | ForSpareParts | janskoelker: (well, of course) |
| 17:25 | jonaskoelker | =) |
| 17:25 | jonaskoelker | I have yet to write anything not printf-debuggable |
| 17:25 | jlongster | dnolen_: vaguely related, if you ever want to see how well your js is JITed in Firefox, here's a cool addon: https://addons.mozilla.org/en-US/firefox/addon/jit-inspector/ |
| 17:26 | emezeske | ForSpareParts, jonaskoelker: Yeah, println is my debug tool of choice |
| 17:26 | TimMc | (doto ... (println)) |
| 17:27 | TimMc | &(+ (doto 5 (println)) 6) |
| 17:27 | lazybot | ⇒ 5 11 |
| 17:27 | gtrak | how would I get the substring of a string after the point where a regex matches? |
| 17:27 | gtrak | getting the offset of the match would do the trick |
| 17:28 | gtrak | ah, I see there's a lastIndexOf method on String |
| 17:28 | jonaskoelker | just about any character sequence is a method on String =) |
| 17:30 | ForSpareParts | emezeske: hm. I used to do print debugging, but I liked using breakpoints so much more... |
| 17:31 | emezeske | ForSpareParts: of course, to each his own |
| 17:32 | technomancy | I think for breakpoints you need either swank or counterclockwise |
| 17:32 | dnolen_ | jlongster: not related - but do you ever run the FF jsshell directly? |
| 17:32 | technomancy | or maybe debug-repl works in other contexts? |
| 17:34 | jlongster | dnolen_: no, I use node for command line js, though I wish spidermonkey was used more! |
| 17:34 | dnolen_ | mmarczyk: ping |
| 17:35 | dnolen_ | jlongster: asking because I'm convinced the jsshell they distribute with the nightlies is not actually the latest js engine build. |
| 17:35 | muhoo | uvtc: heh, enjoy. |
| 17:36 | jlongster | dnolen_: how come? I'm not sure what its used for in the whole toolchain. |
| 17:36 | muhoo | [A |
| 17:37 | michaelr525 | I have an uberjar jar which runs for an hour or a few and then stops for unknown reason without printing any exception... |
| 17:38 | michaelr525 | Sounds familiar to anyone? |
| 17:39 | technomancy | michaelr525: it runs for an hour when generating the uberjar or running via java -jar? |
| 17:39 | michaelr525 | java -jar |
| 17:40 | technomancy | oh, no idea then; sorry |
| 17:40 | michaelr525 | :) |
| 17:40 | michaelr525 | will have to fill it with printlns i guess\ |
| 17:41 | nickmbailey | o893 |
| 17:42 | nickmbailey | oops, wrong channel |
| 17:45 | jonaskoelker | what do you guys use for generating parsers? |
| 17:52 | dnolen_ | jlongster: it's crazy slow |
| 17:52 | dnolen_ | jlongster: the js engine actually in the nightly seems fast |
| 17:54 | jlongster | dnolen_: hm, just looking at the docs for building the shell, and it has the --disable-optimize flag? It might be missing lots of optimizations, possibly even JIT? |
| 17:55 | wkmanire | Howdy folks. |
| 17:55 | dnolen_ | jlongster: :P |
| 17:55 | dnolen_ | jlongster: that doesn't make much sense to me. |
| 17:56 | jlongster | dnolen_: that's a very cursory glance :) |
| 17:56 | jlongster | if you're really interested, I can poke some of the people who work on it |
| 17:56 | dnolen_ | jlongster: that would be sweet! |
| 17:57 | jlongster | dnolen_: ok, I'll let you know what they say |
| 17:57 | dnolen_ | jlongster: we do a lot of sanity checking / perf testing at the command line |
| 18:01 | jlongster | dnolen_: did you build jsshell yourself? |
| 18:02 | dnolen_ | jlongster: I did not, though I could do that. |
| 18:02 | jlongster | just curious, so I give them some context |
| 18:02 | jlongster | so you checked out a built version from Mozilla's hg repo? |
| 18:02 | dnolen_ | jlongster: I just thought the prebuilt shells might be simpler since that's what Brendan directed me towards. |
| 18:02 | jlongster | yeah, makes sense |
| 18:02 | dnolen_ | jlongster: the nightlies directory has prebuilt binaries I just grabbed a zip. |
| 18:03 | jlongster | dnolen_: do you have the URL handy so that I can show them exactly which one your using? |
| 18:03 | jlongster | I'm not too familiar with it |
| 18:04 | dnolen_ | jlongster: got it off ftp from here, ftp://ftp.mozilla.org/pub/firefox/nightly/latest-trunk |
| 18:11 | jlongster | dnolen_: are you running it with the flags "-m -n -a" ? |
| 18:11 | jlongster | just relaying messages at this point, I don't have it handy to see what those are |
| 18:11 | jlongster | oh, -m enables JaegarMonkey and -n enables type inference |
| 18:12 | dnolen_ | jlongster: excellent that did the trick very helpful! |
| 18:12 | jlongster | woot! |
| 18:13 | dnolen_ | jlongster: this is great, thanks much. |
| 18:13 | gtrak | hmm, this is unexpected, I guess because I'm used to java. how do I get a keySeq (the result from calling keys on a map) into a set efficiently, so I can perform an intersection on it? |
| 18:13 | jlongster | np! glad I could help. They said it should become the default at some point |
| 18:17 | gtrak | I guess into #{} might be alright |
| 18:19 | gtrak | actually that's freaky-fast |
| 18:22 | gtrak | intersecting 9k string keys from 2 maps takes 28 ms |
| 18:22 | gtrak | the result is 9k, rather |
| 18:22 | tacoman | what do you guys use for auto-completion of Clojure in Emacs? |
| 18:22 | ForSpareParts | Would you guys mind looking at my attempt at a binary search tree? |
| 18:22 | ForSpareParts | http://pastebin.com/iu0s6XrY |
| 18:23 | ForSpareParts | adding crashes, it says it can't cast a long as an IFn |
| 18:23 | ForSpareParts | and I have no idea why |
| 18:24 | emezeske | ForSpareParts: Your if statement tries to call val as a function |
| 18:24 | ForSpareParts | OH |
| 18:24 | ForSpareParts | Oh, fuck, I see it now, thank you. |
| 18:25 | emezeske | ForSpareParts: very common mistake coming from an infix background. |
| 18:25 | ForSpareParts | Thanks, that's a confidence booster : ) |
| 18:27 | emezeske | :) |
| 18:27 | ForSpareParts | OK, so I fixed that -- now I've got "ArityException Wrong number of args (0) passed to: PersistentHashMap" |
| 18:27 | clojurebot | atacontrol cap ad0 | grep serial | awk '{print $3}' |
| 18:28 | ForSpareParts | I don't know where to look exactly -- it doesn't give me a line number. But I would have expected that to be caused by something like (:keyword), right? |
| 18:29 | emezeske | ForSpareParts: That's the error you'd see if you tried to e.g. ({:foo 42}) I think. |
| 18:30 | emezeske | ForSpareParts: You might want to look for extra parens around things (hint) |
| 18:31 | ForSpareParts | Ah, ok. |
| 18:33 | TimMc | The wonderful thing about abstractions is that there are so many to choose from: https://www.refheap.com/paste/2640 |
| 18:33 | TimMc | Iterator not being Iterable is one of the more baffling things I have encountered in Java. |
| 18:33 | amalloy | TimMc: iterables are supposed to be iterable multiple times |
| 18:34 | amalloy | iterators are mutable, use-once |
| 18:34 | ForSpareParts | emezeske: So, I've narrowed it down to something that happens after I recurse, which should mean that the problem is with (make-bst val) |
| 18:34 | ForSpareParts | but I can't get rid of those parens, I need them to make it a function call, right? |
| 18:34 | technomancy | amalloy: so really the fact that iterators exist in the first place is the WTF =) |
| 18:34 | TimMc | amalloy: I suppose in that case I should direct my bafflement at for loops not supporting Iterator |
| 18:35 | amalloy | ForSpareParts: too many parens |
| 18:35 | amalloy | the one on line 11 is extraneous |
| 18:36 | ForSpareParts | Huh, ok. Thanks. |
| 18:36 | amalloy | (aside: is something still "extraneous" if it's breaking things? or does that word imply that it isn't causing a problem?) |
| 18:36 | ForSpareParts | Why is that? I thought that the entire function body had to be in parens? |
| 18:37 | amalloy | parens always mean "call this as a function/macro" |
| 18:37 | amalloy | the function body tends to have parens around it, because you want to call something as a function |
| 18:37 | amalloy | but you can't just put more in |
| 18:37 | antares_ | dakrone: hey |
| 18:37 | ForSpareParts | I'd say your use of "extraneous" was spot on. It means something is unneeded or extra, but it could be causing a problem as well. |
| 18:37 | ForSpareParts | Also, that makes sense. Thank you. |
| 18:39 | ynniv | is there any sample code using noir or compojure and websockets? |
| 18:40 | weavejester | ynniv: Compojure is for HTTP routes, rather than websockets. |
| 18:41 | kovasb_ | ynniv: https://github.com/andrewvc/noir-async |
| 18:41 | ynniv | I have a compojure app that I would like to add a websocket route to |
| 18:41 | weavejester | ynniv: I believe there's some code in Aleph for web sockets |
| 18:43 | ynniv | yes, the code that I have seen ends up using aleph |
| 18:46 | ynniv | I've probably gotten lost in the abstractions. Can I use my existing compojure routes with aleph? |
| 18:53 | weavejester | ynniv: Hm… Maybe… Compojure is a routing libary built around Ring, but it might also work with Aleph, since it looks like the only difference is in the way the response is returned. |
| 18:54 | ynniv | sanity check: (noir (compojure (ring (jetty))))? |
| 18:54 | ynniv | and it looks like aleph is ring-like |
| 18:54 | ynniv | so (noir-async (compojure (aleph (netty))))? |
| 18:54 | weavejester | Yes. But websockets are not HTTP, and therefor not Ring. |
| 18:54 | ynniv | correct |
| 18:54 | weavejester | You effectively need Ring for your HTTP stuff, and Aleph for your websocket stuff. |
| 18:55 | weavejester | Or noir-async might handle that for you. |
| 18:55 | ynniv | in the best case, I would have a server that fulfilled HTTP requests with ring and WebSockets with something else |
| 18:55 | ibdknox | aleph + compojure or noir works just fine |
| 18:55 | weavejester | It looks like there are wrap-ring-handler and wrap-aleph-handler for converting back and forth |
| 18:56 | weavejester | So you can convert between the two protocols depending on the route. |
| 18:56 | ynniv | yes. but ring/jetty cannot handle websockets |
| 18:56 | ynniv | so I need to swap that part with something else |
| 18:56 | ibdknox | ring is not tied to jetty |
| 18:56 | ibdknox | aleph = netty |
| 18:57 | ynniv | yes, but can ring wrap netty and do ws? |
| 18:57 | ynniv | from what I can tell, aleph is ring applied to netty and ws |
| 18:59 | weavejester | ynniv: It looks like there is middleware to convert back and forth between the Aleph style and Ring. |
| 18:59 | weavejester | https://github.com/ztellman/aleph/wiki/HTTP |
| 19:00 | weavejester | Let me see if I can come up with a small example.... |
| 19:01 | jonaskoelker | have anyone done any parsing in clojure? |
| 19:02 | brehaut | yes, but any advice i have is now out of date |
| 19:02 | jonaskoelker | :| |
| 19:02 | jonaskoelker | know of any good parser generators? |
| 19:03 | ynniv | i last used https://github.com/joshua-choi/fnparse |
| 19:03 | ynniv | the output was kind of slow, but that might have been an artifact of a poor grammar |
| 19:04 | brehaut | last i looked fnparse was not compatible with clj 1.3+ |
| 19:04 | antares_ | jonaskoelker: I am afraid all clojure-specific parser generators are a bit out of date. I used Ragel and ANTLR to produce a Java parser that produces Clojure data structures, it was pretty straightforward. |
| 19:04 | weavejester | Hm, actually an example might mean I'll need to try a few things out first... |
| 19:04 | brehaut | theres parsley |
| 19:04 | ynniv | brehaut: that wouldn't surprise me (clj 1.3) |
| 19:05 | jonaskoelker | brehaut: I can confirm that incompatibility |
| 19:05 | jonaskoelker | antares_: can you share the code? |
| 19:06 | ynniv | weavejester: My compojure routes are ultimately a ring handler, correct? Perhaps it is as simple as wrapping those routes and adding my WebSocket route. |
| 19:06 | antares_ | jonaskoelker: here is one: https://github.com/michaelklishin/crawlista/blob/master/src/rl/clojurewerkz/crawlista/robots/Parser.rl |
| 19:07 | weavejester | ynniv: Effectively yes. I just don't know if you can use GET etc. with Aleph or if you need to create a handler function manually. |
| 19:07 | ynniv | ok. It's a place to start |
| 19:07 | antares_ | jonaskoelker: I wouldn't call it a great example of a Ragel parser but it demonstrates how you can easily build Clojure data structures in a Java parser. I prefer ANTLR to Ragel because it has ANTLWorks (a small IDE) |
| 19:09 | jonaskoelker | antares_: yeah, I think I'll go with ANTLR, though the documentation seems sparse -.- ; but thanks, I'll study the building of clojure data in java |
| 19:10 | ynniv | Unrelated, the velocity of the clojure community is amazing. I'm still wary of the JVM (exceptions, tail calls, bloat), but it's difficult to ignore the energy of the community. |
| 19:12 | jonaskoelker | I find it a non-hassle to use loop/recur, fwiw |
| 19:12 | jonaskoelker | how's exceptions and bloat a problem in your eyes? |
| 19:12 | jonaskoelker | bloat = huge memory consumption? |
| 19:13 | ynniv | yes. I can run racket on a 64MB embedded ARM |
| 19:13 | jonaskoelker | racket? |
| 19:13 | ynniv | and every time I see a stack trace I die a little |
| 19:13 | ynniv | mzscheme |
| 19:13 | jonaskoelker | ah |
| 19:13 | jonaskoelker | oh yeah |
| 19:13 | ynniv | but stack traces are often the only useful part of an exception |
| 19:13 | jonaskoelker | java.foo.indirectMethodOne -> java.foo.indirectMethodTwo -> java.bar.deepNestingThree -> ... |
| 19:13 | ynniv | you really need handlers to do something useful when odd things happen |
| 19:14 | jonaskoelker | ~= callbacks? |
| 19:14 | clojurebot | No entiendo |
| 19:14 | technomancy | leiningen runs on a beaglebox =) |
| 19:14 | jonaskoelker | (I'm new/intermediate to lisp; is `handler' a ... keywordish?) |
| 19:15 | ynniv | how much RAM? |
| 19:15 | clj_guest_002 | so javascript has it's document model; is there anyway in java to create GUIs with something like that |
| 19:15 | antares_ | jonaskoelker: I happen to have 2 books from ANTLR author, one of them on ANTLR :) |
| 19:15 | clj_guest_002 | rather than stacking guilayout on top of guilayouts ? |
| 19:15 | technomancy | ynniv: not sure. 64MB might be enough for leiningen, but not if it needs to share with the OS =) |
| 19:15 | jonaskoelker | antares_: lucky you. Can you fax it? =) |
| 19:15 | ynniv | well, there wasn't a whole lot of room for racket either :) |
| 19:16 | ynniv | but it compiled and ran on a soft-float system |
| 19:16 | technomancy | ynniv: but UTF-16 suuuuucks; it's true |
| 19:16 | antares_ | jonaskoelker: I can give you a link to it :) http://pragprog.com/book/tpantlr/the-definitive-antlr-reference |
| 19:16 | technomancy | it's better than not having the language specify an encoding (cough; ruby), but it's bad. |
| 19:17 | ynniv | jonaskoelker: try http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html |
| 19:17 | jonaskoelker | antares_: but it's like (iterate dec *account-balance*) :-( |
| 19:18 | ynniv | instead of being a backstop for an unwinding stack, they let you change state and resume |
| 19:18 | antares_ | jonaskoelker: `handler` is OK to use but if you want a local name to use for a handler fn, f (for function) is quite common |
| 19:18 | antares_ | jonaskoelker: there are alternative ways to acquire it, lets put it that way. I do not encourage them but it's ultimately up to you :) |
| 19:21 | jonaskoelker | hm; I should probably read up on CL's condition system. I hear good things about it |
| 19:23 | ynniv | it's one of the few things missing from clojure |
| 19:23 | technomancy | ynniv: it's been implemented |
| 19:23 | jonaskoelker | that and a parser generator =) |
| 19:23 | technomancy | but nobody uses it |
| 19:24 | ynniv | technomancy: do you have more info? |
| 19:24 | jonaskoelker | neocons?? |
| 19:24 | lazybot | jonaskoelker: Definitely not. |
| 19:24 | jonaskoelker | -.- |
| 19:25 | technomancy | ynniv: it's called error-kit |
| 19:25 | foxdonut | weavejester: was looking at Ragtime earlier. Quick question: although all the pieces are already there, there doesn't seem to be a single point of entry to run a series of migrations but checking the database to see which ones have already been executed. Am I missing something? |
| 19:25 | foxdonut | technomancy: you were right, Ragtime is a nice option. |
| 19:25 | technomancy | good! =) |
| 19:26 | weavejester | foxdonut: I believe that's the "apply-new" strategy. |
| 19:27 | jonaskoelker | (into 'bed /me) |
| 19:27 | weavejester | foxdonut: So: (migrate-all migrations strategy/apply-new) |
| 19:28 | foxdonut | weavejester: as my 5-year-old daughter would say, "sweeeet!" Thank you! |
| 19:28 | weavejester | foxdonut: Take a look at: https://github.com/weavejester/ragtime/blob/master/ragtime.core/src/ragtime/strategy.clj |
| 19:29 | weavejester | foxdonut: That lists the three different ways migrations can be applied. If you can think of any more, let me know :) |
| 19:29 | foxdonut | weavejester: excellent. I'm pretty sure apply-new is what I'm looking for. thanks again--much appreciated. |
| 19:32 | foxdonut | weavejester: the other part I am having trouble with, but this is likely my not knowing clojure syntax for protocols.. how do I do (def db (ragtime.sql.database.SqlDatabase. {:classname .. :subprotocol ..})) instead of each parameter as separate args? |
| 19:32 | foxdonut | also I can't seem to be able to require or use SqlDatabase to use (SqlDatabase. ...), only able to use fully qualified name |
| 19:33 | weavejester | foxdonut: If you're using Clojure 1.3 or above, records create two functions: ->SqlDatabase and map->SqlDatabase |
| 19:34 | weavejester | foxdonut: You'd want (map->SqlDatabase {:classname … :subprotocol …}) |
| 19:35 | weavejester | foxdonut: Only the ->Record or map->Record functions are created with the namespace. If you want to use the record as a class, e.g. using Record., then you need to import it. But ->Record or map->Record should probably be preferred. |
| 19:35 | ynniv | technomancy: I think that I saw error-kit before. Not sure if I forgot about it because it doesn't get much use, or because most of my exceptions come out of Java libs. |
| 19:35 | foxdonut | weavejester: nice, let me try it out.. |
| 19:40 | foxdonut | weavejester: the protocol syntax works, but the apply-new strategy doesn't seem to work as I expect.. meaning if I call it on every webapp startup, first time it runs the migrations, the second time I expect it not to try to run them again.. but it runs them again and fails with "table already exists" |
| 19:43 | foxdonut | weavejester: perhaps an error on my part.. here's what I'm trying: https://www.refheap.com/paste/2643 |
| 19:45 | weavejester | foxdonut: Hm... |
| 19:45 | weavejester | foxdonut: What does the content of the ragtime_migrations table look like? |
| 19:46 | foxdonut | weavejester: create-bookmark-table|1336433877972 |
| 19:47 | weavejester | foxdonut: What happens if you call (applied-migrations sql-db) ? |
| 19:48 | symbole | Does Clojure have a set of unit tests for its conrrency abstractions? |
| 19:48 | foxdonut | weavejester: bookmarksite.server=> (applied-migrations sql-db) => (nil) |
| 19:50 | weavejester | foxdonut: Try calling (remember-migration migration-create-bookmark-table) |
| 19:51 | weavejester | foxdonut: Ragtime's a work in progress, so it's not as smooth as it could be. |
| 19:51 | foxdonut | weavejester: no problem, I understand, and I appreciate your help |
| 19:51 | foxdonut | weavejester: that last returns {"create-bookmark-table" {:id "create-bookmark-table", :up #<config$create_bookmark_table bookmarksite.database.config$create_bookmark_table@1909385>, :down #<config$drop_bookmark_table bookmarksite.database.config$drop_bookmark_table@12ca580>}} |
| 19:52 | weavejester | Oh, I meant, try calling it before running (create-schema-if-necessary) |
| 19:52 | foxdonut | oic, ok let me try |
| 19:52 | weavejester | foxdonut: It registers the function as a known migration |
| 19:54 | foxdonut | weavejester: indeed that fixes the problem |
| 19:54 | weavejester | foxdonut: I had some plans for a defmigration that would make things easier, adding the :id and remember-migration in automatically. |
| 19:55 | foxdonut | weavejester: nice.. any reason why migrate-all wouldn't imply to remember each migration? |
| 19:56 | weavejester | foxdonut: It does, but I think the order is a little wrong. |
| 19:57 | foxdonut | weavejester: hmm, I think I see what you mean.. |
| 19:59 | weavejester | foxdonut: It calls remember-migration each time migrate is called, but I think migrate-all should register all the migrations before it starts to apply them. |
| 19:59 | weavejester | foxdonut: Like: (doseq [m migrations] (remember-migration m)) |
| 20:00 | foxdonut | weavejester: right, otherwise the strategy decides whether to run migrate, before the migration is registered |
| 20:01 | weavejester | foxdonut: Exactly. It's a bug, I think. |
| 20:01 | foxdonut | weavejester: would you like me to try the change, test it, send you a pull request? |
| 20:01 | weavejester | foxdonut: Please do |
| 20:02 | foxdonut | weavejester: ok, will do. again, thanks for your help, I appreciate it! |
| 20:02 | technomancy | weavejester: sorry I dropped the ball on that whole ragtime thing |
| 20:02 | weavejester | foxdonut: No problem! Sorry about the rough state of ragtime. I haven't yet gotten onto migrations in my app, so I've yet to work on it recently! |
| 20:02 | technomancy | might end up back on clojars soon; will see if we can give it a spin there |
| 20:03 | weavejester | technomancy: Hum? I haven't looked at it recently either, so no need to apologise! |
| 20:03 | dabd | what is the functional idiom for taking numbers from a list [1 2 7 10 5 4] while the sum of those elements is inferior to a given value? I'm trying to use take-while but i cannot figure how to keep the sum without using atom |
| 20:04 | amalloy | &(doc reductions) |
| 20:04 | lazybot | ⇒ "([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init." |
| 20:04 | hiredman | inferior? you mean less than? |
| 20:04 | foxdonut | weavejester: as technomancy said earlier today, the other migration libs seem to try to do too much, and I agree, yours is the cleanest one |
| 20:06 | foxdonut | weavejester: gotta run now to put the kids to bed-- I'll be in touch. |
| 20:06 | weavejester | foxdonut: Glad you like it :) |
| 20:07 | amalloy | &(map second (rest (take-while (fn [[sum num]] (< sum 21)) (reductions (fn [[sum num] x] [(+ sum x) x]) [0 0] [1 2 7 10 5 4])))) ;; dabd? |
| 20:07 | lazybot | ⇒ (1 2 7 10) |
| 20:07 | foxdonut | best part of clojure! all these libraries that are devoid of cruft. |
| 20:08 | emezeske | amalloy: I'm so glad that you keep reminding me about reductions... There are so many places where it makes for simple solutions |
| 20:09 | dabd | amalloy: thanks. reductions seems useful |
| 20:29 | rhc | do let bodies have an implict do? |
| 20:29 | nDuff | rhc: yes |
| 20:33 | rhc | nDuff: thanks |
| 20:34 | rhc | these "Evaluation aborted" errors are driving me nuts, can't figure out where the crash is occuring |
| 20:34 | muhoo | hehe, i find i'm using (vector ) and (hash-map) instead of {} and [] so that i don't end up matching up crap at the end of functions that look like javascript,i.e. ]}])]) |
| 20:34 | Frozenlock | I have a problem here... I just moved from Win7 to Ubuntu, and (.getHostAddress (java.net.InetAddress/getLocalHost)) doesn't work in the same way. I was expecting to get my machine IP (the one given by my router), but instead got 127.0.0.1 |
| 20:34 | muhoo | )))) is cleeeener |
| 20:35 | emezeske | muhoo: you're not using a paredit mode of some sort? |
| 20:35 | TimMc | muhoo: Terrible. |
| 20:38 | muhoo | what drives me nuts about paredit is no freedom of choice. if i want to fix or edit stuff, it doesn't let me |
| 20:38 | Frozenlock | Any advice on how to obtain my machine IP from clojure? |
| 20:39 | muhoo | or if i screw up and put a ( in the wrong place, it puts a ) and won't let me delete it. |
| 20:39 | beffbernard | muhoo: C-u del |
| 20:40 | muhoo | hm, must try, thanks |
| 20:40 | amalloy | my problem with cars is if i accidentally turn them upside down they're too heavy to flip over, so i just walk everywhere |
| 20:40 | beffbernard | C-q ( to insert paren |
| 20:40 | emezeske | muhoo: I dunno about emacs, but I use paredit in vim and it's very easy to tell it "I know what the hell I'm doing, so let me" |
| 20:41 | amalloy | it's not really quite the right analogy, but my point is paredit actually gives you faster/better ways to fix your problems, so the fact that it prevents (or makes difficult) the slow ways is not really a sticking point |
| 20:42 | beffbernard | amalloy: After paredit, I can never see C-k in the same light again |
| 20:42 | beffbernard | :*( |
| 20:42 | amalloy | eh? |
| 20:43 | beffbernard | I miss C-k in any other mode |
| 20:43 | wei_ | hi, is there a way to change the agent state in its error-handler? I want to store the error in the agent state without calling send or send-off, which won't work since the agent is already failed |
| 20:43 | amalloy | beffbernard: C-M-k |
| 20:43 | amalloy | works in most modes |
| 20:43 | beffbernard | :O |
| 20:45 | beffbernard | amalloy: not quite the same |
| 20:45 | amalloy | no |
| 20:45 | beffbernard | almost like M-d in java-mode |
| 20:45 | amalloy | but it gets you the balanced pairs, which is the important part IME |
| 20:45 | clojurebot | You don't have to tell me twice. |
| 20:46 | amalloy | i rarely really care about C-k except as a lazier way to type C-M-k a few times |
| 20:47 | muhoo | i tend to do C-M-space, then C-w |
| 20:47 | beffbernard | I used to use C-k constantly… it's like a shotgun approach.. it was almost faster if I accidently deleted a few things I didn't want and retype them |
| 20:47 | muhoo | on mine, C-k is kill line, i use that in just about every mode |
| 20:48 | gfredericks | amalloy: glad I saw that. I just learned about C-M-k |
| 20:48 | muhoo | or "D" if i happen to be in vim. |
| 20:49 | beffbernard | so who else is trying these commands? |
| 20:49 | beffbernard | these are gold |
| 20:50 | beffbernard | muhoo +1 for C-M-space |
| 20:50 | amalloy | beffbernard: hit it a few more times to highlight more sexps |
| 20:53 | mebaran151 | anybody know a good wsdl web services api for Clojure? |
| 20:54 | beffbernard | yeah I noticed that |
| 20:54 | beffbernard | good stuff |
| 20:54 | muhoo | C-M-space C-x C-x, in particular |
| 20:55 | muhoo | "where the hell does this form end???" |
| 20:55 | amalloy | i dunno, i just use C-M-f |
| 20:55 | amalloy | mucking with point and mark for that seems like wasted effort |
| 20:57 | beffbernard | Typing C-M all the time can't be too healthy |
| 20:57 | amalloy | surely you have caps-lock mapped to ctl, though. it's not really that bad as long as you're not moving your pinky way down there |
| 20:58 | muhoo | technomancy: my daughter and her friends are obsessed with moustaches for some reason. so i printed this out for her: http://bace.s3.amazonaws.com/moustache-obsession.jpg |
| 20:59 | beffbernard | Yes, I do. it's the thumb stretch for meta that's annoying me. |
| 20:59 | beffbernard | Also mac keyboards have meta in a real awkward spot |
| 21:00 | muhoo | beffbernard: getcha one of these then: http://upload.wikimedia.org/wikipedia/commons/4/47/Space-cadet.jpg |
| 21:00 | muhoo | even has a "like" and "unlike" key for using facebook |
| 21:01 | gfredericks | greek? top? |
| 21:02 | gfredericks | oh greek. I see. |
| 21:02 | beffbernard | holy crap, that's old |
| 21:02 | gfredericks | oh a macro key for clojure |
| 21:02 | amalloy | oh, yeah. on the rare occasions i use a mac i swap meta/cmd |
| 21:02 | beffbernard | haha waht's a rub out? |
| 21:03 | beffbernard | muhoo: ^ |
| 21:03 | amalloy | beffbernard: delete/backspace. the terminology was still in flux back then |
| 21:04 | beffbernard | fancy |
| 21:04 | amalloy | (and actually so was the technology. some non-erasable media, like punched cards, you would write a "rub out" after the character you wanted to erase |
| 21:05 | beffbernard | immutable if you will |
| 21:05 | Bretzky | typematrix is the beset imo |
| 21:06 | beffbernard | amalloy: that's pretty interesting; I would not have know that otherwise |
| 21:07 | amalloy | all hearsay, of course; i'm not old enough to have lived through those days |
| 21:11 | creese | Having an issue with a jar. Main takes a number as an argument. Works fine form the REPL, but when I try to run the uberjar, I get |
| 21:11 | creese | ja |
| 21:12 | creese | java.lang.String cannot be cast to java.lang.Number (presumably because on the command line the number is now text) |
| 21:12 | beffbernard | ,(doc read-string) |
| 21:12 | clojurebot | "([s]); Reads one object from the string s" |
| 21:13 | creese | so I need to assume its a string? will it still work from the repl or do I need to deploy two versions now? |
| 21:13 | beffbernard | I'm assuming you are calling your main method right? |
| 21:14 | beffbernard | If so, the args will be strings |
| 21:14 | creese | why does it work from the repl without read-string then? |
| 21:15 | beffbernard | you're passing an int in the repl |
| 21:17 | brainproxy | anyone here know if it's possible to specify the JIT type (i.e. client or server) when firing up the JVM from c++ with JNI_CreateJavaVM? |
| 21:18 | brainproxy | the code I have to do that does accept options for the vm, but barfs when I try passing -server or -client as an option... having trouble hunting down the answer |
| 21:25 | muhoo | i think i'm seeing the benefit of using this nosql stuff. instead of the real core of the app being in sql, i'm writing it in clojure instead |
| 21:26 | muhoo | if i used an sql back-end, i'd end up writing most of the business end of it *in* sql. |
| 21:33 | emezeske | muhoo: I don't think there's any reason you couldn't do that with sql |
| 21:33 | emezeske | muhoo: AFAIK, the nosql benefits are mostly performance/scalability related |
| 21:41 | muhoo | that, and also the db's are schemaless |
| 21:42 | emezeske | Well, you could always just create a key/value table in a sql database and throw blobs of data in the value column |
| 21:42 | emezeske | Not that I recommend that, of course :) |
| 21:42 | muhoo | i could do that, and i've seen that (like how android uses sqlite), but old habits die hard ;-) |
| 21:43 | muhoo | this has really stretched my brain, it's been very difficult. but i'm seeing some benefit now. |
| 21:43 | emezeske | I was just pointing out that nosql is (in my mind) more for performance characteristics than being easier to program |
| 21:43 | muhoo | true |
| 21:44 | emezeske | Also, it has some big drawbacks if you happen to be dealing with data that is, in fact, relational |
| 21:44 | technomancy | muhoo: that's hilarious; love it |
| 21:44 | muhoo | technomancy: you're welcome :-) |
| 21:44 | muhoo | actually, thank you for that great graphic |
| 21:44 | muhoo | did you draw it? |
| 21:44 | technomancy | my brother-in-law made it |
| 21:44 | muhoo | he's good. |
| 21:45 | technomancy | he does game scene art; hoping to move into concept art |
| 21:46 | technomancy | also did the Pindah logo: https://github.com/mirah/pindah |
| 21:47 | muhoo | nice, alien basketball |
| 22:11 | Frozenlock | I've made a function to get my IP on Ubuntu (normal InetAddress/getLocalHost doesn't work on this OS. Well it works, but not as I was expecting). Any suggestions? It seems really big for such a trivial task: http://pastebin.com/JpSR5SN3 |
| 22:13 | jweiss | anyone ever have lein run *really* slowly, and get a thread dump showing it's stuck at leiningen.util.file$delete_file_recursively.doInvoke? seems to be recursively deleting files, but my hard drive activity is pretty much zero. cpu at 100% lein 1.7.1 |
| 22:14 | jweiss | i have had it do this for 30+ seconds, but now it's been several minutes, my project is not that big, <100 files including source and libs. |
| 22:39 | technomancy | jweiss: that sounds like a bug we had in 1.7.0, but it should be fixed in 1.7.1 |
| 22:40 | technomancy | do you have a lot of .class files? |
| 22:41 | jweiss | technomancy: i have 1381. i don't know if that's a lot, it includes all the deps' classes |
| 22:42 | technomancy | kind of a lot, yeah =\ |
| 22:42 | technomancy | a bug in 1.7.0 caused there to be a GC forced in between deleting each file |
| 22:42 | jweiss | technomancy: huh, i ran lein upgrade earlier, and saw it download 1.7.1, but i still have 1.7.0 |
| 22:42 | technomancy | ah... odd |
| 22:42 | jweiss | let me try that again :) |
| 22:43 | jweiss | oh no wait, that was on my laptop. sorry, bad memory on my part :) |
| 22:44 | technomancy | cool |
| 22:44 | jweiss | works better now, thanks technomancy |
| 22:47 | technomancy | great |
| 22:49 | jweiss | is 1300 classes really a lot? considering every function in every lib that gets loaded (both anonymous and named) has a class, that doesn't seem like a lot at all. |
| 22:51 | tomoj | that's the slow clean bug? |
| 22:52 | tomoj | (missed the question) |
| 22:52 | jweiss | tomoj: yep |
| 22:52 | jweiss | now compiling seems fairly slow |
| 22:53 | jweiss | takes about 45 seconds to recreate those 1300 classes, seems like javac would be much faster, but i probably can't compare javac to the clojure compiler :) |
| 22:54 | jweiss | what makes me suspicious that the compiling is not going as fast as it could, is the 5% cpu utilization. |
| 22:55 | jweiss | it seems to be all disk activity, but there's no way the disk should take 45 seconds to write 6.5mb of class files. |
| 23:05 | echo-area | Does anyone here use aleph (https://github.com/ztellman/aleph)? The compilation of code using it is _very_ slow. Am I doing something wrong? |
| 23:09 | echo-area | And the java compiling process uses more than 200 MB memory |
| 23:25 | tomoj | I've noticed slowdowns from aleph too |
| 23:26 | tomoj | no clue why |
| 23:28 | echo-area | I guess something is causing the java process using very large memory usage |
| 23:28 | echo-area | and that slows down the compilation |
| 23:57 | felideon | what are the rules of hyphen motion in clojure, with regards to ? and predicate functions |
| 23:58 | felideon | long-predicate-name? |
| 23:58 | felideon | or long-predicate-name-? |