#clojure logs

2014-01-21

00:00xuserarrdem: but ltc just seems more promising
00:09deadghostyep ddellacosta looks like it was working perfectly fine
00:09deadghosthuman error as usual
00:20technomancyquizdr: what part of .sg are you in?
00:30quizdrtechnomancy there is really only one part, singapore is just a single medium-sized city. i live in the central part of it.
00:31technomancyquizdr: cool; I used to live in Yishun
00:31technomancyare you down near Bishan then?
00:32quizdrno i'm further south than that, not far from Clarke Quay, Little India, etc
00:33quizdrhow long where you here, and when?
00:33technomancyoh nice. my parents used to work near little india; a few blocks from dhoby ghaut
00:33technomancyI was only there from 99-01
00:34ddellacostadeadghost: ah, great. Yeah, sometimes you just need another pair of eyes to take a look. ;-)
00:35technomancyquizdr: do you write clojure for a singaporean firm?
00:36quizdryou probably would not recognize Singapore today. the economy has more than doubled since you were here, and even in the 2 years I've been here the city has changed a lot
00:36quizdrbut i love it here.
00:36technomancyyeah, my parents have visited there and they say it's so much more crowded
00:37quizdrthere is a functional programming group here that meets once a month. about 40 members, sometimes we meet at Google's headquarters, or other startups in the area. Except, the only language anyone of them knows is Haskell, which I do not, so I haven't gotten much out of the meetings.
00:37technomancyhm; still that's more than I would have expected =)
00:37quizdri fall under the category of Clojure Hobbyist at the moment, but my work is almost entirely in C++
00:37technomancyI got the vibe that most companies there were very conservative about technology choices
00:38quizdrWell, Haskell is a lot more conservative a choice that Clojure.
00:38quizdrThe largest startup in Singapore, Zalora, has grown to over 1000 employees in just 1 year, and they use Haskell entirely for their dot-com
00:38nopromptsome of these FP thought leaders make me sad. especially the haskell ones.
00:39technomancyin some ways. introducing an unfamiliar runtime is pretty risky for an ops team that already deploys the JVM.
00:39nopromptquizdr: that comment was unrelated to your discussion btw.
00:39quizdrat least that's what I've gathered, a lot of the Zalora folks are in the FP group
00:39nopromptjust letting off steam.
00:39technomancydoes dons work for a company that operates in Singapore?
00:40quizdrI am very intrigued by Haskell but I've barely got time to play with Clojure and I suspect the learning ciruve is much higher for Haskell from everything I can tell.
00:40quizdrtechnomancy what is "dons" ?
00:40technomancyquizdr: Don S., famous haskell persona
00:40technomancyStewart maybe?
00:41quizdri don't know who that it is, but have you heard of Dr. Shaun Martin?
00:41nopromptquizdr: haskell does require a bit more effort than other languages. but even if you neve use it you'll learn a lot of interesting ideas.
00:41technomancyI just remember hearing him say they had good luck hiring for positions in what I believe was a financial company
00:41technomancyquizdr: no, I haven't read a whole lot about haskell
00:41technomancyI lean more towards OCaml myself =)
00:42quizdryes i've heard nothing but good things about Haskell, and maybe one day I'll amuse myself with that also. I'm going to an interesting talk this Friday from a Haskell guru who runs a company here that does behavoir analysis using FP
00:43quizdrthis guy runs a company here called Applied Cognitive Science, and here is the talk this Friday: http://www.meetup.com/HASKELL-SG/events/158576232/?gj=rcs.j&a=co2.j_grp&rv=rcs.j you guys should come
00:43technomancyI would definitely go if I were there =)
00:43quizdrhis background is MIT, the Princeton Institute of Advanced Study, and Oxford. Should be interesting.
00:44quizdrfrom what I understand, developers here have it nice. It was very easy for me to get a long-term visa, and they are at the top of the list for top-tier work passes and jobs
01:17quizdrI'm reading about mutual recursion inside a lazy-seq; is the reason why it doesn't consume stack space like the un-lazy mutual recursion simply because you may not be retaining the head of the lazy-seq?
01:23amalloyretaining the head of a lazy seq doesn't affect stack usage, just heap
01:24amalloyit doesn't consume heap because a function which returns a lazy seq just immediately returns a thunk. the caller calls that thunk to realize one element, and that produces a Cons object, whose head is a value, and whose tail is another lazy sequence
01:24quizdrhere's the code and question more clearly: https://www.refheap.com/26085
01:24amalloyso the lazy-seq function doesn't do any recursion immediately; it bounces off the caller's stack frame
01:27amalloywellllllll, my above claim relies on the fact that eventually an actual element will be produced. in your example, where there are N nested sequences before any fully-realized element can be produced, you'll get a stack overflow if N is large enough
01:28quizdrIn a non-lazy version of this code, you'd get an overflow error quickly. This lazy version is only avoiding that because the print-level halts the realization of N elements, such that 10,000 are not actually being realized, right?
01:29amalloyyes
01:30quizdrunderstanding laziness has been one of the tougher challenges for me to get used to
01:32quizdrso safe to say that printing something out is a form of head retention, even if you are not storing the results in a var, right?
02:30amalloyno. deeply-nested lazy sequences are a different issue from retaining the head of a long sequence
02:41ro_stdnolen: your youtube video is awesome! did you have to do anything special to get the browser connection going? or is that just lighttable magic?
02:42ro_stdnolen: do you know of a way to stop react eating runtime errors so that i can see a meaningful stacktrace in the debugger?
02:42quizdramalloy no i meant that when you print out a lazy sequence, you are forcing a kind of head retention, even if you are not storying that sequence in your code
02:42quizdrin that the REPL is essentially hanging onto it
03:10domino14hi, how do i loop through a set but also break out if i need to?
03:10greywolvewrite a loop recur?
03:11ro_stor use drop-while or take-while to produce a subset of the set to work with. less useful on an unsorted coll like sets, though
03:11greywolveor if there's a specific value you need use drop-while or take-while
03:12greywolvebingo ;)
03:12quizdror if you are just looking for something in the set and want to stop when you find it, there is "some" which will return the function result and stop right there
03:13greywolveawesome need to check that out
03:14quizdrin general, i'm finding, as a newbie, that a lot of the times my habits say to use loop/recur are actually the times i need to take a few extra minutes to think about a sequence function to use instead. often a single line of code can replace a few lines of a loop
03:14Cr8well
03:14Cr8Om *was* very nifty
03:15Cr8I'm about two hours in to trying to make it not break when I remove an item from a list of things I'm rendering
03:15ro_sthave you seen the todomvc example, Cr8? might be an insight in there?
03:15ro_sthttps://github.com/swannodette/todomvc/tree/gh-pages/labs/architecture-examples/om-undo
03:15Cr8yeah, I'm reffing it
03:16Cr8that seems to just be doing (om/transact! [:path] filter pred)
03:17Cr8Uncaught TypeError: Cannot read property 'parentNode' of undefined
03:17Cr8is what I get
03:17Cr8from inside React
03:17Cr8could be a react problem
03:18fredyrCr8: for me that has usually been that the cursor is wrong
03:18fredyrCr8: so the data you send to the react rendering is undefined
03:19Cr8hm
03:19Cr8so what it as actually happening is I'm assoc'ing a :deleted flag onto the item, and the render just (filter's) deleted stuff out
03:20fredyrCr8: not sure about your transact! example above, seems a little off?
03:20Cr8I can update items in almost exactly the same fashion as long as the update doesn't cause them to not be rendered
03:21fredyrCr8: how are you able to update without rendering?
03:21Cr8mine's closer to (om/transact! my-data [] mark-as-deleted id)
03:21fredyri believe transact and update always trigger re-rendering
03:21Cr8fredyr: no, it does render when I do updates that don't remove anything
03:21Cr8if I swap out mark-as-deleted with thing-that-ticks-a-counter everything is fine
03:21fredyrCr8: ah right, i see
03:22Cr8reality: I have two buttons, one that's supposed to remove an item and one that's supposed to tick its counter
03:22fredyrCr8: you know you can use update! if you're just using the cursor without an path?
03:22Cr8oh
03:24fredyrCr8: shouldn't really matter though
03:25fredyrCr8: but it is a little nicer
03:26Cr8maybe is sablono's fault, had a problem earlier that went away when I switched back to plain om.dom
03:26ro_stom.dom is definitely required if you're using inputs, that's for sure
03:27Cr8yeah that was the first thing that broke
03:27Cr8these are buttons but I thought it'd be okay =P
03:27fredyrCr8: oh haven't used sablono
03:29fredyrCr8: is it good btw, apart from some things not working
03:30ro_stconfirmed. om/react is proving to be great
03:31fredyrro_st: that part i'm onboard with, was wondering about sablono specifically
03:32ro_stoh, yes, sablono is fine, it just doesn't have the stuff om.dom has for inputs
03:32fredyrah right
03:32Cr8well i like hiccup
03:32ro_stperfect for the rest, though. good old hiccup syntax
03:33fredyri've never liked hiccup that much :/
03:33ro_sti like using hiccup because it reduces the amount of function call reading you have to do. it aids the eye to distinguish between markup and logic
03:34ro_st[:button {:on-click #(prn "woo")} "Click me"] vs (dom/button #js {:onClick #(prn "woo") "Click me")
03:34ro_stmissing } in second example, but you get the idea
03:35fredyrsure
03:35fredyri think i agree also, but i has never bothered me that much tho
03:35fredyr*it
03:36ro_stjust another way to reduce cognitive overhead for me
03:37Cr8..
03:37Cr8yep, totally migrated off of sablono and it still breaks
03:37Cr8not sablono's fault then
03:37ro_stcode public, Cr8?
03:37fredyrCr8: refheap some code
03:37fredyr?
03:38Cr8let me hold undo for a sec
03:39Cr8https://www.refheap.com/26134
03:39Cr8the button on line 85 explodes
03:39Cr8excuse formatting, using LightTable and if it has indenty-stuff I don't know how to work it
03:40ro_stgah. my local adsl ipc is having issues. can't reach your refheap, sorry
03:41Cr8http://drop.crate.im/omthing.txt ?
03:42ro_stno, sorry. looks like i have a dns issue. le sigh
03:44fredyrCr8: nothing obvious that stick out unfortunately
03:45Cr8incidentally things worked when this list was a ul and not a table
03:46Cr8yep
03:46Cr8if I switch ul with table, remove the header line, and switch tr/td to li/span
03:46Cr8everything is fine
03:48Cr8I think maybe react + tables has a bug
03:48greywolvewhat's the error?
03:48quizdrdo agents typically share the same pool, or does each one get its own thread?
03:48Cr8Uncaught TypeError: Cannot read property 'parentNode' of undefined
03:49Cr8is what I get if an update happens that would cause a row to be removed from a table
03:49Cr8(but it's fine if the update removes the table entirely)
03:49Cr8(or adds a row)
03:49Cr8but if it removes a row and doesn't remove the table wholesale, I get that error
03:49greywolvebizzare
03:53Cr8at any rate
03:53Cr8now i'm in a position I didn't expect to find myself in:
03:53Cr8faking tables with CSS
04:05xificurCI am running a java app through seesaw and I wonder where do my println's actually print because they dont prin to the repl when I start the "app" from there
04:05xificurCwhen I start it from a terminal it prints to the terminal
04:06Cr8okay now that I'm past this issue this is excellent again
04:06Cr8xificurC: println's go to whatever java.io.Writer clojure.core/*out* is bound to in the calling context
04:06fredyrCr8: I made a suprt short example trying to remove a row in a table
04:07fredyrCr8: guess what error msg i got :s
04:07xificurCCr8: hm, thanks, will take a look
04:07Cr8(with-open [logger (clojure.java.io/writer "log.txt")] (binding [*out* logger] ... printlns in here go to log.txt ...))
04:08xificurCalso, anyone having troubles in emacs with `Lisp nesting exceeds 'max-lisp-eval-depth'`? when I cider-eval-buffer and one of the functions has an error I can never eval the buffer again (or the namespace definition)
04:08Cr8and that context isn't lexical, it carries into called fns. It's sort of kind of thread-local.
04:09Cr8fredyr: well at least we've got a minimum failing case now
04:15quizdris there a way to see if a particular var is dynamic? I'd have thought that this is part of the metadata, but it appears not
04:23clgvit's indeed called thread-local binding ;)
04:24clgv,(meta *out*)
04:24clojurebotnil
04:24clgv,(meta #'*out*)
04:24clojurebot{:ns #<Namespace clojure.core>, :name *out*, :added "1.0", :doc "A java.io.Writer object representing standard output for print operations.\n\n Defaults to System/out, wrapped in an OutputStreamWriter", :tag java.io.Writer}
04:24clgv,(def ^:dynamic *bla*)
04:24clojurebot#'sandbox/*bla*
04:24clgv,(meta #'*bla*)
04:24clojurebot{:ns #<Namespace sandbox>, :name *bla*, :dynamic true, :column 0, :line 0, ...}
04:24TEttingerheyyyy
04:25clgvso at least for self-"deffed" variables it is in the meta data
04:31Cr8what :dynamic does is change how code that references that var is compiled
04:32Cr8if you (def) over a var and define it as dynamic when it wasn't before, you'll be able to (binding) on it, but any fns that were compiled *before* you changed the metadata will only be able to "see" the root binding
04:33Cr8they *will* pick up the newly def'd value, as def changes the root binding
04:37fredyrCr8: i found what the error was now
04:38fredyrCr8: had a meeting, so i was away for bit
04:39fredyrCr8: tbody is auto-inserted in html if it is omitted
04:39fredyrCr8: which makes the diff fail
04:39Cr8ah
04:39fredyrCr8: and everything blows up
04:39Cr8i saw that happening in chrome
04:39Cr8i guess react was unaware of the implicit tbody?
04:40fredyryeah, it would seem so
04:40fredyri realized it could be the reason when inspecting the dom elems in chrome
04:41locksdo all the browsers insert tbody, or is this one of those wild west behaviours?
04:41fredyrits specified in the html4 spec
04:42locksah ok
04:42fredyrhttp://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#parsing-main-intable
04:46quizdrthanks guys, that was very useful, re: dynamic meta data
04:46fredyrhttps://gist.github.com/fredyr/8537199
04:47fredyri made a gist of the code btw
04:47fredyrmostly to remember if myself
04:47AeroNotixAnyone using cloverage
04:47AeroNotix?
04:51AeroNotixIt hangs after running the coverage+tests, really annoying for makefiles.
04:59greywolvefredyr and Cr8 : thanks, that's handy to know ;)
04:59Cr8welp
05:00Cr8now I've converted back to tables and things are fine now that I've put tbody in there
05:07fredyrCr8: nice
05:11dsrxargh... anyone ever set up austin in a weird environment that isn't served over http? (like a chrome extension or spotify application)
05:42quizdris Seesaw primarily for local interfaces like on a desktop JVM, or is it also a web interface builder for a browser?
05:46CookedGryphonquizdr it's very much swing oriented
05:47CookedGryphonI have been thinking about doing (or rather, really wish someone would do so I could use) a more generic interface/graphics library with js, swing, android backends
05:47CookedGryphonshouldn't be too tricky really, all the basics are the same, buttons, lines, etc. Just make it all data based and declarative
05:48quizdrok, i just read about Seesaw and Swing for the first time, I'm not a Java guy so I was curious what they are.
05:49CookedGryphonyou know when you download a java program, and it has a really ugly gui? That's swing
05:49quizdrha ha
05:49quizdri've read that Swing is the defacto standard in Java Gui development.
05:49CookedGryphonyep
05:49quizdrso what's the alternative that people use to make the un-ugly GUIs?
05:50CookedGryphonseesaw is really quite nice to use, redefining stuff and having the interface update in place
05:53andrevdmthe seesaw source code is also very nicely commented. Great for learning
05:54quizdrbut i guess if you are not targeting local devices then there isn't a lot of use for it
05:55CookedGryphonquizdr: not really
05:57fredyranother interesting choice for client ui is node-webkit and clojurescript
05:57quizdrfredyr that would be for a UI that runs in a browser right?
05:57fredyrno
05:57fredyrlighttable uses that
05:57fredyrand runs as a desktop app
05:57quizdrinteresting
05:59fredyrrunning node for all platform interaction and chromium (aka html etc) for all uis
05:59quizdrlight table looks nice but when i gave it a try it just didn't feel right.
05:59quizdrtoo spoiled from emacs already
06:00quizdrnever thought i'd say that!
06:00fredyr:)
06:00CookedGryphonquizdr: the last release went a long way towards an every day usable release
06:00CookedGryphonand the plugin system looks really nice
06:00CookedGryphonjust need people to work on all your emacs features now
06:00quizdri tried lighttable just a week ago, it is beautiful.
06:01fredyri excited to see all the different language plugins
06:01fredyrlike haskell and ocaml and such
06:01CookedGryphonas a platform it's really really promising. Being able to extend it with clojure rather than my half knowledge of elisp...
06:01quizdrit's emacs for the modern age.
06:01quizdrmaybe
06:01CookedGryphonquite possibly
06:01CookedGryphonthe one thing that really really annoys me
06:02CookedGryphonis how the text doesn't all line up
06:02fredyrthe interactive workbook idea is great for trying out new languages and playing around
06:02quizdrah i noticed that, the indentation?
06:02CookedGryphonwith emacs where everything is monospaced text, everything lines up so nicely
06:02CookedGryphonbut with a web ui, where everything's designed to flow... it just doesn't feel as nice to my ocd brain
06:03CookedGryphonbut it's probably more than flexible enough to make a version where it does
06:03quizdris that the reason why lighttable has problems with indentation lining up correctly in code?
06:03CookedGryphonquizdr: that's probably something else
06:04quizdrwhen i started all this lisp stuff a few months ago, i tried very hard to use anything other than emacs. but i'm glad i stuck with it.
06:04CookedGryphonthe text itself is monospace, but for example you can scroll half a line height down, and it doesn't line up with the other text in the ui any more
06:15sandbagsCookedGryphon: can you screenshot what you mean? I've not seen anything i recognise from your description
06:15sandbagsof course, possibly i don't want to know if that means i start seeing it everywhere... ;-)
06:16CookedGryphon:p
06:16fredyrhaha
06:17fredyri didn't see anything from that description either
06:19sandbagseverything seems properly lined up when I scroll
06:19sandbagsi'm on OSX
06:19sandbagspossibly you're having a font issue on a different platform?
06:20CookedGryphonsandbags: no, you misunderstand
06:20sandbagsmore than likely
06:20CookedGryphonthink about when you open emacs in the terminal
06:21CookedGryphonit's exactly the same
06:21CookedGryphonas it's restricted to the same monospace grid as terminal programs
06:21CookedGryphonand as a programmer, I really like that, the constraint keeps everything neatly in line
06:21sandbagsi think the problem here is that I am not able to envisage your experience or how it varies with what i expect
06:21sandbagsand text descriptions don't help :)
06:22sandbagsi don't have a very visual imagination so you may be on to a hiding to nothing here :)
06:22sm0kehello in datalog if i have a source which emits (src0 ?itema ?itemb ?value) and i want to join it with other source (src1 ?item ?vlaue2), and want to collect [?value ?value2]
06:22sm0kebut the problem is i want ?item to join with both ?itema and ?itemb
06:23TEttingerCookedGryphon, I know what you mean actually
06:23sm0kei mean not both but *either*
06:23TEttingerthe problem is partial-glyph-height scrolls
06:24TEttingerit does make it smoother, until you need to compare two chunks of code side-by-side
06:24sandbagsare you describing a situation where you can scroll such that you have half a line visible at the top/bottom of the screen?
06:25sandbagsif not then I will give in gracefully :)
06:25TEttingersandbags, yeah. and if you have two side-by-side windows...
06:25sandbagsokay because I don't see that here in LT
06:25TEttingerone is lined up right, the other is "off"
06:25TEttingerhm, maybe some fonts don't do it
06:28CookedGryphonit's not just side by side code either, but all the interface buttons/command bar things, see http://picpaste.com/pics/Untitled-uBGGw4pT.1390303496.png
06:29CookedGryphonit's not *so* much of an issue to start with, when the whole app conforms to the designers view (one window by default, just that command bar, etc), but once people start making plugins
06:29sandbagsi can appreciate if that bothers you but i suspect that kind of polish is a vast distance from being a priority
06:29CookedGryphonit has the opportunity to go all over the place
06:30sandbagsthis also is true
06:30CookedGryphonit's not polish, that's exactly my point, the plugin makers aren't going to spend time on polish
06:30CookedGryphonmight not be an issue
06:31sandbagsi think if you're preference is a grid in the way you describe then, yes, any essentially web-based system isn't going to feel quite right
06:43sm0kecan i call -main function recursively?
06:43arcatanwhy not
06:43Ember-it's a normal function
06:43Ember-no reason why not
06:43sm0kefeels weird
06:43sm0ke(-main [x y])
06:43sm0kedoesnt it?
06:43Ember-well, that's a completely different conversation :)
06:43Ember-that being wierd :)
06:43Ember-but you can
06:44wei__what's a good way to put an element into a list, only if it's not a list? e.g. (listify 1) => [1] (listify [1 2 3]) => [1 2 3]
06:44wei__s/list/vector/
06:44fredyrwei__: into [] ?
06:45andrevdmwei__: must it be a vector? i.e. can you not use a set?
06:46wei__hm. yes, I can use a set
06:47wei__(into [] 1) doesn't work because it expects a list for the second argument
06:49andrevdmwei__: (conj #{1 2} 1) ; => #{1 2}
06:49andrevdmsets contain unique values only should do all the work for you
06:49wei__oh sorry, I wasn't being clear with the examples. I meant wrap a non-list element in a list.
06:50wei__but don't wrap if it's already a list
06:50pyrtsawei__: Make an own function for it.
06:50wei__yeah sounds good
06:50hyPiRiononly if it's not a vector?
06:52hyPiRionwell ##(let [listify #(if (vector? %) % (vector %))] (map listify [1 [1 2 3]])) is probably the most straightforward one.
06:52lazybot⇒ ([1] [1 2 3])
06:52wei__here's what I got: #(if (coll? %) % [%])
06:52wei__yeah, that's pretty much what I came up with. thanks guys
06:55hyPiRionyeah, [%] is more readable
06:58sm0kei have both :aot and :main keys in project.clj
06:58sm0kestill lein says :main specified without :aot
07:00hyPiRionsm0ke: append `:main` with `^:skip-aot`
07:00sm0keno i gave :main [mynamespace]
07:01sm0keit has to be :main namespace
07:01hyPiRionah'
07:01hyPiRionyeah, there can only be one entry point to the uberjar :)
07:03sm0kewtf
07:03sm0kedoes uberjar runs with "hadoop jar"?
07:03alewif you have multiple applications within a single project, do you need to generate multiple uberjars?
07:04sm0kealew: why not run with clojure.main -m namespacename
07:07hyPiRionalew: You should probably separate them into separate projects
07:10sm0kei always had a difficulty with lein and runnable jar
07:11sm0keit just doesnt work for me
07:54juhovhhmm, if I generate an interface with definterface (which calls gen-interface) how to refer to that interface in another namespace?
07:54juhovhand I know defprotocol is preferred to definterface, but anyway
07:55juhovhimport doesn't work unless I'm compiling
07:57effyhi, i just installed lein, is there something wrong with my setup if the hello world application take 0m3.318s to run with "lein run" ?
07:58greywolveeffy: no that's just the jvm start-up time
07:58effygreywolve: it's going to be a fixed cost on every single thing i code, or is there a way to bypass that, by let's say "pre-compile" the byte code or something ?
08:00greywolveeffy: http://leiningen.org/grench.html , is one solution
08:00katratxoeffy: usually you work inside a repl, not running "lein run" for testing your latest code
08:01greywolveeffy: yeah you should try work in the repl as much as possible, if you need to write command line programs that run, and you don't want to incur that startup penalty then grenchman looks like a good option
08:02alewhyPirion: they share a lot of the same code but have different responsibilities
08:02greywolvefor code reloading, https://github.com/clojure/tools.namespace is great
08:02alewhyPiRion: server and worker in this case
08:03effyyeah sure, repl are good, but just by curiosity, if i wanted to let's say recode the "wc" linux binary, no matter how small the text i pipe to it i would always suffer 3sec delay ?
08:03bob2a jvm-hosted language would be a poor choice for that, yes
08:04clgvgreywolve: thats wrong. only a small portion is jvm startup time, the rest is leiningen and clojure startup time.
08:05greywolveclgv: clojure start's pretty quickly, but yeah, its really 2 jvm processes starting
08:05greywolvestarts*
08:05greywolverlwrap java -server -Xmx800M -classpath $LEIN_CLASSPATH clojure.main -e "( do (require 'clojure.tools.nrepl.server) (clojure.tools.nrepl.server/start-server :bind \"127.0.0.1\" :port 4001))" -r
08:05greywolveis pretty fast
08:06effyi have never used the jvm before, would generating a .jar or some other kind of "pre-parsing" or "pre-byte-compiling" would reduce this jvm startup time or it's a definitive barrier ? (sorry i'm kind astubord :P)
08:06clgvgreywolve: in all the startup time discussions the main problem mentioned is Clojure's initialization and all the stuff leiningen does
08:06bob2effy, no
08:06greywolveeffy: you'll have to learn to love the repl ;p
08:07greywolveclgv: true
08:07effygreywolve: i dont think about devlopment cycle, i can give love to a repl, i think about the end product binaries, i didn't know clojure was only ment for long lived service, and not for fire and use binary
08:08effywould a clojurescript over nodejs have the same limitation in start up time ?
08:09clgveffy: well, you could keep a running jvm alive for often repeated short-lived tasks
08:10juhovheffy: clojurescript on nodejs is likely to be faster on startup, but probably slower after that
08:10juhovheffy: but you can confirm that by testing on your case
08:10greywolveeffy: its probably not the best language for that sort of thing, but you can get around it but its never just going to be a fast executing binary i don't think, not sure about nodejs, maybe? try it ;p
08:11effyok, thank all of you for the feedbacks
08:12xsynthe way I understand it is that they are quite different
08:12xsynnode.js is single threaded
08:12xsynjvm is great for thread concurrency
08:14clgveffy: you could try clojure-py - but that one is not maintained anymore afair
08:17effyclgv: seem's fun, i would feel more at home having access to python libraries than java, but i'll give a chance to a jvm for a moment and come back to this bookmark later for fun :D
08:20s4nchezwho
09:04AeroNotixRC4 Stream decryption/encryption libraries? Java/Clojre
09:04AeroNotixany ideas ?
09:05AeroNotixjavax.crypto Cipher
09:19sritchie_otfrom: hey, posted the liberator thing
09:21daGreviswhat is \a?
09:21daGrevisas in
09:21daGrevis,(seq "a")
09:21clojurebot(\a)
09:22jcromartiedaGrevis: that's a character literal
09:22jcromartiein Java 'a'
09:22daGrevisthanks :/
09:23daGrevisis there any implementation of clojure that's not written in java or C# and is mature enough and stable?
09:23daGrevisclojure-py wasn't good enough
09:24ddellacostadaGrevis: does ClojureScript count?
09:24jcromartieit removes ambiguity because the reader doesn't have to read ahead to determine if 'a is just a quoted symbol, or if it might be the start of a character literal
09:24daGrevisddellacosta, nop
09:24ddellacostadaGrevis: why not?
09:24jcromartiecljs still depends on the compiler
09:24jcromartieit's not self-hosted yet
09:24ddellacostadaGrevis, jcromartie: sorry, jumping into a conversation too late
09:26ddellacostagotcha, guess we will continue to wait on CinC... https://github.com/Bronsa/CinC
09:26daGrevis,(Integer. (re-find #"\d" (str (first (seq "12")))))
09:26clojurebot1
09:26daGrevis^ not cool
09:26clgvis there an easy way to generate interactive graphs? I need to be able to click on nodes to display additional information
09:27daGrevisddellacosta, it's something like pypy?
09:28ddellacostadaGrevis: I don't know, is pypy written in python?
09:28jcromartiedaGrevis: what would you expect?
09:28daGrevisddellacosta, yep!
09:28jcromartie,(first (seq "12"))
09:28clojurebot\1
09:28daGrevisjcromartie, easier way :P
09:29jcromartieum
09:29daGreviswell I need to get list of ints from string full of ints
09:29daGreviss/ints/digits/
09:29jcromartieok
09:29daGrevis"123" -> '(1 2 3)
09:29ddellacosta,(map #(Integer. %) "123")
09:29clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer>
09:29jcromartie,(map #(Integer. %) (re-seq #"\d" "123asf43r25"))
09:29clojurebot(1 2 3 4 3 ...)
09:29ddellacostawhoops
09:29jcromartielike that?
09:30daGrevisyou can't iterate through string
09:30ddellacosta^what he sez
09:30jcromartieyou can with re-seq
09:30daGrevistil
09:30jcromartie,(re-seq #"." "asdf")
09:30clojurebot("a" "s" "d" "f")
09:30daGrevisneat one, thanks ;)
09:30ddellacostadaGrevis: yah you can
09:30jcromartie,(re-seq #"\d+" "123 test 435 zxcv 45")
09:30clojurebot("123" "435" "45")
09:30ddellacostayou don't even need that
09:31jcromartieddellacosta: ?
09:31jcromartieunless you mean some java.lang.String methods
09:31stuartsierra,(map #(Long. (str %)) "1234567890"
09:31clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
09:32stuartsierra,(map irc://chat.freenode.net:6667/#(Long. (str %)) "1234567890")
09:32clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: irc:, compiling:(NO_SOURCE_PATH:0:0)>
09:32stuartsierragrrr
09:32jcromartie:) what
09:32jcromartiesure but I think daGrevis was wanting to avoid the conversion from char back to string
09:32jcromartiejust deal with a seq of substrings
09:32daGrevishttp://vpaste.net/0nnU5
09:32stuartsierraeh, whatever, reduce with subs
09:33clgvis there no clojure library for interactive graphs in a GUI?
09:33jcromartieclgv: you say that like you're surprised
09:34daGrevisimo you can use any java lib
09:34ddellacostaclgv: you mean, you just load up a graph (in what format?) and then view it graphically?
09:34clgvjcromartie: no not surprised just asking
09:34zerokarmaleftclgv: interactive in the d3-sense?
09:34ddellacostaoh, this is funny, just did it by accident
09:34clgvddellacosta: I have an in-memory description of it as clojure data
09:34ddellacosta,(map #(-> % int) "123")
09:34clojurebot(49 50 51)
09:34ddellacostaheh
09:35clgvzerokarmaleft: interactive in the sense of displaying additional information via event handlers, e.g. mouse click on nodes
09:35ddellacostaclgv: when you say graph, do you mean like on the euclidean plane graph, or like https://github.com/aysylu/loom ?
09:36clgvddellacosta: graph as the abstract idea in computer science with nodes and edges
09:36ddellacostaclgv: gotcha
09:36daGrevisddellacosta, didn't know about ->
09:36ddellacostatake a look at loom ^ + graphviz then, I guess...?
09:36ddellacostadaGrevis: I love me some ->
09:36clgvI check whether loom fits
09:37ddellacostaclgv: yeah, haven't used it myself, but maybe if you can mangle your data a bit it'd work?
09:37zerokarmaleftgraphviz doesn't enable interactivity, iirc?
09:37clgvno. it's just rendering.
09:38ddellacostazerokarmaleft: I believe it generates static stuff
09:38ddellacostaalthough they do say " or display in an interactive graph browser." on the web site http://graphviz.org
09:38zerokarmaleftclgv: c2 might be an option for you if you're willing to shuttle your data into cljs-land
09:39ddellacostazerokarmaleft: eh, wouldn't you end up building your graphing lib yourself in c2? I though it was rather barebones last time I checked
09:40clgvI used rhizome for graph visualization in a different project but it uses graphviz as well and thus no interactivity...
09:40ddellacostaseems like you'd get more mileage out of massaging it into d3 in that case
09:40ddellacostaah
09:40daGrevis,(map #(-> % int) "123")
09:40clojurebot(49 50 51)
09:40daGreviswait wut
09:40daGrevishow, ddellacosta ?
09:41ddellacostadaGrevis: ascii values of chars
09:41daGrevisright
09:41jcromartie,(map char (map int "123"))
09:41clojurebot(\1 \2 \3)
09:41jcromartiethere and back again
09:42ddellacostayep. I was trying to do something like what stuartsierra was doing above, but I kept getting java exceptions. String vs. Char or something.
09:45stuartsierra,(map #(Long. (str %)) "1234567890")
09:45clojurebot(1 2 3 4 5 ...)
09:46ddellacostastuartsierra: ah, there it is!
09:47ddellacostacouldn't get the syntax right
09:50jcromartiestuartsierra: why prefer Long over Integer? aside from the constructor "Long." being shorter than "Integer."
09:51hyPiRionjcromartie: Preferably neither, use Long/parseLong. Integers in general is autoconverted to longs I think?
09:51jcromartieyeah
09:52jcromartienow really, we shouldn't be converting to string and parsing it :)
09:52xificurCanyone using seesaw.bind? I'd need some guidance
09:52jcromartie(map #(Character/getNumericValue %) "12345")
09:52jcromartie,(map #(Character/getNumericValue %) "12345")
09:52clojurebot(1 2 3 4 5)
09:52AeroNotixhow do I convert integers to signed bytes?
09:53fredyr,(type 5)
09:53clojurebotjava.lang.Long
09:53stuartsierrajcromartie: Clojure defaults to Long everywhere.
09:54xificurCI am trying to join the logic of a radio button and a text box. Basically if the radio button is selected the text button should be enabled, otherwise disabled. But however I write the bindings it just doesn't seem to work
09:54jcromartiestuartsierra: true
09:54jcromartiehuh, looks like Character/getNumericValue is slower than (Long. (str 5))
09:54jcromartieI mean (Long. (str %))
09:55llasramAeroNotix: https://gist.github.com/llasram/8541480
09:55devnhowdy
09:55jcromartiethat's surprising
09:55broquaintxificurC: Like this? http://blog.darevay.com/2011/07/seesaw-widget-binding/
09:56xificurCbroquaint: I read that a dozen times by now
09:56llasramjcromartie: There's two forms of the getNumericValue() method, which means Clojure needs to emit code performing reflection
09:57xificurC(b/bind (b/property (ss/select main-frame [:#other]) :selected?)
09:57xificurC(b/property (ss/select main-frame [:#delim-text]) :enabled?))
09:57xificurCthis is my last (bad) attempt
09:57llasramjcromartie: Try #(Character/getNumericValue (char %))
09:59AeroNotixllasram: is there are library for this?
09:59jcromartieah ha, llasram thanks
09:59llasramAeroNotix: Not that I know of off the top of my head
10:00AeroNotixllasram: damn, I don't want to c+p
10:00devnI have groups of items: [{:id 1 :name "todd"} {:id 1 :name "bob"} {:id 2 :name "betty"} {id: 2 :name "wilma"}]. I'd like to build a map {1 [{:id 1 ...} {:id 1 ...}] 2 [{:id 2...} {:id 2 ...}]} but i'd like the groups to be sorted by the name key. i've played around with it and haven't found a solution i'm happy with. any thoughts?
10:00jcromartiellasram: without the reflection penalty, Character/getNumericValue looks to be a little fast on average
10:01llasramjcromartie: Nice to align reality with expectations :-)
10:01edbonddevn, sort-by ?
10:02xificurChttps://www.refheap.com/26243
10:02jcromartieI forget about reflection...
10:03devnedbond: yeah, group-by + sort-by is what i've been using but what i've been coming up with feels long-winded
10:03edbonddevn, sorry, I didn't read to the end
10:04edbonddevn, probably reduce-kv fits better
10:04devnedbond: yeah, that's where i keep winding up as well
10:05devnwhich is fine
10:05devnperhaps by the time i go to do this operation i've built it up too much and it should stay in separate pieces that I can mold together rather than reordering things once it's all packed together
10:09devnin any event i'm going to probably rest on it and circle back this evening. i feel like i'm treating reduce almost like it's imperative or something. (reduce (fn [m [k v :as entry]] (...)) {} {:id 1 :name "todd"})
10:11devnit feels sort of like the: arr = []; [1,2,3].each {|x| arr << x}
10:11devnwhich grosses me out
10:13devnbecause reduce's fn actually has a few conditions, so it's worse: arr = []; [1,2,3].each {|x| arr << x if (x > 2); arr << x if ((x + 10) == 11)} etc.
10:14devnidk im probably just obsessing. back to work.
10:14shep-werkdevn: (group-by :id (sort-by :name names)) "works"
10:14shep-werkat least for that one example
10:15shep-werkit relies on group-by maintaining the order
10:15shep-werkwhich the doc says it does
10:17ToBeReplaceddevn: what's the issue with: (->> names (sort-by :name) (group-by :id))?
10:17ToBeReplacedsorry, what shep-werk said... was scrolled up
10:19shep-werkToBeReplaced: ^5
10:20devn:)
10:20devnyeah, like i said, i think im overthinking it
10:21devnit was just starting to feel like i was gluing pieces together in a way that was less declarative than maybe my example above makes clear
10:23ToBeReplaceddevn: i'd be trying to work with data like {1 ["bob" "bruce" "wilma"] 2 ["gerry"]} instead if that's what you mean
10:40mmitchellCan someone recommend a client lib for Zookeeper?
10:41nDuff...hmm; I don't remember any complaints from using zookeeper-clj, but haven't kept up since (and it's been a while).
10:41mmitchellnDuff: Is that this one? https://github.com/liebke/zookeeper-clj
10:42nDuffYup.
10:44devnToBeReplaced: yeah, that's exactly what i meant above
10:44devnToBeReplaced: hence the "time to reconsider some of my previous actions"
10:51mduerksenis there a rationale behind the fact that clojure.string is not nil-tolerant like almost everything else? e.g. (clojure.string/replace nil #"pattern" "replacement) -> Exception. couldn't it just return nil?
10:56technomancyprobably because clojure.string is a thin wrapper around java methods rather than using classes written just for clojure
10:56technomancybut nil is a mess; you can't really expect something called "the billion dollar mistake" to make sense
10:58mduerksentechnomancy: whats wrong with nil?
10:59arrdemmduerksen: do you like the semantics of nillable objects?
11:00CookedGryphonit's hardly fair to compare null in that context with nil in clojure
11:01mduerkseni like that (get m :key-not-present) just returns nil instead of throwing up. i like that i don't have to blur the intent of my code with checks for existence and nil-checks
11:01technomancythat's just because we don't have proper pattern matching built-in
11:02mduerksenimagine (get-in m long-list-of-keys) when you would have to check every level for nil
11:02technomancyjust match against an option type; that kind of thing is easily composable
12:28bbloomkristof: but look at how core.typed works. it type checks with union types
12:29tbaldridgebhauman: I don't see anything wrong with it ATM. I'll bookmark this and take a look at it later today.
12:29bbloomkristof: go look at some of the signatures of clojure.core functions & you'll see lots of examples of where it makes sense
12:29bbloompyrtsa: static & dynamic typing is entirely orthogonal to sum vs union types
12:30yediwhat are some of the cljs data visualization options
12:30jcromartieI like how Oracle has broken like 99% of incoming links to Java-related stuff since they took over.
12:30bhaumantbaldridge: Thanks!
12:30jcromartienow I can be redirected to lots of useful whitepapers instead of that silly API I was looking for
12:31pyrtsabbloom: Oh, right. Btw, would your definition of union types align with the notion of row polymorphism?
12:31pyrtsaE.g. http://brianmckenna.org/blog/row_polymorphism_isnt_subtyping
12:33bbloompyrtsa: i think they are unrelated. or at least it's not obvious to me how they are related
12:35pyrtsaOk, nevermind.
12:37sm0kedoes clojure aims backward compatibility?
12:38sm0keor forward?
12:38sm0keor wtfever
12:38seangroveAims for World Trade Fever, I believe
12:39pyrtsabbloom: Actually, your example was about augmenting the sum type A of (Even | Odd) with Neither. That would create a new type B where x :: A => x :: B, but not vice versa. So there is a connection.
12:39bitemyappsm0ke: aims for parenthetic post-scarcity.
12:39nDuffsm0ke: New releases of Clojure tend to be backward compatible with documented behavior. Undefined behavior, of which there's rather a lot, is prone to change without notice.
12:44dnolennDuff: that's not really true either, there's lots of undefined behavior that will likely never change now
12:44sm0keson of a bitch
12:44devn+1
12:44sm0kefound it
12:45sm0kecore.async is backward incompatible
12:45nDuffdnolen: true enough.
12:45devnspeaking of undefined behavior
12:45dnolensm0ke: alpha software
12:45locksdnolen: is there a way to add more vertical space in the tutorial? I accidentally jumped the dom/ul nil example straight to dom/ul #js etc
12:45devnis that patch to "fix" the pattern for valid symbols and keyboards actually going through?
12:45devnI like my "invalid" symbols and keywords
12:46dnolenlocks: don't really have much control over formatting on Github
12:46devnalso, """heredoc""" -- I really wish we could get that added. Is it really so awful for the reader?
12:47technomancydevn: triple quote is lame; we should have «heredocs» instead =D
12:47devnnot trying to start another thread about it, but i really do wish we had a heredoc
12:47devntechnomancy: honestly, i would be totally fine with that
12:47devnjust /something/
12:47technomancyit's paredit-friendly!
12:47devni almost adopted chiara simply to use """"""
12:48sm0kethere was a new rainbow paranthesis plugin for vim
12:48sm0kecouldnt find it now
12:48devnclownbarf.el
12:48`cbpwhy triple quotes?
12:49devndoesn't have to be triple quote
12:49devnbut most of the chars are already taken
12:49devnhaha
12:49bitemyappoh no, Basho West Elevator follows me.
12:49bitemyappThis is not a good sign.
12:49bitemyapp`cbp: hi!
12:49`cbpbitemyapp: hello
12:50devntechnomancy: do you remember where the most recent heredoc discussion ended?
12:50devni know it's come up like a dozen times
12:50bitemyapp`cbp: surely you knew how I was going to feel about a dynamic scope + auto-arg-injection macro.
12:50`cbpheh
12:50`cbpsoz :P
12:50bitemyappdevn: given how many dreams have been dashed upon the rocks of Mount JIRA, I wouldn't get my hopes up.
12:50technomancydevn: I'm too old to watch the repeated cycle of people proposing changes and getting shot down
12:51bitemyapp`cbp: nah nah, it's cool, I'll respond to the ticket. Makes for good doucmentation.
12:51technomancyit's all re-runs these days anyway
12:51devntechnomancy: we can do it!
12:51devncc bitemyapp
12:51bitemyappdevn: I'm gone baby.
12:52devnIf people just quit obsessing over the syntax and make a decision on what will work best for EDN, cljs, and clj -- we're done
12:52devnsomeone has already implmeneted """heredoc"""
12:52technomancywe can't though
12:52bitemyappdevn: I've drunk the kool-aid and play with kittens and lenses now.
12:53technomancydon't have commit rights or the ability to perform remote hypnotism
12:54bitemyappI would really like heredocs :(
12:54`cbpneed a cognitect mob plant
12:54gtrakjust find a way to make datomic need it
12:55bitemyapp`cbp: 4rlz.
12:55sm0kewhats the antonym for bumping a version?
12:55bitemyappgtrak: that was actually the only reason I think I got Hickey to fix up the edn spec.
12:55kristofbitemyapp: You kept talking about extensible effects but it didn't occur to me that this would be Oleg-ware
12:55technomancygtrak: because, you know, heredocs are way less useful than UUID reader literals
12:55ToxicFrogsm0ke: downgrade? Rollback?
12:55llasramsm0ke: Downgrade?
12:55technomancyM-x eyeroll
12:55kristofbitemyapp: Stumbled upon his paper on it while I was perusing other documents, so I'm in the process of reading it.
12:56sm0kei would call it bounce
12:56arrdemdevn: change links? or just rantings on jira..
12:56bitemyappkristof: http://okmij.org/ftp/Haskell/extensible/
12:56kristofYup, saw it
12:56llasramtechnomancy: *shrug*. I don't use UUIDs, but I have been making pretty extensive use of the tagged literal syntax
12:57llasramIt's pretty nice to be able to define a way to print arbitrary things so that you can read them back
12:57technomancyllasram: I guess it's a neat idea in general, but both of the built-in examples of tagged literals are just bonkers
12:57technomancyeither bafflingly useless or actively harmful
12:57technomancyllasram: eh; I got along fine with print-method
12:58llasramTrue. It's also not how I would have chosen to implement it. They'd be even more useful if there were a multimethod/protocol which gave you the data structure the tagged literal prints as
12:59llasramWell, with just print-method you can't read things back unless reading back as only Clojure data is fine, or you use the read-eval syntax
12:59kristofbitemyapp: From my understanding, it seems that a group of effects that can be arbitrarily composed and accessed can be modeled by a single monad, which is how Oleg models it. That's cool stuff!
12:59bitemyappkristof: I was surprised you were focusing on Eff.
12:59kristofbitemyapp: Hmm?
12:59devnwhat if #^ came back?
12:59sm0kellasram: i have a question regarding parkour
12:59technomancyllasram: right; I was just using read-eval; obviously that's not ok for client interactions
12:59bitemyappkristof: well not only that, but by avoiding CPS-esque style, it can possibly be optimized without manual codensity.
13:00devntalking about heredocs again.
13:00Raynes""""""
13:00kristofbitemyapp: what the hell is manual codensity
13:00llasramsm0ke: You are in luck! I am at present the definitive source of answers regarding Parkour :-)
13:00deadghostsm0ke, you "bump up" so I guess it'd be "bump down"
13:01sm0kellasram: can you run mapreduce jobs interatively from a repl on a cluster? i see that its not really specific to parkout but you would be knowing
13:01bitemyappkristof: http://blog.ezyang.com/2012/01/problem-set-the-codensity-transformation/
13:01sm0kedeadghost: no there is no such thing as bump down
13:01bitemyappkristof: meaning having to manually introduce it to optimize the code.
13:01bitemyappkristof: no CPS/monads, no need.
13:01sm0kebump indicated upward motion
13:02technomancysm0ke: bump/drop
13:02bitemyappsm0ke: (anamorphic / catamorphic) version transformation
13:02deadghosthmm
13:02deadghostpothole then?
13:02sm0kebounce
13:03llasramsm0ke: Not yet / yes-if-you-squint.
13:03deadghostwell depends on if you're using bump to describe something protruding up
13:03deadghostor the action of jolting
13:03deadghostsince a pothole would cause a car to bump
13:04llasramsm0ke: If you launch a REPL with your cluster Hadoop config on the class path (and the correct version of Hadoop for your cluster), and manually add your JAR dependencies (include your actual job code) to the job, then you can launch jobs. I have in fact done this. It is not pretty
13:04llasramsm0ke: There is active discussion on the Parkour mailing list right now to make it pretty :-)
13:04sm0kellasram: can you dynamically add jars to cluster classpath ?
13:04sm0kellasram: without taking it down
13:05sm0keoh you said to the job
13:05kristofbitemyapp: ah, so walking through monadic binds is expensive and wrapping everything in a codensity monad speeds things up, but that's a manual optimization. That's the gist of what I'm getting but I promise I'll work through the exercises sometime.
13:05sm0keso you are saying i would still sumit a job
13:05llasramsm0ke: Depending on what you mean, yes. Regular MapReduce jobs launch a fresh JVM for each task, and can have any classpath you want
13:05sm0kellasram: also whats the rationale behind parkour?
13:06sm0kellasram: didnt cascaog fit your needs?
13:06llasramsm0ke: https://github.com/damballa/parkour/blob/master/doc/motivation.md :-)
13:06sm0kellasram: ah ok thanks
13:06sm0kewill read that
13:07RickInAtlantallasram = marshall?
13:07sm0kelater
13:07llasramYep! Hey, Rick :-)
13:07technomancy,(apply str (reverse "llasram"))
13:07clojurebot"marsall"
13:07technomancy...
13:07RickInAtlantaHowdy
13:07llasramtechnomancy: The `h` is absent for historical reasons
13:07technomancyistorical reasons you mean?
13:08llasramhah! nice
13:11fredyrlol
13:13dnolenhaha nice, http://twitter.com/jacob_ninja/status/425691247601123328
13:14bitemyappkristof: it's a fine approximation.
13:15bbloomdnolen: persistent data structures are like alien technology from the future
13:15bbloom:-)
13:17devnupdated the alternate string quote syntaxes: http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes
13:17devn"""foo""" seems like a logical choice over <<HERE HERE, string interp, etc.
13:17devnit also fits nicely as a docstring
13:18technomancyoh gosh please no ruby-style heredocs
13:18technomancyso hideous
13:18llasramAnyone who currently has """""" in their code deserves everything they have coming
13:18lockstechnomancy: *ahem* perl-style heredocs
13:19rasmustotechnomancy: heretics + docs = heredocs?
13:19bbloomllasram: i start all my programs with """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" just to be sure
13:19gtrak(take 3 (empty-string-seq))
13:22`cbpbbloom: has an EOF exception coming
13:22bbloom,"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
13:23clojurebot""
13:23bbloom,(list """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""")
13:23clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
13:23bbloomdamn.
13:23bbloomi just held the keys down
13:23bbloomi figured 50/50 shot of getting an even number
13:23bbloom,(list """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""")
13:23clojurebot("" "" "" "" "" ...)
13:23bbloom`cbp: ther eyou go
13:26eggheaddoes anyone have an example of using prismatic's schema library with cljs?
13:26eggheadall I'm getting is a bunch of errors no matter what I try
13:28deadghosthmm I'm not using enlive snippets with templates properly
13:28deadghostand/or screwing up laziness
13:28deadghosthttps://www.refheap.com/26269
13:33arrdemtripple quoted strings could be ok.... far less breaking than heredocs.
13:33arrdemthe HEREDOCS ... HEREDOCS is just outright madness.
13:34`cbpi vote for org-mode syntax
13:35arrdemwrt resource files: can't you already do ##(def my-commented-var (slurp "/resources/docs/user/my-commented-var.org") 3)
13:35lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
13:35arrdem`cbp: 2nded
13:35technomancyhaha, org-mode syntax
13:37llasram`cbp: Wouldn't that get hairy then embedding Clojure in org-mode with org-babel ?
13:38arrdemllasram: no, because you can use tangle to make your text comments!
13:38llasramhah
13:39arrdemllasram: also mark((down)|(up)) in a #+BEGIN_SRC #+END_SRC won't parse so you shouldn't be able to confuse yourself...
13:44carkhah this org-babel thing looks funny
13:44RickInAtlantallasram: just read your motivation for Parkour. I am looking forward to your presentation.
13:44carktoo bad it requires slime and swank =/
13:45arrdemcark: .... you're reading old docs then.
13:45carkarrdem: ah could be
13:45arrdemcark: org-babel is entirely language tooling agnostic, I've seen stuff about using it with nrepl before.
13:46gtrakllasram: we fuss with cascading... and serialization... a lot. Our code is littered with deftypes to deal with this.
13:53llasramRickInAtlanta: Should be fun! And keeping my fingers crossed for Clojure/West
13:54gtrakif there's one thing I could shoo away in hadoop, it'd be classloading.
13:55gtrakbut that's basically like... java.
13:55llasramgtrak: Yeah. I did that (deftypes for serialization) for a few projects, but it got messy fast. With Parkour I've pretty much just been using Avro, with the protocol-based support in abracad to allow Avro serialization of arbitrary existing types
13:56llasramgtrak: I'm trying to remember... I talked to someone at Clojure/conj who had strong opinions about class loading, especially under Hadoop. Was that you?
13:56gtrakthat might have been me :-)
13:56gtrakit's insufferable, but the structure of our project makes it worse, since we use a post-delegation classloader that embeds hive.
13:57llasramInteresting. Are you seeking to untangle this?
13:57gtraknow I'm investigating building classpaths by launching ourselves with the 'hadoop' script, which will at least automate some bash away.
13:57gtrakllasram: yea... it's just an issue of manpower and priorities.
13:58gtrakbut we end up spending a lot of time on workarounds for classloading issues.
13:59jcromartiewhat's the way to create the inverse of a Java comparator?
13:59gtrakjcromartie: (comp - ..) ?
13:59llasramgtrak: Most recent Hadoop distro's `hadoop` command has a `hadoop classpath` subcommand. I've had better luck getting things in the right order by slapping the output of that at the end of the classpath for a manually-constructed `java` invocation
13:59jcromartiegtrak: comparators should return −1, 0 or 1 though
13:59jcromartiebut that seems to work :)
13:59gtrakjcromartie: maybe I misunderstand the question
14:00gtrakthat will invert an existing comparator by 'inverting' the results
14:00jcromartieyeah, seems to work close enough
14:01gtrakllasram: I think that'll mostly work, but there's some minor issues with slf4j and such. The hive thing is what ends up breaking first, and afaik that's unique to our project.
14:01gtrakwe shouldn't have hadoop deps in a parent classloader.
14:02llasramgtrak: slf4j configuration, or duplicates?
14:02gtrakduplicates
14:02llasramOk. Yeah, I'm building everything with leiningen, so just make judicious use of global exclusions and the `:provided` profile
14:03llasramI'm not quite sure what you mean by "hadoop deps in a parent classloader" though
14:03llasramMy classloading knowledge is somewhat fuzzy
14:03gtrakyea, we could create classpaths with maven artifacts only, but that shifts burden to testing and integration.
14:03gtraksince we target multiple distros, that's hard.
14:04llasramAh, I see. Hmm
14:04shep-werkjcromartie: comparator just says negative, 0, or positive, not -1, 0, 1
14:04llasramBuild all uberjars, with a different build for each target!
14:04gtrakllasram: main classloader has cascading impls, child classloader calls hive, which has its own mapreduce code, which ends up using hadoop classes from the parent classloader.
14:04jcromartieshep-werk: close enough, but "complement" doesn't reverse that :P
14:04jcromartieanyway, using sort-by, and (complement :foo) works
14:05gtrakllasram: that's also on the table, but we need real devops :-), my boss says 'that sounds hard'
14:05jcromartieto actually reverse a Comparator, you can use (Collections/reverseOrder c)
14:05gtrakjcromartie: we have a 'compare' function that delegates to a comparator.
14:06llasramgtrak: Yeah.... That seems a hairier arrangement than I care to contemplate when not facing it myself :-)
14:06llasramgtrak: What do you mean by "need real devops"?
14:06gtrakllasram: automated integration testing and deployment, some VMs and scripts and such.
14:06gtrakwe have continuous builds, but that's about it at the moment.
14:07gtrakjcromartie: and the main reason I'd prefer to use that is it works with sort-by
14:07jcromartieyup
14:07gtrakalso sort..
14:07jcromartieI'm just playing with more complex sorting of maps, akin to SQL's sorting
14:08jcromartie(sort-by (juxt (complement :admin?) :username) users)
14:08gtrakjcromartie: ah neat
14:08llasramgtrak: Ah, I see. No one is yet using a deployment configuration management tool?
14:08gtraknah
14:09gtrakI've played around with vagrant..
14:09llasramIntroduce puppet/chef/ansible/whatever -- your ops team will love you :-)
14:09gtrakthat's just it, no ops team to love me :-)
14:09llasramWell, or fight you to the death
14:09llasramEven better! Oh god, you'll save yourself so much time, and no one to fight to the death
14:09gtrakif I just did it, no one would oppose..
14:10llasramI think you have an incredibly clear call to action
14:10lvhPSA: don't use salt. Homegrown crypto is bad.
14:10gtrakthat's what I was afraid of.
14:10lvhEspecially for something that has root on all your boxen.
14:10Cr8<3
14:10llasramIn a few months you'll wonder how you lived with yourself prior
14:12gtrakjust saying 'hadoop sucks' to myself is deeply satisfying, but maybe a devops deployment would be more satisfying.
14:12shep-werkjcromartie: sorry, I thought I read the suggestion as (comp - existing-comparator); ie to negate it
14:12gtrakshep-werk: that's how I read it.
14:12jcromartieoh!
14:13shep-werknot complement
14:13jcromartiethat makes perfect sense
14:13llasramgtrak: Little in life is more satisfying than triggering a cluster-wide deployment just by committing test-passing code
14:13jcromartieI missed the "-"
14:13llasramWell, maybe the smile upon your own child's face, but I the cluster thing is a close second
14:14jcromartiemy kid smiles when she does something evil
14:14gtrakthat sounds even more satisfying
14:15gtrakI just want to be in on it
14:17gtrakllasram: we hit an issue the other day, where if the JobClient static initializer is called from the child classloader first, the app won't start, so as a workaround we initialize those classes ahead of time in the main classloader.
14:17gtrakthe error is reported as bad 'mapreduce.framework.name' config.
14:20gtrakit looks like it can't find the mapred-site.xml file.. but that's not really the case.
14:35dobry-denIs the general purpose of the -Xms JVM opt to claim the memory ahead of time?
14:38jcromartiedobry-den: yes, it avoids resizing the heap
14:39llasramgtrak: (was afk) Actually, that makes some sense -- the Configuration class maintains a static list of configuration files it looks up basename on the classpath, using the thread context classloader by default. When JobClient is loaded, it adds mapred-*.xml to that resource list
14:40llasramI'm not perfectly envisioning the chain of events, but there's definitely room for the wrong classloader to load a class which gets the string basename for a file which isn't on it's classpath
14:42gtrakllasram: yea, it's just nasty... it depends on which classloader ends up being the threadcontextclassloader at the time of init, I think, even though the parent is the only one that can actually load the class.
14:44gtrakmaybe there's a way to set that
14:45llasramgtrak: You can set the class loader an individual Configuration uses to load resources, but I'm not sure how helpful that is
14:55OscarZwhats the Clojure way to do something like interfaces in Java.. say I want to have have multiple implementations for some interface.. for example Mysql implements DAO, Datomic implements DAO or something.. DAO interface has Object load() and save(Object o)
14:55gtrak~protocols
14:55clojurebothttp://clojure-log.n01se.net/date/2009-10-13.html#12:02
14:55OscarZshould I just create two namespaces with the same functions ?
14:57carkin one namespace : (defprotocol DAO (load [self]))
14:58carkin other namespaces where you define the actual objects : (defrecord Mysql [field1 field2] DAO (load [self] some code))
14:58carkyou may use reify, or deftype in place of defrecord
14:59carkyou may also extend your protocol to about anything
14:59OscarZok.. ill have to read up on them thanks..
14:59OscarZi dont really have requirement to actually implement Java interface.. just want something where the rest of the code doesnt depend on the actual implementation
15:00OscarZprotocols are still the way to go?
15:00carkyes, though defining a protocol also define an interface
15:00OscarZok.. thats fine :)
15:00gtrakOscarZ: multimethods are more flexible, but slower.
15:01gtraksometimes I feel like I want to make my dispatch function a multimethod.
15:01carkprotocol are good for single dispatch, multimethods are good to dispatch on any variety of way
15:02bbloomgtrak: a multimultimethod!
15:02gtrakI don't know if that's a smell, so i avoid it.
15:02carki think you may do that, don't you ?
15:02deadghosthttp://stackoverflow.com/questions/21266570/enlive-snippet-in-template-produces-lazy-sequence
15:02deadghostanyone want to take a shot at that
15:02deadghostbeen trying to figure it out for at least 2 hours now
15:02bbloomgtrak: i dunno, seems not-too-insane to me, but i can't think of a good use case. what have you felt you needed that for?
15:02mmitchellIs there a webpage that lists sites/apps using Clojure?
15:03jcromartiedeadghost: your defsnippet is totally wrong...
15:03stuartsierrammitchell: http://dev.clojure.org/display/community/clojure+success+stories
15:03gtrakbbloom: seems like you'd want open dispatch, no? I feel encoding things as equality or the hierarchy thing is kinda limiting.
15:03mmitchellstuartsierra: Nice thanks!
15:03bbloomgtrak: it's intentionally limiting to resolve ambiguous dispatch
15:04technomancymmitchell: "last edited december 14, 2012" so take it with a grain of salt
15:04gtrakbbloom: like... I'm not sure how I'd do a defmethod, if I were using constants all defined in the dispatch function.
15:04bbloomgtrak: that is without having the runtime system prove logical implications of predicates :-)
15:04mmitchelltechnomancy: Ahh ok
15:04jcromartiedeadghost: or I could be totally wrong :P
15:04technomancymmitchell: for some reason that wiki page is locked
15:04bbloomgtrak: most of the time, my dispatch function is a keyword
15:04deadghostjcromartie, I got excited for a moment
15:04stuartsierratechnomancy, mmitchell: we had some trouble with spam a while back, might be why
15:05jcromartiedeadghost: try just using content instead of html-content?
15:05gtrakbbloom: yea, if the data's not hardcoded, I guess that solves my problem.
15:05gtrakthe keywords that are returned from the dispatch
15:05deadghostGREAT JCROMARTIE IS GOING TO SOLVE EVERYTHING BECAUSE HE TELLS ME I HAVE AN OBVIOUS ERROR
15:05deadghostthen disappointment
15:05technomancyat least four companies on that page don't exist anymore under those names =)
15:06technomancycorrection: at least six
15:06jcromartiedeadghost: I didn't realize you could use the hiccup style HTML generation instead of a filename in defsnippet
15:06stuartsierratechnomancy: which ones?
15:07technomancystuartsierra: backtype, geni, relevance, revelytix, runa, and weatherbill
15:07stuartsierratechnomancy: thanks, noted
15:08deadghostjcromartie, picked it up from http://stackoverflow.com/questions/20811216/enlive-templating-adding-css-includes-to-head
15:08gtraktechnomancy: revelytix exists, unless you know something I don't know :-)
15:08deadghostapparently hiccup style or java reader string thing is a ok
15:09technomancygtrak: hm; everyone I know who was doing clojure there got let go; I assumed it was because they went under
15:09gtrakI'm still there and doing clojure, there's a few folks.
15:09technomancyoh, gotcha
15:09jcromartiedeadghost: but since your snippet produces a seq of nodes, just use "content", not "html-content"
15:10gtraktechnomancy: that wiki page is really out of date though, we don't mention 'semantic web' at all anymore.
15:10gtraka hadoop shop now.
15:10deadghostoh geez I didn't even know there was a content AND html-content
15:12domino14how do i take the nth element of a sequence, and also build a sequence of everythign minus that element?
15:12domino14i know nth for sequence
15:13jcromartieyou want "take" and "drop"
15:13deadghostyep jcromartie that did the tri
15:13deadghostck
15:14deadghostjcromartie, want to type a response up saying use content instead of html-content and get some internet pts
15:14deadghostotherwise I'm answering myself
15:14jcromartiesure
15:16jcromartieyay internet points!
15:16jcromartiedomino14: something like this
15:17jcromartiedomino14: (defn pick [coll n] [(nth coll n) (concat (take n coll) (drop (inc n) coll))])
15:17jcromartielikely to be very bad for performance though
15:17domino14,(let [s [0 1 2 3 4 5 6 7 8 9]] (concat (take 3 s) (drop 4 s)))
15:17clojurebot(0 1 2 4 5 ...)
15:17domino14what's a more performant way of doing it/
15:18stuartsierraI've updated Relevance/cognitect at least, and we have a TODO to update that wiki page.
15:18AeroNotixdomino14: are you experiencing some slow code and have profiled it to your use of this specific code?
15:18AeroNotixdomino14: if not; stop caring.
15:18jcromartiethanks AeroNotix :)
15:19AeroNotixjcromartie: pre-emptive optimization is horrible
15:19jcromartieI was just saying that since Clojure collections have different performance characteristics for indexing, removing, adding, concatenating, etc., that an operation which does ALL of those can't possibly be optimal
15:19jcromartieanyway, yeah, don't worry about it
15:20AeroNotixand if you do end up worrying about it, wrap a transient in a function
15:23NotteIs an idiom in clojure returning a tuple (value error) ?
15:23gtrakNotte: usually a vector, lines up visually with the destructuring syntax.
15:23ToBeReplaceddomino14: i think a better approach is to figure out why you want to pop the nth element, and see if you can instead use a data structure better suited to your problem
15:24Nottegtrak: yeah, right. Thanks
15:25Nottegtrak: do you think it'd be better using an atom/symbol or a string for the error part?
15:27gtrakNotte: atom means something else here, error depends on the requirements of your app, there's lots of answers.
15:28gtrakusually I'll just return nil unless I really need a message, in that case I'll throw an exception.
15:29gtrakso I do a lot of (if-let [val (some-function of its arguments)] (logic) (error-logic))
15:29gtrak(logic val), rather.
15:36degWith lein-cljsbuild... I have two builds in the map under :cljsbuild. One has ":jar false"; the other ":jar true". But, when I do "lein jar", both .js files are included in the jar.
15:37degI had understood that only production build (with :jar true) would be included.
15:38dobry-denWhat could cause a user to never see :flash data in a Ring app with wrap-flash?
15:42llasramIf they have a flash blocker installed
15:42llasram~rimshot
15:42clojurebotBadum, *tish*
15:42arrdempeople still have flash installed?
15:53technomancystuartsierra: cool, thanks
16:02BobSchackdevn ping
16:02devndomino14: ,(let [s (range 10)] (remove #(= 3 %) s))
16:04devndomino14: also, this is definitely more performant user> '(0 1 2 4 5 ...) ;)
16:20r4vianyone know how to emit a zipper (created from clojure.zip/xml-zip) back to xml, clojure.xml/emit and clojure.data.xml/emit don't seem to work
16:21r4vidata.xml/emit complains that there is no EventGeneration protocol for PersistentStructMap
16:24arrdemso I'm reading the core... what's the backstory with the commented out public Object reduce(Fn) blocks?
16:26tbaldridgearrdem: link?
16:26bbloomarrdem: w/o looking, my guess would be that the impl started at the java level and was later re-done with protocols
16:27arrdemtbaldridge: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ASeq.java#L91
16:27arrdembbloom: yeah I'm expecting to see a lot of that...
16:28arrdemI'm just surprised since there's a commit from Rich ~6 years ago adding that block and none of the diff messages that I read explicitly mentioned deleting it.
16:32arrdemhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L116 whitespace patch? :P
16:33bbloomarrdem: rich told me that intellij fucked up the whitespace silently on him and he didn't notice until it was too late :-P
16:34arrdembbloom: lolz
16:34bbloomarrdem: wouldn't get accepted anyway :-P
16:34arrdembbloom: that's why :/
16:40TimMcDidn't notice until it was too late... I hope that means "I was too lazy to fix it", not "`git commit -a` erryday"
16:41brehautjustin_smith: whats your companies agency web thing urlled>?
16:42justin_smithermdaherm?
16:43brehautwhat is the url for the project :P
16:43justin_smithhttp://let-caribou.in/ this what you want?
16:43brehautthat it is
16:43brehautthanks
16:43justin_smithand I look at that and realize there are more examples we could have on there
16:43justin_smiththisplace, teague, maybe others
16:44justin_smithalso we hang out on #caribou if you want to ask us a bunch of caribou specific stuff
16:49r4vianyone know how to turn a zipper back into xml?
16:50bbloomr4vi: clojure.zip/root
16:52Raynesbbloom: That doesn't return XML though, right?
16:52Raynesbbloom: That'll return the original tree structure.
16:52r4vibbloom: yeah that works if I roundtrip without editing
16:52Cr8then you need to clojure.xml/emit it, yeah
16:52Raynes^
16:52bbloomRaynes: i assumed he meant the tree structure under the zipper
16:52Raynesr4vi: ^ follow the arrows
16:52r4viI can do (xml/emit (zip/root zipped))
16:53r4vibut not zip/edit, zip/root, xml/emit
16:53RaynesAfter your edits, as long as you've still got a zipper, zip/root should work.
16:54r4viyep zip/root works but trying to emit the resulting thing from zip/root gives NPE
16:54NotteDo i have to specify clojure.java.io as dependency inside the project.clj file to use it within the lein repl?
16:54NotteI can't require it in any way
16:54r4viwhen it gets to my first edit
16:55Notte(require [clojure.java.io :as io]) doesn't work
16:55technomancyNotte: it's been part of clojure since 1.1 or 1.2
16:55technomancyyou need to quote the symbols
16:56NotteCould you make an example please?
16:56NotteBecause i tried..
16:56technomancy(require '[clojure.java.io :as io])
16:58rurumate_Notte: start repl from src/user.clj or test/user.clj. user.clj first line should look like this: (ns user (:require [clojure.java.io :as io])) Note when you use (ns :require) you don't quote the symbols
17:00Nottetechnomancy, rurumate_ after both commands io gives this error CompilerException java.lang.RuntimeException: Unable to resolve symbol: io in this context
17:01technomancyNotte: yeah, that's expected; namespaces aren't really first-class like that
17:01technomancyclojurebot: the ns macro?
17:01clojurebotthe ns macro is more complicated than it needs to be, but this might help http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
17:10NotteIt finally worked. That article's helped me, thank you technomancy.
17:10technomancynp,
17:10technomancyit definitely is a bit weird at first
17:11arrdemmore whitespace weirdness in compile.java...
17:13Bronsahttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7793 this is my favourite line in Compiler.java
17:14bbloomBronsa: lol i love how it's interned
17:14bbloomBronsa: "this stupid string is VERY IMPORTANT
17:14bbloom"
17:15Bronsabbloom: the funny thing is that it's dead code
17:16arrdemwhere is this?
17:16bbloomBronsa: just because something is dead, doesn't mean it's not very important. those who don't study history... or some proverb like that
17:16bbloomor rather proverb_fdkkfdksfjs
17:16Bronsaahah, right
17:25zerowidthnDuff: i love that metaphor
17:25zerowidthnDuff: so so much. imagine in even 20 years
17:28rovarzerowidth: I am a big Vinge fan. I got to eat lunch with him at a conference in SD a while. Super nice guy.
17:38technomancyjealous
17:38rovardo atoms have any odd behaviors with regards to namespaces?
17:39rovare.g. if I use an atom in one ns from another, I don't have to do any special re-init or anything, do I?
17:39`cbprovar: no
17:40rovarhmm.. I've been getting some odd behiavior since I refactored a datomic connection out into another ns..
17:40rovarI use it in main, and init in in main.. but in the repl, all of the symbols resolve, but the connection no longer works..
17:57rovarah.. actually the problem is that datomic.api/connect silently fails sometimes..
17:57rovarsuper
18:01baldandgoateedrovar, do you hate me
18:02baldandgoateedbecause everyone hates me.
18:02rovarbaldandgoateed: no, but maybe because I haven't gotten to know you.
18:05domino14i'm trying to use two nested for loops to accumulate a vector. the inner for loop would add on to the vector and the return of the whole function would be the vector
18:06baldandgoateedrovar, I think it is, everyone hates me.
18:06domino14i just cant figure out how to do that in clojure
18:06baldandgoateeddomino14, I don't understand what you mean.
18:07rovardomino14: what exactly are you trying to achieve?
18:09oskarkvyeah, what is for loops?
18:09TEttingerfor is a comprehension in clojure, which is a different usage
18:09technomancyclojurebot: for?
18:09clojurebotfor is not used often enough.
18:10jack_rabbitheh
18:10technomancythat's not what I was looking for
18:11baldandgoateedrovar, do you already hate me.
18:11baldandgoateedBecause everyone does
18:11baldandgoateedthis includes AimHere.
18:12jack_rabbitdomino14, it would help if you provided a testcase.
18:12oskarkvdomino14 don't keep us in suspense. What are you trying to do?
18:13domino14ok
18:13NotteIs clojurebot a repl?
18:13domino14https://dpaste.de/KsxS i'm basically trying to generate that pseudocode in clojure
18:13Notteclojurebot speak up!
18:13TEttingerNotte, it can eval, but is only kinda a repl
18:14TEttingersome things are forbidden, like slurping from URLs
18:14domino14i've written the function "s without a" already, so my main problem is that i cant figure out how to add on to perm_list which is two levels up in the loop
18:14NotteTEttinger: how does it work? Is there an help?
18:14Notteclojurebot help
18:14domino14i understand what 'for' does in clojure, and it's not exactly what i want (since the outer 'for' loop doesn't 'return' anything)
18:15jack_rabbitdomino14, why not do it with a recursive call and a for loop, just like your python there?
18:15RaynesNotte: There are two bots here that can evaluate code. clojurebot is triggered with a comma: ,(+ 2 2). lazybot is triggered with an ampersand: &(+ 2 2).
18:16mmitchellHmm, there was a great post/article out there on the interwebs about why someone (I think the CTO was asking) would choose Clojure over other languages. Anyone know what I'm talking about?
18:16TEttinger,(str "Notte you can call code with a comma-starting line: " (+ 1 2 3))
18:16clojurebot"Notte you can call code with a comma-starting line: 6"
18:16Rayneslazybot also looks for code you've embedded in messages with ##(+ 2 2)
18:16lazybot⇒ 4
18:16mmitchellIt might have been in the Google Groups, but I can't find it
18:16technomancymmitchell: this one? http://www.colinsteele.org/post/23103789647/against-the-grain-aws-clojure-startup
18:17domino14ok, so the inner for loop looks like: (for [e z] (concat [el] [e])) -- this will eventually return ( (..) (..) (..) )
18:17mmitchelltechnomancy: No, but that one is good too -- I worked there :)
18:17domino14then the "outer" for needs to also "return" something because it's a comprehension, it needs that value at the end, but in the pseudocode, you see it's not supposed to "return" anything
18:17NotteGreat, thank you, Raynes, TEttinger
18:18domino14it's only at the end, the return value for the function, that i can just say perm-list and that'll be the return value for the function
18:18TEttingerno prob Notte. you can also /msg clojurebot ,(+ 1 2)
18:18TEttingeror lazybot, actually
18:18mmitchelltechnomancy: There was a guy asking for feedback from people so it must have been on Google Groups. Lots of good feedback, I'll keep looking...
18:18domino14basically i ahve something htat looks like this: https://dpaste.de/ET11
18:18NotteGoodnight
18:19domino14and it's not really working, it's giving me (((0 1)) ((1 0))) instead of ((0 1) (1 0))
18:19domino14see how there's extra (( ))) ?
18:19TEttingerdomino14, agh. there's an issue there with loop/recur being strongly preferred for recursive calls
18:19domino14i realize loop / recur are preferred for recursive calls, but i can't even begin to figure out how to use it here
18:20jack_rabbituntil we get some TCO in clojure. :)
18:20domino14to turn that pseudocode into tail-recursive like that, it's just breaking my brain
18:20domino14so i'd like to do it the "right" way eventually, but it feels like first i ahve to figure out how to just implement that pseudocode
18:22technomancymapcat maybe
18:23akais there a defacto clojure micro-framework/lib for web dev? I use Flask (python) for most web projects now and wanted to try clojure. I'm not looking for a single page app framework.
18:24technomancyaka: compojure is the most widely used and afaik is close-ish to flask
18:24akatechnomancy: thx I'll take a look at it
18:27jack_rabbitYeah, compojure is really cool.
18:27mpenethmm odd, unbound dynamic vars are true'ish ?
18:27mpenet,(def ^:dynamic foo) (when foo (println :dwa))
18:27clojurebot#'sandbox/foo
18:28mpenetbah, it prints here :/
18:28mpenet,(do (def ^:dynamic foo) (when foo (println :dwa)))
18:28clojurebot:dwa\n
18:28hiredmanyeah, there is a special unbound var value, and it is not falsy
18:28mpenetbug?
18:28hiredmannope
18:29mpenetah, surprising though
18:29technomancydoes it depend on ^:dynamic?
18:29hiredmanit isn't just dynamic vars either
18:29tpopeit does not, just tried
18:29baldandgoateedhiredman, did you know that there are people who are flipped internally, like they are mirrored on the inside, everything which is left in most people is right in them
18:29baldandgoateed1 in 10 000 people apparently is flipped like that
18:29tpopewhat does that even mean
18:30rasmusto,(reverse "baldandgoateed")
18:30clojurebot(\d \e \e \t \a ...)
18:30hiredmanI did know that, infact
18:30tpopeoh you mean like their organs?
18:30tpopewas expecting philosophical drivel
18:31nDuffbaldandgoateed: weren't you just talking about this in #xml?
18:31rasmustolooking in a mirror is weird too, or listening to your own voice, but that's a perception thing
18:31baldandgoateednDuff, yeah
18:31nDuffbaldandgoateed: there *are* -offtopic or -social channels on the network, fwiw.
18:31baldandgoateedI am talkinga bout this everywhere.
18:31hiredmanhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L31-L45
18:31baldandgoateedTHere is an offtopic clojure channel?
18:31baldandgoateednDuff, where?
18:31akaI didn't know of situs inversus... gotta love #clojure
18:32nDuffbaldandgoateed: no, but Clojurians don't necessarily have more need to be informed on this topic than Pythonists. You'd have just as much audience in #python-offtopic. :)
18:32hiredmanI forget what that was added for, but it wasn't always the case, rich mentioned the change on irc some years ago
18:32technomancythere used to be an offtopic clojure channel
18:32technomancymaybe #clojure-lounge or something
18:33baldandgoateednDuff, I'm banned there
18:33oskarkvdomino14 https://www.refheap.com/26323
18:33rasmustoI'm always blown away by the number of commented-out lines in the clojure source, most of them existed in some release, right?
18:33mpenethiredman: thanks
18:33hiredmanrasmusto: no
18:34oskarkvdomino14 one key thing is that if (= 1 (count items)) you must wrap it in a seq because it's supposed to be a seq of the permutations, which are seqs
18:34tpoperasmusto: hallmark of using a shitty scm you don't trust. and clojure started in svn
18:34rasmustohiredman: unimplemented features?... oh
18:35hiredmanrasmusto: my guess is rich just likes to fiddle and try stuff out
18:35rasmustoI assume it must be a combo of both
18:35kristoflanguage lounges always suck
18:36hiredmansure
18:36domino14thanks i'll study this code
18:36rasmustobtw, that intern var_blah_foiwjefwoe thing from earlier totally cracked me up
18:37rasmustohttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7793 that one :)
18:39oskarkvdomino14 feel free to ask questions :p
18:40arrdemrasmusto: AAAH NO SPOILERS I'm still reading that file :P
18:41arrdemtechnomancy: is #clojure-lounge registered?
18:42technomancyarrdem: no idea; I have only vague memories from years ago
18:43arrdemtechnomancy: it isn't registered to anyone...
18:47rasmustoarrdem: working your way through all of the source?
18:47TEttingerdomino14: ##(let [k-filter (fn [el coll] (filter #(not= el %) coll)) perms (fn [n coll] (if (= n 1) (map vector coll) (for [el coll nlis (perms (- n 1) (k-filter el coll))] (conj nlis el))))] (perms 4 [1 2 3 4]))
18:47lazybotjava.lang.RuntimeException: Unable to resolve symbol: perms in this context
18:47TEttingerha
18:47arrdemrasmusto: that was the idea..
18:48TEttinger##(let [k-filter (fn [el coll] (filter #(not= el %) coll)) permute (fn perms [n coll] (if (= n 1) (map #(vector %) coll) (for [el coll nlis (perms (- n 1) (k-filter el coll))] (conj nlis el))))] (permute 4 [1 2 3 4]))
18:48lazybot⇒ ([4 3 2 1] [3 4 2 1] [4 2 3 1] [2 4 3 1] [3 2 4 1] [2 3 4 1] [4 3 1 2] [3 4 1 2] [4 1 3 2] [1 4 3 2] [3 1 4 2] [1 3 4 2] [4 2 1 3] [2 4 1 3] [4 1 2 3] [1 4 2 3] [2 1 4 3] [1 2 4 3] [3 2 1 4] [2 3 1 4] [3 1 2 4] [1 3 2 4] [2 1 3 4] [1 2 3 4])
18:49TEttingerit's a port of http://ktuman.blogspot.com/2010_05_01_archive.html
18:49AeroNotixare there any libraries for treating byte-arrays like strings? (SOMELIB/split)
18:49AeroNotixetc
18:50technomancyAeroNotix: typically you'd operate on a seq of an array for things like that
18:50technomancyas long as laziness isn't a problem
18:51AeroNotixtechnomancy: hmm, ok. Cheers!
18:55mrhanky(defn foo ([x y z] ...) ([a] ...)
18:56mrhanky)
18:56mrhankyis it possible to write something like this? (foo (if cond? a x y z))
18:57TEttingermrhanky, condp = a
18:58TEttingerthough I'm not quite sure what you mean
18:59mrhankyi have function which accepts [a] or [x y z]
18:59TEttingeryou can use apply and a sequence
19:00hyPiRionmrhanky: (apply foo (if (pred? ...) [a] [x y z]))
19:00TEttinger(inc hyPiRion)
19:00lazybot⇒ 29
19:01hyPiRioneventually just (if (pred? ...) (foo a) (foo x y z)), which is not that bad in this case, really.
19:01mrhankyi was just wondering if there is something to just have one call to foo
19:02domino14sheesh
19:02domino14what does ## do
19:02oskarkvit's for the bot, it's not clojure
19:02`cbpit calls lazybot
19:13aphyramalloy_: Raynes: would it be possible to enable ,(source foo) for lazybot in #riemann?
19:15Raynesaphyr: I don't think clojure.repl/source works inside lazybot, and even if it did I don't think the sandbox would allow it.
19:15aphyrkk. (doc) works, so I was kinda surprised
19:15aphyrbut source-fn appears to be dark magic
19:15Raynesaphyr: That's because I rewrite doc specifically for lazybot.
19:15aphyroh nice, haha
19:15Raynes:p
19:15Raynesrewrote*
19:16Raynesaphyr: So, there is a $source command but I think it links to out of date docs.
19:16aphyrhmm. I need (source) to work outside the repl for Meitner. Might have to take a stab at it.
19:16Raynes$source println
19:16lazybotprintln is http://is.gd/ewuFP7
19:46domino14how does (remove {#2} [0 1 2 3]) work?
19:46domino14#{2} sorry
19:46domino14what does #{..} mean?
19:46domino14,(remove #{2} [ 0 1 2 3])
19:46clojurebot(0 1 3)
19:47insamniac(remove #{2 3} [ 0 1 2 3])
19:47insamniaci am a failure
19:47bbloomdomino14: explore with the class function and try using #{...} as a function directly. ask again if it hasn't become clear after that
19:48domino14i don't know how to find what that syntax itself means #{..}
19:48ivan,(type #{})
19:48clojurebotclojure.lang.PersistentHashSet
19:48insamniac,(hash-set)
19:48clojurebot#{}
19:49insamniac,(hash-set 1 2 3)
19:49clojurebot#{1 2 3}
19:49domino14,(= #(= 3 %) #{3})
19:49clojurebotfalse
19:50domino14,(#{3} 4)
19:50clojurebotnil
19:50domino14,(#{3} 3)
19:50clojurebot3
19:50domino14,(#{3 4 5} 3)
19:50clojurebot3
19:55oskarkvdomino14 here's all the reader stuff (like #{}, #(), etc.) http://clojure.org/reader
19:59domino14oskarkv: so for your code, i'm not sure what the apply concat does
20:00domino14what do the terms look like that come to it?
20:00bbloom(doc apply), (doc concat)
20:00clojurebot"([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."
20:00bbloomexperiment with them :-)
20:00bbloom(doc concat)
20:00clojurebot"([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."
20:04oskarkvThe inner for generates a subset (the one for the permutations where item has been removed and so on) of all permutations, but the out for generates a list of subsets. But the permutations should not be split up like that. It's just an artifact of the implementation.
20:04oskarkvdomino14 ^
20:04oskarkvouter*
20:14Denommushi
20:14Denommusanyone here worked with Luminus + Cassaforte?
20:23akurilinWhat do you guys do with your ring app logs? Right now I'm just logrotating at 10mb up to 100mb total. I imagine next step is storing them all centrally once the ring app gets cloned onto multiple machines?
20:33RickInAtlantaLF vs CRLF which one is windows, which one is linux
20:34DenommusCRLF is Windows, LF is Linux
20:34DenommusI'm really confused about how to use cassaforte with Luminus, and the documentation does not help
20:34RickInAtlantathx
20:35teslanickWhat's the current thinking on writing a simple parser in clojure?
20:35akurilinI can never remember the CRLF thing because Windows came way after Unix, yet it adopted the more ancient teletype standard, so it escapes reason.
20:35RickInAtlantaI am trying to do what will be my first ever pull request, and now I am thinking I shouldn't do it from windows
20:36quizdrteslanick clojure is great for parsing just about anything
20:37teslanickYeah. I was going to base my format on edn, but clojure (like all rational programming languages) hates tokens in the form of 3d6.
20:37Denommushow would I create schema migrations in Cassaforte?
20:37teslanickWhich is to say I'm fooling around with a simple dice rolling tool.
20:47Cr8teslanick: https://github.com/Engelberg/instaparse has been handy for me
20:48Cr8though I generally just hack dice-strings together with regexes >>
20:50teslanickYeah, it's fine if you want 3d6 + 4. But if you want something that represents: "roll 4d6, drop the lowest, and if the sum is less than 9 reroll"
20:51teslanickI don't necessarily want that kind of complexity, but having that door open seems worth the extra initial time investment.
20:51teslanickSo thanks for the tip
20:54hiredman3d6+3
20:54clojurebot14
20:56teslanick1d20+4
20:56clojurebot15
20:56teslanickWell.
20:57arrdemteslanick: just go ahead and build something cooler :D
20:57teslanickchallenge accepted.
21:01teslanick122
21:03Denommusis there any good migration library for CQL in Clojure?
21:04quizdris there a way to see how a reader macro is implemented? I'm curious how ~@ is written
21:06hyPiRion,'~@my-list
21:06clojurebot(clojure.core/unquote-splicing my-list)
21:06quizdr,(doc unquote-splicing)
21:06clojurebot"; "
21:07hyPiRionbest doc.
21:07quizdrhm ok
21:07hyPiRion$source unquote-splicing
21:07lazybotunquote-splicing is http://is.gd/EHA4TP
21:07gozalawhat’s the idiomatic way to let producer of channel know you no longer want to get data put on the channel ?
21:07hyPiRiongurr.
21:07quizdri don't get it
21:07quizdrthe implementatino is empty?
21:11hyPiRionquizdr: no, it just reserves the symbol for the reader. Look at LispReader, most notably https://github.com/clojure/clojure/blob/clojure-1.4.0/src/jvm/clojure/lang/LispReader.java#L745-L882
21:14quizdrI'm just curious how a function operating on an expression could splice the expressions inside the expression into the parent expression.
21:15quizdri guess it is not handoled in clojure itself, hence the java code block you linked to
21:18srrubyA while back I briefly tried switching my data structures to using records rather than maps. I reverted when I found that postwalk didn't work with records. Any thoughts on this? Thanks, John
21:21quizdrwhat does postwalk mean? i know you can't use keywords as functions with records as you can with maps
21:24quizdrsorry i meant the opposite
21:32quizdrsrruby perhaps you could convert the record to a map for use with the postwalk function
21:34domino14i need to make my permutation function generate permutations of 10 elements and sort them alphabetically. i guess that wasn't the way to do it because it's been running for like 30 minutes
21:34quizdrsrruby turn your record into a map like this: (into {} (->aaa 1 2))
21:34domino14that's only ~3.8 million elements, why so slow clojure
21:35brehautafternoon talios
21:39srrubyquizdr Thanks!
21:40srrubyquizdr Do you recommend using records as opposed to maps?
21:42dj_ryanhey folks, is there a good way to convert a multi-module maven project into lein?
21:42clojurebotNo entiendo
22:01danno1So, the loop form (at least I think it is a form) looks semantically like recursion
22:11quizdrsrruby there is a lot of overlap between them, and i'm fairly new to clojure so i'm not the best one to answer, but here are the considerations: maps are also function of their keywords, records are not. records however allow you to adopt protocols. and if you are going to have several different maps with the same structure, records are better since the keywords are not taking up duplicate space in all the maps.
22:11srrubyThanks!
22:14bbloomsrruby: generally, default to maps, use records if you have a good reason to
22:14bbloomsrruby: and the even if you think you have a good reason to use records, make sure your reason is actually good :-)
22:15carkam i right in thinking that only clojurescript supports specify ?
22:16bbloomcark: yes
22:16carkallright, any caveats i should be aware of ?
22:16uvtcIn my repl, after loading clojure.java.sh :as sh, why doesn't this work? : `(sh/sh "ls" "*.txt")`? It doesn't seem to like the star, because `(sh/sh "ls" "-l")` is fine...
22:17srrubybbloom: I thought I'd see if records would improve the programs speed.
22:17bbloomsrruby: depends greatly on the program
22:17eggheaduvtc: the bash repl actually expands that star for you
22:17uvtc(I realize I should probably be using Raynes' `fs` for that particular need anyway though.)
22:18eggheadso the process that is actually invoked from the shell has no wildcards
22:18eggheadraynes' directory search as tree-seq is cool :)
22:18Raynesegghead: huh?
22:19eggheadfile-seq
22:19uvtcegghead, though, I may need to sometimes use "*.whatev"... how can I keep the repl from trying to expand it for me? I've tried single-quoting it, and also backslash escaping...
22:20eggheadoh nvm Raynes didn't realize file-seq was clj core
22:20Raynesegghead: I was terribly confused.
22:22eggheadhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4504 is such a cool use of tree-seq
22:22carkso there's no way to work with protocol the same way in clojurescript than clojure via extend and a map of functions ?
22:28arrdemCompiler.java:2732 more whitespace weirdness....
22:32Raynesarrdem: What's sad is that you can fix all of the issues with Compiler.java in one simple command.
22:33arrdemRaynes: rm -rf?
22:33Raynesarrdem: rm Compiler.java && touch compiler.clj
22:33Raynes<3
22:33arrdemRaynes: good news, thanks to Bronsa's c.t.a.* work that's what I hope to do before I graduate...
22:38newturtlei'm writing a simple tree search, and have a tree composed nodes, where a node is just a a couple fields and a pointer to a parent. once i get to a end node, i want to walk from the ending node up to the root mood via the parent relation.
22:39arrdemnewturtle: you're gonna have a really really bad time expressing that datastructure unless you resort to atoms..
22:39newturtlei have this working, but i know its a mess, as i just set an atom vector and loop through while parent not nil? and swap conj the parent onto the vector
22:40newturtleok...so that was my eventual question. it just doesn't feel idiomatic to me, so i was wondering if i was going about it wrong.
22:42arrdemnewturtle: so the real answer to this problem is that you cannot express this datastructure in idiomatic Clojure without using Java interop.
22:43arrdemnewturtle: because a child must have a ref to the parent and vice versa, both must be created at the same time which is impossible because "modifiying" one to point to the "other" changes the first and invalidates the cycle hence your use of atoms
22:44alandipertnewturtle: sounds like a candidate for a zipper
22:44arrdemnewturtle: the real answer is that you use a directed tree from parents to children and build something like the zipper library to access it.
22:44arrdem$google clojure zippers github
22:44lazybot[clojure/data.zip · GitHub] https://github.com/clojure/data.zip/
22:44newturtlewell, i build it singly directed, so the child knows of the parent, but not vice versa.
22:44RaynesZippers are the solution to everything.
22:44newturtleso i am alright in that regard.
22:45newturtlemy question is really just once i get the final child, a simple way to traverse back up the tree and collect the nodes i hit.
22:45arrdemnewturtle: ooh. okay I see what you're doing.
22:46newturtlelet me look at zippers, maybe something will click.
22:46arrdemanyone got better ideas than an explicit loop? I'm not thinking of a reduce or for based solution to this...
22:47arrdemyou could also do this with a tail recursion... but that's not any better than an explicit loop really...
22:47arrdem(dec also) ;; I'm downvoting also and so whenever I use their names
22:47lazybot⇒ -1
22:57quizdrbbloom would you say that having many maps with identical keys could be a good reason to use records instead?
22:58bbloomquizdr: define "many"
22:58bbloomor quantify, rather
22:58quizdrsay a hundred or more
22:58quizdrwhere maybe the maps have 30 keys that are all identical
22:59bbloomat a hundred or so, you have to also quantify how many times you're doing what to them
22:59bbloomand a record with 30 key entries is unlikely to perform well.... nor can i conceive of when you'd ever want to do that
22:59bblooma more realistic number of keys for a record is < 10
22:59bbloommore like 2 to 5
22:59quizdri see, so a map is better for large key sets?
23:00bbloomagain, depends on what you're doing
23:00carkif you have a map that could be made a record and it has 30 keys, there's something wrong
23:00quizdri was just thinking that since the keywords themselves would not be taking up space in each individual instance of a record, just in the definition of the record, that many maps with identical keys could benefit from records for that reason
23:00bbloomit's a data structure and therefore it depends on your workload
23:00quizdrso the underlying of implementation of maps and records is considerably different, despite that they have a very similar interface?
23:00Bronsaarrdem: http://sprunge.us/WXJE?java here, this should be better.
23:01bbloomquizdr: the underlying representation of small maps and big maps are very different too!
23:01bbloom,(class (array-map))
23:01clojurebotclojure.lang.PersistentArrayMap
23:01bbloom,(class (hash-map))
23:01clojurebotclojure.lang.PersistentArrayMap
23:01bbloom,(class (sorted-map))
23:01clojurebotclojure.lang.PersistentTreeMap
23:01Bronsaarrdem: indented+all the commented out code removed
23:01bbloom,(defrecord Point2D [x y])
23:01clojurebotsandbox.Point2D
23:01oskarkvare records more like array-maps?
23:02bbloom,(class #sandbox.Point2D{:x 5 :y 10})
23:02clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
23:02quizdri see, so the system will automatically determine the underlying implemenation of a map based on its size, and this is something invisible to the programmer
23:02bbloomquizdr: it's not all that mysterious
23:02bbloomquizdr: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java#L177-L178
23:04quizdrI'm coming to clojure only with a common lisp background, and feel a bit behind the curve since i've never written or read Java in any capacity before
23:05bbloomif you have 100s of maps with 30 keys in common each, you probably have a bad representation for your problem
23:05quizdrthat's possible
23:05oskarkvbbloom so why do you say that a record of 30 keys are unlikely to perform well? It seems similar to a map, is it not?
23:05oskarkvis*
23:05JacobGood1Hello, is anyone willing to lend me a hand, I need help with understanding macros
23:05oskarkvJacobGood1 shoot
23:06bbloomoskarkv: b/c the implementation will be similar to an array map. right now the clojure threshold for promoting an array map to hash map is 16 items
23:07bbloomoskarkv: so if you have an array map of more than 16 items, it stands to reason that it's likely to be slower than a hash map
23:07quizdrbbloom so all records are array maps, despite their size?
23:07bbloomthey are not quite array maps, they are simply similar
23:07newturtlealright, zippers dont seem like the right fix.
23:07oskarkvbbloom ah ok
23:07bbloomrecords have one major advantage, which is that :keywords used for lookups can be compiled to direct field access
23:08newturtlehere's a paste showing what i'm trying to do.
23:08newturtlehttp://pastebin.com/H00MjUSf
23:08bbloomthat the MAIN win of records
23:08bbloomif you're doing higher-order lookups on records or whatever, you're gonna get array map or worse perf
23:08bbloombut if you have 30 fields, i can't imagine you needing to access each individual field by name with a direct keyword lookup....
23:09quizdrin studying the relationship of records to protocols, i felt a bit like it was an attempt to bring OOP patterns into lisp. but I'd think that records/protocol functionality is mostly there with maps/multimethods or is this naive?
23:09alandipertnewturtle: i'll cook up a zipper example for you - it will look similar
23:10hiredmanquizdr: I would say they are more like the type classes of haskell, if you are familiar
23:10technomancyquizdr: yes, one of the annoying things about records is that people tend to think that they're a way of doing traditional OOP, but that is not the intent
23:10quizdrno hiredman i'm not
23:10alandipertnewturtle: oh wait - the objects you're searching contain their parent but not their children?
23:11hiredmanquizdr: http://www.haskell.org/haskellwiki/OOP_vs_type_classes might be a good place to read about them then
23:11technomancyquizdr: that is, you're not the only one to have that mistaken impression =)
23:11newturtleyeah...i build the tree downward...
23:11quizdrit would seem that multimethods are more flexible than protocols and can do a lot of the same things as far as dispatch is concerned, without having to "bundle" a bunch of different method names together.
23:12newturtleso it is singly linked. i just want to collect the solution nodes. what i have works...it just feels a little clunky.
23:14hiredmanquizdr: but the arbitrary dispatch nature of multimethods also limits how fast they can be
23:14quizdrhiredman oh i see
23:15hiredmanthe grouping of functions in to a protocol is often kind of nice
23:16alandipertnewturtle: https://www.refheap.com/26388 is an alternative that comes to mind
23:16hiredmanprotocols are fast open ended dispatch on type (meaning you can extend a protocol to a type without defining the type to say it implements such an such an interface) while multimethods provide arbitrary dispatch, and hierarchy based dispatch
23:17alewisn't the main point of protocols to interop with interfaces?
23:17hiredmanprotocols are in some sense, simpler, and more suited to the bottom of a stack
23:17hiredmanalew: absolutely not
23:18alewso they are just an optimization then?
23:18hiredmanpeople tend to get tripped up because on the jvm protocols also happen to generate an interface that you can use to improve the dispatch speed
23:18hiredmanbut that is not core to the notion of protocols
23:20hiredmanhttp://debasishg.blogspot.com/2010/08/random-thoughts-on-clojure-protocols.html seems like a good write up
23:20newturtlehmm. that is interesting. if-let only assigns parent if it isn't nil then? interesting.
23:24newturtlei tried again with transient, and it was a bit simpler, but yours still seems better.
23:24newturtle(http://pastebin.com/rE7ate5j)
23:24newturtlebut either way, it seems like i'm not terribly far off on the approach?
23:25hiredmanyou are
23:26hiredmanthere is no need for a transient, right?
23:26hiredman(recur … (conj stack some-value))
23:28newturtleyeah, you're right.
23:29alandipertnewturtle: https://www.refheap.com/26394 is another way, a 'backward' zipper that kind of abuses the concept
23:30wei__anyone know how to configure BoneCP (jdbc connection pool) to use a set-parameters function?
23:31seancorfieldNot sure what you're asking wei__ - set-parameters?
23:31wei__seancorfield: so without a connection pool, i can include a :set-parameters function in the spec map, that takes a preparedstatement and applies some custom transforms
23:31newturtleheh, alandipert, you're getting me into the deep end i think! i'll have to work through that one. your first was pretty easy for me
23:32seancorfieldthe pooled connection is also just a map
23:32seancorfieldadd :set-parameters to that map
23:32newturtlehere, without the transient. that's about as simple as my original can be made i think. http://pastebin.com/XJ9gSEvF
23:33seancorfieldsee the docs wei__ http://clojure-doc.org/articles/ecosystem/java_jdbc/connection_pooling.html#create-the-pooled-datasource-from-your-db-spec
23:33newturtlethanks for the help, i'm glad to know i'm not going way off trail here.
23:33seancorfieldthe result of (pool db-spec) is a map {:datasource cpds} so assoc :set-parameters into that
23:34wei__ahh, that works! that's the docs I'm following, but I wasn't sure how set-parameters was used
23:34wei__(inc seancorfield)
23:34lazybot⇒ 10
23:35seancorfieldit's all just maps, all the way down :)
23:35seancorfieldjava.jdbc adds stuff to the map as it works to track transactions and so on
23:35alandipertnewturtle: one advantage of making a 'stack' param is that a user can supply their own collection, like a list, to get the path in another order (leveraging conj polymorphism)
23:36seancorfieldbut for the most part the "db-spec" is opaque
23:36wei__i see
23:36newturtleoh yeah, that's a good point.
23:37seancorfieldeven if you start with a JDBC connection string, you get a map as soon as you try to connect using it, e.g., inside a transaction
23:39wei__well before I added the set-parameters key there was just the :datasource and nothing else
23:41arrdemBronsa: hah thanks
23:42alandipertnewturtle: and, of course, https://www.refheap.com/26399 :-)
23:46newturtleoh man, that one is crazy.
23:48newturtlewow, that's elegant. i never yould have come up with it.
23:48newturtle*would
23:48sdegutisIs there a new Internet yet?
23:51sdegutisChrome kills my laptop and CSS is hard. It's 2014, surely we can do better than this.
23:56quizdrsdegutis actually i'm using Internet 2.2 and it's promising, but in closed beta so I can't really talk about it
23:57TEttingersdegutis: IRC isn't good enough?
23:57sdegutisquizdr: Makes sense. Most things in startup-culture are closed beta for life.
23:57sdegutisTEttinger: Good enough for the time being.
23:57sdegutisI'm gonna delete my website as a boycott to the current Web.
23:58sdegutisYou guys got just a few minutes to check it out.
23:58sdegutishttp://sdegutis.github.io/
23:59TEttingerheh, I'm doing one of your goals