2014-08-27
| 00:40 | danielcompton | On my gravestone when I die: This tombstone is not part of GNU Emacs. |
| 01:22 | amalloy | celwell: yes, that's exactly what you can/should do |
| 03:41 | andrewchabmers | \join #clojurescript |
| 03:45 | andrewchambers | how hard is it to call c++ code from clojure? |
| 03:47 | beamso | you would be calling out from clojure through java (jni or jna) to call the c++ code |
| 03:47 | andrewchambers | hmm |
| 03:47 | andrewchambers | im trying to work out the best way to read in llvm bitcode files into clojure |
| 03:48 | andrewchambers | and convert them to native clojure data structures |
| 03:50 | beamso | http://stackoverflow.com/a/17401949 ? |
| 03:52 | cYmen | Morning #clojure! |
| 04:08 | sm0ke | ,(instance? java.util.Map {}_) |
| 04:08 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: _ in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 04:09 | sm0ke | hurm this seems to work on my repl |
| 04:09 | sm0ke | ,(clojure-version) |
| 04:09 | clojurebot | "1.7.0-master-SNAPSHOT" |
| 04:09 | sm0ke | ##(instance? java.util.Map {}_) |
| 04:09 | lazybot | ⇒ true |
| 04:10 | sm0ke | ha |
| 04:10 | sm0ke | ##(clojure-version) |
| 04:10 | lazybot | ⇒ "1.4.0" |
| 04:10 | engblom | ,(/ 1 0) |
| 04:10 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: Divide by zero> |
| 04:11 | sm0ke | seems like a bug in compiler to me ##(doc instance?) ;as doc has only 2 arity |
| 04:11 | lazybot | ⇒ "([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false" |
| 04:12 | sm0ke | ##(assoc {} 1 {}_) |
| 04:12 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: _ in this context |
| 04:12 | sm0ke | very peculiar |
| 04:17 | amalloy | uhhhh...peculiar in that you typed a _ in the middle of nowhere? |
| 04:18 | sm0ke | ##(instance? java.util.Map {}_) |
| 04:18 | sm0ke | yes |
| 04:18 | lazybot | ⇒ true |
| 04:20 | sm0ke | looks funny right? |
| 04:21 | amalloy | it was fixed in 1.6, i think. maybe 1.5 |
| 04:21 | amalloy | instance? used to be totally awful if you called it with any number of args other than 2 |
| 04:21 | amalloy | &(instance? String) |
| 04:21 | lazybot | ⇒ false |
| 04:21 | amalloy | &(instance?) |
| 04:21 | lazybot | clojure.lang.ArityException: Wrong number of args (0) passed to: core$instance-QMARK- |
| 04:21 | amalloy | 0 was fine too, i guess |
| 04:22 | sm0ke | hurm how is this possible, is instance? a macro? |
| 04:23 | sm0ke | only possible explaination |
| 04:23 | amalloy | it's...well, no |
| 04:23 | amalloy | there are stranger things in this world than what you consider possible |
| 04:23 | sm0ke | weel then how can it take more than 2 arity |
| 04:23 | sm0ke | yea right, that explaination is awesome |
| 04:23 | wjlroe | is it a special form? |
| 04:24 | amalloy | no, it's actually a regular function |
| 04:24 | amalloy | but there's a compiler intrinsic to turn literal calls to instance? into a single jvm bytecode op instead |
| 04:24 | sm0ke | ##(inc 1 2) |
| 04:24 | lazybot | clojure.lang.ArityException: Wrong number of args (2) passed to: core$inc |
| 04:24 | amalloy | and in previous versions of clojure that intrinsic was written wrong |
| 04:24 | sm0ke | wow it says wrong arity, thank god |
| 04:24 | amalloy | such that it didn't complain about the wrong number of args |
| 04:25 | amalloy | or something like that. i think the intrinsic system is actually smarter than that, and it was actually a special case in the compiler |
| 04:25 | wjlroe | ah right - as it's a convenience function that calls java methods |
| 04:25 | andrewchambers | belated goodmorning cYmen |
| 04:27 | andrewchambers | beamso: Those seem pretty out of date |
| 04:39 | cYmen | I'd like to work on a medium/large clojure project. Is there a list of clojure open source projects available somewhere? |
| 04:40 | cataska | 2014-08-27 16:31 *** andrei_ QUIT Remote host closed the connection |
| 04:40 | cataska | Oops |
| 05:31 | visof | ,(sorted-map {:a 1, :d 2, :b 3}) |
| 05:31 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: {:b 3, :d 2, :a 1}> |
| 05:31 | visof | why this don't work? |
| 05:32 | visof | ,(sorted-map :a 1, :d 2, :b 3) |
| 05:32 | TEttinger | ,(apply sorted-map {:a 1, :d 2, :b 3}) |
| 05:32 | clojurebot | {:a 1, :b 3, :d 2} |
| 05:32 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: [:a 1]> |
| 05:32 | TEttinger | that was mine |
| 05:32 | TEttinger | that errored I mean |
| 05:33 | TEttinger | visof, it seems like it should. you may be looking for sort |
| 05:33 | TEttinger | ,(class (sort {:a 1, :d 2, :b 3})) |
| 05:33 | clojurebot | clojure.lang.ArraySeq |
| 05:33 | TEttinger | ,(class (sorted-map :a 1, :d 2, :b 3)) |
| 05:33 | clojurebot | clojure.lang.PersistentTreeMap |
| 05:33 | TEttinger | hm |
| 05:39 | blorg | any1 doing clj gamedev? |
| 05:39 | justin_smith | ,,(into (sorted-map) {:a 0 :b 1 :c 2}) |
| 05:39 | clojurebot | {:a 0, :b 1, :c 2} |
| 05:41 | blorg | ((fn [xs n] (flatten (partition (dec n) n nil xs))) [1 2 3 4 5 6 7 8] 3) |
| 05:42 | justin_smith | ~flatten |
| 05:42 | clojurebot | flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with. |
| 05:44 | blorg | ,,(filter (complement nil?) (map #(if (= %1 1) %2) (cycle (conj (into [] (repeat (dec 3) 1)) 0)) [1 2 3 4 5 6 7 8] ) ) |
| 05:44 | clojurebot | (1 2 4 5 7 ...) |
| 05:44 | justin_smith | ,((fn [xs n] (apply concat (partition (dec n) n nil xs))) [1 2 3 4 5 6 7 8] 3) |
| 05:44 | clojurebot | (1 2 4 5 7 ...) |
| 05:44 | blorg | whats up with the commas? |
| 05:45 | blorg | ,( whats (up (with (the (commas huh?))))) |
| 05:45 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: whats in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 05:45 | justin_smith | ,"it triggers the bot" |
| 05:45 | clojurebot | "it triggers the bot" |
| 05:46 | blorg | ," blorgon is my master!!!" |
| 05:46 | clojurebot | " blorgon is my master!!!" |
| 05:46 | blorg | ," I fear the daeleks!!" |
| 05:46 | clojurebot | " I fear the daeleks!!" |
| 05:47 | blorg | nice gimmick... |
| 05:48 | blorg | ,((comp drop-last #(interleave %2 (repeat (count %2) %1))) 0 [1 2 3]) |
| 05:48 | clojurebot | (1 0 2 0 3) |
| 05:50 | blorg | ,"OBEY THE BLORGONS justin_smith!" |
| 05:50 | clojurebot | "OBEY THE BLORGONS justin_smith!" |
| 05:50 | justin_smith | ,(drop-last (interleave [1 2 3] (repeat 0))) |
| 05:50 | clojurebot | (1 0 2 0 3) |
| 05:53 | SagiCZ1 | what other ~ tips does the bot know? |
| 05:53 | SagiCZ1 | ~atom |
| 05:53 | clojurebot | Titim gan éirí ort. |
| 05:54 | SagiCZ1 | is that irish? |
| 05:54 | blorg | ~~ |
| 05:54 | justin_smith | ~factoids |
| 05:54 | clojurebot | Excuse me? |
| 05:54 | clojurebot | Excuse me? |
| 05:54 | justin_smith | SagiCZ1: I believe so |
| 05:54 | blorg | ~'~ |
| 05:54 | clojurebot | Pardon? |
| 05:54 | blorg | ~`~ |
| 05:54 | clojurebot | No entiendo |
| 05:54 | SagiCZ1 | ~blorg |
| 05:54 | clojurebot | Huh? |
| 05:54 | blorg | ok ill leave u be |
| 05:55 | blorg | a whole REPL with one purpose in life: listining to an IRC channel... |
| 05:55 | justin_smith | (inc clojurebot) |
| 05:55 | lazybot | ⇒ 43 |
| 05:55 | blorg | funny |
| 05:55 | blorg | ~clojurebot |
| 05:55 | clojurebot | clojurebot ignores several people at hiredman's whim |
| 05:56 | justin_smith | 3d6 |
| 05:56 | clojurebot | 17 |
| 05:56 | blorg | who built him? |
| 05:56 | justin_smith | https://github.com/hiredman/clojurebot |
| 05:57 | justin_smith | note the ~clojurebot factoid also mentions hiredman |
| 05:57 | blorg | '(def clojurebot dead) |
| 05:57 | blorg | ,(def clojurebot dead) |
| 05:57 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: dead in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 05:58 | blorg | ,(def clojurebot nil) |
| 05:58 | clojurebot | #'sandbox/clojurebot |
| 05:59 | SagiCZ1 | i love the bot though |
| 05:59 | blorg | he is super cute |
| 05:59 | SagiCZ1 | yup| |
| 05:59 | TEttinger | I can answer questions about lazybot if anyone needs em |
| 06:00 | SagiCZ1 | TEttinger: Nice try |
| 06:00 | blorg | lazybot? |
| 06:00 | clojurebot | lazybot is forget lazybot |
| 06:00 | SagiCZ1 | but not its clojurebot-time! |
| 06:00 | SagiCZ1 | (doc println) |
| 06:00 | clojurebot | "([& more]); Same as print followed by (newline)" |
| 06:00 | blorg | any1 read the post about how clojure/lisp coders are happier? |
| 06:00 | SagiCZ1 | no? |
| 06:00 | TEttinger | ##(clojure.string/join" "(repeatedly 2000(fn [](apply str(concat[(rand-nth ["rh""s""z""t""k""ch""n""th""m""p""b""l""g""phth"])](take(+ 2(* 2(rand-int 2)))(interleave(repeatedly #(rand-nth ["a""a""o""e""i""o""au""oi""ou""eo"]))(repeatedly #(rand-nth ["s""p""t""ch""n""m""b""g""st""rst""rt""sp""rk""f""x""sh""ng"]))))[(rand-nth ["os""is""us""um""eum""ium""iam""us""um""es""anes""eros""or""ophon""on""otron"])]))))) |
| 06:00 | clojurebot | no is tufflax: there was a question somewhere in there, the answer |
| 06:00 | lazybot | ⇒ "thategon pounotus phthortor phthomertus maspanes taspaustis choisterkeros choifophon kortor mospamium pausheros pangospos boifum rhoseros netor choufanes mauchus kananes maumon rhobus thages thautespis laspongeum pouchor mertobium zetamophon postachotron taunopum no... https://www.refheap.com/89505 |
| 06:01 | TEttinger | the refheap link is handy |
| 06:01 | SagiCZ1 | TEttinger what just hapenned? |
| 06:01 | TEttinger | it's a random greek-like word generator |
| 06:01 | TEttinger | in one IRC line |
| 06:01 | TEttinger | 411 chars |
| 06:02 | TEttinger | 413 if you include the prepend for lazybot |
| 06:02 | SagiCZ1 | sweet! does lazybot link the log automatically if the output is too long? |
| 06:02 | blorg | wt is diff lazy vs clj? |
| 06:02 | TEttinger | yep! |
| 06:02 | TEttinger | blorg, different authors, different purposes |
| 06:02 | SagiCZ1 | ,(take 456 (range 1000)) |
| 06:02 | clojurebot | (0 1 2 3 4 ...) |
| 06:03 | blorg | k |
| 06:03 | TEttinger | ##(take 456 (range 1000)) |
| 06:03 | lazybot | ⇒ (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 ... https://www.refheap.com/89506 |
| 06:03 | SagiCZ1 | ok so its double hashmark for lazybot |
| 06:03 | TEttinger | only lazybot links to refheap |
| 06:03 | TEttinger | there's othrs than ## |
| 06:03 | SagiCZ1 | (inc lazybot) |
| 06:03 | lazybot | ⇒ 30 |
| 06:03 | TEttinger | I think $ or & works, one of them |
| 06:03 | SagiCZ1 | ok.. good work btw.. ! |
| 06:04 | justin_smith | double hashmarks are for ##(print "inline" "calls") |
| 06:04 | lazybot | ⇒ inline callsnil |
| 06:04 | TEttinger | but ##(+ 1 1) can be inside another message |
| 06:04 | lazybot | ⇒ 2 |
| 06:04 | justin_smith | &"only works at the beginning of the line" |
| 06:04 | lazybot | ⇒ "only works at the beginning of the line" |
| 06:04 | blorg | this irc shud be renamed to shoe-your-clojurebot-day |
| 06:04 | blorg | *show |
| 06:04 | TEttinger | SagiCZ1, heh, it's Raynes and amalloy_'s work, I just extended the plugins for my fork that wouldn't be a good fit here |
| 06:05 | blorg | bring-your-clojure-bot-to-scholl-day |
| 06:05 | SagiCZ1 | TEttinger: I see.. :) |
| 06:06 | SagiCZ1 | i better start doing some real coding in clojure.. its so hard to learn any new languages.. at first i dont have enough experience to really code but i dont really learn if i am just doing artifical exercises :/ |
| 06:06 | SagiCZ1 | i had the same problem with java 5 years ago but ive gotten through taht somehow |
| 06:07 | blorg | u know 4clojure? (sagiCZ1) |
| 06:07 | SagiCZ1 | blorg: yep |
| 06:07 | SagiCZ1 | almost done with that |
| 06:07 | blorg | hmm.. im only at like problem 50 or so.. |
| 06:07 | SagiCZ1 | mm.. me too |
| 06:08 | SagiCZ1 | there is about 150 so i guess it doesnt really qualify as being "almost done" sorry |
| 06:08 | blorg | but i need clj for some project so i know ill pull thru |
| 06:08 | SagiCZ1 | i need clj too |
| 06:08 | SagiCZ1 | but its too early to start on that project.. |
| 06:08 | SagiCZ1 | i would be rewriting all of it |
| 06:08 | SagiCZ1 | need some small toy projects before that |
| 06:08 | blorg | ye.. |
| 06:09 | blorg | genetic algo is small enuf.. |
| 06:10 | blorg | a small MS-paint clone.. in clj... |
| 06:10 | blorg | IamDrowsy too |
| 06:10 | SagiCZ1 | cool ideas.. ive done some evolutionary algos too.. clojure just seemed so very natural with that |
| 06:12 | cYmen | IamDrowsy? |
| 06:12 | blorg | cYmen? |
| 06:12 | SagiCZ1 | blorg? |
| 06:12 | blorg | clojurebot? |
| 06:12 | clojurebot | clojurebot is amazing |
| 06:13 | SagiCZ1 | lazybot? |
| 06:13 | clojurebot | lazybot is forget lazybot |
| 06:13 | SagiCZ1 | ...but i still dont know how to replace java's objects in clojure.. i know i talk about it all the time here.. objects just make sense to me |
| 06:13 | cYmen | Interesting... |
| 06:13 | blorg | objects are bad |
| 06:14 | SagiCZ1 | are they? |
| 06:14 | cYmen | SagiCZ1: Which part do you miss? The type-checking? Inheritance? |
| 06:14 | blorg | yes... |
| 06:14 | SagiCZ1 | none of that.. just the data storage and methods that mutate their state.. i just miss mutability i guess |
| 06:14 | ivan | I miss the state |
| 06:14 | cYmen | I mean an object is just a bunch of data and a bunch of related methods. |
| 06:15 | SagiCZ1 | cYmen: data that can be mutated |
| 06:15 | cYmen | But you can just use a map or tuple or whatever and still store data i.e. state. |
| 06:15 | blorg | u can hack objects together in any lang |
| 06:15 | blorg | almost.. |
| 06:15 | SagiCZ1 | map is ok.. but its immutable |
| 06:15 | cYmen | But why does it matter if you do object.mutate() instead of object = mutate(object)? |
| 06:15 | ivan | SagiCZ1: the common thing is to use an atom |
| 06:15 | SagiCZ1 | atom is for special cases though isnt it |
| 06:16 | blorg | im trying to do OOP rehab |
| 06:17 | SagiCZ1 | so what i would do.. is i would have a global variable atom.. and functions with sidefect that mutate the atom.. it just seems like a horrible misuse of clojure |
| 06:17 | cYmen | SagiCZ1: I think this is perfectly appropriate in some cases. |
| 06:17 | blorg | try exploring haskell mbe. |
| 06:17 | justin_smith | cYmen: it matters because the affects none of the data structures embedding object |
| 06:18 | blorg | its less usefull IMO than clj.. but it forces u to think diff |
| 06:18 | justin_smith | *the latter |
| 06:18 | SagiCZ1 | blorg: i love the JVM.. can't live without it.. the apache math library is a lifesaver. |
| 06:18 | cYmen | justin_smith: I still can't parse that sentence. :) |
| 06:18 | SagiCZ1 | justin_smith: could you elaborate please? |
| 06:18 | blorg | ye i agree that haskell isnt very usefull |
| 06:21 | justin_smith | if you have (def foo [o]) (def o (bar o)) does not change foo at all - (.mutate o) does change the contents of foo |
| 06:22 | SagiCZ1 | yeah.. so it has no state |
| 06:23 | justin_smith | SagiCZ1: check out some of the alioth shootout haskell code |
| 06:23 | justin_smith | if you want it to, it can definitely work in terms of pure mutation |
| 06:23 | justin_smith | (that just happens to lead to ugly terrible code - but it performs well) |
| 06:24 | SagiCZ1 | i see.. but i dont want ugly code :) |
| 06:24 | justin_smith | I find it informative to compare the ugly ass unidiomatic haskell code, to the more idiomatic ocaml that performs nearly as well |
| 06:25 | blorg | my end goal is make a very "modular"/programable game. since i can do the OOD for games in my sleep its very hard for me to switch to a functional mindset.. but thats the only way to go... |
| 06:26 | blorg | justin_smith: hmm.. what? |
| 06:26 | lvh_ | I'm having some difficulty understanding when to use futures, promises and core.async channels. I have an api for getting something out of a key value store. futures don't seem appropriate because it's not cpu-blocking (although it could be that, because you're wrapping a synchronous API, blocking a thread is really what it has to do) |
| 06:27 | lvh_ | promises feel most appropriate, but everything else in my code already has channels |
| 06:27 | lvh_ | does a channel that will only ever return one thing (an error or a success) and then close make any sense? |
| 06:27 | justin_smith | blorg: what, what? |
| 06:28 | blorg | "ugly ass unidiomatic haskell code, to the more idiomatic ocaml that performs nearly as well" |
| 06:29 | justin_smith | right, on alioth |
| 06:29 | justin_smith | http://benchmarksgame.alioth.debian.org/ pick a benchmark, compare haskell code to ocaml code, and their performance |
| 06:29 | SagiCZ1 | oh.. now i know what alioth is |
| 06:29 | justin_smith | http://benchmarksgame.alioth.debian.org/u64q/haskell.php |
| 06:30 | justin_smith | sorry, this is the link I meant to share http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=all&lang=ghc&lang2=ocaml&data=u64q |
| 06:32 | SagiCZ1 | most of clojure programs are slower than java and some take more lines of code.. thats surprising |
| 06:33 | blorg | justin_smith: both seem ugly to me... |
| 06:37 | blorg | this http://benchmarksgame.alioth.debian.org/u32/program.php?test=binarytrees&lang=racket&id=2 however seems so nicer. and only twice slower |
| 06:49 | blorg | hello glorbon |
| 06:50 | glorbon | hello blorgon |
| 06:54 | SagiCZ1 | are you two, by any chance, each others evil twin? |
| 06:57 | cYmen | justin_smith:Very often you can replace mutation with getting a new object except in cases very there are multiple references to the same thing which is exactly the case when you generally don't want mutation. :) |
| 06:57 | justin_smith | yeah, that's kind of what I was trying to say |
| 06:58 | glorbon | YES WE ARE !! |
| 06:58 | glorbon | (which makes us both evil!) |
| 06:58 | blorg | SO EVIL |
| 07:00 | glorbon | cYmen: u r sayin one can do good OOP? |
| 07:01 | mindbender1 | Is there a clojure library wrapping java.nio? |
| 07:02 | Bronsa | mindbender1: https://github.com/pjstadig/nio |
| 07:02 | cYmen | glorbon: I don't think I said anything about OOP |
| 07:03 | glorbon | ook.. sry then |
| 07:04 | vijaykiran | clear |
| 07:04 | vijaykiran | meha |
| 07:04 | mindbender1 | Bronsa: thanks. |
| 07:04 | Bronsa | np |
| 07:09 | justin_smith | mindbender1: there is also an nio.file wrapper |
| 07:10 | mindbender1 | justin_smith: how can I access it? |
| 07:10 | justin_smith | https://github.com/ToBeReplaced/nio.file I am a contributor, prs welcom |
| 07:11 | mindbender1 | justin_smith: cool, thanks. Checking it out. |
| 07:55 | glorbon | so quiet |
| 07:56 | SagiCZ1 | im listening! |
| 07:58 | glorbon | are you? are . . . you . . . |
| 08:00 | glorbon | ,"lets party" |
| 08:00 | clojurebot | "lets party" |
| 08:00 | glorbon | we agree then |
| 08:03 | glorbon | ,((fn do-u-love-me-clojurebot? [_] (str "YES!"))0) |
| 08:03 | clojurebot | "YES!" |
| 08:03 | SagiCZ1 | ~party |
| 08:03 | clojurebot | Pardon? |
| 08:04 | SagiCZ1 | why are u passing zero to it? |
| 08:04 | glorbon | y not |
| 08:05 | glorbon | idk actually.. |
| 08:05 | glorbon | ,((fn do-u-love-me-clojurebot? [_] (str "YES!"))) |
| 08:05 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval73/do-u-love-me-clojurebot?--74> |
| 08:05 | glorbon | o.. thts y.. |
| 08:05 | glorbon | ,((fn do-u-love-me-clojurebot? (str "YES!"))) |
| 08:05 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: Parameter declaration str should be a vector, compiling:(NO_SOURCE_PATH:0:0)> |
| 08:05 | SagiCZ1 | ,((fn do-u-love-me-clojurebot? [] (str "YES!"))) |
| 08:05 | clojurebot | "YES!" |
| 08:06 | SagiCZ1 | this way |
| 08:06 | glorbon | k |
| 08:06 | glorbon | coolio |
| 08:07 | SagiCZ1 | and btw.. |
| 08:07 | SagiCZ1 | ,(= (str "YES!") "YES!)) |
| 08:07 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading string> |
| 08:08 | glorbon | (#(do % "YES")) |
| 08:08 | SagiCZ1 | ,(= (str "YES!") "YES!")) |
| 08:08 | clojurebot | true |
| 08:08 | glorbon | ((#(do % "YES"))0) |
| 08:08 | glorbon | (#(do % "YES") 0) |
| 08:08 | glorbon | ? |
| 08:08 | glorbon | oh forgot commas |
| 08:08 | glorbon | heh |
| 08:09 | glorbon | ,(#(do % "YES") 0) |
| 08:09 | clojurebot | "YES" |
| 08:11 | hyPiRion | constantly yes. |
| 08:11 | samflores | ,(#(constantly "YES!")) |
| 08:11 | clojurebot | #<core$constantly$fn__4178 clojure.core$constantly$fn__4178@12b700f> |
| 08:12 | glorbon | ,(#(constantly "YES!") 0) |
| 08:12 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval51/fn--52> |
| 08:12 | samflores | ,(doc constantly) |
| 08:12 | clojurebot | "([x]); Returns a function that takes any number of arguments and returns x." |
| 08:12 | glorbon | hmm |
| 08:13 | glorbon | ,((constantly "YES!") 0) |
| 08:13 | clojurebot | "YES!" |
| 08:13 | nathan7 | remember, #() makes a function |
| 08:14 | nathan7 | ,(#(do %& 42) 0) |
| 08:14 | clojurebot | 42 |
| 08:14 | samflores | I always forgot constantly makes a fn :D |
| 08:15 | glorbon | ,(reduce (constantly "YES") ["does" "clj" "love" "me?"]) |
| 08:15 | clojurebot | "YES" |
| 08:15 | glorbon | aww shucks |
| 08:16 | samflores | *forget |
| 08:16 | glorbon | huh? |
| 08:17 | glorbon | (can I add stuff to the bot or is it protected via clojail and such?) |
| 08:17 | hyPiRion | it's semiprotected |
| 08:18 | glorbon | elaborate? |
| 08:18 | andrewchambers | is there a tool for pretty printing edn? |
| 08:22 | hyPiRion | clojure.pprint/pprint ? |
| 08:25 | lvh | What happened to clojure.contrib again? Especially clojure.contrib.base64 |
| 08:25 | lvh | (I want base64 urlencoding and decoding) |
| 08:25 | lvh | Sorry, base64url* |
| 08:26 | lvh | nothing to do with urlencoding; just base64 with a url-safe alphabet :) |
| 08:42 | lvh | argh |
| 08:42 | spradnyesh | if there are multiple expressions (w/ side-effects) in a let body, will they be executed serially or in parallel? |
| 08:42 | lvh | there was *a* library on github that did this right for clojure (base64url enc/dec) |
| 08:42 | spradnyesh | i'm seeing parallel execution, but want serial |
| 08:45 | spradnyesh | for example, in (let [x 1] (do-a) (do-b)) i'm seeing errors which should happen only if do-b is executed before do-a has finished |
| 08:45 | dnolen_ | spradnyesh: serial |
| 08:45 | spradnyesh | i haven't put either in a future/Thread |
| 08:45 | dnolen_ | spradnyesh: then present a minimal case that people can look at - but it sounds implausible |
| 08:45 | spradnyesh | dnolen_: thanks. that is what i expected too; but that's not what i'm seeing :( |
| 08:47 | spradnyesh | do-a cleans-up something from mongodb, and do-b reads from mongodb and processes and writes back. i'm seeing a duplicate key error |
| 08:47 | spradnyesh | also, i get the error back almost instantaneously, whereas do-a should have taken atleast 1-2 sec to complete |
| 08:48 | dnolen_ | spradnyesh: sounds like a problem with a) mongodb b) your mongodb driver |
| 08:48 | spradnyesh | i'm thinking of putting do-a inside a future, and then referencing it from do-b. that should work, right? |
| 08:48 | spradnyesh | dnolen_: i'm using monger-1.7.0 |
| 08:49 | dnolen_ | spradnyesh: I don't know anything about the mongodb but I can say w/ confidence Clojure execution is serial. Look for the problem in more likely sources. |
| 08:49 | spradnyesh | dnolen_: what do you think about my using "future" as a bypass/solution as suggested above? |
| 08:50 | dnolen_ | spradnyesh: sounds ok to me. |
| 08:51 | cYmen | Is it possible that the mongodb call returns immediately because there is no return value it needs to wait for? |
| 08:51 | cYmen | So even though it isn't done it returns already? |
| 08:53 | spradnyesh | cYmen: i don't think so; http://docs.mongodb.org/manual/reference/method/db.collection.update/ says that update returns result of update. but thanks for pointer :) |
| 08:53 | spradnyesh | dnolen_: i'll try that out |
| 08:58 | cYmen | dnolen_: Is it possible that clojure simply runs the commands serially withou waiting for them to return? |
| 09:00 | spradnyesh | found out the issue: do-a has a (map (some-side-effect) some-seq) as it's last expr. this made the some-side-effect lazy. trying to do a dorun on it now |
| 09:03 | cYmen | ah well :) |
| 09:11 | ebaxt | I've been using Stuart Sierra's "Clojure Workflow, Reloaded" based on tools.namespace for over a year now. I've recently started to experience PermGen exceptions when reloading my project. Could this have anything to do with http://dev.clojure.org/jira/browse/CLJ-1152? I haven't looked at the mechanics of tools.namespace reloading so I don't know if it might be related... |
| 09:13 | stuartsierra | ebaxt: Don't know if it's related, but I've certainly experienced PermGen problems when (re)loading large projects (hundreds of source files). |
| 09:14 | stuartsierra | tools.namespace removes namespaces before reloading them, so things like protocols & multimethods should be GC'd. |
| 09:15 | ebaxt | stuartsierra: about 10K loc in 138 files |
| 09:17 | stuartsierra | ebaxt: That might be enough to fill the PermGen, depending on your JVM settings. |
| 09:17 | stuartsierra | See if increasing the PermGen size fixes the problem. |
| 09:17 | ebaxt | stuartsierra: Any PermSize suggestions? Lein repl use :jvm-opts from user profiles right? |
| 09:18 | stuartsierra | ebaxt: Look up the default PermGen size for your JVM, make it bigger, see if that fixes the problem :) |
| 09:20 | ebaxt | stuartsierra: hehe, thx, I'll do that. BTW, we're using some libs that keep state in refs, could that be part of the problem? |
| 09:20 | stuartsierra | ebaxt: don't know |
| 09:21 | ebaxt | k |
| 09:21 | stuartsierra | but I doubt it |
| 09:21 | hyPiRion | ebaxt: not sure how that would affect permgen |
| 09:21 | stuartsierra | it might break in other ways when you try to reload though |
| 09:29 | ebaxt | :jvm-opts ^:replace [] in project.clj will ignore :jvm-opts in .lein/profiles.clj? |
| 09:37 | stuartsierra | ebaxt: not sure; test or try asking later when the U.S. West Coast wakes up :) |
| 09:38 | SagiCZ1 | clojure is trending https://www.google.cz/trends/explore#q=clojure |
| 09:40 | TimMc | Finland, interesting. |
| 09:41 | hyPiRion | Norway whut |
| 09:41 | hyPiRion | I feel like there's like 5 Clojure devs over here |
| 09:41 | llasram | Add one more and it's up 20% |
| 09:42 | Foxboron | hyPiRion: Norwegian? |
| 09:42 | hyPiRion | Foxboron: yes |
| 09:43 | Foxboron | is there actually anyone doing professional CLojure development in Norway? |
| 09:44 | hyPiRion | Foxboron: yeah, pretty sure ebaxt is |
| 09:44 | Foxboron | oh, thats fun. Got a friend who wrote his master thesis in Clojure |
| 09:44 | Foxboron | been dabbling with it since autumn 2012 |
| 09:45 | Foxboron | <- Norwegain aswell (to get that straight) |
| 09:45 | hyPiRion | I am working in Clojure at work. |
| 09:45 | Foxboron | hyPiRion: there was also a Clojure talk at Boosterconf IIRC |
| 09:46 | hyPiRion | Foxboron: oh nice. I know augustl is working with Clojure as well, but not sure if that's professionally or on a hobby basis |
| 09:46 | ebaxt | Foxboron: We are, (small startup ardoq.com) I know a couple of other small ones and I think schibsted (https://github.com/schibsted) |
| 09:47 | Foxboron | ebaxt: thats fun. I had no idea there where places in Norway doing that |
| 09:48 | hyPiRion | Oh, and I think Bekk has a single project in Clojure. But they seem to prefer Scala -- I think they have 3 projects with Scala. |
| 09:48 | ebaxt | Foxboron: There are :) Kodemaker has at least one project, maybe more magnars / augustl ? |
| 09:49 | Foxboron | i know magnars had a Clojure online thingie developing a zombie game |
| 09:49 | Foxboron | hyPiRion: got a friend working at Bekk |
| 09:50 | Foxboron | he is mostly working in Javascript tho |
| 09:51 | hyPiRion | Foxboron: What I feel like is sort of a problem is that we don't have a Norwegian user group for Clojurists. That's probably why people don't see so many of these Clojure projects |
| 09:52 | Foxboron | hyPiRion: yeah, but there is a user group for functional langs in Oslo? |
| 09:53 | ebaxt | hyPiRion: You're based in Trondheim right? |
| 09:53 | hyPiRion | ebaxt: I was until June. Finished my master's then went down to Oslo |
| 09:55 | hyPiRion | Foxboron: yeah, true. But I still don't feel it's easy to figure out who to ask if I were to join a Clojure company. |
| 09:55 | hyPiRion | /s/were/wanted/ |
| 09:57 | ebaxt | hyPiRion: agree, most of the people I know are using Clojure at work I met at http://www.meetup.com/Oslo-Socially-Functional/ |
| 09:59 | hyPiRion | ebaxt: How often are there events with OsloSF? Seems like roughly monthly or so? |
| 10:00 | TimMc | Oslo, San Francisco, California, USA |
| 10:01 | ebaxt | hyPiRion: Every two months aprox. Trying to increase the number of meetings last i heard |
| 10:04 | hyPiRion | ebaxt: cool. I'll try to join and see if I can help out with anything |
| 10:05 | ebaxt | hyPiRion: Good idea :) |
| 11:11 | acagle | buffer 1 |
| 11:15 | mdeboard | false |
| 12:02 | virmundi | Hello. I’ve got a question about naming standards. I’ve got a method that will take a map argument and execute an http call from it. The client gets to pick the HTTP method. So it could be a get or a post. Should the method’s name end with !? |
| 12:04 | bbloom | virmundi: no not really |
| 12:04 | bbloom | virmundi: ! does not mean side effectful |
| 12:04 | bbloom | otherwise entire subsections of your library would have bang on everything |
| 12:04 | justin_smith | do you literally mean a method? Clojure functions are objects. |
| 12:05 | virmundi | justin_smith: I mean function. I try to avoid the OO side of the underlying host. Old terms for a different pardigm and all. |
| 12:05 | virmundi | so the api has create-database! |
| 12:05 | CookedGryphon | the basic rule of thumb is, could you put it in a swap! statement |
| 12:05 | CookedGryphon | i.e. would it matter if it got executed 3 times over instead of one? |
| 12:06 | CookedGryphon | if it would matter, put a bang on it to warn other people |
| 12:06 | TimMc | meh |
| 12:06 | TimMc | I appreciate the thoroughness, but I think that's impractical. |
| 12:06 | bbloom | i probably wouldn't put a ! on create-database |
| 12:06 | bbloom | especially if it's idempotent |
| 12:07 | virmundi | bbloom: since it’s a rest call, the results will change. So POST first time, returns 201. POST a second time on the resource returns a 409 (I think, I just remember not 201). |
| 12:08 | bbloom | virmundi: just use ! to highlight a rare non-transaction-safe method among an otherwise transaction-safe api |
| 12:08 | bbloom | virmundi: if everything is effectful, then nothing is special enough to justify a ! |
| 12:09 | teslanick | What is the actual standard for using ! anyway? I usually use it as a "be careful" or a "this is *really* impure" signifier |
| 12:09 | teslanick | i.e. non-idempotent. |
| 12:09 | justin_smith | &(filter #(re-matches #".*!$" %) (map (comp name first) (ns-publics 'clojure.core))) |
| 12:09 | justin_smith | no lazybot? |
| 12:09 | justin_smith | ,(filter #(re-matches #".*!$" %) (map (comp name first) (ns-publics 'clojure.core))) |
| 12:09 | virmundi | bbloom: I thought that. Things get even weirder if the client uses the async feature of the driver, because that creates a resource for later lookup. |
| 12:09 | clojurebot | ("set-error-mode!" "set-agent-send-executor!" "disj!" "conj!" "pop!" ...) |
| 12:09 | lazybot | java.lang.SecurityException: You tripped the alarm! ns-publics is bad! |
| 12:10 | mpenet | ,(doc pop!) |
| 12:10 | clojurebot | "([coll]); Removes the last item from a transient vector. If the collection is empty, throws an exception. Returns coll" |
| 12:10 | mpenet | ah transient |
| 12:11 | bbloom | (doc persistent) |
| 12:11 | clojurebot | Huh? |
| 12:11 | bbloom | (doc persistent!) |
| 12:11 | clojurebot | "([coll]); Returns a new, persistent version of the transient collection, in constant time. The transient collection cannot be used after this call, any such use will throw an exception." |
| 12:11 | bbloom | the bang doesn't have a firm meaning |
| 12:12 | virmundi | the thing that made me wonder about the ! is that clojure.java.jdbc has insert! and execute! where as query is normal. |
| 12:12 | bbloom | it can be effectful, or non-idempotent, or dangerous, or whatever |
| 12:12 | bbloom | it's just to make it stand out when such an effect may not be expected |
| 12:12 | bbloom | virmundi: use your discretion |
| 12:12 | virmundi | Sounds fair. I appreciate the advice from all involved. |
| 12:13 | stuartsierra | There's no universal rule for `!` but it sometimes means "modifies mutable state", e.g. `swap!` |
| 12:13 | bbloom | (doc alter) ; stuartsierra |
| 12:13 | clojurebot | "([ref fun & args]); Must be called in a transaction. Sets the in-transaction-value of ref to: (apply fun in-transaction-value-of-ref args) and returns the in-transaction-value of ref." |
| 12:13 | bbloom | really, it means "pay attention, dummy" :-) |
| 12:13 | virmundi | :) |
| 12:14 | justin_smith | sorry guys, I got a massive lag suddenly |
| 12:14 | justin_smith | virmundi: in that case, (regarding avoiding the OO side of the underlying host), a function is self contained, a method belongs to some object |
| 12:15 | virmundi | justin_smith: I’m know. I’m jst not using precise language. Method is a hold over from the Java days. I first developed in VB so it took me a while to say method rather that function or sub. |
| 12:15 | stuartsierra | bbloom: like I said, not universal, also 'alter-var-root' |
| 12:16 | virmundi | justin_smith:I’ll try to be more precise. |
| 12:17 | justin_smith | np - not trying to be pedantic, when I first saw your question I really didn't know if you were talking about a normal function or an object made via perhaps gen-class with a method on it |
| 12:18 | justin_smith | and of course I use the relatively imprecise term "function" when really I mean "object implementing IFn" |
| 12:18 | noncom | are bitwise operations like (bit-shift-left), (bit-and) and the likes on ints in Clojure as fast as in Java ? or do we pay for some boxing and stuff ? |
| 12:18 | noncom | do i better do bitwise stuff in java ? |
| 12:18 | noncom | if i care for speed.. |
| 12:18 | justin_smith | noncom: depends on how well things are hinted and / or hotspot compiled |
| 12:19 | noncom | uh.. |
| 12:19 | justin_smith | noncom: there is a library that warns about numeric boxing and reflection... one moment |
| 12:23 | justin_smith | noncom: ztellman/primative-math provides reflection and boxing warnings (normal warn-on-reflection won't actually show this) https://github.com/ztellman/primitive-math |
| 12:24 | noncom | thanks :) |
| 12:24 | justin_smith | if you aren't boxing or reflecting, and you turn on *unchecked-math*, the numeric part of your code should be competitive with java |
| 12:25 | noncom | i still have to master all this.. |
| 12:26 | stuartsierra | Just write Java. |
| 12:26 | noncom | :) |
| 12:28 | technomancy | shell out to bc |
| 12:31 | rhg135 | inlime assembly 2.0 |
| 12:31 | rhg135 | inline* |
| 12:32 | justin_smith | create a REST service to do arithmetic, implemented in fortran |
| 12:32 | rhg135 | whoa |
| 13:04 | bridgethillyer | It’s an interesting aspect of the Clojure ecosystem that it lives in the Java world |
| 13:04 | bridgethillyer | And I often wonder about the experience of people who are coming to Clojure with no Java experience |
| 13:04 | justin_smith | bridgethillyer: that was me - I had lisp experience but no java experience |
| 13:05 | bridgethillyer | Some things must be Totally Mysterious to them, and my guess is that is not a very comfortable experience |
| 13:05 | technomancy | same |
| 13:05 | bridgethillyer | And I just had an ah-hah! lightbulb moment about this |
| 13:05 | justin_smith | java is tedious, but not that surprising (most of the time) |
| 13:05 | noprompt | why doesn't metadata for clojurescript namespaces get added to *cljs-ns*? https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L1134-L1135 |
| 13:05 | bridgethillyer | I am a {retired? reformed? defeated?} java programmer |
| 13:05 | technomancy | the main thing that confused me early on was the JDK's IO stuff |
| 13:05 | technomancy | but that was before clojure.java.io existed |
| 13:06 | bridgethillyer | So I have a LOT of experience with Maven |
| 13:06 | justin_smith | similar to man pages, javadoc is terrible to read, but once you learn how you can get the info you need quickly |
| 13:06 | bridgethillyer | But if you are not a Java programmer, likely you have little experience with Maven |
| 13:06 | mdrogalis | Maven will steal your lunch money. :/ |
| 13:06 | noprompt | i probably should have aimed that at dnolen_ or bbloom |
| 13:06 | bridgethillyer | So here’s a tidbit of Maven know-how that comes in handy: |
| 13:07 | bridgethillyer | Releases you just *get* with leiningen |
| 13:07 | bridgethillyer | Voila they magically appear |
| 13:07 | aperiodic | technomancy: do you know when the stack overflow on dependency resolution issue started? |
| 13:08 | bridgethillyer | But SNAPSHOTS you actually have to go get yourself or add Sonatype repository |
| 13:08 | technomancy | aperiodic: AFAIK it's been around forever, but :pedantic? just got turned on by default in 2.4.3 |
| 13:09 | bridgethillyer | So if your library is unreleased, someone is going to be totally mystified why it’s not there when they try to require it |
| 13:09 | aperiodic | technomancy: ok, so can it be worked around by turning pedantic off? |
| 13:09 | technomancy | aperiodic: I think so |
| 13:09 | technomancy | aperiodic: if not, try master and let me know |
| 13:10 | mdrogalis | bridgethillyer: Yeah, it's mildly infuriating. D: |
| 13:10 | technomancy | bridgethillyer: that's not any different from ruby |
| 13:10 | bridgethillyer | Anyhow, just found it interesting to actually uncover one of those weirdnesses about the non-Java experience. Generally I wouldn’t see them since I don’t have the perspective |
| 13:10 | aperiodic | technomancy: it's definitely fixed in master, I just misunderstood when you said it was a 2.4.3 issue yesterday (since my colleague just reproduced on 2.3.4) |
| 13:11 | bridgethillyer | technomancy: Well, it’s helpful to be aware of it |
| 13:11 | technomancy | aperiodic: gotcha, cool |
| 13:11 | technomancy | bridgethillyer: actually now I'm curious... in what language do you get access to unreleased libs without asking for them specifically? |
| 13:11 | technomancy | I guess you mean in systems that work from git directly? |
| 13:11 | bridgethillyer | technomancy: If you’re aware of it, you can do things to help orient non-Java people (assuming they are a big enough population to serve that way… I assume they are) |
| 13:12 | technomancy | bridgethillyer: I'm skeptical this has anything to do with java/non-java |
| 13:13 | bridgethillyer | technomancy: fair point; I guess it’s more that you don’t know *how* it happens because the machinery is specific to Java |
| 13:13 | justin_smith | my big surprise when I was new to clojure: the fact that you didn't install things via some analog of git clone, configure, make, make install |
| 13:13 | bridgethillyer | technomancy: So it is mysterious and difficult to diagnose/see |
| 13:13 | rhg135 | juarez, thats just c(++) |
| 13:14 | rhg135 | damn tab |
| 13:14 | bridgethillyer | technomancy: I’m not suggesting that anything that is happening is the wrong way to do it |
| 13:14 | rhg135 | i can never get used to a chan with so many ppl |
| 13:14 | rhg135 | justin_smith*** |
| 13:14 | bridgethillyer | technomancy: I’m pointing out the user experience of it |
| 13:15 | technomancy | bridgethillyer: sure, it's always difficult to see things from the perspective of someone new. |
| 13:16 | bridgethillyer | technomancy: *exactly* and that is what I was able to experience |
| 13:16 | technomancy | bridgethillyer: that said, most snapshots are on clojars; contrib libs seem to like going out of their way to make things more complicated. |
| 13:16 | justin_smith | it's not just c - many languages have clone / build / install for libs (at least for the core language - this includes all the versions of common lisp and scheme I know of, ocaml, haskell...) |
| 13:16 | bbloom | noprompt: namespaces are not reified at runtime, so there's no way to get to the metadata from cljs |
| 13:16 | bbloom | noprompt: do you need it form a macro? |
| 13:16 | bridgethillyer | technomancy: yes, exactly… which makes for an even more mysterious experience |
| 13:16 | bbloom | s/form/from |
| 13:16 | noprompt | bbloom: yep. it's the macro use case. |
| 13:16 | technomancy | justin_smith: that's just legacy ocaml stuff; these days everything is done from opam. IIUC the same is true of haskell/cabal. |
| 13:16 | bbloom | noprompt: in that case, it's probably just an oversight. i can't speak for dnolen_, but i'd say patch is likely welcome |
| 13:16 | technomancy | justin_smith: also CL has quicklisp now, racket has had packages forever, chicken has eggs... |
| 13:17 | bridgethillyer | So I think the lesson to be taken away for library (cough contrib) authors is: if your library is unreleased, just go ahead and put this in your README: |
| 13:17 | justin_smith | technomancy: but for getting ocaml itself |
| 13:17 | technomancy | justin_smith: opam manages compiler installs too |
| 13:17 | justin_smith | technomancy: what was new is the language itself being managed by the package manager |
| 13:17 | bridgethillyer | To use Clojure and contrib library SNAPSHOTS in your Leiningen project, add the following to your project.clj: :repositories {“sonatype… |
| 13:17 | bbloom | noprompt: just add the metadata as :meta here: https://github.com/clojure/clojurescript/blob/245de2e752f638f5d06527a1cafed26b0d8d0da8/src/clj/cljs/analyzer.clj#L1166 |
| 13:17 | bridgethillyer | So easy, makes things much easier for a set of your users |
| 13:17 | justin_smith | technomancy: and somehow I managed to be ignorant of the various language package managers for the most part |
| 13:18 | rhg135 | those exist?? |
| 13:18 | lazybot | rhg135: Uh, no. Why would you even ask? |
| 13:18 | aperiodic | technomancy: FYI turning pedantic off does work around the stack overflow |
| 13:18 | rhg135 | shut up lazybot lol |
| 13:19 | noprompt | bbloom: awesome. i'll work up a patch. |
| 13:20 | noprompt | thanks. |
| 13:20 | technomancy | man, rebar. =( |
| 13:20 | justin_smith | technomancy: regardless of my relative ignorance, I was used to a paradigm where to try a language I could find the source, configure make and install, and then run it, without also needing to figure out a language specific dep management tool or packaging system or construct a "project", and this was my biggest surprise as a newcomer to clojure |
| 13:21 | technomancy | I unknowningly pulled in a patch that changed the dependencies, and suddenly I got test failures due to needing a newer version that I had no idea about. no dep updates, no warning, nothing. |
| 13:21 | technomancy | justin_smith: ah, gotcha |
| 13:23 | justin_smith | when my friend told me I had to download a shell script that downloaded another shell script and executed it and that was the right way to do clojure I was like "WTF YO" |
| 13:24 | dnolen_ | noprompt: missing the backlog what's up? |
| 13:25 | noprompt | dnolen_: i was asking about metadata for *cljs-ns*. apparently it never gets used. for macro use cases that metadata is useful. |
| 13:25 | dnolen_ | noprompt: what kind of metadata? |
| 13:25 | noprompt | dnolen_: namespace metadata. |
| 13:26 | dnolen_ | noprompt: yes I never use this - what goes there that's missing? |
| 13:27 | noprompt | dnolen_: i'm writing a macro and i was hoping that i could read that metadata from *cljs-ns* but the only information that's there is :line, :column, etc. |
| 13:27 | dnolen_ | noprompt: but what else is supposed to be there? I'm asking you a question because I don't know, hint, hint :) |
| 13:28 | bbloom | dnolen_: you can put arbitrary metadata on namespaces |
| 13:28 | bbloom | ,(meta (the-ns 'clojure.core)) |
| 13:28 | clojurebot | {:doc "Fundamental library of the Clojure language"} |
| 13:29 | bbloom | ,(ns ^:omg my-ns) |
| 13:29 | clojurebot | nil |
| 13:29 | bbloom | ,(meta (the-ns 'my-ns)) |
| 13:29 | clojurebot | {:omg true} |
| 13:29 | dnolen_ | ah right, yeah patch welcome that's an easy one |
| 13:30 | noprompt | dnolen_: cool, bbloom mentioned placing it here: https://github.com/clojure/clojurescript/blob/245de2e752f638f5d06527a1cafed26b0d8d0da8/src/clj/cljs/analyzer.clj#L1166 |
| 13:30 | dnolen_ | noprompt: you probably want to put it here https://github.com/clojure/clojurescript/blob/245de2e752f638f5d06527a1cafed26b0d8d0da8/src/clj/cljs/analyzer.clj#L1160 |
| 13:30 | dnolen_ | and we can dupe it into the analysis map as well |
| 13:31 | noprompt | dnolen_: cool, initially that's where i thought it might go. |
| 13:32 | noprompt | dnolen_: alrighty, well i'll work up a patch. fortunately i work with someone who knows the whole jira process (which i've been neglecting to learn). this'll get my feet wet. |
| 13:32 | noprompt | dnolen_, bbloom: thanks for the help. :) |
| 13:32 | mindbender1 | where the issue tracker for org.clojure-andriod/clojure? |
| 13:33 | mindbender1 | is the same for org.clojure/clojure? |
| 13:39 | toxmeister | clojars currently gives HTTP 500 (not sure if that's the best place to mention here...) |
| 13:40 | loliveira | hi, congomongo or monger? |
| 13:41 | Bronsa | toxmeister: it's a known issue with the homepage: https://github.com/ato/clojars-web/issues/235 |
| 13:43 | toxmeister | bronsa: thx, it seems deploys are broken too… getting checksum failures. was going to double check my uploaded keys, but that will have to wait until the UI is fixed again |
| 13:43 | arrdem | loliveira: whichever, they both work fine |
| 13:45 | loliveira | arrdem: thank you. I will try monger. I’ve been using congomongo since forever and I ‘m wondering if I’d like monger. |
| 13:46 | arrdem | loliveira: I've used congomongo a before, just looked at monger and it doesn't look fundamentally different. |
| 13:47 | justin_smith | ~mongodb |
| 13:47 | clojurebot | mongodb is an ORM for mmap |
| 13:47 | schmee | can `^:const` be used with arrays, like this? (def ^:const foo [6 3 0 7 4 1 8 5 2]) |
| 13:47 | loliveira | arrdem: ty |
| 13:48 | schmee | I read the it only works with "primitive values", but I'm unsure of what that means |
| 13:48 | justin_smith | schmee: primitives are things in the jvm that are not objects |
| 13:48 | schmee | ahh, so int bool and the likes. I guess that const does nothing for arrays then? |
| 13:48 | justin_smith | http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html |
| 13:49 | justin_smith | right, an array is an object (as are vectors, and your example was a vector, not an array) |
| 13:50 | schmee | yeah, I always mix up vectors and arrays, using many different programming languages certainly doesn't help :P |
| 13:50 | schmee | thanks for the info |
| 13:50 | justin_smith | schmee: though I think :const can actually help on vars for non-primitive values, but Bronsa or arrdem would be better people to ask about the ins and outs of that |
| 13:51 | arrdem | Bronsa will know better than I do. I remember playing around with ^:const a while back and there is a bytecode difference in evaluating const tagged symbols but I don't think it's significant. |
| 13:52 | arrdem | s/symbols/vars/g ;; arguably pedantic |
| 13:53 | schmee | ok, I think I'll leave them out in that case |
| 13:56 | Bronsa | schmee: ^:const can be used with anything that has a clojure literal representation, but there are some issues; the only thing I'd feel safe using ^:const with are: numbers, strings and keywords |
| 13:58 | alexbaranosky_ | Bronsa: curious what the issues are |
| 14:06 | Bronsa | alexbaranosky metadata might or might not be preserved |
| 14:07 | alexbaranosky_ | Bronsa: thx |
| 14:09 | toxmeister | bronsa: I actually just chased a bug in related to ^:const attached to deftype instances a few hours ago. it behaved all fine until i started implementing a hash cache mechanism using mutable fields. then suddenly got completely weird compiler errors about missing field names. removing ^:const from some of the "const" preset instances, removed the issue... |
| 14:10 | Bronsa | yeah, don't use ^:const for deftypes |
| 14:11 | hiredman | don't use :const |
| 14:11 | hiredman | toxmeister: why are you using :const at all? |
| 14:11 | Bronsa | hiredman: that's a bit too much :), it's perfectly fine for numbers/strings/keywords |
| 14:12 | hiredman | Bronsa: but doesn't throw an error or warning for anything else |
| 14:12 | alexbaranosky_ | what spots does the perf benefit of const really add up to anything substantial enough to matter? |
| 14:12 | Bronsa | right, it just explodes in your face later |
| 14:13 | hiredman | will be better off having maintainable code that doesn't use it |
| 14:13 | Bronsa | alexbaranosky_ (def ^:const x 23), you can use x as a primitive |
| 14:14 | hiredman | alexbaranosky_: I am sure there are cases where it matters, I suspect the majority of (ab)use is people who sprinkle it on as magic pixy dust |
| 14:16 | toxmeister | hiredman: i read somewhere (ages ago) that it would provide some minor perf difference, but I learned since that this doesn't make much sense for non-primitives |
| 14:17 | hiredman | well, there is a data point |
| 14:18 | hiredman | (I am counting that as one for magic pixy dust) |
| 14:19 | alexbaranosky_ | pixie dust driven development |
| 14:22 | chenglou | what's a good beginner clojure/clojurescript rss feed to follow? |
| 14:23 | hiredman | /win 19 |
| 14:25 | kqr | I don't know who I talked to before, but I've tried the java interop a little more now and I'm really starting to like it |
| 14:26 | kqr | it was just unfamiliarity talking before when I was unsure about how good it was |
| 14:27 | samflores | quick survey: which one is more readable (or idiomatic)? https://gist.github.com/samflores/2c68a9bcb6b4742d6760 |
| 14:28 | kqr | samflores, for so few function calls, 1 works |
| 14:28 | kqr | samflores, otherwise 3 |
| 14:29 | amalloy | samflores: i like 3. but i'd surround the chained calls with parens, like (display-board!). i don't like that those are optional |
| 14:29 | loliveira | samflores: 3, but i liked 4 |
| 14:29 | amalloy | i definitely hate 2. 10 is a bad place to start the arrow |
| 14:29 | kqr | I agree with amalloy on that |
| 14:29 | alexbaranosky_ | i do 3 |
| 14:30 | Jaood | indent 1 :P |
| 14:30 | arrdem | M-x cljr-thread-first-all RET :P |
| 14:30 | amalloy | kqr: on which? hating 2, or using parens? |
| 14:30 | alexbaranosky_ | or indented 1 |
| 14:30 | kqr | amalloy, I was about to say "the former" but you made it tricky by exchanging the order of them |
| 14:31 | amalloy | haha |
| 14:31 | kqr | amalloy, hating 2 |
| 14:31 | amalloy | i try to make your answers to my questions as ambiguous as possible so i can pick which stance i think you're taking |
| 14:31 | kqr | that's a good strategy |
| 14:32 | kqr | I don't mind the no parens... with parens it looks more like actual function calls |
| 14:32 | kqr | like, fully saturated with arguments and all |
| 14:32 | Jaood | this wins: https://www.refheap.com/89513 |
| 14:32 | kqr | which is probably not the intention |
| 14:32 | kqr | Jaood, i think so too for so few levels of nesting |
| 14:37 | amalloy | kqr, Jaood: http://stackoverflow.com/a/12716708/625403 is a summary of my oft-linked-to stance on how to use -> |
| 14:37 | amalloy | obviously you don't have to agree, but it's a useful viewpoint to be aware of |
| 14:39 | samflores | good point |
| 14:40 | elben | is there an easy way of pasting in strings with double-quotes into the REPL? e.g. my copy buffer is ‘“hello”’ and I want (def s “\”hello\””) |
| 14:40 | SagiCZ1 | and know i know what amalloy looks like |
| 14:40 | SagiCZ1 | *now i know |
| 14:41 | justin_smith | elben: in a naked repl or in an editor? |
| 14:41 | elben | naked, though i also use vim-fireplace |
| 14:41 | amalloy | SagiCZ1: well, you know what i looked like when i took my gravatar picture like...four years ago |
| 14:42 | amalloy | elben: not really |
| 14:42 | justin_smith | elben: if you put your paste in a temporary file, slurp should get you the right result |
| 14:42 | SagiCZ1 | amalloy: i bet u look completely different now |
| 14:43 | technomancy | elben: step 1: don't use smart quotes. =) |
| 14:43 | justin_smith | bonus points: make a small shell script that takes the paste buffer, puts it in a temp file, then puts the path to the temp file in the paste buffer |
| 14:43 | elben | technomancy: that’s just my IRC client :) |
| 14:43 | amalloy | technomancy: or *do* use smart quotes, and then pasting them mid-string won't be an issue |
| 14:43 | amalloy | next-level thinking here |
| 14:44 | elben | i really do like python’s triple-quote, though. wonder if http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes is going anywhere |
| 14:44 | amalloy | elben: no, it's not |
| 14:44 | TimMc | I have an utterly terrible answer for you. |
| 14:44 | technomancy | amalloy: brilliant |
| 14:44 | TimMc | Are you ready? |
| 14:44 | technomancy | I would really love to have «guillemot» support work like triplequoting in python though |
| 14:45 | TimMc | (def input (javax.swing.JOptionPane/showInputDialog "paste it")) |
| 14:45 | kqr | hahaha |
| 14:45 | kqr | that's actually not a bad answer |
| 14:45 | TimMc | Terrible, but practical. |
| 14:45 | amalloy | TimMc: well, i was considering suggesting (read-line) |
| 14:45 | TimMc | I don't know if it handles multiline. |
| 14:45 | arrdem | (def foo (slurp (io/resource "docs/user/foo")) ...) |
| 14:45 | amalloy | rich's opinion, i believe, is that you shouldn't be embedding wacky strings in your source code - anything weird you need should be in a resource file anyway, and as a side effect it then doesn't matter if it has " in it |
| 14:46 | amalloy | arrdem: justin_smith suggested that first |
| 14:46 | rhg135 | what's wrong with ctrl-v assuming your term is nice |
| 14:46 | elben | TimMc: amazing |
| 14:46 | justin_smith | rhg135: you don't get proper escaping |
| 14:46 | rhg135 | ah |
| 14:46 | rhg135 | justin_smith, im with rich/amalloy |
| 14:46 | elben | amalloy: the common use case i have everyday is working with JSON in the repl |
| 14:46 | rhg135 | keep it elsewhere |
| 14:47 | amalloy | the problem with TimMc's suggestion is that anyone who uses it on macos will be like "argh there's a dang system tray icon for my java process now" |
| 14:47 | justin_smith | rhg135: my answer also involved putting the wacky string in a file first |
| 14:47 | technomancy | there should be an M-x clojure-escape-yank though in elisp |
| 14:47 | justin_smith | technomancy: string-edit-at-point is handy, and works recursively |
| 14:47 | technomancy | nice |
| 14:47 | TimMc | amalloy: read-line would interact badly with the REPL, yeah? |
| 14:48 | justin_smith | comes with the string-edit package |
| 14:48 | amalloy | TimMc: if you have a lame repl |
| 14:48 | TimMc | shots fired |
| 14:48 | arrdem | amalloy: oh that wasn't apparent to me. |
| 14:48 | amalloy | (as, for example, i do) |
| 14:48 | amalloy | but it works fine in lein repl, for example |
| 14:48 | amalloy | which is what he was asking about |
| 14:48 | TimMc | (defn lame? [repl] (not= repl dr-racket)) |
| 14:49 | kqr | what's the difference between when-let, if-let and if-some? |
| 14:49 | amalloy | TimMc: (def lame? (complement #{dr-racket})) |
| 14:50 | justin_smith | kqr: when-let has no else clause |
| 14:50 | kqr | i see |
| 14:50 | justin_smith | and if-some doesn't exist in my currently open repl, dunno what it is |
| 14:50 | justin_smith | (doc if-some) |
| 14:50 | clojurebot | "([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is not nil, evaluates then with binding-form bound to the value of test, if not, yields else" |
| 14:50 | kqr | new in 1.6 apparently |
| 14:51 | amalloy | TimMc: you know what's cool about my repl, though? (swank.core/read-from-emacs-minibuffer "What is your name? ") |
| 14:51 | justin_smith | kqr: looks like it replaces (if-let [foo bar] (let [...])) by letting you put other bindings after the conditional one |
| 14:51 | technomancy | amalloy: nrepl-discover has that |
| 14:52 | kqr | justin_smith, where do you gather that? |
| 14:52 | technomancy | except hypothetically-portable |
| 14:52 | kqr | it's not obvious from the documentation i've found |
| 14:52 | amalloy | technomancy: does nrepl-discover actually get used? i never hear anyone but you talk about it |
| 14:52 | kqr | though i'm still new so I might be missing something obvious |
| 14:52 | amalloy | but i don't know about the ecosystem |
| 14:52 | justin_smith | kqr: never mind, I was misled by the name "bindings" |
| 14:52 | kqr | ah |
| 14:53 | technomancy | amalloy: I keep mentioning it in hopes that someone who actually still uses clojure will realize how cool it is |
| 14:53 | kqr | justin_smith, it looks like when-some tests for (not (nil? p)) |
| 14:53 | kqr | justin_smith, while let-if tests for true |
| 14:53 | kqr | justin_smith, possibly |
| 14:54 | TimMc | elben: (def input (clojure.string/join \newline (take-while (complement empty?) (repeatedly read-line)))) will do multiline input, stopping at the first empty line. |
| 14:55 | TimMc | From standard lein repl, that is. |
| 14:57 | hlprmnky | newbie question time |
| 14:58 | hlprmnky | I have required core.async like so in my ns decl: [clojure.core.async :as async] |
| 14:58 | elben | TimMC, interestingly that only allows 1024 chars to be pasted in at a time? |
| 14:58 | hlprmnky | yet when I run a repl in that namespace, things like merge are clojure.core.async/merge, not clojure.core.merge as I would expect |
| 14:58 | Jaood | technomancy: was that phrase a pun? re:"someone who actually still uses clojure" |
| 14:59 | technomancy | Jaood: not intentionally? |
| 14:59 | amalloy | hlprmnky: did you actually :require it, or did you :use it? |
| 14:59 | hlprmnky | (e.g., (doc merge) returns the docstring for async/merge, not core/merge, and (merge {} {:a “foo”}) returns a channel, or dies because it can’t merge a keyword |
| 14:59 | Jaood | technomancy: :) |
| 14:59 | hlprmnky | amalloy, I don’t have a :use block for any of my namespaces |
| 15:00 | amalloy | mmmm. paste your ns form then, i guess |
| 15:00 | amalloy | technomancy: king of puns so subtle even he doesn't get them |
| 15:00 | amalloy | (i don't either) |
| 15:00 | hiredman | hlprmnky: you are likely using :use insteaad of :require |
| 15:01 | hiredman | oh |
| 15:01 | hiredman | I see that was already said |
| 15:01 | hlprmnky | oh haha |
| 15:01 | hiredman | (old repl) |
| 15:01 | hlprmnky | no, but I am doing something equally dumb |
| 15:01 | amalloy | ah, or an old repl, sure |
| 15:01 | justin_smith | kqr: frankly, I can't make if-some do anything if-let would not do |
| 15:01 | amalloy | justin_smith: try (if-some [x false] true false) |
| 15:01 | amalloy | vs if-let |
| 15:01 | justin_smith | ,(if-some [a false] :yes :no) |
| 15:01 | clojurebot | :yes |
| 15:01 | justin_smith | ahh |
| 15:01 | justin_smith | there we go |
| 15:02 | hlprmnky | no but I do still have (:refer-clojure :exclude [map reduce into …etc.]) from before I decided that I wanted the core available and async off to the side |
| 15:02 | hlprmnky | amalloy: thanks for asking me to paste the ns and therefore inducing me to *actually read the whole thing again* |
| 15:02 | hiredman | that in no way explains why you would get core.asyncs merge instead of clojure cores |
| 15:03 | kqr | is there anyone here who uses vim and can recommend something to edit expressions? |
| 15:04 | hlprmnky | if I have excluded merge in that statement, and then :require [clojure.core.async :refer :all :as async], what would the expected value of ‘merge’ be? |
| 15:04 | Jaood | kqr: evil-mode :P |
| 15:05 | arrdem | hlprmnky: :as async will create async/* bindings, :refer :all will refer all symbols from core.async with no prefixes |
| 15:05 | kqr | Jaood, that's just evil |
| 15:05 | hlprmnky | The whole reason I decided to move to having :as async in there was that I didn’t fully understand what :refer-clojure was doing and made the conscious choice to not muck with it now |
| 15:05 | hlprmnky | arrdem: Ah! (also: d’oh) |
| 15:05 | hiredman | hlprmnky: :refer :all is the same as :use basically |
| 15:05 | amalloy | hlprmnky: :refer :all! you left out the key point |
| 15:06 | hlprmnky | I did |
| 15:06 | rhg135 | kqr, paredit.vim |
| 15:06 | hlprmnky | I need to go reread that 8th light blog post about how to know what on earth I am doing with use, require, etc. |
| 15:06 | rhg135 | that's what i used |
| 15:07 | Ven | kqr: evil-mode and slime :P |
| 15:07 | amalloy | c'mon you guys, vim has fine clojure tooling. you don't have to switch to emacs |
| 15:07 | catern | yes you do |
| 15:07 | catern | switch to emacs |
| 15:07 | amalloy | ask tpope or Raynes or something, those being the two vimmers i can think of at this moment |
| 15:08 | technomancy | no, emacs is ridiculous |
| 15:08 | hlprmnky | I was doing it right in <project>.core (just [clojure.core.async :as async], calls to (async/*)), doing it wrong in <project>.system, which hilariously over time has lost all its uses of async as I refactored stuff into functions in core |
| 15:08 | catern | at least it's not vim, regards ex-vim-user |
| 15:08 | kqr | rhg135, hm I also heard about another one that was supposedly better, but I can't for the life of me remember the name |
| 15:09 | justin_smith | kqr: I assume you are using fireplace? |
| 15:09 | rhg135 | amalloy, no lighttable |
| 15:09 | rhg135 | i USED to use vim |
| 15:10 | virmundi | I use to use Light Table, now I use vim |
| 15:10 | kqr | justin_smith, not yet, but that's in the pipes as well |
| 15:10 | virmundi | LT takes 1 gb of ram. |
| 15:10 | aperiodic | kqr: http://www.vim.org/scripts/script.php?script_id=3998 |
| 15:10 | amalloy | rhg135: i don't know what i've said that you're disagreeing with? i don't think i addressed you, or said anything about what editor you're using |
| 15:10 | rhg135 | i have a 3tb hdd |
| 15:10 | rhg135 | if i needed more i could swap |
| 15:11 | rhg135 | im not disagreeing |
| 15:11 | rhg135 | vim was nice and i use it when i don't have x for lt |
| 15:12 | kqr | ah |
| 15:12 | kqr | the other alternative is vim-sexp |
| 15:13 | kqr | which is apparently made with clojure in mind |
| 15:13 | kqr | I don't know if paredit is |
| 15:14 | schmee | kqr: vim-surround gets the job done |
| 15:14 | aperiodic | paredit.vim is aware of clojure but not made only for clojure |
| 15:14 | schmee | https://github.com/tpope/vim-surround |
| 15:15 | schmee | kqr: + a whole lot of {command}ab and %{command} |
| 15:18 | TimMc | catern: Don't tell other people to switch editors just because you didn't like it. That's absurd. |
| 15:19 | aperiodic | kqr: if vim-sexp treats quotes exactly like parens and square braces, and supports the majority of the operations that paredit.vim does, let me know! |
| 15:20 | catern | TimMc: huh? I just have their best interests at heart, I was a diehard vim user for a long time |
| 15:20 | aperiodic | kqr: my main gripe with paredit.vim is it'll let you wrap quotes but not strip them |
| 15:20 | kqr | aperiodic, isn't that what you have vim-surround for? |
| 15:21 | technomancy | switching to emacs at the same time you're learning clojure is a pretty good way to get frustrated and give up. |
| 15:21 | aperiodic | kqr: yeah, I should probably get that |
| 15:21 | alloyed | aperiodic: vim-sexp will wrap quotes as you'd expect, not sure about stripping because I always use vim-surround instead |
| 15:21 | brainproxy_ | technomancy: it's not *that* bad |
| 15:21 | alloyed | using tpopes mappings for vim-sexp make them feel like two sides of the same coin |
| 15:23 | TimMc | brainproxy_: I agree with technomancy from personal experience on this. |
| 15:23 | TimMc | Learning a new language and a new, powerful editor at the same time is just asking for sadness. |
| 15:23 | kqr | haha |
| 15:23 | kqr | either way |
| 15:23 | kqr | I've tried emacs for a few months |
| 15:23 | amalloy | TimMc: i learned them both at the same time and had fun with it, but i wouldn't recommend it as a strategy. certainly not to someone who specifically asked for help with a different editor |
| 15:23 | kqr | and I'd really like to like it |
| 15:23 | TimMc | *Especially* if you try to use integration features like SLIME. |
| 15:23 | kqr | but it's just not for me |
| 15:23 | emaphis | notepad and clojure is sadness too. |
| 15:24 | danielszmulewicz | Emacs is for life. Clojure, who knows? |
| 15:24 | kqr | I didn't even know editor wars were still a thing |
| 15:24 | TimMc | kqr: Some people are still fighting that war. It's like those Japanese soldiers on the islands after WWII. |
| 15:25 | rpaulo | there's just one war |
| 15:25 | rpaulo | emacs vs vi{,m} |
| 15:25 | amalloy | don't forget bash vs everyone else, since you had to bring in {,m} |
| 15:26 | amalloy | (obviously not an editor, but pretty similar kinds of wars) |
| 15:26 | rhg135 | just use vim if you know it, emacs if you know it, or lt if you know neither |
| 15:26 | justin_smith | does anyone seriously defend vi[^m]* ? I prever non-vim vi, but I am only a casual vi user |
| 15:26 | amalloy | but i agree the editor wars are silly. use what you know, and always learn more things |
| 15:27 | TimMc | justin_smith: Such as vixjohyvwaw? |
| 15:27 | amalloy | TimMc: visudo |
| 15:27 | TimMc | ah, ok |
| 15:27 | justin_smith | TimMc: nvi, elvis, plain vi |
| 15:27 | rhg135 | visudo actually calls EDITOR |
| 15:28 | justin_smith | vim overrides things like ## and ~ which I acutally like to use when doing a quick config file edit |
| 15:28 | rhg135 | gentoo sets it to nano by default xD |
| 15:28 | danielszmulewicz | What is the editor that hipsters want to be seen with? |
| 15:28 | justin_smith | rhg135: so does debian |
| 15:28 | rhg135 | D: |
| 15:29 | rhg135 | it's a virus |
| 15:29 | rhg135 | or plague |
| 15:29 | rhg135 | to be less ambigous |
| 15:29 | aztak | danielszmulewicz: it used to be Atom, right? |
| 15:29 | justin_smith | danielszmulewicz: vintage TECO |
| 15:29 | danielszmulewicz | haha. |
| 15:29 | justin_smith | it's the heavy vinyl pressing of the editor world |
| 15:30 | TimMc | rhg135: Confirmed: https://en.wikipedia.org/wiki/Nanoviridae |
| 15:30 | emaphis | hipsters use ed |
| 15:30 | rhg135 | i was joking... |
| 15:30 | rhg135 | but wow ik it! |
| 15:30 | aztak | hehe... about editors: https://www.kickstarter.com/projects/1203633826/notepad-conf |
| 15:31 | kqr | haha |
| 15:32 | kqr | all I can think of is how notepad fails badly when it comes to LF line endings |
| 15:32 | justin_smith | I actually logged into and tried the vms system hosted by sdf, and used TECO just to see what it would be like |
| 15:32 | emaphis | wow, $171, it's a thing. |
| 15:32 | justin_smith | I actually liked the vms versioning system (but hated the shell) |
| 15:33 | rhg135 | i hope it's a joke |
| 15:33 | noprompt | bbloom, dnolen_: i'm trying to write a test for the patch we talked about earlier but i run in to an error: IllegalStateException Can't change/establish root binding of: *cljs-ns* with set clojure.lang.Var.set (Var.java:221) |
| 15:33 | bbloom | ,(def x 1) |
| 15:33 | clojurebot | #'sandbox/x |
| 15:33 | bbloom | ,(set! x 2) |
| 15:33 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: x with set> |
| 15:34 | bbloom | ,(alter-var-root #'x inc) |
| 15:34 | clojurebot | 2 |
| 15:34 | bbloom | ,x |
| 15:34 | clojurebot | 2 |
| 15:34 | bbloom | noprompt: ^^ |
| 15:34 | noprompt | bbloom: so should i patch the analyzer to use alter-var-root instead of set! |
| 15:34 | bbloom | noprompt: i have no idea. depends on what it's using set! for |
| 15:34 | noprompt | *cljs-ns* is a dynvar so it seems like alter-var-root is a bad idea. |
| 15:35 | dnolen_ | noprompt: no |
| 15:35 | dnolen_ | noprompt: we use set! just fine it's dynvar |
| 15:36 | dnolen_ | noprompt: do you have the patch somewhere? or a gist? |
| 15:36 | TimMc | By the way, this is the editor I used to transition to writing Clojure: http://www.prodevtips.com/2010/05/03/my-clojure-editor/ |
| 15:36 | noprompt | dnolen_: right. from the doc on set! that makes sense. i guess what i'm asking is is there anything else i need to do when trying to analyze the ns form in the repl. |
| 15:36 | hiredman | likely you are doing some lazily and it is escaping the scope of the binding |
| 15:36 | danielszmulewicz | noprompt: Currently, it is an error to attempt to set the root binding of a var using set!, i.e. var assignments are thread-local. |
| 15:36 | noprompt | dnolen_: cljs.analyzer-tests> (a/analyze ns-env '(ns foo {:baz "woz"})) |
| 15:36 | TimMc | It's fragile and low on features, but it is sexp-aware and that's just what I needed to make the jump. |
| 15:36 | dnolen_ | noprompt: so you need to establish a binding around that first |
| 15:37 | noprompt | dnolen_: doh. |
| 15:38 | bridgethillyer | hlprmnky: I had that exact problem this morning |
| 15:39 | arrdem | https://github.com/clojure/clojure/pull/17#issuecomment-53628365 hooboy |
| 15:40 | justin_smith | arrdem: razum2um1 is the same person who considers the lack of ubiquitous usage of ansi colors in clojure output to be a usability bug |
| 15:40 | razum2um1 | yep |
| 15:40 | joegallo | 'oh man, what a beautiful hornet's nest this is that i have come across. i shall kick it heartily!' |
| 15:41 | catern | git send-email/git format-patch should be mandatory in all git tutorials |
| 15:41 | bridgethillyer | hlprmnky: Or, rather, no, misreading your question |
| 15:41 | catern | alternatively, github shouldn't be so lame and use its own proprietary method for pull requests |
| 15:41 | catern | should stop being so lame and should stop using its own* |
| 15:41 | bridgethillyer | hlprmnky: There is a merge, also, in Clojure core |
| 15:42 | danielszmulewicz | TimMc: If you ever want to make the jump: https://github.com/pierre-lecocq/emacs4developers |
| 15:42 | campeterson | Hey all, got a question about fn args. |
| 15:42 | joegallo | you may ask it |
| 15:42 | campeterson | :) |
| 15:43 | campeterson | The function takes a keyword as the first arg, and n vectors |
| 15:43 | campeterson | I want to programatically build the "arg" and send it in |
| 15:43 | justin_smith | campeterson: sounds like you may want apply |
| 15:44 | joegallo | (apply your-fn the-keyword seq-of-the-vectors) |
| 15:44 | rhg135 | ,(apply + 1 [1 2 3]) |
| 15:44 | clojurebot | 7 |
| 15:44 | rhg135 | thank you mr. bot |
| 15:44 | campeterson | Ah, I think that might do it |
| 15:45 | danielszmulewicz | Please someone help me put an end to my misery: I'm trying to retract a fact in datomic that involve a ref, and I can't wrap my head around it. In my schema, I have :video/user, it's a ref with cardinality many. I want to remove the link of that particular video with a particular user. I've tried this: (d/transact conn [[:db/retract 17592186045835 :video/user 17592186045424]]) where the first id is the id of the video, and the second |
| 15:45 | danielszmulewicz | the id of the user. This is wrong, apparently. |
| 15:45 | schmee | am I correct in thinking that `apply` is basically argument unpacking ala Python? |
| 15:45 | joegallo | i don't know python, but, uhhhh... probably. |
| 15:45 | danielszmulewicz | schmee: same here. but yes. |
| 15:46 | joegallo | yeah, it looks sortof similar |
| 15:46 | rhg135 | yes it is schmee |
| 15:46 | schmee | nice, that'll be handy! |
| 15:46 | rhg135 | except it's only on the last arg to apply |
| 15:47 | lemonodor | foo(x, y, *z) in python is basically (apply foo x y z) in clojure. |
| 15:48 | schmee | I was converting some old Python code I wrote to clojure yesterday, and by god Python looks horrible when you've gotten used to clojure |
| 15:48 | schmee | everything is so... inconsistent |
| 15:48 | campeterson | joegallo: so, say I don't need to apply a function, but I have my keyword and my seq-of-the-vectors |
| 15:48 | rhg135 | yup |
| 15:49 | joegallo | okay, you've got your keyword and the seq-of-the-vectors... what of them? |
| 15:50 | campeterson | In need to build "args" and pass it into the function |
| 15:50 | joegallo | the way to do that is with apply |
| 15:51 | SagiCZ1 | hey how do i watch this video? cant find any play button http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey |
| 15:51 | joegallo | there is no (my-fn n-arguments-that-have-been-prepacked). there's only (apply mf-fn n-arguments-that-have-been-prepacked) |
| 15:51 | razum2um1 | justin_smith: btw, it's not only me, see there is already some progress :) https://github.com/AvisoNovate/pretty but I didn't mentioned it has to be in the core, no. but there should be some way to get newbie-freindly REPL. imagine you're life without readline library inside bash/other shell-or-repl? |
| 15:52 | SagiCZ1 | schmee: python does look horrible and i have never thought different.. even java looks better |
| 15:52 | danielszmulewicz | Is there any blog post/ tutorial about retracting facts in datomic? |
| 15:52 | joegallo | or maybe you haven't fully conveyed the situation to me, campeterson |
| 15:52 | nullptr | SagiCZ1: you might need to install flash |
| 15:53 | campeterson | joegallo: yeah, sorry |
| 15:53 | TimMc | danielszmulewicz: Oh, I already made the jump; I'm using a big-boy text editor now. |
| 15:53 | danielszmulewicz | TimMc: Oh, I must have misread. All Good. |
| 15:53 | SagiCZ1 | nullptr: yeah it was flash.. works in IE |
| 15:54 | campeterson | joegallo: the light just came on |
| 15:55 | joegallo | excellent! http://xkcd.com/224/ |
| 15:55 | TimMc | However, this might be good to skim through. |
| 15:56 | campeterson | joegallo: yeah, stupid rookie mistake. but I see it now. Apply take the function you want the args to go to, then the args |
| 15:57 | joegallo | exactly |
| 15:57 | kqr | woo! i *finally* have reason to write my first macro |
| 15:57 | campeterson | joegallo: thanks again |
| 15:57 | danielszmulewicz | You know, people, for a dummy like me, Clojure has been a boon. Suddenly I could write web applications with minimum effort, and I went on to master every piece in the so-called "immutable stack". I'm writing 100% Clojure for a year now. There's only one piece of the stack that eludes me, and that is datomic. I get the concept of facts accretion, but it has never played out well for me. I think I'm about to give up on datomic. Thoughts? |
| 15:58 | joegallo | campeterson: you're welcome! |
| 15:58 | rhg135 | ask yourself 'do i need a db' |
| 15:59 | danielszmulewicz | I need a db I can understand. |
| 15:59 | rhg135 | ah |
| 15:59 | rhg135 | never give up |
| 16:00 | technomancy | a db you can understand is easier when the license doesn't prevent you from examining the implementation |
| 16:00 | danielszmulewicz | rhg135: but is it worth it? |
| 16:00 | danielszmulewicz | technomancy: Everything in the datomic experience is a turn off. |
| 16:01 | danielszmulewicz | Docs, installation, default memory settings. |
| 16:01 | technomancy | for many use cases, it's not that hard to treat postgres as an immutable event log |
| 16:01 | tuft | that's what i've been thinking lately |
| 16:01 | danielszmulewicz | technomancy: exactly. |
| 16:01 | tuft | also postgres has real serializable transaction isolation, which datomic only has half of |
| 16:02 | tuft | the rest you have to do yourself with functions that run in the transactor |
| 16:02 | tuft | just need a way to get the transactions and queries as data part -- still like that =) |
| 16:03 | rhg135 | danidk if it is i've never used it |
| 16:03 | rhg135 | danielszmulewicz, *** |
| 16:03 | rhg135 | srsly i need to type out nicks |
| 16:05 | TimMc | Get a better chat client! |
| 16:05 | rhg135 | i'm using hexchat |
| 16:05 | akurilin | quick question: how do you guys measure the load on your web applications ? I have a ring app that's getting a lot of traffic, but I'm not sure how much is too much. I have munin set up to monitor/track things like IO, cpu and mem use. I could also analyze the logs and see how long requests take on average |
| 16:05 | rhg135 | too many ppl in this chan |
| 16:06 | tuft | rhg135: no tab completion in that client? |
| 16:07 | schmee | tuft: there sure is, works for me at least |
| 16:10 | loliveira | when should I use datomic over postgres? |
| 16:11 | danielszmulewicz | tuft: to be honest, even mongodb would fit my use case. Heresy maybe, but good enough for me. And monger just redesigned their api to be more "functional". |
| 16:11 | loliveira | did this question make any sense? |
| 16:11 | technomancy | loliveira: when does vendor-lock-in not matter? |
| 16:12 | loliveira | technomancy: Do you know how does the vendor-lock-in is implmented in datomic? |
| 16:12 | technomancy | when you work for Cognitect I guess? =) |
| 16:12 | kqr | if I have a list of statements in a macro, how do I expand them one by one? |
| 16:12 | dnolen_ | danielszmulewicz: you know there's #datomic and an active mailing list for datomic questions :) |
| 16:13 | danielszmulewicz | dnolen_: Oh, thanks. I forgot about that. |
| 16:13 | kqr | ah I found it, ~@ |
| 16:14 | danielszmulewicz | So Clojure was a gift to the world, but the plan to monetize it was datomic. Result: the world adopts Clojure and rejects datomic? How accurate a description is this? |
| 16:15 | danielszmulewicz | Is Cognitect making money with Datomic? |
| 16:15 | technomancy | http://p.hagelb.org/mystery.gif |
| 16:16 | TimMc | I hope so. |
| 16:17 | danielszmulewicz | technomancy: :-) |
| 16:18 | justin_smith | kqr: that splices them - everything returned by your macro gets expanded to create the form that gets run |
| 16:19 | dnolen_ | danielszmulewicz: seems pretty inaccurate. also there's a bunch of people in this room with Clojure products making money. |
| 16:19 | kqr | justin_smith, i'm not sure I follow |
| 16:20 | TimMc | That doesn't monetize it for the Core folks, though. |
| 16:20 | TimMc | I mean, except via consulting, I guess. |
| 16:21 | danielszmulewicz | dnolen_: I also make money with a Clojure product. I'm asking about Cognitect's product, Datomic. |
| 16:21 | kqr | justin_smith, if xs is (a b), will not `(x ~@xs x) be (x a b x)? |
| 16:21 | justin_smith | kqr: that is the splicing I was talking about |
| 16:21 | justin_smith | but whatever you return is expanded, and then evaluated |
| 16:21 | kqr | ah yeah |
| 16:22 | Jumblemuddle | Let's say that I wanted to create a route that allows for forward slashes. (e.g. site.tld/a/b/c would return a (list?) of the arguments) I want it to allow for an 'infinite' amount of 'sub-folders' and return them as a list. Any way to do this with compojure? |
| 16:23 | amalloy_ | Jumblemuddle: it's certainly possible, if a little bit weird. you'd probably want to define a recursive route |
| 16:24 | Jumblemuddle | Interesting, I hadn't even thought about recursion. I was thinking I'd just have to do a regex that allowed for '/' then parse it myself. |
| 16:28 | TimMc | Jumblemuddle: I think that makes far more sense. |
| 16:30 | Jumblemuddle | I wasn't quite sure if it'd work, because '/' is a 'special' character, so I figured I'd ask here in case there was some 'pretty' way to do it. |
| 16:40 | noprompt | dnolen_: could you take a look at a gist real quick and give me some feedback about this patch? https://gist.github.com/noprompt/130197e3c1ede9567bc3 |
| 16:40 | noprompt | bbloom: you're welcome to it as well. |
| 16:42 | noprompt | bbloom, dnolen_: i'm unsure what makes sense to test. for my use case i'm positive i want to look at *cljs-ns* when the macro is being compiled but as far as clojurescript goes i'm not sure what's relevant for the test. |
| 16:42 | hiredman | a2enmod proxy |
| 16:42 | hiredman | whoops pardon |
| 16:43 | Jaood | now everyone knows you use apache instead of nginx |
| 16:43 | dnolen_ | noprompt: is that how ns metadata works, a map after the symbol is supported? |
| 16:43 | noprompt | dnolen_: according to what the current code says. |
| 16:44 | noprompt | dnolen_: https://github.com/clojure/clojurescript/blob/245de2e752f638f5d06527a1cafed26b0d8d0da8/src/clj/cljs/analyzer.clj#L1132-L1134 |
| 16:44 | timothyw | hey all. when trying to do a `lein release` the input screen doesn’t respond to my inputs (http://bit.ly/1q5Ucmp) |
| 16:44 | timothyw | I think input is "gpg-agent > pinentry-curses" |
| 16:44 | amalloy_ | does anyone have a recommendation for a thrift library to use from clojure? i'll be working with some java code so just a clojure-looking layer on top of the generated java classes would be nice |
| 16:44 | timothyw | any ideas? (probably missing something simple) |
| 16:44 | noprompt | dnolen_: and from the look of it in the repl, yes. |
| 16:44 | noprompt | it's news to me. :P |
| 16:45 | dnolen_ | noprompt: huh, ok. looks good to me, ticket + patch in JIRA then. |
| 16:45 | noprompt | dnolen_: what about the tests? should i leave all of that in there? |
| 16:46 | dnolen_ | noprompt: tests are fine |
| 16:46 | dnolen_ | noprompt: all that matters is a squashed patch with an appropriate commit message |
| 16:46 | dnolen_ | noprompt: https://github.com/clojure/clojurescript/wiki/Patches |
| 16:46 | noprompt | dnolen_: thanks! i'll get that started. |
| 16:59 | kqr | is there any sort of style guide for clojure (or some project which I can imitate?) |
| 16:59 | kqr | wait |
| 17:00 | kqr | I just googled "clojure style" |
| 17:00 | kqr | first hit seems promising |
| 17:00 | justin_smith | kqr: there are even automated linters - like kibit and eastwood |
| 17:00 | Jumblemuddle | Alright, I'm probably doing this wrong. I'm trying to create a compojure route that will allow for '/'s in the route '(GET ["/:route", :route #"[A-z,a-z,/]"] [] (default)) |
| 17:00 | timothyw | kqr: I’ve seen this one reference a few times: https://github.com/bbatsov/clojure-style-guide |
| 17:00 | justin_smith | kqr: also, I like this one, though it is not wholly uncontroversial https://github.com/bbatsov/clojure-style-guide |
| 17:01 | amalloy_ | that regex is bananas, Jumblemuddle. you probably want [A-Za-z/]+ |
| 17:01 | Jumblemuddle | I knew I'd end up doing something stupid... thanks |
| 17:03 | Jumblemuddle | It seems to work fine, until I try doing a route with a '/' in it. Is it even possible to make compojure treat routes with them as a single route? |
| 17:04 | Jumblemuddle | I'm an idiot... It works fine, I was trying localhost:3000/test/test3 (I don't have numbers in the regex) :/ Thanks, guys! |
| 17:05 | justin_smith | Jumblemuddle: it seems like for a route like that it would be easier to make your own middleware layer, that detects the regex for the deep path you want, and calls your handler, and only invokes the real compojure router if there is no match |
| 17:05 | justin_smith | oh, so it worked, never mind then |
| 17:06 | Jumblemuddle | Ya, I was just being an idiot. Thanks, anyways! |
| 17:08 | PigDude | if a Java method takes a Map, can you provide a Clojure map to it? |
| 17:08 | PigDude | walking my way from IPersistentMap on up, I don't think so. |
| 17:08 | PigDude | is that right? |
| 17:09 | technomancy | ,(instance? java.util.Map {}) |
| 17:09 | clojurebot | true |
| 17:09 | justin_smith | ,(isa? (class {}) java.util.Map) |
| 17:09 | clojurebot | true |
| 17:09 | gtrak | technically that's an array map :-) |
| 17:09 | technomancy | psh; isa? |
| 17:09 | PigDude | hm, what did i miss? |
| 17:09 | amalloy_ | ,(isa? clojure.lang.IPersistentMap java.util.map) |
| 17:09 | clojurebot | #<CompilerException java.lang.ClassNotFoundException: java.util.map, compiling:(NO_SOURCE_PATH:0:0)> |
| 17:09 | amalloy_ | ,(isa? clojure.lang.IPersistentMap java.util.Map) |
| 17:09 | clojurebot | false |
| 17:10 | amalloy_ | PigDude: you didn't miss anything - the interfaces are separate, it's just that every implementation of c.l.map stuff also implements j.u.map |
| 17:10 | technomancy | (isa? clojure.lang.TerriblyNamedFunction isa?) |
| 17:10 | PigDude | amalloy_: that's what i missed :) i'm not java guy, forgot to look for the implementation |
| 17:10 | PigDude | amalloy_: i see APersistentMap extends Map |
| 17:10 | amalloy_ | it really *should* be a subinterface, because stuff in clojure.core breaks if you create classes that implement clojure stuff but not java stuff |
| 17:11 | PigDude | i agree |
| 17:12 | tuft | danielszmulewicz: what would mongo offer you over postgres? i'm not so familiar with it, just curious |
| 17:12 | justin_smith | tuft: unreliability, and speed |
| 17:13 | justin_smith | ~mongodb |
| 17:13 | clojurebot | mongodb is an ORM for mmap |
| 17:14 | TimMc | ~mmap |
| 17:14 | clojurebot | Huh? |
| 17:14 | TimMc | ~ORM |
| 17:14 | clojurebot | Excuse me? |
| 17:17 | tuft | haha |
| 18:00 | myazaki | I have a question about java interop, I have a java library which returns classes of primitive types (int.class, float.class) and I want to use that as a dispatch value for a multi method |
| 18:00 | noprompt | dnolen_: i opened the issue (#846) and attached the patch. thanks for your help on it. |
| 18:01 | myazaki | so for instance I got a float.class, but I can't seem to make it work |
| 18:01 | amalloy | myazaki: Float/TYPE |
| 18:02 | amalloy | (is one place where the class for the float primitive can be found) |
| 18:02 | myazaki | I tried that... |
| 18:03 | myazaki | I probably must be doing something wrong :) |
| 18:03 | dnolen_ | noprompt: thanks will take a look later |
| 18:04 | justin_smith | ,(class (float 1.0)) ; a more hacky way to get it |
| 18:04 | clojurebot | java.lang.Float |
| 18:04 | noprompt | dnolen_: awesome. really appreciate it. |
| 18:04 | lemonodor | i’m getting “java.lang.IllegalAccessError: in-seconds does not exist, compiling:(cookies.clj:1:1)” with ring 1.3.1, which supposedly has to do with pulling in an old clj-time, but i’ve put [clj-time “0.8.0”] in my project.clj and still get the error. lein deps :tree shows only that clj-time. |
| 18:04 | justin_smith | oh, never mind, for a primitive |
| 18:04 | lemonodor | anyone else run into this with ring 1.3.1 (released this week, i think)? |
| 18:06 | amalloy | justin_smith: that doesn't work at all? |
| 18:06 | justin_smith | amalloy: I misunderstood what was wanted, thus my "never mind" followup |
| 18:06 | amalloy | okay you said that already. but also: if the goal were to get at the class for Float, it's just...Float |
| 18:07 | amalloy | (class (float 1.0)) is silly |
| 18:07 | justin_smith | yes, it is |
| 18:07 | myazaki | I'm dispatch on Float/TYPE, for instance like this (defmulti blah (fn [arg1 dt] dt)) and (defmethod blah Float/Type [arg1 dt] ...) |
| 18:08 | myazaki | when I use blah with the float.class returned from the java library it says that it can't find a method for dispatch value: float |
| 18:15 | hiredman | myazaki: does (= Float/TYPE dt) return true? |
| 18:16 | myazaki | yes! |
| 18:16 | myazaki | I'll try isa? |
| 18:17 | myazaki | because I think multimethods use that |
| 18:17 | hiredman | did you load the code that defines the method for Float/TYPE ? |
| 18:18 | hiredman | (require or use of the namespace, direct call to load-file or load, etc) |
| 18:18 | danielszmulewicz | tuft: Oh, what mongodb gives me over postgres? The luxury to be lazy. No schemas in mongodb. I can shoot myself in the foot as much as I want. It's a document store, so at development time I can experiment with how I want my data to be structured without formalizing. Maybe that's why so many people hate it. It seems that people who understand databases recommend against it. Since I don't understand them, I use it happily. |
| 18:19 | myazaki | most definitely, hiredman |
| 18:19 | myazaki | damn it, such a strange error |
| 18:19 | hiredman | myazaki: what happens when you call the mutlimethod at the repl with (blah :foo Float/TYPE) ? |
| 18:20 | hiredman | myazaki: why are you so sure you have the defmethod loaded? |
| 18:20 | myazaki | man I think I found the error |
| 18:21 | myazaki | I'm an idiot |
| 18:21 | myazaki | lol |
| 18:24 | myazaki | thanks hiredman |
| 18:25 | myazaki | Actually, the error was inside a let statement of a method that called one of the multimethod |
| 18:25 | myazaki | I ultimately passed a wrong argument |
| 18:26 | myazaki | wow, it works now |
| 18:27 | myazaki | Lesson #928: Be careful with refactoring |
| 18:40 | TimMc | &(sort ["foo" :foo]) |
| 18:40 | lazybot | java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Keyword |
| 18:40 | TimMc | :-( |
| 18:41 | TimMc | For a moment I was living in a utopia where Clojure implemented universal sorting. |
| 18:41 | TimMc | like in Python |
| 18:42 | Scorchin | Evening, something that might be relevant to folks in this channel is a "SICP Distilled" course that's being run in Clojure: https://www.kickstarter.com/projects/1751759988/sicp-distilled |
| 18:42 | mdeboard | I thought that strict ordering was like a requirement for type systems or something |
| 18:42 | mdeboard | TimMc: |
| 19:39 | danielszmulewicz | I'm offering a macro in a library for convenience. What is more idiomatic? (defystem name [args]) or (defsystem name {args}). A vector or a map? |
| 20:00 | bogdan | can somebody tell me if cider in any of version have something like clj browsing feature like speedbar or i only limited to jump to source? |
| 20:00 | celwell | How can I 'unwrap' a collection and just have each of its elements in place of it in the function? (I assume this needs some sort of macro) (I don't think I can use apply because of the details of the situation) |
| 20:04 | verma | celwell, apply? |
| 20:04 | verma | ,(apply + [1 2 3 4]) |
| 20:04 | clojurebot | 10 |
| 20:04 | aperiodic | celwell: why don't you think you can use apply? |
| 20:05 | verma | celwell, oh didn't see you comment for "apply" |
| 20:11 | danielszmulewicz | bogdan: M-. ? |
| 20:50 | lpvb | right now I have a function that synchronously loads sound data from an audio stream freezing the UI |
| 20:50 | lpvb | what's the right clojure concurrency way to do this? |
| 20:50 | lpvb | future? java threads? agents? |
| 20:51 | TEttinger | lpvb, so it's synchronous now but you want it to be async? |
| 20:51 | TEttinger | sounds like future would be easiest |
| 20:52 | TEttinger | I've used it before for very similar tasks, just not from disk |
| 20:53 | lpvb | TEttinger: I read that it will block when I deref it |
| 20:53 | lpvb | but for this case doing IO I don't need a value back so I don't ahve to worry about it right? |
| 20:54 | lpvb | will the future thread be terminated once it's done doing its work? |
| 20:54 | bogdan | ty daniel |
| 20:55 | alandipert | lpvb: another thing to look into would be agents + send-off |
| 21:00 | lpvb | alandipert: what would I put in the agent? |
| 21:01 | alandipert | i usually put something in there to store any information i want about how the processing went |
| 21:01 | lpvb | I'm confused |
| 21:01 | lpvb | how does that help me load audio data into a buffer asynchronously |
| 21:04 | alandipert | it’s just another way to make a thread |
| 21:08 | celwell | Hi, How can I unwrap a coll and have the elements in its place? (to anyone who recognizes this question: sorry, got disconnected from irc) |
| 21:09 | akhudek | yay, immutant 2 finally hit alpha! |
| 21:09 | lpvb | seems like future spawns an agent send off pool thread anyway |
| 21:09 | lpvb | celwell: what do you mean elements in its place? |
| 21:09 | celwell | I don't know how I would be able to use apply because it is part of the with-query-results macro. |
| 21:09 | celwell | lpvb: (1 2 3 4) -> 1 2 3 4 |
| 21:11 | celwell | It's going into this macro in place of 'params' for [stmt & params] https://github.com/clojure/java.jdbc/blob/97be163884d402c4506e2397a528b15a23867a8f/src/main/clojure/clojure/java/jdbc/deprecated.clj#L680 |
| 21:11 | celwell | But I have params as a vector and it has to 'unwrapped' I assume. |
| 21:12 | akhudek | celwell: you could do it with another macro I guess. Try searching for “using apply with a macro” |
| 21:12 | akhudek | celwell: It should cover the same topic |
| 21:12 | turbofail | [stmt [a b c d & more]] |
| 21:12 | amalloy | celwell: sql-params just wants a vector anyway |
| 21:12 | amalloy | turbofail: well, it's actually [stmt a b c d & more] |
| 21:12 | verma | so, (put! c val close!) is a common thing to do for one shot async calls? |
| 21:14 | celwell | amalloy: sorry, are you saying it's fine to just give it a vector? im confused |
| 21:15 | akhudek | celwell: if you are trying to give sql-params, yes |
| 21:15 | amalloy | celwell: all it wants is a vector to begin with |
| 21:17 | celwell | amalloy: but it wants this vecotr [stmt & params], but I'm giving it this vector [stmt [blah blah blah]]. I need to figure how to give it [stmt blah blah blah] |
| 21:17 | amalloy | (apply vector stmt [blah blah blah]) or (into [stmt] [blah blah blah]) |
| 21:19 | amalloy | if the entire vector is this opaque thing you can't control at all, you can do something like (into [(first v)] (rest v)) |
| 21:19 | celwell | amalloy: ok, i see what you mean. ok I'll work on this, thanks |
| 21:19 | celwell | amalloy: I was getting tunnel-visioned into a certain vector |
| 21:20 | lpvb | I used a future to execute loading the sound buffer, but if the user clicks another sound while the original future is still running it will continue to play the previous future |
| 21:22 | TEttinger | lpvb, then agents may be better, I think you can cancel both, but I'm more certain that you can with agents |
| 21:22 | TEttinger | most of my clojure does not use concurrency :| |
| 21:37 | verma | how do I put a value into an async channel and close it rightaway, I guess I cal do (do (put! c v) (close! c)) .. but was wonder if there's a thing for this |
| 21:40 | lpvb | Maybe to solve my problems I need to send my buffer loading function a continuation so it can halt itself when it notices the user has changed selection? |
| 21:57 | whatisthewhat | My HDD crashed earlier. After recovering, I can't do lein repl anymore. Instead, I get the this Java error http://pastebin.com/2M7buaBJ. Tried reinstalling without success. Any thoughts what's causing this? |
| 22:01 | verma | which "transformer" is being referred to here: https://clojure.github.io/core.async/#clojure.core.async/filter<? |
| 22:01 | verma | a transducer? |
| 22:02 | beamso | whatisthewhat: https://github.com/technomancy/leiningen/issues/1321 ? |
| 22:02 | verma | oh |
| 22:02 | verma | https://github.com/clojure/core.async/commit/81fc946a4d80dd57f641282831e72ae0d829f1b0 |
| 22:03 | verma | so I can use transducers with 1.6.0? |
| 22:05 | whatisthewhat | beamso: Not clear but I don't think that's my issue. The error code on that page shows the nREPL server starting. My error occurs before the server starts. |
| 22:06 | TimMc | technomancy: I'm thinking of buying a Maltron ergonomic keyboard. Ever used one of those? |
| 22:07 | whatisthewhat | This also seemed relevant, but my /etc/hosts file looks fine: http://stackoverflow.com/questions/22114716/lein-repl-errorconnection-refused?rq=1 |
| 22:09 | beamso | i checked my hosts file on two machines. both had a '127.0.0.1 localhost' entry. |
| 22:10 | beamso | i also note from your stackoverflow post that 2.4.2 isn't the latest one... but there is a annoying bug in 2.4.3 anyway. |
| 22:10 | whatisthewhat | yeah i intentionally was running 2.4.2 because of that bug |
| 22:23 | TimMc | whatisthewhat: What does your hosts file look like? |
| 22:24 | TimMc | The selected answer on SO hinges on the hostname not being in /etc/hosts. |
| 22:28 | gastove | Buh: I have a project that declares dev dependencies in its project.clj. On one of my computers, my lein repl loads with dev dependencies on the classpath; on my other computer, dev dependencies are omitted from the classpath. Does anybody... have any suggestions where to start looking to fix this? |
| 22:29 | xeqi | gastove: lein versions? |
| 22:29 | gastove | Even more bizarre to me: lein with-profile dev repl *still* doesn't start a repl with dev dependencies loaded. So something... is wacky. _But what?_ |
| 22:29 | TimMc | gastove: Do you have a ~/.lein/profiles.clj on either machine? |
| 22:30 | gastove | I have a profiles.clj on both machines; they're identical. And: I updated lein on both of 'em this morning. |
| 22:30 | gastove | So both are on 2.4.3 |
| 22:32 | hiredman | gastove: I would check lein classpath |
| 22:32 | whatisthewhat | TimMc: my hosts file is normal, and has a 127.0.0.1 localhost entry |
| 22:33 | xeqi | gastove: add lein-pprint and see what it tells you about the :dev profiles |
| 22:33 | TimMc | whatisthewhat: Right, but does it have an entry for your hostname? |
| 22:34 | TimMc | It *shouldn't* matter, but it apparently did for the SO person. |
| 22:34 | whatisthewhat | when I type hostname into terminal it says it's simply localhost |
| 22:35 | TimMc | huh |
| 22:36 | TimMc | At this point I would try changing/setting the hostname and setting it in /etc/hosts under 127.0.1.1, but that's because I'm a little fuzzy on this stuff. |
| 22:37 | gastove | xeqi: I'm not perfectly sure what I'm looking for. (I'm on the broken computer, and don't have access to the working computer at the moment, so I can't compare and contrast.) |
| 22:38 | gastove | xeqi: but it does show the dev dep in the dev profile: `:dependencies ([midje/midje "1.6.3"])` |
| 22:39 | hiredman | :( |
| 22:39 | hiredman | I blame midje what the problem is |
| 22:39 | gastove | heh |
| 22:39 | hiredman | it is terrible |
| 22:40 | xeqi | gastove: and `lein deps :tree` and `lein with-profile +dev deps :tree` don't show midje? |
| 22:41 | gastove | xeqi: nope, neither of them. |
| 22:44 | gastove | hiredman: (or anybody else for that matter) is "which testing framework is good" going to be the kind of question I regret asking, or is there one-or-another that's emerging as Generally Pretty Solid? (I'm not super attached to midje, just like it better than clojure.test.) |
| 22:45 | TimMc | Midje is batteries-included, but the error messages can be pretty difficult to parse. |
| 22:46 | gastove | TimMc: good to know, actually -- that's rather a pet peeve of mine. |
| 22:46 | hiredman | midje is also written by people who have demonstrated time and time again that they don't know clojure |
| 22:46 | gastove | heh. |
| 22:46 | gastove | Any love for Speclj? Was also looking at it. |
| 22:46 | hiredman | clojure.test |
| 22:47 | xeqi | gastove: running out of ideas debugging without pastes |
| 22:47 | xeqi | test.check and clojure.test have been sufficent for my purposes |
| 22:48 | gastove | xeqi: I appreciate the help. I'm going to put the working computer and the broken computer in the same place tomorrow, see if one is config'd differently than the other. |
| 22:48 | tbaldrid_ | gastove: let's just say that everytime I've run into a mature midje codebase, the authors have either said "we should have written that in clojure.test" or "we're rewriting that in clojure.test" |
| 22:48 | gastove | *nods* I'm interested in test.check; seems solid. |
| 22:48 | gastove | tbaldrid_: ha! That's also good to know. |
| 22:49 | tbaldrid_ | clojure.test has it's warts, but it's so simple it's fairly easy to understand. |
| 22:49 | gastove | I just wish there were a better way to do setup/teardown/test ordering than test-ns-hook. |
| 22:49 | gastove | (Maybe there is and I just haven't come across it?) |
| 22:49 | xeqi | gastove: I was considering multiple profiles in the ~/.lein directory merging weird, but I'd have expected lein-pprint to get the same merger |
| 22:50 | hiredman | what is test-ns-hook? |
| 22:50 | xeqi | something beyond `use-fixture`? |
| 22:50 | hiredman | ^- |
| 22:51 | gastove | If I've got this right: test-ns-hook lets you specify the order in which the functions in a test ns get called. It's incompatible with fixtures, though, which is a shame. |
| 22:51 | hiredman | never heard of it, so you don't need it |
| 22:52 | xeqi | hmm, I always considered the randomness in the ordering a positive |
| 22:52 | xeqi | test independent/idempotency and what now |
| 22:52 | hiredman | xeqi: it isn't random enough to be a positive |
| 22:52 | hiredman | it will run in the same order for ever run |
| 22:52 | hiredman | every |
| 22:53 | hiredman | if it was really random that would be great |
| 22:53 | hiredman | our big test suite at work ends up having problems with state leaking between tests in a namespace, and even across namespaces |
| 22:54 | gastove | Eh, I'm doing integration testing. Idempotence/commutativity is lovely, but I also need to do things like "definitely add 5 things to a DB, make sure code FNs remove them correctly." You need at least a *little* ordering for that. |
| 22:54 | hiredman | gastove: that sounds like one deftest |
| 22:55 | hiredman | and the body of deftest is just code that runs in order as written |
| 22:55 | technomancy | TimMc: Maltrons seem pretty hardcore. a lot like the kinesis advantage, but harder to find. |
| 22:55 | TimMc | You can build anything you want out of clojure.test, but the question is do you *want* to. |
| 22:56 | hiredman | TimMc: there are no alternatives that are good enough to trade off the simplicity |
| 22:57 | gastove | Well. Thanks for the time, all. |
| 22:57 | technomancy | TimMc: IMO the main flaw of the kinesis advantage (beyond size) is it's only available with quiet or linear switches. I don't know if the Maltron has the same problem or not off the top of my head. |
| 22:58 | TimMc | hiredman: You always build your own testing utils on top of clojure.test with each new project? |
| 22:58 | TimMc | technomancy: What key switch do you prefer? |
| 22:58 | hiredman | TimMc: not really, I just wrote code that does things and asserts things |
| 22:59 | technomancy | TimMc: the cherry blue switches are the best IMO, unless you are in an office where you can't make a lot of noise. |
| 22:59 | hiredman | with-redefs here and there |
| 23:00 | technomancy | TimMc: hm; one source says that maltron only has blacks, which are mechanical, but not tactile. (mostly used in gaming keyboards) |
| 23:00 | technomancy | seems like an odd choice |
| 23:00 | TimMc | technomancy: I bet Maltron would use different key switches for little to no extra cost. |
| 23:00 | TimMc | They hand-assemble them anyhow... |
| 23:00 | technomancy | TimMc: considering they're all hand-wired anyway, it's definitely a possibility |
| 23:01 | technomancy | at that cost level there should be room for customization =) |
| 23:01 | technomancy | TimMc: curious if you've seen this? http://atreus.technomancy.us |
| 23:02 | technomancy | can't remember if I showed you that or not |
| 23:03 | xeqi | technomancy: does it come in bluetooth? |
| 23:03 | TimMc | Oh, I vaguely recall this... |
| 23:04 | technomancy | xeqi: the base design doesn't. it might be possible to hack it in, but the case clearance is pretty tight. |
| 23:04 | technomancy | maybe if you increased the width of the spacer |
| 23:04 | technomancy | it's an open source design, so ... anything is possible =) |
| 23:04 | technomancy | personally I have enough batteries to keep charged every day as it is |
| 23:05 | TimMc | I think I'd want something with more keys. |
| 23:05 | technomancy | it definitely takes a lot of getting used to |
| 23:07 | TimMc | Not having arrow keys at the base layer is a no-go for sure. |
| 23:07 | TimMc | If I spent *all* my time in Emacs, maybe not... |
| 23:07 | technomancy | it's not for everyone; just thought I'd mention it |
| 23:08 | TimMc | *nod* |
| 23:08 | technomancy | the maltron looks neat if you don't need to take it with you |
| 23:08 | TimMc | heh |
| 23:08 | TimMc | What's wrong with Cherry MX Brown? |
| 23:08 | technomancy | I'd just watch out for the switches. maybe you'd like the ones they use by default, but I'd see if you can try it out in person before you pull the trigger. |
| 23:09 | TimMc | You can "rent" the Maltrons for a month if you live in the UK. |
| 23:09 | technomancy | huh, that's pretty cool |
| 23:09 | TimMc | I'd want to do some remapping to make Ctrl, Alt, and ( really easy to hit. |
| 23:09 | technomancy | makes a lot of sense; people would be reluctant otherwise. and you need about a month to get used to a layout like that. |
| 23:10 | TimMc | and maybe set up sticky keys or something |
| 23:11 | technomancy | http://deskthority.net/workshop-f7/anybody-ever-change-the-switches-on-their-maltron-t4675.html |
| 23:12 | technomancy | TimMc: the brown switches are supposed to be tactile, but they just feel weak to me; like a token effort at tactility. |
| 23:12 | technomancy | try it for yourself I guess, but IMO nothing is as nice as the clicky blues |
| 23:13 | TimMc | How loud are blues? |
| 23:13 | technomancy | kinda like clicking a pen |
| 23:13 | TimMc | Will my coworkers kill me? |
| 23:14 | technomancy | now the wisdom of try-before-you-buy becomes more apparent =) |
| 23:14 | TimMc | I'm going to see if any of my coworkers have one. |
| 23:14 | mdeboard | Does flipping the brown switch activate the brown note |
| 23:15 | technomancy | I'm working on a prototype that uses Matias quiet switches, which are dampened but still have the good tactile feedback. |
| 23:15 | technomancy | unfortunately they take a different style of keycap that is very difficult to source |
| 23:16 | technomancy | I had to steal caps from a thrift store mid-90s Apple keyboard for the prototype |
| 23:21 | TimMc | I should also get ahold of a set of Cherry MX switches to poke at. |
| 23:22 | technomancy | if you do need something quiet, the MX clear are better than brown IMO |
| 23:25 | TimMc | Maybe I can play with one of these: http://www.cmstore-usa.com/mechanical-key-switch-demo-board/ |
| 23:25 | TimMc | (What I should *really* do is go to bed.) |
| 23:26 | amalloy | nonsense, TimMc. it's only like 5:30, in hawaii |
| 23:38 | ifiht | Hey I have a crazy question, any takers? |
| 23:40 | catern | don't ask to ask, just ask |
| 23:40 | catern | clojurebot? do you have that memorized? |
| 23:40 | catern | ~ask |
| 23:40 | clojurebot | The Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question. |
| 23:40 | ifiht | kk |
| 23:40 | ifiht | I want to redifine the result of an equation |
| 23:40 | ifiht | *define |
| 23:40 | ifiht | i.e. 1+2=7 |
| 23:41 | ifiht | HOW? |
| 23:41 | amalloy | you want to make three equal to seven? this question is too vague to answer |
| 23:42 | ifiht | I want to specify a specific instance of incongruity in the math library |
| 23:42 | ifiht | not 3=7 |
| 23:42 | ifiht | but 8-3 = 7 |
| 23:43 | ifiht | or the like |
| 23:43 | tbaldridge | you want to break math? |
| 23:43 | ifiht | yes, but only s little |
| 23:43 | ifiht | *a |
| 23:43 | tbaldridge | I may regret this next question....but why? |
| 23:43 | catern | (defn + [& _] 7) |
| 23:43 | catern | there you go |
| 23:43 | ifiht | it's important for working with lots of zeros |
| 23:44 | catern | ,(defn + [& _] 7) |
| 23:44 | clojurebot | #<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)> |
| 23:44 | ifiht | hold on, repl tiem |
| 23:44 | catern | :) |
| 23:44 | ifiht | NICE! |
| 23:44 | tbaldridge | ifiht: what does "working with lots of zeroes" mean? |
| 23:44 | catern | lol |
| 23:44 | catern | i may have just done something horrible |
| 23:44 | catern | ~xy |
| 23:44 | clojurebot | xy is http://mywiki.wooledge.org/XyProblem |
| 23:44 | ifiht | 8/0 comes up more than once |
| 23:44 | ifiht | rather n/0 |
| 23:45 | ifiht | I have to define them |
| 23:45 | catern | ifiht: ~xy |
| 23:45 | catern | clojurebot dang it |
| 23:45 | ifiht | clojurebot? |
| 23:45 | amalloy | use a function different from clojure's built-in /. attempting to redefine how / works for all other code that exists is just doomed |
| 23:45 | catern | anyway, I feel a strong xy vibe |
| 23:45 | clojurebot | clojurebot is not a benchmarking platform |
| 23:45 | tbaldridge | I think there's got to be a much better way to avoid division by zero errors instead of redefining math |
| 23:46 | ifiht | I'm actually actively using n/0 to make it work. |
| 23:46 | amalloy | maybe if you're w WIMP, tbaldridge. i refuse to be bound by the chains of mathematics |
| 23:46 | ifiht | But the separate operator is a good idea |
| 23:46 | ifiht | THanks |
| 23:55 | technomancy | what just happened |
| 23:55 | ifiht | @catern Hey about the xy thing, the main instance that led to this is 0/0 |
| 23:56 | ifiht | I need it to return a value, and I can do it in c, but Java stops it from happening in clojure |
| 23:56 | ifiht | THAT's x |
| 23:56 | amalloy | ,(/ 0 0.0) |
| 23:56 | clojurebot | NaN |
| 23:57 | ifiht | yep |
| 23:57 | amalloy | that's a value |
| 23:57 | ifiht | ,(/ 0 0) |
| 23:57 | clojurebot | #<ArithmeticException java.lang.ArithmeticException: Divide by zero> |
| 23:57 | ifiht | Oh, i see |
| 23:57 | ifiht | *numerical value |
| 23:57 | amalloy | if you divide an integer 0 by an integer 0 in C, i don't think anything good happens to you after that |
| 23:58 | amalloy | in either language, you can do it with ieee floats, and you get back NaN |
| 23:58 | ifiht | it can, but it's pretty processor dependant |
| 23:58 | ifiht | nul = (0 / 0); if (c == (1 || nul)) <- like that |
| 23:59 | amalloy | then it's not "in C", it's "with my particular C compiler on this one computer", because your program isn't standards-compliant |
| 23:59 | ifiht | I'm dividing by 0, and you bring up standards compliance? |