2014-03-10
| 00:44 | firefaux | how would you go about iterating over the values of two (or more) maps, for matching keys, and for keys that are missing in one of the maps, use a default value? |
| 00:51 | tolstoy | firefaux: Maybe not what you want, but there's clojure.data/diff. |
| 00:53 | firefaux | actually |
| 00:53 | firefaux | I might be able to use that |
| 00:53 | firefaux | though it might not be the best way to do it |
| 00:54 | firefaux | I could diff the keys |
| 00:54 | firefaux | then iterate over the shared keys on both maps |
| 00:54 | firefaux | and then iterate over the keys that aren't shared, using the default value |
| 00:54 | TravisD | firefaux: this isn't particularly elegant, but it works: https://www.refheap.com/55476 |
| 00:55 | firefaux | hmm |
| 00:55 | TravisD | it makes a set containing all the keys that appear in any of the maps, and then there is a function which takes a map and fills in the missing values |
| 00:55 | TravisD | then maps that function over the maps. |
| 00:55 | TravisD | lol |
| 00:56 | firefaux | that's quite a bit of work |
| 00:56 | TravisD | (add-missing-keys :missing {:one 1} {:two 2}) ; => ({:one 1, :two :missing} {:one :missing, :two 2}) |
| 00:56 | TravisD | yeah, there is likely a cleaner solution |
| 00:56 | TravisD | conceptually this is a clean solution, though |
| 00:56 | firefaux | well, efficiency isn't a big concern of mine at this point |
| 00:57 | firefaux | as long as it takes nice inputs and gives nice outputs, I'm happy |
| 00:58 | firefaux | taking [default & maps] is pretty much perfect |
| 00:58 | firefaux | and returning a seq of maps is also perfect |
| 01:04 | ddellacosta | hmm, is there a way to auto run tests w/cljsbuild? |
| 01:05 | ddellacosta | I thought I'd done it in the past but can't figure it out now |
| 01:06 | TravisD | firefaux: I like this implementation more than the last one: https://www.refheap.com/55501 |
| 01:07 | TravisD | or even https://www.refheap.com/55504 |
| 01:08 | firefaux | what makes them better? the fact that they use --> ? |
| 01:08 | firefaux | lol |
| 01:09 | TravisD | Yeah, this seems easier to read to me |
| 01:09 | firefaux | is it doing anything differently, though? |
| 01:09 | TravisD | Also, I like that they use merge, instead of another function |
| 01:09 | firefaux | (doc merge) |
| 01:09 | clojurebot | "([& maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result." |
| 01:10 | firefaux | ah, that's smart |
| 01:10 | TravisD | I guess it's what merge is for :) |
| 01:11 | firefaux | ok, this does make more sense |
| 01:11 | TravisD | It makes a dictionary that maps all present keys to the default value, and then merges that with every map you provide |
| 01:12 | firefaux | yeah |
| 01:12 | firefaux | that's a neat way of doing it |
| 01:12 | TravisD | and now that I look at it, there's really no need for add-keys to be a named function: https://www.refheap.com/55512 |
| 01:13 | firefaux | I thought about that |
| 01:13 | firefaux | is there any harm in it, though? |
| 01:13 | TravisD | not really |
| 01:13 | firefaux | I kinda like it like that |
| 01:13 | firefaux | makes it clear what it's doing |
| 01:13 | TravisD | hehe, to each his own |
| 01:14 | TravisD | This is also clearer than the one before, I think: https://www.refheap.com/55514 . Instead of using partial, it uses the fact that map can combine multiple sequences |
| 01:15 | firefaux | ooh |
| 01:15 | firefaux | I like it |
| 01:16 | arubin | So Lambda Jam will only be two days this year, and it is on the south side, although I believe that it is on the U of Chicago campus. |
| 01:21 | firefaux | is there a prepending version of conj? |
| 01:22 | andcloj | Can someone tell me why this evaluates to 3 and not 5? http://pastebin.com/fiPFfKaA |
| 01:22 | firefaux | oh, I guess I can just use cons |
| 01:23 | TravisD | firefaux: For lists, conj will add to the beginning and for vectors it adds to the end |
| 01:23 | firefaux | oh |
| 01:23 | TravisD | more generally, I think the implementation is free to choose where to add the new element based on what is the most efficient |
| 01:23 | firefaux | what about cons? |
| 01:23 | firefaux | is that always guaranteed to put it at the front? |
| 01:23 | firefaux | actually, of course |
| 01:23 | firefaux | that's what conses are |
| 01:23 | TravisD | cons is only defined for lists, but it does the same as conj |
| 01:24 | TravisD | aside from having its arguments swapped |
| 01:24 | firefaux | I can still use a vector as input to it, right? |
| 01:24 | firefaux | ,(cons 2 [1 2 3]) |
| 01:24 | clojurebot | (2 1 2 3) |
| 01:24 | firefaux | ok good |
| 01:24 | firefaux | I don't care what kind of seq I get out |
| 01:24 | firefaux | as long as it's a sequence of some sort |
| 01:25 | TravisD | ah, and what I said I think is wrong. When I was testing things out I had the arguments mixed up :) |
| 01:29 | andcloj | Why does this evaluate to 3 and not 5? code: (let [x '(+ 2 3) op (first x) args (rest x)] (apply op args)) |
| 01:35 | ddellacosta | andcloj: you want |
| 01:35 | ddellacosta | ,(let [x '(+ 2 3) op (first x) args (rest x)] (apply (resolve op) args)) |
| 01:35 | clojurebot | 5 |
| 01:36 | ddellacosta | andcloj: what you are doing is essentially this: |
| 01:36 | ddellacosta | ,(apply (symbol "+") [2 3]) |
| 01:36 | clojurebot | 3 |
| 01:37 | ddellacosta | I'm actually not sure what that is doing. |
| 01:37 | TravisD | ddellacosta: Hmm, why doesn't that give an arrity exception, since the symbol is a function on dictionaries, expecting one argument? |
| 01:37 | TravisD | er, it is not that. It is just not a function |
| 01:37 | ddellacosta | TravisD: yeah, it's a bit strange to me... |
| 01:37 | TravisD | on my machine it does give an error |
| 01:38 | TravisD | but not for the original code pasted by andcloj |
| 01:38 | ddellacosta | TravisD: wat |
| 01:39 | andcloj | I get no exception. |
| 01:40 | TravisD | Ah, no, sorry. I get an error depending on the number of arguments I provide: https://www.refheap.com/55533 |
| 01:40 | ddellacosta | TravisD: ah, yeah, I see that too. |
| 01:40 | andcloj | I find this to be interesting, too: (= + (resolve (symbol (first '(+))))) evaluates to false |
| 01:41 | andcloj | (= + (resolve (first '(+)))) also resolves to false |
| 01:42 | pdk | ,(= '+ (resolve (first '(+))) |
| 01:42 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 01:42 | pdk | ,(= '+ (resolve (first '(+)))) |
| 01:42 | clojurebot | false |
| 01:43 | andcloj | ,(= + (resolve (symbol (first '(+))))) |
| 01:43 | clojurebot | false |
| 01:43 | ddellacosta | andcloj: do you expect that to be true? |
| 01:44 | ddellacosta | ,(= (first '(+)) '+) |
| 01:44 | clojurebot | true |
| 01:44 | ddellacosta | ,(= (resolve (first '(+))) #'+) |
| 01:44 | clojurebot | true |
| 01:45 | andcloj | ddellacost: I'm not sure what I expect, I'm new to clojure |
| 01:45 | ddellacosta | ah, okay |
| 01:45 | andcloj | :) |
| 01:45 | ddellacosta | ,+ |
| 01:45 | clojurebot | #<core$_PLUS_ clojure.core$_PLUS_@1ac5f00> |
| 01:45 | ddellacosta | ,'+ |
| 01:45 | clojurebot | + |
| 01:45 | ddellacosta | ,#'+ |
| 01:45 | clojurebot | #'clojure.core/+ |
| 01:45 | ddellacosta | ,(resolve '+) |
| 01:45 | clojurebot | #'clojure.core/+ |
| 01:45 | andcloj | I very much so appreciate the help though. |
| 01:45 | ddellacosta | etc |
| 01:45 | ddellacosta | andcloj: :-) |
| 01:45 | andcloj | Yeah so they are different things |
| 01:47 | ddellacosta | andcloj: yeah, I recommend taking a look at these two pages for more context: http://clojure.org/reader and http://clojure.org/data_structures#Data%20Structures-Symbols |
| 01:50 | andcloj | ok thanks |
| 01:51 | andcloj | ddellacost: going back to the original I still don't quite understand the actual mechanics of how it returns 3 instead of 5, I'll see if I can figure it out from those pages |
| 01:51 | andcloj | ,('x 1 2) |
| 01:51 | clojurebot | 2 |
| 01:52 | andcloj | ,('+ 1 2) |
| 01:52 | clojurebot | 2 |
| 01:52 | ddellacosta | andcloj: This explains what is going on there: http://stackoverflow.com/questions/12281631/what-do-clojure-symbols-do-when-used-as-functions |
| 01:53 | ddellacosta | it's apparently the same as doing (get {:foo "foo"} :bar "bar") |
| 01:53 | ddellacosta | ,(get {:foo "foo"} :bar "bar") |
| 01:53 | clojurebot | "bar" |
| 01:53 | ddellacosta | not the same, but analogous, I should say |
| 01:54 | andcloj | ddellacosta: this stack overflow references the same 4clojure that led me to this confusion :) |
| 01:54 | ddellacosta | andcloj: haha, there ya go, it all comes full circle. ;-) |
| 01:56 | ddellacosta | er, more like |
| 01:56 | ddellacosta | ,(:bar {:foo "foo"} "bar") |
| 01:56 | clojurebot | "bar" |
| 01:56 | xuser | 0 |
| 01:57 | andcloj | so then is using (resolve op) a no no? |
| 01:57 | andcloj | like using an eval in other languages would be? |
| 01:57 | andcloj | if we had to worry about user input |
| 01:58 | andcloj | I guess you could check if it's in a list of allowed symbols |
| 02:00 | ddellacosta | andcloj: no, I use it all the time. eval is definitely...questionable. But resolve is fine if you know what you're doing. Worst thing that'll happen probably is that you'll get an exception because something doesn't resolve. |
| 02:00 | ddellacosta | andcloj: I mostly find myself using it in macros. |
| 02:02 | firefaux | damned daylight savings time |
| 02:02 | firefaux | it's 2 already :\ |
| 02:02 | firefaux | alright, 'night everyone |
| 02:09 | dissipate | ,(and) |
| 02:09 | clojurebot | true |
| 02:09 | dissipate | ,(or) |
| 02:09 | clojurebot | nil |
| 02:10 | dissipate | ,(= (and) (or)) |
| 02:10 | clojurebot | false |
| 02:10 | dissipate | ,(= (or) (or)) |
| 02:10 | clojurebot | true |
| 02:10 | dissipate | ,(= (and) (or)) |
| 02:10 | clojurebot | false |
| 02:11 | dissipate | anyone care to explain that ^ |
| 02:19 | dissipate | lazy-seq seems like python's 'yield' |
| 02:30 | Nyyx | anyone know of any clojure IDE's for android |
| 02:35 | dissipate | Nyyx, not sure about IDE but there is a repl |
| 02:35 | dissipate | 'Clojure REPL' |
| 04:41 | BartAdv | Nyyx: and what about Nightcode? |
| 04:51 | scottj | BartAdv: I think the assumption was the IDE was going to run on android, not make apps for android (which is I think all nightcode does) |
| 04:53 | BartAdv | hah, I assumed the same, somehow I thought Nightcode can be run there |
| 05:46 | anars | I'm writing my own workflow for cemerick's friend library, but I'm not sure what to return from the workflow function when auth succeeds. I've looked at https://github.com/cemerick/friend/blob/master/src/cemerick/friend/workflows.clj#L54 of course, but I'm not sure what should go into the meta map. |
| 05:47 | anars | I figured I'd put in a ::friend/workflow key, but can I just invent a new value for it? instead of :http-basic that is. that part isn't being validated anywhere down the road? |
| 05:51 | noidi | in http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded , Stuart Sierra keeps the system reference in a var that he updates with alter-var-root. what's the reason for updating the var instead of storing an atom in the var and updating it? |
| 05:51 | noidi | this has been bugging me for quite a while now :) |
| 05:52 | clgv | noidi: no big reason. I guess he wants to make clear that it is a dev time constant |
| 05:53 | clgv | and the few dev functions associated to it do not have the additional noise an atom would introduce |
| 05:55 | sm0ke | hey guys how to design multivariate macros? |
| 05:55 | sm0ke | ,(defmacro foo ([x y] `(prn ~x ~y)) ([x] (foo x 1))) |
| 05:55 | clojurebot | #'sandbox/foo |
| 05:55 | sm0ke | this doesnt work |
| 05:55 | sm0ke | ,(foo 1) |
| 05:55 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/foo> |
| 05:55 | sm0ke | ,(foo 1 2) |
| 05:55 | clojurebot | 1 2\n |
| 06:00 | fredyr | think about what's happening when you macro expand the macro |
| 06:01 | fredyr | at compile time |
| 06:01 | sm0ke | got it |
| 06:01 | sm0ke | (defmacro foo ([x y] `(prn ~x ~y)) ([x] `(foo ~x 1))) |
| 06:01 | sm0ke | hit and trial though |
| 06:01 | sm0ke | ,(defmacro foo ([x y] `(prn ~x ~y)) ([x] `(foo ~x 1))) |
| 06:01 | clojurebot | #'sandbox/foo |
| 06:01 | sm0ke | ,(foo 3) |
| 06:01 | clojurebot | 3 1\n |
| 06:02 | sm0ke | makes sense though |
| 06:06 | sm0ke | so i have this protocol where i want to define a function `flush` |
| 06:06 | sm0ke | is this a good idea? |
| 06:11 | dsrx | well.. |
| 06:11 | dsrx | ,(doc flush) |
| 06:11 | clojurebot | "([]); Flushes the output stream that is the current value of *out*" |
| 06:26 | sm0ke | yes but i have seen people using reserved function names |
| 06:33 | cemerick | anars: ::friend/workflow is more to aid in debugging (i.e. "where did this map of credentials come from?") than anything else |
| 06:49 | zoldar | Clourescript related question: I need to set an attribute deeper in the nested structure of object, like "elem.style.margin-left". The problem is the dash in "margin-left". How to do that? I can't find a valid form for "set!" for such case |
| 06:54 | zoldar | ok, got it: (aset (.-style elem) "margin-left" 0) |
| 07:00 | dsrx | zoldar: that JS property is elem.style.marginLeft |
| 07:00 | dsrx | at least, if you're talking about a dom element |
| 07:00 | zoldar | dsrx: ouch, thanks |
| 07:00 | zoldar | dsrx: yes, yes I do, however I suppose that in case of non-dom attributes, I would have to resort to my version |
| 07:01 | dsrx | yeah, if you'd have to use a string property accessor rather than dots to get at it in JS, you'd probably need to do the same in cljs |
| 07:04 | dsrx | seems that elem.style["background-color"] etc also works, huh. dunno if that's standard |
| 07:04 | dsrx | i've always usedthe camelized versions of css properties |
| 07:07 | zoldar | well afaik all object attributes in js are accessible through string notation, no? |
| 07:08 | dsrx | yes, they are; i was surprisde that you can use either style["backrgroundColor"] or style["background-color"] in the case of css properties, at least in chrome |
| 07:08 | zoldar | ah |
| 07:11 | anars | cemerick: alright. I've written this, and it's gotten me a bit further: http://hastebin.com/xavoripise.clj |
| 07:12 | anars | although now the request is 403'd telling me I don't have the proper roles. however, the resources I've secured using friend doesn't require any roles. |
| 07:12 | anars | (i.e. :roles #{}) |
| 07:13 | anars | the setup works when I'm using the bundled http-basic workflow, but I'm definately missing something here with my custom JWT workflow. |
| 07:15 | anars | last note: I know I don't need the if-let from line 8 in the hastebin. that's only there because I started out with the http-basic handler and started shaving things off. |
| 07:16 | cemerick | anars: what is the actual message provided? There's nothing in friend that should emit any mention of roles in a 403 AFAIK. |
| 07:18 | anars | cemerick: you're right, I wasn't specific enough. it seems to be the default-unauthorized-handler which is being invoked: "Sorry, you do not have access to this resource." |
| 07:19 | anars | my println's tell me that the JWT provided is valid, and it even prints out the creds map: {:identity anars, :username anars, :roles #{:meve-webservice.web/user}} |
| 07:23 | cemerick | anars: You must be throwing an unauthorized exception somewhere |
| 07:25 | anars | cemerick: yeah, but I'm not doing that on purpose :-) if you have the time, you can have a look at my route and app defs here: http://hastebin.com/worimixuru.clj |
| 07:25 | anars | but there's nothing seemingly wrong with what I'm returning from the jwt auth handler, is there? |
| 07:28 | cemerick | anars: the empty set provided to wrap-authorize is probably the culprit |
| 07:31 | anars | cemerick: as always, I would've sworn I tried that ;) but you're perfectly right. it's working now. thanks a ton. |
| 07:32 | cemerick | anars: pull req welcome to assert that that set isn't empty |
| 07:34 | anars | cemerick: roger - will do that. |
| 08:23 | pyrtsa | What's the concensus on reflection warnings? Should one try everything to get rid of them? Is it considered acceptable to send pull requests that fix them in open source libraries? |
| 08:25 | ambrosebs | pyrtsa: yes |
| 08:26 | clgv | pyrtsa: there are sometimes (rare) cases where you cant get rid of them without loosing general applicability |
| 08:27 | anars | cemerick: would you accept the usage of :pre condition map for that? |
| 08:27 | cemerick | anars: No, there should be a useful message thrown when the condition fails |
| 08:28 | anars | roger |
| 09:39 | arav93 | Hi! |
| 10:02 | steerio | anyone alive? :) |
| 10:03 | jballanc | nope |
| 10:03 | jballanc | ;-) |
| 10:04 | steerio | oh, carry on then. |
| 10:04 | steerio | :D |
| 10:04 | jballanc | EDT is probably sleeping off their DST hangovers |
| 10:04 | steerio | was the switch just now? |
| 10:04 | steerio | totally different in europe |
| 10:04 | jballanc | yesterday for the US |
| 10:04 | steerio | TIL :) |
| 10:04 | jballanc | heh...Europe and the rest of the "sane" world ;-) |
| 10:05 | steerio | i'm questioning the sanity of DST in general |
| 10:05 | jballanc | as a programmer, doubly true! |
| 10:06 | jballanc | I once caught a DST bug only because I was up, coding at 2 AM during a DST transition |
| 10:06 | steerio | lol |
| 10:06 | steerio | always use UTC! |
| 10:06 | jballanc | indeed |
| 10:07 | steerio | anyway, check what i've just found http://pastie.org/8903501 |
| 10:07 | steerio | quite interesting behaviour of seqable, i say |
| 10:08 | steerio | the klass is an excerpt of one of an actual class that does a couple of things that are irrelevant here |
| 10:10 | Anderkent | steerio: that's because (list) and (seq (list)) are not the same thing, and map gets confused when doing (seq coll) returns '() rather than nil |
| 10:11 | Anderkent | steerio: pretty sure the contract of Sequable specifies that if it's empty it should return nil |
| 10:11 | Anderkent | ... but htere's no javadoc on the class so there. |
| 10:13 | steerio | Anderkent: yep, nothing in clojure.lang.Seqable |
| 10:13 | steerio | Anderkent: but it's good to know |
| 10:13 | Anderkent | steerio: i.e. map goes (if (seq xs) (cons (f (first xs)) (map f (rest xs))) nil); xs is your Klass thing, (seq xs) gives back '(), which is truthy |
| 10:13 | Anderkent | so map does (cons nil (map f nil)) -> '(nil) |
| 10:13 | steerio | Anderkent: yep that's what was confusing, that map does seq anyway |
| 10:13 | Anderkent | yeah but your thing is only valid when its seq'd twice |
| 10:14 | Anderkent | (seq xs) -> '() , (seq (seq xs)) -> nil |
| 10:14 | steerio | tricky |
| 10:14 | Anderkent | what you want your class to do |
| 10:14 | Anderkent | is RT.seq(loader.invoke()) |
| 10:15 | Anderkent | nice repro though |
| 10:15 | Anderkent | (inc steerio) |
| 10:15 | lazybot | ⇒ 1 |
| 10:15 | steerio | thanks for the help |
| 10:15 | clgv | steerio: I think the contract is the seq() must return nil if the collection is empty |
| 10:17 | steerio | Anderkent: repro? |
| 10:17 | Anderkent | example |
| 10:17 | steerio | oh right, thx |
| 10:18 | jjro | I have a route "/rest/v1/async", and when I'm sending a websocket message through I get an error: java.lang.ClassCastException: org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame cannot be cast to org.jboss.netty.handler.codec.http.HttpChunk |
| 10:18 | jjro | (defroutes async |
| 10:18 | jjro | (GET "/rest/v1/async" {} |
| 10:18 | jjro | (aleph/wrap-aleph-handler connect-message))) |
| 10:20 | jjro | non-websocket requests the route works, but I cannot figure out why it fails, when using websockets |
| 10:22 | steerio | Anderkent, clgv: works like a charm now, thx for making it clear about seq() |
| 10:27 | whodidthis | Can't open 'Successfully compiled "out/test.js". how to fix when trying to run cljsbuild tests |
| 10:27 | scape_ | jjro: take a closer look at compojure, which I think you're using for routing |
| 10:28 | scape_ | also remember that websockets get routed only once for the entirety of the connection |
| 10:34 | jjro | scape_: thanks for the hint. I'm following http://alexkehayias.tumblr.com/post/28783286946/a-simple-real-time-chat-server-using-clojure-and-aleph and I haven't yet spot the difference in my code. |
| 10:38 | scape_ | use refheap or something and post your connect-message function |
| 10:47 | jjro | ok, here is the paste of all relevant parts: https://www.refheap.com/55822 |
| 10:53 | jjl`_ | anyone have an opinion on what's the easiest library for handling config files? |
| 10:54 | jjl`_ | no particular format is required. it's liable to only store simple keys/values |
| 10:56 | jjro | I solved that websocket-problem. Upgrading aleph to 0.3.1, and compojure to 1.1.6 changed something, and now it works. |
| 10:57 | scape_ | oh good, jjro |
| 10:58 | joegallo | jjl`: tell us more about these config files |
| 11:00 | jjl` | they'll be storing configuration for webapps. likely to be things like database credentials etc., nothing too complicated, doubtful i'll need anything more than key/value pairs. i don't want to pass them on the command line though |
| 11:00 | steerio | jjl`: https://github.com/weavejester/environ |
| 11:00 | steerio | jjl`: may or may not be what you want |
| 11:00 | jjl` | i was just looking at that. i'm a little unclear about how the jvm resolves properties files at runtime though |
| 11:00 | steerio | you can also use java properties files |
| 11:01 | joegallo | there's also require and load-file, you could just a config ns with a bunch of defs in it... |
| 11:01 | jjl` | yeah, properties files are sufficiently structured for my purposes. environ seemed like a nice way of handling it |
| 11:01 | joegallo | or something like https://github.com/sonian/carica |
| 11:02 | jjl` | heh. i'm not configuring my app with executable code :) |
| 11:02 | joegallo | shrug |
| 11:03 | jjl` | something that parsed EDN would be okay |
| 11:05 | joegallo | you could just edn-read a file from the classpath, then http://clojure.github.io/clojure/clojure.edn-api.html#clojure.edn/read |
| 11:12 | johnnyblaze | Question: how do you escape parenthesis in a string ? |
| 11:14 | jjl` | a string of...? |
| 11:14 | johnnyblaze | trying to execute a stored procedure. args to that stored procedure are enclosed in parenths |
| 11:15 | jjl` | using what? i suspect what you actually want is a placeholder |
| 11:16 | johnnyblaze | (execute! db-spec "execute sp ('mode")) |
| 11:16 | johnnyblaze | as an example |
| 11:16 | johnnyblaze | change the last quote to a single |
| 11:16 | johnnyblaze | (execute! db-spec "execute sp ('mode')) |
| 11:17 | johnnyblaze | No way to do it with just jdbc? I don't use korma. |
| 11:18 | jjl` | i'm sure there is, but i've tried to avoid using raw jdbc because i find it quite painful |
| 11:18 | jjl` | but i think what you want is a placeholder in any case |
| 11:18 | koalallama | johnnyblaze: aren't you missing a close double-quote? |
| 11:19 | johnnyblaze | yeah I am. (execute! db-spec "execute sp ('mode")") |
| 11:19 | johnnyblaze | err (execute! db-spec "execute sp ('mode')") |
| 11:19 | johnnyblaze | sorry coffee hasn't kicked in yet... apparently |
| 12:04 | TravisD | So this came up last night, and I'm still not totally sure what's going on. Can someone explain it to me? I understand that the + symbol is not being resolved to the addition function, but it's not clear to me why this doesn't give an arity exception in all four cases: https://www.refheap.com/55870 |
| 12:05 | bbloom | (doc +) |
| 12:05 | clojurebot | "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'" |
| 12:05 | bbloom | TravisD: note the variadic signatures |
| 12:05 | bbloom | + is a monoid |
| 12:05 | bbloom | http://mathworld.wolfram.com/Monoid.html |
| 12:05 | TravisD | bbloom: I don't think that's what going on. (apply '+ [2 3]) evaluates to 2 |
| 12:05 | bbloom | (doc *) ;; multiplication too |
| 12:05 | clojurebot | "([] [x] [x y] [x y & more]); Returns the product of nums. (*) returns 1. Does not auto-promote longs, will throw on overflow. See also: *'" |
| 12:06 | bbloom | TravisD: oh, duh, overlooked that. symbols are functions like keywords are functions |
| 12:06 | TravisD | and, why doesn't the 3-argument apply return |
| 12:06 | bbloom | ,('x {'x 5}) |
| 12:06 | clojurebot | 5 |
| 12:06 | TravisD | Ah, okay, and what do the functions do? |
| 12:06 | bbloom | ,('y {'x 5} 10) |
| 12:06 | clojurebot | 10 |
| 12:06 | bbloom | ,('y {'x 5} 10 15) |
| 12:06 | TravisD | namespace resolution or something? |
| 12:06 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: Symbol> |
| 12:06 | hyPiRion | TravisD: they are like keywords |
| 12:07 | hyPiRion | ,(map 'foo '[{foo :bar} {foo :zap}]) |
| 12:07 | clojurebot | (:bar :zap) |
| 12:07 | TravisD | hyPiRion: Right, so keywords look themselves up in maps. But what do symbols do? |
| 12:07 | bbloom | ('sym associative) is similar to (get associative 'sym) |
| 12:07 | hyPiRion | TravisD: exactly the same thing |
| 12:07 | TravisD | Ah, cool |
| 12:07 | TravisD | and why can they take two arguments instead of one? |
| 12:07 | bbloom | (doc get) |
| 12:07 | clojurebot | "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present." |
| 12:07 | rasmusto | ,(map 'foo '[{foo :bar} {bif :bof}]) |
| 12:07 | clojurebot | (:bar nil) |
| 12:07 | bbloom | similar to the second signature |
| 12:07 | TravisD | Ah, very neat. Thanks a lot |
| 12:07 | hyPiRion | TravisD: For the same reason keywords can, as a fallback if no value exists |
| 12:07 | TravisD | Yeah, I didn't realize that was an option |
| 12:10 | clgv | ,({:a 1} :b :c) |
| 12:10 | clojurebot | :c |
| 12:11 | TravisD | ,(:b {:a 1} :c!) |
| 12:11 | clojurebot | :c! |
| 12:11 | clgv | you build riddles by mixing those frequently in the same source ;) |
| 12:12 | TravisD | Hehe, unpleasant riddles |
| 12:13 | hyPiRion | (apply map list ...) is also a fun riddle |
| 12:13 | hyPiRion | HOFing, how does it work |
| 12:14 | rasmusto | ,(apply map list [[1 2 3] [4 5 6] [7 8 9]]) |
| 12:14 | clojurebot | ((1 4 7) (2 5 8) (3 6 9)) |
| 12:14 | rasmusto | :) |
| 12:14 | TravisD | It be the transpose! |
| 12:14 | sm0ke | anyone else having problem with maven repositories today? |
| 12:15 | rasmusto | ,(apply (comp (partial reduce +) (partial map list) [[1 2 3] [4 5 6] [7 8 9]]) |
| 12:15 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 12:15 | rasmusto | ,(apply (comp (partial reduce +) (partial map list)) [[1 2 3] [4 5 6] [7 8 9]]) |
| 12:15 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.Number> |
| 12:15 | rasmusto | aw :( |
| 12:15 | rasmusto | ,(apply (comp (partial apply reduce +) (partial map list)) [[1 2 3] [4 5 6] [7 8 9]]) ; oh man |
| 12:16 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core/reduce> |
| 12:16 | rasmusto | ,(apply (comp (partial map #(apply reduce + %)) (partial map list)) [[1 2 3] [4 5 6] [7 8 9]]) ; oh man |
| 12:16 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core/reduce> |
| 12:16 | TravisD | :( |
| 12:16 | rasmusto | ok I give up. use a list comprehension |
| 12:16 | TravisD | Poor clojurebot |
| 12:17 | rasmusto | oh whoops, forgot to eat breakfast. brb |
| 12:19 | justin_smith | rasmusto: you do know you can /msg clojurebot right? |
| 12:19 | rasmusto | justin_smith: k. sorry about the spam |
| 12:20 | justin_smith | np |
| 12:21 | justin_smith | it's more like "you can keep trying and find that answer without showing off all your mistakes", since you weren't interrupting another convo or anything |
| 12:21 | rasmusto | gotcha |
| 12:24 | rasmusto | food is kicking in ##(apply (comp (partial map #(apply + %)) (partial map list)) [[1 2 3] [4 5 6] [7 8 9]]) |
| 12:24 | lazybot | ⇒ (12 15 18) |
| 12:28 | mindbender1 | ,(seq? [4 1 9]) |
| 12:28 | clojurebot | false |
| 12:29 | mindbender1 | ,(sequential? [4 1 9]) |
| 12:29 | clojurebot | true |
| 12:33 | justin_smith | ,(sequential? "hello") |
| 12:33 | clojurebot | false |
| 12:34 | mindbender1 | ,(more [4 1 9]) |
| 12:34 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: more in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 12:36 | mindbender1 | why doesn't PersistentVector qualify as ISeq? |
| 12:37 | mindbender1 | ISeq interface demands first() next() more() cons() |
| 12:37 | justin_smith | mindbender1: were you looking for "rest" instead of more? |
| 12:38 | justin_smith | ,(.more (cons 1 ())) |
| 12:38 | clojurebot | () |
| 12:38 | mindbender1 | justin_smith: no, I was wondering why my test for seq? on PersistentVector fail |
| 12:38 | justin_smith | it isn't more, it's .more |
| 12:38 | yedi | anyone in boston wanna do a clojure thing for this: http://grandhackfest.wordpress.com/ |
| 12:39 | justin_smith | mindbender1: because of the underlying implementation of vectors you have peek and pop with an appending conj instead of first / rest with a prepending conj as the primitives |
| 12:40 | justin_smith | ,(.pop [0 1 2]) |
| 12:41 | clojurebot | [0 1] |
| 12:41 | justin_smith | ,(.first '(0 1 2)) |
| 12:41 | clojurebot | 0 |
| 12:41 | mindbender1 | justin_smith: is there any reason why PersistentVector was not tagged as implementing ISeq? |
| 12:42 | mindbender1 | since the .first works on it |
| 12:42 | justin_smith | because iseq is for things that conj at the front |
| 12:42 | justin_smith | ,(.first [0 1 2]) |
| 12:42 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: first for class clojure.lang.PersistentVector> |
| 12:42 | justin_smith | no it doesn't |
| 12:42 | mindbender1 | ok |
| 12:42 | justin_smith | seq is useful here |
| 12:42 | mindbender1 | justin_smith: thanks |
| 12:42 | stompyj | How are people deploying their webapps? I'm kinda torn on just sticking with heroku v. jetty v. nginx-clojure module |
| 12:43 | mindbender1 | yeah |
| 12:43 | justin_smith | ,(.first (seq [0 1 2])) |
| 12:43 | clojurebot | 0 |
| 12:43 | mindbender1 | got it |
| 12:44 | justin_smith | stompyj: my latest fave is http-kit standalone (uberjar run with java -jar) with whatever in front of it (nginx in my case) |
| 12:44 | justin_smith | stompyj: heroku is annoying because you can get discrepencies between their version of lein and your own |
| 12:44 | justin_smith | (among other reasons) |
| 12:44 | stompyj | justin_smith: yeah, there's a host of reasons I want to leave herokuu |
| 12:45 | stompyj | great for development, but too $$$ for production |
| 12:45 | justin_smith | and also I don't think git or lein should be running on the web server, personally |
| 12:45 | stompyj | esp. if you know how to roll your own |
| 12:45 | technomancy | justin_smith: does setting :min-lein-version help? |
| 12:45 | justin_smith | technomancy: not sure - haven't tried it |
| 12:45 | justin_smith | frankly it was my coworker patchwork who was mainly dealing with these issues |
| 12:45 | stompyj | I'll take a look @ what you suggest. Bascially I just want something that's easily scriptable via chef/ansible and supports new relic, heh |
| 12:46 | stompyj | technomancy: yeah, :min-lein-version fixed it for me |
| 12:46 | technomancy | justin_smith: we don't actually recommend leaving lein around in production any more fwiw |
| 12:46 | justin_smith | right, I agree with that :) |
| 12:47 | justin_smith | I was more listing my heroku annoyances |
| 12:47 | technomancy | keep it coming =) |
| 12:47 | stompyj | technomancy: you mean lein on the box at all? or running lein as the executable to launch the production process? |
| 12:48 | technomancy | stompyj: we keep the lein shell script around on the unit of deployment, but the jar file gets deleted in order to keep the size down. if you end up using it for interactive debugging or whatever it gets downloaded on demand. |
| 12:49 | technomancy | stompyj: this happens for you if you deploy using an uberjar |
| 12:49 | stompyj | ahhh ok |
| 12:49 | stompyj | what do you guys use as your http server? |
| 12:49 | stompyj | or 'front-end' server |
| 12:49 | stompyj | or however you want to call it |
| 12:50 | technomancy | we have a custom erlang front end that routes HTTP requests to the right place by tracking the way the runtime system moves around processes |
| 12:50 | stompyj | hahahahah |
| 12:50 | stompyj | thats probably overkill for my liberator based data api |
| 12:50 | stompyj | ;) |
| 12:50 | stompyj | that awesome tho |
| 12:51 | technomancy | yeah it's not like there are any off the shelf solutions that would work in a situation like that |
| 12:51 | stompyj | cool to see erlang getting some love. I used it back in the mid 90s in my mobile dev days, back when Ericcson ruled the roost |
| 12:51 | technomancy | oh wow, nice. |
| 12:52 | technomancy | yeah unfortunately the http server isn't oss yet, but the erlang codebase I'm working on is. |
| 12:52 | stompyj | Yeesh, I meant mid-2000s. |
| 12:52 | stompyj | wow, sweet. you're working on riak right? |
| 12:53 | technomancy | I was going to say, you couldn't even get erlang outside ericsson in the mid nineties iirc |
| 12:53 | technomancy | no, https://github.com/heroku/logplex |
| 12:55 | stompyj | haha yeah, it just *felt* like the 90s |
| 12:55 | stompyj | hahaah |
| 12:55 | stompyj | pre iPhone pre android |
| 12:55 | wink | technomancy: wait, heroku does not do "lein run" in a tmux? :) |
| 12:55 | technomancy | hehe |
| 12:55 | wink | we all do it! |
| 12:57 | technomancy | let it crash |
| 13:15 | ghaz | quit |
| 13:31 | jballanc | huh...would've expected clojurebot to have something snarky to say to that... |
| 13:33 | rasmusto | ~quit |
| 13:33 | clojurebot | rasmusto: We'll never let you leave. |
| 13:34 | TimMc | jballanc: It didn't come up on the dice this time. |
| 13:35 | jballanc | clojurebot's off his game, it seems |
| 13:35 | jballanc | clojurebot, pull yourself together |
| 13:35 | clojurebot | I don't understand. |
| 13:35 | jballanc | yeah, that's what I thought |
| 13:51 | TimMc | clojurebot is not so much a Chinese Room as a _____ |
| 13:51 | TimMc | Someone fill in the blank, I can't come up with anything really funny. |
| 13:52 | turbofail | maltese falcon? |
| 13:53 | hiredman | ~clojurebot |
| 13:53 | clojurebot | clojurebot is a time-capsule for snark |
| 13:53 | hiredman | that'll do |
| 13:55 | amalloy | (inc clojurebot) |
| 13:55 | lazybot | ⇒ 34 |
| 13:55 | Raynes | (inc amalloybot) |
| 13:55 | lazybot | ⇒ 1 |
| 14:01 | steerio | amalloybot: what's this (inc nickname) thing? |
| 14:01 | steerio | -bot |
| 14:01 | steerio | stupid tab |
| 14:03 | seangrove | (inc amalloybot) |
| 14:03 | lazybot | ⇒ 2 |
| 14:03 | koalallama | Raynes: ran across your irclj library the other day. very nice |
| 14:04 | pdk | irclj is truly a national treasure |
| 14:08 | justin_smith | regarding erlang mentioned above, I was just looking at the version of erlang that can run directly as a VM with no OS the other day |
| 14:09 | justin_smith | I wonder how hard it would be to have a JVM that is directly hosted as a VM instance |
| 14:09 | justin_smith | (next question: would it actually be any benefit) |
| 14:10 | pdk | with a vm running on top of nothing wouldn't you have to roll your own versions of all the background services that an os would normally provide |
| 14:10 | justin_smith | if you use them, yeah |
| 14:10 | pdk | then again i guess you could just implement the parts of an os you want on top of a really simple vm |
| 14:11 | justin_smith | also you could have ie. a log server, that is a bog standard *nix box that runs rsyslog, and just send all your logs there via syslog UDP |
| 14:11 | justin_smith | it would get trickier for anything that absolutely needed to run within the same box |
| 14:16 | amalloybot | steerio: it's just this channel's quaint way of thanking someone. and the bot keeps track of how often someone's been thanked |
| 14:16 | amalloybot | regrettably, amalloybot's circuits are not advanced enough to keep track of that, so we have to use lazybot |
| 14:17 | Raynes | koalallama, pdk: Heh, happy you guys like it. <3 |
| 14:20 | amalloybot | also the network latency to amalloybot is unacceptable. sometimes it takes up to eight hours to get a response! |
| 14:21 | Raynes | Packets sent by carrier pigeon. |
| 14:21 | rasmusto | fancy merge-with: https://www.refheap.com/55878 thoughts? |
| 14:22 | rasmusto | (both on impl and utility) |
| 14:24 | amalloybot | rasmusto: the first apply-merge step seems silly |
| 14:24 | amalloybot | just use a default merge-fn of (fn [a b] b) |
| 14:24 | amalloybot | and otherwise look it up in the merge-fn-map |
| 14:25 | Raynes | There's a lot of merging happening in that code. |
| 14:25 | rasmusto | amalloybot: ah, okay. Does the list comprehension make sense? or could I do "merge-fn-map" more generically |
| 14:25 | justin_smith | amalloybot: thing is, he needs a step that merges together all the unmerged keys |
| 14:26 | justin_smith | the ones that only appear in one map I mean |
| 14:26 | arrdem | rasmusto: that's pretty slick |
| 14:26 | amalloybot | yeah, i confess it's not as easy as it first appeared to me. i was thinking you have access to the key in merge-with |
| 14:27 | rasmusto | ah, yeah. |
| 14:27 | rasmusto | would it help to dissoc the specified keys from the (apply merge maps) step? |
| 14:28 | AmnesiousFunes | rasmusto: I think you could work out a version with a more enjoyable implementation, but the functionality is very neat |
| 14:29 | rasmusto | alright. I'll tweak it to make it more readable/efficient |
| 14:29 | amalloybot | rasmusto: https://www.refheap.com/55881 is how i'd write it. yours is more readable :P |
| 14:31 | rasmusto | amalloybot: reduce works because it's assumed to go left-to-right? |
| 14:32 | amalloybot | incidentally, you don't test for what happens if a key needs to be merged that you don't specify a function for |
| 14:32 | justin_smith | amalloybot: he reduces across the function keys |
| 14:32 | amalloybot | "assumed"? reduce is defined to operate on sequences in order |
| 14:32 | justin_smith | that's what the apply merge is for |
| 14:33 | amalloybot | justin_smith: i can see his implementation. i meant his test case at the bottom |
| 14:33 | justin_smith | OK, now I get it |
| 14:35 | justin_smith | https://www.refheap.com/55883 |
| 14:36 | amalloybot | (merge x (into {} foo)) is (into x foo), by the way, rasmusto |
| 14:38 | sdegutis | amalloy is a bot now? How long was I gone!? |
| 14:39 | amalloybot | sdegutis: it was only a matter of time before my tendency to rewrite people's functions in shorter or faster ways became automated |
| 14:39 | zspencer | isn't that just clojure.core/assimilate |
| 14:39 | bbloom | amalloybot: your services are automated now!? is there a vim plugin? |
| 14:40 | sdegutis | M-x insert-emacs-joke-here |
| 14:40 | Raynes | I'll write his Vim integration. All it has to do is prompt you to install Emacs. |
| 14:40 | amalloybot | sdegutis: vim is just a very long-term emacs joke |
| 14:40 | sdegutis | Bah-dum tshh! |
| 14:40 | zspencer | because no one knows how to :q! it? |
| 14:40 | arrdem | zspencer: haha |
| 14:41 | chouser | I use evil in emacs, demonstrating that emacs is just a really complicated vim implementation. |
| 14:41 | amalloybot | zspencer: amusingly, i've bound C-x C-c to (lambda () (message "Why would you ever leave?")) |
| 14:41 | technomancy | chouser: two vim implementations, technically |
| 14:41 | amalloybot | is it only two? |
| 14:41 | technomancy | amalloybot: two built-in |
| 14:41 | amalloybot | ah |
| 14:42 | technomancy | oh my bad |
| 14:42 | technomancy | evil isn't built in |
| 14:42 | amalloybot | bbloom: you mentioned an editor |
| 14:42 | technomancy | it's two built-in IRC clients |
| 14:42 | amalloybot | this is a programming-language channel. it's inevitable |
| 14:42 | bbloom | amalloybot: i just wanted my functions to be shorter and faster :-P |
| 14:42 | chouser | viper is does not implement vim, it tries to implement vi. But nobody wants to use vi |
| 14:42 | amalloybot | *chuckle* |
| 14:42 | InvidFlower | Hey, is there anything in clojure by default to let you partial application in a way more like scala syntax where you can skip things in the partial application? Like (partial2 do-thing 1 _ 5) would return a func that applies the first argument to the second param.. and any additional ones to 4th param, etc ? |
| 14:43 | sdegutis | I was hoping to rewrite emacs in a JavaScript VM on top of ObjC the other day. Got pretty far actually. |
| 14:43 | amalloybot | InvidFlower: lambda |
| 14:43 | sdegutis | (And by "emacs" I meant a <textarea> linked to a file.) |
| 14:43 | chouser | InvidFlower: #(apply do-thing 1 % 5 %&) |
| 14:43 | amalloybot | sdegutis: ymacs? |
| 14:43 | sdegutis | I guess that's LightTable though... |
| 14:44 | amalloybot | nah, ibdknox doesn't want to implement emacs |
| 14:44 | InvidFlower | amalloybot, chouser: Yeah I was thinking of that, though I didn't realize the %& syntax.. |
| 14:44 | sdegutis | amalloybot: well, it's in the spirit of emacs |
| 14:45 | amalloybot | InvidFlower: the #() syntax is fine there, although personally i usually use a "long-form" lambda rather than %&: (fn [x & args] (apply do-thing 1 x 5 args)) |
| 14:46 | sdegutis | amalloybot: ymacs looks neat, if limited |
| 14:47 | amalloy | i'm tired of being a bot already |
| 14:47 | koalallama | you were the smartest bot I had ever seen |
| 14:47 | amalloy | vim integration sounded like too much work |
| 14:49 | InvidFlower | amalloybot: Good point. In my case I was trying to do a dynamic query to Korma which transforms (select table (fields :id :name)) to (-> (select* table) (fields :id :name)). So to pass a collection to fields it had to be something like (select table (#(fields % field-names))). I guess if I wrap "fields" in my own func or macro it'd help.. |
| 14:51 | InvidFlower | Errr… I mean (select table (#(apply fields % field-names))) |
| 15:07 | aka | is there an idiomatic way to grab a single random value from a map? |
| 15:08 | aka | I don't need truely random here... just randomish. |
| 15:09 | pyrtsa | aka: I think your best option is to keep (vec (keys m)) at hand, and call (m (rand-nth ks)) with it. |
| 15:09 | justin_smith | (rand-nth (vals {:a 0 :b 1})) |
| 15:09 | justin_smith | ,(rand-nth (vals {:a 0 :b 1})) |
| 15:09 | clojurebot | 1 |
| 15:10 | aka | thanks for the suggestion |
| 15:10 | justin_smith | of course if you knew the keys ahead of time you could do ((rand-nth ks) m) |
| 15:11 | justin_smith | but that depends on your implementation |
| 15:11 | justin_smith | well no, that only works with keyword / symbol keys, better pyrtsa's version in the case where you know the keys ahead of time |
| 15:11 | aka | I will have them ahead of time |
| 15:12 | justin_smith | yeah, (m (rand-nth ks)) in that case |
| 15:12 | justin_smith | as pyrtsa suggested |
| 15:12 | aka | sweet, thanks |
| 15:12 | justin_smith | pyrtsa: any particular reason to want ks to be a vector? |
| 15:13 | pyrtsa | One possible downside, if m is big, in (rand-nth (vals m)) is that rand-nth is O(N). That's why I had the (vec ...) in there. |
| 15:13 | justin_smith | is rand-nth faster on a vec? |
| 15:13 | pyrtsa | justin_smith: That. ^ :) |
| 15:13 | justin_smith | ahh |
| 15:15 | hyPiRion | rand-nth is constant time for vecs |
| 15:15 | justin_smith | cool, TIL |
| 15:15 | hyPiRion | afaik it uses nth to lookup |
| 15:15 | pyrtsa | hyPiRion: Exactly. |
| 15:16 | justin_smith | hmm, if only rand-nth worked on maps |
| 15:16 | justin_smith | that seems hypothetically possible - since in rand-nth it isn't the nth part we care about, it is the equal probability per element we care about |
| 15:16 | pyrtsa | justin_smith: Maps in general don't implement a mechanism for jumping to the nth element. |
| 15:16 | shep-werk | but, wouldn't converting it to a vector also be O(N)? thus you only save if you do it multiple times? |
| 15:17 | pyrtsa | shep-werk: Yes. |
| 15:18 | amalloy | justin_smith: hash maps don't really keep the information you'd need to do a uniformly-random selection, i think |
| 15:18 | justin_smith | oh, OK |
| 15:18 | pyrtsa | What amalloy said. |
| 15:18 | amalloy | the tree has N branches, each of which has M actual nodes in its subtree; you can't choose a branch at random, you have to weight them according to each M |
| 15:19 | shep-werk | well, aka did say "random-ish" and maps arent sorted... so just use `first` :-) |
| 15:19 | shep-werk | (def rand-int 4) |
| 15:19 | justin_smith | yeah, and you need a full tree walk for that, so you may as well put the vals in a vec at that point |
| 15:19 | amalloy | justin_smith: well, a hash-map *could* manage enough information so that you could do rand-nth without a tree walk |
| 15:20 | justin_smith | right, just not the current clojure default {} impl |
| 15:20 | amalloy | but that would be a lot of wasted effort for the vast majority of time when nobody wants to select at random |
| 15:22 | chouser | Now with a sorted map and a carefully constructed object passed to subseq... |
| 15:23 | Pate_ | where is .emacs on Windows? I can't find it in ~/.emacs (there is no .emacs in ~) |
| 15:23 | justin_smith | Pate_: is there a .emacs.d ? |
| 15:23 | Pate_ | justin_smith: nope :\ |
| 15:24 | justin_smith | I don't think .emacs is even considered the "right thing" any more |
| 15:24 | justin_smith | have you made any customizations? |
| 15:24 | turbofail | Pate_: if it's not there you can create it |
| 15:24 | Pate_ | could it be somewhere else? |
| 15:25 | turbofail | doubt it. it won't exist by default |
| 15:25 | turbofail | especially not on windows |
| 15:25 | justin_smith | "~/.emacs.d/init.el" is the current recommended place for config I think |
| 15:26 | hyPiRion | yeah |
| 15:27 | justin_smith | that's why I asked if you customized anything: it should prompt for creating the config file unless there is one you just don't see |
| 15:27 | Pate_ | ~ should be C:\Users\<my-user>\ on Windows, right? |
| 15:27 | clojurebot | Excuse me? |
| 15:27 | Pate_ | ~ test if cbot answers |
| 15:27 | clojurebot | Huh? |
| 15:27 | justin_smith | ~ should equal $HOME |
| 15:27 | Pate_ | hmmm |
| 15:27 | clojurebot | It's greek to me. |
| 15:27 | Pate_ | ~ google test |
| 15:27 | clojurebot | First, out of 280000000 results is: |
| 15:27 | clojurebot | Speedtest.net by Ookla - The Global Broadband Speed Test |
| 15:27 | clojurebot | http://www.speedtest.net/ |
| 15:27 | Pate_ | cool :) |
| 15:27 | justin_smith | $HOME exists on win |
| 15:28 | Pate_ | there is no $HOME, but there is $HOMEPATH, which is at /Users/myuser |
| 15:29 | justin_smith | ahh, I guess the canonical thing on win is %USERPROFILE% |
| 15:36 | Pate_ | justin_smith, I can echo $HOME and get c:/users/myuser |
| 15:37 | Pate_ | should I create a .emacs.d folder there? |
| 15:37 | justin_smith | yeah, and a file called init.el in that |
| 15:37 | justin_smith | and emacs will pick it up |
| 15:37 | justin_smith | bbl; lunch |
| 15:37 | gfredericks | why is autopromotion slower than overflow detection? |
| 15:42 | hyPiRion | gfredericks: I guess it's because there are alu flags for overflow detection? |
| 15:43 | hyPiRion | I mean, it's probably faster to do a short `jo throw_overflow_exception` in machine code |
| 16:19 | edw | My CIDER's been hanging like crazy recently while attempting complete; has anyone else been running into this? I'm getting very good at typing C-g C-g C-g. |
| 16:21 | rasmusto | amalloy: thanks |
| 16:22 | AeroNotix | edw: I occasionally do |
| 16:22 | AeroNotix | Too busy to look into ti |
| 16:22 | AeroNotix | it |
| 16:23 | edw | AeroNotix: I'd be too busy to look into it too, if it weren't hanging all the time. :P |
| 16:23 | AeroNotix | haha |
| 16:24 | technomancy | using auto-complete.el or built-in completion? |
| 16:25 | edw | Built in, though it was happening when I was using auto-complete and then disabled while troubleshooting. |
| 16:26 | edw | technomancy: The only thing remotely not default I'm doing right now is this: I was requiring nrepl-eval-sexp-fu, but I just disabled that too. |
| 16:28 | Profpatsch | So if I have a function get-token that returns a token if there is one, how would I write Cloj-onic code for the case that there is none? |
| 16:28 | Profpatsch | In Python I’d throw an exception. |
| 16:29 | Profpatsch | I could do this in Clojure, too, but there has to be a better way. |
| 16:29 | amalloy | return nil |
| 16:29 | Profpatsch | We’re back to that? |
| 16:29 | technomancy | there is a superior way, but it's not the clojure way |
| 16:29 | Profpatsch | I thought returning a null pointer was a very bad idea. |
| 16:29 | amalloy | yeah, that's about right, technomancy |
| 16:30 | Profpatsch | What would be the superior way? |
| 16:30 | amalloy | Profpatsch: you can also take the approach `get` and friends use: an optional extra argument to get-token, which is what to return if there isn't one |
| 16:31 | technomancy | Profpatsch: returning [:not-found] | [:ok value] while making the assumption the caller will be pattern matching against the return value |
| 16:31 | technomancy | or throwing an exception |
| 16:31 | shep-werk | or a Maybe ;-) |
| 16:32 | technomancy | shep-werk: ^ actually is effectively a dynamic Maybe |
| 16:32 | Profpatsch | So [:not-found] is not the Clojure way? |
| 16:33 | technomancy | Profpatsch: that approach is pretty terrible without pervasive pattern matching |
| 16:33 | shep-werk | technomancy: in that case, are you advocating something like core.match? Or somethign more manual? |
| 16:33 | chouser | Another potentially nicer way is a condition system like Common Lisp. |
| 16:33 | technomancy | shep-werk: I'm saying it's not idiomatic clojure, so I'm not advocating anything =) |
| 16:33 | shep-werk | Profpatsch: I'd expect nil, with the optional argument like `get` |
| 16:34 | technomancy | haven't used the new actually-working version of core.match yet |
| 16:34 | shep-werk | technomancy: oh, it's certainly not idiomatic, but I was hoping you'd tell me how awesome (or not) core.match was ;-) |
| 16:34 | rasmusto | technomancy: actually-working? |
| 16:35 | technomancy | shep-werk: I can strongly advise against using old versions of core.match; that's all |
| 16:35 | technomancy | rasmusto: old core.match blows up if you use it with AOT |
| 16:35 | amalloy | for an even more awful dynamic-maybe: (get-token stream (fn ([] ...no-token...) ([token] ...)) |
| 16:35 | dnolen_ | rasmusto: old versions of core.match had problems with AOT |
| 16:35 | rasmusto | dnolen_, technomancy: ah, okay :) |
| 16:36 | turbofail | hooray, manual CPS transforms |
| 16:36 | amalloy | turbofail: well, it's not really CPS because of the arity stuff |
| 16:36 | amalloy | i'd say it's more like hijacking the arity dispatcher, or like Maybe with an implicit bind |
| 16:38 | turbofail | it's basically a success and fail continuation packaged into a "single"-ish function |
| 16:38 | amalloy | yeah, i guess that's true |
| 16:40 | arrdem | oh good amalloy isn't a bot anymore |
| 16:40 | arrdem | I can still act like programming is NP-hard |
| 16:45 | stuartsierra | What's the most direct way to do truncating division of java.util.Longs? |
| 16:46 | amalloy | stuartsierra: ##(doc div), i think? |
| 16:46 | lazybot | java.lang.RuntimeException: Unable to resolve var: div in this context |
| 16:46 | rasmusto | amalloy: oh, your code makes perfect sense, and is faster. Thanks for giving me more use-cases for reduce :) |
| 16:46 | amalloy | &(doc quot) |
| 16:46 | lazybot | ⇒ "([num div]); quot[ient] of dividing numerator by denominator." |
| 16:46 | amalloy | or do you mean in java-land |
| 16:47 | rasmusto | amalloy: the double-reduce is a bit strange at first, but it makes sense since its a coll of maps we're dealing with |
| 16:48 | stuartsierra | div makes sense, thanks amalloy |
| 16:48 | amalloy | stuartsierra: it's actually quot, i was wrong |
| 16:48 | stuartsierra | ah |
| 16:49 | amalloy | $findfn 10 4 2 |
| 16:49 | lazybot | [clojure.core/rem clojure.core/unchecked-remainder-int clojure.core/quot clojure.core/unchecked-divide-int clojure.core/mod] |
| 16:49 | amalloy | oh, of course mod shows up in that list too :P |
| 16:54 | dbasch | what's the right way to validate from input in a compojure app (e.g. emails, numbers)? |
| 16:54 | dbasch | or at least, the easiest way besides doing it myself with regexes |
| 16:55 | justin_smith | The only way to reliable and simple way to validate an email is to send an email. The email spec is weird. |
| 16:55 | justin_smith | OT I know, just saying |
| 16:55 | amalloy | justin_smith: that's true, and i almost said it myself, but that doesn't mean it's wrong to want to validate them anyway |
| 16:55 | amalloy | you can easily say "that can't possibly be a valid email address because it has no @, please check it" |
| 16:56 | amalloy | once all the idiot-tests have passed, you validate it for real |
| 16:56 | pyrtsa | Also, there are client-side JS libraries that let you warn the user of probable typos in email addresses, even suggest corrections. |
| 16:59 | justin_smith | "very.unusual.@.unusual.com"@example.com http://en.wikipedia.org/wiki/Email_address#Examples |
| 17:01 | Pate_ | I'm trying to follow this tut: http://clojure-doc.org/articles/tutorials/emacs.html |
| 17:02 | Pate_ | but I'm stuck at the "Configuring Emacs" step |
| 17:02 | seangrove | What's the clojure metrics plugin? |
| 17:02 | seangrove | I'd like to see LoC, etc. |
| 17:02 | Pate_ | I found the .emacs.d folder: C:\Users\myuser\AppData\Roaming\.emacs.d\ |
| 17:02 | justin_smith | Pate_: have you created init.el? |
| 17:03 | Pate_ | yes, I can put stuff in init.el |
| 17:03 | Pate_ | and it seems to run |
| 17:03 | Pate_ | now, in the tut it says to put (require 'package) ... |
| 17:03 | Pate_ | that works |
| 17:03 | justin_smith | OK |
| 17:03 | justin_smith | now you can use package to install stuff |
| 17:03 | Pate_ | then it says to put: (defvar my-packages '(starter-kit... |
| 17:03 | Pate_ | should I replace the previous content or append it to init.el? |
| 17:03 | Pate_ | I tried both |
| 17:03 | justin_smith | append |
| 17:04 | Pate_ | if I append, Emacs starts up blank |
| 17:04 | justin_smith | that stuff won't work without package required |
| 17:04 | justin_smith | you may need to wait for it to finish installing things |
| 17:04 | Pate_ | ah, so no loading indicator? |
| 17:04 | justin_smith | that will take a few, it is downloading stuff etc. |
| 17:04 | myguidingstar | hi all, I have a corelogic question |
| 17:04 | justin_smith | Pate_: not sure, I have not installed things that way, but I would not be surprised if there was no indicator |
| 17:05 | justin_smith | you could check the process manager, emacs should be using the network and using some CPU and using the HD |
| 17:05 | myguidingstar | ;"reverse" in the Reasoned Sch; 3.98 |
| 17:05 | myguidingstar | (define memberrevo |
| 17:05 | myguidingstar | (lambda (x l) |
| 17:05 | myguidingstar | (conde |
| 17:05 | myguidingstar | ((nullo l) fail) |
| 17:05 | myguidingstar | (succeed |
| 17:05 | myguidingstar | (fresh (d) |
| 17:05 | myguidingstar | (cdro l d) |
| 17:05 | myguidingstar | (memberrevo x d))) |
| 17:05 | myguidingstar | (else (eq-caro l x))))) |
| 17:05 | amalloy | ~refheap |
| 17:05 | clojurebot | https://www.refheap.com/ |
| 17:05 | myguidingstar | (test-check "3.100" |
| 17:05 | myguidingstar | (run* (x) |
| 17:05 | myguidingstar | (memberrevo x `(pasta e fagioli))) |
| 17:05 | myguidingstar | `(fagioli e pasta)) |
| 17:05 | Pate_ | ok so it finally started to respond |
| 17:06 | Pate_ | it seemed to be eating WM_MESSAGE |
| 17:06 | alew | myguidingstar: please don't paste code into irc |
| 17:06 | myguidingstar | alew, I'm sorry |
| 17:06 | technomancy | it's still recommending the starter kit? =/ |
| 17:06 | alew | as amalloy suggested, use ~refheap |
| 17:06 | technomancy | should drum up a pull request |
| 17:06 | alew | ~refheap |
| 17:06 | clojurebot | https://www.refheap.com/ |
| 17:06 | Pate_ | emacs is complaining about args out of range |
| 17:06 | Pate_ | can't select the text to paste |
| 17:07 | Pate_ | how do I switch to the bottom window? |
| 17:07 | amalloy | Pate_: C-x b *Messages* |
| 17:09 | myguidingstar | I tried to "translate" the memberrevo function in The Reasoned Schemer 3.98 |
| 17:09 | myguidingstar | https://www.refheap.com/55936 |
| 17:09 | myguidingstar | but it doesn't work |
| 17:12 | Profpatsch | Anyone knows what steps I need to take when changing my ns in Clojurescript (in Lighttable)? I can’t reevaluate it, so what do I have to reset minimum to get the imported stuff to work? |
| 17:12 | dnolen_ | myguidingstar: what result do you get? |
| 17:12 | justin_smith | Profpatsch: maybe use in-ns? |
| 17:12 | myguidingstar | well, the original list was returned |
| 17:13 | Profpatsch | justin_smith: Nah, when re-evaling in Lighttable from my code. I’m not in a repl. |
| 17:14 | technomancy | the heck |
| 17:14 | technomancy | the clojure doc guide doesn't even mention paredit |
| 17:15 | RickInAtlanta | myguidingstar: where you have (firsto l x) I have eq-caro |
| 17:15 | RickInAtlanta | oh,which is just firsto, nm |
| 17:16 | dnolen_ | myguidingstar: hmm, I don't have an old version of miniKanren to verify the original behavior. |
| 17:16 | myguidingstar | dnolen_, okay, so is there any way to do 'reverse' in core logic? |
| 17:17 | RickInAtlanta | is it because conde in core.logic is actualy condi in minikanren? |
| 17:17 | dnolen_ | myguidingstar: what I'm saying is I'm not even convinced that will work, core.logic is based on a newer version of mK |
| 17:18 | myguidingstar | dnolen_, I got it. I just ask 'how do we do that with core.logic?' |
| 17:18 | dnolen_ | myguidingstar: also reading it, it doesn't appear to me that the original does what you think it does |
| 17:19 | dnolen_ | myguidingstar: but again hard for me to confirm |
| 17:20 | myguidingstar | dnolen_, ok, forget that book. Please help me with my latest question: how do we do that? |
| 17:21 | dnolen_ | myguidingstar: https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/bench.clj#L42 |
| 17:23 | myguidingstar | dnolen_, thanks a lot. You're my hero ;> |
| 18:05 | justin_smith | (str str str) |
| 18:05 | justin_smith | ,(str str str) |
| 18:05 | clojurebot | "clojure.core$str@f4b5c1clojure.core$str@f4b5c1" |
| 18:06 | technomancy | buffalo buffalo buffalo |
| 18:06 | justin_smith | ,(vector vector vector) |
| 18:06 | clojurebot | [#<core$vector clojure.core$vector@81d1ed> #<core$vector clojure.core$vector@81d1ed>] |
| 18:06 | AeroNotix | ,(partial partial partial) |
| 18:06 | clojurebot | #<core$partial$fn__4196 clojure.core$partial$fn__4196@f300fa> |
| 18:06 | justin_smith | nice |
| 18:07 | justin_smith | ,(juxt juxt juxt) |
| 18:07 | clojurebot | #<core$juxt$fn__4179 clojure.core$juxt$fn__4179@12dea42> |
| 18:07 | justin_smith | now to find a context where (juxt juxt juxt) would be in some way useful |
| 18:10 | technomancy | juxt praemium suum est |
| 18:11 | technomancy | much like TCO |
| 18:11 | justin_smith | indeed |
| 18:14 | rasmusto | ,((apply juxt [:a :b :c :d]) {:a 1 :b 2 :c 3 :d 4}) ; am I doing it right? |
| 18:14 | clojurebot | [1 2 3 4] |
| 18:14 | atyz | Could someone tell me how I might find the fully qualified path for a function? |
| 18:15 | amalloy | &(map {:a 1 :b 2 :c 3 :d 4} [:a :b :c :d]) |
| 18:15 | lazybot | ⇒ (1 2 3 4) |
| 18:15 | bbloom | atyz: functions don't have fully qualified paths |
| 18:15 | technomancy | atyz: you need a var for that |
| 18:15 | rasmusto | ,((apply juxt [:a :b :c :d #(get % :e :baz)]) {:a 1 :b 2 :c 3 :d 4}) ; am I doing it right? |
| 18:15 | clojurebot | [1 2 3 4 :baz] |
| 18:16 | atyz | Thanks! |
| 18:16 | redx543 | Is it possible to remove nils from a vector of vectors, for example [nil nil [1 5] nil nil [3 8] nil nil]? |
| 18:17 | amalloy | redx543: sure, i mean, there's ##(doc remove) |
| 18:17 | lazybot | ⇒ "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns false. pred must be free of side-effects." |
| 18:17 | rasmusto | redx543: you almost have it typed out in pseudocode already |
| 18:17 | redx543 | I already tried that but for some reason it flattens the vector. |
| 18:17 | amalloy | but also consider why you've generated such a weird vector to begin with - there's usually a better way that doesn't involve generating something weird and then fixing it |
| 18:17 | S11001001 | redx543: don't use for |
| 18:18 | redx543 | Wait, is for the reason for generating nils inside of the vector? |
| 18:18 | amalloy | don't use for??? what is the context for this that i'm missing? |
| 18:18 | justin_smith | S11001001 parsed a sentence oddly |
| 18:19 | redx543 | I don't know, but it's true that I'm generating this in a for loop. |
| 18:19 | amalloy | oh, i see |
| 18:19 | rasmusto | ,(for [a [nil [1 2] nil [3 4]] b a] [a b]) |
| 18:19 | clojurebot | ([[1 2] 1] [[1 2] 2] [[3 4] 3] [[3 4] 4]) |
| 18:19 | amalloy | redx543: why don't you paste your code on refheap or gist? i'm sure someone will see the right way to do it |
| 18:19 | rasmusto | is that what we're talking about? |
| 18:20 | amalloy | rasmusto: no, i think you're three levels deep into a nested misunderstanding |
| 18:20 | amalloy | everyone abort |
| 18:20 | rasmusto | ,for |
| 18:20 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/for, compiling:(NO_SOURCE_PATH:0:0)> |
| 18:20 | turbofail | everyone out of the universe! |
| 18:22 | S11001001 | it's *cosmos* these days. |
| 18:27 | justin_smith | ~for |
| 18:27 | clojurebot | for is complected |
| 18:28 | justin_smith | ~for |
| 18:28 | clojurebot | for is complected |
| 18:28 | rasmusto | i've seen this a few times ##(#(for [a %] a) [1 2 3]) |
| 18:28 | lazybot | ⇒ (1 2 3) |
| 18:30 | justin_smith | it's less characters than #(map identity %) I guess |
| 18:30 | justin_smith | but more than seq |
| 18:30 | rasmusto | well, I just pasted the simplest version of it |
| 18:30 | justin_smith | ahh, right |
| 18:30 | rasmusto | its better than trying to do everything complex using thread-last |
| 18:40 | technomancy | is "thread-last" the canonical pronounciation? |
| 18:40 | amalloy | technomancy: that's my understanding, yes |
| 18:40 | rasmusto | I saw it written somewhere, I just say ->> |
| 18:40 | amalloy | i say "double-arrow", but i don't mind being wrong |
| 18:40 | technomancy | I call -> "thrush" in my head |
| 18:40 | amalloy | rasmusto: out loud? i'd loev to hear that |
| 18:40 | amalloy | technomancy: :(((( |
| 18:40 | technomancy | I guess I call ->> "thrushush" |
| 18:41 | AeroNotix | thread and thread-last here |
| 18:41 | rasmusto | hyphengreaterthangreaterthan |
| 18:44 | amalloy | technomancy: i don't understand the popularity of the name thrush for that operator. it does things that don't make sense from the combinatorial-bird perspective |
| 18:45 | SegFaultAX | (inc amalloy) |
| 18:45 | lazybot | ⇒ 89 |
| 18:45 | technomancy | amalloy: it seems like a natural extension when you move from SKI->lisp though |
| 18:45 | technomancy | I don't call it a combinator, because that's silly |
| 18:45 | SegFaultAX | Didn't fogus do a blog post about the thrush operator? |
| 18:45 | amalloy | yes, i'm inclined to mostly blame him for the popularity, SegFaultAX |
| 18:46 | amalloy | it doesn't even take functions |
| 18:46 | technomancy | thread-first is to lisp forms as the thrush combinator is to SKI |
| 18:47 | technomancy | fogus's post was pretty explicit about -> not being the thrush combinator |
| 18:48 | technomancy | which doesn't imply that -> does not partake in the nature of thrushiness |
| 18:50 | amalloy | you're right, i'm definitely wrong in saying the name popularity came from fogus |
| 18:50 | danielszmulewicz | seangrove: ping |
| 18:53 | dsrx | will company-cider use the complete op from the cider-nrepl middlewares if it's available? |
| 18:53 | danielszmulewicz | amalloy: there is an explanation of the name here referencing the combinator: http://debasishg.blogspot.co.il/2010/04/thrush-in-clojure.html I don't know if it makes a lot of sense. |
| 19:03 | RickInAtlanta | I used the mies-om template to create a project, but when I try to evaluate my ns I get "no such var clojure.core/require-macros when I make my ns (:require-macros [cljs.core.async.macros :refer [go]]) |
| 19:04 | RickInAtlanta | (ns om-test.core |
| 19:04 | RickInAtlanta | (:require-macros [cljs.core.async.macros :refer [go]]) |
| 19:04 | RickInAtlanta | (:require [om.core :as om :include-macros true] |
| 19:04 | RickInAtlanta | [om.dom :as dom :include-macros true])) |
| 19:04 | dsrx | RickInAtlanta: refheap.com |
| 19:05 | RickInAtlanta | https://www.refheap.com/56131 |
| 19:05 | Anderkent | RickInAtlanta: are you running it as clojure or cljs? |
| 19:05 | RickInAtlanta | I am trying to run as cljs |
| 19:08 | SegFaultAX | amalloy: Sorry, I wasn't clear. I meant fogus wrote a blog post about the actual thrush operator vs. the threading macros in Clojure. |
| 19:09 | RickInAtlanta | weird,I try it in LightTable I get 'goog' is not defined |
| 19:11 | yarou | which one is thrush? something like: \ab -> ba |
| 19:11 | technomancy | yarou: that's S, I think |
| 19:12 | danielszmulewicz | Anyone has opinions about CSS frameworks? I'm starting a new cljs project, and I'm not set in my mind regarding which framework to use. I've worked with bootstrap, but I'm inclined to experiment with a more semantic framework (no classes littering the html). Would love to hear from anyone with experience in that matter. |
| 19:13 | yarou | hmm, it might be |
| 19:13 | yarou | i read raganwald's javascript book a while ago, so i dont remember the combinators too much |
| 19:13 | rasmusto | ~thrush |
| 19:13 | clojurebot | I don't understand. |
| 19:14 | justin_smith | danielszmulewicz: sass is popular around here |
| 19:14 | justin_smith | http://sass-lang.com/ |
| 19:14 | yarou | ah, i see |
| 19:14 | yarou | -< |
| 19:14 | rasmusto | I always thought that (-> blah (#(something %))) felt weird |
| 19:14 | yarou | -> |
| 19:15 | stcredzero | Any good Clojure web application examples with database backend and authentication...that actually work? http://vijaykiran.com/2012/01/web-application-development-with-clojure-part-1/ and https://github.com/xavi/noir-auth-app seem subject to bit-rot. |
| 19:15 | amalloy | rasmusto: that's because it's bad |
| 19:15 | amalloy | like, sometimes it's the least-bad alternative |
| 19:16 | yarou | lambda a, b: b(a) is that thrush??? in python ofc |
| 19:16 | rasmusto | yarou: don't think so |
| 19:16 | amalloy | but usually you can structure things so that -> or ->> makes sense, and if you can't then it's often more readable to not use them |
| 19:17 | yarou | ok, how about this |
| 19:17 | amalloy | i think those are both thrush, yarou. (defn thrush [a b] (b a)) |
| 19:18 | yarou | a function that takes (possibly) functions a and b as parameters, and returns b applied to a |
| 19:18 | yarou | amalloy: gotcha |
| 19:20 | rasmusto | ,(reduce #(%2 %1) [(range 10) #(map inc %) reverse]) |
| 19:20 | clojurebot | (10 9 8 7 6 ...) |
| 19:22 | danielszmulewicz | justin_smith: thanks. SASS is a CSS extension language. I'm wondering about frameworks to quickly iterate on the design. I need a grid system, UI components, responsiveness, etc. |
| 19:26 | SegFaultAX | danielszmulewicz: The common choices right now are bootstrap and foundation. |
| 19:26 | SegFaultAX | I prefer the latter but lots and /lots/ of people use bootstrap. |
| 19:26 | SegFaultAX | Also, wrapbootstrap.com is a thing. |
| 19:27 | seangrove | danielszmulewicz: SASS on top of bootstrap is what you're looking for, most likely |
| 19:27 | SegFaultAX | seangrove: Not likely |
| 19:27 | SegFaultAX | Bootstrap is LESS |
| 19:27 | SegFaultAX | Foundation is SASS |
| 19:27 | seangrove | SegFaultAX: Yes, yes, but that idea |
| 19:27 | SegFaultAX | Unless you're just using .min.css straight up, in which case use whichever you like more. |
| 19:27 | SegFaultAX | :) |
| 19:27 | yarou | bootstrap is the devil |
| 19:28 | yarou | one can only hope we can find god |
| 19:28 | SegFaultAX | yarou: Why? |
| 19:28 | danielszmulewicz | yarou: That's what I had in mind :-) |
| 19:28 | seangrove | Looks like there's a sass-port of bootstrap |
| 19:28 | SegFaultAX | danielszmulewicz: Then check out Zurb Foundation. |
| 19:28 | seangrove | I'm an atheist, I actively try avoiding religious associations with tech :P |
| 19:28 | zspencer | I'm a fan of suzy: http://susy.oddbird.net/ |
| 19:28 | zspencer | susy( |
| 19:28 | zspencer | susy* |
| 19:28 | danielszmulewicz | The problem of bootstrap is that it breaks the semantic coherence of html by its heavy (mi)suse of classes |
| 19:29 | danielszmulewicz | there's semantic ui. Anyone tried it? |
| 19:29 | yarou | seangrove: i am an atheist too |
| 19:30 | yarou | but literary characters are attached to some sentiment or philosophy |
| 19:30 | seangrove | yarou: Just a joke ;) |
| 19:30 | SegFaultAX | Assuming atheism is defined as lack of belief in god or gods, how can one /be/ atheist. |
| 19:30 | danielszmulewicz | zspencer: thanks. I had heard about it. |
| 19:30 | zspencer | danielszmulewicz: if you're obsessive about keeping the classes as less mixins it works reasonably ok |
| 19:30 | SegFaultAX | Atheism is the default position. |
| 19:30 | yarou | geocities |
| 19:30 | yarou | is our savior |
| 19:30 | stcredzero | seangrove: We could highlight similarities to religious dogma and other pathologies in tech and programming language communities, but some fraction of the audience will end up thinking "Hey, that's COOL!" and get the opposite message. |
| 19:30 | seangrove | danielszmulewicz: The whole idea with with SASS + bootstrap is that you have semantic classes in the markup, but they're compiled from the presentational classes |
| 19:31 | Cr8 | SegFaultAX: by fitting that definition, I guess? |
| 19:31 | SegFaultAX | Cr8: What other definition could there be? |
| 19:31 | yarou | has anyone used luminous or w/e in production ? |
| 19:31 | seangrove | stcredzero: One must be careful with sarcasm, heh |
| 19:31 | yarou | i'm contemplating porting my rails app to this |
| 19:31 | Cr8 | of that word? none, but one could *not* fit the definition, and then they wouldn't be |
| 19:31 | SegFaultAX | Cr8: "There are no gods" is a belief, but /a/theism literally means not theist, as in not someone who subscribes to a theological worldview. |
| 19:32 | seangrove | yarou: Certainly could do worse than that |
| 19:32 | stcredzero | "Animal House" was a cautionary parody which spawned endless clueless imitators. (Me in my late teens being one of them, admittedly) |
| 19:32 | danielszmulewicz | seangrove: BTW, have you had time to look into the externs for om (ReactCSSTransitionGroup)? |
| 19:33 | Cr8 | that's a thing you could argue, but I feel it's being a bit pendantic ;) |
| 19:33 | rasmusto | is pedantic a css framework? |
| 19:33 | seangrove | danielszmulewicz: I did, but it turned out to be a very, very involved process. I'm going to meet up with some of the React team and see if there's anything that can be done about moving them over to using Closure (perhaps even on top of browserify). |
| 19:33 | seangrove | danielszmulewicz: Have you tried just using auto-generated externs? |
| 19:34 | seangrove | That was going to be my next attempt |
| 19:34 | danielszmulewicz | seangrove: Awesome news. No, I've been stalling. |
| 19:34 | Cr8 | and then there are noncognitivists, who hold the position that "there are(n't) gods" isn't a belief |
| 19:35 | justin_smith | and ignosticism, which contends "is there a God" is an underdefined, and nonsensical question |
| 19:36 | SegFaultAX | Cr8: Which makes no sense, since "there are(n't)..." is a claim which must be substantiated with evidence. |
| 19:36 | SegFaultAX | (Irrespective of the claim) |
| 19:36 | Cr8 | well the position is the stuff after the "..." is not defined in any useful sense |
| 19:36 | Cr8 | same as ignosticisim |
| 19:37 | Cr8 | so it's useless to make the statement |
| 19:37 | tlbakh | is there anyone that i can ask a question about clojure ? |
| 19:37 | SegFaultAX | tlbakh: Ignore us, carry on. :) |
| 19:37 | Cr8 | tlbakh: yes |
| 19:37 | zspencer | Only if your say 10 hail-hickey's first. |
| 19:38 | SegFaultAX | Haha, hail hickeys. |
| 19:38 | SegFaultAX | "Our father, who art in bytecode, Clojure be thy name..." |
| 19:38 | tlbakh | started yesterday to code in clj. The thing is I tried to increment every element of a list by 1 by using map. |
| 19:39 | tlbakh | and i wrote a main for it as follows |
| 19:39 | SegFaultAX | tlbakh: Wait |
| 19:39 | SegFaultAX | tlbakh: Don't paste code longer than one line to the chat. |
| 19:39 | SegFaultAX | tlbakh: refheap.com or gist. |
| 19:39 | tlbakh | i was gonna post gist page |
| 19:39 | tlbakh | oh oke then :) |
| 19:39 | SegFaultAX | Great! :) |
| 19:41 | tlbakh | https://gist.github.com/wishfulpanda/9476787 |
| 19:41 | tlbakh | here is the link |
| 19:41 | tlbakh | and i commented it |
| 19:41 | tlbakh | why are these giving different outputs |
| 19:41 | tlbakh | is there any relevance with immutable collections? |
| 19:42 | akhudek | tlbakh, because everything is immutable in clojure |
| 19:42 | SegFaultAX | tlbakh: def is a top-level form. Use let to introduce local bindings. |
| 19:42 | justin_smith | tlbakh: inc does not change its argument |
| 19:42 | zspencer | when you call `def` you're declaring a n immutable list |
| 19:42 | SegFaultAX | ,(let [x 5] (prn x)) |
| 19:42 | zspencer | print x then just reprints the list |
| 19:42 | clojurebot | 5\n |
| 19:42 | akhudek | so x is always going to be same, but the map returns a value (that you are not capturing) that represents what you want |
| 19:43 | justin_smith | s/inc/#(+ % 1) |
| 19:43 | zspencer | Also, let is the preferred nomenclature for declaring locally scoped variables, from what I understand |
| 19:43 | tlbakh | im kinda confused right now but thank you so much |
| 19:44 | zspencer | Is there a language you're more familiar with I could write an alternate gist for? |
| 19:44 | tlbakh | def is not used for what my purpose as far as i understand |
| 19:44 | tlbakh | java c++ python |
| 19:44 | tlbakh | im just a newbie for fp |
| 19:45 | zspencer | Me too :). Let me take a stab at this in python and link you to it |
| 19:45 | zspencer | I'm not a python guru though |
| 19:45 | justin_smith | def always adds a binding to a namespace, so using it inside a function is usually wrong |
| 19:45 | justin_smith | it does not create any function-local binding |
| 19:45 | tlbakh | that makes sens |
| 19:45 | tlbakh | sense* |
| 19:45 | tlbakh | thank you |
| 19:45 | SegFaultAX | tlbakh: Think of it like this: l = [1,2,3]; [n + 1 for n in l] |
| 19:45 | tlbakh | zspencer, thank you really appreciated |
| 19:46 | SegFaultAX | tlbakh: There is no reason that would modify the original value. |
| 19:46 | SegFaultAX | It just produces a new list. |
| 19:46 | tlbakh | SegFaultAX, what if i call it with let? |
| 19:47 | SegFaultAX | ,(let [n [1 2 3] n (map inc n)] n) |
| 19:47 | clojurebot | (2 3 4) |
| 19:47 | SegFaultAX | tlbakh: Let is recursive. |
| 19:47 | justin_smith | you can capture the binding with let |
| 19:47 | SegFaultAX | (In other words you can access previous bindings in the same let form) |
| 19:47 | SegFaultAX | Or even re-bind them, as above. |
| 19:48 | SegFaultAX | tlbakh: Mind you def and let really have nothing to do with eachother. |
| 19:49 | SegFaultAX | let introduces a local name for a value, def creates a var in the top-level of the current namespace. |
| 19:49 | justin_smith | the commonality is they create bindings from symbols in the code to values |
| 19:49 | tlbakh | oke so let is the right way to local binding |
| 19:49 | tlbakh | i get it |
| 19:49 | nightfly | yes |
| 19:52 | tlbakh | now i got it worked =) |
| 19:52 | tlbakh | thank you guys |
| 19:53 | tlbakh | from the point i stand, i have to learn a lot of stuff. whats the best road map that i should follow? any recommendations? |
| 19:53 | zspencer | tlbakh: https://gist.github.com/zspencer/9476808 |
| 19:53 | justin_smith | clojure koans and 4clojure are helpful (but not sufficient) |
| 19:54 | tlbakh | im working on 4clojure , its helpful but not enough for a noob |
| 19:54 | justin_smith | http://clojure.org/cheatsheet is good to refer to (even though it points to out of date docs, the functions are still useful in newer versions) |
| 19:54 | zspencer | Yea, 4clojure was too hard for me :/ |
| 19:55 | SegFaultAX | zspencer: Ehhh, map really isn't idiomatic Python so it's probably less useful in examples. Pythonistas tend to prefer comprehensions. |
| 19:55 | zspencer | I get to pair everyday with clojure programmers, so that was nice |
| 19:55 | zspencer | yea, the idiomatic is more clojure centered :) I don't know python well |
| 19:55 | SegFaultAX | zspencer: [x + 1 for x in [1,2,3]] |
| 19:57 | rasmusto | ,(reduce #(%2 %1) [[1 2 3] inc]) |
| 19:57 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number> |
| 19:58 | rasmusto | ,(reduce #(%2 %1) [[1 2 3] #(map inc %)]) ; my bad |
| 19:58 | clojurebot | (2 3 4) |
| 19:58 | zspencer | SegFaultAX: list comprehensions don't seem to mutate state |
| 19:58 | SegFaultAX | zspencer: They don't, that's the point. |
| 19:58 | SegFaultAX | And neither should map. |
| 19:58 | zspencer | Concur |
| 20:01 | zoldar | I'm playing around with core.async and I wanted to make a channel through which I could send messages to multiple receivers (every message is directed at a particular receiver). I've come up with this: https://www.refheap.com/56170 - is that the right way to accomplish this? |
| 20:01 | turbofail | don't mutate? lulz. a = [lambda: x for x in range(10)]; a[0]() => 9 |
| 20:02 | turbofail | at least in python 2.7.3 |
| 20:02 | zspencer | Lammmbbbdddaaaaaaaaassssss |
| 20:03 | SegFaultAX | turbofail: That isn't mutation, that's a capturing problem. |
| 20:03 | amalloy | yeah, exactly. java "solves" that problem by making you promise not to change x before it lets you close over it |
| 20:03 | SegFaultAX | Yup, finals all the way down. |
| 20:03 | turbofail | well because of its capturing problem it mutates |
| 20:04 | SegFaultAX | turbofail: Impure, sure. But mutating? |
| 20:04 | turbofail | how is that not mutating? |
| 20:05 | turbofail | it's mutating x |
| 20:05 | turbofail | it has the exact same symptoms that altering a mutable data structure would |
| 20:05 | SegFaultAX | turbofail: Because the mutation is not a side effect of the lambda itself. |
| 20:05 | rasmusto | ,(let [a 4 a 5] a) ; is mutating? |
| 20:05 | clojurebot | 5 |
| 20:06 | SegFaultAX | The mutation is external to the lambda. |
| 20:06 | turbofail | sure, the list comprehension is mutating state, not the lambda |
| 20:06 | SegFaultAX | Which is what amalloy was saying: you have to promise to java this reference you gave it won't mutate before you can close over it. |
| 20:06 | SegFaultAX | turbofail: I didn't say you couldn't mutate state with listcomps or map, just that you shouldn't. |
| 20:07 | SegFaultAX | turbofail: Nothing it stopping you from using impure functions (in Python or Clojure), but why would you want to? |
| 20:07 | turbofail | all i'm saying is that something that looks like it should be pure isn't |
| 20:08 | dsrx | what's that, a list comprehension can't mutate state? |
| 20:08 | SegFaultAX | dsrx: s/can't/shouldn't/ |
| 20:08 | dsrx | :p |
| 20:08 | turbofail | well specifically you said they "don't" mutate state |
| 20:08 | turbofail | and it looks like they don't, until they do |
| 20:10 | SegFaultAX | turbofail: Fair enough. But then Python is almost entirely imperative. |
| 20:10 | SegFaultAX | turbofail: But "don't capture loop state" is a pretty common thing in lots of languages. |
| 20:11 | gfredericks | would it be haxy to make a (def-record-ns IFoo IBar) that implements all the protocols by calling identically named functions in the namespace? |
| 20:11 | gfredericks | to avoid doing all the code inlined in a defrecord form |
| 20:12 | turbofail | SegFaultAX: sure. but list comprehensions look like they're functional, which is why i find that particularly egregious |
| 20:14 | SegFaultAX | turbofail: Yea :(. I have fallen entirely out of love with Python, even though I write it everyday (professionally) |
| 20:14 | amalloy | gfredericks: that would probably be okay, although it doesn't sound *super* easy - you have to inspect the protocols (or interfaces!) to figure out what method bodies to emit |
| 20:23 | mr-foobar | In om, what's the best place to put ajax call for initial data of a component ? |
| 20:31 | zoldar | mr-foobar: IWillMount / will-mount , probably |
| 20:33 | gfredericks | amalloy: right |
| 20:36 | mr-foobar | zoldar: I can fire the ajax in IWillMount, but how do I check if the ajax call has returned ? |
| 20:37 | seangrove | mr-foobar: You can use a core.async channel for it |
| 20:38 | mr-foobar | seangrove: I want to render the component with the data. Without the data, I'd like to show zilch. |
| 20:39 | seangrove | mr-foobar: (will-mount [_] (let [finish-ch (chan)] (ajax-call ... finish-ch) (go (let [res (<! finish-ch)] (om/set-state! owner :result red)))))...(render [_] (when-let [res (om/get-state owner :result)] (dom/div ...))) |
| 20:40 | seangrove | Amongst another dozen ways, I sure. That's a QND way though |
| 20:41 | seangrove | I would do the ajax calls elsewhere, but if you have to do it in the component, then there you go |
| 20:41 | mr-foobar | seangrove: sounds right. thx ! |
| 20:51 | danielszmulewicz | gf3: ping |
| 20:51 | gf3 | holla |
| 20:52 | danielszmulewicz | gf3: Hi, I was looking for any-matches? in secretary but couldn't find it anymore... |
| 20:52 | gf3 | danielszmulewicz: It's all been changed |
| 20:52 | danielszmulewicz | gf3: :-) |
| 20:52 | gf3 | danielszmulewicz: The new secretary is much more powerful and robust |
| 20:52 | gf3 | Mostly thanks to noprompt |
| 20:52 | danielszmulewicz | gf3: that's nice to hear |
| 20:53 | danielszmulewicz | gf3: how do I acheive any-matches? though? |
| 20:53 | gf3 | danielszmulewicz: You should be able to use `locate-route` |
| 20:53 | gf3 | danielszmulewicz: https://github.com/gf3/secretary/blob/master/src/secretary/core.cljs#L181-L186 |
| 20:53 | danielszmulewicz | gf3: ah so that's what I'm looking for. Thanks a bunch. |
| 20:54 | gf3 | oops, it's not exported though |
| 20:54 | danielszmulewicz | gf3: private function :-) |
| 20:54 | gf3 | danielszmulewicz: We can see about opening it up, though |
| 20:54 | gf3 | danielszmulewicz: What's the use-case, if you don't mind me asking? |
| 20:56 | danielszmulewicz | gf3: sure, I have a go loop that listens for uris. If it's a real URI, fetch it with XHR, if it's a route, dispatch with secretary. That's my use case. You got a solution. |
| 20:56 | danielszmulewicz | ? |
| 20:58 | danielszmulewicz | gf3: https://www.refheap.com/56178 |
| 20:58 | gf3 | danielszmulewicz: Ahh cool |
| 20:59 | gf3 | danielszmulewicz: This might even be a good use-case for this → https://github.com/gf3/secretary/issues/21 |
| 21:00 | stcredzero | Is clojure.java.jdbc db-do-commands vulnerable to SQL injection? |
| 21:00 | danielszmulewicz | gf3: Yes, but the API should have a simple boolean check for routes if you don't mind my opinion :-) |
| 21:01 | gf3 | danielszmulewicz: I agree |
| 21:01 | danielszmulewicz | gf3: cool. |
| 21:01 | gf3 | danielszmulewicz: For now it should be possible to simulate `locate-routes` as the route atom is accessible → https://github.com/gf3/secretary/blob/master/src/secretary/core.cljs#L158-L159 |
| 21:02 | gf3 | danielszmulewicz: Can you open an issue to make that fn public, and I'll triage it? |
| 21:02 | danielszmulewicz | gf3: sure |
| 21:02 | danielszmulewicz | gf3: thanks. |
| 21:03 | gf3 | danielszmulewicz: No, thank you! |
| 21:15 | seangrove | $seen noprompt |
| 21:15 | lazybot | noprompt was last seen quitting 7 hours and 38 minutes ago. |
| 21:35 | gfredericks | what causes clojure.repl to be use'd when I run `lein repl`? |
| 21:55 | akurilin2 | So I'm looking at http kit here trying to figure out the idea behind async http connections. Why do I want that? |
| 21:56 | akurilin2 | Is the idea that I'm not keeping a connection open while handling the request? |
| 21:56 | noonian | akurilin2: you are keeping a connection open in the case of something like a websocket, but you don't have to have 1 thread per connection is the idea |
| 21:57 | akurilin2 | So the difference is that you're not having a 1 to 1 thread to connection mapping? |
| 21:57 | noonian | you can serve multiple long running connections from a single thread |
| 21:57 | noonian | right |
| 21:57 | akurilin2 | Does jetty do thread pooling of any sort? |
| 21:58 | akurilin2 | I've been oblivious to this eveer since I started using it. |
| 21:59 | akurilin2 | Not sure if there's a thread pool, but there's a default cap of 50 threads per ring app if you use the adapter |
| 21:59 | noonian | it uses a thread pool i think, so whenever a connection it comes in it grabs a thread to handle it from the thread pool |
| 22:03 | mlb- | How popular is the clojure library incanter? |
| 22:03 | mlb- | I'm playing about with R, but it's been a while and it seems most things with R have moved to ggplot2 |
| 22:04 | akhudek | mlb-: R has a huge ecosystem and plotting is only a small part of it |
| 22:05 | noonian | but if you want something like R thats Clojure, you'd use incanter |
| 22:07 | mlb- | akhudek: R's huge ecosystem is somewhat part of the issue for me ;] It's hard to identify what parts of said ecosystem are still maintained and are compatible. The situation gives me perl-like feelings |
| 22:08 | akhudek | mlb-: well, unlike perl, R is still popular, isn't it? In that sense, incanter is much less mature and has much less out of the box. Not sure how big it's user base is, but it's no where close to Rs, that's for sure. I use it from time to time for the odd bit of statistics. |
| 22:11 | mlb- | akhudek: Actually, I honestly don't know. That said, popularity can be subjective. Do you know where I might find a sizable R community? |
| 22:13 | akhudek | mlb-: probably the mailing lists? |
| 22:17 | mlb- | akhudek: hmm, I'll check those out. Thanks! |
| 22:18 | michel_slm | mlb-: there's Stack Overflow too, the R tag is quite active |
| 22:26 | bufferloss | so I'm running a basic empty/test project (almost empty except for a single postgres query throuhgh clojure.java.jdbc) and when I assign the results of the query to a var using (def rs (clojure.java.jdbc/query "")) then println works as expected, if instead I use for example (let [rs (query...)]) I get an error that rs is not within that scope, but both the println and the let are in the same defn and I though that let just create variable |
| 22:26 | bufferloss | s within the local scope |
| 22:26 | bufferloss | what am I missing? |
| 22:26 | bufferloss | I've gotten through about the first 3rd of this http://java.ociweb.com/mark/clojure/article.html |
| 22:26 | bufferloss | (the first, left hand column in the table of contents) |
| 22:27 | bufferloss | maybe my understanding of let is incorrect |
| 22:27 | dsrx | bufferloss: |
| 22:28 | dsrx | ,(let [x 32] (+ x 10)) |
| 22:28 | clojurebot | 42 |
| 22:28 | dsrx | ,((fn [] (let [x 32]) (+ x 10))) |
| 22:28 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 22:29 | bufferloss | oh, I see, so it creates its own scope |
| 22:29 | bufferloss | and you have to use x within the let block, right? |
| 22:29 | noonian | yep |
| 22:29 | bufferloss | aight cool thx, didn't catch that |
| 22:29 | bufferloss | ,(+ 1 2) |
| 22:29 | clojurebot | 3 |
| 22:31 | bufferloss | ,((defn hello (+ 1 2) (def x 4)) hello) |
| 22:31 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: Parameter declaration + should be a vector, compiling:(NO_SOURCE_PATH:0:0)> |
| 22:31 | bufferloss | ,((defn hello [& args] (+ 1 2) (def x 4)) hello) |
| 22:31 | clojurebot | #'sandbox/x |
| 22:32 | bufferloss | ,((defn hello [& args] (+ 1 2) (def x 4)) x) |
| 22:32 | clojurebot | #'sandbox/x |
| 22:32 | bufferloss | is a symbol defined within a function using (def ...) accessible outside the function? |
| 22:32 | bufferloss | (I am guessing/hoping no) |
| 22:32 | hiredman | yes |
| 22:32 | hiredman | clojure is not like scheme |
| 22:33 | bufferloss | I don't know scheme |
| 22:33 | hiredman | def/defn always creat/definee a global var |
| 22:33 | bufferloss | so how do I define a variable local only to the scope of a function |
| 22:33 | hiredman | let |
| 22:33 | hiredman | let and fn arguments are local bindings |
| 22:33 | bufferloss | ah, so I'd need to let all my vars and then work within that let block within the function block if I want locally scoped vars |
| 22:34 | hiredman | a "var" is a distinct thing, it is always global |
| 22:34 | hiredman | generally in clojure people don't talk about variables, because locals are immutable and don't vary, and globals are vars |
| 22:34 | bufferloss | let all my symbols then |
| 22:35 | hiredman | so the bindings of names to values created via let, and via fn application tend be called "locals" |
| 22:35 | noonian | the symbols you use in a let will be bound to the value you provide in the let binding form |
| 22:35 | hiredman | so you let bind locals |
| 22:35 | bufferloss | right, so I can't actually, strictly speaking "declare" a bunch of empty symbols with let and then define them later, right? |
| 22:35 | noonian | you can bind them to nil if you want |
| 22:36 | hiredman | bufferloss: correct |
| 22:36 | noonian | let only takes an even number of forms so you have to give everything a value |
| 22:36 | hiredman | bufferloss: but symbols is not the right word either |
| 22:36 | nightfly | bindings |
| 22:36 | noonian | it binds what the symbols resolve to when they are evaluated |
| 22:36 | hiredman | symbols are the datatype that happen to be used in the reader to represent names |
| 22:36 | noonian | yea |
| 22:37 | hiredman | but they don't have storage associated with them, (let [x 1] x) doesn't somehow stick 1 in some value slot on x |
| 22:38 | hiredman | somewhere there is a thing that locally binds the name x to the value 1, a local binding |
| 22:46 | akurilin2 | Oh man I need to write down what noonian just said, always wanted to phrase that whole symbol resolution process elegantly :) |
| 22:50 | vjktm | I am trying cider in emacs |
| 22:50 | vjktm | I can't get the error highlighting to work, i.e., I don't see the red highlight |
| 22:50 | vjktm | what should I try? |
| 22:54 | bufferloss | am I supposed to use * for all my local bindings? e.g. function parameters or let bindings? |
| 22:55 | akurilin2 | What's *? |
| 22:56 | hiredman | bufferloss: confusingly there is a thing in clojure called binding, which doesn't have anything to do with local bindings, but is for dynamic binding of vars, earmuffs( *foo* ) are used to indicate vars that are dynamicly bindable |
| 22:56 | bufferloss | ,(println *clojure-version*) |
| 22:56 | clojurebot | {:interim true, :major 1, :minor 6, :incremental 0, :qualifier master}\n |
| 22:56 | noonian | the use of asterisks is a convetion used with dynamic vars to tell you that they are dynamic |
| 22:56 | bufferloss | akurilin2, stuff like that as far as I know |
| 22:56 | hiredman | it is just a convention to use them though |
| 22:56 | bufferloss | noonian, ah ok |
| 22:56 | akurilin2 | Yeah it's a naming convention for dynamic vars |
| 22:56 | akurilin2 | Because they're freaky and you should avoid making your own. |
| 23:01 | bocaj | Would anyone like to share an extract, transform, load experience with clojure? I'm sick of thick tools. |
| 23:16 | seangrove | stcredzero: By the way, as a osx/ios dev, do you use IB at all? Or is everything done in XCode? And do you use VFL and autolayout? |
| 23:24 | bufferloss | is there an equivalent to "each" aside from (doall (map...)) |
| 23:25 | noonian | ,(doseq [i (range 10)] (println i)) |
| 23:25 | clojurebot | 0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n |
| 23:26 | noonian | ,(doseq [i (range 10)] (print i)) |
| 23:26 | clojurebot | 0123456789 |
| 23:27 | bufferloss | noonian, ah cool |
| 23:27 | bufferloss | anyone happen to know how to get the actual SQL error message out of clojure.java.jdbc if a sql error occurs? |
| 23:28 | jcromartie | noonian: it's also worth noting: "doall" holds onto the head and keeps the whole seq in memory, while "dorun" and "doseq" do not |
| 23:28 | bob2 | when does 'ns-level code' run in clojure? e.g. if I put a (set-logger) statement at the top level of a file, is it executed at import-time? or does all that get run and jar load time? |
| 23:28 | jcromartie | noonian: i.e. use doall when you care about ALL the seq |
| 23:28 | jcromartie | bob2: only when it is require'd |
| 23:29 | bob2 | cheers |
| 23:30 | trptcolin | bbloom: thanks again for the delimc help the other day - i'm getting close to grokking it. |
| 23:30 | noonian | jcromartie: but for printing out a seq you don't really care about holding onto the head right? |
| 23:30 | jcromartie | noonian: correct |
| 23:31 | bbloom | trptcolin: np, did i explain the kernel call metaphore to you? that's my new favorite way to think about it |
| 23:31 | noonian | cool, it seemed like bufferloss wasn't trying to hold onto the result with his question |
| 23:33 | trptcolin | bbloom: no, i don't think so. |
| 23:34 | bbloom | trptcolin: the idea is that all continuations are delimited SOMEWHERE and that an undelimited (or "full") continuation (ie "call-cc") is simply delimited by the top-level of the process |
| 23:34 | bbloom | trptcolin: when you make a normal call in C code, you push some args on the stack and run some code, then pop back off... but that means that you and the code you call are in control. that's not acceptable for security and multiprocessing reasons when you need to make an OS system kernel call |
| 23:35 | bbloom | trptcolin: so when you make a call to your OS, your C code will put the arguments in a special place (registers, etc) and then yield to the kernel |
| 23:36 | trptcolin | so you delimit a continuation around the system call w/ the stuff you stuck in the registers? :) |
| 23:36 | trptcolin | i like it |
| 23:38 | bbloom_ | trptcolin: shit. i wrote a bunch of stuff, but i got disconnected |
| 23:38 | bbloom_ | trptcolin: https://www.refheap.com/56255 <- there |
| 23:38 | trptcolin | bbloom: :) yeah shift/reset are weird names. i kept thinking shift/reduce initially |
| 23:38 | bbloom_ | yeah |
| 23:39 | bbloom_ | i much prefer the handle/raise variant since it maps to how i already understand try/throw |
| 23:39 | trptcolin | bbloom_: the metaphor is interesting though |
| 23:40 | trptcolin | bbloom_: if you have another min, does it seem reasonable that a reset should delimit the extent of the continuation, e.g. https://github.com/swannodette/delimc/pull/11 ? |
| 23:40 | trptcolin | [specifically a nested one] |
| 23:41 | technomancy | gfredericks: you know you have commit on lein, right? |
| 23:41 | bbloom_ | trptcolin: also good: http://www.cs.indiana.edu/l/www/pub/techreports/TR615.pdf |
| 23:42 | trptcolin | bbloom_: i have so many tabs of this stuff open, that's in there somewhere :) |
| 23:43 | technomancy | trptcolin: so ... are you familiar with the sjacket api? |
| 23:43 | trptcolin | technomancy: kinda sorta :) |
| 23:43 | technomancy | I noticed reply uses it |
| 23:43 | technomancy | but it doesn't actually have any docs |
| 23:45 | trptcolin | technomancy: yeah basically i threw a tree-seq at the parse tree looking for unexpected or unfinished nodes: https://github.com/trptcolin/reply/blob/fff1fbc42ddc76e06cc4bd5e5d24b0f6308f24cb/src/clj/reply/parsing.clj#L5-L8 |
| 23:45 | trptcolin | using net.cgrand.sjacket/str-pt on an input string |
| 23:46 | trptcolin | i haven't done any of the fancy rewriting stuff |
| 23:49 | technomancy | yeah... I want to do stuff like that for lein 2.4 |
| 23:49 | technomancy | but yeah. no docs makes it tricky. |
| 23:50 | chare | when you guys do something distributed with Clojure like something similar to Erlang what do you do for rpc or mesage passing? |
| 23:51 | trptcolin | chare: i'm suddenly seeing irony, because i often use erlang (rabbitmq) for that |
| 23:51 | technomancy | most people use a queue like rabbit, yeah |
| 23:51 | technomancy | it's only vaguely erlang-like of course |
| 23:51 | chare | what? you guys use clojure with a erlang backbone messaging? |
| 23:52 | technomancy | well yeah, use the best tool for the job |
| 23:52 | chare | so use rabbitmq except when you're already using erlang? |
| 23:53 | chare | and also what happened to javaEE stuff, isn't there suppose to something for rpc/messaging that would make sense to use with clojure |
| 23:53 | trptcolin | chare: rabbit just happened to be one i've used on some projects. i know plenty of folks who use hornet, plain old http, and other stuff. |
| 23:54 | trptcolin | technomancy: yeah, i struggled a bit - i was hoping to point you at the tests, but looks like i wrote most of them and they're almost all parser stuff |