#clojure log - Dec 11 2013

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

0:00 TEttinger: ,"\uff"

0:00 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Invalid character length: 2, should be: 4>

0:05 cljr: dcolish: i was aware of that notation, but i basically am trying to get to a 16 character string, if it was python it would be something like 10 * "\x00" + 2 * "\xff" + "\x7f\x00\x00\x01"; if I used 0xff in java/cojure, it is easy enough to create a vector of those, but i dont know how to get th the string representation, if i do (str 0xff) -> "255"

0:06 uvtc: ~botslack

0:06 clojurebot: No entiendo

0:07 cljr: i was using something akin to "\u007f\u0000\u0000\u0001", but then i realized that 0x7f != "\u007f"

0:09 alandipert: ,(apply str (map char (repeat 5 0xff)))

0:09 clojurebot: "�����"

0:10 cljr: ,(char 0xff)

0:10 clojurebot: \�

0:10 cljr: alandipert: i believe that is what i needed, thanks

0:10 alandipert: cljr: np

0:19 dcolish: if you can use it, commons-codec has some niceties for working with Hex strings

0:19 bitemyapp: arrdem: http://i.imgur.com/MJgBsoR.jpg

0:19 arrdem: bitemyapp: you're about three hours early

0:20 bitemyapp: arrdem: given finals, figured I'd let you sleep more

0:20 arrdem: bitemyapp: the final is at 9am. my scheduler is tied voting for and against sleep.

0:21 bitemyapp: arrdem: sleep

0:21 trinary: always sleep.

0:29 arrdem: the effort will be made then

1:47 SegFaultAX: bitemyapp: I need to borrow your gun.

1:47 bitemyapp: SegFaultAX: ...

1:48 SegFaultAX: okay, what?

1:48 SegFaultAX: bitemyapp: I must recreate: http://i.imgur.com/pyqtppN.jpg

1:49 arrdem: SegFaultAX: ............................. why

1:49 bitemyapp: SegFaultAX: my gun is too pretty for it to work.

1:49 SegFaultAX: Haha

1:49 bitemyapp: you need a fugly handgun like that dude's.

1:49 SegFaultAX: I already have the sweater and everything.

1:49 bitemyapp: I'm srs.

1:49 arrdem: SegFaultAX: go find a pair of gold deagles. it'll be great.

1:49 bitemyapp: Masha is not to be trifled wish. She has feelingks.

1:49 SegFaultAX: .357 magnum would be perfect.

1:49 bitemyapp: with*

1:49 I do not own a .357

1:52 SegFaultAX: http://i.imgur.com/vi2KPFY.jpg

1:53 SegFaultAX: Mk23

1:54 arrdem: dat. can.

1:54 bitemyapp: arrdem: ikr

1:56 arrdem: I'm gonna have to see if Reds has one of those next time I make a trip....

1:56 bitemyapp: arrdem: I'm going to HATE YOU REALLY HARD from over here in California.

1:57 arrdem: bitemyapp: bro. texas. I may wind up with a gunsafe in my appartment next year. you could too :P

1:57 bitemyapp: Watching Zizek while hacking Haskell makes me feel intense.

1:57 and coke-addled.

1:57 arrdem: HOW THE SHIT IS THAT GUN $1905

1:57 {[^-^]}: Is there anywhere at all I can see complexity of clojure data structures?

1:57 in big-O notation

1:57 bitemyapp: arrdem: H&K

1:58 {[^-^]}: because googling for it is a huge fail

1:58 arrdem: bitemyapp: that's friggin silly

1:58 bitemyapp: {[^-^]}: clojure.org

1:58 arrdem: H&K is nazi brick of high price

1:58 arrdem: is par for course, comrade.

1:58 arrdem: bitemyapp: but dat german engineering...


1:58 bitemyapp: arrdem: nazi brick of high price.

1:58 arrdem: I'll just go build my $500 AR and feel poor now...

1:59 {[^-^]}: bitemyapp: there's barely any info about it

1:59 on clojure.org

1:59 bitemyapp: arrdem: don't build a $500 AR

2:00 arrdem: that's not really worth it.

2:00 arrdem: if you need something more accurate than an AK, then Mosin or Mini-14. Or Mini-30.

2:05 arrdem: yay cheaper garands!

2:09 mysamdog: I'm having another clojurescript problem, this time with dommy.

2:10 Here's my cljs file: https://www.refheap.com/21667, my html file: https://www.refheap.com/21669, and the tail -n 500 of the js that it compiles to: https://www.refheap.com/21670

2:10 echo-area: What's the point of adding macros like cond->, some->, as->? I can't think of a typical usage

2:11 arrdem: echo-area: as-> is great if your threaded value doesn't aways need to occur in the first position

2:12 echo-area: And there's no examples in clojure's source code itself

2:12 (Practical examples)

2:12 arrdem: Ah, I see that now

2:12 What about the others?

2:12 * arrdem ponders

2:12 mysamdog: I'm tryring to use dommy for click events and such, and I made a quick test to make sure it worked, which it didn't.

2:12 talios: threading macros are for people who pretend they don't really want to use scala and symbol heavy code ;)

2:13 arrdem: echo-area: some-> provides shortcutting, it's potentially a nice way to chain predicates

2:13 mysamdog: What's supposed to happen is when I click the button with id "Home" is that the word test is added to the div with id "content"

2:14 arrdem: echo-area: cond-> is just shorthand for (cond e (...) (-> e ...))

2:14 mysamdog: Calling soar.site.test(); from the js console in my browser works, but clicking the button doesn't.

2:14 arrdem: s/shortcutting/short circuting/g

2:15 * talios pokes [Neurotic] or any other kiwi - anyone wanna guest on the podcast ( google hangout ), we're down a cohost ;)

2:15 * [Neurotic] is in AU :)

2:15 [Neurotic]: It's not quite the same ;)

2:15 talios: You doing it right now?

2:16 talios: [Neurotic] - shceduled to record in about 15 mins ish

2:16 echo-area: arrdem: Not exactly, cond-> doesn't short circuit after the first true test expression

2:16 talios: [Neurotic] - ah yes, its Kai whose wellington based right?

2:16 [Neurotic]: Argh! I would be delighted to join you, unfortunately, I have dinner with my parents shortly for their wedding anniversary

2:16 talios: That's the one :) German born, NZ based.

2:17 arrdem: echo-area: true, and I think that's a feature.

2:17 talios: [Neurotic] - if we guest on each podcast, we could be 3 devs down under :) hah

2:17 arrdem: echo-area: it allows for multiple cases to be true.. a better way to think about it is throwing #(if)s in your ->

2:17 talios: altho - we're under downunder

2:17 [Neurotic]: talios: I like it ;)

2:18 talios: I'm currently hassling Kai to do another podcast before year end. Nailing him down is proving to be struggle ;)

2:18 talios: [Neurotic] - and at this time of year even harder I imagine

2:19 [Neurotic]: He's travelling or something else fairly non-important (to me anyway ;) )

2:25 talios: good luck finding someone! If you ever need a guest, I'd be more than happy to fill in!

2:25 talios: sweet - you may get mocked for cold fusion however ;-)

2:26 [Neurotic]: I always get mocked for ColdFusion. I would expect no less ;)

2:26 talios: we need more guests, shift things up a bit - can be a bit tedious us always the same

2:26 hah - mind you - me/greg are both ex Delphi as well

2:26 [Neurotic]: I'm a terrible extrovert, so any chance I get to talk .. in front of people, I'm pretty much there :D

2:26 okay, I reely need to run. ttyl!

2:27 talios: Happy Wedding Annivsary :)

2:27 for your folks

2:41 nones: is there any differences between (map :key) and (:key map)

2:41 arrdem: nones: practically no

2:41 talios: different functions, same outcome.

2:41 for all intent - as arrdem says, nothing different

2:42 one may "read" better to human brains given different scenarios is all

2:42 nones: thanks

2:45 daniel_k_: https://github.com/bbatsov/clojure-style-guide#collections says that (map :key) is susceptible to NullPointerException.

2:45 scottj: nones: (:key map) is better if map might be nil

2:49 nones: thanks, i understood

3:51 * ucb waves

4:38 magnars: Just added introduce-let and expand-let refactorings to clj-refactor.el :) https://github.com/magnars/clj-refactor.el#introduce--expand-let-example

4:45 ucb: magnars: !

4:45 magnars: (that means "whoa, nice!")

4:45 but shorter

4:45 magnars: brevity is the essence of wit

4:47 ucb: :)

5:26 piranha: magnars: you list paredit 24 as a dependency for clj-refactor, but I see only paredit 22 on marmelade (and through el-get I got paredit 23)

5:27 magnars: is that some kind of dev version? should I obtain it by hands somehow?

5:43 magnars: piranha: oh, I guess paredit 24 isn't released yet. It certainly isn't necessary to get such a new version. I'll downgrade the dependency straight away.

5:43 piranha: magnars: thanks :)

5:44 magnars: piranha: 0.4.2 released and on marmalade :)

5:46 piranha: magnars: error: Need package `multiple-cursors-1.2.2', but only 1.2.1 is available :)

5:46 magnars: haha, really now :) Let me see what the difference between 1.2.2 and 1.2.1 is

5:47 multi-file packages are a pain to deploy to marmalade :P

5:47 piranha: they are always a bit of pain :)

5:48 magnars: Bah, 1.2.1 is pretty old. I'll get 1.3.0 out on marmalade instead. Bear with me as I curse the tar command.

6:02 piranha: multiple-cursors 1.3.0 is now deployed to marmalade

6:02 piranha: magnars: cool, let me try...

6:03 damn, 'package-handle-response: Error during download request: Not Found'

6:03 I'll have to debug this to determine what's going on :(

6:03 later then

6:03 magnars: hmm, that sucks

6:03 piranha: give me few mins though, maybe I'll find the source quick enough

6:04 magnars: that seems about multiple-cursors

6:05 magnars: http://paste.in.ua/9150/

6:05 magnars: hmm ... it certainly is there: http://marmalade-repo.org/packages/multiple-cursors

6:06 piranha: eh

6:07 well, later then

6:07 :)

6:08 magnars: I should find some way of having CI pull from both marmalade and melpa, in addition to git.

6:08 piranha: I hope that's not el-get getting in the way...

6:10 magnars: no, same error on a blank emacs

6:15 piranha: seems like a marmalade fail - pressing "Download" on the marmalade page fails too.

6:15 piranha: ah...

6:16 maybe we just need to wait for a bit

7:25 CookedGryphon: magnars: I'm getting a runtime exception, EOF while reading when I try to do some refactors

7:25 magnars: CookedGryphon: ok, would you mind opening an issue with an example, so I can reproduce it?

7:26 CookedGryphon: Yeah, it might be quite an involved example though - I'm doing clojure on android.

7:26 feel free to say "unsupported"!

7:28 I'll check if it works fine in some of my other projects and then do a little more investigation of my own before I bother you with an issue, but it seems to think I have unmatched delimiters

7:28 when I don't

7:30 magnars: CookedGryphon: Clojure on android shouldn't be a problem. The refactorings pretty much only care about sexps. Which ones are giving you the issue? Might be that paredit is complaining.

7:31 CookedGryphon: magnars: Why am I getting a runtime exception as a result? Is the manipulation purely elisp?

7:31 as in a java runtime exception

7:31 magnars: Wow, that's really odd. There's just elisp in there.

7:31 CookedGryphon: it's evaluating things automatically right?

7:33 magnars: oh!

7:33 magnars: It might be that the `clojure-find-ns`, `clojure-update-ns` `clojure-expected-ns` calls are doing some evaluating. But there's no nrepl integration going on, so that seems strange too.

7:33 CookedGryphon: magnars: I'm being really stupid

7:33 magnars: That happens to me some times too :)

7:34 CookedGryphon: magnars: I set up my keybindings in scratch to try it out, picked something which was unbound, went and tried it out

7:34 but of course while it wasn't bound in my scratch, it *was* already bound in clojure mode

7:34 magnars: Classic!

7:34 CookedGryphon: okay, sorry to bother you, i'll try again :P

7:34 magnars: No worries :)

7:40 piranha: Seems like this marmalade issue is a known bug without a fix atm: https://twitter.com/bbatsov/status/410747520940539904 - maybe try melpa?

7:41 piranha: magnars: oh, ok; should I just switch repo to melpa and it will work?

7:41 I have no idea how all those repos work with emacs to be honest :)

7:42 magnars: If you're comfortable living on the edge. melpa builds straight from master, so that comes with its ups and downs.

7:42 piranha: ah

7:43 I'm ok :-) I initially tried to install with el-get straight from github but then it has dependencies so I thought that I have to use some package manager... anyway, let me try

7:43 magnars: You should be able to grab the dependencies with el-get too.

7:44 rurumate: how to make clojure.pprint print things more pretty than, say, pr-str?

7:44 '(clojure.pprint/pprint {12 13})

7:44 piranha: magnars: I should, but then I need to add them by hand :)

7:48 magnars: it works! :)

7:48 magnars: excellent! :)

7:49 piranha: magnars: it's just great, I love 'ar' and 'rf' the most right now :)

7:49 magnars: :D

7:49 piranha: how do you find files in project?

7:50 I mean how do you decide "this is a project"?

7:50 magnars: (locate-dominating-file default-directory "project.clj")

7:51 piranha: ah :-)

7:51 makes sense :P

7:51 magnars: again, thanks a lot! That's something really sweet :))

7:51 magnars: Glad to hear that :)

7:59 seriously_random: how do you apply a function on a vector? http://pastebin.com/PiPx9vAF

8:05 john2x: seriously_random: do you mean apply a function over each element in a vector?

8:06 seriously_random: john2x, funtion

8:09 john2x, got it! "(map rank hand)"

9:01 how to convert (2 3) to [2 3]?

9:02 arrdem: the seq vs vector difference shouldn't be important, but you can use (vector)

9:03 hyPiRion: seriously_random: vec

9:03 ,(vec '(2 3))

9:03 clojurebot: [2 3]

9:05 seriously_random: hyPiRion, (vec '(vals (frequencies ranks))) doesn't give me what I want

9:06 hyPiRion, works without '

9:07 arrdem: seriously_random: of course, because you're quoting the list of symbols, giving you a list of symbols rather than a list of expressions

9:25 deadghost: http://pastebin.com/psjkr9zC

9:25 I'm not sure if I should be using recur here

9:28 clgv: deadghost: you can `reduce` over the list of predicate functions

9:30 deadghost: clgv, as in do I need to cram in recur somewhere to get TCO

9:30 *as is

9:31 ivan: if anyone wants to become a "security researcher" just search github for everything that uses hiccup

9:31 filenames, source lines, etc can all contain HTML

9:39 clgv: deadghost: no. pure usage of `reduce`

9:40 deadghost: I mean the way I wrote it

9:40 unless you're telling me shutup and just use reduce

9:43 amalloy: deadghost: if you were going to write it the way you did, recur is clearly better

9:43 but (remove (apply some-fn

9:43 (remove (apply some-fn fn-list) data-list) is much shorter

9:44 reduce/remove would be okay, but not great

9:45 Anderkent: Can anyone help me with proxy? I'm trying to proxy a Reader java.io.reader, but I have no idea how to override only the abstract (read [char-array offest len]), and not the provided (read ^char [])

9:46 deadghost: amalloy, I was asking about recur because I totally don't know how to use recur

9:46 coming from CL

9:46 (newbie at CL as well)

9:49 amalloy: deadghost: recur is used when, inside of a function f, the last thing you do is call f again and immediately return its result

9:50 (defn f [x] (if (zero? x) 0 (f (dec x)))), for example: the last call in the false-branch is to f, so it could be replaced with recur

9:50 deadghost: so usage wise would I replace f with recur

9:50 amalloy: in (defn f [x] (if (zero? x) 0 (inc (f (dec x))))), however, the recursive call to f is *not* the final action, so recur would not apply

9:50 try it and see!

9:52 deadghost: hmm ok looks like

9:52 "While not as general as tail-call-optimization, it allows most of the same elegant constructs, and offers the advantage of checking that calls to recur can only happen in a tail position."

9:53 Anderkent: holy god of all that's clojure, is this accurate and the only way? https://groups.google.com/d/msg/clojure/TVRsy4Gnf70/7DwezPG9digJ (2009)

9:53 deadghost: I take it this isn't exaclty the same as TCO

9:57 clgv: amalloy, deadghost: oh right the new `some-fn` fits awesome there

9:58 Anderkent: oh my god it's true... (defn -read-char<>-int-int [])

9:59 BobSchack: Anderkent are you using proxy for Java interop?

9:59 Anderkent: I tried to use proxy but I can't figure out how to override just a single overload

9:59 so I'm trying gen-class right now

10:01 amalloy: Anderkent: if you want to implement a Reader, you could extend the approach we used in flatland/io (https://github.com/flatland/io/tree/develop/src/flatland/io) for Streams

10:02 BobSchack: Anderkent here's a good link for when to java interop http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/

10:03 Anderkent: BobSchack: ... that doesn't help at all. I'd LOVE to use proxy. It's not working. Telling me 'use proxy' does NOT help

10:04 amalloy: cool, thanks. I'd like to avoid having to write those wrappers, so if gen-class works I'd go with that. I only need one instance and the overriden behaviour is trivial (reader that writes to stdout whenever it's read from, to simulate stdin echo)

10:06 deadghost: ha it took me a few passes before I realized some-fn is a function

10:19 Anderkent: Can't get gen-class to work - probably doing something stupid. https://www.refheap.com/21673

10:20 nDuff: Anderkent: gen-class only happens during AOT compilation.

10:20 Anderkent: argh, i knew that

10:21 too used to the repl by now!

10:21 nDuff: Anderkent: ...by the way, did you provide a reproducer for the issues you were reporting w/ proxy?

10:21 ...ahh, n/m.

10:23 Anderkent: I take it as a confirmation that yes it's an issue and no i can't do it with proxy :)

10:28 yay, it works!

10:37 deadghost: hmm amalloy some-fn doesn't seem to like me

10:38 ((apply some-fn '(even?)) 2)

10:38 results in nil

10:39 amalloy: uh, '(even?) is a list containing a symbol, not a function

10:42 deadghost: uhhhh

10:42 I'm not sure what I'm missing then

10:42 do I need to denote even? is a function or something?

10:44 Anderkent: deadghost: some-fn takes functions and returns a function to apply to the argument

10:44 i.e. &((some-fn even?) 2)

10:44 uhm

10:44 ,((some-fn even?) 2)

10:44 clojurebot: true

10:44 Anderkent: if you have a list of functions as an argument, you'd do

10:45 `cbp: ' will turn even? into a symbol

10:45 Anderkent: ,((apply some-fn [even? pos?]) 3)

10:45 clojurebot: true

10:45 `cbp: use list or use a vector or something

10:47 deadghost: hmm what

10:48 I thought ' was shorthand for list

10:48 or am I mixing clojure up with cl

10:49 Anderkent: '() is a way of escaping a list and its contents -> '(1 2 3) is the same as (list 1 2 3). But if oyu have symbols in it, it becomes (list 1 2 'symbol 3)

10:51 `cbp: ' is quote not list, its the same for cl

10:51 deadghost: I guess I just got an oversimplified explanation then

10:51 `cbp: its to prevent evaluation

10:56 Anderkent: right, i didnt mean to say it expands to (list), just that it gives you the same result

10:57 deadghost: more likely I didn't pay enough attention reading gentle introduction to symbolic computing

10:58 `cbp: when you run clojure code there are basically two stages: read and eval. read turns strings into data structures and some values. quote basically says stop right after read. It works with other data structures not just lists.

11:03 fredyr: deadghost: unlike other lisps, in clojure you mostly want to use vectors

11:04 ToBeReplaced: one day, i would love not to have to type clojure.lang.PersistentQueue/EMPTY -- is there a ticket where a (queue) function or similar was discussed?

11:04 deadghost: fredyr, I never read up on why I'd prefer a vector over a list

11:04 tbaldridge: ToBeReplaced: yes there is, http://dev.clojure.org/jira/browse/CLJ-1078

11:05 ToBeReplaced: tbaldridge: thanks

11:05 Anderkent: deadghost: if you need random access, for example

11:06 also sometimes it just helps as a visual distinction between data and code.

11:06 deadghost: what really

11:06 I thought vectors were like arrays

11:06 and I needed to traverse through to a value

11:06 or that arrays were a type of vector

11:06 Anderkent: that's not how arrays work!

11:06 deadghost: lolidk

11:06 tbaldridge: deadghost: you don't have to transverse an array

11:07 *traverse

11:07 * deadghost tries to remember his K&R

11:07 tbaldridge: arrays are basically a pointer lookup. arrayptr + (index * size of element)

11:08 it can be harder to grow arrays however, so vectors fill that void. Fast random access plus fast grow

11:09 deadghost: does SICP cover this material?

11:09 Anderkent: is there a function to always add a single object to the end of a collection? I guess I can do (concat coll [x])

11:09 tbaldridge: Anderkent: conj will add to the end of vectors.

11:09 fredyr: conj does that

11:09 deadghost: I totally don't know my data structures

11:09 Anderkent: yeah the thing is i dont know if its a vector o rlist

11:09 mdrogalis: Is there a completely bullet-proof Clojure or Java function to check if a string is a number? When I say bullet proof I mean anything java.lang.Number.

11:09 Anderkent: ,(conj '( 1 2 3) 4)

11:09 mdrogalis: Apache's utils don't catch decimals.

11:09 clojurebot: (4 1 2 3)

11:09 tbaldridge: Anderkent: convert it first with vec perhaps

11:10 Anderkent: meh

11:10 I could :P

11:10 tbaldridge: Anderkent: if it is already a vector I think vec is a no op

11:11 Anderkent: yeah it just feels wasted since i'll only ever read it once, and will read it like a list

11:11 i.e. it's (string.join \newline (concat lines [""]))

11:11 tbaldridge: Anderkent: yeah, then concat is probably best

11:11 That's what this does after all:

11:11 CookedGryphon: mdrogalis: ,(number? (read-string "123.2f"))

11:12 ToBeReplaced: tbaldridge: it seems like there was disagreement and now nothing is occurring -- does it seem like it's stuck to you? fwiw i like queue/queue* since list/list* and no clear match to vec/vector

11:12 Anderkent: actually, I guess the best answer is (str (map (str % "\n) lines)) :P

11:12 tbaldridge: , `(1 2 3 4 ~2)

11:12 clojurebot: (1 2 3 4 2)

11:12 tbaldridge: , '`(1 2 3 4 ~2)

11:12 clojurebot: (clojure.core/seq (clojure.core/concat (clojure.core/list 1) (clojure.core/list 2) (clojure.core/list 3) (clojure.core/list 4) ...))

11:12 tbaldridge: actually, ick, that's rather gross...lol

11:13 gfredericks: ToBeReplaced: que/queue :)

11:14 tbaldridge: ToBeReplaced: I think the latest changes are what Rich is looking for. Perhaps ping clojure-dev?

11:14 ToBeReplaced: que/queue is funny

11:16 dav: ok I'm banging my head against a wall simply trying to call some java classes..

11:16 hoping I can get a bit of guidance

11:16 I got a jar file off for XLLoop on here: http://xlloop.sourceforge.net/

11:16 There's no explicit support for clojure but that shouldn't matter.

11:16 gfredericks: tbaldridge: I don't think vec is a noop; looks like it converts to a seq then back to a vector

11:17 dav: They have a simple bit of (Java) code under "Usage"

11:17 tbaldridge: really? ick

11:17 gfredericks: ,(let [v (vec (range 1000000))] (time (count (vec v))))

11:17 clojurebot: #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>

11:17 dav: I can't, for the life of me, instantiate the FunctionServer class

11:17 gfredericks: &(let [v (vec (range 1000000))] (time (count (vec v))))

11:17 lazybot: ⇒ "Elapsed time: 2274.815886 msecs" 1000000

11:18 Anderkent: dav: what errors are you getting? Is the class on the classpath?

11:18 gfredericks: &(let [v (set (range 1000000))] (time (count (set v))))

11:18 dav: Anderkent: I've put the jar file in the resources folder of my lein project

11:18 Anderkent: the folder is in the classpath

11:19 Anderkent: dav: I'm not sure if that'll work. What happens if you type (import 'org.boris.xlloop.FunctionServer) in the repl?

11:19 Bronsa: gfredericks: ouch

11:19 gfredericks: &42

11:19 dav: Anderkent: ClassNotFoundException

11:20 Anderkent: where else should I put it?

11:21 Anderkent: dav: lein tries to stick to the dependency-managed way. I don't think there's an easy way. For a local setup you can try something like http://www.elangocheran.com/blog/2013/03/installing-jar-files-locally-for-leiningen-2/

11:21 but the preffered way is to build a pom.xml for that jar and deploy it to clojars :P

11:22 dav: Anderkent: the folder is definitely in (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))

11:22 Anderkent: For a really hacky way you can try unpacking the jar (it's just a .zip file) and putting the .class files on the classpath (in the resource/ directory, for example)

11:22 dav: Anderkent: ok let me have a look.

11:22 Anderkent: yeah, but jars are special

11:23 dav: Anderkent: clojars you mean upload the jar back onto some public repository?

11:23 Anderkent: dav: it involves more than that. You'd have to create a file that describes dependenceis of that jar, its verion etc.

11:24 (uh, I kinda assumed you're using lein. Are you?)

11:24 dav: Anderkent: yes I am

11:24 Anderkent: ok cool.

11:24 dav: Anderkent: ok but it feels unsatisfying that I'd have to upload a jar online to be allowed to use it..

11:24 Anderkent: I'll try that blog post you linked to

11:25 mdrogalis: ,(number? (read-string "12 lol"))

11:25 clojurebot: true

11:25 Anderkent: dav: there is good reason for that. see https://github.com/technomancy/leiningen/wiki/Repeatability

11:25 mdrogalis: CookedGryphon ^

11:26 Anderkent: mdrogalis: read-string only reads one expression from the string

11:26 kinda funny how it doesnt even tell you how much it read, or throw an exception if there's stuff left over..

11:26 mdrogalis: Anderkent: Yep.

11:26 It does what it wants.

11:28 CookedGryphon: mdrogalis: http://stackoverflow.com/questions/2640169/whats-the-easiest-way-to-parse-numbers-in-clojure

11:29 mdrogalis: half way down it has a neat hack to pull the matchNumber method from clojure's reader

11:29 and invoke it to give you the number or nil

11:29 wei__: given java.jdbc/update!, what's the best way to write an update-and-return! function?

11:30 mdrogalis: CookedGryphon: Hah, that actually works.

11:35 Anderkent: argh why is it so hard to decide if strings should have a trailing newline or not

11:38 dav: Anderkent: mvn install-file worked after a few tries :) thanks a lot.

11:42 Bronsa: dnolen: ping

11:54 deadghost: clojure doesn't have second, third, etc?

11:55 mdrogalis: ,(second [1 2])

11:55 clojurebot: 2

11:55 mdrogalis: ,(doc third)

11:55 clojurebot: Titim gan éirí ort.

11:55 Bronsa: uuuh just found a tools.reader bug thanks to tools.analyzer.jvm and eastwood

11:55 vijaykiran: deadghost: use nth for stuff beyond second

11:55 teslanick: ,(nth [1 2 3 4] 3)

11:55 clojurebot: 4

11:55 deadghost: oh huh

11:55 it's kinda funny it has second

11:56 Anderkent: it's because pairs are common

11:56 vijaykiran: deadghost: second is bit more useful/readable when you are recursing over stuff

11:56 deadghost: I see

12:00 Anderkent: hm, what's the idiom for executing an expression in a different namespace? (binding [*ns* (find-ns 'ns)] ...) seems a bunch of boilerplate

12:01 tbaldridge: Anderkent: in-ns should do that.....but why would you want to?

12:01 Bronsa: Anderkent: that won't work as you'd expect in some cases

12:04 Anderkent: well, basically i'm simulating a repl - feeding a list of strings to clojure.main/repl. I want to switch to the user ns so that the output is as if someone was sitting there typing

12:04 tbaldridge: afaik in-ns just switches to it, it doesnt take a body expr

12:04 tbaldridge: Anderkent: well switch to it, run your code, then switch back

12:05 Anderkent: ugly!

12:05 i'd rather (binding) wrap it than (try finally) :P

12:05 tbaldridge: ,(do (in-ns 'foo) (println *ns*) (in-ns 'user))

12:05 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: println in this context, compiling:(NO_SOURCE_PATH:0:0)>

12:05 tbaldridge: ,(do (in-ns 'foo) (clojure.core/println *ns*) (in-ns 'user))

12:05 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: *ns* in this context, compiling:(NO_SOURCE_PATH:0:0)>

12:05 deadghost: hmm that's kinda funny

12:05 nil isn't true or false

12:05 Anderkent: :) joy of uninitialized namespaces

12:06 deadghost: I guess I need to check for it

12:06 Anderkent: ,(if nil :yes :no)

12:06 clojurebot: :no

12:06 Bronsa: Anderkent: binding *ns* won't work. (binding [*ns* some-ns] some-ns-symbol) will fail

12:06 Anderkent: Bronsa: that's okay

12:06 Bronsa: the compiler will try to resolve some-ns-symbol before in the current ns

12:06 tbaldridge: Anderkent: yeah, so do what I suggested inside a try/finally. And it'll work as you want.

12:06 Bronsa: / before/d

12:06 Anderkent: my thing already works. I just wondered if there was something like (with-ns)

12:06 tbaldridge: but once again, if you need to do that, I'll question your code structure.

12:07 deadghost: ,(false? nil)

12:07 clojurebot: false

12:07 Anderkent: deadghost: false? checks for 'is this Boolean.false'. There's rarely any reason to call it

12:07 deadghost: I see

12:11 Anderkent: ugh, is there something that takes a predicate and basically returns [(filter pred list) (filter (not pred) list)] ?

12:11 (group-by pred) works, I guess. But ugly.

12:15 murtaza52: I want to sort a map by its value, is there a lib fn for it ?

12:15 seangrove: Anderkent: partition-by ?

12:16 murtaza52: You want the keys in the map to be sorted according to their values, or just the values sorted?

12:16 murtaza52: keys sorted by the values

12:17 Anderkent: seangrove: partition is not the same thing

12:17 ,(partition-by odd? [1 2 3 4])

12:17 clojurebot: ((1) (2) (3) (4))

12:17 Anderkent: ,[(filter odd? [1 2 3 4]) (filter (comp not odd?) [1 2 3 4])]

12:17 clojurebot: [(1 3) (2 4)]

12:17 seangrove: Anderkent: True

12:18 Anderkent: it's ok, group-by works pretty nicely in retrospect

12:18 hyPiRion: ,((juxt filter remove) odd? [1 2 3 4])

12:18 clojurebot: [(1 3) (2 4)]

12:19 murtaza52: seangrove: I am trying to sort the keys by values, and also need to preserve the structure as a map

12:19 Anderkent: hyPiRion: cool, but it does two passes right?

12:20 hyPiRion: Anderkent: sure, is that a problem?

12:21 seangrove: murtaza52: Hrm, not sure, I think all the sorted-maps compare keys for sorting

12:21 murtaza52: Probably hints that you should use a different data structure

12:21 Anderkent: not in practice, only in terms of elegance :P

12:21 but thanks anyway

12:22 In retrospect the group-by solution worked out pretty nicely

12:25 stuartsierra: Re `in-ns` discussion earlier, if you really want to create Vars in another namespace, use `intern`.

12:27 murtaza52: seangrove: thanks sorted it by converting it into a vector :)

12:27 seangrove: murtaza52: Yeah, sounds considerably easier :)

12:28 Anderkent: stuartsierra: I don't! I just want the repl to run in a different context.

12:28 stuartsierra: oh nevermind then :)

12:30 coventry: Anderkent: Which repl? How is (ns 'ns-symbol) insufficient?

12:31 Anderkent: it's not an interactive repl. I'm using the clojure repl, feeding it strings, and looking at sdout

12:31 but it starts in my current ns instead of user

12:31 thus, wanting to run a function in a different ns context

12:32 coventry: Oh. I do a lot of that, and (binding) is the best solution I've seen so far.

12:33 Anderkent: a lot of running functions in different contexts, or a lot of feeding repls strings?

12:33 because if the second, then I definitely want to steal your code :P

12:37 coventry: Running functions in different contexts. I mostly feed strings straight to the reader. https://github.com/coventry/troncle/blob/master/src/troncle/core.clj#L9

12:38 What's the advantage to driving clojure via the repl?

12:38 Anderkent: I'm writing doctest

12:41 i.e. put copy your repl session into docstrings / a file, and I'll run the code and verify that the output is the same

12:41 and now not only am i stuck on the airport, the wifi seems to be giving out. Gah.

12:43 coventry: Nice.

12:44 TimMc: Anderkent: Negati id not recei last communica *HKSSHSHHHTTT* <connection dropped>

12:46 I kind of wish digital stream failure modes were more like analog.

12:48 tbaldridge: Anderkent: actually that's probably the best reason I've heard for doing this sort of thing.

12:51 arrdem: bitemyapp: final survived. one haskell was sighted, several scalas were slain and monads where nowhere to be found

12:52 bitemyapp: the haskell was surprisingly helpful... the scalas all put up a fight

12:54 * nDuff is curious as to context for the bitemyapp / arrdem convo.

12:54 seangrove: Any kind of distinct-by function?

12:56 gfredericks: reiddraper: do you have any thoughts on some way of multiplying the trial times by some fixed number for a given test run? E.g., "run my tests with 10 times as many runs as usual"

12:56 use case is I want quick tests in dev but longer/thorough tests in CI

12:56 so an env variable or some such would be the most convenient

12:57 I just peeked at simple-check.clojure-test and it looked like there isn't such a thing currently

12:57 reiddraper: gfredericks: yeah, i think something like that would be useful, but not yet sure how to best do it. i'd like to keep the quick-check function itself as magic-free as possible, and have everything be explicit

12:57 arrdem: nDuff: bitemyapp was helping me out yesterday in my studying for a type theory heavy programming languages final test.

12:57 gfredericks: reiddraper: is doing it in defspec too messy?

12:58 arrdem: nDuff: I'm referring to languages as animals because my sleep deprived brain thinks it's funny

13:00 stompyj: arrdem: specific languages? or theory?

13:01 arrdem: stompyj: type inference over typed lambda calculus + scala :/

13:01 stompyj: that and multiple inheritance behavior was about 75% of it

13:01 stompyj: wow

13:01 scala in schools, thats awesome

13:02 reiddraper: gfredericks: that's probably ok. i think in my ideal, it'd be something you'd pass in on the command line to 'lein test'

13:02 stompyj: when I was in school we used C, Scheme, Prolog, ML and that's about it

13:02 * arrdem rants about scala's lack of real lazy structures

13:04 reiddraper: gfredericks: but yeah, i think defspec is probably a reasonable place

13:04 gfredericks: reiddraper: okay; if I end up needing this soon I'll draft it up on a branch and can open a PR for discussion when it feels ready

13:05 reiddraper: gfredericks: awesome, thanks. hopefully the move to contrib will happen sooner than later, i need to go bug people to start replying to the clojure-dev email

13:06 gfredericks: so, actually, if you don't mind, can you reply to it as well, just basically pasting what i wrote, but replacing with your name. (that is, if your cool with donating to contrib)

13:07 gfredericks: reiddraper: I'm curious what happens if I'm not cool with it; but my curiosity is not enough to overtake my coolness with it

13:07 reiddraper: gfredericks: feel free to dm me

13:10 gfredericks: OSS & licenses is so weird

13:16 technomancy: copyright assignment isn't so much about licenses

13:19 justin_smith: technomancy: well in the case of GNU at least, it is about being able to legally enforce licenses (if it came to that).

13:20 They can't easily take someone to court for unlicensed usage if they don't have all copyright holders on board, copyright assignment makes this much easier.

13:21 technomancy: yeah, GNU is a special-case on account of being fairly high-profile though

13:22 they've basically painted a big target on their back

13:25 justin_smith: right, and at this point some high percentage of computers run their code, nearly all if you count things that came out of their compilers

13:25 hmm... maybe not in embedded I guess

13:26 arrdem: justin_smith: I don't think that the GPL2/3 covers the results of a GPL'd tool... does it?

13:26 justin_smith: no, of course not

13:26 just a metric of their ubiquity

13:26 not how far their licensing concerns go

13:27 also copyright assignment is often a concern for smaller projects if they want to be able to dual license

13:27 that is really hard to do if there are multiple copyright holders, and it rightly scares away any takers for alternate paid licenses

13:29 technomancy: yeah, I'm thinking more in the context of contrib

13:29 dnolen: pure React CLJS interface wip - https://github.com/swannodette/om

13:29 clojurebot: Huh?

13:30 arrdem: gfredericks: you have a CA in, right?

13:30 TimMc: arrdem: That's debatable.

13:30 yazirian: om.dom? what a missed opportunity for om.nom

13:30 arrdem: TimMc: how is that possible...

13:30 technomancy: but actually now I realize I don't know the motivation behind the CA at all any more

13:31 http://p.hagelb.org/mystery.gif

13:31 gfredericks: arrdem: totes

13:31 TimMc: arrdem: Only to the extent that portions of the output were present in the GPL'd source.

13:31 * arrdem missed something in the scrollback

13:31 dnolen: example using om w/ #js literals and :include-macros https://gist.github.com/swannodette/7915826

13:32 TimMc: arrdem: If you have a GPL'd parser-generator, it has to output some source code based on templates that are carried in the generator's own source.

13:32 dnolen: all om.dom functions inline into direct React calls, so no overhead for standard use

13:33 * arrdem rolls his eyes but sees the point

13:33 TimMc: I don't know how yacc (or is it bison?) handles that, license-wise.

13:33 seangrove: dnolen: Interesting, the :include-macros cleans up the ns form

13:33 dnolen: seangrove: yep

13:33 arrdem: I suspect that the short answer is nobody cares, or has tried to enforce license over those stubs.

13:34 seangrove: I'd prefer hiccup-style data structures, but that could be overlayed pretty easily

13:34 dnolen: seangrove: and because :include-macros is explicit it doesn't cause unintended madness

13:34 seangrove: sure

13:34 bitemyapp: arrdem: glad I was useful.

13:39 seangrove: overlaid*, goodness

13:41 dnolen: Ah, I see, the :shouldComponentUpdate is where you get most of the speed up from

13:41 #js {} doesn't look too bad actually

13:41 bitemyapp: arrdem: using a GPL'd tool doesn't GPL the output of the tool. The GPL'd code has to live within the output somehow.

13:41 arrdem: it's pretty easy to reason about even if the implications are deep. Think of it like a tangible infection.

13:42 coventry: ~/.lein/indices is taking up over a gig of space. Is that typical?

13:42 clojurebot: Cool story bro.

13:42 bitemyapp: coventry: I don't even have one of those.

13:42 what did you do?

13:42 coventry: bitemyapp: I think it's generated by some command like "lein search"

13:43 bitemyapp: oh.

13:43 I always know what I want ^_^

13:43 danneu: What's the general use-case for using stateful sessions as opposed to Ring's functional sessions?

13:44 gfredericks: classic tradeoff of noise vs magic?

13:46 bitemyapp: danneu: stateful sessions aren't a good idea. Stash state in the request map.

13:46 danneu: dynamic vars aren't async-safe.

13:46 ~dynamicvars are not async-safe

13:46 clojurebot: I don't understand.

13:46 bitemyapp: ~dynamicvars is are not async-safe

13:46 clojurebot: c'est bon!

13:46 bitemyapp: ugly wording. ugh.

13:47 ~dynamic vars

13:47 clojurebot: Cool story bro.

13:47 bitemyapp: ~dynamicvars

13:47 clojurebot: dynamicvars is are not async-safe

13:47 danneu: Ring's functional sessions are refreshing after a rather hellish experience with stateful sessions in a large Rails app

13:47 bitemyapp: wow that is horrific

13:47 danneu: what are the functional sessions exactly?

13:48 I don't really pay attention to what the cool kids use anymore.

13:48 justin_smith: bitemyapp: the session is replaced by the session you return

13:48 rather than being mutated as you go along

13:49 the one gotcha being if you forget to return the session in your response, *POOF* no more session

13:49 otherwise it is perfect

13:49 bitemyapp: lol.

13:49 sritchie: bitemyapp: I went down a serious deploy tools rabbit hole last night

13:49 jesus

13:49 docker

13:49 bitemyapp: sritchie: welcome to my bunny hutch then.

13:49 sritchie: ...are you okay?

13:50 sritchie: :) the docker pitch seems just so, so good

13:50 I'm working on getting a dev environment up with a single "vagrant up"

13:50 and it seemed like separate docker containers for riemann, graphite, nginx, etc was the cleanest way…

13:51 but now I'm degrading, falling back to the simpler thing of little ansible playbooks

13:51 bitemyapp: (all to avoid pallet. sorry dudes.)

13:51 technomancy: being on debian stable is great; no temptation to try out half-baked stuff like that when I'm on a kernel that's too old

13:51 sritchie: bitemyapp: any hot/cold reaction to the buzzwords I'm throwing out, from an experienced bunny hutcher such as yourself?

13:52 seangrove: sritchie: What makes you want to avoid pallet so much?

13:52 justin_smith: technomancy: yeah, I am tempted to upgrade my ubuntu install that shipped with this box to debian stable

13:52 technomancy: doooo eeeet

13:52 sritchie: seangrove: I've actually used pallet quite a bit, but vagrant does the VM thing much better

13:52 bitemyapp: sritchie: I avoid pallet, I don't have much use for containers or stateful images. I automate mechanistically with idempotent composable tasks

13:53 sritchie: if docker makes you happy, cool, but it doesn't save me anything because I don't put multiple apps on a single server in a way that needs containment.

13:53 docker, to my mind, is most useful as an abstraction to cgroups as much as anything else.

13:53 gfredericks: technomancy: I've been using nix for weeks now; no regrets

13:53 bitemyapp: gfredericks: treating you well eh?

13:54 bbloom: bitemyapp: yeah, i have to agree. i'm not sure i understand the fuss about docker. i mean it's pretty great for people building PaaS stuff, but i'm usually only deploying 1 app per host

13:54 gfredericks: I don't understand channels yet, with the result being I don't know how to install older versions of things

13:54 justin_smith: seangrove: my suspicion (and the reason I avoid it) is that because it seems over-architected. Same author as ritz, and I have similar isssues with that design.

13:54 or maybe I am just too stupid to use such tools

13:54 gfredericks: but other than that it does exactly what I want

13:54 bitemyapp: bbloom: well said.

13:54 technomancy: gfredericks: yeah, my experience has been that you don't need to understand too many layers to get it to DWIM

13:54 sritchie: justin_smith: it's very difficult to find my way around their new stuff

13:55 BUT, the code sharing situation isn't great yet in ansible

13:55 bitemyapp: sritchie: in my view of the universe, unless I'm concerned about containment (offering a PaaS to untrusted users that might smack each other around), all I need is automation and the ability to "bootstrap my universe" from my automation code.

13:55 sritchie: just trying to play with all the new tooling and get a feel for how to build this up

13:55 bitemyapp: sritchie: I use Fabric + Cuisine in Python more often than not for this stuff. It is not fancy at all.

13:55 But I write tasks that work, quickly.

13:55 bbloom: bitemyapp: i can see some usefulness for app-per-host containerization, but it's not worth the overhead of yet-another-tool when i'd already need a machine image, some config scripts, etc

13:55 technomancy: ansible doesn't strike me as particularly fancy

13:56 bitemyapp: sritchie: https://github.com/bitemyapp/fabric_recipes examples on my github as usual.

13:56 sritchie: bitemyapp: yeah, that's fair. down the road, I want to get to the point where every feature branch I have for this web app pushes a container to a single server, heroku style

13:56 bitemyapp: technomancy: they went to a lot of trouble to add the MOAR_SPEED mode.

13:56 sritchie: in fact, the dokku project with docker does all of that

13:56 technomancy: hm; yeah this is my uneducated opinion

13:56 bitemyapp: sritchie: buhhhhh. okay but is that really something that impacts users?

13:57 sritchie: haha, no, I don't want to do it now

13:57 bitemyapp: you just really need to automate deployment and provisioning, quick-cheap-now, right?

13:57 sritchie: I want to spin on totally useless tech stack things

13:57 bbloom: it seems to me that virtualization is only ever going to be able to achieve incremental workflow improvements

13:57 sritchie: bitemyapp: yeah, what I really need is a local setup for riemann

13:57 and the ability to bounce a config really quickly

13:57 bbloom: we just need better tools that are built for isolation from the start

13:57 sritchie: then push that up to an EC2 instance and forget about it

13:57 bitemyapp: sritchie: that's how I use my fabric scripts.

13:57 bbloom: the go folks seem to understand that, and so they just cheat (in a great way) by doing fully static linking :-P

13:57 hiredman: mesosphere!

13:58 bitemyapp: bbloom: native Haskell is statically linked dontchaknow.

13:58 dynamic linking was probably one of those billion dollar mistakes.

13:59 bbloom: bitemyapp: yeah, i think we need to differentiate between late & dynamic linking. late linking is an implementation detail. dynamic linking is a bad idea :-P

13:59 late, but not dynamic, doesn't seem to exist anywhere i know of tho

13:59 stompyj: infrastructure and deployment is a ridiculously exciting area of innovation right now

13:59 bbloom: i want to link against a SHA1 :-)

13:59 bitemyapp: bbloom: late linking doesn't meaningfully exist, you know that.

14:00 a reminder that https://github.com/winterTTr/ace-jump-mode exists

14:00 bbloom: this reminds me: guys. we need to start saying that clojure is "Latently typed" instead of dynamic :-)

14:01 bitemyapp: ,(nil [:muh-data])

14:01 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>

14:01 bitemyapp: smart-ass compiler is a smart-ass.

14:02 ,(let [my-fn nil] (my-fn [:muh-data]))

14:02 clojurebot: #<NullPointerException java.lang.NullPointerException>

14:02 bitemyapp: bbloom: looks dynamically typed to me.

14:02 mdrogalis: bitemyapp: Google something trivial for me. :P

14:02 bitemyapp: mdrogalis: wutcha need?

14:02 bbloom: bitemyapp: dynamic implies, to me, change over time

14:02 mdrogalis: bitemyapp: How do I upgrade Leiningen?

14:03 bitemyapp: mdrogalis: lein upgrade

14:03 mdrogalis: Gotta keep you sharp.

14:03 You didn't Google that

14:03 bitemyapp: mdrogalis: didn't have to.

14:03 bbloom: bitemyapp: i think you'd agree that clojure types are dramatically less dynamic than ruby or python :-P

14:03 mdrogalis: This was a sad exercise :|

14:03 bitemyapp: ,(let [x "woohoo!"] (println (type x) (let [x 100] (println (type x)))

14:03 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

14:03 bitemyapp: ,(let [x "woohoo!"] (println (type x)) (let [x 100] (println (type x)))

14:03 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

14:03 bitemyapp: ,(let [x "woohoo!"] (println (type x)) (let [x 100] (println (type x))

14:03 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

14:03 bitemyapp: ,(let [x "woohoo!"] (println (type x)) (let [x 100] (println (type x))))

14:03 clojurebot: java.lang.String\njava.lang.Long\n

14:04 seangrove: Don't worry, we'll all wait for you to get it right bitemyapp

14:04 bitemyapp: bbloom: looks dynamically typed to me.

14:04 seangrove: I blame the PARENS

14:04 seangrove: typing lisp code in irssi is tedious.

14:04 seangrove: bitemyapp: Too many of 'em, I'd say. I prefer bangs instead

14:04 bitemyapp: !:a {:a 1}! => 1

14:04 seangrove: I like the way you think. It can feel like writing Spanish.

14:04 seangrove: See? So much more legible!

14:04 bitemyapp: !AVISO!

14:05 justin_smith: ¡FTFY!

14:06 gfredericks: bbloom: you're saying ruby/python are dynamic (as in "change over time") because the type definitions themselves are dynamic?

14:06 rather than an object being able to change its type, which afaik is not the case

14:07 seangrove: gfredericks: Oh, that'd be cool though. I wonder how it'd be abused.

14:07 tbaldridge: gfredericks: oh you can soooo change a type in python

14:07 bbloom: gfredericks: a bigger issue is variables

14:07 gfredericks: a variable's type can change when the value in that variable changes

14:07 gfredericks: tbaldridge: python I know less about

14:08 bbloom: okay so they're dynamic by virtue of having untyped local variables, which clojure doesn't?

14:08 tbaldridge: gfredericks: each object in Python has a __class__ attr. Change that to change the class type

14:09 gfredericks: tbaldridge: that's the grossest thing I've heard all day

14:09 justin_smith: that's basically how transients work

14:09 arohner: bbloom: I've been threatening for a while to start SHA1'ing the macroexpanded source of my fns

14:09 bbloom: gfredericks: that's one thing. the word dynamic implies change to me. i was just discussing with dnolen how clojure's vars are ALL dynamic variables. the :dynamic keyword is a misnomer, it really means :threadlocal

14:09 justin_smith: flag on the data structure

14:09 bbloom: arohner: hash all the things!

14:09 arohner: and then serialize all the things!

14:10 technomancy: eh; dynamic can apply to scope, not just type

14:10 bbloom: technomancy: yeah, that was about scope. i think the word dynamic invokes a notion of time

14:11 which implies a notion of chnage

14:11 gfredericks: ,(letfn [(f [x] (println (type x)))] (f "foo") (f :bar))

14:11 clojurebot: java.lang.String\nclojure.lang.Keyword\n

14:11 seangrove: bbloom: You thinking along the lines of stuartsierra's article?

14:11 bbloom: which?

14:11 seangrove: http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope

14:11 dynamic vs indefinite extent

14:12 bbloom: well now we're getting in to a discussion of scope :-P

14:12 seangrove: bbloom: Well, I think the idea of extent was interesting, emphasizing time/when

14:13 bbloom: yeah, extent is a scope construct. it's like the area of influence of a binding

14:13 dynamic extent is binding in time

14:13 lexical extent is binding in space

14:13 * seangrove considers reverting back to qbasic

14:14 seangrove: Never had any of these problems as a kid.

14:17 * gfredericks started with TI-BASIC where all variable names were 1-letter long

14:18 gfredericks: oh man and they were system-globals too, not just process globals; why can't we have more languages like that.

14:18 bitemyapp: I started with GW-BASIC.

14:18 pretty depressing language.

14:19 justin_smith: gfredericks: that is still how haskell does it, makes naming so much easier when you are limited to one letter

14:19 and with unicode you won't run out of identifiers either

14:19 tbaldridge: got my start there as well. then on to qbasic, then DJGPP

14:19 BobSchack: Anyone here familiar with fressian? I'm writing a JS port and trying to figure out what to do with Longs since JS only has 32 bit ints

14:19 bitemyapp: justin_smith: beg-pardon?

14:19 justin_smith: ahh, djgpp, have not seen that character sequence in so long

14:19 tbaldridge: :-)

14:20 bitemyapp: BobSchack: stringify.

14:20 alandipert: TI-BASIC was a nice language but i found it too academic, people only write it in school

14:20 justin_smith: bitemyapp: teasing about the idiomatic usage of one-letter names in so much haskell code

14:20 gfredericks: my program's README was a piece of folded notebook paper with pencil scribbles on it explaining what each variable was for

14:20 bitemyapp: justin_smith: you can eliminate this complaint by writing point-free code and not naming variables at all.

14:21 justin_smith: much like my preferred solution to, "there are gendered pronouns in the documentation" --- "we now have no documentation"

14:22 justin_smith: not a complaint, a tease, I use one letter names for things with short scope of usage myself

14:23 bitemyapp: justin_smith: you've got me curious, checking my code to see what that looks like.

14:23 stuartsierra: I remember djgpp!

14:24 bitemyapp: I see, db-uri, query, limit, offset, args, paginated, num-results, services, request.

14:24 kw, extant, ensured, new-reg.

14:25 * gfredericks tries to imagine a programming language with true globals, that have only one value everywhere

14:25 coventry: You should implement it in swearjure.

14:25 justin_smith: gfredericks: assembly, the variable names are address offsets :)

14:26 gfredericks: bitemyapp: that must be clojure code; haskell doesn't have anything nearly as sophisticated as dashes in names

14:26 justin_smith: it's still local to a particular machine

14:26 bitemyapp: gfredericks: right, that's the example I pulled from. Clojure.

14:26 justin_smith: ahh! universal variable bindings

14:26 bitemyapp: gfredericks: specifically from berossus which I just open sourced.

14:26 gfredericks: $google github berossus

14:27 lazybot are you still trying to make a large set for me

14:27 justin_smith: he'll google it for you, but only if it isn't his own project

14:27 bitemyapp: https://github.com/bitemyapp/berossus

14:27 gfredericks: REST API wrapper for Datomic.

14:28 gfredericks: bitemyapp: oh so you don't have to futz with the HTTPs?

14:28 hiredman: gfredericks: dns?

14:29 gfredericks: hiredman: hey that's a good idea; DNS as a language platform

14:29 bitemyapp: gfredericks: roughly. Their REST API (Datomic's built-in) didn't make me happy.

14:29 justin_smith: bitemyapp: the readme claims that what the project does is up to me. I have decided it is a hot-or-not clone implemented in rails

14:29 gfredericks: DotComJure is a clojure-like lisp that runs on DNS

14:29 bitemyapp: gfredericks: we're making a Python OEM for Datomic.

14:29 which will also be open sourced.

14:29 hiredman: vllm: very large lisp machine

14:30 gfredericks: the helloworld involves godaddy

14:30 and costs anywhere between $50 and $500 depending on whether you minify your code first

14:32 coventry: If you want them to be truly global, you need some kind of reconciliation framework to deal with network partitions. The bitcoin ledger is probably a better platform.

14:33 bitemyapp: coventry: bitcoin has a built-in script language.

14:33 of sorts.

14:33 justin_smith: ooo - maybe bitcoin itself could be leveraged as the vm

14:33 hiredman: I wonder if anyone has tried to grab .lisp from icann

14:33 justin_smith: later upgrading to bytecoin and shortcoin as scaling becomes neccessary

14:34 bitemyapp: you guys are in a really weird mood today.

14:34 technomancy: .paren

14:34 bitemyapp: "today"?

14:35 justin_smith: I crashed my bicycle on black ice today and did a belly flop on the asphalt, I am always a little loopy after things like that

14:36 bitemyapp: justin_smith: :(

14:37 justin_smith: I survived with some bruises and some bicycle repairs needed

14:42 bitemyapp: justin_smith: well I hope the repairs are minimal.

14:42 justin_smith: and that you didn't crack a rib.

14:43 justin_smith: thanks

15:09 TimMc: gfredericks: TI-89 BASIC was my first programming language.

15:10 You could actually put the global vars in different "folders", so there's that.

15:10 Data composition was achieved via stringified arrays inside other arrays.

15:10 justin_smith: sounds like how tcl does "namespaces"

15:11 TimMc: Oh, but you had to like... switch to the other folder before saving.

15:11 justin_smith: (for the folders thing that is)

15:11 TimMc: I was half-way to reinventing OOP before someone got me started learning Java.

15:12 justin_smith: heh, I did something similar (and totally incompetantly) with c++ and inventing fp, before discovering common lisp

15:21 amalloy: TimMc: haha, that happened to me too. invented objects on the ti-89, with methods as strings. i forget how parameter passing worked; i think i did replacement on the string $1 as first arg, or something

15:24 TimMc: amalloy: I was trying to turn the calculator into a PDA. Did you have a grand project as well?

15:24 amalloy: game programming

15:25 TimMc: *nod*

15:25 I got partway through writing Mancala (2-player over the link cord) before getting fed up.

15:26 I still have that calculator; it's at least 15 years old at this point.

15:27 amalloy: the link cord was such a pain that it was easier to just pass the calculator back and forth

15:29 danneu: Is there an example of http://yogthos.github.io/lib-noir/noir.validation.html usage?

15:29 TimMc: amalloy: There was also the lack of friends.

15:30 (Well, friends with TI-89s...)

15:46 malbertife: join #lisp

15:46 danneu: oh yeah, i can read source

15:46 mdrogalis: malbertife: The irony is that you're already there.

15:48 malbertife: mdrogalis: :)

15:49 bitemyapp: why do I have to install ansi-terminal to use a concurrency library?

15:49 `cbp: wat

15:49 bitemyapp: `cbp: Iuno. LVars be weird yo. How are you doing?

15:50 `cbp: trying to finish work stuff so i can be useful and finish revise :(

15:53 gfredericks: http://marmalade-repo.org/packages/cider-0.4.0.tar => "Don't have any version of cider.tar"

15:54 bitemyapp: `cbp: don't sweat it! Life stuff is more important than open source.

15:54 `cbp: if you need any help, ping me.

15:54 gfredericks: TimMc: I seriously doubt my TI-83 had folders for variables

15:55 danneu: i like this validation lib https://github.com/logaan/vlad

15:55 gfredericks: amalloy: I think I got a function link-cable version of hangman working; it was tedious and was not once used for pleasure

15:55 functional*

15:56 the funnest thing I ever wrote was A) a snake game, and B) a version that played by itself

15:56 TimMc: My minesweeper game took like... 30 seconds to display a move.

15:56 gfredericks: once I collected 12 calculators and ran the auto snake program on all of them simultaneously like a horse race

15:56 * gfredericks has no regrets

15:56 amalloy: gfredericks: actually the 83 sooooorta had folders for variables. you could use lists: each list gets a 4-character name, and can hold 0+ numbers

15:56 TimMc: haha, nice

15:57 emaphis`: hmm. my first programming language was HP-41 RPN

15:57 Hi, gfredericks

15:57 amalloy: or maybe that was an 83+ feature

15:57 gfredericks: amalloy: yeah I definitely used the heck out the lists

15:58 I had an 83+

15:58 I kept having to manage archival to fit all the programs/lists in memory

15:58 emaphis`: hi

15:59 technomancy: gfredericks: argh @ marmalade

15:59 node.js breakage

15:59 gfredericks: marmalade runs on node?

16:00 technomancy: it is one of the great tragedies of our day =(

16:02 gfredericks: marmalode

16:03 emaphis`: spreadable javascript.

16:03 gfredericks: I have this kids book called "Hop Toad" that seems to be mostly based on the phonetics of the word "toad" and I think maybe from now on I will probably think of it as "Hop Node"

16:04 the primary conflict in the book is that the node.js almost gets run over by a truck while crossing the road

16:05 does node.js have a mascot yet? this one might work: http://www.amazon.com/Hoptoad-Jane-Yolen/dp/0152163522

16:06 emaphis`: Frogger?

16:07 marcopolo2: gfredericks: I always imagined this to be the mascot for node http://nodedublin-2012-strapping-turtles-to-rockets.jit.su/img/node_turtle.png

16:07 TimMc: That looks pretty unbalanced.

16:08 I'm no rocket scientist, but I did play one at summer camp.

16:08 gfredericks: the book does have a turtle in it as well

16:08 marcopolo2: I'm no rocket scientist, but I'm pretty good at Kerbal Space Program

16:09 TimMc: gfredericks: I'm sold.

16:09 gfredericks: also contains the line "Toadal disaster"

16:09 marcopolo2: gfredericks: hahaha

16:10 TimMc: My partner jokes that I'm not interested in movies unless they have animals in them. I think this might be true.

16:10 gfredericks: nodal disaster?

16:11 marcopolo2: anyone here in North Florida?

16:12 emaphis`: North Ohio.

16:13 marcopolo2: You can take I-75 and get here in an hour

16:13 + some days...

16:13 gfredericks: North chicago?

16:13 everybody list what you're north of!

16:13 emaphis`: not from Ohio.

16:14 marcopolo2: emaphis`: I must be thinking of cincinnati

16:15 emaphis`: marcopolo2: I'd guess closer to two hours. :-)

16:15 maybe three.

16:17 TimMc: gfredericks: -east.

16:17 -east US, specifically

16:20 gfredericks: clojure not having a *rand* is rather annoying

16:21 is there any reason it shouldn't?

16:21 has that been proposed before?

16:22 marcopolo2: gfredericks: what would *rand* do?

16:22 set the seed for the rng?

16:22 gfredericks: it would _be_ the java.util.Random that all the built in rand functions use

16:31 bitemyapp: gfredericks: northern california

16:31 gfredericks: north of Hell A

16:32 seangrove: North of my monitors.

16:34 justin_smith: north of a bread factory, south of a 20 foot tall wooden teepee with an imac in it

16:35 bitemyapp: north and south are kinda relative if you allow looping around the spheroid.

16:35 just like west and east

16:35 gfredericks: what?

16:35 clojurebot: what is wrong with you

16:36 bitemyapp: is california really the "west"? We call Japan/China/etc the Far East, and California the west coast

16:36 but California is east of Japan

16:36 marcopolo2: clojurebot: nice

16:36 clojurebot: Pardon?

16:36 gfredericks: north/south have poles though

16:36 bitemyapp: gfredericks: and west/east have the date line.

16:36 so a point vs. a line

16:37 how is crossing and looping past the point any more meaningful than crossing a line?

16:37 gfredericks: well the line is physically arbitrary

16:37 bitemyapp: violating the commonly held understanding of west/east crosses a higher dimensional barrier than north/south would.

16:37 the poles are physically arbitrary too

16:37 gfredericks: the planet rotates

16:38 bitemyapp: why base north/south on that? why not the magnetic poles instead?

16:38 it would make instrumentation more accurate.

16:38 indigo: (inc bitemyapp)

16:38 :3

16:39 seangrove: It would be lovely if IMAP let me retrieve a single message efficiently

16:39 bitemyapp: indigo: I'm glad to see my nihilism appeals to you.

16:39 seangrove: how do you identify a single message?

16:40 seangrove: bitemyapp: With gmail's proprietary extension X-GM-MSGID

16:40 gfredericks: bitemyapp: less variance?

16:40 indigo: bitemyapp: http://cravencottagenewsround.files.wordpress.com/2008/07/nihilists.jpg

16:40 gfredericks: in any case arbitrarily choosing between two reasonable alternatives is a different scale from arbitrarily choosing from a continuous range of options

16:40 bitemyapp: gfredericks: variance from what? you can't find true north with a compass.

16:40 emaphis`: the magnetic poles shift over time.

16:41 bitemyapp: seangrove: but absent that, how?

16:41 emaphis`: so?

16:41 seangrove: bitemyapp: Fix IMAP?

16:41 emaphis`: not a good standard for north/south

16:41 bitemyapp: emaphis`: an arbitrary projection is no less for arbitrary when it is based on fixed as opposed to moving points.

16:41 gfredericks: bitemyapp: do you use a compass to find things?

16:41 seangrove: And by fix, I mean lay on a some standardized extensions

16:41 bitemyapp: emaphis`: good is based on a set of priorities.

16:42 seangrove: I'm not totally convinced IMAP shouldn't be replaced with a federated database.

16:42 seangrove: since that's basically all it is.

16:42 emaphis`: On priority is having a north that doesn't move.

16:42 seangrove: I don't *think* IMAP is totally broken, but it would be nice if it had continued to evolve

16:42 bitemyapp: emaphis`: that can work if you're okay with not using compasses to find north.

16:43 gfredericks: bitemyapp: can you find the date line with a compass?

16:43 bitemyapp: seangrove: I think it's built on the wrong assumptions and will not be fixed.

16:43 gfredericks: no, but unless you memorize location-dependent offsets, you can't find true north with a compass either.

16:43 seangrove: bitemyapp: Please elaborate, as you continue two simultaneous conversations :)

16:43 gfredericks: bitemyapp: I never said you could

16:43 bitemyapp: seangrove: like I said IMAP is basically just a federated database

16:44 seangrove: with "targeted" replication.

16:44 gfredericks: bitemyapp: my point was that not being able to find something with a compass doesn't make it useless; and having a fixed standard seems more useful than compass-findfulness

16:44 bitemyapp: gfredericks: only because you live in a world with GPS.

16:45 gfredericks: you don't?

16:45 bitemyapp: gfredericks: I'm preparing for the zombie apocalypse. satellites fall eventually.

16:46 gfredericks: okay, my apologies for the noise everybody

16:46 indigo: bitemyapp: Big fan of mechanical watches? ;)

16:46 bitemyapp: gfredericks: sorry!

16:46 indigo: wind-up.

16:46 indigo: :D

16:59 stompyj: hey all, beginner question here. If I need to fork a library, but I don't want to publish it to clojars or something along those lines, in order to reference it in my dependencies... what's the best way to go about that?

16:59 (or better yet, what should I be reading to help me figure it out)

17:00 bitemyapp: stompyj: install locally or publish to private maven repo.

17:00 stompyj: `lein install` is a thing.

17:00 stompyj: thanks, I'll check that out

17:00 coventry: You can publish it to clojars under a personal namespace. http://clojars.org:8001/org.clojars.coventry/tools.reader

17:01 bitemyapp: coventry: that still dirties up the search results, doesn't it?

17:01 technomancy: org.clojars.* should be ranked below everything else in search results

17:01 Jarda: hey

17:02 bitemyapp: technomancy: cool, good to know.

17:02 technomancy: but if it's literally for one person, `lein install` is best

17:02 Jarda: (my-function "foo" "bar") and (my-function "foo" [1 2 3])

17:02 how should I differ with these two?

17:02 stompyj: technomancy: bitemyapp: perfect. thanks guys

17:03 Jarda: can I even overload functions by their type?

17:03 technomancy: pattern matching

17:04 bitemyapp: Jarda: case type

17:04 Jarda: ok thanks

17:05 coventry: Jarda: clojure.walk and clojure.walk2 have good examples.

17:06 bitemyapp: certainly better examples than my code.

17:27 devn: Anyone here deploy a caribou app to heroku yet?

17:28 justin_smith: ^

17:28 technomancy: devn: if it uses ring it should be the same as anything else

17:28 justin_smith: I know patchwork has, at least as a proof of concept

17:28 patchwork: any wise words on caribou/heroku?

17:29 we have seen hiccups with our default max mem and the default heroku app size

17:29 so you may need to bump down the mem asked for

17:30 patchwork: devn: We have had someone successfully deploy to heroku, yes

17:30 Are you having an issue?

17:31 devn: well, im helping a coworker

17:31 he's not using a Procfile AFAICT

17:31 Here was his error: 2013-12-11T22:09:26.480017+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

17:31 patchwork: There were two small changes necessary which I'm integrating back into the caribou template

17:32 technomancy: devn: try an uberjar

17:32 devn: He also dropped some fns into the production.clj

17:32 which strikes me as odd since there's no ns associated with it

17:32 technomancy: what is production.clj?

17:32 patchwork: devn: Ah, yeah production.clj is just for config, he should be modifying core.clj

17:32 justin_smith: devn: he can try production.clj locally: env _JAVA_OPTIONS=-Denvironment=production lein ring server

17:33 technomancy: caribou environment specific config file

17:33 technomancy: don't do lein ring server

17:33 patchwork: technomancy: Why is that?

17:33 technomancy: patchwork: build an uberjar, or if you can't do that, use trampoline

17:33 justin_smith: technomancy: I am telling him to do lein ring server locally

17:33 with prod config

17:33 technomancy: oh gotcha

17:33 justin_smith: not lein ring server on prod

17:33 patchwork: (though I have been migrating over to httpkit lately)

17:33 devn: justin_smith: so don't drop the jvm opts?

17:34 technomancy: I still don't get the point of lein ring, but if that's what you like it's fine for local stuff

17:34 justin_smith: well try that too :) I think 512 is the limit for the default heroku

17:34 technomancy: 512 is the total limit; the heap needs to be smaller

17:34 dav: hi again

17:34 ns some.Example (:gen-class)) (defn -tryThis [this] "yo") (ns user) (.tryThis (some.Example.))

17:34 technomancy: and 2x dynos get you 1024

17:34 dav: produces a classNotFound exception..

17:34 patchwork: devn: Actually technomancy is right, heroku uses the -main function, so > lein run would be a better simulation of the heroku environment

17:34 dav: any thouhgts?

17:35 justin_smith: technomancy: if you have a reason not to do it locally I am all ears, but it has been our standard MO for running locally

17:35 technomancy: patchwork: heroku uses whatever you tell it to, but all the docs suggest -main =)

17:35 patchwork: justin_smith: I have been using > lein run lately

17:35 dav: does gen-class not work from the repl?

17:35 patchwork: which runs httpkit in the latest template

17:35 TimMc: dav: You probably need to :import the class in the second namespace.

17:35 justin_smith: well then I will too

17:35 * justin_smith hops on the wagon.

17:36 technomancy: justin_smith: -main is just the standard entry point for clojure applications across the board. I don't see the point of introducing a new way to start apps just because they're web apps.

17:36 normalization, and all that

17:36 bitemyapp: if one more person typedefs a function pointer in C and says, "look ma, FP!" I am going to just die

17:36 patchwork: technomancy: That makes sense, we used lein ring server before to avoid directly referencing jetty anywhere

17:36 technomancy: dav: gen-class requires AOT. you can do it from the repl with clojure.core/compile, but it's kind of cumbersome.

17:37 devn: justin_smith: patchwork: I'm trying to connect to postgres on heroku. :database needs more than just the uri, it needs it split up

17:37 so the functions he wrote were for splitting up the heroku env's postgres URL and putting it into the map

17:38 so now he has a function call in that production.clj

17:38 dav: technomancy: does that mean I can't put the gen-class in the same clj file that's going to be using it?

17:38 technomancy: dav: no that should be fine as long as you precompile it

17:39 patchwork: devn: Ah, interesting. Yeah that should probably go in boot.clj (that is where the config is loaded and the app is initialized).

17:39 devn: Yeah I have not used heroku with postgres so I haven't run into this issue

17:39 We can provide a function to generate the caribou config from the string heroku provides

17:40 technomancy: devn: why doesn't the string config work?

17:40 devn: technomancy: he was just matching the way caribou was expecting it

17:40 technomancy: dav: I'm not sure if AOT works with namespaces that don't have files behind them.

17:40 patchwork: technomancy: Our db config is in a map, and it constructs the string out of that. We should probably support both since the string approach would be more direct

17:41 devn: :database {:host "..." :protocol "..."}

17:41 patchwork: yeah, that would make it way easier

17:41 technomancy: argh

17:41 yeah I patched c.j.jdbc specifically to fix that

17:42 devn: patchwork: so in boot.clj you're saying, what? to assoc on :database with the result of splitting the URI up?

17:43 dav: technomancy: ok I'll try around a bit

17:43 technomancy: thx

17:43 patchwork: devn: Added to the list!

17:43 technomancy: np

17:43 justin_smith: devn: that can be done in boot.clj

17:43 patchwork: devn: Yep, that should do the trick

17:43 justin_smith: that is where the config is generated from the config

17:43 *from the env.clj

17:45 I ran into similar issues when I added c3p0 connection pooling support (which totally works in a branch btw).

17:45 regarding caribou.model's conservative expectations of db config layout

17:45 devn: patchwork: justin_smith: so this confuses me a bit then. does this mean I need to check my env in boot.clj then?

17:46 what happens to the production.clj config?

17:46 justin_smith: devn: that is the source data file

17:46 boot.clj merges that with some defaults

17:46 based on env

17:46 then makes it the operating config

17:46 so anything other than static edn data should happen in that file

17:46 patchwork: devn: In the config/config-from-environment call it merges in the config from whichever environment you are running in (production, staging, development etc)

17:47 So boot.clj has the global config settings, which is supplemented by config from specific environments

17:48 technomancy: You patched c.j.jdbc to enable database strings rather than maps?

17:48 technomancy: patchwork: right

17:48 patchwork: I will have to check out the latest version

17:48 technomancy: this was a long time ago

17:48 maybe before 0.2.0 or 0.2.1

17:48 justin_smith: technomancy: awesome

17:49 patchwork: but we should be more flexible anyway, for pooled data, or nosql, datomic when we add support for those

17:49 devn: patchwork: so this is the rub then

17:49 patchwork: justin_smith: Agreed, it is really just a relic of the format of c.j.jdbc when I started this project two years ago

17:49 devn: patchwork: if that's true, then modifications i make to local-config will be overwritten if production.clj specifies :database

17:50 so I guess I need to drop :database from that config file

17:50 justin_smith: devn: you can check config/environment in boot.clj

17:50 patchwork: devn: Check out the let form, config/config-from-environment happens last

17:50 dav: technomancy: do I have to do lein build or something for AOT prior to jumping into the REPL?

17:50 justin_smith: and act conditionally on whether it is "production"

17:50 patchwork: devn: So you can just add an extra binding under that that modifies it further

17:51 technomancy: dav: put :aot [my.genclass.ns] in project.clj

17:51 devn: patchwork: yeah, did that, now it's blowing up for a different reason, probably not related to caribou. more likely his expectation that we have a heroku env var set.

17:51 patchwork: devn: post the stacktrace on a paste somewhere

17:51 dav: technomancy: ah cool.

17:52 patchwork: devn: like refheap or something

17:52 bitemyapp: ,(set (mapcat (comp merge set keys) [{:a 1} {:b 0} {:c 3 :d 1}]))

17:52 clojurebot: #{:a :c :b :d}

17:52 bitemyapp: anybody got a way to clean that up?

17:52 my solution with "into" was dirtier.

17:54 ,(mapcat (comp merge keys) [{:a 1} {:b 0} {:c 3 :d 1}])

17:54 clojurebot: (:a :b :c :d)

17:54 bitemyapp: improvements from a coworker

17:55 danneu: would've expected ring.util.response/redirect to handle URI instead of just a string

17:55 patchwork: ,(set (mapcat keys [{:a 1} {:b 0} {:c 3 :d 1}]))

17:55 clojurebot: #{:a :c :b :d}

17:55 ztellman: bitemyapp: what does merge do here? the result is the same with out

17:55 `cbp: [{:a 1} {:b 0} {:c 3 :d 1}]

17:55 err

17:55 well patchwork had what i wanted to paste

17:55 patchwork: bitemyapp: Do you want a set or a list back?

17:56 bitemyapp: ztellman: to uniqify. Should that be done at the end?

17:56 patchwork: doesn't even really matter, it's just for a unit test, wanted to query all unique keys across a coll of maps.

17:56 ztellman: I didn't even know you could call merge on something which isn't a map

17:56 I'm pretty sure you're not meant to

17:57 TimMc: &(merge 5)

17:57 ztellman: patchwork's answer is the right one, you could get away with 'distinct' if you don't care about the set-ness

17:57 TimMc: nullbot

17:57 ,(merge 5)

17:57 clojurebot: 5

17:57 `cbp: oh goodness

17:57 ztellman: TimMc: that's probably identity no matter what

17:57 TimMc: *nod*

17:58 ztellman: ah, so that's why it's working

17:58 though apparently this is possible:

17:58 ,(merge #{1} #{2})

17:58 clojurebot: #{1 #{2}}

17:58 `cbp: =(

17:58 dav: technomancy: so I did this: http://paste.debian.net/70441/

17:58 TimMc: lolwut

17:58 ,(merge #{1} #{2} #{3} #{4})

17:58 clojurebot: #{1 #{2} #{3} #{4}}

17:58 justin_smith: ,(last (take 500 (iterate merge merge)))

17:58 clojurebot: #<core$merge clojure.core$merge@d46b95>

17:59 ztellman: merge just calls conj, apparently

17:59 dav: Compiling test-xlloop.methods

17:59 technomancy: lein repl prints: Compiling test-xlloop.methods

17:59 ztellman: ,(apply merge [] (range 5))

17:59 clojurebot: [0 1 2 3 4]

17:59 dav: technomancy: but once in the repl I can't get my hands on the class test-xlloop.methods

17:59 ztellman: I'm never using into again

18:02 TimMc: I don't suppose merge uses transients, though...

18:03 bitemyapp: TimMc: it's mostly reduce and conj with some boolean checks AFAICT

18:05 good to see being untyped leads to !FUN!

18:05 devn: patchwork: https://www.refheap.com/b1edceb8c7610770d5f73762e

18:05 bitemyapp: ztellman: don't like transients? :P

18:06 devn: patchwork: something tells me that the default method of running migrations by specifying resources/config/production.clj is not going to work given there is no :database key/val in there.

18:06 ztellman: bitemyapp: it seems like merge should use transients and assoc!, but apparently it doesn't

18:08 devn: patchwork: it also seems funky that it's booting an nrepl server in production

18:08 justin_smith: is that really the default?

18:08 * justin_smith is tempted to take that out right now.

18:10 devn: doo itttt :)

18:10 patchwork: devn: Ah, that is editable in the config

18:10 Just take out the :nrepl line

18:10 I'll fix the production config in the template

18:11 justin_smith: patchwork: is boot.clj run for the config when running migrate? or will that be a future thing

18:11 devn: what about running migrations on heroku?

18:11 patchwork: Ah! I already have, it has just not been released : )

18:11 justin_smith: you can run a migration inside the app - you could make a version that just boots and runs the migration (though that is a total hack)

18:11 devn: :)

18:12 patchwork: devn: If your config points to your database, you can run the migration locally

18:12 devn: patchwork: right, but as we discussed earlier it can't

18:12 because that env var lives on heroku

18:12 patchwork: devn: Ah, so you have no access to the db info at all?

18:12 Strange

18:13 technomancy: any reason not to migrate as part of app boot?

18:13 should be quick to check for needed migrations

18:14 patchwork: technomancy: We have talked about it. More just that we don't want to surprise people by automatically running migrations if they didn't intend it

18:14 devn: patchwork: nono, let me explain -- (System/getenv "HEROKU_POSTGRESQL_PURPLE_URL") returns a string: "postgres://blah:blah@foobarbaz.com" -- there are some user-defined fns in boot.clj which split that up into a map and assoc it onto the local-config

18:14 patchwork: But maybe it does make sense

18:14 bitemyapp: ztellman: strange that it doesn't, I would've guessed that it did.

18:14 technomancy: patchwork: oh I don't think the framework should, but as an app author it's a decision you could amke

18:15 patchwork: devn: Understood, but couldn't you log out that string once you receive it?

18:15 bitemyapp: technomancy: we migrate as part of app deploy, not boot.

18:15 patchwork: Or is there a reason the db information is kept from you?

18:15 bitemyapp: technomancy: I don't think boot is a good idea, but deploy seems fine.

18:15 devn: patchwork: so i get the string and then you're saying to do what with it?

18:15 ztellman: bitemyapp: I would have put money on it, before I actually checked

18:15 technomancy: bitemyapp: we have a pretty big pile of reasons not to expose runtime config during build

18:16 patchwork: devn: (println (System/getenv "HEROKU_POSTGRESQL_PURPLE_URL"))

18:16 and check the logs

18:16 Otherwise yeah, you can do as technomancy suggested and trigger pending migrations on boot

18:16 devn: i dont see what that buys me for running migrations if the only way to currently run them is by specifying resources/config/production.clj

18:17 short of hand-editing that file

18:17 patchwork: But I would feel safer about running them directly. Sorry I've never had a db I couldn't connect to directly, it makes the neckbeard in me uncomfortable

18:17 bitemyapp: ztellman: me too

18:18 patchwork: devn: You could make a new config that just has the remote db info

18:18 bitemyapp: technomancy: okay, then in a heroku context, that's not a good idea.

18:18 technomancy: I'd do it as a separate, ran locally, part of the deployment then.

18:18 not on heroku

18:18 technomancy: bitemyapp: it would if we had a step between build and release, but we currently don't

18:18 we should though

18:18 patchwork: devn: Then do > lein caribou migrate resources/config/local.clj

18:18 where local.clj is pointing to the remote heroku db

18:18 devn: patchwork: patchwork oh you're saying do this from my /local machine/!

18:19 patchwork: devn: Yeah!

18:19 devn: whooosh

18:19 patchwork: But maybe you can't even connect to the heroku db locally

18:19 devn: yeah of course that'll work

18:19 patchwork: which is a possibility

18:19 devn: nono i should be able to

18:19 patchwork: Okay

18:19 devn: running migrations on deploy would be preferable in my case i think

18:19 but this will at least get it running out in space

18:19 patchwork: devn: Yeah I see that now

18:19 haven't come across that before!

18:20 This is why caribou is still alpha ; )

18:21 devn: It will improve because you are using it ways we have not anticipated, so thanks!

18:22 dav: I must be missing something very simple :(

18:24 (1) I've put a trivial (ns :gen-class) in a myclass.clj (2) I've added :aot [test-proj.myclass] in project.clj (3) lein repl compiles myclass (4) java.lang.ClassNotFoundException anytime I try to do anything with myclass.. please help?

18:27 bitemyapp: technomancy: realistically it can (and should most cases) just happen in the customer's deploy script before they git push heroku master

18:28 amalloy: dav: not enough information to diagnose a problem. try gisting the relevant code

18:28 bitemyapp: technomancy: but I guess the whole point of your company is that they not need to have a deploy script other than gphm huh?

18:28 technomancy: bitemyapp: well, with tests it becomes more complicated. you want a pipeline.

18:28 I think some folks hook it up to circleci &c

18:29 devn: patchwork: no dice still, fails to connect, but it is connectable.

18:29 technomancy: but we don't do enough to make that easy ATM

18:29 dav: amalloy: code is at http://paste.debian.net/70441/

18:29 devn: patchwork: you should try out what im doing just to get a feel for the herku deployment situation. im just taking the stock example app and trying to get a deploy to heroku with postgres as the db.

18:30 patchwork: devn: Right, I have used postgres with caribou, and heroku with caribou, but not postgres AND heroku with caribou

18:31 I have added it to the list, should be straightened out in the next release

18:32 devn: patchwork: patchwork Exception in thread "main" org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "xxx.xxx.xxx.xxx" user "xxx" password "xxx"

18:32 gah sorry for the double nick again, force of habit

18:32 patchwork: devn: That is locally?

18:32 devn: yeah, using the postgres connection details on the heroku postgresql addon page

18:33 patchwork: So can you log into the remote heroku psql db from your local machine directly?

18:34 technomancy: dav: needs to include the caller

18:34 dav: technomancy: what do you mean ?

18:34 devn: patchwork: should be able to. i've done it before.

18:34 technomancy: dav: the part that's actually failing

18:35 is not in the paste

18:35 dav: technomancy: I'm just typing (test-xlloop.methods.) in lein repl

18:35 patchwork: devn: That looks like a host issue, which would mean your host is not authorized to access the db

18:35 Try it and let me know

18:35 if you can do it directly, you should be able to do it through jdbc

18:36 devn: yeah, im going to take a break -- but ill test it with straight jdbc to be sure

18:36 patchwork: devn: Cool, yeah I'll improve the heroku story here

18:37 technomancy: dav: oh gotcha. does the .class file exist in target/classes?

18:38 patchwork: devn: Beyond connecting through jdbc, let me know if you can connect with psql!

18:39 devn: patchwork: https://devcenter.heroku.com/articles/heroku-postgresql#external-connections-ingress

18:39 im guessing it has to do with sslmode=require

18:39 patchwork: devn: Hmm… so not with a regular psql command though

18:39 That is being mediated by heroku

18:40 dav: technomancy: yes, target/classes/test_xlloop/methods.class

18:40 devn: patchwork: check out this: https://devcenter.heroku.com/articles/heroku-postgresql#remote-connections

18:41 technomancy: dav: has the repl been restarted since compiling?

18:41 patchwork: devn: Ah, well there you go

18:41 justin_smith: patchwork: devn: I think the easiest thing here is to add a call to caribou.migrate/migrate during the boot sequence, and deploy like that. It will migrate and then boot up. You can comment it out after the first deploy, but even re-running it won't hurt (except by making your boot-time take longer)

18:41 devn: patchwork: fixed it

18:41 clojurebot: I don't understand.

18:42 devn: patchwork: i needed to specify :ssl true, :sslfactory "org.postgresql.ss.NonValidatingFactory"

18:42 patchwork: devn: Ah, radical!

18:42 devn: i need to give you guys some doc PRs

18:42 patchwork: devn: That would be most welcome

18:43 technomancy: not much longer, hopefully

18:43 devn: technomancy: is that comment w/r/t the sslfactory thing?

18:44 dav: technomancy: yes, in fact, it's the repl that compiles on startup.

18:44 justin_smith: devn: thanks for being patient with these issues and keeping us informed

18:46 technomancy: dav: what you're describing works for me

18:47 justin_smith: devn: also we hang out on #caribou and it may be better to have the more in depth caribou specific convos there

18:50 technomancy: dav: maybe try a fresh project. `lein new aoty-thingy; edit project.clj; edit core.clj; lein repl; (aoty-thingy.core.)` and see what's different between the two

18:53 dav: technomancy: ok let me try that

18:56 technomancy: those exact step do not work for me.

18:57 technomancy: CompilerException java.lang.ClassNotFoundException: aoty-thingy.core

18:57 technomancy: http://paste.ubuntu.com/6558678/

18:57 technomancy: dav: are you using leiningen 1.x?

18:58 dav: technomancy: Leiningen 2.3.3 on Java 1.7.0_25 OpenJDK 64-Bit Server VM

18:59 technomancy: dav: not sure what's going on; can't reproduce the problem

19:00 dav: technomancy: could you send me a tar/zip of your aoty ?

19:01 technomancy: sure http://p.hagelb.org/buggery.tar

19:01 dav: technomancy: thanks!

19:01 technomancy: no offense; "buggery" is just what I always call my one-off debugging projects =)

19:03 dav: technomancy: none taken ;-)

19:11 technomancy: I think it struck me

19:11 technomancy: can't have a - in a class name in Java can we?

19:11 technomancy: oh hum

19:11 according to the spec you can't

19:12 dav: technomancy: clojure converted it to a _ :-(

19:12 technomancy: mystery solved.

19:12 technomancy: I thought it actually worked ok on openjdk, but maybe not

19:12 dav: technomancy: thanks.

19:12 technomancy: oh, right. you can do it, but clojure won't let you.

19:12 super annoying

19:12 please to vote for http://dev.clojure.org/jira/browse/CLJ-1297

19:13 which wouldn't solve this exact problem but is related

19:13 dav: usually gen-classed namespaces are camelcased

19:13 which is weird

19:15 Bronsa: technomancy: clojure will happily compile (deftype foo-bar []) though

19:17 arrdem: bitemyapp: dotas in a couple hours?

19:21 dav: technomancy: will do. thanks for all the help!

19:27 technomancy: np

19:28 pandeiro: is this :include-macros keyword for :require expressions new in cljs?

19:39 bitemyapp: arrdem: dinner with technomancy, then we can.

19:39 arrdem: done with your finals?

20:17 meoblast001: Raynes: hi

20:18 Raynes: meoblast001: Hi.

20:18 meoblast001: cool

20:44 murtaza52: I have a collection of tuples which are ordered. When I convert them into a map, I loose the order. How can I keep the order ?

20:44 amalloy: don't convert them into a map

20:47 coventry: Is ordered-map a bad idea? https://github.com/flatland/ordered

20:47 gfredericks: any guesses when clojure/west will be announced?

20:49 amalloy: coventry: i mean, it's not awful. there are specialized scenarios where you might want an ordered-map (which is why i wrote it). but most of the time, you either want a map or you want ordered tuples, and trying to conflate the two just leads to confusion

20:52 coventry: amalloy: Makes sense. Thanks.

20:57 shep-home: Does anyone have suggestions for Clojure projects I can read from and learn more about testing in Clojure?

20:57 I'm getting the distinct sense that most of the tests I want to write are duplication of the implementation

20:57 Which doesn't sit well with me.

20:58 * gfredericks perks up

20:58 gfredericks: shep-home: what sort of code are you testing? business logic?

20:59 shep-home: gfredericks: I decided to do something nice and easy to (inc clojure-skill)

20:59 so, I'm trying to implement Raft

21:00 https://ramcloud.stanford.edu/wiki/download/attachments/11370504/raft.pdf

21:00 Which is stretching me in lots of ways

21:01 But I've been reasonably happy with how I'm forced to separate my code

21:01 but I'll end up with tiny-ish functions

21:02 coventry: shep-home: Make tests for each of the paper diagrams.

21:03 shep-home: coventry: so, here's where my imperitive programming background kicks in...

21:03 Mos tof the diagrams seem to focus on successions of state

21:04 And it feels a little funny to have a test that is

21:04 coventry: Doesn't the corresponding logic in your implementation involve updating state somewhere? Test that that's happening as it should.

21:04 How are you tracking the successions of state in your implementation?

21:05 shep-home: (let [server (-> (create-server) state-trans1 state-trans2 ...)] (is ...some assertion on state...)

21:05 coventry: well, I've punted a small bit there. I've started with an agent for it

21:06 coventry: The code you wrote there looks sane to me.

21:06 shep-home: But testing against the agent feels like a comparitively high-level test

21:09 For example, once I get that high, my "sockets" (aka in-memory queues for now) come into play

21:10 I also started to look into simple-check some. Some of those state-transition steps have parameters that I've arbitrarily chosen

21:11 But I'm not sure that it makes sense for these tests...

21:12 Most of the books and whatnot have talked about how the testing frameworks work... but I'd love to see real-life examples

21:13 gfredericks: simple-check is the knee of the bee

21:15 coventry: You might try arranging it so that (create-server) contains a reference to the agent, and all the state-trans* fns refer to the agent that way. Then you can have (create-server :test) refer to a mock of it, or something. Or you could just bash the reference in your tests so that it points to a mock.

21:16 For reading, try the tests in aleph. https://github.com/ztellman/aleph/tree/perf/test/aleph/test

21:18 shep-home: coventry: to clarify, are you using * to mean one-or-more or as in "foo and foo*" method pair?

21:18 coventry: yeah, I meant it as a glob.

21:20 shep-home: Would you expect that the functions take in server or server-agt?

21:22 coventry: That server-agt is an agent should be an implementation detail of server which the state-trans* fns don't touch.

21:27 shep-home: Ok, I agree with that. So there would be user-facing method that ultimately do the send or swap or dosync, right?

21:27 methods*

21:28 coventry: From what you've described, that sounds like a sensible way to do things.

21:29 shep-home: And would you expect I have tests that drive via these user-facing methods? That seems only sensible, but those start to feel like full-stack-ish / integration tests.

21:30 coventry: The goal is to make anything like that an extremely simple wrapper around a pure function.

21:32 shep-home: That all makes sense. I'm also stuck with the fact that there are side effects scattered throughout

21:33 Like, when you get a message, you need to send a message

21:33 So I've been trying to push all those to the outside of my pure state modification methods

22:02 jweiss: what is the mechanism clojure uses to avoid duplicating the list in memory when you run something like (drop 5 (range 10000)) ? I thought it was STM but that seems to only deal with concurrency.

22:04 eric_normand: dnolen: when did #js come to be?

22:10 Apage43: jweiss: garbage collection? =P

22:10 coventry: jweiss: laziness.

22:10 $source range

22:10 jweiss: no, it's not either of those. there's a diagram on the clojure site that shows a tree in memory

22:10 sorry maybe range was a bad example

22:10 maravillas: structual sharing

22:11 jweiss: yeah, that

22:11 beppu: jweiss: http://paulsanwald.com/blog/234.html (intro to lazy-seq)

22:11 coventry: range is definitely returning a lazy seq, and drop is dropping the head.

22:12 But yeah, for non-lazy structures, it's structural sharing. I think hyperion had a good post on this recently

22:13 jweiss: coventry, but i'm pretty sure (take 5 (doall (range 10000)) wouldn't duplicate in memory either.

22:13 coventry: Sure. http://hypirion.com/musings/understanding-persistent-vector-pt-1

22:19 jweiss: coventry: ah that's helpful, thanks. i would think this would be something common to many programming languages but i don't think i've used any other that has it. i'd guess haskell probably does

22:19 `cbp: every lisp has structural sharing for lists :P

22:20 not that it's very hard to implement

22:20 coventry: It's a pretty alien concept. Some folks on #python were arguing volumes that it wouldn't make sense to have such structures in python.

22:20 (a couple of weeks ago.)

22:21 jweiss: i have been learning python lately and the #python channel is, shall we say, less pleasant than this one.

22:22 ok i think perhaps the term i am looking for is 'persistent data structure'

22:22 newblue: Rich Hickey explains structural sharing about 30 minutes into this video: http://www.youtube.com/watch?v=wASCH_gPnDw

22:22 jweiss: ultimately what i was wondering is, does this concept exist in any lower-level languages

22:23 coventry: Well, they've been ported to javascript. :-)

22:25 jweiss: i suppose to make my question even more abstract, is how close to the machine can you get without being forced into looking at it in the von neumann perspective

22:38 arrdem: bitemyapp: nice! I'm jelly. done with finals on saturday night but I'm done for the night so whatever

22:46 bitemyapp: weeeeee

22:46 arrdem: that was technomancy. that was his way of saying hi.

22:46 arrdem: bitemyapp: haha

22:46 bitemyapp: arrdem: he doesn't know how to use irssi. (erc user. and dvorak.)

22:47 arrdem: bitemyapp: ah yes... the emacs curse...

23:36 bitemyapp: rickasaurus: "EXPERIENCE REQUIRED: [...] Object oriented programming experience in Haskell." http://t.co/A3MGRrykrK

23:37 coventry: You can write java in any programming language.

23:38 arrdem: #fivehorrorsofprogramming

23:38 or whatever that was

23:41 hyPiRion: #FiveWordTechHorrors

23:41 arrdem: yeah that

23:43 {[^-^]}: so, is it better to, after you've finished designing, optimize your clojure in different clojure or java?

23:44 I guess what I'm asking is can you optimize clojure to be as fast as java without becoming unreadable

23:44 arrdem: sometimes you just gotta write java if it's that much of an issue.

23:44 but there are tricks you can play with profiling clojure code to speed things up

23:52 eric_normand: bitemyapp: data MonadManagerFactory = ...

23:56 dnolen: an MVC "framework" in ClojureScript, whopping 24 lines https://github.com/swannodette/om/blob/master/src/om/core.cljs

Logging service provided by n01se.net