2013-10-09
| 01:01 | DomKM | grench |
| 01:01 | DomKM | oops, trying to search |
| 01:01 | technomancy | DomKM: it's fun to say, isn't it? |
| 01:01 | technomancy | grench grench grench |
| 01:01 | DomKM | sorry |
| 01:01 | DomKM | hehe, true |
| 01:03 | DomKM | technomancy: actually, since I have you here, will grenchman be available via homebrew? |
| 01:04 | technomancy | DomKM: I have no plans to package it there myself, but I wouldn't be surprised if someone else does |
| 01:04 | technomancy | that said, it takes a loooooooong time to compile the toolchain for it |
| 01:04 | technomancy | like, close to an hour |
| 01:06 | technomancy | I would like to offer PPAs though |
| 01:06 | DomKM | technomancy: wow, okay I'll just install the binary. It's kind of funny that a tool that speeds up development takes that long to compile. |
| 01:07 | technomancy | DomKM: well you're pulling in a whole new runtime, two new compilers, and a package manager |
| 01:08 | technomancy | plus two standard libraries |
| 01:08 | technomancy | I think in some cases you're compiling twice too, once for bytecode and once for native code? not sure about that part. |
| 01:09 | technomancy | anyway, part of why I picked OCaml was for the independently-distributable native binaries |
| 01:09 | technomancy | of course calling out to libreadline kind of puts a wrench in the works as far as standalone portability goes =\ |
| 01:10 | TEttinger | isn't there readline for windows? |
| 01:10 | technomancy | but having access to Genuine GNU-brand libreadline software product is pretty great |
| 01:10 | TEttinger | http://gnuwin32.sourceforge.net/packages/readline.htm |
| 01:10 | technomancy | TEttinger: yeah, but async (the jane street networknig library that grench uses) hasn't been ported to Windows |
| 01:10 | TEttinger | jaaaaane streeeeeet!!!!! |
| 01:11 | technomancy | (the portability issues are more around dynamic linking and requiring rebuilds on platforms with different versions of libreadline/libffi) |
| 01:11 | TEttinger | so grenchman on windows isn't happening, is it? |
| 01:13 | uvtc | I'm trying to decode some base64-encoded text (actually, the sample from <http://en.wikipedia.org/wiki/Base64>. Here's how far I've gotten: <https://gist.github.com/uvtc/6896279>. How can I turn that resulting byte array into a string? I'm assuming that the bytes are utf8-encoded unicode... |
| 01:13 | technomancy | TEttinger: yeah, unlikely unless you can convince jane st |
| 01:14 | TEttinger | I wonder if haskell would have been easier... |
| 01:14 | TEttinger | is grenchman a large piece of software? |
| 01:14 | Frozenlock | uvtc: If you can handle horrible, you can take a look at that ;p https://github.com/Frozenlock/gzip64/blob/master/src/gzip64/core.clj |
| 01:15 | technomancy | TEttinger: not really... ~500 LOC right now including the bencode library |
| 01:17 | uvtc | Thanks, Frozenlock . Not sure exactly what you're suggesting though. |
| 01:17 | uvtc | How can I convert a utf8-encoded byte into a character? If I can do that, |
| 01:17 | uvtc | I can join them. |
| 01:17 | technomancy | I think contrib has a pure-clojure base64? |
| 01:17 | technomancy | if not there's commons-codec |
| 01:18 | uvtc | I'm using clojure.data.codec from contrib. |
| 01:18 | technomancy | oh right |
| 01:18 | technomancy | ~(String (.getBytes "ohai")) |
| 01:18 | clojurebot | Cool story bro. |
| 01:18 | technomancy | argh |
| 01:18 | technomancy | ,(String (.getBytes "ohai")) |
| 01:18 | clojurebot | #<RuntimeException java.lang.RuntimeException: Expecting var, but String is mapped to class java.lang.String> |
| 01:18 | technomancy | ,(String. (.getBytes "ohai")) |
| 01:18 | clojurebot | "ohai" |
| 01:18 | Frozenlock | uvtc: That's what I used. https://github.com/Frozenlock/gzip64/blob/master/src/gzip64/core.clj#L44 |
| 01:19 | technomancy | nearly five years and you'd think I could have clojurebot figured out |
| 01:19 | Frozenlock | What technomancy just said :p |
| 01:21 | uvtc | When I try: `(String. (base64/decode (.getBytes input)))`, I get lots of gibberish in my terminal window. |
| 01:21 | uvtc | Some of the correct text, then gibberish, then more text. |
| 01:22 | uvtc | That sample on the wikipedia page is not all ascii. |
| 01:30 | uvtc | The problem also came up when trying to decode some sort of MIME base64-encoded MS Outlook email attachment someone sent me. I was able to decode it using Python's base64 module. |
| 01:30 | uvtc | If anyone can think of anything, please let me know. I'll check the IRC logs tomorrow. Thanks. |
| 01:32 | IceD^ | I do have (def r (ref ...)) and (defn is-ok [r] ....) |
| 01:32 | gws | uvtc: what encoding is `input` in when you call .getBytes? |
| 01:32 | Sgeo | &(let [-> inc] (-> 5)) |
| 01:32 | lazybot | ⇒ 5 |
| 01:32 | IceD^ | what's teh best way to wait for is-ok |
| 01:32 | Sgeo | Sorry, I had to know |
| 01:33 | uvtc | gws. Hm. Dunno. It's from the example at <http://en.wikipedia.org/wiki/Base64>. |
| 01:34 | dnolen | Sgeo: huh, probably a bug? 6 in CLJS |
| 01:34 | jwpalmer | uvtc: this is where it's done in tentacles: https://github.com/Raynes/tentacles/blob/master/src/tentacles/repos.clj#L420-L433 |
| 01:34 | dnolen | Sgeo: locals should be able to shadow macros |
| 01:35 | Sgeo | dnolen: long-standing bug in the sandbox lazybot uses |
| 01:35 | Sgeo | iirc |
| 01:35 | Sgeo | Presumably due to a broken macroexpander |
| 01:35 | dnolen | Sgeo: oh right, lazybot bug, not a clojure one |
| 01:35 | Frozenlock | https://news.ycombinator.com/item?id=6517553 :-( |
| 01:35 | uvtc | Hm. Hovering my mouse over the appropriate Emacs status bar area doesn't have the familiar "U" but instead indicates "multi-byte undecided unix". |
| 01:36 | mercwithamouth | can someone tell me the difference between let and :let? http://logaan.github.io/images/birds-eye-view-typed-gol-full-size.gif the second example in clojure |
| 01:36 | uvtc | gws , jwpalmer ^^ Thanks. Will have to get back to this tomorrow. |
| 01:37 | zeroem1 | mercwithamouth: you mean the second example in typed clojure? |
| 01:38 | zeroem1 | oh nvm, there it is |
| 01:38 | mercwithamouth | oh sorry..the regular clojure |
| 01:39 | zeroem1 | mercwithamouth: never used it, but my guess would be it's just a convenience for letting some symbols as part of a for loop |
| 01:39 | andyfingerhut | mercwithamouth: It is a special thing inside of for bindings |
| 01:39 | mercwithamouth | hrmm...alrighty then |
| 01:40 | zeroem1 | I guess it would be an optimization too, let once as part of the loop instead of on every iteration, but I'd have to try it out |
| 01:40 | andyfingerhut | http://clojuredocs.org/clojure_core/clojure.core/for has another example of it, although not necessarily as much as you might want. |
| 01:40 | mercwithamouth | ahh..hmmm |
| 01:41 | andyfingerhut | mercwithamouth: They are the kind of things I don't see terribly often, and thus don't use terribly often, and thus have to look up and think about again whenever I see them. |
| 01:41 | mercwithamouth | yeah...it seemed like some 'weird' or 'fancy' case |
| 01:41 | zeroem1 | huh. not an optimization |
| 01:42 | andyfingerhut | I think they are really there to make certain kinds of coding shorter, not necessarily more efficient. |
| 01:42 | zeroem1 | ,(for [a [1 2 3] :let [b ((fn [] (prn "here") 1))]] (prn a)) |
| 01:42 | clojurebot | ("here"\n1\n"here"\n2\n"here"\n3\nnil nil nil) |
| 01:43 | zeroem1 | yeah, thought it might have been as it doesn't really save much loc wise |
| 01:57 | indigo | Blah, uvtc signed off |
| 01:57 | indigo | I found the solution to his problem :\ |
| 01:58 | jwpalmer | what was it? he said he'd check the logs tomorrow |
| 01:58 | jwpalmer | i'm curious |
| 01:58 | indigo | jwpalmer: I posted on his Gist, it was because he wasn't taking out the newlines in input |
| 01:59 | jwpalmer | ah thx |
| 01:59 | indigo | Should it automatically do that for you, though? |
| 02:00 | jwpalmer | oh i hate it when the test data is the problem |
| 02:01 | nightfly | yes! Boo to bad tests! |
| 02:02 | indigo | Well, it's a question for another day |
| 02:02 | indigo | I'm going to bed |
| 02:36 | phiat | hello all. I have a question about assoc and assoc-in... and why assoc-in doesn not have an analogue to assoc's multiple 'replacements'. |
| 02:37 | phiat | example: (assoc mymap :name "Hank" :hp 20 :weapon :sword) is nice and handy |
| 02:38 | phiat | but there is not (assoc-in mymap [:stats :exp] 100 [:stats :lvl] 2) |
| 02:38 | amalloy | you don't really need that, with update-in: (update-in mymap [:stats] assoc :exp 100 :lvl 2) |
| 02:39 | phiat | ah i see, thanks again |
| 02:39 | andyfingerhut | phiat: As you can probably guess from looking at their definitions, it would be easy to define a variant of assoc-in that would do what you describe. |
| 02:39 | phiat | i was about to do just that, but thought i see if something was more idiomatic clojure style |
| 02:40 | phiat | (inc amalloy) |
| 02:40 | lazybot | ⇒ 73 |
| 02:40 | phiat | (inc andyfingerhut) |
| 02:40 | lazybot | ⇒ 1 |
| 03:01 | Gooder | how to write the dependencies for oracle jdbc 11g driver? |
| 03:17 | Frozenlock | Is there instances of 'lein clean' not erasing everything? :-/ |
| 03:19 | Frozenlock | I have the weird feeling that my compojure server is still acting as before my changes... even if I've done 'lean clean' multiple times. |
| 03:33 | Frozenlock | Nvm, I think it's a problem with my nginx configuration file... |
| 03:35 | deg | Frozenlock: I'm putting together a lib that should make it easy to host multiple domains under compojure. Also some support for dev vs production versions and playing nicely with ClojureScript via Austin. |
| 03:36 | Frozenlock | deg: can you complete it for... 3 days ago? :p |
| 03:36 | deg | Not ready for prime-time yet. I've got the pieces working in one project, now pulling it apart and generalizes into a lib. Also, it's a skunkwork project right now. But, with a bit of luck, I hope to have it public within a few days. |
| 03:36 | Frozenlock | I'll make sure to look at it! |
| 03:36 | deg | Maybe something limping along later today. |
| 03:37 | Frozenlock | Don't rush things for me however, I'm pretty much advanced in my nginx config :p |
| 03:37 | deg | ok. good luck. |
| 03:37 | Frozenlock | Thanks :P |
| 03:37 | Frozenlock | Good luck to you too with your library! |
| 03:37 | deg | thx |
| 03:41 | Frozenlock | Ah! Got it! Nginx wasn't forwarding the original host name. That wasn't playing nice with the various compojure redirect and all... |
| 03:42 | SegFaultAX | Frozenlock: Why have that logic at the application level? |
| 03:44 | Frozenlock | SegFaultAX: It's a function looking like this: (when-not login (resp/redirect "/login")). Where would you put that, if not in the server jar itself? |
| 03:48 | SegFaultAX | Frozenlock: Sorry that was for deg |
| 03:48 | SegFaultAX | Why would compojure care about multiple domain names? |
| 03:49 | Frozenlock | Probably because you can easily run a website entirely in compojure... but things get messy if you want to run more than one. |
| 03:49 | Frozenlock | exhibit A: me :p |
| 03:50 | SegFaultAX | What does "run a website entirely in compojure" mean? |
| 03:51 | Frozenlock | Means run the jar, forward the port 80 on a router and you are set. |
| 04:44 | deg | Frozenlock: Back now; not sure exactly what you were asking me above. |
| 04:46 | Frozenlock | deg: wasn't asking anything... I was answering SegFaultAX |
| 04:46 | deg | Ah, ok. Just saw your "sorry that was for deg" above. |
| 04:47 | Frozenlock | def: that wasn't me saying that.. :p |
| 04:47 | Frozenlock | Holy flood reiddraper! |
| 04:47 | deg | oops. Time to get my glasses checked. Sorry. (and, I see you already answered the question he asked me) |
| 05:05 | ddellacosta | what is going on with reiddraper |
| 05:21 | TEttinger | ddellacosta: I have him on /ignore, it seems to be going around :| |
| 05:22 | ddellacosta | TEttinger: yeah, I wouldn't normally want to ignore reiddraper, but ah well. :-( |
| 05:22 | TEttinger | I'll periodically unignore him |
| 05:50 | deg | Frozenlock: Still >>very<< raw, but take a look at https://github.com/deg/muxx to get a sense of the direction I'm heading. |
| 06:01 | rurumate_ | aws-java-sdk version can (should?) be greatly bumped in weavejester's clj-aws-s3 |
| 06:20 | mercwithamouth | . |
| 06:20 | Oddman | mmm, clojure s3 |
| 06:26 | noidi | let's see if "/ignore reiddraper JOINS PARTS" does the trick... |
| 06:27 | noidi | ah, missed QUITS |
| 06:54 | sm0ke | hey guys anything for authentication in compjure/ring based apps? |
| 06:54 | glosoli | sm0ke: https://github.com/cemerick/friend maybe ? |
| 06:57 | sm0ke | thanks..though i was looking for something simpler .. dont need oauth in particular |
| 07:07 | clgv | sm0ke: there is a simple web authentication in there |
| 07:12 | sm0ke | i guess its too complicated and heavyweight for me |
| 07:12 | sm0ke | i just need to hack up some cookies i guess |
| 08:35 | cmajor7 | how to make lein to pick up a test related config: https://www.refheap.com/19558 ? |
| 08:37 | cmajor7 | e.g. have a custom ":test-resources-path" |
| 08:45 | clgv | cmajor7: is there a leiningen profile called :test? or does your test lib (if any) have a leiningen profile? |
| 08:50 | cmajor7 | I tried a ":profiles {:test {:resource-paths ["path/to/test/resources"]", but it did not do it... |
| 08:55 | cmajor7 | looks like I might need to create a "test" profile myself in "profiles.clj" / , and run: "lein with-profile [name] ..." |
| 09:21 | TimMc | noidi: Wait, you have JOINS PARTS unignored in general for a channel this size? |
| 09:21 | TimMc | I also recommend the smartnoise.pl script for irssi, by the way. |
| 09:41 | maku__ | Anyone know how to send a clojure map to a client as a string? |
| 09:41 | cdombroski | pr-str ? |
| 09:44 | maku__ | cdombroski: Thanks! |
| 09:44 | clgv | cmajor7: then you can create an alias to avoid the repetitive "with-profile" |
| 10:03 | jtoy | if i wanted to implement a way to monitor a rolling window of the last 5 times a function is called,( i can add the logging in the function), what is the simplest way to do it? |
| 10:04 | jtoy | I dont want to use a database |
| 10:04 | ordnungswidrig | jtoy: you can use an atom |
| 10:04 | jtoy | ordnungswidrig: oh, and it needs to be persistent because mulitple processes will be running the function |
| 10:05 | ordnungswidrig | jtoy: different jvms? |
| 10:05 | mdrogalis | jtoy: Clojure persistent, or durable? |
| 10:05 | jtoy | mdrogalis: durable |
| 10:05 | jtoy | ordnungswidrig: seperate pids |
| 10:05 | mdrogalis | So you need durability, but don't want to use a database? :) |
| 10:06 | ordnungswidrig | jtoy: it'd go with redis |
| 10:06 | jtoy | ordnungswidrig: yeah, i could use redis, its too heavy just to monitor one function though |
| 10:07 | tbaldridge | jtoy: you could use a CAS operation on a memory mapped file. But that's a ton of work to go through to avoid a DB. Just use a database. |
| 10:07 | mdrogalis | jtoy: A dire pre-hook and a light durable datastore? |
| 10:07 | mdrogalis | That's about the best case I can see. |
| 10:09 | ordnungswidrig | you can also go with file locking but this sounds like a very good way to limit the troughput of your system hard |
| 10:10 | jtoy | mdrogalis: am looking up dire, I see you wrote it :) |
| 10:11 | mdrogalis | jtoy: I use it a lot for 'hands-off' function modification. |
| 10:11 | mdrogalis | jtoy: Does your programming work ever eclipse your neuroscience interest? |
| 10:13 | jtoy | mdrogalis: a little, my plan is too to eventually be 100% oeverlap :) I do clojure/machine learning for my regular job, but I also volunteer part-time at MIT at a computational neuroscience lab |
| 10:14 | mdrogalis | jtoy: That's really cool :D |
| 10:14 | jtoy | thanks! planning to go back to school next year also |
| 10:15 | mdrogalis | Where to? |
| 10:22 | jtoy | mdrogalis: I would like to go to MIT, but not sure how realistic |
| 10:28 | mdrogalis | jtoy: Best of luck. :) |
| 10:31 | jtoy | mdrogalis: thanks, appreciate it |
| 10:41 | mdrogalis | Sit still. D: |
| 11:04 | craigbro | greetiings |
| 11:06 | stuartsierra | Anybody ever seen "java.lang.IllegalStateException: Attempting to call unbound fn: #'potemkin/transform-fn-bodies" while compiling code which uses Lamina? |
| 11:21 | noncom | not really a clojure-related question, but maybe clojure has some nice way to do it: how do I get, for a character, the character which would be typed if the shift key were pressed? like A for a, & for 7, ( for 9 and so on? |
| 11:23 | craigbro | noncom: depends on your keyboard mapping, so you could have to look that up |
| 11:23 | cdombroski | noncom: for letters just using the .toUppercase method should work, everything else would be dependent on the keyboard layout |
| 11:23 | Morgawr | mmm.. I've been trying to run clojure from the command line without having a leiningen project, I just want to run it as standalone, however it doesn't call the main function automatically |
| 11:24 | Morgawr | I'm doing lein run -m clojure.main/main -i file.clj |
| 11:24 | craigbro | how do you expect to run lein without a lein project? |
| 11:24 | noncom | well, this post proposes some solution: http://stackoverflow.com/questions/11079820/java-keyboard-get-shifted-char maybe i could incorporate that, otherwise, i'll just have to do it in hardcoding which is not very cheer |
| 11:24 | Morgawr | craigbro: you can, I don't see the problem |
| 11:25 | craigbro | try java -cp path/to/clojure.jar clojure.main/main -i file.clj |
| 11:25 | hyPiRion | Morgawr: clojure.main/main will not automatically call the main function, so you have to add inn a (apply main- *args*) at the end |
| 11:25 | cdombroski | Morgawr: java -cp clojure.jar clojure.main /path/to/clj (from: http://clojure.org/repl_and_main) |
| 11:26 | hyPiRion | oh right, you can replace -i with -m probably |
| 11:26 | craigbro | or specifically -e '(load-file "file.clj") (-main "my" "args")' |
| 11:27 | craigbro | hyPiRion: don't think the -m will work, since that asumes a namespace that already compiled |
| 11:28 | Morgawr | mmm.. it's not working.. can you guys give me the full line I need to use? |
| 11:28 | craigbro | Morgawr: stop using lein |
| 11:28 | Morgawr | craigbro: no |
| 11:28 | craigbro | Morgawr: what is the eror you get |
| 11:28 | cdombroski | he's not using lein |
| 11:28 | cdombroski | the entire point is to not use lein |
| 11:28 | Morgawr | I want to use lein to handle classpathing but don't want to create a full blown lein project |
| 11:28 | Morgawr | I know you can run a .clj file with lein run |
| 11:29 | craigbro | cdombroski: this is what the dude said: I'm doing lein run -m clojure.main/main -i file.clj |
| 11:29 | Morgawr | but I need to pass some command line arguments |
| 11:29 | craigbro | so he's using line |
| 11:29 | craigbro | lein |
| 11:29 | craigbro | what error do you get Morgawr? |
| 11:29 | cdombroski | oh, missed that part |
| 11:29 | Morgawr | if I run "lein run -m clojure.main/main -i myfile.clj" nothing happens since it doesn't call main |
| 11:29 | craigbro | well, when I do that without a project.clj, I get this: |
| 11:30 | craigbro | binah:~ craig$ lein run |
| 11:30 | craigbro | Couldn't find project.clj, which is needed for run |
| 11:30 | Morgawr | oh okay, I managed to gt it to work |
| 11:30 | craigbro | what was the solution? |
| 11:30 | Morgawr | lein run -m clojure.main/main -i file.clj -e "(mynamespace/-main)" |
| 11:30 | Morgawr | I needed to add the namespace |
| 11:30 | craigbro | so you have a project.clj? |
| 11:31 | craigbro | which version of lein? |
| 11:31 | Morgawr | I don't have a project.clj |
| 11:31 | Morgawr | Leiningen 2.1.3 on Java 1.7.0_40 Java HotSpot(TM) 64-Bit Server VM |
| 11:31 | Morgawr | (might be a bit outdated, not sure) |
| 11:31 | craigbro | I LEARNED SOMETHING! |
| 11:31 | craigbro | I am running 2.0.0 and it fails out complaining about no project |
| 11:31 | Morgawr | yeah, technomancy told me about that yesterday :P |
| 11:31 | cdombroski | so, how do we get a classpath with no project.clj? |
| 11:31 | tufflax | Take a look if you have the time please https://www.refheap.com/19565 |
| 11:31 | cdombroski | it wouldn't know what is needed |
| 11:32 | craigbro | cdombrowsky - defaults 8^) |
| 11:37 | stuarthalloway | hi all -- I am seeing what appears to be leiningen injecting a library called [clojure-complete "0.2.3"] into applications I build |
| 11:37 | stuarthalloway | anybody else seeing this? |
| 11:39 | xeqi | stuarthalloway: yep, technomancy added clojure-complete and nrepl to the :default profile, which is included by default |
| 11:39 | xeqi | https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/project.clj#L369 |
| 11:39 | xeqi | it gets removed before any jar/pom/uberjar tasks |
| 11:40 | bja | why is clojure.repl/dir a macro? |
| 11:40 | stuarthalloway | it doesn't get removed before generating a pom... |
| 11:41 | stuarthalloway | my first reaction is "leiningen changed out from under me and started injecting code into my releases" |
| 11:41 | stuarthalloway | is there a way to change the default to what it was? |
| 11:41 | bja | I only noticed because (clojure.repl/dir *ns*) seemed like the right thing to do |
| 11:42 | llasram | stuarthalloway: Use the (by default empty) :production profile for building production releases |
| 11:43 | stuarthalloway | llasram: I am not using lein to build production releasesa |
| 11:43 | stuarthalloway | I am using it as part of a larger build chain, and this broke me |
| 11:43 | vivekramaswamy | Hi, I m new to clojure, what tool would you recommend to run REPL, as it is much easier learning the language using a command line tool, I don't like the one provided by leinengen |
| 11:44 | scriptor | isn't the one provided by leiningen a command line tool? |
| 11:45 | llasram | stuarthalloway: I'm kind of confused... If lein isn't being used to build the releases, how is the clojure-complete dependency showing up in releases? |
| 11:45 | vivekramaswamy | yes it is but not very intutive to write small programs, does not match brackets once you go to new line |
| 11:45 | stuarthalloway | llasram: lein pom, then run maven |
| 11:46 | scriptor | vivekramaswamy: ah, if you're writing small programs the command line might get a little too limiting |
| 11:46 | maku__ | vivekramaswamy: have you tried light table? http://www.chris-granger.com/lighttable/ |
| 11:47 | vivekramaswamy | nope, never heard that name, let me try that then |
| 11:47 | maku__ | vivekramaswamy: I found that using the instarepl in L.T. was the fastest way to get going. |
| 11:48 | xeqi | stuarthalloway: my apologies, you are right it does stay with `lein pom`. blah |
| 11:48 | vivekramaswamy | maku_: Thank you will give it a try |
| 11:48 | xeqi | technomancy: ^ ick |
| 11:48 | maku__ | vivekramaswamy: I highly recommend watching Chris Granger's Demo Videos. |
| 11:49 | scriptor | are they up to date for the latest version, maku__? |
| 11:49 | vivekramaswamy | maku_: will do |
| 11:49 | llasram | xeqi, stuarthalloway: oi, even doing things which should leave out :base. ouch |
| 11:49 | ThePawnBreak | how can I match the beginning of a string with a regexp? |
| 11:49 | maku__ | scriptor: latest version of clojure? |
| 11:50 | scriptor | latest Light Table |
| 11:50 | scriptor | are the videos up to date, I mean |
| 11:50 | stuarthalloway | llasram, xeqi: can I disable lein's self update so I control which lein I am using until this is fixed |
| 11:51 | maku__ | scriptor: Good point. The videos are not up to date, but they are versioned so at least you know what version each video is demoing. |
| 11:52 | llasram | stuarthalloway: Unless I've missed a feature-addition, self-upgrade should never be automatic. The `upgrade` command actually takes a version, if you just wanted to add that to an existing build script which tries to update to most recent lein on each run |
| 11:52 | scriptor | yeah, it's been changing quite a bit with each release, so it might get confusing watching an older video |
| 11:52 | stuarthalloway | llasram: cool, trying to track down a developer report that this problem happened "underneath" him, might be mistaken |
| 11:54 | maku__ | vivekramaswamy: scriptor: To scriptor's point, It's best to use the videos as a method of understanding the core concepts and not a lockstep tutorial of features/ |
| 11:54 | clgv | vivekramaswamy: do you come from a java background? |
| 11:55 | stuartsierra | stuarthalloway: You can copy a specific version of the `lein` executable into your source control repo, and run that. |
| 11:55 | stuartsierra | It's just a shell script. |
| 11:56 | stuarthalloway | stuartsierra: understood, thanks |
| 11:56 | vivekramaswamy | clgv: Yes I do, hardcore Java background, I am very comfortable with IDE based dev. |
| 11:56 | clgv | vivekramaswamy: there is an eclipse plugin for clojure called counterclockwise |
| 11:57 | vivekramaswamy | yes am using that, but the repl for that is not something I liked very |
| 11:58 | clgv | vivekramaswamy: huh? what is the reason therefore? |
| 11:59 | stuarthalloway | xeqi: having nrepl in the default profile can cause nrepl's Clojure version (1.2.0!) to override and change the version of Clojure used in a project |
| 11:59 | vivekramaswamy | clgv: brackets don't match cleanly for many progs, please don't get me wrong, I am not used to using so many brackets in a program |
| 12:00 | clgv | vivekramaswamy: do you use "strict mode"? |
| 12:00 | clgv | vivekramaswamy: you can toggle strict mode via ALT+D |
| 12:00 | vivekramaswamy | clgv: didn't get that, is there some setting for strict mode |
| 12:00 | clgv | vivekramaswamy: there is also a setting to always use strict mode initially |
| 12:01 | llasram | stuarthalloway: That really shouldn't happen at all -- the :base profile nrepl dep has an exclusion for org.clojure/clojure |
| 12:02 | stuarthalloway | xeqi: your mention of "it gets removed before any jar/pom/uberjar tasks" terrifies me -- sounds very mutable and error-prone as an implementation strategy |
| 12:02 | stuarthalloway | llasram: from lein deps :tree, I see |
| 12:02 | stuarthalloway | WARNING!!! possible confusing dependencies found: |
| 12:02 | stuarthalloway | [org.clojure/tools.nrepl "0.2.3"] -> [org.clojure/clojure "1.2.0"] |
| 12:02 | stuarthalloway | overrides |
| 12:02 | stuarthalloway | [clojure-complete "0.2.3"] -> [org.clojure/clojure "1.3.0"] |
| 12:02 | stuarthalloway | and |
| 12:03 | llasram | stuarthalloway: What version of leiningen is this? |
| 12:03 | stuarthalloway | 2.2.0 |
| 12:04 | llasram | Ok -- that has been fixed in a more recent release |
| 12:04 | stuarthalloway | upgrading now |
| 12:04 | llasram | The `clojure-complete`-in-pom.xml bug is still there though :-/ |
| 12:04 | xeqi | stuarthalloway: fwiw I dislike manipulating the deps too, I just haven't been able to convice technomancy yet |
| 12:05 | llasram | xeqi: I thought that was part of the profile changes on the roadmap for 3.0? |
| 12:06 | stuarthalloway | llasram: so you pointing out another bug (now fixed) but made possible by the same strategy |
| 12:06 | stuarthalloway | maybe instead of fixing these bugs one by one we should choose a different strategy |
| 12:06 | mdrogalis | What was the reasoning behind injecting that jar? |
| 12:07 | xeqi | llasram: maybe, I haven't heard much about the plan for 3.0 yet. |
| 12:07 | stuarthalloway | mdrogalis: prioritize developer convenience over production? |
| 12:08 | mdrogalis | stuarthalloway: I guess so. I'd think there would be other ways to accomplish it without mangling prod's deps. |
| 12:08 | stuarthalloway | it would be great if other people who cared about production advocated for it |
| 12:09 | llasram | stuarthalloway: Or submit PRs :-) |
| 12:09 | xeqi | or used time to implement it |
| 12:09 | xeqi | bah |
| 12:10 | stuarthalloway | PRs are a poor way to address a philosophical disagreement |
| 12:14 | technomancy | mdrogalis: production is not affected if you use the production profile |
| 12:14 | mdrogalis | technomancy: Ahh, got'cha. |
| 12:14 | technomancy | llasram: that's not a bug; clojure-complete is test-scoped |
| 12:15 | mdrogalis | stuarthalloway: Follow the lead of the American government and disable Leiningen use until its resolved. |
| 12:15 | stuarthalloway | mdrogalis: ouch |
| 12:15 | mdrogalis | I'm American, I'm allowed to do that. |
| 12:16 | llasram | technomancy: Oh, so it is -- my eye totally slipped right over that |
| 12:16 | stuarthalloway | llasram: basis of my question about auto-upgrade: https://github.com/technomancy/leiningen/issues/1265 |
| 12:17 | stuarthalloway | my customer read that issue to mean "lein prioritizes developers and is not well-suited for repeatable builds" |
| 12:18 | stuarthalloway | which I don't think is the intention |
| 12:18 | llasram | stuarthalloway: I believe `auto` in that sense just means `self` |
| 12:18 | xeqi | stuarthalloway: its a misnomer, auto should be self in that issue |
| 12:19 | stuarthalloway | so lein-pkg actually disables *explicit* update? |
| 12:19 | xeqi | it should. Its for thinkgs like apt-get where the package manager should be used to control the version |
| 12:20 | stuarthalloway | xeqi,llasram: great, thanks -- that is much more encouraging |
| 12:23 | ichrvk | Hello everybody! |
| 12:23 | ichrvk | Nice to meet y'all |
| 12:23 | ichrvk | how alive is this channel? |
| 12:23 | stuarthalloway | technomancy: how do I say "lein pom" for production? |
| 12:24 | joegallo_ | ichrvk: quite alive |
| 12:24 | stuartsierra | Asking again: anybody seen "java.lang.IllegalStateException: Attempting to call unbound fn: #'potemkin/transform-fn-bodies" while loading code which uses Lamina? |
| 12:24 | mdrogalis | stuartsierra: I've used Lamina a fair amount - can't say I have, sorry. |
| 12:25 | stuartsierra | Only happens for me on one particular environment (Ubuntu on VirtualBox) so I'm stumped. |
| 12:26 | technomancy | stuarthalloway: the default profiles get stripped out of the project map before the pom is calculated: https://github.com/technomancy/leiningen/blob/master/src/leiningen/pom.clj#L361 |
| 12:26 | stuarthalloway | technomancy: that is not what I am seeing |
| 12:26 | mdrogalis | stuartsierra: That's pretty odd. Does it happen with a clean virtual box of the same OS? |
| 12:26 | stuarthalloway | technomancy: double and triple checking now |
| 12:27 | stuartsierra | mdrogalis: This was a clean virtual box. :( |
| 12:27 | technomancy | stuarthalloway: ok; definitely interested in a repro case if you find anything |
| 12:27 | mdrogalis | stuartsierra: Yuck. |
| 12:29 | xeqi | stuartsierra: you might clear the ~/.m2 of potemkin incase that box has a bad download |
| 12:29 | stuartsierra | xeqi: Tried that multiple times already. |
| 12:31 | mdrogalis | stuartsierra: Lamina has upset me a great many times over the last year. I try not to use it. D: |
| 12:32 | ThePawnBreak | how can I match the beginning of a string with a regexp? |
| 12:32 | stuartsierra | mdrogalis: This is in a client's code so I'm stuck with it. |
| 12:33 | stuarthalloway | technomancy: repro steps at https://github.com/technomancy/leiningen/issues/1343 |
| 12:33 | ichrvk | ThePawnBreak: "^" is the beginning of a string |
| 12:33 | stuarthalloway | technomancy: does not seem to be a problem for other commands I tested, e.g. "lein deps :tree" does the right thing |
| 12:33 | ichrvk | ThePawnBreak: just as "$" is the end of the string |
| 12:34 | ThePawnBreak | ,(st/replace "gigi" #"\^gigi" "test") |
| 12:34 | clojurebot | #<CompilerException java.lang.RuntimeException: No such namespace: st, compiling:(NO_SOURCE_PATH:0:0)> |
| 12:34 | ThePawnBreak | this outputs gigi instead of test |
| 12:34 | technomancy | stuarthalloway: right... ok. so if you look at nrepl, it's added as <scope>test</scope> |
| 12:34 | technomancy | oh, he left |
| 12:35 | hiredman | stuartsierra: are any dependencies depending on different versions of potemkin? |
| 12:35 | xeqi | stuartsierra: I can only find that fn in potemkin 0.1.6. Is there a difference in the dependency trees between the environments? |
| 12:35 | ThePawnBreak | ichrvk: any idea why? |
| 12:35 | llasram | ThePawnBreak: If nothing else, part of the reason for having the #"" reader form for regexps is that you don't need to double-escape regex meta characters |
| 12:35 | llasram | So it should just be #"^gigi" |
| 12:36 | ThePawnBreak | llasram: you're right; thanks |
| 12:36 | stuartsierra | xeqi: I don't see how. It's the same code. |
| 12:37 | stuartsierra | But `lein deps :tree` stack overflows. |
| 12:38 | xeqi | stuartsierra: what version of lein? |
| 12:38 | stuartsierra | xeqi: 2.3.2 |
| 12:38 | xeqi | sadness |
| 12:39 | mdrogalis | stuartsierra: I take it this is one of those 'everything is broken' days? |
| 12:40 | stuartsierra | mdrogalis: Just the one thing really. But it's a complete blocker. |
| 12:41 | mdrogalis | What a pain. |
| 12:41 | justin_smith | concurrency semantics question: I want to start operating on a stream that may not be done generating yet - how do I ensure I continue waiting for new data in the stream if the source of the stream is still working? I was thinking of having a lock passed in, but the lock negotiation logic is making my head hurt and I think clojure may have something better for this. |
| 12:41 | mdrogalis | justin_smith: Can a normal queue suffice? |
| 12:42 | justin_smith | it is a bufferedbytestream |
| 12:42 | ThePawnBreak | is there any way to match a word, regardless of casing? |
| 12:42 | ThePawnBreak | for example, match live and LiVe with a regex |
| 12:42 | justin_smith | coming from a buffered image source (an image resize operation) |
| 12:42 | xeqi | stuartsierra: as a try to get this working next step, you could `lein pom` and `mvn dependency:tree` |
| 12:43 | stuartsierra | xeqi: That's a good idea, thanks. |
| 12:43 | xeqi | I'll be happy to fix the stack overflow if you are able to reproduce in a sharable way |
| 12:43 | justin_smith | mdrogalis: iow I don't really think I can make it be a queue - I would be happy to be proven wrong |
| 12:44 | stuartsierra | xeqi: I'll see if I can find the cause. May take a while. |
| 12:44 | xeqi | hiredman, stuartsierra: or version ranges |
| 12:44 | llasram | ThePawnBreak: http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html, section on "Special constructs". Turn on the `?i` flag |
| 12:44 | mdrogalis | justin_smith: Not sure. Gonna pop out for lunch. Back later. |
| 12:45 | xeqi | I lean toward thinking the tree has a dependency loop that doesn't get broken out of by pedantic |
| 12:46 | stuartsierra | Well, based on what lein is downloading, I've got Lamina 0.5.0-beta10 and potemkin 0.2.0. |
| 12:46 | stuartsierra | Again, same versions I have everywhere else, this problem only occurs on one VM. |
| 12:47 | ztellman | stuartsierra: just arrived, anything I can help with? |
| 12:47 | ztellman | not sure about the context |
| 12:47 | stuartsierra | ztellman: Aha! There you are! |
| 12:47 | kephale | cemerick: regarding friend, is there an easy way (including hard coded solutions for just a few users) to use openid auth but have app specific privileges, like admin? |
| 12:47 | stuartsierra | ztellman: java.lang.IllegalStateException: Attempting to call unbound fn: #'potemkin/transform-fn-bodies |
| 12:48 | xeqi | kephale: can you give those users roles including admin? |
| 12:48 | ztellman | yeah, potemkin 0.2.0 is way old |
| 12:48 | ztellman | is that an explicit dependency |
| 12:48 | ztellman | ? |
| 12:48 | stuartsierra | ztellman: No idea, since `lein deps :tree` stackoverflows. :P |
| 12:48 | ztellman | haha |
| 12:48 | stuartsierra | But I'm assuming it's via Lamina or Aleph, both of which this project uses. |
| 12:49 | ztellman | can you run the maven equivalent of deps :tree? |
| 12:49 | ztellman | I always have to look up what it is |
| 12:49 | xeqi | lamina 0.5.0-beta10 requires it https://github.com/ztellman/lamina/blob/0.5.0-beta10/project.clj#L6 |
| 12:49 | stuartsierra | ztellman: yes, hang on |
| 12:49 | justin_smith | possibly unrelated: I had a bug where I wasn't seeing a function from a newer version of a lib, the culprit was an aot-compiled lib that had required an older version, so pedantic / exclusions were inapplicable |
| 12:49 | kephale | xeqi: i'm still just a neophyte of friend, so i'm not exactly sure what you mean by giving them roles, but yes i could easily come up with a keyword for each situation/user |
| 12:50 | ztellman | xeqi: oh, wow, I forgot how old beta10 was |
| 12:50 | technomancy | justin_smith: eep |
| 12:50 | technomancy | justin_smith: one thing that would be cool would be a clojars spider that could yell at people for stuff like that =) |
| 12:50 | justin_smith | luckily the aot-compiled lib was from my own project, so I was able to update it instead of forking |
| 12:50 | stuartsierra | justin_smith, technomancy, ztellman: I'm fairly well-convinced that it's something to do with AOT-compilation. I just can't narrow it down. |
| 12:50 | justin_smith | heh, I will yell at the guy on our team that decided to aot-compile |
| 12:51 | ztellman | stuartsierra: totally plausible |
| 12:51 | ztellman | stuartsierra: are you able to update the versions of aleph et al? |
| 12:51 | technomancy | AOT is always my go-to scapegoat =) |
| 12:51 | stuartsierra | ztellman: Possibly, I can try that. |
| 12:52 | ztellman | just target [aleph "0.3.0"] and rip out any other references to my libraries |
| 12:52 | justin_smith | just this morning, updating an aot-compiled lib totally fixed my issue :) |
| 12:52 | ztellman | I can vouch for that working in an AOT-compiled service of my own |
| 12:53 | ztellman | also, mdrogalis: sorry |
| 12:56 | stuartsierra | ztellman: My dependency tree: https://gist.github.com/stuartsierra/6903938 |
| 12:59 | stuartsierra | Trying again with Aleph 0.3.0 and Lamina 0.5.0 final... |
| 12:59 | ztellman | stuartsierra yeah, that doesn't point to any obvious issues |
| 13:00 | ztellman | it looks like an AOT issue where a more recent lib is being referenced |
| 13:00 | ztellman | stepping away for a bit, let me know how it goes |
| 13:00 | stuartsierra | ztellman: thanks |
| 13:00 | kephale | xeqi: ok i see what you're saying, but the question stems from the use of openid, where it isn't immediately obvious how to attached app specific roles to users |
| 13:08 | mdrogalis | ztellman: I don't hold it against you. :) |
| 13:14 | ztellman | mdrogalis: well, if you ever have problems with my crap in the future, let me know |
| 13:17 | jcrossley3 | technomancy: like bundler for ruby and /etc/hosts for networking ;) |
| 13:18 | technomancy | jcrossley3: or the starter kit for emacs! |
| 13:18 | technomancy | oh wait |
| 13:18 | jcrossley3 | ha |
| 13:20 | stuartsierra | OMG I think it's working. |
| 13:21 | kephale | cemerick, xeqi: got it, easily solved by asocc-ing roles in response to :identity within the credentials-fn of the openid workflow |
| 13:24 | rasmusto | kephale: it's assoc, though I pronounce it "ass sock" |
| 13:25 | mdrogalis | ztellman: Didn't mean to offend. I think async programming for the application programmer is hard in general, and Lamina was kind of the only Clojure solution for a while. |
| 13:26 | stuartsierra | ztellman: Updating Lamina & Aleph appears to have resolved the issue. Phew. Thanks for your help. |
| 13:26 | coventry | Is there a clean way to subclass a concrete class in clojure code? I would like to make a shim of java.io.Reader for passing to Compiler/load which takes a list of forms to spit out when its .read method is called. |
| 13:26 | ztellman | stuartsierra: great, glad to hear it |
| 13:27 | ztellman | mdrogalis: no worries, I'll be the first to admit Lamina's flaws |
| 13:27 | gtrak | coventry: http://chasemerick.files.wordpress.com/2011/07/choosingtypeforms2.png |
| 13:28 | coventry | gtrak: Thanks. |
| 13:28 | mdrogalis | ztellman: :) |
| 13:28 | coventry | ztellman: I think I found a way around all the print-dup craziness in sleight: clone Compiler/load: https://www.refheap.com/19541 |
| 13:29 | coventry | (But I think it would be cleaner to have a Reader shim to pass to Compiler/load instead.) |
| 13:30 | ztellman | coventry: if we can cleanly hijack Compiler/load, that's a far better approach |
| 13:30 | ztellman | but that means transitively hijacking everything that touches Compiler/load |
| 13:32 | deg | <flame on> Does anyone believe that https://gist.github.com/deg/6902409 contains more useful info than a message like "Error compiling:(degel/muxx/server.clj:84:39). Map literal must contain an even number of forms."? |
| 13:32 | deg | What value do we get from letting the Clojure compiler percolate internal/java details? Is it just a question of not enough time or hands, or is there some value to the current state of affairs? |
| 13:32 | bitemyapp | deg: seems pretty informative to me. |
| 13:33 | gtrak | deg, well, you can tell when it's happening, that's useful |
| 13:33 | mdrogalis | deg: That's a pretty good error message. |
| 13:33 | mdrogalis | Your eyes will eventually be able to parse a stack trace like that qucikly. |
| 13:33 | mdrogalis | Quickly* |
| 13:34 | deg | Seriously? It's a syntax error. I don't need a compiler stack trace. |
| 13:34 | gtrak | i'd rather have more info than not |
| 13:34 | coventry | ztellman: Hmm, you don't think dropping changing sleight.rt/load-resource-script*'s Compiler/load call to that compiler-load function I linked will suffice? |
| 13:34 | bitemyapp | Ditto. |
| 13:34 | deg | Of course, it would be even better if the compiler could deliver multiple warnings when compiling a file, but for now I'd be thrilled just not to get these long useless stacktraces for silly typing errors. |
| 13:34 | bitemyapp | deg: eventually you just see blonde, brunette...redhead... |
| 13:34 | llasram | deg: I've put some thought into this, and the Clojure model actually makes it really difficult to do much else |
| 13:34 | gtrak | deg: plus, the lines of compile-time vs run-time are blurry |
| 13:34 | gtrak | this way there is no doubt |
| 13:35 | ztellman | coventry: you know, that might be the case, it's been a while since I looked at exactly how I was defacing the compiler |
| 13:35 | llasram | (inc gtrak) |
| 13:35 | lazybot | ⇒ 7 |
| 13:35 | mdrogalis | deg: You can propose a fix on the Clojure-dev mailing list if you feel strongly about it. |
| 13:35 | deg | llasram: Is there a brief answer of why the Clojure model makes it so hard? |
| 13:36 | technomancy | deg: attempting to continue when a form fails will just get you junk errors |
| 13:36 | coventry | ztellman: Oh, the part left out is that I also changed reader/transform-reader to just return a list of forms, which compiler-load then takes. No attempt to round-trip through print-dup. Anyway, I will test it further. |
| 13:36 | technomancy | it's like "hey, foo in undefined. obviously, because it failed to compile as per the previous error." |
| 13:36 | deg | technomancy: Understood. Continuing is nice to have, but tough. |
| 13:36 | ztellman | coventry: right, if we can avoid having to render the code, that's ideal |
| 13:36 | ztellman | so please, give it a try and submit a pull request if it works |
| 13:37 | deg | But, it should be relatively easy (says he, without seeing the code) to just give a brief single warning message on the first error. |
| 13:37 | dnolen | deg: the Clojure reader is not particularly friendly w/ respect to errors, tools.reader is much nicer hopefully the changes can make their way back into the standard reader |
| 13:37 | coventry | ztellman: Yep, I'll be in touch. :-) |
| 13:37 | llasram | deg: Mostly because of what gtrak said. The basic compiler is really simple, with layers built up in macros and internal functions. |
| 13:37 | deg | Currently, the COMPILER IS CRASHING on a user syntax error. Compilers are not supposed to do that. |
| 13:37 | gtrak | deg: it's not crashing... |
| 13:38 | llasram | deg: By the time a piece of code knows it has an erroneous form, it can be arbitrarily difficult to correlate that to a particular user error |
| 13:38 | deg | From a user perspective, yes it is. I claim we've all been blinded by too much time accepting this as ok. |
| 13:38 | gtrak | deg: to see the issue, consider that clojure code is generally java classes/bytecode that get generated at runtime. |
| 13:38 | dnolen | deg: what language do you use doesn't go haywire on syntax errors? |
| 13:38 | coventry | Every (decent) compiler I've ever used has errored out on a syntax error. If there's a better way, I would like to hear it. |
| 13:38 | dnolen | I want to know about it |
| 13:38 | gtrak | when the code actually runs, it has no idea when/how it was generated |
| 13:38 | deg | But, it knows the line number. It really has enough info? |
| 13:38 | gtrak | so, it needs to fail-fast. |
| 13:39 | mtp | coventry clearly the compiler should just correct your syntax error and press on!! |
| 13:39 | llasram | deg: Reader errors are one case where might be able to do something nicer, but it would end up being a special error-reporting path which wouldn't work for the general case |
| 13:39 | clojurebot | Excuse me? |
| 13:39 | deg | Most compilers (including Common Lisp, which has some similarity to Clojure) gives the user a one-line error message. |
| 13:39 | technomancy | coventry: "it looks like you're trying to put an odd number of things in a map. would you like me to pad it out with nil? [Y/n]" |
| 13:39 | technomancy | </clippy> |
| 13:39 | mtp | automatic random-crap insertion until it compiles, so we can simulate users! |
| 13:40 | llasram | deg: And most Clojure REPLs just give you the exception message by default, not the full trace |
| 13:40 | ThePawnBreak | how can I remove a string from a reg-exp using st/replace? (st/replace "remove this stuff KEY this too" #"(\.*)KEY(\.*)" "KEY") --> I want the output: "KEY" |
| 13:40 | ToxicFrog | dnolen, llasram: there's a difference between "compiling bailing after the first error" and "compiler vomiting a 30+ frame stack trace of compiler internals on the first error" |
| 13:40 | coventry | deg: Oh, you're objecting to the unreadable spew? I'm with you there. |
| 13:40 | ToxicFrog | The latter looks a lot like a compiler crash even if it is technically not. |
| 13:40 | llasram | ThePawnBreak: You're still `\` escaping your regex meta characters (`.`) |
| 13:40 | dnolen | ToxicFrog: deg: don't confuse tooling w/ languages |
| 13:40 | deg | coventry: yes, that was the immediate trigger for this flame. |
| 13:40 | ThePawnBreak | I thought . isn't in the same category |
| 13:40 | ThePawnBreak | like w |
| 13:40 | TimMc | &`{1} |
| 13:40 | lazybot | java.lang.RuntimeException: Map literal must contain an even number of forms |
| 13:41 | TimMc | &`{1 ~@nil} |
| 13:41 | lazybot | java.lang.IllegalArgumentException: No value supplied for key: 1 |
| 13:41 | deg | But, ideally (and I know it's a big project) I'd love to see the compiler able to generate multiple warning messages. |
| 13:41 | gtrak | it's not unreadable. I can read it and it's informative. I appreciate that clojure doesn't insulate me from the details when I want to know them. I think there could be a case made for more succinct error messages too, but not as a revolt against that. |
| 13:41 | ToxicFrog | I would settle for the compiler not showing me all of its internals every time there's an error in my code. |
| 13:41 | llasram | ThePawnBreak: nope! |
| 13:42 | coventry | deg: Yeah, there is huge room for improvement in error messages, and failure when argument signatures don't match. |
| 13:42 | deg | gtrak: I got 67 (!!) lines of spew, just to tell me that I had skipped a token. |
| 13:42 | ThePawnBreak | llasram: but I do need to escape w, right? |
| 13:42 | TimMc | gtrak: What? Clojure's error messages are terrible. |
| 13:42 | deg | It's even worse in other cases. |
| 13:43 | llasram | ThePawnBreak: if you're trying to use `\w`, then yes. The Pattern class doco I sent you a link to earlier has a full description of the complete Java RE syntax |
| 13:43 | TimMc | Stack traces from the compiler are for compiler-developers; someone just trying to compile their code is a *user*, so they should be shown a good message. |
| 13:43 | ToxicFrog | gtrak: go read https://gist.github.com/deg/6902409 . The first line is useful. The rest is completely worthless noise unless you are debugging the compiler itself. |
| 13:43 | deg | Clojure would be much more newbie-friendly if the error messages made it easy to debug. |
| 13:43 | ThePawnBreak | llasram: thanks, and sorry for being an idiot |
| 13:43 | ToxicFrog | It should be available if you are debugging the compiler, but most of us aren't, we just want to know where the error in our code is. |
| 13:43 | dnolen | deg: Clojure already supports pretty stack traces ... no one uses them |
| 13:43 | llasram | ThePawnBreak: learning is the thing! |
| 13:44 | deg | I guess my question really is: "Is this a known problem that nobody has time to fix; or do enough folks believe that this is philosophically correct" |
| 13:44 | technomancy | deg: yeah, the core team isn't particularly concerned about usability for newcomers |
| 13:44 | TimMc | ding ding ding |
| 13:44 | deg | dnolen: the point is not pretty stack traces. There should be no stack trace at all of the compiler guts. |
| 13:44 | llasram | deg, technomancy, TimMc: That may be true, but I really do think it would be v v hard to make errors nicer in the general case. Every internal macro carefully checking args, etc |
| 13:44 | deg | when the error lies in the code being compiled. |
| 13:44 | `cbp | pretty stack traces? |
| 13:44 | technomancy | it's difficult (possible but very awkward) to address this problem from outside, but it's fighting upstream |
| 13:45 | ToxicFrog | More generally, clojure is the only language I've used where an error in your code will result in getting frames of runtime internals interspersed with "actual" stack frames, but that may be an unavoidable consequence of running on the VM. |
| 13:45 | dnolen | deg: that's what I'm talking about |
| 13:45 | ToxicFrog | The situation with the compiler could absolutely be improved, though. |
| 13:45 | dnolen | deg: You can get traces w/ no internals w/o munging ... no one uses them |
| 13:45 | ThePawnBreak | llasram: is there any way to negate \w ? |
| 13:45 | ToxicFrog | dnolen: I didn't even know that was possible until this discussion. |
| 13:45 | deg | dnolen: sorry too many negatives in your last line. I didn't understand. |
| 13:45 | ToxicFrog | Maybe no-one uses them because they are neither the default nor widely known. |
| 13:46 | `cbp | dnolen: can you elaborate a bit? |
| 13:46 | gtrak | well, it's a small compiler :-), it would have to get bigger to support such things. |
| 13:46 | technomancy | deg: I was working on a branch of clj-stacktrace which filtered stack traces, but then Chouser announced he was going to release his own stack trace lib that looked a lot more powerful, so I stopped |
| 13:46 | ToxicFrog | And for the compiler itself, this is irrelevant. |
| 13:46 | dnolen | (require '[clojure.repl :as r]) |
| 13:46 | technomancy | but he never did =\ |
| 13:46 | llasram | ToxicFrog: \W ? Not entirely certain what you're asking |
| 13:46 | dnolen | (r/pst e*) |
| 13:46 | ToxicFrog | llasram: what? |
| 13:46 | `cbp | dnolen: ty |
| 13:46 | llasram | ToxicFrog: Sorry, wrong person :-) |
| 13:46 | llasram | ThePawnBreak: \W ? Not entirely certain what you're asking |
| 13:46 | deg | technomancy: I don't think it's a stack trace issue. It's more a question of "what is the mandate for a compiler" .. |
| 13:47 | ThePawnBreak | llasram: something that matches x iff \w doesn't match it |
| 13:47 | technomancy | deg: well if you come at it from that angle you're not going to get anywhere |
| 13:47 | gtrak | the fact that you CAN understand the internals compiler is a testament to its minimalism.. bad error messages aside. |
| 13:47 | coventry | (pst) is hugely useful. |
| 13:47 | deg | currently, the compiler is "compile this code or die trying". Instead it should be (imho) "compile this code, yielding either a compilation or an error message" |
| 13:47 | technomancy | deg: fixing it there would require buy-in from clojure/core, which isn't going to happen IMO |
| 13:47 | deg | A compiler-generated error/warning message is not the same as the compiler error. |
| 13:47 | llasram | ThePawnBreak: Well, that's what the Pattern doco seems to suggest |
| 13:48 | technomancy | it's more productive to think about what you can actually fix instead of shaking your fist at the sky |
| 13:48 | deg | technomancy: Now, that's interesting. So, you are saying that there actually is a philosophical argument against fixing this. What is the argument? |
| 13:48 | sm0ke | llasram: there? |
| 13:48 | llasram | sm0ke: Yah. What's up? |
| 13:49 | dnolen | deg: there's not really a philosphy, enhancements are extremely low priority. FWIW, ClojureScript is more like how you suggest. |
| 13:49 | technomancy | deg: oh, I'm not saying that; I'm just saying it's very difficult to get *any* changes into the compiler, philosophically-motivated or not. |
| 13:49 | dnolen | deg: multiple warnings, instead of aborting |
| 13:49 | sm0ke | llasram: OK i am a clojure newbie so excuse if am completely misunderstood.. |
| 13:50 | deg | I actually expect (again, without looking at the code) that changes can be made incrementally, macro-by-macro, function-by-function in the compiler, making individual error cases easier to understand. |
| 13:50 | ToxicFrog | technomancy: so...I should abandon my plans to upgrade the compiler to be less stack-tracy? |
| 13:50 | technomancy | ToxicFrog: depends; how do you feel about forking? =\ |
| 13:50 | deg | I would even jump in and see if I could do some, unless there was (as you suggest) reason to believe that no such changes would be accepted. |
| 13:50 | sm0ke | llasram: but i wanted to ask when using abracad when i decode a byte array using a avro schema is the return type a map? |
| 13:50 | coventry | technomancy: If someone forked clojure, they could produce a logo just by turning the regular clojure logo upside down. :-) |
| 13:50 | dnolen | deg: there are individual enhancement tickets they will be low priority |
| 13:50 | ToxicFrog | Right now I actually have a bash script that wraps it and hides everything but the first line of the error, since that's the only useful part~ |
| 13:50 | dnolen | s/there/these |
| 13:50 | ToxicFrog | technomancy: :/ |
| 13:51 | sm0ke | llasram: but i noticed something very interesting..when i do a (type) on the return type if get the avro schema name, how that works? |
| 13:52 | deg | dnolen: Have other folks tried doing these fixes already, and they are queued for approval? Or has no one really tried yet? |
| 13:52 | llasram | sm0ke: The Clojure `type` function first checks to see if an object has `:type` metadata, and returns that if it does |
| 13:53 | ToxicFrog | This would be a lot easier to fix if it threw a ClojureCompilerException rather than a generic RuntimeException. |
| 13:53 | coventry | deg: My impression is that the core team is totally hosed by all the patches proposed. |
| 13:53 | llasram | sm0ke: When abracad deserializes a record, the default deserialization reader adds `:type` metadata for the schema type name |
| 13:53 | llasram | sm0ke: If you really just want to know the class of an object, use `class` |
| 13:53 | sm0ke | llasram: cool..awesome way to trackdown the type..does that works recursively? |
| 13:54 | coventry | The other day I came across some way of pulling a graph out of jira showing the number of issues submitted vs number resolved. It looked a bit overwhelming. |
| 13:54 | sm0ke | llasram: i mean what will i get if i have defined a union withdifferent types in avro |
| 13:54 | dnolen | deg: people have tried in the past, some of these enhancements land eventually. It's not futile, it's just slow. |
| 13:54 | coventry | Here: http://dev.clojure.org/jira/browse/CLJ |
| 13:54 | deg | coventry: I see only 30 pull requests at https://github.com/clojure/clojure/pulls. Am I looking in the wrong place? |
| 13:54 | deg | (crossed) |
| 13:55 | dnolen | deg: Clojure and contrib projects doesn't do pull requests, only patches in JIRA |
| 13:55 | mdrogalis | Oh yeah. |
| 13:55 | llasram | sm0ke: If you have a union of two record types, the result of deserializing should have :type metadata indicating which one it actually was |
| 13:56 | sm0ke | llasram: ok not trying to be a tool here but if the union types each has nested unions with themselves, is there way to track that? |
| 13:56 | tbaldridge | deg: to be honest, I'd rather have the compiler spit out too much error information than not enough. I really hate it when tools assume I only want the top of a stacktrace |
| 13:56 | deg | dnolen, coventry: I see. 300+ open issues; only 750 closed historically. Ouch. |
| 13:56 | tbaldridge | sometimes when working with macros, I want th eentire thing. |
| 13:57 | llasram | sm0ke: Well, you can't have unions directly in unions. But any default-reader record produced by abracad during deserialization will have :type metadata, no matter at what level of nesting appears |
| 13:57 | deg | tbaldridge: Agreed, but the issue isn't depth of stack trace. It's having the compiler separate levels of meta - distinguishing between its innards and the code it is compiling. |
| 13:58 | sm0ke | llasram: ah didnt know about that limitation of avro..thanks much that makes sense! |
| 13:59 | deg | Anyway, my wife is calling me to dinner so I'm gonna abandon this fun for a bit. |
| 13:59 | llasram | sm0ke: np! |
| 13:59 | technomancy | ToxicFrog: actually using ex-info for compiler exceptions is a no-brainer IMO |
| 13:59 | ToxicFrog | ex-info? |
| 14:00 | technomancy | not that I think it'd be accepted, but it's a much better way to do it |
| 14:00 | technomancy | ToxicFrog: exceptions with a map attached |
| 14:00 | ToxicFrog | Aah |
| 14:00 | ToxicFrog | Yeah, it would be nice if it did that, wouldn't it? |
| 14:07 | TimMc | It looks like Compojure won't dispatch on which query parameters are present, is that correct? |
| 14:08 | dnolen | technomancy: hey grench is pretty cool, I'm assuming the idea is for it be project local? |
| 14:09 | technomancy | dnolen: that's the typical workflow, but there's nothing preventing it from working against a systemwide nrepl server |
| 14:12 | TimMc | Raynes: My god this laser selector is ugly... https://www.refheap.com/19572 |
| 14:13 | Raynes | TimMc: Looks fine to me. |
| 14:14 | TimMc | D-: |
| 14:14 | gtrak | TimMc: here's the business end: https://github.com/weavejester/clout/blob/master/src/clout/core.clj#L119 |
| 14:15 | dnolen | technomancy: hrm should `grench lein deps-tree` or something like that work if I've started a :headless repl? |
| 14:16 | technomancy | dnolen: if you have started a lein-specific nrepl server then `grench lein deps :tree` should work |
| 14:16 | TimMc | gtrak: What should I be seeing there? |
| 14:16 | technomancy | lein-specific meaning just that it was launched from outside a project dir |
| 14:17 | gtrak | TimMc: so, I'm not sure if something pull off the query params for the URI, but, the regex match is what's determining the route-dispatch |
| 14:17 | gtrak | each route returns a response or nil, and the whole thing is run inside a big 'some' |
| 14:18 | logic_prog | is clojure docs down? |
| 14:18 | logic_prog | also, where is "def" defined? |
| 14:18 | logic_prog | defn = clojure.core/defn |
| 14:18 | TimMc | logic_prog: def is a special form |
| 14:18 | logic_prog | why is there no clojure.core/def ? |
| 14:19 | TimMc | That means it's a true language primitive, defined only inside the compiler itself. |
| 14:19 | dnolen | technomancy: when I try to that I get a "Couldn't find project.clj ..." |
| 14:19 | tbaldrid_ | logic_prog: http://clojure.org/special_forms |
| 14:19 | llasram | logic_prog: If you really want to find it, try poking around in Compiler.java |
| 14:19 | technomancy | dnolen: ah, that's due to a lein bug; try upgrading to 2.3.3 |
| 14:20 | dnolen | technomancy: I'm on 2.3.3 |
| 14:20 | technomancy | hmm... very odd |
| 14:20 | gtrak | TimMc: as far as I know, compojure doesn't care about query params for routes, but it relies on a middleware to throw them into the :params bucket on the request map, and then its destructuring pulls them from there |
| 14:20 | coventry | logic_prog: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L369 |
| 14:21 | TimMc | Raynes: Actually, that doesn't even do what I thought it would. :-( |
| 14:21 | technomancy | dnolen: just to be clear, I meant the `grench eval` and `grench repl` stuff could work outside the context of a project |
| 14:22 | dnolen | technomancy: I missing something here, is grench about persistent REPL per project so that lein commands are faster or something? |
| 14:23 | dnolen | something else? |
| 14:23 | jtoy | how can I run arbitrary methods uberjar? |
| 14:24 | technomancy | dnolen: it's three separate things actually. |
| 14:24 | technomancy | 0) being able to eval arbitrary code in a running nREPL server (completely orthogonal to Leiningen; lein is just the main way people launch these nrepl servers) |
| 14:24 | technomancy | 1) an interactive repl implementation with eval semantics similar to 0) |
| 14:24 | gtrak | jtoy: clojure.main might be what you want? can you be more specific? |
| 14:25 | technomancy | and 2) a way to run lein tasks in an already-running lein JVM |
| 14:25 | dnolen | technomancy: for 2) is this a global lein JVM? |
| 14:26 | jtoy | gtrak i have an uberjar, i can just call mynamspace.myfunction to call it or do I have to write a main function for each namespace? |
| 14:26 | gtrak | jtoy: ah, yea, clojure.main provides an eval for you |
| 14:26 | technomancy | dnolen: right, the lein tasks runs in a lein-specific JVM but if the lein task involves running project code it could stil start a project JVM |
| 14:27 | technomancy | dnolen: you can avoid launching a new project JVM from within lein by sending stuff to a project nREPL server, but that actually is orthogonal to grench |
| 14:27 | technomancy | you've been able to do that for months now |
| 14:27 | technomancy | I should draw a diagram or something |
| 14:27 | kmicu | yes |
| 14:27 | dnolen | technomancy: oh hrm, where is the project nREPL server bit documented? |
| 14:28 | dnolen | technomancy: I missed this |
| 14:28 | gtrak | jtoy: so I think you'd do java -cp your-uber.jar clojure.main -e "(do (require 'your.ns) (your.ns/function))" |
| 14:28 | jtoy | gtrak: ah, great! I will test it |
| 14:28 | Raynes | TimMc: What did you think it would do? |
| 14:29 | Raynes | TimMc: Anyways, if you want to write l/from-css, by all means be my guest. |
| 14:29 | technomancy | https://github.com/technomancy/grenchman#usage <- this describes regular project eval under "Usage" and the "Leiningen" stuff under its own section |
| 14:29 | Raynes | TimMc: I'd take that pull request. |
| 14:29 | technomancy | hm; it should probably be re-worded to make the separation more explicit |
| 14:32 | technomancy | dnolen: the project started as being more lein-centric, but hugod had some good suggestions for how to make it less coupled |
| 14:33 | dnolen | technomancy: I mean, setting grench aside, how can I start a project local nREPL server today and run lein tasks faster? Is this documented somewhere? |
| 14:34 | technomancy | dnolen: oh, gotcha. that's via :eval-in :nrepl; might only be documented on the wiki: https://github.com/technomancy/leiningen/wiki/Faster |
| 14:35 | dnolen | technomancy: thanks I understand grench a bit more now |
| 14:35 | technomancy | dnolen: cool; hopefully I can make the readme a bit clearer. lots of moving parts. |
| 14:36 | dnolen | technomancy: oh, actually still not clear. in Faster, it specifically says it doesn't speed up lein |
| 14:36 | technomancy | dnolen: right; so there are two separate optimizations |
| 14:36 | technomancy | :eval-in :nrepl avoids launching a new project JVM |
| 14:36 | technomancy | and `grench lein ...` avoids launching a new lein jvm |
| 14:37 | dnolen | technomancy: ok, and `grench lein` can be project local? yes? |
| 14:37 | technomancy | they're separate things, but they're stackable |
| 14:38 | dnolen | technomancy: if `grench lein ...` can be project local, I can't seem to get it to work :) |
| 14:38 | dnolen | `grench lein ... task ...` just returns immediately and nothing happens |
| 14:38 | technomancy | sorry, got a meeting; bbiab |
| 14:39 | TimMc | Raynes: Mmm, figured it out; the adjacency selector needs to be the middle element of the descedant chain. I updated the paste. |
| 14:39 | jonasen | dnolen: so I'm looking at CLJS-610. The deftype/defrecord/defprotocol stuff is pretty daunting |
| 14:40 | TimMc | I really like laser other than this translation difficulty I'm having; from-css would be a neat tack-on lib. |
| 14:40 | jonasen | One thing I noticed is that defrecord isn't built on top of deftype. Why is that? I thought it would be a much simpler macro. |
| 14:42 | bitemyapp | Having really fun conversations with my coworkers about Clojure and Datomic lately |
| 14:42 | bitemyapp | Starting to sound like I might get to do more Clojure after my current project. :) |
| 14:45 | hiredman | jonasen: defrecord definitely emits a call to deftype |
| 14:45 | hiredman | well, deftype* I guess |
| 14:46 | hiredman | which is what deftype does too |
| 14:47 | TimMc | In CLJS? |
| 14:47 | hiredman | oh, no, in clojure |
| 14:47 | cYmen | Good evening. |
| 14:48 | jonasen | hiredman: Yes, I looked at the Clojure src and there it expands to deftype*, not so in CLJS |
| 14:48 | cYmen | Could somebody please explain the following sentence: Clojure provides bindings to Vars, which are containers bound to mutable storage locations. |
| 14:49 | cYmen | It seems to define the concept "Var" by using the concepts "container" and "storage location". I assume a storage location is a place in memory and I know what a container is but with those interpretations I cannot parse that sentence. :) |
| 14:50 | gtrak | cYmen: that's an awkward way to say it, but Vars are dynamic-scoped reference objects with a thread-local stack discipline. |
| 14:50 | hiredman | a var is basically a handle(pointer to a pointer) with a name |
| 14:50 | gtrak | if that's any less awkward |
| 14:51 | hiredman | well, that kind of confuses things, because it brings in how the jvm allocates things on the heap I guess |
| 14:51 | hiredman | so a var is a pointer with a name |
| 14:51 | dnolen | jonasen: oh yeah, happy to take a refactor patch |
| 14:52 | cYmen | hm.. |
| 14:52 | dnolen | jonasen: I wanted to get a refactor patch from the specify/specify! work but I never saw anything |
| 14:52 | jonasen | weird, this is the only place I see defrecord* used https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L804 |
| 14:52 | hiredman | ,(resolve 'clojure.core/+) |
| 14:52 | clojurebot | #'clojure.core/+ |
| 14:52 | technomancy | hiredman: true of any c.l.IDerefs, really |
| 14:52 | dnolen | jonasen: why weird? |
| 14:52 | cYmen | hiredman: If by pointer you mean the C/C++ concept: Don't they usually have a name? |
| 14:52 | jonasen | it's not defined anywhere (at least I can't find it) |
| 14:53 | technomancy | dnolen: not sure I understand what you mean by "project-local"; can you be more explicit about the steps you're taking? |
| 14:53 | dnolen | technomancy: I just mean can I avoid paying for lein startup time when running lein tasks in a project |
| 14:53 | cYmen | gtrak: ignoring threads for now what do you mean by reference-object? Somehow I wish these things would be explained totally different. :) |
| 14:53 | hiredman | cYmen: they have a name that you can reference them by in your compiled program, but that name is not reified in the runtime |
| 14:54 | gtrak | cYmen: by reference-object I mean the same thing that others are meaning by pointer |
| 14:54 | gtrak | an object that refers to another in some specific useful way |
| 14:54 | gtrak | that's the 'containerness' |
| 14:54 | riley526 | Quick question: In Python, you can import a module within a function, and the module is only visible within the scope of that function; it does not "leak" to the global namespace. Is there an analog to that in Clojure? |
| 14:54 | hiredman | because vars have the sort of double reference thing going on, and you refer to other functions through vars, you can redefine functions without having to recompile everything |
| 14:55 | dnolen | riley526: nothing similar, and probably for the best ... |
| 14:55 | gtrak | clojure's 'mutable' reference objects are atoms, vars, refs, and agents |
| 14:55 | technomancy | dnolen: right; so when you run tasks like `lein version` you launch one JVM, and when you run stuff like `lein test` you launch two JVMs. each of those can be skipped by connecting to separate existing nREPLs. |
| 14:56 | cYmen | *sigh* |
| 14:56 | technomancy | `grench lein` attempts to invoke :eval-in :nrepl if it can but falls back to launching a subprocess if necessary |
| 14:57 | cYmen | I guess I'll just try to learn more clojure and figure this out later when it doesn't behave the way I expect. |
| 14:57 | dnolen | technomancy: ok, so here's the steps I'm taking |
| 14:57 | cYmen | But I am a bit disappointed by the lack of appropriate language in my head. |
| 14:57 | technomancy | cYmen: once you get a handle on atoms and refs, the fact that vars are reference types makes more sense. |
| 14:57 | dnolen | 1) cd into project directory 2) lein trampoline repl :headless 3) grench lein ... |
| 14:57 | gtrak | vars were kinda tricky to think about, but the impl is pretty small |
| 14:57 | dnolen | technomancy: however grench lein doesn't seem to work |
| 14:58 | technomancy | cYmen: for now just treat them like "things that can change when you recompile" |
| 14:58 | hiredman | vars are code linking constructs |
| 14:58 | cYmen | :) |
| 14:58 | gtrak | the hardest thing for me was reasoning about when they actually get deref'd |
| 14:58 | hiredman | (defn foo [x] x) creates a var foo in the current name that has the value (fn [x] x) |
| 14:58 | technomancy | dnolen: ok, so you're launching an in-project nREPL, which will let the other grench commands work, but `grench lein` needs an out-of-project nREPL |
| 14:59 | bitemyapp | technomancy: I get java.lang.Exception: Error loading project.clj in my lein repl :headless instance when I try to use grench. |
| 14:59 | cYmen | I'll donate 50 € to the clojure project of choice of somebody who can draw me a picture of these concepts so that I will understand them. :) |
| 14:59 | technomancy | dnolen: so `cd ~ && lein repl :headless` |
| 14:59 | technomancy | bitemyapp: lein 2.3.3? |
| 14:59 | hiredman | (defn bar [x] (foo x)) ;; when bar calls foo it goes it derefences the value of the var foo |
| 14:59 | bitemyapp | cYmen: really? because I could do that. |
| 14:59 | bitemyapp | technomancy: no, rectifying now. Sorry :( |
| 14:59 | cYmen | The picture has to be free but yes. |
| 14:59 | cYmen | Don't underestimate my ability to fail at understanding. ;) |
| 15:00 | hiredman | because it goes through the var, you can change the value of the var foo and bar will use the updated value |
| 15:00 | gtrak | cYmen: if you're fearless: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java |
| 15:00 | technomancy | dnolen: a repl that has your project loaded doesn't know anything about lein tasks |
| 15:00 | cYmen | er...by free I mean as in creative commons. I'd still donate the money. |
| 15:00 | hiredman | the dynamic binding bits are best ignored |
| 15:00 | technomancy | "Free as in Lessig" |
| 15:01 | bitemyapp | it appears lein is not a task, but grenchman seems to work otherwise. |
| 15:01 | dnolen | technomancy: ok that was I missed! I did that, then in my project `grench lein cljsbuild auto ...` but now I can't seem to kill the process with Control-C ? |
| 15:01 | bitemyapp | makes my unit tests run faster. Fun. |
| 15:01 | technomancy | dnolen: huh... I haven't tested interrupts under grench lein. probably best to open an issue. |
| 15:02 | cYmen | hiredman: How would I tell the compiler which function to call without a Var then? I somehow need to give the function a name. |
| 15:02 | hiredman | cYmen: the compiler takes care of resolving names to vars |
| 15:02 | gtrak | you *could* theoretically do things with only lexical scope |
| 15:02 | hiredman | but you can also do it manually if you want |
| 15:02 | gtrak | your code would literally have to take the shape of a tree. |
| 15:02 | bitemyapp | In fact, avoiding giving names to data can be beneficial at times. |
| 15:03 | cYmen | So that would mean lambdaing it all up? |
| 15:04 | hiredman | no |
| 15:04 | kmicu | Bo problem jest z tym, że Typ się rozlewa na cały kod. |
| 15:04 | kmicu | ignore, ban, kill |
| 15:04 | hiredman | ,(resolve 'clojure.core/+) ;; resolving the name clojure.core/+ to the var #'clojure.core/+ |
| 15:04 | clojurebot | #'clojure.core/+ |
| 15:04 | hiredman | ,(deref (resolve 'clojure.core/+)) ;; the value of the var is the + function |
| 15:04 | clojurebot | #<core$_PLUS_ clojure.core$_PLUS_@1e9f71c> |
| 15:05 | technomancy | cYmen: it's weird at first because clojure gives you access to all these things which are just implicit and magic in most languages |
| 15:05 | hiredman | in my earlier example (defn bar [x] ((deref (resolve 'foo)) x)) would be manually resolving the var and derefing instead of letting the compiler figure it out |
| 15:05 | rasmusto | ,+ |
| 15:05 | clojurebot | #<core$_PLUS_ clojure.core$_PLUS_@1e9f71c> |
| 15:05 | cYmen | I can only attest to the first statement. |
| 15:06 | technomancy | like in Ruby you can't grab a global and look at the global itself; you can just get the value it contains |
| 15:06 | dnolen | technomancy: done, running into lots of bugs, but to be expected, conceptually this pretty cool |
| 15:06 | cYmen | hiredman: Would it still happen at compile time? |
| 15:06 | hiredman | no |
| 15:07 | hiredman | runtime |
| 15:07 | technomancy | dnolen: yeah, it's still pretty immature |
| 15:07 | hiredman | when the compiler does it, it does the resolving at compile time, but the dereferencing at runtime |
| 15:08 | cYmen | Not that I know what resolving and dereferencing mean in this context. ;) |
| 15:08 | hiredman | resolving means looking up a var by name |
| 15:08 | bitemyapp | ,@(atom {:a 1}) |
| 15:08 | clojurebot | {:a 1} |
| 15:08 | hiredman | dereferencing means getting the value of a var |
| 15:08 | bitemyapp | hiredman: or any reference type |
| 15:09 | bitemyapp | vars are reference types. atoms, refs, agents, promises... |
| 15:09 | hiredman | because the resolving happens at compile time you will always be getting the value of the same var |
| 15:09 | gtrak | cYmen: vars get made at compile-time: try this (do #(def b nil) #'b) |
| 15:09 | hiredman | but the derencing happens at runtime so you will get a new value if the value of the var changes |
| 15:10 | technomancy | hrm; I thought deref at runtime went away in 1.3 |
| 15:10 | technomancy | well, I guess conceptually you can still think of it that way |
| 15:10 | gtrak | technomancy: I think that's only for static annotated stuff like + |
| 15:10 | hiredman | no, you have to deref at runtime |
| 15:10 | technomancy | hiredman: oh, explicit deref, you mean |
| 15:11 | hiredman | no, I mean the code the compielr emits |
| 15:11 | gtrak | wait, it's the :inline metadata that does it |
| 15:11 | technomancy | hiredman: I thought that was too slow and 1.3 replaced it with field lookup |
| 15:11 | hiredman | if you have ever used the static stuff, that removes the deref at runtime |
| 15:12 | hiredman | technomancy: 1.3 stopped checking the "is thing thread bound?" field |
| 15:12 | technomancy | hotspot can't inline through a deref |
| 15:12 | hiredman | hotspot could not inline through the old var dereferencing behaviour because it had to check this extra flag |
| 15:12 | technomancy | or maybe hotspot couldn't inline through a deref when deref involved thread checks, but now it can because deref becomes simplefield looku? |
| 15:13 | technomancy | jinx, I think |
| 15:13 | jonasen | dnolen: I'm reading https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj but I can't find where deftype* and defrecord* are defined. Any pointer would be much appreciated :) |
| 15:13 | hiredman | right, to be clear, I am when I say "deref" I mean the general concept of deref'ing something like a pointer, not an IDeref and the deref method |
| 15:13 | technomancy | oooooh okay |
| 15:13 | technomancy | gotcha |
| 15:14 | dnolen | jonasen: oh sorry, I misunderstood, they are special forms |
| 15:14 | technomancy | yes, that's my understanding |
| 15:14 | jonasen | dnolen: ah, ok |
| 15:15 | jonasen | so a possible refactoring would be to remove defrecord* as a special form and expand to deftype? |
| 15:15 | hiredman | post 1.3 the compiler doesn't emit calls to IDeref#deref() for vars, I forget but I think it emits calls to getRawRoot() which is deref without the binding check |
| 15:17 | dnolen | jonasen: I would examine if that's how it's done in Clojure first to see there is a good reason for the separation. |
| 15:17 | dnolen | jonasen: if there isn't a good reason, then unifying them is fine by me. |
| 15:17 | hiredman | (without the binding check the method just returns the field value, just like a getter on some kind of pojo, so hotspot eats that up) |
| 15:17 | technomancy | nom nom nom fields |
| 15:17 | jonasen | I don't think defrecord is a primitive in clojure |
| 15:18 | technomancy | I'm sure that clarifies everything to cYmen =) |
| 15:18 | hiredman | :) |
| 15:19 | cYmen | Yes, I am well informed now. :p |
| 15:19 | dnolen | jonasen: ok, yeah it looks like only deftype* |
| 15:19 | jonasen | dnolen: they have almost identical definitions in analyzer |
| 15:19 | technomancy | compiler internals wooo |
| 15:20 | dnolen | jonasen: yeah, emission is a bit different |
| 15:20 | hiredman | vars are pretty sweet |
| 15:20 | technomancy | they really are |
| 15:20 | technomancy | I heart them so much |
| 15:22 | jonasen | dnolen: I can experiment with removing defrecord*. Should be fun at least :) |
| 15:22 | gtrak | i like that binding-conveyor-fn works at all |
| 15:22 | gtrak | a useful subset of 'environment as a value' |
| 15:23 | hiredman | some day I'll write "Vars, what the hell?" |
| 15:29 | joegallo | hiredman: +1 |
| 15:31 | logic_prog | (slurp (.getOutputStream (. (Runtime/getRuntime) exec "ls")) doens't work -- is there a way to say "return me the outputstream of executing this command as a string" ? |
| 15:33 | piranha | dnolen: hi, cljs keywords are not going to be compressed by closure compiler, right? I have an app which uses React and when I define objects for it, I do (clj->js {:render ....}), and this :render is not mangled. And I need to be, but have no idea how to get that... |
| 15:34 | piranha | *I need it to be |
| 15:34 | logic_prog | fuck it |
| 15:34 | logic_prog | I needed .getInputStream |
| 15:34 | dnolen | piranha: keywords get converted into their string rep just fine |
| 15:34 | llasram | logic_prog: Have you looked at `clojure.java.shell` ? |
| 15:35 | joegallo | yeah, logic_prog you always gotta remember that that's backwards ;) |
| 15:35 | piranha | dnolen: but I need not a string representation, but something like {render: function() ...}, so that render is not a string |
| 15:35 | piranha | so that closure compiler will mangle it |
| 15:36 | dnolen | piranha: what you're asking for doesn't really make sense to me. |
| 15:36 | piranha | why? |
| 15:36 | clojurebot | http://clojure.org/rationale |
| 15:36 | craigbro | hehe |
| 15:36 | dnolen | piranha: keyword have string representation and you are asking for it when converting JSON, mangling doesn't come into the picture at all |
| 15:36 | dnolen | not even a little bit |
| 15:37 | piranha | yes, let me paraphrase |
| 15:37 | piranha | I don't really need keywords, I need something to be a object key, so that it'll be compressed by closure compiler |
| 15:37 | hiredman | joegallo: I actually started the reducers thing last night, so you never know |
| 15:38 | piranha | i.e. I need to get an object like {render: "x"} instead of {"render": "x"}, which is what js-obj can give me... |
| 15:38 | joegallo | hiredman: excelsior! |
| 15:38 | joegallo | i'm so happy to hear that! |
| 15:39 | dnolen | piranha: that is impossible |
| 15:39 | piranha | dnolen: :)) |
| 15:39 | dnolen | piranha: oh rather, we don't support that |
| 15:39 | piranha | dnolen: I just found out about set!, it should ok for me it seems... |
| 15:39 | dnolen | piranha: Closure may support munging "enums" |
| 15:39 | dnolen | piranha: based on what I've seen |
| 15:40 | piranha | (set! (.-render o) "x") gives me o.render = "x", I guess closure should compress that |
| 15:40 | piranha | what's enum? |
| 15:40 | dnolen | piranha: er, anyways, I just didn't understand your question because you were talking about keywords. |
| 15:40 | dnolen | piranha: yes that works |
| 15:41 | piranha | yes, I really started it wrong, I'm sorry |
| 15:41 | piranha | it's just that right now I have keywords there |
| 15:41 | piranha | and amount of things I had to do to realise what's wrong with code was a bit too much for me, I'm just a bit overwhelmed |
| 15:41 | piranha | thanks for listening to me :) |
| 16:04 | philc_ | Is it possible to run a lein plugin in conjunction with an uberjar? lein lobos, in particular |
| 16:06 | udoprog | Does anyone here use maven instead of leiningen, what is your experience? |
| 16:07 | hiredman | we had a maven multi-module build at work, then technomancy decided it was horrible and wrote leiningen :) |
| 16:07 | Creap | I don't have any previous experience with threads, are there any good resources for when and why to run something in a separate thread? Is there overhead and reason to limit the number of threads, etc |
| 16:07 | xeqi | cemerick: have you tried to use cljs sourcemaps with austin? |
| 16:09 | cemerick | xeqi: haven't touched source maps yet |
| 16:09 | xeqi | ah, well I'm about to try it |
| 16:10 | cemerick | xeqi: cheers; should "just work", though I don't know how the source map actually gets to the browser..... |
| 16:13 | logic_prog | is there a way to run "lein cljsbuild auto" from inside emacs? |
| 16:13 | joegallo | besides inside a shell mode buffer? |
| 16:14 | logic_prog | I'd like to intergarte leincljsbuild auto and "nrepl" into a single buffer |
| 16:14 | logic_prog | since they're both executing just lein commands anyway |
| 16:15 | coventry | logic_prog: There were some folks talking about that in a Clojure West talk: <http://www.infoq.com/presentations/clojure-clojurescript>. I have no idea what the state of their tools is https://github.com/BirdseyeSoftware |
| 16:15 | logic_prog | infoq link appears to be broken |
| 16:16 | coventry | Search for "A Shorter Path from Clojure to ClojureScript" |
| 16:16 | logic_prog | oh shit |
| 16:16 | logic_prog | this is exactly what I wnat |
| 16:17 | coventry | Don't get your hopes up yet. Some of the stuff they mentioned, I couldn't find. |
| 16:18 | Frozenlock | logic_prog: Single command, or really a single buffer? |
| 16:18 | coventry | (But worth looking into.) |
| 16:19 | logic_prog | Frozenlock: I'm working in clj + cljs. In emacs, I have one buffer for where I actually write code. I'd like my other buffer to simultaneosly show me (1) nrepl (2) a place where I can type in commands into the repl, and (3) show me cljsbuild compile errors |
| 16:20 | Frozenlock | :-/ |
| 16:21 | Frozenlock | I know you can connect to the cljs repl with an nrepl instance, but adding cljsbuild error message... |
| 16:21 | logic_prog | am I insane, or do other people alsowant this? |
| 16:21 | Frozenlock | I would just do "C-x 3" and :p |
| 16:21 | Frozenlock | Or C-x 2, depending on your setup. |
| 16:22 | Frozenlock | Personnaly I prefer to have the java nrepl and the cljs repl in different buffers. |
| 16:22 | logic_prog | I only have one monitor. |
| 16:23 | hiredman | I ahve 300 emacs buffers open, why not another? |
| 16:23 | Frozenlock | Yes... C-x 2 will divide your screen |
| 16:24 | hiredman | (actually only 247, I rebooted the other day) |
| 16:27 | melipone | hello! I need to escape the special characters embedded in a string. I know how to do that one character at a time but how can I do that for all characters? |
| 16:27 | melipone | The problem is the backslash and recursion will not work. |
| 16:27 | hiredman | escape for what? different systems escape things differently |
| 16:28 | melipone | Escape for re-find |
| 16:28 | hiredman | re-find takes a regex, not a string |
| 16:28 | noncom|2 | dnolen: hi! i have found this ancient topic: https://groups.google.com/forum/#!topic/clojure/5VJ3esXVJL8 i see you were interested in some oo system for, say UIs.. how did it turn out in the end? |
| 16:28 | melipone | yes, but if there is a special character in the regex, it needs to be escaped |
| 16:29 | hiredman | sure, and typically it will need extra escaping because it has to be read as a string too |
| 16:29 | joegallo | melipone: perhaps if you shared an example... |
| 16:30 | melipone | is there something else than re-find to look for a string pattern embedded in a string? |
| 16:30 | melipone | for example, I want to know if a string contains the substring "+inte" |
| 16:31 | hiredman | ,(.contains "hello internet" "inte") |
| 16:31 | clojurebot | true |
| 16:31 | hiredman | ,(.contains "hello world" "inte") |
| 16:31 | clojurebot | false |
| 16:31 | melipone | but I need the string "+inte" not "inte" alone |
| 16:32 | coventry | For regular expressions, java has a quotation method: ##(java.util.regex.Pattern/quote "$5") |
| 16:32 | lazybot | ⇒ "\\Q$5\\E" |
| 16:33 | melipone | okay, contains is another option that does not need escaping on special chars like regex does |
| 16:33 | mtp | contains matches literal strings, yes |
| 16:33 | hiredman | melipone: what regex is this? is it something a parser might be more appropriate for? becuase instaparse is pretty nice |
| 16:33 | mtp | ,(.contains "hello +internet" "+inte") |
| 16:33 | clojurebot | true |
| 16:34 | melipone | hiredman: thanks |
| 16:34 | melipone | mtp: thanks |
| 16:35 | dnolen | noncom|2: that's so old, don't think such shenanigans are necessary anymore |
| 16:35 | noncom|2 | so defrecord and deftype are the way? |
| 16:37 | dnolen | noncom|2: for UI? core.async with a dash of protocols here and there |
| 16:37 | xeqi | cemerick: it looks like there are some issues with the way paths are being generated for the .map file, and the pointers to the cljs file, so no luck |
| 16:37 | bitemyapp | join #typed-clojure |
| 16:37 | bitemyapp | sigh. |
| 16:37 | rasmusto | ok |
| 16:37 | cemerick | xeqi: Is the map file updated on each eval or something? |
| 16:38 | noncom|2 | dnolen: i need that for realtime, but doesn't core.async use blocking? |
| 16:39 | dnolen | noncom|2: blocking? |
| 16:39 | noncom|2 | is the wait for a message from a channel blocking until a message arrives? |
| 16:40 | dnolen | noncom|2: it doesn't block a thread if that's what you mean |
| 16:40 | xeqi | cemerick: I didn't even get it working for an initial build. The :output-to and :sourcemap are relative to the project.clj, but I want them to be relative to :output-dir so I can serve them. Additionally the pointer to the sourcemap file uses :sourcemap, so even if I set them in the right place, the resulting url is wrong |
| 16:40 | scriptor | dnolen: it does block the 'process' created by go, right? |
| 16:41 | noncom|2 | dnolen: so it will simply pass over a go block if no messages are available and continue execution of the program? |
| 16:41 | xeqi | assuming I manually fix that, then the pointers to the .cljs files use full paths, instead of ones relative to :output-to so they don't get served correctly |
| 16:41 | xeqi | and at that point I gave up |
| 16:42 | dnolen | scriptor: yes but I don't see why that matters |
| 16:42 | dnolen | noncom|2: yes |
| 16:42 | cemerick | xeqi: I'll have to dig in at some point; I didn't grok half of what you said. :-P |
| 16:42 | cemerick | Never used source maps in any context, so... |
| 16:42 | dnolen | noncom|2: meaning the go block will execute when it can |
| 16:42 | scriptor | it doesn't, just something I've wanted cleared up for a while |
| 16:43 | xeqi | cemerick: np, take it as warning of "thar be dragons" for when you get to it |
| 16:43 | cemerick | xeqi: Are people putting things into place manually right now? |
| 16:44 | noncom|2 | dnolen: so if i'm making a game and i want the game entities communicate between each other, while the game is running. so core.async is a perfect fit? |
| 16:44 | cemerick | So far, I've just compiled with :whitespace when I'm developing, then switch to :advanced when I go to prod. *shrug* |
| 16:44 | dnolen | xeqi: yep I already mentioned this on the CLJS mailing list - the paths can't just be relative to :output-to, you need to copy everything out of jars, and remote files, and src paths all into the place that's available to the browser |
| 16:44 | dnolen | noncom|2: depends on the game |
| 16:45 | noncom|2 | say realtime 3d action game. think of a counter-strike or quake.. |
| 16:45 | dnolen | xeqi: patch welcome for this of course, what we have is good enough for people hacking on the compiler - not quite good enough for web dev. |
| 16:45 | dnolen | noncom|2: I'd be concerned about latency but I can't say since I haven't tried. But certainly for the UI elements of the game, it's a great fit |
| 16:46 | dnolen | noncom|2: and plenty of games where the model is fine |
| 16:47 | noncom|2 | so at least it worth a try and see if latency is ok then it is ok! |
| 16:47 | xeqi | dnolen: no worries, I know I'm on the edge. |
| 16:48 | dnolen | xeqi: it works well enough for ClojureScript compiler hackers and lib designers, not quite good enough for integrating into web dev, happy to move patches along for people who want to see it improved. |
| 16:54 | xeqi | dnolen: ah, I see the sourcemaps thread, I'll have to tryout the patch on CLJS-591 |
| 16:55 | dnolen | xeqi: that won't fix the problem, that just about making the source map location relative to the js file |
| 16:57 | xeqi | hmm, right. I've got this idea in my head the :output-to and :sourcemap end up in the same place as :output-dir, which isn't true :/ |
| 16:59 | dnolen | xeqi: as simplification we could probably just write all the files needed by source maps by default to :output-dir, and allow override via :source-map-dir |
| 17:03 | xeqi | cemerick: is [lein-cljsbuild "0.3.3"] suppose to be using [cljsbuild "0.3.3-SNAPSHOT"] ? https://github.com/emezeske/lein-cljsbuild/blob/0.3.3/plugin/src/leiningen/cljsbuild/subproject.clj#L6 |
| 17:03 | cemerick | xeqi: oh fuck :-( |
| 17:04 | cemerick | no, definitely not. Good catch. |
| 17:05 | xeqi | I await [lein-cljsbuild "0.3.3.1"] :p |
| 17:05 | cemerick | the release process for the plugin is unique :-) |
| 17:05 | cemerick | xeqi: eh, I have two bugfixes I haven't pushed yet. 0.3.4 :-) |
| 17:20 | mechazoidal | is there a version of partition that can take a decreasing count? |
| 17:21 | rasmusto | mechazoidal: decreasing count? |
| 17:21 | scriptor | mechazoidal: can you give an example? |
| 17:21 | llasram | mechazoidal: Input/output example? |
| 17:22 | TimMc | [[0 1 2 3 4] [5 6 7 8] [9 10 11] [12 13] [14]] I think |
| 17:22 | mechazoidal | yup |
| 17:23 | mechazoidal | was trying to do it with map, but not sure how to get 'ranges' from a vec/seq |
| 17:23 | rasmusto | might be a case for reduce |
| 17:24 | rasmusto | or some combo of partition-at and map-indexed |
| 17:25 | llasram | ,((fn step [n coll] (lazy-seq (if (and (pos? n) (seq coll)) (cons (take n coll) (step (dec n) (drop n coll)))))) 5 (range 20)) |
| 17:25 | clojurebot | ((0 1 2 3 4) (5 6 7 8) (9 10 11) (12 13) (14)) |
| 17:25 | coventry | java/interop newbie question: Compiler/load, after catching a ReaderException "e", throws CompilerException(sourcePath, e.line, e.column, e.getCause()). I matched this in clojure code with (throw (new clojure.lang.Compiler$CompilerException sourcepath (. e line) (. e col) (. e getCause))). But this is failing with "No matching field found: line for class clojure.lang.LispReader$ReaderException". What's the right way to match that |
| 17:25 | coventry | java code? |
| 17:25 | mechazoidal | huh, interesting |
| 17:27 | philc_ | technomancy: Is it possible to run a lein plugin in conjunction with an uberjar? lein lobos in this case. |
| 17:27 | llasram | coventry: It's package-private. You'd need to use explicit reflection to get at it |
| 17:28 | coventry | llasram: Thanks. I'll stick it in an atom and figure out how to do that from the repl, I guess. |
| 17:33 | scriptor | I asked on here a while back about whether there was a way to have reduce go through a seq of functions as it consumed the main collection |
| 17:33 | scriptor | like (reduce-with-fns (cycle + *) (range 20)) |
| 17:34 | scriptor | and someone said this sounds like…applicatives I think? Ring a bell for anyone? |
| 17:35 | technomancy | philc_: what does "in conjunction with" mean? |
| 17:35 | gfredericks | I wasn't around for that but it does sound like applicatives |
| 17:35 | gfredericks | i.e., it's one of the ways to make a list an ApplicativeFunctor |
| 17:35 | indigo | Hm... I wonder if anyone's made a Datomic wiki yet |
| 17:35 | gfredericks | well wait |
| 17:35 | gfredericks | that'd just be for maping |
| 17:35 | gfredericks | mapping |
| 17:35 | hiredman | the scope lisppaste seems to have expired |
| 17:35 | gfredericks | I don't know anymore |
| 17:36 | hiredman | ~scope |
| 17:36 | clojurebot | scope is at http://paste.lisp.org/display/73838 |
| 17:36 | hiredman | sad |
| 17:37 | philc_ | technomancy: I have an uberjar created via lein, a project.clj, and lein present on a server. Is it possible to run lein plugins which use classes found in that uberjar? |
| 17:37 | scriptor | gfredericks: must be something like that, Haskell defines <*> for two lists a bit differently, but I think the idea is the same |
| 17:38 | technomancy | philc_: no, lein plugins typically don't have visibility into code that's not running under lein |
| 17:38 | technomancy | philc_: this is why stuff like lobos really shouldn't be a lein plugin; it's the wrong model |
| 17:40 | mechazoidal | llasram: thanks! |
| 17:41 | philc_ | technomancy: thanks, that's helpful. So what's a better model for bundling up lobos-like functionality into an uberjar, to be run remotely? |
| 17:43 | technomancy | philc_: it should just be a -main function; that way you can invoke it via lein run or a repl or an uberjar |
| 17:43 | technomancy | clojurebot: clojars migrations? |
| 17:43 | clojurebot | No entiendo |
| 17:43 | technomancy | aw come on you dumb bot |
| 17:43 | technomancy | philc_: https://github.com/ato/clojars-web/blob/master/src/clojars/db/migrate.clj |
| 17:44 | technomancy | of course whether the -main function is in the application source or coming from a dependency is immaterial; it works teh same way |
| 17:48 | philc_ | technomancy: got it. lein lobos provides two trivial migrate and rollback functions, so I'll just move them into my jar and expose them via a main. Thanks for the handy link! |
| 17:48 | technomancy | sure thing |
| 17:52 | gfredericks | scriptor: the weird part is you'd presumably want N-1 functions? |
| 17:52 | gfredericks | it seems rather contrived |
| 17:53 | scriptor | it's best done with infinite lists |
| 17:54 | scriptor | I found it pretty useful if you have a 2 player game were each player is a function |
| 17:54 | zachallaun | Can anyone point me to the Clojure equivalent of litable-mode.el (https://github.com/Fuco1/litable), if it exists. Does nrepl.el already support this? cc/ technomancy |
| 17:54 | scriptor | and then you cycle between those two while reducing the board/map/etc |
| 17:55 | technomancy | zachallaun: wouldn't be difficult to integrate into c.t.trace if you wanted |
| 17:55 | technomancy | I'm skeptical of how useful it would be; specifying good values to seed the tracing runs is tricky |
| 17:56 | zachallaun | Skeptical of the concept as a whole, or c.t.trace's usefulness in getting there? |
| 17:56 | zachallaun | (thanks for the pointer, btw) |
| 17:56 | technomancy | skeptical of its general applicability. hell of a demo though. |
| 17:56 | technomancy | it's kind of disappointing that his code is coupled to elisp for no good reason. |
| 17:57 | zachallaun | I agree re: general applicability. I happen to do a huge number of Clojure demos though, and would love it for that reason :) |
| 17:58 | technomancy | it'd be useful for small math functions, but as soon as you start manipulating nontrivial maps you can't fit anything readable into the tiny slice of space for each arg |
| 17:58 | technomancy | hah; yeah |
| 17:58 | technomancy | c.t.trace is great on its own |
| 17:59 | technomancy | partly because it can spew as much output as it needs |
| 17:59 | zachallaun | Cool, I'll check it out. I'm basically looking for a replacement for ";; C-u C-x C-e" after every expression I type |
| 18:00 | technomancy | nrepl-discover makes it easier to invoke tracing |
| 18:00 | technomancy | ~nrepl-discover |
| 18:00 | clojurebot | excusez-moi |
| 18:00 | technomancy | https://github.com/technomancy/nrepl-discover |
| 18:00 | zachallaun | cheers |
| 18:00 | bitemyapp | technomancy: I have Emacs macros for auto-replacing defns with deftrace and injecting the require. Super handy. |
| 18:01 | technomancy | bitemyapp: not a fan of doing that in a way that affects the files on disk |
| 18:01 | bitemyapp | that sounds nicer. |
| 18:01 | stuartsierra | zachallaun: I use this in classes I teach sometimes: https://github.com/stuartsierra/dotfiles/blob/d157175c88771feb49f65f8344a2c64d7d5163ca/.emacs.d/local/init.el#L357 |
| 18:01 | technomancy | bitemyapp: give it a try |
| 18:02 | stuartsierra | Basically C-x C-e but it copies the form into the *nrepl* buffer. |
| 18:02 | technomancy | bitemyapp: the cool thing is you can bind any clojure-implemented defns to emacs-side commands, and by extension key bindings. |
| 18:02 | zachallaun | stuartsierra: Awesome, thanks. |
| 18:03 | bitemyapp | the toggle-trace looks quite nice. |
| 18:03 | technomancy | I keep waiting for someone else to see how awesome nrepl-discover is and do something amazing with it =) |
| 18:03 | bitemyapp | technomancy: also there really needs to be a way to auto-pull the README's leiningen [blah "0.0.1"] from clojars. |
| 18:03 | technomancy | (did I mention operations are hypothetically editor-agnostic?) |
| 18:04 | technomancy | bitemyapp: from what context? |
| 18:04 | technomancy | a checkout? |
| 18:04 | Frozenlock` | technomancy: Consider me interested. :-) |
| 18:04 | bitemyapp | technomancy: I mean somebody with a long-tail of libraries to maintain. Like Travis CI's little tests passing gif. |
| 18:04 | bitemyapp | technomancy: except it just auto-pulls the latest clojars project version and generates the Leiningen dependency bector. |
| 18:05 | technomancy | bitemyapp: https://groups.google.com/forum/#!topic/clojure/hLjrBmFmEkM |
| 18:05 | technomancy | or you mean from emacs? |
| 18:05 | bitemyapp | technomancy: no, that's bloody it! |
| 18:05 | bitemyapp | Raynes: ^^ look! |
| 18:05 | technomancy | dun dun dun |
| 18:06 | bitemyapp | dammit I need to pay better attention. |
| 18:06 | technomancy | haha; we had this conversation like two days ago with Raynes |
| 18:06 | bitemyapp | (to the mailing list and in general) |
| 18:06 | TimMc | bitemyapp: lein-outdated ? |
| 18:06 | bitemyapp | technomancy: bah he didn't tell me. |
| 18:06 | bitemyapp | TimMc: no this is so I can stop editing my READMEs when I push new jars to clojars. |
| 18:07 | TimMc | Ah, got it. |
| 18:07 | TimMc | What, you don't keep changelogs? |
| 18:07 | brainproxy | in the context of cljs I need to extend the prototype of HTMLElement and then hand that extended prototype off to another function, all the while making sure that the extension methods don't get munged by the compiler |
| 18:07 | brainproxy | trying several different things ... not working out though |
| 18:08 | bitemyapp | TimMc: I do, but I forget to change the Leiningen line. |
| 18:08 | bitemyapp | like a derp. |
| 18:08 | bitemyapp | it happens almost every time, I end up pushing an extra commit just to change the version line |
| 18:09 | TimMc | True. |
| 18:09 | bitemyapp | https://github.com/bitemyapp/blackwater/ now that is satisfying. |
| 18:09 | brainproxy | naive way, using (.create Object (.-prototype HTMLElement)) and then (set! ...) to setup methods, but the I'm not sure if there is a way to refer to `this` inside a (fn [] ...) in the context of clojurescript |
| 18:10 | brainproxy | been away from cljs for awhile :-/ |
| 18:10 | amalloy | brainproxy: isn't there a (this-as foo (...body...)), in which foo is a local-name for this? |
| 18:11 | brainproxy | amalloy: perhaps so |
| 18:11 | bitemyapp | only part I don't like is lack of copy-pasta. |
| 18:12 | bitemyapp | I wonder if SVG can be marshalled into presenting text? |
| 18:12 | technomancy | bitemyapp: varies by browser, from what I hear |
| 18:12 | bitemyapp | nuts. |
| 18:12 | technomancy | supposedly getting fixed in trunk gecko |
| 18:12 | bitemyapp | whatevs. people will have to type a single line. |
| 18:12 | bitemyapp | technomancy: nice. better SVG support always makes me happy :) |
| 18:14 | technomancy | hrm; viewable in emacs but also not copyable |
| 18:14 | TimMc | bitemyapp: "No, no, that's a С (U+0421), not a C (U+0043)." |
| 18:22 | brainproxy | amalloy: thanks, that's what I needed |
| 18:23 | `cbp | hiredman: scope? https://www.refheap.com/19579 :P |
| 18:26 | hiredman | `cbp: http://dev.clojure.org/display/design/Resource+Scopes |
| 18:28 | bitemyapp | that is really cool. |
| 18:34 | bitemyapp | hiredman: are scopes headed towards a release? |
| 18:36 | coventry | Why does Compile/load convert LispReader.ReaderExceptions into CompilerExceptions, anyway? |
| 18:54 | noprompt | life w/o the internet is weird. |
| 18:55 | seangrove | Can lein build an uberjar with custom source-paths? I'm getting a NPE on requiring a namespace from a file in one of the additional source paths |
| 18:56 | bitemyapp | noprompt: how have you been? |
| 18:56 | bitemyapp | seangrove: :source-paths doesn't work? |
| 18:56 | noprompt | bitemyapp: good i think. |
| 18:57 | noprompt | writing my first leiningen plugin. |
| 18:57 | seangrove | bitemyapp: Source paths work fine in the repl, etc. But it's my first time trying to build an uberjar, getting an NPE from requiring a custom version of korma and clj-yaml from source paths |
| 18:57 | noprompt | bitemyapp: and yourself? |
| 18:57 | technomancy | seangrove: is :source-paths in a profile? |
| 18:58 | seangrove | technomancy: No, top level |
| 18:58 | bitemyapp | noprompt: doing okay, getting caught up on work. |
| 18:58 | technomancy | seangrove: weird, let me know if you can get a repro case |
| 18:58 | bitemyapp | seangrove: I'd very much like for you to tell me more about this custom version of Korma sometime :P |
| 18:59 | seangrove | technomancy: Probably waited a bit too long and now it's a bigger project than it should be to try building an uberjar for the first time |
| 18:59 | seangrove | bitemyapp: I think you've accepted the patch, that doesn't have to be a custom version anymore |
| 18:59 | technomancy | seangrove: does `lein compile :all` work? |
| 18:59 | seangrove | technomancy: Same issue |
| 19:00 | seangrove | technomancy: Seems to be dying on the namespace declartion when I require https://www.refheap.com/5b5f67646098b5325aae124ec |
| 19:01 | noprompt | (:file (meta #'foo)) confuses me |
| 19:01 | technomancy | seangrove: probably a bug in clojure |
| 19:02 | bitemyapp | noprompt: why? |
| 19:02 | bitemyapp | tardis.is.awesome.routes.api> (:file (meta #'dashboard)) |
| 19:02 | bitemyapp | "tardis/is/awesome/routes/api.clj" |
| 19:02 | bitemyapp | looks fine to me. |
| 19:02 | seangrove | technomancy: I'd err on the side of pebkac |
| 19:02 | noprompt | bitemyapp: sometimes it returns a path that includes "~/..." |
| 19:02 | bitemyapp | seangrove: there's something about the weird way you're including these custom libraries that makes me uncomfortable. |
| 19:02 | technomancy | seangrove: welllll |
| 19:03 | noprompt | bitemyapp: other times it doesn't. |
| 19:03 | technomancy | reasonable, but http://dev.clojure.org/jira/browse/CLJ-1241 |
| 19:03 | technomancy | I ran into this debugging a customer issue several weeks back; it looks like the same bug |
| 19:03 | technomancy | oh cool, jira is down |
| 19:04 | technomancy | tl;dr: the bug only triggers when you AOT code that shadows a clojure.core var which is (I think) used in a macro |
| 19:04 | technomancy | seangrove: so putting in the proper :refer-clojure clause like the warning tells you to should fix it |
| 19:04 | seangrove | Oh, interesting... let me rename the find fn |
| 19:04 | mr_rm | i'm trying to do this: https://gist.github.com/cowlike/6909631 but it seems that i need to put the fully qualified name in the method signature (a.b.c.Thing) in the namespace part. is that right? |
| 19:05 | technomancy | finding compiler bugs is fun |
| 19:05 | bitemyapp | technomancy: oh you know what, I ran into this too! |
| 19:05 | mr_rm | i mean for the Thing class |
| 19:05 | bitemyapp | I shadowed a Clojure var and got the same issue ^_^ |
| 19:05 | bitemyapp | oooops |
| 19:05 | TEttinger | foo [^Thing t] |
| 19:05 | TEttinger | ^ is used for type hints |
| 19:06 | mr_rm | TEttinger: i'm talking about in the namespace declaration |
| 19:06 | seangrove | technomancy: Oh wow, I think that's it |
| 19:06 | TEttinger | yeah, I think it's also used there. I can check. |
| 19:06 | mr_rm | it's complaining about the bare use of "Thing" in the method declaration inside (ns...) |
| 19:06 | mr_rm | TEttinger: but if i put a.b.c.Thing it works |
| 19:07 | noprompt | does this seem like a decent way to watch a file for changes? https://gist.github.com/noprompt/6909648 |
| 19:07 | hiredman | mr_rm: right |
| 19:07 | hiredman | mr_rm: that is just sort of the way it is |
| 19:07 | seangrove | Ah, I thought it must be from my suspect source-path entries |
| 19:07 | seangrove | Thanks technomancy! |
| 19:07 | noprompt | using async+fs |
| 19:07 | hiredman | mr_rm: you can avoid that by not using genclass |
| 19:07 | seangrove | (inc technomancy) |
| 19:07 | lazybot | ⇒ 82 |
| 19:07 | technomancy | seangrove: np |
| 19:08 | TEttinger | oh. I'm dumb |
| 19:08 | mr_rm | hiredman: ok thanks! i wasn't sure if there was something braindead i was doing. believe me, i'd rather not use genclass but i need to make this a class callable by other java code, and as static methods |
| 19:08 | TEttinger | foo [Thing] |
| 19:08 | TEttinger | you don't stick the name in there, it's just a type list |
| 19:08 | seangrove | (dec technomancy) ; keep the ego in check |
| 19:08 | lazybot | ⇒ 81 |
| 19:09 | TEttinger | (inc technomancy) ;; he deserves it |
| 19:09 | lazybot | ⇒ 82 |
| 19:09 | technomancy | good call |
| 19:09 | bitemyapp | pretty sure technomancy is the lazybot karma king. |
| 19:09 | mr_rm | TEttinger: ummm i am NOT putting the name in there, just the types |
| 19:09 | mr_rm | technomancy: it's a java type that i'm importing from a third party jar |
| 19:09 | TEttinger | $karma Raynes[foo [Thing t] String]])) |
| 19:09 | lazybot | Raynes[foo has karma 0. |
| 19:09 | mr_rm | oh sorry, that was supposed to be TEttinger |
| 19:09 | TEttinger | gah |
| 19:10 | TEttinger | [foo [Thing t] String]])) <-- the t isn't needed in there |
| 19:10 | TEttinger | in :methods |
| 19:10 | TEttinger | :methods [[setLocation [String] void]] ;; this is an example |
| 19:10 | mr_rm | TEttinger: oh right... sorry that was a copy/paste error when i typed it in from another screen |
| 19:10 | TEttinger | oh ok |
| 19:10 | mr_rm | i don't have the 't' in the real code |
| 19:11 | mr_rm | well... transcription error, copy paste would have save me the stupidity :) |
| 19:12 | mr_rm | TEttinger: but you should be able to duplicate my problem. you have to put [foo [a.b.c.Thing] String] just Thing won't work |
| 19:13 | TEttinger | mr_rm, huh. I don't really do much with gen-class, it has caused me pain before. |
| 19:14 | hiredman | the thing is, the code that the ns macro emits does the gen-class first, for importing any classes |
| 19:15 | mr_rm | hiredman: ok that would make sense |
| 19:15 | mr_rm | so it can't use the short version of the name |
| 19:15 | hiredman | so the default set of imported classes like java.lang.String can use the short name, but for other classes you'll need to include the package in the class name |
| 19:15 | hiredman | correct |
| 19:19 | mr_rm | hiredman: in this case, is it considered bad form to do (gen-class ...) later on, in order to be able to use the short names? there are some horribly long package names in there, and many of them |
| 19:20 | hiredman | *shrug* |
| 19:20 | seangrove | lein uberjar is amazing |
| 19:21 | bitemyapp | seangrove: it is quite nice. Do you AOT or OTF? |
| 19:21 | seangrove | technomancy: But have you considered making it a bit messier, so devs from other languages/platforms feel at home? |
| 19:22 | seangrove | bitemyapp: I think I have implicit AOT going on, making it explicit now |
| 19:22 | bitemyapp | seangrove: probably a better idea. I take the other direction and use lein-otf to preserve non-AOT-ness even though I write my code to be AOT-safe. |
| 19:22 | technomancy | seangrove: just try tracing profile merge logic; that should do the trick |
| 19:22 | bitemyapp | I think I started doing that out of paranoia related to my embedded nRepl instance. I don't think it's merited. |
| 19:23 | technomancy | bitemyapp: you don't mind the longer boot times? |
| 19:24 | bitemyapp | technomancy: I notice them, but the mailing list has made me hella paranoid about AOT even though I know I shouldn't care. |
| 19:24 | bitemyapp | I've set :aot :all and not been any worse for the wear. *shrug* |
| 19:24 | bitemyapp | I'd really like an exhaustive wiki page explaining the implications of AOT. Then I'd feel more comfortable with it. |
| 19:25 | technomancy | bitemyapp: if you use profile isolation and only trigger aot during uberjar it's safe |
| 19:25 | bitemyapp | technomancy: but that raises the question, what am I worried about? Why would I be doing that? |
| 19:25 | bitemyapp | technomancy: what does it break if I don't specify :aot :all under the :uberjar profile? |
| 19:26 | bitemyapp | that's sorta my point. People keep cautioning about stuff like that without explaining what will actually break beyond free-standing code in namespaces. |
| 19:26 | bitemyapp | which I'm persnickety about anyway because I got burnt by non-idempotent namespace loading in Python. |
| 19:26 | Frozenlock | Is there a way to get a project version from inside the said project? (I had a System/getProperty macro, but it doesn't seem to work once uberjared..) |
| 19:26 | bitemyapp | technomancy: does AOT break an embedded nRepl? |
| 19:27 | technomancy | the reasons we do it at heroku are for faster process startup and to catch certain kinds of errors earlier. if you have proper CI you don't care about the latter, and the former might not be an issue |
| 19:27 | technomancy | bitemyapp: the only thing I've heard of breaking with proper (non-stale) AOT is old versions of core.match |
| 19:27 | bitemyapp | well. I'm willing to give it a whirl then. |
| 19:28 | technomancy | Frozenlock: there's a pom.properties file inside your uberjar you can read |
| 19:28 | Frozenlock | technomancy: Awww, so much manual work... |
| 19:28 | Frozenlock | Thanks :p |
| 19:29 | technomancy | Frozenlock: there's a lib that can do it for you in a way that will work during dev and prod; check out versioneer |
| 19:29 | Frozenlock | technomancy: Looks perfect! Thanks! |
| 19:30 | Frozenlock | (inc technomancy) |
| 19:30 | lazybot | ⇒ 83 |
| 19:30 | technomancy | bitemyapp: be sure you do it with profile isolation though, or force a clean before building in your CI setup |
| 19:30 | technomancy | let me know if profile isolation isn't documented properly; I can't recall |
| 19:31 | bitemyapp | technomancy: I have a script that lein cleans before doing anything. |
| 19:31 | technomancy | I never should have doubted |
| 19:32 | bitemyapp | my deployment stack is a bash script. lol. |
| 19:32 | bitemyapp | technomancy: I can kinda see the profile isolation from the target path stuff, but only via the mailing list release of 2.3.2 - not in the docs themselves. |
| 19:32 | bitemyapp | I can get away with using a bash script to deploy my app because it's Clojure + Leiningen and uberjar makes my life easy. |
| 19:33 | technomancy | bitemyapp: huh... check the end of the FAQ |
| 19:33 | technomancy | need to make it clearer though |
| 19:33 | technomancy | theoretically profile isolation should make manual clean calls unnecessary |
| 19:35 | akurilin | Is there anything along the lines of a parallel let? As in, I want each of the bindings to be computed in a separate thread. I could theoretically just make a vec of futures and then bind the results in the let block, but perhaps there's a more out-of-the-box way. |
| 19:36 | akurilin | The use case would be wanting to fetch a bunch of DB data in a few concurrent connections before crunching it. |
| 19:48 | seangrove | How can I pass through a ring handler? |
| 19:48 | seangrove | Ah, nevermind |
| 19:59 | Frozenlock | Weird... I had the impression the source of a function was stored into the function metada. Is it only for technomancy's serializable-fn? (I wanted to get my hand on the source of a function defined in a repl) |
| 20:00 | TEttinger | Frozenlock, yeah. serializable-fn is special |
| 20:00 | TEttinger | there is however |
| 20:00 | TEttinger | http://clojuredocs.org/clojure_core/clojure.repl/source-fn |
| 20:02 | Frozenlock | TEttinger Isn't it the same function as the source macro? :-/ |
| 20:02 | TEttinger | (clojure.repl/source-fn 'spit) ;; yes, very similar |
| 20:03 | Frozenlock | source ----> (println (or (source-fn '~n) (str "Source not found"))) |
| 20:03 | Frozenlock | For all intended purposes, they are the same :p |
| 20:03 | TEttinger | one takes a symbol, the other needs a quoted symbol, and one returns a string |
| 20:04 | mlb- | There seems to be a subtle difference between "require" and "use". Does one supercede the other, or is there a special set of conditions which dictate which to use? |
| 20:05 | rasmusto | mlb-: use require |
| 20:05 | akurilin | Quick map question. Considering that there's no ordering guarantee in maps, is it possible for a (zipmap (keys m) (vals m)) to end up with the wrong pairing? |
| 20:06 | rasmusto | akurilin: no |
| 20:06 | akurilin | rasmusto, how so? |
| 20:06 | TEttinger | "use" puts things in the current ns, "require" lets you either use the full qualified ns or an :as alias |
| 20:06 | rasmusto | akurilin: the trees are the same |
| 20:06 | TEttinger | use is an easy way to break compatibility |
| 20:07 | rasmusto | akurilin: I don't know all of the impl details though... |
| 20:07 | akurilin | rasmusto, I was going to say, isn't that basically relying on internals that might change? |
| 20:07 | TEttinger | (use 'clojure.string) will screw up the replace fn in clojure.core |
| 20:07 | akurilin | not likely, but *could* |
| 20:07 | TEttinger | (require '[clojure.string :as s]) will not |
| 20:08 | rasmusto | akurilin: I think it's an inherent property of the way that the persistant immutable collections are done, so I doubt that it will be changed |
| 20:09 | akurilin | Got it |
| 20:09 | akurilin | I guess the "safe" way would be to vec it, and then reduce it |
| 20:10 | TEttinger | ##(let [m {:a 1 :b 2 :c 3 :d 4}] (zipmap (keys m) (vals m))) |
| 20:10 | lazybot | ⇒ {:d 4, :b 2, :c 3, :a 1} |
| 20:10 | rasmusto | if by "safe" you mean "probably unnecessary but warm and fuzzy", then yeah |
| 20:10 | TEttinger | the same hash fn on the same key, right? |
| 20:10 | TEttinger | unless the hash behavior changes, which might across versions but not inside one version, you should be fine |
| 20:11 | rasmusto | my responses have been a bit blunt and without justification, sorry about that :P |
| 20:11 | akurilin | That's fine. I just keep getting bitten by subtle facts that like across different tools so now I'm extra paranoid about it |
| 20:12 | akurilin | totally worth asking rather than debugging for half a day |
| 20:12 | TEttinger | ##(let [m {:a 1 :b 2 :c 3 :d 4}] (apply = (repeatedly 100 #(zipmap (keys m) (vals m))))) |
| 20:12 | lazybot | ⇒ true |
| 20:13 | TEttinger | seems fine. |
| 20:13 | rasmusto | ##(let [m {(rand) (rand)}] (apply = (repeatedly 100 #(zipmap (keys m) (vals m))))) |
| 20:13 | lazybot | ⇒ true |
| 20:14 | rasmusto | ##(let [m {(rand) (rand) (rand) (rand)}] (apply = (repeatedly 100 #(zipmap (keys m) (vals m))))) |
| 20:14 | akurilin | don't crash him :) |
| 20:14 | akurilin | *it |
| 20:15 | akurilin | Ok thanks guys, I'll use that approach then, much more readable. |
| 20:16 | TEttinger | rand not fn! |
| 20:17 | rasmusto | akurilin: I use a list-comprehension and into sometimes too ##(into {} (for [[k v] [[1 2] [3 4]]] [k (inc v)])) |
| 20:17 | lazybot | ⇒ {1 3, 3 5} |
| 20:17 | TEttinger | ##(let [m {(rand-int 1000) (rand-int 100) (+ 1000 (rand-int 1000)) (rand-int 100)}] (apply = (repeatedly 100 #(zipmap (keys m) (vals m))))) |
| 20:17 | lazybot | ⇒ true |
| 20:17 | rasmusto | (maybe that's the paranoid method) |
| 20:18 | rasmusto | TEttinger what's wrong with my second (rand) example? |
| 20:18 | TEttinger | did it run? |
| 20:18 | TEttinger | hm |
| 20:18 | TEttinger | ,(doc rand) |
| 20:18 | clojurebot | "([] [n]); Returns a random floating point number between 0 (inclusive) and n (default 1) (exclusive)." |
| 20:18 | rasmusto | it worked for ##{(rand) (rand)} |
| 20:18 | lazybot | ⇒ {0.2593158246725171 0.020521385055436214} |
| 20:18 | rasmusto | but not ##{(rand) (rand) (rand) (rand)} |
| 20:19 | rasmusto | ,{(rand) (rand) (rand) (rand)} |
| 20:19 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: (rand)> |
| 20:19 | rasmusto | ah, that's it |
| 20:19 | rasmusto | ,*clojure-version* |
| 20:19 | clojurebot | {:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"} |
| 20:20 | TEttinger | ,{(rand 10) (rand) (rand 10) (rand)} |
| 20:20 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: (rand 10)> |
| 20:20 | rasmusto | er, wait a second, didn't this change at some point? |
| 20:20 | TEttinger | huh |
| 20:20 | rasmusto | ,{1 1 2 2 2 2} |
| 20:20 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: 2> |
| 20:20 | rasmusto | ##{1 1 1 1} |
| 20:20 | TEttinger | won't print on lazybot |
| 20:20 | metellus | &{1 1 1 1} |
| 20:20 | lazybot | java.lang.IllegalArgumentException: Duplicate key: 1 |
| 20:21 | TEttinger | also ##() is the only way to use ## |
| 20:21 | lazybot | ⇒ () |
| 20:21 | rasmusto | https://github.com/clojure/clojure/blob/master/changes.md#changes-to-clojure-in-version-15 is why i'm confused |
| 20:21 | rasmusto | 2.10 |
| 20:22 | rasmusto | oh, constructor functions, not literals I guess |
| 20:37 | seangrove | I'm trying to authenticate a user for a route, but *only* if it matches a route |
| 20:55 | akurilin | Is the idea that in general one should use "nth" to access entries in collections when doing some data massaging, unless you absolutely know you're dealing with something like a vec, in which case you can use get to reap some of its benefits? |
| 20:55 | bitemyapp | akurilin: generally speaking, if things have special "places" in a vector you're using destructuring to get at them rather than nth. |
| 20:56 | bitemyapp | ,(let [[entity-id attribute value] [101 :my/attr "woohoo!"]] (println entity-id attribute value)) |
| 20:56 | clojurebot | 101 :my/attr woohoo!\n |
| 20:56 | bitemyapp | that's along the lines of how people use tuples. |
| 20:56 | bitemyapp | Usually you'd use a map unless there's a good reason for doing otherwise. |
| 20:57 | bitemyapp | unless the fields really have to be anonymous...for some reason... |
| 20:57 | rasmusto | bitemyapp: can you use vector destructuring on the first few items of a lazy seq? |
| 20:57 | bitemyapp | rasmusto: why not try it and see what happens? |
| 20:59 | rasmusto | ,(let [[a b c] (range)] [c b a]) |
| 20:59 | clojurebot | [2 1 0] |
| 20:59 | rasmusto | :) |
| 20:59 | akurilin | The only reason why I ended up with a seq in a scenario I'm working on is because I used partition (which seemed convenient) to split up interleaved keys and values into pairs, except I would rather have a vec. I'm certain that there's a pretty straightforward of building a vec of vecs 2 entries at a time without partition. |
| 20:59 | akurilin | Just need to slap that together once I stop being lazy. |
| 21:00 | rasmusto | akurilin: never stop being lazy :D |
| 21:01 | jared314 | does anyone know if leiningen's do task can pipe values to the next task, like additional project keys? |
| 21:01 | akurilin | bitemyapp, but yes, that was helpful, thanks for the explanation. |
| 21:02 | akurilin | There a few cases where I'd love to use a sorted map, but most of the times I end up turning that into JSON, so bad things will happen. |
| 21:02 | akurilin | So vecs it is. |
| 21:02 | bitemyapp | akurilin: interesting that it's order dependent. |
| 21:03 | akurilin | bitemyapp, as in? |
| 21:04 | hiredman | jared314: I don't think so, however https://github.com/hiredman/Archimedes/blob/master/project.clj has an example of the update-in task being used to empty the :prep-tasks key in the project map, so javac isn't invoked before run is |
| 21:04 | hiredman | so basically you tell update-in what change to make, and what tasks to run with those changes |
| 21:04 | rasmusto | akurilin: I think he's just saying that an order-dependent associative collection isn't the norm |
| 21:04 | bitemyapp | ^^ what rasmusto said. |
| 21:05 | bitemyapp | cemerick: howdy! |
| 21:05 | jared314 | hiredman: interesting, thank you |
| 21:08 | bitemyapp | akurilin: sorted-maps and order-dependency is usually an optimization, not an access pattern. Typically one would use sequences, tuples, sets, maps, or records. |
| 21:09 | indigo | Sup Clojurians |
| 21:09 | bitemyapp | akurilin: your admission that you tumbled into this particular way of doing something hints that there's a possibly a misdesign that if rectified, could make your life easier. But until you share more, I cannot help. |
| 21:09 | bitemyapp | indigo: hai |
| 21:09 | indigo | Hihi :) |
| 21:09 | bitemyapp | I made a little querying dashboard for Datomic. Can't wait to add a model browser. :) |
| 21:09 | bitemyapp | Possibly writing a migration library for Datomic too |
| 21:10 | indigo | Nice |
| 21:11 | bitemyapp | indigo: it's not all roses, but I'm happy with it so far. |
| 21:11 | bitemyapp | it definitely solves the problem it set out to solve. |
| 21:13 | coventry | Any idea why I'd get "Attempting to call unbound fn" on the first run from the repl, but not on subsequent runs? |
| 21:15 | Frozenlock | As I've been out of the Clojure loop for a while, is there any news/hope for Clojure in Clojure? |
| 21:15 | indigo | Frozenlock: I don't really see what you mean |
| 21:15 | Raynes | $google bronsa CinC |
| 21:15 | lazybot | [Bronsa (Nicola Mometto) · GitHub] https://github.com/Bronsa |
| 21:15 | bitemyapp | Frozenlock: actually, yes. Haha. Bronsa is doing amazing work and his wagon has been hitched to ambrosebs' wildly successful core.typed fund raising effort. |
| 21:15 | Raynes | https://github.com/Bronsa/CinC |
| 21:16 | Frozenlock | Awesome! Thanks! |
| 21:16 | indigo | Ahh |
| 21:16 | indigo | That is cool |
| 21:17 | ruzu | crap i forgot about that fundraiser |
| 21:17 | Bronsa | Frozenlock: as the README says it's been split and I'm going to keep developing it as those 3 contrib libraries |
| 21:17 | ruzu | its over isn't it |
| 21:17 | bitemyapp | ruzu: I don't think so? |
| 21:17 | Bronsa | ruzu: still ~30 days |
| 21:18 | ruzu | ah 33 it would seem |
| 21:23 | Raynes | Bronsa: I don't think it was split into enough libraries! :p |
| 21:23 | Raynes | Bronsa: We also need tools.analyzer.lol.more.stuff |
| 21:24 | ruzu | speak of the devil |
| 21:25 | Bronsa | Raynes: actually, Rich was wondering if the bytecode generation namespace into a separate library, lol |
| 21:25 | Bronsa | *should be split |
| 21:26 | Bronsa | Raynes: btw the current split makes sense, I prefer having it this way than e.g having to require all of clojurescript only for its analyzer |
| 21:28 | rigger | http://ultimatemotorcycling.com/wp-content/uploads/2010-Buell-1125RR-Racing-Motorcycle.jpg |
| 21:28 | rigger | er |
| 21:38 | arrdem | rigger: nice bike, wrong chan :P |
| 21:38 | rigger | yep |
| 21:39 | bitemyapp | arrdem: I never understood the appeal of Buells specifically, but that is a very nice bike. |
| 21:39 | arrdem | Bronsa: how stable is the tools.emitter API? |
| 21:39 | arrdem | Bronsa: stable enough that I can start a tools.emitter.x86? :P |
| 21:41 | arrdem | bitemyapp: I must confess to not knowing enough about bikes... one of these days I will learn and get one. but not today. |
| 21:41 | bitemyapp | arrdem: I recently sold off bike #5, thinking of upgrading to a superbike for my next death-mo-cycle. |
| 21:41 | Bronsa | arrdem: *should* be stable from now on -- however there's no documentation yet on how to extend it, that should probably come soon |
| 21:43 | arrdem | Bronsa: ok just curious. one of the projects on my "maybe someday" list. |
| 21:49 | arrdem | bitemyapp: haha nice! that's the one thing my local biker friends are really pushing.. deathmachine #1 costs nothing, and by the time you upgrade to deathmachine #3 you've got all the bike you want. |
| 22:09 | mercwith1mouth | so....hash-maps vs array-maps |
| 22:10 | mercwith1mouth | arrays are ordered...hashes aren't...what are some other benefits of each? |
| 22:18 | arrdem | little help with interfaces? https://www.refheap.com/19589 explodes for some reason. |
| 22:19 | TEttinger | does IGraphLike need to be in brackets in defrecord? |
| 22:20 | TEttinger | can't you implement multiple? |
| 22:20 | arrdem | TEttinger: the github docs indicate that defrecord is (interface specs*)+ |
| 22:20 | arrdem | TEttinger: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/definterface |
| 22:22 | TEttinger | you are correct |
| 22:23 | gfredericks | mercwith1mouth: they're the same at the interface level. array maps are just a perf optimization for small maps |
| 22:25 | mercwith1mouth | gfredericks: hmmm gotcha |
| 22:25 | gfredericks | mercwith1mouth: note that sorted maps are a different thing |
| 22:25 | TEttinger | arrdem, I think they need this |
| 22:26 | TEttinger | 'this' as an argument for each function declared in the interface, and each implemented in the record |
| 22:26 | TEttinger | http://stackoverflow.com/a/18270705 |
| 22:27 | arrdem | TEttinger: if it's sensitive to this vs. self I'm gonna be moderately mad. |
| 22:27 | TEttinger | oh I didn't get that. |
| 22:28 | arrdem | yeah that's python's "this" equivalent name. old habits die hard. |
| 22:41 | mercwith1mouth | gfredericks: so array-maps aren't sorted? |
| 22:41 | mercwith1mouth | sorry...i got distracted looking at the piss poor job they did on the healthcare site https://github.com/CMSgov/healthcare.gov |
| 22:42 | arrdem | mercwith1mouth: any fun vulns? |
| 22:44 | mercwith1mouth | arrdem: lol no say yet i'm still pissed they seem to have just used jekyl...a library for static page sites(i used for..2 months) and jammed a bund of JS into it |
| 22:46 | mercwith1mouth | https://github.com/CMSgov/healthcare.gov/blob/master/_layouts/home.html who still does that?! |
| 22:46 | arrdem | mercwith1mouth: you forget that the federales still have support contracts with Symbolics... |
| 23:15 | gfredericks | mercwith1mouth: they're sorted arbitrarily I think |
| 23:15 | gfredericks | ,(array-map 8 9 6 7 4 5 20 20) |
| 23:15 | clojurebot | {8 9, 6 7, 4 5, 20 20} |
| 23:16 | gfredericks | probably insertion order or something |
| 23:16 | gfredericks | again, just an implementation detail |
| 23:18 | arrdem | gfredericks: IIRC none of the clojure map types make an order gurantee... although for the most part the are sorted in some order. There are projects kicking around for insertion-ordered maps... |
| 23:18 | TEttinger | gfredericks, it seems to here http://clojuredocs.org/clojure_core/clojure.core/array-map |
| 23:18 | akurilin | bitemyapp, you mentioned you run your tests from a repl dedicated to them? |
| 23:18 | TEttinger | arrdem, just use a TreeMap or whatever that java one is |
| 23:18 | gfredericks | arrdem: I would think ##(sorted-map) makes an order guarantee |
| 23:18 | lazybot | ⇒ {} |
| 23:19 | arrdem | gfredericks: I'm sure it does... but hash-map and array-map (the two I rembered) I don't think do. |
| 23:20 | arrdem | do we have an update-in eqivalent for seqs/vectors? |
| 23:20 | TEttinger | http://docs.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html this one |
| 23:21 | arrdem | oh d'oh it does support seqs. |
| 23:24 | TEttinger | ,(update-in [[1 2]] [0 1] inc) |
| 23:24 | clojurebot | [[1 3]] |
| 23:25 | TEttinger | regarding array-map: http://clojure.org/data_structures#Data Structures-ArrayMaps |
| 23:25 | frozenlock | Is there a way to store a clojure map into an emacs variable? |
| 23:25 | TEttinger | pr-str ? |
| 23:26 | mercwith1mouth | gfredericks: gotcha. |
| 23:26 | frozenlock | TEttinger: directly, without printing it in the repl :-/ |
| 23:26 | TEttinger | yes |
| 23:26 | TEttinger | ,(count (pr-str {:a 1 :b 2})) |
| 23:26 | clojurebot | 12 |
| 23:27 | TEttinger | it returns a string, does not print it |
| 23:27 | frozenlock | I must be missing obvious... how can I get it to emacs from there? |
| 23:27 | frozenlock | *something |
| 23:28 | TEttinger | oh, that's what you mean |
| 23:28 | TEttinger | it is probably stored in a file somewhere? |
| 23:29 | frozenlock | Just in the RAM. I could spit it and then copy the file, but I was hoping for a more close nrepl/emacs relationship :p |
| 23:29 | coventry | Is it known that if you forward-declare a fn, stick it in a map, then try to dispatch to it from the map, you get an "unbound fn" error? |
| 23:30 | coventry | E.g. (dorun (map eval '[(ns tst1) (declare f) (def d {:k f}) (defn c [] ((d :k))) (defn f [] :success) (ns tst2 (:require [tst1])) (tst1/c)])) |
| 23:31 | coventry | (Oh, and you have to access the function dispatching from the map from a different ns, as shown in that example.) |
| 23:34 | TEttinger | f is declared with different qualified namespaces |
| 23:34 | TEttinger | try using read-string and eval |
| 23:36 | coventry | Somehow I got the wrong version of the example. There should be an empty argument vector in (defn f [] ::success). |
| 23:36 | TEttinger | I got a FileNotFoundException Could not locate tst1__init.class or tst1.clj on classpath: clojure.lang.RT.load (RT.java:432) |
| 23:37 | TEttinger | not the same example though |
| 23:39 | coventry | Hmm, and the example isn't failing for me anymore. Bizarre. I will try a fresh repl. https://www.refheap.com/19590 |
| 23:43 | coventry | Oh, OK, I just had some editing errors. Updated the refheap. |
| 23:44 | coventry | TEttinger: I don't understand what you mean about different qualified ns's. The declare, the map and the fn using the map are all in the first ns. |
| 23:44 | TEttinger | right, nvm |
| 23:49 | coventry | http://dev.clojure.org/jira/browse/CLJ-1276 |
| 23:49 | TEttinger | (dorun (map eval ['(ns tst1) '(declare f) '(def d {:k f}) '(defn c [] ((d :k))) '(defn f [] :success) '(ns tst2 (:require [tst1])) '(tst1/c)])) |
| 23:50 | TEttinger | can't reproduce, coventry |
| 23:50 | TEttinger | I entered that code and got |
| 23:50 | TEttinger | FileNotFoundException Could not locate tst1__init.class or tst1.clj on classpath: clojure.lang.RT.load (RT.java:432) |
| 23:50 | coventry | TEttinger: What version of clojure? |
| 23:50 | TEttinger | the code in the bug report |
| 23:50 | TEttinger | 1.5.1 I think |
| 23:50 | coventry | Could you try 1.6, if you have it handy? |
| 23:50 | coventry | *clojure-version* will tell you. |
| 23:52 | TEttinger | now THAT's interesting. |
| 23:52 | TEttinger | I got that error on 1.4.0, but on 1.5.1, I get your error |
| 23:53 | coventry | Oh, wait, that repl I ran from CL is 1.5.1. I will add that version to the report. Thanksn for checking. |
| 23:55 | TEttinger | figured it out |
| 23:55 | TEttinger | declare is executed separately from the ns |
| 23:55 | TEttinger | it is in user |
| 23:55 | TEttinger | try (doall (map eval '[(do (ns tst1) (declare f) (def d {:k f}) (defn c [] ((d :k))) (defn f [] (println "success"))) (ns tst2 (:require [tst1])) (tst1/c)])) |
| 23:58 | coventry | Damn, now I'm going to have to post my multi-file example. :-) Thanks, TEttinger. |
| 23:58 | TEttinger | I'm not sure if I was right! |
| 23:59 | coventry | Well, it does work wrapped in a (do) form, which is weird. |
| 23:59 | TEttinger | but yeah, the issue may have been with the ns not carrying through |
| 23:59 | TEttinger | because each was evaled... hm |
| 23:59 | TEttinger | could be doall/dorun chunking behavior too |