#clojure log - Jan 21 2014

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

0:00 xuser: arrdem: but ltc just seems more promising

0:09 deadghost: yep ddellacosta looks like it was working perfectly fine

0:09 human error as usual

0:20 technomancy: quizdr: what part of .sg are you in?

0:30 quizdr: technomancy there is really only one part, singapore is just a single medium-sized city. i live in the central part of it.

0:31 technomancy: quizdr: cool; I used to live in Yishun

0:31 are you down near Bishan then?

0:32 quizdr: no i'm further south than that, not far from Clarke Quay, Little India, etc

0:33 how long where you here, and when?

0:33 technomancy: oh nice. my parents used to work near little india; a few blocks from dhoby ghaut

0:33 I was only there from 99-01

0:34 ddellacosta: deadghost: ah, great. Yeah, sometimes you just need another pair of eyes to take a look. ;-)

0:35 technomancy: quizdr: do you write clojure for a singaporean firm?

0:36 quizdr: you 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

0:36 but i love it here.

0:36 technomancy: yeah, my parents have visited there and they say it's so much more crowded

0:37 quizdr: there 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.

0:37 technomancy: hm; still that's more than I would have expected =)

0:37 quizdr: i fall under the category of Clojure Hobbyist at the moment, but my work is almost entirely in C++

0:37 technomancy: I got the vibe that most companies there were very conservative about technology choices

0:38 quizdr: Well, Haskell is a lot more conservative a choice that Clojure.

0:38 The largest startup in Singapore, Zalora, has grown to over 1000 employees in just 1 year, and they use Haskell entirely for their dot-com

0:38 noprompt: some of these FP thought leaders make me sad. especially the haskell ones.

0:39 technomancy: in some ways. introducing an unfamiliar runtime is pretty risky for an ops team that already deploys the JVM.

0:39 noprompt: quizdr: that comment was unrelated to your discussion btw.

0:39 quizdr: at least that's what I've gathered, a lot of the Zalora folks are in the FP group

0:39 noprompt: just letting off steam.

0:39 technomancy: does dons work for a company that operates in Singapore?

0:40 quizdr: I 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.

0:40 technomancy what is "dons" ?

0:40 technomancy: quizdr: Don S., famous haskell persona

0:40 Stewart maybe?

0:41 quizdr: i don't know who that it is, but have you heard of Dr. Shaun Martin?

0:41 noprompt: quizdr: 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.

0:41 technomancy: I just remember hearing him say they had good luck hiring for positions in what I believe was a financial company

0:41 quizdr: no, I haven't read a whole lot about haskell

0:41 I lean more towards OCaml myself =)

0:42 quizdr: yes 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

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

0:43 technomancy: I would definitely go if I were there =)

0:43 quizdr: his background is MIT, the Princeton Institute of Advanced Study, and Oxford. Should be interesting.

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

1:17 I'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?

1:23 amalloy: retaining the head of a lazy seq doesn't affect stack usage, just heap

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

1:24 quizdr: here's the code and question more clearly: https://www.refheap.com/26085

1:24 amalloy: so the lazy-seq function doesn't do any recursion immediately; it bounces off the caller's stack frame

1:27 wellllllll, 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

1:28 quizdr: In 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?

1:29 amalloy: yes

1:30 quizdr: understanding laziness has been one of the tougher challenges for me to get used to

1:32 so 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?

2:30 amalloy: no. deeply-nested lazy sequences are a different issue from retaining the head of a long sequence

2:41 ro_st: dnolen: your youtube video is awesome! did you have to do anything special to get the browser connection going? or is that just lighttable magic?

2:42 dnolen: do you know of a way to stop react eating runtime errors so that i can see a meaningful stacktrace in the debugger?

2:42 quizdr: amalloy 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

2:42 in that the REPL is essentially hanging onto it

3:10 domino14: hi, how do i loop through a set but also break out if i need to?

3:10 greywolve: write a loop recur?

3:11 ro_st: or 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

3:11 greywolve: or if there's a specific value you need use drop-while or take-while

3:12 bingo ;)

3:12 quizdr: or 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

3:13 greywolve: awesome need to check that out

3:14 quizdr: in 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

3:14 Cr8: well

3:14 Om *was* very nifty

3:15 I'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

3:15 ro_st: have you seen the todomvc example, Cr8? might be an insight in there?

3:15 https://github.com/swannodette/todomvc/tree/gh-pages/labs/architecture-examples/om-undo

3:15 Cr8: yeah, I'm reffing it

3:16 that seems to just be doing (om/transact! [:path] filter pred)

3:17 Uncaught TypeError: Cannot read property 'parentNode' of undefined

3:17 is what I get

3:17 from inside React

3:17 could be a react problem

3:18 fredyr: Cr8: for me that has usually been that the cursor is wrong

3:18 Cr8: so the data you send to the react rendering is undefined

3:19 Cr8: hm

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

3:20 fredyr: Cr8: not sure about your transact! example above, seems a little off?

3:20 Cr8: I can update items in almost exactly the same fashion as long as the update doesn't cause them to not be rendered

3:21 fredyr: Cr8: how are you able to update without rendering?

3:21 Cr8: mine's closer to (om/transact! my-data [] mark-as-deleted id)

3:21 fredyr: i believe transact and update always trigger re-rendering

3:21 Cr8: fredyr: no, it does render when I do updates that don't remove anything

3:21 if I swap out mark-as-deleted with thing-that-ticks-a-counter everything is fine

3:21 fredyr: Cr8: ah right, i see

3:22 Cr8: reality: I have two buttons, one that's supposed to remove an item and one that's supposed to tick its counter

3:22 fredyr: Cr8: you know you can use update! if you're just using the cursor without an path?

3:22 Cr8: oh

3:24 fredyr: Cr8: shouldn't really matter though

3:25 Cr8: but it is a little nicer

3:26 Cr8: maybe is sablono's fault, had a problem earlier that went away when I switched back to plain om.dom

3:26 ro_st: om.dom is definitely required if you're using inputs, that's for sure

3:27 Cr8: yeah that was the first thing that broke

3:27 these are buttons but I thought it'd be okay =P

3:27 fredyr: Cr8: oh haven't used sablono

3:29 Cr8: is it good btw, apart from some things not working

3:30 ro_st: confirmed. om/react is proving to be great

3:31 fredyr: ro_st: that part i'm onboard with, was wondering about sablono specifically

3:32 ro_st: oh, yes, sablono is fine, it just doesn't have the stuff om.dom has for inputs

3:32 fredyr: ah right

3:32 Cr8: well i like hiccup

3:32 ro_st: perfect for the rest, though. good old hiccup syntax

3:33 fredyr: i've never liked hiccup that much :/

3:33 ro_st: i 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

3:34 [:button {:on-click #(prn "woo")} "Click me"] vs (dom/button #js {:onClick #(prn "woo") "Click me")

3:34 missing } in second example, but you get the idea

3:35 fredyr: sure

3:35 i think i agree also, but i has never bothered me that much tho

3:35 *it

3:36 ro_st: just another way to reduce cognitive overhead for me

3:37 Cr8: ..

3:37 yep, totally migrated off of sablono and it still breaks

3:37 not sablono's fault then

3:37 ro_st: code public, Cr8?

3:37 fredyr: Cr8: refheap some code

3:37 ?

3:38 Cr8: let me hold undo for a sec

3:39 https://www.refheap.com/26134

3:39 the button on line 85 explodes

3:39 excuse formatting, using LightTable and if it has indenty-stuff I don't know how to work it

3:40 ro_st: gah. my local adsl ipc is having issues. can't reach your refheap, sorry

3:41 Cr8: http://drop.crate.im/omthing.txt ?

3:42 ro_st: no, sorry. looks like i have a dns issue. le sigh

3:44 fredyr: Cr8: nothing obvious that stick out unfortunately

3:45 Cr8: incidentally things worked when this list was a ul and not a table

3:46 yep

3:46 if I switch ul with table, remove the header line, and switch tr/td to li/span

3:46 everything is fine

3:48 I think maybe react + tables has a bug

3:48 greywolve: what's the error?

3:48 quizdr: do agents typically share the same pool, or does each one get its own thread?

3:48 Cr8: Uncaught TypeError: Cannot read property 'parentNode' of undefined

3:49 is what I get if an update happens that would cause a row to be removed from a table

3:49 (but it's fine if the update removes the table entirely)

3:49 (or adds a row)

3:49 but if it removes a row and doesn't remove the table wholesale, I get that error

3:49 greywolve: bizzare

3:53 Cr8: at any rate

3:53 now i'm in a position I didn't expect to find myself in:

3:53 faking tables with CSS

4:05 xificurC: I 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

4:05 when I start it from a terminal it prints to the terminal

4:06 Cr8: okay now that I'm past this issue this is excellent again

4:06 xificurC: println's go to whatever java.io.Writer clojure.core/*out* is bound to in the calling context

4:06 fredyr: Cr8: I made a suprt short example trying to remove a row in a table

4:07 Cr8: guess what error msg i got :s

4:07 xificurC: Cr8: hm, thanks, will take a look

4:07 Cr8: (with-open [logger (clojure.java.io/writer "log.txt")] (binding [*out* logger] ... printlns in here go to log.txt ...))

4:08 xificurC: also, 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)

4:08 Cr8: and that context isn't lexical, it carries into called fns. It's sort of kind of thread-local.

4:09 fredyr: well at least we've got a minimum failing case now

4:15 quizdr: is 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

4:23 clgv: it's indeed called thread-local binding ;)

4:24 ,(meta *out*)

4:24 clojurebot: nil

4:24 clgv: ,(meta #'*out*)

4:24 clojurebot: {: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}

4:24 clgv: ,(def ^:dynamic *bla*)

4:24 clojurebot: #'sandbox/*bla*

4:24 clgv: ,(meta #'*bla*)

4:24 clojurebot: {:ns #<Namespace sandbox>, :name *bla*, :dynamic true, :column 0, :line 0, ...}

4:24 TEttinger: heyyyy

4:25 clgv: so at least for self-"deffed" variables it is in the meta data

4:31 Cr8: what :dynamic does is change how code that references that var is compiled

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

4:33 they *will* pick up the newly def'd value, as def changes the root binding

4:37 fredyr: Cr8: i found what the error was now

4:38 Cr8: had a meeting, so i was away for bit

4:39 Cr8: tbody is auto-inserted in html if it is omitted

4:39 Cr8: which makes the diff fail

4:39 Cr8: ah

4:39 fredyr: Cr8: and everything blows up

4:39 Cr8: i saw that happening in chrome

4:39 i guess react was unaware of the implicit tbody?

4:40 fredyr: yeah, it would seem so

4:40 i realized it could be the reason when inspecting the dom elems in chrome

4:41 locks: do all the browsers insert tbody, or is this one of those wild west behaviours?

4:41 fredyr: its specified in the html4 spec

4:42 locks: ah ok

4:42 fredyr: http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#parsing-main-intable

4:46 quizdr: thanks guys, that was very useful, re: dynamic meta data

4:46 fredyr: https://gist.github.com/fredyr/8537199

4:47 i made a gist of the code btw

4:47 mostly to remember if myself

4:47 AeroNotix: Anyone using cloverage

4:47 ?

4:51 It hangs after running the coverage+tests, really annoying for makefiles.

4:59 greywolve: fredyr and Cr8 : thanks, that's handy to know ;)

4:59 Cr8: welp

5:00 now I've converted back to tables and things are fine now that I've put tbody in there

5:07 fredyr: Cr8: nice

5:11 dsrx: argh... anyone ever set up austin in a weird environment that isn't served over http? (like a chrome extension or spotify application)

5:42 quizdr: is Seesaw primarily for local interfaces like on a desktop JVM, or is it also a web interface builder for a browser?

5:46 CookedGryphon: quizdr it's very much swing oriented

5:47 I 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

5:47 shouldn't be too tricky really, all the basics are the same, buttons, lines, etc. Just make it all data based and declarative

5:48 quizdr: ok, i just read about Seesaw and Swing for the first time, I'm not a Java guy so I was curious what they are.

5:49 CookedGryphon: you know when you download a java program, and it has a really ugly gui? That's swing

5:49 quizdr: ha ha

5:49 i've read that Swing is the defacto standard in Java Gui development.

5:49 CookedGryphon: yep

5:49 quizdr: so what's the alternative that people use to make the un-ugly GUIs?

5:50 CookedGryphon: seesaw is really quite nice to use, redefining stuff and having the interface update in place

5:53 andrevdm: the seesaw source code is also very nicely commented. Great for learning

5:54 quizdr: but i guess if you are not targeting local devices then there isn't a lot of use for it

5:55 CookedGryphon: quizdr: not really

5:57 fredyr: another interesting choice for client ui is node-webkit and clojurescript

5:57 quizdr: fredyr that would be for a UI that runs in a browser right?

5:57 fredyr: no

5:57 lighttable uses that

5:57 and runs as a desktop app

5:57 quizdr: interesting

5:59 fredyr: running node for all platform interaction and chromium (aka html etc) for all uis

5:59 quizdr: light table looks nice but when i gave it a try it just didn't feel right.

5:59 too spoiled from emacs already

6:00 never thought i'd say that!

6:00 fredyr: :)

6:00 CookedGryphon: quizdr: the last release went a long way towards an every day usable release

6:00 and the plugin system looks really nice

6:00 just need people to work on all your emacs features now

6:00 quizdr: i tried lighttable just a week ago, it is beautiful.

6:01 fredyr: i excited to see all the different language plugins

6:01 like haskell and ocaml and such

6:01 CookedGryphon: as a platform it's really really promising. Being able to extend it with clojure rather than my half knowledge of elisp...

6:01 quizdr: it's emacs for the modern age.

6:01 maybe

6:01 CookedGryphon: quite possibly

6:01 the one thing that really really annoys me

6:02 is how the text doesn't all line up

6:02 fredyr: the interactive workbook idea is great for trying out new languages and playing around

6:02 quizdr: ah i noticed that, the indentation?

6:02 CookedGryphon: with emacs where everything is monospaced text, everything lines up so nicely

6:02 but with a web ui, where everything's designed to flow... it just doesn't feel as nice to my ocd brain

6:03 but it's probably more than flexible enough to make a version where it does

6:03 quizdr: is that the reason why lighttable has problems with indentation lining up correctly in code?

6:03 CookedGryphon: quizdr: that's probably something else

6:04 quizdr: when 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.

6:04 CookedGryphon: the 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

6:15 sandbags: CookedGryphon: can you screenshot what you mean? I've not seen anything i recognise from your description

6:15 of course, possibly i don't want to know if that means i start seeing it everywhere... ;-)

6:16 CookedGryphon: :p

6:16 fredyr: haha

6:17 i didn't see anything from that description either

6:19 sandbags: everything seems properly lined up when I scroll

6:19 i'm on OSX

6:19 possibly you're having a font issue on a different platform?

6:20 CookedGryphon: sandbags: no, you misunderstand

6:20 sandbags: more than likely

6:20 CookedGryphon: think about when you open emacs in the terminal

6:21 it's exactly the same

6:21 as it's restricted to the same monospace grid as terminal programs

6:21 and as a programmer, I really like that, the constraint keeps everything neatly in line

6:21 sandbags: i think the problem here is that I am not able to envisage your experience or how it varies with what i expect

6:21 and text descriptions don't help :)

6:22 i don't have a very visual imagination so you may be on to a hiding to nothing here :)

6:22 sm0ke: hello 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]

6:22 but the problem is i want ?item to join with both ?itema and ?itemb

6:23 TEttinger: CookedGryphon, I know what you mean actually

6:23 sm0ke: i mean not both but *either*

6:23 TEttinger: the problem is partial-glyph-height scrolls

6:24 it does make it smoother, until you need to compare two chunks of code side-by-side

6:24 sandbags: are you describing a situation where you can scroll such that you have half a line visible at the top/bottom of the screen?

6:25 if not then I will give in gracefully :)

6:25 TEttinger: sandbags, yeah. and if you have two side-by-side windows...

6:25 sandbags: okay because I don't see that here in LT

6:25 TEttinger: one is lined up right, the other is "off"

6:25 hm, maybe some fonts don't do it

6:28 CookedGryphon: it'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

6:29 it'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

6:29 sandbags: i can appreciate if that bothers you but i suspect that kind of polish is a vast distance from being a priority

6:29 CookedGryphon: it has the opportunity to go all over the place

6:30 sandbags: this also is true

6:30 CookedGryphon: it's not polish, that's exactly my point, the plugin makers aren't going to spend time on polish

6:30 might not be an issue

6:31 sandbags: i 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

6:43 sm0ke: can i call -main function recursively?

6:43 arcatan: why not

6:43 Ember-: it's a normal function

6:43 no reason why not

6:43 sm0ke: feels weird

6:43 (-main [x y])

6:43 doesnt it?

6:43 Ember-: well, that's a completely different conversation :)

6:43 that being wierd :)

6:43 but you can

6:44 wei__: 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]

6:44 s/list/vector/

6:44 fredyr: wei__: into [] ?

6:45 andrevdm: wei__: must it be a vector? i.e. can you not use a set?

6:46 wei__: hm. yes, I can use a set

6:47 (into [] 1) doesn't work because it expects a list for the second argument

6:49 andrevdm: wei__: (conj #{1 2} 1) ; => #{1 2}

6:49 sets contain unique values only should do all the work for you

6:49 wei__: oh sorry, I wasn't being clear with the examples. I meant wrap a non-list element in a list.

6:50 but don't wrap if it's already a list

6:50 pyrtsa: wei__: Make an own function for it.

6:50 wei__: yeah sounds good

6:50 hyPiRion: only if it's not a vector?

6:52 well ##(let [listify #(if (vector? %) % (vector %))] (map listify [1 [1 2 3]])) is probably the most straightforward one.

6:52 lazybot: ⇒ ([1] [1 2 3])

6:52 wei__: here's what I got: #(if (coll? %) % [%])

6:52 yeah, that's pretty much what I came up with. thanks guys

6:55 hyPiRion: yeah, [%] is more readable

6:58 sm0ke: i have both :aot and :main keys in project.clj

6:58 still lein says :main specified without :aot

7:00 hyPiRion: sm0ke: append `:main` with `^:skip-aot`

7:00 sm0ke: no i gave :main [mynamespace]

7:01 it has to be :main namespace

7:01 hyPiRion: ah'

7:01 yeah, there can only be one entry point to the uberjar :)

7:03 sm0ke: wtf

7:03 does uberjar runs with "hadoop jar"?

7:03 alew: if you have multiple applications within a single project, do you need to generate multiple uberjars?

7:04 sm0ke: alew: why not run with clojure.main -m namespacename

7:07 hyPiRion: alew: You should probably separate them into separate projects

7:10 sm0ke: i always had a difficulty with lein and runnable jar

7:11 it just doesnt work for me

7:54 juhovh: hmm, if I generate an interface with definterface (which calls gen-interface) how to refer to that interface in another namespace?

7:54 and I know defprotocol is preferred to definterface, but anyway

7:55 import doesn't work unless I'm compiling

7:57 effy: hi, i just installed lein, is there something wrong with my setup if the hello world application take 0m3.318s to run with "lein run" ?

7:58 greywolve: effy: no that's just the jvm start-up time

7:58 effy: greywolve: 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 ?

8:00 greywolve: effy: http://leiningen.org/grench.html , is one solution

8:00 katratxo: effy: usually you work inside a repl, not running "lein run" for testing your latest code

8:01 greywolve: effy: 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

8:02 alew: hyPirion: they share a lot of the same code but have different responsibilities

8:02 greywolve: for code reloading, https://github.com/clojure/tools.namespace is great

8:02 alew: hyPiRion: server and worker in this case

8:03 effy: yeah 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 ?

8:03 bob2: a jvm-hosted language would be a poor choice for that, yes

8:04 clgv: greywolve: thats wrong. only a small portion is jvm startup time, the rest is leiningen and clojure startup time.

8:05 greywolve: clgv: clojure start's pretty quickly, but yeah, its really 2 jvm processes starting

8:05 starts*

8:05 rlwrap 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

8:05 is pretty fast

8:06 effy: i 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)

8:06 clgv: greywolve: in all the startup time discussions the main problem mentioned is Clojure's initialization and all the stuff leiningen does

8:06 bob2: effy, no

8:06 greywolve: effy: you'll have to learn to love the repl ;p

8:07 clgv: true

8:07 effy: greywolve: 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

8:08 would a clojurescript over nodejs have the same limitation in start up time ?

8:09 clgv: effy: well, you could keep a running jvm alive for often repeated short-lived tasks

8:10 juhovh: effy: clojurescript on nodejs is likely to be faster on startup, but probably slower after that

8:10 effy: but you can confirm that by testing on your case

8:10 greywolve: effy: 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

8:11 effy: ok, thank all of you for the feedbacks

8:12 xsyn: the way I understand it is that they are quite different

8:12 node.js is single threaded

8:12 jvm is great for thread concurrency

8:14 clgv: effy: you could try clojure-py - but that one is not maintained anymore afair

8:17 effy: clgv: 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

8:20 s4nchez: who

9:04 AeroNotix: RC4 Stream decryption/encryption libraries? Java/Clojre

9:04 any ideas ?

9:05 javax.crypto Cipher

9:19 sritchie_: otfrom: hey, posted the liberator thing

9:21 daGrevis: what is \a?

9:21 as in

9:21 ,(seq "a")

9:21 clojurebot: (\a)

9:22 jcromartie: daGrevis: that's a character literal

9:22 in Java 'a'

9:22 daGrevis: thanks :/

9:23 is there any implementation of clojure that's not written in java or C# and is mature enough and stable?

9:23 clojure-py wasn't good enough

9:24 ddellacosta: daGrevis: does ClojureScript count?

9:24 jcromartie: it 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

9:24 daGrevis: ddellacosta, nop

9:24 ddellacosta: daGrevis: why not?

9:24 jcromartie: cljs still depends on the compiler

9:24 it's not self-hosted yet

9:24 ddellacosta: daGrevis, jcromartie: sorry, jumping into a conversation too late

9:26 gotcha, guess we will continue to wait on CinC... https://github.com/Bronsa/CinC

9:26 daGrevis: ,(Integer. (re-find #"\d" (str (first (seq "12")))))

9:26 clojurebot: 1

9:26 daGrevis: ^ not cool

9:26 clgv: is there an easy way to generate interactive graphs? I need to be able to click on nodes to display additional information

9:27 daGrevis: ddellacosta, it's something like pypy?

9:28 ddellacosta: daGrevis: I don't know, is pypy written in python?

9:28 jcromartie: daGrevis: what would you expect?

9:28 daGrevis: ddellacosta, yep!

9:28 jcromartie: ,(first (seq "12"))

9:28 clojurebot: \1

9:28 daGrevis: jcromartie, easier way :P

9:29 jcromartie: um

9:29 daGrevis: well I need to get list of ints from string full of ints

9:29 s/ints/digits/

9:29 jcromartie: ok

9:29 daGrevis: "123" -> '(1 2 3)

9:29 ddellacosta: ,(map #(Integer. %) "123")

9:29 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer>

9:29 jcromartie: ,(map #(Integer. %) (re-seq #"\d" "123asf43r25"))

9:29 clojurebot: (1 2 3 4 3 ...)

9:29 ddellacosta: whoops

9:29 jcromartie: like that?

9:30 daGrevis: you can't iterate through string

9:30 ddellacosta: ^what he sez

9:30 jcromartie: you can with re-seq

9:30 daGrevis: til

9:30 jcromartie: ,(re-seq #"." "asdf")

9:30 clojurebot: ("a" "s" "d" "f")

9:30 daGrevis: neat one, thanks ;)

9:30 ddellacosta: daGrevis: yah you can

9:30 jcromartie: ,(re-seq #"\d+" "123 test 435 zxcv 45")

9:30 clojurebot: ("123" "435" "45")

9:30 ddellacosta: you don't even need that

9:31 jcromartie: ddellacosta: ?

9:31 unless you mean some java.lang.String methods

9:31 stuartsierra: ,(map #(Long. (str %)) "1234567890"

9:31 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

9:32 stuartsierra: ,(map irc://chat.freenode.net:6667/#(Long. (str %)) "1234567890")

9:32 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: irc:, compiling:(NO_SOURCE_PATH:0:0)>

9:32 stuartsierra: grrr

9:32 jcromartie: :) what

9:32 sure but I think daGrevis was wanting to avoid the conversion from char back to string

9:32 just deal with a seq of substrings

9:32 daGrevis: http://vpaste.net/0nnU5

9:32 stuartsierra: eh, whatever, reduce with subs

9:33 clgv: is there no clojure library for interactive graphs in a GUI?

9:33 jcromartie: clgv: you say that like you're surprised

9:34 daGrevis: imo you can use any java lib

9:34 ddellacosta: clgv: you mean, you just load up a graph (in what format?) and then view it graphically?

9:34 clgv: jcromartie: no not surprised just asking

9:34 zerokarmaleft: clgv: interactive in the d3-sense?

9:34 ddellacosta: oh, this is funny, just did it by accident

9:34 clgv: ddellacosta: I have an in-memory description of it as clojure data

9:34 ddellacosta: ,(map #(-> % int) "123")

9:34 clojurebot: (49 50 51)

9:34 ddellacosta: heh

9:35 clgv: zerokarmaleft: interactive in the sense of displaying additional information via event handlers, e.g. mouse click on nodes

9:35 ddellacosta: clgv: when you say graph, do you mean like on the euclidean plane graph, or like https://github.com/aysylu/loom ?

9:36 clgv: ddellacosta: graph as the abstract idea in computer science with nodes and edges

9:36 ddellacosta: clgv: gotcha

9:36 daGrevis: ddellacosta, didn't know about ->

9:36 ddellacosta: take a look at loom ^ + graphviz then, I guess...?

9:36 daGrevis: I love me some ->

9:36 clgv: I check whether loom fits

9:37 ddellacosta: clgv: yeah, haven't used it myself, but maybe if you can mangle your data a bit it'd work?

9:37 zerokarmaleft: graphviz doesn't enable interactivity, iirc?

9:37 clgv: no. it's just rendering.

9:38 ddellacosta: zerokarmaleft: I believe it generates static stuff

9:38 although they do say " or display in an interactive graph browser." on the web site http://graphviz.org

9:38 zerokarmaleft: clgv: c2 might be an option for you if you're willing to shuttle your data into cljs-land

9:39 ddellacosta: zerokarmaleft: eh, wouldn't you end up building your graphing lib yourself in c2? I though it was rather barebones last time I checked

9:40 clgv: I used rhizome for graph visualization in a different project but it uses graphviz as well and thus no interactivity...

9:40 ddellacosta: seems like you'd get more mileage out of massaging it into d3 in that case

9:40 ah

9:40 daGrevis: ,(map #(-> % int) "123")

9:40 clojurebot: (49 50 51)

9:40 daGrevis: wait wut

9:40 how, ddellacosta ?

9:41 ddellacosta: daGrevis: ascii values of chars

9:41 daGrevis: right

9:41 jcromartie: ,(map char (map int "123"))

9:41 clojurebot: (\1 \2 \3)

9:41 jcromartie: there and back again

9:42 ddellacosta: yep. I was trying to do something like what stuartsierra was doing above, but I kept getting java exceptions. String vs. Char or something.

9:45 stuartsierra: ,(map #(Long. (str %)) "1234567890")

9:45 clojurebot: (1 2 3 4 5 ...)

9:46 ddellacosta: stuartsierra: ah, there it is!

9:47 couldn't get the syntax right

9:50 jcromartie: stuartsierra: why prefer Long over Integer? aside from the constructor "Long." being shorter than "Integer."

9:51 hyPiRion: jcromartie: Preferably neither, use Long/parseLong. Integers in general is autoconverted to longs I think?

9:51 jcromartie: yeah

9:52 now really, we shouldn't be converting to string and parsing it :)

9:52 xificurC: anyone using seesaw.bind? I'd need some guidance

9:52 jcromartie: (map #(Character/getNumericValue %) "12345")

9:52 ,(map #(Character/getNumericValue %) "12345")

9:52 clojurebot: (1 2 3 4 5)

9:52 AeroNotix: how do I convert integers to signed bytes?

9:53 fredyr: ,(type 5)

9:53 clojurebot: java.lang.Long

9:53 stuartsierra: jcromartie: Clojure defaults to Long everywhere.

9:54 xificurC: I 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

9:54 jcromartie: stuartsierra: true

9:54 huh, looks like Character/getNumericValue is slower than (Long. (str 5))

9:54 I mean (Long. (str %))

9:55 llasram: AeroNotix: https://gist.github.com/llasram/8541480

9:55 devn: howdy

9:55 jcromartie: that's surprising

9:55 broquaint: xificurC: Like this? http://blog.darevay.com/2011/07/seesaw-widget-binding/

9:56 xificurC: broquaint: I read that a dozen times by now

9:56 llasram: jcromartie: There's two forms of the getNumericValue() method, which means Clojure needs to emit code performing reflection

9:57 xificurC: (b/bind (b/property (ss/select main-frame [:#other]) :selected?)

9:57 (b/property (ss/select main-frame [:#delim-text]) :enabled?))

9:57 this is my last (bad) attempt

9:57 llasram: jcromartie: Try #(Character/getNumericValue (char %))

9:59 AeroNotix: llasram: is there are library for this?

9:59 jcromartie: ah ha, llasram thanks

9:59 llasram: AeroNotix: Not that I know of off the top of my head

10:00 AeroNotix: llasram: damn, I don't want to c+p

10:00 devn: I 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:00 jcromartie: llasram: without the reflection penalty, Character/getNumericValue looks to be a little fast on average

10:01 llasram: jcromartie: Nice to align reality with expectations :-)

10:01 edbond: devn, sort-by ?

10:02 xificurC: https://www.refheap.com/26243

10:02 jcromartie: I forget about reflection...

10:03 devn: edbond: yeah, group-by + sort-by is what i've been using but what i've been coming up with feels long-winded

10:03 edbond: devn, sorry, I didn't read to the end

10:04 devn, probably reduce-kv fits better

10:04 devn: edbond: yeah, that's where i keep winding up as well

10:05 which is fine

10:05 perhaps 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:09 in 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:11 it feels sort of like the: arr = []; [1,2,3].each {|x| arr << x}

10:11 which grosses me out

10:13 because 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:14 idk im probably just obsessing. back to work.

10:14 shep-werk: devn: (group-by :id (sort-by :name names)) "works"

10:14 at least for that one example

10:15 it relies on group-by maintaining the order

10:15 which the doc says it does

10:17 ToBeReplaced: devn: what's the issue with: (->> names (sort-by :name) (group-by :id))?

10:17 sorry, what shep-werk said... was scrolled up

10:19 shep-werk: ToBeReplaced: ^5

10:20 devn: :)

10:20 yeah, like i said, i think im overthinking it

10:21 it 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:23 ToBeReplaced: devn: i'd be trying to work with data like {1 ["bob" "bruce" "wilma"] 2 ["gerry"]} instead if that's what you mean

10:40 mmitchell: Can someone recommend a client lib for Zookeeper?

10:41 nDuff: ...hmm; I don't remember any complaints from using zookeeper-clj, but haven't kept up since (and it's been a while).

10:41 mmitchell: nDuff: Is that this one? https://github.com/liebke/zookeeper-clj

10:42 nDuff: Yup.

10:44 devn: ToBeReplaced: yeah, that's exactly what i meant above

10:44 ToBeReplaced: hence the "time to reconsider some of my previous actions"

10:51 mduerksen: is 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:56 technomancy: probably because clojure.string is a thin wrapper around java methods rather than using classes written just for clojure

10:56 but nil is a mess; you can't really expect something called "the billion dollar mistake" to make sense

10:58 mduerksen: technomancy: whats wrong with nil?

10:59 arrdem: mduerksen: do you like the semantics of nillable objects?

11:00 CookedGryphon: it's hardly fair to compare null in that context with nil in clojure

11:01 mduerksen: i 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:01 technomancy: that's just because we don't have proper pattern matching built-in

11:02 mduerksen: imagine (get-in m long-list-of-keys) when you would have to check every level for nil

11:02 technomancy: just match against an option type; that kind of thing is easily composable

12:28 bbloom: kristof: but look at how core.typed works. it type checks with union types

12:29 tbaldridge: bhauman: I don't see anything wrong with it ATM. I'll bookmark this and take a look at it later today.

12:29 bbloom: kristof: go look at some of the signatures of clojure.core functions & you'll see lots of examples of where it makes sense

12:29 pyrtsa: static & dynamic typing is entirely orthogonal to sum vs union types

12:30 yedi: what are some of the cljs data visualization options

12:30 jcromartie: I like how Oracle has broken like 99% of incoming links to Java-related stuff since they took over.

12:30 bhauman: tbaldridge: Thanks!

12:30 jcromartie: now I can be redirected to lots of useful whitepapers instead of that silly API I was looking for

12:31 pyrtsa: bbloom: Oh, right. Btw, would your definition of union types align with the notion of row polymorphism?

12:31 E.g. http://brianmckenna.org/blog/row_polymorphism_isnt_subtyping

12:33 bbloom: pyrtsa: i think they are unrelated. or at least it's not obvious to me how they are related

12:35 pyrtsa: Ok, nevermind.

12:37 sm0ke: does clojure aims backward compatibility?

12:38 or forward?

12:38 or wtfever

12:38 seangrove: Aims for World Trade Fever, I believe

12:39 pyrtsa: bbloom: 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:39 bitemyapp: sm0ke: aims for parenthetic post-scarcity.

12:39 nDuff: sm0ke: 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:44 dnolen: nDuff: that's not really true either, there's lots of undefined behavior that will likely never change now

12:44 sm0ke: son of a bitch

12:44 devn: +1

12:44 sm0ke: found it

12:45 core.async is backward incompatible

12:45 nDuff: dnolen: true enough.

12:45 devn: speaking of undefined behavior

12:45 dnolen: sm0ke: alpha software

12:45 locks: dnolen: 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:45 devn: is that patch to "fix" the pattern for valid symbols and keyboards actually going through?

12:45 I like my "invalid" symbols and keywords

12:46 dnolen: locks: don't really have much control over formatting on Github

12:46 devn: also, """heredoc""" -- I really wish we could get that added. Is it really so awful for the reader?

12:47 technomancy: devn: triple quote is lame; we should have «heredocs» instead =D

12:47 devn: not trying to start another thread about it, but i really do wish we had a heredoc

12:47 technomancy: honestly, i would be totally fine with that

12:47 just /something/

12:47 technomancy: it's paredit-friendly!

12:47 devn: i almost adopted chiara simply to use """"""

12:48 sm0ke: there was a new rainbow paranthesis plugin for vim

12:48 couldnt find it now

12:48 devn: clownbarf.el

12:48 `cbp: why triple quotes?

12:49 devn: doesn't have to be triple quote

12:49 but most of the chars are already taken

12:49 * deadghost googled clownbarf.el to see if it's really a thing

12:49 devn: haha

12:49 bitemyapp: oh no, Basho West Elevator follows me.

12:49 This is not a good sign.

12:49 `cbp: hi!

12:49 `cbp: bitemyapp: hello

12:50 devn: technomancy: do you remember where the most recent heredoc discussion ended?

12:50 i know it's come up like a dozen times

12:50 bitemyapp: `cbp: surely you knew how I was going to feel about a dynamic scope + auto-arg-injection macro.

12:50 `cbp: heh

12:50 soz :P

12:50 bitemyapp: devn: given how many dreams have been dashed upon the rocks of Mount JIRA, I wouldn't get my hopes up.

12:50 technomancy: devn: I'm too old to watch the repeated cycle of people proposing changes and getting shot down

12:51 bitemyapp: `cbp: nah nah, it's cool, I'll respond to the ticket. Makes for good doucmentation.

12:51 technomancy: it's all re-runs these days anyway

12:51 devn: technomancy: we can do it!

12:51 cc bitemyapp

12:51 bitemyapp: devn: I'm gone baby.

12:52 devn: If 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:52 someone has already implmeneted """heredoc"""

12:52 technomancy: we can't though

12:52 bitemyapp: devn: I've drunk the kool-aid and play with kittens and lenses now.

12:53 technomancy: don't have commit rights or the ability to perform remote hypnotism

12:54 bitemyapp: I would really like heredocs :(

12:54 `cbp: need a cognitect mob plant

12:54 gtrak: just find a way to make datomic need it

12:55 bitemyapp: `cbp: 4rlz.

12:55 sm0ke: whats the antonym for bumping a version?

12:55 bitemyapp: gtrak: that was actually the only reason I think I got Hickey to fix up the edn spec.

12:55 kristof: bitemyapp: You kept talking about extensible effects but it didn't occur to me that this would be Oleg-ware

12:55 technomancy: gtrak: because, you know, heredocs are way less useful than UUID reader literals

12:55 ToxicFrog: sm0ke: downgrade? Rollback?

12:55 llasram: sm0ke: Downgrade?

12:55 technomancy: M-x eyeroll

12:55 kristof: bitemyapp: Stumbled upon his paper on it while I was perusing other documents, so I'm in the process of reading it.

12:56 sm0ke: i would call it bounce

12:56 arrdem: devn: change links? or just rantings on jira..

12:56 bitemyapp: kristof: http://okmij.org/ftp/Haskell/extensible/

12:56 kristof: Yup, saw it

12:56 llasram: technomancy: *shrug*. I don't use UUIDs, but I have been making pretty extensive use of the tagged literal syntax

12:57 It's pretty nice to be able to define a way to print arbitrary things so that you can read them back

12:57 technomancy: llasram: I guess it's a neat idea in general, but both of the built-in examples of tagged literals are just bonkers

12:57 either bafflingly useless or actively harmful

12:57 llasram: eh; I got along fine with print-method

12:58 llasram: True. 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:59 Well, 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:59 kristof: bitemyapp: 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:59 bitemyapp: kristof: I was surprised you were focusing on Eff.

12:59 kristof: bitemyapp: Hmm?

12:59 devn: what if #^ came back?

12:59 sm0ke: llasram: i have a question regarding parkour

12:59 technomancy: llasram: right; I was just using read-eval; obviously that's not ok for client interactions

12:59 bitemyapp: kristof: well not only that, but by avoiding CPS-esque style, it can possibly be optimized without manual codensity.

13:00 devn: talking about heredocs again.

13:00 Raynes: """"""

13:00 kristof: bitemyapp: what the hell is manual codensity

13:00 llasram: sm0ke: You are in luck! I am at present the definitive source of answers regarding Parkour :-)

13:00 deadghost: sm0ke, you "bump up" so I guess it'd be "bump down"

13:01 sm0ke: llasram: 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:01 bitemyapp: kristof: http://blog.ezyang.com/2012/01/problem-set-the-codensity-transformation/

13:01 sm0ke: deadghost: no there is no such thing as bump down

13:01 bitemyapp: kristof: meaning having to manually introduce it to optimize the code.

13:01 kristof: no CPS/monads, no need.

13:01 sm0ke: bump indicated upward motion

13:02 technomancy: sm0ke: bump/drop

13:02 bitemyapp: sm0ke: (anamorphic / catamorphic) version transformation

13:02 deadghost: hmm

13:02 pothole then?

13:02 sm0ke: bounce

13:03 llasram: sm0ke: Not yet / yes-if-you-squint.

13:03 deadghost: well depends on if you're using bump to describe something protruding up

13:03 or the action of jolting

13:03 since a pothole would cause a car to bump

13:04 llasram: sm0ke: 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:04 sm0ke: There is active discussion on the Parkour mailing list right now to make it pretty :-)

13:04 sm0ke: llasram: can you dynamically add jars to cluster classpath ?

13:04 llasram: without taking it down

13:05 oh you said to the job

13:05 kristof: bitemyapp: 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:05 sm0ke: so you are saying i would still sumit a job

13:05 llasram: sm0ke: Depending on what you mean, yes. Regular MapReduce jobs launch a fresh JVM for each task, and can have any classpath you want

13:05 sm0ke: llasram: also whats the rationale behind parkour?

13:06 llasram: didnt cascaog fit your needs?

13:06 llasram: sm0ke: https://github.com/damballa/parkour/blob/master/doc/motivation.md :-)

13:06 sm0ke: llasram: ah ok thanks

13:06 will read that

13:07 RickInAtlanta: llasram = marshall?

13:07 sm0ke: later

13:07 llasram: Yep! Hey, Rick :-)

13:07 technomancy: ,(apply str (reverse "llasram"))

13:07 clojurebot: "marsall"

13:07 technomancy: ...

13:07 RickInAtlanta: Howdy

13:07 llasram: technomancy: The `h` is absent for historical reasons

13:07 technomancy: istorical reasons you mean?

13:08 llasram: hah! nice

13:11 fredyr: lol

13:13 dnolen: haha nice, http://twitter.com/jacob_ninja/status/425691247601123328

13:14 bitemyapp: kristof: it's a fine approximation.

13:15 bbloom: dnolen: persistent data structures are like alien technology from the future

13:15 :-)

13:17 devn: updated the alternate string quote syntaxes: http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes

13:17 """foo""" seems like a logical choice over <<HERE HERE, string interp, etc.

13:17 it also fits nicely as a docstring

13:18 technomancy: oh gosh please no ruby-style heredocs

13:18 so hideous

13:18 llasram: Anyone who currently has """""" in their code deserves everything they have coming

13:18 locks: technomancy: *ahem* perl-style heredocs

13:19 rasmusto: technomancy: heretics + docs = heredocs?

13:19 bbloom: llasram: i start all my programs with """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" just to be sure

13:19 gtrak: (take 3 (empty-string-seq))

13:22 `cbp: bbloom: has an EOF exception coming

13:22 bbloom: ,"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

13:23 clojurebot: ""

13:23 bbloom: ,(list """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""")

13:23 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

13:23 bbloom: damn.

13:23 i just held the keys down

13:23 i figured 50/50 shot of getting an even number

13:23 ,(list """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""")

13:23 clojurebot: ("" "" "" "" "" ...)

13:23 bbloom: `cbp: ther eyou go

13:26 egghead: does anyone have an example of using prismatic's schema library with cljs?

13:26 all I'm getting is a bunch of errors no matter what I try

13:28 deadghost: hmm I'm not using enlive snippets with templates properly

13:28 and/or screwing up laziness

13:28 https://www.refheap.com/26269

13:33 arrdem: tripple quoted strings could be ok.... far less breaking than heredocs.

13:33 the HEREDOCS ... HEREDOCS is just outright madness.

13:34 `cbp: i vote for org-mode syntax

13:35 arrdem: wrt resource files: can't you already do ##(def my-commented-var (slurp "/resources/docs/user/my-commented-var.org") 3)

13:35 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

13:35 arrdem: `cbp: 2nded

13:35 technomancy: haha, org-mode syntax

13:37 llasram: `cbp: Wouldn't that get hairy then embedding Clojure in org-mode with org-babel ?

13:38 arrdem: llasram: no, because you can use tangle to make your text comments!

13:38 llasram: hah

13:39 arrdem: llasram: also mark((down)|(up)) in a #+BEGIN_SRC #+END_SRC won't parse so you shouldn't be able to confuse yourself...

13:44 cark: hah this org-babel thing looks funny

13:44 RickInAtlanta: llasram: just read your motivation for Parkour. I am looking forward to your presentation.

13:44 cark: too bad it requires slime and swank =/

13:45 arrdem: cark: .... you're reading old docs then.

13:45 cark: arrdem: ah could be

13:45 arrdem: cark: org-babel is entirely language tooling agnostic, I've seen stuff about using it with nrepl before.

13:46 gtrak: llasram: we fuss with cascading... and serialization... a lot. Our code is littered with deftypes to deal with this.

13:53 llasram: RickInAtlanta: Should be fun! And keeping my fingers crossed for Clojure/West

13:54 gtrak: if there's one thing I could shoo away in hadoop, it'd be classloading.

13:55 but that's basically like... java.

13:55 llasram: gtrak: 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:56 gtrak: 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:56 gtrak: that might have been me :-)

13:56 it's insufferable, but the structure of our project makes it worse, since we use a post-delegation classloader that embeds hive.

13:57 llasram: Interesting. Are you seeking to untangle this?

13:57 gtrak: now I'm investigating building classpaths by launching ourselves with the 'hadoop' script, which will at least automate some bash away.

13:57 llasram: yea... it's just an issue of manpower and priorities.

13:58 but we end up spending a lot of time on workarounds for classloading issues.

13:59 jcromartie: what's the way to create the inverse of a Java comparator?

13:59 gtrak: jcromartie: (comp - ..) ?

13:59 llasram: gtrak: 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:59 jcromartie: gtrak: comparators should return −1, 0 or 1 though

13:59 but that seems to work :)

13:59 gtrak: jcromartie: maybe I misunderstand the question

14:00 that will invert an existing comparator by 'inverting' the results

14:00 jcromartie: yeah, seems to work close enough

14:01 gtrak: llasram: 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:01 we shouldn't have hadoop deps in a parent classloader.

14:02 llasram: gtrak: slf4j configuration, or duplicates?

14:02 gtrak: duplicates

14:02 llasram: Ok. Yeah, I'm building everything with leiningen, so just make judicious use of global exclusions and the `:provided` profile

14:03 I'm not quite sure what you mean by "hadoop deps in a parent classloader" though

14:03 My classloading knowledge is somewhat fuzzy

14:03 gtrak: yea, we could create classpaths with maven artifacts only, but that shifts burden to testing and integration.

14:03 since we target multiple distros, that's hard.

14:04 llasram: Ah, I see. Hmm

14:04 shep-werk: jcromartie: comparator just says negative, 0, or positive, not -1, 0, 1

14:04 llasram: Build all uberjars, with a different build for each target!

14:04 gtrak: llasram: 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:04 jcromartie: shep-werk: close enough, but "complement" doesn't reverse that :P

14:04 anyway, using sort-by, and (complement :foo) works

14:05 gtrak: llasram: that's also on the table, but we need real devops :-), my boss says 'that sounds hard'

14:05 jcromartie: to actually reverse a Comparator, you can use (Collections/reverseOrder c)

14:05 gtrak: jcromartie: we have a 'compare' function that delegates to a comparator.

14:06 llasram: gtrak: Yeah.... That seems a hairier arrangement than I care to contemplate when not facing it myself :-)

14:06 gtrak: What do you mean by "need real devops"?

14:06 gtrak: llasram: automated integration testing and deployment, some VMs and scripts and such.

14:06 we have continuous builds, but that's about it at the moment.

14:07 jcromartie: and the main reason I'd prefer to use that is it works with sort-by

14:07 jcromartie: yup

14:07 gtrak: also sort..

14:07 jcromartie: I'm just playing with more complex sorting of maps, akin to SQL's sorting

14:08 (sort-by (juxt (complement :admin?) :username) users)

14:08 gtrak: jcromartie: ah neat

14:08 llasram: gtrak: Ah, I see. No one is yet using a deployment configuration management tool?

14:08 gtrak: nah

14:09 I've played around with vagrant..

14:09 llasram: Introduce puppet/chef/ansible/whatever -- your ops team will love you :-)

14:09 gtrak: that's just it, no ops team to love me :-)

14:09 llasram: Well, or fight you to the death

14:09 Even better! Oh god, you'll save yourself so much time, and no one to fight to the death

14:09 gtrak: if I just did it, no one would oppose..

14:10 llasram: I think you have an incredibly clear call to action

14:10 lvh: PSA: don't use salt. Homegrown crypto is bad.

14:10 gtrak: that's what I was afraid of.

14:10 lvh: Especially for something that has root on all your boxen.

14:10 Cr8: <3

14:10 llasram: In a few months you'll wonder how you lived with yourself prior

14:12 gtrak: just saying 'hadoop sucks' to myself is deeply satisfying, but maybe a devops deployment would be more satisfying.

14:12 shep-werk: jcromartie: sorry, I thought I read the suggestion as (comp - existing-comparator); ie to negate it

14:12 gtrak: shep-werk: that's how I read it.

14:12 jcromartie: oh!

14:13 shep-werk: not complement

14:13 jcromartie: that makes perfect sense

14:13 llasram: gtrak: Little in life is more satisfying than triggering a cluster-wide deployment just by committing test-passing code

14:13 jcromartie: I missed the "-"

14:13 llasram: Well, maybe the smile upon your own child's face, but I the cluster thing is a close second

14:14 jcromartie: my kid smiles when she does something evil

14:14 gtrak: that sounds even more satisfying

14:15 I just want to be in on it

14:17 llasram: 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:17 the error is reported as bad 'mapreduce.framework.name' config.

14:20 it looks like it can't find the mapred-site.xml file.. but that's not really the case.

14:35 dobry-den: Is the general purpose of the -Xms JVM opt to claim the memory ahead of time?

14:38 jcromartie: dobry-den: yes, it avoids resizing the heap

14:39 llasram: gtrak: (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:40 I'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:42 gtrak: llasram: 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:44 maybe there's a way to set that

14:45 llasram: gtrak: You can set the class loader an individual Configuration uses to load resources, but I'm not sure how helpful that is

14:55 OscarZ: whats 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:55 gtrak: ~protocols

14:55 clojurebot: http://clojure-log.n01se.net/date/2009-10-13.html#12:02

14:55 OscarZ: should I just create two namespaces with the same functions ?

14:57 cark: in one namespace : (defprotocol DAO (load [self]))

14:58 in other namespaces where you define the actual objects : (defrecord Mysql [field1 field2] DAO (load [self] some code))

14:58 you may use reify, or deftype in place of defrecord

14:59 you may also extend your protocol to about anything

14:59 OscarZ: ok.. ill have to read up on them thanks..

14:59 i 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:00 protocols are still the way to go?

15:00 cark: yes, though defining a protocol also define an interface

15:00 OscarZ: ok.. thats fine :)

15:00 gtrak: OscarZ: multimethods are more flexible, but slower.

15:01 sometimes I feel like I want to make my dispatch function a multimethod.

15:01 cark: protocol are good for single dispatch, multimethods are good to dispatch on any variety of way

15:02 bbloom: gtrak: a multimultimethod!

15:02 gtrak: I don't know if that's a smell, so i avoid it.

15:02 cark: i think you may do that, don't you ?

15:02 deadghost: http://stackoverflow.com/questions/21266570/enlive-snippet-in-template-produces-lazy-sequence

15:02 anyone want to take a shot at that

15:02 been trying to figure it out for at least 2 hours now

15:02 bbloom: gtrak: 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:02 mmitchell: Is there a webpage that lists sites/apps using Clojure?

15:03 jcromartie: deadghost: your defsnippet is totally wrong...

15:03 stuartsierra: mmitchell: http://dev.clojure.org/display/community/clojure+success+stories

15:03 gtrak: bbloom: seems like you'd want open dispatch, no? I feel encoding things as equality or the hierarchy thing is kinda limiting.

15:03 mmitchell: stuartsierra: Nice thanks!

15:03 bbloom: gtrak: it's intentionally limiting to resolve ambiguous dispatch

15:04 technomancy: mmitchell: "last edited december 14, 2012" so take it with a grain of salt

15:04 gtrak: bbloom: like... I'm not sure how I'd do a defmethod, if I were using constants all defined in the dispatch function.

15:04 bbloom: gtrak: that is without having the runtime system prove logical implications of predicates :-)

15:04 mmitchell: technomancy: Ahh ok

15:04 jcromartie: deadghost: or I could be totally wrong :P

15:04 technomancy: mmitchell: for some reason that wiki page is locked

15:04 bbloom: gtrak: most of the time, my dispatch function is a keyword

15:04 deadghost: jcromartie, I got excited for a moment

15:04 stuartsierra: technomancy, mmitchell: we had some trouble with spam a while back, might be why

15:05 jcromartie: deadghost: try just using content instead of html-content?

15:05 gtrak: bbloom: yea, if the data's not hardcoded, I guess that solves my problem.

15:05 the keywords that are returned from the dispatch

15:05 deadghost: GREAT JCROMARTIE IS GOING TO SOLVE EVERYTHING BECAUSE HE TELLS ME I HAVE AN OBVIOUS ERROR

15:05 then disappointment

15:05 technomancy: at least four companies on that page don't exist anymore under those names =)

15:06 correction: at least six

15:06 jcromartie: deadghost: I didn't realize you could use the hiccup style HTML generation instead of a filename in defsnippet

15:06 stuartsierra: technomancy: which ones?

15:07 technomancy: stuartsierra: backtype, geni, relevance, revelytix, runa, and weatherbill

15:07 stuartsierra: technomancy: thanks, noted

15:08 deadghost: jcromartie, picked it up from http://stackoverflow.com/questions/20811216/enlive-templating-adding-css-includes-to-head

15:08 gtrak: technomancy: revelytix exists, unless you know something I don't know :-)

15:08 deadghost: apparently hiccup style or java reader string thing is a ok

15:09 technomancy: gtrak: hm; everyone I know who was doing clojure there got let go; I assumed it was because they went under

15:09 gtrak: I'm still there and doing clojure, there's a few folks.

15:09 technomancy: oh, gotcha

15:09 jcromartie: deadghost: but since your snippet produces a seq of nodes, just use "content", not "html-content"

15:10 gtrak: technomancy: that wiki page is really out of date though, we don't mention 'semantic web' at all anymore.

15:10 a hadoop shop now.

15:10 deadghost: oh geez I didn't even know there was a content AND html-content

15:12 domino14: how do i take the nth element of a sequence, and also build a sequence of everythign minus that element?

15:12 i know nth for sequence

15:13 jcromartie: you want "take" and "drop"

15:13 deadghost: yep jcromartie that did the tri

15:13 ck

15:14 jcromartie, want to type a response up saying use content instead of html-content and get some internet pts

15:14 otherwise I'm answering myself

15:14 jcromartie: sure

15:16 yay internet points!

15:16 domino14: something like this

15:17 domino14: (defn pick [coll n] [(nth coll n) (concat (take n coll) (drop (inc n) coll))])

15:17 likely to be very bad for performance though

15:17 domino14: ,(let [s [0 1 2 3 4 5 6 7 8 9]] (concat (take 3 s) (drop 4 s)))

15:17 clojurebot: (0 1 2 4 5 ...)

15:17 domino14: what's a more performant way of doing it/

15:18 stuartsierra: I've updated Relevance/cognitect at least, and we have a TODO to update that wiki page.

15:18 AeroNotix: domino14: are you experiencing some slow code and have profiled it to your use of this specific code?

15:18 domino14: if not; stop caring.

15:18 jcromartie: thanks AeroNotix :)

15:19 AeroNotix: jcromartie: pre-emptive optimization is horrible

15:19 jcromartie: I 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:19 anyway, yeah, don't worry about it

15:20 AeroNotix: and if you do end up worrying about it, wrap a transient in a function

15:23 Notte: Is an idiom in clojure returning a tuple (value error) ?

15:23 gtrak: Notte: usually a vector, lines up visually with the destructuring syntax.

15:23 ToBeReplaced: domino14: 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:24 Notte: gtrak: yeah, right. Thanks

15:25 gtrak: do you think it'd be better using an atom/symbol or a string for the error part?

15:27 gtrak: Notte: atom means something else here, error depends on the requirements of your app, there's lots of answers.

15:28 usually I'll just return nil unless I really need a message, in that case I'll throw an exception.

15:29 so I do a lot of (if-let [val (some-function of its arguments)] (logic) (error-logic))

15:29 (logic val), rather.

15:36 deg: With 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:37 I had understood that only production build (with :jar true) would be included.

15:38 dobry-den: What could cause a user to never see :flash data in a Ring app with wrap-flash?

15:42 llasram: If they have a flash blocker installed

15:42 ~rimshot

15:42 clojurebot: Badum, *tish*

15:42 * dobry-den dies

15:42 arrdem: people still have flash installed?

15:43 * arrdem busts out gdb and goes 0day hunting

15:53 technomancy: stuartsierra: cool, thanks

16:00 * devn eats a cheeto

16:02 BobSchack: devn ping

16:02 devn: domino14: ,(let [s (range 10)] (remove #(= 3 %) s))

16:04 domino14: also, this is definitely more performant user> '(0 1 2 4 5 ...) ;)

16:20 r4vi: anyone 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:21 data.xml/emit complains that there is no EventGeneration protocol for PersistentStructMap

16:24 arrdem: so I'm reading the core... what's the backstory with the commented out public Object reduce(Fn) blocks?

16:26 tbaldridge: arrdem: link?

16:26 bbloom: arrdem: w/o looking, my guess would be that the impl started at the java level and was later re-done with protocols

16:27 arrdem: tbaldridge: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ASeq.java#L91

16:27 bbloom: yeah I'm expecting to see a lot of that...

16:28 I'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:32 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L116 whitespace patch? :P

16:33 bbloom: arrdem: rich told me that intellij fucked up the whitespace silently on him and he didn't notice until it was too late :-P

16:34 arrdem: bbloom: lolz

16:34 * arrdem won't bother with a PR

16:34 bbloom: arrdem: wouldn't get accepted anyway :-P

16:34 arrdem: bbloom: that's why :/

16:40 TimMc: Didn't notice until it was too late... I hope that means "I was too lazy to fix it", not "`git commit -a` erryday"

16:41 * arrdem rm's ~/.zsh_history to hide his sins

16:41 brehaut: justin_smith: whats your companies agency web thing urlled>?

16:42 justin_smith: ermdaherm?

16:43 brehaut: what is the url for the project :P

16:43 justin_smith: http://let-caribou.in/ this what you want?

16:43 brehaut: that it is

16:43 thanks

16:43 justin_smith: and I look at that and realize there are more examples we could have on there

16:43 thisplace, teague, maybe others

16:44 also we hang out on #caribou if you want to ask us a bunch of caribou specific stuff

16:49 r4vi: anyone know how to turn a zipper back into xml?

16:50 bbloom: r4vi: clojure.zip/root

16:52 Raynes: bbloom: That doesn't return XML though, right?

16:52 bbloom: That'll return the original tree structure.

16:52 r4vi: bbloom: yeah that works if I roundtrip without editing

16:52 Cr8: then you need to clojure.xml/emit it, yeah

16:52 Raynes: ^

16:52 bbloom: Raynes: i assumed he meant the tree structure under the zipper

16:52 Raynes: r4vi: ^ follow the arrows

16:52 r4vi: I can do (xml/emit (zip/root zipped))

16:53 but not zip/edit, zip/root, xml/emit

16:53 Raynes: After your edits, as long as you've still got a zipper, zip/root should work.

16:54 r4vi: yep zip/root works but trying to emit the resulting thing from zip/root gives NPE

16:54 Notte: Do i have to specify clojure.java.io as dependency inside the project.clj file to use it within the lein repl?

16:54 I can't require it in any way

16:54 r4vi: when it gets to my first edit

16:55 Notte: (require [clojure.java.io :as io]) doesn't work

16:55 technomancy: Notte: it's been part of clojure since 1.1 or 1.2

16:55 you need to quote the symbols

16:56 Notte: Could you make an example please?

16:56 Because i tried..

16:56 technomancy: (require '[clojure.java.io :as io])

16:58 rurumate_: 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:00 Notte: technomancy, rurumate_ after both commands io gives this error CompilerException java.lang.RuntimeException: Unable to resolve symbol: io in this context

17:01 technomancy: Notte: yeah, that's expected; namespaces aren't really first-class like that

17:01 clojurebot: the ns macro?

17:01 clojurebot: the 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:10 Notte: It finally worked. That article's helped me, thank you technomancy.

17:10 technomancy: np,

17:10 it definitely is a bit weird at first

17:11 arrdem: more whitespace weirdness in compile.java...

17:13 Bronsa: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7793 this is my favourite line in Compiler.java

17:14 bbloom: Bronsa: lol i love how it's interned

17:14 Bronsa: "this stupid string is VERY IMPORTANT

17:14 "

17:15 Bronsa: bbloom: the funny thing is that it's dead code

17:16 arrdem: where is this?

17:16 bbloom: Bronsa: 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:16 or rather proverb_fdkkfdksfjs

17:16 Bronsa: ahah, right

17:17 * nDuff is reminded of Vinge's software archeology

17:25 zerowidth: nDuff: i love that metaphor

17:25 nDuff: so so much. imagine in even 20 years

17:28 rovar: zerowidth: I am a big Vinge fan. I got to eat lunch with him at a conference in SD a while. Super nice guy.

17:38 technomancy: jealous

17:38 rovar: do atoms have any odd behaviors with regards to namespaces?

17:39 e.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 `cbp: rovar: no

17:40 rovar: hmm.. I've been getting some odd behiavior since I refactored a datomic connection out into another ns..

17:40 I 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:57 ah.. actually the problem is that datomic.api/connect silently fails sometimes..

17:57 super

18:01 baldandgoateed: rovar, do you hate me

18:02 because everyone hates me.

18:02 rovar: baldandgoateed: no, but maybe because I haven't gotten to know you.

18:05 domino14: i'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:06 baldandgoateed: rovar, I think it is, everyone hates me.

18:06 domino14: i just cant figure out how to do that in clojure

18:06 baldandgoateed: domino14, I don't understand what you mean.

18:07 rovar: domino14: what exactly are you trying to achieve?

18:09 oskarkv: yeah, what is for loops?

18:09 TEttinger: for is a comprehension in clojure, which is a different usage

18:09 technomancy: clojurebot: for?

18:09 clojurebot: for is not used often enough.

18:10 jack_rabbit: heh

18:10 technomancy: that's not what I was looking for

18:11 baldandgoateed: rovar, do you already hate me.

18:11 Because everyone does

18:11 this includes AimHere.

18:12 jack_rabbit: domino14, it would help if you provided a testcase.

18:12 oskarkv: domino14 don't keep us in suspense. What are you trying to do?

18:13 domino14: ok

18:13 Notte: Is clojurebot a repl?

18:13 domino14: https://dpaste.de/KsxS i'm basically trying to generate that pseudocode in clojure

18:13 Notte: clojurebot speak up!

18:13 TEttinger: Notte, it can eval, but is only kinda a repl

18:14 some things are forbidden, like slurping from URLs

18:14 domino14: i'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:14 Notte: TEttinger: how does it work? Is there an help?

18:14 clojurebot help

18:14 domino14: i understand what 'for' does in clojure, and it's not exactly what i want (since the outer 'for' loop doesn't 'return' anything)

18:15 jack_rabbit: domino14, why not do it with a recursive call and a for loop, just like your python there?

18:15 Raynes: Notte: 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:16 mmitchell: Hmm, 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:16 TEttinger: ,(str "Notte you can call code with a comma-starting line: " (+ 1 2 3))

18:16 clojurebot: "Notte you can call code with a comma-starting line: 6"

18:16 Raynes: lazybot also looks for code you've embedded in messages with ##(+ 2 2)

18:16 lazybot: ⇒ 4

18:16 mmitchell: It might have been in the Google Groups, but I can't find it

18:16 technomancy: mmitchell: this one? http://www.colinsteele.org/post/23103789647/against-the-grain-aws-clojure-startup

18:17 domino14: ok, so the inner for loop looks like: (for [e z] (concat [el] [e])) -- this will eventually return ( (..) (..) (..) )

18:17 mmitchell: technomancy: No, but that one is good too -- I worked there :)

18:17 domino14: then 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:17 Notte: Great, thank you, Raynes, TEttinger

18:18 domino14: it'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:18 TEttinger: no prob Notte. you can also /msg clojurebot ,(+ 1 2)

18:18 or lazybot, actually

18:18 mmitchell: technomancy: 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:18 domino14: basically i ahve something htat looks like this: https://dpaste.de/ET11

18:18 Notte: Goodnight

18:19 domino14: and it's not really working, it's giving me (((0 1)) ((1 0))) instead of ((0 1) (1 0))

18:19 see how there's extra (( ))) ?

18:19 TEttinger: domino14, agh. there's an issue there with loop/recur being strongly preferred for recursive calls

18:19 domino14: i realize loop / recur are preferred for recursive calls, but i can't even begin to figure out how to use it here

18:20 jack_rabbit: until we get some TCO in clojure. :)

18:20 domino14: to turn that pseudocode into tail-recursive like that, it's just breaking my brain

18:20 so 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:22 technomancy: mapcat maybe

18:23 aka: is 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:24 technomancy: aka: compojure is the most widely used and afaik is close-ish to flask

18:24 aka: technomancy: thx I'll take a look at it

18:27 jack_rabbit: Yeah, compojure is really cool.

18:27 mpenet: hmm odd, unbound dynamic vars are true'ish ?

18:27 ,(def ^:dynamic foo) (when foo (println :dwa))

18:27 clojurebot: #'sandbox/foo

18:28 mpenet: bah, it prints here :/

18:28 ,(do (def ^:dynamic foo) (when foo (println :dwa)))

18:28 clojurebot: :dwa\n

18:28 hiredman: yeah, there is a special unbound var value, and it is not falsy

18:28 mpenet: bug?

18:28 hiredman: nope

18:29 mpenet: ah, surprising though

18:29 technomancy: does it depend on ^:dynamic?

18:29 hiredman: it isn't just dynamic vars either

18:29 tpope: it does not, just tried

18:29 baldandgoateed: hiredman, 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:29 1 in 10 000 people apparently is flipped like that

18:29 tpope: what does that even mean

18:30 rasmusto: ,(reverse "baldandgoateed")

18:30 clojurebot: (\d \e \e \t \a ...)

18:30 hiredman: I did know that, infact

18:30 tpope: oh you mean like their organs?

18:30 was expecting philosophical drivel

18:31 nDuff: baldandgoateed: weren't you just talking about this in #xml?

18:31 rasmusto: looking in a mirror is weird too, or listening to your own voice, but that's a perception thing

18:31 baldandgoateed: nDuff, yeah

18:31 nDuff: baldandgoateed: there *are* -offtopic or -social channels on the network, fwiw.

18:31 baldandgoateed: I am talkinga bout this everywhere.

18:31 hiredman: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L31-L45

18:31 baldandgoateed: THere is an offtopic clojure channel?

18:31 nDuff, where?

18:31 aka: I didn't know of situs inversus... gotta love #clojure

18:32 nDuff: baldandgoateed: 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:32 hiredman: I forget what that was added for, but it wasn't always the case, rich mentioned the change on irc some years ago

18:32 technomancy: there used to be an offtopic clojure channel

18:32 maybe #clojure-lounge or something

18:33 baldandgoateed: nDuff, I'm banned there

18:33 oskarkv: domino14 https://www.refheap.com/26323

18:33 rasmusto: I'm always blown away by the number of commented-out lines in the clojure source, most of them existed in some release, right?

18:33 mpenet: hiredman: thanks

18:33 hiredman: rasmusto: no

18:34 oskarkv: domino14 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:34 tpope: rasmusto: hallmark of using a shitty scm you don't trust. and clojure started in svn

18:34 rasmusto: hiredman: unimplemented features?... oh

18:35 hiredman: rasmusto: my guess is rich just likes to fiddle and try stuff out

18:35 rasmusto: I assume it must be a combo of both

18:35 kristof: language lounges always suck

18:36 hiredman: sure

18:36 domino14: thanks i'll study this code

18:36 rasmusto: btw, that intern var_blah_foiwjefwoe thing from earlier totally cracked me up

18:37 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7793 that one :)

18:39 oskarkv: domino14 feel free to ask questions :p

18:40 arrdem: rasmusto: AAAH NO SPOILERS I'm still reading that file :P

18:41 technomancy: is #clojure-lounge registered?

18:42 technomancy: arrdem: no idea; I have only vague memories from years ago

18:43 arrdem: technomancy: it isn't registered to anyone...

18:47 rasmusto: arrdem: working your way through all of the source?

18:47 TEttinger: domino14: ##(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:47 lazybot: java.lang.RuntimeException: Unable to resolve symbol: perms in this context

18:47 TEttinger: ha

18:47 arrdem: rasmusto: that was the idea..

18:48 TEttinger: ##(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:48 lazybot: ⇒ ([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:49 TEttinger: it's a port of http://ktuman.blogspot.com/2010_05_01_archive.html

18:49 AeroNotix: are there any libraries for treating byte-arrays like strings? (SOMELIB/split)

18:49 etc

18:50 technomancy: AeroNotix: typically you'd operate on a seq of an array for things like that

18:50 as long as laziness isn't a problem

18:51 AeroNotix: technomancy: hmm, ok. Cheers!

18:55 mrhanky: (defn foo ([x y z] ...) ([a] ...)

18:56 )

18:56 is it possible to write something like this? (foo (if cond? a x y z))

18:57 TEttinger: mrhanky, condp = a

18:58 though I'm not quite sure what you mean

18:59 mrhanky: i have function which accepts [a] or [x y z]

18:59 TEttinger: you can use apply and a sequence

19:00 hyPiRion: mrhanky: (apply foo (if (pred? ...) [a] [x y z]))

19:00 TEttinger: (inc hyPiRion)

19:00 lazybot: ⇒ 29

19:01 hyPiRion: eventually just (if (pred? ...) (foo a) (foo x y z)), which is not that bad in this case, really.

19:01 mrhanky: i was just wondering if there is something to just have one call to foo

19:02 domino14: sheesh

19:02 what does ## do

19:02 oskarkv: it's for the bot, it's not clojure

19:02 `cbp: it calls lazybot

19:13 aphyr: amalloy_: Raynes: would it be possible to enable ,(source foo) for lazybot in #riemann?

19:15 Raynes: aphyr: 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:15 aphyr: kk. (doc) works, so I was kinda surprised

19:15 but source-fn appears to be dark magic

19:15 Raynes: aphyr: That's because I rewrite doc specifically for lazybot.

19:15 aphyr: oh nice, haha

19:15 Raynes: :p

19:15 rewrote*

19:16 aphyr: So, there is a $source command but I think it links to out of date docs.

19:16 aphyr: hmm. I need (source) to work outside the repl for Meitner. Might have to take a stab at it.

19:16 Raynes: $source println

19:16 lazybot: println is http://is.gd/ewuFP7

19:46 domino14: how does (remove {#2} [0 1 2 3]) work?

19:46 #{2} sorry

19:46 what does #{..} mean?

19:46 ,(remove #{2} [ 0 1 2 3])

19:46 clojurebot: (0 1 3)

19:47 insamniac: (remove #{2 3} [ 0 1 2 3])

19:47 i am a failure

19:47 bbloom: domino14: explore with the class function and try using #{...} as a function directly. ask again if it hasn't become clear after that

19:48 domino14: i don't know how to find what that syntax itself means #{..}

19:48 ivan: ,(type #{})

19:48 clojurebot: clojure.lang.PersistentHashSet

19:48 insamniac: ,(hash-set)

19:48 clojurebot: #{}

19:49 insamniac: ,(hash-set 1 2 3)

19:49 clojurebot: #{1 2 3}

19:49 domino14: ,(= #(= 3 %) #{3})

19:49 clojurebot: false

19:50 domino14: ,(#{3} 4)

19:50 clojurebot: nil

19:50 domino14: ,(#{3} 3)

19:50 clojurebot: 3

19:50 domino14: ,(#{3 4 5} 3)

19:50 clojurebot: 3

19:55 oskarkv: domino14 here's all the reader stuff (like #{}, #(), etc.) http://clojure.org/reader

19:59 domino14: oskarkv: so for your code, i'm not sure what the apply concat does

20:00 what do the terms look like that come to it?

20:00 bbloom: (doc apply), (doc concat)

20:00 clojurebot: "([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:00 bbloom: experiment with them :-)

20:00 (doc concat)

20:00 clojurebot: "([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."

20:04 oskarkv: The 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:04 domino14 ^

20:04 outer*

20:14 Denommus: hi

20:14 anyone here worked with Luminus + Cassaforte?

20:23 akurilin: What 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:33 RickInAtlanta: LF vs CRLF which one is windows, which one is linux

20:34 Denommus: CRLF is Windows, LF is Linux

20:34 I'm really confused about how to use cassaforte with Luminus, and the documentation does not help

20:34 RickInAtlanta: thx

20:35 teslanick: What's the current thinking on writing a simple parser in clojure?

20:35 akurilin: I 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:35 RickInAtlanta: I 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:36 quizdr: teslanick clojure is great for parsing just about anything

20:37 teslanick: Yeah. I was going to base my format on edn, but clojure (like all rational programming languages) hates tokens in the form of 3d6.

20:37 Denommus: how would I create schema migrations in Cassaforte?

20:37 teslanick: Which is to say I'm fooling around with a simple dice rolling tool.

20:47 Cr8: teslanick: https://github.com/Engelberg/instaparse has been handy for me

20:48 though I generally just hack dice-strings together with regexes >>

20:50 teslanick: Yeah, 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:51 I don't necessarily want that kind of complexity, but having that door open seems worth the extra initial time investment.

20:51 So thanks for the tip

20:54 hiredman: 3d6+3

20:54 clojurebot: 14

20:56 teslanick: 1d20+4

20:56 clojurebot: 15

20:56 teslanick: Well.

20:57 arrdem: teslanick: just go ahead and build something cooler :D

20:57 teslanick: challenge accepted.

21:01 122

21:03 Denommus: is there any good migration library for CQL in Clojure?

21:04 quizdr: is there a way to see how a reader macro is implemented? I'm curious how ~@ is written

21:06 hyPiRion: ,'~@my-list

21:06 clojurebot: (clojure.core/unquote-splicing my-list)

21:06 quizdr: ,(doc unquote-splicing)

21:06 clojurebot: "; "

21:07 hyPiRion: best doc.

21:07 quizdr: hm ok

21:07 hyPiRion: $source unquote-splicing

21:07 lazybot: unquote-splicing is http://is.gd/EHA4TP

21:07 gozala: what’s the idiomatic way to let producer of channel know you no longer want to get data put on the channel ?

21:07 hyPiRion: gurr.

21:07 quizdr: i don't get it

21:07 the implementatino is empty?

21:11 hyPiRion: quizdr: 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:14 quizdr: I'm just curious how a function operating on an expression could splice the expressions inside the expression into the parent expression.

21:15 i guess it is not handoled in clojure itself, hence the java code block you linked to

21:18 srruby: A 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:21 quizdr: what does postwalk mean? i know you can't use keywords as functions with records as you can with maps

21:24 sorry i meant the opposite

21:32 srruby perhaps you could convert the record to a map for use with the postwalk function

21:34 domino14: i 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:34 quizdr: srruby turn your record into a map like this: (into {} (->aaa 1 2))

21:34 domino14: that's only ~3.8 million elements, why so slow clojure

21:35 brehaut: afternoon talios

21:39 srruby: quizdr Thanks!

21:40 quizdr Do you recommend using records as opposed to maps?

21:42 dj_ryan: hey folks, is there a good way to convert a multi-module maven project into lein?

21:42 clojurebot: No entiendo

22:01 danno1: So, the loop form (at least I think it is a form) looks semantically like recursion

22:11 quizdr: srruby 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:11 srruby: Thanks!

22:14 bbloom: srruby: generally, default to maps, use records if you have a good reason to

22:14 srruby: and the even if you think you have a good reason to use records, make sure your reason is actually good :-)

22:15 cark: am i right in thinking that only clojurescript supports specify ?

22:16 bbloom: cark: yes

22:16 cark: allright, any caveats i should be aware of ?

22:16 uvtc: In 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:17 srruby: bbloom: I thought I'd see if records would improve the programs speed.

22:17 bbloom: srruby: depends greatly on the program

22:17 egghead: uvtc: the bash repl actually expands that star for you

22:17 uvtc: (I realize I should probably be using Raynes' `fs` for that particular need anyway though.)

22:18 egghead: so the process that is actually invoked from the shell has no wildcards

22:18 raynes' directory search as tree-seq is cool :)

22:18 Raynes: egghead: huh?

22:19 egghead: file-seq

22:19 uvtc: egghead, 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:20 egghead: oh nvm Raynes didn't realize file-seq was clj core

22:20 Raynes: egghead: I was terribly confused.

22:22 egghead: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4504 is such a cool use of tree-seq

22:22 cark: so there's no way to work with protocol the same way in clojurescript than clojure via extend and a map of functions ?

22:28 arrdem: Compiler.java:2732 more whitespace weirdness....

22:32 Raynes: arrdem: What's sad is that you can fix all of the issues with Compiler.java in one simple command.

22:33 arrdem: Raynes: rm -rf?

22:33 Raynes: arrdem: rm Compiler.java && touch compiler.clj

22:33 <3

22:33 * arrdem high fives Raynes

22:33 arrdem: Raynes: good news, thanks to Bronsa's c.t.a.* work that's what I hope to do before I graduate...

22:38 newturtle: i'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:39 arrdem: newturtle: you're gonna have a really really bad time expressing that datastructure unless you resort to atoms..

22:39 newturtle: i 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:39 * arrdem cringes and hides in the depths of the compiler

22:40 newturtle: ok...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:42 arrdem: newturtle: so the real answer to this problem is that you cannot express this datastructure in idiomatic Clojure without using Java interop.

22:43 newturtle: 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:44 alandipert: newturtle: sounds like a candidate for a zipper

22:44 arrdem: newturtle: 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:44 $google clojure zippers github

22:44 lazybot: [clojure/data.zip · GitHub] https://github.com/clojure/data.zip/

22:44 newturtle: well, i build it singly directed, so the child knows of the parent, but not vice versa.

22:44 Raynes: Zippers are the solution to everything.

22:44 newturtle: so i am alright in that regard.

22:45 my 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:45 arrdem: newturtle: ooh. okay I see what you're doing.

22:46 newturtle: let me look at zippers, maybe something will click.

22:46 arrdem: anyone got better ideas than an explicit loop? I'm not thinking of a reduce or for based solution to this...

22:47 you could also do this with a tail recursion... but that's not any better than an explicit loop really...

22:47 (dec also) ;; I'm downvoting also and so whenever I use their names

22:47 lazybot: ⇒ -1

22:57 quizdr: bbloom would you say that having many maps with identical keys could be a good reason to use records instead?

22:58 bbloom: quizdr: define "many"

22:58 or quantify, rather

22:58 quizdr: say a hundred or more

22:58 where maybe the maps have 30 keys that are all identical

22:59 bbloom: at a hundred or so, you have to also quantify how many times you're doing what to them

22:59 and 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:59 a more realistic number of keys for a record is < 10

22:59 more like 2 to 5

22:59 quizdr: i see, so a map is better for large key sets?

23:00 bbloom: again, depends on what you're doing

23:00 cark: if you have a map that could be made a record and it has 30 keys, there's something wrong

23:00 quizdr: i 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:00 bbloom: it's a data structure and therefore it depends on your workload

23:00 quizdr: so the underlying of implementation of maps and records is considerably different, despite that they have a very similar interface?

23:00 Bronsa: arrdem: http://sprunge.us/WXJE?java here, this should be better.

23:01 bbloom: quizdr: the underlying representation of small maps and big maps are very different too!

23:01 ,(class (array-map))

23:01 clojurebot: clojure.lang.PersistentArrayMap

23:01 bbloom: ,(class (hash-map))

23:01 clojurebot: clojure.lang.PersistentArrayMap

23:01 bbloom: ,(class (sorted-map))

23:01 clojurebot: clojure.lang.PersistentTreeMap

23:01 Bronsa: arrdem: indented+all the commented out code removed

23:01 bbloom: ,(defrecord Point2D [x y])

23:01 clojurebot: sandbox.Point2D

23:01 oskarkv: are records more like array-maps?

23:02 bbloom: ,(class #sandbox.Point2D{:x 5 :y 10})

23:02 clojurebot: #<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>

23:02 quizdr: i 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:02 bbloom: quizdr: it's not all that mysterious

23:02 quizdr: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java#L177-L178

23:04 quizdr: I'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:05 bbloom: if you have 100s of maps with 30 keys in common each, you probably have a bad representation for your problem

23:05 quizdr: that's possible

23:05 oskarkv: bbloom 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:05 is*

23:05 JacobGood1: Hello, is anyone willing to lend me a hand, I need help with understanding macros

23:05 oskarkv: JacobGood1 shoot

23:06 bbloom: oskarkv: 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:07 oskarkv: 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:07 quizdr: bbloom so all records are array maps, despite their size?

23:07 bbloom: they are not quite array maps, they are simply similar

23:07 newturtle: alright, zippers dont seem like the right fix.

23:07 oskarkv: bbloom ah ok

23:07 bbloom: records have one major advantage, which is that :keywords used for lookups can be compiled to direct field access

23:08 newturtle: here's a paste showing what i'm trying to do.

23:08 http://pastebin.com/H00MjUSf

23:08 bbloom: that the MAIN win of records

23:08 if you're doing higher-order lookups on records or whatever, you're gonna get array map or worse perf

23:08 but if you have 30 fields, i can't imagine you needing to access each individual field by name with a direct keyword lookup....

23:09 quizdr: in 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:09 alandipert: newturtle: i'll cook up a zipper example for you - it will look similar

23:10 hiredman: quizdr: I would say they are more like the type classes of haskell, if you are familiar

23:10 technomancy: quizdr: 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:10 quizdr: no hiredman i'm not

23:10 alandipert: newturtle: oh wait - the objects you're searching contain their parent but not their children?

23:11 hiredman: quizdr: http://www.haskell.org/haskellwiki/OOP_vs_type_classes might be a good place to read about them then

23:11 technomancy: quizdr: that is, you're not the only one to have that mistaken impression =)

23:11 newturtle: yeah...i build the tree downward...

23:11 quizdr: it 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:12 newturtle: so it is singly linked. i just want to collect the solution nodes. what i have works...it just feels a little clunky.

23:14 hiredman: quizdr: but the arbitrary dispatch nature of multimethods also limits how fast they can be

23:14 quizdr: hiredman oh i see

23:15 hiredman: the grouping of functions in to a protocol is often kind of nice

23:16 alandipert: newturtle: https://www.refheap.com/26388 is an alternative that comes to mind

23:16 hiredman: protocols 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:17 alew: isn't the main point of protocols to interop with interfaces?

23:17 hiredman: protocols are in some sense, simpler, and more suited to the bottom of a stack

23:17 alew: absolutely not

23:18 alew: so they are just an optimization then?

23:18 hiredman: people 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:18 but that is not core to the notion of protocols

23:20 http://debasishg.blogspot.com/2010/08/random-thoughts-on-clojure-protocols.html seems like a good write up

23:20 newturtle: hmm. that is interesting. if-let only assigns parent if it isn't nil then? interesting.

23:24 i tried again with transient, and it was a bit simpler, but yours still seems better.

23:24 (http://pastebin.com/rE7ate5j)

23:24 but either way, it seems like i'm not terribly far off on the approach?

23:25 hiredman: you are

23:26 there is no need for a transient, right?

23:26 (recur … (conj stack some-value))

23:28 newturtle: yeah, you're right.

23:29 alandipert: newturtle: https://www.refheap.com/26394 is another way, a 'backward' zipper that kind of abuses the concept

23:30 wei__: anyone know how to configure BoneCP (jdbc connection pool) to use a set-parameters function?

23:31 seancorfield: Not sure what you're asking wei__ - set-parameters?

23:31 wei__: 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:31 newturtle: heh, 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:32 seancorfield: the pooled connection is also just a map

23:32 add :set-parameters to that map

23:32 newturtle: here, without the transient. that's about as simple as my original can be made i think. http://pastebin.com/XJ9gSEvF

23:33 seancorfield: see the docs wei__ http://clojure-doc.org/articles/ecosystem/java_jdbc/connection_pooling.html#create-the-pooled-datasource-from-your-db-spec

23:33 newturtle: thanks for the help, i'm glad to know i'm not going way off trail here.

23:33 seancorfield: the result of (pool db-spec) is a map {:datasource cpds} so assoc :set-parameters into that

23:34 wei__: ahh, that works! that's the docs I'm following, but I wasn't sure how set-parameters was used

23:34 (inc seancorfield)

23:34 lazybot: ⇒ 10

23:35 seancorfield: it's all just maps, all the way down :)

23:35 java.jdbc adds stuff to the map as it works to track transactions and so on

23:35 alandipert: newturtle: 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:36 seancorfield: but for the most part the "db-spec" is opaque

23:36 wei__: i see

23:36 newturtle: oh yeah, that's a good point.

23:37 seancorfield: even 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:39 wei__: well before I added the set-parameters key there was just the :datasource and nothing else

23:41 arrdem: Bronsa: hah thanks

23:42 alandipert: newturtle: and, of course, https://www.refheap.com/26399 :-)

23:46 newturtle: oh man, that one is crazy.

23:48 wow, that's elegant. i never yould have come up with it.

23:48 *would

23:48 sdegutis: Is there a new Internet yet?

23:51 Chrome kills my laptop and CSS is hard. It's 2014, surely we can do better than this.

23:56 quizdr: sdegutis actually i'm using Internet 2.2 and it's promising, but in closed beta so I can't really talk about it

23:57 TEttinger: sdegutis: IRC isn't good enough?

23:57 sdegutis: quizdr: Makes sense. Most things in startup-culture are closed beta for life.

23:57 TEttinger: Good enough for the time being.

23:57 I'm gonna delete my website as a boycott to the current Web.

23:58 You guys got just a few minutes to check it out.

23:58 http://sdegutis.github.io/

23:59 TEttinger: heh, I'm doing one of your goals

Logging service provided by n01se.net