2012-06-24
| 00:00 | gfredericks | 1) your call to print is causing things to be printed (a side effect) |
| 00:00 | y3di | im gettin the same error that this guy had: https://gist.github.com/1326747 |
| 00:00 | gfredericks | 2) print is returning nil, and those nils are being collected into a list which is the return value of the for expression; that list of nils is being printed at the repl because the repl prints the return value of the expression you give it |
| 00:01 | gfredericks | so two things are printed: "0123" and "(nil nil nil nil)" |
| 00:01 | gfredericks | and they're somewhat interleaved in the output |
| 00:01 | SrPx | actually |
| 00:02 | SrPx | if that was true then I would get the output "0123 (nil nil nil nil)". but I'm getting the output "(0123 nil nil nil nil)" |
| 00:02 | SrPx | how is the 1234 getting inside the parenthesis |
| 00:02 | gfredericks | welp |
| 00:02 | gfredericks | for is lazy |
| 00:02 | gfredericks | it returns immediately with a lazy seq |
| 00:02 | gfredericks | the repl say "oh I have a seq; that means I need to print an open paren and the print the contents" |
| 00:03 | gfredericks | so it prints the open paren and then proceeds to read the contents of the seq |
| 00:03 | gfredericks | which causes the side effects |
| 00:03 | gfredericks | you might expect (0nil 1nil 2nil 3nil) or something like that |
| 00:03 | gfredericks | ,(for [a '[0 1 2 3]] (print a)) |
| 00:03 | clojurebot | (0123nil nil nil nil) |
| 00:03 | gfredericks | ,(for [a '(0 1 2 3)] (print a)) |
| 00:03 | clojurebot | (01nil 2nil 3nil nil) |
| 00:03 | gfredericks | ah like that ^ |
| 00:04 | gfredericks | the reason you don't get something more interleaved like that, and instead get the whole "0123" up front is because some seqs are chunked for optimization |
| 00:04 | gfredericks | so when you request the first thing, the first 32 things are computed. or 4 in this case since there are only 4. |
| 00:04 | SrPx | wow |
| 00:04 | gfredericks | this whole thing can be avoided if |
| 00:04 | SrPx | ,(for [a '[0 1 2 3]] (print a)) |
| 00:04 | clojurebot | (0123nil nil nil nil) |
| 00:05 | gfredericks | you don't mix laziness with side effects |
| 00:05 | SrPx | ,(for [a '[0 1 2 3]] (print a)) |
| 00:05 | clojurebot | (0123nil nil nil nil) |
| 00:05 | SrPx | ,(for [a '[0 1 2 3]] (print a)) |
| 00:05 | clojurebot | (0123nil nil nil nil) |
| 00:05 | SrPx | wat |
| 00:05 | gfredericks | for is lazy and print is a side effect |
| 00:05 | gfredericks | doseq is good for side effects |
| 00:05 | SrPx | how did you manage to get that different output |
| 00:05 | gfredericks | ,(doseq [a (range 4)] (print a)) |
| 00:05 | clojurebot | 0123 |
| 00:05 | gfredericks | SrPx: using a list instead of a vector |
| 00:05 | SrPx | oh I see |
| 00:05 | gfredericks | vectors are chunked, lists are not |
| 00:05 | gfredericks | apparently |
| 00:06 | SrPx | ,(for [a '(0 1 2 3)] (print a)) |
| 00:06 | clojurebot | (01nil 2nil 3nil nil) |
| 00:06 | gfredericks | you got chunked output originally because range is also chunked |
| 00:06 | SrPx | ,(for [a '(0 1 2 3)] (print a)) |
| 00:06 | clojurebot | (01nil 2nil 3nil nil) |
| 00:06 | gfredericks | ,(for [a (take 4 (iterate inc 0))] (print a)) |
| 00:06 | clojurebot | (01nil 2nil 3nil nil) |
| 00:06 | gfredericks | ^ that's another way to avoid chunking |
| 00:06 | SrPx | hm |
| 00:07 | gfredericks | 99% of the time you don't have to think about these things |
| 00:07 | SrPx | anyway |
| 00:07 | SrPx | for generates a list |
| 00:07 | gfredericks | yep |
| 00:07 | SrPx | would be more to a list comprehension on python than python's for itself right |
| 00:07 | gfredericks | correct |
| 00:07 | SrPx | (= |
| 00:08 | SrPx | very cool. |
| 00:08 | gfredericks | so the second question was about a succincter syntax for function composition? |
| 00:09 | SrPx | I dont know the word succincter but well, just asking if some syntax sugars are possible |
| 00:10 | gfredericks | with macros most sugars are possible, within a couple constraints |
| 00:10 | gfredericks | 1) you still have to use s-expressions -- i.e., only what the clojure reader accepts |
| 00:11 | gfredericks | 2) macros have to be called as a list, i.e. (macro-name ...other-things...) |
| 00:11 | SrPx | so I definitely cant make something like (+ 3*2 2) >> 8 |
| 00:11 | SrPx | (not that I want that, just wondering) |
| 00:11 | gfredericks | per constraint 2, you could arrange that IF that expression were wrapped in a macro that was managing it for you |
| 00:11 | gfredericks | well |
| 00:12 | gfredericks | constraint 1 will probably say that 3*2 is unreadable |
| 00:12 | gfredericks | but (+ 3 * 2 2) should be possible |
| 00:12 | gfredericks | ,(read-string "3*2") |
| 00:12 | clojurebot | #<NumberFormatException java.lang.NumberFormatException: Invalid number: 3*2> |
| 00:12 | SrPx | gfredericks: should it? |
| 00:13 | gfredericks | SrPx: if it was wrapped in a macro; e.g. (with-funny-syntax (+ 3 * 2 2)) |
| 00:13 | SrPx | gfredericks: how? + is not a macro so... ? |
| 00:13 | gfredericks | or I suppose you could also define a macro called + |
| 00:13 | gfredericks | different tradeoffs in each case |
| 00:18 | bhenry | has anyone else run into this? http://i.imgur.com/kVdJB.png |
| 00:18 | bhenry | i can't figure out where my code is making that happen. |
| 00:19 | gfredericks | bhenry: that's interesting looking |
| 00:20 | gfredericks | bhenry: you have an re-matches in your code somewhere? |
| 00:20 | bhenry | nope! |
| 00:20 | bhenry | it must be used in ibdknox's remote stuff with his fetch library |
| 00:21 | gfredericks | it looks like something that could get compiled from (let [[x y z] (re-matches ...)] ...) |
| 00:21 | gfredericks | but in clojure when re-matches returns nil then it should just bind x y and z to nil |
| 00:21 | gfredericks | rather than crash |
| 00:21 | gfredericks | I can't imagine cljs behaving differently |
| 00:22 | gfredericks | surely someone would have noticed by now :) |
| 00:22 | gfredericks | but can't say more than that without seeing the source for that line |
| 00:22 | gfredericks | and I'm going to bed anyhow |
| 03:04 | michaelr525 | 2.5 hours of full channel sleep |
| 04:54 | michaelr525 | 4.5 hours of full channel sleep |
| 04:54 | Erika_Mustermann | hush |
| 05:52 | muhoo | zzzzz |
| 05:52 | muhoo | this has been a much less chatty channel in recent months than it used to be |
| 05:52 | muhoo | not sure tht's a bad thing tho |
| 06:00 | michaelr525 | muhoo: if you want to sleep, sleep! don't talk! |
| 06:24 | bartj | hello, can someone please have a look at this tiny example of multimethods: http://pastie.org/4142109 |
| 06:24 | antares_ | clojurebot: anyone |
| 06:24 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 06:25 | bartj | I am not sure why the multimethod is not getting executed. Instead it throws the error: java.lang.IllegalArgumentException: No method in multimethod 'test' for dispatch value: true (NO_SOURCE_FILE:0) |
| 06:27 | antares_ | bartj: because you defined implementations for [true] and [false] |
| 06:27 | antares_ | not true and false |
| 06:27 | antares_ | 2nd argument to defmethod is an exact value, not a vector: https://github.com/michaelklishin/welle/blob/master/src/clojure/clojurewerkz/welle/conversion.clj#L310 |
| 06:28 | bartj | ok, I think you mean the first argument? |
| 06:29 | bartj | because when I do this: (defmethod mtest true [_] (println "hello")) |
| 06:29 | bartj | (defmethod mtest false [_] (println "world")) |
| 06:29 | bartj | it works |
| 06:29 | antares_ | yes, that's the 2nd argument |
| 06:29 | Guest52069 | hi |
| 06:30 | antares_ | bartj: so it is [name of multimethod] [dispatch value] [vector of args] [body] |
| 06:31 | bartj | antares_, thank you very much! |
| 06:31 | antares_ | bartj: no problem |
| 07:22 | gtuckerkellogg | i just upgraded to 1.4, and now clojure-jack-in fails :( |
| 07:23 | gtuckerkellogg | anyone else seen this: "error in process filter: slime-require: Assertion failed: (keywordp module)" |
| 07:23 | bhenry | gtuckerkellogg: did you also upgrade lein-swank? |
| 07:24 | gtuckerkellogg | hmm |
| 07:25 | gtuckerkellogg | bhenry, you mean swank-clojure? |
| 07:26 | bhenry | gtuckerkellogg: yes that's exactly what i mean, sorry |
| 07:31 | gtuckerkellogg | i seem to be using lein-swank 1.4.4, but lein 1.7.1 |
| 07:31 | antares_ | gtuckerkellogg: I have lein-swank 1.4.3 here and it works great with 1.3 and 1.4 codebases |
| 07:31 | antares_ | I use lein2, though |
| 07:31 | antares_ | for everything |
| 07:31 | gtuckerkellogg | maybe I should upgrade |
| 07:32 | gtuckerkellogg | to lein2 |
| 08:32 | espeed | what's the recommended Thrift library? |
| 08:39 | dfgdfgdfg | am planning to do SICP in the next couple of months..would it be advisable to use clojure instead of scheme? |
| 08:40 | michaelr525 | dfgdfgdfg: dfgdfgfhgdfgdg |
| 08:40 | dfgdfgdfg | michaelr525: I cannot decipher |
| 08:42 | antares_ | dfgdfgdfg: yes |
| 08:42 | dfgdfgdfg | antares_: alright, I am going to give it a shot |
| 08:42 | antares_ | dfgdfgdfg: there is nothing wrong with scheme but clojure has many nice aspects about it and some traditional Lisp baggage that was dropped (for good) |
| 08:43 | dfgdfgdfg | antares_: cool, I might even be able to do something with it at work :) |
| 08:45 | antares_ | dfgdfgdfg: right :) |
| 09:15 | samrat | ok, so i've downloaded this repo https://bitbucket.org/drcabana/euler but i've no idea about how to try out the programs |
| 09:16 | samrat | also, i already have lein installed |
| 09:16 | samrat | can anyone help me |
| 09:18 | antares_ | project.clj has a comment that says there are unit tests |
| 09:18 | antares_ | so, lein test |
| 09:20 | michaelr525 | samrat: you can 'lein repl' and then '(load "file.clj")' and then you can run any of the functions from that file |
| 09:21 | samrat | michaelr525: thanks, i'll try it |
| 10:02 | tenso | Hi, this gives me an error in slime / swank: |
| 10:02 | tenso | (do (println "LOG: Computing...") |
| 10:02 | tenso | (+ 1 1)) |
| 10:02 | tenso | sry |
| 10:03 | tenso | it makes slime-repl print "; Evaluation aborted." |
| 10:04 | Vinzent | tenso, that's all? No buffer with stacktrace? |
| 10:09 | tenso | Huh, the error disappeared after I restarted Emacs |
| 10:10 | xeqi | I've had that occasionally, when I restart swank it disappears |
| 10:10 | Vinzent | you probably sent something BAD before :) |
| 10:10 | tenso | weird, it might be I still had a stacktrace open in the background |
| 10:29 | jhowarth | Is there a keybind in emacs paredit mode for swapping a s-expression's surrounding character? e.g. change ( to [? |
| 10:33 | AimHere | Unlikely, since paredit is really for all lisps, and users of not-Clojure lisps have no need of brackets that aren't your traditional rounded parentheses |
| 10:33 | AimHere | It's the sort of thing you'd write your own binding for if you had a pressing need for it |
| 10:37 | jhowarth | AimHere: |
| 10:37 | jhowarth | Thanks |
| 10:43 | y3di | getting swank-clojure on windows is feeling impossible, sigh |
| 10:43 | Scorchin | What are the best "introduction to clojure" lightning talks (10-15 min) out there? Bonus points if you can provide a link to view/download a video. |
| 10:48 | nonrecursive | Scorchin: this is a good talk but it's an hour and ten minutesL http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey |
| 10:48 | Scorchin | nonrecursive: cool, thanks! |
| 10:49 | nonrecursive | np |
| 10:49 | nonrecursive | Just put my first noir site on heroku :) :) |
| 10:57 | jhowarth | grats! |
| 10:57 | jhowarth | Hoping I can do the same this weekend :D |
| 10:58 | Frozenlo` | Why on Heroku VS your own machine? |
| 10:59 | jhowarth | I actually was more hoping to get my first noir site done this weekend. Hadn't thought about hosting. |
| 10:59 | jhowarth | heroku is easier initially to get setup |
| 11:36 | bartj | ,(+ 18.99 1.90) |
| 11:36 | clojurebot | 20.889999999999997 |
| 11:37 | bartj | why is the above result not simply 20.89 |
| 11:37 | bartj | how can I get clojure to output: 20.89 ? |
| 11:37 | AimHere | Because you're using floating point numbers, which are necessarily inaccurate |
| 11:38 | AimHere | ,(+ 1899/100 19/10) |
| 11:38 | clojurebot | 2089/100 |
| 11:38 | AimHere | You could try rounding the numbers somehow |
| 11:38 | zomg | wut, does 1/2 to mean 0.5 work? |
| 11:38 | zomg | Neat |
| 11:39 | AimHere | Well clojure does support rationals |
| 11:39 | AimHere | bartj, if you want it as a String, eventually, you could use format |
| 11:39 | AimHere | ,(format "%.2f" (+ 18.99 1.90)) |
| 11:39 | clojurebot | "20.89" |
| 11:39 | zomg | AimHere: well a lot of languages do but first time I see that syntax for it :) |
| 11:42 | bartj | , (+ (Double/parseDouble "18.99") (Double/parseDouble "1.90")) |
| 11:42 | clojurebot | 20.889999999999997 |
| 11:42 | bartj | I tried using double instead of float but, still the precision does not seem enough |
| 11:42 | gfredericks | ,(let [third (double 1/3)] (+ third third third)) |
| 11:42 | clojurebot | 1.0 |
| 11:42 | gfredericks | ^ why does that happen? |
| 11:43 | gfredericks | bartj: if you don't like floating point spookiness, use rationals |
| 11:43 | gfredericks | it's not too hard to write an exact function that outputs a rational in decimal format to any precision you like |
| 11:44 | AimHere | Trouble is, you see, bartj, floating point numbers are always going to have artifacts of that nature. You could write a dinky little function to round the function to the nth significant figure, if there isn't one pinched from Java in Math/foo or whatever |
| 11:48 | bartj | AimHere, gfredericks thanks! |
| 11:49 | gfredericks | ,(first (drop-while #(= 1.0 (apply + (repeat % (double (/ 1 %))))) (drop 2 (range)))) |
| 11:49 | clojurebot | 6 |
| 11:49 | gfredericks | ,(let [x 1/6] (+ x x x x x x)) |
| 11:49 | clojurebot | 1N |
| 11:50 | gfredericks | ,(let [x (double 1/6)] (+ x x x x x x)) |
| 11:50 | clojurebot | 1.0000000000000002 |
| 11:50 | gfredericks | I still don't understand why 1/3 and 1/5 escape |
| 11:51 | kaoD | gfredericks, what do you mean escape? |
| 11:52 | gfredericks | kaoD: why is (+ 1/3 1/3 1/3) equal to 1.0 in floating point addition? |
| 11:52 | gfredericks | (double 1/3) must be rounded either up or down |
| 11:52 | gfredericks | so it stands to reason that the sum should be either greater or less than 1.0 |
| 11:53 | gfredericks | it's as if there's some sort of trivial exception logic built in to the floating point ALU |
| 11:53 | mmarczyk | ,(+ 0.3333333333333333333333333333333333333333333333333 0.33333333333333333333333333333333333333333 0.33333333333333333333333333333333333333333333) |
| 11:53 | clojurebot | 1.0 |
| 11:54 | gfredericks | or else the software is silently rounding things that look really close to other things |
| 11:54 | gfredericks | but that's disturbing as well |
| 11:56 | gfredericks | ruby has the same threshold (6 breaks, 3 and 5 don't) |
| 11:56 | gfredericks | but stranger, the result for 6 it still prints as "1.0" despite reporting that it doesn't equal 1.0 |
| 11:56 | mmarczyk | huh? |
| 11:57 | kaoD | gfredericks, I guess rounding is right there |
| 11:57 | mmarczyk | irb says 0.333... + 0.333... + 0.333... == 1.0 |
| 11:57 | gfredericks | x=1.0/6;y=x+x+x+x+x+x;[y.to_s,y==1.0] |
| 11:57 | mmarczyk | oh, for 6 |
| 11:57 | bartj | gfredericks, you are very curious |
| 11:57 | kaoD | ,(float 1/3) |
| 11:57 | clojurebot | 0.33333334 |
| 11:57 | mmarczyk | well, nothing suspect about this |
| 11:57 | kaoD | ,(* 3 0.33333334) |
| 11:57 | clojurebot | 1.0000000199999999 |
| 11:58 | mmarczyk | an extra digit of precision appears "to the left", so some precision might be lost "to the right" |
| 11:58 | gfredericks | mmarczyk: about what? |
| 11:58 | kaoD | ,(float (* 3 0.33333334)) |
| 11:58 | clojurebot | 1.0 |
| 11:58 | kaoD | see? |
| 11:58 | kaoD | it's just lucky about the rounding error |
| 11:58 | gfredericks | mmarczyk: what extra digit of precision? |
| 11:59 | mmarczyk | gfredericks: just before the decimal point in our representation of choice |
| 11:59 | gfredericks | 101 vs 110 both have 3 digits |
| 11:59 | gfredericks | whence the difference between 5 and 6? |
| 11:59 | mmarczyk | what kaoD said |
| 12:00 | kaoD | floating point representation is quite different from binary |
| 12:00 | gfredericks | well they're inverted so 101 vs 110 doesn't apply I guess |
| 12:00 | kaoD | see IEEE754 |
| 12:00 | gfredericks | kaoD: I'm familiar with it |
| 12:00 | gfredericks | kaoD: (double 1/3) must be either slightly less or greater than the ideal 1/3, right? |
| 12:00 | mmarczyk | you could draw diagrams of ieee 754 doubles and do the calculations by hand to check :-) |
| 12:01 | kaoD | let's see |
| 12:01 | kaoD | ,(double 1/3) |
| 12:01 | clojurebot | 0.3333333333333333 |
| 12:01 | kaoD | ,(* 3 (double 1/3)) |
| 12:01 | clojurebot | 1.0 |
| 12:01 | kaoD | you don't see the rounding error really |
| 12:01 | kaoD | you can see it in float (using double) |
| 12:01 | kaoD | but double is the max representation |
| 12:01 | mmarczyk | that doesn't mean that when you add three of them you won't get 1.0 |
| 12:01 | gfredericks | why not? |
| 12:02 | gfredericks | oh hmmm maybe I can imagine |
| 12:02 | mmarczyk | since the "ideal" result of adding three copies of the double closest to 1/3 might turn out to be the double closest to 1.0 |
| 12:02 | mmarczyk | that is, 1.0 |
| 12:02 | gfredericks | so perhaps it is larger by a slight amount but that amount gets lopped off? |
| 12:02 | kaoD | gfredericks, that's it |
| 12:02 | gfredericks | okay, I can buy that |
| 12:02 | kaoD | I insist: it's easier to se in float because you can use double to see the actual rounding error |
| 12:02 | kaoD | but it happens in double too |
| 12:03 | mmarczyk | I mean, might turn out to be closest to the double closets to 1.0 :-P |
| 12:03 | kaoD | and not only that, most FPUs have extra bits of precision |
| 12:03 | mmarczyk | closest |
| 12:03 | gfredericks | ,(first (drop-while #(= 1.0 (apply + (repeat % (float (/ 1 %))))) (drop 2 (range)))) |
| 12:03 | clojurebot | 3 |
| 12:03 | kaoD | and once that bit's trimmed, there's an extra rounding error there too |
| 12:03 | kaoD | (which luckily turns 1.3*3 into 1.0) |
| 12:04 | gfredericks | ,(take 10 (remove #(= 1.0 (apply + (repeat % (float (/ 1 %))))) (drop 2 (range)))) |
| 12:04 | clojurebot | (3 5 6 7 9 ...) |
| 12:04 | kaoD | in fact, think about the internal representation |
| 12:04 | kaoD | the implied 1 bit |
| 12:04 | kaoD | and a lot of zeroes |
| 12:04 | kaoD | (in the mantissa, of course) |
| 12:04 | gfredericks | of course |
| 12:04 | kaoD | if, after rounding, you lose all the ones, it will be rounded to 1.0 |
| 12:05 | gfredericks | so for 1/6, too much error is accumulated |
| 12:05 | kaoD | no |
| 12:05 | kaoD | the error is at the end |
| 12:05 | kaoD | once the floating point value is truncated |
| 12:05 | kaoD | as I said, most FPUs have extra bits |
| 12:06 | kaoD | and it might be truncated only at the end |
| 12:06 | y3di | hm, i can't seem to find clojure-mode in the package list for emacs, does that mean i might already have it installed |
| 12:06 | kaoD | y3di, nope, that means you oughta add marmalade to your package list |
| 12:07 | kaoD | see the slime-clojure (or swank-clojure, not sure) README.md at their GitHub repo |
| 12:07 | kaoD | gotta go, cya! |
| 12:09 | rlb | ...and with x86 you those extra bits can be confusing if you forget they're there. gcc has some options to control their use. |
| 12:10 | y3di | i followed a tutorial, and this is in my init.el file: (add-to-list 'load-path "~/.emacs.d/") |
| 12:10 | y3di | (require 'clojure-mode) |
| 12:10 | y3di | i assume this may mean i already have clojure-mode? |
| 12:11 | y3di | and i installed swank-clojure through lein |
| 12:11 | y3di | so i think i should be good to go |
| 12:13 | y3di | hm but doing m-x swank/slime shows no match |
| 12:13 | y3di | m-x clojure-jack-in works however |
| 12:17 | Vinzent | y3di, well you also need slime, slime-repl and swank-clojure in your emacs |
| 12:20 | y3di | hm, I installed swank-clojure through lein |
| 12:20 | y3di | im having trouble figuring out how ti install slime/slime-repl/swank-clojure |
| 12:20 | y3di | reading the swank readme, it says to get marmalade |
| 13:08 | SrPx | how can I see a list of variables on local namespace? |
| 13:19 | jhowarth | y3di: I recently setup slime so I might be able to help. Did you end up upgrading to emacs 24? |
| 13:24 | kaoD | y3di, as I said, you've got to add the Marmalade package repositories |
| 13:24 | kaoD | see the README.md of related projects at GitHub, it's there somewhere |
| 13:25 | kaoD | you might need Emacs snapshot, if you're not using it already |
| 13:25 | kaoD | and make sure you just add clojure-mode and paredit |
| 13:25 | kaoD | don't install anything else, clojure-mode takes care of SLIME for you |
| 13:25 | kaoD | (just invoke clojure-jack-in and it'll download and install everything) |
| 13:26 | kaoD | and don't even try clojure starter kit, it didn't work very well for me |
| 14:01 | Rakin05 | hi guys. i'm a vimmer at heart and found my love for clojure. i downloaded VimClojure and installed it. now i have the question if there is any syntaxchecker for clojure that can work with syntastic? |
| 14:36 | y3di | kaoD, thanks, imma pm you |
| 14:45 | kaoD | y3di, answered your pm, not sure if you've read it |
| 14:58 | Scorchin | what's the easiest way to convert a ByteArrayInputStream into clojure string? |
| 14:58 | Scorchin | *into a clojure string |
| 14:59 | S11001001 | ,(doc slurp) |
| 14:59 | clojurebot | "([f & opts]); Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments." |
| 14:59 | S11001001 | ^^ Scorchin |
| 15:01 | Scorchin | S11001001: thanks |
| 15:04 | shawnlewis | Is there a way to specify contrib.datalog as a dependency in leiningen, given that contrib is gone and datalog didn't move? |
| 15:04 | shawnlewis | (with clojure 1.3) |
| 15:04 | S11001001 | no; put it in your own source under a different namespace, or offer to maintain it |
| 15:05 | shawnlewis | S11001001: word, thanks |
| 15:06 | S11001001 | you could complain to jstraszheim about it, but I'm not sure that will work |
| 15:08 | shawnlewis | S11001001: well… no complaint really. I was just wondering if I was right that its gone away. |
| 15:12 | jicksta | Can anyone explain why doing (take 5 (cycle (range 6)) in the REPL would hang? |
| 15:13 | raek | jicksta: the repl waits for one more closing parenthesis |
| 15:14 | jicksta | Haha, a much stupider problem that I expected. I was getting problems with the (cycle (range 6)) outputting an infinite sequence just before this so I thought it was the same problem. Thanks :) |
| 15:22 | Rakin05 | is there anything like "~ compile" from sbt/scala in leiningen? |
| 15:24 | S11001001 | Rakin05: no; compilation doesn't take long, and doesn't really help you code anyway |
| 15:25 | Rakin05 | S11001001: what about live error checking? is there anything? |
| 15:25 | S11001001 | Rakin05: also, in clj-land, we code by installing new source into a running program, not compiler loops |
| 15:25 | S11001001 | Rakin05: I make edits and press C-c C-l to load my source changes into the running program |
| 15:26 | Rakin05 | S11001001: You use Emacs? |
| 15:26 | S11001001 | yes |
| 15:26 | S11001001 | for scala too |
| 15:27 | Rakin05 | S11001001: tried emacs...my pinky still hurts |
| 15:27 | S11001001 | swap your caps lock and control keys |
| 15:27 | S11001001 | or just replace caps lock, who needs that |
| 15:27 | S11001001 | I guess there is also a vimclojure thing if you're into that, but I don't care about vim usage |
| 15:28 | S11001001 | and some IDE things, but I don't care about those either |
| 15:28 | Rakin05 | S11001001: does'nt that mean that i write Uppercase and Lowercase randomly? |
| 15:28 | S11001001 | uh, what |
| 15:28 | S11001001 | I am fairly sure they all provide live loading into a running program |
| 15:28 | S11001001 | so, I replaced caps lock with control |
| 15:28 | S11001001 | when I hold down caps lock, it just does what ctrl does |
| 15:29 | S11001001 | even the vim people I know do this |
| 15:29 | rlb | (and it's much better) |
| 15:29 | Rakin05 | Ohhh...okay...i understand. you mean via system settings |
| 15:30 | bartj | hello, was the "run/test" task added to leningen after version 1.1 ? |
| 15:30 | bartj | i can't seem to find them in version 1.1 |
| 15:30 | S11001001 | 1.1?!?! |
| 15:32 | bartj | yes :) |
| 15:32 | S11001001 | bartj: can you not upgrade for some reason? |
| 15:34 | S11001001 | Rakin05: you may like to peruse my intro to clojure for scalawags at https://bazaar.launchpad.net/~scompall/+junk/clojure-stuff/view/head:/src/com/nocandysw/cloj_dummy/scala.clj ; instructions for cloning at https://code.launchpad.net/~scompall/+junk/clojure-stuff |
| 15:34 | S11001001 | in progress :) |
| 15:35 | SrPx | How do you guys organize your project? For example, in C++ it would be .cpp files for class implementation, .h files for header implementation, with the old OO design of classes and methods... |
| 15:35 | SrPx | How are clojure projects organized? |
| 15:35 | Rakin05 | S11001001: The idea with Caps Lock Ctrl switching is great. thanks for that hint |
| 15:36 | uvtc | SrPx, `lein new` gets you off to a good start. |
| 15:36 | uvtc | SrPx, The newest version will also create a "doc" dir for you and start you off with, I think, an "intro.md" file. |
| 15:37 | S11001001 | I assume due to github bias? |
| 15:37 | SrPx | lein new,? let me see |
| 15:38 | uvtc | S11001001, may as well settle on a standard, IMO. .md files in a "doc" directory seems to work fine. |
| 15:38 | uvtc | Which brings me to... |
| 15:38 | S11001001 | hmm. |
| 15:39 | uvtc | I've been working some more on my project to centralize project docs. I added a way to create examples for a given project, similar to how there's examples at clojuredocs. |
| 15:39 | uvtc | The project is called "The Alcove" and it's at http://www.unexpected-vortices.com/alcove/index.html |
| 15:40 | uvtc | I'll announce it on the ML, but thought I'd post here first, and maybe get some feedback and also suggestions on projects to add. |
| 15:40 | uvtc | It works now for projects without a "doc" directory, |
| 15:40 | uvtc | and also even for projects without a README.md file. |
| 15:40 | bartj | SrPx, https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md |
| 15:42 | jhowarth | Does Korma guard against sql injection? |
| 15:44 | uvtc | S11001001, regarding creating docs for a project, I don't think it's necessarily a github bias, though github does use markdown all over the place. But so do sites like reddit and various blog commenting systems. And marginalia uses it too. And it's the nicest of the bunch (of markup formats that I've used). And pretty much everyone already knows it or can learn the basics in a few minutes. |
| 15:45 | S11001001 | alright, good |
| 15:46 | uvtc | What other projects should I add to the alcove? For what projects do you think others might be interested in adding examples? |
| 15:49 | S11001001 | uvtc: slingshot, tools.macro, and algo.monads are good example fodder |
| 15:51 | uvtc | S11001001: Some of those are contrib. I think contrib docs/examples are at clojuredocs, correct? |
| 15:51 | wingy | how is closjurescript doing in async programming? |
| 15:51 | S11001001 | I don't know |
| 15:52 | uvtc | S11001001, Looks like they are. For example, monads: http://clojuredocs.org/clojure_contrib/clojure.contrib.monads |
| 15:52 | S11001001 | that would be ancient history |
| 15:53 | S11001001 | your chance to grab onto the new hotness while clojuredocs is stuck with the old and busted |
| 15:54 | uvtc | S11001001, added slingshot. Thanks. |
| 15:55 | uvtc | S11001001, I actually emailed clojuredocs to see about having the alcove hosted there. Have not heard back yet. |
| 15:55 | uvtc | S11001001, I mean, Zachary. |
| 15:56 | SrPx | seriously what is that |
| 15:56 | SrPx | o.o |
| 15:56 | SrPx | what do you use instead of classes, just this? |
| 15:57 | S11001001 | SrPx: that what? |
| 16:01 | SrPx | lein |
| 16:01 | S11001001 | lein is a build tool |
| 16:01 | S11001001 | it knows how to create project trees and set up a REPL with your code and libraries you're using |
| 16:02 | S11001001 | if you mean organization at the source level, clojure programs are organized mostly as functions in namespaces |
| 16:12 | technomancy | rlb: did you say you're working on getting emacs 24 into Debian? |
| 16:28 | bartj | is the error: "Exception in thread "main" java.lang.Exception: Unable to resolve symbol: defrecord in this context" because of an older clojure version ? |
| 16:30 | S11001001 | Yes |
| 16:31 | S11001001 | still wondering why you're stuck with lein 1.1 |
| 16:32 | bartj | S11001001, I've upgraded |
| 16:32 | bartj | Leiningen 2.0.0-preview6 on Java 1.6.0_22 Java HotSpot(TM) Client VM |
| 16:32 | S11001001 | ok, so your clojure version in project.clj... |
| 16:38 | clj_newb_024587 | I have a clojure web app currently setup using ring, compojure, friend, clojurescript. Now, I want to add ssl support to it. What is the easiest way to do this? |
| 16:39 | weavejester | clj_newb_024587: Usually it's easiest to proxy from nginx or something similar. |
| 16:39 | clj_newb_024587 | I am using ubuntu 12.04. I have no exprience setting up ssl, though I am familiar with crypto. Which one do I have the smallest chance of fucking up? |
| 16:39 | weavejester | clj_newb_024587: The Ring Jetty adapter does support SSL, but it's often useful to separate it out into a proxy. |
| 16:40 | weavejester | clj_newb_024587: nginx SSL is fairly straightforward. |
| 16:40 | clj_newb_024587 | weavejester: this is very low bandwidth, i.e. I have a dual 8GB machine, and there's be a max of 3 concurrent users at any time. |
| 16:40 | clj_newb_024587 | So I can set this all up using just ring-jetty, without nginx? |
| 16:41 | weavejester | clj_newb_024587: It's often useful to proxy a web server through a proxy nginx as a matter of course. That way you can bind nginx to port 80 as root, but have your web app run as an unpriviledged user. |
| 16:41 | clj_newb_024587 | right now, I have an iptables rule forwarding port 80 to port 8080 |
| 16:42 | clj_newb_024587 | but it sounds like I should learn about ngninx |
| 16:43 | weavejester | clj_newb_024587: I think nginx would be my choice, whether I was writing a web app in Clojure or Ruby or something else. |
| 16:43 | clj_newb_024587 | weavejester: can you recommend something better than http://nginx.org/en/docs/http/configuring_https_servers.html ? |
| 16:44 | weavejester | clj_newb_024587: Let me see if I can find something... |
| 16:45 | clj_newb_024587 | weavejester: one more thing; how do I get a signed ssl certificate? |
| 16:45 | clj_newb_024587 | do I just go and throw my wallet at godaddy ? |
| 16:45 | arrdem | clj_newb_024587: that'll work.... but I would look around some first |
| 16:46 | arrdem | godaddy is not what you would call cheap. |
| 16:46 | clj_newb_024587 | arrdem: what would you use? |
| 16:46 | arrdem | clj_newb_024587: honestly? no idea. I have never worked with SSL/HTTPS certs. I've just had sub-optiomal experiences with GDDY |
| 16:49 | clj_newb_024587 | http://emspace.com.au/article/installing-ssl-ubuntu-nginx damn this is compliated |
| 16:49 | weavejester | clj_newb_024587: Try looking at this for examples of proxying: https://help.ubuntu.com/community/Nginx/ReverseProxy |
| 16:50 | weavejester | clj_newb_024587: It's actually not that complex… You just need to dump one file in a directory, and then run one command, if memory serves. |
| 16:50 | clj_newb_024587 | it's like NP-complete; an expoenntial amount of work for a short solution |
| 16:57 | weavejester | clj_newb_024587: This file should be all you need to proxy (HTTP at least): https://gist.github.com/2984900 |
| 16:57 | clj_newb_024587 | intersting you merged in proxy.conf |
| 16:57 | clj_newb_024587 | (I was just working through the tutorial) |
| 16:58 | weavejester | clj_newb_024587: You just dump that in /etc/nginx/available, and sym-link ot to /etc/nginx/enabled and then reload |
| 16:58 | clj_newb_024587 | so I have this weird situation right now, where (1) ssh-ed into my server, "lynx localhost:80" works (it gets me localhost:8080's content); however, from my laptop, going to remote-addr:80 ... it hangs |
| 16:58 | weavejester | For SSL, add another server to listen on 443 |
| 16:59 | clj_newb_024587 | crap ; I think I just nuked my ssh conections |
| 17:00 | clj_newb_024587 | okay; my current problems = firewall problem; not nginx problem |
| 17:00 | clj_newb_024587 | weavejester: thanks for help |
| 17:00 | weavejester | clj_newb_024587: np |
| 17:01 | clj_newb_024587 | weavejester: one more dumb question; I acutally don't need to change anythign on the ring/compojre/clojure side right? i.e. I can just redirect 443 to port 8080, and not modify my clojure code, and everything will wor as is, since nginx handles everything? |
| 17:02 | weavejester | clj_newb_024587: Right |
| 17:03 | weavejester | clj_newb_024587: If you wanted to work with client SSL certificates, you'd have to have Jetty handle the SSL, but client SSL certs are rarely used |
| 17:03 | weavejester | clj_newb_024587: Once nginx is setup, you can use any back end web server and not have to worry about SSL anymore |
| 17:03 | clj_newb_024587 | I like this separation of concerns. |
| 17:04 | weavejester | clj_newb_024587: Another benefit is that you can configure nginx to wait if the web app is down, so you can restart your app with new code, and users wouldn't see any downtime - their connections would just be delayed for a few seconds while the app restarts. |
| 17:05 | clj_newb_024587 | weavejester: oh boy, I'm not sure if that is possible with jvm start up times |
| 17:07 | weavejester | clj_newb_024587: The JVM only takes a few seconds to boot, right? |
| 17:07 | weavejester | clj_newb_024587: Alternatively, you could have two servers, and restart each separately, so you always have one server up. |
| 17:11 | bartj | in clojure.test is there a diff b/w error and failure ? |
| 17:13 | cky | bartj: Yes. A failure means your code has a bug. An error means some unexpected error occurred, which means your code may or may not be buggy. |
| 17:13 | xeqi | did it throw an exception or fail an (is ..) |
| 17:14 | bartj | i purposefully changed an expected test-case which it showed as "failure" |
| 17:14 | clj_newb_09824 | weavejester: okay, after firewall fixing, port 443 forwarding works now |
| 17:14 | clj_newb_09824 | so correct me if i"mwrong all I need now is to generate the fiels cert.pem and cert.key |
| 17:14 | bartj | xeqi, failure |
| 17:15 | bartj | is it possible to write a multimethod for this scenario: |
| 17:15 | bartj | input is a string |
| 17:16 | weavejester | clj_newb_09824: I can never remember the exact steps, but essentially a cert is a public key plus metadata about the site (domain name, owner, etc.). You need to generate the key-pair, generate the cert, then upload the cert to a cert authority to sign it. |
| 17:16 | bartj | if input contains the string "abc" return 1, if input contains the string "xyz" return 2, input is "pqr" return 3 |
| 17:16 | weavejester | clj_newb_09824: Then nginx needs to have a file with the signed cert, and the private key. |
| 17:16 | bartj | i think it is not possible because the dispatch value has to be a *constant* |
| 17:19 | Raynes | mmarczyk: The problem we were seeing in refheap was that mongo-session had a transitive dependency on an ancient version of the java mongo driver. Updating it fixed that issue. |
| 17:20 | Raynes | bartj: That would require predicate dispatch which Clojure's multimethods do not support. |
| 17:26 | Raynes | mmarczyk: Also, this is ridiculously slow. |
| 17:26 | Raynes | :( |
| 17:26 | Raynes | 20 seconds to highlight a 655 line java file. |
| 17:27 | bartj | Raynes, I meant something like this: http://pastie.org/4144823 |
| 17:28 | bartj | do you think that implementation is wrong, for the problem I posted above? |
| 17:29 | Raynes | bartj: That looks about right. (nth foo 1) is just (second foo) though. |
| 17:29 | Raynes | &(nth [1 2 3] 1) |
| 17:29 | Raynes | Damn bot. |
| 17:29 | bartj | but, you said it wasn't possible ? |
| 17:29 | bartj | so I was wondering... |
| 17:30 | Raynes | I thought you were asking for something much more general. |
| 17:30 | Raynes | It sounded like you wanted to execute a different function for each method implementation until one matched. |
| 17:46 | clj_newb_09824 | hmm |
| 17:46 | clj_newb_09824 | where can I get my *.csr file signed? |
| 17:49 | rlb | technomancy: yes, should be soonish (next few days I hope). |
| 17:50 | cky | clj_newb_09824: Any certificate authority will do that for you for some $$$. |
| 18:00 | technomancy | rlb: godspeed =) |
| 18:01 | rlb | thx -- nearly finished; the dfsg split and debian "multiple flavor" infrastructure just takes some time. |
| 18:11 | hcliff | hey, anyone know how to bring up the chrome debugger from the clojurescript reply? (js* "debugger") isn't working |
| 18:13 | brehaut | hcliff: are you wanting to just make it appear, or to break at a certain point? |
| 18:28 | jlewis | do the runtime characteristics of assocEx differ from assoc in IPersistentHashMap? |
| 18:33 | gfredericks | I was wondering what assocEx was the other day |
| 18:33 | gfredericks | is that assoc where you know the key to be already present? |
| 18:33 | jlewis | well, i think what it does is throw an exception immediately if the key already exists |
| 18:33 | jlewis | but... if that's the case, what does assoc do when the key already exists? |
| 18:36 | jlewis | oh, i see |
| 18:36 | jlewis | assoc replaces the value |
| 18:36 | jlewis | assocEx blows up |
| 19:11 | ibdknox | dnolen: have you run into this showing up with master: clojure.lang.PersistentHashMap.create.call(null, b) |
| 19:11 | ibdknox | dnolen: it's appearing in cljs.core.js->clj and blowing up |
| 19:34 | iwillig | does anyone know if i can call a compojure application with a ring request ? |
| 19:35 | weavejester | iwillig: Yes; Compojure is built on top of Ring. |
| 19:35 | iwillig | cool |
| 19:35 | weavejester | iwillig: Compojure's effectively a routing library for Ring |
| 19:36 | weavejester | Almost every function in Compojure returns a Ring handler |
| 19:36 | iwillig | so if i have an compojure app... I should be able to call (app (request :get "/")) |
| 19:36 | mmarczyk | ibdknox: do you have an example of code where this happens? |
| 19:36 | weavejester | iwillig: Right |
| 19:36 | iwillig | where request is from request ring-mock |
| 19:36 | iwillig | cool weavejester thanks |
| 19:36 | ibdknox | mmarczyk: it's in cljs.core |
| 19:37 | weavejester | iwillig: A compojure app = a ring handler |
| 19:37 | mmarczyk | ibdknox: I mean, a call to js->clj which is guaranteed to blow up |
| 19:37 | mmarczyk | I've never seen this happen |
| 19:37 | iwillig | lovely thank weavejester |
| 19:38 | ibdknox | mmarczyk: here's what is in my output: https://www.refheap.com/paste/3304 |
| 19:38 | ibdknox | mmarczyk: any call to js->clj will trigger that path |
| 19:39 | mmarczyk | whoa |
| 19:39 | iwillig | weavejester: when i try (app (request :get "/")) |
| 19:39 | iwillig | i keep on getting an key must be an integer error |
| 19:39 | ibdknox | mmarczyk: yeah, I have no idea what's going on |
| 19:39 | ibdknox | mmarczyk: makes no sense to me |
| 19:40 | weavejester | iwillig: It sounds like there's a problem in your app |
| 19:40 | iwillig | okay |
| 19:40 | ibdknox | mmarczyk: this started happening after I picked up the analyzer split changes |
| 19:40 | ibdknox | mmarczyk: I was a little behind though, so it could be anything since then |
| 19:40 | iwillig | shoot silly error sorry to bug you |
| 19:44 | gfredericks | there is no cljs.core/format? |
| 19:44 | gfredericks | I guess because it'd have to be implemented from scratch instead of deferring to jvm? |
| 19:45 | ibdknox | gfredericks: correct |
| 19:45 | gfredericks | is that a wanted feature? |
| 19:46 | dnolen | ibdknox: I just looked at my output, I don't see this. Did you try cleaning everything? |
| 19:46 | ibdknox | dnolen: yeah |
| 19:46 | ibdknox | dnolen: I'll recheckout |
| 19:46 | ibdknox | gfredericks: I'd love it :D |
| 19:46 | gfredericks | is there a jira ticket for it? |
| 19:46 | dnolen | gfredericks: no |
| 19:46 | gfredericks | dnolen: shall I? |
| 19:46 | dnolen | gfredericks: please do. |
| 19:46 | gfredericks | or are there design questions? |
| 19:46 | mmarczyk | ibdknox: yeah, I don't have this in my compiled output either |
| 19:46 | gfredericks | on it |
| 19:47 | ibdknox | dnolen: mmarczyk: I'm on 1.5, not sure if that might make a difference |
| 19:47 | mmarczyk | ibdknox: https://www.refheap.com/paste/3305 |
| 19:48 | dnolen | ibdknox: that looks like map destructuring is completely broken. |
| 19:48 | dnolen | ibdknox: hmm ... that might, on 1.4 here. are you using 1.5 specific things? |
| 19:48 | ibdknox | yeah |
| 19:49 | mmarczyk | oh yeah |
| 19:49 | mmarczyk | replacing clojure.jar in lib with 1.5.0-alpha1 breaks things for me |
| 19:49 | mmarczyk | *but* |
| 19:49 | mmarczyk | not in the same way :-P |
| 19:49 | ibdknox | lol |
| 19:50 | ibdknox | I'm using clojure master |
| 19:51 | dnolen | ibdknox: yeah destructuring macro changed. |
| 19:51 | gfredericks | cljs.core/format sounds like a good target for the macro-and-function pattern |
| 19:51 | dnolen | ibdknox: inline clojure.lang.PersistentHashMap/create reference in Clojure HEAD |
| 19:51 | dnolen | ibdknox: which of course does not exist in CLJS. |
| 19:51 | ibdknox | dnolen: right |
| 19:52 | mmarczyk | hah |
| 19:52 | dnolen | this a pretty argument for continuing with static fields pattern even though not necessary for JS target ... |
| 19:53 | ibdknox | dnolen: suggestion? If necessary I can likely recreate my changes on 1.4 instead. If there's a straightforward path to a fix, I can work on that instead though. |
| 19:54 | mmarczyk | this is also possibly an argument in favour of bbloom 's host-specific-macro-based approach to map creation, although here I guess it wouldn't help (since any macros imported from clojure.core would still have been compiled to use clojure.core's helpers) |
| 19:54 | dnolen | mmarczyk: ibdknox: http://dev.clojure.org/jira/browse/CLJS-325 |
| 19:54 | dnolen | ibdknox: seems like a simple patch. |
| 19:54 | dnolen | mmarczyk: how was the 1.5 breakage you were seeing different from ibdknox's? |
| 19:55 | mmarczyk | dnolen: Reflection warning, cljs/analyzer.clj:234 - call to create can't be resolved. |
| 19:55 | mmarczyk | dnolen: Reflection warning, cljs/compiler.clj:500 - call to create can't be resolved. |
| 19:55 | mmarczyk | dnolen: and loads more with different line numbers |
| 19:56 | mmarczyk | dnolen: compiled output looked ok at first (cursory) glance |
| 19:56 | dnolen | mmarczyk: oh right ... |
| 19:56 | dnolen | mmarczyk: that's a Java class reference. |
| 19:56 | mmarczyk | yeah |
| 19:56 | mmarczyk | freaked me out though |
| 19:56 | mmarczyk | until I looked at the output :-P |
| 19:57 | dnolen | mmarczyk: we probably need to move destructure into core.clj macros file. |
| 19:58 | mmarczyk | dnolen: ...and possibly revisit :properties destructuring? :-) |
| 19:58 | mmarczyk | dnolen: wouldn't that entail moving let, loop, fn, defn, defmacro (... ?) into cljs also? |
| 19:59 | mmarczyk | not that I necessarily see a problem with that |
| 19:59 | dnolen | mmarczyk: ah ... yeah since they will be calling the wrong destructure. |
| 20:00 | mmarczyk | also, with cljs-specific macros c.l.PHM/create wouldn't be needed |
| 20:01 | dnolen | mmarczyk: yeah |
| 20:02 | mmarczyk | at some point those macros may simply need to be imported -- certainly if cljs were to become *the* Clojure compiler (w/ a JVM backend), possibly if non-JVM cross-host issues or something else of importance required cljs-specific changes |
| 20:04 | dnolen | mmarczyk: I don't think we need to move that many macros. only let and loop far as I can tell. |
| 20:09 | mmarczyk | dnolen: oh, it does look that way |
| 20:18 | mmarczyk | was there a ticket for 93c795fe10ee5c92a36b6ec6373b3c80a31135c4 (in Clojure)? |
| 20:18 | mmarczyk | I'd like to read the rationale |
| 20:22 | technomancy | rlb: yeah, I don't envy anyone who has to get in the middle of the dfsg and the gfdl. |
| 20:22 | technomancy | I'd imagine it's something like http://wondermark.com/657/ |
| 20:26 | dnolen | mmarczyk: hmm I vaguely recall something |
| 20:27 | mmarczyk | dnolen: ? |
| 20:27 | gfredericks | it looks like the example test sort of uses it as a way to provide default values? |
| 20:27 | SrPx | is there any way to save REPL state? |
| 20:27 | dnolen | mmarczyk: http://dev.clojure.org/jira/browse/CLJ-763 |
| 20:28 | mmarczyk | dnolen: thanks! |
| 20:29 | mmarczyk | now this really makes me see bbloom's emitter idea in a new light |
| 20:30 | bbloom | mmarczyk: :-) |
| 20:30 | mmarczyk | expanding to (unchecked-create-map ...) w/ unchecked-create-map inlined on the JVM would save as some hassle |
| 20:30 | mmarczyk | bbloom: :-) |
| 20:30 | mmarczyk | bbloom: thanks for the extensive reply, by the way, I'll be answering soon |
| 20:30 | bbloom | what did i miss? |
| 20:31 | mmarczyk | bbloom: I do think I came across in a more negative way than I aimed for -- I just think macro-based constant handling should happen no sooner than generic factories are in place |
| 20:31 | mmarczyk | bbloom: cljs breaks with Clojure 1.5 because of a change to clojure.core/destructure |
| 20:32 | mmarczyk | bbloom: which now calls clojure.lang.PersistentHashMap/create directly |
| 20:32 | bbloom | mmarczyk: ah. yes, need a generic factory function for it to call directly? |
| 20:32 | mmarczyk | bbloom: ah, also, set is comparable to vec, not vector... hash-set is the analogue of hash-map |
| 20:32 | mmarczyk | bbloom: right |
| 20:33 | bbloom | mmarczyk: yeah, in that patch, i used set* |
| 20:33 | mmarczyk | set* ? |
| 20:33 | bbloom | mmarczyk: yeah, didn't know what else to call it to differentiate the same was as vec vs vector |
| 20:34 | mmarczyk | bbloom: ah, right |
| 20:34 | bbloom | mmarczyk: because you need the vector-version of set to work well with a macro otherwise you need to break down the form to get the tems |
| 20:34 | bbloom | and the form might just be a symbol! which is no good |
| 20:34 | bbloom | tems -> items |
| 20:35 | bbloom | simply (defn set* [& items] (set items)) |
| 20:35 | bbloom | and then you can define a set* macro |
| 20:35 | bbloom | probably needs a better name :-P |
| 20:35 | bbloom | i guess could use hash-set directly |
| 20:37 | mmarczyk | create-$foo ? |
| 20:38 | mmarczyk | and unchecked-create-foo for places where the standard ctor / factory objects to some kind of errors (like duplicate keys in sets/maps) |
| 20:39 | mmarczyk | bbloom: incidentally, that PHSet/fromArray thing could be a separate patch -- should be a 100% clear gain right now, I think |
| 20:39 | mmarczyk | imo, at any rate |
| 20:39 | bbloom | mmarczyk: ok ill look at that in a sec |
| 20:39 | mmarczyk | cool |
| 20:54 | bbloom | mmarczyk: https://www.refheap.com/paste/3306 what do you think? that's just the fromArray bit |
| 20:55 | bbloom | seems like a win to me :-) |
| 20:56 | mmarczyk | bbloom: hah! cool :-) |
| 20:56 | bbloom | ignore that -equiv thing on string |
| 20:56 | bbloom | didn't mean to have that in there :-P |
| 21:00 | mmarczyk | dnolen: so I have a working version of cljs with destructure, let and loop in cljs.core; tests pass |
| 21:00 | dnolen | mmarczyk: great make a ticket and a patch and I'll take a look. |
| 21:00 | mmarczyk | dnolen: k, just a sec |
| 21:01 | dnolen | mmarczyk: er I mean attach patch to existing ticket :) |
| 21:01 | bbloom | mmarczyk: dnolen: http://dev.clojure.org/jira/browse/CLJS-326 |
| 21:01 | SrPx | Okay after playing with windows command prompt I really need an editor for the REPL |
| 21:01 | SrPx | are you guys all using emacs? |
| 21:02 | leo2007 | it is the only sensible option. |
| 21:02 | bbloom | mmarczyk: you mean let and loop implemented as macros? or just namespaced? or what? |
| 21:02 | mmarczyk | bbloom: I mean copy & paste + adjustments to make them work again (because some things they use are on the :refer-clojure :exclude list) |
| 21:03 | mmarczyk | bbloom: http://dev.clojure.org/jira/browse/CLJS-325 |
| 21:03 | mmarczyk | bbloom: part of cljs's struggle for independence ;-) |
| 21:03 | bbloom | mmarczyk: yup :-) hence why i keep adding missing bits and pieces from clj proper heh |
| 21:03 | mmarczyk | right |
| 21:03 | mmarczyk | SrPx: that's one good choice |
| 21:03 | bbloom | mmarczyk: one small step at a time towards the canonical CinC ;-) |
| 21:04 | mmarczyk | I don't know of another one |
| 21:04 | mmarczyk | bbloom: totally! :-) |
| 21:04 | SrPx | mmarczyk: I can't install it u.u |
| 21:05 | mmarczyk | (actually I do like my Vim, used it to write thousands of lines of Scheme, but Paredit put me under a spell) |
| 21:05 | mmarczyk | SrPx: what OS? |
| 21:05 | SrPx | xp |
| 21:05 | bbloom | i'm still wed to vim… haven't tried the vimparedit thing yet |
| 21:06 | mmarczyk | bbloom: don't try the Emacs version if you want to stay faithful |
| 21:06 | SrPx | mmarczyk: is it bad? |
| 21:07 | mmarczyk | (actually I haven't tried Vim's paredit impls, but I'm told they don't implement the full range of functionality -- and I think I use most of what's available) |
| 21:07 | SrPx | oh nvm |
| 21:07 | bbloom | mmarczyk: i figure i need to try emacs&slime at some point but the last time i tried i wanted to cry b/c my vim muscle memory is very very deep. also i do *a lot* of different languages in any given coding session, so i just need my vim bindings and no vim-emulation mode will ever cut it |
| 21:07 | SrPx | anyway |
| 21:08 | mmarczyk | SrPx: hm, I'm not sure I can be much help except to say I have run Emacs on XP with no problems |
| 21:08 | SrPx | I've cloned slime, swank clojure, clojure mode... I have slime working... no idea what to do with that code, though |
| 21:08 | mmarczyk | SrPx: slime on the other hand... would you be willing to try cygwin? |
| 21:09 | SrPx | why not? |
| 21:09 | mmarczyk | bbloom: I know what you mean, Vim is absolutely the best editor |
| 21:10 | SrPx | I'm under an impression that vim doesn't matter that much for lisp |
| 21:10 | bbloom | minus vimscript… *cringe* |
| 21:10 | mmarczyk | bbloom: supposedly evil (latest vim emulator for emacs) is very good -- I must give it a try, but I'll be really surprised if it solves the problem |
| 21:10 | SrPx | All your code is small s-expressions, right? |
| 21:10 | mmarczyk | ah, vimscript doesn't come into it for me |
| 21:10 | mmarczyk | I said "editor" :-) |
| 21:10 | bbloom | heh |
| 21:10 | mmarczyk | so the Emacs text editing experience is somewhat inferior imo |
| 21:10 | mmarczyk | in general |
| 21:10 | bbloom | i don't know of any hardcore vim guys who have tried evil and stuck |
| 21:10 | bbloom | and i know a few who tried hard |
| 21:11 | bbloom | but it was a while ago |
| 21:11 | mmarczyk | certain modes offer so much on top of the basics though |
| 21:11 | bbloom | maybe i'll try it sometime |
| 21:11 | SrPx | but mmarczyk does it matter that much for clojure? |
| 21:11 | mmarczyk | plus there are fantastic emacs "apps" -- org mode etc. |
| 21:11 | mmarczyk | magit |
| 21:12 | SrPx | )= |
| 21:12 | mmarczyk | SrPx: as mentioned above, I've written thousands of lines of scheme in Vim and I loved that experience |
| 21:12 | mmarczyk | I switched to Emacs for a number of reasons |
| 21:13 | mmarczyk | but for lisp editing paredit made the most difference |
| 21:13 | mmarczyk | plus the fact that I simply came to prefer a workflow where I have hundreds of buffers in a single editor session :-P |
| 21:13 | mmarczyk | a server running in the background, clients -- X and terminal -- coming and going... |
| 21:13 | mmarczyk | ah, the Emacs life |
| 21:14 | mmarczyk | anyway. there are new addons for Vim which introduce stuff like text objects useful in lisp, some subset of paredit functionality etc. |
| 21:15 | mmarczyk | it's well worth a try |
| 21:15 | bbloom | i use the shit out of text objects in vim |
| 21:15 | gfredericks | mmarczyk: I work with a bunch of vimmy folk and they're always closing vim and CDing somewhere and opening another file in a new vim session...........it pains me to watch it |
| 21:15 | bbloom | dap baby dap all the way |
| 21:15 | mmarczyk | gfredericks: yeah :-) |
| 21:16 | bbloom | gfredericks: why is that painful? i don't do that when working on a project, but on a server editing configs? i do that non stop |
| 21:16 | mmarczyk | gfredericks: I used to open loads of files in Vim too -- with tabs, NERDtree -- but it never felt as natural as it does in Emadcs |
| 21:16 | mmarczyk | Emacs. |
| 21:16 | gfredericks | bbloom: because they do it when working on a project |
| 21:16 | bbloom | heh |
| 21:16 | gfredericks | mmarczyk: yeah I was using nerdtree during my last few months of vim |
| 21:16 | bbloom | luckily vim starts fast :-) |
| 21:17 | mmarczyk | SrPx: but if you want slime, I think cygwin might help |
| 21:17 | mmarczyk | gfredericks: well, I actually still use Vim a fair bit -- I'd really love it for Evil to be as good as it's made out to be |
| 21:18 | bbloom | i've even got one of those kenisis concave keyboards with the modifiers on the thumbs… people assume i'm an emacs guy :-P |
| 21:18 | mmarczyk | I was planning to give it a spin come end of June, so I guess I'll find out soon :-P |
| 21:19 | mmarczyk | bbloom: oh cool, always wanted to touch one of those things |
| 21:19 | bbloom | mmarczyk: took about 1 week to get back up to speed a few years ago |
| 21:19 | mmarczyk | I don't believe they're stocked by any brick & mortar 'round here :-( |
| 21:19 | bbloom | mmarczyk: love this dopey thing |
| 21:20 | mmarczyk | :-) |
| 21:20 | bbloom | yeah, i ordered online |
| 21:20 | mmarczyk | I think it'd be slightly dangerous in my current situation |
| 21:20 | SrPx | no idea how to use it sigh |
| 21:22 | mmarczyk | moving around with a laptop quite a lot, I mean |
| 21:23 | mmarczyk | the switch from a MS keyboard to the laptop keyboard was already painful, if the kinesis thing is anywhere near as good as it looks ... :-P |
| 21:23 | mmarczyk | SrPx: cygwin? |
| 21:24 | bbloom | *cringe* @ cygwin |
| 21:25 | Hodapp | cygwin helps keep my sanity on my Windows box at work |
| 21:26 | SrPx | õo |
| 21:26 | S11001001 | truth |
| 21:28 | gfredericks | mmarczyk: I never even considered being proficient at both editors simultaneously |
| 21:28 | gfredericks | that sounds like a recipe for confusion and frustration |
| 21:28 | gfredericks | ditto for qwerty and dvorak |
| 21:29 | y3di | have you guys tried out haskell? and if so, why do you like clojure better? |
| 21:30 | bbloom | gfredericks: probably pretty easily overcome. i used to think the same thing when i started doing a few different languages for a few different projects at the same time or in the same file. HOW DO I KEEP ALL THESE ESCAPE SEQUENCES RIGHT!?! but eventually you just get good at it |
| 21:31 | mmarczyk | y3di: I have, I love it |
| 21:31 | mmarczyk | y3di: as for the why question, there are two answers |
| 21:33 | S11001001 | y3di: who said I like clojure better? :? |
| 21:33 | mmarczyk | the first is that I like the Lisp style of programming best, I find Clojure's design particularly elegant etc. -- could go on |
| 21:33 | mmarczyk | the second is Cabal |
| 21:34 | mmarczyk | w/o the second answer I think this would be a pretty close call, I absolutely love doing stuff in Haskell when I'm not fighting the packaging facility |
| 21:35 | mmarczyk | there's hsenv now and the Yesod thing (cabal-meta?) which I haven't tried yet, so things are getting better |
| 21:38 | SrPx | What is cabal? |
| 21:39 | mmarczyk | the blog post on cabal-meta is dated April 5, 2012 and it includes the sentence (describing the pre-cabal-meta state of affairs) "Even with all these tools, one day I found myself completely incapable of installng Yesod from source." |
| 21:40 | mmarczyk | I still think Haskell is a marvellous language and an overall glorious achievement, but *argh* |
| 21:40 | mmarczyk | SrPx: Haskell package manager |
| 21:40 | mmarczyk | SrPx: well, build tool |
| 21:41 | S11001001 | sort of both |
| 21:41 | mmarczyk | that's actually an acronym |
| 21:41 | S11001001 | fetches deps anyway |
| 21:41 | mmarczyk | http://www.haskell.org/haskellwiki/Cabal |
| 21:42 | mmarczyk | with certain recently developed utilities it can be used sort of like lein |
| 21:43 | mmarczyk | but getting the correct versions of deps resolved seems to be more of a problem |
| 21:52 | treehug | how would i go about using goog.dom.query in a clojurescript app? i got this far: https://gist.github.com/2985921 but i'm confused why it is not finding the right provides even though they are in the deps i listed in project.clj for cljsbuild to use |
| 21:53 | bbloom | treehug: hmm.. looks like you're getting errors in core, not your code |
| 21:53 | bbloom | i see you're using cljsbuild, have you managed to compile an empty project at all? |
| 21:54 | treehug | yes, if i leave out the deps i have listed there it compiles. even using goog.dom.* functions if i 'require them |
| 21:54 | treehug | (that is, i remove the reference to good.dom.query from mutest.cljs) |
| 21:54 | technomancy | mmarczyk: it's funny that build nightmares are also my biggest complaint with ocaml |
| 21:54 | technomancy | the general advice is "just use apt" |
| 21:55 | mmarczyk | ouch |
| 21:56 | jhowarth | Is there an equivalent in emacs for M+( that will wrap an s-exp in brackets instead? |
| 21:56 | bbloom | treehug: is that the right sep? do you want (:use [goog.dom :only [query]])) |
| 21:57 | bbloom | or (:require [goog.dom.query :as query]) |
| 21:57 | bbloom | i think you're running into the export == module name issue |
| 21:57 | mmarczyk | jhowarth: there's no default binding, but the function is called paredit-wrap-square |
| 21:58 | bbloom | treehug: let me know if either of those work |
| 21:58 | jhowarth | mmarczyk: Thanks! |
| 22:02 | cgag | i'm messing with aleph and my code looks like this: https://www.refheap.com/paste/3307, but when i open up three tabs and send 3 requests, rather than all of them finishing around the same time, it looks like it's just chugging through them synchronously |
| 22:02 | rlb | technomancy: yeah, it's unfortunate, but I understand how we got here, and at the moment, it's the situation we have. |
| 22:03 | rlb | technomancy: though I was very happy when guile dropped the non-dfsg bits. |
| 22:03 | rlb | (Running candidate 24.4+1-1 build now...) |
| 22:05 | cgag | anyone know if my that code looks reasonable? |
| 22:06 | treehug | bbloom: i tried (:require [goog.dom.query :as query]) w/ (query/query …), also (:use [goog.dom.query :only [query]) w/ (query …) and (:use [goog.dom :only [query]) w/ (query …) -- basically the same error message with only the namespace text different |
| 22:07 | bbloom | treehug: what version of cljs are you using? |
| 22:07 | bbloom | treehug: or, i guess revision |
| 22:08 | ibdknox | I have very exciting news for tomorrow :) |
| 22:09 | mmarczyk | ibdknox: http://dev.clojure.org/jira/browse/CLJS-325 |
| 22:09 | bbloom | treehug: are you sure you have the right namespace? i think it's good.dojo.dom.query |
| 22:09 | ibdknox | mmarczyk: ah, thank you! |
| 22:09 | bbloom | treehug: http://closure-library.googlecode.com/svn/docs/closure_third_party_closure_goog_dojo_dom_query.js.html |
| 22:09 | treehug | bbloom: interesting question… i take it that cljsbuild provided me lein-cljsbuild-compiler-0/cljs/core.cljs but i'm not sure where from |
| 22:10 | bbloom | hmm maybe there is goog.dom.query too |
| 22:10 | treehug | ok i'll try that |
| 22:10 | bbloom | is there a git repo in there? what revision is it? |
| 22:10 | mmarczyk | ibdknox: now I'm going to wonder what kind of news :-P |
| 22:10 | mmarczyk | is tomorrow many hours away in your TZ? :-) |
| 22:11 | ibdknox | I'll be releasing the playground tomorrow :) |
| 22:11 | treehug | nothing in it, i'll try a clean & deps and see where it downloads from |
| 22:11 | bbloom | ibdknox: ah, cool. |
| 22:11 | ibdknox | I suspect there will be a sudden spike in interest for "learning clojure" materials |
| 22:11 | mmarczyk | ibdknox: oh great, now you've ruined my start-of-week productivity :-D |
| 22:12 | ibdknox | haha |
| 22:12 | bbloom | ibdknox: presumably only to kickstarter backers? or more boradly? |
| 22:12 | bbloom | broadly* |
| 22:12 | ibdknox | the playground will go out to the world |
| 22:12 | mmarczyk | seriously though, can't wait to have a look :-) |
| 22:14 | gtuckerkellogg | is anyone here using clojure in with org-babel? |
| 22:16 | treehug | bbloom: looks like org/clojure/clojurescript/0.0-1236/clojurescript-0.0-1236 is downloaded by cljsbuild |
| 22:19 | treehug | i think it must be my project.clj -- even if i just have (ns mytest) and that |
| 22:20 | treehug | 's all i get the same kind of error |
| 22:20 | bbloom | treehug: oh, heh, that's what i was asking about before…. like i said: you're getting errors loading stuff at the top of cljs core… you're not importing goog.string for example, but core is |
| 22:21 | pterygota | hello, anyone working with overtone in here? |
| 22:21 | treehug | bbloom: yeah sorry, i've been messing around with my project and at one point a simple empty file did compile properly… |
| 22:22 | bbloom | treehug: try to break it down to a minimal repo & the problem will hopefully become more apparent :-) |
| 22:24 | treehug | bbloom: ok https://gist.github.com/2986062 does compile simple (ns mutest) file, but uncommenting any comination of those google-closure-library deps will break it |
| 22:25 | bbloom | i don't use cljsbuild myself, so i don't know: do you need a gclosure dep? or is that implicitly provided by leon? |
| 22:25 | bbloom | lein* stupid apple auto correct |
| 22:28 | treehug | it looks like leon cljsbuild is downloading a clojurescript and a closure-library to ~/.m2/repository and then compiling a cljs.js info ./.lein-cljsbuild-compiler-0/cljs/core.js maybe my explicitly including closure-library/closure-library-thirdparty on top of the gclosure bits compiled into cljs.js conflict |
| 22:29 | bbloom | maybe. again, i don't use cljsbuild… have you tried just using query without the deps in project.clj ? |
| 22:31 | technomancy | clojurebot: leon is a good sign it's time to turn off auto-"correct" |
| 22:31 | clojurebot | c'est bon! |
| 22:31 | bbloom | leon. |
| 22:31 | xeqi | ~leon |
| 22:31 | bbloom | no? :-P |
| 22:31 | clojurebot | leon is a good sign it's time to turn off auto-"correct" |
| 22:31 | technomancy | I should write a library named after Ponce de Leon just to mess with people |
| 22:31 | bbloom | heh. |
| 22:32 | bbloom | i use Textual irc which doesn't disable auto correct in it's little message box, it's pretty much the only time i ever encounter a normal cocoa text box |
| 22:33 | bbloom | chrome, terminal, and vim is pretty much the only other times i type anything :-P |
| 22:34 | SrPx | https://github.com/technomancy/swank-clojure <- Add [lein-swank "1.4.4"] to the :plugins section of either project.clj or your user profile. <- what does this mean? |
| 22:35 | abp | ibdknox: Holding my breath. ;D |
| 22:35 | bbloom | SrPx: what does which part mean? |
| 22:36 | bbloom | SrPx: do you have a project.clj file? |
| 22:36 | SrPx | No, I don't even know what this is? |
| 22:36 | bbloom | leon, er i mean lein |
| 22:36 | pterygota | SrPx: if you create a project with lein new projectname, you should get a directory with a project.clj in it called projectname |
| 22:36 | bbloom | SrPx: it's clojure's project system https://github.com/technomancy/leiningen |
| 22:37 | treehug | bbloom: no doesn't work either - i think because clojurescript doesn't use the thirdpaty closure stuff. anyway i just discovered domina uses good.dom.query and depends on a goog.jar for it and does some magic :libs ["goog/dom/query.js"] in the project.clj. i'll experiment a bit more with that |
| 22:37 | pterygota | and in project.clj there will be a plugins section |
| 22:37 | treehug | bbloom thanks for your help and ideas |
| 22:38 | SrPx | but how can I install it? I don't have any of those package manages |
| 22:38 | SrPx | managers |
| 22:38 | pterygota | just install lein by downloading it as described on that page and running it |
| 22:57 | dnolen | mmarczyk: ping |
| 22:57 | wolgo | hi |
| 22:57 | mmarczyk | dnolen: pong |
| 22:57 | dnolen | mmarczyk: see my comment on 325? |
| 22:58 | wolgo | I want to start learning clojure. Outside of writing, programs what is recommended as a decent first read for someone that has some lisp exposure and can program in other languages? |
| 22:58 | mmarczyk | dnolen: assert-args was already in cljs.core, I just moved it to the top of the file |
| 22:59 | mmarczyk | dnolen: it's only used to validate macro args, not in the expansion |
| 22:59 | scottj | wolgo: fav book of the channel is clojurebook.com |
| 22:59 | mmarczyk | expansions |
| 22:59 | dnolen | mmarczyk: oh right, gotcha. |
| 23:00 | wolgo | okay thanks |
| 23:00 | wolgo | I will be back when I have questions. You have been warned! |
| 23:03 | dnolen | mmarczyk: ibdknox: CLJS-325 resolved. |
| 23:04 | mmarczyk | great! |
| 23:04 | rlb | technomancy: probably won't upload emacs24 until at least tomorrow fwiw -- everything looks good, but I need to test the install a bit more. |
| 23:27 | technomancy | rlb: no worries; I'm on testing anyway |