2011-12-30
| 00:20 | emezeske | Any clojurescript compiler people in here? |
| 00:38 | fryguy | is it normal for "lein repl" to take 5+ seconds to start? |
| 00:39 | technomancy | fryguy: yeah, you'll want to see if you can install a client JVM; it starts a lot faster than the server JVM |
| 00:39 | fryguy | what is a lot faster in this case? |
| 00:40 | technomancy | the time it takes to launch the process |
| 00:40 | fryguy | i mean how much faster |
| 00:40 | fryguy | also: |
| 00:40 | fryguy | ~% java -version |
| 00:40 | clojurebot | excusez-moi |
| 00:40 | fryguy | java version "1.6.0_22" |
| 00:40 | fryguy | OpenJDK Runtime Environment (IcedTea6 1.10.4) (ArchLinux-6.b22_1.10.4-1-x86_64) |
| 00:40 | fryguy | OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode) |
| 00:40 | technomancy | on an SSD with a weak processor I get the repl coming up in about 0.7s |
| 00:43 | technomancy | a weak cpu being a 1.8 GHz core 2 duo |
| 00:43 | fryguy | trying to find out how to get a client vm now |
| 00:44 | technomancy | you'll need it compiled for 32-bit for starters |
| 00:44 | fryguy | there's not 64-bit client vm? |
| 00:45 | technomancy | right |
| 00:45 | fryguy | that sucks |
| 00:46 | technomancy | yeah, I need to put together some docs for that; maybe on the wiki |
| 00:47 | technomancy | it used to be easy to get a 32-bit oracle JDK on ubuntu, but for some reason the openjdk builds are only available as 64-bit |
| 00:49 | fryguy | trying to find them for my distro now, PITA |
| 00:50 | technomancy | actually sorry; the 0.7s number was the boot time for lein itself; the time it takes to start a repl will be longer |
| 00:50 | technomancy | still, it'll definitely be better than 5s |
| 00:53 | fryguy | i guess I can just live with poor start times for now |
| 00:53 | fryguy | not like i'll be starting repls all of the time, if I do this right i'll have my repl up and connected to my text editor and that's it |
| 00:54 | technomancy | yeah, that's basically the reason I haven't bothered getting set up with a client JVM; I just don't start a new process very often. |
| 00:55 | fryguy | so i've got "clj" as an executable, and lein, will get interaction with text editor next. Hopefully that's all I'll need in the short term to get things done |
| 00:56 | amalloy | i suggest deleting clj with a flamethrower. lein repl will just make you happier |
| 00:56 | amalloy | there are people who disagree with me here, but most of the time when you want a repl, use lein |
| 00:57 | technomancy | amalloy: there are? |
| 00:57 | fryguy | so, here's a silly question, if I do JUST lein self-install, and nothing else, does that give me clojure too? or do I need clojure before I use lein? |
| 00:57 | amalloy | i've heard rumblings once or twice, technomancy |
| 00:57 | fryguy | i installed clojure from my distro's package repository |
| 00:57 | technomancy | rumblings, you say? |
| 00:57 | amalloy | i forget from who; some heretics |
| 00:57 | technomancy | ~guards |
| 00:57 | clojurebot | SEIZE HIM! |
| 00:58 | technomancy | fryguy: yeah, that's usually not very useful |
| 00:58 | technomancy | common mistake |
| 00:59 | fryguy | so I JUST need lein? |
| 00:59 | fryguy | (and a jdk obviously), nothing else? |
| 01:00 | technomancy | plus whatever it takes to make your editor work with clojure |
| 01:00 | fryguy | right |
| 01:00 | fryguy | i thought lein would be more analogous to cabal from haskell |
| 01:01 | amalloy | does he actually need a jdk? i kinda thought clojure only needed a jre but haven't really investigated |
| 01:02 | technomancy | depends on if you want a debugger and/or javca |
| 01:02 | technomancy | *javac |
| 01:02 | amalloy | oh right, durn that javac |
| 01:05 | technomancy | for some reason people tend to use it |
| 01:05 | technomancy | no idea why |
| 02:09 | emezeske | Okay, I've encountered a situation where I can "lein run ..." my project, and it throws an exception. |
| 02:09 | emezeske | Then, if I touch a particular .clj file in my src/ directory |
| 02:10 | emezeske | And "lein run ..." again, no exception is thrown and it works just fine |
| 02:10 | emezeske | (and I mean touch as in the unix command; no change to its contents) |
| 02:10 | emezeske | This is really hurting my brain... |
| 02:20 | simonadameit | emezeske: strange situation… though it doesn't sound totally inconceivable to me.. dont those build tools decide, what to recompile based on last modification date? |
| 02:21 | emezeske | simonadameit: Yeah, I assume so |
| 02:21 | emezeske | simonadameit: I noted all the timestamps on the *.class files, though, and then touched my special file and reran things |
| 02:22 | emezeske | simonadameit: None of the *.class files were modified |
| 02:22 | emezeske | So I wonder if maybe making the file newer than it's *.class files makes clojure interpret it instead of using the .class file on disk |
| 02:23 | emezeske | The weird thing is, though, that I'm not changing contents of the .clj file, so it should work the same from a .class or interpreted from a .clj |
| 02:27 | emezeske | Weird... it looks like the {:macro true} metadata is not being stored in the class files |
| 02:27 | emezeske | When I run things without AOT, though, the macros have ^{:macro true} |
| 02:30 | simonadameit | emezeske: sounds like that could be a clojure bug? |
| 02:30 | simonadameit | emezeske: I wish you good luck, gotta go to work |
| 02:30 | emezeske | simonadameit: It's beginning to look that way... X.X |
| 02:30 | emezeske | simonadameit: thanks for the input!! |
| 02:32 | amalloy | emezeske: whoa, that sounds pretty weird. what was happening that made you start looking at macro meta? |
| 02:32 | emezeske | amalloy: uh, I don't remember. I've been digging at this for like 20 hours |
| 02:32 | emezeske | There's problems with using the clojurescript compiler when it's AOT compiled |
| 02:32 | emezeske | sometimes |
| 02:33 | emezeske | And it's due to the way it determines "what's a macro" |
| 02:33 | emezeske | It checks the metadata for :macro=true |
| 02:33 | ibdknox | why are you trying to aot compile the cljs compiler? |
| 02:33 | emezeske | I'm trying to package it up as an uberjar |
| 02:33 | amalloy | ibdknox: i send IRC msgs to my IRC client to ask it to talk to y'all |
| 02:34 | ibdknox | amalloy: hm? |
| 02:34 | emezeske | Anyway, the {:macro true} metadata is apprently not stored in AOT class files |
| 02:34 | amalloy | i was going for a yo dawg thing: compiling the compiler, /msging the irc client...didn't work out that well |
| 02:35 | ibdknox | haha |
| 02:35 | ibdknox | :p |
| 02:35 | emezeske | I guess the metadata is not stored at all, and just the basic stuff is regenerated when loading the class files? |
| 02:35 | emezeske | (by basic stuff I mean line no, file, etc) |
| 02:35 | emezeske | Wait, that doesn't make sense... The line-no/file would need to be stored... |
| 03:34 | kral | morning |
| 03:35 | Scriptor | marnin |
| 05:47 | przemek_ | Hi, I have a question. I'm wondering what is the idiomatic way to create a new map out of some other map in a way that we want to modify some of its values. |
| 05:48 | przemek_ | say we have a map {:a {:foo 1 :bar 2} ... } and we need to modify :foo for some entries and we want to produce a new map |
| 05:49 | przemek_ | in Scala there is something like "yield" |
| 05:49 | przemek_ | so I can get to entry k/v and can yield value(s) so at the end it is the final new map |
| 05:50 | przemek_ | no idea how to accomplish this simply in Clojure |
| 05:51 | przemek_ | any ideas highly appreciated :) |
| 05:51 | raek | przemek_: check out the *-in functions: update-in, assoc-in, get-in |
| 05:52 | raek | ,(update-in {:a {:foo 1}} [:a :foo] inc) |
| 05:52 | clojurebot | {:a {:foo 2}} |
| 05:53 | przemek_ | yeah |
| 05:53 | przemek_ | thanks a lot! |
| 06:02 | raek | przemek_: it's usually simpler to answer a "how do I ___?" question if you can show an example input and an example of the desired output |
| 06:06 | przemek_ | ok |
| 06:07 | przemek_ | actually it still does not seem simple to me |
| 06:07 | przemek_ | Given: {"foo" {:x ... :y ...} "bar" {:x ... :y ...} ...} |
| 06:07 | przemek_ | I want to have all entries that match some predicate to have :x value modified, say changed to 1: |
| 06:07 | przemek_ | {"foo" {:x 1 :y ...} "bar" {:x 1 :y ...} ... } |
| 06:07 | przemek_ | note I don't know the key name/position |
| 06:08 | przemek_ | have read http://clojuredocs.org/clojure_core/clojure.core/update-in and still not sure... |
| 06:12 | raek | I think this is easier to do if you break down the problem into smaller pieces |
| 06:12 | przemek_ | surely, but still it is just 1 level of nesting and a simple map |
| 06:13 | raek | (defn update-outer-map [m] (into (empty m) (for [[key val] m] [key (update-inner-map val)]))) |
| 06:13 | raek | (defn update-inner-map [m] (if (pred? (:x m)) (assoc m :x 1) m)) |
| 06:13 | mageslayerden | Hi guys. I am trying emacs+slime+clojure. And something breaks :). Maybe someone knows the magic spell? I see only - error in process filter: Elisp destructure-case failed: (:write-string "2 " :repl-result) |
| 06:14 | mageslayerden | it's when I am trying to eval (+ 1 1) |
| 06:14 | przemek_ | it kinda makes sense :) I will check that out |
| 06:14 | mageslayerden | I am using slime from macmalade repo :) |
| 06:17 | raek | przemek_: but of course you can do all this in one function. just inline update-inner-map into the for |
| 06:18 | raek | in this case update-outer-map could also have been written (defn update-outer-map [m] (zipmap (keys m)) (map update-inner-map (vals m)))) |
| 06:18 | raek | since you only want to change the values of the outer map |
| 06:35 | raek | mageslayerden: make sure you don't have slime installed in your OS package manager (e.g. apt-get) and that you don't have slime-clj, swank-clj, and swank-clojure installed in emacs |
| 06:36 | mageslayerden | I uninstalled official slime. The problem is without swank-clj - slime does not start, just emits another error |
| 06:36 | raek | the only clojure related elisp package you should have in a basic setup is clojure-mode (and if you don't use clojure-jack-in: also slime and slime-repl) |
| 06:37 | mageslayerden | slime and slime-repl have been installed from elpa as well |
| 06:37 | raek | mageslayerden: swank/slime-clj is an alternative implementation of swank and slime. do not mix them with the usual ones |
| 06:38 | raek | that project has been renamed, but the versions with the old names are still available |
| 06:38 | mageslayerden | Ok. I got it. btw. is it possible to unload slime-clj without restarting emacs? |
| 06:40 | raek | basic setup: clojure-mode (and possibly slime and slime-repl) on the emacs side and swank-clojure on the leiningen side |
| 06:41 | antares_ | vijaykiran: hey |
| 06:41 | mageslayerden | ok. I'll to restart emacs to test it now. Thanks a lot |
| 06:41 | raek | starting swank-clojure from emacs is a very outdated approach (not counting features that use lein to do it, like clojure-jack-in and various lein elisp packages) |
| 06:43 | vijaykiran | antares_: Hi |
| 06:43 | antares_ | vijaykiran: you had a question in #travis, correct? |
| 06:44 | mageslayerden | raek: without slime-clj, I get - byte-code: Symbol's function definition is void: slime-buffer-name |
| 06:44 | mageslayerden | |
| 06:44 | vijaykiran | antares_: yeah :) |
| 06:45 | antares_ | vijaykiran: you problem seems to be what several people had with re-published artifacts |
| 06:45 | antares_ | vijaykiran: on travis-ci.org, dependencies are installed from scratch. Locally it is usually not the case. Try (re)moving ~/.m2 and see if you can reproduce the issue locally, then :exclude clojure dependency like this: https://github.com/michaelklishin/monger/blob/master/project.clj#L7 |
| 06:46 | mageslayerden | raek: here is my emacs+slime config - http://pastebin.com/UD3rLPhP |
| 06:48 | vijaykiran | antares_: oh .. thanks a lot, I don't have any tests but I'll try your tip |
| 06:49 | antares_ | vijaykiran: hm, what do you mean you don't have any tests? |
| 06:49 | antares_ | vijaykiran: then why put your project on travis-ci.org? :) |
| 06:49 | raek | mageslayerden: when you install slime or when you use it? |
| 06:49 | raek | it is normal to get these kind of errors when installing |
| 06:49 | vijaykiran | antares_: just to "test" :) |
| 06:49 | mageslayerden | when? just 2 hours ago :) |
| 06:50 | antares_ | vijaykiran: ok. Well, one issue is already revealed :) |
| 06:51 | mageslayerden | sorry. I misunderstood you. This error is shown when I am starting emacs. |
| 06:54 | vijaykiran | antares_: I've another question - do you know if there's an easy way to use test database from travis (Clojure) ? |
| 06:54 | raek | mageslayerden: sorry, but I don't know what to do except for trying commenting out lines in the .emacs.d file |
| 06:55 | antares_ | vijaykiran: we provide mysql, postgresql, sqlite, mongodb, riak, couchdb, redis and some projects download & install neo4j and so on |
| 06:55 | antares_ | vijaykiran: http://about.travis-ci.org/docs/user/database-setup/ |
| 06:55 | mageslayerden | raek: looks like like it is related to hippie-expand. I removed hippie-expand, but the error with eval is the same |
| 06:55 | antares_ | vijaykiran: create your databases in before_script, that is usually it |
| 06:56 | raek | mageslayerden: I got to go now, but you can read more in the official docs for swank-clojure: https://github.com/technomancy/swank-clojure |
| 06:56 | mageslayerden | raek: thanks, I'll try |
| 06:56 | raek | if you are going to follow a guide, this is the *only* one you should look at |
| 06:56 | vijaykiran | antares_: yes, saw that page. But was wondering if different config is needed for clj apps |
| 06:56 | antares_ | vijaykiran: no |
| 06:57 | mageslayerden | raek: I tried maybe a dozen already :), but thanks :) |
| 06:57 | vijaykiran | antares_: okies .. thanks, will RTFM and drop by #travis if I'm stuck! |
| 07:00 | antares_ | vijaykiran: for example, I have https://github.com/michaelklishin/monger and https://github.com/michaelklishin/neocons on travis. https://github.com/doctrine/dbal/blob/master/.travis.yml is a good example of testing against multiple relational databases. |
| 07:01 | antares_ | vijaykiran: cool, let us know what you think :) |
| 07:18 | benoyst | just a stupid question, but why clojure.xml/parse does not accept a string (except as uri) but only files? |
| 07:19 | benoyst | I've a function returning a java.lang.String which happens to be an xml doc but parse refuses to munch it. |
| 07:20 | benoyst | I'm sure it's very basic but I can't get out of this issue. |
| 07:33 | cemerick | ,(clojure.xml/parse (java.io.ByteArrayInputStream. (.getBytes "<html></html>" "UTF8"))) |
| 07:33 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.xml> |
| 07:33 | cemerick | ,(require 'clojure.xml) |
| 07:33 | clojurebot | nil |
| 07:33 | cemerick | ,(clojure.xml/parse (java.io.ByteArrayInputStream. (.getBytes "<html></html>" "UTF8"))) |
| 07:33 | clojurebot | {:tag :html, :attrs nil, :content nil} |
| 07:33 | cemerick | benoyst: ^^ |
| 07:34 | benoyst | cemerick: just for the records: big fan! |
| 07:34 | benoyst | this is the offending code: http://maleloria.org/temp/hard-times-with-xml.txt |
| 07:35 | benoyst | oh. ByteArrayInputStream. |
| 07:35 | benoyst | I guess I dit not get something right here. |
| 07:35 | benoyst | (but I thought I did that in my code) |
| 07:37 | cemerick | benoyst: what's the actual error you're getting? |
| 07:40 | benoyst | cemerick: java.lang.String cannot be cast to clojure.lang.IFn. I guess there are too many () somewhere? |
| 07:41 | cemerick | benoyst: from-raw-msg-to-details calls my-saml-xml, which looks to be a string. |
| 07:44 | benoyst | oh yes, but (parse-saml-message mysamlxml) throws the IFn error ... before even playing with the from-... |
| 07:44 | benoyst | (I'm converting a base64xml to xml to get some data in it) |
| 07:45 | cemerick | benoyst: can you paste the error + stack trace? |
| 07:47 | benoyst | sure! |
| 07:54 | benoyst | cemerick: I'm very grateful for your time. I've updated my file here: http://maleloria.org/temp/hard-times-with-xml.txt |
| 07:54 | benoyst | (repl session + strack trace) |
| 07:56 | Somelauw | Is there some way to get slime/leiningen/clojure/emacs outside a Java heap space error without restarting emacs? |
| 07:56 | Somelauw | I got myself into infinite a recursion without TR. |
| 07:57 | cemerick | benoyst: oh: (saml-xml) |
| 07:58 | benoyst | (big shame on me in 3, 2, 1...)? |
| 07:58 | benoyst | oh you mean (.getBytes (saml-xml) "UTF-8"))] instead of (.getBytes saml-xml "UTF-8"))] right? |
| 07:58 | cemerick | yes |
| 07:59 | benoyst | yes. |
| 07:59 | benoyst | big shame in me *now* :) |
| 07:59 | benoyst | on |
| 07:59 | cemerick | (foo) invokes foo as a function; since saml-xml is a string, that won't work :-) |
| 08:00 | benoyst | yes! can't believe I made that. Sorry. and *many* thanks for your expert eye on that! |
| 08:00 | cemerick | You're welcome. no need to be sorry :-) |
| 08:00 | benoyst | cemerick: many thanks! |
| 08:05 | benoyst | (much better now!) |
| 08:14 | vijaykiran | is there an easy way to see the dependency tree for a lein project ? |
| 08:15 | cemerick | vijaykiran: lein pom && mvn dependency:tree, assuming you have maven installed |
| 08:15 | Raynes | lein pom && mvn dependency:tree |
| 08:15 | chouser | vijaykiran: the best I've been able to do is trace the load function, so you can see which namespaces are loading which. |
| 08:15 | Raynes | cemerick: Dude. |
| 08:15 | cemerick | A better alternative is incoming |
| 08:15 | cemerick | Raynes: Dude! |
| 08:16 | Raynes | I don't know how your latency made that look, but mine made it appear as if we said that at *exactly* the same time. Like, two a microsecond. |
| 08:16 | Raynes | to* |
| 08:16 | vijaykiran | cemerick: how do I trace - sorry noob here |
| 08:16 | cemerick | trace? |
| 08:16 | clojurebot | trace is http://richhickey.github.com/clojure-contrib/trace-api.html |
| 08:16 | lazybot | Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/trace-api.html and try to stop linking to rich's repo. |
| 08:17 | cemerick | gawd, dueling bots |
| 08:17 | Raynes | Hahaha, clojurebot just got told. |
| 08:17 | chouser | except they're both wrong |
| 08:18 | cemerick | chouser: He lives! I thought you'd abandoned us irc plebs for good. ;-) |
| 08:18 | chouser | https://github.com/clojure/tools.trace |
| 08:19 | chouser | well, I am getting sufficient Clojure fixes at work now. |
| 08:19 | cemerick | Oh, so we were just your fling on the side. I get it. |
| 08:19 | cemerick | :-D |
| 08:20 | chouser | I don't need IRC to stem the gnawing desperate craving for Clojure discussions. |
| 08:20 | cemerick | s'ok, I'm sorta absent these days a bit as well |
| 08:21 | chouser | fling? More like I'm selling now, so don't need my old dealer. |
| 08:22 | Somelauw | Why is this code not lazy? |
| 08:22 | Somelauw | http://pastebin.com/b0QJsDRz |
| 08:25 | chouser | Somelauw: why do you think it isn't? |
| 08:25 | Somelauw | chouser: Executing it results in an infinite loop. |
| 08:26 | Somelauw | Or at least, it hangs. |
| 08:27 | Somelauw | And ends in a heap memory error if I don't stop it. |
| 08:27 | chouser | (first (primes)) returns promptly for me |
| 08:28 | Somelauw | er, my bad |
| 08:29 | chouser | That suggests it actually is lazy, but that copmuting some of the later elements of the seq consumes large amounts of time and memory |
| 08:30 | Somelauw | I tried writing this prime function. Then got a heap error. I restarted emacs and wrote it all over again and this time I forgot to use the take command. |
| 08:32 | Somelauw | chouser: I know this is not the most efficient way. |
| 08:34 | Somelauw | thanks |
| 09:00 | solussd | is there a more straightforward way to splice in a list of arguments to a defrecord than a macro? e.g. If I have a record call Blah that takes 2 args and I have [arg1 arg2], I need (Blah. arg1 arg2) |
| 09:03 | cemerick | solussd: use (->Blah arg1 arg2) |
| 09:04 | solussd | cemerick: but my arg1 and arg2 are in a vector, how do I splice them in w/o a macro? |
| 09:04 | cemerick | (apply ->Blah arg1 arg2) |
| 09:04 | hank_the_hobo | cemerick? I'm a user of nREPL. it says in the docs to contact you on IRC. |
| 09:04 | solussd | (apply ->Blah [arg1 arg2]) |
| 09:05 | solussd | this ->RecordType is new to me, is it new to clojure? |
| 09:05 | cemerick | solussd: yeah, sorry, typing too fast :-) |
| 09:05 | cemerick | solussd: new in 1.3, discussed here http://dev.clojure.org/display/design/defrecord+improvements |
| 09:05 | cemerick | hank_the_hobo: ut-oh :-) |
| 09:05 | cemerick | what's up? |
| 09:06 | solussd | cool thanks! |
| 09:06 | hank_the_hobo | @cemerick. why uh oh. it's nifty and useful and many thanks for that. |
| 09:06 | hank_the_hobo | 1 comment: |
| 09:07 | hank_the_hobo | the latest iteration seems to be introducing a dependency on java.awt for some strange reason. not sure what awt has to do with a REPL |
| 09:07 | hank_the_hobo | I'm using it on Android which has no AWT. is this something that can be factored out into a separate module. |
| 09:08 | cemerick | hank_the_hobo: I think it's more likely that you're doing something to prompt AWT to start up. |
| 09:08 | cemerick | Oh. |
| 09:08 | cemerick | Hrm. |
| 09:09 | hank_the_hobo | it's says java.awt.RenderedImage somewhere in the code if I'm not too tired to tell things apart |
| 09:09 | cemerick | hank_the_hobo: so you're using 0.0.6-SNAPSHOT? |
| 09:10 | hank_the_hobo | not actively but I did a little look ahead |
| 09:10 | cemerick | Yeah. You're right. |
| 09:11 | hank_the_hobo | @cemerick I might have to fork it anyway ... the other problem on android is that threads come with very small default stack sizes so I had to change the part where the executor is init'd with the threadfactory |
| 09:11 | hank_the_hobo | android has 8k by default which is not enough to eval moderately complex expressions |
| 09:11 | hank_the_hobo | so I might fork it anyway |
| 09:12 | cemerick | hank_the_hobo: some fairly significant improvements will be coming to nREPL soon that will make the AWT issue go away. |
| 09:12 | hank_the_hobo | oh |
| 09:12 | hank_the_hobo | ok |
| 09:12 | cemerick | I'm not even sure I'm going to put out a 0.0.6 release |
| 09:12 | hank_the_hobo | well I'm worried for nothing then. |
| 09:12 | cemerick | Probably going to "jump" to 0.1.0 with a new architecture |
| 09:13 | hank_the_hobo | thanks keep up the good work |
| 09:14 | cemerick | hank_the_hobo: a patch to customize the thread stack size would be most welcome, though. |
| 09:15 | cemerick | I might end up changing what you produce so as to satisfy other configuration requirements as well, but I'd at least know what you need on android. |
| 09:15 | hank_the_hobo | @cemerick ok no probs |
| 09:15 | cemerick | heh, or you can just file a bug: http://dev.clojure.org/jira/browse/NREPL |
| 09:15 | cemerick | :-P |
| 09:16 | hank_the_hobo | ah is that how it works ... couldn't find the bug function on github that some other accounts have |
| 09:16 | cemerick | Yeah, nREPL is a contrib project, so everything is in JIRA / confluence. |
| 09:22 | solussd | is (into {} (vec my-record)) the best way to squeeze a hash-map from a record? |
| 09:23 | cemerick | solussd: just (into [] my-record) will do — though worrying about concrete types like that should be a warning signal. |
| 09:24 | solussd | but I want a map |
| 09:24 | cemerick | Records are maps! |
| 09:24 | TimMc | solussd: There are different kinds of maps. |
| 09:24 | solussd | right-- |
| 09:24 | solussd | you had [], I wanted {}, which also works. :) |
| 09:24 | TimMc | ah, into [] <- got it |
| 09:25 | TimMc | solussd: Yes, (into {} ...) is fine. |
| 09:25 | solussd | I'm using (into {} my-record) now, thanks! |
| 09:25 | solussd | I swear that didn't work before… |
| 09:26 | cemerick | TimMc: [] was (another) typo on my part, I still suspect solussd is doing an unnecessary conversion. |
| 09:26 | solussd | is (into {} my-record) ok? |
| 09:26 | TimMc | solussd: What's the use-case here? |
| 09:27 | solussd | I need to pass the contents of a record as a map for :attrs in a map for clojure.xml/emit |
| 09:28 | solussd | so (clojure.xml/emit {:tag :something :attrs (into {} my-record)}) |
| 09:28 | TimMc | And it doesn't treat records as maps? |
| 09:28 | solussd | i thought it didnt-- but then, i also thought the into wasn't working.. (testing...) |
| 09:29 | goodieboy | anyone here use noir? |
| 09:29 | solussd | that works… :D |
| 09:55 | solussd | why doesn't this work? (. java-array length) ? |
| 09:56 | hoeck | solussd: because .length isn't a property or method of java arrays, its java syntax |
| 09:56 | hoeck | solussd: like String.class |
| 09:57 | solussd | oh, ok. Do I have to make it a seq then? |
| 09:57 | solussd | (to get the length) |
| 09:59 | jodaro | you should be able to use count |
| 09:59 | hoeck | solussd: no, (count java-array) does the right thing for you |
| 09:59 | solussd | thanks |
| 10:10 | TimMc | I recently found myself annoyed that Java doesn't have a IntegerNumber marker interface on Long, Integer, Short, Byte, and BigInteger. |
| 10:11 | TimMc | (and similar for the floating-point numbers.) |
| 10:12 | TimMc | Would multimethods (with a derive hierarchy) be an effective way of getting that information? |
| 10:18 | TimMc | $findfn (int-array 5) 5 ; solussd |
| 10:18 | lazybot | [clojure.core/count clojure.core/alength] |
| 10:19 | TimMc | I think alength would be used when performance was essential. |
| 10:20 | solussd | thanks |
| 10:50 | jodaro | woop, my first ANN: http://groups.google.com/group/clojure/browse_thread/thread/7ae3e1926f02b20f |
| 11:17 | TimMc | "ANN"? |
| 11:18 | TimMc | nvm, announcement |
| 11:40 | TimMc | hoeck: I had no idea that was sugar. Array classes are just one big lie, eh? |
| 11:40 | TimMc | s/sugar/syntax/ |
| 11:45 | hoeck | TimMc: they are 'special', I don't like that, no one will notice it except when starting to use clojure |
| 11:55 | solussd | how do I get a sub-array of a plain java array? |
| 12:10 | semperos | solussd: what's your array look like? (gist/pastebin) and do you need to return a Java array, or are you looking to make it a Clojure datastructure? |
| 12:11 | solussd | semipros its for a genetic algorithm where I'm randomly piecing together sub-arrays to form 'children'. Don't need to go back to a clojure data structure |
| 12:11 | solussd | *semperos^ |
| 12:11 | semperos | ok |
| 12:11 | semperos | by sub-array, do you mean you have something like [1 2 [:a :b] 3 4] and you need the [:a :b] ? |
| 12:12 | solussd | well, it's a java character array created like this: (char-array \a \b \c) |
| 12:12 | solussd | I might want just the \b and \c, for example |
| 12:12 | solussd | so, what I need is a sub-array copy function |
| 12:12 | solussd | in java it is System.arraycopy |
| 12:13 | cemerick | solussd: that's what it is in Clojure too ;-) |
| 12:14 | ibdknox | cemerick: I'll get you my feedback by tomorrow, sound good? |
| 12:14 | cemerick | ibdknox: perfect, thanks :-) |
| 12:14 | cemerick | I saw a commit that looks like it fixed the bug I think I found? |
| 12:14 | ibdknox | it wasn't a bug per se, I actually did it on purpose, it was just a dumb decision :) |
| 12:15 | ibdknox | wasn't consistent with everything else |
| 12:15 | ibdknox | so yep! |
| 12:15 | ibdknox | all fixed |
| 12:31 | TimMc | solussd: Why are you using arrays instead of vectors? |
| 12:32 | solussd | performance I guess |
| 12:32 | ibdknox | I missed the beginning of that conversation so I didn't respond with ##(doc subvec) ;) |
| 12:32 | lazybot | ⇒ "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done." |
| 12:32 | ibdknox | hard to beat constant time "copies" |
| 12:33 | ibdknox | if copying is the main overhead |
| 12:33 | solussd | I doubt it is though.. |
| 12:33 | ibdknox | huh? |
| 12:33 | ibdknox | oh |
| 12:33 | ibdknox | yeah, I have no idea what you're doing :) |
| 12:35 | ibdknox | solussd: out of curiosity, did you benchmark the difference between an array solution and a vector one? |
| 12:35 | TimMc | solussd: "performance I guess" <-- if you haven't profiled your code, don't try to optimize |
| 12:35 | ibdknox | that's what I was getting at ^^ |
| 12:35 | solussd | simple example: two parents: 'abcdef' and 'uvwxyz' would make children like: 'abcxyz' 'xyzdef', etc. Need millions of these where I'm taking sub-arrays from each parent and concatenating them together into a new array |
| 12:36 | ibdknox | copying is definitely the overhead then :p |
| 12:36 | solussd | well, the vector solution runs terribly.. looking to try a straight java-array approach |
| 12:37 | ibdknox | are you using seqs? Vectors are really fast, seqs are really slow |
| 12:37 | solussd | well I start with strings that are 'cast' to vecs and then back to strings… that might be part of the problem |
| 12:37 | ibdknox | ah |
| 12:38 | ibdknox | that could do it |
| 12:38 | ibdknox | ,(source subs) |
| 12:38 | clojurebot | Source not found |
| 12:38 | ibdknox | I assume that is really fast ^ |
| 12:39 | ibdknox | do you really need them to be vectors? if you're just doing crossovers, it seems like that would be unnecessary |
| 12:39 | TimMc | solussd: Just keep in mind that subvec and substring hold a reference to the original, preventing garbage collection. |
| 12:40 | ibdknox | that might actually be more memory efficient in the long run if all patterns are just parts of some base set |
| 12:41 | ibdknox | you'd only define that set once, assuming subvec does the smart thing |
| 12:41 | solussd | hmm |
| 12:42 | solussd | it's only the original string that isn't ever collected, i can live with that |
| 12:43 | ibdknox | It'd be easy to find out :) |
| 12:44 | solussd | thanks |
| 12:46 | choffstein | Hello everyone! This is a real, real shot in the dark -- and I know it isn't the right place to ask -- but does anyone have experience in developing a REST API for services that don't have cookie storage (and therefore can't rely on regular session authentication methods)? I could really use some resources on how to implement a secure "authentication key" system. |
| 12:46 | choffstein | Security isn't my forte -- and so far, I am just giving each client a unique key and having them just connect over https with their unique key to identify themselves |
| 12:47 | flazz | is slime-repl for clojure supposed to 'use' clojure.repl? |
| 12:47 | technomancy_ | flazz: most (all?) of the stuff in clojure.repl is obsoleted by slime functionality |
| 12:48 | flazz | technomancy_: what about doc? |
| 12:48 | technomancy_ | flazz: C-c C-d d will handle that |
| 12:48 | technomancy_ | not obsoleted exactly... overshadowed maybe? |
| 12:48 | flazz | technomancy_: omg, nice, thanks |
| 12:48 | technomancy_ | there's a nice reference in the swank-clojure readme |
| 12:50 | ldh | i'm trying to use clojure.test to check existence of all elements in a collection against a set: (are [v] (my-set v) my-collection). however, 'are' wants discrete values and not an explicit collection. how can i expand my-collection to work here? |
| 12:51 | technomancy_ | ldh: (is (every? my-set my-collection)) |
| 12:53 | ibdknox | ldh: (is (every? my-set my-collection) |
| 12:53 | ibdknox | darn |
| 12:53 | ibdknox | beat to the punch :p |
| 12:53 | ldh | great, thanks guys |
| 13:09 | rangen | hi. the screencast about sequences is broken, it only shows for few seconds: http://blip.tv/clojure/clojure-sequences-740581 |
| 13:13 | tmciver | choffstein: I'm a http security newb myself but since you are using SSL, you could use http's Basic Authentication, I think. |
| 13:13 | tmciver | choffstein: I intend to do something like this in a web app I'm working on. |
| 13:14 | tmciver | choffstein: of course the problem with that is there's no good 'log out' mechanism, to my knowledge. |
| 13:15 | technomancy_ | rangen: there's a thread on the mailing list about how to get downloadable versions of the videos from a few weeks ago |
| 13:18 | choffstein | tmciver: Yeah -- yeah, that's an interesting though. But I would definitely want some sort of session timeout |
| 13:18 | choffstein | tmciver: I'm currently in #security where I am getting lots of interesting ideas about using certs for client auth and that sort of stuff |
| 13:19 | tmciver | choffstein: cool |
| 13:20 | tmciver | choffstein: you'll have to let me know what you find; they won't let me in! :( |
| 13:20 | choffstein | No? |
| 13:21 | tmciver | Yeah, I tried to join #security on freenode. says you need to be invited. |
| 13:27 | TimMc | haha |
| 13:28 | TimMc | tmciver: I bet you need to register your nick first. |
| 13:38 | rangen | technomancy: found it, but still no luck. that episode is borken also on itunes version |
| 13:38 | technomancy | rangen: might want to post on the mailing list about it then |
| 13:38 | technomancy | I'd be happy to get off blip.tv |
| 13:43 | rangen | there was a post about this issue in september, but no replies |
| 14:00 | juhu_chapa | Is there a modular contrib project related to network sockets programming? |
| 14:15 | ssideris | hello |
| 14:18 | solussd | how do you tell emacs to compile every form in a file (working in emacs/slime). I usually compile each form using c-c c-c |
| 14:19 | TimMc | Compile? |
| 14:19 | TimMc | You mean eval in REPL? |
| 14:38 | axle_512_ | anyone know why incanter charts would be plotted with jagged lines? |
| 14:38 | ssideris | solussd: c-c c-l |
| 14:38 | ssideris | while in the relevant buffer |
| 15:24 | cemerick | FYI: Mostly Lazy Episode 0.0.3: Chris Granger (@ibdknox) at Clojure Conj 2011 http://wp.me/p1Y10D-M |
| 15:25 | jonasen | EU överväger att utvidga sin Atalanta-operation till Somalias kust, uppgav Tyskland på fredagen. För tillfället opererar EU:s antipiratstyrka i farvattnen mellan Somalia och Jemen och på Indiska oceanen. |
| 15:26 | jonasen | sorry |
| 15:33 | TimMc | cemerick: Nice! |
| 15:33 | hugod | v |
| 15:40 | ibdknox | latest Mostly Lazy Podcast submitted to HN: http://news.ycombinator.com/item?id=3409001 |
| 15:46 | jodaro | rad |
| 15:53 | solussd | can I still use clojure.contrib.lazy-xml in 1.3? |
| 16:08 | society__ | does anyone have any ideas for utilizing json-str with bson data from mongodb that contains and ObjectId key which isn't recognized by the standard implementation? |
| 16:08 | Bronsa | cemerick: ping |
| 16:09 | cemerick | hi :-) |
| 16:09 | Bronsa | in mostly lazy episode 0.0.3 the link to Noir is mistyped, should be webnoir.org, you wrote webnoir.com |
| 16:10 | cemerick | Thanks, fixed. I always do that. |
| 16:11 | Bronsa | great interviews though |
| 16:11 | ibdknox | nobody wants to go there anyways ;) |
| 16:11 | ibdknox | it's an evil place. |
| 16:19 | cemerick | ibdknox: I've never understood what it is — a splash page with a tune, and that's it? |
| 16:20 | ibdknox | I meant my website lol. But yeah... I have no idea |
| 16:20 | ibdknox | even weirder are some of the links off of it: http://www.webnoir.com/bob/sackson.htm |
| 16:26 | mcrittenden | man there's all kinds of good stuff in there. http://gog.is/site:webnoir.com |
| 16:27 | ibdknox | so weird |
| 16:36 | cemerick | ibdknox: they've gotten more traffic in the past 6 months than in the past 6 years! ;-) |
| 16:36 | ibdknox | haha |
| 16:36 | ibdknox | cemerick: It's my gift to them ;) |
| 16:54 | mcrittenden | decent way to remove non-ascii chars from a string, anyone? |
| 16:56 | jodaro | mcrittenden: i had a function that would tell me if a string contained non-ascii characters somewhere |
| 16:56 | jodaro | didn't remove them, though |
| 16:56 | jodaro | let me find it |
| 16:56 | mcrittenden | that would definitely be helpful jodaro |
| 16:57 | TimMc | mcrittenden: A regex with [^[:ascii:]] or some such would do it. |
| 16:57 | raek | mcrittenden: perhaps you could use clojure.string/replace and a regex for non-ascii chars? |
| 16:58 | raek | (str/replace the-string #"[^\u0000-\u007F]" "") |
| 16:59 | raek | ,(clojure.string/replace "abcåäö" #"[^\u0000-\u007F]" "") |
| 16:59 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string> |
| 16:59 | TimMc | mcrittenden: Do you want ASCII control chars removed too? |
| 16:59 | mcrittenden | TimMc: yep, if possible |
| 16:59 | TimMc | and tab? :-) |
| 16:59 | mcrittenden | yep |
| 17:00 | raek | ok, make that \u0020-\u007E |
| 17:00 | jodaro | all i was doing was checking to see if the character arg was in the 32-127 range |
| 17:00 | mcrittenden | awesome, thanks all |
| 17:00 | raek | ascii chars 32 to 126 are printable |
| 17:00 | raek | 127 is a control char |
| 17:01 | jodaro | crap, it might have gone away with a botched repl |
| 17:01 | jodaro | sorry, right, 126 |
| 17:01 | raek | mcrittenden: you need this to generate a URL or sometihng? |
| 17:01 | TimMc | mcrittenden: Writing a hex viewer? https://github.com/tmciver/hexdump/blob/master/src/hexdump/core.clj |
| 17:01 | raek | consider the case where a string contains only non-ascii characters (e.g. russian) |
| 17:01 | TimMc | Wait, you're removing them, not replacing them. |
| 17:02 | raek | a hex viewer should operate on bytes, not character |
| 17:02 | raek | s |
| 17:02 | TimMc | (^ not my repo) |
| 17:02 | mcrittenden | raek, nope, I just have a bunch of txt files with nonprintable chars and i was hoping to write a clj script to clean them up |
| 17:03 | raek | why are there "nonprintable chars" there in the first place? mixed binary and textual data? |
| 17:04 | mcrittenden | tbh I'm not sure, seems to be maybe fancy chars like curly quotes that someone's editor screwed up at some point |
| 17:04 | mcrittenden | at least that's my guess |
| 17:04 | jodaro | tr -cd "[:print:]" < file1 |
| 17:04 | jodaro | man tr |
| 17:05 | jodaro | that might be what you want |
| 17:05 | TimMc | mcrittenden: And your text editor is barfing? |
| 17:06 | mcrittenden | TimMc: nope, I'm importing these txt files into a CMS which is barfing |
| 17:06 | mcrittenden | jodaro that's awesome, tr is new to me. |
| 17:07 | raek | mcrittenden: you are probably decoding the file with the wrong charset. the best way would be to find out which encoding scheme the file uses, and read it with that |
| 17:08 | raek | mcrittenden: sometimes you can use the 'file' command line program to find it out |
| 17:08 | TimMc | Or they've been through the charset wringer and no longer have a correct charset. |
| 17:11 | mcrittenden | gotta run, thanks again guys |
| 17:37 | tscheibl | read-string is damn slow in Clojurescript (except on v8... e.g. Chrome Browser) |
| 18:39 | technomancy | if you have written or are interested in writing a leiningen plugin, please read this proposal for a new way to handle plugins: https://groups.google.com/group/leiningen/browse_thread/thread/db4f8336f565d626 |
| 18:46 | technomancy | also, did anyone try out that slime-compile-presave hook I posted yesterday? |
| 18:46 | technomancy | I wasn't sure if it was crazy or not, but it's growing on me |
| 18:47 | TimMc | technomancy: Nah, it's not hardcore enough. It should run tests too. |
| 18:47 | technomancy | aw yeah |
| 18:48 | TimMc | (Really, it should be a pre-commit-hook.) |
| 18:48 | amalloy | technomancy: fyi i love slime, and i am never-ever gonna try that hook |
| 18:48 | TimMc | I think I would use it if it just *told* the file didn't compile, but didn't block the save. |
| 18:49 | amalloy | i want to save non-compiling stuff all the time |
| 18:49 | technomancy | TimMc: pre-commit hooks that take > 1s drive me nuts |
| 18:49 | technomancy | amalloy: that's what people say about paredit too |
| 18:49 | amalloy | yeah but they're wrong and i'm always right |
| 18:50 | technomancy | oh yeah; I forgot |
| 18:50 | amalloy | seriously though: maybe i'm trying to write something top-down for a while, using functions that don't exist yet. i can't save my thoughts because the computer can't run them yet? it's not supposed to be able to run them |
| 18:51 | Raynes | I agree, that hook is useless for me. |
| 18:51 | technomancy | turn on auto-declare? ={ |
| 18:51 | Raynes | I save things *compulsively*. |
| 18:51 | technomancy | =) |
| 18:52 | Raynes | Like, every two words that I type ends in C-x C-s |
| 18:52 | technomancy | Raynes: so write better code, duh. |
| 18:52 | technomancy | basically it forces you to take smaller, more correct steps |
| 18:54 | technomancy | well anyway, it'll never be the default, but I'll probably add it as a swank payload with the defvar set to nil |
| 18:54 | TimMc | Can't hurt. |
| 18:54 | MenTaLguY | if nothing else you can always put in stubs |
| 18:54 | MenTaLguY | to let things compile |
| 18:55 | technomancy | MenTaLguY: what we need is a smalltalk-style debugger that offers to create defns that don't already exist |
| 18:55 | technomancy | actually ... damn. |
| 18:55 | technomancy | we really do |
| 18:55 | MenTaLguY | hmm |
| 18:55 | technomancy | slime already has customizable restarts, which swank-clojure doesn't use at all |
| 18:56 | TimMc | yay condition systems |
| 18:56 | technomancy | "This var wasn't found. Would you like to 0) abort, 1) refer it from another namespace or 2) add a defn in the current one?" |
| 18:56 | TimMc | "3) DWIM" |
| 18:56 | technomancy | or delegate to slamhound |
| 18:56 | TimMc | which opens http://www.reddit.com/ in your browser |
| 18:57 | MenTaLguY | "It looks like you're trying to reference a var. Would you like help with that?" |
| 18:57 | technomancy | hahaha |
| 18:57 | TimMc | Yes! We're one step closer to vim-clippy. |
| 18:58 | MenTaLguY | so I've got a bit of code that I've been trying to make not ugly |
| 18:58 | MenTaLguY | anyone want to have a look and make suggestions for expressing it in a more lucid way? |
| 18:58 | amalloy | ~anyone |
| 18:58 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 18:59 | technomancy | I need to take off, but if you bring it by next Thursday I could. =) |
| 19:00 | MenTaLguY | not sure if i'll make it to Seajure or not |
| 19:00 | MenTaLguY | but thanks |
| 19:00 | MenTaLguY | this is the bit I'm wrestling with at the moment if anyone else wants to have a look: |
| 19:00 | MenTaLguY | https://gist.github.com/1542110 |
| 19:01 | MenTaLguY | basically I've got a bunch of maps which describe transitions in an NFA |
| 19:02 | MenTaLguY | with the :default key in the map, if present, providing a default transition |
| 19:02 | amalloy | well, lookup-edge is (some edges [label :default]) |
| 19:02 | MenTaLguY | okay, that helps a bit |
| 19:03 | MenTaLguY | hm |
| 19:04 | MenTaLguY | actually it really needs to be (get edges label (edges :default)), I just realized |
| 19:05 | MenTaLguY | since you can still have an explicit edge to the error state even when there's a default |
| 19:06 | MenTaLguY | anyway, merge-nfa-edges is the really ugly part (to me) |
| 19:07 | amalloy | indeed. i think you'd be happier if you threw away most of the lets, and all of the maps, and replaced them with a for |
| 19:07 | amalloy | (let [labels (...)] (into {} (for [[k v] labels] [k (whatever v)]))) |
| 19:09 | MenTaLguY | hmm |
| 19:26 | MenTaLguY | amalloy: hm, well, this seems a bit better: https://gist.github.com/1542110 |
| 19:32 | amalloy | personally all the defn-s make me sad. i don't care for defn- most of the time anyway, but in particular here you're making the functions *so* small that like a third of the screen space is taken up by giving names to snall ideas |
| 19:33 | amalloy | and passing around arguments (eg edges-map) when you could just be using the one in the local scope if you inlined the functions |
| 19:38 | MenTaLguY | lookup-edge actually gets used elsewhere, so that's factored out for th sake of DRY |
| 19:38 | MenTaLguY | I guess I see your point about merge-nfa-targets |
| 19:38 | MenTaLguY | but the indentation was getting quite deep |
| 19:40 | amalloy | well, you can do other things to combat that, if it bothers you |
| 19:40 | amalloy | eg, don't (let) the labels - inline that into the for initializer |
| 19:41 | amalloy | toss in some more liberal newlines, trading vertical for horizontal space |
| 19:42 | amalloy | https://gist.github.com/1542246 doesn't get very wide, for example |
| 19:43 | MenTaLguY | yeah, that's not too bad |
| 19:48 | jodaro | hrm |
| 19:48 | MenTaLguY | so the last thing I need to do here is if all of the targets for a particular label are nil, the resulting target should be nil, and not the empty set |
| 19:48 | jodaro | Can't set!: *ns* from non-binding thread |
| 19:50 | MenTaLguY | IOW (merge-nfa-edges {\c nil, \d #{2} :default #{3}} {\c nil, :default #{4}}) => {\c nil, \d #{2}, :default #{3 4}} |
| 20:01 | MenTaLguY | amalloy: thoughts on this approach? https://gist.github.com/1542110 |
| 20:02 | amalloy | (if (empty? x) nil x) is (not-empty x) |
| 20:03 | MenTaLguY | great, thanks |
| 20:03 | amalloy | which means you no longer need the (let) either |
| 20:04 | TimMc | &(doc not-empty) |
| 20:04 | lazybot | ⇒ "([coll]); If coll is empty, returns nil, else coll" |
| 20:04 | TimMc | That's an odd one. |
| 20:05 | amalloy | TimMc: for when you want to (seq x) but without destroying its type |
| 20:05 | amalloy | ie, test for emptiness |
| 20:05 | TimMc | sweet |
| 20:06 | MenTaLguY | this kind of case, basically, I want either nil or a non-empty set |
| 20:17 | MenTaLguY | amalloy: all right, I think I have something I feel better about now; thank you |
| 21:18 | lnostdal | i think i've asked about this before -- i've probably forgotten the answer .. but what's up with futures and exceptions? .. sometimes they "creep through" and sometimes they only show themselves when i deref the future |
| 21:20 | technomancy | they shouldn't ever escape the future thread until they're derefed |
| 21:20 | TimMc | lnostdal: Is something printing stack traces of intermediate exceptions? |
| 21:20 | lnostdal | ok, perhaps something is derefing them when printing the result |
| 21:20 | technomancy | though it could be derefed in surprising ways, like pr-str |
| 21:21 | lnostdal | ..or when showing a printed representation of the future object |
| 21:21 | lnostdal | right, ok, makes sense again then |
| 21:22 | lnostdal | ,(let [it (future (/ 42 0))] (Thread/sleep 100) it) |
| 21:23 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.ArithmeticException: Divide by zero> |
| 21:23 | lnostdal | that'll fail every time .. i.e. not racy |
| 21:23 | lnostdal | (..not racing with :pending status..) |
| 21:23 | lnostdal | there are so many things that can go wrong .. heh |
| 21:24 | lnostdal | ..i don't think printing should "be the same" as dereffing here |
| 21:24 | lnostdal | ..because the proper handlers (catch blocks) aren't in place everywhere |
| 22:14 | jodaro | so |
| 22:14 | jodaro | for better or worse |
| 22:14 | jodaro | i have a function that uses in-ns |
| 22:14 | jodaro | that function gets called by something else in a future |
| 22:14 | jodaro | and that, apparently, doesn't work |
| 22:15 | jodaro | giving me an illegalstateexception |
| 22:15 | jodaro | with the error Can't set!: *ns* from non-binding thread |
| 22:18 | technomancy | wow, in-ns used inside a function? |
| 22:18 | amalloy | jodaro: it's pretty weird to be changing what namespace you're in at runtime |
| 22:19 | jodaro | yeah, i figured i was doing something wacky to begin with |
| 22:19 | jodaro | it was working great in the unit tests |
| 22:19 | jodaro | its all related to protocol buffers |
| 22:20 | jodaro | trying to protobuf-load dynamically based on a string that has the protobuf type |
| 22:20 | jodaro | using like |
| 22:20 | jodaro | (deref (resolve (symbol protobuf-name))) |
| 22:22 | jodaro | but i had to in-ns to the ns where i call defprotobuf |
| 22:25 | amalloy | i mean, it seems like something you can do at compile-time instead of runtime. but you can easily enough just do like...(binding [*ns* whatever] (...stuff...)) instead of using in-ns |
| 22:27 | emezeske | hmm, is there a standard way to force non-laziness like "doseq", but to still collect the results like "for" ? |
| 22:28 | emezeske | or does one just have to use (doall (for ...)) to get that behavior? |
| 22:53 | chipdude | transient objects are marked alpha, but data.json uses them. is this OK because the transient doesn't escape the interface? |
| 22:53 | akhudek | emezeske: lookup doall |
| 22:53 | jodaro | amalloy: that works, thanks |
| 22:53 | technomancy | chipdude: transients crossing API boundaries would be super-sketchy even if they weren't alpha |
| 22:54 | chipdude | ok |
| 22:54 | chipdude | that said, my question's answer is yes? |
| 22:55 | emezeske | akhudek: yeah, I saw doall; what I want is essentiall (doall (for ...)) |
| 22:55 | emezeske | akhudek: I just wondered if there was already a combo macro |
| 22:55 | emezeske | akhudek: I just wrote my own called "dofor" |
| 22:55 | akhudek | you have the solution, there is no precanned macro or function |
| 22:56 | emezeske | cool, that's what I wanted to know, thanks |
| 23:26 | TimMc | technomancy: They *claim* to be alpha... |
| 23:27 | TimMc | They've been there for two versions of clojure.core and they're recommended all over the place for performance-requiring stuff. |
| 23:28 | technomancy | heh; yeah I just realized promise/deliver is alpha and has been around even longer |
| 23:35 | amalloy | at least in 1.3 some of the alpha notifications have started going away |
| 23:35 | TimMc | amalloy: Which ones? |
| 23:36 | amalloy | juxt is the one i know about, but there are more |
| 23:36 | TimMc | Haha, juxt was "alpha"? |
| 23:37 | amalloy | as late as 1.2.1 |
| 23:37 | TimMc | Maybe the vec vs. lazy seq decision was alpha, but there's no way it would have been removed. |
| 23:39 | emezeske | Wooo, my new lein plugin for compiling ClojureScript is done! http://github.com/emezeske/lein-cljsbuild |
| 23:41 | emezeske | If you use cljs-watch or lein-clojurescript, you may want to check out lein-cljsbuild |
| 23:50 | fryguy | wow, nailgun with VimClojure is a pain in the ass |
| 23:55 | adiabatic | hi, I'm doing https://www.4clojure.com/problem/21 and I"ve been able to come up with (fn [coll index] ((first (drop index coll)))), but I'm getting a java.lang.ClassCastException saying that it can't cast a java.lang.Integer to a clojure.lang.IFn. My first guess is that I transposed the two arguments (I'm reimplementing nth), but everything looks OK. Can someone give me a hint as to where I messed up? |
| 23:59 | amalloy | too many parens |