2014-03-11
| 00:18 | noprompt | any thoughts on creating a macro which targets clj/cljs w/ cljx that needs to return a reified instance of clojure.lang.IFn/IFn? |
| 00:18 | noprompt | anyone? |
| 00:18 | noprompt | lol |
| 00:18 | clojurebot | anyone is anybody |
| 00:33 | seangrove | Hrm, I'm not sure that gridstylesheets are a 100% clear win. Seems like they definitely have the potential to be, but are missing a few things first |
| 00:34 | noprompt | seangrove: they're definitely more complex, if i'm thinking the same thing your talking about. |
| 00:34 | seangrove | noprompt: http://gridstylesheets.org |
| 00:34 | seangrove | Hands-down better than css at layout, but it's unclear how to handle some of the dynamic parts |
| 00:35 | noprompt | ok i think that's different from what i was thinking. |
| 00:36 | noprompt | i did some work on a very sophisticate layout system which used a font-size/line-height scale which generated a grid. |
| 00:36 | noprompt | it was meant to be used as a layout system. |
| 00:37 | seangrove | noprompt: undoubtedly a good idea for you to checkout gss, the idea is certainly very interesting |
| 00:37 | seangrove | And it's right up your alley. Add some core.logic to garden, some accelerated 3d transforms, and boom :) |
| 00:37 | noprompt | seangrove: i've bookmarked it and will definitely give it a look. |
| 00:38 | noprompt | fwiw i used to work for a newspaper and there was just a ton of brilliant ideas in all the old books they had laying around. |
| 00:38 | noprompt | i never understood why the same attention to detail in print never made it to the web. |
| 00:39 | noprompt | it's like the web came along and suddenly everyone when "well, this completely different so forget everything we've learned over the passed 100 years" |
| 00:39 | noprompt | s/when/went |
| 00:39 | noprompt | better yet a 1000 years. |
| 00:40 | seangrove | bbloom_: Any thoughts on the constraints system in OSX now? GSS is based off of that, seems clever, much better aligned with app design |
| 00:40 | noprompt | seangrove: the amazing thing about clojure is that now there's actually a *very* good opportunity to build extrodinarily complex layouts. |
| 00:41 | noprompt | stuff that you simply could/would not do w/ sass/haml/etc. |
| 00:41 | seangrove | noprompt: How so? |
| 00:41 | noprompt | seangrove: because you can unify both systems with protocols. |
| 00:44 | noprompt | seangrove: imho, while scss/less are great tools they're not powerful enough to build the kinds of systems you could build with a *real* programming language. |
| 00:44 | seangrove | noprompt: I'm pretty curious about it |
| 00:44 | seangrove | Any example specifically? |
| 00:45 | noprompt | for example w/ a reified object/datatype you can implement various protocols that express how to render itself in different contexts. |
| 00:45 | noprompt | seangrove: look at newspaper design. it's very complex. |
| 00:46 | seangrove | noprompt: I'm more interested in app design, rather than newspaper design |
| 00:46 | noprompt | seangrove: definitely. |
| 00:46 | seangrove | CSS isn't very good at handling app design, to say the least |
| 00:46 | noprompt | it's not, but it can be if you program it. |
| 00:47 | noprompt | iow, w/ garden you can build better abstractions that express what you want in html/css. |
| 00:47 | noprompt | app design or newspaper design. |
| 00:47 | noprompt | whatever design. |
| 00:47 | noprompt | ddellacosta: i'll take that as a complement. :) |
| 00:48 | seangrove | noprompt: Let me know what you think about gss, it's certainly up there with what you're talking about |
| 00:48 | seangrove | The documentation is lacking, but the ideas are solid |
| 00:48 | ddellacosta | noprompt: I've just always taken the opposite approach, which is to touch CSS as little as possible...but what are ya gonna do, it's there and it's not going away. |
| 00:48 | bufferloss | so my dates are coming out obviously in a "different timezone" than UTC, which my database is set to UTC |
| 00:48 | seangrove | ddellacosta: Use gss :P |
| 00:48 | ddellacosta | I mean, I'm not a designer or a front-end layout person, I just pretend to be one. |
| 00:48 | Raynes | My approach to dealing with CSS has always been to write CSS. |
| 00:48 | bufferloss | any way to prevent this? I've done some googling but nothing particularly satisfies the answer |
| 00:48 | bufferloss | er, the question? |
| 00:48 | ddellacosta | Raynes: :-P |
| 00:49 | noprompt | Raynes: you haven't written enough then. ;) |
| 00:49 | bufferloss | CSS3 is pretty much fine |
| 00:49 | bufferloss | SASS ftw |
| 00:49 | bufferloss | not having to deal with IE ftw |
| 00:49 | Raynes | noprompt: You lookin' for a paddlin |
| 00:49 | ddellacosta | let's all just acknowledge the elephant in the room, it's not CSS, it's the f*ing browsers |
| 00:49 | noprompt | Raynes: bring it. ;P |
| 00:49 | seangrove | ddellacosta: ? It's certainly css. |
| 00:49 | Raynes | noprompt: Brb packing my car. |
| 00:49 | noprompt | ddellacosta: yeah, i'm with seangrove on this one. |
| 00:50 | seangrove | ddellacosta: http://gridstylesheets.org/guides/ccss/ |
| 00:50 | ddellacosta | seangrove, noprompt: yeah, do you guys write CSS to support IE8? Like, all features, across your apps? |
| 00:50 | noprompt | i guess i'm biased. |
| 00:51 | ddellacosta | whenever someone throws a framework at me I'm just like...whatever. Doesn't change anything. |
| 00:51 | noprompt | in the past i've written large scss projects 3K-6K lines, i don't belive preprocessors are the future. period. |
| 00:51 | seangrove | ddellacosta: Nope. But even once you're passed that, CSS is a hurdle to overcome in writing apps |
| 00:51 | noprompt | why would i want @for i through j when i could have (map some-fn (range i j)) |
| 00:51 | ddellacosta | seangrove: right, I'm just saying, I'm not past that and a lot of folks aren't. I don't have the luxury of thinking of CSS in the terms that you guys are talking about it now. |
| 00:52 | noprompt | why wouldn't i want macros? |
| 00:52 | noprompt | like this: http://noprompt.github.io/clojurescript/2014/02/10/media-query-breakpoints-with-garden.html |
| 00:52 | Raynes | noprompt: Dear God, the fancy. |
| 00:52 | Raynes | It burns. |
| 00:53 | noprompt | and as soon as i finish converting the sass parse tree to scss, i can use whatever's out there. |
| 00:53 | noprompt | sorry "to clj" |
| 00:53 | ddellacosta | noprompt, seangrove: I mean, granted, I'm writing for the enterprise, solely web-based apps. It's a different world than someone who is trying to write a system for up-to-date desktop and mobile browsers. |
| 00:53 | noprompt | Raynes: just a theme bro. lots of 20's inspiration. |
| 00:53 | noprompt | lol |
| 00:54 | noprompt | ddellacosta: this is true. |
| 00:54 | noprompt | my whole point is that CSS is awful. SCSS is an improvement, sure, but that's all it is. |
| 00:55 | ddellacosta | noprompt: well, then we are in agreement. |
| 00:55 | noprompt | call me a smug lisp weenie, but i'd rather write my own language that abstracts all the CSS horse shit away and live in my ivory tower than write that. |
| 00:56 | noprompt | if anyone gave a damn i'd do kickstarter! LMAO!!! |
| 00:56 | noprompt | hell i'll throw in type safety! cc/ ambrosebs |
| 00:57 | ddellacosta | noprompt: I'm totally down with that. But what I'd really like is some system that let me use css3 transitions transparently across browsers, handling all the shimming and whatnot. That's the kind of crap I get stuck on consistently. |
| 00:57 | noprompt | seangrove: but looking at what your working on, hey go w/ what you know, make the damn thing work. then get fancy. |
| 00:57 | noprompt | ddellacosta: that's the whole idea! :) |
| 00:57 | seangrove | noprompt: This *is* fancy |
| 00:57 | ddellacosta | noprompt: then give it to me |
| 00:58 | seangrove | noprompt: But, check out constraint-based layout systems and compiling them to css/js runtime, and tell me what you can do with it in garden ;) |
| 00:58 | seangrove | That'd be fantastic |
| 00:58 | Raynes | https://www.youtube.com/watch?v=zplc4Ienkws |
| 00:58 | seangrove | That's almost certainly a much bigger opportunity |
| 00:58 | noprompt | guys, i was watching a lot of BoardWalk Empire and browsing http://www.jugend-wochenschrift.de/index.php?id=25 |
| 00:58 | ddellacosta | Raynes: that looks creepy I ain't clickin |
| 00:58 | Raynes | ddellacosta: It's a song. |
| 00:58 | seangrove | https://www.youtube.com/watch?v=47-xxp02PFg |
| 00:58 | ddellacosta | noprompt: pretty |
| 00:59 | Raynes | No creepies. |
| 00:59 | noprompt | my whole house is gonna end up looking like an art deco time machine. |
| 00:59 | ddellacosta | Reba! |
| 01:00 | bufferloss | how can I accomlish something like this with condp |
| 01:00 | bufferloss | ,(let [value 2] (if (> value 2) "foo" (if (< value 2) "bar" "baz"))) |
| 01:00 | noprompt | seangrove: it'll take time. no one really shares the vision i have and it's hard to find anyone who wants to be an active contributor. |
| 01:00 | clojurebot | "baz" |
| 01:01 | noprompt | seangrove: writing new code takes time and thought. improving the compiler each time is a big effort. |
| 01:01 | seangrove | noprompt: Definitely. It's a pretty huge system you're working on |
| 01:01 | noprompt | seangrove: not to mention ensure i can support both cljs and clj. |
| 01:02 | noprompt | i mean if i could just find one or two solid guys/gals who could give me a few hours a week that'd be awesome. |
| 01:02 | noprompt | and ddellacosta, i could deliver on that promis. |
| 01:03 | noprompt | (deliver that-promise "d-d-d-deliver that promise yo") |
| 01:03 | ddellacosta | noprompt: :-) |
| 01:05 | noprompt | ddellacosta: i did tell you about thorn right? https://github.com/noprompt/thorn |
| 01:05 | noprompt | ddellacosta: css->clj is almost done w/ the exception of media queries. |
| 01:05 | noprompt | ddellacosta: then the hard part scss->clj. |
| 01:05 | ddellacosta | noprompt: I was eavesdropping the other day right when you were talking about it with bbloom actually. :-O |
| 01:05 | ddellacosta | noprompt: very cool stuff, I gotta say. |
| 01:06 | noprompt | ddellacosta: it was actually pretty easy once i figured out the right ruby spells. |
| 01:06 | ddellacosta | noprompt: yeah, it's kind of crazy the stuff you can do with the JVM huh? |
| 01:07 | noprompt | ddellacosta: it's incredible. i kept telling my coworker how amazed i was for like an hour on/off. |
| 01:08 | seangrove | ddellacosta: Worth checking out https://www.youtube.com/watch?v=ouzAPLaFO7I for an idea |
| 01:08 | ddellacosta | seangrove: will do, after I listen to this Reba song Raynes dropped on us |
| 01:10 | mskoud | Anyone who can help me with this: http://stackoverflow.com/questions/22316854/clojure-nested-maps-path |
| 01:12 | ddellacosta | mskoud: you'll make it easier on yourself if you can make :children contain maps vs. vectors |
| 01:13 | ddellacosta | mskoud: for example |
| 01:13 | ddellacosta | ,(def x {:name "A", :id 1, :children {2 {:name "B", :id 2, :children []} 3 {:name "C", :id 3, :children {4 {:name "D", :id 4, :children {}}}}}}) |
| 01:13 | clojurebot | #'sandbox/x |
| 01:13 | ddellacosta | mskoud: then you can do stuff like |
| 01:14 | ddellacosta | (get-in x [:children 3 :children]) |
| 01:14 | ddellacosta | whoops |
| 01:14 | ddellacosta | ,(get-in x [:children 3 :children]) |
| 01:14 | clojurebot | {4 {:name "D", :id 4, :children {}}} |
| 01:14 | ddellacosta | mskoud: and |
| 01:14 | ddellacosta | ,(update-in x [:children 3 :children 4 :name] "E") |
| 01:14 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn> |
| 01:14 | ddellacosta | er |
| 01:14 | ddellacosta | ,(assoc-in x [:children 3 :children 4 :name] "E") |
| 01:14 | clojurebot | {:name "A", :id 1, :children {2 {:name "B", :id 2, :children []}, 3 {:name "C", :id 3, :children {4 {:name "E", :id 4, :children {}}}}}} |
| 01:15 | ddellacosta | etc. |
| 01:15 | mskoud | ok, thx ddellacosta, will try to explore this, sounds resonable! |
| 01:15 | ddellacosta | mskoud: :-) |
| 01:20 | mskoud | it better but i still miss an index where i can lookup any id , independent of level/depth. |
| 01:22 | mosber | /join #incanter |
| 01:29 | ddellacosta | mskoud: how so? |
| 01:30 | mskoud | Getting a record like this is ok (get-in @x [:children 3 :children 4]) , but i do not know which child element its in. Just need to get the element with :id 4 , know knowing where it is. Maybee i should build some sort of index. |
| 01:32 | TravisD | mskoud: Are you searching through the tree to find an element, and return the path to it? |
| 01:32 | ddellacosta | mskoud: well, in that case I would just make it into a binary tree or something to be able to search easily on the ids, assuming they are unique. |
| 01:33 | mskoud | TravisD : Yes, thats right. And the id's are unique |
| 01:39 | amalloy | ddellacosta: don't roll your own binary search tree, just use a map |
| 01:39 | noprompt | dammit. i think i'm actually gonna have to generate the clj/cljs code and cp/pst it into the file. |
| 01:39 | noprompt | :| |
| 01:39 | ddellacosta | amalloy: is it still efficient then to find nodes by id when you don't know where the node is? |
| 01:40 | amalloy | huh? just one map of id->thing |
| 01:40 | ddellacosta | amalloy: I don't know how you'd do it without iterating through each branch, if your nodes aren't structured at all. |
| 01:40 | ddellacosta | right; see the above conversation for context |
| 01:40 | TravisD | If the data is not already in a nice structure, you cant avoid doing a naive search through the tree |
| 01:44 | noprompt | oh duh, just import the clojure.lang.* stuff. |
| 01:44 | noprompt | that was easy. |
| 01:44 | ddellacosta | heh |
| 01:46 | ddellacosta | amalloy: while I think mskoud needs some kind of structure it's hard to know what (probably *not* a binary search tree actually), but since the nodes have parent/child relationships to each other doesn't seem like a flat map would suffice. Would be interested to hear why that is not the case though. |
| 01:47 | amalloy | ddellacosta: what i mean is, if the current hierarchy he has is important to him, then converting it to a binary search tree doesn't make any sense; and if he just needs an index to look up "something" by id, then a map is all he needs |
| 01:47 | ddellacosta | amalloy: right, gotcha...so he'd keep the index somewhere else. |
| 01:49 | mskoud | so keep the structure a plain map instead of a nested? |
| 01:58 | amalloy | mskoud: presumably the structure of the nested map matters to you, so you can't just throw it away. but you can additionally maintain a flat map of id->path or something, which you use to make operations faster |
| 01:59 | mskoud | yes, that would be a good way to go. Any hint to how to create such a map. |
| 02:00 | akhudek | mskoud: iterate over the entire tree and build the map as you go |
| 02:01 | akhudek | of course, if you need to update the tree, you'll have to remember to update the map too |
| 02:45 | sid_ | Hi there, I'm trying to use pulsar library in my project, but I'm getting this error: |
| 02:45 | sid_ | (use 'co.paralleluniverse.pulsar.actors) Initializing core.typed ... Loading Clojurescript... Clojurescript found and loaded. Initializing cljs.core NullPointerException clojure.core/deref-future (core.clj:2108) |
| 02:45 | sid_ | I've added the dependencies in my project.clj file. |
| 02:46 | sid_ | can anyone please help |
| 02:46 | sid_ | anyone? |
| 02:46 | clojurebot | anyone is anybody |
| 02:46 | sid_ | anybody? :P |
| 02:50 | sid_ | I searched on google but couldn't resolve it |
| 02:51 | noprompt | sid_: maybe browse the issue tracker? |
| 02:51 | noprompt | i'm not familiar with the library, but you should do that or look at the stacktrace and try to figure out where the issue is. |
| 02:53 | dsrx | it looks like you're trying to load some mish-mash of clojurescript and clojure |
| 02:54 | dsrx | er, I may be misreading that error |
| 02:55 | sid_ | Stacktrace got me this: java.lang.NullPointerException: null at clojure.core$deref_future.invoke (core.clj:2108) clojure.core$deref.invoke (core.clj:2129) cljs.analyzer$resolve_var.invoke (analyzer.clj:347) cljs.analyzer$resolve_var.invoke (analyzer.clj:308) clojure.core.typed.util_cljs$resolve_var.invoke (util_cljs.clj:40) clojure.core.typed.parse_unparse$resolve_type_cljs.invoke (parse_unparse.clj:585) cloju |
| 02:56 | sid_ | I'm pretty new to clojure |
| 02:56 | sid_ | what can I do to resolve it |
| 02:56 | sid_ | ? |
| 02:57 | noprompt | sid_: did you browse the issue tracker yet? |
| 02:58 | sid_ | how can I browse the issue tracker? Sorry if this is a lame question |
| 02:59 | noprompt | sid_: i think the project is hosted on github -> https://github.com/puniverse/pulsar |
| 02:59 | noprompt | sid_: browse the open/closed issues. |
| 02:59 | noprompt | sid_: if you can't find something open a new issue or attempt to ping the authors here. |
| 03:01 | sid_ | I'll do that. Thank you for your help :) |
| 03:01 | jph- | is there a way to get progress from java.io/copy? |
| 03:01 | noprompt | sid_: no problem |
| 03:01 | noprompt | sid_: also, if you're new to clojure it might help to learn the basics before jumping in to something like pulsar. |
| 03:02 | SegFaultAX | sid_: http://www.clojurebook.com/ |
| 03:02 | noprompt | sid_: get a handle on things first. that'll help you debug problems faster once you're more familiar w/ the clojure landscape. |
| 03:02 | noprompt | just a friendly tip. |
| 03:02 | noprompt | :) |
| 03:02 | SegFaultAX | (inc noprompt) |
| 03:02 | lazybot | ⇒ 7 |
| 03:05 | sid_ | Thank you for so much. I'm working on a web app and I encountered a situation in which I thought using actors would be a good. So I was going through pulsar and core.async. |
| 03:05 | sid_ | Thank you so much* |
| 03:05 | noprompt | sure. :) |
| 03:07 | dissipate | how important is it to study reducers when first learning Clojure? http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html |
| 03:08 | noprompt | dissipate: it's not essential. you can get far w/o them. |
| 03:08 | dissipate | noprompt, do you use them? |
| 03:08 | noprompt | dissipate: i've been programming clojure for a 1 1/2yrs and haven rarely used thme. |
| 03:08 | noprompt | *them. |
| 03:08 | noprompt | dissipate: it just depends on what you're doing. but they're fairly easy to learn. |
| 03:09 | dissipate | noprompt, it just seems more and more stuff to learn! |
| 03:09 | dissipate | noprompt, do you think it is a good thing that the core is getting bigger and bigger? |
| 03:10 | noprompt | dissipate: just my two cents: learn about things so you know about them; solve your problem with the core tools; if you need more horse power use power tools. |
| 03:11 | noprompt | dissipate: i don't have a problem w/ that no. |
| 03:11 | noprompt | i've never found core to be bloated. |
| 03:12 | noprompt | and there's hardly any core function i didn't want or wanted improved. |
| 03:12 | noprompt | well except for for re-matches and re-find. |
| 03:12 | noprompt | those are terrible. |
| 03:14 | dissipate | noprompt, you use core.logic? |
| 03:14 | noprompt | no not yet. |
| 03:14 | sid_ | hey noprompt, I'm actually confused what to do. I need to maintain sessions of 60 minutes on a click event for multiple users parallely. I thought on using actors that could revert with a message that the 60 minutes session is over and return all the computations done in the fiber. Would it be good to use puslar in this case or would you recommend using something else? |
| 03:15 | noprompt | sid_: i can't speak to pulsar. i've really only used core.async. if you're working w/ the browser i'd recommend that. |
| 03:16 | dissipate | sid_, what about Redis? |
| 03:18 | SegFaultAX | dissipate: I will say this about reducers: they are perfectly usable without understanding how they actually work. |
| 03:18 | sid_ | noprompt, how would I join a thread in core.async for 60 minutes? Is there something in clojure or should I use java's join interop? |
| 03:18 | dissipate | SegFaultAX, well, that's good because Hickey's article has me confused out of my mind. :O |
| 03:18 | SegFaultAX | As long as you fundamentally understand the core functional operators map, filter, and reduce, you can defer learning how the library works for some time. |
| 03:19 | SegFaultAX | dissipate: http://www.infoq.com/presentations/Clojure-Reducers might be a good extra resource. |
| 03:19 | sid_ | dissipate, clj-redis-session? |
| 03:19 | SegFaultAX | Good analogies for gaining an intuition about reducers. |
| 03:20 | sid_ | dissipate, I'm already using lib-noir to maintain sessions when a user login |
| 03:20 | dissipate | sid_, yep, looks good to me. https://github.com/wuzhe/clj-redis-session should be able to create a session in Redis with a 60 second timeout that any thread can access. |
| 03:21 | dissipate | SegFaultAX, thanks. i'm actually still trying to figure out how recursive functions with lazy-seq work. seems to be somewhat like Python's 'yield' |
| 03:22 | dissipate | sid_, (wrap-session your-app {:store (redis-store redis-conn {:expire-secs (* 3600 12)})}) |
| 03:23 | SegFaultAX | dissipate: Reading the source is instructive. Lazy seqs are just chained continuations. |
| 03:23 | sid_ | dissipate, wouldn't it be better just to join a thread for 60 minutes? I'm already using lib-noir to maintain user login sessions |
| 03:24 | SegFaultAX | dissipate: Each cell in the lazy seq is either evaluated (in which case its value is already cached and returned immediately), or there is a thunk which will yield the next value (which is immediately cached and the thunk destroyed) |
| 03:24 | dissipate | sid_, but Redis is probably more robust. you need persistence for something that lasts 60 minutes. |
| 03:25 | SegFaultAX | sid_: What does "join a thread for 60 minutes" mean? Thread.join(60 * 60 * 1000)? |
| 03:26 | sid_ | like dispatch something like a future for 60 minutes and it should return back after the completion if those 60 minutes with all the calculated results |
| 03:27 | dissipate | SegFaultAX, this is confusing to me: https://www.refheap.com/56279 |
| 03:27 | SegFaultAX | sid_: Join probably isn't the tool you want to use for that. |
| 03:27 | sid_ | SegFaultAX, joining won't work. I'm pretty new to futures and agents. Does futures really work that way |
| 03:27 | sid_ | ? |
| 03:28 | SegFaultAX | dissipate: It's idiomatic to wrap the outer-most form in the lazy-seq to defer as much execution as possible. |
| 03:28 | sid_ | completion of* |
| 03:28 | SegFaultAX | sid_: Do futures really work what way? I have no idea what you're talking about. |
| 03:29 | SegFaultAX | But blocking the main thread for 60 minutes waiting for a thread to return seems insane. |
| 03:30 | sid_ | yup, my bad, joining would be bad |
| 03:30 | dissipate | sid_, you really ought to consider some kind of persistence for your sessions |
| 03:30 | SegFaultAX | sid_: So what are you really trying to do? |
| 03:30 | sid_ | can you suggest something? |
| 03:30 | SegFaultAX | sid_: Can you describe the problem you're trying to solve? |
| 03:31 | sid_ | I'm working on a web app, which provides user registration on it |
| 03:31 | sid_ | after user registration, a user can start a new test |
| 03:31 | sid_ | for 60 minutes |
| 03:31 | SegFaultAX | What's a test? |
| 03:32 | sid_ | test as in any kind of test related to academics |
| 03:32 | SegFaultAX | Oh like an exam |
| 03:32 | SegFaultAX | ? |
| 03:32 | sid_ | yup |
| 03:32 | SegFaultAX | Ok, go on. |
| 03:32 | sid_ | so i need to maintain a a session of 60 minutes for that test session |
| 03:33 | sid_ | and at the end of the test, I need to add those results in the database |
| 03:33 | SegFaultAX | Ok |
| 03:33 | sid_ | what would you suggest I should do? |
| 03:34 | SegFaultAX | Depends on the format of the exam. |
| 03:34 | SegFaultAX | Does the client send the user's response after each question? |
| 03:34 | sid_ | yes it does |
| 03:35 | sid_ | I'm pretty confused what to do |
| 03:35 | SegFaultAX | Does it need to be very exact? Down to the second? |
| 03:36 | sid_ | no, I want to add the answers to the database at the end of 60 minutes |
| 03:36 | SegFaultAX | I mean the length of the session. |
| 03:37 | sid_ | yes, the length of session should be exact |
| 03:38 | SegFaultAX | Ok, based on what you've told me I can think of a few ways to model this. |
| 03:39 | SegFaultAX | MVP might be a user table, a session table, and a response table. |
| 03:39 | SegFaultAX | A user has many sessions, and a session has many responses. |
| 03:39 | SegFaultAX | A session also has a start time and a duration (or end time, as you like) |
| 03:40 | SegFaultAX | The business logic is essentially "allow new responses to be inserted for this session as long as the session is still open" |
| 03:40 | SegFaultAX | Or you could always allow responses to be recorded, but only count those that were created within the session window. |
| 03:41 | SegFaultAX | You can easily provide an endpoint to query how many seconds are remaining in the session to update/synchronize the UI. |
| 03:41 | sid_ | okay..so paralleslism doesn't come in if a lot of users are talking the test session at the same time? |
| 03:41 | SegFaultAX | sid_: Each user has their own session. |
| 03:42 | sid_ | wouldn't that impact the performance? |
| 03:42 | SegFaultAX | sid_: There is also probably some sort of test table, and so a session belongs to a user and a test (it's essentially a join table with some additional metadata) |
| 03:42 | SegFaultAX | a) Don't optimize prematurely, b) no it wouldn't. |
| 03:42 | SegFaultAX | Since you can do an index scan on the join table by (user_id, test_id) |
| 03:43 | SegFaultAX | If you have a group of students taking the test together and that's a meaningful thing you want to capture, you could create a session group, which has many sessions. |
| 03:44 | SegFaultAX | Then you could ask questions like "which students took this test together?" |
| 03:45 | SegFaultAX | Anyway, that's just one idea for how to implement it. |
| 03:45 | sid_ | so all the queries for an individual user has to go through what? a thread? |
| 03:45 | SegFaultAX | sid_: What? |
| 03:46 | SegFaultAX | What do threads have to do with this? |
| 03:47 | sid_ | like, each question returns a question id and answers when going to the next question |
| 03:47 | dissipate | ,(first (iterate inc 2)) |
| 03:47 | clojurebot | 2 |
| 03:47 | sid_ | I'll have to store those results somewhere? |
| 03:47 | SegFaultAX | sid_: As I said presumably you'll have some representation of a test. |
| 03:48 | sid_ | would it be feasible to let an actor do all those tasks |
| 03:48 | sid_ | and at the end of session just add those results to the database? |
| 03:48 | dissipate | sid_, you should store every single result the student gives in some persistent DB. depending on how important the data is. |
| 03:49 | SegFaultAX | sid_: Um, I don't feel like we're talking about the same thing. |
| 03:49 | dissipate | sid_, no, not at the end of the session, during the session, store everything the student gives you persistently |
| 03:49 | SegFaultAX | You're asking about actors and threads and I'm trying to help you conceptualize your problem. |
| 03:49 | sid_ | I was thinking of storing those results in an atom |
| 03:49 | dissipate | sid_, why? store them in a DB or some persistent layer. |
| 03:50 | dissipate | sid_, you could do something like memcached or redis, with a mongodb capped collection for additional caching. |
| 03:51 | SegFaultAX | dissipate: Dude, what? |
| 03:51 | SegFaultAX | memcache, redis, and mongo all in one sentence? |
| 03:51 | SegFaultAX | sid_: Why don't you focus on getting a working solution first before you start trying to "optimize" |
| 03:52 | dissipate | SegFaultAX, why not? if memcached or redis go down, you still have mongo as a backup. but like i said, depends on how important the data is. |
| 03:52 | sid_ | SegFaultAX, okay, so I'll do as yo usay |
| 03:53 | SegFaultAX | dissipate: http://i.imgur.com/f9bQXZA.png |
| 03:53 | dissipate | sid_, i don't see why you are getting into threading stuff. should be handled by your web framework. |
| 03:53 | sid_ | when does atoms, refs, agents, futures come into picture? |
| 03:54 | SegFaultAX | sid_: When you require coordination, synchronization, or parallel execution. |
| 03:54 | dissipate | SegFaultAX, i'm not advocating mongodb as a primary database. but it can be used for caching IMO. |
| 03:54 | SegFaultAX | Which at this phase, you clearly don't. |
| 03:55 | sid_ | so these test sessions aren't parallel execution. I'm sorry I'm a complete n00b |
| 03:55 | sid_ | :/ |
| 03:55 | dissipate | sid_, should be handled at the web server layer |
| 03:56 | SegFaultAX | sid_: Why don't you just start building the test taking part for now? Worry about all that other crap later. |
| 03:56 | SegFaultAX | I think it's better to nail down the core domain models and logic first anyway. |
| 03:56 | dissipate | SegFaultAX, DDD? |
| 03:57 | sid_ | Thank you SeagFaultAX and dissipate for your help :) |
| 03:57 | SegFaultAX | DDD-lite |
| 03:57 | SegFaultAX | sid_: Good luck mate. |
| 03:57 | atyz | So I'm currently logging a couple of datomic entities. However there are several fields I would like to redact from the logs... Is there a nice way to do this? |
| 03:57 | dissipate | SegFaultAX, you a fan of Uncle Bob's 'Clean Architecture'? |
| 03:58 | sid_ | I'll work on the model and than think about optimization |
| 03:58 | sid_ | just out of curiosity, aren't test session a parallel execution? |
| 03:58 | atyz | (turning it into a map doens't work because something like (into {} entity) doesn't resolve components |
| 03:58 | dissipate | ,(take 1 (iterate inc 2)) |
| 03:58 | clojurebot | (2) |
| 03:59 | dissipate | ,(first (iterate inc 2)) |
| 03:59 | clojurebot | 2 |
| 03:59 | dissipate | very interestng |
| 03:59 | TEttinger | it is odd how iterate does that |
| 03:59 | TEttinger | 0 calls, then 1 call |
| 03:59 | dissipate | TEttinger, what do you mean? |
| 03:59 | SegFaultAX | TEttinger: Huh? |
| 04:00 | TEttinger | ,(take 5 (iterate inc 2)) |
| 04:00 | clojurebot | (2 3 4 5 6) |
| 04:00 | SegFaultAX | The first value of iterate is the initial value. |
| 04:00 | pyrtsa | TEttinger: It's just like how (reductions f init xs) behaves. |
| 04:00 | dissipate | TEttinger, one evaluates to a list of 1 value, the other evaluates to just 1 value |
| 04:00 | TEttinger | 0 calls to inc, 1 call to inc, 2 calls to inc... is what I mean |
| 04:00 | SegFaultAX | TEttinger: Why is that weird? |
| 04:00 | alew | iterate explicitly says it returns the inital arg as the first value |
| 04:00 | TEttinger | I just wasn't aware of other fns that acted like that until now |
| 04:01 | dissipate | TEttinger, that's how iterate works. f(f(f(x))) |
| 04:01 | dissipate | no? |
| 04:01 | clojurebot | no is tufflax: there was a question somewhere in there, the answer |
| 04:01 | SegFaultAX | dissipate: x, f(x), f(f(x)), f(f(f(x))). |
| 04:02 | TEttinger | dissipate, yeah I know, I just mean it is sorta a different way of thinking about the result is all |
| 04:02 | dissipate | alew, so why does 'take 1' evaluate to a list? |
| 04:02 | alew | what is with this odd notation of putting the opening paren after the function name |
| 04:02 | TEttinger | map doesn't preserve the base values unless you tel it to |
| 04:02 | dissipate | SegFaultAX, so why doesn't 'take 1' result in the value by itself? |
| 04:02 | alew | take always returns a lazyseq |
| 04:03 | SegFaultAX | dissipate: Because take is a sequence operation. |
| 04:03 | SegFaultAX | (take 3 (range)) |
| 04:03 | SegFaultAX | ,(take 3 (range)) |
| 04:03 | clojurebot | (0 1 2) |
| 04:03 | TEttinger | first is similar to (nth coll 0), take is more like a subsequence |
| 04:03 | dissipate | ,(first (range)) |
| 04:03 | clojurebot | 0 |
| 04:04 | dissipate | SegFaultAX, gotcha |
| 04:04 | dissipate | SegFaultAX, that sieve function is quite clever then. it uses 'first' instead of 'take 1'. |
| 04:05 | dissipate | SegFaultAX, which triggers the caching mechanism? 'first' or 'take x' ? |
| 04:05 | SegFaultAX | dissipate: First always forces a value. take is lazy. |
| 04:07 | nonuby | enlive question, trying to figure out the selector syntax to match an element that has a data-section attribute but this is not equal to "homepage-section" I though [[(attr? :data-section) (but (attr= :data-section "hompage-content"))] would work but not so |
| 04:08 | dissipate | SegFaultAX, is it possible to have a collection that is not an 'iterable', and hence cannot have 'seq' called on it? |
| 04:09 | SegFaultAX | dissipate: If you created your own collection and didn't use anything built into Java, sure. But ISeq is extended over the base Java iterable types. |
| 04:10 | SegFaultAX | Not sure why you would do such a thing. |
| 04:13 | dissipate | SegFaultAX, i dunno. one thing i do know is that i thought Python was a clever language. Clojure (and hence Lisp) seems to be on a whole other level of cleverness. i can see why many programmers are repelled by it. :P |
| 04:18 | AmnesiousFunes | Is there a convenient way to test a nested data structure for circularity, i.e. including atoms that at some point reference themselves? |
| 04:19 | AmnesiousFunes | Or should I just check every node in a branch for identity with its ancestors? |
| 04:23 | SegFaultAX | AmnesiousFunes: I'm not aware of any built-in way to do that. Use the standard recursive approach. |
| 04:27 | AmnesiousFunes | SegFaultAX: Thanks. |
| 04:45 | dissipate | how is caching in a lazy sequence not a side effect? |
| 04:46 | SegFaultAX | dissipate: It is |
| 04:46 | dissipate | SegFaultAX, wtf. that's ridiculous. |
| 04:47 | lvh | dissipate: why is that ridiculous |
| 04:47 | dissipate | SegFaultAX, how can a core library function have side effects like that? the whole idea is to get rid of that. |
| 04:47 | dissipate | lvh, and is this caching done in STM? |
| 04:47 | SegFaultAX | Nope. |
| 04:48 | dissipate | i just don't see how this is consistent with the 'pure function' philosophy |
| 04:48 | lvh | dissipate: iteration functions losing referential transparency is a lot worse of a side effect than caching |
| 04:48 | SegFaultAX | The side effects are encapsulated. |
| 04:48 | SegFaultAX | It's similar to doing side effecting code in a transient for speed. |
| 04:48 | dissipate | SegFaultAX, what if i have one thread calling 'realized?' on a lazy seq at the same time i have a thread calling 'take x' on the lazy seq? |
| 04:49 | pyrtsa | dissipate: The caching is not done in STM but it *is* synchronized (see LazySeq.java if interested). |
| 04:50 | SegFaultAX | Yup |
| 04:50 | SegFaultAX | dissipate: In general, you don't need to worry about these things. |
| 04:51 | dissipate | pyrtsa, is there a version of lazy-seq that has no side effects? |
| 04:51 | pyrtsa | dissipate: You shouldn't write logic that causes side effects based on (realized? x). Only use realized? to check whether x *was* already realized. |
| 04:51 | SegFaultAX | lvh: Nice to see you on this side. :) Clojure is slowly pulling you away from Python. |
| 04:51 | lvh | SegFaultAX: soon I will be shipping 500MB uberjars that have clojure.core + jython in them |
| 04:51 | pyrtsa | dissipate: What would that even mean? Just make sure that the iteration only produces results. |
| 04:51 | pyrtsa | ...without causing side effects itself. |
| 04:51 | lvh | SegFaultAX: core.async is nice and all but twisted is still a few years ahead if you want to write protocols :) |
| 04:52 | dissipate | pyrtsa, what it would mean is that every time lazy-seq is iterated through, a brand new lazy-seq reference is created starting at the point where it left off |
| 04:53 | pyrtsa | dissipate: As long as you keep the same head, the lazy-seq is only evaluated once. |
| 04:53 | SegFaultAX | pyrtsa: A thunk is only evaluated once* |
| 04:53 | pyrtsa | Thanks for the correction. |
| 04:54 | dissipate | SegFaultAX, python and clojure are 2 different languages with different use cases IMO. |
| 04:54 | SegFaultAX | pyrtsa: Same head or not, it won't do unnecessary re-evaluation. |
| 04:54 | dissipate | SegFaultAX, i wouldn't use clojure as a scripting language because the JVM takes too long to start up, for instance. |
| 04:54 | SegFaultAX | dissipate: lvh is very well known in #python, I was commenting about that. |
| 04:54 | pyrtsa | SegFaultAX: Indeed. Only if you call the function that creates a lazy-seq repeatedly, will it evaluate multiple times. |
| 04:55 | pyrtsa | *repeatedly call the function |
| 04:56 | dissipate | SegFaultAX, i see. i'm actually trying to get away from ruby, python, perl for medium/large apps, and use clojure instead. |
| 04:56 | SegFaultAX | dissipate: You and me both. |
| 04:57 | SegFaultAX | I'm trying to get away from Python and Ruby in general. |
| 04:57 | alew | dissipate: if you want to write clojure scripts, you could have clojurescript that runs on node.js :P |
| 04:57 | dissipate | SegFaultAX, but i see myself still using python etc. for scripting |
| 04:57 | michel_slm | dissipate: hopefully soon you can use ClojureScript for that |
| 04:57 | SegFaultAX | About 30% of my work is ops, and for that Python is perfect. |
| 04:57 | dissipate | alew, that's true, hadn't thought of that. :P perhaps i can escape entirely. |
| 04:57 | alew | SegFaultAX: checked out pallet? |
| 04:57 | SegFaultAX | But for application development, I've lost my taste. |
| 04:57 | SegFaultAX | alew: Hah, no. |
| 04:57 | chare | Clojure > Python and you know it |
| 04:58 | dissipate | michel_slm, clojurescript has been ported to node.js? |
| 04:58 | SegFaultAX | alew: I looked at pallet about a year ago. I have no idea how people are building stuff with it. |
| 04:58 | alew | dissipate: as for caching, it's referentially transparent so it shouldn't violate the purity |
| 04:58 | SegFaultAX | The documentation is horrendous and the code isn't particularly good either. |
| 04:59 | alew | SegFaultAX: it's really confusing mostly due to the docs |
| 04:59 | dissipate | SegFaultAX, i lost my taste before i even got into clojure. OOP just doesn't smell right to me. it is actually quite awkward in practice, and not really reusable. |
| 04:59 | alew | SegFaultAX: I know at least a few clojure companies that are using it |
| 04:59 | michel_slm | dissipate: I believe the newest version is now more Node.js friendly |
| 04:59 | SegFaultAX | I heard it was undergoing a complete rewrite or something, but that was like over a year ago. |
| 04:59 | SegFaultAX | What ever, boto and ansible work great. |
| 04:59 | dissipate | SegFaultAX, it's all about Rust. :P |
| 04:59 | alew | SegFaultAX: maybe you are talking about 0.8? I don't know what they are doing for 0.9 or 1.0 even |
| 05:00 | michel_slm | dissipate: aha, yes, you can -- https://github.com/clojure/clojurescript/wiki/Quick-Start |
| 05:00 | SegFaultAX | dissipate: I have issues with some variations of OOP. I don't take issue with object orientation in the general sense. |
| 05:00 | dissipate | SegFaultAX, boto? that's good but for some reason it was really lacking for AWS Simple Workflow |
| 05:01 | SegFaultAX | dissipate: Use the CLI API for anything boto doesn't provide. |
| 05:01 | SegFaultAX | Or the admin if you want, but that's so ugly. |
| 05:02 | SegFaultAX | Wow is it 2a already? Sheesh |
| 05:02 | SegFaultAX | Night all. |
| 05:03 | dissipate | SegFaultAX, night |
| 05:07 | BartAdv | whoa, writing some recursive stuff in SQL. thinking all the time how datomic could ease my suffering ;) |
| 05:20 | anars | cemerick: pull request regarding the empty roles set is up as of yesterday. also with a few comments. just fyi :) |
| 05:48 | triyo | What are the key changes to Clojure since 1.3.0 release? I have an app that's been happily running 1.3 and I'm looking into if it's worth putting some time aside, sooner rather than later, to upgrade to latest stable release. |
| 05:50 | triyo | any links summarising this info would be useful. |
| 05:52 | dsrx | triyo: there's a changelog on the github repository https://github.com/clojure/clojure/blob/master/changes.md |
| 05:52 | triyo | dsrx: thanks started looking through that (history of changelog) |
| 05:57 | clgv | triyo: some very convenient threading macros: some->(>), cond->(>), as-> |
| 05:58 | triyo | clgv: thanks, just saw those; added in 1.5. Very cool. Personally love the -> and ->>. |
| 05:59 | triyo | What was the main purpose of adding the reduces over standard map/filter/reduce? |
| 06:00 | clgv | triyo: clojure.core.reducers you mean? |
| 06:00 | triyo | *reducers |
| 06:00 | triyo | yes, sorry, typo |
| 06:00 | clgv | triyo: if so, then the main goal is parallelization of those operations |
| 06:01 | dissipate | triyo, they were added so that you would have to learn more stuff |
| 06:01 | dsrx | hickey's got a good blog post about them here http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html |
| 06:01 | triyo | weren't there pmap, etc.? |
| 06:01 | triyo | dsrx: thanks for the link |
| 06:01 | clgv | triyo: you cant parallelize efficiently with those lazy-seq based approaches. hence reducers |
| 06:02 | clgv | triyo: that's because lazy-seqs are inherently sequentially |
| 06:04 | triyo | oh I see, that makes sense. |
| 06:04 | pyrtsa | Not just parallelization, also stream fusion, AFAIK. |
| 06:13 | triyo | sweet `reducers/fold` (parallelize reduction) |
| 07:15 | CookedGr1phon | Is there a way to temporarily set how many s.f. (or d.p. would do) a float will print for a given pr-str |
| 07:15 | CookedGr1phon | I have some long vectors of floats which are all 0.30000004 etc and so I only really need to see the 0.3, but as it is, it scrolls off the screen |
| 07:27 | koalallama | ,(format "%.2f" 3.14159) |
| 07:27 | clojurebot | "3.14" |
| 07:28 | pyrtsa | CookedGr1phon: clojure.core/pr (and thus, pr-str) uses clojure.core/print-method or clojure.core/print-dup depending whether *print-dup* is truthy. In both cases, when the value x is java.lang.Double, you'll get x.toString(). So no unless you can change the printing function, no formatting is possible. |
| 07:30 | CookedGr1phon | pyrtsa: I've done it before, so I know it's possible |
| 07:31 | CookedGr1phon | Just couldn't remember how |
| 07:31 | pyrtsa | See what koalallama wrote. |
| 07:33 | pyrtsa | CookedGr1phon: FYI, for both Double and Float (I don't know which you're actually using), 0.30000004 has a different internal representation than 0.3. That's why you don't see the rounding when converting to string. |
| 07:33 | pyrtsa | (Of course, neither 0.30000004 nor 0.3 are exactly representable as floating point numbers.) |
| 07:50 | CookedGr1phon | ah, this is all different for clojurescript |
| 07:51 | CookedGr1phon | need to extend protocol IPrintWithWriter |
| 07:52 | pyrtsa | Ah, of course. Nice to hear. :) |
| 07:56 | CookedGr1phon | doesn't seem to work if i extend that for floats |
| 08:03 | pyrtsa | CookedGr1phon: Just change the printing function, I'd say. Extending protocols that aren't your own for types that aren't yours is usually a bad idea. |
| 08:17 | CookedGr1phon | what do you mean change the printing function? |
| 08:18 | CookedGr1phon | I'm printing arbitrary data, some of which has floats, which might be nested as the values of maps inside vectors, I can't just map over this and print it myself |
| 08:54 | BartAdv | do you have some general tips how to find out why aot-compiled module gives InvalidArgumentException: argument type mismatch, whereas with aot turned off it runs just fine? |
| 08:54 | BartAdv | http://lpaste.net/3729188939110547456 |
| 09:00 | BartAdv | ok, nevermind, found the answer |
| 09:00 | AeroNotix | what are people using for Icinga? |
| 09:00 | gvickers | BartAdv: what was it? |
| 09:01 | BartAdv | https://github.com/clojure-android/neko/issues/23#issuecomment-37291111 |
| 09:12 | felher | hey Folks. Quick question: is there a default/standard logging library for clojure? A link to it would suffice :) |
| 09:12 | joegallo | clojure.tools.logging |
| 09:13 | joegallo | https://github.com/clojure/tools.logging |
| 09:13 | felher | joegallo: great, thank you :) |
| 09:13 | joegallo | you're welcome! |
| 09:51 | jlpeters | folks, should I be able to access session variables from within the repl within emacs (for debugging and such?). My process is to visit the file that requires noir.session, run C-c C-k to compile the file, then run C-c M-n to switch the repl to the right namespace. With that setup done (and the server started via the repl), should I be able to get and set |
| 09:51 | jlpeters | session values? |
| 10:05 | clgv | jlpeters: if those are stored in global "def"s (what noir did in most cases) then you should be able to access them |
| 10:09 | jlpeters | clgv: ok, I'll dig at it. I was getting casting errors which made me think I was missing a step somewhere Thanks! |
| 10:13 | felher | Another quick question: is https://github.com/bbatsov/clojure-style-guide a good resource for a beginner? Is it followed by most people? |
| 10:31 | gvickers | felher: I would say most of that is sound advice. I have seen most clojure code written in a similiar style. Although the necessity of that style guide is questionable, code seems to fall out like that anyway. |
| 10:34 | clgv | felher: well some rules in there are debatable |
| 10:36 | felher | Okay, thanks, to the both of you. :) |
| 10:37 | llasram | I really should fork that thing and update it for my team's style... |
| 10:37 | llasram | Except the last time I tried that, I had a huuuuge fight with a guy who wouldn't agree to any max column limit at all |
| 10:37 | llasram | s,that,something like that, |
| 10:38 | clgv | llasram: max-column-limit is always ones monitors width respective to the preferred font size ;) :P |
| 10:40 | llasram | I actually proposed we compromise and take the team median of that value, but this guy literally wouldn't accept any limit as being valid |
| 10:40 | llasram | And by "limit" I mean "general length to try to stay under, unless the code is harder to read unless you don't" |
| 10:40 | llasram | I'm not a monster :-) |
| 10:41 | szymanowski | hello, what would be the simplest way to overwrite the print-method dispatch function while keeping unchanged all methods? |
| 10:41 | llasram | szymanowski: print-method is a multimethod, so just extend it for a new type |
| 10:41 | llasram | Oh, you want to change the dispatch function |
| 10:41 | llasram | Huh |
| 10:41 | szymanowski | yes |
| 10:41 | szymanowski | i need it for some reason |
| 10:42 | llasram | haha |
| 10:42 | llasram | Any mode details on what you're trying to achieve? |
| 10:42 | szymanowski | certainly wrong reasons |
| 10:42 | llasram | s,mode,more, |
| 10:43 | clgv | llasram: ah that rule sounds not too bad with the ifs attached. well, some people just dont want to agree^^ |
| 10:43 | llasram | szymanowski: I ask because if you aren't aware, print-method dispatches via `type`, which you can override for IMeta's by having `:type` metadata: ##(type '^:example some-thing) |
| 10:43 | lazybot | ⇒ clojure.lang.Symbol |
| 10:43 | szymanowski | i've got this (with-meta {:a 1 :b2} {:type 'Foo}) and would like to add a custom print method on it |
| 10:43 | llasram | szymanowski: er, let's try again: ##(type '^{:type :example} some-thing) |
| 10:43 | lazybot | ⇒ clojure.lang.Symbol |
| 10:43 | llasram | ugh |
| 10:43 | szymanowski | the thing is my type is a symbol not a keyword |
| 10:44 | llasram | That's fine |
| 10:44 | szymanowski | so it dispatch on the class |
| 10:44 | llasram | Despite my failure to have a proper example |
| 10:44 | clgv | ,(type ^{:type :example} {:a 1}) |
| 10:44 | clojurebot | :example |
| 10:44 | szymanowski | PersistentHashMap or ArrayMap |
| 10:44 | llasram | clgv: Thank you :-) |
| 10:44 | clgv | ,(type ^{:type 'Foo} {:a 1}) |
| 10:44 | clojurebot | Foo |
| 10:44 | llasram | szymanowski: So there you go -- just extend print-method for the symbol `Foo` |
| 10:45 | clgv | ,(defmulti foo type) |
| 10:45 | clojurebot | #'sandbox/foo |
| 10:45 | clgv | ,(defmethod foo 'Bar [x] (println "Bar:" x)) |
| 10:45 | clojurebot | #<MultiFn clojure.lang.MultiFn@367342> |
| 10:45 | llasram | ,(type '^{:type :example} some-thing) |
| 10:45 | clojurebot | :example |
| 10:45 | llasram | &(type '^{:type :example} some-thing) |
| 10:45 | lazybot | ⇒ :example |
| 10:45 | llasram | Huh |
| 10:45 | llasram | what##(type '^{:type :example} some-thing) |
| 10:45 | lazybot | ⇒ clojure.lang.Symbol |
| 10:45 | llasram | !!!!! |
| 10:46 | clgv | ,(foo (with-meta {:a 1} {:type 'Bar})) |
| 10:46 | clojurebot | Bar: {:a 1}\n |
| 10:46 | llasram | Different evaluation processes for the lazybot's different way of giving it forms! |
| 10:46 | szymanowski | :) |
| 10:46 | szymanowski | thank you |
| 10:46 | clgv | llasram: patch it^^ |
| 10:47 | llasram | If I have the time |
| 10:47 | llasram | I'm trying to chill out a bit more right now. Was working too hard for several months and got a bit burned out |
| 10:50 | clgv | oh ok |
| 10:51 | szymanowski | i don't really understand your answer, i don't want to create a new multifunction for printing my stuff,I would like to do it via the print-method multi, but the current dispatch function for it use metadata :type only when it is a keyword else it defer to the class of the object, the thing is my object metadata :type is a symbol |
| 10:54 | llasram | Oh |
| 10:54 | szymanowski | can i just grab (methods print-method) , then redefine print-method multi with another dispatch fun and then re add the originals methods after? |
| 10:54 | llasram | szymanowski: I'm sorry, -- I thought you were just mistaken. I really didn't remember that limitation |
| 10:54 | llasram | That's very strange |
| 10:55 | llasram | I seriously thought it just used the `type` function to dispatch |
| 10:55 | llasram | Hmmm |
| 10:56 | szymanowski | is there something like (add-method my-multi a-function) ? |
| 10:58 | llasram | Kind of... Trying something |
| 10:59 | Anderkent | szymanowski: uh, other than (.addmethod my-multi a-function) ? |
| 10:59 | Anderkent | but that's pretty much the same as defmethod |
| 10:59 | szymanowski | ok I suppose this is what I need |
| 10:59 | Anderkent | it's equivalent to defmethod, sorry, need to read back to see what you actually want |
| 10:59 | szymanowski | ok |
| 11:03 | Anderkent | szymanowski: so, I wouldn't do this ever, but you could in theory chnage the dispatch function on existing multimethod via java reflection |
| 11:04 | szymanowski | reflexion is arcane to me |
| 11:04 | Anderkent | buuut I'd rather just wrap print-method with a function of your own that changes the metadata on the objects that interest you so that the :type is a keyword |
| 11:04 | szymanowski | reflection* |
| 11:04 | llasram | Anderkent: It's final, so that might result in madness |
| 11:05 | llasram | Here's a probably-equally-insane approach |
| 11:05 | Anderkent | llasram: .setAccessible! XP |
| 11:05 | Anderkent | oh and |
| 11:05 | Anderkent | modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); |
| 11:05 | Anderkent | xP |
| 11:05 | llasram | ,(defmulti print-method* (fn [x w] (type x))) |
| 11:05 | clojurebot | #'sandbox/print-method* |
| 11:05 | llasram | ,(doseq [[dv m] (.getMethodTable print-method)] (.addMethod print-method* dv m)) |
| 11:05 | clojurebot | nil |
| 11:05 | llasram | ,(doseq [[dv dvs] (.getPreferTable print-method), dv' dvs] (.preferMethod print-method* dv dv')) |
| 11:05 | clojurebot | nil |
| 11:06 | llasram | (.bindRoot #'print-method print-method*) |
| 11:06 | llasram | ,(.bindRoot #'print-method print-method*) |
| 11:06 | clojurebot | nil |
| 11:06 | llasram | ,^{:type 'Foo} {:anything :at-all} |
| 11:06 | clojurebot | {:anything :at-all} |
| 11:06 | llasram | ,(defmethod print-method 'Foo [x w] (.write w "<Foo on you>")) |
| 11:06 | clojurebot | #<MultiFn clojure.lang.MultiFn@cbab2> |
| 11:06 | llasram | ,^{:type 'Foo} {:anything :at-all} |
| 11:06 | clojurebot | <Foo on you> |
| 11:06 | llasram | Haha! |
| 11:06 | Anderkent | ;_; |
| 11:06 | szymanowski | great |
| 11:06 | Anderkent | ... |
| 11:07 | llasram | szymanowski: OOC, are you using Abracad? |
| 11:08 | clgv | ,1 |
| 11:08 | clojurebot | 1 |
| 11:08 | clgv | ,^{:type 'Foo} {:anything :at-all} |
| 11:08 | clojurebot | <Foo on you> |
| 11:08 | szymanowski | no i don't know Abracad |
| 11:08 | clgv | damn no separated sandboxes ;) |
| 11:09 | TimMc | clojurebot, why can't you be more like those scheme bots? |
| 11:09 | llasram | szymanowski: Just curious if that's where you were getting things with symbol `:type`s from |
| 11:09 | clojurebot | I don't understand. |
| 11:09 | clgv | szymanowski: my example showed you how to use the symbol |
| 11:10 | llasram | clgv: Huh? But it only works because I replaced print-method :-) |
| 11:11 | szymanowski | thank you again to all of you |
| 11:11 | clgv | llasram: what do you mean? |
| 11:11 | clgv | llasram: I just used a different multimethod for the example but showed dispatch for a symbol |
| 11:11 | llasram | Oh, I see |
| 11:12 | llasram | I misunderstand the referent of "my example" |
| 11:43 | gfredericks | augh now I think cider is doing (use 'clojure.repl) too |
| 11:45 | gtrak | gfredericks, cider has a lot of work to be done, come help! |
| 11:46 | gtrak | moving inlined code out is my jam. |
| 11:46 | gfredericks | but I don't know elisp |
| 11:46 | gtrak | me neither.. |
| 11:46 | gfredericks | I just found nrepl-repl-requires-sexp |
| 11:47 | gfredericks | which duplicates functionality in reply, but I guess reply isn't part of the cider setup |
| 11:47 | gtrak | we have cider-nrepl, and we're in the process of re-implementing a bunch of stuff in a pure clojure backend. At some point, when it's ready, it'll be a requirement. |
| 11:47 | gtrak | a collection of nrepl middlewares and ops |
| 11:48 | gtrak | at that point, we can delete a bunch of elisp |
| 11:48 | gtrak | https://github.com/clojure-emacs/cider-nrepl |
| 11:48 | gfredericks | will this be sharable by `lein repl`? |
| 11:49 | gtrak | yea, I made a lein plugin for it, I'm using it daily. |
| 11:50 | gtrak | mostly I started working on it b/c completion for CLJS is impossible otherwise. |
| 11:50 | gtrak | or impractical.. |
| 11:50 | gtrak | the inline code is unmaintainable. |
| 11:51 | gfredericks | yeah |
| 12:18 | gfredericks | fun problem: writing your :repl-options {:init (...)} code so that it composes under concatenation |
| 12:18 | gfredericks | I think ((comp last list) (do some) (init things)) might be the easiest way? |
| 12:19 | gfredericks | I guess there's no reason to return the last value at all |
| 12:19 | gfredericks | presumably nrepl ignores it |
| 12:22 | sdegutis | What's the use-case for higher-order Leiningen tasks? |
| 12:22 | sdegutis | My googling for it only brings up github-issues relating to it. |
| 12:25 | sdegutis | Is it mostly used for combining compilation tasks into a single one like `lein compile-everything`? |
| 12:28 | hyPiRion | sdegutis: to change profiles (with-profile), to reuse a lein shell (do) or to run with more perf/less memory overhead (trampoline) mostly |
| 12:35 | cbp | ,(macroexpand '(-> x ((f a b)))) |
| 12:35 | clojurebot | ((f a b) x) |
| 12:37 | xsyn | How do you patch a live system through the repl? |
| 12:37 | devn | jump into the namsepace, redefine a function |
| 12:39 | devn | lol at the topic btw |
| 12:39 | devn | "top analysts expect this to be followed by newer versions with still higher numbers" |
| 12:39 | devn | reminds me of the "maths" "look around you" |
| 12:39 | devn | mathematicians think there may be even larger numbers... |
| 12:40 | xsyn | devn: that's it? |
| 12:40 | devn | xsyn: i mean, you can do that. |
| 12:40 | xsyn | yeah, I thought it would have been more complicated |
| 12:40 | xsyn | good to know :) |
| 12:41 | pbostrom | xsyn: you can also connect your editor to the live system, if you want to try to keep your source in sync with the running system |
| 12:42 | xsyn | so, if I'm running a system via lein, how do I tell emacs to attach to that system, does lein keep a port open or is that something I need to configure? |
| 12:42 | technomancy | xsyn: typically you embed an nrepl server in your application |
| 12:43 | technomancy | it's just a library you can add to :dependencies |
| 12:44 | xsyn | thank you kindly |
| 12:45 | technomancy | devn: oh man |
| 12:45 | technomancy | I just saw "look around you" over the weekend |
| 12:45 | technomancy | good times |
| 12:45 | devn | haha, yes |
| 12:45 | devn | the second season is not nearly as good |
| 12:45 | technomancy | shame |
| 12:45 | technomancy | have you seen Moments of Wonder? |
| 12:45 | devn | no! |
| 12:46 | technomancy | it is a treasure |
| 12:46 | devn | added to my watchlist. |
| 12:46 | devn | favorite episode? |
| 12:46 | technomancy | I think the one on Time probably |
| 12:46 | devn | bahahaha, omg, okay im sold, just watched 2min |
| 12:47 | technomancy | but they're super short and there are only five |
| 12:47 | rasmusto | relevant http://www.youtube.com/watch?v=nyd1XzGMxOQ |
| 12:47 | devn | "it's not like money, you can't taste it." |
| 12:47 | devn | "so, what is clocks?" |
| 12:47 | technomancy | "it will always be an unknowable mystery, like why the seasons change, or how telephones work" |
| 12:47 | devn | bahahaha. i love the accent. |
| 12:49 | dnolen_ | noprompt: btw, are you actually pairing up Om + Garden? |
| 12:49 | noprompt | dnolen_: i've done a little bit w/ it but not much. |
| 12:49 | noprompt | dnolen_: thoughts? |
| 12:50 | TimMc | technomancy: The Look Around You DVD set is on my wishlist. |
| 12:50 | dnolen_ | noprompt: no, just wondered if you had something that worked for you. |
| 12:50 | noprompt | dnolen_: the clientside story for garden won't be compelling until there's and API for the CSSOM |
| 12:51 | dnolen_ | noprompt: i see |
| 12:51 | noprompt | dnolen_: i mean you can still generate inline styles with garden.core/style for complex CSS. |
| 12:52 | noprompt | dnolen_: but i really need help w/ the project. |
| 12:52 | dnolen_ | noprompt: what kind of help? |
| 12:53 | noprompt | dnolen_: ideas, code, improvements, etc. |
| 12:53 | dnolen_ | noprompt: ok the general kind :) I've been keeping my eye on it |
| 12:53 | noprompt | dnolen_: the big thing i want is to expose protocols instead of types and clean up the compiler so more advanced features can be added. |
| 12:54 | noprompt | dnolen_: duplicate code removal, etc. |
| 12:54 | noprompt | dnolen_: by all means if you have thoughts/suggestions please let me know. |
| 12:55 | noprompt | dnolen_: julian stepped up and patched the whole thing to support cljs. |
| 12:55 | noprompt | it was awesome. |
| 12:55 | noprompt | garden was also my first real clojure library so there's definitely some n00bish stuff happening in there. |
| 12:56 | noprompt | dnolen_: maybe i should open an issue that explains what my ideas are for the next version? |
| 12:57 | dnolen_ | noprompt: I usually find wiki design pages better for that sort of thing. |
| 12:57 | noprompt | dnolen_: ah, great idea. |
| 12:57 | noprompt | tonight i'll collect my thoughts and do that. |
| 12:58 | dnolen_ | noprompt: cool |
| 12:58 | dnolen_ | will check it out |
| 12:58 | noprompt | dnolen_: awesome! |
| 12:59 | noprompt | the big thing would be advice on how to design a better compiler. |
| 13:00 | noprompt | right now it takes two passes. |
| 13:02 | noprompt | dnolen_: i'm sure you'll have plenty of folks to chat w/ but i'll be a clojure west if you have time to chat then. |
| 13:02 | dnolen_ | noprompt: definitely |
| 13:04 | noprompt | dnolen_: honestly, my dream here is to have a unified system for frontend development. |
| 13:04 | noprompt | i think it's possible. |
| 13:18 | clgv | why do I need *print-dup* true in addition to *print-meta* true to get metadata annotations for symbols in printed output? |
| 13:18 | clgv | I do not care whether a PersistenArrayMap is used when reading that output back in, but I care whether metadata is restored as well |
| 13:20 | rasmusto | ~+> |
| 13:20 | clojurebot | Huh? |
| 13:21 | jjttjj | I'm trying to use seesaw with very little experence with Swing. I want to basically have a table with values that are constantly changing according to an incoming stream of (a lot) of data. is it fine to be pulling from a core.async channel and just re-rendering the whole table on each new incoming piece of info or is there a way to render invidual cells of the table? |
| 13:23 | pyrtsa | ,(binding [*print-meta* true] (pr-str (with-meta 'x {:tag :foo}))) |
| 13:23 | clojurebot | "^:foo x" |
| 13:23 | pyrtsa | clgv: ^ |
| 13:24 | clgv | well I use *print-meta* true |
| 13:25 | clgv | jjttjj: you probably will have to learn to write a custom table model since the one provided with seesaw.table might not meet your performance expectations |
| 13:25 | pyrtsa | ,(binding [*print-meta* true] (let [foo ^:foo 'x] (pr-str foo))) |
| 13:25 | clojurebot | "x" |
| 13:26 | jjttjj | clgv: thanks! sounds fun |
| 13:29 | clgv | pyrtsa: to be specific it is :type metadata on the symbol |
| 13:30 | pyrtsa | clgv: Are you sure you managed to attach the metadata? |
| 13:30 | clgv | ,(binding [*print-meta* true] (let [foo ^{:type :bla} 'x] (pr-str foo))) |
| 13:30 | clojurebot | "x" |
| 13:30 | pyrtsa | I'm saying adding metadata like that apparently fails for symbols. with-meta works. |
| 13:30 | pyrtsa | Don't know why. |
| 13:31 | pyrtsa | ,(binding [*print-meta* true] (let [foo (with-meta 'x {:type :bla})] (pr-str foo))) |
| 13:31 | clojurebot | "x" |
| 13:31 | pyrtsa | Argh. |
| 13:31 | clgv | pyrtsa: yeah I checked I have symbol with :type metadata in a map |
| 13:32 | rasmusto | ,(binding [*print-meta* true] (let [foo (with-meta {:not 'asymbol} {:type :bla})] (pr-str foo))) |
| 13:32 | clojurebot | "{:not asymbol}" |
| 13:32 | pyrtsa | clgv: Hmm, right. At least the print functions use the :type metadata if it's there. Didn't think they might strip it away, but that could explain. |
| 13:33 | pyrtsa | clgv: There: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj#L75-L76 |
| 13:34 | pyrtsa | So then, I guess the answer to the original question is: yes, you'll need to set *print-dup* to true if you want to have the :type metadata printed. |
| 13:38 | clgv | pyrtsa: humm I could fix it, since it does not need to be :type meta |
| 13:40 | k3ny | test.. |
| 13:41 | k3ny | test.. |
| 13:45 | RickInAtlanta | I was trying to see how the cljs.core.async.map function works, https://www.refheap.com/56399 I only get results 1,3 and 5. does anyone know what happened to 2 and 4? |
| 14:15 | amalloy | RickInAtlanta: (fn [& args] (apply str args)) is just str |
| 14:16 | cbp | what's an okish embedded database that i can use inside a clojurescript/node-webkit program |
| 14:17 | cbp | maybe i can use edn files |
| 14:17 | amalloy | RickInAtlanta: and while i've never actually written any core.async, i bet if you life the map out of the while, you'll get the results you want. that is, (go (let [c (map ...)] (while true (... (<! c))))) |
| 14:20 | RickInAtlanta | amalloy: Thanks, that worked |
| 14:21 | RickInAtlanta | amalloy: can you explain why it worked when I put the map into the let bindings? |
| 14:22 | amalloy | RickInAtlanta: well, it worked then because that's what you'd expect! instead, i'll explain why it didn't work in your original version |
| 14:22 | RickInAtlanta | or more specifically, why it didn't work when I called it directly in the go block |
| 14:22 | RickInAtlanta | :) |
| 14:22 | amalloy | when the map was inside the while, you were creating a new mapped channel in each iteration of the while loop |
| 14:23 | RickInAtlanta | DOH |
| 14:23 | RickInAtlanta | makes total sense now! |
| 14:23 | RickInAtlanta | thanks a ton |
| 14:23 | amalloy | core.async: reintroducing us to mutability problems we've forgotten how to deal with |
| 14:24 | RickInAtlanta | Yeah, you helped me fix not just that error, but the next 25 errors I won't get, because I will think about the channel's lifetime |
| 14:28 | bbloom_ | (doc into-array) ; "type of the first value". ouch. |
| 14:28 | clojurebot | "([aseq] [type aseq]); Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE." |
| 14:30 | amalloy | bbloom_: as opposed to what? walking over the array to find the least general type that can hold them all? |
| 14:30 | bbloom_ | i assumed (into-array coll) was the same as (object-array coll) |
| 14:31 | bbloom_ | been using it wrong for quite a while & probably have some subtle bugs around.... |
| 14:32 | amalloy | bbloom_: i can certainly understand making silly assumptions (i do so all the time), but of course if that were true there'd be no reason for into-array to exists |
| 14:33 | hadronzoo_ | What is the best way to pause a thread indefinitely? |
| 14:33 | amalloy | unplug your computer |
| 14:33 | bbloom_ | amalloy: well the two-arity overload makes lots of sense... seemed reasonable to assume that the 1-arg overload delegated to the two-arg one... i just didn't expect it to effectively GUESS |
| 14:33 | bbloom_ | i can see how that might be useful, but shit, burned me :-P |
| 14:36 | cbp | how do i use ex-info in clojurescript? |
| 14:36 | cbp | it doesn't seem to use the info map at all |
| 14:36 | amalloy | yeah, i suppose that's true. into-array's one-arg version is rarely useful |
| 14:36 | cbp | or gives me weird errors |
| 14:36 | amalloy | mostly it's only good for making String[]s |
| 14:38 | cbp | errors such as "has no method 'call'" |
| 14:39 | amalloy | cbp: paste a real error message |
| 14:41 | cbp | amalloy: err sorry my mistake. I was missing the throw |
| 15:01 | Pate_ | Are there any large open source eCommerce systems currently being built in Clojure? |
| 15:02 | stuartsierra | Pate_: Yes, but I can't talk about them. :) |
| 15:04 | stuartsierra | Actually, here's one I can talk about: http://techcrunch.com/2013/10/02/staples-buys-runa-to-square-up-to-amazon-in-the-e-commerce-game-for-office-supplies/ |
| 15:04 | Pate_ | Clojure+Datomic seems like a great platform to build an open source eCommerce platform on and offer commercial support/plugins. |
| 15:04 | stuartsierra | Oh, you said open-source. |
| 15:06 | stuartsierra | I'm not aware of any open-source "platform" projects, but plenty of companies are building eCommerce systems with Clojure and/or Datomic. |
| 15:07 | Pate_ | Is Runa built in Clojure? |
| 15:10 | stuartsierra | yes |
| 15:11 | Pate_ | cool, (reading up on it). Runa's 20 odd peeps are now Staples Innovation Lab. |
| 15:11 | Pate_ | Were you involved with that stuartsierra? |
| 15:22 | Frozenlock | Is there an equivalent of `map-indexed' for `for'? Or should I just use `range' like shown here http://clojuredocs.org/clojure_core/clojure.core/for#example_962? |
| 15:24 | TimMc | Hah, runa's jobs website is *still* malware-infested. |
| 15:30 | apetastic | anyone with experience using jax-ws with annotations in clojure? i've been able to get a web service up and running by using deftype in the vein of this: https://github.com/clojurebook/ClojureProgramming/blob/master/ch09-annotations/src/main/clojure/com/clojurebook/annotations/jaxws.clj but i'd like to expand on it and hang a @Resource annotation to get the WebServiceContext to do some basic auth and header manipulation |
| 15:32 | amalloy | Frozenlock: use range, or even use map-indexed if you want: (for [[i x] (map-indexed vector xs)] ...) |
| 15:33 | Frozenlock | amalloy: thanks |
| 15:44 | Anderkent | oh hey 1.6.0-RC1 is out? Should totally be the topic |
| 16:06 | jowag | Can anyb please give me a concrete example of where the java equals is broken wrt. to Clojure's equiv? |
| 16:08 | pyrtsa | ,(.equals 1.0 (float 1.0)) |
| 16:08 | clojurebot | false |
| 16:08 | pyrtsa | ,(== 1.0 (float 1.0)) |
| 16:08 | clojurebot | true |
| 16:08 | pyrtsa | ,(= 1.0 (float 1.0)) |
| 16:08 | clojurebot | true |
| 16:10 | S11001001 | ,(.equals nil "42") |
| 16:10 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 16:11 | borkdude | How do I get a value from a cursor, so I can use it in a normal function, in Om? |
| 16:12 | indure | I am having the same problem described here https://groups.google.com/forum/#!msg/clojure/asEXM2uHyxw/aK4rrKOKs1YJ |
| 16:14 | indure | any thoughts on whats going on? |
| 16:15 | borkdude | got it, om/value |
| 16:17 | gfredericks | indure: my guess is the var version uses reflection, which picks the first method it finds at runtime |
| 16:17 | gfredericks | I don't think the inconsistency is a good thing |
| 16:17 | gfredericks | probably they should both error |
| 16:17 | gfredericks | there might be a ticket for this? |
| 16:18 | pyrtsa | indure: For getting rid of the actual problem, you should just add type hints, e.g.: (.submit ^ExecutorService pool ^Runnable f) |
| 16:23 | jowag | pyrtsa: thank you, so it is mainly an issue with numerics? |
| 16:23 | indure | gfredericks: thanks. I'll check if there's a ticket |
| 16:23 | indure | pyrtsa: will do |
| 16:24 | jowag | (inc pyrtsa) |
| 16:24 | lazybot | ⇒ 3 |
| 16:26 | pyrtsa | jowag: Numbers, collections and nil come to my mind first. To be honest, I'm not completely satisfied by the way Clojure treats equality and inequality either. But it's certainly better than in Java. |
| 16:31 | amalloy | for an example of where clojure's equality semantics are too permissive: ##(map (memoize pop) '((1 2 3) [1 2 3] (1 2 3))) |
| 16:31 | lazybot | ⇒ ((2 3) (2 3) (2 3)) |
| 16:32 | amalloy | in case it's not clear: (pop [1 2 3]) should return [1 2], not (2 3), but memoize sees that [1 2 3] is equal to (1 2 3) and returns the cached result |
| 16:32 | gfredericks | amalloy: "too permissive" meaning you have a specific idea for how = should behave differently? |
| 16:32 | pyrtsa | Good one! |
| 16:33 | amalloy | gfredericks: not really. just that the equality model has effects that are definitely surprising |
| 16:34 | gfredericks | roger |
| 16:34 | amalloy | haskell's approach is viable, in that you can't even ask whether two objects of different type are equal, but it wouldn't work at all in clojure |
| 16:34 | gfredericks | who wants to make a dependently typed clojure |
| 16:34 | pyrtsa | amalloy: Actually, pop should be two functions, pop-last for vectors and pop-first for lists. |
| 16:35 | amalloy | pyrtsa: i mean, i disagree, but even if we take that as a given, what about conj? |
| 16:35 | pyrtsa | Likewise. |
| 16:35 | tbaldridge | I'd love to have used the Haskell approach in school "are 1 and 1.1 equal" me: "you aren't allowed to ask me that question" |
| 16:35 | amalloy | assoc? lots of things dispatch differently across types that clojure considers equal |
| 16:36 | pyrtsa | Yeah, I know. The list goes on and on. But AFAICT, that would fix the problem with sequence equality. |
| 16:36 | amalloy | pyrtsa: that's basically advocating removal of polymorphism. cure seems a lot worse than the disease |
| 16:37 | pyrtsa | Ugh, I guess you're right. |
| 16:37 | tbaldridge | agreed, the whole idea that things that are equal must act exactly the same, makes no sense to me. |
| 16:37 | steckerhalter | how do find out why I get a stackoverflow after a few minutes? |
| 16:37 | gfredericks | Clojure is a monomorphic, concretely typed, single-threaded, one-variable language with message-passing nulls. |
| 16:38 | indure | pyrtsa: hints didn't help - still getting same issue |
| 16:39 | steckerhalter | I'm downloading xmls, parse them and write them to files. and it fails with a stackoverflow after it has been running for some time |
| 16:39 | pyrtsa | Btw, I'm stunned stunned that (compare [1 1 1] [1 2]) returns 1 in Clojure. If the implementation had been "compare lexicographically, like strings", inequalities could be extended to lists too. And order by length is almost never what you want. |
| 16:39 | tbaldridge | steckerhalter: perhaps one of you xml file is really deep? |
| 16:40 | steckerhalter | tbaldridge: no, they're pretty short |
| 16:40 | tbaldridge | steckerhalter: most of the time stack overflows are pretty easy to debug if you look at the pattern of the overflow. |
| 16:40 | pyrtsa | indure: Can you paste the source code and the error you're seeing somewhere online? |
| 16:40 | ToBeReplaced | tbaldridge: maybe (= 1 1.0) should be nil? |
| 16:40 | tbaldridge | there will normally be a cycle between a few functions, follow that path of execution. |
| 16:41 | steckerhalter | tbaldridge: ok, I will try |
| 16:45 | indure | pyrtsa: http://padfly.com/3323443344 |
| 16:49 | pyrtsa | indure: Unfortunately, the ^Runnable tag won't stick to `#()` for reasons beyond my current knowledge. If you use (let [... f #()] (.submit pool ^Runnable f)) it will work okay. |
| 16:50 | indure | hm..strange - trying ... |
| 16:51 | tbaldridge | does it stick to (fn...)? |
| 16:51 | pyrtsa | I don't think it does. |
| 16:51 | pyrtsa | It doesn't. |
| 16:52 | indure | it doesnt |
| 16:52 | indure | I am losing confidence now |
| 16:52 | tbaldridge | I've experience this issue before. |
| 16:53 | tbaldridge | try moving .submit into a pool |
| 16:53 | tbaldridge | bleh, moving submit into a defn |
| 16:53 | tbaldridge | then type hint the args to the defn |
| 16:54 | pyrtsa | tbaldridge: That does definitely work. It's just another way to use symbols for the arguments, and to thus be able to type annotate the symbols in source. |
| 16:55 | pyrtsa | (let [pool ..., f ...] (.submit ^ExecutorService pool ^Runnable f)) is what I usually use. |
| 16:55 | tbaldridge | yeah that works too |
| 16:56 | pyrtsa | Being able to do Java interop is definitely Clojure's big upside. But not its second nature. |
| 16:56 | pyrtsa | (And shouldn't be.) |
| 17:08 | TravisD | how much of an impact do type tags actually have on performance? Do you get runtime error if a value of unexpected type is passed in? |
| 17:09 | TravisD | (I mean in clojure code, not calling java) |
| 17:16 | stuartsierra | Type tags are *only* there to prevent reflective method calls. They are neither coercions nor assertions. |
| 17:22 | splunk_ | TravisD: check out https://github.com/clojure/core.typed if you're interested in static type checking |
| 17:23 | TravisD | Ah, I see. So there isn't any performance benefit? |
| 17:23 | TravisD | like, if I have some functions that are working on ints, and I tag them as such, they won't end up being java primitives or whateveR? |
| 17:27 | splunk_ | it's a bit more involved than that to work with primtiives |
| 17:27 | splunk_ | http://clojure.org/java_interop#Java%20Interop-Support%20for%20Java%20Primitives |
| 17:30 | splunk_ | there's also a section on it in http://www.clojurebook.com/ |
| 17:30 | TravisD | cool, thanks |
| 17:51 | Profpatsch | Why won’t recur bow to my will: http://i.imgur.com/FAn9tRV.jpg ?! |
| 17:51 | Profpatsch | Can’t recur at line … |
| 17:51 | llasram | Profpatsch: Because you're posting images instead of using rehfeap :-p |
| 17:52 | Profpatsch | Yeah, sorry. :P |
| 17:53 | Profpatsch | https://www.refheap.com/56584 Here ya go. |
| 17:54 | Profpatsch | I don’t see why this wouldn’t work. |
| 17:56 | Frozenlo` | Github down o_O |
| 17:56 | Anderkent | eh, probably is confused by go's state machine |
| 17:56 | Profpatsch | oO |
| 17:56 | Profpatsch | You mean a compiler error? |
| 17:57 | amalloy | well, an error in the go transformation macros? that certainly looks like it *should* expand into something in tail position |
| 17:57 | Profpatsch | Ooooh, it worked once I re-evalled the whole file. |
| 17:57 | Profpatsch | No idea. |
| 17:57 | Anderkent | wait what |
| 17:58 | Profpatsch | I think open-close-ui was a very old version, too, so I made it a stub. Maybe that was it. |
| 17:59 | Anderkent | (defn foo [x] (go (if (pos? x) (recur (dec x)) x))) fails for me |
| 17:59 | Anderkent | the exception comes from ioc macros too, rather than compiler |
| 18:00 | Cr8 | (go-loop is shorthand for (go (loop |
| 18:00 | Cr8 | recur is fine inside a go, it just can't *cross* a go |
| 18:03 | PinkPrincess | ,(map (fn [f] (f 1 2)) ((juxt juxt juxt) + -)) |
| 18:03 | clojurebot | ([3 -1] [3 -1]) |
| 18:03 | PinkPrincess | Imagine explaining the meaning of (juxt juxt juxt) to your mother. |
| 18:04 | mdeboard | PinkPrincess: Can you break down what's happening there |
| 18:04 | mdeboard | pls |
| 18:05 | gtrak | imagine explaining it to myself... :-) |
| 18:05 | mdeboard | gooby pls |
| 18:06 | PinkPrincess | Well... ((juxt juxt juxt) + -) returns two functions (of variable arguments) that will apply + and - to their arguments. I then map a function onto this sequence that'll call the "apply +" and "apply -" functions with the arguments 1 and 2. |
| 18:06 | PinkPrincess | But that may or may not make sense mostly in my own head. |
| 18:06 | amalloy | Anderkent: (fn [] (go (recur))) is clearly no good |
| 18:06 | danielszmulewicz | github crashed hard here. Anyone else noticed? |
| 18:06 | mdeboard | danielszmulewicz: yep |
| 18:06 | amalloy | you can't recur to the top of the function, you have to stay inside the go |
| 18:06 | mdeboard | danielszmulewicz: been about a half hour or so |
| 18:06 | danielszmulewicz | right. |
| 18:07 | AeroNotix | status.github.com |
| 18:07 | Anderkent | ah, sorry; didn't see it was go-loop rather than go |
| 18:09 | amalloy | status.github.com is so reliable. they should just host main github services there |
| 18:10 | AeroNotix | amalloy: alol |
| 18:11 | gtrak | i like how the octocat is red |
| 18:11 | gtrak | time well spent |
| 18:11 | danielszmulewicz | amalloy: lol |
| 18:11 | danielszmulewicz | gf3: ping |
| 18:12 | stuartsierra | Profpatsch: There have been some bugs with the `go` macro transformations and other macros such as -> |
| 18:12 | hyPiRion | amalloy: wasn't that like an actual, serious hacker news comment last time they were down? |
| 18:12 | amalloy | hyPiRion: probably. i certainly didn't come up with it myself |
| 18:13 | stuartsierra | hyPiRion: I saw it on a hacker news parody twitter account. |
| 18:13 | amalloy | actually i do wonder what the uptime of status.github.com is. is it actually 100%, or does it go down sometimes and nobody notices because it's not when github is down? |
| 18:13 | amalloy | yeah, https://twitter.com/shit_hn_says/status/421116237792284672 |
| 18:15 | mr-foobar | Hi all, toying with om. It seems om's dom utils, does not have dom/input element. not sure why ... |
| 18:15 | hyPiRion | stuartsierra, amalloy: It's a reference to https://news.ycombinator.com/item?id=7027040 |
| 18:16 | hyPiRion | I don't know why I bothered to search that up |
| 18:17 | Profpatsch | stuartsierra: I guess the Clojure devs are human, too. :) |
| 18:17 | Profpatsch | Is there a good solution for waiting on document.readyState without using jquery in Clojurescript? |
| 18:20 | stuartsierra | Profpatsch: And core.async is still alpha. Channels are pretty stable, but the `go` macro still has bugs to be worked out. |
| 18:20 | mr-foobar | Profpatsch: put script tag at end of the body ? |
| 18:20 | Profpatsch | mr-foobar: Is that enough to make it work in every case? |
| 18:20 | harmspam | Profpatsch: (.addEventListener js/window "DOMContentLoaded" handler) |
| 18:21 | Profpatsch | What about readystatechange? |
| 18:22 | mr-foobar | Profpatsch: by the time the browser reaches the end of body, the dom is already there ... so you are good to go I think |
| 18:23 | pbostrom | mr-foobar: om does have an input element |
| 18:23 | Profpatsch | mr-foobar: Thanks, that worked. |
| 18:26 | mr-foobar | pbostrom: my bad. f'ed up. I was seeing https://github.com/swannodette/om/blob/master/src/om/dom.clj and I couldn't find input, so got confused ... |
| 18:27 | pbostrom | yeah, I think since input and other cannot have children they are not included in the macro file |
| 18:29 | mr-foobar | pbostrom: i was missing nil, (div/form div/input #js {.... |
| 19:03 | Profpatsch | Is there something like clojure-toolbox.com for cljs? |
| 19:03 | TimMc | amalloy: I've seen status.github.com go down. |
| 19:16 | turbopape | hi people; I am try to loop recur over a map, but when I put a (dissoc map key) in the recur form, it seem to not change anything in the next loop iteration... |
| 19:16 | turbopape | any one can assist ? |
| 19:17 | hiredman | ,(doc dissoc) |
| 19:17 | clojurebot | "([map] [map key] [map key & ks]); dissoc[iate]. Returns a new map of the same (hashed/sorted) type, that does not contain a mapping for key(s)." |
| 19:17 | hiredman | returns a new map |
| 19:18 | qbg | turbopape: code? |
| 19:18 | turbopape | ok |
| 19:18 | stuartsierra | Anyone ever seen `lein trampoline repl` cause "OutOfMemoryError: PermGen" when `lein repl` works fine? |
| 19:18 | turbopape | where can I post it ? |
| 19:18 | bob2 | turbopape, remember you can't alter a map, just create a new map that differs in some way |
| 19:18 | bob2 | turbopape, refheap.com |
| 19:21 | turbopape | here it is guys, |
| 19:21 | turbopape | https://www.refheap.com/56627 |
| 19:21 | turbopape | thanks for help ... |
| 19:22 | turbopape | yeah bob2 , I'm totally aware... |
| 19:22 | bob2 | what's in the map? |
| 19:23 | turbopape | something like { :k1 1 :k2 2...} |
| 19:23 | qbg | key is going to be a seq |
| 19:23 | bob2 | from that code perhaps you want (map ) instead |
| 19:23 | qbg | ,(take 1 [1 2 3]) |
| 19:23 | clojurebot | (1) |
| 19:23 | qbg | that isn't what you want |
| 19:23 | turbopape | okay, |
| 19:23 | bob2 | since you're just doing a thing to every key and returning an aggregate thing |
| 19:24 | turbopape | ok, but If I don't do a loop, I won't be able to get the aggrefate thing (result) |
| 19:24 | turbopape | If I map, I'll have the result for each key at a time... |
| 19:25 | qbg | ,(let [keys [:a :b :c]] (zipmap keys (map (fn [_] "whatever") keys))) |
| 19:25 | clojurebot | {:c "whatever", :b "whatever", :a "whatever"} |
| 19:25 | turbopape | no actullay result is not just a plain zipmap ... I just simplified it here for the sake of the example |
| 19:26 | turbopape | I really need the loop to work plz :) |
| 19:26 | turbopape | I actually call a function depending on each key and recalling it on the result each time... |
| 19:26 | qbg | ,(reduce (fn [m k] (assoc m k "whatever")) {} [:a :b :c]) |
| 19:26 | clojurebot | {:c "whatever", :b "whatever", :a "whatever"} |
| 19:27 | turbopape | yes qpg, thank you, but result isn't relevant here... I don't want the result, I want the loop plz :) |
| 19:27 | qbg | ,(loop [remaining {:a 1, :b 2, :c 3} res {}] (let [key (first (keys remaining))] (if key (recur (dissoc remaining key) (assoc res key "whatever")) res))) |
| 19:27 | clojurebot | {:b "whatever", :c "whatever", :a "whatever"} |
| 19:28 | turbopape | plz have a look on the new https://www.refheap.com/56627 |
| 19:28 | turbopape | ok , thank you qbg :) |
| 19:29 | qbg | still could use reduce with your updated refheap |
| 19:29 | turbopape | yeah, maybe reduce after all... |
| 19:30 | turbopape | Thank you anyway, I sure owe you a lot in my path of enlightenment :) |
| 19:33 | turbopape | absolutely. Reduce ! |
| 19:41 | mischov | Does anybody have any good resources on packaging javascript libs like react-cljs does? Trying to understand what is going on there. |
| 19:53 | TravisD | Can someone suggest a resource on zippers? Partly I'd like a tutorial but I'm also interested in how they work |
| 19:55 | amalloy | TravisD: http://en.wikipedia.org/wiki/Zipper_(data_structure) http://stackoverflow.com/questions/380438/what-is-the-zipper-data-structure-and-should-i-be-using-it |
| 19:55 | technomancy | wasn't there a conj talk on zippers a while back? |
| 19:55 | TravisD | amalloy: Great, thanks :) I suppose I should have checked Wikipedia. |
| 19:58 | TravisD | Hm, so in the list example, they have to reverse the list of elements to be added after the location in order to have efficient operations. Are there similar issues with trees? |
| 19:59 | Frozenlock | Is there a way to make cljsbuild only build a single `build' when using "lein cljsbuild test" ? |
| 20:00 | TravisD | Also, this business about types looking like polynomials and zippers being formal derivatives is pretty fascinating |
| 20:05 | amalloy | TravisD: well, "have to" reverse elements...it's just a different choice of representation |
| 20:05 | amalloy | just like when you make a queue out of two linked lists by reversing one of them |
| 20:06 | TravisD | Ah, yeah |
| 20:06 | TravisD | I am reading http://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf |
| 20:51 | camelCaseIsUgly | I have what is probably a dumb question: I have a lein project with two files under src/name-of-project- core.clj and view.clj. How can I load core.clj into view.clj? I've true doing (ns view.clj (:use core.clj)) but that raises a FileNotFoundException. I'm guessing there's something I don't understand about java's classpath. Can anyone help me out? |
| 20:52 | gfredericks | you want src/project/core.clj and src/project/view.clj |
| 20:53 | gfredericks | then (ns project.core) and (ns project.view (:use project.core)) |
| 20:54 | camelCaseIsUgly | yep, that works. Thank you! |
| 20:59 | Profpatsch | oO, I can’t do (apply recur [thing1 thing2 thing3]) |
| 20:59 | Profpatsch | Recur is seen as Var in my namespace. oO |
| 21:06 | TravisD_ | Profpatsch: I think the issue is that recur is not a function, it is a special form |
| 21:06 | Profpatsch | TravisD_: Can you think of a way to do this? |
| 21:06 | Profpatsch | Hm, an unquote splice is not an option in Clojurescript code. |
| 21:06 | TravisD_ | You could use destructuring: (let [ [a b c] [thing1 thing2 think3] ] (recur a b c)) |
| 21:06 | Profpatsch | But not with arbitrary lists. |
| 21:06 | Profpatsch | Hm, wait. |
| 21:06 | Profpatsch | That wouldn’t make sense with recur anyway. |
| 21:06 | TravisD_ | Profpatsch: Yeah, I think that is true |
| 21:06 | Profpatsch | Whoa, I *can* do an unquote splice in cljs functions? |
| 21:06 | bufferloss | does the (. Math pow arg1 arg2...) syntax work for "regular" clojure libs? i.e. not specifically java only libs, like clojure.java.jdbc ? |
| 21:11 | Profpatsch | bufferloss: If you mean backend-agnostic, then no. |
| 21:11 | bufferloss | not sure what backend-agnostic means, so... not sure? |
| 21:11 | bufferloss | Profpatsch, I'm not using e.g. clojurescript if that's what you are referring to |
| 21:11 | bufferloss | currently it's fairly "plain" clojure code |
| 21:12 | Profpatsch | Because you said not Java only libs. |
| 21:12 | Profpatsch | Everything is Clojure is kind of „Java only“ as long as you are on the JVM. |
| 21:13 | Profpatsch | Every JVM language can access every JVM library. |
| 21:13 | Profpatsch | If I’m not mistaken. |
| 21:13 | bufferloss | well I mean, that as far as I'm aware, clojure.java.jdbc won't exactly "run" in a regular Java program, that is to say, Clojure works with Java but Java doesn't really "work" with clojure (to my knowlege anyway) |
| 21:14 | bufferloss | so just wondering if clojure libs, being written in clojure I would presume work differently than Java libs "written for java" |
| 21:14 | Profpatsch | You can call Clojure constructs from Java. |
| 21:14 | Profpatsch | It’s not nice (what is), but you definitely can. |
| 21:15 | Profpatsch | Well, I guess jdbc interfaces with native (C/C++) libraries. |
| 21:16 | Profpatsch | But with Java and Clojure you stay on the JVM, so you can call everything available on the JVM. |
| 21:16 | bufferloss | k |
| 21:16 | bufferloss | so the clojure.java.jdbc has nothing clojure specific in it? |
| 21:16 | bufferloss | no features that I can use from clojure but not from java? |
| 21:16 | Profpatsch | Ah, that’s where you’re coming from. |
| 21:18 | Profpatsch | I haven’t used the clojure jdbc interface yet, so I don’t know. |
| 21:18 | Profpatsch | JDBC itself is just an API-Definition. |
| 21:19 | Profpatsch | That specifies how to access (relational) databases with Java. |
| 21:20 | Profpatsch | So to be compatible clojure JDBC has to comply with that API. But I guess they do use quite a bit of syntactic sugar. |
| 21:21 | bufferloss | also, like, I wouldn't likely expect to be able to just be writing regular Java and at a whim, mix the syntax of clojure on random lines into my Java program - the syntaxes are fundamentally different and, effectively, not "compatible" per se |
| 21:21 | bufferloss | so I was wondering if there was maybe some restriction on clojure libs being called, but it sounds like there probably isn't |
| 21:22 | bufferloss | and I should just go try it and see anyway |
| 21:22 | Profpatsch | No, especially the dynamic part of Clojure doesn’t play well with Java (lots of object casting necessary). |
| 21:22 | Profpatsch | What are you trying to do anyway? |
| 21:23 | Profpatsch | It sounds like you want to incorporate Clojure in a Java project. |
| 21:25 | bufferloss | nope, I want to stay as far away from Java itself as possible :P |
| 21:26 | bufferloss | also I'm not really doing anything special in reference to my original question, it was more of a syntax curiosity |
| 21:27 | bufferloss | what I am about to be doing is dealing with e.g. writing a record to a Postgres database with a separate date column and a separate time column |
| 21:27 | bufferloss | not sure how that's going to work in Clojure, but I've done it before in Java so actually I suppose it won't be much different |
| 21:27 | Profpatsch | jdbc Clojure is a very low-level wrapper around the Java stuff. |
| 21:27 | bufferloss | btw, what is an #inst() when it refers to some type of date object |
| 21:28 | bufferloss | cuz that's the default type that comes out of the database for both date and time columns |
| 21:28 | bufferloss | (using jdbc) |
| 21:28 | Profpatsch | If you go ti https://github.com/clojure/java.jdbc the first thing they recommend is to use a higher level wrapper to ease the pain. |
| 21:30 | Profpatsch | Korma looks useable http://sqlkorma.com/ . |
| 21:31 | gfredericks | bufferloss: #inst is probably just how the thing is printing; use clojure.core/class to find out what it actually is |
| 21:31 | gfredericks | #inst is not type-specific |
| 21:32 | Profpatsch | It’s like that with most Java libraries: Only because the Java world uses the same stuff they have for ten years there are way friendlier solutions in Clojure. |
| 21:32 | Profpatsch | That don’t make you scream in agony. |
| 21:34 | bufferloss | ok |
| 21:35 | bufferloss | yeah jdbc is painful :( |
| 21:35 | bufferloss | but, also fast |
| 21:35 | bufferloss | I guess, I mean about as fast as you can get in Java I would suppose |
| 21:36 | bufferloss | also, I tried grenchman yesterday, but got an error both times, the first time it said I had to run lein repl :headless from outside of my project root, which I did, and grenchman still failed to work with `grench lein run` |
| 21:38 | bufferloss | oh yeah, when I run: `lein repl :headless` outside of my project root and then attempt to `grench lein run` from *within* my project root I get "java.lang.Exception: Error loading project.clj" |
| 21:39 | Profpatsch | Wasn’t grenchman written in Ocaml? |
| 21:39 | bufferloss | I have no idea |
| 21:39 | bufferloss | why? |
| 21:39 | brehaut | yes |
| 21:39 | clojurebot | why is the ram gone |
| 21:39 | bufferloss | lol |
| 21:40 | Profpatsch | That was kind of a hurdle for me b/c on Arch it requires sever hundred MB of dependencies. |
| 21:40 | xuser | clojurebot: because java |
| 21:40 | clojurebot | Huh? |
| 21:40 | xuser | clojurebot: right |
| 21:40 | clojurebot | Pardon? |
| 21:40 | xuser | clojurebot: no |
| 21:40 | clojurebot | no is tufflax: there was a question somewhere in there, the answer |
| 21:40 | bufferloss | ok, so now I get "Unknown status:19namespace-not-found" |
| 21:41 | Profpatsch | But I have to say that I don’t really need Clojure to boot that fast, since I seldomly start a clj process. |
| 21:41 | Profpatsch | Normally you fire up your repl and that’s that for one productive session. |
| 21:42 | Profpatsch | Lighttable does it in the background so you don’t even have to think about stuff. |
| 21:44 | Profpatsch | For Clojurescript theres a Debian VM running with Vagrant, cljsbuild and a python server serving it inside tmux. |
| 21:45 | Profpatsch | So on finishing development just save VM to disk and start everything up again running next time. |
| 21:48 | bufferloss | woot, grenchman works finally, sweet |
| 21:49 | bufferloss | well, I happen to be working in a method/paradigm in which I am consistently/constantly invoking and re-invoking my current project from the command line |
| 21:50 | bufferloss | in the future I may build a web interface to trigger the run, but it's really a "science" type app that has no particular need of any such web frontend, only need of much crunching, very numbers, so maths |
| 21:50 | Profpatsch | So why not do that from the repl? |
| 21:50 | bufferloss | cuz it's not a text editor |
| 21:51 | Profpatsch | So why not write a function that reloads the file from the repl? |
| 21:51 | ddellacosta | bufferloss: can't you pull in whatever data you need via functions, and just re-run the thing in the repl? |
| 21:51 | ddellacosta | or, what Profpatsch said ^ |
| 21:51 | bufferloss | Profpatsch, hmm, that might work |
| 21:51 | Profpatsch | It’s like, two lines. |
| 21:52 | bufferloss | I'm like, pretty noob to clojure, and I have a limited time to hack after my other coding day job, so... suffice it to say I haven't investigated many of the "finer points", though I'm quite interested in said finer points of clojure development |
| 21:52 | bufferloss | my next goal mainly is to learn more about how to structure my code properly into namespaces/packages/whatever-theyre-called |
| 21:52 | Profpatsch | (defn run-maths [config-file] …) |
| 21:53 | ddellacosta | bufferloss: making the repl central to your workflow definitely helps--I was doing the same thing as you with testing for a while until I learned my lesson. |
| 21:53 | bufferloss | ddellacosta, well, grench has just sped that up by a ton |
| 21:53 | bufferloss | but I'm still interested in how to do it in repl |
| 21:53 | Profpatsch | (run-maths (slurp "path/to/file")) |
| 21:54 | bufferloss | slurp, I like it, is that a real method? :) |
| 21:54 | Profpatsch | Or, as per preference: |
| 21:54 | Profpatsch | (def *config-file* "path") |
| 21:54 | ddellacosta | bufferloss: I also recommend taking a look at: https://github.com/stuartsierra/component and http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded just for some ideas |
| 21:55 | bufferloss | ddellacosta, sweet thanks |
| 21:55 | Profpatsch | bufferloss: http://clojuredocs.org/clojure_core/clojure.core/slurp |
| 21:55 | bufferloss | Profpatsch, excellent |
| 21:56 | Profpatsch | I can very much recommend the cheatsheet: http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html |
| 21:56 | Profpatsch | It’s what I use all the time. |
| 22:18 | bufferloss | ok sweet I think I have the namespaces thing down now |
| 22:18 | bufferloss | time to check out this repl workflow y'all be holla' bout |
| 22:19 | bufferloss | was that appropriately hip? |
| 22:19 | bufferloss | does anyone actually use Maven for building clojure projects? |
| 22:20 | bufferloss | is there a benefit to using maven over leinengen? |
| 22:22 | bufferloss | last time I was working on a Java project I was using ant |
| 22:28 | bufferloss | Profpatsch, so, sorry but I don't entirely understand how the run-maths function is supposed to trigger my program |
| 22:29 | bufferloss | I get how to slurp theh program into a string, but then how do I cause that string to be run as a program? is there something like eval I should use? I thought eval was evil? |
| 22:29 | bufferloss | or is there something specifically for doing that, e.g. "running" or "loading" a file? |
| 22:29 | TravisD_ | bufferloss: As far as I know, it is strongly recommended to use leiningen |
| 22:29 | TravisD_ | I think it uses maven behind the scenes |
| 22:30 | bufferloss | TravisD_, ok, I am using leinengen, was wondering why anyone would want to use maven given that leinengen exists :P |
| 22:30 | TravisD_ | bufferloss: Regarding loading a file, I think the recommended approach is to use the :require options in the ns macro |
| 22:33 | TravisD_ | I wasn't following the conversation, though, so I'm not sure of the context |
| 22:34 | bufferloss | TravisD_, well Profpatsch was suggesting that I shouldn't invoke my program manually from the command line using 'lein run' every time I want to test a few new lines I've added |
| 22:34 | muhoo | TravisD_: AFAICT it uses maven repositories (remote and local ~/.m2/) but doesn't actually depend on maven or mvn binaries |
| 22:34 | TravisD_ | muhoo: Ah, cool |
| 22:34 | bufferloss | was trying to make sense of his suggestion on how to go about doingi this |
| 22:35 | TravisD_ | bufferloss: Hmm, it seems perfectly fine to me, or you could use a REPL to play with your code more interactively |
| 22:35 | bufferloss | all I see so far is (slurp) and I don't understand how to evaluate that string or how to in other words, reload and or re "require" the files in the project that have changed |
| 22:35 | bufferloss | I mean, I usually do keep a repl open but mostly for snippets that aren't much more than a few lines |
| 22:35 | TravisD_ | bufferloss: I'm not sure I'd go that route |
| 22:36 | TravisD_ | bufferloss: If you use emacs, you might want to check out cider. It makes a lot of this stuff very painless |
| 22:36 | bufferloss | k, grenchman seems to more or less take care of my previous gripe regarding the load time per script invocation |
| 22:37 | bufferloss | nodepad.exe for me :P |
| 22:37 | bufferloss | but, alas I fall short, because real programmers use butterflies |
| 22:37 | TravisD_ | Ah, from the land of windows |
| 22:37 | TravisD_ | Heh, M-x butterflies |
| 22:37 | bufferloss | nah, actually I am on ubuntu right now |
| 22:38 | bufferloss | some folks diss on the ubu, but it means I don't have to think mostly about my setup and I can just code |
| 22:38 | TravisD_ | so.. you use notepad in ubuntu? |
| 22:39 | ddellacosta | wine has come really far |
| 22:39 | TravisD_ | \me shivers |
| 22:39 | TravisD_ | ! |
| 22:39 | TravisD_ | emote failure. |
| 22:39 | ddellacosta | ha |
| 22:40 | bufferloss | yeah I'm masochistic like that |
| 22:41 | bufferloss | sometimes I use regedit instead and send keystrokes by updating the registry |
| 22:45 | bufferloss | yeah, even (load-file) won't for example load any other files that are depended upon, so I'd have to load-file for every changed file |
| 22:45 | bufferloss | which seems sub-optimal, esp if and or when the project grows and has many files |
| 22:45 | bufferloss | grenchman is good enough for me for now |
| 22:45 | TravisD_ | yeah, seems unwise to reimplement that functionality |
| 23:00 | isaacbw | ( |
| 23:00 | technomancy | bufferloss: can't you pipe a file to grench repl? |
| 23:00 | isaacbw | (println "Hi!") |
| 23:00 | isaacbw | ,(println "Hi!") |
| 23:00 | clojurebot | Hi!\n |
| 23:01 | bufferloss | technomancy, dunno, possibly? would that cause any and all other filess that may have been changed to be loaded as well if the piped file depends on them? |
| 23:01 | isaacbw | hiredman: is the clojurebot here the same one on github? |
| 23:03 | technomancy | bufferloss: you would need :reload-all for that |
| 23:09 | amalloy | isaacbw: github.com/hiredman/clojurebot is the source for clojurebot, yes |
| 23:09 | amalloy | although it seems like a lot of it is not hard-coded, but learned/taught facts. i'm not really sure how much |
| 23:09 | TravisD | Anyone here from Ann Arbor? |
| 23:11 | amalloy | isaacbw: github.com/raynes/lazybot also runs here |
| 23:14 | isaacbw | amalloy: which one would be a better bet if all I want is a clojure evaluator for my channel? |
| 23:15 | amalloy | i'd say it's easier to run your own lazybot, but then i helped write lazybot |
| 23:15 | isaacbw | :P |
| 23:15 | amalloy | you can also just ask Raynes or me to put this lazybot in your channel. he's in a lot of channels |
| 23:15 | isaacbw | ah, that might be nice. Let me check it out first though |
| 23:15 | TravisD | For some reason that reminded me a lot of the movie Her. Many conversations! (hopefully not a spoiler) |
| 23:16 | isaacbw | we might want a single bot that evaluates a variety of languages (js, clojure, haskell, etc) in which case a prefab bot wouldn't work (probably) |
| 23:16 | isaacbw | TravisD: maybe a little one |
| 23:16 | isaacbw | or a big one if I'm guessing correctly. I haven't seen it :P |
| 23:16 | TravisD | ah, no, it's not a major thing |
| 23:16 | dissipate | ,(= (and) (or)) |
| 23:16 | isaacbw | okay |
| 23:16 | clojurebot | false |
| 23:17 | TravisD | You probably wont recognize what I mean until you've watched it |
| 23:17 | amalloy | isaacbw: lazybot does haskell, at least |
| 23:17 | isaacbw | ooh |
| 23:17 | amalloy | i think rublets does a lot of languages |
| 23:17 | isaacbw | that's two out of four |
| 23:18 | dissipate | amalloy, all these bots are a security disaster waiting to happen |
| 23:18 | dissipate | amalloy, who calls 'eval' on some random code anyways? |
| 23:18 | amalloy | dissipate: yeah bro, selinux sandboxes are basically like injecting yourself with aids |
| 23:18 | TravisD | heh |
| 23:19 | dissipate | amalloy, selinux? really? i would have thought it would be running on BSD. |
| 23:22 | amalloy | you're welcome to try and break clojurebot or lazybot, dissipate |
| 23:22 | amalloy | i think you'll find it's more difficult than just badmouthing everything you see |
| 23:23 | dissipate | amalloy, badmouthing?? |
| 23:23 | TravisD | amalloy: It's impressive to me that these bots are open source and still safe enough to use |
| 23:23 | lazybot | dissipate: What are you, crazy? Of course not! |
| 23:23 | ryantm | I found this post about Clojure records from 2010 http://david-mcneil.com/post/765563763/enhanced-clojure-records it talks about some shortcomings of Records, like positional, non-optional arguments to the constructors. It mentions that maybe more work would go into Records in Clojure. Has any of that work happened? |
| 23:24 | dissipate | amalloy, i'm not into h4x0ring. |
| 23:24 | amalloy | TravisD: like anything else, they're safe because they're open-source |
| 23:25 | muhoo | lol grenchmen. i think "simon le cowell" is a reference to "simon le bon" |
| 23:25 | ryantm | Oh, I just found the map-> constructor. That works! |
| 23:25 | TravisD | amalloy: Yeah, I guess you have many eyes checking. But, I guess it's also easier to find potential exploits |
| 23:25 | dissipate | amalloy, bitcoin is open source, and someone broke it awhile back. |
| 23:25 | amalloy | i'm 100% sure there are vulnerabilities left somewhere in lazybot, but there are far fewer than there used to be |
| 23:26 | TravisD | dissipate: "Broke" might be a strong word, there |
| 23:26 | dissipate | TravisD, well, they were able to do a transaction for a ridiculous number of coins |
| 23:26 | TravisD | I don't know much about it, but I don't think that was a fault in the design of bitcoin |
| 23:27 | dissipate | TravisD, well it was because they didn't handle integer arithmetic properly in the C++ code |
| 23:28 | TravisD | dissipate: I was also under the impression that bitcoin was mostly a community and a protocol, with many different implementations. |
| 23:28 | TravisD | But this is getting off topic! We can move it to clojure-social, if you like |
| 23:28 | dissipate | amalloy, did you say i 'badmouth' everything because i raised issues with 'shuffle' awhile back? just curious |
| 23:28 | technomancy | not exactly a lot of incentive to spend all day breaking into lazybot though |
| 23:28 | amalloy | if lazybot were protecting bank vaults, it would be considered laughably insecure. but it's just a tool to make hobbyists' lives easier. people love to find bugs in it, and when they do, they tell us about them |
| 23:29 | TravisD | technomancy: But think of the power you would have! |
| 23:29 | dissipate | TravisD, sorry, i was referring to the Satoshi client |
| 23:29 | amalloy | a malicious hacker could, what, wipe a VPS? that we have a backup of? |
| 23:29 | dissipate | amalloy, no, turn the VPS into a C&C |
| 23:29 | ryantm | Does lazybot parse IRC messages in some rigorous way? |
| 23:30 | dissipate | ryantm, yeah, it's called 'eval' |
| 23:30 | ryantm | I don't mean the PRIVMSG contents. |
| 23:31 | bufferloss | how do I pass a sql date back into clojure.java.jdbc |
| 23:31 | dissipate | ,(iterate) |
| 23:31 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/iterate> |
| 23:31 | dissipate | ,(iterate +) |
| 23:31 | bufferloss | I'm getting 'Exception in thread "main" java.lang.RuntimeException: Unable to convert: class java.sql.Date to Object[]' |
| 23:31 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/iterate> |
| 23:31 | ryantm | ,(defrecord Message [a b c]) |
| 23:31 | clojurebot | sandbox.Message |
| 23:32 | dissipate | ,(iterate + 1) |
| 23:32 | clojurebot | (1 1 1 1 1 ...) |
| 23:32 | ryantm | ,(map->Message {:a 1}) |
| 23:32 | clojurebot | #sandbox.Message{:a 1, :b nil, :c nil} |
| 23:33 | amalloy | dissipate: i didn't have any particular incident in mind. but most of the time when i hear you talk, you are saying how bad something is. shuffle, clojars...and this is what i could find in five minutes log-grepping the past two weeks |
| 23:33 | xeqi | the bots have vulnerabilites, but I found the recursive bot talk someone finally found to be more awesome |
| 23:33 | dissipate | amalloy, i offered to donate to clojars |
| 23:34 | amalloy | apparently while i wasn't listening you also said java is a bad language for startups, and anyone who "architects" a java application probably doesn't ever write code |
| 23:34 | dissipate | amalloy, java is a bad language, period. bad especially for startups. that's in dispute? |
| 23:35 | amalloy | i don't intend to engage you on the merits of your claims. but you insult a lot of things |
| 23:37 | dissipate | amalloy, i think things could be better, that's for sure. |
| 23:37 | noonian | it's hard to argue that java isn't at the very least an improvement over c(++) |
| 23:37 | amalloy | so go make them better. write an amazing product in clojure. write a better sandboxer. find a bug in lazybot |
| 23:38 | amalloy | mirror clojars |
| 23:38 | dissipate | amalloy, BTW, my poke at lazy bot was a joke. sorry it hit you the wrong way. |
| 23:40 | dissipate | amalloy, i'm amazed by clojure (so far). but i won't be writing any amazing product in it. my first project might be to port AIXI to clojure, or to write an easy to use alternative to the built-in 'shuffle'. |
| 23:42 | noonian | ,(doc shuffle) |
| 23:42 | clojurebot | "([coll]); Return a random permutation of coll" |
| 23:42 | dissipate | noonian, oh man, don't get me started again.... |
| 23:42 | TravisD | Is that not convenient? |
| 23:43 | noonian | let me guess, it's not random enough for some use case? |
| 23:43 | dissipate | TravisD, it is convenient with a number of caveats that are not even properly documented. |
| 23:44 | dissipate | noonian, in a way, yes. if you pass a collection over a certain size, not all permutations will be equally possible, and many permutations will never show up at all. |
| 23:45 | ryantm | ,(map->Message {:a 1 :asdf 5}) |
| 23:45 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: map->Message in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 23:45 | ryantm | ,(defrecord Message [a b c]) |
| 23:45 | clojurebot | sandbox.Message |
| 23:45 | ryantm | ,(map->Message {:a 1 :asdf 5}) |
| 23:45 | clojurebot | #sandbox.Message{:a 1, :b nil, :c nil, :asdf 5} |
| 23:48 | dissipate | noonian, i think i could rewrite shuffle that would block until there was enough entropy to produce truly random shuffles. in other words if you do (shuffle (range 0 52)), the call doesn't return until enough entropy has been acquired to do the shuffle without certain permutations being dropped |
| 23:49 | dissipate | noonian, in short, a design decision was made to cover up the deficiencies of hardware |
| 23:49 | noonian | idk, if i'm using shuffle i most likely don't care if it's not quite random |
| 23:50 | dissipate | noonian, if you are a statistician, research scientist or a mathematician, you would care |
| 23:51 | ryantm | Clojure has plenty of design decisions like that. |
| 23:52 | dissipate | ryantm, i'm not surprised. what's another example? |
| 23:53 | ryantm | There seems to be a lot of talk these days about the insecurity of blocking for entropy. An attacker could exhaust your entropy pool via a side channel and control your program flow. |
| 23:54 | dissipate | ryantm, damn. :( |