#clojure logs

2014-03-11

00:18nopromptany thoughts on creating a macro which targets clj/cljs w/ cljx that needs to return a reified instance of clojure.lang.IFn/IFn?
00:18nopromptanyone?
00:18nopromptlol
00:18clojurebotanyone is anybody
00:33seangroveHrm, I'm not sure that gridstylesheets are a 100% clear win. Seems like they definitely have the potential to be, but are missing a few things first
00:34nopromptseangrove: they're definitely more complex, if i'm thinking the same thing your talking about.
00:34seangrovenoprompt: http://gridstylesheets.org
00:34seangroveHands-down better than css at layout, but it's unclear how to handle some of the dynamic parts
00:35nopromptok i think that's different from what i was thinking.
00:36noprompti did some work on a very sophisticate layout system which used a font-size/line-height scale which generated a grid.
00:36nopromptit was meant to be used as a layout system.
00:37seangrovenoprompt: undoubtedly a good idea for you to checkout gss, the idea is certainly very interesting
00:37seangroveAnd it's right up your alley. Add some core.logic to garden, some accelerated 3d transforms, and boom :)
00:37nopromptseangrove: i've bookmarked it and will definitely give it a look.
00:38nopromptfwiw i used to work for a newspaper and there was just a ton of brilliant ideas in all the old books they had laying around.
00:38noprompti never understood why the same attention to detail in print never made it to the web.
00:39nopromptit's like the web came along and suddenly everyone when "well, this completely different so forget everything we've learned over the passed 100 years"
00:39noprompts/when/went
00:39nopromptbetter yet a 1000 years.
00:40seangrovebbloom_: Any thoughts on the constraints system in OSX now? GSS is based off of that, seems clever, much better aligned with app design
00:40nopromptseangrove: the amazing thing about clojure is that now there's actually a *very* good opportunity to build extrodinarily complex layouts.
00:41nopromptstuff that you simply could/would not do w/ sass/haml/etc.
00:41seangrovenoprompt: How so?
00:41nopromptseangrove: because you can unify both systems with protocols.
00:44nopromptseangrove: imho, while scss/less are great tools they're not powerful enough to build the kinds of systems you could build with a *real* programming language.
00:44seangrovenoprompt: I'm pretty curious about it
00:44seangroveAny example specifically?
00:45nopromptfor example w/ a reified object/datatype you can implement various protocols that express how to render itself in different contexts.
00:45nopromptseangrove: look at newspaper design. it's very complex.
00:46seangrovenoprompt: I'm more interested in app design, rather than newspaper design
00:46nopromptseangrove: definitely.
00:46seangroveCSS isn't very good at handling app design, to say the least
00:46nopromptit's not, but it can be if you program it.
00:47nopromptiow, w/ garden you can build better abstractions that express what you want in html/css.
00:47nopromptapp design or newspaper design.
00:47nopromptwhatever design.
00:47nopromptddellacosta: i'll take that as a complement. :)
00:48seangrovenoprompt: Let me know what you think about gss, it's certainly up there with what you're talking about
00:48seangroveThe documentation is lacking, but the ideas are solid
00:48ddellacostanoprompt: I've just always taken the opposite approach, which is to touch CSS as little as possible...but what are ya gonna do, it's there and it's not going away.
00:48bufferlossso my dates are coming out obviously in a "different timezone" than UTC, which my database is set to UTC
00:48seangroveddellacosta: Use gss :P
00:48ddellacostaI mean, I'm not a designer or a front-end layout person, I just pretend to be one.
00:48RaynesMy approach to dealing with CSS has always been to write CSS.
00:48bufferlossany way to prevent this? I've done some googling but nothing particularly satisfies the answer
00:48bufferlosser, the question?
00:48ddellacostaRaynes: :-P
00:49nopromptRaynes: you haven't written enough then. ;)
00:49bufferlossCSS3 is pretty much fine
00:49bufferlossSASS ftw
00:49bufferlossnot having to deal with IE ftw
00:49Raynesnoprompt: You lookin' for a paddlin
00:49ddellacostalet's all just acknowledge the elephant in the room, it's not CSS, it's the f*ing browsers
00:49nopromptRaynes: bring it. ;P
00:49seangroveddellacosta: ? It's certainly css.
00:49Raynesnoprompt: Brb packing my car.
00:49nopromptddellacosta: yeah, i'm with seangrove on this one.
00:50seangroveddellacosta: http://gridstylesheets.org/guides/ccss/
00:50ddellacostaseangrove, noprompt: yeah, do you guys write CSS to support IE8? Like, all features, across your apps?
00:50noprompti guess i'm biased.
00:51ddellacostawhenever someone throws a framework at me I'm just like...whatever. Doesn't change anything.
00:51nopromptin the past i've written large scss projects 3K-6K lines, i don't belive preprocessors are the future. period.
00:51seangroveddellacosta: Nope. But even once you're passed that, CSS is a hurdle to overcome in writing apps
00:51nopromptwhy would i want @for i through j when i could have (map some-fn (range i j))
00:51ddellacostaseangrove: right, I'm just saying, I'm not past that and a lot of folks aren't. I don't have the luxury of thinking of CSS in the terms that you guys are talking about it now.
00:52nopromptwhy wouldn't i want macros?
00:52nopromptlike this: http://noprompt.github.io/clojurescript/2014/02/10/media-query-breakpoints-with-garden.html
00:52Raynesnoprompt: Dear God, the fancy.
00:52RaynesIt burns.
00:53nopromptand as soon as i finish converting the sass parse tree to scss, i can use whatever's out there.
00:53nopromptsorry "to clj"
00:53ddellacostanoprompt, seangrove: I mean, granted, I'm writing for the enterprise, solely web-based apps. It's a different world than someone who is trying to write a system for up-to-date desktop and mobile browsers.
00:53nopromptRaynes: just a theme bro. lots of 20's inspiration.
00:53nopromptlol
00:54nopromptddellacosta: this is true.
00:54nopromptmy whole point is that CSS is awful. SCSS is an improvement, sure, but that's all it is.
00:55ddellacostanoprompt: well, then we are in agreement.
00:55nopromptcall me a smug lisp weenie, but i'd rather write my own language that abstracts all the CSS horse shit away and live in my ivory tower than write that.
00:56nopromptif anyone gave a damn i'd do kickstarter! LMAO!!!
00:56noprompthell i'll throw in type safety! cc/ ambrosebs
00:57ddellacostanoprompt: I'm totally down with that. But what I'd really like is some system that let me use css3 transitions transparently across browsers, handling all the shimming and whatnot. That's the kind of crap I get stuck on consistently.
00:57nopromptseangrove: but looking at what your working on, hey go w/ what you know, make the damn thing work. then get fancy.
00:57nopromptddellacosta: that's the whole idea! :)
00:57seangrovenoprompt: This *is* fancy
00:57ddellacostanoprompt: then give it to me
00:58seangrovenoprompt: But, check out constraint-based layout systems and compiling them to css/js runtime, and tell me what you can do with it in garden ;)
00:58seangroveThat'd be fantastic
00:58Rayneshttps://www.youtube.com/watch?v=zplc4Ienkws
00:58seangroveThat's almost certainly a much bigger opportunity
00:58nopromptguys, i was watching a lot of BoardWalk Empire and browsing http://www.jugend-wochenschrift.de/index.php?id=25
00:58ddellacostaRaynes: that looks creepy I ain't clickin
00:58Raynesddellacosta: It's a song.
00:58seangrovehttps://www.youtube.com/watch?v=47-xxp02PFg
00:58ddellacostanoprompt: pretty
00:59RaynesNo creepies.
00:59nopromptmy whole house is gonna end up looking like an art deco time machine.
00:59ddellacostaReba!
01:00bufferlosshow can I accomlish something like this with condp
01:00bufferloss,(let [value 2] (if (> value 2) "foo" (if (< value 2) "bar" "baz")))
01:00nopromptseangrove: it'll take time. no one really shares the vision i have and it's hard to find anyone who wants to be an active contributor.
01:00clojurebot"baz"
01:01nopromptseangrove: writing new code takes time and thought. improving the compiler each time is a big effort.
01:01seangrovenoprompt: Definitely. It's a pretty huge system you're working on
01:01nopromptseangrove: not to mention ensure i can support both cljs and clj.
01:02noprompti mean if i could just find one or two solid guys/gals who could give me a few hours a week that'd be awesome.
01:02nopromptand ddellacosta, i could deliver on that promis.
01:03noprompt(deliver that-promise "d-d-d-deliver that promise yo")
01:03ddellacostanoprompt: :-)
01:05nopromptddellacosta: i did tell you about thorn right? https://github.com/noprompt/thorn
01:05nopromptddellacosta: css->clj is almost done w/ the exception of media queries.
01:05nopromptddellacosta: then the hard part scss->clj.
01:05ddellacostanoprompt: I was eavesdropping the other day right when you were talking about it with bbloom actually. :-O
01:05ddellacostanoprompt: very cool stuff, I gotta say.
01:06nopromptddellacosta: it was actually pretty easy once i figured out the right ruby spells.
01:06ddellacostanoprompt: yeah, it's kind of crazy the stuff you can do with the JVM huh?
01:07nopromptddellacosta: it's incredible. i kept telling my coworker how amazed i was for like an hour on/off.
01:08seangroveddellacosta: Worth checking out https://www.youtube.com/watch?v=ouzAPLaFO7I for an idea
01:08ddellacostaseangrove: will do, after I listen to this Reba song Raynes dropped on us
01:10mskoudAnyone who can help me with this: http://stackoverflow.com/questions/22316854/clojure-nested-maps-path
01:12ddellacostamskoud: you'll make it easier on yourself if you can make :children contain maps vs. vectors
01:13ddellacostamskoud: for example
01:13ddellacosta,(def x {:name "A", :id 1, :children {2 {:name "B", :id 2, :children []} 3 {:name "C", :id 3, :children {4 {:name "D", :id 4, :children {}}}}}})
01:13clojurebot#'sandbox/x
01:13ddellacostamskoud: then you can do stuff like
01:14ddellacosta(get-in x [:children 3 :children])
01:14ddellacostawhoops
01:14ddellacosta,(get-in x [:children 3 :children])
01:14clojurebot{4 {:name "D", :id 4, :children {}}}
01:14ddellacostamskoud: and
01:14ddellacosta,(update-in x [:children 3 :children 4 :name] "E")
01:14clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
01:14ddellacostaer
01:14ddellacosta,(assoc-in x [:children 3 :children 4 :name] "E")
01:14clojurebot{:name "A", :id 1, :children {2 {:name "B", :id 2, :children []}, 3 {:name "C", :id 3, :children {4 {:name "E", :id 4, :children {}}}}}}
01:15ddellacostaetc.
01:15mskoudok, thx ddellacosta, will try to explore this, sounds resonable!
01:15ddellacostamskoud: :-)
01:20mskoudit better but i still miss an index where i can lookup any id , independent of level/depth.
01:22mosber /join #incanter
01:29ddellacostamskoud: how so?
01:30mskoudGetting a record like this is ok (get-in @x [:children 3 :children 4]) , but i do not know which child element its in. Just need to get the element with :id 4 , know knowing where it is. Maybee i should build some sort of index.
01:32TravisDmskoud: Are you searching through the tree to find an element, and return the path to it?
01:32ddellacostamskoud: well, in that case I would just make it into a binary tree or something to be able to search easily on the ids, assuming they are unique.
01:33mskoudTravisD : Yes, thats right. And the id's are unique
01:39amalloyddellacosta: don't roll your own binary search tree, just use a map
01:39nopromptdammit. i think i'm actually gonna have to generate the clj/cljs code and cp/pst it into the file.
01:39noprompt:|
01:39ddellacostaamalloy: is it still efficient then to find nodes by id when you don't know where the node is?
01:40amalloyhuh? just one map of id->thing
01:40ddellacostaamalloy: I don't know how you'd do it without iterating through each branch, if your nodes aren't structured at all.
01:40ddellacostaright; see the above conversation for context
01:40TravisDIf the data is not already in a nice structure, you cant avoid doing a naive search through the tree
01:44nopromptoh duh, just import the clojure.lang.* stuff.
01:44nopromptthat was easy.
01:44ddellacostaheh
01:46ddellacostaamalloy: while I think mskoud needs some kind of structure it's hard to know what (probably *not* a binary search tree actually), but since the nodes have parent/child relationships to each other doesn't seem like a flat map would suffice. Would be interested to hear why that is not the case though.
01:47amalloyddellacosta: what i mean is, if the current hierarchy he has is important to him, then converting it to a binary search tree doesn't make any sense; and if he just needs an index to look up "something" by id, then a map is all he needs
01:47ddellacostaamalloy: right, gotcha...so he'd keep the index somewhere else.
01:49mskoudso keep the structure a plain map instead of a nested?
01:58amalloymskoud: presumably the structure of the nested map matters to you, so you can't just throw it away. but you can additionally maintain a flat map of id->path or something, which you use to make operations faster
01:59mskoudyes, that would be a good way to go. Any hint to how to create such a map.
02:00akhudekmskoud: iterate over the entire tree and build the map as you go
02:01akhudekof course, if you need to update the tree, you'll have to remember to update the map too
02:45sid_Hi there, I'm trying to use pulsar library in my project, but I'm getting this error:
02:45sid_(use 'co.paralleluniverse.pulsar.actors) Initializing core.typed ... Loading Clojurescript... Clojurescript found and loaded. Initializing cljs.core NullPointerException clojure.core/deref-future (core.clj:2108)
02:45sid_I've added the dependencies in my project.clj file.
02:46sid_can anyone please help
02:46sid_anyone?
02:46clojurebotanyone is anybody
02:46sid_anybody? :P
02:50sid_I searched on google but couldn't resolve it
02:51nopromptsid_: maybe browse the issue tracker?
02:51noprompti'm not familiar with the library, but you should do that or look at the stacktrace and try to figure out where the issue is.
02:53dsrxit looks like you're trying to load some mish-mash of clojurescript and clojure
02:54dsrxer, I may be misreading that error
02:55sid_Stacktrace got me this: java.lang.NullPointerException: null at clojure.core$deref_future.invoke (core.clj:2108) clojure.core$deref.invoke (core.clj:2129) cljs.analyzer$resolve_var.invoke (analyzer.clj:347) cljs.analyzer$resolve_var.invoke (analyzer.clj:308) clojure.core.typed.util_cljs$resolve_var.invoke (util_cljs.clj:40) clojure.core.typed.parse_unparse$resolve_type_cljs.invoke (parse_unparse.clj:585) cloju
02:56sid_I'm pretty new to clojure
02:56sid_what can I do to resolve it
02:56sid_?
02:57nopromptsid_: did you browse the issue tracker yet?
02:58sid_how can I browse the issue tracker? Sorry if this is a lame question
02:59nopromptsid_: i think the project is hosted on github -> https://github.com/puniverse/pulsar
02:59nopromptsid_: browse the open/closed issues.
02:59nopromptsid_: if you can't find something open a new issue or attempt to ping the authors here.
03:01sid_I'll do that. Thank you for your help :)
03:01jph-is there a way to get progress from java.io/copy?
03:01nopromptsid_: no problem
03:01nopromptsid_: also, if you're new to clojure it might help to learn the basics before jumping in to something like pulsar.
03:02SegFaultAXsid_: http://www.clojurebook.com/
03:02nopromptsid_: get a handle on things first. that'll help you debug problems faster once you're more familiar w/ the clojure landscape.
03:02nopromptjust a friendly tip.
03:02noprompt:)
03:02SegFaultAX(inc noprompt)
03:02lazybot⇒ 7
03:05sid_Thank you for so much. I'm working on a web app and I encountered a situation in which I thought using actors would be a good. So I was going through pulsar and core.async.
03:05sid_Thank you so much*
03:05nopromptsure. :)
03:07dissipatehow important is it to study reducers when first learning Clojure? http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
03:08nopromptdissipate: it's not essential. you can get far w/o them.
03:08dissipatenoprompt, do you use them?
03:08nopromptdissipate: i've been programming clojure for a 1 1/2yrs and haven rarely used thme.
03:08noprompt*them.
03:08nopromptdissipate: it just depends on what you're doing. but they're fairly easy to learn.
03:09dissipatenoprompt, it just seems more and more stuff to learn!
03:09dissipatenoprompt, do you think it is a good thing that the core is getting bigger and bigger?
03:10nopromptdissipate: just my two cents: learn about things so you know about them; solve your problem with the core tools; if you need more horse power use power tools.
03:11nopromptdissipate: i don't have a problem w/ that no.
03:11noprompti've never found core to be bloated.
03:12nopromptand there's hardly any core function i didn't want or wanted improved.
03:12nopromptwell except for for re-matches and re-find.
03:12nopromptthose are terrible.
03:14dissipatenoprompt, you use core.logic?
03:14nopromptno not yet.
03:14sid_hey noprompt, I'm actually confused what to do. I need to maintain sessions of 60 minutes on a click event for multiple users parallely. I thought on using actors that could revert with a message that the 60 minutes session is over and return all the computations done in the fiber. Would it be good to use puslar in this case or would you recommend using something else?
03:15nopromptsid_: i can't speak to pulsar. i've really only used core.async. if you're working w/ the browser i'd recommend that.
03:16dissipatesid_, what about Redis?
03:18SegFaultAXdissipate: I will say this about reducers: they are perfectly usable without understanding how they actually work.
03:18sid_noprompt, how would I join a thread in core.async for 60 minutes? Is there something in clojure or should I use java's join interop?
03:18dissipateSegFaultAX, well, that's good because Hickey's article has me confused out of my mind. :O
03:18SegFaultAXAs long as you fundamentally understand the core functional operators map, filter, and reduce, you can defer learning how the library works for some time.
03:19SegFaultAXdissipate: http://www.infoq.com/presentations/Clojure-Reducers might be a good extra resource.
03:19sid_dissipate, clj-redis-session?
03:19SegFaultAXGood analogies for gaining an intuition about reducers.
03:20sid_dissipate, I'm already using lib-noir to maintain sessions when a user login
03:20dissipatesid_, yep, looks good to me. https://github.com/wuzhe/clj-redis-session should be able to create a session in Redis with a 60 second timeout that any thread can access.
03:21dissipateSegFaultAX, thanks. i'm actually still trying to figure out how recursive functions with lazy-seq work. seems to be somewhat like Python's 'yield'
03:22dissipatesid_, (wrap-session your-app {:store (redis-store redis-conn {:expire-secs (* 3600 12)})})
03:23SegFaultAXdissipate: Reading the source is instructive. Lazy seqs are just chained continuations.
03:23sid_dissipate, wouldn't it be better just to join a thread for 60 minutes? I'm already using lib-noir to maintain user login sessions
03:24SegFaultAXdissipate: Each cell in the lazy seq is either evaluated (in which case its value is already cached and returned immediately), or there is a thunk which will yield the next value (which is immediately cached and the thunk destroyed)
03:24dissipatesid_, but Redis is probably more robust. you need persistence for something that lasts 60 minutes.
03:25SegFaultAXsid_: What does "join a thread for 60 minutes" mean? Thread.join(60 * 60 * 1000)?
03:26sid_like dispatch something like a future for 60 minutes and it should return back after the completion if those 60 minutes with all the calculated results
03:27dissipateSegFaultAX, this is confusing to me: https://www.refheap.com/56279
03:27SegFaultAXsid_: Join probably isn't the tool you want to use for that.
03:27sid_SegFaultAX, joining won't work. I'm pretty new to futures and agents. Does futures really work that way
03:27sid_?
03:28SegFaultAXdissipate: It's idiomatic to wrap the outer-most form in the lazy-seq to defer as much execution as possible.
03:28sid_completion of*
03:28SegFaultAXsid_: Do futures really work what way? I have no idea what you're talking about.
03:29SegFaultAXBut blocking the main thread for 60 minutes waiting for a thread to return seems insane.
03:30sid_yup, my bad, joining would be bad
03:30dissipatesid_, you really ought to consider some kind of persistence for your sessions
03:30SegFaultAXsid_: So what are you really trying to do?
03:30sid_can you suggest something?
03:30SegFaultAXsid_: Can you describe the problem you're trying to solve?
03:31sid_I'm working on a web app, which provides user registration on it
03:31sid_after user registration, a user can start a new test
03:31sid_for 60 minutes
03:31SegFaultAXWhat's a test?
03:32sid_test as in any kind of test related to academics
03:32SegFaultAXOh like an exam
03:32SegFaultAX?
03:32sid_yup
03:32SegFaultAXOk, go on.
03:32sid_so i need to maintain a a session of 60 minutes for that test session
03:33sid_and at the end of the test, I need to add those results in the database
03:33SegFaultAXOk
03:33sid_what would you suggest I should do?
03:34SegFaultAXDepends on the format of the exam.
03:34SegFaultAXDoes the client send the user's response after each question?
03:34sid_yes it does
03:35sid_I'm pretty confused what to do
03:35SegFaultAXDoes it need to be very exact? Down to the second?
03:36sid_no, I want to add the answers to the database at the end of 60 minutes
03:36SegFaultAXI mean the length of the session.
03:37sid_yes, the length of session should be exact
03:38SegFaultAXOk, based on what you've told me I can think of a few ways to model this.
03:39SegFaultAXMVP might be a user table, a session table, and a response table.
03:39SegFaultAXA user has many sessions, and a session has many responses.
03:39SegFaultAXA session also has a start time and a duration (or end time, as you like)
03:40SegFaultAXThe business logic is essentially "allow new responses to be inserted for this session as long as the session is still open"
03:40SegFaultAXOr you could always allow responses to be recorded, but only count those that were created within the session window.
03:41SegFaultAXYou can easily provide an endpoint to query how many seconds are remaining in the session to update/synchronize the UI.
03:41sid_okay..so paralleslism doesn't come in if a lot of users are talking the test session at the same time?
03:41SegFaultAXsid_: Each user has their own session.
03:42sid_wouldn't that impact the performance?
03:42SegFaultAXsid_: There is also probably some sort of test table, and so a session belongs to a user and a test (it's essentially a join table with some additional metadata)
03:42SegFaultAXa) Don't optimize prematurely, b) no it wouldn't.
03:42SegFaultAXSince you can do an index scan on the join table by (user_id, test_id)
03:43SegFaultAXIf you have a group of students taking the test together and that's a meaningful thing you want to capture, you could create a session group, which has many sessions.
03:44SegFaultAXThen you could ask questions like "which students took this test together?"
03:45SegFaultAXAnyway, that's just one idea for how to implement it.
03:45sid_so all the queries for an individual user has to go through what? a thread?
03:45SegFaultAXsid_: What?
03:46SegFaultAXWhat do threads have to do with this?
03:47sid_like, each question returns a question id and answers when going to the next question
03:47dissipate,(first (iterate inc 2))
03:47clojurebot2
03:47sid_I'll have to store those results somewhere?
03:47SegFaultAXsid_: As I said presumably you'll have some representation of a test.
03:48sid_would it be feasible to let an actor do all those tasks
03:48sid_and at the end of session just add those results to the database?
03:48dissipatesid_, you should store every single result the student gives in some persistent DB. depending on how important the data is.
03:49SegFaultAXsid_: Um, I don't feel like we're talking about the same thing.
03:49dissipatesid_, no, not at the end of the session, during the session, store everything the student gives you persistently
03:49SegFaultAXYou're asking about actors and threads and I'm trying to help you conceptualize your problem.
03:49sid_I was thinking of storing those results in an atom
03:49dissipatesid_, why? store them in a DB or some persistent layer.
03:50dissipatesid_, you could do something like memcached or redis, with a mongodb capped collection for additional caching.
03:51SegFaultAXdissipate: Dude, what?
03:51SegFaultAXmemcache, redis, and mongo all in one sentence?
03:51SegFaultAXsid_: Why don't you focus on getting a working solution first before you start trying to "optimize"
03:52dissipateSegFaultAX, why not? if memcached or redis go down, you still have mongo as a backup. but like i said, depends on how important the data is.
03:52sid_SegFaultAX, okay, so I'll do as yo usay
03:53SegFaultAXdissipate: http://i.imgur.com/f9bQXZA.png
03:53dissipatesid_, i don't see why you are getting into threading stuff. should be handled by your web framework.
03:53sid_when does atoms, refs, agents, futures come into picture?
03:54SegFaultAXsid_: When you require coordination, synchronization, or parallel execution.
03:54dissipateSegFaultAX, i'm not advocating mongodb as a primary database. but it can be used for caching IMO.
03:54SegFaultAXWhich at this phase, you clearly don't.
03:55sid_so these test sessions aren't parallel execution. I'm sorry I'm a complete n00b
03:55sid_:/
03:55dissipatesid_, should be handled at the web server layer
03:56SegFaultAXsid_: Why don't you just start building the test taking part for now? Worry about all that other crap later.
03:56SegFaultAXI think it's better to nail down the core domain models and logic first anyway.
03:56dissipateSegFaultAX, DDD?
03:57sid_Thank you SeagFaultAX and dissipate for your help :)
03:57SegFaultAXDDD-lite
03:57SegFaultAXsid_: Good luck mate.
03:57atyzSo I'm currently logging a couple of datomic entities. However there are several fields I would like to redact from the logs... Is there a nice way to do this?
03:57dissipateSegFaultAX, you a fan of Uncle Bob's 'Clean Architecture'?
03:58sid_I'll work on the model and than think about optimization
03:58sid_just out of curiosity, aren't test session a parallel execution?
03:58atyz(turning it into a map doens't work because something like (into {} entity) doesn't resolve components
03:58dissipate,(take 1 (iterate inc 2))
03:58clojurebot(2)
03:59dissipate,(first (iterate inc 2))
03:59clojurebot2
03:59dissipatevery interestng
03:59TEttingerit is odd how iterate does that
03:59TEttinger0 calls, then 1 call
03:59dissipateTEttinger, what do you mean?
03:59SegFaultAXTEttinger: Huh?
04:00TEttinger,(take 5 (iterate inc 2))
04:00clojurebot(2 3 4 5 6)
04:00SegFaultAXThe first value of iterate is the initial value.
04:00pyrtsaTEttinger: It's just like how (reductions f init xs) behaves.
04:00dissipateTEttinger, one evaluates to a list of 1 value, the other evaluates to just 1 value
04:00TEttinger0 calls to inc, 1 call to inc, 2 calls to inc... is what I mean
04:00SegFaultAXTEttinger: Why is that weird?
04:00alewiterate explicitly says it returns the inital arg as the first value
04:00TEttingerI just wasn't aware of other fns that acted like that until now
04:01dissipateTEttinger, that's how iterate works. f(f(f(x)))
04:01dissipateno?
04:01clojurebotno is tufflax: there was a question somewhere in there, the answer
04:01SegFaultAXdissipate: x, f(x), f(f(x)), f(f(f(x))).
04:02TEttingerdissipate, yeah I know, I just mean it is sorta a different way of thinking about the result is all
04:02dissipatealew, so why does 'take 1' evaluate to a list?
04:02alewwhat is with this odd notation of putting the opening paren after the function name
04:02TEttingermap doesn't preserve the base values unless you tel it to
04:02dissipateSegFaultAX, so why doesn't 'take 1' result in the value by itself?
04:02alewtake always returns a lazyseq
04:03SegFaultAXdissipate: Because take is a sequence operation.
04:03SegFaultAX(take 3 (range))
04:03SegFaultAX,(take 3 (range))
04:03clojurebot(0 1 2)
04:03TEttingerfirst is similar to (nth coll 0), take is more like a subsequence
04:03dissipate,(first (range))
04:03clojurebot0
04:04dissipateSegFaultAX, gotcha
04:04dissipateSegFaultAX, that sieve function is quite clever then. it uses 'first' instead of 'take 1'.
04:05dissipateSegFaultAX, which triggers the caching mechanism? 'first' or 'take x' ?
04:05SegFaultAXdissipate: First always forces a value. take is lazy.
04:07nonubyenlive question, trying to figure out the selector syntax to match an element that has a data-section attribute but this is not equal to "homepage-section" I though [[(attr? :data-section) (but (attr= :data-section "hompage-content"))] would work but not so
04:08dissipateSegFaultAX, is it possible to have a collection that is not an 'iterable', and hence cannot have 'seq' called on it?
04:09SegFaultAXdissipate: If you created your own collection and didn't use anything built into Java, sure. But ISeq is extended over the base Java iterable types.
04:10SegFaultAXNot sure why you would do such a thing.
04:13dissipateSegFaultAX, i dunno. one thing i do know is that i thought Python was a clever language. Clojure (and hence Lisp) seems to be on a whole other level of cleverness. i can see why many programmers are repelled by it. :P
04:18AmnesiousFunesIs there a convenient way to test a nested data structure for circularity, i.e. including atoms that at some point reference themselves?
04:19AmnesiousFunesOr should I just check every node in a branch for identity with its ancestors?
04:23SegFaultAXAmnesiousFunes: I'm not aware of any built-in way to do that. Use the standard recursive approach.
04:27AmnesiousFunesSegFaultAX: Thanks.
04:45dissipatehow is caching in a lazy sequence not a side effect?
04:46SegFaultAXdissipate: It is
04:46dissipateSegFaultAX, wtf. that's ridiculous.
04:47lvhdissipate: why is that ridiculous
04:47dissipateSegFaultAX, how can a core library function have side effects like that? the whole idea is to get rid of that.
04:47dissipatelvh, and is this caching done in STM?
04:47SegFaultAXNope.
04:48dissipatei just don't see how this is consistent with the 'pure function' philosophy
04:48lvhdissipate: iteration functions losing referential transparency is a lot worse of a side effect than caching
04:48SegFaultAXThe side effects are encapsulated.
04:48SegFaultAXIt's similar to doing side effecting code in a transient for speed.
04:48dissipateSegFaultAX, what if i have one thread calling 'realized?' on a lazy seq at the same time i have a thread calling 'take x' on the lazy seq?
04:49pyrtsadissipate: The caching is not done in STM but it *is* synchronized (see LazySeq.java if interested).
04:50SegFaultAXYup
04:50SegFaultAXdissipate: In general, you don't need to worry about these things.
04:51dissipatepyrtsa, is there a version of lazy-seq that has no side effects?
04:51pyrtsadissipate: You shouldn't write logic that causes side effects based on (realized? x). Only use realized? to check whether x *was* already realized.
04:51SegFaultAXlvh: Nice to see you on this side. :) Clojure is slowly pulling you away from Python.
04:51lvhSegFaultAX: soon I will be shipping 500MB uberjars that have clojure.core + jython in them
04:51pyrtsadissipate: What would that even mean? Just make sure that the iteration only produces results.
04:51pyrtsa...without causing side effects itself.
04:51lvhSegFaultAX: core.async is nice and all but twisted is still a few years ahead if you want to write protocols :)
04:52dissipatepyrtsa, what it would mean is that every time lazy-seq is iterated through, a brand new lazy-seq reference is created starting at the point where it left off
04:53pyrtsadissipate: As long as you keep the same head, the lazy-seq is only evaluated once.
04:53SegFaultAXpyrtsa: A thunk is only evaluated once*
04:53pyrtsaThanks for the correction.
04:54dissipateSegFaultAX, python and clojure are 2 different languages with different use cases IMO.
04:54SegFaultAXpyrtsa: Same head or not, it won't do unnecessary re-evaluation.
04:54dissipateSegFaultAX, i wouldn't use clojure as a scripting language because the JVM takes too long to start up, for instance.
04:54SegFaultAXdissipate: lvh is very well known in #python, I was commenting about that.
04:54pyrtsaSegFaultAX: Indeed. Only if you call the function that creates a lazy-seq repeatedly, will it evaluate multiple times.
04:55pyrtsa*repeatedly call the function
04:56dissipateSegFaultAX, i see. i'm actually trying to get away from ruby, python, perl for medium/large apps, and use clojure instead.
04:56SegFaultAXdissipate: You and me both.
04:57SegFaultAXI'm trying to get away from Python and Ruby in general.
04:57alewdissipate: if you want to write clojure scripts, you could have clojurescript that runs on node.js :P
04:57dissipateSegFaultAX, but i see myself still using python etc. for scripting
04:57michel_slmdissipate: hopefully soon you can use ClojureScript for that
04:57SegFaultAXAbout 30% of my work is ops, and for that Python is perfect.
04:57dissipatealew, that's true, hadn't thought of that. :P perhaps i can escape entirely.
04:57alewSegFaultAX: checked out pallet?
04:57SegFaultAXBut for application development, I've lost my taste.
04:57SegFaultAXalew: Hah, no.
04:57chareClojure > Python and you know it
04:58dissipatemichel_slm, clojurescript has been ported to node.js?
04:58SegFaultAXalew: I looked at pallet about a year ago. I have no idea how people are building stuff with it.
04:58alewdissipate: as for caching, it's referentially transparent so it shouldn't violate the purity
04:58SegFaultAXThe documentation is horrendous and the code isn't particularly good either.
04:59alewSegFaultAX: it's really confusing mostly due to the docs
04:59dissipateSegFaultAX, i lost my taste before i even got into clojure. OOP just doesn't smell right to me. it is actually quite awkward in practice, and not really reusable.
04:59alewSegFaultAX: I know at least a few clojure companies that are using it
04:59michel_slmdissipate: I believe the newest version is now more Node.js friendly
04:59SegFaultAXI heard it was undergoing a complete rewrite or something, but that was like over a year ago.
04:59SegFaultAXWhat ever, boto and ansible work great.
04:59dissipateSegFaultAX, it's all about Rust. :P
04:59alewSegFaultAX: maybe you are talking about 0.8? I don't know what they are doing for 0.9 or 1.0 even
05:00michel_slmdissipate: aha, yes, you can -- https://github.com/clojure/clojurescript/wiki/Quick-Start
05:00SegFaultAXdissipate: I have issues with some variations of OOP. I don't take issue with object orientation in the general sense.
05:00dissipateSegFaultAX, boto? that's good but for some reason it was really lacking for AWS Simple Workflow
05:01SegFaultAXdissipate: Use the CLI API for anything boto doesn't provide.
05:01SegFaultAXOr the admin if you want, but that's so ugly.
05:02SegFaultAXWow is it 2a already? Sheesh
05:02SegFaultAXNight all.
05:03dissipateSegFaultAX, night
05:07BartAdvwhoa, writing some recursive stuff in SQL. thinking all the time how datomic could ease my suffering ;)
05:20anarscemerick: pull request regarding the empty roles set is up as of yesterday. also with a few comments. just fyi :)
05:48triyoWhat are the key changes to Clojure since 1.3.0 release? I have an app that's been happily running 1.3 and I'm looking into if it's worth putting some time aside, sooner rather than later, to upgrade to latest stable release.
05:50triyoany links summarising this info would be useful.
05:52dsrxtriyo: there's a changelog on the github repository https://github.com/clojure/clojure/blob/master/changes.md
05:52triyodsrx: thanks started looking through that (history of changelog)
05:57clgvtriyo: some very convenient threading macros: some->(>), cond->(>), as->
05:58triyoclgv: thanks, just saw those; added in 1.5. Very cool. Personally love the -> and ->>.
05:59triyoWhat was the main purpose of adding the reduces over standard map/filter/reduce?
06:00clgvtriyo: clojure.core.reducers you mean?
06:00triyo*reducers
06:00triyoyes, sorry, typo
06:00clgvtriyo: if so, then the main goal is parallelization of those operations
06:01dissipatetriyo, they were added so that you would have to learn more stuff
06:01dsrxhickey's got a good blog post about them here http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
06:01triyoweren't there pmap, etc.?
06:01triyodsrx: thanks for the link
06:01clgvtriyo: you cant parallelize efficiently with those lazy-seq based approaches. hence reducers
06:02clgvtriyo: that's because lazy-seqs are inherently sequentially
06:04triyooh I see, that makes sense.
06:04pyrtsaNot just parallelization, also stream fusion, AFAIK.
06:13triyosweet `reducers/fold` (parallelize reduction)
07:15CookedGr1phonIs there a way to temporarily set how many s.f. (or d.p. would do) a float will print for a given pr-str
07:15CookedGr1phonI have some long vectors of floats which are all 0.30000004 etc and so I only really need to see the 0.3, but as it is, it scrolls off the screen
07:27koalallama,(format "%.2f" 3.14159)
07:27clojurebot"3.14"
07:28pyrtsaCookedGr1phon: clojure.core/pr (and thus, pr-str) uses clojure.core/print-method or clojure.core/print-dup depending whether *print-dup* is truthy. In both cases, when the value x is java.lang.Double, you'll get x.toString(). So no unless you can change the printing function, no formatting is possible.
07:30CookedGr1phonpyrtsa: I've done it before, so I know it's possible
07:31CookedGr1phonJust couldn't remember how
07:31pyrtsaSee what koalallama wrote.
07:33pyrtsaCookedGr1phon: FYI, for both Double and Float (I don't know which you're actually using), 0.30000004 has a different internal representation than 0.3. That's why you don't see the rounding when converting to string.
07:33pyrtsa(Of course, neither 0.30000004 nor 0.3 are exactly representable as floating point numbers.)
07:50CookedGr1phonah, this is all different for clojurescript
07:51CookedGr1phonneed to extend protocol IPrintWithWriter
07:52pyrtsaAh, of course. Nice to hear. :)
07:56CookedGr1phondoesn't seem to work if i extend that for floats
08:03pyrtsaCookedGr1phon: Just change the printing function, I'd say. Extending protocols that aren't your own for types that aren't yours is usually a bad idea.
08:17CookedGr1phonwhat do you mean change the printing function?
08:18CookedGr1phonI'm printing arbitrary data, some of which has floats, which might be nested as the values of maps inside vectors, I can't just map over this and print it myself
08:54BartAdvdo you have some general tips how to find out why aot-compiled module gives InvalidArgumentException: argument type mismatch, whereas with aot turned off it runs just fine?
08:54BartAdvhttp://lpaste.net/3729188939110547456
09:00BartAdvok, nevermind, found the answer
09:00AeroNotixwhat are people using for Icinga?
09:00gvickersBartAdv: what was it?
09:01BartAdvhttps://github.com/clojure-android/neko/issues/23#issuecomment-37291111
09:12felherhey Folks. Quick question: is there a default/standard logging library for clojure? A link to it would suffice :)
09:12joegalloclojure.tools.logging
09:13joegallohttps://github.com/clojure/tools.logging
09:13felherjoegallo: great, thank you :)
09:13joegalloyou're welcome!
09:51jlpetersfolks, should I be able to access session variables from within the repl within emacs (for debugging and such?). My process is to visit the file that requires noir.session, run C-c C-k to compile the file, then run C-c M-n to switch the repl to the right namespace. With that setup done (and the server started via the repl), should I be able to get and set
09:51jlpeterssession values?
10:05clgvjlpeters: if those are stored in global "def"s (what noir did in most cases) then you should be able to access them
10:09jlpetersclgv: ok, I'll dig at it. I was getting casting errors which made me think I was missing a step somewhere Thanks!
10:13felherAnother quick question: is https://github.com/bbatsov/clojure-style-guide a good resource for a beginner? Is it followed by most people?
10:31gvickersfelher: 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:34clgvfelher: well some rules in there are debatable
10:36felherOkay, thanks, to the both of you. :)
10:37llasramI really should fork that thing and update it for my team's style...
10:37llasramExcept 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:37llasrams,that,something like that,
10:38clgvllasram: max-column-limit is always ones monitors width respective to the preferred font size ;) :P
10:40llasramI 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:40llasramAnd by "limit" I mean "general length to try to stay under, unless the code is harder to read unless you don't"
10:40llasramI'm not a monster :-)
10:41szymanowskihello, what would be the simplest way to overwrite the print-method dispatch function while keeping unchanged all methods?
10:41llasramszymanowski: print-method is a multimethod, so just extend it for a new type
10:41llasramOh, you want to change the dispatch function
10:41llasramHuh
10:41szymanowskiyes
10:41szymanowskii need it for some reason
10:42llasramhaha
10:42llasramAny mode details on what you're trying to achieve?
10:42szymanowskicertainly wrong reasons
10:42llasrams,mode,more,
10:43clgvllasram: ah that rule sounds not too bad with the ifs attached. well, some people just dont want to agree^^
10:43llasramszymanowski: 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:43lazybot⇒ clojure.lang.Symbol
10:43szymanowskii've got this (with-meta {:a 1 :b2} {:type 'Foo}) and would like to add a custom print method on it
10:43llasramszymanowski: er, let's try again: ##(type '^{:type :example} some-thing)
10:43lazybot⇒ clojure.lang.Symbol
10:43llasramugh
10:43szymanowskithe thing is my type is a symbol not a keyword
10:44llasramThat's fine
10:44szymanowskiso it dispatch on the class
10:44llasramDespite my failure to have a proper example
10:44clgv,(type ^{:type :example} {:a 1})
10:44clojurebot:example
10:44szymanowskiPersistentHashMap or ArrayMap
10:44llasramclgv: Thank you :-)
10:44clgv,(type ^{:type 'Foo} {:a 1})
10:44clojurebotFoo
10:44llasramszymanowski: So there you go -- just extend print-method for the symbol `Foo`
10:45clgv,(defmulti foo type)
10:45clojurebot#'sandbox/foo
10:45clgv,(defmethod foo 'Bar [x] (println "Bar:" x))
10:45clojurebot#<MultiFn clojure.lang.MultiFn@367342>
10:45llasram,(type '^{:type :example} some-thing)
10:45clojurebot:example
10:45llasram&(type '^{:type :example} some-thing)
10:45lazybot⇒ :example
10:45llasramHuh
10:45llasramwhat##(type '^{:type :example} some-thing)
10:45lazybot⇒ clojure.lang.Symbol
10:45llasram!!!!!
10:46clgv,(foo (with-meta {:a 1} {:type 'Bar}))
10:46clojurebotBar: {:a 1}\n
10:46llasramDifferent evaluation processes for the lazybot's different way of giving it forms!
10:46szymanowski:)
10:46szymanowskithank you
10:46clgvllasram: patch it^^
10:47llasramIf I have the time
10:47llasramI'm trying to chill out a bit more right now. Was working too hard for several months and got a bit burned out
10:50clgvoh ok
10:51szymanowskii 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:54llasramOh
10:54szymanowskican i just grab (methods print-method) , then redefine print-method multi with another dispatch fun and then re add the originals methods after?
10:54llasramszymanowski: I'm sorry, -- I thought you were just mistaken. I really didn't remember that limitation
10:54llasramThat's very strange
10:55llasramI seriously thought it just used the `type` function to dispatch
10:55llasramHmmm
10:56szymanowskiis there something like (add-method my-multi a-function) ?
10:58llasramKind of... Trying something
10:59Anderkentszymanowski: uh, other than (.addmethod my-multi a-function) ?
10:59Anderkentbut that's pretty much the same as defmethod
10:59szymanowskiok I suppose this is what I need
10:59Anderkentit's equivalent to defmethod, sorry, need to read back to see what you actually want
10:59szymanowskiok
11:03Anderkentszymanowski: so, I wouldn't do this ever, but you could in theory chnage the dispatch function on existing multimethod via java reflection
11:04szymanowskireflexion is arcane to me
11:04Anderkentbuuut 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:04szymanowskireflection*
11:04llasramAnderkent: It's final, so that might result in madness
11:05llasramHere's a probably-equally-insane approach
11:05Anderkentllasram: .setAccessible! XP
11:05Anderkentoh and
11:05AnderkentmodifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
11:05AnderkentxP
11:05llasram,(defmulti print-method* (fn [x w] (type x)))
11:05clojurebot#'sandbox/print-method*
11:05llasram,(doseq [[dv m] (.getMethodTable print-method)] (.addMethod print-method* dv m))
11:05clojurebotnil
11:05llasram,(doseq [[dv dvs] (.getPreferTable print-method), dv' dvs] (.preferMethod print-method* dv dv'))
11:05clojurebotnil
11:06llasram(.bindRoot #'print-method print-method*)
11:06llasram,(.bindRoot #'print-method print-method*)
11:06clojurebotnil
11:06llasram,^{:type 'Foo} {:anything :at-all}
11:06clojurebot{:anything :at-all}
11:06llasram,(defmethod print-method 'Foo [x w] (.write w "<Foo on you>"))
11:06clojurebot#<MultiFn clojure.lang.MultiFn@cbab2>
11:06llasram,^{:type 'Foo} {:anything :at-all}
11:06clojurebot<Foo on you>
11:06llasramHaha!
11:06Anderkent;_;
11:06szymanowskigreat
11:06Anderkent...
11:07llasramszymanowski: OOC, are you using Abracad?
11:08clgv,1
11:08clojurebot1
11:08clgv,^{:type 'Foo} {:anything :at-all}
11:08clojurebot<Foo on you>
11:08szymanowskino i don't know Abracad
11:08clgvdamn no separated sandboxes ;)
11:09TimMcclojurebot, why can't you be more like those scheme bots?
11:09llasramszymanowski: Just curious if that's where you were getting things with symbol `:type`s from
11:09clojurebotI don't understand.
11:09clgvszymanowski: my example showed you how to use the symbol
11:10llasramclgv: Huh? But it only works because I replaced print-method :-)
11:11szymanowskithank you again to all of you
11:11clgvllasram: what do you mean?
11:11clgvllasram: I just used a different multimethod for the example but showed dispatch for a symbol
11:11llasramOh, I see
11:12llasramI misunderstand the referent of "my example"
11:43gfredericksaugh now I think cider is doing (use 'clojure.repl) too
11:45gtrakgfredericks, cider has a lot of work to be done, come help!
11:46gtrakmoving inlined code out is my jam.
11:46gfredericksbut I don't know elisp
11:46gtrakme neither..
11:46gfredericksI just found nrepl-repl-requires-sexp
11:47gfrederickswhich duplicates functionality in reply, but I guess reply isn't part of the cider setup
11:47gtrakwe 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:47gtraka collection of nrepl middlewares and ops
11:48gtrakat that point, we can delete a bunch of elisp
11:48gtrakhttps://github.com/clojure-emacs/cider-nrepl
11:48gfrederickswill this be sharable by `lein repl`?
11:49gtrakyea, I made a lein plugin for it, I'm using it daily.
11:50gtrakmostly I started working on it b/c completion for CLJS is impossible otherwise.
11:50gtrakor impractical..
11:50gtrakthe inline code is unmaintainable.
11:51gfredericksyeah
12:18gfredericksfun problem: writing your :repl-options {:init (...)} code so that it composes under concatenation
12:18gfredericksI think ((comp last list) (do some) (init things)) might be the easiest way?
12:19gfredericksI guess there's no reason to return the last value at all
12:19gfrederickspresumably nrepl ignores it
12:22sdegutisWhat's the use-case for higher-order Leiningen tasks?
12:22sdegutisMy googling for it only brings up github-issues relating to it.
12:25sdegutisIs it mostly used for combining compilation tasks into a single one like `lein compile-everything`?
12:28hyPiRionsdegutis: to change profiles (with-profile), to reuse a lein shell (do) or to run with more perf/less memory overhead (trampoline) mostly
12:35cbp,(macroexpand '(-> x ((f a b))))
12:35clojurebot((f a b) x)
12:37xsynHow do you patch a live system through the repl?
12:37devnjump into the namsepace, redefine a function
12:39devnlol at the topic btw
12:39devn"top analysts expect this to be followed by newer versions with still higher numbers"
12:39devnreminds me of the "maths" "look around you"
12:39devnmathematicians think there may be even larger numbers...
12:40xsyndevn: that's it?
12:40devnxsyn: i mean, you can do that.
12:40xsynyeah, I thought it would have been more complicated
12:40xsyngood to know :)
12:41pbostromxsyn: 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:42xsynso, 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:42technomancyxsyn: typically you embed an nrepl server in your application
12:43technomancyit's just a library you can add to :dependencies
12:44xsynthank you kindly
12:45technomancydevn: oh man
12:45technomancyI just saw "look around you" over the weekend
12:45technomancygood times
12:45devnhaha, yes
12:45devnthe second season is not nearly as good
12:45technomancyshame
12:45technomancyhave you seen Moments of Wonder?
12:45devnno!
12:46technomancyit is a treasure
12:46devnadded to my watchlist.
12:46devnfavorite episode?
12:46technomancyI think the one on Time probably
12:46devnbahahaha, omg, okay im sold, just watched 2min
12:47technomancybut they're super short and there are only five
12:47rasmustorelevant http://www.youtube.com/watch?v=nyd1XzGMxOQ
12:47devn"it's not like money, you can't taste it."
12:47devn"so, what is clocks?"
12:47technomancy"it will always be an unknowable mystery, like why the seasons change, or how telephones work"
12:47devnbahahaha. i love the accent.
12:49dnolen_noprompt: btw, are you actually pairing up Om + Garden?
12:49nopromptdnolen_: i've done a little bit w/ it but not much.
12:49nopromptdnolen_: thoughts?
12:50TimMctechnomancy: The Look Around You DVD set is on my wishlist.
12:50dnolen_noprompt: no, just wondered if you had something that worked for you.
12:50nopromptdnolen_: the clientside story for garden won't be compelling until there's and API for the CSSOM
12:51dnolen_noprompt: i see
12:51nopromptdnolen_: i mean you can still generate inline styles with garden.core/style for complex CSS.
12:52nopromptdnolen_: but i really need help w/ the project.
12:52dnolen_noprompt: what kind of help?
12:53nopromptdnolen_: ideas, code, improvements, etc.
12:53dnolen_noprompt: ok the general kind :) I've been keeping my eye on it
12:53nopromptdnolen_: 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:54nopromptdnolen_: duplicate code removal, etc.
12:54nopromptdnolen_: by all means if you have thoughts/suggestions please let me know.
12:55nopromptdnolen_: julian stepped up and patched the whole thing to support cljs.
12:55nopromptit was awesome.
12:55nopromptgarden was also my first real clojure library so there's definitely some n00bish stuff happening in there.
12:56nopromptdnolen_: maybe i should open an issue that explains what my ideas are for the next version?
12:57dnolen_noprompt: I usually find wiki design pages better for that sort of thing.
12:57nopromptdnolen_: ah, great idea.
12:57noprompttonight i'll collect my thoughts and do that.
12:58dnolen_noprompt: cool
12:58dnolen_will check it out
12:58nopromptdnolen_: awesome!
12:59nopromptthe big thing would be advice on how to design a better compiler.
13:00nopromptright now it takes two passes.
13:02nopromptdnolen_: 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:02dnolen_noprompt: definitely
13:04nopromptdnolen_: honestly, my dream here is to have a unified system for frontend development.
13:04noprompti think it's possible.
13:18clgvwhy do I need *print-dup* true in addition to *print-meta* true to get metadata annotations for symbols in printed output?
13:18clgvI do not care whether a PersistenArrayMap is used when reading that output back in, but I care whether metadata is restored as well
13:20rasmusto~+>
13:20clojurebotHuh?
13:21jjttjjI'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:23pyrtsa,(binding [*print-meta* true] (pr-str (with-meta 'x {:tag :foo})))
13:23clojurebot"^:foo x"
13:23pyrtsaclgv: ^
13:24clgvwell I use *print-meta* true
13:25clgvjjttjj: 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:25pyrtsa,(binding [*print-meta* true] (let [foo ^:foo 'x] (pr-str foo)))
13:25clojurebot"x"
13:26jjttjjclgv: thanks! sounds fun
13:29clgvpyrtsa: to be specific it is :type metadata on the symbol
13:30pyrtsaclgv: Are you sure you managed to attach the metadata?
13:30clgv,(binding [*print-meta* true] (let [foo ^{:type :bla} 'x] (pr-str foo)))
13:30clojurebot"x"
13:30pyrtsaI'm saying adding metadata like that apparently fails for symbols. with-meta works.
13:30pyrtsaDon't know why.
13:31pyrtsa,(binding [*print-meta* true] (let [foo (with-meta 'x {:type :bla})] (pr-str foo)))
13:31clojurebot"x"
13:31pyrtsaArgh.
13:31clgvpyrtsa: yeah I checked I have symbol with :type metadata in a map
13:32rasmusto ,(binding [*print-meta* true] (let [foo (with-meta {:not 'asymbol} {:type :bla})] (pr-str foo)))
13:32clojurebot"{:not asymbol}"
13:32pyrtsaclgv: 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:33pyrtsaclgv: There: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_print.clj#L75-L76
13:34pyrtsaSo 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:38clgvpyrtsa: humm I could fix it, since it does not need to be :type meta
13:40k3nytest..
13:41k3nytest..
13:45RickInAtlantaI 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:15amalloyRickInAtlanta: (fn [& args] (apply str args)) is just str
14:16cbpwhat's an okish embedded database that i can use inside a clojurescript/node-webkit program
14:17cbpmaybe i can use edn files
14:17amalloyRickInAtlanta: 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:20RickInAtlantaamalloy: Thanks, that worked
14:21RickInAtlantaamalloy: can you explain why it worked when I put the map into the let bindings?
14:22amalloyRickInAtlanta: 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:22RickInAtlantaor more specifically, why it didn't work when I called it directly in the go block
14:22RickInAtlanta:)
14:22amalloywhen the map was inside the while, you were creating a new mapped channel in each iteration of the while loop
14:23RickInAtlantaDOH
14:23RickInAtlantamakes total sense now!
14:23RickInAtlantathanks a ton
14:23amalloycore.async: reintroducing us to mutability problems we've forgotten how to deal with
14:24RickInAtlantaYeah, 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:28bbloom_(doc into-array) ; "type of the first value". ouch.
14:28clojurebot"([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:30amalloybbloom_: as opposed to what? walking over the array to find the least general type that can hold them all?
14:30bbloom_i assumed (into-array coll) was the same as (object-array coll)
14:31bbloom_been using it wrong for quite a while & probably have some subtle bugs around....
14:32amalloybbloom_: 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:33hadronzoo_What is the best way to pause a thread indefinitely?
14:33amalloyunplug your computer
14:33bbloom_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:33bbloom_i can see how that might be useful, but shit, burned me :-P
14:36cbphow do i use ex-info in clojurescript?
14:36cbpit doesn't seem to use the info map at all
14:36amalloyyeah, i suppose that's true. into-array's one-arg version is rarely useful
14:36cbpor gives me weird errors
14:36amalloymostly it's only good for making String[]s
14:38cbperrors such as "has no method 'call'"
14:39amalloycbp: paste a real error message
14:41cbpamalloy: err sorry my mistake. I was missing the throw
15:01Pate_Are there any large open source eCommerce systems currently being built in Clojure?
15:02stuartsierraPate_: Yes, but I can't talk about them. :)
15:04stuartsierraActually, 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:04Pate_Clojure+Datomic seems like a great platform to build an open source eCommerce platform on and offer commercial support/plugins.
15:04stuartsierraOh, you said open-source.
15:06stuartsierraI'm not aware of any open-source "platform" projects, but plenty of companies are building eCommerce systems with Clojure and/or Datomic.
15:07Pate_Is Runa built in Clojure?
15:10stuartsierrayes
15:11Pate_cool, (reading up on it). Runa's 20 odd peeps are now Staples Innovation Lab.
15:11Pate_Were you involved with that stuartsierra?
15:22FrozenlockIs 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:24TimMcHah, runa's jobs website is *still* malware-infested.
15:30apetasticanyone 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:32amalloyFrozenlock: use range, or even use map-indexed if you want: (for [[i x] (map-indexed vector xs)] ...)
15:33Frozenlockamalloy: thanks
15:44Anderkentoh hey 1.6.0-RC1 is out? Should totally be the topic
16:06jowagCan anyb please give me a concrete example of where the java equals is broken wrt. to Clojure's equiv?
16:08pyrtsa,(.equals 1.0 (float 1.0))
16:08clojurebotfalse
16:08pyrtsa,(== 1.0 (float 1.0))
16:08clojurebottrue
16:08pyrtsa,(= 1.0 (float 1.0))
16:08clojurebottrue
16:10S11001001,(.equals nil "42")
16:10clojurebot#<NullPointerException java.lang.NullPointerException>
16:11borkdudeHow do I get a value from a cursor, so I can use it in a normal function, in Om?
16:12indureI am having the same problem described here https://groups.google.com/forum/#!msg/clojure/asEXM2uHyxw/aK4rrKOKs1YJ
16:14indureany thoughts on whats going on?
16:15borkdudegot it, om/value
16:17gfredericksindure: my guess is the var version uses reflection, which picks the first method it finds at runtime
16:17gfredericksI don't think the inconsistency is a good thing
16:17gfredericksprobably they should both error
16:17gfredericksthere might be a ticket for this?
16:18pyrtsaindure: For getting rid of the actual problem, you should just add type hints, e.g.: (.submit ^ExecutorService pool ^Runnable f)
16:23jowagpyrtsa: thank you, so it is mainly an issue with numerics?
16:23induregfredericks: thanks. I'll check if there's a ticket
16:23indurepyrtsa: will do
16:24jowag(inc pyrtsa)
16:24lazybot⇒ 3
16:26pyrtsajowag: 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:31amalloyfor an example of where clojure's equality semantics are too permissive: ##(map (memoize pop) '((1 2 3) [1 2 3] (1 2 3)))
16:31lazybot⇒ ((2 3) (2 3) (2 3))
16:32amalloyin 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:32gfredericksamalloy: "too permissive" meaning you have a specific idea for how = should behave differently?
16:32pyrtsaGood one!
16:33amalloygfredericks: not really. just that the equality model has effects that are definitely surprising
16:34gfredericksroger
16:34amalloyhaskell'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:34gfrederickswho wants to make a dependently typed clojure
16:34pyrtsaamalloy: Actually, pop should be two functions, pop-last for vectors and pop-first for lists.
16:35amalloypyrtsa: i mean, i disagree, but even if we take that as a given, what about conj?
16:35pyrtsaLikewise.
16:35tbaldridgeI'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:35amalloyassoc? lots of things dispatch differently across types that clojure considers equal
16:36pyrtsaYeah, I know. The list goes on and on. But AFAICT, that would fix the problem with sequence equality.
16:36amalloypyrtsa: that's basically advocating removal of polymorphism. cure seems a lot worse than the disease
16:37pyrtsaUgh, I guess you're right.
16:37tbaldridgeagreed, the whole idea that things that are equal must act exactly the same, makes no sense to me.
16:37steckerhalterhow do find out why I get a stackoverflow after a few minutes?
16:37gfredericksClojure is a monomorphic, concretely typed, single-threaded, one-variable language with message-passing nulls.
16:38indurepyrtsa: hints didn't help - still getting same issue
16:39steckerhalterI'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:39pyrtsaBtw, 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:39tbaldridgesteckerhalter: perhaps one of you xml file is really deep?
16:40steckerhaltertbaldridge: no, they're pretty short
16:40tbaldridgesteckerhalter: most of the time stack overflows are pretty easy to debug if you look at the pattern of the overflow.
16:40pyrtsaindure: Can you paste the source code and the error you're seeing somewhere online?
16:40ToBeReplacedtbaldridge: maybe (= 1 1.0) should be nil?
16:40tbaldridgethere will normally be a cycle between a few functions, follow that path of execution.
16:41steckerhaltertbaldridge: ok, I will try
16:45indurepyrtsa: http://padfly.com/3323443344
16:49pyrtsaindure: 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:50indurehm..strange - trying ...
16:51tbaldridgedoes it stick to (fn...)?
16:51pyrtsaI don't think it does.
16:51pyrtsaIt doesn't.
16:52indureit doesnt
16:52indureI am losing confidence now
16:52tbaldridgeI've experience this issue before.
16:53tbaldridgetry moving .submit into a pool
16:53tbaldridgebleh, moving submit into a defn
16:53tbaldridgethen type hint the args to the defn
16:54pyrtsatbaldridge: 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:55pyrtsa(let [pool ..., f ...] (.submit ^ExecutorService pool ^Runnable f)) is what I usually use.
16:55tbaldridgeyeah that works too
16:56pyrtsaBeing able to do Java interop is definitely Clojure's big upside. But not its second nature.
16:56pyrtsa(And shouldn't be.)
17:08TravisDhow 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:09TravisD(I mean in clojure code, not calling java)
17:16stuartsierraType tags are *only* there to prevent reflective method calls. They are neither coercions nor assertions.
17:22splunk_TravisD: check out https://github.com/clojure/core.typed if you're interested in static type checking
17:23TravisDAh, I see. So there isn't any performance benefit?
17:23TravisDlike, 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:27splunk_it's a bit more involved than that to work with primtiives
17:27splunk_http://clojure.org/java_interop#Java%20Interop-Support%20for%20Java%20Primitives
17:30splunk_there's also a section on it in http://www.clojurebook.com/
17:30TravisDcool, thanks
17:51ProfpatschWhy won’t recur bow to my will: http://i.imgur.com/FAn9tRV.jpg ?!
17:51ProfpatschCan’t recur at line …
17:51llasramProfpatsch: Because you're posting images instead of using rehfeap :-p
17:52ProfpatschYeah, sorry. :P
17:53Profpatschhttps://www.refheap.com/56584 Here ya go.
17:54ProfpatschI don’t see why this wouldn’t work.
17:56Frozenlo`Github down o_O
17:56Anderkenteh, probably is confused by go's state machine
17:56ProfpatschoO
17:56ProfpatschYou mean a compiler error?
17:57amalloywell, an error in the go transformation macros? that certainly looks like it *should* expand into something in tail position
17:57ProfpatschOoooh, it worked once I re-evalled the whole file.
17:57ProfpatschNo idea.
17:57Anderkentwait what
17:58ProfpatschI think open-close-ui was a very old version, too, so I made it a stub. Maybe that was it.
17:59Anderkent(defn foo [x] (go (if (pos? x) (recur (dec x)) x))) fails for me
17:59Anderkentthe exception comes from ioc macros too, rather than compiler
18:00Cr8(go-loop is shorthand for (go (loop
18:00Cr8recur is fine inside a go, it just can't *cross* a go
18:03PinkPrincess,(map (fn [f] (f 1 2)) ((juxt juxt juxt) + -))
18:03clojurebot([3 -1] [3 -1])
18:03PinkPrincessImagine explaining the meaning of (juxt juxt juxt) to your mother.
18:04mdeboardPinkPrincess: Can you break down what's happening there
18:04mdeboardpls
18:05gtrakimagine explaining it to myself... :-)
18:05mdeboardgooby pls
18:06PinkPrincessWell... ((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:06PinkPrincessBut that may or may not make sense mostly in my own head.
18:06amalloyAnderkent: (fn [] (go (recur))) is clearly no good
18:06danielszmulewiczgithub crashed hard here. Anyone else noticed?
18:06mdeboarddanielszmulewicz: yep
18:06amalloyyou can't recur to the top of the function, you have to stay inside the go
18:06mdeboarddanielszmulewicz: been about a half hour or so
18:06danielszmulewiczright.
18:07AeroNotixstatus.github.com
18:07Anderkentah, sorry; didn't see it was go-loop rather than go
18:09amalloystatus.github.com is so reliable. they should just host main github services there
18:10AeroNotixamalloy: alol
18:11gtraki like how the octocat is red
18:11gtraktime well spent
18:11danielszmulewiczamalloy: lol
18:11danielszmulewiczgf3: ping
18:12stuartsierraProfpatsch: There have been some bugs with the `go` macro transformations and other macros such as ->
18:12hyPiRionamalloy: wasn't that like an actual, serious hacker news comment last time they were down?
18:12amalloyhyPiRion: probably. i certainly didn't come up with it myself
18:13stuartsierrahyPiRion: I saw it on a hacker news parody twitter account.
18:13amalloyactually 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:13amalloyyeah, https://twitter.com/shit_hn_says/status/421116237792284672
18:15mr-foobarHi all, toying with om. It seems om's dom utils, does not have dom/input element. not sure why ...
18:15hyPiRionstuartsierra, amalloy: It's a reference to https://news.ycombinator.com/item?id=7027040
18:16hyPiRionI don't know why I bothered to search that up
18:17Profpatschstuartsierra: I guess the Clojure devs are human, too. :)
18:17ProfpatschIs there a good solution for waiting on document.readyState without using jquery in Clojurescript?
18:20stuartsierraProfpatsch: And core.async is still alpha. Channels are pretty stable, but the `go` macro still has bugs to be worked out.
18:20mr-foobarProfpatsch: put script tag at end of the body ?
18:20Profpatschmr-foobar: Is that enough to make it work in every case?
18:20harmspamProfpatsch: (.addEventListener js/window "DOMContentLoaded" handler)
18:21ProfpatschWhat about readystatechange?
18:22mr-foobarProfpatsch: by the time the browser reaches the end of body, the dom is already there ... so you are good to go I think
18:23pbostrommr-foobar: om does have an input element
18:23Profpatschmr-foobar: Thanks, that worked.
18:26mr-foobarpbostrom: 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:27pbostromyeah, I think since input and other cannot have children they are not included in the macro file
18:29mr-foobarpbostrom: i was missing nil, (div/form div/input #js {....
19:03ProfpatschIs there something like clojure-toolbox.com for cljs?
19:03TimMcamalloy: I've seen status.github.com go down.
19:16turbopapehi 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:16turbopapeany one can assist ?
19:17hiredman,(doc dissoc)
19:17clojurebot"([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:17hiredmanreturns a new map
19:18qbgturbopape: code?
19:18turbopapeok
19:18stuartsierraAnyone ever seen `lein trampoline repl` cause "OutOfMemoryError: PermGen" when `lein repl` works fine?
19:18turbopapewhere can I post it ?
19:18bob2turbopape, remember you can't alter a map, just create a new map that differs in some way
19:18bob2turbopape, refheap.com
19:21turbopapehere it is guys,
19:21turbopapehttps://www.refheap.com/56627
19:21turbopapethanks for help ...
19:22turbopapeyeah bob2 , I'm totally aware...
19:22bob2what's in the map?
19:23turbopapesomething like { :k1 1 :k2 2...}
19:23qbgkey is going to be a seq
19:23bob2from that code perhaps you want (map ) instead
19:23qbg,(take 1 [1 2 3])
19:23clojurebot(1)
19:23qbgthat isn't what you want
19:23turbopapeokay,
19:23bob2since you're just doing a thing to every key and returning an aggregate thing
19:24turbopapeok, but If I don't do a loop, I won't be able to get the aggrefate thing (result)
19:24turbopapeIf I map, I'll have the result for each key at a time...
19:25qbg,(let [keys [:a :b :c]] (zipmap keys (map (fn [_] "whatever") keys)))
19:25clojurebot{:c "whatever", :b "whatever", :a "whatever"}
19:25turbopapeno actullay result is not just a plain zipmap ... I just simplified it here for the sake of the example
19:26turbopapeI really need the loop to work plz :)
19:26turbopapeI actually call a function depending on each key and recalling it on the result each time...
19:26qbg,(reduce (fn [m k] (assoc m k "whatever")) {} [:a :b :c])
19:26clojurebot{:c "whatever", :b "whatever", :a "whatever"}
19:27turbopapeyes qpg, thank you, but result isn't relevant here... I don't want the result, I want the loop plz :)
19:27qbg,(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:27clojurebot{:b "whatever", :c "whatever", :a "whatever"}
19:28turbopapeplz have a look on the new https://www.refheap.com/56627
19:28turbopapeok , thank you qbg :)
19:29qbgstill could use reduce with your updated refheap
19:29turbopapeyeah, maybe reduce after all...
19:30turbopapeThank you anyway, I sure owe you a lot in my path of enlightenment :)
19:33turbopapeabsolutely. Reduce !
19:41mischovDoes anybody have any good resources on packaging javascript libs like react-cljs does? Trying to understand what is going on there.
19:53TravisDCan someone suggest a resource on zippers? Partly I'd like a tutorial but I'm also interested in how they work
19:55amalloyTravisD: 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:55technomancywasn't there a conj talk on zippers a while back?
19:55TravisDamalloy: Great, thanks :) I suppose I should have checked Wikipedia.
19:58TravisDHm, 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:59FrozenlockIs there a way to make cljsbuild only build a single `build' when using "lein cljsbuild test" ?
20:00TravisDAlso, this business about types looking like polynomials and zippers being formal derivatives is pretty fascinating
20:05amalloyTravisD: well, "have to" reverse elements...it's just a different choice of representation
20:05amalloyjust like when you make a queue out of two linked lists by reversing one of them
20:06TravisDAh, yeah
20:06TravisDI am reading http://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf
20:51camelCaseIsUglyI 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:52gfredericksyou want src/project/core.clj and src/project/view.clj
20:53gfredericksthen (ns project.core) and (ns project.view (:use project.core))
20:54camelCaseIsUglyyep, that works. Thank you!
20:59ProfpatschoO, I can’t do (apply recur [thing1 thing2 thing3])
20:59ProfpatschRecur is seen as Var in my namespace. oO
21:06TravisD_Profpatsch: I think the issue is that recur is not a function, it is a special form
21:06ProfpatschTravisD_: Can you think of a way to do this?
21:06ProfpatschHm, an unquote splice is not an option in Clojurescript code.
21:06TravisD_You could use destructuring: (let [ [a b c] [thing1 thing2 think3] ] (recur a b c))
21:06ProfpatschBut not with arbitrary lists.
21:06ProfpatschHm, wait.
21:06ProfpatschThat wouldn’t make sense with recur anyway.
21:06TravisD_Profpatsch: Yeah, I think that is true
21:06ProfpatschWhoa, I *can* do an unquote splice in cljs functions?
21:06bufferlossdoes the (. Math pow arg1 arg2...) syntax work for "regular" clojure libs? i.e. not specifically java only libs, like clojure.java.jdbc ?
21:11Profpatschbufferloss: If you mean backend-agnostic, then no.
21:11bufferlossnot sure what backend-agnostic means, so... not sure?
21:11bufferlossProfpatsch, I'm not using e.g. clojurescript if that's what you are referring to
21:11bufferlosscurrently it's fairly "plain" clojure code
21:12ProfpatschBecause you said not Java only libs.
21:12ProfpatschEverything is Clojure is kind of „Java only“ as long as you are on the JVM.
21:13ProfpatschEvery JVM language can access every JVM library.
21:13ProfpatschIf I’m not mistaken.
21:13bufferlosswell 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:14bufferlossso just wondering if clojure libs, being written in clojure I would presume work differently than Java libs "written for java"
21:14ProfpatschYou can call Clojure constructs from Java.
21:14ProfpatschIt’s not nice (what is), but you definitely can.
21:15ProfpatschWell, I guess jdbc interfaces with native (C/C++) libraries.
21:16ProfpatschBut with Java and Clojure you stay on the JVM, so you can call everything available on the JVM.
21:16bufferlossk
21:16bufferlossso the clojure.java.jdbc has nothing clojure specific in it?
21:16bufferlossno features that I can use from clojure but not from java?
21:16ProfpatschAh, that’s where you’re coming from.
21:18ProfpatschI haven’t used the clojure jdbc interface yet, so I don’t know.
21:18ProfpatschJDBC itself is just an API-Definition.
21:19ProfpatschThat specifies how to access (relational) databases with Java.
21:20ProfpatschSo to be compatible clojure JDBC has to comply with that API. But I guess they do use quite a bit of syntactic sugar.
21:21bufferlossalso, 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:21bufferlossso I was wondering if there was maybe some restriction on clojure libs being called, but it sounds like there probably isn't
21:22bufferlossand I should just go try it and see anyway
21:22ProfpatschNo, especially the dynamic part of Clojure doesn’t play well with Java (lots of object casting necessary).
21:22ProfpatschWhat are you trying to do anyway?
21:23ProfpatschIt sounds like you want to incorporate Clojure in a Java project.
21:25bufferlossnope, I want to stay as far away from Java itself as possible :P
21:26bufferlossalso I'm not really doing anything special in reference to my original question, it was more of a syntax curiosity
21:27bufferlosswhat 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:27bufferlossnot 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:27Profpatschjdbc Clojure is a very low-level wrapper around the Java stuff.
21:27bufferlossbtw, what is an #inst() when it refers to some type of date object
21:28bufferlosscuz that's the default type that comes out of the database for both date and time columns
21:28bufferloss(using jdbc)
21:28ProfpatschIf 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:30ProfpatschKorma looks useable http://sqlkorma.com/ .
21:31gfredericksbufferloss: #inst is probably just how the thing is printing; use clojure.core/class to find out what it actually is
21:31gfredericks#inst is not type-specific
21:32ProfpatschIt’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:32ProfpatschThat don’t make you scream in agony.
21:34bufferlossok
21:35bufferlossyeah jdbc is painful :(
21:35bufferlossbut, also fast
21:35bufferlossI guess, I mean about as fast as you can get in Java I would suppose
21:36bufferlossalso, 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:38bufferlossoh 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:39ProfpatschWasn’t grenchman written in Ocaml?
21:39bufferlossI have no idea
21:39bufferlosswhy?
21:39brehautyes
21:39clojurebotwhy is the ram gone
21:39bufferlosslol
21:40ProfpatschThat was kind of a hurdle for me b/c on Arch it requires sever hundred MB of dependencies.
21:40xuserclojurebot: because java
21:40clojurebotHuh?
21:40xuserclojurebot: right
21:40clojurebotPardon?
21:40xuserclojurebot: no
21:40clojurebotno is tufflax: there was a question somewhere in there, the answer
21:40bufferlossok, so now I get "Unknown status:19namespace-not-found"
21:41ProfpatschBut I have to say that I don’t really need Clojure to boot that fast, since I seldomly start a clj process.
21:41ProfpatschNormally you fire up your repl and that’s that for one productive session.
21:42ProfpatschLighttable does it in the background so you don’t even have to think about stuff.
21:44ProfpatschFor Clojurescript theres a Debian VM running with Vagrant, cljsbuild and a python server serving it inside tmux.
21:45ProfpatschSo on finishing development just save VM to disk and start everything up again running next time.
21:48bufferlosswoot, grenchman works finally, sweet
21:49bufferlosswell, 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:50bufferlossin 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:50ProfpatschSo why not do that from the repl?
21:50bufferlosscuz it's not a text editor
21:51ProfpatschSo why not write a function that reloads the file from the repl?
21:51ddellacostabufferloss: can't you pull in whatever data you need via functions, and just re-run the thing in the repl?
21:51ddellacostaor, what Profpatsch said ^
21:51bufferlossProfpatsch, hmm, that might work
21:51ProfpatschIt’s like, two lines.
21:52bufferlossI'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:52bufferlossmy next goal mainly is to learn more about how to structure my code properly into namespaces/packages/whatever-theyre-called
21:52Profpatsch(defn run-maths [config-file] …)
21:53ddellacostabufferloss: 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:53bufferlossddellacosta, well, grench has just sped that up by a ton
21:53bufferlossbut I'm still interested in how to do it in repl
21:53Profpatsch(run-maths (slurp "path/to/file"))
21:54bufferlossslurp, I like it, is that a real method? :)
21:54ProfpatschOr, as per preference:
21:54Profpatsch(def *config-file* "path")
21:54ddellacostabufferloss: 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:55bufferlossddellacosta, sweet thanks
21:55Profpatschbufferloss: http://clojuredocs.org/clojure_core/clojure.core/slurp
21:55bufferlossProfpatsch, excellent
21:56ProfpatschI can very much recommend the cheatsheet: http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html
21:56ProfpatschIt’s what I use all the time.
22:18bufferlossok sweet I think I have the namespaces thing down now
22:18bufferlosstime to check out this repl workflow y'all be holla' bout
22:19bufferlosswas that appropriately hip?
22:19bufferlossdoes anyone actually use Maven for building clojure projects?
22:20bufferlossis there a benefit to using maven over leinengen?
22:22bufferlosslast time I was working on a Java project I was using ant
22:28bufferlossProfpatsch, so, sorry but I don't entirely understand how the run-maths function is supposed to trigger my program
22:29bufferlossI 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:29bufferlossor is there something specifically for doing that, e.g. "running" or "loading" a file?
22:29TravisD_bufferloss: As far as I know, it is strongly recommended to use leiningen
22:29TravisD_I think it uses maven behind the scenes
22:30bufferlossTravisD_, ok, I am using leinengen, was wondering why anyone would want to use maven given that leinengen exists :P
22:30TravisD_bufferloss: Regarding loading a file, I think the recommended approach is to use the :require options in the ns macro
22:33TravisD_I wasn't following the conversation, though, so I'm not sure of the context
22:34bufferlossTravisD_, 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:34muhooTravisD_: AFAICT it uses maven repositories (remote and local ~/.m2/) but doesn't actually depend on maven or mvn binaries
22:34TravisD_muhoo: Ah, cool
22:34bufferlosswas trying to make sense of his suggestion on how to go about doingi this
22:35TravisD_bufferloss: Hmm, it seems perfectly fine to me, or you could use a REPL to play with your code more interactively
22:35bufferlossall 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:35bufferlossI mean, I usually do keep a repl open but mostly for snippets that aren't much more than a few lines
22:35TravisD_bufferloss: I'm not sure I'd go that route
22:36TravisD_bufferloss: If you use emacs, you might want to check out cider. It makes a lot of this stuff very painless
22:36bufferlossk, grenchman seems to more or less take care of my previous gripe regarding the load time per script invocation
22:37bufferlossnodepad.exe for me :P
22:37bufferlossbut, alas I fall short, because real programmers use butterflies
22:37TravisD_Ah, from the land of windows
22:37TravisD_Heh, M-x butterflies
22:37bufferlossnah, actually I am on ubuntu right now
22:38bufferlosssome folks diss on the ubu, but it means I don't have to think mostly about my setup and I can just code
22:38TravisD_so.. you use notepad in ubuntu?
22:39ddellacostawine has come really far
22:39TravisD_\me shivers
22:39TravisD_!
22:39TravisD_emote failure.
22:39ddellacostaha
22:40bufferlossyeah I'm masochistic like that
22:41bufferlosssometimes I use regedit instead and send keystrokes by updating the registry
22:45bufferlossyeah, 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:45bufferlosswhich seems sub-optimal, esp if and or when the project grows and has many files
22:45bufferlossgrenchman is good enough for me for now
22:45TravisD_yeah, seems unwise to reimplement that functionality
23:00isaacbw(
23:00technomancybufferloss: can't you pipe a file to grench repl?
23:00isaacbw(println "Hi!")
23:00isaacbw,(println "Hi!")
23:00clojurebotHi!\n
23:01bufferlosstechnomancy, 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:01isaacbwhiredman: is the clojurebot here the same one on github?
23:03technomancybufferloss: you would need :reload-all for that
23:09amalloyisaacbw: github.com/hiredman/clojurebot is the source for clojurebot, yes
23:09amalloyalthough it seems like a lot of it is not hard-coded, but learned/taught facts. i'm not really sure how much
23:09TravisDAnyone here from Ann Arbor?
23:11amalloyisaacbw: github.com/raynes/lazybot also runs here
23:14isaacbwamalloy: which one would be a better bet if all I want is a clojure evaluator for my channel?
23:15amalloyi'd say it's easier to run your own lazybot, but then i helped write lazybot
23:15isaacbw:P
23:15amalloyyou can also just ask Raynes or me to put this lazybot in your channel. he's in a lot of channels
23:15isaacbwah, that might be nice. Let me check it out first though
23:15TravisDFor some reason that reminded me a lot of the movie Her. Many conversations! (hopefully not a spoiler)
23:16isaacbwwe 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:16isaacbwTravisD: maybe a little one
23:16isaacbwor a big one if I'm guessing correctly. I haven't seen it :P
23:16TravisDah, no, it's not a major thing
23:16dissipate,(= (and) (or))
23:16isaacbwokay
23:16clojurebotfalse
23:17TravisDYou probably wont recognize what I mean until you've watched it
23:17amalloyisaacbw: lazybot does haskell, at least
23:17isaacbwooh
23:17amalloyi think rublets does a lot of languages
23:17isaacbwthat's two out of four
23:18dissipateamalloy, all these bots are a security disaster waiting to happen
23:18dissipateamalloy, who calls 'eval' on some random code anyways?
23:18amalloydissipate: yeah bro, selinux sandboxes are basically like injecting yourself with aids
23:18TravisDheh
23:19dissipateamalloy, selinux? really? i would have thought it would be running on BSD.
23:22amalloyyou're welcome to try and break clojurebot or lazybot, dissipate
23:22amalloyi think you'll find it's more difficult than just badmouthing everything you see
23:23dissipateamalloy, badmouthing??
23:23TravisDamalloy: It's impressive to me that these bots are open source and still safe enough to use
23:23lazybotdissipate: What are you, crazy? Of course not!
23:23ryantmI 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:24dissipateamalloy, i'm not into h4x0ring.
23:24amalloyTravisD: like anything else, they're safe because they're open-source
23:25muhoolol grenchmen. i think "simon le cowell" is a reference to "simon le bon"
23:25ryantmOh, I just found the map-> constructor. That works!
23:25TravisDamalloy: Yeah, I guess you have many eyes checking. But, I guess it's also easier to find potential exploits
23:25dissipateamalloy, bitcoin is open source, and someone broke it awhile back.
23:25amalloyi'm 100% sure there are vulnerabilities left somewhere in lazybot, but there are far fewer than there used to be
23:26TravisDdissipate: "Broke" might be a strong word, there
23:26dissipateTravisD, well, they were able to do a transaction for a ridiculous number of coins
23:26TravisDI don't know much about it, but I don't think that was a fault in the design of bitcoin
23:27dissipateTravisD, well it was because they didn't handle integer arithmetic properly in the C++ code
23:28TravisDdissipate: I was also under the impression that bitcoin was mostly a community and a protocol, with many different implementations.
23:28TravisDBut this is getting off topic! We can move it to clojure-social, if you like
23:28dissipateamalloy, did you say i 'badmouth' everything because i raised issues with 'shuffle' awhile back? just curious
23:28technomancynot exactly a lot of incentive to spend all day breaking into lazybot though
23:28amalloyif 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:29TravisDtechnomancy: But think of the power you would have!
23:29dissipateTravisD, sorry, i was referring to the Satoshi client
23:29amalloya malicious hacker could, what, wipe a VPS? that we have a backup of?
23:29dissipateamalloy, no, turn the VPS into a C&C
23:29ryantmDoes lazybot parse IRC messages in some rigorous way?
23:30dissipateryantm, yeah, it's called 'eval'
23:30ryantmI don't mean the PRIVMSG contents.
23:31bufferlosshow do I pass a sql date back into clojure.java.jdbc
23:31dissipate,(iterate)
23:31clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/iterate>
23:31dissipate,(iterate +)
23:31bufferlossI'm getting 'Exception in thread "main" java.lang.RuntimeException: Unable to convert: class java.sql.Date to Object[]'
23:31clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/iterate>
23:31ryantm,(defrecord Message [a b c])
23:31clojurebotsandbox.Message
23:32dissipate,(iterate + 1)
23:32clojurebot(1 1 1 1 1 ...)
23:32ryantm,(map->Message {:a 1})
23:32clojurebot#sandbox.Message{:a 1, :b nil, :c nil}
23:33amalloydissipate: 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:33xeqithe bots have vulnerabilites, but I found the recursive bot talk someone finally found to be more awesome
23:33dissipateamalloy, i offered to donate to clojars
23:34amalloyapparently 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:34dissipateamalloy, java is a bad language, period. bad especially for startups. that's in dispute?
23:35amalloyi don't intend to engage you on the merits of your claims. but you insult a lot of things
23:37dissipateamalloy, i think things could be better, that's for sure.
23:37noonianit's hard to argue that java isn't at the very least an improvement over c(++)
23:37amalloyso go make them better. write an amazing product in clojure. write a better sandboxer. find a bug in lazybot
23:38amalloymirror clojars
23:38dissipateamalloy, BTW, my poke at lazy bot was a joke. sorry it hit you the wrong way.
23:40dissipateamalloy, 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:42noonian,(doc shuffle)
23:42clojurebot"([coll]); Return a random permutation of coll"
23:42dissipatenoonian, oh man, don't get me started again....
23:42TravisDIs that not convenient?
23:43noonianlet me guess, it's not random enough for some use case?
23:43dissipateTravisD, it is convenient with a number of caveats that are not even properly documented.
23:44dissipatenoonian, 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:45ryantm,(map->Message {:a 1 :asdf 5})
23:45clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: map->Message in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:45ryantm,(defrecord Message [a b c])
23:45clojurebotsandbox.Message
23:45ryantm,(map->Message {:a 1 :asdf 5})
23:45clojurebot#sandbox.Message{:a 1, :b nil, :c nil, :asdf 5}
23:48dissipatenoonian, 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:49dissipatenoonian, in short, a design decision was made to cover up the deficiencies of hardware
23:49noonianidk, if i'm using shuffle i most likely don't care if it's not quite random
23:50dissipatenoonian, if you are a statistician, research scientist or a mathematician, you would care
23:51ryantmClojure has plenty of design decisions like that.
23:52dissipateryantm, i'm not surprised. what's another example?
23:53ryantmThere 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:54dissipateryantm, damn. :(