2013-01-05
| 00:07 | muhoo | tomoj: it's bitcoinj under clj on the server side |
| 00:07 | muhoo | it'll be a store for music. soon, i hope |
| 03:06 | amalloy | ambrosebs: my understanding was he wanted something more like an enum: "This function returns either :foo or :bar" |
| 03:07 | ambrosebs | amalloy: sounds like a union? |
| 03:08 | amalloy | i dunno. i haven't done much more than skim typedclojure, myself. but isn't a union a union of existing types? whereas :foo is a value, not a type |
| 03:08 | ambrosebs | Typed Clojure has value types (singletons) |
| 03:09 | ambrosebs | (U ':foo ':bar) |
| 03:09 | amalloy | excellent. then it sounds exactly like...uh...what i think he wanted |
| 03:09 | ambrosebs | :) |
| 04:19 | dbushenko | how to learn in clojurescript how many parameters the function expects? |
| 04:49 | dbushenko | how to get current namespace name in clojurescript? |
| 05:05 | tomoj | there is no current namespace |
| 05:06 | tomoj | except in macro land, in which case it should be, what, (:ns &env) ? |
| 05:06 | amalloy | *ns*? |
| 05:08 | tomoj | oh yeah |
| 05:08 | Sgeo | I'd need to understand them first though |
| 06:40 | Netfeed | with clojure.java.jdbc, what's the best way to run a string with 1 or more different sql-commands? |
| 06:41 | Netfeed | most likely to be inserts and/or create table and such |
| 06:42 | Netfeed | so i'm not sure if i can use with-query-result for it |
| 06:45 | thorwil | Netfeed: what's the sql you have in mind? |
| 06:48 | Netfeed | it could be something like "CREATE TABLE foo (name TEXT); INSERT INTO foo ('bar');" |
| 06:48 | Netfeed | the problem is that i read it from a file and i don't know what it is ahead of execution |
| 06:49 | thorwil | it should be obvious that with-query-result is solely for queries |
| 06:50 | Netfeed | yes |
| 06:51 | Netfeed | it seems like there's a way to do it in 0.2.4-SNAPSHOT |
| 06:52 | thorwil | so you would have to use one of with-query-results, insert-records, create-table ... conditionally |
| 06:53 | thorwil | Netfeed: is taking the different commands from a text file an absolute must, or can you change the architecture? |
| 06:54 | Netfeed | i can't change that, but it seems like db-do-commands will do the trick in 0.2.4-SNAPSHOT so i will take a look at that |
| 06:55 | thorwil | ah, do-commands |
| 07:01 | samrat | in nrepl.el, how can I find out which port the REPL is running on? |
| 07:06 | AimHere | You could always use 'netstat -p' (on Linux) or with some other command line switches on other OSes |
| 07:16 | Sgeo | ,'??!lambda |
| 07:16 | clojurebot | ??!lambda |
| 07:16 | Sgeo | awesome |
| 07:20 | hyPiRion | ,'it's-dangerous-though. |
| 07:20 | clojurebot | it's-dangerous-though. |
| 07:21 | hyPiRion | At least for function names. |
| 07:21 | Sgeo | I'm reading some Oleg stuff |
| 07:21 | Sgeo | He defines a ??!apply macro and a ??!lambda form that ??!apply interprets |
| 07:22 | Sgeo | Right now I'm reading him write a macroexpansion-level factorial using them |
| 07:23 | Sgeo | using syntax-rules of course which is the only R5RS macro mechanism |
| 07:50 | Raynes | Sgeo: There is a certain level of nerd that even we should be careful treading near. |
| 07:50 | Raynes | You're prancing all over it. |
| 07:50 | Sgeo | :D |
| 07:51 | Sgeo | I'm trying to figure out if any of this stuff could be useful in Racket or Clojure |
| 07:51 | Sgeo | Rather than just pure R5RS |
| 07:51 | Sgeo | (which only has syntax-rules, not syntax-case) |
| 07:58 | acuzio | folks - how do you invoke the local bot ? |
| 07:59 | acuzio | ~ ping |
| 07:59 | clojurebot | PONG! |
| 07:59 | acuzio | ah there it is - |
| 07:59 | hyPiRion | ~botsnack |
| 07:59 | clojurebot | Thanks! Can I have chocolate next time |
| 08:00 | Raynes | acuzio: , is for code eval in clojurebot, & is for code eval in lazybot, and ##(println "is for code evaluation in the middle of a message") |
| 08:00 | lazybot | ⇒ is for code evaluation in the middle of a message nil |
| 08:02 | acuzio | Raynes: ta |
| 08:02 | hyPiRion | And &| (println "is for inline eval") |& for lazybot. |
| 08:02 | lazybot | ⇒ is for inline eval nil |
| 08:03 | Raynes | wat |
| 08:03 | Raynes | hyPiRion: I swear to God I had no clue it could do that, and I wrote the bloody bot. |
| 08:04 | acuzio | Raynes: btw - thanks for tryclj |
| 08:04 | Sgeo | And also, there's a difference between clojurebot and lazybot when it comes to ... |
| 08:04 | hyPiRion | Raynes: hahah, grats |
| 08:05 | hyPiRion | I wish I could program subconsciously too. |
| 08:05 | Netfeed | another java.jdbc question: stupid question but, how do you know if a transaction succeded? |
| 08:06 | hyPiRion | mutt sgeo@rip.com |
| 08:06 | lazybot | Woof! |
| 08:22 | Netfeed | nevermind |
| 08:48 | dspp | how can i read in a file with slurp and then walk it as though it was code |
| 08:48 | dspp | i can load-string, but i dont want it exectued |
| 08:48 | dspp | trying to do some static analysis |
| 08:51 | terom | (doc read-string) |
| 08:51 | clojurebot | "([s]); Reads one object from the string s" |
| 08:52 | dspp | how can i quote the result and not the read-string form? |
| 08:52 | dspp | i dont want it evaluated |
| 08:53 | dspp | oh wait |
| 08:53 | dspp | sorry, read load-string instead of read-string |
| 08:53 | dspp | thanks terom |
| 09:22 | dspp | when i (read-string (slurp "file.clj")) it only returns the first form it finds |
| 09:23 | dspp | im running it on clojure.core so it returns (ns clojure.core) |
| 09:23 | dspp | what about all other expressions? |
| 09:23 | dspp | why does it stop reading? |
| 09:24 | dspp | https://raw.github.com/clojure/clojure/master/src/clj/clojure/core.clj |
| 09:24 | abp | (doc read-string) |
| 09:24 | clojurebot | "([s]); Reads one object from the string s" |
| 09:25 | dspp | actually, abp, im using read-from-file-safely http://clojuredocs.org/clojure_core/clojure.core/read but result it the same |
| 09:25 | dspp | this uses read which should read in objects from a stream |
| 09:26 | dspp | i guess i need to modify that function to call read multiple times |
| 09:26 | abp | dspp found that http://stackoverflow.com/questions/6840425/with-clojure-read-read-string-function-how-do-i-read-in-a-clj-file-to-a-list-o |
| 09:27 | dspp | great, perfect, wonderful |
| 09:27 | dspp | thank you abp |
| 09:28 | dspp | i can just add the take-while to my function |
| 09:43 | zilti | Is &env an implementation detail, or is it "future-proof"? |
| 10:42 | MrMiracle | .. |
| 10:44 | Raynes | MrMiracle: ..................... |
| 10:44 | MrMiracle | Hello all |
| 10:45 | MrMiracle | I have a question regarding an issue I'm having with the lein repl |
| 10:45 | MrMiracle | and a compatriot lead me here, am I in the right place? |
| 10:45 | Raynes | Yup. |
| 10:45 | MrMiracle | sweet |
| 10:45 | AimHere | The guy who wrote lein is somewhere around, so you can shout at him directly |
| 10:46 | Raynes | I wrote most of the repl task. |
| 10:46 | Raynes | Oh no, I just incriminated myself. |
| 10:46 | MrMiracle | ok I'm definitely in the right place then, I'm hella new at this, never lisped before |
| 10:46 | AimHere | I'll get the pitchforks, you bring the torches |
| 10:46 | Raynes | I think it has been changed enough since then to render me sufficiently stupid. |
| 10:46 | MrMiracle | most of the development I've done is .NET with tools, etc |
| 10:46 | MrMiracle | but i wanted to dive in deep with this, and I'm having issues :) |
| 10:47 | MrMiracle | i can get a repl started, but I get a mess of errors before it kicks out a prompt |
| 10:48 | MrMiracle | and when I try to require clojure.contrib libraries, etc, I get cannot find file in the classpath |
| 10:48 | MrMiracle | or can't find it, something like that |
| 10:48 | Raynes | Please post the output of lein repl to https://www.refheap.com/paste |
| 10:48 | Raynes | (I wrote that too, teehee) |
| 10:48 | MrMiracle | sure |
| 10:49 | Raynes | You don't actually have to paste their. I like to pretend I can force people to use my pastebin. |
| 10:49 | Raynes | there* |
| 10:49 | MrMiracle | lol |
| 10:49 | AimHere | You mean you're starting to become an actual software ecosystem |
| 10:50 | callen | AimHere: "I am large and contain multitudes" |
| 10:50 | MrMiracle | https://www.refheap.com/paste/8129 |
| 10:50 | Raynes | Does this happen every time? |
| 10:50 | MrMiracle | almost |
| 10:50 | Raynes | It looks like some sort of permission issue. |
| 10:51 | Raynes | I think the repl-port file is in the target/ directory. |
| 10:51 | Raynes | Might be worth while to check permissions on that. |
| 10:52 | MrMiracle | cool, thanks for the tip |
| 10:52 | MrMiracle | I've got some experimenting to do, i'll be back |
| 10:52 | Raynes | As for clojure.contrib libraries, you shouldn't be using them. The old monolithic contrib (the one with one jar and a buttload of nses in it) is deprecated. Most of it was split into several other libraries that you can scan on https://github.com/clojure |
| 10:52 | jeremyheiler | If you're not in a project, then the repl-port is created in the cwd |
| 10:52 | Raynes | I assumed this was in a project. |
| 10:52 | MrMiracle | i'm glad i found the right place, much obliged |
| 10:53 | MrMiracle | it's not |
| 10:53 | MrMiracle | that could be an issue |
| 10:53 | Raynes | Still probably a permissions issue. |
| 10:53 | MrMiracle | i'm just experimenting, like an irb, etc |
| 10:53 | Raynes | MrMiracle: What are you reading that is telling you about clojure.contrib namespaces? |
| 10:53 | Raynes | Chances are it is way too old. |
| 10:53 | MrMiracle | programming clojure |
| 10:53 | MrMiracle | by.... |
| 10:53 | Raynes | You have the first edition of that book. |
| 10:53 | Raynes | The second edition is much more up-to-date. |
| 10:54 | MrMiracle | Stuart Hallaway |
| 10:54 | MrMiracle | yeah i think this one is a bit old |
| 10:54 | Raynes | I also recommend Clojure Programming by Chas Emerick et al. |
| 10:54 | Raynes | It is extremely old. |
| 10:54 | Raynes | Like, probably not very useful at all old. :p |
| 10:54 | MrMiracle | i see |
| 10:54 | Raynes | Clojure was a lot more fast moving when it came out and quite a bit has changed since then. |
| 10:55 | Raynes | But the second edition should be fine. |
| 10:55 | Raynes | Of course, I know it's probably annoying for me to tell you to go spend money. |
| 10:55 | MrMiracle | i'll see if i can track that down, I'm hungry for whatever i can get |
| 10:55 | MrMiracle | i can maybe find it at a library, we have a branch that's pretty hip with programming material |
| 10:56 | Raynes | If you can find Clojure Programming, grab it. |
| 10:56 | Raynes | It's very thorough and up-to-date |
| 10:56 | MrMiracle | i'll keep an eye out for it |
| 10:56 | MrMiracle | thanks guys, |
| 10:56 | MrMiracle | i'll be back on later, is there usually someone on here? |
| 10:56 | Raynes | You're also welcome to learn by reading code and asking questions in here. |
| 10:57 | Raynes | There is currently 519 people in here. Someone is bound to be around. ;) |
| 10:57 | Raynes | s/is currently/are currently/ |
| 10:57 | MrMiracle | excellent, thanks again |
| 10:57 | Raynes | No problem. |
| 10:57 | Raynes | yogthos: Mornin' pardner |
| 10:57 | yogthos | Raynes: howdy :) |
| 10:58 | Raynes | yogthos: I'm going to set you up a ZNC account now. Have like 10 minutes in a few minutes? |
| 10:58 | yogthos | Raynes: yeah sure thing :) |
| 10:58 | Raynes | Awesome. I'll ping you in a few. |
| 10:59 | yogthos | Raynes: cool stuff |
| 11:04 | zilti | How weird. It seems to make a difference if I do (declare macroname) <form-which-uses-macro> (defmacro macro1) (defmacro macroname <uses macro1>) or if I do (defmacro macro1) (defmacro macroname <uses macro 1>) <form-which-uses-macro>. |
| 11:10 | zilti | https://gist.github.com/4462196 <- If someone's interested. I'm not sure if that's a bug? |
| 11:11 | zilti | *Clojure bug |
| 11:15 | tpope | zilti: I'm not sure why it says and, but you're most definitely tring to take the value of clojure.core/or |
| 11:15 | jonasen | kovas: ping |
| 11:16 | zilti | tpope: Whoops. The error is supposed to say "clojure.core/or", not "and". But the first one does not work, but the second does. (as in, compiles). |
| 11:17 | zilti | All three functions and macros are identical in both cases, just the order is different. |
| 11:17 | tpope | zilti: first one you've just declared it, second one you've made a macro |
| 11:18 | abp | zilti, I can reproduce that. |
| 11:18 | zilti | tpope: Yes, I know, and the compiler stumbles over that. In a in my opinion very weird way. |
| 11:18 | tpope | macro expansion happens at compile time, so you can't define a macro after you use it |
| 11:18 | abp | yes |
| 11:18 | abp | now I know why :x |
| 11:18 | zilti | So declare intentionally doesn't work in the case of macros? |
| 11:19 | tpope | that's a very weird way to say it's impossible |
| 11:19 | tpope | it's not like someone went in and added special case code to blow up if you tried to use a macro that doesn't exist |
| 11:21 | Bronsa | try (declare ^:macro foo) |
| 11:21 | Bronsa | no wait, it's still no use |
| 11:26 | abp | Bronsa, at least it works. I still have no knowledge of the internals of Clojure.. |
| 11:43 | brainproxy | recommendation for blog post, tutorial etc. for using java's watch service w/ clojure? |
| 11:45 | tpope | hey what do you call those -*- foo -*- lines that emacs recognizes in files? and does anyone ever use them anymore? |
| 11:50 | gko | file variables? |
| 11:51 | tpope | gko: that's it |
| 11:51 | Raynes | tpope: God I hope not. |
| 11:51 | Raynes | tpope: I compulsively beat the shit out of people who use those things in any editor. |
| 11:52 | gko | tpope: yes, still used. |
| 11:53 | tpope | Raynes: I don't use them in source code. but I've occasionally found the vim equivalent handy for setting the file type of say, some weird file in /etc |
| 11:55 | Raynes | I'M SORRY, I CAN'T HELP IT, I CAN'T STOP |
| 11:55 | abp | of mud? |
| 12:16 | TimMc | tpope: I thought they were called modelines. |
| 12:16 | tpope | TimMc: that's we call them over in vi land |
| 12:16 | tpope | but googling emacs modeline gets me stuff about the bottom line of the screen |
| 12:16 | TimMc | ha |
| 12:16 | technomancy | yeah the modeline is the place it tells you which modes are active |
| 12:17 | tmciver | TimMc: got my macro working based on your advice: wrote a function to return syntax then wrote the macro that apply's its args to it. Thanks bud. |
| 12:18 | TimMc | \o/ |
| 12:44 | Raynes | I would hope so. |
| 12:44 | Raynes | If not, you'd be an excellent troll though. |
| 12:44 | Raynes | Rivaling lajla. |
| 12:44 | gfredericks | ahahaha I take it all back python FTW |
| 12:44 | gfredericks | you suckers fell for it |
| 12:45 | Raynes | I was just glancing in #python. |
| 12:45 | gfredericks | clojure was a good try but it is not named after a snake |
| 12:45 | Raynes | I saw a money wearing a beach ball around his private parts and dancing to Die Young by Ke$ha. |
| 12:46 | gfredericks | a monkey? |
| 12:46 | Raynes | monkey |
| 12:46 | gfredericks | phew |
| 12:46 | Raynes | I sometimes forget letters. |
| 12:55 | djwonk | Is `contains-duplicates?` an idiomatic name for a predicate? |
| 12:55 | antoineB | hello, is it possible to do computation on compile time with macro, in clojurescript? |
| 12:55 | Raynes | djwonk: Sure. |
| 12:56 | gfredericks | djwonk: the only other idea I would have is `duplicates?` if that makes enough sense |
| 12:56 | gfredericks | antoineB: the macros are run in clojure; but otherwise yes |
| 12:56 | gfredericks | (i.e., on the jvm) |
| 12:56 | Raynes | Yeah, or that. Either one is perfectly fine. Whichever you feel is more descriptive. |
| 12:56 | gfredericks | djwonk: also `does-first-arg-to-this-function-have-duplicate-things?!!?` |
| 12:56 | gfredericks | that one is slightly more ruby-style |
| 12:57 | djwonk | gfredericks yes! `is-this-function-name-too-long?` |
| 12:57 | gfredericks | (def is-this-function-name-too-long? (constantly true)) |
| 12:58 | djwonk | or (def ^:const is-this-function-name-long-enough-yet? false) |
| 12:59 | gfredericks | hmmm. How can a clojurescript lib ensure that some clojure code has been run? The hacky thing I can think of is to require-macros on a file just for its load-time side-effects |
| 12:59 | gfredericks | (purpose is to modify the cljs compiler) |
| 13:01 | antoineB | gfredericks: i would like (my-macro obj [-prop 12]) be transform to (set! (.. obj -prop) 12) instead of (set! (.. obj (first [-prop 12])) (second [-prop 12])) |
| 13:02 | gfredericks | antoineB: what's your macro definition currently? |
| 13:03 | antoineB | (defmacro help-deserialize [obj data] `(set! (.. ~obj (first ~data)) (second ~data))) |
| 13:04 | antoineB | the size of data is know at compile time |
| 13:04 | gfredericks | (defmacro my-macro [obj [prop-name data]] `(set! (.. ~obj ~prop-name) ~data)) |
| 13:04 | gfredericks | would that work? |
| 13:04 | gfredericks | maybe s/data/value/ |
| 13:06 | antoineB | gfredericks: yes that works, tahnks |
| 13:06 | gfredericks | antoineB: also would have worked to do (defmacro my-macro [obj data] `(set! (.. ~obj ~(first data)) ~(second data))) |
| 13:07 | gfredericks | antoineB: you want to unquote around the first and second, else they're quoted and emitted instead of run at compile-time |
| 13:08 | antoineB | that works too |
| 13:10 | antoineB | i was thinking i should do ~(first ~data), but that does'nt work |
| 13:14 | thorwil | suddenly midje is of a different opinion then the repl. that is, it somehow got stuck on an older version of the function tested. |
| 13:14 | Raynes | Is there an easy way to copy a var in one namespace to another? Like defalias used to do before it got thrown out of contrib because it was 'broken' (had a misleading name, Stuart Sierra's OCD strikes again, I guess). |
| 13:16 | gfredericks | thorwil: `lein clean`? |
| 13:16 | jeremyheiler | Raynes: mayber refer with :rename? |
| 13:17 | jeremyheiler | I guess, what do you mean by 'copy'? |
| 13:17 | thorwil | gfredericks: didn't help. have no idea how that related to the active "lein immutant run", anyway |
| 13:17 | Raynes | I have a couple of functions in an internal namespace that I'd like to make public in another. |
| 13:18 | jeremyheiler | ahihi2, hmm... |
| 13:18 | jeremyheiler | ah hmm... |
| 13:20 | jeremyheiler | Why not (def bar foo/bar) ? |
| 13:20 | Raynes | Because I need metadata. |
| 13:20 | jeremyheiler | arg |
| 13:21 | Raynes | (intern *ns* (with-meta 'zipper? (meta #'lzip/zipper?)) lzip/zipper?) |
| 13:21 | Raynes | Works, but I'd rather cut my left off at the thigh with a dull blade. |
| 13:21 | Raynes | I only have two fns to do that for, so it is forgivable, but still bleh. |
| 13:22 | jeremyheiler | &(doc intern) |
| 13:22 | lazybot | java.lang.SecurityException: You tripped the alarm! intern is bad! |
| 13:23 | jeremyheiler | ,(doc intern) |
| 13:23 | clojurebot | "([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var." |
| 13:23 | gfredericks | lazybot: turn off the alarm |
| 13:23 | jeremyheiler | That second to last sentence. Do you stil need with-meta then? |
| 13:23 | Raynes | jeremyheiler: Yes. |
| 13:23 | jeremyheiler | cool |
| 13:24 | Raynes | It adopts meta from the name symbol, not the thing you pass as the value. If it did the latter it'd do precisely what I want. |
| 13:29 | Raynes | jeremyheiler: (defmacro defcopy [name oldname] `(intern *ns* (with-meta '~name (meta #'~oldname)) #'~oldname)) |
| 13:32 | jeremyheiler | nice. perhaps update the :name key in the metadata in the case the new name is different. |
| 13:32 | jeremyheiler | and :ns |
| 13:32 | jeremyheiler | maybe not, depends on those are used i guess |
| 13:32 | Raynes | Well, technically that stuff is still correct. |
| 13:33 | jeremyheiler | right |
| 13:33 | Raynes | So it's a little confusing what should and shouldn't be changed. |
| 13:33 | Raynes | I'm probably just going to not do this at all, because I'm entering potemkin territory. |
| 13:34 | jeremyheiler | haha, i suppose it's good practice to not expose another public api as your own *shrug* |
| 13:35 | Raynes | It is my own API, I just had to move it to avoid circular dependencies. |
| 13:35 | jeremyheiler | ah |
| 13:48 | Anniepoo | foo - apt-get leiningen installs freaking openjdk |
| 13:50 | p_l | Anniepoo: ... let me guess, ubuntu? ;P |
| 13:52 | Foxboron | What is the 'best' way for autocompletion? Example: (defn <tab> or defn <tab>? |
| 13:53 | Foxboron | WHen i read it over now i managed to explain it in the worst possible way...hmm |
| 13:54 | Raynes | https://www.refheap.com/paste Working for everyone? Just renewed my SSL cert. |
| 13:54 | uvtc | Can anyone suggest a general rule for when to use a map, vs. when to use a record? |
| 13:54 | gfredericks | Raynes: werks for me and chrome is green |
| 13:54 | Raynes | gfredericks: o/ |
| 13:54 | gfredericks | uvtc: don't use a record |
| 13:54 | Foxboron | Imma go eat some dinner and come back explaining the 'problem' a bit better. |
| 13:54 | uvtc | gfredericks: ! Why? |
| 13:54 | Raynes | uvtc: Do you need something a record gives you? |
| 13:54 | gfredericks | uvtc: not true universally, but a good rule of thumb :) |
| 13:55 | Raynes | If you don't need any features of a record that a map does not have, use a map. |
| 13:55 | uvtc | Raynes: Personally, right now, I do not. I was writing up some notes, and want to write, "Use a map unless $x, $y, or $z". |
| 13:56 | tetzco | Hi - a question regarding java interop: |
| 13:56 | Raynes | Use a map unless you need to implement a protocol or interface for it, I guess? |
| 13:56 | Raynes | Or for some other reason need it to be a specific class. |
| 13:56 | uvtc | Raynes: what does a record give you (other than performance), besides a name for the things you're creating? |
| 13:56 | tetzco | can i somehow store a java member function in a map and call it later? |
| 13:56 | gfredericks | tetzco: would memfn work? |
| 13:56 | Raynes | uvtc: See above. |
| 13:56 | uvtc | Raynes: Yes. Sounds good. |
| 13:57 | gfredericks | the lamest reason to use a record is to enforce a minimum keyset for a map |
| 13:57 | tetzco | gfredericks: i'll have a look (i'm really new to clojure so i don't even know what memfn does) |
| 13:57 | gfredericks | tetzco: or just #(.method someObj) |
| 14:00 | Anniepoo | yes, freaking ubuntu |
| 14:00 | gfredericks | ,(let [m {:thunk #(.substring "foo" 1 3)}] ((:thunk m))) |
| 14:00 | clojurebot | "oo" |
| 14:01 | gfredericks | tetzco: ^ like that |
| 14:01 | Anniepoo | lol - why I quit using Clojure. |
| 14:01 | gfredericks | No results found for "why I quit using clojure". |
| 14:02 | Anniepoo | 'windows is too lame, don't run Clojure on it' , now Its' 'Ubuntu's too lame, don't run Clojure on it' |
| 14:02 | bja | obviously you should only run clojure on an operating system you bootstrapped yourself |
| 14:02 | gfredericks | within a half hour the only google hit for that phrase will be an IRC log of you using it and me reporting on its google hits |
| 14:03 | Anniepoo | yup, apparently |
| 14:03 | Anniepoo | well, if yer a wimp, you can run it on a hacked version of Haiku |
| 14:04 | Anniepoo | sad, sad |
| 14:04 | gfredericks | what's up with ubuntu? I've never needed anything to run clojure besides a jdk; install lein and there it goes |
| 14:04 | uvtc | Is the main purpose of hierarchies for use with multimethods (to implement inheritance)? |
| 14:05 | Anniepoo | trying to manually run the lein script |
| 14:05 | tetzco | gfredericks: Thanks - it'll take a while for me to try this out (i need this in a macro definition and i'm still having a lot to learn …) |
| 14:05 | gfredericks | uvtc: afaik |
| 14:06 | uvtc | Anniepoo: just create (if you don't already have) a ~/bin dir, plop the lein script in there, `chmod +x lein`, then `./lein` |
| 14:06 | uvtc | gfredericks: thanks. |
| 14:06 | Anniepoo | yah, apt-get was offering to install it, I did just that |
| 14:06 | uvtc | Anniepoo: I'd suggest that you don't install Clojure or lein via apt. |
| 14:06 | freakazoid | yo peeps, LTNS |
| 14:07 | Anniepoo | bunch of missing dependencies |
| 14:07 | Anniepoo | 8cP |
| 14:07 | freakazoid | I've got some java source files in my project. Is leiningen supposed to be including the source files themselves into the .jar (with lein uberjar) instead of just the .class files? |
| 14:07 | freakazoid | it is incorporating both at the moment, which seems unnecessary |
| 14:12 | Anniepoo | ok, off to windows |
| 14:12 | uvtc | I wish I could remember where, but I've heard a couple of times that you can often use higher-order functions in place of resorting to polymorphism... can anyone give an example where that's the case? |
| 14:15 | uvtc | Perhaps it's a question better asked on the ML. |
| 14:25 | uvtc | Ah. Sorry. After some searching, found a thread or two on the ML regarding polymorphism and HOFs. |
| 14:40 | Raynes | gfredericks: Thank you for that pr* tweet to Alex Redington. |
| 14:40 | Raynes | You made my day, sir. |
| 14:41 | Raynes | Sometimes flags can be very helpful. I don't much appreciate the implication that I am a bad programmer because I do not write code precisely as he would. |
| 14:42 | gfredericks | Raynes: anytime :) |
| 14:42 | Raynes | gfredericks: For example, https://github.com/Raynes/conch is entirely based around flags to change behavior. The concept would simply not work otherwise. |
| 14:42 | gfredericks | there are a few other print functions I think but not the full set of 16 |
| 14:43 | gfredericks | I forget what they're for |
| 14:44 | Raynes | On second thought, conch might be slightly out of his range. |
| 14:44 | Raynes | I don't think anything there is actually a 'flag', but merely optional information. |
| 14:45 | oskarth | does anyone code clojure from FreeBSD? just curious |
| 14:45 | Raynes | For example :seq could also have a value of :err, not just true or false. |
| 14:45 | gfredericks | yeah it's an interesting argument for the simple case |
| 14:45 | gfredericks | I'd bet tempted to have three functions |
| 14:46 | Raynes | Sure, but there are a million other options as well. |
| 14:46 | Raynes | It'd be more like in the area of 10-20 or more functions. |
| 14:46 | Raynes | Seems like, anyways. |
| 14:46 | Raynes | I might be overestimating how much a process function in conch can do. |
| 14:47 | gfredericks | &(apropos "pr") |
| 14:47 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: apropos in this context |
| 14:47 | gfredericks | oh it's the formatter versions |
| 14:47 | Raynes | No, I'm not. The problem is combinations of informations. I can't be of sound mind and still define functions for every possible combination of conch options. |
| 14:48 | Raynes | And yes, I'm having an argument with myself. |
| 14:48 | Raynes | I haven't slept in quite a while. |
| 14:48 | Raynes | I think I'll go do that now. |
| 14:48 | gfredericks | I guess there's only printf |
| 14:48 | gfredericks | Raynes: goodnight. |
| 14:48 | Raynes | It's more like a nap. |
| 14:49 | Raynes | I can only sleep until 5PM-6PM. |
| 14:49 | Raynes | I suck at sleep. |
| 14:51 | ppppaul | should i use hiccup for writing xml? |
| 14:52 | gfredericks | I've done it but I don't know that that's a supported use case |
| 14:53 | ppppaul | the xml i'm making is simple and isn't using namespaces or anything fancy |
| 14:54 | gfredericks | you're probably fine |
| 14:59 | Anniepoo | for the record, leiningen installed on my windows 7 only griping about a bunch of missing templates |
| 15:03 | ejackson | pppaul: I've done that and it works. Enlive is also an option. |
| 15:05 | ppppaul | i'm looking into clojure.data.xml |
| 15:06 | ejackson | ppppaul: another good xml lib is cheshire |
| 15:06 | ejackson | oops... wrong |
| 15:06 | ejackson | that's json.... |
| 15:07 | gfredericks | json is the best kind of xml |
| 15:08 | Anniepoo | God created json to taunt sinners writing xml |
| 15:10 | ejackson | aaah yes... in the garden of edn or something... |
| 15:10 | gfredericks | what're the details on the / reader bug? it looks like it's not fixed in 1.5-RC1? |
| 15:17 | Anniepoo | aww, for the love of Pete.... |
| 15:18 | technomancy | Anniepoo: don't install leiningen from apt. it's very easy to install by hand on ubuntu. |
| 15:18 | technomancy | the apt version is very outdated |
| 15:18 | Anniepoo | thanks tech- your github page advises otherwise, as I read it |
| 15:19 | Anniepoo | installing on ubuntu constantly conflicted with apt-get offering to install it, so I said to heck with it and went to windows |
| 15:20 | gfredericks | just make sure that ~/bin/lein appears at the front of the PATH |
| 15:20 | gfredericks | can't imagine how that would conflict with anything |
| 15:20 | Anniepoo | hmm... I added ~/bin that's probably it |
| 15:20 | Anniepoo | kk, will try ubuntu again, brb, gonna reboot |
| 15:21 | gfredericks | well ~/bin is fine, just make sure it's before anything else |
| 15:21 | Anniepoo | it is - dunno why it's not working. I did indeed start a new shell |
| 15:22 | technomancy | I'll put a note to make sure to get 2.x before installing from a package manager |
| 15:22 | technomancy | oh, there's already a note saying that |
| 15:22 | Anniepoo | ok, my bad |
| 15:24 | Anniepoo | well, I'm having issues with datomic on win 7, back to ubuntu |
| 15:35 | uvtc | technomancy: I don't think it's wise to advise (on leiningen.org) using your OS's package manager at all. |
| 15:35 | tpope | I think it would be fine if we weren't in a "use the preview version" state |
| 15:36 | uvtc | technomancy: I'd just remove the paragraph at the top of the "Install" section. |
| 15:36 | uvtc | tpope: My guess is, the people who want to install 1.x already know how to go about it. |
| 15:37 | tpope | I mean once 2.0 is out (lol) and has had time to propograte, that would be fine advice again |
| 15:37 | tpope | but you're right, in the meantime, nix it |
| 15:41 | Anniepoo | In early Clojure days I gave a hands on clojure thing for java programmers. I passed out the jars and a .clj and everybody was up - |
| 15:41 | ppppaul | ejackson, data.xml is being good to me... very hiccup like |
| 15:41 | gfredericks | Anniepoo: that still works |
| 15:42 | technomancy | uvtc: yeah, hopefully I can reinstate it once the package managers catch up |
| 15:42 | tpope | are you sure these package managers aren't waiting for 2.0 final? |
| 15:42 | Anniepoo | well, and my constant griping about the struggles with clojure ecosystem actually are becoming less pertinent of late |
| 15:42 | ppppaul | i have a tree walking problem guys... it's been a while since my tree walking days (2 years) and now i'm stuck on something that seems like a simple problem. i have a tree with nodes that have {:tag :value} littered in it. i want to extract all the :values for a type :tag. i want a flattened list as a result... how do i go about this (i'm trying clojure.walk, but i'm super rusty) |
| 15:43 | technomancy | tpope: fedora is but debian isn't |
| 15:43 | ravster | hello everyone |
| 15:43 | Anniepoo | from zero I've got leiningen and clooj running |
| 15:43 | technomancy | I told the fedora guys it was silly to package 1.x, but whatever |
| 15:44 | technomancy | those are the only ones who have contacted me |
| 15:44 | ravster | can someone help me with getting nrepl working? I'm trying to set it up and it just gets stuck at "connecting to nrepl on host:port" |
| 15:44 | Anniepoo | whats the deal with packages that they're always out of date? |
| 15:44 | technomancy | oh, except nix. it's on 1.x because I haven't gotten around to submitting a pull request |
| 15:44 | tpope | well I think it's silly to call it a "preview" when it's the preferred installation, but that's just me :) |
| 15:44 | Anniepoo | SWI-Prolog has the same problem |
| 15:44 | technomancy | Anniepoo: because in most cases stability is much more valuable than newness |
| 15:44 | technomancy | clojure is an edge case |
| 15:45 | technomancy | tpope: in retrospect it wasn't the best choice, but there was no way to know that clojars would take soooooo long |
| 15:45 | Anniepoo | and I get that, but SWI-Prolog does reasonable 'stable' releases |
| 15:45 | technomancy | it's downright amazing how bad the sqlite jdbc drivers are |
| 15:45 | tpope | technomancy: is there a reason you can't change course? punt the signed jars requirement to 2.1? |
| 15:45 | ejackson | ppppaul: I recommend looking at enlive selectors for that, or zippers (there is a specific XML zipper) if enlive can't do ti |
| 15:45 | technomancy | tpope: can't introduce a breaking change in 2.1 |
| 15:46 | tpope | 3? |
| 15:46 | tpope | I assume you're squeamish about 2 back to back major releases |
| 15:46 | technomancy | tpope: if I knew up front it would take this long, I would have called preview1 2.0.0 |
| 15:46 | technomancy | but at this point it seems like it's just around the corner |
| 15:46 | xeqi | preview4 |
| 15:46 | technomancy | xeqi: yeah, maybe not quite preview1 =) |
| 15:46 | uvtc | technomancy: I'm not familiar with "nix". First time I saw the name (can't recall where) I just assumed it meant "*nix" (that is, "some value of Unix"). |
| 15:47 | ibdknox | it always seems just around the corner ;) |
| 15:47 | technomancy | uvtc: yeah, it's a crappy name |
| 15:47 | technomancy | ibdknox: lein's own codebase has been ready since september |
| 15:47 | ppppaul | ejackson, i'm using xml zippers right now, are you suggesting that i use enlive for general tree stuff? |
| 15:47 | technomancy | for the past 3 weeks I've learned new and amazing things about how bad sqlite is every week |
| 15:48 | technomancy | uvtc: amazing software though |
| 15:48 | ibdknox | technomancy: yeah, I know - I go and check if there's a new preview every once in a while :) |
| 15:48 | uvtc | technomancy: what is clojars switching to? Postgres? Or one of the embedded Java db's (Derby, H2)? |
| 15:48 | gfredericks | holy cow guys it's snowing at like 60 degrees from the vertical |
| 15:48 | ibdknox | technomancy: and yeah, the sqlite drivers are astoundingly bad |
| 15:48 | technomancy | I'm literally adding locks to the sqlite calls in order to avoid segfaults |
| 15:48 | technomancy | which are like the two things you use clojure because you never want to think about them again |
| 15:49 | technomancy | uvtc: probably derby; haven't decided yet |
| 15:50 | technomancy | migrating to even another embedded DB for a service like that isn't something you undertake lightly |
| 15:50 | uvtc | technomancy: thanks. At some point I was going to read through the docs on both Derby and H2 and see which made more sense to me. :) |
| 15:50 | technomancy | luckily no matter how bad the DB is it won't screw up downloads |
| 15:50 | ppppaul | github is down :( |
| 15:50 | ppppaul | i feel souless |
| 15:51 | technomancy | uvtc: if you do any research please do let me know. all I've heard is that H2 has better full-text indexing, but IMO using the DB for that is silly when we have lucene indices already generated |
| 15:51 | ibdknox | ppppaul: not for me |
| 15:51 | ppppaul | i can't see the enlive repo |
| 15:51 | Anniepoo | the world would be a better place if they turned the internet off on even numbered days |
| 15:51 | ppppaul | oh it's up now |
| 15:52 | ibdknox | ppppaul: is the cljs pprint stuff up somewhere? :) |
| 15:52 | ppppaul | i don't do cljs |
| 15:52 | xeqi | technomancy: the prebuilt lucene index aren't great for searching either :/ |
| 15:52 | ppppaul | but, why wouldn't it be? |
| 15:52 | uvtc | technomancy: ok |
| 15:52 | technomancy | xeqi: even the legacy ones? |
| 15:52 | ibdknox | you must not be the paul I think you are lol |
| 15:53 | ppppaul | i have more 'p's than the paul you know |
| 15:53 | abp | ibdknox, do you know already when LT 0.3.0 will be released? |
| 15:53 | technomancy | xeqi: I know the segmented ones are annoying but IIRC we should still have access to the monolithic ones |
| 15:53 | ibdknox | abp: shooting for end of Jan |
| 15:53 | xeqi | technomancy: the prebuilt ones include every artifact (group-id, artifact-id, version), so they return results containing lots of different versions of say, hiccup |
| 15:54 | xeqi | I worked around it with some lucence filters, but they are ..... slooooooow |
| 15:54 | technomancy | xeqi: ah, gotcha. in lein search that's appropriate, but in the web UI not so much |
| 15:54 | technomancy | if there's no query syntax to collapse that then I could see the draw of doing it in the DB |
| 15:55 | xeqi | I'm thinking it'll just be better to have a different index, that gets updated on artifact save to only include the latest one |
| 15:55 | technomancy | still with lucene? |
| 15:56 | xeqi | yeah |
| 15:56 | technomancy | sure |
| 15:56 | technomancy | I was musing the other day... how crazy it would be to just store artifact data on the filesystem? |
| 15:56 | technomancy | you could walk the file-seq of the repo to build indices |
| 15:57 | xeqi | haha, I had a similiar thought the other day |
| 15:57 | technomancy | I mean, does the jars table contain anything that's not on the filesystem? |
| 15:57 | ibdknox | technomancy: It makes me sad people don't reach for that as a solution more often |
| 15:57 | xeqi | username |
| 15:57 | technomancy | xeqi: yeah, you have the group name, but that's not enough |
| 15:58 | xeqi | I'm thinking the username isn't really useful though |
| 15:58 | technomancy | could be useful for auditing |
| 15:58 | technomancy | but an append-only log would be better |
| 15:59 | technomancy | HMMMMMMMMMMMM |
| 15:59 | technomancy | bbiab |
| 15:59 | xeqi | technomancy: ooh, promoted_at isn't in the fs |
| 16:00 | gfredericks | man; you complain about a cljsbuild bug, don't do anything to fix it, wait 3 months, and suddenly nobody has fixed it. |
| 16:00 | gfredericks | what is the world coming to |
| 16:02 | ppppaul | i would like to flatten a tree, any pointers? |
| 16:02 | arrdem | ppppaul: (flatten) |
| 16:02 | ppppaul | hmmmm |
| 16:02 | gfredericks | clojure.walk/postwalk if you need more control than that |
| 16:02 | ppppaul | i will try this |
| 16:03 | ppppaul | i'm using prewalk/postwalk but it's tricky |
| 16:04 | ppppaul | flatten isn't doing anything to my tree |
| 16:04 | gfredericks | what does your tree look like? |
| 16:04 | gfredericks | flatten probably doesn't touch maps |
| 16:05 | pandeiro | 6 months later i still haven't figured out how to find where nrepl.el shows (println)s in my code |
| 16:05 | gfredericks | ,(clojure.walk/postwalk #(if (= :foo %) :bar %) {:foo 7 :bam [:foo]}) |
| 16:05 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.walk> |
| 16:05 | arrdem | is there some way that I can prevent the macro expander from qualfying symbols without using gensyms? |
| 16:05 | gfredericks | &(clojure.walk/postwalk #(if (= :foo %) :bar %) {:foo 7 :bam [:foo]}) |
| 16:05 | lazybot | ⇒ {:bar 7, :bam [:bar]} |
| 16:05 | ppppaul | (:tags #{{tag-data}} :page {:number 4}) |
| 16:06 | gfredericks | ,`[here are ~'my ~'symbols] ;; arrdem |
| 16:06 | clojurebot | [sandbox/here sandbox/are my symbols] |
| 16:07 | arrdem | thanks gfredericks |
| 16:07 | gfredericks | arrdem: backtick works indepently of macros |
| 16:07 | gfredericks | independently |
| 16:07 | gfredericks | independentendentdeply |
| 16:07 | arrdem | hehe. spelling is for those who can't speak engleesh |
| 16:08 | arrdem | ,`['symbol] |
| 16:08 | clojurebot | [(quote clojure.core/symbol)] |
| 16:08 | arrdem | ,`[~'symbol] |
| 16:08 | clojurebot | [symbol] |
| 16:08 | arrdem | AH. so the quote prevents it from being (eval)d, and the ~ expands at macro time. |
| 16:09 | gfredericks | ~ unquotes |
| 16:09 | clojurebot | Huh? |
| 16:09 | arrdem | cute! thanks. |
| 16:26 | djwonk | If Java interop is not important to me, do exceptions make less sense? Do functional programs tend to need exception handling? |
| 16:26 | gfredericks | unless you want to pull out the Either monad... |
| 16:27 | gfredericks | then you'll probably still find them useful |
| 16:27 | djwonk | ok, thanks, looking for the big picture in case I was dragging along old habits |
| 16:28 | gfredericks | they should be exceptional of course :) |
| 16:28 | djwonk | right. but I get to define what exceptional is for my API, so it is sort of arbitrary |
| 16:29 | arrdem | gfredericks: can you force clojure to use clisp style signals and restarts? |
| 16:29 | gfredericks | arrdem: I'm not familiar with those; or maybe I was for an hour or two in which case I suspect it's unlikely |
| 16:30 | gfredericks | but maybe there'd be a haxy way |
| 16:30 | gfredericks | you could return functions in the ex-data... |
| 16:30 | arrdem | that could be interesting... |
| 16:31 | gfredericks | (throw (ex-info {:restarts {:who-cares (fn [] ...), :loggit (fn [] ...)}})) |
| 16:31 | gfredericks | that's probably kill your stack info? |
| 16:31 | gfredericks | that's probably the main limitation |
| 16:32 | gfredericks | that's probably the third sentence I start with those two words |
| 16:34 | TimMc | Anniepoo: I forgot you did Clojure stuff. (This is phyzome from foonetic.) |
| 16:35 | djwonk | what are some reasonable choices for a basic runtime error exception? Throwable? Exception? RuntimeException? |
| 16:35 | Anniepoo | hey Phyzome! |
| 16:35 | technomancy | xeqi: would it be crazy to disallow overwriting existing deployments even in the classic repo? |
| 16:35 | gfredericks | Throwable isn't a class I don't think |
| 16:35 | technomancy | it would sure make things simpler |
| 16:35 | Anniepoo | I forgot it too - switched to Prolog a while back |
| 16:35 | technomancy | djwonk: ex-info is the only thing worth using |
| 16:36 | technomancy | unless your code is going to be consumed by a java application |
| 16:37 | djwonk | technomancy: thanks. I was looking for something like that |
| 16:37 | djwonk | ,(doc ex-info) |
| 16:37 | clojurebot | "([msg map] [msg map cause]); Alpha - subject to change. Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data." |
| 16:37 | gfredericks | technomancy: that is some violent imagery |
| 16:37 | technomancy | gfredericks: the gaping maw of tomcat |
| 16:37 | gfredericks | and we never saw that code again |
| 16:38 | technomancy | I think it was Black Francis who said something about violent imagery being more likely to be memorable; throwing a brick leaves more of a mark than blowing smoke or something? |
| 16:38 | technomancy | anyway, slamhound |
| 16:38 | Anniepoo | thanks for the help all - tip o the lid to technomancy |
| 16:38 | technomancy | Anniepoo: open to suggestions for things that could clarify the docs too |
| 16:38 | technomancy | oops |
| 16:39 | gfredericks | ah ha technomancy accidentally opened himself to suggestions |
| 16:40 | xeqi | technomancy: .. I've never pushed the same artifact twice, so I don't think so |
| 16:40 | xeqi | but others might disagree |
| 16:40 | xeqi | its definitly a change |
| 16:40 | technomancy | it can be a bit embarrassing to have your mistakes stay around forever, but it sure simplifies things |
| 16:40 | technomancy | I'll bring it up on the mailing list |
| 16:42 | technomancy | anyone strongly opposed to disallowing re-deploys over the same artifact in classic clojars? |
| 16:42 | djwonk | so you require a version bump? |
| 16:42 | technomancy | djwonk: yeah |
| 16:43 | djwonk | immutability FTW. i like it |
| 16:43 | gfredericks | I think I assumed it was already that way |
| 16:43 | gfredericks | especially since I locked myself out of my account that one time by pushing something |
| 16:44 | gfredericks | djwonkv2: fixed some personal bugs? |
| 16:44 | djwonkv2 | actually, I was just giving myself permission to have new opinions |
| 16:45 | technomancy | haha |
| 16:57 | ppppaul | anyone have good resources for clojure.walk? |
| 16:57 | TimMc | technomancy: Isn't classic Clojars for SNAPSHOTs? Those often involve overwriting. |
| 16:57 | technomancy | TimMc: technically SNAPSHOTs are a new version every time |
| 16:58 | TimMc | hrm |
| 16:58 | TimMc | If you define it that way, then fine. |
| 16:58 | technomancy | the SNAPSHOT version is resolved to the latest timestamped version |
| 16:58 | technomancy | so nothing is overwritten |
| 16:59 | TimMc | Architecture question: I want to write an email autoresponder that crunches inbound requests and sends back the answer. |
| 17:00 | technomancy | TimMc: answer: implement ring for SMTP |
| 17:00 | TimMc | haha |
| 17:00 | TimMc | hmm |
| 17:00 | technomancy | if you don't, someone else will |
| 17:00 | TimMc | That's... actually a kind of interesting idea. |
| 17:01 | TimMc | I was thinking of how the autoresponder portion should be broken down. |
| 17:01 | technomancy | if it doesn't have middleware I'mma call the ~gourds on you |
| 17:02 | TimMc | There's some complexity that I don't know where to put: I want rate-limiting on email responses. |
| 17:05 | TimMc | I can see writing this as an email autoresponder library, as you say. Perhaps it should be more generic, like a message queue, an email retriever, and an email sender all hooked together by the main app. |
| 17:07 | abp | ppppaul: Are you still trying to 'flatten' some datastructure? |
| 17:07 | ppppaul | yeah, i'm currently using some maps and groupby |
| 17:08 | abp | So your asking about walk isn't related? |
| 17:08 | ppppaul | it is |
| 17:08 | ppppaul | i want a more general solution |
| 17:09 | ppppaul | i want to be able to pluck values from anywhere in my tree and matches a key |
| 17:09 | ppppaul | *that matches a key |
| 17:11 | abp | Hm ok, I used an atom to collect things of interest while walking. |
| 17:11 | ppppaul | i was thinking about that |
| 17:11 | ppppaul | i thought there may be a functional approach |
| 17:12 | ppppaul | i did something like this in JS without mutations |
| 17:12 | ppppaul | a year ago :( |
| 17:13 | abp | Yeah, it doesn't feel quite right.. I thought that too until I was told I should just do it. |
| 17:14 | djwonk | TimMc : maybe this can give you inspiration for SMTP middleware? https://github.com/amccloud/django-firstclass/ |
| 17:15 | ppppaul | adp it's probably much faster to use an atom, at least |
| 17:15 | ppppaul | there would be tons of transformations for flattening a tree |
| 17:21 | ferd | help: I cannot find a clean way to structure my code to support multiple DB implementations |
| 17:21 | technomancy | ferd: is your code a library or an application? |
| 17:21 | ferd | multimethods and protocols give me runtime polimorphism... but in this case that's not really what I need. What I'm thinking of is a may to have a single db namespace that the app uses, and then backend namespaces (db.postgres, db.mem, etc)... and at init time somehow populate the former with the vars of one of the latter. Am I clear? |
| 17:21 | ferd | an app |
| 17:22 | technomancy | application portability across database implementations is a myth |
| 17:22 | technomancy | for nontrivial applications |
| 17:22 | technomancy | it looks easy, but it's impossible to do well. |
| 17:22 | ferd | technomancy: I mostly agree... but my question is more general |
| 17:23 | ferd | I mean, the same question goes for DBs, queuing transports, etc |
| 17:23 | technomancy | oh I see. yeah, you sort of want a circular dependency |
| 17:23 | technomancy | that's one of my least favourite things about multimethods =\ |
| 17:23 | ferd | mmm no, why do you say circular? |
| 17:24 | technomancy | well, you have the namespace that contains the defmulti and you have the defmethod implementations in namespaces that require the defmulti namespace |
| 17:24 | technomancy | but you want application code to be able to just require the defmulti and have the defmethods available automatically |
| 17:25 | ferd | right... but besides that, multimethods don't feel right. What's the dispatch function? a constant ? |
| 17:25 | technomancy | one way to do it is to have the defmulti namespace search the classpath for all namespaces under a given pattern (myapp.db.*) and require them all at the end of the namespace. |
| 17:25 | technomancy | nothing wrong with using config-based constantly in your dispatch fn |
| 17:26 | ferd | I don't really need runtime dispatch... I was hoping for something simple, like ... I wish I could load a namespace (say db.postgresql) under the name of another (db) |
| 17:27 | ferd | ...well, if you say that there's nothing wrong with using config-based constantly as dispatch fn, then I don't feel that bad :-) |
| 17:28 | technomancy | it's been a while since I've worked on a large application in Clojure. there are probably others here with differing opinions, but I didn't find it bad. |
| 17:28 | ferd | I do find it a bit weird |
| 17:29 | ferd | another thought was: define a dbprotocol, then have each db.xyz implement it, and then somehow create "wrapper" functions in namespace db, which just call the protocol functions on the db "impl" instance (am I clear?) |
| 17:30 | technomancy | you could also use alter-var-root to change the interface defn to whatever the current config happens to point at |
| 17:30 | technomancy | IMO protocols are a terrible fit for this because they impose themselves on your arglist |
| 17:30 | technomancy | the alter-var-root approach would be faster if that matters |
| 17:30 | ferd | that's why I'm saying to wrap them |
| 17:32 | technomancy | it's a bit odd but if you're using it only at application boot I'd say it's kosher |
| 17:32 | abp | ferd: I've heard of someone that they are doing querying through middlewares to concrete datastores. So you always have a request to some storage and a response, just like ring for the web. |
| 17:35 | ferd2 | technomancy: damn... I lost power here and lost our conversation |
| 17:35 | technomancy | ferd2: just missed this: it's a bit odd but if you're using it only at application boot I'd say it's kosher |
| 17:35 | technomancy | and <abp> ferd: I've heard of someone that they are doing querying through middlewares to concrete datastores. So you always have a request to some storage and a response, just like ring for the web. |
| 17:36 | TimMc | technomancy: Oh, as for Clojars overwriting... is this going to be problematic for the snapshots/releases distinction? I don't want to bump the version just to sign a jar. |
| 17:36 | technomancy | TimMc: hm... good point; I hadn't thought of that |
| 17:36 | technomancy | what if we used the presence of the signature to block redeploys? |
| 17:39 | TimMc | technomancy: How about only blocking overwrites when a jar has been promoted? |
| 17:40 | technomancy | TimMc: that's what we currently do. I'd like to be able to make the call based on the state of the repository alone rather than bringing a DB into it though. |
| 17:40 | TimMc | I see. |
| 17:40 | technomancy | brainstorming: http://p.hagelb.org/clojars-events.html |
| 17:42 | abp | ferd2: http://clojure-log.n01se.net/ |
| 17:43 | technomancy | what's the possessive of Clojars? |
| 17:44 | technomancy | Clojars's? |
| 17:44 | clojurebot | next-gen clojars is http://groups.google.com/group/clojars-maintainers/browse_thread/thread/77c1cd77e478bb0f |
| 17:44 | technomancy | thanks clojurebot you're a pal |
| 17:44 | abp | technomancy, why are you using sqlite for Clojars? Have seen some of your struggle with the drivers etc. |
| 17:44 | technomancy | abp: it wasn't my choice |
| 17:44 | technomancy | if I had known about these issues I would have rewritten the DB layer much sooner |
| 17:44 | abp | To much work to use something else now? |
| 17:45 | technomancy | abp: I thought we could work around the flaws, but I no longer think that's a good idea. |
| 17:45 | technomancy | abp: http://p.hagelb.org/clojars-events.html <- my current plan |
| 17:45 | ferd | abp: thanks |
| 17:47 | abp | technomancy, so why aren't you guys considering datomic? Lucene indexing is a property of attributes for instance. |
| 17:47 | technomancy | I would really hate for Clojars not to be fully OSS |
| 17:47 | technomancy | Lucene is really fantastic technology |
| 17:49 | abp | Haven't done anything with Lucene, the same goes for datomic besides tampering. But in the light of it's advancements insisting on being 100% OS is probably not the best choice. Pro licenses are also available for free to OS-projects, I think. |
| 17:49 | mak3r | hey guys, anyone know the best way to explore the friend test mock app, in a jetty instance ? |
| 17:51 | ferd | abp: do you know of any app in production using datomic? |
| 17:54 | abp | ferd: Actually nothing despite OS-projects. But we'll probably use it for an upcoming project at work over the next months. |
| 17:54 | mak3r | ferd: we've got a product in pilot with datomic, and two to go live beginning of Feb |
| 17:56 | mak3r | ferd: one with a well known multinational (not able to divulge just yet) |
| 17:56 | mpan | mak3r: how has the experience been? compared vs a more traditional database? |
| 17:56 | ferd | I'm very tempted to use datomic on a new project... but I see little case stories. |
| 17:56 | mpan | any particular big ideas you guys ran into? |
| 17:57 | mpan | and if you don't mind me asking, what was your motivation for choosing it? |
| 17:57 | mak3r | ferd: I'll put something together once it is official |
| 17:57 | mak3r | mpan: a great experience, does as it says on the tin for us so far |
| 17:58 | abp | mak3r: regarding your friend question: I just built a app with form-auth myself to try it. The examples didn't exist then but it was easy. |
| 17:58 | mak3r | mpan: I'd say we feel liberated now we are not constrained by more traditional features of RDBMS |
| 17:58 | ferd | mak3r: which backend are you using? dynamo? I was wondering of the option of using the embedded h2 is solid for production |
| 17:58 | mpan | mak3r: any specific examples of constraints you no longer have? |
| 17:59 | mpan | I'm curious because, personally, I'm happy with traditional RDBMSes, but I'm not sure how much of that is just due to not having seen much of what else is out there |
| 17:59 | mak3r | ferd: atm just in memory, have tested on dynamo and will switch to it soon as we exit pilot, for the bespoke projects I mentioned will be Riak |
| 17:59 | mak3r | abp: awesome... got any pointers on the process with friend ? |
| 18:00 | abp | mpan: That sounds like you've never seen a schema getting over-complicated just by relational constraints. |
| 18:00 | mak3r | mpan: tying attributes and reusing across entities is awesome |
| 18:00 | mpan | abp: I've mostly seen constraints-enforced-at-application-level, so sorry but I'm not sure what you're referring to |
| 18:00 | abp | abp: It wasn't more than a simple test. Auth, eat your cookie and you are in. Nothing in production. |
| 18:01 | abp | mpan: ^ |
| 18:01 | mak3r | mpan: its very fluid, the only anchor being datatype on a given attribute (at least the only one that really can cause problems) |
| 18:01 | abp | mak3r: ^ |
| 18:01 | abp | autocompletion and mistyping is hitting me hard. :D |
| 18:01 | mak3r | haha, no worries |
| 18:02 | mpan | the other thing I'm wondering is: are there other database systems with similar properties? |
| 18:02 | mpan | something for a frame of reference? |
| 18:02 | abp | mpan: I was referring to more abstract or complex models being laid out in a relational fashion. It just doesn't work, produces SQL-bandworms and isn't generally healthy for developers minds.. |
| 18:03 | mak3r | mpan: its half way between relational and key/value |
| 18:03 | mak3r | mpan: I think there _will_ be clones, but right now it is new territory |
| 18:04 | mpan | thanks guys |
| 18:04 | mak3r | no problem |
| 18:05 | TimMc | djwonk: I'm not taking technomancy's bait. Someone else can do the ring-for-email thing. |
| 18:05 | technomancy | abp: you're free to your opinion, but clojars will always be 100% oss as long as I can help it |
| 18:05 | TimMc | I already shaved one yak for this project. |
| 18:07 | abp | technomancy, weren't trying to insult you or something. I just don't get that mindset, I think. You live of some closed source too, don't you? Along the way you and your company can produce OS. So without proprietary things and their usage there wouldn't be as much OS.. |
| 18:12 | technomancy | actually all the projects I'm working on at work are creating OSS replacements for proprietary code |
| 18:12 | AimHere | You are Stealing From America! |
| 18:12 | hyPiRion | technomancy: Oh, that reminds me, do you actually develop OSS for a living? |
| 18:13 | technomancy | I understand there are some codebases where that's more difficult due to work, but I sure am not going to contribute to that when it's up to me. |
| 18:13 | arrdem | AimHere: aiming... |
| 18:13 | mak3r | technomancy: lucky, sounds awesome... I've always had too much commercial pressure to go that route |
| 18:13 | technomancy | especially not when I'm not getting paid for it =) |
| 18:13 | technomancy | hyPiRion: yeah |
| 18:13 | technomancy | https://github.com/technomancy/sokoban, https://github.com/nzoschke/code, https://github.com/heroku/buildkits |
| 18:14 | hyPiRion | technomancy: That explains stuff, and it also makes me envy |
| 18:24 | abp | Ok, so we probably should try to get Rich, Stuart & co to start a hosting business so they can open source datomic. ;) |
| 18:25 | TimMc | heh |
| 18:26 | amalloy | technomancy: yeah, clojars's |
| 18:27 | technomancy | amalloy: thanks =) |
| 18:29 | technomancy | in this case the data model is so simple that I don't think it'd be much work to implement with a log file and lucene |
| 18:29 | technomancy | there are literally only three events |
| 18:30 | ravster | whats the setting to have paredit autoloaded with clojure-mode in emacs? I can't seem to find the right command. |
| 18:30 | technomancy | event types |
| 18:30 | technomancy | ravster: (add-hook 'clojure-mode-hook 'paredit-hook) |
| 18:31 | ravster | technomancy: thanks |
| 18:36 | technomancy | hyPiRion: FWIW I spend more time maintaining the existing projects than actively replacing them, but I'm grateful that I have the chance to do so |
| 18:37 | hyPiRion | Still better than closed source |
| 18:37 | hyPiRion | At least I find OSS more fun to work with, maybe that changes if it's your job. |
| 18:38 | technomancy | heh; well the clojure is more fun than the ruby either way |
| 18:38 | Sgeo | I guess I'd have more of a chance of finding a job that uses Clojure than one that uses Racket? |
| 18:39 | TimMc | Yeah. |
| 18:40 | technomancy | maybe unless you work for MIT or something =) |
| 18:40 | TimMc | I've *seen* job postings for Clojure developers. |
| 18:40 | TimMc | technomancy: NEU is more likely for Racket. |
| 18:40 | technomancy | what's that? |
| 18:41 | TimMc | Northeastern University |
| 18:41 | TimMc | At least 2 of the Racket devs teach there. |
| 18:41 | TimMc | At MIT I would expect MIT Scheme. :-) |
| 18:41 | zilti | When I start studying I have to go back to the Java nightmare... |
| 18:41 | Sgeo | zilti, my condolences |
| 18:41 | technomancy | doesn't MIT have like three schemes? |
| 18:43 | zilti | Sgeo: There was a time I really really liked Java. Because it was the only language I knew. |
| 18:44 | TimMc | zilti: It was pretty fantastic coming from TI-89 Basic. :-P |
| 18:44 | Sgeo | zilti, I think you could say something like that about me and Python. Python wasn't the only language I knew, but it was the only language that seemed to be free for me to use |
| 18:44 | Sgeo | Although hmm, I know I've read about Java before then |
| 18:45 | zilti | I hated Python after the first time I had to re-indent a 200-line source file by hand. |
| 18:45 | Sgeo | I never had to do that |
| 18:45 | Sgeo | However, now I can't really stand the broken lambda synta |
| 18:45 | Sgeo | syntax |
| 18:45 | amalloy | zilti: i think you mean you hated your editor? surely doing it by hand is never necessary |
| 18:46 | technomancy | don't you have to do it by hand when there are merge conflicts? |
| 18:46 | amalloy | i dunno. i don't actually write any python, i'm just a busybody |
| 18:46 | arrdem | amalloy: no.. I had an argument about this a while back. If indentation is syntactically significant then loss thereof constitutes a loss of information and therefore cannot be reconstructed by a computer. |
| 18:47 | arrdem | with a gurantee of correctness at least. |
| 18:47 | zilti | amalloy: It's problematic enough that such a thing depends on your editor. |
| 18:49 | zilti | Hmm I forgot the name of the editor and can't find it. It was a pretty popular one (I think), basically just an Editor with syntax highlighting and a REPL. |
| 18:49 | arrdem | was it Idle? that's the standard packged python editor/repl... |
| 18:50 | zilti | Oh, yes. That was it. Well, python.org seems to be down. |
| 18:58 | arrdem | ,(doc rename) |
| 18:58 | clojurebot | Huh? |
| 19:01 | arrdem | is there an idiomatic way to update several functional objects at once? right now I'm trying to build a map, then update-in on each step and it isn't behaving nicely. |
| 19:04 | AimHere | nested update-ins should work, though it's not pretty, for sure |
| 19:05 | AimHere | I'd guess that building something out of reduce would be the neatest answer |
| 19:06 | AimHere | Something along the lines of (reduce #(apply update-in %1 %2) initial-map [keyvec1 keyvec2 keyvec3 ...]) |
| 19:07 | AimHere | minus the 'apply |
| 19:07 | hyPiRion | not minus the apply. |
| 19:07 | AimHere | Isn't it (update-in map vec) ? |
| 19:07 | arrdem | this is what I've cooked up... https://www.refheap.com/paste/8133 |
| 19:07 | arrdem | AimHere: it's (update-in map path fn & args) |
| 19:08 | hyPiRion | ,(reduce (partial apply update-in) {:a 1, :b 2} [[[:a] inc] [[:b] + 3]]) |
| 19:08 | clojurebot | {:a 2, :b 5} |
| 19:08 | AimHere | Oops yes. I'm confused with get-in |
| 19:21 | TimMc | technomancy: Have you made signed jars for any of your projects yet? If so, have you self-signed or used a CA? |
| 19:24 | technomancy | TimMc: PGP doesn't really have CAs afaik |
| 19:24 | technomancy | it operates under a web of trust model |
| 19:24 | TimMc | Oh, hmmm... right. |
| 19:24 | technomancy | TimMc: `lein deploy clojars` should automatically try to sign artifacts before deploying them |
| 19:25 | TimMc | Does it prompt for key choice? I don't want it to use my regular key. |
| 19:25 | technomancy | hmm... I don't think we've added that yet. definitely an oversight. |
| 19:25 | hyPiRion | yeah |
| 19:26 | hyPiRion | I think I had to specify key last time I used it |
| 19:26 | technomancy | there are definitely edge cases that haven't been thought through |
| 19:27 | TimMc | hyPiRion: Oh, that's fine then. |
| 19:27 | TimMc | As long as it doesn't grab .ssh/id_rsa and run with it. |
| 19:28 | hyPiRion | oh right, I thought you meant GPG. |
| 19:28 | TimMc | Derp, those are RSA keys. |
| 19:29 | technomancy | clojars only uses ssh for scp deploy, I've been recommending lein deploy over scp. |
| 19:31 | bbloom | apparently *print-meta* doesn't work for vectors? |
| 19:32 | bbloom | or maybe it sometimes doesn't work? or maybe i have a bug.... |
| 19:32 | bbloom | lol |
| 19:32 | bbloom | ,(let [v ^:v [] m ^:m {}] (binding [*print-meta* true] (prn v m))) |
| 19:32 | clojurebot | ^{:v true} [] ^{:m true} {} |
| 19:33 | hyPiRion | Well, that seems to work. |
| 19:33 | ravster | I'm using data.zip.xml and its turning a <Number> into a character. How do I force it to be a string? |
| 19:33 | bbloom | it seems to be something special with the :type value |
| 19:34 | bbloom | er key |
| 19:35 | bbloom | or maybe i'm just going crazy... |
| 19:35 | arrdem | (assoc-in [0] [0] 1) |
| 19:35 | arrdem | ,(assoc-in [0] [0] 1) |
| 19:35 | clojurebot | [1] |
| 19:36 | bbloom | https://www.refheap.com/paste/8134 |
| 19:36 | bbloom | hyPiRion: see that ^^ wtf? |
| 19:36 | bbloom | lol |
| 19:39 | TimMc | Hey, why does lein2 want my clojars password? |
| 19:39 | hyPiRion | bbloom: Reproduceable |
| 19:39 | TimMc | deploy doesn't use SSH? |
| 19:40 | bbloom | hyPiRion: ok, so i'm not crazy? :-) |
| 19:40 | hyPiRion | bbloom: It omits :type for some reason |
| 19:41 | bbloom | hyPiRion: hmm, seems to be intentional behavior |
| 19:41 | bbloom | confusing as hell |
| 19:41 | TimMc | (def x (with-meta [1 2 3 4] {:type :foo :bar :baz})) |
| 19:41 | TimMc | (binding [*print-meta* true] (pr-str x)) ;;= "^{:bar :baz} [1 2 3 4]" |
| 19:41 | hyPiRion | bbloom: whut, why? |
| 19:42 | bbloom | hyPiRion: why is it intentional? or why is it confusing? |
| 19:42 | hyPiRion | intentional |
| 19:42 | bbloom | i have no idea.... |
| 19:42 | bbloom | maybe because that's what print-dup is about? |
| 19:43 | hyPiRion | *shrug* |
| 19:43 | bbloom | kinda sucks though b/c it's baked into print-method :default |
| 19:43 | bbloom | soo if you write your own print-method, you need to know about that subtle behavior and replicate it |
| 19:44 | TimMc | I'm not going to mess with all this gpg-agent and credentials.clj stuff. Too complicated. |
| 19:46 | TimMc | (I'm not trying to be bitchy; it's just more than I feel I should have to deal with to release stuff.) |
| 19:46 | cjfrisz | evening, folks |
| 19:47 | bbloom | TimMc: i agree with you to some extent. it was surprisingly complicated to set up on my previous mac, so i just didn't bother on my new machine |
| 19:49 | hyPiRion | TimMc: I agree with that |
| 19:51 | bbloom | i can't tell how i feel about metadata in general |
| 19:51 | bbloom | sometimes, it's fantastic |
| 19:51 | bbloom | sometimes, it's annoying as hell |
| 19:51 | bbloom | particulary things like :tag and :type |
| 19:51 | eipi10 | ,(first '("foo")) |
| 19:51 | clojurebot | "foo" |
| 19:52 | bbloom | some operations preserve metadata, others don't |
| 19:52 | bbloom | you need to really *think* about it or just try it before you know whether or not you'll get metadata preserved |
| 19:52 | bbloom | and then sometimes you want the opposite of whatever the operation does |
| 19:55 | tomoj | 1.5 reportedly improves metadata preservation |
| 19:55 | tomoj | probably still some problems left |
| 19:55 | ravster | How do I make sure that all the values of a map are strings, and if not, turn them into strings? I'm wondering if there is already a function that does something like that. |
| 19:56 | bbloom | tomoj: glad to hear, i found CLJ-916 |
| 19:56 | tomoj | there is no such function |
| 19:56 | tomoj | in 1.5, (reduce-kv #(assoc %1 %2 (str %3)) {} a-map) could work |
| 19:57 | tomoj | hopefully someday (but not today): (into-kv {} (r/map str a-map)) |
| 19:57 | ravster | hmm, I just found map-values in clojure.contrib.datalog.util |
| 19:57 | bbloom | ravster: (into {} (for [[k v] a-map] [k (str v])) |
| 19:57 | bbloom | or, in light of the metadata discussion: |
| 19:58 | bbloom | (into a-map (for [[k v] a-map] [k (str v])) |
| 19:58 | bbloom | to preserve the metadata lol |
| 19:58 | ravster | nice |
| 19:58 | bbloom | i'm missing a ) in there |
| 19:58 | bbloom | i should avoid coding in my IRC window... |
| 20:00 | ravster | hehe |
| 20:02 | ravster | thanks bbloom, the into works great. |
| 20:02 | seangrove | Is there an (or this that) that will return 'this' if 'this' is false and not nil? |
| 20:02 | seangrove | (if (nil? this) that this) |
| 20:02 | gfredericks | nope |
| 20:03 | seangrove | Ok, no problem |
| 20:35 | gfredericks | I don't imagine cljsbuild provides any mechanism for extending the compiler at runtime? |
| 20:36 | bbloom | gfredericks: extending it in what way? |
| 20:38 | gfredericks | bbloom: e.g., extending some of the multimethods |
| 20:38 | bbloom | analyze and emit ? |
| 20:38 | gfredericks | which kind of implies "running arbitrary code before the compiler gets called" |
| 20:38 | gfredericks | yeah those sort |
| 20:38 | bbloom | i doubt cljsbuild offers that... but i'm not entirely sure how it would be useful. what's your use case? |
| 20:39 | gfredericks | numbers! |
| 20:39 | bbloom | numbers? |
| 20:39 | clojurebot | (pl reverse $ (↕reduce range $ 10 () λxy (↕conj inc $ y x))) |
| 20:39 | gfredericks | bigints and ratios specifically |
| 20:39 | bbloom | are you adding support for bigints and ratios to cljs ? |
| 20:40 | bbloom | if so, why not just run a patched version of the compiler? |
| 20:40 | bbloom | it's pretty easy to use a local checkout |
| 20:40 | bbloom | and then contribute those :-) |
| 20:40 | gfredericks | I thought I'd start off with a lib |
| 20:40 | gfredericks | every time I talked to dnolen about it it sounded rather difficult to get it in |
| 20:41 | bbloom | gfredericks: did he specify why? perf? |
| 20:41 | gfredericks | perf and design questions I think |
| 20:41 | gfredericks | I started up a design page about it |
| 20:41 | bbloom | yeah, i'm reasoning about the design now.... |
| 20:41 | bbloom | i suspect that perf would suck unless you *opted in* to it |
| 20:41 | dnolen | bbloom: gfredericks: fwiw even Dart has punted on this |
| 20:41 | bbloom | heh |
| 20:41 | dnolen | and think about how much money they're spending on that |
| 20:42 | gfredericks | opt-in would be fine with me, as long as it's opt-in for the whole program |
| 20:42 | gfredericks | so you can use all the regular functions |
| 20:42 | bbloom | gfredericks: well, that's sorta the problem |
| 20:42 | bbloom | if it's opt in to the whole program, it makes all non ratios slower too |
| 20:42 | bbloom | b/c you suddenly need generic + and friends |
| 20:43 | gfredericks | yep |
| 20:43 | dnolen | gfredericks: opt-in for the whole programs doesn't make much sense. Since you would tank the performance of the core library as well. |
| 20:43 | bbloom | gfredericks: i think you're better off starting with a lib that doesn't impact the reader in any way |
| 20:43 | gfredericks | was there an idea about having primitive versions, like +' *', etc? |
| 20:43 | bbloom | ie just provide a factory function (ratio 5 10) |
| 20:43 | gfredericks | bbloom: well I can even write a macro that enables the literals |
| 20:43 | gfredericks | bbloom: I already have this lib |
| 20:43 | dnolen | gfredericks: no because that would be backwards from Clojure JVM |
| 20:44 | gfredericks | dnolen: okay +''' and *''' then :P |
| 20:44 | bbloom | gfredericks: so then go with the macro, don't bother with patching the cljs env |
| 20:44 | dnolen | gfredericks: I don't see why you don't just do you're own generic math lib. what's the problem? |
| 20:44 | gfredericks | I am doing it; I started with a question about how to make it nicer to use |
| 20:44 | dnolen | gfredericks: ok sorry missed that. |
| 20:44 | gfredericks | i.e., not requiring a top-level macro to use literals |
| 20:45 | tomoj | can't you just put the defmethods in the macro ns and :require-macros it? |
| 20:46 | bbloom | seems like a bad idea to mutate the compiler.... you'd have to disable your changes as well to prevent breaking libraries that don't expect it |
| 20:46 | bbloom | at which point you'd have (enable-literals!) and (disable-literals!) |
| 20:46 | bbloom | and might as well have (with-literals-macro ...) |
| 20:46 | bbloom | maybe turning it on for a namespace? *shrug* |
| 20:46 | tomoj | if the library is a staging ground for a compiler patch, why not mutate the compiler? |
| 20:48 | bbloom | tomoj: because the library is useful without the literals, etc, is it not? |
| 20:48 | bbloom | tomoj: might as well publish that |
| 20:48 | bbloom | and then we have a basis from which to discuss the complexities of fast numerics |
| 20:48 | bbloom | are you modifying all of the core functions too? :-/ |
| 20:49 | arrdem | ,(doc reduce) |
| 20:49 | clojurebot | "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i... |
| 20:49 | gfredericks | bbloom: what libraries would rely on numeric literals not compiling? |
| 20:50 | bbloom | gfredericks: i don't think anyone would break unless you had a bug or they depended on undefined behavior |
| 20:50 | bbloom | gfredericks: but their perf would surely suck unexpectedly :-P |
| 20:50 | gfredericks | not modifying core functions, just making 7/5 compile to (ratio 7 5) |
| 20:50 | gfredericks | so shouldn't effect exterior perf either |
| 20:51 | gfredericks | external* |
| 20:51 | bbloom | ,(+ 2 5/7) |
| 20:51 | clojurebot | 19/7 |
| 20:51 | bbloom | that wouldn't work even with your patch right? |
| 20:51 | gfredericks | depends what + refers to |
| 20:51 | gfredericks | I have my own + |
| 20:51 | bbloom | does your compiler "plugin" sub in your + or do you have to manually :refer that ? |
| 20:52 | gfredericks | the latter |
| 20:52 | gfredericks | so it's lib-style |
| 20:52 | bbloom | yeah, so then there isn't much benefit and a bunch of confusion in having literals |
| 20:52 | gfredericks | isn't much benefit? |
| 20:52 | gfredericks | why do we have them in clojure? |
| 20:52 | bbloom | the literals don't compile to (cljs.core/ratio 5 7) they compile to (your.lib/ratio 5 7) |
| 20:53 | bbloom | the literals are in clojure b/c they are well integrated |
| 20:53 | gfredericks | :/ okay |
| 20:53 | bbloom | i'm not trying to shit on your work... i would love to see ratios in cljs |
| 20:53 | bbloom | but dnolen is right: it's a haaaard problem to do well |
| 20:54 | bbloom | the JVM happened to already have solved this to some extent with good perf on the Number type, etc.. .and even then i believe JVM clojure had some numerics struggles & still does |
| 20:54 | gfredericks | I wasn't trying to integrate them into cljs, I was trying to have my lib extend the compiler for convenience. But I see why that my be sneaky. |
| 20:54 | gfredericks | may* |
| 20:54 | bbloom | gfredericks: yeah, i'd avoid extending the compiler in any transparent way |
| 20:55 | bbloom | it's potentially possible that clojure could have some kind of namespace level flags thing for compiler plugins |
| 20:55 | bbloom | like a :plugins key in the ns form |
| 20:55 | gfredericks | that sounds interesting |
| 20:56 | bbloom | but that would likely be shunned in the same was as :use |
| 20:56 | bbloom | as too much magic :-P |
| 20:56 | bbloom | in the meantime, you can just do (my-wrapping-macro-thinggie ...) |
| 20:56 | gfredericks | yep |
| 20:56 | bbloom | or maybe the equivilent of *warn-on-reflection* |
| 20:57 | gfredericks | how does that work with cljs? |
| 20:57 | bbloom | some macro that expands (enable-ratios!) to (defmethod emit ...) and (set! *ratios-enabled* true) |
| 20:57 | bbloom | gfredericks: it doesn't |
| 20:57 | bbloom | but you can have macros that just expand to nil and then have side effects in the compiler |
| 20:57 | bbloom | if you really insisted on getting the syntax support |
| 20:57 | gfredericks | ah right |
| 20:57 | bbloom | but really, it seems sketchy as hell to me :-) |
| 20:58 | gfredericks | you can't undefmethod though |
| 20:58 | gfredericks | can you? |
| 20:58 | bbloom | (doc remove-method) |
| 20:58 | clojurebot | "([multifn dispatch-val]); Removes the method of multimethod associated with dispatch-value." |
| 20:58 | gfredericks | now if only you could defmethod in a thread-local way |
| 20:58 | bbloom | but you wouldn't want to do that, you'd want to install the method only once and then have a flag to enable/disable it |
| 20:58 | arrdem | ,(let [{odd false even true} (group-by odd? (range 5))] (println odd even)) |
| 20:58 | clojurebot | [0 2 4] [1 3] |
| 20:58 | bbloom | hence the flag |
| 20:58 | bbloom | you (def ^:dynamic *enable-ratios* false) |
| 20:59 | bbloom | and then use binding on that |
| 20:59 | gfredericks | bbloom: that still changes the behavior while the flag is off, technically :P |
| 20:59 | tomoj | except it needs to be a, uh, special var? |
| 20:59 | bbloom | gfredericks: yeah, but at least it won't fuck anyone up |
| 20:59 | gfredericks | seems unlikely to fuck anybody up more in either case |
| 20:59 | tomoj | like *unchecked-if* ? |
| 20:59 | bbloom | yeah, this is basically how unchecked-if works... i believe |
| 21:00 | tomoj | well I guess you can just have a macro that sets the var clj-side |
| 21:00 | bbloom | tomoj: yeah that's what i'm suggesting |
| 21:00 | bbloom | tomoj: this is my complaint about the top level again... |
| 21:00 | bbloom | dnolen: (when false (def x 1)) :-( |
| 21:00 | tomoj | seems like that would be a better way to do *unchecked-if* too |
| 21:01 | bbloom | the right way to do it would be to define the top level at compile time and require a main function :-) |
| 21:01 | bbloom | but that's a pretty dramatic change to clojure semantics |
| 21:10 | gfredericks | hmmm. how do I get the /src-cljs into the jar again? add it to :source-paths? |
| 21:11 | bbloom | i just symlink my clojurescript checkout into my project directory |
| 21:11 | gfredericks | I mean for jarring up my lib |
| 21:11 | gfredericks | I just got the /src and not the /src-cljs |
| 21:11 | bbloom | oh, havent done that yet, no idea :-P |
| 21:11 | bbloom | ask technomancy |
| 21:12 | tomoj | src-cljs or src/cljs? |
| 21:12 | tomoj | I have :source-paths ["src/clj" "src/cljs" "clojurescript/src/clj" "clojurescript/src/cljs"] |
| 21:12 | tomoj | oh the src-cljs is yours, huh |
| 21:13 | gfredericks | the :source-paths made it work |
| 21:22 | arrdem | ,(doc source) |
| 21:22 | clojurebot | "([n]); Prints the source code for the given symbol, if it can find it. This requires that the symbol resolve to a Var defined in a namespace for which the .clj is in the classpath. Example: (source filter)" |
| 21:22 | gfredericks | ,(source doc) |
| 21:22 | clojurebot | Source not found |
| 21:22 | xeqi | ,(source source) |
| 21:22 | clojurebot | Source not found |
| 21:23 | gfredericks | ,(doc doc) |
| 21:23 | clojurebot | "([name]); Prints documentation for a var or special form given its name" |
| 21:23 | gfredericks | ,(partial partial) |
| 21:23 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$partial> |
| 21:23 | gfredericks | dangit |
| 21:23 | xeqi | ,(identity identity) |
| 21:23 | clojurebot | #<core$identity clojure.core$identity@4349f1b6> |
| 21:23 | dnolen | bbloom: what happens w/ that? |
| 21:23 | dnolen | bbloom: (when false ...) |
| 21:23 | gfredericks | let's figure out how many functions/macros can meaningfully be passed to themselves |
| 21:23 | gfredericks | dnolen: it emits the def unconditionally |
| 21:23 | arrdem | damnit guys I was being serious |
| 21:24 | gfredericks | arrdem: that doesn't mean it isn't fun |
| 21:24 | arrdem | oh I'm laughing. |
| 21:24 | arrdem | ,(println println) |
| 21:24 | clojurebot | #<core$println clojure.core$println@33666bf5> |
| 21:24 | gfredericks | dnolen: or so I've heard |
| 21:24 | bbloom | dnolen: yup, what gfredericks said |
| 21:25 | gfredericks | ,(delay delay) |
| 21:25 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/delay, compiling:(NO_SOURCE_PATH:0)> |
| 21:25 | tomoj | &((((partial partial partial) map) inc) [1 2 3]) |
| 21:25 | lazybot | ⇒ (2 3 4) |
| 21:25 | bbloom | on the JVM, top levels are executed on module load |
| 21:25 | arrdem | (inc tomoj) |
| 21:25 | lazybot | ⇒ 5 |
| 21:25 | gfredericks | tomoj: that's awful |
| 21:25 | bbloom | same thing for clojure script, but since there is no def at runtime, that's a problem |
| 21:25 | bbloom | what you really want is for top levels to be executed on module compilation |
| 21:25 | bbloom | in the compilation enviornment |
| 21:26 | tomoj | gfredericks: it's kind of useful, since clojure.core/map etc are not curried |
| 21:26 | bbloom | dnolen: hence the :-( face |
| 21:26 | xeqi | gfredericks: not a fan of point-free style? |
| 21:26 | bbloom | xeqi: not in clojure :-P |
| 21:26 | bbloom | or at least, not like that |
| 21:26 | gfredericks | xeqi: oh now I have to dig through my gists |
| 21:26 | tomoj | (def curry-seq-fn (partial partial partial)) |
| 21:27 | cjfrisz | I always feel guilty when I work through unhelpful Clojure error messages and only realize afterward that I should have documented what I did |
| 21:27 | tomoj | also WHY aren't they curried? :( |
| 21:27 | cjfrisz | Cuz I certainly don't remember all the steps now |
| 21:27 | gfredericks | xeqi: https://gist.github.com/967464 |
| 21:28 | xeqi | gfredericks: heh |
| 21:30 | tomoj | wait, what? |
| 21:30 | tomoj | &(partial partial) |
| 21:30 | lazybot | clojure.lang.ArityException: Wrong number of args (1) passed to: core$partial |
| 21:30 | tomoj | ..since when? |
| 21:30 | gfredericks | it used to not? |
| 21:31 | tomoj | https://github.com/clojure/clojure/commit/c85617be |
| 21:32 | gfredericks | haha partial is identity |
| 21:33 | gfredericks | that could make for some nice obfuscated code |
| 21:33 | gfredericks | &*clojure-version* |
| 21:33 | lazybot | ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil} |
| 21:33 | gfredericks | ,*clojure-version* |
| 21:33 | clojurebot | {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"} |
| 21:33 | amalloy | tomoj: committed five months ago? that's after 1.4 for sure, right? |
| 21:34 | gfredericks | haha yept (partial 42) returns 42 |
| 21:34 | amalloy | gfredericks: my dream come true! i can now (map (juxt partial :name) coll) |
| 21:34 | gfredericks | SWEET |
| 21:35 | gfredericks | partial now preferred over identity for shorter spelling |
| 21:39 | amalloy | indeed, partial now joins deliver in the ranks of "easily misleading functions" |
| 21:39 | arrdem | ,(doc deliver) |
| 21:39 | clojurebot | "([promise val]); Alpha - subject to change. Delivers the supplied value to the promise, releasing any pending derefs. A subsequent call to deliver on a promise will throw an exception." |
| 21:40 | amalloy | if you have a 1.5 repl handy, try to mix-n-match with (deliver partial :x) |
| 21:41 | gfredericks | so you're saying that we could replace identity with (partial deliver partial)? |
| 21:42 | gfredericks | as well as (partial deliver (partial deliver partial)) |
| 21:42 | gfredericks | the fun never stops |
| 21:45 | amalloy | you're a monster |
| 21:46 | gfredericks | core.logic would be a good way to implement an obfuscation lib |
| 21:47 | gfredericks | (defn identityo [x expr] (conde [(== x expr)] [(== x ['partial 'deliver x])] ...)) |
| 21:51 | gfredericks | "I don't care much for proper error handling; I'm a Clojure programmer at heart." |
| 21:52 | TimMc | technomancy: If we're going to be using a web-of-trust signing architecture, we should be exchanging PGP keys at Clojure meetups. :-) |
| 21:53 | arrdem | ,(dec (Float. "Infinity")) |
| 21:53 | clojurebot | Infinity |
| 21:54 | arrdem | Okay.. which is less evil: having a refcount of Infinity, or adding control logic so that you can't refdec some refs? |
| 21:56 | tomoj | refdec? |
| 21:58 | gfredericks | tomoj: opposite of refinc |
| 21:59 | gfredericks | which is like finc but for if you have already called finc |
| 22:02 | tomoj | for a second I thought that was the actual answer :) |
| 22:02 | gfredericks | (defn finc [f x] (f (inc x))) |
| 22:02 | gfredericks | (def refinc finc) |
| 22:03 | arrdem | ,(>= 0 (dec (Long. "Infinity"))) |
| 22:03 | clojurebot | #<NumberFormatException java.lang.NumberFormatException: For input string: "Infinity"> |
| 22:03 | arrdem | ,(>= 0 (dec (Float. "Infinity"))) |
| 22:03 | clojurebot | false |
| 22:04 | arrdem | gfredericks: https://github.com/arrdem/OoOP/blob/ea5e33e9b924c2ee1e45b5df364eef90b56527d3/src/final/gc_map.clj |
| 22:05 | arrdem | because I'm a party pooper. |
| 22:08 | gfredericks | arrdem: so you have certain refs that shouldn't be dec'able? |
| 22:09 | arrdem | gfredericks: yeah... I got that solved but basically I have a map that represents the register state of the simulator and I refcount the temporary registers but not the architectural ones. |
| 22:48 | nodename | Why does seq? return false on a vector? |
| 22:49 | bbloom | (doc sequential?) |
| 22:49 | gfredericks | there's a distinction between something being a seq and something being seqable |
| 22:49 | clojurebot | "([coll]); Returns true if coll implements Sequential" |
| 22:49 | bbloom | (doc seq?) |
| 22:49 | clojurebot | "([x]); Return true if x implements ISeq" |
| 22:49 | bbloom | (doc seq) |
| 22:49 | clojurebot | "([coll]); Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable." |
| 22:50 | bbloom | (map (juxt seq? sequential?) [(list 1 2 3) (vector 1 2 3)]) |
| 22:50 | bbloom | ,(map (juxt seq? sequential?) [(list 1 2 3) (vector 1 2 3)]) |
| 22:50 | clojurebot | ([true true] [false true]) |
| 22:50 | gfredericks | Sequential is an empty interface? |
| 22:50 | bbloom | ,(map (juxt seq? sequential?) [(list 1 2 3) (vector 1 2 3) {:x 1} (seq {:x 1})]) |
| 22:50 | clojurebot | ([true true] [false true] [false false] [true true]) |
| 22:50 | amalloy | yes |
| 22:51 | amalloy | gfredericks: otherwise how would you tell vectors and maps apart? |
| 22:51 | gfredericks | I think halloway once said that the best API is one with zero functions |
| 22:51 | gfredericks | amalloy: by staring |
| 22:51 | amalloy | ah, the (str x) approach to type dispatch |
| 22:51 | gfredericks | amalloy: or better yet, by (comp first pr-str) |
| 22:52 | gfredericks | er. like you thought I said. |
| 22:54 | gfredericks | (defmulti sequential? (comp first pr-str)) (defmethod sequential? \( [_] true) (defmethod sequential? \[ [_] true) (defmethod sequential? \{ [_] false) |
| 22:55 | gfredericks | somebody's gotta write this code. |
| 23:09 | arrdem | ,(doc update-in) |
| 23:09 | clojurebot | "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created." |
| 23:28 | technomancy | TimMc: I was key-signing like crazy at the Conj =) |
| 23:28 | TimMc | Cool. |
| 23:28 | technomancy | well, as much as my illness allowed |
| 23:29 | amalloy | you should have set up a key-signing robot to sign anyone's keys |
| 23:29 | TimMc | Dammit, I should have exchanged keys with cemerick when I met him at a recent meetup. |
| 23:29 | Raynes | You were a zombie at the conj, technomancy. |
| 23:29 | technomancy | amalloy: don't make me sic the gourds on you |
| 23:29 | Raynes | technomancy: I knew you were going to be doing key signing, so I purposely found a seat away from everyone so I wouldn't have to tell them to bug off. |
| 23:35 | TimMc | I just heard that song a few days ago... where's it from? |
| 23:35 | technomancy | jonathan coultron |
| 23:38 | technomancy | http://www.jonathancoulton.com/wiki/Re:_Your_Brains |
| 23:39 | technomancy | actually https://www.youtube.com/watch?v=S6vnM9I7HIo |
| 23:41 | bbloom | tpope: is there a flag to disable evaluating expressions without a persistent repl? i dislike the wait when i open a clj file just to look at it but don't have a repl running |