2014-03-31
| 00:10 | chare | amalloy so whats the point of the map in the context of :exists? |
| 00:11 | amalloy | who knows? i don't understand the liberator context |
| 00:12 | chare | amalloy: so you don't use liberator? |
| 00:12 | chare | amalloy you saying that liberator is a substandard clojure web library |
| 00:21 | myguidingstar | hi all, how do I access an object in memory when I only know its id? For instance, (str (repeat 3 "Hello ")) => "clojure.lang.LazySeq@e878644d" So how do I get back that lazy sequence, give its unique id? |
| 00:22 | tmciver | myguidingstar: you can't. You would have had to capture it in a local or something. |
| 00:23 | myguidingstar | tmciver, I'm just curious. I know it's a bit advanced ;> thanks |
| 00:23 | tmciver | myguidingstar: that print representation just encodes the type along with some ID that probably is some kind of memory location. |
| 00:26 | tmciver | myguidingstar: you can print clojure objects in such a way that they can be read back in again (see print-dup) but that's not what you're talking about there. |
| 00:28 | myguidingstar | yeah, I know that. I use str just to show the id |
| 00:29 | myguidingstar | I meant how to access that memory location |
| 00:30 | tmciver | myguidingstar: ah yes, I didn't read your question carefully enough. |
| 00:32 | amalloy | myguidingstar: you can't |
| 00:33 | myguidingstar | thanks amalloy tmciver I'm just curious |
| 00:33 | amalloy | also, that's not an id, it's the object's hashCode (which, by default, is related to the memory address, but not by any means a 1-to-1 mapping) |
| 00:34 | myguidingstar | a ha, that's clear to me now |
| 00:44 | vimuser2 | Hey there, was curious how do you guys handle passing data to over-ridden methods for a subclass, where you need to pass data to a function but can't call the function directly? |
| 00:45 | vimuser2 | Adding a getter/setter seems meh, would be interesting to use a channel |
| 00:46 | vimuser2 | (specifically, i need to pass some data to paintComponent method for jpanel) |
| 00:49 | amalloy | i don't understand the question. paintComponent just takes a Graphics object, right? what would it mean to pass something else to that? perhaps you could give a more specific example |
| 00:49 | vimuser2 | well technically if i read from a channel the value is removed, and it's possible for the panel needing to be repainted without me explicitly saying so… so maybe adding a property to store state to the class makes sense for this scenario unfortnuately <_< |
| 00:50 | vimuser2 | amalloy: alright, will do. I basically got a bunch of nodes I want to draw with connections. I only really need to draw everything once, until I envoke some function to redraw everything. |
| 00:51 | vimuser2 | amalloy: So, basically i got a hash map of nodes with connectors, external to my instance created with proxy |
| 00:53 | vimuser2 | So more or less, when JPanel.paintComponent(g) is called, i would like to somehow draw all these connections. and rather not have some global ref. pointing to the nodes and connections, if that makes sense... |
| 00:56 | TravisD | vimuser2: You might want to check out the seesaw library. It exposes a more idiomatic clojure interface to javax.swing |
| 00:57 | vimuser2 | TravisD: hm, alright. i was trying to more or less do this as a challenge for myself, but maybe I can study the source and get a few hints |
| 01:00 | TravisD | vimuser2: Unless you're looking for a java interop challenge, it seems like one library is as good as another. It's still an interesting (and challenging) problem to automatically draw pleasing graphs |
| 01:04 | vimuser2 | yeah heh. i mean my code to create the nodes and whatnot is functional, but this interop stuff is a bit of a challenge like you said. |
| 01:05 | vimuser2 | just curious, is there any soft of weird thing where it can hold 2 values (defaults are nil), but when 2 values are set it automatically fires another function? |
| 01:05 | vimuser2 | seems more or less like a event or something heh |
| 01:09 | vimuser2 | but yeah, that wouldn't necessarily work for me anyways since the graphic object shouldn't be held on to. anyways thanks for the input, I'm done flooding the channel =) |
| 02:33 | luxbock | I installed YourKit profiler and I'm not looking at the results of the Method List that was recorded during CPU profiling |
| 02:34 | luxbock | the most time is spent in clojure.lang.RT.seqFrom(Object) |
| 02:34 | luxbock | am I correct in interpreting that this means that I could perhaps find spots where I can optimize the code by avoiding my arrays getting turned into seqs? |
| 02:36 | luxbock | https://gist.github.com/luxbock/da22767ef16af6ebc5dc |
| 02:36 | luxbock | here is the code in question, with the last file being the one I'm profiling for further improvements |
| 02:58 | amalloy | luxbock: seqFrom just delegates to other code. you want to look through the stacktraces emanating from seqFrom to see what sequences are taking a long time to build, and/or who's asking for a lot of sequences |
| 03:09 | luxbock | what does clojure.core$every_QMARK_ do? |
| 03:22 | plaeremans | @andyf_ thanks! |
| 03:32 | luxbock | found two ways two tweak the algorithm that gave me a 10x speed improvement, so now I'm only 10x behind the Java version |
| 04:56 | aztak | hi all! Here's a newbie question for you all -> Which book on Clojure should I buy? :) I know Scala and FP reasonably well, but I've never really been exposed to LISP before. |
| 05:00 | clgv | aztak: often recommended: Clojure Programming |
| 05:04 | aztak | clgv: thanks for the pointer. Will look it up! |
| 05:07 | aztak | clgv: any thoughts on 'Joy of Clojure'? |
| 05:07 | AeroNotix | aztak: I feel it's more in-depth than Clojure Programming |
| 05:07 | clgv | aztak: it's great but maybe not suited as first clojure book |
| 05:10 | clgv | aztak: my reading path was "Programming Clojure (1st Edition)" -> "Joy of Clojure" |
| 05:11 | aztak | thanks guys. Should probably get both of them then. |
| 05:11 | aztak | clgv: how does "Programming Clojure" compare to "Clojure Programming"? |
| 05:12 | clgv | aztak: "Programmign Clojure" has older roots but is available as second edition already |
| 05:13 | clgv | aztak: hard to say without comparing them in detail |
| 06:26 | aztak | There. Just ordered 'Programming Clojure, 2nd ed' :) |
| 07:36 | oskarth | how do you guys usually rename a leiningen project? (including all the references in files) |
| 07:39 | ambrosebs | I avoid namespace prefixes, do the `git mv` commands, then use git status to build up a project-wide search/replace. |
| 07:39 | ambrosebs | Worked a treat moving around 70 namespaces in core.typed |
| 07:39 | ambrosebs | you might guess I'm not in an IDE ;) |
| 07:40 | hyPiRion | oskarth: `find test -name '*.clj' -print0 | xargs -0 sed -i.bak -e 's/old-ns-prefix/new-ns-prefix/'` in root directory |
| 07:40 | hyPiRion | that one should work on both mac and linux |
| 07:41 | ambrosebs | also consider if you have dashes in your namespaces, they are converted to underscores in :imports |
| 07:42 | ambrosebs | I realise now you were talking about simply renaming the prefixes. |
| 07:43 | oskarth | thanks :) |
| 07:44 | oskarth | One thing that's missing is the folders, but I can do it at the second stage |
| 07:44 | oskarth | as a* |
| 07:45 | hyPiRion | oskarth: yeah, that's a bit more involved, but I tend to do that manually |
| 07:45 | hyPiRion | It's not like I rename projects every say, so I've not bothered to set up a script for it |
| 07:45 | hyPiRion | *day |
| 07:45 | hyPiRion | Hrm... |
| 07:46 | hyPiRion | Sounds sorta like something you could write a Lein plugin for. |
| 07:46 | oskarth | lein rename foo bar would indeed be nice |
| 07:48 | noncom | what's the best way to convert java.util.List to a [] ? |
| 07:49 | ambrosebs | noncom: a vector? |
| 07:49 | noncom | yeah, a list into a vector |
| 07:49 | ambrosebs | noncom: try into |
| 07:49 | ambrosebs | to just (vector lst) |
| 07:49 | ambrosebs | )or |
| 07:49 | hyPiRion | I think (vec my-list) should work too |
| 07:50 | ambrosebs | yes not vector |
| 07:50 | noncom | so (into), (vec) are aware of how to treat java collections? |
| 07:50 | gfredericks | yeah |
| 07:50 | noncom | cool, thank you |
| 07:50 | gfredericks | thanks to the java.util.Collection interface or something |
| 07:50 | hyPiRion | noncom: yeah. I think most of the Clojure functions works on seqs, and Collection is seqable |
| 07:51 | hyPiRion | ,(seq (doto (java.util.ArrayList.) (.add 1) (.add 2) (.add 3))) |
| 07:51 | clojurebot | (1 2 3) |
| 07:51 | hyPiRion | ,(map inc (doto (java.util.ArrayList.) (.add 1) (.add 2) (.add 3))) |
| 07:51 | clojurebot | (2 3 4) |
| 07:51 | gfredericks | ,(apply concat (repeatedly 10000 #(java.util.ArrayList.))) |
| 07:51 | clojurebot | () |
| 07:53 | noncom | really cool |
| 09:02 | doky | hello can anybody help me how to return value from inside of loop like return value ? a try it this way |
| 09:02 | doky | (let [xx (vec nil)] |
| 09:02 | doky | (doseq [kv @clients] |
| 09:02 | doky | (if (= "first" (:room-id (val kv))) |
| 09:02 | doky | (conj xx (:user-id (val kv))))) |
| 09:02 | doky | (println xx)) |
| 09:02 | doky | the better would be instead of var xx, return only data like: (into [] (:user-id (val kv))) |
| 09:02 | doky | the better would be instead of var xx, return only data like: (into [] (:user-id (val kv))) |
| 09:02 | doky | but both returns nil :/ |
| 09:04 | llasram | doky: (a) better to use a paste service (such as refheap.com) for any code longer than 1 line |
| 09:04 | doky | ok sorry for that |
| 09:05 | llasram | (b) what your code appears to be attempting to do is build a vector via mutation |
| 09:05 | llasram | But the Clojure default datastructures are all immutable |
| 09:06 | doky | so here it is: http://pastebin.com/2kxwvzR0 |
| 09:06 | doky | and so how to get the vector of these items ? |
| 09:07 | llasram | Is @clients a map? |
| 09:07 | doky | yes |
| 09:07 | llasram | something like (map :room-id (vals @clients)) will give you a sequence of the :room-id's |
| 09:08 | llasram | But you want... the :user-id where the :room-id is "first"? |
| 09:08 | llasram | So you chain operations -- (->> @clients vals (filter #(= "first" (:room-id %))) (map :user-id)) |
| 09:08 | doky | yes |
| 09:09 | doky | thanks i will try it :) |
| 09:10 | llasram | But make sure you understand why the way you were trying to do it didn't work |
| 09:10 | doky | woow, that's great |
| 09:12 | doky | i know that data are immutable but i don't understand why i did't worked if i put it that way: |
| 09:12 | doky | (into [] (:user-id (val kv))) |
| 09:12 | doky | so it didn't create a new anonymous vector ? |
| 09:17 | arr-ee | Hi guys. I have a problem with dynamically creating tests (or named functions, even): I can’t figure how to resolve (?) the symbol for the function name. Here’s the gist: https://gist.github.com/arr-ee/9892004 |
| 09:26 | llasram | doky: If you have that form inside of the `doseq` you're still doing pretty much the same thing |
| 09:27 | doky | ok i see and thanks for help :) |
| 09:28 | llasram | arr-ee: Because macros act at macro-expansion time on their literal arguments -- in this case, the literal symbol `tname` |
| 09:30 | arr-ee | @llasram: yeah, I was thinking that way, but hoped I was wrong. And that means I won’t be able to do what I wanted to, right? |
| 09:31 | llasram | Yes/no. There's always `eval`, but fighting against the language like that suggests you are doing something uncommon and potentially unnecessary |
| 09:32 | llasram | What's your ultimate goal here? |
| 09:32 | arr-ee | Yeah, eval is a bit too much |
| 09:34 | arr-ee | I have a list of maps like {:scope :a, :method :b}, and I want to generate tests for those that basically call a function with that :method value as an argument |
| 09:34 | arr-ee | Thing is, different :scope's require different env set-ups, so I wanted to move those to the tests’ metas to be able to use selectors |
| 09:36 | arr-ee | and also test names based on those :method values, because there’s a lot of them (about a hundred), so shoving them into one test wasn’t looking great |
| 09:37 | llasram | Are all the :scopes known ahead of time? |
| 09:37 | arr-ee | however, since I know all :scope values and they are quite limited, I’ll go hardcoded defs + generated assertions way, I guess. Thanks anyway, I’ve learned something new :) |
| 09:37 | arr-ee | yeah, they are, and they aren’t changing a lot |
| 09:38 | llasram | You could have one `deftest` per `:scope` which runs all the tests for that scope |
| 09:41 | arr-ee | yes, I guess I’ll do it that way + easier to do setup/teardown |
| 09:42 | llasram | arr-ee: Alternatively -- where does this vector of maps come from? Is it inline in this test code? |
| 09:42 | llasram | Actually, doesn't matter |
| 09:42 | llasram | You could write a macro which accepts that map as a literal and defines all the necessary `deftest` forms |
| 09:43 | llasram | Then either call the macro with the map (if already a literal), or `eval` invoking the macro with the map from elsewhere |
| 09:44 | llasram | Because you need the selectors as metadata to work with existing tools, I think this qualifies as a case of actually doing something uncommon :-) |
| 09:44 | llasram | s,map as a literal,vector as a literal, etc |
| 09:44 | arr-ee | I’m not sure anyone from my team will appreciate that :) |
| 09:45 | llasram | Oh? |
| 09:45 | arr-ee | deftest per scope should work, I seriously doubt it will change anytime soon anyway. |
| 09:45 | llasram | kk |
| 09:45 | arr-ee | llasram: thanks! |
| 09:52 | antris_ | There's a competition where you can code a race car bot using Clojure :) https://helloworldopen.com/ |
| 09:52 | antris_ | They opened the signups today |
| 10:39 | bodie_ | anyone played with overtone? |
| 10:41 | ddellacosta | bodie_: you know, I've been meaning to. I used to spend a lot of time with SuperCollider... |
| 10:43 | nathanic | in particular i liked hooking overtone up to things like http://hexler.net/software/touchosc |
| 10:46 | greg` | simple made easy where can i download? |
| 10:47 | technomancy | greg`: if you're asking for help violating copyright then please get lost |
| 10:47 | technomancy | (but if not then don't get lost.) |
| 10:48 | bodie_ | ddellacosta, neato :) I just got set up with the Emacs Live bundle from Overtone |
| 10:48 | bodie_ | it's really, really nice so far, if a little bloaty |
| 10:48 | benmoss | does anyone know of a way with clojure.data.json to avoid parsing nested JSON |
| 10:48 | greg` | sorry i didnt know it was copyright |
| 10:49 | greg` | havent been on the clojure community before but thats not a great advert |
| 10:49 | greg` | simple made easy is a talk by richard hickey on the infoq website |
| 10:50 | bodie_ | unwillingness to help you break copyright is a bad advert for a community? |
| 10:50 | bodie_ | O_o |
| 10:50 | greg` | is it copyright? |
| 10:50 | ddellacosta | woah let's relax here folks |
| 10:50 | bodie_ | LET'S FIGHT |
| 10:50 | Anderkent | I prefer moveleft to copyright, prevents duplication |
| 10:51 | greg` | well if i can stream it , it cant be copyright since it gets copied to my machine first to be played |
| 10:51 | ddellacosta | greg`: http://www.infoq.com/presentations/Simple-Made-Easy |
| 10:51 | greg` | thanks ddellacosta. nice to know there are some nice clojurians |
| 10:52 | greg` | wont be back in a hurry |
| 10:52 | ddellacosta | greg`: most Clojurians are nice, don't get the wrong idea. And I suspect technomancy was just joking around, 'cause he's quite nice. |
| 10:52 | bodie_ | i've never heard of moveleft |
| 10:52 | technomancy | greg`: sorry, there's a book called "Clojure made easy" that I thought you were talking about |
| 10:53 | technomancy | my bad |
| 10:53 | greg` | ah ok, well thanks |
| 10:53 | bodie_ | also.... he did say "if you're not, please don't get lost" =P which I thought was quite nice |
| 10:53 | dselph | greg`: ddellacosta: Agreed - technomancy is one of the nicest folks you'd ever meet |
| 10:53 | greg` | bodie: ....i guess :-\ |
| 10:53 | bodie_ | the butthz are strong with this one |
| 10:54 | greg` | k l8r |
| 10:54 | bodie_ | that guy was an ass imo |
| 10:54 | bodie_ | I'm a total newcomer and you guys have always been awesome |
| 10:55 | ddellacosta | bodie_: well, it |
| 10:55 | ddellacosta | d'oh |
| 10:55 | bodie_ | dat return key |
| 10:55 | Anderkent | the internet: where sometimes some people take the thing you typed as something else than what you ment. |
| 10:55 | ddellacosta | bodie_: it's always good to give folks the benefit of the doubt methinks |
| 10:55 | ddellacosta | bodie_: yah, haha |
| 10:55 | Anderkent | shocking :) |
| 10:55 | ddellacosta | Anderkent: heh. ;-) |
| 10:56 | bodie_ | Anderkent, the difference therefore is in how you respond, meaning the responsibility lies on the individual ;) |
| 10:59 | technomancy | we used to have people looking for pirated ebooks come by every so often, but I haven't noticed it as much recently |
| 11:01 | tmciver | That's because technomancy puts 'em in their place. :) |
| 11:02 | ddellacosta | technomancy: seriously? Clojure books in particular? |
| 11:09 | technomancy | ddellacosta: I don't think they expected the authors to hang out on irc |
| 11:10 | AimHere | I just want a pirated copy of clojure |
| 11:10 | teslanick | It's lines like the above that makes me wish there were an @Horse_Clojure some days. |
| 11:12 | wink | I thought it was about a talk |
| 11:15 | Guest77325 | http://www.marketglory.com/strategygame/galahad1st for online gamers, if you didn't already, use this link to register on MerkatGlory: a free2play financial strategy game where virtual currency can be converted into real money. It starts out slow but in time you can turn a good profit that is if you have the necessary patience to grow a little bit every day :P |
| 11:21 | philth | I'll never play marketglory, thanks spammer. MeerkatGlory however... |
| 12:11 | mikerod | hmm |
| 12:12 | mikerod | ,(clojure.java.io/writer (clojure.java.io/writer "filename.txt")) |
| 12:12 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 12:13 | mikerod | I have noticed that a File will open a FileOutputStream with clojure.java.io . I do not believe this is safe when encoding is a concern. Then I noticed that an OutputStream with the `writer` fn would wrap it in an OutputStreamWriter |
| 12:14 | mikerod | So would this be the typical path to getting an OutputStreamWriter from a file? |
| 12:14 | mikerod | it is sort of odd looking to call `writer` twice :P |
| 12:14 | mikerod | I know I could just Java interop of course. |
| 12:21 | clgv | mikerod: you can specify the encoding via optional parameters |
| 12:23 | mikerod | clgv: yes, that too |
| 12:23 | mikerod | clgv: I meant to actually get the OSWriter |
| 12:24 | mikerod | Since the File alone would just get me a FileOutputStream |
| 12:26 | hiredman | mikerod: streams, outpunt and input, operate at the level of unencoded bytes, if you care about encoding you should use readers and writers |
| 12:29 | simon_ | Hello, I have a list of PGobjects like so (#<PGobject dev> #<PGobject live> ... ) |
| 12:29 | simon_ | I can call getValue on it by doing "(.getValue (first myList))" |
| 12:29 | simon_ | But I cannot map .getValue over the list |
| 12:29 | simon_ | I get CompilerException java.lang.RuntimeException: Unable to resolve symbol: .getValue in this context, |
| 12:30 | xeqi | ,(doc mem-fn) |
| 12:30 | noprompt | dnolen_: what's the status on the new cljs version? |
| 12:30 | clojurebot | Titim gan éirí ort. |
| 12:30 | nathanic | simon_: http://clojuredocs.org/clojure_core/clojure.core/memfn |
| 12:30 | dnolen_ | noprompt: I pushed it out on Wednesday |
| 12:30 | dnolen_ | 2197 |
| 12:30 | simon_ | noprompt: great, thanks! |
| 12:30 | noprompt | dnolen_: ah, cool, the README still says 2173. |
| 12:31 | noprompt | dnolen_: haven't read the ML in a bit. |
| 12:31 | TravisD | Ah, that is so much better than making anonymous function wrappers |
| 12:31 | dnolen_ | noprompt: thx for pointing that out, fixed |
| 12:33 | noprompt | dnolen_: thanks! |
| 12:33 | TravisD | I mean, it is the same thing, but it looks nicer |
| 12:38 | michaniskin | cemerick: is the key in the repositories map passed to resolve-dependencies! significant? or can the key be any string? |
| 12:38 | cemerick | michaniskin: sorry, where? |
| 12:39 | michaniskin | cemerick: https://github.com/cemerick/pomegranate/blob/master/src/main/clojure/cemerick/pomegranate/aether.clj#L639 |
| 12:39 | michaniskin | cemerick: the "name" there |
| 12:39 | cemerick | michaniskin: yeah, any string AFAIK; corresponds to "targets" in lein tasks, but no real constraints |
| 12:40 | michaniskin | cemerick: thanks! |
| 12:40 | xeqi | michaniskin: I believe it is best to try and use "standard" names, as Aether may pull in further name/repo settings for transative deps |
| 12:41 | michaniskin | xeqi: you mean aether itself adds new repositories? |
| 12:41 | michaniskin | xeqi: and what would be a "standard" name? i've been using the url. |
| 12:42 | xeqi | michaniskin: if a pom includes new repositories it will add them to make sure you can download any transative deps |
| 12:43 | xeqi | michaniskin: I really mean just don't go defining central as someother name, I'm not sure if it will cause problems but it seems like a bad idea |
| 12:44 | michaniskin | xeqi: i see. this whole thing seems like a bad idea :) |
| 12:45 | michaniskin | but we go to war with the ideas we have |
| 12:49 | ambrosebs | Bronsa: how do I get a line number from a :def expr? |
| 12:50 | ambrosebs | not having much luck |
| 12:53 | cemerick | dnolen_: shouldn't e.g. (om/allow-reads @cursor) work in render? (Trying to do some thrash-debugging here.) |
| 12:53 | Bronsa | ambrosebs: (-> (analyze '(def x 1) (empty-env)) :meta :form :line) ;;=> 1 |
| 12:53 | dnolen_ | cemerick: that combination doesn't really make sense. if you deref you don't need to bother with allow-reads |
| 12:53 | ambrosebs | Bronsa: ah! |
| 12:54 | cemerick | dnolen_: and yet, "Cannot deref cursor during render phase: [object Object]" |
| 12:54 | bodie_ | to anyone who's really experienced with Clojure: what are some pitfalls / do you feel in the end that it's been worth it? or would you have gone a different route if you were in the shoes of a newcomer? |
| 12:54 | dnolen_ | cemerick: what are you trying to do? |
| 12:55 | Bronsa | ambrosebs: you really want to just do (-> the-node :env :line) though |
| 12:55 | ambrosebs | Bronsa: do I have to write my own pass for that? |
| 12:55 | dnolen_ | cemerick: if you need to get at the value, om.core/value works |
| 12:55 | Bronsa | ambrosebs: no, it already works |
| 12:56 | Bronsa | ambrosebs: the env will have :line/:column/:file when available |
| 12:56 | cemerick | dnolen_: OK, om/value worked. Was just wanting to pump verbose-mode console prints. Not really clear on why deref'ing is frowned upon…? |
| 12:56 | Bronsa | ambrosebs: note that :file will not be there when not available, instead of defaulting to "NO_SOURCE" |
| 12:57 | dnolen_ | cemerick: because deref'ing can give you something inconsistent |
| 12:58 | ambrosebs | Bronsa: I only see :ns, :context and :file in some of my :def :env's. |
| 12:58 | ambrosebs | Bronsa: the :line is still in :meta tho |
| 12:59 | ambrosebs | anyway g2g |
| 13:01 | stuartsierra | bodie_: I was biased toward lisp when I started with closure more than five years ago. But I feel it has been totally worthwhile. |
| 13:01 | stuartsierra | *clojure |
| 13:02 | technomancy | bodie_: you're not going to get anyone in this channel who didn't think it was worth it |
| 13:02 | technomancy | https://en.wikipedia.org/wiki/Survivorship_bias |
| 13:02 | bodie_ | lol! |
| 13:03 | bodie_ | hmm, that's not necessarily applicable, since some people may be stuck with a large and unwieldy codebase that they have to maintain professionally, for example |
| 13:04 | bodie_ | I don't think everyone who has 15 years of Java or C++ experience thinks they're ideal languages |
| 13:04 | bodie_ | (though you could probably make a case for it with C++) |
| 13:04 | technomancy | that's true |
| 13:04 | bodie_ | stuartsierra, thanks for the input. can you elaborate on what you experience has been like? do you use it professionally? |
| 13:05 | technomancy | though in that case you would wonder if people would fail to speak up because they don't want to get into a huge argument right now with all the pro-clojure people in the channel |
| 13:05 | bodie_ | lol |
| 13:05 | bodie_ | some people like a healthy debate ;) |
| 13:05 | pdk | [13:01] <bodie_> I don't think everyone who has 15 years of Java or C++ experience thinks they're ideal languages |
| 13:06 | pdk | ive seen some koolaid drinkers |
| 13:06 | cemerick | dnolen_: That reply makes me want to throw 20 questions at you, but I will restrain myself. Thanks for the `value` workaround. |
| 13:06 | stuartsierra | bodie_: Yes, I work for Relevance/Cognitect, where we use Clojure professionally every day. I've done a lot of blogging and conference talks about the experience: they're easy to find online. |
| 13:07 | bodie_ | :) cool! |
| 13:07 | dnolen_ | cemerick: the rendering loop is async, you only want to render consistent snapshots - I've provided loop holes but we're going to error out if you try to do obviously bad things. |
| 13:07 | cemerick | bodie_: search for "why clojure sucks", for one treatment. |
| 13:07 | bodie_ | pdk -- i meant not all people think it's ideal, not "all people think it's not ideal" |
| 13:08 | bodie_ | thanks cemerick |
| 13:08 | stuartsierra | In fact, nearly all the talks from past Clojure conferences are online somewhere. Lots of those include practical experience reports. |
| 13:08 | TEttinger | bodie_: it's been worth it, but I would not use clojure for games. which is mostly what I do. for certain tasks clojure is vastly more effective in my experience |
| 13:08 | bodie_ | what do you like to use for games? C++? |
| 13:08 | Anderkent | bodie_: We've went with clojure over java for a web service a year or two ago, been pretty happy with it |
| 13:08 | technomancy | interesting experiment would be to ask in #scala for stories of people who tried clojure and gave up, and ask vice-versa in here =) |
| 13:09 | stuartsierra | That would be interesting. |
| 13:09 | bodie_ | hehehe |
| 13:09 | bodie_ | Hmm, I did ask the latter half already. it was good. |
| 13:10 | rootex | all answers will lead you to haskell :) |
| 13:10 | bodie_ | how about Typed Clojure? anyone play with that much? |
| 13:10 | TEttinger | bodie_: I got further in C# than Clojure in about the same time, despite having better libs in Clojure/Java-land. C# was easier to port certain algorithms to and I didn't have the same issues with optimization seeming necessary when it turns out I was optimizing the wrong places |
| 13:11 | bodie_ | I see |
| 13:11 | TEttinger | however for other things I can churn out a clojure "script" in a few minutes that does what would take me an hour in C# |
| 13:11 | bodie_ | I don't get much out of C# |
| 13:12 | Raynes | conch has so many stars |
| 13:12 | bodie_ | but that's a good thing to bring up |
| 13:12 | technomancy | there are the obvious things clojure is bad for, like fast-launching scripts, low-memory environments, and C FFI. |
| 13:12 | alpheus | I'm having trouble getting OAUTH2 with Google working. I'm just trying the ddellacosta/friend-oauth2-examples for google oauth2. |
| 13:12 | alpheus | After the 302 redirect from Google to the callback URI (with a state and code that look good) I try to access the /authlink, which should work but I get a 403. |
| 13:12 | alpheus | The HTTP headers and the ring request maps all look reasonable to me. What should I look at next? |
| 13:12 | alpheus | |
| 13:13 | rootex | technomancy: wish we had a clojure in c :) |
| 13:13 | technomancy | rootex: I just wish we had C libraries on a nicer runtime |
| 13:14 | bodie_ | there's a compiler for clojure -> gambit which compiles to C |
| 13:14 | gtrak | C# has a pretty good FFI, no? |
| 13:15 | technomancy | OCaml has good C FFI, but it gets that by representing its own strings the same way C does |
| 13:15 | technomancy | which is really not so great |
| 13:15 | rootex | technomancy: a clojure in C is more realistic :) |
| 13:15 | technomancy | trade-offs are a thing |
| 13:15 | bodie_ | technomancy, wouldn't you say that a lot of the memory and speed issues around Clojure are able to be optimized away with some work via type hinting? |
| 13:15 | TEttinger | gtrak: depends? SWIG seems to work but I haven't gotten very far |
| 13:15 | bodie_ | or is that an illusion I've acquired? |
| 13:15 | SegFaultAX | Strings in Erlang are also pretty dicey. |
| 13:15 | Raynes | technomancy: You mean to tell me I can't run my Clojure on my toaster? |
| 13:16 | Raynes | SegFaultAX: You bean binary lists :P |
| 13:16 | Raynes | mean* |
| 13:16 | SegFaultAX | Raynes: Exactly. |
| 13:16 | TEttinger | bodie_: speed issues yes, memory not so much |
| 13:16 | koalallama | technomancy: I was reading Clojure Programming the other night and saw a link to one of your libs/tools |
| 13:16 | SegFaultAX | koalallama: Probably lein. |
| 13:16 | bodie_ | right, type hinting wouldn't solve that issue, but wouldn't proper tco? |
| 13:16 | technomancy | bodie_: type hinting solves a very small subset of speed issues. |
| 13:16 | koalallama | technomancy: just thought you should know that you are famous in my eyes |
| 13:17 | bodie_ | I suppose I meant "tools like type hinting and recur" |
| 13:17 | technomancy | bodie_: granted they are often severe speed issues, but they're not all that common |
| 13:17 | bodie_ | hmm |
| 13:17 | technomancy | koalallama: haha cool |
| 13:17 | SegFaultAX | technomancy: It might be a small subset, but that subset can dramatically impact your performance. |
| 13:17 | bodie_ | SegFaultAX, good point - I was actually considering elixir as an option against clojure |
| 13:18 | justin_smith | bodie_: I think it really depends on what aspect of performance needs improving - startup time? throughput in tight loops? RAM usage? |
| 13:18 | SegFaultAX | Reflection ain't free, afterall. |
| 13:18 | justin_smith | (by RAM usage I mean more cache performance) |
| 13:18 | koalallama | SegFaultAX: nope, it was something else. I'll have to check. It was in the footnotes around pp480ish |
| 13:18 | SegFaultAX | bodie_: I actually enjoy Erlang's syntax because I'm a weirdo. Elixir is also beautiful, though. |
| 13:18 | bodie_ | I don't know enough about Clojure's pitfalls to know to ask a question specifically enough to answer your question, justin_smith :) |
| 13:18 | SegFaultAX | koalallama: Well it's certainly his most famous library since it's the de facto project manager for Clojure. |
| 13:19 | bodie_ | Erlang does have beautiful syntax. |
| 13:19 | bodie_ | I am not very productive with it however. |
| 13:19 | justin_smith | bodie_: each of those issues have different answers, and some contradict one another :) |
| 13:19 | SegFaultAX | bodie_: I don't know if I would call it beautiful necessarily. Using `,` and `.` to separate/terminate statements can be quite tedious during refactoring. |
| 13:20 | koalallama | SegFaultAX: I know :) |
| 13:20 | bodie_ | cemerick, I'm really enjoying this "what sucks about clojure" talk :) good pointer |
| 13:20 | cemerick | bodie_: :-) It's a bit old, but isn't dated, if that makes sense. |
| 13:20 | technomancy | SegFaultAX: the separator nonsense is realyl my only complaint about the syntax too |
| 13:21 | bodie_ | sure. I think the test of time is a good thing. |
| 13:21 | SegFaultAX | technomancy: Yea. But frankly, the annoyance of using `,` and `.` is offset dramatically by Erlang's pervasive pattern matching. |
| 13:22 | SegFaultAX | Oh man it makes me fuzzy inside just thinking about it. |
| 13:22 | bodie_ | Erlang has some pretty damn nifty features. |
| 13:22 | technomancy | I wonder if you could solve the ,/. problem with something paredit-like |
| 13:22 | SegFaultAX | Perhaps. |
| 13:23 | SegFaultAX | But even JA thinks Elixir's syntax is pretty sweet (though it doesn't actually hide enough of the warts according to him, while still introducing its own) |
| 13:23 | technomancy | adding |> helps a lot |
| 13:23 | SegFaultAX | Yes! Pipe syntax is /sweet/! |
| 13:30 | melipone | help! I was storing hash codes and after switching to clojure 1.6, my hash codes are no longer valid! I was able to retrieve them after backtracking to 1.5 but what's going on? |
| 13:30 | rasmusto | melipone: there was a hash collision bug in 1.5 and earlier |
| 13:31 | llasram | melipone: By "storing hash codes" you mean caching hashes, or e.g. storing them in a database? |
| 13:31 | melipone | jeez! how can I convert? |
| 13:32 | melipone | llasram: I was storing them in a hash-map |
| 13:32 | oskarth | What's the idiomatic way to get a resource from an API with a jsonblob in its body using clj-http? Right now I'm parsing it using cheshire (another dependency) like this: (parse-string (:body resp)) |
| 13:32 | melipone | llasram: and I was writing the hash-map out so it's like a database |
| 13:32 | dakrone | oskarth: you can use {:as :json} in clj-http to get back a clojure map from json strings automatically if you like |
| 13:32 | TravisD | melipone: If you have the original objects, you could rebuild the hash map |
| 13:33 | melipone | TravisD: I am not sure I have the original objects... |
| 13:34 | TravisD | melipone: Can't you get them by calling keys and vals on the map? |
| 13:34 | oskarth | dakrone: oh! I tried it before but realized I had two maps instead of dakrone one, now it works. Thanks :) |
| 13:34 | dakrone | oskarth: you're welcome :) |
| 13:35 | TravisD | melipone: (You could, for example, do that with clojure 1.5 and dump the values to file somehow) |
| 13:37 | melipone | TravisD: the vals are not just the translation of the keys |
| 13:39 | bodie_ | cemerick -- 28 minute delorean joke is hilarious |
| 13:39 | bodie_ | i know you stole it, but i got a good laugh |
| 13:40 | TravisD | melipone: I'm not sure that I understand the problem. If you need the key-value pairs you could just call seq on the map, no? |
| 13:41 | mikerod | does Clojure have any libraries for seq'ing through jar files? |
| 13:41 | melipone | TravisD: but I am going to get a hash value for the key and I don't know what it maps to |
| 13:41 | mikerod | analogous perhaps to file-seq |
| 13:42 | mikerod | I guess it doesn't always make sense... |
| 13:42 | TravisD | melipone: Ah, I see. That seems like a troubling situation |
| 13:42 | melipone | TravisD: I guess I'll figure it out somehow ... but jeez ... |
| 13:44 | TravisD | melipone: So, presumably you only care about keys that appear as hashes of objects that are somehow produced in your application. You could reimplement the old hash function and then build a new map in clojure 1.6. If you don't find a given key in the new map, look it up in the old map using the 1.5 hash function. If it's there, move it over, otherwise add it to the 1.6 hash. or something. |
| 13:45 | TravisD | I'll stop speculating and flooding now though :) |
| 13:53 | koonchun | #rust |
| 14:00 | DaReaper5 | Hey all, how can I convert a java.util.Date to org.joda.time.ReadableInstant ? |
| 14:00 | justin_smith | https://github.com/clj-time/clj-time DaReaper5: clj-time is a wrapper around joda stuff |
| 14:01 | justin_smith | I have found it very reliable and easy to use |
| 14:01 | DaReaper5 | justin_smith: yupp, already using it |
| 14:01 | amalloy | http://stackoverflow.com/questions/5137666/how-to-convert-a-java-date-to-a-readableinstant-for-joda-time-inside-a-jsp |
| 14:01 | DaReaper5 | justin_smith: is there a method inthere for an easy conversion |
| 14:01 | amalloy | third google result for org.joda.time.ReadableInstant |
| 14:02 | DaReaper5 | amalloy: yes but that is in java... i guess ill remind myself what the equivalent clojure code is |
| 14:03 | justin_smith | DaReaper5: I think the clj-time type that it creates implements ReadableInstant |
| 14:03 | justin_smith | anything that returns a DateTime |
| 14:07 | xpera | Raynes: I've enjoyed Laser! I'm having some trouble with how hickory and quoin handle HTML entities though |
| 14:07 | xpera | I wonder if David Santiago is in here? https://github.com/davidsantiago/hickory/issues/16 |
| 14:15 | amalloy | xpera: dsantiag_ is probably dsantiago's answering machine |
| 14:16 | dsantiag_ | I do not know why it won't let me change my nick back. |
| 14:16 | amalloy | dsantiag_: you're probably in another channel that's banned dsantiago |
| 14:16 | amalloy | leave that one, then you can change nicks |
| 14:17 | dsantiago | No idea why I'd be banned in #git. Haven't spoken in there for ages. |
| 14:17 | amalloy | hey, that happened to me too |
| 14:17 | amalloy | i forget why |
| 14:17 | xpera | dsantiago: thanks for finding me |
| 14:17 | dsantiago | I was just replying to you. |
| 14:17 | amalloy | #git has weird rules |
| 14:17 | technomancy | some channels ban for constant nick changes |
| 14:18 | Bronsa | :/ |
| 14:18 | technomancy | like if you keep adding and removing _away |
| 14:18 | xpera | dsantiago: I wrote up some things here https://github.com/davidsantiago/hickory/issues/16 would like to hear what you think |
| 14:18 | dsantiago | xpera: Yep, that is what I am replying to. |
| 14:18 | dsantiago | Gimme a min. |
| 14:19 | xpera | thanks. this is part of a larger saga too about Jetty and HTML entities: http://stackoverflow.com/questions/22752678 |
| 14:22 | justin_smith | xpera: a hack would be a substitution map on the enlive output that turns the utf8 characters into proper html escaped entities |
| 14:24 | xpera | justin_smith: yes, that would be a good hack! my goal would be to understand Jetty well enough to tell it to behave as expected |
| 14:24 | justin_smith | fair enough, that part I can't help with :) |
| 14:26 | xpera | right :) maybe some ring or pedestal folks know some Jetty content type / unicode tricks |
| 14:28 | marcuscreo | hey benkay, how' life? |
| 14:29 | justin_smith | xpera: https://issues.apache.org/jira/browse/SOLR-2381 maybe a bug in that jetty version? |
| 14:29 | justin_smith | JAVA_OPTIONS+=("-Dfile.encoding=UTF-8") <- another page suggests adding this to bin/jetty.sh |
| 14:30 | xpera | justin_smith: thanks a bunch. i'll try that. |
| 14:32 | xpera | justin_smith: this was what you saw? http://stackoverflow.com/questions/4214111/jetty-character-encoding-issue |
| 14:33 | justin_smith | yeah, I should have shared that too |
| 14:36 | tvachon | arg, anyone else having trouble with clojars? I can't even get lein to run https://gist.github.com/travis/9899061 |
| 14:36 | tvachon | and https://clojars.org/ is just failing to load |
| 14:36 | justin_smith | oh ouch! |
| 14:37 | justin_smith | http://www.downforeveryoneorjustme.com/clojars.org |
| 14:37 | rasmusto | its down for me |
| 14:37 | justin_smith | "It's just you. http://clojars.org is up." - clojars does not load for me either though |
| 14:39 | amalloy | xeqi: ^ |
| 14:39 | coventry | Is there a clojure.core function f for which (= ((f inc dec) [0 0]) [1 -1])? |
| 14:40 | amalloy | coventry: no, but https://github.com/flatland/useful/blob/develop/src/flatland/useful/fn.clj#L94 |
| 14:40 | coventry | Thanks. |
| 14:41 | amalloy | out of curiosity, what did you want it for, coventry? mapping one function over a map's keys and another over its values is the only use that's obvious to me |
| 14:41 | coventry | That's exactly what I wanted it for. |
| 14:42 | Raynes | It's scary how Clojure ceases to exist when clojars goes down :P |
| 14:43 | justin_smith | there should really be mirrors |
| 14:43 | justin_smith | and some kind of mirror friendly option in lein |
| 14:43 | tvachon | well, don't think it's quite that bad, I restarted my network interface and it's behaving better, I suspect something got crazy in my stack |
| 14:43 | tvachon | though I definitely wouldn't have (can't?) download required deps |
| 14:43 | coventry | Is there any way to tell lein not to check for updates? |
| 14:44 | justin_smith | tvachon: if so it is crazy in my stack too |
| 14:44 | amalloy | lein -o <whatever> |
| 14:44 | tvachon | ah |
| 14:44 | tvachon | well at least I'm not nuts |
| 14:45 | xpera | justin_smith: hooray. I will buy you a beer sometime. |
| 14:45 | amalloy | (which, incidentally, i discovered by running `lein help`) |
| 14:46 | justin_smith | xpera: glad it worked |
| 14:46 | xpera | justin_smith: i'll update my chef-jetty chef recipe and share that soon |
| 14:46 | doky | hello is it possible to pass items of list on-by-one to function ? http://pastebin.com/F67qiYn5 |
| 14:46 | amalloy | doky: apply |
| 14:47 | coventry | amalloy: "lein -o help"? :-) "lein help" is hanging for me. I suppose I should have changed my cwd. |
| 14:47 | amalloy | haha |
| 14:47 | amalloy | ouch |
| 14:48 | amalloy | oh. or map? i hadn't read your paste, doky |
| 14:48 | justin_smith | yeah, he wants map |
| 14:48 | doky | will it work with apply, will tried it but maybe i did there any mistake in syntax or something like that |
| 14:48 | rasmusto | ,(map (fn [n] {:what "hi" :who n}) ["bob" "tom"]) |
| 14:48 | clojurebot | ({:what "hi", :who "bob"} {:what "hi", :who "tom"}) |
| 14:48 | xpera | if anyone wants to get Jetty 9 to work, this is what I use: https://github.com/bluemont/chef-jetty/commit/5796e2c660efe036c81238f86352e9de6b611a54 |
| 14:49 | justin_smith | nice |
| 14:49 | doky | woow thanks :) |
| 14:49 | rasmusto | doky: understanding "map" is the path to enlightenment |
| 14:50 | ptcek | rasmusto: and reduce :) |
| 14:50 | doky | :D i will remember |
| 14:50 | justin_smith | rasmusto: the map is not the territory! map only shows where the path is :) |
| 14:50 | oskarth | Is there (a) a collection of everything clojurebot has evaluated or (b) a nice downloadable archive of chat logs for #clojure? |
| 14:51 | amalloy | oskarth: devn has such a project |
| 14:52 | amalloy | yeah, https://github.com/devn/getclojure |
| 14:52 | oskarth | amalloy: this one? http://getclojure.com/search?q=iterate+AND+range&num=0 thanks |
| 14:52 | oskarth | coo |
| 14:52 | oskarth | cool* :) |
| 15:03 | hlship | is anyone else seeing clojars.org as down? Can't even ping it right now. |
| 15:03 | rasmusto | yessir |
| 15:03 | tvachon | yep |
| 15:03 | amalloy | hlship: yes. we've raised the bat-signal for xeqi |
| 15:03 | hlship | glad its not just me |
| 15:03 | hlship | was having wierd DNS issues last week |
| 15:04 | trptcolin | http://status.linode.com/ |
| 15:05 | amalloy | ah, thanks trptcolin |
| 15:08 | startling | I'd like to call some clojure code from some java code in the same package. It's apparently not sufficient to say :aot [whatever] -- I still get "cannot find symbol" where I try to import whatever in java. What else needs to be done? |
| 15:08 | hiredman | startling: lein runs the clojure compiler after javac |
| 15:08 | startling | hiredman: ah, well. |
| 15:09 | xpera | dsantiago: thanks for your help. I'd also be curious if I'm off-base about reflection. |
| 15:09 | startling | Is this kind of thing possible at all without using clojure.lang.RT? |
| 15:09 | trptcolin | np |
| 15:09 | amalloy | startling: it's easier to, rather than AOTing the clojure code, have java call into an ordinary clojure function via RT |
| 15:10 | hiredman | startling: https://github.com/sonian/Greenmail is my go to example of java and clojure in one project |
| 15:10 | amalloy | starting in clojure 1.6 there's a somewhat more java-friendly API than RT, in clojure.java.api.Clojure, iirc |
| 15:10 | startling | hiredman, thanks, I'll take a look |
| 15:10 | hiredman | startling: if you look at the com.icegreen.greenmail.util.Greenmail class you can see using RT to get vars and using vars to require namespaces and call functions |
| 15:12 | gtrak | startling: it's pretty tiny: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/java/api/Clojure.java |
| 15:15 | seancorfield | startling: FWIW, at World Singles we load all our Clojure into our main app using clojure.lang.RT (we haven't switched to the new API yet) and it works really well |
| 15:16 | seancorfield | you just need to have the project src on your classpath - and the various JARs you rely on (which is the fun part) |
| 15:16 | oskarth | dakrone: another question. I'm trying to translate a curl post request to clj-http. This is what my body looks like when I use :debug in clj-http "name=test+name&email=test+email&address%5Bcountry_code%5D=DE<etc>" and here's what it looks like in curl: "name=Sterling Archer&email=your@test.email.com&address[line1]=Pr<etc>". The curl one is working, and the |
| 15:16 | oskarth | clj-http is not. What's wrong here? %5B and %5D correspond to [ and ], but not sure if that's picked up properly. |
| 15:17 | seancorfield | Much depends on how your Java code is set up and how much control you have over it (in terms of whether it needs to just interact with a Java-like class or whether you can write all the interop from scratch) |
| 15:19 | justin_smith | oskarth: I think an embedded map that looks like {:address {:country_code "DE"} ...} should do what you want iirc |
| 15:19 | oskarth | justin_smith: that's what it looks like right now |
| 15:20 | justin_smith | oh |
| 15:20 | oskarth | and somehow it's translating it correctly, since I didn't put the [ and ] in there |
| 15:20 | oskarth | but still not all the way, and all I get from the server is a 400 |
| 15:20 | justin_smith | except it is escaping the [ and ], so I am guessing a misbehaving abstraction layer |
| 15:21 | oskarth | yeah indeed. Trying to use the plaintext string right now instead but getting some other error :p |
| 15:34 | upwardindex | Can some kind of deadlock happen in http-kit when compared to jetty? (sometimes my server stops responding and it only happens since i switched from one to the other) |
| 15:36 | justin_smith | upwardindex: perhaps you had some operations in your handler that are not compatible with http-kit's more pervasive async |
| 15:36 | justin_smith | like in jetty you can assume each request has exactly one thread it runs in, start to finish |
| 15:36 | justin_smith | in http-kit this is not the case |
| 15:36 | justin_smith | (which can mess with things like dynamic vars that are thread specific) |
| 15:36 | abaker | yeeehah, clojars is back up |
| 15:47 | upwardindex | justin_smith: Yes, I’m most probably doing something http-kit does not like. Any idea what it does not like? The doc page isn’t quite explicit about stuff I shouldn’t do |
| 15:47 | justin_smith | are you using any dynamic vars? |
| 15:47 | justin_smith | any thread-local stuff in general? |
| 15:49 | upwardindex | justin_smith: no dynamic vars, just atoms and hmmm is “locking” thread local? |
| 15:50 | justin_smith | what are the chances that you are trying to alter the atom in multiple threads? would retries be better than failing? if so switch atoms to refs |
| 15:51 | justin_smith | *I think |
| 15:51 | upwardindex | So basically, I shouldn’t use atoms with http-kit? |
| 15:51 | upwardindex | That’s a pretty huge deal |
| 15:51 | justin_smith | let me check something... |
| 15:52 | AeroNotix | Did something just go tit's up with Clojars? |
| 15:52 | justin_smith | yeah, it has been weird today |
| 15:52 | AeroNotix | great :) |
| 15:52 | xeqi | AeroNotix: linode has been having problems with it's atlanta data center |
| 15:53 | AeroNotix | I have a huge deploy planned :) Sigh. This is what I get for not pushing for private repos harder. |
| 15:53 | AeroNotix | xeqi: roger |
| 15:53 | xeqi | funnily enough, when I talked to people about clojars as point of failure at c/w no one cared cause it was always up :p |
| 15:54 | xeqi | maybe I should move talking to fastly as a possible cdn higher on my task list |
| 15:54 | AeroNotix | c/w? |
| 15:54 | AeroNotix | clojurewest? |
| 15:56 | xeqi | AeroNotix: yep |
| 15:58 | xeqi | AeroNotix: what would you use as a private repo? |
| 15:59 | AeroNotix | xeqi: we're currently ramping up our Archiva usage |
| 15:59 | AeroNotix | From what I can tell, you can mirror other stuff |
| 16:00 | xeqi | AeroNotix: yep, should be able to mirror. Easy for someone to admin? |
| 16:00 | AeroNotix | xeqi: one of our ops guys didn't say it was perfect, but it's not overly annoying |
| 16:00 | AeroNotix | he said he found some pieces "snowflakes" which he means that they do some non-standard stuff. |
| 16:00 | AeroNotix | That's all I know |
| 16:00 | AeroNotix | but from my perspective, it's all rainbows |
| 16:04 | ivan | I'm really sad because I can't put metadata on a keyword |
| 16:05 | dsjklj | in your opinion what does i hope to see you again mean if said by one of the interviewers at the end of a job interview? |
| 16:05 | hfaafb | s/he hopes to see you again |
| 16:06 | petron | I'm doing a intro to Clojure talk to a bunch of university students. Is it okay if I use the Clojure logo on my slides? (which are based on Rich Hickey's "Clojure for Java Programmers" talk, with credit). |
| 16:08 | dsjklj | but would you say that would be because he is worried i reject a possible offer or because he does not know if they will make one? |
| 16:09 | ianeslick | No, it means he enjoyed the conversation and hopes the rest of the process goes well and that you come back / get an offer. |
| 16:09 | ianeslick | Personal statement of support, says little about the process itself. |
| 16:09 | zspencer | What is the human word for `()? |
| 16:09 | zspencer | It's inside of a macro |
| 16:10 | ianeslick | empty list |
| 16:10 | zspencer | I thought that was '() |
| 16:11 | seancorfield | ,`() |
| 16:11 | clojurebot | () |
| 16:11 | seancorfield | ,() |
| 16:11 | clojurebot | () |
| 16:11 | seancorfield | ,'() |
| 16:11 | clojurebot | () |
| 16:11 | seancorfield | :) |
| 16:11 | hiredman | ,() |
| 16:11 | clojurebot | () |
| 16:12 | hiredman | (you don't need to quote the empty list in clojure as in some other lisps) |
| 16:12 | seancorfield | the point I was making |
| 16:12 | zspencer | For reference: http://www.amazon.com/Chemex-6-Cup-Classic-Series-Coffee/dp/B0000YWF5E%3FSubscriptionId%3DAKIAILSHYYTFIVPWUY6Q%26tag%3Dduckduckgo-d-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB0000YWF5E |
| 16:12 | zspencer | eerm that's the other paste bin |
| 16:12 | zspencer | https://github.com/ptaoussanis/carmine#connections |
| 16:12 | hiredman | seancorfield: ah, I missed the unquoted one |
| 16:13 | trptcolin | i like the first link better (not that the second one’s bad) |
| 16:13 | zspencer | lol |
| 16:13 | zspencer | I really need to figure out macros for reals instead of just kind of assuming how they work |
| 16:13 | seancorfield | ah, you're just asking about syntax quote in general zspencer ? |
| 16:13 | brehaut | zspencer: a good paste error though |
| 16:14 | zspencer | So I can intuit that the & body bit is "My arguments are code" and the ~@body is "put the code here!" |
| 16:15 | zspencer | So the macro isn't actually calling car/wcar? |
| 16:16 | seancorfield | perhaps macroexpand will help you here? that way you can see exactly what a macro expands to... |
| 16:16 | zspencer | Agg te |
| 16:16 | zspencer | Ahh yes. That would be handy |
| 16:16 | seancorfield | the macro transforms code to code |
| 16:16 | seancorfield | but macros can include evaluated expressions as well as quoted (code) expressions |
| 16:17 | zspencer | So the list it returns is actually the code it executes |
| 16:19 | seancorfield | Macros are expanded, then the resulting code is evaluated. |
| 16:19 | seancorfield | Not sure what your "it" refers to. |
| 16:20 | seancorfield | The list the macro returns is actually the code Clojure executes perhaps? |
| 16:20 | zspencer | the it being `(car/wcar server1-conn ~@body) |
| 16:21 | seancorfield | if you have (wcar* :foo 42), it will expand to (car/wcar server1-conn :foo 42) |
| 16:21 | seancorfield | then that expanded code will be evaluated (if the original (wcar* :foo 42) form would have been evaluated) |
| 16:22 | zspencer | Got it |
| 16:22 | zspencer | so if (wcar* (inc 1)) it'd become (car/wcar server1-conn (inc 1)) |
| 16:23 | seancorfield | note that car/wcar is also a macro https://github.com/ptaoussanis/carmine/blob/master/src/taoensso/carmine.clj#L17 |
| 16:23 | seancorfield | right, the code is transformed first, evaluated second |
| 16:23 | seancorfield | but (car/wcar server1-conn (inc 1)) will also macro-expand before evaluation |
| 16:25 | zspencer | so when do dynamics come into play with bindings? |
| 16:25 | zspencer | erm macro expansions* |
| 16:25 | tuft | anyone using immutant? |
| 16:25 | seancorfield | dynamic variables and bindings happen when code is evaluated |
| 16:26 | zspencer | So they should play nicely with macro expansions |
| 16:26 | coventry | It's worth having a look at some of the macros in the later parts of clojure.core. https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4111 |
| 16:26 | seancorfield | most macros expand to code, some macros cause some evaluation to happen as part of the expansion |
| 16:26 | seancorfield | but dynamic variables are frowned on in Clojure these days |
| 16:26 | seancorfield | (in general) |
| 16:26 | zspencer | I'm beginning to see why :-p |
| 16:27 | tcrawley | tuft: come see us in #immutant if you have any immutant-specific questions |
| 16:32 | rasmusto | is there a way I can get something in clojure.tools.trace to inspect the values in a let binding? |
| 16:35 | coventry | rasmusto: There is trace-forms, but that's only informative on error. |
| 16:35 | gtrak | rasmusto: http://blog.gaz-jones.com/2012/02/04/debug_let.html ? |
| 16:35 | gtrak | we have something similar in our codebase |
| 16:37 | rasmusto | gtrak: ok, i'll give it a shot |
| 16:37 | rasmusto | coventry: that actually might work for now, since I do have an error |
| 16:38 | rasmusto | coventry: er, I guess it doesn't dig into the body of the function, just reports back what the top-level was called with |
| 16:39 | gtrak | rasmusto: what we use I think is actually this def-let thingy: http://www.learningclojure.com/2010/09/astonishing-macro-of-narayan-singhal.html |
| 16:40 | coventry | rasmusto: That sounds more like deftrace. trace-forms will give you a stack of the forms executed. |
| 16:41 | rasmusto | coventry: I can use trace-forms on a (let [a 1 b nil] (first a)) |
| 16:41 | rasmusto | and it'll error out and give me the bindings |
| 16:41 | rasmusto | but if I call it on a form with a call to a function in it, it doesn't dig deeper |
| 16:42 | rasmusto | gtrak: doesn't that have the risk of clobbering other global vars? |
| 16:42 | coventry | Oh, you mean it doesn't tell you the return value. Yeah. |
| 16:43 | gtrak | rasmusto: yes, sometimes it's more trouble than it's worth. |
| 16:43 | rasmusto | well, it tells me that (foo 3) failed |
| 16:43 | rasmusto | but it doesn't dig deeper and tell me that the (let [a (first 1)]) inside of 'foo failed |
| 16:47 | coventry | Looking inside of 'foo seems like a different problem than inspecting the values in a let binding, more like providing inspection for all frames in the stack trace. |
| 16:47 | amalloy | rasmusto: it couldn't do that without recompiling foo |
| 16:47 | rasmusto | amalloy: ah, ok. |
| 16:47 | amalloy | (and, therefore, recompiling every function in your entire codebase that foo might need to call, etc) |
| 16:48 | coventry | If you're looking for a debugger, schmetterling is nice. |
| 16:48 | rasmusto | sounds like I should go on that route |
| 16:49 | rasmusto | coventry: https://github.com/prismofeverything/schmetterling this one? |
| 16:49 | coventry | Yeah. |
| 16:51 | rasmusto | seems a bit heavy for what i'm doing, maybe that's just me |
| 16:55 | coventry | Perhaps I should pick up troncle again. That was fun. |
| 16:58 | rasmusto | went back to _ (println blah) :( |
| 16:59 | rasmusto | found my bug though, so there's that. |
| 17:15 | mercwithamouth | does anyone have a compojure project on github I can take a look at? |
| 17:15 | mercwithamouth | or can point me to a small one? |
| 17:17 | mercwithamouth | got one |
| 17:22 | rasmusto | mercwithamouth: there's `lein new compojure` iirc |
| 17:26 | cYmen_ | Hm...I am calling (js/alert (nodes (by-class "foo"))) with domina |
| 17:26 | cYmen_ | and there are clearly tags with "foo" class in the src |
| 17:26 | cYmen_ | but I get null back |
| 17:26 | cYmen_ | any ideas what I might be doing wrong? |
| 17:27 | cYmen_ | I'm doing this in a <script> tag but it should probably be attached to a document.ready..maybe that's the problem? |
| 17:30 | brehaut | if your script tag is at the end of the document your code can see all the existing nodes |
| 17:30 | brehaut | if its in the head then you will need to use a load or ready handler |
| 17:31 | cYmen_ | Okay so just before </html>? |
| 17:31 | brehaut | i think before </body> from memory |
| 17:32 | coventry | cYmen_: If you think it might be something like that, you might be able to try domina.nodes(domina.by_class("foo")) in the console after you've verified that the nodes are present. (Not sure whether that trick'll work with a protocol method.) |
| 17:33 | cYmen_ | brehaut: seems not to help, maybe it's something else after all |
| 17:33 | cYmen_ | coventry: I'll try |
| 17:33 | cYmen_ | wait..what console? :) |
| 17:33 | cYmen_ | you mean a brepl? |
| 17:34 | coventry | I assumed you didn't have a brepl because you're using js/alert to explore this, and getting a brepl going is a big hairy yak. :-) |
| 17:34 | cYmen_ | coventry: indeed |
| 17:35 | cYmen_ | So where else can I input stuff? |
| 17:36 | cYmen_ | Sorry, I haven't done any webdev in 10 years or so :p |
| 17:36 | cYmen_ | I'm using firefox btw |
| 17:37 | coventry | I meant the javascript console. I think you can start the js console in ff from Tools -> Web Developer -> Web Console. |
| 17:37 | coventry | (At least on OS X.) |
| 17:37 | cYmen_ | hehe |
| 17:37 | cYmen_ | I have that open but don't know here to input anything >_< |
| 17:38 | coventry | There's a little ">>" at the bottom of mine which accepts input. |
| 17:39 | cYmen_ | hm... |
| 17:39 | cYmen_ | I get [object Object] |
| 17:39 | brehaut | congratulations you have nearly anything ;) |
| 17:39 | cYmen_ | and if I alert that I do not get null |
| 17:39 | brehaut | (but not nothing) |
| 17:40 | cYmen_ | so apparently the problem is somehow with the order of execution and dom creation |
| 17:40 | cYmen_ | now where do I call this damn script :) |
| 17:40 | coventry | Sounds like you've verified the hypothesis. |
| 17:42 | cYmen_ | alriiight |
| 17:43 | cYmen_ | A little searching turned up this: |
| 17:43 | cYmen_ | (defn on-doc-ready [] (aset js/document "onreadystatechange" init)) |
| 17:43 | cYmen_ | (on-doc-ready) |
| 17:43 | cYmen_ | Which is exactly what the old javascript code did and seems to work. |
| 17:45 | coventry | Hmm, I wonder why we don't need that. |
| 17:46 | brehaut | i dont know much about cljs, but aset lets you set object properties O_O |
| 17:46 | coventry | Ah, we use (set! (.-onload js/window) setup!*)) which is similar I guess. |
| 17:46 | cYmen_ | What's the * for? |
| 17:47 | brehaut | coventry: phew |
| 17:49 | coventry | cYmen_: It's a minor change from setup! which turns off some reporting functionality we'll want in production. |
| 17:50 | cYmen_ | ah :) |
| 17:54 | cYmen_ | well, thanks for your help guys |
| 17:57 | coventry | NP. BTW, (js/console.log (pr-str obj)) tends to be a lot easier to go review than js/alert. |
| 17:58 | amalloy | coventry: is js/console.log really guaranteed to work? i see people use it all the time, when it seems like the only form that the compiler would guarantee works is (.log js/console) |
| 17:59 | coventry | I don't know, it may be bad practice. Hasn't bitten me yet. |
| 18:02 | bbloom | amalloy: it was even more permissive before & we broke some ppl, but i forget the details |
| 18:02 | bbloom | hasn't changed for quite some time, probably safe to rely on it at this point |
| 18:04 | dnolen_ | amalloy: it is guaranteed to work actually, as far as I can tell intentionally |
| 18:05 | dnolen_ | amalloy: an exception for js/foo as far as I can tell |
| 18:06 | hiredman | guaranteed as much as anything in js is |
| 18:31 | chare | does the web dev setup in clojure have a way to avoid having to restart the webserver everytime i make a small change to the code, so i don't have to rerun lein compile and lein ring server |
| 18:31 | gtrak | chare: there's tons of ways to do this, simplest is lein-ring automatically reloads your namespaces |
| 18:32 | chare | its setup to already auto recompile and reload? |
| 18:32 | gtrak | yes, seems that way |
| 18:32 | gtrak | though I never use this feature |
| 18:33 | gtrak | chare: you might have to be careful though, if you're not indirecting through a var in your handler, it's possible that old versions of code will still be live. |
| 18:33 | Raynes | gtrak: Are you saying that lein ring reload is a substandard lein-ring feature? |
| 18:33 | gtrak | Raynes: I eval. |
| 18:34 | gtrak | I don't let other eval for me. |
| 18:34 | gtrak | others* |
| 18:34 | chare | gtrak i don't understand what yo mean by var |
| 18:34 | gtrak | chare: depends on how you define your ring handler, somewhere you're passing something into a servlet or the jetty adapter directly, I forget what lein-ring expects. |
| 18:35 | cbp | ~var |
| 18:35 | clojurebot | var is Passing xyz is passing its value around, #'xyz is short for (var xyz), passes a reference to xyz around. Whenever a reference is dereferenced, the current value is returned. It allows you do do things like dynamically updating code in the repl, change your ring routes, etc. |
| 18:35 | justin_smith | chare: #'handler points to the var (so it updates if you change the def) handler points to the value of the var, so does not update |
| 18:35 | gtrak | chare: I'm not sure of the implications to whatever you put in your project map, but that's how the impl probably works. |
| 18:35 | technomancy | Raynes: haha |
| 18:35 | aka | chare: alternatively you could do explicit reloading in repl (for example http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded ) |
| 18:36 | programmancer | I'm having some issues with datomic. Being completely new to it, I'm assuming I'm just not using it right: http://pastebin.com/yhwe5XZ2 |
| 18:36 | gtrak | or just suck it up and eval everything manually :-) |
| 18:36 | programmancer | If anyone has some tips I'd be very happy. |
| 18:36 | Raynes | technomancy: Totally unoriginal. |
| 18:36 | gtrak | well, through some cider-hotkeys. |
| 18:36 | Raynes | It was someone else's idea ;) |
| 18:36 | gtrak | understand how the compiler works.. |
| 18:37 | amalloy | Raynes: are you saying lein-ring is totally unoriginal? |
| 18:37 | aka | just blindly sucking it up can't always be good |
| 18:37 | Raynes | Yes. |
| 18:38 | hiredman | programmancer: midje is terrible, is likely our problem |
| 18:38 | hiredman | programmancer: your |
| 18:38 | programmancer | Oh. |
| 18:38 | koreth_ | What's wrong with midje? |
| 18:38 | programmancer | What do you suggest instead, then? |
| 18:38 | aka | it's hard to pronounce first off |
| 18:38 | hiredman | programmancer: you aren't calling the function in the gist either |
| 18:39 | gtrak | aka: it gets better |
| 18:39 | hiredman | oh, I guess you are |
| 18:39 | hiredman | programmancer: I like to use clojure.test |
| 18:39 | coventry | programmancer: Do you get the same error if you call (add-card test-card) in the repl? |
| 18:39 | hiredman | koreth_: lots |
| 18:39 | programmancer | Let's see, coventry. |
| 18:39 | amalloy | programmancer: it looks like midje is trying to do some bizarro fiddling with metadata or something |
| 18:42 | aka | gtrak: you sound like my uncle |
| 18:42 | programmancer | hiredman, coventry, amalloy: everything works just well in the REPL. |
| 18:42 | programmancer | I suppose that settles my issue; don't use Midje. |
| 18:42 | gtrak | i might use something like 'component' on a future large project, but it's probably too much hassle to refactor the current one, and not really necessary for small ones. |
| 18:42 | amalloy | gtrak: large projects start out small |
| 18:42 | hiredman | programmancer: see if you still get the error if you dump the datomic results in to a clojure hash set |
| 18:43 | gtrak | amalloy: well, for the next thing that's intended to be a large project, I should say. |
| 18:43 | hiredman | (into #{} whatever) |
| 18:43 | gtrak | doesn't really happen to me very often :-) |
| 18:43 | aka | I'm converting a small project to component right now... |
| 18:43 | programmancer | I can't seem to reproduce the error at all in the REPL. |
| 18:44 | programmancer | Everything works like a charm there. |
| 18:44 | hiredman | sounds like typical midje wonkiness |
| 18:44 | programmancer | I suppose it's time to rewrite the tests for clojure.test. |
| 18:44 | programmancer | Are there other good testing libraries out there? |
| 18:44 | programmancer | clojure.test is certainly good enough, but some of the stuff Midje added was rather handy. |
| 18:44 | brehaut | generative testing |
| 18:45 | amalloy | clojure.test.check is fun if you don't mind relearning how to think about tests |
| 18:45 | programmancer | Yeah, I actually saw that on the clojure Github repo. |
| 18:45 | amalloy | ie, basically what brehaut just said |
| 18:45 | programmancer | It looked very interesting. |
| 18:46 | brehaut | programmancer: theres a great talk on generative testing from clojure/west 2014 by john hughes though he uses erlang |
| 18:46 | programmancer | There's no "known wonkiness" with that? |
| 18:46 | brehaut | programmancer: http://www.youtube.com/watch?v=zi0rHwfiX1Q |
| 18:47 | amalloy | programmancer: clojure's mocking support is...okay. midje goes kinda crazy adding more. it's better to build support for swappable implementations to begin with, eg with stuartsierra's component idea; and at that point clojure.test is fine - you don't really need any features more complicated than assert |
| 18:47 | programmancer | Thanks, brehaut. I'll queue that up for tomorrow (Danish time is approaching bed time) |
| 18:47 | aka | wonkiness is the worst |
| 18:47 | koreth_ | The hard part with generative testing (sometimes prohibitively hard, IMO) is that you need to be able to programmatically specify what the correct output is. Sometimes that's easy and sometimes you practically end up doing a second implementation of the code under test. |
| 18:47 | amalloy | are all the clojure/west talks up already? |
| 18:48 | stuartsierra | amalloy: yes, Clojure on YouTube |
| 18:48 | rasmusto | danish time is the best time |
| 18:48 | amalloy | stuartsierra: sweet. it's amazing they got this done so fast |
| 18:49 | ianeslick|onvaca | amalloy: it was done same day this time! |
| 18:49 | bbloom | amalloy: the videos were up within like ~12 hours, it was crazy |
| 18:49 | stuartsierra | amalloy: We paid $$$ to get same-day service from the videographers. |
| 18:49 | brehaut | amalloy: some were up hours after the talk happened. its amazing |
| 18:49 | brehaut | bloody lag |
| 18:50 | amalloy | yeah, i heard about some of the videos being up right away, but couldn't believe they were *all* up so decided it must be going up like one per day (even that would have been unbelievably fast) |
| 18:50 | programmancer | I now feel all kinds of excited about generative testing. I think I may have a regular addiction to new libraries. |
| 18:50 | amalloy | kudos to everyone involved |
| 18:51 | programmancer | Not that generative testing is really a library. |
| 18:51 | stuartsierra | Thanks due to Lynn Grogan and Alex Miller. |
| 18:51 | brehaut | koreth_: the hard part about non-generative testing is that its useless ;) |
| 18:52 | aka | I'm loving the clojure west talk videos. |
| 18:52 | koreth_ | brehaut: That's quite a bold claim. Even John Hughes disagreed with that in his post-talk Q&A. |
| 18:52 | bbloom | koreth_: his disagreement was kinda funny/subtle though... |
| 18:52 | brehaut | koreth_: note emoticons |
| 18:53 | bbloom | he discussed a serialize/deserialize round-trip property and suggested that you could have that property while still being entirely useless |
| 18:53 | bbloom | suggesting that you need some example tests just to constraint the program to actually do something useful while preserving the round trip prperty |
| 18:54 | bbloom | one big example with all the possible interesting serializable/deserializable entities would be sufficient to constrain the code to do something useful, then generative testing could do all the rest of the work from there |
| 18:54 | rootex | stuartsierra: does having the questions included in the videos cost more? |
| 18:54 | bodie_ | anyone comfy with CIDER? |
| 18:55 | brehaut | ~anyone |
| 18:55 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 18:55 | stuartsierra | rootex: I don't understand the question. |
| 18:55 | bodie_ | I'm trying to do a substring history search in an attached repl. |
| 18:55 | rasmusto | stuartsierra: I think he's talking about the Q&A after each session |
| 18:55 | noprompt | is anyone else seeing "ERROR: JSC_PARSE_ERROR. Parse error. syntax error at ..." with the newest version of cljs. |
| 18:55 | bodie_ | however, every search I do matches against ^<search term>, so I'm not able to do substrings. |
| 18:56 | bodie_ | example: "(definst foo ... " is a previously entered repl command. |
| 18:56 | bodie_ | I want to do a reverse search on "efin" and match that entry. |
| 18:57 | bodie_ | however, that's obviously not a clojure question, nor even an emacs question -- it's a plugin included in Emacs Live, which I guess is popular with some Clojure users. |
| 18:57 | stuartsierra | I had no part in actually hiring videographers, and I haven't watched the videos yet. I assume Q&A was included, but not all the talks had time for it. We ask speakers to repeat questions from the audience, but they often forget. |
| 18:57 | bodie_ | so I wondered if anyone was familiar with that and willing to answer a somewhat verbose question before I dumped in here :) |
| 18:57 | rasmusto | The talks that I watched ended with the applause, right before the q&a |
| 18:59 | stuartsierra | More discussion about the Clojure/West videos https://groups.google.com/d/topic/clojure/NKrU3m-4HEo/discussion |
| 19:00 | technomancy | I remember some incredibly entitled whining about the schedule last time |
| 19:00 | technomancy | nice to see they should be shut up this time |
| 19:01 | bohford | lol whining?? |
| 19:01 | lazybot | bohford: What are you, crazy? Of course not! |
| 19:01 | rootex | stuartsierra: yeah, what rasmusto said, I only watched 3 and they were cut off just before the Q&As |
| 19:01 | brehaut | rootex: one of them i saw didnt cut off so its not a policy. i wonder if the presenters didnt all repeat questions or something making the Q+A useless on video? |
| 19:02 | stuartsierra | Could have been. Again, I don't know anything. :) |
| 19:03 | stuartsierra | Q&A at a talk tends to be pretty useless anyway. :) |
| 19:03 | brehaut | “its not so much a question as a statement…” |
| 19:04 | amalloy | brehaut: most of the presenters were pretty good about repeating the question. the only one i remember who wasn't was the keynote |
| 19:05 | brehaut | amalloy: look at that; unfounded guessing turns out to be false |
| 19:05 | amalloy | i for one would never have guessed that |
| 19:31 | perplexa | A boy and a girl were sitting in a Java programming class together. He reached over and grabbed her breast. She said "Hey, that's private". He looked confused and said "I thought we were in the same class" |
| 19:31 | brehaut | stay classy perplexa |
| 19:31 | perplexa | :) |
| 19:33 | S11001001 | perplexa: No. |
| 19:34 | antonv | hi all |
| 19:34 | bohford | yikes |
| 19:34 | gtrak | (dec perplexa) |
| 19:34 | lazybot | ⇒ -1 |
| 19:35 | rasmusto | ,(pos? -1) |
| 19:35 | clojurebot | false |
| 19:35 | antonv | when code of the same namespace is distributed over several .clj source files, do you use (ns ... (require ...)) in every source file? |
| 19:35 | S11001001 | antonv: absolutely |
| 19:35 | rasmusto | antonv: yep |
| 19:35 | antonv | this means you must copy/paste dependency list in every file? |
| 19:35 | gtrak | antonv: wat? each clj file should be a separate namespace unless you know what you're doing. |
| 19:35 | perplexa | what the heck is wrong with you guys :P |
| 19:35 | S11001001 | antonv: the alternative is "spaghetti loading" and it's seriously confusing to read. |
| 19:36 | justin_smith | assumed you mean (ns ... (:require ...)) |
| 19:36 | perplexa | (dec gtrak) |
| 19:36 | lazybot | ⇒ 6 |
| 19:36 | perplexa | ;) |
| 19:36 | rasmusto | :use is really only OK for test namespaces and the like, where there's a 1:1 mapping |
| 19:36 | technomancy | perplexa: we're not like ... twelve? |
| 19:36 | S11001001 | perplexa: As technomancy says. |
| 19:36 | perplexa | so humor is now an age thing, i see |
| 19:36 | antonv | gtrak: yes, that's what I assumed as alternative |
| 19:36 | gtrak | just because some things are possible, it does not mean they should be done :-) |
| 19:37 | S11001001 | antonv: as for the dependencies, I think if you're separating out functionality, then your files will work out to need very different sets of :requirements. |
| 19:37 | antonv | gtrak: well I often use one nanespase for whole the system |
| 19:38 | turbofail | "humor" |
| 19:39 | brehaut | (inc gtrak) |
| 19:39 | lazybot | ⇒ 7 |
| 19:40 | coventry | Is it really so bad to make actual-namespace.clj a series (load "file.clj")s like clojure.core does, if actual-namespace.clj would be unmanageably huge? Keeping the (ns) forms straight across the different files sounds potentially just as confusing. |
| 19:40 | S11001001 | coventry: Yeah, it's so bad. |
| 19:40 | amalloy | coventry: putting the same code into N different files doesn't make it less unmanageably huge in any magical way |
| 19:40 | antonv | S11001001: well, yes, separate functionality pieces placed in these different files have different dependencies |
| 19:40 | technomancy | coventry: plus it breaks slamhound |
| 19:41 | antonv | but as the dependencies are bound to namespace, and I wanted to use the same namespace... |
| 19:41 | coventry | technomancy: OK, that's compelling. :-) |
| 19:41 | amalloy | technomancy, always keeping the big picture in mind |
| 19:42 | technomancy | I like to think of it as imperative vs declarative, though in fact require is still fairly imperative |
| 19:42 | aka | whoa gorilla repl is neat |
| 19:42 | S11001001 | antonv: If you wish to present to your library's clients a convenience "everything" namespace, there are other approaches; under these, one-namespace-per-file is still preferred. |
| 19:42 | coventry | "One namespace for the whole system" sounds like the core problem here. |
| 19:43 | antonv | OK, guys, thanks for confirming |
| 19:45 | antonv | Althoug, to ensure. Is it impossible to specify files load order in project.clj? |
| 19:45 | antonv | Then in the first file I would have (ns ... (require ...)) and in all the dependent files (in-ns ...) |
| 19:46 | CapitalSigma | hi all |
| 19:46 | cbp | CapitalSigma: hi |
| 19:48 | amalloy | antonv: files aren't loaded unless you ask for them |
| 19:48 | amalloy | when you (require 'foo.core), the file foo/core.clj is loaded |
| 19:48 | amalloy | if it loads other files, that's its responsibility |
| 19:50 | antonv | amalloy: ah... thanks |
| 19:51 | antonv | amalloy: so I can say (ns foo (require depA debB)) in one file and (ns foo (require depC)) in another file... |
| 19:51 | amalloy | i guess? i mean, i'm not thrilled with this whole multi-file namespace, but obviously that is a thing you can do |
| 19:51 | akurilin | Quick question: those of you running serving SPAs from your ring apps, how do you handle templating in the .js assets? Do you build a middleware that checks if the request is for a .js file and then you just pass the file through something like Selmer with a basic map of common interpolations? |
| 19:52 | antonv | amalloy: on the other hand require loads files using namespace to resource mapping, based on naming convention... |
| 19:52 | coventry | antonv: If you want everything in one ns for ease of loading / repl access or something, you can do something like this: https://github.com/coventry/troncle/blob/master/src/troncle/traces.clj#L174 |
| 19:52 | antonv | amalloy: so I will have problems loading code from my files, because namespace doesn't correspond to fill name... |
| 19:53 | coventry | antonv: ... and that way, you can use namespaces as intended elsewhere in your project. |
| 19:53 | antonv | coventry: thanks for the link. No, I want namespace not for repl, but for easier coding.... |
| 19:54 | coventry | antonv: Pretty sure you'll find that's a false economy as you go on. |
| 19:54 | antonv | coventry: it's not economy, just a habbit |
| 19:55 | antonv | I just came from Common Lisp, it is usually done that way there and it is supported by system definition facility |
| 19:55 | amalloy | coventry: that doesn't look like a very good implementation, fwiw. try putting the following into troncle.traces: (let [x 1] (defn foo [] x)) |
| 19:55 | antonv | But I see now that leingen and clojure do not support this |
| 19:55 | antonv | OK |
| 19:55 | antonv | another quick question |
| 19:56 | antonv | nevermind |
| 19:56 | amalloy | if you use intern instead of eval/def, you avoid the problem |
| 19:57 | coventry | Thanks, amalloy. Good point. |
| 19:57 | amalloy | also, coventry, while i'm in there: (swap! a (constantly x)) is just (reset! a x) |
| 19:58 | antonv | still, quick question |
| 19:58 | coventry | Yeah, I've learned that one since I wrote it. |
| 19:58 | antonv | I see the default in clojure is to create public functions |
| 19:58 | CapitalSigma | i'm learning clojure and i have a potentially stupid question -- what's the point of having both a cons and conj operation? is either optimized for a particular situation? |
| 19:58 | antonv | and only with special sign (the minus) the functions become private |
| 19:58 | rasmusto | CapitalSigma: conj is collection-agnostic |
| 19:59 | amalloy | CapitalSigma: cons always builds a linked list, conj adds to an existing collection based on its type |
| 20:00 | rasmusto | ,(conj #{} 'a) |
| 20:00 | clojurebot | #{a} |
| 20:00 | CapitalSigma | okay. is cons essentially a relic from lisp, then? i can't imagine why i would want to use a linked-list only function over a polymorphic one |
| 20:00 | rasmusto | ,(cons 'a #{}) |
| 20:00 | clojurebot | (a) |
| 20:00 | hiredman | ,(doc cons) |
| 20:00 | clojurebot | "([x seq]); Returns a new seq where x is the first element and seq is the rest." |
| 20:01 | hiredman | (doesn't say anything about linked lists) |
| 20:01 | cbp | cons is for building seqs |
| 20:01 | antonv | do you guys care to hide design public/private interfaces between all these namespaces? |
| 20:01 | amalloy | CapitalSigma: because linked lists are amazing |
| 20:01 | technomancy | antonv: metadata is one good way |
| 20:01 | amalloy | you can build them and traverse them lazily, and they're cheap to put together |
| 20:01 | hiredman | ~private |
| 20:01 | clojurebot | not even once |
| 20:01 | amalloy | (inc clojurebot) |
| 20:01 | lazybot | ⇒ 39 |
| 20:02 | bbloom | we need a word for "not private, but not promised" |
| 20:02 | CapitalSigma | ah, okay. the result of cons is guaranteed to be lazy? (sorry if this is basic -- i'm a former scheme-er going through the clojure koans) |
| 20:02 | technomancy | bbloom: ^:internal is what I use |
| 20:02 | cbp | CapitalSigma: no you need to wrap it inside lazy-seq |
| 20:02 | amalloy | that's a good point, hiredman. i guess it's not really a whole linked list, it's like one node prepended to something that knows how to act like a list (ie, a seq) |
| 20:02 | bbloom | technomancy: but that has some java/c#-ish meaning |
| 20:03 | bbloom | CapitalSigma: clojure has interfaces/protocols for sequences. clojure.lang.Cons, clojure.lang.PersistentList, etc implement the clojure.lang.Seq interface, which has first/rest |
| 20:03 | bbloom | CapitalSigma: ... and so does clojure.lang.LazySeq |
| 20:04 | CapitalSigma | okay. i'll start digging through the documentation then -- thank you |
| 20:04 | bbloom | ~seqs |
| 20:04 | clojurebot | seqs is http://www.brainonfire.net/files/seqs-and-colls/main.html |
| 20:04 | bbloom | CapitalSigma: ^^ good reference |
| 20:05 | CapitalSigma | cool, thanks |
| 20:06 | cbp | CapitalSigma: (defn my-range [start] (lazy-seq (cons start (my-range (inc start))))) ; for an example |
| 20:09 | antonv | technomancy: hiredman: bbloom: I mean private as defn- does |
| 20:09 | bbloom | antonv: yeah, hiredman was suggesting not to bother |
| 20:10 | bbloom | antonv: technomancy and i were discussing the desire for "still private, but labeled as not part of the promised api" |
| 20:10 | bbloom | er i mean "still public, but..." |
| 20:10 | technomancy | antonv: the important thing is not that you prevent people from using your vars, but that you communicate that they're not part of a stable interface |
| 20:11 | bbloom | well said |
| 20:11 | technomancy | so the difference between ^:private and ^:internal is not all that important |
| 20:11 | technomancy | (defn- is shorthand for ^:private) |
| 20:13 | antonv | technomancy: by private I mean not visible in the user namespace, after you clojure.core/refere the my namespace |
| 20:14 | amalloy | right, he's telling you not to care so much about that, antonv |
| 20:14 | amalloy | or suggesting it, anyway |
| 20:14 | antonv | OK |
| 20:14 | antonv | thanks |
| 20:36 | akurilin | Does anyone know of an article/blog post/whatever out there explining the various options one has when wanting to share code across a few lein projects? It's my understanding that there's a sliding scale of how complex this can be made, from actually including the sources directly in each project to turning the shared code into separate .jar s |
| 21:07 | brehaut | is nashorn going to be viable target for cljs in the future? |
| 21:08 | hiredman | is it not one now? |
| 21:08 | brehaut | well, i dont know if anyone has pointed cljs at it yet |
| 21:08 | brehaut | i guess thats what i really meant though isnt it |
| 21:08 | chare | so to get something of the effect of rails asset pipeline i do what in clojure? |
| 21:23 | devn | Uncaught Error: No protocol method ReadPort.take! defined for type number: 23 hrm |
| 21:23 | devn | this is core.async and cljs -- what am i doing wrong here i wonder? |
| 21:25 | egghead | sounds like you are trying to: (<! 23) |
| 21:27 | devn | egghead: https://gist.github.com/devn/af570b702f68d31da704 |
| 21:28 | devn | im taking this basically verbatim from http://swannodette.github.io/2013/07/12/communicating-sequential-processes/ |
| 21:29 | egghead | ya nothing in that gist looks wrong |
| 21:29 | devn | I have a couple of go blocks putting onto c, and then i have a go block taking from c and logging |
| 21:33 | amalloy | devn: that error message looks like it's produced by code other than the code in your gist, really |
| 21:37 | devn | strange business |
| 21:38 | devn | because that's it verbatim, no foolin' |
| 21:39 | amalloy | restart your repl, restart your machine, reinstall your OS? |
| 21:41 | arrdem | amalloy: better zero your hard disk first |
| 21:41 | arrdem | amalloy: just to make sure no state persists |
| 21:41 | Raynes | Best to just replace it. |
| 21:41 | arrdem | better nuke from orbit... it's the only way to be sure |
| 21:41 | Raynes | Potentially shift to an alternate universe as well. |
| 21:41 | Raynes | To make sure all the bits are properly flipped. |
| 21:42 | Raynes | M-x butterfly only does one at a time. |
| 21:42 | arrdem | Raynes: I mean... the number of atoms in the universe is finite so we can just compute the inverse universe in O(N) time, right? |
| 21:42 | arrdem | better. we can do O(1)! |
| 21:47 | Frozenlock | seancorfield: You mentioned wanting to do some massive changes to congomongo on the mailing list. Is this still planed? Should I wait a new version before starting something new on it? |
| 21:51 | S11001001 | Raynes: thanks to you mentioning that, I took another look at M-x butterfly, to find that if you answer no to the confirmation, it sends you to the cartoon. Convenient built-in bookmark for that particular xkcd entry. |
| 21:54 | brunov | Raynes: hey. Thanks for Ororo, I've been using it these past days |
| 21:54 | Raynes | :D |
| 21:55 | brunov | killer name |
| 21:55 | brunov | I added async support via httpkit in a fork, let me know if you'd be interested in such a change. |
| 21:56 | Raynes | I saw! Just hadn't gotten around to checking it out |
| 21:56 | brunov | yeah, I know how it goes. No rush. |
| 21:56 | Raynes | brunov: So could you give me an elevator pitch of what this gains ororo? |
| 21:56 | Raynes | I'm unclear on what 'added async support' means |
| 21:57 | brunov | Sure. So, with httpkit's asynchronous support, you don't block the caller whenever you do an HTTP request. |
| 21:57 | brunov | The function returns a promise |
| 21:57 | Raynes | Can't you just call an existing Ororo function wrapped in a promise? :P |
| 21:58 | Raynes | I'm assuming that's too easy |
| 21:59 | brunov | you could, but you'd have to manage the threads where those promises will have to be fulfilled though, right? |
| 22:02 | brunov | the word is delivered, not fulfilled, hopefully the point came across though |
| 22:02 | ivan | dang I can't unquote-splice one form into a key and value in a map |
| 22:03 | Raynes | brunov: Do you by chance have an example that would demonstrate the issue? |
| 22:03 | Raynes | Sorry if I'm being thick. |
| 22:03 | ivan | well actually I can if I'm unquote-splicing an even number of things |
| 22:03 | brunov | No, it's ok. And it's probably overkill for casual usage, since WUnderground's API is heavily throttled. |
| 22:04 | brunov | There is no actual issue. |
| 22:04 | brunov | It just so happens I just started a project that will leave our team to use one of the paid plans with higher limits |
| 22:05 | Raynes | Well if your team needs this feature then clearly it is important! |
| 22:05 | brunov | Haha, I wouldn't say 'need'. |
| 22:05 | brunov | We 'need' food :) |
| 22:05 | brunov | we don't 'need' async support in Ororo ;) |
| 22:06 | brunov | basically I'm trying ot avoid blocking a full OS thread per concurrent call if I ever need to have, say, hundreds of concurrent pending requests |
| 22:06 | brunov | Btw, this is way harder to justify than I though. |
| 22:06 | brunov | thought, even |
| 22:06 | S11001001 | brunov: maybe you could use the Norwegian Meteorological Institute's feed? http://api.met.no/#english :) |
| 22:06 | Raynes | I can't recommend anything except for wunderground. |
| 22:06 | Raynes | They sent me swag for this library. |
| 22:06 | brunov | hahaha |
| 22:07 | brunov | S11001001: interesting, but I'm going to go with Raynes. It's pretty hard to beat their over 45k personal weather stations |
| 22:07 | brunov | we're talking full world saturation here |
| 22:07 | brunov | to the moon, etc. |
| 22:07 | Raynes | $weather the moon |
| 22:07 | Raynes | $conditions the moon |
| 22:07 | lazybot | Last Updated on March 31, 11:00 PM BRT; Clear; Dewpoint: 77 F (25 C); Precipitation today: 0.00 in (0.0 mm); Temperature: 79 F (26 C); Windchill: NA; Wind speed: 0mph; Wind gust: 0mph; URL: http://www.wunderground.com/global/stations/82579.html. |
| 22:07 | Raynes | o_o |
| 22:08 | Raynes | Didn't see that coming. |
| 22:08 | brunov | haha |
| 22:08 | Raynes | So the moon is in Brazil I see. |
| 22:08 | Raynes | Exciting. |
| 22:08 | Raynes | (funfact: lazybot's conditions plugin is so smart it does not account for spaces in place names) |
| 22:10 | brunov | who needs spaces |
| 22:23 | Foxboron | 25 celsius on the moon? |
| 22:23 | Foxboron | Well boys, summer have to arrive the moon at one point |
| 22:23 | Foxboron | at the moon* |
| 22:44 | rootex | what is the meaning of doing #_defn ? |
| 22:44 | rootex | err #_(defn ... |
| 22:44 | brehaut | #_ skipps the next form |
| 22:44 | brehaut | while reading |
| 22:45 | rootex | oh ok |
| 22:45 | brehaut | ,[:a #_ :b :c] |
| 22:45 | clojurebot | [:a :c] |
| 22:45 | brehaut | ,[:a (comment :b) :c] |
| 22:45 | clojurebot | [:a nil :c] |
| 22:46 | rootex | yeah, forgot about that comment thing |
| 22:47 | rootex | 'form-level' comment |
| 22:49 | chare | how is apply implemented? |
| 22:51 | amalloy | chare: from clojure's point of view it's a language primitive, one that you couldn't implement without already having apply. are you interested in how it's implemented deep in the java guts of the compiler? |
| 22:51 | rootex | chare: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L619 |
| 22:51 | chare | amalloy does that mean it counts as a special form? |
| 22:51 | amalloy | no, it's an actual function that you can pass to other functions |
| 22:52 | amalloy | kinda like +. it's a function, but it's also a primitive |
| 22:52 | chare | rootex does that mean applyTo is the one thats a primitive |
| 22:52 | rootex | amalloy: what about clojure.core/apply ? |
| 22:53 | amalloy | that's the function we're discussing, rootex. i mean, yes, obviously from one point of view that's a function implemented in clojure. but really it's just delegating to some java stuff |
| 22:53 | chare | what is applyTo? |
| 22:54 | amalloy | chare: when you define a function, with fn or defn or whatever, that creates an implementation of the java interface clojure.lang.IFn |
| 22:54 | amalloy | a method of that interface is applyTo |
| 22:54 | amalloy | which says "someone is trying to call this function, here is a list of the args they want to pass" |
| 22:55 | amalloy | so fn and defn implement applyTo for you in a way that dispatches to the right arity of your function, binds the appropriate variables, etcv |
| 23:00 | rootex | amalloy: is that a performance optimization? the multiple arities in the definition of apply |
| 23:01 | amalloy | yeah. clojure.core is full of nonsense like that |
| 23:01 | rootex | k |
| 23:05 | rootex | amalloy: so functions compile down to classes? |
| 23:07 | rootex | since you said fn or defn implements IFn |
| 23:08 | rootex | it most create a class to implement its methods |
| 23:08 | amalloy | i mean, this is the jvm. everything is a class at some point |
| 23:10 | rootex | amalloy: yeah, was wondering if each function has a class of its own or if they are all under some class per namespace or something |
| 23:10 | amalloy | each fn form compliles to a new class, with a method for each arity it supports. every fn object is an instantiation of that class |
| 23:11 | rootex | thanks |
| 23:20 | arrdem | anyone want an Atom code? I don't have a use for mine... |
| 23:21 | rootex | arrdem: you requested one? |
| 23:22 | arrdem | rootex: I expected them to not be reatarded and have a Linux build |
| 23:22 | rootex | :) |
| 23:25 | gwz | hey, is it possible to check in a if statement that a type is cons, is there anything like (if (cons? item)... |
| 23:28 | amalloy | gwz: seq? |
| 23:28 | gwz | yes |
| 23:31 | todd__ | there is not a lot of chatting here |
| 23:56 | chare | how do i use a namespace a second on repl after changing the code |