2012-07-09
| 00:01 | ro_st | emezeske: looking at cljs-build's multiple build configurations. can i build two distinct code-trees in parallel with this feature? |
| 00:02 | ro_st | say a base app and a module that may or may not be loaded at runtime? |
| 00:02 | ro_st | if so, is there any support for generating externs in the one based on the exports of the other? |
| 00:07 | emezeske | ro_st: I... let me think about that |
| 00:08 | emezeske | ro_st: You can definitely supply multiple trees, and they will both be on the classpath |
| 00:08 | ro_st | ok so it'll build both, but not do anything about allowing the two to run side-by-side in the same VM |
| 00:09 | emezeske | ro_st: I'm not sure what you mean by side by side |
| 00:09 | ro_st | as in the case with a base app (js 'binary') loading another module of code (also a js 'binary') into memory and calling into it |
| 00:10 | ro_st | the base app would need to be compiled with a set of externs that correspond to the exports of the module |
| 00:10 | emezeske | ro_st: ah, no, AFAIK if you produced two output js files with lein-cljsbuild, from two separate trees, the output files would each include any code from the other that was called |
| 00:11 | emezeske | ro_st: I think you'd have to supply your own externs file, and mark public things in the base library with ^:export |
| 00:12 | emezeske | ro_st: In otherwords, no help from lein-cljsbuild :) |
| 00:12 | ro_st | and make sure that when compiling the module that it uses the externs instead of the actual base code |
| 00:12 | ro_st | if it can find both an actual namespace and that namespace is in externs, which gets precedence? |
| 00:12 | emezeske | ro_st: yeah, you couldn't use the (ns ...) form to hook up to them |
| 00:12 | emezeske | hah, you've got me stumped on that one. |
| 00:12 | ro_st | right, it'd have to be a call directly to js, using js/symbol? |
| 00:13 | emezeske | ro_st: yeah, AFAIK |
| 00:13 | ro_st | i can live with that |
| 00:13 | emezeske | I'm definitely not certain there's no other way |
| 00:13 | ro_st | forces me to think about that api super carefully |
| 00:13 | emezeske | But that is the only way I can think of :) |
| 00:13 | ro_st | i'm going to stub this out and see what happens |
| 00:14 | emezeske | cool, that's an interesting use case |
| 00:14 | wingy | is it recommended to always use loop/recur instead of calling the fn when recursing? |
| 00:14 | ro_st | in my case, the module is actually 95% static content and 5% logic, and you can only have one loaded at a time |
| 00:14 | wingy | due to TCO |
| 00:14 | ro_st | wingy: recur doesn't add a call to the stack |
| 00:14 | ro_st | so you don't blow the stack on long recursions |
| 00:14 | wingy | ro_st: so it's recommended even on short recursions? |
| 00:15 | emezeske | wingy: I've found that often when I think I need a loop/recur, I can rewrite as a reduce |
| 00:15 | wingy | emezeske: nice |
| 00:15 | emezeske | I tend to find reduce more readable than loop/recur, but I guess that's personal taste? |
| 00:16 | ro_st | madsy: looks like lein-cljsbuild's crossover support gives me what i want |
| 00:17 | madsy | ro_st: Yeah, I've just started using it, so I don't know exactly how easy it is. |
| 00:17 | ro_st | looks fairly straightforward. i'm so totally nowhere near ready to write macros, so i'm not worried about that aspect of it |
| 00:19 | madsy | ro_st: If you want some crappy cljs code to play with: https://gist.github.com/3062242 |
| 00:20 | ro_st | in the cljs repl, in dev mode, i can do everything i usually could in a repl? define new fns, overwrite existing vars, etc? |
| 00:20 | madsy | sure |
| 00:20 | wingy | i read a whole chapter in a book without quite getting why i would need atom .. the http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Cookbook made me getting it with one line: "How to write x = x+ 1" :) |
| 00:21 | ro_st | it's when you go advanced that everything is statically compiled and you lose this capability |
| 00:21 | ro_st | madsy: interesting. webgl. never played with it before |
| 00:27 | ro_st | is there some sort of a cheatsheet for cljs, kinda like clojure.org/cheatsheet? |
| 00:28 | zerokarmaleft | ro_st: http://himera.herokuapp.com/index.html |
| 00:28 | ro_st | oh of course! thank you |
| 00:34 | ro_st | emezeske: how do i teach cljsbuild how to find Firefox on osx? |
| 00:35 | ro_st | i'm getting "Error in background process: #<IOException java.io.IOException: Cannot run program "firefox": error=2, No such file or directory>" |
| 00:35 | ro_st | when running "lein trampoline cljsbuild repl-launch firefox http://localhost:3000/repl-demo" |
| 00:35 | ro_st | on your advanced sample project |
| 00:44 | ToxicFrog | What is the best way to define an anonymous function returning its second argument? |
| 00:44 | ToxicFrog | #(%2) tries to call its second argument, which is not what I want |
| 00:44 | ro_st | #(-> %2) maybe? |
| 00:44 | amalloy | (fn [x y] y) |
| 00:45 | amalloy | you can mess with #() syntax if you want, but it hardly saves you any characters and looks silly |
| 00:45 | dnolen | or (fn [_ x] x) |
| 00:46 | amalloy | wingy: as long as its tail recursion, recur is preferred to calling the function directly |
| 00:46 | amalloy | dnolen: sure. depends whether you want to document/reinforce why you're ignoring the first one |
| 00:47 | emezeske | ro_st: I don't know much about OSX, does it have a $PATH variable in the shell? |
| 00:47 | ro_st | it does |
| 00:48 | ro_st | so it's just trying to call 'firefox'? |
| 00:48 | emezeske | ro_st: Maybe "export PATH=/parent/dir/of/firefox:$PATH" ? |
| 00:48 | emezeske | I believe so |
| 00:48 | emezeske | You could always change it to an absolute path in the project.clj |
| 00:50 | ro_st | the first arg in the vector? |
| 00:50 | emezeske | yeah |
| 00:50 | ro_st | cool |
| 00:50 | wingy | amalloy: ok |
| 00:54 | ro_st | emezeske: fyi, for the next person: instead of "firefox", use "/Applications/Firefox.app/Contents/MacOS/firefox-bin" |
| 00:54 | ro_st | i'm guessing there's no easy way to run this repl from within emacs? |
| 00:58 | evildaemon | Okay, what am I doing wrong in this code? (Besides the horrible abuse of function parameters.) |
| 00:58 | evildaemon | http://pastebin.com/Szg6zwBe |
| 00:59 | evildaemon | (I'm going to go ahead a preface this with "I kind of suck." |
| 00:59 | evildaemon | ) |
| 01:00 | technomancy | ro_st: OS X has all kinds of issues with PATH on gui-launched emacs |
| 01:00 | technomancy | the official fix involves mucking with an XML plist file =( |
| 01:01 | evildaemon | technomancy: If he's on OS X, why not just distribute a patch file? |
| 01:02 | technomancy | a patch for de-fubaring the PATH? |
| 01:02 | emezeske | ro_st: :) |
| 01:03 | ToxicFrog | ,(- 2 1) |
| 01:03 | clojurebot | 1 |
| 01:03 | technomancy | evildaemon: (do) is just nil |
| 01:04 | evildaemon | technomancy: I know. |
| 01:04 | evildaemon | technomancy: It wouldn't take nil because it's not a function. |
| 01:05 | technomancy | do isn't a function either |
| 01:06 | ToxicFrog | asdfghl |
| 01:06 | evildaemon | technomancy: Special form. |
| 01:06 | ToxicFrog | There's the problem |
| 01:06 | ToxicFrog | (split-lines "\n") returns [] rather than ["" ""] |
| 01:06 | technomancy | evildaemon: I don't know what you're doing there, but I'm pretty sure there's no need for (do) |
| 01:07 | amalloy | i can't think of a reason tot est whether j is even in a fib impl |
| 01:07 | ToxicFrog | ,(split-lines "asdf\n\nfdsa") |
| 01:07 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: split-lines in this context, compiling:(NO_SOURCE_PATH:0)> |
| 01:08 | ToxicFrog | ,(clojure.string.split-lines "asdf\n\nfdsa") |
| 01:08 | clojurebot | #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string.split-lines, compiling:(NO_SOURCE_PATH:0)> |
| 01:08 | ToxicFrog | ,(clojure.string/split-lines "asdf\n\nfdsa") |
| 01:08 | clojurebot | ["asdf" "" "fdsa"] |
| 01:08 | ToxicFrog | what |
| 01:08 | evildaemon | amalloy: It's not a test for j, it's to do the second euler problem. |
| 01:08 | ToxicFrog | ,(clojure.string/split-lines "asdf\n\n") |
| 01:08 | clojurebot | ["asdf"] |
| 01:08 | amalloy | oh, you're trying to get all the even fibs |
| 01:08 | ToxicFrog | WHAT |
| 01:08 | ToxicFrog | This is nonsense |
| 01:09 | evildaemon | technomancy: You're right. I just needed a way to return nil and got lazy. |
| 01:09 | amalloy | you don't need a way to return nil either. you just want to return k |
| 01:10 | technomancy | ,((partial constantly nil)) |
| 01:10 | clojurebot | #<core$constantly$fn__2351 clojure.core$constantly$fn__2351@4a2cf11b> |
| 01:10 | ToxicFrog | ,(clojure.string/split-lines "\n\nasdf") |
| 01:10 | clojurebot | ["" "" "asdf"] |
| 01:10 | technomancy | ,(((partial constantly nil))) |
| 01:10 | clojurebot | nil |
| 01:10 | evildaemon | amalloy: *Stares* I'm an idiot. |
| 01:10 | ToxicFrog | AAAA WHAT IS THIS |
| 01:10 | evildaemon | amalloy: Thank you. |
| 01:11 | technomancy | ToxicFrog: Spartaaaaaa? |
| 01:11 | amalloy | ToxicFrog: if it doesn't do what you want, write a function that does? |
| 01:11 | amalloy | (inc technomancy) |
| 01:11 | amalloy | lazybot: what the hell. give the Dude his karma |
| 01:11 | lazybot | It's AWWWW RIGHT! |
| 01:11 | ToxicFrog | amalloy: I'm going to have to, yeah |
| 01:11 | ToxicFrog | Since split-lines completely ignores trailing newlines |
| 01:12 | ToxicFrog | This tastes like a bug |
| 01:13 | ToxicFrog | ,(clojure.string/split "\nasdf\n" #"\n") |
| 01:13 | clojurebot | ["" "asdf"] |
| 01:15 | ro_st | ToxicFrog: it's calling into java's Pattern class |
| 01:19 | ToxicFrog | Aha |
| 01:19 | ToxicFrog | re.split(s) calls re.split(s, 0) |
| 01:19 | ToxicFrog | Which brings this into play: "If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded." |
| 01:21 | ToxicFrog | ,(clojure.string/split "\nasdf\n" #"\n" -1) |
| 01:21 | clojurebot | ["" "asdf" ""] |
| 01:24 | ro_st | watching stuart sierra's evident code talk. datomic looks great |
| 01:26 | wingy | shouldn't this one return a lazy seq: (def integers (iterate inc 0)) . i can't figure out why my processor is overworking when i run that line |
| 01:28 | technomancy | works for me |
| 01:30 | ToxicFrog | Ok, so this is a Java bug, not a Clojure bug~ |
| 01:31 | wingy | technomancy: get it now, it doesn't work on Light Table .. one reason could be that it's running clj 1.5, another that it's trying to realize the infinite lazy sequence |
| 01:32 | wingy | but that latter makes more sense |
| 01:35 | technomancy | weird, why would it try to realize the value of the var returned? that's kind of crazy =\ |
| 01:37 | wingy | technomancy: light table has to print out something for us to see to the right |
| 01:37 | wingy | so that we know what values are in the sequence |
| 01:37 | technomancy | the whole point of def returning a var is so that this doesn't happen |
| 01:38 | technomancy | so it's kinda going out of its way to defeat Clojure's built-in workaround for this problem |
| 01:40 | wingy | (def ll (range 3)) prints out in Light Table (def (0 1 2) (range 3)) |
| 01:42 | wingy | it seems to handle (def ll (range)) fine and less fine with custom fns for constructing values in lazy seqs |
| 02:21 | noidi | I'm using CCW and "navigate to definition" (F3) only works on my project's dependencies, but not on my own code |
| 02:22 | noidi | any idea how to fix this? |
| 03:02 | fureddo | I have a constructor function called create-item. I would like to inialize a list with 10 items, 5 items of type a and 5 items of type b. How can I do that? I'm trying (list (dotimes [_ 5] (create-item 'a)) (dotimes [_ 5] (create-item 'b))) It doesn't work because dotimes always returns nil. |
| 03:08 | _ulises | fureddo: just return a vector/list/etc with something like (map (fn [] (create-item 'a)) (range 5)) |
| 03:08 | pyrtsa | Something like (concat (take 5 (repeatedly create-item)) ...) |
| 03:08 | _ulises | pyrtsa: I suspect that the 'a and 'b are params that denote the type being created though |
| 03:08 | _ulises | pyrtsa: otherwise, +1 on yours |
| 03:08 | pyrtsa | _ulises: Right. |
| 03:09 | pyrtsa | Ha, you can give the count to repeatedly directly! |
| 03:09 | alexey | repeatedly takes number as parameter, like (repeatedly 5 create-item) |
| 03:10 | fureddo | I think that _ulises's answer is ok for my needs, I will try it in a moment. |
| 03:10 | pyrtsa | So what remains is: (concat (repeatedly 5 (partial create-item 'a)) ...) |
| 03:10 | pyrtsa | "..." being, the same for 'b instead of 'a. |
| 03:11 | alexey | what concat does there, by the way? |
| 03:11 | alexey | oh, didn't notice ... :) |
| 03:12 | _ulises | a more contrived solution might be: (take 10 (map create-item (interleave (repeatedly (constantly 'a)) (repeatedly (constantly 'b))))) |
| 03:13 | _ulises | and by contrived I mean ugly, complex and utterly pointless of course |
| 03:13 | fureddo | :-) |
| 03:13 | _ulises | if you know you need 5 and 5, stick to a something like [(map ...) (map )] |
| 03:14 | pyrtsa | _ulises: Or just (repeat 'a) |
| 03:19 | fureddo | After some tests, I think that (concat (repeatedly 5 (partial create-item 'a))) is the solution. |
| 03:19 | pyrtsa | Here's one more: (mapcat #(repeatedly 5 (partial create-item %)) ['a 'b]) |
| 03:22 | ro_st | anyone using cljsbuild got an idea why i'm getting this crossover error? https://www.refheap.com/paste |
| 03:22 | ro_st | erk |
| 03:22 | ro_st | https://www.refheap.com/paste/3518 |
| 03:23 | ro_st | the namespaces all look right |
| 03:24 | alexyakushev | Could someone please explain this inconsistent behavior of type hints across different namespaces? https://www.refheap.com/paste/3519 |
| 03:26 | alexyakushev | Looks like if the hint is placed before the argument vector (rather than before the function symbol) and it is not package-qualified, then the namespace using this function should also have this class imported |
| 03:26 | amalloy | alexyakushev: the second form is only for primitive typehints |
| 03:27 | alexyakushev | amalloy: Could I read about it somewhere? I actually never saw anyone placing the hint there, though I discovered it works... most of the time |
| 03:27 | amalloy | *shrug* |
| 03:28 | alexyakushev | amalloy: So by primitive you mean the primitive types? |
| 03:28 | amalloy | yes, double and long |
| 03:29 | alexyakushev | But it still works for classes as well (if I qualify the hint class). Is it undocumented behavior then? |
| 03:29 | amalloy | as you can see, it doesn't actually work |
| 03:29 | alexyakushev | It doesn't because namespace 'bar doesn't have ArrayList imported |
| 03:30 | alexyakushev | If I either import it, or the hint in 'foo would go like (defn make-list-2 ^java.util.ArrayList [] ....) then it works |
| 03:30 | amalloy | just...don't do it, it's not what hints there are for |
| 03:31 | alexyakushev | Yes, I know, I just have to use them a lot, Android reflection is very expensive |
| 03:32 | amalloy | that's not really relevant? just put the typehints in the right place instead of the wrong place |
| 03:33 | alexyakushev | Yes, you are right |
| 03:33 | alexyakushev | Thank you |
| 04:25 | tozz | Any good resources on how to think about immutable data when building a web app? Coming from Ruby I wanna have a go a Clojure, but I can't wrap my head around how not changing things will work out / look in code, guess it's a mindset thing |
| 04:26 | kral | namaste |
| 04:28 | wingy | confusing that the REPL prints out a list structure when it's infact a sequence |
| 04:28 | wingy | adds confusion since it's not a list |
| 04:29 | wingy | eg. (list? (seq [1 2 3])) |
| 04:29 | wingy | ,(list? (seq [1 2 3])) |
| 04:29 | clojurebot | false |
| 04:29 | wingy | but the structure returned looks like a list .. (1 2 3) |
| 04:30 | wingy | why not have it printed out something like: 1 2 3 or whatever to tell it's a sequence, not a list |
| 04:32 | pyrtsa | wingy: I like that idea. But a lazy sequence of one element (or an empty one) might then be hard to understand. |
| 04:32 | pyrtsa | Something like (lazy-seq [1 2 3 ...]), perhaps? |
| 04:32 | wingy | yeah that would do better |
| 04:33 | wingy | i feel that clj is a really simple and great lang, the last thing to do should be adding incidental complexities |
| 04:33 | wingy | then it would be simple for everyone to get it and thus making it even more popular |
| 04:37 | stain | anyone done EBNF parsing in Clojure? I have not found anything except fnparse - which just has 'EBNF like' rules in Clojure. |
| 04:37 | stain | one would think that one of the first things to do with an EBNF-like parser is to write a parrser for EBNF.. |
| 04:51 | augustl | does http://pastie.org/4224635 make sense? |
| 04:52 | wingy | no since there is no highlighting |
| 04:52 | wingy | use gist github next time :) |
| 05:01 | augustl | wingy: any other paste sites that highlight lisp? |
| 05:05 | wingy | augustl: why not github gist? |
| 05:05 | wingy | http://pastebin.com/ |
| 05:07 | wingy | do you think that "Programming Clojure" is still a good read even though it's from 2009? |
| 05:12 | augustl | wingy: don't like the way they stick around forever |
| 05:14 | stain | wingy: why not Clojure in Action or perhaps the O'Reilly Clojure Programming? |
| 05:14 | wingy | stain: i have already read clojure programming |
| 05:14 | evildaemon | augustl: But yeah, pastebin does syntax highlighting for stuff I've never even heard of. |
| 05:15 | augustl | :D |
| 05:15 | wingy | programming clojure seems short and concise for a better coverage on basics |
| 05:15 | wingy | thought i could read joy of clojure after this one |
| 05:16 | augustl | http://pastebin.com/MnFQZUR8 ! |
| 05:16 | augustl | now with colors |
| 05:16 | augustl | so, does it make sense? :) |
| 05:16 | wingy | perhaps clojure in action after that one. lets dig deep |
| 05:20 | stain | Joy of Clojure is good, but not as a first book! |
| 05:33 | arglist_und_wilk | Mist. |
| 05:36 | kral | some of the examples of The Joy of Clojure are misleading |
| 05:36 | kral | yesterday I was reading it, trying some example |
| 05:36 | kral | (def *test* \a) gives me a warning |
| 05:37 | kral | then I discovered ^:dynamic |
| 05:37 | stain | yes, the book is pre 1.3 style :( |
| 05:37 | stain | good the warning message gets you straight onto the right track |
| 05:37 | kral | it stills to be a great book, anyway |
| 05:37 | kral | stain: sure |
| 05:37 | Raynes | The book was written pre-1.3. |
| 05:38 | wingy | they should update it for each clj version and release an updated ebook |
| 05:38 | Raynes | The examples, when written, were not at all misleading. |
| 05:38 | _nmmn | agree that its great book, maybe there are some editions planned for post 1.3 style hmm |
| 05:38 | wingy | things in programming world change so fast .. they need to iterate as well in docs |
| 05:39 | _nmmn | well depends, dont think cobol docs changed much in last decade =]]] |
| 05:39 | wingy | a waste if 90% of the things in a book is still valid but people choose the most up to date book to read since it will be 100% correct |
| 05:40 | kral | anyway, for a newbie, it can be quite discouraging when an example "fails" |
| 05:40 | wingy | yepp |
| 05:40 | wingy | reading programming clojure atm and they use defstruct |
| 05:40 | stain | yeah. But then this makes you learn the other side - reading the API docs (still horrible), etc. |
| 05:40 | _nmmn | if its easy example i think newbie gets even more info |
| 05:40 | wingy | a good thing i know its deprecated |
| 05:41 | _nmmn | and its not kind of book read-follow-forget, i prefer books that make you think learn and know =] |
| 05:42 | kral | defstruct is deprecated? |
| 05:42 | Raynes | Yes. Records are better. |
| 05:42 | kral | oh, sure |
| 06:04 | wingy | i guess that a function can be considered a value since it could be bound to a var. could one say that a function is data then? |
| 06:06 | wingy | or should one separate data (eg. numbers, strings etc) from functions |
| 06:28 | clgv | Raynes: hey Raynes. you are in the 4clojure "business" right? |
| 06:38 | Raynes | clgv: I guess. |
| 06:38 | Raynes | What's up? |
| 06:39 | clgv | Raynes: I have a problem with my solutions for two problems timing out although one runs in less than 700ms for all tests and the other consumes only less than 30ms for all tests on my machine |
| 06:40 | clgv | Raynes: posted it here: http://groups.google.com/group/4clojure/browse_thread/thread/f43d0acbbc22a1bc |
| 06:40 | Raynes | All of the code given to 4Clojure runs through a sandbox. Some code takes significantly longer in the sandbox. We're not entirely sure why or how to fix it. |
| 06:41 | clgv | I guessed something like that. |
| 06:41 | Raynes | Usually you can just write the solution differently and fix it. |
| 06:41 | Raynes | It's a pain in the ass. |
| 06:42 | clgv | thats difficult without feedback how long each test took and what the timeout for each test is |
| 06:54 | alexyakushev | Does anyone uses Org-mode for Github wiki pages/readmes? |
| 06:54 | alexyakushev | *use |
| 06:55 | pyr | alexyakushev: i do |
| 06:56 | alexyakushev | pyr: I'd like to write some text in superscript but ^ is not working |
| 06:57 | alexyakushev | pyr: Any ideas how those can be done? |
| 06:57 | pyr | ah nope, i only pushed very basic outlines |
| 06:57 | pyr | the more complicated stuff i generate with o-blog |
| 06:58 | alexyakushev | I see. Well, perhaps I would be better without them. Thanks for responding |
| 07:26 | pyr | schani: clojurec is very exciting |
| 07:27 | schani | pyr: thanks. that's why i started it ;-) |
| 07:30 | piotr_ | hi |
| 07:30 | piotr_ | Do you know who is maintaining the clojure cheat sheet? There's a dead link in it... |
| 07:32 | piotr_ | The problem is with the dotdot operator. The problem is more on the ClojureDocs side in fact... |
| 07:33 | wingy | to answer my own question: fn is not data |
| 07:33 | wingy | but they are both values |
| 07:38 | clgv | wingy: LISP => Code is Data and Data is Code |
| 07:40 | ticking | clgv, in good old lisps yes, in clojure only with heavy restrictions |
| 07:41 | clgv | I didn't encounter that heavy restrictions yet |
| 07:41 | kmicu | ticking: can you give an example? :) |
| 07:42 | ticking | Code => mostly Data but Data =|=> Code |
| 07:42 | ticking | the problem is that java shines too to much for this to truly work |
| 07:43 | kmicu | ticking: but can you give an real example, wich part of clojure code is not a clojure data? :) |
| 07:43 | ticking | kmicu, seen picolisp? |
| 07:43 | clgv | I would say: Code => Data, Compiled Functions != Data |
| 07:44 | ticking | clgv, yeah but in good old lisps there is no such concept |
| 07:45 | clgv | if I remember correctly, you cant access the code of a compiled function in sbcl either... |
| 07:46 | unnali | nope, sbcl compiles to native |
| 07:47 | unnali | clisp too |
| 07:47 | unnali | most CLs, I guess. |
| 07:49 | ticking | unnali, i wouldnt call sbcl that classic either ^^ but the compilation process is rather transparent |
| 07:49 | ticking | but yeah the only lisp I know of where data is truly code and code is truly data is picolisp^^ |
| 07:56 | wingy | how do i use clojure contrib namespaces in my lein project? eg http://clojuredocs.org/clojure_contrib/clojure.contrib.repl-utils/show |
| 07:57 | clgv | wingy: you must not - it is deprecated |
| 07:57 | wingy | clgv: all contrib libs are deprecated? |
| 07:57 | wingy | or have they been moved somewhere? |
| 07:58 | clgv | yes. a lot of them were replaced by single libs that are still maintained |
| 07:58 | clgv | ~contrib |
| 07:58 | clojurebot | Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 07:59 | clgv | wingy: in fact, some of the namespaces in contrib will not compile with clojure 1.3/1.4 |
| 08:02 | wingy | wouldn't it be a good idea to not list the contrib lib functions in the search results in clojure docs? |
| 08:03 | clgv | wingy: I have no idea who is in charge for clojuredocs ;) |
| 08:06 | michaelr525 | wingy: there is a lot of good stuff in the old contrib. sometimes i just copy/paste functions from there |
| 08:07 | clgv | michaelr525: I miss clojure.contrib.repl-utils/show |
| 08:11 | wingy | it seems that different sources are describing forms differently |
| 08:11 | wingy | is form the function call itself with fn and its args or any evaluation? |
| 08:12 | babilen | How can I add two lines (one at the start and one at the end) to an input-stream? (I essentially need to read files and add a string at the beginning and at the end). I am currently using something like https://www.refheap.com/paste/3522 but think that it is ugly. Can you think of something better? |
| 08:12 | wingy | eg. 1. (fn arg1 arg2) 2. [1 2] .. which one is a form? |
| 08:12 | wingy | from Programming Clojure: "A vector of numbers is another kind of form." |
| 08:13 | wingy | he even says "Numeric literals are forms." .. 1 2 3 etc |
| 08:18 | wingy | but then some people say that form is a S-expression that is a valid fn call |
| 08:20 | clgv | wingy: the [...] brackets are just syntactic sugar for (vector ...) |
| 08:20 | unnali | wingy: http://stackoverflow.com/questions/2877371/definition-of-lisp-form |
| 08:21 | clgv | unnali: lol in short everything in round brackets ;) |
| 08:23 | clgv | wingy: so why splitting hairs - are you learning for a theoretical exam? |
| 08:23 | unnali | and then some :) |
| 08:23 | wingy | clgv: i just hate when i dont understand |
| 08:24 | wingy | ok lets say its just an expression that is valid |
| 08:26 | clgv | wingy: well, just distinguish between "form" and "valid form" |
| 08:26 | wingy | form has to be valid? |
| 08:26 | wingy | (1 2 3) is not a form |
| 08:26 | lucian | wingy: i think a form is a data structure that can be evaluated as a program |
| 08:26 | wingy | yeah |
| 08:26 | wingy | 1 is a data structure .. it can be evaled .. 1 will be returned |
| 08:26 | madsy | wingy: Think of why (1 2 3) isn't a valid form. What happens when you call 1? |
| 08:27 | wingy | (fn 1 2) as well |
| 08:27 | wingy | "Forms such as +, concat, and java.lang.String are called symbols and |
| 08:27 | wingy | are used to name things." |
| 08:27 | wingy | in this case the forms he is referring to is symbols that are evaled to the values of the vars they are naming |
| 08:27 | wingy | madsy: hmm |
| 08:28 | wingy | i just know it wont work since 1 is not a fn |
| 08:28 | lucian | does it matter? |
| 08:28 | wingy | yeah |
| 08:28 | clgv | well I think those sentences are meant to explain to you what the author will call "form" thrroughout the book |
| 08:28 | madsy | wingy: In a way 1 is a function. It evaluates to itself. |
| 08:28 | wingy | knowledge matters :) |
| 08:28 | madsy | Hence it is a unary function. |
| 08:28 | madsy | Same with strings and keywords |
| 08:28 | gfredericks | madsy: wat |
| 08:28 | michaelr525 | watwat |
| 08:29 | madsy | gfredericks: I said you can think of it like that. Not that it literally is a function. |
| 08:29 | gfredericks | madsy: I just can't see why that's helpful |
| 08:30 | gfredericks | maybe "function call" instead of "function" |
| 08:30 | madsy | gfredericks: Yeah, okay. |
| 08:30 | gfredericks | since ("foo") won't work |
| 08:30 | gfredericks | michaelr525: what kind of certificate were we talking about |
| 08:31 | madsy | gfredericks: right |
| 08:32 | wingy | i think i get it .. form is simply a data structure that can be evaled |
| 08:32 | wingy | (1 2 3) is a data structure when read into memory, but not a form |
| 08:32 | AWizzArd | wingy: a form is something that you intend to evaluate. |
| 08:32 | wingy | wii |
| 08:32 | clgv | well you can do ##(eval '+) |
| 08:32 | lazybot | java.lang.SecurityException: You tripped the alarm! eval is bad! |
| 08:32 | clgv | lol not in the sandbox ;) |
| 08:32 | clgv | &+ |
| 08:32 | lazybot | ⇒ #<core$_PLUS_ clojure.core$_PLUS_@1ca18e9> |
| 08:33 | wingy | yeah + is a form |
| 08:33 | AWizzArd | A type hint is not a form, as you don’t want to evaluate it. But a type hint is an expression, like everything else. |
| 08:33 | gfredericks | type hints can't be read on their own |
| 08:33 | michaelr525 | gfredericks: ssl? |
| 08:34 | gfredericks | michaelr525: don't they serve the function of ensuring there aren't two certs for the same domain? |
| 08:34 | michaelr525 | gfredericks: hmm.. didn't know that |
| 08:35 | gfredericks | michaelr525: how else do the clients know that they're connecting to your site? |
| 08:36 | michaelr525 | gfredericks: that's why i thought it isn't worth the money, but if you say that they issue only one cert per domain maybe it is :) |
| 08:36 | rabbler | I have a really, really stupid Lisp/Clojure design decision to ask…. Why can't primitive types (integral, float strings and such) just resolve to themselves, such as symbols? Why can't everything be a function? Again, this is just a design question. Seems strange to me that we have to differentiate these from functions. But, I must be missing something important. |
| 08:36 | gfredericks | michaelr525: everything about "you connecting to your bank" can be easily faked by e.g.. your ISP except for the cert part |
| 08:37 | clgv | rabbler: what use would that have? do you want to build a herbrandt universe? ;) |
| 08:37 | michaelr525 | i see.. |
| 08:37 | michaelr525 | gfredericks: well i feel a bit safer now.. thanks :) |
| 08:37 | gfredericks | michaelr525: probably "one per domain" isn't even all that important; more important is only issueing them to the domain owner |
| 08:38 | rabbler | Just a silly question. If I have a function, which takes another function that expects that function to return, lets say an Int, why can't I just pass an int to test. That int would just be treated as a function and return itself. |
| 08:38 | gfredericks | "one per domain" might not even be true... |
| 08:39 | clgv | rabbler: you can create such a function via e.g. (constantly 1) |
| 08:40 | clgv | gfredericks: subdomains should be possible |
| 08:40 | rabbler | true, but I have to create such a function. Why not treat them the same? Again, just a question. |
| 08:41 | rabbler | Just wondering why it would be bad. |
| 08:41 | clgv | rabbler: how would you distinguish when it shall be really used as a function and when not? |
| 08:42 | rabbler | it still has a type. Just as a map does. Right? It's early and I am on my first cup. I just popped on because this has been bugging' me. |
| 08:42 | clgv | rabbler: if it would always be a function you'll get performance issues since you always have to call it to get the value |
| 08:43 | rabbler | clgv:So, you think it's just a performance thing? Wouldn't the runtime be able to deal with this once it's compiled and sees that the value in it is static? |
| 08:44 | rabbler | clgv: Sorry for all the silly questions. Just something I was wondering. |
| 08:45 | clgv | rabbler: most of the time you want to use those constants as constants - I think that's a reason as well. if not there is `constantly` |
| 08:45 | rabbler | clgv: I'm not clojure/lisp expert. I've been to two clojure-conj and still don't use it. Grrr. No iOS version. ;-) |
| 08:45 | rabbler | clgv: Thanks for the info. |
| 08:46 | clgv | rabbler: you want to program clojure on an iOS device? |
| 08:46 | algal | clgv: who doesn't ? :) |
| 08:46 | rabbler | clgv: I thought we'd want to program clojure on everything? |
| 08:46 | rabbler | clgv: Though, not really. |
| 08:46 | clgv | I'd stick to something with a keyboard and a mouse ;) |
| 08:46 | rabbler | clgv:It's just what I have been doing for 6 months and I miss messing with clojure. |
| 08:47 | bordatoue | hello, could anyone tell me how i can pass string than need to re-find function |
| 08:47 | clgv | rabbler: programming on a tablet? |
| 08:47 | rabbler | clgv: No, writing iOS software. Using Xcode, on a Mac. You know. |
| 08:48 | bordatoue | okay, sorry for being stupid , i need to pass a string to re-find however # symbol keeps getting in the way |
| 08:48 | bordatoue | is there any way to do it . |
| 08:48 | clgv | rabbler: lol, right. hmm they are working on android though, GSoC project afair |
| 08:48 | rabbler | clgv:But, I've offloaded all server-side work to java devs. Some want to try to use clojure, badly! But, darned management. We have to sneak it in and show that it worked. You know how it is. |
| 08:53 | unnali | bordatoue: how do you mean by "getting in the way"? |
| 08:53 | bordatoue | unnali: the # symbol is being converted to string so this doesn't work |
| 08:53 | unnali | bordatoue: could you show me an example? I'm not entirely sure I'm on the same page as you. |
| 08:53 | bordatoue | unnali: all i need to do is to pass an argument that prefix # in such a way that # is not a string |
| 08:54 | bordatoue | unnali: for example (re-find #<something> [col]) ; how do i pass something as an argument |
| 08:54 | unnali | oh, right. |
| 08:55 | clgv | bordatoue: re-pattern |
| 08:55 | unnali | #"blah" is a reader macro to compile a java.util.regex.Pattern .. so there should be one to create such a thing from the string? |
| 08:55 | unnali | ^ |
| 08:55 | unnali | bordatoue: per clgv's advice, (re-find (re-pattern <something>) [col]) |
| 08:56 | bordatoue | unnali: # is implemented as re-patter |
| 08:57 | unnali | uh.. yes. |
| 08:57 | bordatoue | how did you find that # was implemented as re-pattern |
| 08:57 | unnali | clgv said so. |
| 08:57 | clgv | &(doc re-pattern) |
| 08:57 | lazybot | ⇒ "([s]); Returns an instance of java.util.regex.Pattern, for use, e.g. in re-matcher." |
| 08:57 | bordatoue | is there any other way to know about these things |
| 08:58 | unnali | bordatoue: search the API docs I guess? |
| 08:58 | clgv | $findfn "bla" #"bla" |
| 08:58 | lazybot | [] |
| 08:58 | clgv | oh he cant do that :/ |
| 08:58 | unnali | bordatoue: http://clojure.github.com/clojure/ and look for functions starting with "re-" is a good start. |
| 08:59 | bordatoue | unnali: i can find docs , but i need to understand the association of reader macros with the actual fn names |
| 08:59 | unnali | that's probably only defined in the clojure source |
| 08:59 | clgv | bordatoue: books are good for that ^^ |
| 08:59 | bordatoue | nice one |
| 09:00 | unnali | bordatoue: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L100 |
| 09:01 | unnali | '#' causes delegation to a DispatchReader() |
| 09:01 | unnali | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L105 |
| 09:01 | unnali | and '"' in turn causes delegation to a RegexReader() |
| 09:01 | unnali | hence #" starts reading a regex in. |
| 09:01 | unnali | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L422 |
| 09:01 | bordatoue | can we not use source |
| 09:01 | bordatoue | to list the macros |
| 09:01 | unnali | book vs. source, if they disagree, who wins? ;-) |
| 09:02 | bordatoue | (source #) would that work |
| 09:02 | unnali | no |
| 09:02 | unnali | reader macros are not first-class |
| 09:02 | unnali | they're defined here in LispReader.java, as you can see |
| 09:02 | unnali | that's not necessarily introspectable (I haven't looked that far) |
| 09:02 | unnali | and besides, the source is java, not clojure |
| 09:02 | bordatoue | alright |
| 09:02 | bordatoue | thanks very much |
| 09:04 | unnali | np! |
| 09:13 | gfredericks | clgv: oh certainly, I didn't intend to exclude subdomains |
| 09:21 | jsabeaudry | Is sandbar the best library when it come to authentication for a web server written in clojure? |
| 09:22 | clgv | jsabeaudry: there is chas' "friend" library which he actively develops |
| 09:23 | kmicu | jsabeaudry: https://github.com/cemerick/friend/ |
| 09:25 | jsabeaudry | clgv, kmicu, thanks! |
| 09:31 | bordatoue | is there any python equivalent of string[:-1] in clojure |
| 09:31 | foxdonut | /leave #clojure |
| 09:32 | jsabeaudry | I love the quotations (and the inspirations) for library names like friend and leiningen, great stuff |
| 09:35 | bordatoue | is there any python equivalent of string[:-1] in clojure |
| 09:35 | mtkoan | what does string[:-1] do in python |
| 09:35 | unnali | bordatoue: what have you tried? |
| 09:36 | clgv | bordatoue: (->> s count dec (nth s)) |
| 09:36 | bordatoue | (nth "string" idx) |
| 09:36 | bordatoue | (butlast |
| 09:36 | bordatoue | (butlast string) |
| 09:36 | unnali | ,(drop-last "xyz") |
| 09:36 | clojurebot | (\x \y) |
| 09:36 | clgv | then use butlast ^^ |
| 09:36 | bordatoue | problem is they return character sequence not a string |
| 09:36 | unnali | then use str after! |
| 09:36 | foxdonut | apply str |
| 09:37 | unnali | ,(apply str (drop-last "great string")) |
| 09:37 | clojurebot | "great strin" |
| 09:37 | bordatoue | so what about the performance |
| 09:37 | unnali | so what about the performance ;-) |
| 09:37 | clgv | bordatoue: for performance you have to use stringbuilder or similar anyway |
| 09:37 | bordatoue | doesn't it matter to keep on calling serveral fns to attain a simple task |
| 09:37 | llasram | &(let [s "examples"] (->> s count dec (subs s 0))) |
| 09:37 | lazybot | ⇒ "example" |
| 09:38 | bordatoue | okay, subs based on string builder |
| 09:38 | unnali | bordatoue: pick the clean solution first, profile and optimise later |
| 09:38 | llasram | I do wish the Clojure index-taking functions would accept negative indices as counting from the end where sensible |
| 09:39 | bordatoue | exactly llasram |
| 09:40 | bordatoue | unnali: i think we should write clean code from the start not just writing some ting that involves multiple invokataion to attain a simple task of creating a substring |
| 09:40 | unnali | ^ not that it would help perf-wise. |
| 09:40 | bordatoue | in python its "string"[:-1] thats it |
| 09:40 | unnali | just because python does it with one invocation, it doesn't mean any other language can necessarily do that |
| 09:40 | unnali | if the building block isn't there for you already, then that's it, you'll have to make your own. |
| 09:40 | unnali | it's idiomatic to treat strings as seqs. |
| 09:41 | unnali | but I mean, heck. |
| 09:41 | lucian | bordatoue: python's slicing isn't necessarily more efficient than function calls in clojure |
| 09:41 | unnali | ^^^ |
| 09:41 | lucian | and getting back a seq is meh |
| 09:41 | lucian | not really a problem either way |
| 09:42 | lucian | perhaps strings should act as seqs without becoming something else |
| 09:42 | lucian | but it's not a big deal imo |
| 09:42 | unnali | ,(let [str "Blah blah"] (.substring str 0 (dec (count str)))) |
| 09:42 | clojurebot | "Blah bla" |
| 09:42 | unnali | hardly better than llasram's example before, but whatever. |
| 09:43 | clgv | `subs` is definitely the way to go here, though ;) |
| 09:43 | lucian | but yeah, i also wish negative indices did something meaningful in more places |
| 09:43 | unnali | for sure :) |
| 09:43 | lucian | i think it's a nice small feature of python |
| 09:43 | unnali | ditto ruby, it's nice and makes sense |
| 09:43 | solussd_ | it's a feature that you could add to [your] clojure [library] as a one-liner though, so just do it. :) |
| 09:44 | lucian | and it only eats into behaviour that is in fact an error, too |
| 09:44 | lucian | solussd_: but not all clojure funcs will support it magically |
| 09:44 | solussd_ | what clojure functions would need to support it? |
| 09:44 | solussd_ | outside of what you write |
| 09:45 | lucian | indexing vectors, for example |
| 09:45 | lucian | &([0 1 2] -1) |
| 09:45 | lazybot | java.lang.IndexOutOfBoundsException |
| 09:46 | clgv | &((subvec [0 1 2 3 4 :evil] 0 2) 5) |
| 09:46 | lazybot | java.lang.IndexOutOfBoundsException |
| 09:46 | clgv | ah that one got fixed :) |
| 09:46 | solussd_ | ooh ok.. you want that behavior everywhere |
| 09:47 | solussd_ | ;) |
| 09:47 | Iceland_word | Maybe something like ([:-3] "string") ;) |
| 09:47 | lucian | solussd_: i think it might be nice |
| 09:47 | solussd_ | i agree |
| 09:47 | clgv | &((subvec [0 1 2 3 4 :evil] 2) -1) |
| 09:47 | lazybot | ⇒ 1 |
| 09:47 | clgv | or not :P |
| 09:48 | clgv | &(clojure-version) |
| 09:48 | lazybot | ⇒ "1.4.0" |
| 09:48 | jweiss | anyone know what might be wrong when emacs slime-connect says it connects, but no slime repl buffer appears? clojure-jack in works just fine |
| 09:49 | solussd_ | jweiss: have you verified it isn't in your buffer list (even though it doesnt appear)? |
| 09:49 | jweiss | solussd_: yeah, it's not there |
| 09:55 | jsabeaudry | jweiss, any clue in the *swank* buffer? |
| 09:58 | bordatoue | would it be possible to pass #{somevalues} as an argument to the main method |
| 09:58 | bordatoue | basically I would like to pass clojure set as an argument to -main fn from cmd line |
| 10:00 | ohpauleez | bordatoue: You can pick off the cmd args you want, and put them into a set |
| 10:00 | ohpauleez | or |
| 10:00 | ohpauleez | take the first arg and pass it to read-string |
| 10:00 | ohpauleez | and it'll return a set |
| 10:01 | jweiss | jsabeaudry: hm, all that's in there now is the output from clojure-jack-in. what's interesting is after i ran clojure-jack-in, and doing sayoonara, slime-connect now works normally. |
| 10:02 | jweiss | so clojure-jack-in must be initializing something in slime that i need to do in my emacs init file |
| 10:07 | locojay1 | hi if i want to import a local api project is the right way to do it lein install and then use lein local repo to install produced jar file to m2 repo? or is there a better way |
| 10:09 | clgv | locojay1: lein install should work fine |
| 10:10 | clgv | I use it all the time |
| 10:10 | locojay1 | k thanks |
| 10:13 | locojay1 | if i plan to opensource and upload to github is there any other step involved (repo server?) so others don't need to clone and install first. will do so research |
| 10:22 | clgv | locojay1: if you publish, you can upload your jars to clojars |
| 10:27 | locojay1 | clgv: thanks |
| 10:52 | mtkoan | Just upgraded emacs24, now when compiling with swank-clojure, if there is an error in a file, the compilation error isn't reported correctly |
| 10:53 | mtkoan | just prints: error in process filter: symbols function defintion is void: cl-set-getf |
| 10:53 | mtkoan | happen to anyone else? |
| 11:09 | bordatoue | if i create a clj file with a -main fn would I be able to pass #{} clojure set as an argument to the clojure main fn , I don't know if it will be possible as all the argument to the main method in java is type String |
| 11:10 | bordatoue | can anyone please suggest |
| 11:11 | jsabeaudry | bordatoue, I beleive ohpaulesz had a pretty good suggestion the last time you asked the question |
| 11:16 | bordatoue | jsabeaudry: well, I didn't understand what he meant, by putting cmds in a set. Wont the main method in java accepts a string array |
| 11:17 | bordatoue | hello |
| 11:18 | jsabeaudry | bordatoue, From my limited experience, the main function in all languages accept a string array. What he suggested is how to transform a string in a clojure data structure, "read-string" |
| 11:20 | bordatoue | using read-string, thanks. So why doesn't repl require a readstring |
| 11:20 | clgv | bordatoue: why would you want to put something in a main function? |
| 11:20 | jsabeaudry | bordatoue, the R in repl is about that part |
| 11:21 | bordatoue | so it is not a good env to test your functions then |
| 11:22 | jsabeaudry | it is a great environment to test your functions |
| 11:22 | jsabeaudry | just not your "-main" |
| 11:23 | clgv | bordatoue: you should test your functions in a REPL ... |
| 11:23 | bordatoue | okay, so how do i add a local jar file to the classpath in lein if i manually copy something to lib it is still not picking it up , |
| 11:23 | bordatoue | clgv: testing in REPL is what ihave done, i came acrross this special case for -main |
| 11:24 | bordatoue | i wanted to pass few arguments to the main function |
| 11:24 | clgv | bordatoue: ideally your -main method only contains task selection code |
| 11:24 | nDuff | bordatoue: ...if you're doing it right, your -main is so trivial as to be obviously correct, and all the logic goes somewhere else that's easier to test. |
| 11:25 | clgv | I'll test my main via (-main "-E" "bla" "-R" "blubb"), well I have a convenience macro to just write (main -E bla -R blubb) ;) |
| 11:25 | bordatoue | clgv: nDuff there should be a entry point in the code to pass some arguments , is there any properties in clojure similar to java -D options |
| 11:26 | clgv | see above ^^ |
| 11:26 | nDuff | bordatoue: ...well, you can certainly access Java properties from Clojure. |
| 11:26 | bordatoue | in my case i wanted to test something so (-main #{no no2 }) |
| 11:30 | clgv | bordatoue: how do you provide that to your jarfile from commandline? |
| 11:36 | jsabeaudry | bordatoue, your main function needs to receive strings because that is what your OS will give it. If you find an OS that will pass clojure data structures to your main, then you will be able to do what you want to do |
| 11:37 | jsabeaudry | bordatoue, until then, if you want the strings to be clojure data structures, you need to perform the conversion yourself, possibly using read-string |
| 11:47 | bordatoue | this works in repl breaks from cmd |
| 11:48 | clgv | bordatoue: erm what? |
| 11:48 | bordatoue | clgv: just not getting anywhere |
| 11:48 | bordatoue | okay, in lein how do i add a local .jar file to the classpath |
| 11:48 | clgv | bordatoue: from cmd you can ONLY pass STRINGS to a program. |
| 11:48 | bordatoue | i copied .jar to lib directory and still it didn't pick up |
| 11:48 | TimMc | bordatoue: Of course it will work from the REPL, you can pass anything in there. |
| 11:49 | clgv | bordatoue: restart your repl - then it works |
| 11:49 | bordatoue | clgv: TimMc is there any equivalent of python keywords in clojure |
| 11:49 | TimMc | You mean, named arguments? Not really. |
| 11:50 | bordatoue | yes |
| 11:50 | bordatoue | okays forget the string , i do understand now. thanks/ |
| 11:50 | bordatoue | tell me how do i add a local jar file in lein classpath |
| 11:51 | clgv | bordatoue: putting it in the lib folder works. just restart that repl |
| 11:51 | bordatoue | clgv: are you sure about it , so if i do a uberjar will it work |
| 11:52 | clgv | bordatoue: no. because you have to disable auto-clean of the lib folder which uberjar will do otherwise. |
| 11:52 | clgv | have a look at the sample-project-clj |
| 11:53 | bordatoue | thanks, and how do i disable this auto-clean hopefully it must be something in the project.clj file |
| 11:53 | bordatoue | clgv: i can goolge that one |
| 11:57 | ToxicFrog | ,(let [test-kwargs (fn [x y & args] (let [kwargs (apply hash-map args)] (println x y kwargs))] (test-kwargs "one" "two" :foo true :bar false :baz [])) |
| 11:57 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: ]> |
| 11:58 | TimMc | bordatoue: Down that road madness lies. |
| 11:58 | TimMc | ~repeatability |
| 11:58 | clojurebot | repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability |
| 11:59 | ToxicFrog | ,(let [test-kwargs (fn [x y & args] (let [kwargs (apply hash-map args)] (println x y kwargs)))] (test-kwargs "one" "two" :foo true :bar false :baz [])) |
| 11:59 | clojurebot | one two {:foo true, :bar false, :baz []} |
| 11:59 | ToxicFrog | There you go, named arguments. |
| 12:00 | clgv | ToxicFrog: it can be much nicer with the "clojure.options" library |
| 12:00 | ToxicFrog | The API doesn't list that library. |
| 12:02 | TimMc | ToxicFrog: And then everyone who wants to use 'apply with that will hate you. |
| 12:02 | ToxicFrog | TimMc: why? |
| 12:02 | clgv | ToxicFrog: https://github.com/guv/clojure.options |
| 12:02 | TimMc | ToxicFrog: Go ahead, combine test-kwargs with {"one" "two", :foo true, :bar false, :baz []} |
| 12:03 | TimMc | It's surprisingly common and surprisingly irritating. |
| 12:03 | ToxicFrog | ,(let [test-kwargs (fn [x y & args] (let [kwargs (apply hash-map args)] (println x y kwargs)))] (test-kwargs {"one" "two", :foo true, :bar false, :baz []}) |
| 12:03 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 12:04 | ToxicFrog | ,(let [test-kwargs (fn [x y & args] (let [kwargs (apply hash-map args)] (println x y kwargs)))] (test-kwargs {"one" "two", :foo true, :bar false, :baz []})) |
| 12:04 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval103$test-kwargs> |
| 12:04 | TimMc | If you think you need kwargs, you should probably just accept an options map at the end. |
| 12:04 | ToxicFrog | Why is the above result meant to be surprising? |
| 12:04 | TimMc | It's not. It just shows that the standard tool for the job, 'apply, can't be used here. |
| 12:05 | TimMc | And that pisses people off. |
| 12:05 | ToxicFrog | Why can't apply be used there? |
| 12:06 | TimMc | &(apply (fn [& args] args) {:a 1 :b 2}) |
| 12:06 | lazybot | ⇒ ([:a 1] [:b 2]) |
| 12:06 | TimMc | &(apply (fn [& args] args) [:a 1 :b 2]) |
| 12:06 | lazybot | ⇒ (:a 1 :b 2) |
| 12:07 | ToxicFrog | Aah. |
| 12:07 | ToxicFrog | So it's not that you can't use apply, it's that you can't pass in an options map (with or without apply) |
| 12:08 | clgv | TimMc: well it's said that you should not pass options as a map. when ever you want named options they shall be passed without additional "{}" |
| 12:08 | TimMc | ToxicFrog: No, it's that you can't apply an options map. |
| 12:09 | TimMc | clgv: I don't care what the clojure core style guide says. |
| 12:09 | TimMc | I mean, most of that document is pretty reasonable, but that suggestion is misguided. |
| 12:10 | clgv | TimMc: For the cases of passing options from function to function with added documentation I wrote clojure.options ;) |
| 12:11 | clgv | for all other cases I do not want to add additional {} |
| 12:13 | locojay1 | whein i use lein run install of java -jar i keep on getting output to stdout. example : upload sequence to mongodb via monger will keep on outputing the writeresult. anyway to prevent this witout redirecting when using lein run |
| 12:14 | antares_ | locojay1: lein run install of java -jar? |
| 12:14 | antares_ | if you use tools.logging or timbre and make your application to log to a file or elsewhere, it will |
| 12:14 | antares_ | leiningen does not control that |
| 12:15 | locojay1 | sry i meant lein run instead of java -jar |
| 12:15 | antares_ | locojay1: can you paste the output? |
| 12:17 | locojay1 | will get {"$oid":"4ffb02f0c0126262551793277b"},"n":1, "connectionId": 64, "wtime"0, "err":null,"of":1.0} for each elem in sequence im updating (so allot of output) |
| 12:20 | antares_ | locojay1: this means you probably have println somewhere |
| 12:20 | antares_ | as far as I know MongoDB Java driver does not log |
| 12:20 | antares_ | monger definitely does not |
| 12:25 | locojay1 | https://gist.github.com/3077448 |
| 12:31 | ToxicFrog | mthvedt: I've got a working lexer and parser now! |
| 12:31 | ToxicFrog | The lack of error reporting in the parser is still a problem, though - I'm having to query the lexer to get a rough idea of where the error is |
| 12:34 | wingy | is it possible for 2 different vars to bind to one and the same value? |
| 12:34 | jweiss | ,`(let [x 1] x) |
| 12:34 | clojurebot | (clojure.core/let [sandbox/x 1] sandbox/x) |
| 12:34 | jweiss | how do i avoid the x getting namespaced in the syntax quote? is there any other way besides using gensym? |
| 12:35 | wingy | jweiss: i thought you were answering my question :) |
| 12:35 | jweiss | i tried doing postwalk/replace, but then that doesn't affect macros that expand into let |
| 12:35 | jweiss | sorry :) |
| 12:35 | jweiss | wingy: to answer your question can't you bind them both to a atom? |
| 12:36 | S11001001 | ,`(let [x# 1] x#) ; jweiss is this what you mean? |
| 12:36 | clojurebot | (clojure.core/let [x__53__auto__ 1] x__53__auto__) |
| 12:36 | wingy | jweiss: have no idea .. just a thought that came up in my head .. nm :) |
| 12:36 | jweiss | S11001001: yeah, that *works* but part of the reason I'm using syntax quote is so the expression is more human-readable. those autogenned names are pretty ugly. |
| 12:37 | S11001001 | jweiss: human-readable and avoiding capture don't go hand in hand, not without first-class bound/free variables in the forms (like scheme has) anyway |
| 12:38 | jweiss | S11001001: i prefer risking capture |
| 12:38 | jweiss | otherwise i have to explain to my users to always remember to put # at the end of their local variables or else it will not compile |
| 12:38 | jweiss | or eval, rather |
| 12:40 | wingy | is ^ not valid anymore in clj for returning meta data? |
| 12:40 | technomancy | jweiss: are you writing an anaphoric macro? |
| 12:40 | nickaugust | so when I use (map my-func my-seq) the function calls are not fired until I read the returned seq? I have a map call that doesnt run unless I (println (map ... |
| 12:40 | wingy | i get "java.lang.RuntimeException: EOF while reading" when using ^object |
| 12:41 | jweiss | technomancy: no, i'm trying out using quoted code for steps of funtional tests (and then evaling it to run the test) |
| 12:41 | ToxicFrog | ,(cons [1 2] [3 4]) |
| 12:41 | clojurebot | ([1 2] 3 4) |
| 12:41 | jweiss | the point being that i want to preserve the original data |
| 12:41 | technomancy | jweiss: it's considered bad form to introduce implicit lexical bindings for callers; much better to let them pick the name for the local |
| 12:42 | jweiss | technomancy: that's what i want to do. |
| 12:42 | nickaugust | (map #(+ % 3) [2 4 7]) |
| 12:42 | nickaugust | ,(map #(+ % 3) [2 4 7]) |
| 12:42 | clojurebot | (5 7 10) |
| 12:42 | technomancy | jweiss: if the caller provides the name you don't need to set it in the syntax-quote |
| 12:43 | jweiss | technomancy: my users are going to give my test harness syntax-quoted forms, and the test harness runs them. at this point they cannot use let without the reader gensym |
| 12:43 | nickaugust | is there a map function that calculates the results immedietly? |
| 12:44 | ToxicFrog | nickaugust: (doall (map ...)) |
| 12:44 | nickaugust | ToxicFrog: thanks :) |
| 12:44 | ToxicFrog | If you just want the side effects and not the resulting seq, use (dorun) instead |
| 12:45 | nickaugust | ToxicFrog: perfect thanks! |
| 12:45 | hiredman | http://news.ycombinator.com/item?id=4218820 |
| 12:45 | ToxicFrog | (in particular, (dorun (range)) is an infinite loop and (doall (range)) is an OutOfMemoryException~) |
| 12:47 | hiredman | (I imagine dons is being sarcastic there) |
| 12:47 | dnolen | hiredman: :P |
| 12:47 | technomancy | jweiss: I don't think there's a good way to do that |
| 12:48 | technomancy | with syntax-quote |
| 12:48 | jweiss | technomancy: i'm open to non-syntax quoted, but figured i'd need it for namespace resolution |
| 12:49 | technomancy | not if you can bind *ns* |
| 12:51 | jweiss | technomancy: i probably can, but then what? |
| 12:52 | jweiss | oh you mean pop it back out before eval? |
| 12:57 | technomancy | just bind it to whatever ns has the values your form needs |
| 13:04 | wingy | why would i want to use the :tag meta data to describe what data type is expected in a parameter? it doesn't seem that clj enforces type checking |
| 13:05 | wingy | eg. what good does this :tag meta data do: (defn #^{:tag String} shout [#^{:tag String} s] s) |
| 13:07 | dakrone | wingy: :tag metadata is type-hinting |
| 13:08 | foxdonut | ~CPOR |
| 13:08 | clojurebot | CPOR is Clojure Programming (O'Reilly): http://www.clojurebook.com |
| 13:09 | ToxicFrog | dakrone: right, but what actual effect does the type-hinting have? |
| 13:09 | dakrone | ToxicFrog: http://clojure.org/java_interop#Java%20Interop-Type%20Hints |
| 13:10 | ToxicFrog | Aah |
| 13:11 | wingy | foxdonut: lol i actually ignored the java interop chapter in that book |
| 13:11 | wingy | perhaps i should read it :) |
| 13:11 | wingy | dakrone: thx |
| 13:11 | nDuff | Easiest way to tell is to set the *warn-on-reflection* flag |
| 13:11 | foxdonut | wingy: :-) |
| 13:11 | nDuff | anywhere that doesn't generate a warning, type hinting is unnecessary/useless. |
| 13:11 | nDuff | (and it's not necessarily best placed at the warning site, either -- if putting it somewhere else allows inference...) |
| 14:03 | dustingetz | dnolen: i see a clojuescript branch "ext-js-sample" as well as an issue "CLJS-54 Create a sample cljs app that uses an external JavaScript library" (which is resolved) http://dev.clojure.org/jira/browse/CLJS-54 |
| 14:04 | dustingetz | i already have from hackerschool i functional sencha/extjs sample app |
| 14:04 | dustingetz | is this something i can just slam in as a new sample, tag it against cljs-54, and submit a pul req? is that valuable and likely to be accepted? |
| 14:04 | dnolen | dustingetz: at this point probably not. |
| 14:04 | dustingetz | cool, glad i asked haha |
| 14:05 | dnolen | dustingetz: also, CLJS doesn't take pull requests, only patches via JIRA |
| 14:05 | dustingetz | sure, we'll get all that figured out |
| 14:05 | dustingetz | i dunno if you talked to sonali, its "open source week" at hackerschool. six of us looking at cljs issues right now |
| 14:05 | dustingetz | we just started |
| 14:06 | dnolen | dustingetz: I take it you all are you looking for low hanging fruit? |
| 14:06 | dustingetz | yeah, we think we can handle the docstring issue |
| 14:06 | dustingetz | might take a whack at it today and see what we come up with |
| 14:07 | dnolen | dustingetz: the docstring issue and related REPL things are not as simple as they seem (though not overly complex either) |
| 14:07 | dustingetz | yeah, the related repl stuff (from your email to Alan a month ago) would be a next step, but unlikely we can contribute something significant in a week |
| 14:08 | brainproxy | dnolen: I acquired an introductory prolog book last night :) but it doesn't recommend one runtime over another; do you recommend swi prolog or gnu prolog? |
| 14:08 | dustingetz | we spent a couple days looking at cljs internals last month, we may have a shot at the docstring issue |
| 14:08 | dustingetz | can you point us to other low hanging fruit issues ? we're skimming the jira now |
| 14:08 | foxdonut | brainproxy: which book is that? |
| 14:09 | dnolen | dustingetz: a simple docstring fix would be welcome and welcome. |
| 14:09 | brainproxy | dnolen: this one http://www.springer.com/computer/swe/book/978-1-85233-938-8 |
| 14:10 | brainproxy | dnolen: i researched various intro books, and liked the fact that one can be purchased as a DRM free pdf |
| 14:10 | brainproxy | eventually I'd like to get the AI prolog book you recommended |
| 14:10 | dnolen | dustingetz: hmm nothing jumps out at me. |
| 14:10 | brainproxy | but this one will be my starter |
| 14:12 | dnolen | brainproxy: I'm not familiar that one. SWI-Prolog works well and has an active community. |
| 14:12 | oskarth_ | dnolen: would writing marginalia docs for the source code be desirable? |
| 14:12 | dnolen | oskarth_: not really. |
| 14:12 | brainproxy | dnolen: okay, then I'll go w/ swi for starters |
| 14:17 | dnolen | oskarth_: dustingetz: to be honest if you all way to contribute I recommend first reading and playing around with the analyzer and compiler sources. More than happy to answer specific questions. |
| 14:18 | dustingetz | thanks, yeah, we agree |
| 14:21 | oskarth_ | roger, thanks |
| 14:45 | jsabeaudry | Are people using 1.4 in production? |
| 14:46 | gfredericks | jsabeaudry: I am |
| 14:46 | jsabeaudry | gfredericks, so far so good? |
| 14:46 | gfredericks | surely |
| 14:46 | gfredericks | I'm not using anything 1.4 specific, I just wanted to postpone library issues as far into the future as possible |
| 14:46 | jsabeaudry | great, I'll give it a spin then |
| 14:47 | hiredman | sonian skipped 1.3 (too many issues) right to 1.4 from 1.2 |
| 14:51 | jsabeaudry | pretty agressive liveperson on the sonian website :) |
| 14:57 | hiredman | :) |
| 14:57 | hiredman | clojure is all the back end, so no point in looking at websites, etc |
| 14:58 | gfredericks | unless we have a mountain of emails and don't know what to do with them? |
| 15:00 | amalloy | geni skipped 1.3 to 1.4 also |
| 15:01 | wingy | fun performance comparison: https://gist.github.com/3078233 |
| 15:01 | hiredman | gfredericks: sure, if you are interested as a customer, but if you are interested in clojure there isn't much to see |
| 15:02 | wingy | just paste it into the repl .. reduce is 500 times slower :/ |
| 15:02 | wingy | but more readable |
| 15:03 | wingy | i cant even get the second one .. would you still prefer using reduce for readability? |
| 15:03 | amalloy | wingy: so try again with arrows: (-> (* n (inc n)) (/ 2)) |
| 15:04 | KirinDave | Hey, if I do (dosync (pmap …)) |
| 15:04 | KirinDave | Does that work the way I'd lexically expect it to? |
| 15:04 | amalloy | no |
| 15:04 | KirinDave | Figured |
| 15:04 | hiredman | you're gonna have a bad time |
| 15:05 | technomancy | dosync is the moral equivalent of dynamic scope |
| 15:05 | KirinDave | So each work unit in the pmap should establish its transaction internally? |
| 15:05 | hiredman | a. pmap is a mix of eager and lazy b. if you have a task where the runtime of the task dominates the over head of pmap you should *not* but it a transaction |
| 15:05 | hiredman | put |
| 15:05 | amalloy | technomancy: you seem to be saying it's not actually dynamic scope |
| 15:06 | KirinDave | hiredman: I have a really big structure I'd like to iterate within. |
| 15:06 | amalloy | it's not dynamic scoping of a variable, but it's dynamic scoping of a resource (the transaction) |
| 15:06 | KirinDave | Okay, well easy enough to fix, I suppose. |
| 15:06 | technomancy | amalloy: right; I wouldn't use the word scope for something that's not reified |
| 15:06 | KirinDave | Just put the dosync inside the pmap and get the master list outside in its own transaction. |
| 15:06 | hiredman | :( |
| 15:06 | KirinDave | I suppose I could always use a readwritelock if this really causes consistency problems. |
| 15:06 | technomancy | or maybe you could use that word, but it would be a kind of pun |
| 15:07 | hiredman | clojurebot: pmap? |
| 15:07 | clojurebot | excusez-moi |
| 15:07 | hiredman | clojurebot: pmap is not what you want |
| 15:07 | clojurebot | Ok. |
| 15:08 | amalloy | i'm not sure i really understand what reified means in that context. is it just: something with a real existence manipulable by your program at runtime? |
| 15:14 | TimMc | Eh, it's still scope, just not a var. |
| 15:23 | ibdknox | More useful instarepl! http://www.chris-granger.com/2012/07/09/light-table-playgrounds-level-up/ |
| 15:27 | dnolen | ibdknox: nice! when i try to run it seems to hang on "Waiting for server" |
| 15:27 | ibdknox | hm |
| 15:27 | ibdknox | weird |
| 15:28 | Raynes | Uses a special version of Clojure? |
| 15:28 | Raynes | Why is that? |
| 15:28 | ibdknox | metadata gets nuked and I needed more position info |
| 15:28 | ibdknox | no reason those things can't make it into clojure proper, just haven't had the time to make that happen |
| 15:28 | ibdknox | dnolen: ~/.lighttable/logs/server.log |
| 15:29 | Raynes | ibdknox: So light table will end up not being compatible with < 1.5.0? |
| 15:29 | ibdknox | dnolen: it might be that somehow the server didn't get started? |
| 15:29 | Raynes | Assuming your stuff even gets into 1.5.0. |
| 15:29 | ibdknox | Raynes: no, it's a weird version that's actually 1.4.0 |
| 15:29 | ibdknox | oh |
| 15:29 | ibdknox | sort of |
| 15:29 | ibdknox | only for the instarepl stuff |
| 15:30 | ibdknox | showing things flow through and whatnot |
| 15:30 | ibdknox | can't do that without position info :( |
| 15:30 | Raynes | Sucks. |
| 15:31 | ibdknox | Raynes: in theory I could fork the reader out |
| 15:31 | ibdknox | and do it that way |
| 15:31 | Raynes | I'm not really complaining. Just seems strange. |
| 15:31 | Raynes | But I get why it is necessary. |
| 15:32 | amalloy | ibdknox: what do you mean by "metadata gets nuked"? |
| 15:32 | ibdknox | amalloy: metadata in the symbol -> var transition disappears |
| 15:33 | ibdknox | during analysis |
| 15:33 | dnolen | ibdknox: hmm, deleted light table, ran install commands from scratch - hangs on "starting server" in my terminal |
| 15:34 | ibdknox | dnolen: it usually does that when there's a rogue server hanging out somewhere :( ps aux | grep -i lighttable and kill those |
| 15:34 | wingy | ibdknox: i like the update notification |
| 15:34 | ibdknox | dnolen: I'm trying to come up with a different packaging mechanism |
| 15:34 | ibdknox | dnolen: hopefully next release :( |
| 15:34 | ibdknox | I reallllllly wish javafx would work |
| 15:34 | ibdknox | but the webkit it uses is so incredibly slow it's not even an option |
| 15:37 | dnolen | ibdknox: k killing rogue server allow terminal to start process "Server up!", but actual Light Table app frozen on "Waiting for server" |
| 15:37 | scriptor | on a fresh install of lein, trying to do lein new <something> is giving me: |
| 15:37 | scriptor | https://gist.github.com/3078433 |
| 15:38 | ibdknox | dnolen: ah, are you pressing cmd-r? I don't think that's hooked up on that page. If you open it in a new window does it work? How about in chrome can you get to http://localhost:8833/? |
| 15:38 | scriptor | any idea why it's trying to get the clojure 1.5 alpha? |
| 15:38 | scriptor | instead of 1.4 |
| 15:39 | scriptor | installed lein through homebrew, if that makes a difference |
| 15:40 | foxdonut | "--- Found a new version!" awesome :) |
| 15:40 | dnolen | ibdknox: hmm neither things work |
| 15:40 | ibdknox | dnolen: oh weird :( |
| 15:40 | ibdknox | dnolen: did the server.log have anything in it? |
| 15:40 | Raynes | scriptor: Did you add lein-light? |
| 15:40 | foxdonut | ./light: line 198: unexpected EOF while looking for matching `"' |
| 15:40 | scriptor | Raynes: yep |
| 15:41 | foxdonut | ./light: line 200: syntax error: unexpected end of file |
| 15:41 | Raynes | scriptor: That's why it is trying to get 1.5.0 |
| 15:41 | scriptor | ah |
| 15:41 | scriptor | I had to create the profiles.clj file for it, so otherwise if I remove that it won't use 1.5? |
| 15:41 | ibdknox | foxdonut: yeah, after the update that should go away |
| 15:41 | Raynes | But I'm pretty sure that's wrong. |
| 15:41 | Raynes | ibdknox: Why is it trying to get clojure 1.5.0-alpha1 when you never pushed that jar? |
| 15:42 | ibdknox | I haven't seen it do that |
| 15:42 | ibdknox | Raynes: I have no idea |
| 15:42 | pyrtsa | Hmm, so macros like "doc" don't quite work yet in Light Table? Despite that, this is looking really great! |
| 15:42 | dnolen | ibdknox: Connected. Server started. CONNECTING: local |
| 15:42 | Raynes | Why is everything broken today? |
| 15:43 | foxdonut | ibdknox: then I get a "We seem to have lost that one." on http://localhost:8833/ |
| 15:43 | Raynes | I bet even amalloy isn't working. |
| 15:43 | technomancy | Raynes: clojars was broken because stupid American date formatting made it look to an aussie like the cert expired in August. |
| 15:43 | ibdknox | pyrtsa: yes they do, just do (use 'clojure.repl) |
| 15:43 | wingy | yeah I get "waiting for server" as well |
| 15:43 | pyrtsa | Ah, thanks! |
| 15:43 | Raynes | technomancy: Don't think that's the problem. |
| 15:43 | ibdknox | dnolen: looking into it |
| 15:43 | dnolen | ibdknox: I get that at :8833 as well. If I kill the light table app I get a rogue server that I have to kill at terminal. |
| 15:43 | pyrtsa | Great! |
| 15:44 | scriptor | is lein-light on github? |
| 15:44 | technomancy | Raynes: of course it is; month-first sucks |
| 15:45 | technomancy | I mean the cause of the issues over the weekend |
| 15:45 | gfredericks | technomancy: I question your patriotism. |
| 15:46 | Raynes | He hates aussies. |
| 15:46 | Raynes | Bet he doesn't like kittens either/. |
| 15:46 | wingy | ibdknox: also lein-light doesn't work: it cant find artifact |
| 15:46 | ibdknox | wingy: what can't it find? |
| 15:47 | Raynes | Let me guess, clojure 1.5.0-alpha1. |
| 15:47 | pbostrom_ | ibdknox: The following artifacts could not be resolved: lighttable.hub.clj:lighttable.hub.clj:jar:0.0.2, org.clojure:clojure:jar:1.5.0-ibdknox5: Could not find artifact lighttable.hub.clj:lighttable.hub.clj:jar:0.0.2 in central (http://repo1.maven.org/maven2) |
| 15:47 | ibdknox | wtf |
| 15:47 | seancorfield | ibdknox: i was just about to report that same error |
| 15:47 | wingy | https://gist.github.com/3078481 |
| 15:47 | wingy | ibdknox: ^ |
| 15:47 | scriptor | yep, that's what I'm getting |
| 15:47 | Raynes | ibdknox: You've screwed up a project.clj somewhere. |
| 15:47 | gfredericks | wait do aussies use month-first? |
| 15:47 | ibdknox | apparently |
| 15:47 | gfredericks | don't americans also? |
| 15:47 | gfredericks | oh he wasn't talking to me |
| 15:48 | gfredericks | I knew my "always assume ibdknox is talking to you" policy would backfire eventually |
| 15:48 | Hodapp | Americans often to month-first with dates. |
| 15:49 | Hodapp | that's very common when writing in full - as in July 9, 2012 - and often they'll just take that and turn 'July' to a number. |
| 15:49 | Hodapp | not that 7-9-12 is ambiguous or anything. |
| 15:49 | gfredericks | haha |
| 15:49 | scriptor | there's always the yyyymmdd format |
| 15:50 | Hodapp | scriptor: that's what I use almost always |
| 15:50 | foxdonut | so that would be September 12, 2007 :) |
| 15:51 | Hodapp | NEVER FORGET |
| 15:52 | amalloy | i use yyyy-mm-dd in programs, and mm/dd/yy in real life. it's pretty terrible, i guess |
| 15:52 | Raynes | amalloy: Get out of my intenret. |
| 15:52 | Raynes | internet too |
| 15:53 | amalloy | sometimes just m/d/yy. i bet you feel dirty just reading that |
| 15:53 | kmicu | lol |
| 15:53 | Raynes | amalloy: If you knew what I've been through with GEDCOM date parsing. |
| 15:56 | locojay1 | python has a cool lib dateutil from dateutil.parser import parse as dateparser. dateparser(<string> , fuzzy=true) will convert any kind of format... Is there something simlar in clojure/java |
| 15:59 | ibdknox | lein2 deps :tree isn't showing anything anyone else have a good way to debug rogue deps? |
| 16:01 | amalloy | ibdknox: is the lein-light plugin source somewhere? |
| 16:01 | amalloy | it seems likely to me you're doing something naughty like modifying the project map when your plugin loads, rather than when it's invoked |
| 16:01 | Raynes | Apparently brokeville. |
| 16:04 | ibdknox | ok |
| 16:04 | ibdknox | fixed |
| 16:04 | ibdknox | lein-light 0.0.3 |
| 16:04 | acagle | (def ^:private uri1 "datomic:dev://localhost:4334/portland") |
| 16:04 | acagle | (def ^:private uri2 "datomic:mem://portland") |
| 16:04 | Raynes | ibdknox: What was the problem? |
| 16:04 | ibdknox | or if you want you can nuke the one in you ~/.m2 |
| 16:04 | ibdknox | I did something stupid |
| 16:04 | ibdknox | changed the name of the project |
| 16:04 | Raynes | Well, yeah, but what in particular? ;) |
| 16:04 | Raynes | Hah |
| 16:04 | ibdknox | but it adds itself to the project map like amalloy said, and was using the old name |
| 16:05 | amalloy | oh wow, so i was close? i don't even know how to write a lein plugin |
| 16:05 | scriptor | so the fix is to change 0.0.2 to 0.0.3 in profiles.clj? |
| 16:06 | ibdknox | yes |
| 16:06 | Raynes | That always fixes my problems. |
| 16:07 | scriptor | hmm, still getting the same error :/ |
| 16:07 | Raynes | ibdknox: It isn't too late to quit programming and become a firefighter. |
| 16:07 | amalloy | *laugh* |
| 16:08 | ibdknox | Raynes: seems like a reasonable decision |
| 16:08 | scriptor | ibdknox: still getting errors saying it couldn't find the artifact clojure 1.5.0 in central or clojars |
| 16:09 | ibdknox | scriptor: ah yeah. rm ~/.m2/repository/ibdknox ~/.m2/repository/lein-light |
| 16:10 | foxdonut | hmm, even downloading from scratch gives me "We seem to have lost that one" on localhost:8833 |
| 16:12 | wingy | ibdknox: http://pastebin.com/1k2TuHZX |
| 16:12 | wingy | even though i changed version to 0.0.3 |
| 16:12 | LeNsTR | I have the same problem ( |
| 16:12 | scriptor | ibdknox: removed those 2 directories, got the same error as wingy |
| 16:13 | amalloy | Raynes, technomancy: i'm about to make the big leap, guys. i'm pointing ~/bin/lein at lein2 |
| 16:13 | Raynes | amalloy: Me moving protobuf/jiraph to lein 2 is the catalyst, right? |
| 16:13 | amalloy | yes |
| 16:13 | amalloy | you are the hero |
| 16:14 | ibdknox | ooook |
| 16:14 | ibdknox | once more with feeling |
| 16:14 | ibdknox | lein-light 0.0.4 |
| 16:15 | scriptor | should we rm /ibdknox and /lein-light again? |
| 16:15 | ibdknox | you shouldn't need to |
| 16:15 | amalloy | i'd rm everything ibdknox has ever written, just to be safe |
| 16:16 | ibdknox | A wise call really. |
| 16:16 | scriptor | let's rm ibdknox while we're at it |
| 16:16 | scriptor | back him up first, of course |
| 16:16 | ibdknox | you didn't -f |
| 16:17 | wingy | use -r as well just in case |
| 16:17 | wingy | ibdknox: it says "connected" but is idling |
| 16:18 | amalloy | jeez, i didn't mean to start a kill squad |
| 16:18 | ibdknox | wingy: idling? |
| 16:18 | wingy | yeah nothing happens |
| 16:18 | Raynes | Means he doesn't have the accelerator depressed. |
| 16:19 | foxdonut | needs anti-depressants, then. |
| 16:19 | LeNsTR | it's work! ^^ |
| 16:19 | wingy | ibdknox: does it work for you? |
| 16:19 | foxdonut | LeNsTR: let's the goods time rolls! |
| 16:19 | ibdknox | wingy: what are you expecting it to do? |
| 16:20 | ibdknox | wingy: it's kind of like swank |
| 16:20 | ibdknox | it should just start up :) |
| 16:20 | ibdknox | then you open light table and connect to it |
| 16:20 | scriptor | is there something I need to do to compile a clojure file if I've made changes after I connected? |
| 16:20 | foxdonut | ibdknox: sorry everyone's bombarding you.. in my case it has nothing to do with the plugin, just plain server up and running but error message on web page |
| 16:20 | wingy | ibdknox: ah |
| 16:21 | wingy | :) |
| 16:21 | 45PAAS8B6 | is there a way to have emacs code navigation, e.g. M-., on a project that doesn't use lein |
| 16:21 | wingy | ibdknox: it says Waiting for server... |
| 16:21 | dustingetz_ | me ^ |
| 16:21 | ibdknox | foxdonut: kill your java processes and rm ~/.lighttable/ and start over |
| 16:22 | ibdknox | I pushed an update that is my best guess as to why people are running into this |
| 16:23 | wingy | moment of truth |
| 16:23 | scriptor | ibdknox: sorry for the dumb question, but how do I use it? I have manual mode enabled and trying to evaluate a function call to a function from core, but I'm not seeing anything |
| 16:23 | ibdknox | if that doesn't work, what does going to http://localhost:8833 show? |
| 16:24 | foxdonut | ibdknox: works, thank you! |
| 16:24 | ibdknox | k |
| 16:24 | ibdknox | good to know |
| 16:24 | foxdonut | poor guy |
| 16:24 | foxdonut | bombardment! bombardment! |
| 16:24 | ibdknox | scriptor: what do you mean exactly? as in you pressed cmd-enter and nothing happened? |
| 16:24 | scriptor | ibdknox: |
| 16:24 | scriptor | right |
| 16:25 | ibdknox | what are you executing? |
| 16:25 | foxdonut | ibdknox: "here it is, the update you've been waiting for, like the salivating dogs that you are..." |
| 16:25 | scriptor | my project's called tutor, and I have a function inside it called foo that just returns 2 + 3 |
| 16:25 | foxdonut | (bonus points for recognizing the simpsons krusty-the-clown reference) |
| 16:25 | scriptor | so I have (tutor.core/foo) and shift-enter |
| 16:25 | scriptor | but nothing shows up on the right side |
| 16:25 | ibdknox | scriptor: hmm and you required tutor.core? |
| 16:27 | SegFaultAX|work2 | Any vim users in here that use vimclojure: I'm having trouble with the indentation settings. If I type `(defroutes main-routes` and press enter, it indents to align with the m in `main-routes` instead of 2 spaces in. |
| 16:27 | dnolen | ibdknox: sweet LT works again for me now. |
| 16:28 | ibdknox | good deal |
| 16:28 | Raynes | SegFaultAX|work2: let vimclojure#FuzzyIndent = 1 |
| 16:28 | Raynes | Put that in your .vimrc. |
| 16:29 | scriptor | ibdknox: I need (require '[tutor.core]) right? |
| 16:29 | ibdknox | I have no idea how that could be different for people |
| 16:29 | SegFaultAX|work2 | Raynes: Awesome, thanks mate. |
| 16:29 | ibdknox | the thing that was causing the issues was a filter to make sure only local requests came in |
| 16:29 | scriptor | at this point I'm fairly sure I'm just failing at writing clojure |
| 16:29 | ibdknox | scriptor: yeah, that should be it |
| 16:30 | technomancy | my barista just called me "friendo" and I thought "wait, a logic programmer?" |
| 16:30 | SegFaultAX|work2 | Raynes: That was it, thanks mate. |
| 16:30 | scriptor | ibdknox: nope, still doesn't work, this is all the code: https://gist.github.com/3078705 |
| 16:30 | SegFaultAX|work2 | Raynes: Also, are you aware of any way to get syntax highlighting for custom macros? |
| 16:31 | seancorfield | ibdknox: fwiw, i'm happily running LT connected to my local worldsingles project and it's *HOT* so thanx for that update! |
| 16:31 | scriptor | interestingly enough, if I change it to just (foo) I do get an error, but changing it back to (tutor.core/foo) and the error text is still there |
| 16:31 | SegFaultAX|work2 | Raynes: Or even normal functions not included in clojure for that matter. |
| 16:31 | scriptor | Raynes: didn't know about FuzzyIndent, you just made vimclojure so much better for me |
| 16:31 | technomancy | seancorfield: is your work to make c.j.jdbc not require dynamic binding underway or is that still in the planning stage? |
| 16:31 | ibdknox | scriptor: does anything show up at the bottom? |
| 16:31 | seancorfield | scriptor: try (require '[tutor.core :as tc]) and (tc/foo) |
| 16:31 | Raynes | SegFaultAX|work2: No idea. |
| 16:32 | scriptor | ibdknox: yep, tutor.core in red text |
| 16:32 | seancorfield | technomancy: i'm incubating the new code in another project right now |
| 16:32 | ibdknox | scriptor: ah |
| 16:32 | ibdknox | scriptor: apparently that is the message of the exception O_o |
| 16:32 | scriptor | seancorfield: look through the files you have to install for vimclojure |
| 16:32 | foxdonut | (inc Raynes) |
| 16:32 | ibdknox | scriptor: ok, that means you probably aren't connected to your project, in the bottom right open the menu |
| 16:33 | ibdknox | scriptor: click connect and then select your project |
| 16:33 | scriptor | seancorfield: it won't be automatic, but you can manually add more keywords to highlight |
| 16:33 | seancorfield | scriptor: why would i install vimclojure? :) |
| 16:33 | ibdknox | seancorfield: yay it's working for someone! |
| 16:33 | scriptor | argh, wrong person |
| 16:33 | scriptor | SegFaultAX|work2: check the files you copy to install vimclojure, you can at least manually change the list of highlighted keywords, nothing automatic though :/ |
| 16:34 | ohpauleez | ibdknox: the only error I'm getting is a missing clj-stacktrace error, but I think that's an error on my part |
| 16:34 | scriptor | ibdknox: nope, I think I was connected before and I just tried having it connect again, same issue |
| 16:34 | ibdknox | hm |
| 16:35 | scriptor | seancorfield: just tried your suggestion, now getting: |
| 16:35 | ibdknox | scriptor: not sure then :( It picks up all its classpath stuff from Lein, so it should be there as long as it's running in that project |
| 16:35 | kotarak | vimclojure issues? |
| 16:35 | hyPiRion | ibdknox: It seems like some sort of documentation on this thing would be nice - people have questions and problems all over, and there's no real place where the questions and answers is placed. |
| 16:35 | technomancy | seancorfield: right; cool |
| 16:36 | scriptor | ibdknox: getting a new error from seancorfield's suggestion, but this friggin might mouse is being a pain |
| 16:36 | ibdknox | hyPiRion: as soon as the issues are fixed. Only have two hands :) |
| 16:36 | kotarak | SegFaultAX|work2: vimclojure issues? |
| 16:36 | hyPiRion | ibdknox: Just my two cents. ;) |
| 16:37 | kotarak | SegFaultAX|work2: with a running backend you get automatic highlighting of required, used and aliased namespaces. |
| 16:37 | kotarak | SegFaultAX|work2: see vimclojure#DynamicHighlighting. |
| 16:37 | scriptor | ibdknox: seancorfield: new error, this time with :as tc and (tc/foo) https://gist.github.com/3078737 |
| 16:38 | wingy | ibdknox: it has been on: --- Starting server... (this takes several seconds) forever .. and the cpu is idling .. i have reinstalled it but its still idling |
| 16:38 | ibdknox | scriptor: apparently tutor.core has an error in it |
| 16:38 | ibdknox | wingy: you have an old server running |
| 16:38 | scriptor | yes…yes it does |
| 16:39 | ibdknox | wingy: kill you java processes and run it again, should be ok |
| 16:39 | pandeiro | was there a new release of lighttable? |
| 16:40 | SegFaultAX|work2 | kotarak: Does that require nailgun to use? |
| 16:40 | kotarak | SegFaultAX|work2: yes |
| 16:40 | foxdonut | pandeiro: have you been living under a rock? it's been over 2000 seconds already! |
| 16:41 | scriptor | ibdknox: it works! |
| 16:41 | SegFaultAX|work2 | kotarak: Alright, well I was about to get that one up and running as well? |
| 16:41 | SegFaultAX|work2 | I didn't main to make that a question. It's imperative. :) |
| 16:41 | SegFaultAX|work2 | Mean. Man I can't type right now. |
| 16:41 | pandeiro | foxdonut: |
| 16:41 | pandeiro | sorry, link? |
| 16:42 | wingy | ibdknox: works fine |
| 16:42 | pandeiro | ah nvm hackernews |
| 16:42 | foxdonut | pandeiro: http://www.chris-granger.com/2012/07/09/light-table-playgrounds-level-up/ |
| 16:42 | ibdknox | alrighty then |
| 16:42 | ibdknox | I believe the issues are sorted out |
| 16:42 | kotarak | SegFaultAX|work2: There is lein-parsier for leiningen, and vimclojure/gradle for gradle |
| 16:42 | ibdknox | thanks for bearing with me guys :) |
| 16:42 | pandeiro | weird, i went to chris' site and wasn't getting the new post |
| 16:42 | kotarak | SegFaultAX|work2: to start the backend server easily in your project. |
| 16:42 | foxdonut | pandeiro: but maybe just ./light table will auto update for you |
| 16:42 | wingy | love the "live off" feature already |
| 16:43 | scriptor | ibdknox: thanks for bearing with my inability to write clojure :) |
| 16:43 | kotarak | SegFaultAX|work2: that should be lein-tarsier, can't type neither |
| 16:44 | SegFaultAX|work2 | kotarak: Is using nailgun as a stand-alone in-vim REPL a supported use case? Or does it only make sense inside of a project? |
| 16:44 | pandeiro | wow, looks like an enormous upgrade |
| 16:45 | kotarak | SegFaultAX|work2: I only use it inside a project, but vc itself doesn't care. Start the server manually as you like and it is good to go. Just make sure to get the classpath right. |
| 16:45 | SegFaultAX|work2 | kotarak: Awesome, thanks. |
| 16:46 | scriptor | ibdknox: is there a way for it to reload code after I've made changes in the project? |
| 16:46 | ibdknox | (require [..] :reload) |
| 16:46 | sjl | is there a way to provide a default implementation for a protocol method? Or must I always type out the same fn body every time if just one implementor might need something different? |
| 16:46 | scriptor | ah, nice! |
| 16:47 | ohpauleez | ibdknox: Working for me - I had to comment out all my clj-stacktrace stuff in my profile.clj |
| 16:47 | ohpauleez | Totally awesome stuff |
| 16:48 | pandeiro | right now light table is just doing jvm clojure, right? no js compilation? |
| 16:48 | ohpauleez | slj: are you in cljs or clj |
| 16:49 | ibdknox | pandeiro: yeah, just JVM right now |
| 16:50 | sjl | ohpauleez: clojure |
| 16:50 | seancorfield | ibdknox: it doesn't seem to recognize a top-level form like @foo - i have to either do (identity @foo) or (deref foo) - known issue? |
| 16:50 | ohpauleez | sjl: You can extend the protocol to Object |
| 16:50 | ibdknox | seancorfield: ah yeah, it doesn't know how to do that yet |
| 16:50 | ohpauleez | which will provide a default implementation |
| 16:50 | sjl | ohpauleez: that only works in an all-or-nothing wway, right? |
| 16:51 | ohpauleez | slj:Nope, it'll match specific extensions before it hits that one |
| 16:52 | kotarak | sjl: Use extend: (def your-defaults {:proto-fn (fn …)}) (extend YourType YourProtocol your-defaults) |
| 16:53 | kotarak | sjl: you can mix-in other functions (extend YourType YourProtocol (merge your-defaults {:overriden-proto-fn (fn …)})) |
| 16:53 | sjl | kotarak: ohpauleez: one sec, let me type out something and paste it |
| 16:55 | SegFaultAX|work2 | Random question: Is clojure feasible on Android (yet)? |
| 16:56 | scriptor | does vimclojure's fuzzy indent only work on def* and with-* names? |
| 16:56 | kotarak | scriptor: you can define your own patterns |
| 16:56 | scriptor | kotarak: right, just checking what comes out of the box |
| 16:57 | pbostrom_ | ibdknox: my own $0.02: 1) it would be nice to have option to word-wrap output on right side instead of scrolling 2) It might not be that clojure-esqe, but if I want to de-reference an atom that has changed outside the light table scope, I have to exit live mode |
| 16:57 | kotarak | scriptor: that's basically what comes out of the box. def and with. |
| 16:57 | Raynes | SegFaultAX|work2: https://github.com/alexander-yakushev/lein-droid |
| 16:57 | scriptor | kotarak: ah, looks like let* also gets included |
| 16:58 | kotarak | scriptor: ah. indeed. The documentation contains a full list. |
| 16:58 | kotarak | scriptor: :help clojure |
| 16:58 | sjl | ohpauleez: http://paste.stevelosh.com/4ffb45e5c5338c0007000000?clojure |
| 17:00 | sjl | kotarak: I think I can use bare extend and wrap a bit of sugar around it, thank you! |
| 17:01 | ohpauleez | sjl: Right, you don't want a default implementation, you just don't want to write the same code over and over again for you given types |
| 17:01 | sjl | ohpauleez: yeah, that's what I meant by default but there's probably another word that's better |
| 17:02 | ohpauleez | using raw extend is one way, or clojure.template if you felt really inclined |
| 17:02 | kotarak | slj; you always have to implement all functions of a protocol. |
| 17:02 | seancorfield | ibdknox: you need to update this page to show version 0.0.4 http://app.kodowa.com/playground/lein-light |
| 17:02 | kotarak | ohpauleez slj extend should be the first guess. No need to overengineer stuff for extend-type which just expands to an extend. |
| 17:02 | sjl | kotarak: really? In the example I gave ohpauleez the Dog can speak just fine, even though I didn't define the other one |
| 17:03 | kotarak | sjl: but you wrote that in-location fails for the dog. |
| 17:03 | ibdknox | seancorfield: pushing now, thanks |
| 17:03 | ohpauleez | kotarak: I agree |
| 17:03 | sjl | kotarak: in-location does fail. but speak works, even through I didn't implement thr full protocol |
| 17:03 | scriptor | I feel proud in having contributed to the creation of two entire lein-light versions |
| 17:03 | scriptor | even if it was by whining |
| 17:03 | foxdonut | hehe |
| 17:04 | kotarak | sjl: yes. But in-location fails. If you want both to work, you have to implement them in the same extend. |
| 17:04 | ohpauleez | sjl: that's because you didn't implement the full protocol - that's why it failed, it has no method, because you didn't write one |
| 17:04 | kotarak | sjl: if you want default for the dog for in-location, you need extend+merge |
| 17:04 | ohpauleez | what kotarak said |
| 17:04 | sjl | kotarak: yeah, that "in the same extend" is what I'm trying to get around, and the bare extend + merge will let me do that |
| 17:12 | jg | (defmacro with-tokens [& body] `(let [tokens# (yaml/parse-string (slurp "tokens.yml")) {:keys [consumer_key access_key]} tokens#] (do ~@body))) |
| 17:13 | jg | could someone explain what i'm doing wrong here? |
| 17:13 | jg | the idea is to be able to write (with-tokens (print consumer_key)) |
| 17:13 | technomancy | jg: consumer_key and access_key are locals |
| 17:13 | technomancy | so they need gensyms |
| 17:14 | pydave6357 | Hey all. I'm running my project with lein run -m <project-name>.core, but the execution time is pretty slow, presumably because I'm starting the JVM each time. Is there any way to speed things up? Keeping the JVM running in the background perhaps? |
| 17:14 | jg | technomancy: but will i be able then to access them in ~@body ? |
| 17:15 | technomancy | jg: what you're trying to do is write an anaphoric macro, which is widely considered a bad idea |
| 17:15 | technomancy | you want to accept the names of the locals as args to the macro |
| 17:15 | technomancy | pydave6357: most people start a repl and work from there |
| 17:16 | jjttjj | somewhat general question, but let's say I have have an entity "item" which corresponds to a db table, and I have an item model in my application. Some things, like a picture url, are not directly stored in the db, because they can be derived from the item's other attributes, config vars, etc. My question is, is it a bad idea to simply wrap the getters to tack on an extra k/v pair, eg, (assoc (first (select item)) :image-url |
| 17:16 | jjttjj | "www.site.com/blah.jpg"), or is it strictly better to have a seperate function (item->image-url [item])? |
| 17:16 | pydave6357 | technomancy: I'll do likewise. Thank you. |
| 17:19 | jg | technomancy: okay i've written a macro accepting the names, it works. Still, i would be interested to know how to fix the posted code or if it's at all possible. |
| 17:20 | haspaker | Hi |
| 17:20 | haspaker | My function returns 0N |
| 17:20 | haspaker | Any knows what kind of value that is? |
| 17:20 | haspaker | *anyone |
| 17:20 | technomancy | jg: it's not possible to use :keys in syntax-quote |
| 17:21 | hyPiRion | haspaker: ##(class 0N) |
| 17:21 | lazybot | ⇒ clojure.lang.BigInt |
| 17:21 | haspaker | Thanks |
| 17:21 | uvtc | haspaker: trailing "N" means arbitrary-precision decimal. |
| 17:22 | hyPiRion | uvtc: I think you're refering to M - ##(class 0.1M) |
| 17:22 | lazybot | ⇒ java.math.BigDecimal |
| 17:22 | hyPiRion | And no problem, sir. |
| 17:22 | haspaker | So what separates 0 from 0N? That the value is not certain to be 0, only close to it? |
| 17:22 | uvtc | hyPiRion: ack. I meant arbitrary-precision int. Thanks. |
| 17:23 | hyPiRion | haspaker: 0N means that the element is a BigInteger. In practice no difference from being a normal 0 integer. |
| 17:25 | haspaker | Yeah, looked it up on Wikipedia. |
| 17:25 | haspaker | Thanks for the help everyone |
| 17:26 | haspaker | Still strange, it should return 0.6 |
| 17:26 | haspaker | But I'll try some more debugging |
| 17:27 | hyPiRion | haspaker: Keep in mind that clojure has ratios. ##(/ 1 3) |
| 17:27 | lazybot | ⇒ 1/3 |
| 17:31 | haspaker | hyPiRion: I don't understand your advice. Are you suggesting I should look for 3/5 instead of 0.6? :> |
| 17:32 | SegFaultAX|work2 | Will (ns foo :reload-all) re-compile source? |
| 17:33 | hyPiRion | haspaker: Uh, not really. Just be aware of that. I burned myself on it first time I was around it. |
| 17:34 | haspaker | Ah. Don't worry then, I'm aware of that. |
| 17:34 | technomancy | SegFaultAX|work2: I think you have to scope :reload-all under a specific :require |
| 17:35 | technomancy | but you can always try it |
| 17:35 | SegFaultAX|work2 | technomancy: Here is the problem: I just want to reload source anytime I make changes without having to reload the repl. |
| 17:36 | technomancy | SegFaultAX|work2: best to do that via editor integration |
| 17:36 | SegFaultAX|work2 | Also, I haven't got nailgun up and running yet. |
| 17:37 | SegFaultAX|work2 | technomancy: Ah. So does nailgun automatically relaod changed files? |
| 17:37 | technomancy | no, but presumably vimclojure would |
| 17:37 | technomancy | or at least would make it easy |
| 17:37 | technomancy | I don't know |
| 17:38 | emezeske | SegFaultAX|work2: You are a vim user? |
| 17:38 | emezeske | SegFaultAX|work2: Use lein-tarsier, nailgun, and vimclojure, then you can type "\ef" to reload the current file. (You could also set up an after-change trigger to reload it) |
| 17:39 | kotarak | SegFaultAX|work2: vimclojure does not reload files automatically by design. You can add a autocmd on file saving to do that if you like. |
| 17:39 | SegFaultAX|work2 | emezeske: Yea, that's what kotarak suggested earlier. I just haven't taken the time to get nailgun working. |
| 17:40 | kotarak | SegFaultAX|work2: I avoid doing anything automatic. |
| 17:40 | emezeske | SegFaultAX|work2: I see. You need to spend time to get it working, then :) |
| 17:40 | SegFaultAX|work2 | kotarak: That's fair. What's the canonical way to reload something at the repl then? |
| 17:40 | kotarak | SegFaultAX|work2: Just do \ef or \et in the file. The repl will know the change. |
| 17:41 | SegFaultAX|work2 | kotarak: What's the doing under the hood? |
| 17:41 | kotarak | SegFaultAX|work2: or a plain (require :reload 'your.name.space) in the repl. |
| 17:41 | kotarak | SegFaultAX|work2: takes the code and sends it to the backend. |
| 17:41 | kotarak | SegFaultAX|work2: the backend and repls running there will pick-up the change. |
| 17:41 | SegFaultAX|work2 | kotarak: It just ships the entire file to the repl? |
| 17:41 | kotarak | SegFaultAX|work2: yes. With \ef. Or the current toplevel expression with \et. |
| 17:42 | SegFaultAX|work2 | kotarak: That's pretty neat! |
| 17:42 | SegFaultAX|work2 | kotarak: Where is the best tutorial for setting up nailgun on OSX? |
| 17:42 | SegFaultAX|work2 | kotarak: (Or one for Linux if you got it) |
| 17:43 | kotarak | SegFaultAX|work2: java -cp clojure.jar:vimclojure-server.jar vimclojure.nailgun.NGServer 127.0.0.1 |
| 17:43 | kotarak | SegFaultAX|work2: with the correct jar names of course. |
| 17:43 | kotarak | SegFaultAX|work2: There is also a launcher script in the VimClojure distribution but I haven't used it for ages. |
| 17:43 | emezeske | kotarak: Why not use lein-tarsier? |
| 17:43 | kotarak | SegFaultAX|work2: You have to use the nailgun server from the vc distribution. |
| 17:44 | kotarak | emezeske: or vimclojure/gradle for gradle users. But SegFaultAX|work2 wants to use it outside a project. |
| 17:45 | SegFaultAX|work2 | kotarak: That's right. While I'm learning it would be nice to have quick access to a REPL from vim eg slimv.vim |
| 17:46 | kotarak | SegFaultAX|work2: there is a repl built into vc. But with certain restrictions. |
| 17:46 | kotarak | SegFaultAX|work2: eg. no access to stdin. So no (read-line). |
| 17:46 | emezeske | Well, I'd say particularly while you're learning, you should be using lein. But to each his own! |
| 17:51 | pandeiro | was there a doc somewhere on upgrading to lein2, specific issues etc? |
| 17:52 | technomancy | clojurebot: upgrading to leiningen 2? |
| 17:52 | clojurebot | upgrading to leiningen 2 is easy with this handy upgrade guide: https://github.com/technomancy/leiningen/wiki/Upgrading |
| 17:56 | pandeiro | technomancy: awesome thanks |
| 17:56 | technomancy | sure |
| 17:59 | haspaker_ | God, my genetic algorithm certainly takes its time |
| 18:00 | TimMc | haspaker: Try giving it a few million years, I'm sure you'll see a result. |
| 18:01 | haspaker | I actually have some result just after 2000 iterations |
| 18:02 | haspaker | The best of the created algorithms are 60% effective |
| 18:02 | emezeske | 60% of the time, they work every time. |
| 18:03 | tacoman | I think that's the first time I've heard that statement in a way that makes sense. |
| 18:04 | haspaker | I have a bug that only manifests itself after several thousand iterations |
| 18:04 | haspaker | It's quite a pain in the ass to debug |
| 18:08 | tacoman | I think I've seen several mentions of genetic algorithms on the channel at various points. what are people using them for? |
| 18:08 | tacoman | and does Clojure have any particular advantages to leverage them? |
| 18:09 | haspaker | They rarely have any real usage, only in very specific situations |
| 18:09 | haspaker | They are mostly cool to make, I think |
| 18:09 | gtrak` | immutability means history's built-in? |
| 18:09 | ohpauleez | tacoman: genetic algorithms are great when you expect to have multiple maxima, and you don't have the clear way to find the absolute |
| 18:09 | ohpauleez | so any problem that has that, counts |
| 18:10 | ohpauleez | being able to have powerful, immutable data structures, with sane concurrency makes modeling the fitness function and the problem space easier |
| 18:10 | ohpauleez | and opens the door for making the algorithm parallel |
| 18:11 | ohpauleez | tacoman: You probably see a high mention of them here because a lot of early adoption of Clojure came from people doing machine learning and general sequence/stream crunching |
| 18:12 | tacoman | yeah. I have an AI class during my final undergraduate semester this fall, I wonder if the prof will let me use Clojure for it. I *think* we're supposed to do something along those lines. |
| 18:13 | ohpauleez | tacoman: If the prof can take a jar, solid. If not, spin up a Noir app on your university hosting account, and send him a URL :) |
| 18:13 | ohpauleez | profs love the "extra mile" |
| 18:13 | tacoman | heh. and it'd certainly be good Clojure experience. I'm not even sure that I get any such hosting account. you mean one that the university would give to every student, right? |
| 18:13 | ohpauleez | right |
| 18:14 | tacoman | yeah.... despite being a "tech" school, I don't think I get one of those. >_< |
| 18:15 | SegFaultAX|work2 | kotarak: So when you run your ng server, do you run it as a background job? |
| 18:16 | kotarak | SegFaultAX|work2: No. I run it in a separate terminal. |
| 18:16 | SegFaultAX|work2 | kotarak: Or do you just always have an extra term open. |
| 18:16 | SegFaultAX|work2 | kotarak: I see. Isn't that kind of a waste, though? |
| 18:16 | kotarak | SegFaultAX|work2: I prefer the extra term. => Full job control. |
| 18:16 | kotarak | SegFaultAX|work2: Other people prefer background jobs. Should work in any way. |
| 18:17 | kotarak | SegFaultAX|work2: Who cares? Windows may be minimized if necessary. |
| 18:17 | SegFaultAX|work2 | kotarak: That's true. I just have a separate tab in my console for it now (or a window in tmux depending on the environment I'm using) |
| 18:18 | ohpauleez | SegFaultAX|work2: FWIW, I use leon repl, then just start the ng server from there when I want it |
| 18:21 | SegFaultAX|work2 | ohpauleez: Leon? |
| 18:21 | SegFaultAX|work2 | ohpauleez: Oh, lein. Yea. |
| 18:21 | SegFaultAX|work2 | ohpauleez: Disregard last highlight. :D |
| 18:22 | ohpauleez | leon - yes. OSX auto correct fail |
| 18:22 | technomancy | leon? |
| 18:22 | clojurebot | leon is a good sign it's time to turn off auto-"correct" |
| 18:22 | ohpauleez | lein** |
| 18:22 | technomancy | clojurebot: botsnack |
| 18:22 | clojurebot | Thanks! Can I have chocolate next time |
| 18:22 | ohpauleez | haha seriously, that was spot on |
| 18:23 | SegFaultAX|work2 | kotarak: Your rainbow parens feature makes me want to find a general purpose plugin for that exact thing. |
| 18:23 | SegFaultAX|work2 | kotarak: Not only is it colorful and fun, it's damn useful to match things up visually. |
| 18:27 | kotarak | SegFaultAX|work2: It's probably possible to extract that. I just stole it from the lisp or scheme plugin. (Don't remember) |
| 18:27 | SegFaultAX|work2 | kotarak: It's awesome all the same. :D |
| 18:35 | haspaker | Wohoo! |
| 18:36 | haspaker | My genetic algorithm worked perfectly |
| 18:36 | haspaker | Turns out I has set up the conditions wrong, so the "bug" was nothing more than the algorithm solving a different problem than I had expected |
| 18:40 | zakwilson | I'm looking for an imap library. All I've found with google is nonomail (which hasn't had an update in a while) and a project on nakkaya.com that has jars, but no public repo. There are a lot of noise results related to the interface imap. |
| 18:48 | hiredman | zakwilson: client? have you dismissed javamail's implementation? |
| 18:49 | talios | it works. but thats all I can say :) |
| 18:50 | hiredman | javamail has the virtue of generally enforcing rfc compliant email generation, given the abundance of email that isn't compliant, there must be a lot of software that doesn't |
| 18:51 | talios | Agreed. I don't mind the API, its more some of its internals that are kinda weird, designed to be open/flexible almost tooo much, the whole activation.jar framework stuff |
| 18:52 | talios | But… theres plenty of wrappers around it ( like SpringMail etc. ) which make it nicer to work with for simple things. |
| 18:52 | brehaut | hiredman: what do you mean you cant use a regexp to validate an email address correctl‽ *sigh* |
| 18:52 | zakwilson | hiredman: yes, client. nonomail seems to wrap com.sun.mail.imap. The other wraps javax.mail. |
| 18:52 | talios | 'lo brehaut |
| 18:52 | brehaut | hi talios |
| 18:52 | hiredman | we've been running in to almost the opposite at work, javamail has a lot global options |
| 18:53 | hiredman | a lot of |
| 18:53 | hiredman | and options the result of which are read in to a finaly private field, so you cannot change them, etc |
| 18:53 | talios | doh |
| 18:54 | talios | There might be some stuff extracted from the Apache James mailserver project now as well, I know mime4j popped out of that. |
| 19:06 | hiredman | I just saw an email address that had a non-breaking space as the last character in the domain part |
| 19:06 | hiredman | email really is disgusting |
| 19:06 | technomancy | it's the date headers that'll really churn your stomach |
| 19:09 | zakwilson | I have yet to find a satisfactory mail client (no, I'm not currently looking for libraries to write a general-purpose mail client in Clojure) |
| 19:11 | zakwilson | But yes, email is a mess. I love email though, conceptually. |
| 19:32 | Raynes | zakwilson: You can't even find a satisfactory IRC client! |
| 19:33 | seancorfield | using javax.mail is pretty nasty... at world singles we wrapped it up so we can just say (send-email from to subject body) and not have to see how the sausage is made... |
| 19:34 | zakwilson | Raynes: I have a pretty satisfactory general-purpose interactive IRC client. Clojure IRC libraries, on the other hand.... |
| 19:34 | zakwilson | seancorfield: yeah, I have a wrapper like that in a product I built for a customer too. I want to receive email now. |
| 19:36 | hiredman | zakwilson: you can use something like subetha smtp to just recieve mail that way |
| 19:37 | hiredman | (being an smtp server) |
| 19:38 | Raynes | seancorfield: You could have just used that apache commons library and not have bothered with javamail. |
| 19:42 | zakwilson | hiredman: I don't want to be a mail server. I want to be an imap client. |
| 19:44 | Raynes | Really? I always wanted to be a fireman when I grew up. |
| 20:04 | zakwilson | I wanted to be a cop. Almost went for it. |
| 20:05 | hiredman | then you realized you'd spend your days telling kids to get off their skateboards and move a long? |
| 20:06 | hiredman | this email address is in the form: "Foo Bar" <foobar[foobar@blah.com]> |
| 20:06 | hiredman | ugh |
| 20:07 | brehaut | hiredman: is dealing with that better or worse than the affordmention skateboards? |
| 20:07 | hiredman | touche |
| 20:18 | TEttinger | how would I call a function a set amount of time after the program starts? |
| 20:19 | TEttinger | (Clojure, probably going to be Swing-based) |
| 20:19 | gtrak` | java Timer |
| 20:20 | gtrak` | http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Timer.html#schedule(java.util.TimerTask, long) |
| 20:22 | jeremyheiler | yeah, email sucks. There's a reason why I haven't done much with Lime. I'm still digesting the million related RFCs |
| 20:23 | Frozenlock | TEttinger: Check https://github.com/overtone/at-at |
| 20:23 | Frozenlock | Is there a way to change the destination port in clj-http? |
| 20:23 | brehaut | Frozenlock yes |
| 20:24 | brehaut | (finding it) |
| 20:25 | brehaut | Frozenlock: actually, cant you just put it into the url string like normal? |
| 20:25 | pandeiro | are there any existing clojure wrappers for java smtp servers? |
| 20:25 | Frozenlock | Like "http://127.0.0.1:8443"? I must have done something wrong, it blew up when I tried... |
| 20:26 | brehaut | yeah, i was sure that worked |
| 20:27 | Frozenlock | Oh- it does, I forgot to put https |
| 20:27 | brehaut | aha |
| 20:27 | brehaut | you have my sympathy |
| 20:27 | Frozenlock | :p |
| 20:27 | Frozenlock | thanks |
| 20:27 | Frozenlock | But of course my certificate is for my URL, not 127.0.0.1, so it just refuses to connect -_- |
| 20:27 | brehaut | hosts file time |
| 20:28 | Frozenlock | Oh wait, I just listened to the security now podcast about that! |
| 20:34 | TEttinger | Frozenlock, I can't seem to install AT-AT via Lein |
| 20:35 | pandeiro | who knew setting up an e-mail server was so easy? http://www.ian-barton.com/blog/linux/2011/10/31/archlinux-mail-server.html |
| 20:35 | pandeiro | just 73 steps |
| 20:36 | Frozenlock | TEttinger: [overtone/at-at "1.0.0"] works just fine for me... |
| 20:36 | Frozenlock | (in your project dependencies) |
| 20:37 | TEttinger | http://ideone.com/usffj |
| 20:38 | TEttinger | oh, / |
| 20:39 | brainproxy | time to shop for a new work laptop, will primarily be doing clojure and nodejs dev stuff.. new macbook pro? or thinkpad w530 + linux? any clojure devs here recently contemplated similar decision? |
| 20:39 | Frozenlock | Arg I was messing with the hostname file silly me |
| 20:41 | emezeske | brainproxy: both of those options are very good, I think |
| 20:41 | Frozenlock | brainproxy: Why not a real computer? A big manly tower :) |
| 20:42 | brainproxy | Frozenlock: because I like to be able to switch easily between my standing desk, an easy chair, and going elsewhere to code |
| 20:42 | brainproxy | so using a beefy laptop as a mobile workstation is appealing to me |
| 20:43 | Frozenlock | Oh- didn't think of that. I must say I have a transforming desk. Desk, maximize! *weird tranformers sound* |
| 20:45 | Frozenlock | Ehhh... do I need to reboot or something once I changed my hosts file? |
| 20:45 | brainproxy | shouldn't need to |
| 20:46 | Frozenlock | grrr |
| 20:47 | Frozenlock | Is there, by any chance, a command to return the current hostname? |
| 20:47 | nsxt_ | Frozenlock: echo $HOST |
| 20:47 | nsxt_ | ? |
| 20:48 | Frozenlock | Sorry, I meant the name associated with 127.0.0.1 |
| 20:48 | Frozenlock | but yes, echo $HOST does work, thanks ;) |
| 20:49 | unnali | brainproxy: I use a MacBook Air for node/erlang/clojure, it's pretty sweet. |
| 20:49 | aperiodic | Frozenlock: `hostname` |
| 20:50 | Frozenlock | yes! Thank you very much |
| 20:51 | brainproxy | unnali: I'm wearing out a 17" mbp from 2010.. new mbp would make a lot of sense; but so many of my tools are *nix things or platform neutral and would work just as well on a linux laptop |
| 20:52 | brainproxy | so I'm contemplating just switching over to full-time linux for my work machine |
| 20:52 | brainproxy | but hesistant at the same time :/ |
| 20:52 | unnali | brainproxy: I find the unrefinedness of the Linux experience distracts from just trying to get shit done™ |
| 20:52 | emezeske | brainproxy: I do all dev under linux, and confirm that it is just fine |
| 20:53 | unnali | (I used Linux as primary for 6 or 7 years, had to use OS X with work, didn't go back.) |
| 20:53 | nsxt_ | brainproxy: all dev under linux here as well, no problems. "getting shit done" is highly contingent on your distro, i've found. |
| 20:53 | brainproxy | nsxt_: what distro do you use? |
| 20:53 | nsxt_ | brainproxy: arch |
| 20:53 | Frozenlock | I don't care about my OS anymore since I use Emacs |
| 20:54 | unnali | rofl |
| 20:54 | brainproxy | Frozenlock: yeah, emacs here also |
| 20:54 | emezeske | The first thing I do when I install an OS is totally bastardize it into what I want (xmonad, xterm+tmux, vim, etc), so OSX isn't really more refined for me |
| 20:54 | brainproxy | but at the same time, my brain has been wired to mac since i started using the os x public beta back in 2000 |
| 20:54 | brainproxy | i mean for everyday desktop/laptop stuff |
| 20:55 | brainproxy | but I deploy and dev in linux virtual machines also |
| 20:56 | brainproxy | i wonder if I could find a place that would let me rent a thinkpad for awhile and wouldn't care if I blow away the OS and put linux on it |
| 20:56 | brainproxy | iow, try it for awhile and see if I would be happy |
| 20:56 | nsxt_ | brainproxy: are you looking for any old laptop to try linux with? or specifically a thinkpad |
| 20:57 | brainproxy | I met some clojure devs at Strange Loop last year, and they all had thinkpads + linux |
| 20:57 | brainproxy | so seemed to me like a promising combo |
| 20:57 | nsxt_ | brainproxy: i've an old dell i wouldn't mind giving away for free. i know some people cringe at the thought of dell, but for 3 laptops straight now, it's been pretty solid. |
| 20:58 | Frozenlock | brehaut: ok I don't want to sound like an easily impressionable little girl, but... OMG it worked! Thank you for mentioning the hosts file! |
| 20:58 | unnali | Frozenlock: nothing wrong with sounding like a girl :3 |
| 20:58 | brainproxy | nsxt_: i might consider dell, i just know thinkpad has a reputation for being linux friendly |
| 20:59 | Frozenlock | No, but "an easily impressionable little girl", yes :P |
| 20:59 | unnali | so you say it in a manly way … an easily impressionable little man? :P |
| 20:59 | nsxt_ | brainproxy: i haven't really followed dell's bundling of ubuntu, but i'm fairly positive they're just as, if not more, friendly |
| 20:59 | Frozenlock | unnali: Ouch |
| 20:59 | brainproxy | nsxt_: thanks for the tip, I'll definitely research that avenue |
| 21:00 | nsxt_ | brainproxy: here's some help: http://www.ubuntu.com/certification/desktop/make/Dell/?csrfmiddlewaretoken=c61120be39ee7cdbb58136e7ab7e4f57&query=&category=Laptop&release=Any&level=Any |
| 21:00 | Frozenlock | God I can't believe I thought I would have to test my webserver from outside my LAN after I added the certificates. |
| 21:00 | nsxt_ | not that you're necessarily going to run ubuntu, but it'll give you a good idea of compatibility |
| 21:03 | pandeiro | that thinkpad w530 looks pretty butch, anyone use one? |
| 21:08 | brainproxy | nsxt_: thanks for the link.. for starters I probably will use ubuntu |
| 21:10 | TEttinger | pandeiro, just got one for my brother |
| 21:11 | TEttinger | he loves it, but he loved his 4-year-old thinkpad (that still runs) too |
| 21:11 | TEttinger | old one was a thinkpad T-series |
| 21:11 | TEttinger | they are both clearly durable things, no flimsy bits anywhere on them |
| 21:12 | TEttinger | thinkpad edge series are crazy cheap for what you get though, especially when there's a coupon |
| 21:17 | brainproxy | TEttinger: what does he think of the new chiclet keyboard? |
| 21:17 | brainproxy | vs the old style keyboard that was so highly praised for many years as one of the best features of thinkpads |
| 21:18 | TEttinger | brainproxy, haven't heard him complain -- he has always had a lenovo-branded thinkpad, never had an IBM |
| 21:23 | _tca | the new keyboards are still good brainproxy |
| 21:23 | brainproxy | I'm pretty used to the chiclet style, since mbp's have had that for awhile |
| 21:23 | pandeiro | TEttinger: i think i'd prefer to shed the optical drive and a couple inches off the screen, but it's an impressive machine for the price |
| 21:23 | pandeiro | albeit once you quadruple the RAM and switch to a 128GB SSD it pushes $2500 |
| 21:44 | TimMc | I know that 'keys and 'vals must return the same ordering for a given instance, but are (map key m) and (keys m) guaranteed to match? |
| 21:48 | zakwilson | I don't think it makes that guarantee. The current implementation might always behave that way, but you can't rely on it. |
| 22:05 | amalloy | TimMc: probably not |
| 22:30 | alfred | e |
| 22:35 | emezeske | bash: e: command not found |
| 22:40 | cshell_ | e |
| 22:50 | unnali | ksh: e: command not found |
| 22:57 | TimMc | clintm: Nope, -> is a stitching macro. |
| 22:58 | TimMc | &(clojure.walk/macroexpand-all '(-> d (c) (b) (a e))) |
| 22:58 | lazybot | ⇒ (a (b (c d)) e) |
| 23:01 | nDuff | Hrm. |
| 23:15 | clintm | TimMc: damn, that's cool. $ and . in haskell. sort of. |
| 23:16 | clintm | wait, not sort of. Per that example, it's the same behavior as $ in .hs |
| 23:17 | clintm | either way, pretty cool. |
| 23:25 | nDuff | ::foo seems to always be becoming "\ufdd0'user/foo" in cljs, regardless of the local ns |
| 23:32 | amalloy | clintm: no, it's not the same |
| 23:32 | wmealing | so, ive done some quick reading on https://github.com/schani/clojurec , i think you'd lose the java interop, but can you call C ? |
| 23:32 | amalloy | -> operates at the source-code level because it's a macro, so it can do things that are not possible with function composition |
| 23:33 | amalloy | &(-> lol whut undefined symbols quote) |
| 23:33 | lazybot | ⇒ (symbols (undefined (whut lol))) |
| 23:41 | mwanga` | clj-camel - a new library that lets you write routing DSL in clojure |
| 23:41 | mwanga` | as plain vectors. https://github.com/hmanish/clj-camel |
| 23:42 | mwanga` | clj-camel - a new library that lets you write Apache Camel routing DSL in clojure |
| 23:42 | mwanga` | as plain vectors. (https://github.com/hmanish/clj-camel) |
| 23:43 | brehaut | mwanga`: pure functions of no arguemnts are just constants; you could write (defn make-error-handler [] [[…]]) as (def error-handler [[…]]) |
| 23:44 | mwanga` | agreed ... i'll fix the sample |
| 23:53 | nDuff | dnolen: I'm hitting the CLJS-266 issue myself, and have attached a patch updated to apply to the current code. WORKSFORME, but I'm not sure if the decisions in terms of which namespace to put the new vars in was appropriate. |
| 23:57 | dnolen | nDuff: will take a look |
| 23:57 | dnolen | nDuff: thx |