#clojure log - Mar 11 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0: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?

0:18 anyone?

0:18 lol

0:18 clojurebot: anyone is anybody

0:20 * talios is nobody

0: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

0:34 noprompt: seangrove: they're definitely more complex, if i'm thinking the same thing your talking about.

0:34 seangrove: noprompt: http://gridstylesheets.org

0:34 Hands-down better than css at layout, but it's unclear how to handle some of the dynamic parts

0:35 noprompt: ok i think that's different from what i was thinking.

0:36 i did some work on a very sophisticate layout system which used a font-size/line-height scale which generated a grid.

0:36 it was meant to be used as a layout system.

0:37 seangrove: noprompt: undoubtedly a good idea for you to checkout gss, the idea is certainly very interesting

0:37 And it's right up your alley. Add some core.logic to garden, some accelerated 3d transforms, and boom :)

0:37 noprompt: seangrove: i've bookmarked it and will definitely give it a look.

0:38 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.

0:38 i never understood why the same attention to detail in print never made it to the web.

0:39 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"

0:39 s/when/went

0:39 better yet a 1000 years.

0: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

0:40 noprompt: seangrove: the amazing thing about clojure is that now there's actually a *very* good opportunity to build extrodinarily complex layouts.

0:41 stuff that you simply could/would not do w/ sass/haml/etc.

0:41 seangrove: noprompt: How so?

0:41 noprompt: seangrove: because you can unify both systems with protocols.

0:44 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.

0:44 seangrove: noprompt: I'm pretty curious about it

0:44 Any example specifically?

0:45 noprompt: for example w/ a reified object/datatype you can implement various protocols that express how to render itself in different contexts.

0:45 seangrove: look at newspaper design. it's very complex.

0:46 seangrove: noprompt: I'm more interested in app design, rather than newspaper design

0:46 noprompt: seangrove: definitely.

0:46 seangrove: CSS isn't very good at handling app design, to say the least

0:46 noprompt: it's not, but it can be if you program it.

0:47 * ddellacosta is starting to wonder if noprompt is a mad scientist

0:47 noprompt: iow, w/ garden you can build better abstractions that express what you want in html/css.

0:47 app design or newspaper design.

0:47 whatever design.

0:47 ddellacosta: i'll take that as a complement. :)

0:48 seangrove: noprompt: Let me know what you think about gss, it's certainly up there with what you're talking about

0:48 The documentation is lacking, but the ideas are solid

0: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.

0:48 bufferloss: so my dates are coming out obviously in a "different timezone" than UTC, which my database is set to UTC

0:48 seangrove: ddellacosta: Use gss :P

0:48 ddellacosta: I mean, I'm not a designer or a front-end layout person, I just pretend to be one.

0:48 Raynes: My approach to dealing with CSS has always been to write CSS.

0:48 bufferloss: any way to prevent this? I've done some googling but nothing particularly satisfies the answer

0:48 er, the question?

0:48 ddellacosta: Raynes: :-P

0:49 noprompt: Raynes: you haven't written enough then. ;)

0:49 bufferloss: CSS3 is pretty much fine

0:49 SASS ftw

0:49 not having to deal with IE ftw

0:49 Raynes: noprompt: You lookin' for a paddlin

0:49 ddellacosta: let's all just acknowledge the elephant in the room, it's not CSS, it's the f*ing browsers

0:49 * seangrove feels his right eye twitchin'

0:49 noprompt: Raynes: bring it. ;P

0:49 seangrove: ddellacosta: ? It's certainly css.

0:49 Raynes: noprompt: Brb packing my car.

0:49 * ddellacosta has to make web sites that work in IE8

0:49 noprompt: ddellacosta: yeah, i'm with seangrove on this one.

0:50 seangrove: ddellacosta: http://gridstylesheets.org/guides/ccss/

0:50 ddellacosta: seangrove, noprompt: yeah, do you guys write CSS to support IE8? Like, all features, across your apps?

0:50 noprompt: i guess i'm biased.

0:51 ddellacosta: whenever someone throws a framework at me I'm just like...whatever. Doesn't change anything.

0:51 noprompt: in the past i've written large scss projects 3K-6K lines, i don't belive preprocessors are the future. period.

0:51 seangrove: ddellacosta: Nope. But even once you're passed that, CSS is a hurdle to overcome in writing apps

0:51 noprompt: why would i want @for i through j when i could have (map some-fn (range i j))

0: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.

0:52 noprompt: why wouldn't i want macros?

0:52 like this: http://noprompt.github.io/clojurescript/2014/02/10/media-query-breakpoints-with-garden.html

0:52 Raynes: noprompt: Dear God, the fancy.

0:52 It burns.

0:53 noprompt: and as soon as i finish converting the sass parse tree to scss, i can use whatever's out there.

0:53 sorry "to clj"

0: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.

0:53 noprompt: Raynes: just a theme bro. lots of 20's inspiration.

0:53 lol

0:54 ddellacosta: this is true.

0:54 my whole point is that CSS is awful. SCSS is an improvement, sure, but that's all it is.

0:55 ddellacosta: noprompt: well, then we are in agreement.

0: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.

0:56 if anyone gave a damn i'd do kickstarter! LMAO!!!

0:56 hell i'll throw in type safety! cc/ ambrosebs

0: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.

0:57 noprompt: seangrove: but looking at what your working on, hey go w/ what you know, make the damn thing work. then get fancy.

0:57 ddellacosta: that's the whole idea! :)

0:57 seangrove: noprompt: This *is* fancy

0:57 ddellacosta: noprompt: then give it to me

0: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 ;)

0:58 That'd be fantastic

0:58 Raynes: https://www.youtube.com/watch?v=zplc4Ienkws

0:58 seangrove: That's almost certainly a much bigger opportunity

0:58 noprompt: guys, i was watching a lot of BoardWalk Empire and browsing http://www.jugend-wochenschrift.de/index.php?id=25

0:58 ddellacosta: Raynes: that looks creepy I ain't clickin

0:58 Raynes: ddellacosta: It's a song.

0:58 seangrove: https://www.youtube.com/watch?v=47-xxp02PFg

0:58 ddellacosta: noprompt: pretty

0:59 Raynes: No creepies.

0:59 * seangrove couldn't help himself

0:59 * ddellacosta goes to rustle up some headphones

0:59 noprompt: my whole house is gonna end up looking like an art deco time machine.

0:59 ddellacosta: Reba!

1:00 bufferloss: how can I accomlish something like this with condp

1:00 ,(let [value 2] (if (> value 2) "foo" (if (< value 2) "bar" "baz")))

1: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.

1:00 clojurebot: "baz"

1:01 noprompt: seangrove: writing new code takes time and thought. improving the compiler each time is a big effort.

1:01 seangrove: noprompt: Definitely. It's a pretty huge system you're working on

1:01 noprompt: seangrove: not to mention ensure i can support both cljs and clj.

1:02 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.

1:02 and ddellacosta, i could deliver on that promis.

1:03 (deliver that-promise "d-d-d-deliver that promise yo")

1:03 ddellacosta: noprompt: :-)

1:05 noprompt: ddellacosta: i did tell you about thorn right? https://github.com/noprompt/thorn

1:05 ddellacosta: css->clj is almost done w/ the exception of media queries.

1:05 ddellacosta: then the hard part scss->clj.

1:05 ddellacosta: noprompt: I was eavesdropping the other day right when you were talking about it with bbloom actually. :-O

1:05 noprompt: very cool stuff, I gotta say.

1:06 noprompt: ddellacosta: it was actually pretty easy once i figured out the right ruby spells.

1:06 ddellacosta: noprompt: yeah, it's kind of crazy the stuff you can do with the JVM huh?

1:07 noprompt: ddellacosta: it's incredible. i kept telling my coworker how amazed i was for like an hour on/off.

1:08 seangrove: ddellacosta: Worth checking out https://www.youtube.com/watch?v=ouzAPLaFO7I for an idea

1:08 ddellacosta: seangrove: will do, after I listen to this Reba song Raynes dropped on us

1:08 * Raynes chuckles

1:10 mskoud: Anyone who can help me with this: http://stackoverflow.com/questions/22316854/clojure-nested-maps-path

1:12 ddellacosta: mskoud: you'll make it easier on yourself if you can make :children contain maps vs. vectors

1:13 mskoud: for example

1:13 ,(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 {}}}}}})

1:13 clojurebot: #'sandbox/x

1:13 ddellacosta: mskoud: then you can do stuff like

1:14 (get-in x [:children 3 :children])

1:14 whoops

1:14 ,(get-in x [:children 3 :children])

1:14 clojurebot: {4 {:name "D", :id 4, :children {}}}

1:14 ddellacosta: mskoud: and

1:14 ,(update-in x [:children 3 :children 4 :name] "E")

1:14 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>

1:14 ddellacosta: er

1:14 ,(assoc-in x [:children 3 :children 4 :name] "E")

1: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 {}}}}}}

1:15 ddellacosta: etc.

1:15 mskoud: ok, thx ddellacosta, will try to explore this, sounds resonable!

1:15 ddellacosta: mskoud: :-)

1:20 mskoud: it better but i still miss an index where i can lookup any id , independent of level/depth.

1:22 mosber: /join #incanter

1:29 ddellacosta: mskoud: how so?

1: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.

1:32 TravisD: mskoud: Are you searching through the tree to find an element, and return the path to it?

1: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.

1:33 mskoud: TravisD : Yes, thats right. And the id's are unique

1:39 amalloy: ddellacosta: don't roll your own binary search tree, just use a map

1:39 noprompt: dammit. i think i'm actually gonna have to generate the clj/cljs code and cp/pst it into the file.

1:39 :|

1:39 ddellacosta: amalloy: is it still efficient then to find nodes by id when you don't know where the node is?

1:40 amalloy: huh? just one map of id->thing

1: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.

1:40 right; see the above conversation for context

1:40 TravisD: If the data is not already in a nice structure, you cant avoid doing a naive search through the tree

1:44 noprompt: oh duh, just import the clojure.lang.* stuff.

1:44 that was easy.

1:44 ddellacosta: heh

1:46 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.

1: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

1:47 ddellacosta: amalloy: right, gotcha...so he'd keep the index somewhere else.

1:49 mskoud: so keep the structure a plain map instead of a nested?

1: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

1:59 mskoud: yes, that would be a good way to go. Any hint to how to create such a map.

2:00 akhudek: mskoud: iterate over the entire tree and build the map as you go

2:01 of course, if you need to update the tree, you'll have to remember to update the map too

2:45 sid_: Hi there, I'm trying to use pulsar library in my project, but I'm getting this error:

2:45 (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)

2:45 I've added the dependencies in my project.clj file.

2:46 can anyone please help

2:46 anyone?

2:46 clojurebot: anyone is anybody

2:46 sid_: anybody? :P

2:50 I searched on google but couldn't resolve it

2:51 noprompt: sid_: maybe browse the issue tracker?

2:51 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.

2:53 dsrx: it looks like you're trying to load some mish-mash of clojurescript and clojure

2:54 er, I may be misreading that error

2: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

2:56 I'm pretty new to clojure

2:56 what can I do to resolve it

2:56 ?

2:57 noprompt: sid_: did you browse the issue tracker yet?

2:58 sid_: how can I browse the issue tracker? Sorry if this is a lame question

2:59 noprompt: sid_: i think the project is hosted on github -> https://github.com/puniverse/pulsar

2:59 sid_: browse the open/closed issues.

2:59 sid_: if you can't find something open a new issue or attempt to ping the authors here.

3:01 sid_: I'll do that. Thank you for your help :)

3:01 jph-: is there a way to get progress from java.io/copy?

3:01 noprompt: sid_: no problem

3:01 sid_: also, if you're new to clojure it might help to learn the basics before jumping in to something like pulsar.

3:02 SegFaultAX: sid_: http://www.clojurebook.com/

3: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.

3:02 just a friendly tip.

3:02 :)

3:02 SegFaultAX: (inc noprompt)

3:02 lazybot: ⇒ 7

3: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.

3:05 Thank you so much*

3:05 noprompt: sure. :)

3: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

3:08 noprompt: dissipate: it's not essential. you can get far w/o them.

3:08 dissipate: noprompt, do you use them?

3:08 noprompt: dissipate: i've been programming clojure for a 1 1/2yrs and haven rarely used thme.

3:08 *them.

3:08 dissipate: it just depends on what you're doing. but they're fairly easy to learn.

3:09 dissipate: noprompt, it just seems more and more stuff to learn!

3:09 noprompt, do you think it is a good thing that the core is getting bigger and bigger?

3: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.

3:11 dissipate: i don't have a problem w/ that no.

3:11 i've never found core to be bloated.

3:12 and there's hardly any core function i didn't want or wanted improved.

3:12 well except for for re-matches and re-find.

3:12 those are terrible.

3:14 dissipate: noprompt, you use core.logic?

3:14 noprompt: no not yet.

3: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?

3: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.

3:16 dissipate: sid_, what about Redis?

3:18 SegFaultAX: dissipate: I will say this about reducers: they are perfectly usable without understanding how they actually work.

3: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?

3:18 dissipate: SegFaultAX, well, that's good because Hickey's article has me confused out of my mind. :O

3: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.

3:19 dissipate: http://www.infoq.com/presentations/Clojure-Reducers might be a good extra resource.

3:19 sid_: dissipate, clj-redis-session?

3:19 SegFaultAX: Good analogies for gaining an intuition about reducers.

3:20 sid_: dissipate, I'm already using lib-noir to maintain sessions when a user login

3: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.

3:21 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'

3:22 sid_, (wrap-session your-app {:store (redis-store redis-conn {:expire-secs (* 3600 12)})})

3:23 SegFaultAX: dissipate: Reading the source is instructive. Lazy seqs are just chained continuations.

3: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

3: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)

3:24 dissipate: sid_, but Redis is probably more robust. you need persistence for something that lasts 60 minutes.

3:25 SegFaultAX: sid_: What does "join a thread for 60 minutes" mean? Thread.join(60 * 60 * 1000)?

3: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

3:27 dissipate: SegFaultAX, this is confusing to me: https://www.refheap.com/56279

3:27 SegFaultAX: sid_: Join probably isn't the tool you want to use for that.

3:27 sid_: SegFaultAX, joining won't work. I'm pretty new to futures and agents. Does futures really work that way

3:27 ?

3:28 SegFaultAX: dissipate: It's idiomatic to wrap the outer-most form in the lazy-seq to defer as much execution as possible.

3:28 sid_: completion of*

3:28 SegFaultAX: sid_: Do futures really work what way? I have no idea what you're talking about.

3:29 But blocking the main thread for 60 minutes waiting for a thread to return seems insane.

3:30 sid_: yup, my bad, joining would be bad

3:30 dissipate: sid_, you really ought to consider some kind of persistence for your sessions

3:30 SegFaultAX: sid_: So what are you really trying to do?

3:30 sid_: can you suggest something?

3:30 SegFaultAX: sid_: Can you describe the problem you're trying to solve?

3:31 sid_: I'm working on a web app, which provides user registration on it

3:31 after user registration, a user can start a new test

3:31 for 60 minutes

3:31 SegFaultAX: What's a test?

3:32 sid_: test as in any kind of test related to academics

3:32 SegFaultAX: Oh like an exam

3:32 ?

3:32 sid_: yup

3:32 SegFaultAX: Ok, go on.

3:32 sid_: so i need to maintain a a session of 60 minutes for that test session

3:33 and at the end of the test, I need to add those results in the database

3:33 SegFaultAX: Ok

3:33 sid_: what would you suggest I should do?

3:34 SegFaultAX: Depends on the format of the exam.

3:34 Does the client send the user's response after each question?

3:34 sid_: yes it does

3:35 I'm pretty confused what to do

3:35 SegFaultAX: Does it need to be very exact? Down to the second?

3:36 sid_: no, I want to add the answers to the database at the end of 60 minutes

3:36 SegFaultAX: I mean the length of the session.

3:37 sid_: yes, the length of session should be exact

3:38 SegFaultAX: Ok, based on what you've told me I can think of a few ways to model this.

3:39 MVP might be a user table, a session table, and a response table.

3:39 A user has many sessions, and a session has many responses.

3:39 A session also has a start time and a duration (or end time, as you like)

3:40 The business logic is essentially "allow new responses to be inserted for this session as long as the session is still open"

3:40 Or you could always allow responses to be recorded, but only count those that were created within the session window.

3:41 You can easily provide an endpoint to query how many seconds are remaining in the session to update/synchronize the UI.

3:41 sid_: okay..so paralleslism doesn't come in if a lot of users are talking the test session at the same time?

3:41 SegFaultAX: sid_: Each user has their own session.

3:42 sid_: wouldn't that impact the performance?

3: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)

3:42 a) Don't optimize prematurely, b) no it wouldn't.

3:42 Since you can do an index scan on the join table by (user_id, test_id)

3:43 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.

3:44 Then you could ask questions like "which students took this test together?"

3:45 Anyway, that's just one idea for how to implement it.

3:45 sid_: so all the queries for an individual user has to go through what? a thread?

3:45 SegFaultAX: sid_: What?

3:46 What do threads have to do with this?

3:47 sid_: like, each question returns a question id and answers when going to the next question

3:47 dissipate: ,(first (iterate inc 2))

3:47 clojurebot: 2

3:47 sid_: I'll have to store those results somewhere?

3:47 SegFaultAX: sid_: As I said presumably you'll have some representation of a test.

3:48 sid_: would it be feasible to let an actor do all those tasks

3:48 and at the end of session just add those results to the database?

3:48 dissipate: sid_, you should store every single result the student gives in some persistent DB. depending on how important the data is.

3:49 SegFaultAX: sid_: Um, I don't feel like we're talking about the same thing.

3:49 dissipate: sid_, no, not at the end of the session, during the session, store everything the student gives you persistently

3:49 SegFaultAX: You're asking about actors and threads and I'm trying to help you conceptualize your problem.

3:49 sid_: I was thinking of storing those results in an atom

3:49 dissipate: sid_, why? store them in a DB or some persistent layer.

3:50 sid_, you could do something like memcached or redis, with a mongodb capped collection for additional caching.

3:51 SegFaultAX: dissipate: Dude, what?

3:51 memcache, redis, and mongo all in one sentence?

3:51 sid_: Why don't you focus on getting a working solution first before you start trying to "optimize"

3: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.

3:52 sid_: SegFaultAX, okay, so I'll do as yo usay

3:53 SegFaultAX: dissipate: http://i.imgur.com/f9bQXZA.png

3:53 dissipate: sid_, i don't see why you are getting into threading stuff. should be handled by your web framework.

3:53 sid_: when does atoms, refs, agents, futures come into picture?

3:54 SegFaultAX: sid_: When you require coordination, synchronization, or parallel execution.

3:54 dissipate: SegFaultAX, i'm not advocating mongodb as a primary database. but it can be used for caching IMO.

3:54 SegFaultAX: Which at this phase, you clearly don't.

3:55 sid_: so these test sessions aren't parallel execution. I'm sorry I'm a complete n00b

3:55 :/

3:55 dissipate: sid_, should be handled at the web server layer

3:56 SegFaultAX: sid_: Why don't you just start building the test taking part for now? Worry about all that other crap later.

3:56 I think it's better to nail down the core domain models and logic first anyway.

3:56 dissipate: SegFaultAX, DDD?

3:57 sid_: Thank you SeagFaultAX and dissipate for your help :)

3:57 SegFaultAX: DDD-lite

3:57 sid_: Good luck mate.

3: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?

3:57 dissipate: SegFaultAX, you a fan of Uncle Bob's 'Clean Architecture'?

3:58 sid_: I'll work on the model and than think about optimization

3:58 just out of curiosity, aren't test session a parallel execution?

3:58 atyz: (turning it into a map doens't work because something like (into {} entity) doesn't resolve components

3:58 dissipate: ,(take 1 (iterate inc 2))

3:58 clojurebot: (2)

3:59 dissipate: ,(first (iterate inc 2))

3:59 clojurebot: 2

3:59 dissipate: very interestng

3:59 TEttinger: it is odd how iterate does that

3:59 0 calls, then 1 call

3:59 dissipate: TEttinger, what do you mean?

3:59 SegFaultAX: TEttinger: Huh?

4:00 TEttinger: ,(take 5 (iterate inc 2))

4:00 clojurebot: (2 3 4 5 6)

4:00 SegFaultAX: The first value of iterate is the initial value.

4:00 pyrtsa: TEttinger: It's just like how (reductions f init xs) behaves.

4:00 dissipate: TEttinger, one evaluates to a list of 1 value, the other evaluates to just 1 value

4:00 TEttinger: 0 calls to inc, 1 call to inc, 2 calls to inc... is what I mean

4:00 SegFaultAX: TEttinger: Why is that weird?

4:00 alew: iterate explicitly says it returns the inital arg as the first value

4:00 TEttinger: I just wasn't aware of other fns that acted like that until now

4:01 dissipate: TEttinger, that's how iterate works. f(f(f(x)))

4:01 no?

4:01 clojurebot: no is tufflax: there was a question somewhere in there, the answer

4:01 SegFaultAX: dissipate: x, f(x), f(f(x)), f(f(f(x))).

4:02 TEttinger: dissipate, yeah I know, I just mean it is sorta a different way of thinking about the result is all

4:02 dissipate: alew, so why does 'take 1' evaluate to a list?

4:02 alew: what is with this odd notation of putting the opening paren after the function name

4:02 TEttinger: map doesn't preserve the base values unless you tel it to

4:02 dissipate: SegFaultAX, so why doesn't 'take 1' result in the value by itself?

4:02 alew: take always returns a lazyseq

4:03 SegFaultAX: dissipate: Because take is a sequence operation.

4:03 (take 3 (range))

4:03 ,(take 3 (range))

4:03 clojurebot: (0 1 2)

4:03 TEttinger: first is similar to (nth coll 0), take is more like a subsequence

4:03 dissipate: ,(first (range))

4:03 clojurebot: 0

4:04 dissipate: SegFaultAX, gotcha

4:04 SegFaultAX, that sieve function is quite clever then. it uses 'first' instead of 'take 1'.

4:05 SegFaultAX, which triggers the caching mechanism? 'first' or 'take x' ?

4:05 SegFaultAX: dissipate: First always forces a value. take is lazy.

4: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

4:08 dissipate: SegFaultAX, is it possible to have a collection that is not an 'iterable', and hence cannot have 'seq' called on it?

4: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.

4:10 Not sure why you would do such a thing.

4: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

4: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?

4:19 Or should I just check every node in a branch for identity with its ancestors?

4:23 SegFaultAX: AmnesiousFunes: I'm not aware of any built-in way to do that. Use the standard recursive approach.

4:27 AmnesiousFunes: SegFaultAX: Thanks.

4:45 dissipate: how is caching in a lazy sequence not a side effect?

4:46 SegFaultAX: dissipate: It is

4:46 dissipate: SegFaultAX, wtf. that's ridiculous.

4:47 lvh: dissipate: why is that ridiculous

4:47 dissipate: SegFaultAX, how can a core library function have side effects like that? the whole idea is to get rid of that.

4:47 lvh, and is this caching done in STM?

4:47 SegFaultAX: Nope.

4:48 dissipate: i just don't see how this is consistent with the 'pure function' philosophy

4:48 lvh: dissipate: iteration functions losing referential transparency is a lot worse of a side effect than caching

4:48 SegFaultAX: The side effects are encapsulated.

4:48 It's similar to doing side effecting code in a transient for speed.

4: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?

4:49 pyrtsa: dissipate: The caching is not done in STM but it *is* synchronized (see LazySeq.java if interested).

4:50 SegFaultAX: Yup

4:50 dissipate: In general, you don't need to worry about these things.

4:51 dissipate: pyrtsa, is there a version of lazy-seq that has no side effects?

4: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.

4:51 SegFaultAX: lvh: Nice to see you on this side. :) Clojure is slowly pulling you away from Python.

4:51 lvh: SegFaultAX: soon I will be shipping 500MB uberjars that have clojure.core + jython in them

4:51 pyrtsa: dissipate: What would that even mean? Just make sure that the iteration only produces results.

4:51 ...without causing side effects itself.

4:51 lvh: SegFaultAX: core.async is nice and all but twisted is still a few years ahead if you want to write protocols :)

4: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

4:53 pyrtsa: dissipate: As long as you keep the same head, the lazy-seq is only evaluated once.

4:53 SegFaultAX: pyrtsa: A thunk is only evaluated once*

4:53 pyrtsa: Thanks for the correction.

4:54 dissipate: SegFaultAX, python and clojure are 2 different languages with different use cases IMO.

4:54 SegFaultAX: pyrtsa: Same head or not, it won't do unnecessary re-evaluation.

4:54 dissipate: SegFaultAX, i wouldn't use clojure as a scripting language because the JVM takes too long to start up, for instance.

4:54 SegFaultAX: dissipate: lvh is very well known in #python, I was commenting about that.

4:54 pyrtsa: SegFaultAX: Indeed. Only if you call the function that creates a lazy-seq repeatedly, will it evaluate multiple times.

4:55 *repeatedly call the function

4:56 dissipate: SegFaultAX, i see. i'm actually trying to get away from ruby, python, perl for medium/large apps, and use clojure instead.

4:56 SegFaultAX: dissipate: You and me both.

4:57 I'm trying to get away from Python and Ruby in general.

4:57 alew: dissipate: if you want to write clojure scripts, you could have clojurescript that runs on node.js :P

4:57 dissipate: SegFaultAX, but i see myself still using python etc. for scripting

4:57 michel_slm: dissipate: hopefully soon you can use ClojureScript for that

4:57 SegFaultAX: About 30% of my work is ops, and for that Python is perfect.

4:57 dissipate: alew, that's true, hadn't thought of that. :P perhaps i can escape entirely.

4:57 alew: SegFaultAX: checked out pallet?

4:57 SegFaultAX: But for application development, I've lost my taste.

4:57 alew: Hah, no.

4:57 chare: Clojure > Python and you know it

4:58 dissipate: michel_slm, clojurescript has been ported to node.js?

4:58 SegFaultAX: alew: I looked at pallet about a year ago. I have no idea how people are building stuff with it.

4:58 alew: dissipate: as for caching, it's referentially transparent so it shouldn't violate the purity

4:58 SegFaultAX: The documentation is horrendous and the code isn't particularly good either.

4:59 alew: SegFaultAX: it's really confusing mostly due to the docs

4: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.

4:59 alew: SegFaultAX: I know at least a few clojure companies that are using it

4:59 michel_slm: dissipate: I believe the newest version is now more Node.js friendly

4:59 SegFaultAX: I heard it was undergoing a complete rewrite or something, but that was like over a year ago.

4:59 What ever, boto and ansible work great.

4:59 dissipate: SegFaultAX, it's all about Rust. :P

4: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

5:00 michel_slm: dissipate: aha, yes, you can -- https://github.com/clojure/clojurescript/wiki/Quick-Start

5:00 SegFaultAX: dissipate: I have issues with some variations of OOP. I don't take issue with object orientation in the general sense.

5:00 dissipate: SegFaultAX, boto? that's good but for some reason it was really lacking for AWS Simple Workflow

5:01 SegFaultAX: dissipate: Use the CLI API for anything boto doesn't provide.

5:01 Or the admin if you want, but that's so ugly.

5:02 Wow is it 2a already? Sheesh

5:02 Night all.

5:03 dissipate: SegFaultAX, night

5:07 BartAdv: whoa, writing some recursive stuff in SQL. thinking all the time how datomic could ease my suffering ;)

5:20 anars: cemerick: pull request regarding the empty roles set is up as of yesterday. also with a few comments. just fyi :)

5: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.

5:50 any links summarising this info would be useful.

5:52 dsrx: triyo: there's a changelog on the github repository https://github.com/clojure/clojure/blob/master/changes.md

5:52 triyo: dsrx: thanks started looking through that (history of changelog)

5:57 clgv: triyo: some very convenient threading macros: some->(>), cond->(>), as->

5:58 triyo: clgv: thanks, just saw those; added in 1.5. Very cool. Personally love the -> and ->>.

5:59 What was the main purpose of adding the reduces over standard map/filter/reduce?

6:00 clgv: triyo: clojure.core.reducers you mean?

6:00 triyo: *reducers

6:00 yes, sorry, typo

6:00 clgv: triyo: if so, then the main goal is parallelization of those operations

6:01 dissipate: triyo, they were added so that you would have to learn more stuff

6: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

6:01 triyo: weren't there pmap, etc.?

6:01 dsrx: thanks for the link

6:01 clgv: triyo: you cant parallelize efficiently with those lazy-seq based approaches. hence reducers

6:02 triyo: that's because lazy-seqs are inherently sequentially

6:04 triyo: oh I see, that makes sense.

6:04 pyrtsa: Not just parallelization, also stream fusion, AFAIK.

6:13 triyo: sweet `reducers/fold` (parallelize reduction)

7: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

7:15 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

7:27 koalallama: ,(format "%.2f" 3.14159)

7:27 clojurebot: "3.14"

7: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.

7:30 CookedGr1phon: pyrtsa: I've done it before, so I know it's possible

7:31 Just couldn't remember how

7:31 pyrtsa: See what koalallama wrote.

7:33 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.

7:33 (Of course, neither 0.30000004 nor 0.3 are exactly representable as floating point numbers.)

7:50 CookedGr1phon: ah, this is all different for clojurescript

7:51 need to extend protocol IPrintWithWriter

7:52 pyrtsa: Ah, of course. Nice to hear. :)

7:56 CookedGr1phon: doesn't seem to work if i extend that for floats

8: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.

8:17 CookedGr1phon: what do you mean change the printing function?

8:18 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

8: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?

8:54 http://lpaste.net/3729188939110547456

9:00 ok, nevermind, found the answer

9:00 AeroNotix: what are people using for Icinga?

9:00 gvickers: BartAdv: what was it?

9:01 BartAdv: https://github.com/clojure-android/neko/issues/23#issuecomment-37291111

9:12 felher: hey Folks. Quick question: is there a default/standard logging library for clojure? A link to it would suffice :)

9:12 joegallo: clojure.tools.logging

9:13 https://github.com/clojure/tools.logging

9:13 felher: joegallo: great, thank you :)

9:13 joegallo: you're welcome!

9: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

9:51 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 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 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 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 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 Oh, you want to change the dispatch function

10:41 Huh

10:41 szymanowski: yes

10:41 i need it for some reason

10:42 llasram: haha

10:42 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 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 thank you

10:46 clgv: llasram: patch it^^

10:47 llasram: If I have the time

10:47 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 That's very strange

10:55 I seriously thought it just used the `type` function to dispatch

10:55 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 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 Here's a probably-equally-insane approach

11:05 Anderkent: llasram: .setAccessible! XP

11:05 oh and

11:05 modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);

11:05 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 ,(.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 llasram: I just used a different multimethod for the example but showed dispatch for a symbol

11:11 llasram: Oh, I see

11:12 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 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 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 a collection of nrepl middlewares and ops

11:48 at that point, we can delete a bunch of elisp

11:48 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 mostly I started working on it b/c completion for CLJS is impossible otherwise.

11:50 or impractical..

11:50 the inline code is unmaintainable.

11:51 gfredericks: yeah

12:18 fun problem: writing your :repl-options {:init (...)} code so that it composes under concatenation

12:18 I think ((comp last list) (do some) (init things)) might be the easiest way?

12:19 I guess there's no reason to return the last value at all

12:19 presumably nrepl ignores it

12:22 sdegutis: What's the use-case for higher-order Leiningen tasks?

12:22 My googling for it only brings up github-issues relating to it.

12:25 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 lol at the topic btw

12:39 "top analysts expect this to be followed by newer versions with still higher numbers"

12:39 reminds me of the "maths" "look around you"

12:39 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 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 it's just a library you can add to :dependencies

12:44 xsyn: thank you kindly

12:45 technomancy: devn: oh man

12:45 I just saw "look around you" over the weekend

12:45 good times

12:45 devn: haha, yes

12:45 the second season is not nearly as good

12:45 technomancy: shame

12:45 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 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 "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 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 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 dnolen_: duplicate code removal, etc.

12:54 dnolen_: by all means if you have thoughts/suggestions please let me know.

12:55 dnolen_: julian stepped up and patched the whole thing to support cljs.

12:55 it was awesome.

12:55 garden was also my first real clojure library so there's definitely some n00bish stuff happening in there.

12:56 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 tonight i'll collect my thoughts and do that.

12:58 dnolen_: noprompt: cool

12:58 will check it out

12:58 noprompt: dnolen_: awesome!

12:59 the big thing would be advice on how to design a better compiler.

13:00 right now it takes two passes.

13:02 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 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 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 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 Don't know why.

13:31 ,(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 clgv: There: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj#L75-L76

13:34 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 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 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 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 :)

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 makes total sense now!

14:23 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 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 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 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 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 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 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 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 I don't think the inconsistency is a good thing

16:17 probably they should both error

16:17 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 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 It doesn't.

16:52 indure: it doesnt

16:52 I am losing confidence now

16:52 tbaldridge: I've experience this issue before.

16:53 try moving .submit into a pool

16:53 bleh, moving submit into a defn

16:53 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 (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 (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 (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 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 http://clojure.org/java_interop#Java%20Interop-Support%20for%20Java%20Primitives

17:30 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 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 https://www.refheap.com/56584 Here ya go.

17:54 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 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 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 the exception comes from ioc macros too, rather than compiler

18:00 Cr8: (go-loop is shorthand for (go (loop

18:00 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 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 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 time well spent

18:11 danielszmulewicz: amalloy: lol

18:11 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 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 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 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 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 turbopape, refheap.com

19:21 turbopape: here it is guys,

19:21 https://www.refheap.com/56627

19:21 thanks for help ...

19:22 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 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 I really need the loop to work plz :)

19:26 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 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 Thank you anyway, I sure owe you a lot in my path of enlightenment :)

19:33 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 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 just like when you make a queue out of two linked lists by reversing one of them

20:06 TravisD: Ah, yeah

20:06 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 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 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 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 Hm, wait.

21:06 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 Profpatsch, I'm not using e.g. clojurescript if that's what you are referring to

21:11 currently it's fairly "plain" clojure code

21:12 Profpatsch: Because you said not Java only libs.

21:12 Everything is Clojure is kind of „Java only“ as long as you are on the JVM.

21:13 Every JVM language can access every JVM library.

21:13 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 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 It’s not nice (what is), but you definitely can.

21:15 Well, I guess jdbc interfaces with native (C/C++) libraries.

21:16 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 so the clojure.java.jdbc has nothing clojure specific in it?

21:16 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 I haven’t used the clojure jdbc interface yet, so I don’t know.

21:18 JDBC itself is just an API-Definition.

21:19 That specifies how to access (relational) databases with Java.

21:20 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 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 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 What are you trying to do anyway?

21:23 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 also I'm not really doing anything special in reference to my original question, it was more of a syntax curiosity

21:27 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 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 cuz that's the default type that comes out of the database for both date and time columns

21:28 (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 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 #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 That don’t make you scream in agony.

21:34 bufferloss: ok

21:35 yeah jdbc is painful :(

21:35 but, also fast

21:35 I guess, I mean about as fast as you can get in Java I would suppose

21:36 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 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 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 Normally you fire up your repl and that’s that for one productive session.

21:42 Lighttable does it in the background so you don’t even have to think about stuff.

21:44 For Clojurescript theres a Debian VM running with Vagrant, cljsbuild and a python server serving it inside tmux.

21:45 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 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 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 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 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 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 (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 It’s what I use all the time.

22:18 bufferloss: ok sweet I think I have the namespaces thing down now

22:18 time to check out this repl workflow y'all be holla' bout

22:19 was that appropriately hip?

22:19 does anyone actually use Maven for building clojure projects?

22:20 is there a benefit to using maven over leinengen?

22:22 last time I was working on a Java project I was using ant

22:28 Profpatsch, so, sorry but I don't entirely understand how the run-maths function is supposed to trigger my program

22:29 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 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 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 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 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 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 nodepad.exe for me :P

22:37 but, alas I fall short, because real programmers use butterflies

22:37 TravisD_: Ah, from the land of windows

22:37 Heh, M-x butterflies

22:37 bufferloss: nah, actually I am on ubuntu right now

22:38 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 !

22:39 emote failure.

22:39 ddellacosta: ha

22:40 bufferloss: yeah I'm masochistic like that

22:41 sometimes I use regedit instead and send keystrokes by updating the registry

22:45 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 which seems sub-optimal, esp if and or when the project grows and has many files

22:45 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 ,(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 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 TravisD: maybe a little one

23:16 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 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 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 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 mirror clojars

23:38 dissipate: amalloy, BTW, my poke at lazy bot was a joke. sorry it hit you the wrong way.

23:40 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 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 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. :(

Logging service provided by n01se.net