#clojure log - Jan 22 2013

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

0:00 frozenlock: cjfrisz: No problem. I'm mostly in the same situation; learning JS with clojure :)

0:00 TheBusby: technomancy: I'm very tempted

0:00 though it might be easier to setup a proxy service and offer others. collect the bribes myself you see

0:00 technomancy: arrdem: any time someone says "I wouldn't use it myself, but it'll be great for newbies" my BS detector goes off

0:00 arrdem: technomancy: haha good rule

0:02 why is the coffee always gone...

0:02 TheBusby: technomancy: "I wouldn't use it myself, but it'll be great for newbies" = pmap?

0:03 technomancy: TheBusby: pretty much

0:03 craigbro: i use pmap!

0:03 technomancy: you can s/newbies/presentations/ and it still works

0:03 craigbro: i use it quite a bit

0:03 in production code even

0:03 TheBusby: craigbro: you're scaring me now

0:03 craigbro: however I do stupid partition tricks

0:04 to limit the number of threads

0:06 TheBusby: speaking of core contributors, are there any that aren't US TZ? I thought a few were EU but couldn't tell who

0:06 craigbro: also, I exxagerate the quite a bit (two places)

0:06 TheBusby: craigbro: you'll like reducer's fold I think ;)

0:06 craigbro: yah, haven't had time to look at those yet

0:07 I'm perpetually behind the times it seems

0:07 didn't use paredit, was slow to pick up threading macros...

0:09 noprompt: i just wanna verify here, if i have an ns containing soley records the ns name should be (ns foo.types) or (ns foo.type)?

0:09 TheBusby: no worries, I still haven't played with reader tagged literals

0:09 noprompt: i'm confused as to what constitutes "heterogenous"

0:09 amalloy: noprompt: pick any old name you want

0:10 noprompt: amalloy: ha! i suppose that's fine too :)

0:10 craigbro: noprompt: lots of different things

0:12 noprompt: cool. every language seems to have preferred conventions and i'm still new to clojure.

0:13 craigbro: noprompt: I would callit foo.types

0:14 noprompt: craigbro: i think that makes sense

0:15 technomancy: noprompt: also make sure it makes sense to use records; most people who are new to clojure use them when they should be using maps

0:15 craigbro: noprompt: my collection of functions for importing frm a given data type I call foo.import

0:16 noprompt: technomancy: absolutely. i made sure to do a lot of reading and consideration before choosing them in my case.

0:18 would a css compiler constitute a good use case for records/protocols?

0:18 technomancy: I think not.

0:19 if you are considering introducing types merely for the purposes of dispatch it's likely that you're trying to treat clojure like an OOP language

0:20 noprompt: ouch. :)

0:20 so what would be the right way to model it?

0:20 maps, functions, and macros?

0:20 technomancy: maps and functions until you need polymorphism, in which case defmulti

0:21 (but you will need less polymorphism than you think)

0:21 craigbro: i like to think of it as needed less typoed polymorphism

0:21 noprompt: ok, so originally i had gone that route, which is ok since i'm using version control.

0:21 SegFaultAX: Is there something like hiccup for css?

0:21 arrdem: herm.. how to do a recursive macro?

0:21 craigbro: and using lots of value polymorphism

0:22 noprompt: yes there are a couple libraries.

0:23 ibdknox: wow the pull requests thread makes me sad :(

0:23 amalloy: arrdem: that's too vague a question to answer

0:23 arrdem: amalloy: yeah it is...

0:24 SegFaultAX: ibdknox: ?

0:24 ibdknox: SegFaultAX: https://groups.google.com/forum/?fromgroups=#!topic/clojure/0gwjKtatf-0

0:24 noprompt: SegFaultAX: there's gaka and cssgen

0:25 craigbro: killer 1.5.0 feature; print-table output compatible with Emacs org mode...

0:26 technomancy: ibdknox: but not particularly surprising

0:26 ibdknox: technomancy: not anymore :/

0:26 TheBusby: ibdknox: I think it's only going to get worse as the community grows

0:27 ibdknox: it should

0:27 it's broken

0:27 frozenlock: technomancy: separated IRC channel? #clojurescript then?

0:27 SegFaultAX: technomancy: I'm only at the top of the thread, but #clojurescript is a thing.

0:27 technomancy: SegFaultAX: are there people in it?

0:27 TheBusby: ibdknox: I agree, I have tons of patches/updates/etc (not sure if they're worth anything) that have simply never been submitted because of all this drama

0:27 SegFaultAX: technomancy: As of now, like 6 haha

0:28 ibdknox: TheBusby: it has kept me from contributing :(

0:28 TheBusby: ibdknox: the great thing with git though is you can easily maintain your own fork

0:28 ibdknox: mm

0:29 TheBusby: though beta2 has broken some of my reduces stuff... :( Sticking to alpha2 until 1.5.0 gets released

0:29 s/reduces/reducers/

0:29 luxbock: should I use records, structs or just regular maps to represent a playing card, e.g. {:rank :K :suit :clubs} ?

0:30 technomancy: luxbock: maps for sure

0:30 SegFaultAX: luxbock: A map is probably sufficient. Even just a pair.

0:30 technomancy: or yeah, you could use a vector if you can keep the positions straight in your head

0:30 TheBusby: ^^^ sarcams I hope

0:30 noprompt: so what is the ideal use case for a record?

0:31 luxbock: alright, I was confused because I've seen people use both structs and records, but yet someone here said earlier that most of the time neither one is needed

0:31 technomancy: noprompt: if you are implementing a very tight loop and you wish to sacrifice flexibility for speed

0:31 SegFaultAX: luxbock: When you want to have a distinct type, probably.

0:31 technomancy: luxbock: structs are completely deprecated

0:31 SegFaultAX: Whoops, noprompt ^

0:31 technomancy: luxbock: records are highly over-used

0:31 luxbock: alright, good to know

0:32 craigbro: so, if records are overused, what about defprtocol and reify?

0:32 SegFaultAX: technomancy: Do you mean defstruct is deprecated?

0:32 technomancy: craigbro: protocols are also overused. reify doesn't seem to be because most people understand it's only necessary for Java interop.

0:33 SegFaultAX: yeah, I don't know if it's official, but there's no reason to use them

0:33 SegFaultAX: technomancy: Good to know. I knew it had fallen out of favor, I didn't realize it was actively cautioned against.

0:33 craigbro: ok, here is an example. I have a informal type, called sample-info

0:34 it's a map witha set of keys in it, guaranteed to be there, tho it's usually merged with other information

0:34 luxbock: for the deck, I'm guessing I should use a vector? I need mostly to shuffle it and deal out cards

0:35 craigbro: what would be the way to mark those maps such that people could be sure those keys were there?

0:35 err, what i mean is

0:35 SegFaultAX: luxbock: Vector works great. I have some sample code if you like?

0:35 craigbro: I want to throw an error if I pass in a map that has one of those keys missing

0:35 technomancy: craigbro: just use preconditions

0:35 craigbro: I would prefer not to use runtime preconditions

0:36 luxbock: SegFaultAX: yes please

0:36 SegFaultAX: craigbro: Why do you need to strictly enforce the presence of keys?

0:36 craigbro: and I also want some form of documnetation, or making explicit, that this is a known map

0:36 SegFaultAX: luxbock: Crud, it's on my other laptop. Sec.

0:36 luxbock: I'm trying to build an equity calculator for poker as an excercise

0:37 technomancy: craigbro: you have all the tools you need to do that in defn

0:37 noprompt: i should have joined this room sooner :)

0:37 frozenlock: Aaaaand I killed my browser #(let [lock (atom true)] (some-async fn... (reset! lock nil)) (while @lock ))

0:38 craigbro: I guess the real goal is that i want a shared abstract that other programmers on the team can use

0:38 not so much throw an error if a key is missing

0:38 hmmm

0:38 alexbaranosky: craigbro: https://github.com/runa-dev/clj-schema ?

0:38 craigbro: I guess I miss the pedagogical role that class/types play in OO langs

0:38 or even functioanl langs with static typing

0:39 SrPx: What's Clojure's equivalent to CL's progn?

0:40 technomancy: craigbro: you can write Clojure that way, but it's not necessary and doesn't help much

0:40 SrPx: do

0:40 SrPx: technomancy: ty

0:40 craigbro: do?

0:40 clojurebot: do does not

0:40 Raynes: &(do :you :love :me?)

0:40 lazybot: ⇒ :me?

0:41 SrPx: c:

0:41 luxbock: SegFaultAX: I have to run but I'll get back to you later about that sample code, thanks

0:41 SegFaultAX: luxbock: I have it

0:41 noprompt: SegFaultAX: i think i'd still like to see it

0:41 SegFaultAX: luxbock: https://gist.github.com/4592392

0:41 craigbro: technomancy: oh, but it does help

0:41 luxbock: ah nice, ty

0:42 SegFaultAX: luxbock: It's part of a project I'm building to tutor a friend of mine interested in clojure.

0:42 craigbro: technomancy: when you have a team working on a dynamic language like clojure

0:42 luxbock: cool

0:42 SegFaultAX: luxbock: But it is a mostly functioning blackjack game.

0:42 craigbro: clj-schema might do the trick

0:43 technomancy: craigbro: people aren't going to suddenly forget to pass in the right arguments just because you're not using a record type

0:43 SegFaultAX: noprompt: ^

0:43 noprompt: SegFaultAX: ty, reading it now.

0:44 craigbro: technomancy: surr they will, or more likely the return value of some function they called that previously returned a map of that type, has changed and no longer does

0:44 technomancy: I would prefer a runtime error or at least warning, instead of something like silenty returning a weird/nil value or something

0:45 technomancy: I am not arguing for records either

0:45 technomancy: if you had a proper type inference engine it would catch something like that, but records are a long way from that

0:46 TheBusby: craigbro: I think it's safe to say that the above isn't "normal" Clojure, so unless you really feel confident you're doing the right thing, don't.

0:46 craigbro: technomancy: yah, without the static checks, preconditions are the obivous choice, precondition + clj-schema might be the sweet spot

0:47 technomancy: right now, I do it via documentation, naming convention for fn params

0:47 aka convention

0:47 TheBusby: what is the "above"?

0:48 SegFaultAX: noprompt: I'm open to comments if you have any. There are some weird parts because it's an interactive port of a Python implementation. We're still building up to a completely working game.

0:48 craigbro: I always dug CLs type system

0:48 opt-in

0:49 when I saw the work on a typed CLJ, I immediately thought of that

0:49 noprompt: SegFaultAX: oh, i think i'm far from being able to make judgements about the code. i've only been using clojure for about 2.5 months, and mostly in my free time.

0:49 technomancy: even that is a long way from a proper inference engine unfortunately

0:49 SegFaultAX: noprompt: Oh, cool. Welcome! :)

0:49 craigbro: yah

0:49 I could dig being able to use something like the type hints tho

0:50 noprompt: SegFaultAX: but i'm going to meditate on it and the comments others have made.

0:50 craigbro: to say "this kind of map"

0:50 TheBusby: craigbro: just adding my vote to ditch records and listen to technomancy. There are a number of specialized Clojure features that look really cool, but should only be used in special circumstances.

0:50 craigbro: TheBusby: the use of records is not even on the table here

0:50 TheBusby: craigbro: sorry, nmind then

0:51 craigbro: TheBusby: I am using maps now, but I wanted some kind of notation/representation of the "types" of the maps I use

0:51 noprompt: i'm slowly backseating ruby as my primary programming language in favor of clojure at work. :)

0:51 ruby's nice for shell scripts though.

0:51 TheBusby: {:type :magic: :data "foo"}

0:53 SegFaultAX: noprompt: In my day job I do mostly Ruby, and Erlang before that. I have mixed emotions about Ruby as a language; there are some features that I absolutely adore, but the vast majority is just needlessly complex.

0:53 craigbro: I guess I wish type hints ala #^foo didn't have to be java classes

0:54 SegFaultAX: craigbro: What other type hints would there be?

0:54 craigbro: protoclols?

0:55 TheBusby: you could play with typed-clojure maybe?

0:55 SegFaultAX: Is typed-clojure actually in a usable state?

0:56 amalloy: craigbro: hinting protocols would do no good to the core language. so you might as well use your own custom tags that the compiler will just ignore

0:56 craigbro: amalloy: that's the conclusion I just came to in my repl 8^)

0:56 amalloy: (defn ^:int foo [^:stringable x])

0:56 not that i'd want to read such code

0:56 noprompt: SegFaultAX: i agree. ruby used to make me feel very happy, and in many ways it still does. but OO feels a bit like a cage after working more with FP langs.

0:57 craigbro: amalloy: really a docstring is just as good then

0:58 and if I wanted anything more, I could use preconditions and clj-schema

0:58 adu: ooo typed clojure

0:58 craigbro: thanks yall

0:59 adu: I thought it was (defn ^int foo [^stringable x])

1:00 craigbro: adu: the : makes it a keyword, which makes the compiler ignore it

1:00 which is what we want, as it's a tag for humans, and not a tag for the compiler (in this case)

1:01 SegFaultAX: That seems like it could be problematic.

1:01 adu: what if you have a type called "private"?

1:01 SegFaultAX: Is a 1 character difference visually distinctive enough to signal that this type hint, aint.

1:02 adu: I don't think you could since that's a keyword in Java.

1:02 craigbro: one char and a color in emacs 8^)

1:04 SegFaultAX: I think I prefer docstrings anyways

1:04 as they will show up when a user asks for the documentation of the fn, but the type hints get dropped

1:04 SegFaultAX: craigbro: I agree with that.

1:11 tomoj: wish I could extend ILookup (and, hell, IAssociative?) to java.net.URI

1:12 (assoc #uri "/foo" :query-params {:bar 3})

1:15 noprompt: technomancy: i noticed you contributed to cssgen, the project uses records. it hasn't been updated in some time, in hind site would you say records are not needed?

1:15 s/are not/were not

1:16 craigbro: urls/uris don't store query params as maps tho

1:17 clojurewerkz or someone out there has a bit of code that explodes/compsoes urls into/outof maps

1:17 easy enought o write yourself too, plus handle things like specifying a map for query params...

1:20 tomoj: that's what I'm doing now

1:20 but I want to just make java.net.URI better

1:21 I guess I don't have a right to extend core protocols to URI

1:21 craigbro: proxy?

1:21 clojurebot: proxy is not reify

1:22 SegFaultAX: craigbro: Citation needed. I'd like to see that :)

1:22 craigbro: citation for what?

1:23 tomoj: URI is final

1:23 SegFaultAX: craigbro: "explodes/compsoes urls into/outof maps" this is immediately relevant to something I'm working on. Happen to remember where you read it?

1:23 tomoj: I don't think I want to proxy it anyway

1:23 craigbro: I was thinking of this: https://github.com/michaelklishin/urly

1:23 SegFaultAX: craigbro: Thanks!

1:23 amalloy: doesn't cemerick have a uri library?

1:24 tomoj: cemerick.url?

1:24 clojurebot: cemerick: Yeah, MacKay's book is great too.

1:24 SegFaultAX: amalloy: This one? https://github.com/cemerick/url

1:25 amalloy: i'd try that before the one from clojureworks, personally

1:25 craigbro: tomoj: fuck, URI is declared final

1:25 SegFaultAX: amalloy: Oh man, this is exactly what I'm looking for. Thanks!

1:26 xeqi: cemerick is full of useful libraries

1:26 SegFaultAX: amalloy: I was basically porting this functionality from Python and it appears cemerick has already done it.

1:26 Raynes: amalloy: The one from cemerick is great for URLs specifically, but not URIs in general. Not sure about the clojurewerks one, but I've avoided it because it blows my mind that you'd need to use Java directly to do whatever that thing does.

1:27 craigbro: Raynes: your avg URL parsing is pretty simple, true, but full coverage, can be a pain, and might as well use the java libs if you are in clojure already

1:27 tomoj: (.mutatePath u "/Protocols") ???

1:27 lazybot: tomoj: Yes, 100% for sure.

1:27 Raynes: craigbro: No.

1:28 craigbro: I mean, they hava Java source files in the code.

1:28 tomoj: https://github.com/wtetzner/exploding-fish

1:28 Raynes: You'd definitely want to use the Java URI stuff.

1:28 tomoj: I've used exploding fish. It was nice

1:29 craigbro: Raynes: oh, that's kinda gross

1:29 SegFaultAX: Who maintains clojuredocs.org?

1:29 Raynes: I think nobody at this point.

1:29 tomoj: I wonder if I'm allowed to extend ILookup to goog.Uri in cljs

1:30 SegFaultAX: Raynes: Is it looking for a maintainer? Is there a better online source for up-to-date clojure documentation?

1:30 Raynes: SegFaultAX: It is a ruby codebase so nobody wants to maintain it.

1:30 I think people are hopeful someone will come with a Clojure version and light the way.

1:31 Also, it might be closed source.

1:31 Which is mindblowingly awesome.

1:32 SegFaultAX: https://github.com/zkim/clojuredocs

1:32 Raynes: Okay, in that case it was closed source when it first came out.

1:32 I know it was at some point.

1:33 craigbro: it's all open sources

1:35 I prefer emacs' ability to open a jar

1:36 and then I read the code

1:36 noprompt: oh! i simply love closed source!

1:36 it's like commercial grade orange juice. it contains oranges*.

1:37 craigbro: well, there ya go noprompt, a project to transition from ruby to clojure

1:37 SegFaultAX: I don't really have any particular issue with proprietary software.

1:38 noprompt: craigbro: haha! i think rogue might be better for that! ;)

1:38 craigbro: wasn't there some big discussion about replacing it on the mailing list awhile back?

1:38 SegFaultAX: Except for datomic. I really want to crack datomic open and see how it works.

1:39 noprompt: rogue needs a ton of work too as i'm sure clojuredocs does

1:40 craigbro: what is rogue?

1:40 noprompt: rouge is a clojure for ruby

1:41 the problem is, the more you use clojure, the less you want to work with ruby

1:42 more generally the more you FP the less you want to OOP

1:42 at least this has been my experience

1:42 SegFaultAX: noprompt: It isn't really an OOP thing, I think.

1:43 noprompt: OOP and FP are really orthogonal in a lot of ways.

1:43 noprompt: It so happens that OOP in a languages means lots of mutable state, which is a shame.

1:43 In a lot of languages*

1:44 noprompt: SegFaultAX: yeah, that's usually why constants are commonly frozen or simply placed in refs in ruby.

1:45 s/refs/defs

1:45 SegFaultAX: noprompt: Well, "constants" aren't really constants in Ruby. And frozen-ness is something else.

1:46 noprompt: Anyway, I'm simply saying that it's possible to have a language that combines FP and OOP successfully (eg Scala)

1:46 Sgeo: It's really not difficult to imagine a purely-functional OO system

1:46 I would like to see one

1:47 More difficult may be purely-functional + Smalltalk-like environment

1:47 SegFaultAX: Sgeo: I think Scala is pretty close. It isn't pure in the sense that functions are still technically non-deterministic. But it's a good example of a mixture of both paradigms, I think.

1:48 noprompt: perhaps it's just been my general experience with programming in an OO style and the mentality of it's proponents

1:49 arguments about design based solely on empiricism, design patterns, etc.

1:49 SegFaultAX: noprompt: I blame the bloggers. They often (incorrectly) set FP and OOP as diametrically opposed when they really aren't.

1:49 noprompt: SegFaultAX: i can appreciate that and agree.

1:50 SegFaultAX: Can someone please g-line Inoperable?

1:50 noprompt: SegFaultAX: but many books are also guilty of the same charge, which is not surprise since many of those authors are likely the same bloggers you're referring to.

1:51 craigbro: well

1:51 object identity, which is one of several core parts of OO, is antithetical to FP

1:52 polymorphism, encapsulation, inheritance are not

1:53 Sgeo: Is inheritance even a core part of OO?

1:53 craigbro: nope

1:53 well, class inheritance isn't there are prototype based OO languages, JS for example

1:54 cark: oo is a collection of properties (inheritance being one of these). pick any 3 and you have proper OO

1:54 in my opinion

1:54 =P

1:55 SegFaultAX: cark: That's part of the problem, isn't it? The fact that you can have an /opinion/ on the /definition/ of OOP. It's kind of a meaningless phrase, a catchall for certain types of common patterns and behaviors.

1:56 cark: you have the same problem about functional programming

1:56 some people cannot imagine proper FP without a strong type system à la ML

1:56 noprompt: SegFaultAX: it really is and i think you're right. ask a dozen programmers what OOP is and you'll likely get that many answers.

1:56 ChongLi: functional programming is programming with functions; what's the problem?

1:56 Sgeo: I wonder if there's anyone who would hold the opinion that Smalltalk isn't real OO

1:57 SegFaultAX: Sgeo: It would be ironic, wouldn't it?

1:57 ChongLi: cark: those people are silly

1:57 cark: ChongLi: see that definition is too broad even for me =P

1:57 ChongLi: cark: it depends on the definition of function

1:57 and that's how it really ought to be

1:58 adu: Smalltalk is the definition of OO

1:58 Sgeo: Maybe someone so caught up on syntax that they think . for method call is somehow fundamental

1:58 cark: ChongLi: how about the purely functional crowd ...

1:58 ChongLi: they've added an extra qualifier

1:58 "purely"

1:59 cark: take clojure as an example

1:59 SegFaultAX: Well a "pure function" is different from the function most people think of when they think about "functions"

1:59 cark: it isn4t really purely functional

1:59 ChongLi: no, it doesn't enforce purity

1:59 cark: but purity has a big role in clojure nevertheless

1:59 ChongLi: take javascript as another example

1:59 adu: and scheme people would say clojure is unhygenic

2:00 ChongLi: I consider it a functional programming language

2:00 and it's definitely not pure!

2:00 cark: adu: woah i wouldn't mix that in =P

2:00 adu: haha

2:00 ChongLi: yeah, macros have nothing to do with it

2:00 Sgeo: adu, I think most Clojure people who agree that Clojure is unhygienic but that it doesn't pose a severe problem

2:00 cark: ChongLi: indeed

2:00 Sgeo: Although I would say it's more hygienic than CL

2:01 adu: even some scheme implementations are based on unhygenic foundations

2:01 cark: ChongLi: so, i think across the realm of ML, clojure and JS we've established that functional programming takes many forms

2:01 ChongLi: macros in essence are merely the application of functions at a different stage in the process

2:01 cark: which one is true ?

2:01 craigbro: ocaml!

2:02 Sgeo: Does Smalltalk count as functional? It might not be "as" functional like Haskell in that things like function composition aren't easy, but that doesn't really mean not functional at all

2:02 It takes some a few functional idioms here and there

2:02 ChongLi: all you need for functional programming are first class functions with lexical closures

2:02 cark: Sgeo: i think there are some gotchas with blocks

2:02 SegFaultAX: Sgeo: I think the problem is that Smalltalk functions are non-deterministic.

2:02 ChongLi: Well, and real functions.

2:02 clojurebot: functions are maps

2:02 Sgeo: SegFaultAX, so not "purely" functional, sure

2:03 adu: cark: Apple blocks?

2:03 SegFaultAX: Sgeo: If you like.

2:03 Sgeo: cark, gotchas?

2:03 ChongLi: SegFaultAX: what do you mean real functions?

2:03 Sgeo: Well, I think historically Squeak blocks weren't closures, but now they are

2:03 cark: i'm no expert with smalltalk, but i think blocks were not really lexical closure until (somewhat) recently

2:04 Sgeo: you beat me to it =P

2:04 i blame the cat

2:05 craigbro: beddddddddd

2:05 adu: I really like clojure

2:06 cark: so do I... it's great...but sometimes OO is better suited

2:06 noprompt: adu: me too :)

2:06 adu: I wonder if I could write a clojure interpreter in scheme

2:10 SegFaultAX: ChongLi: Functions without side effects. Referentially transparent.

2:12 ChongLi: yeah, pure functions

2:57 tomoj: exploding-fish doesn't even work for me :(

3:09 Raynes: tomoj: I used to use it in refheap.

3:10 tomoj: But monger does what I was using it for.

3:31 babyclj: hi, is there an elegant way to compare if a value falls between 2 values; e.g, test if X is between 0.5 and 1.5.

3:31 amalloy: (< x a b)

3:32 er, (< a x b). you get the idea

3:32 babyclj: amalloy: ok so no bultin function to do those kind of thing -- pardon me, newbie. :-)

3:32 thanks

3:33 amalloy: huh?

3:33 that's exactly what < is

3:33 &(< 0.5 1 1.5)

3:33 lazybot: ⇒ true

3:33 amalloy: &(< 0.5 2 1.5)

3:33 lazybot: ⇒ false

3:33 babyclj: nvm, I get it

4:16 ucb: does anybody know if there's an emacs mode to collapse forms?

4:16 I seem to recall that there was one somewhere...

4:17 ChongLi: collapse? you mean code folding?

4:17 ucb: yes

4:18 ChongLi: http://stackoverflow.com/questions/2399612/why-is-there-no-code-folding-in-emacs?answertab=active#tab-top

4:18 ucb: if you had (defn f [a b c] (do-something...) (more exps)) you'd end up with something like (defn f ...)

4:18 aha! thanks ChongLi

4:18 ChongLi: hope it works well for you!

4:19 ucb: me too! :)

4:33 ChongLi: hideshow works a charm; especially after you add hideshowvis (for the +- symbols on the margin) http://tinypic.com/r/1jxgk5/6

4:35 ro_st: ucb: awesome, you're using riemann

4:35 impressions so far?

4:35 ucb: ro_st: yeah, really nice. We've been using it at work for a while now. We're trying to upgrade to latest master but for some reason it's dropping packets :(

4:35 ro_st: eek

4:35 ucb: ro_st: but all and all, very nice

4:36 ro_st: how are you collecting dat?

4:36 * ucb is working on modularising his alerts

4:36 ro_st: s/dat/data

4:36 ucb: collectd mostly

4:36 (you can see the beginning of the collectd parser there)

4:37 ro_st: we're using AWS, so we're looking into feeding riemann into cloudfront custom metrics

4:37 ucb: ooh

4:37 funcy!

4:38 ro_st: have you ever needed support for riemann, and if so, what was the support like? either from the community or the maintainers

4:39 also, would you mind pasting the bit of elisp that does that folding happiness you demonstrate? a pm is fine :-)

4:39 ucb: ro_st: it's a standard package hideshow (comes as built-in in 24.x) and I added hideshowvis (from marmalade)

4:39 ro_st: I didn't do much other than enable hideshowvis for clojure-mode

4:39 tomoj: say you need to do some initialization once per entire test run

4:39 ucb: ro_st: as for support on riemann, we haven't had the need to reach out yet, it mostly works :)

4:40 ro_st: mostly = we haven't come across something that doesn't work yet, but I'm sure we will at some point

4:40 tomoj: I guess maybe you can use a hook?

4:40 ucb: tomoj: entire test run being the entire test suite?

4:42 ro_st: http://www.emacswiki.org/emacs/HideShow

4:42 ro_st: thanks, just installing the vis

4:42 ucb: cool

4:44 tomoj: ucb: yes

4:44 ucb: tomoj: I'm guessing you need to then tear down the state at the end?

4:45 tomoj: sure, but I'm thinking mostly of running with `lein test`

4:45 if I'm running tests from the repl I can setup and teardown in the repl around my run-all-tests call

4:45 and with `lein test`.. it'll just die off anyway I tihnk

4:45 maybe not

4:46 ucb: well, if you're setting up a db and some tables they won't go away once lein test is finished

4:46 it it's just an atom or so, then yes

4:46 tomoj: it's a cljs browser repl environment

4:46 ro_st: ucb: working. thanks

4:46 tomoj: I don't think I can close the browser if I even can open one, so it's just them jvm piece

4:47 ucb: tomoj: for browser testing try clj-webdriver

4:47 tomoj: also see the section on fixtures http://richhickey.github.com/clojure/clojure.test-api.html

4:47 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure/clojure.test-api.html and try to stop linking to rich's repo.

4:48 ro_st: ucb: used clj-webdriver?

4:48 tomoj: fixtures run per-ns though

4:48 ucb: ro_st: some, yes

4:48 tomoj: clj-webdriver looks interesting, but I just want to test cljs library code

4:49 I don't need to automate the browser

4:49 ucb: tomoj: indeed; I don't know what you're doing but a long-running state is a bit of a smell if you ask me :)

4:49 i.e. normally fixtures should do the trick

4:49 "normally"

4:50 ro_st: tomoj, we got around that by putting the code in clj and using cljsbuild crossovers

4:50 then we could use midje

4:50 tomoj: it looks like one.test creates a new browser env every time you use in-javascript

4:50 ro_st: but i'm guessing you want to test cljs specifically

4:50 cljsbuild's advanced example config has phantom js stuff all wired up

4:50 tomoj: oh, no, it does one browser env per ns I guess

4:51 ro_st: phantom drives a headless webkit

4:51 * ucb was wondering about phantom as well

4:52 tomoj: no microsecond timers, hmm

4:52 ro_st: https://github.com/emezeske/lein-cljsbuild/blob/master/example-projects/advanced/project.clj#L42

5:58 oskar__: If I

5:58 o

5:58 ops

6:15 nico``: test

7:40 borkdude: in emacs, when I have accidentally split a windows, with C-x 2 or C-x 3, can I undo it?

7:41 daimrod: borkdude: ,,winner-mode

7:42 it's not #emacs /o\

7:42 borkdude: C-x 0

7:42 daimrod I know, but the atmosphere in #clojure is better and half of the people or more use emacs anyway here ;)

7:42 daimrod: C-x 0 will remove the window, winner-mode is a mode to undo/redo windows configuration.

7:43 borkdude: daimrod ah, will look into it

7:44 bozhidar: borkdude: there are different kind of Emacs users :-)

7:44 borkdude: that said the atmosphere here is definitely nicer

7:45 daimrod: FSVO better.

7:46 borkdude: daimrod tnx, winner-mode is exactly what I needed

7:47 daimrod: borkdude: yw, I've bound `C-c u' to `winner-undo' and `C-c r' to `winner-redo' <right> and <left> are too far for me :)

7:48 ljos: Hi. Anyone any who have used jayq in clojurescript? how do I do $(document).delegate(...) . I can get the js to run, but not cljs. I think I am missunderstanding the api or something.

7:49 I would think it should be (delegate ($ js/document) selector event fn), but that does not seem to work for me...

7:56 zphds: hi all… Kinda new to clojure. Was playing around with 'refs' and I can't seem to wrap around why this tiny snippet isn't working

7:57 http://dpaste.com/887305/

7:57 Why is my ref-set not working?

7:57 borkdude: zphds you might want to wrap that in some parens

7:57 zphds: oh wait

7:57 yeah

7:57 duh

7:57 *brainfart*

7:58 borkdude, thanks!

7:58 borkdude: yw

8:08 no7hing: f

8:09 damn, wrong window

8:32 gfredericks: ljos: (.delegate ($ js/document) ...)

8:36 Thallasios_Xelon: hello :)

8:36 gfredericks: somebody convince me not to create a date lib

8:36 Thallasios_Xelon: grefredericks you really help me last time thx

8:37 gfredericks: Thallasios_Xelon: phew!

8:37 Thallasios_Xelon: if a have a lazy sequence,and i want to print it,it will evaluate?

8:37 because of the print?

8:38 borkdude: Thallasios_Xelon of course

8:38 Thallasios_Xelon if you want to print every element that is

8:38 clgv: Thallasios_Xelon: the lazyseq usually does not print if you do not iterate over its elements and print them

8:38 borkdude: ,(print (range))

8:38 clojurebot: (0 1 2 3 4 ...)

8:38 Thallasios_Xelon: i think thats my problem,i dont interate

8:39 ok i will figured it out

8:39 borkdude: sometimes you just see some LazySeq with some numbers

8:39 Thallasios_Xelon: also (let [x lazy1 ] x) is x evaluated?

8:39 clgv: borkdude: humm wait where did I have that from. maybe some special print function...

8:39 gfredericks: &(prn (take 5 (range)))

8:39 lazybot: ⇒ (0 1 2 3 4) nil

8:40 gfredericks: Thallasios_Xelon: x isn't any more evaluated than it was already

8:40 Thallasios_Xelon: x is just a lazy sequence,not the result of the evaluation...

8:40 ?

8:41 gfredericks: x is whatever lazy1 is

8:41 borkdude: ,(str (range))

8:41 gfredericks: your experssion is equivalent to just `lazy1`

8:41 Thallasios_Xelon: lazy sequences make me tired ,ok i will read more,thx guys

8:41 borkdude: &(str (range))

8:42 ?

8:42 clgv: Thallasios_Xelon: for evaluation your code or some print functions code needs to iterate over the elements of the lazy-seq

8:42 Thallasios_Xelon: (doall (concat ....) makes concat "non lazy"?

8:42 clgv: ,(str (range))

8:42 ,(str (range 100))

8:42 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

8:42 #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

8:42 clgv: ,(str (range 100))

8:42 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

8:43 clgv: upps it's broken now

8:43 borkdude: :(

8:43 clgv: &(str (range 100))

8:43 Raynes: lazybot seems to be on vacation ;)

8:43 gfredericks: Thallasios_Xelon: it doesn't make it non-lazy, it just realizes the lazy seq; so the effects of laziness are removed, yes

8:44 borkdude: ,(str (lazy-seq [1 2 3]))

8:44 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

8:44 gfredericks: you're thought is probably correct, it's just misleading to say that it changes the behavior of concat somehow

8:44 borkdude: &(str (lazy-seq [1 2 3]))

8:44 Thallasios_Xelon: ok gfredericks i will kill the lazyness,for now until i know how it works

8:44 bye guys thx

8:44 clgv: borkdude: but you are right, it was the string conversion. I used it in GUI

8:44 borkdude: anyway, this evaluates to "clojure.lang.LazySeq@7861" on my machine

8:45 clgv: clojurebot: botsnack?

8:45 clojurebot: botsnack

8:45 humm weird^^

8:45 borkdude: did I break smth again?

8:45 no7hing: not hungry

8:46 llasram: ~botsnack

8:46 !!!

8:49 ejackson: i bet I know who is *hungry*...

8:49 $botsnack

8:49 lazybot: ejackson: Thanks! Om nom nom!!

8:49 ejackson: yeeeeah

8:51 Bronsa: ciaolol

8:51 lol*

8:52 konr_trab: Why doesn't this work?

8:52 ,(try (assert (= 3 4)) (catch Exception e "nope"))

8:52 clojurebot: konr_trab: Pardon?

8:52 Bronsa: , (try (assert (= 3 4)) (catch Throwable e "nope"))

8:52 clojurebot: Bronsa: Huh?

8:53 Bronsa: :(

8:53 ucb: ,(assert (= 1 0))

8:53 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.AssertionError: Assert failed: (= 1 0)>

8:53 Bronsa: &(try (assert (= 3 4)) (catch Throwable e "nope"))

8:53 lazybot: java.lang.SecurityException: You tripped the alarm! catch is bad!

8:53 Bronsa: whatever, use that.

8:53 ucb: heh

8:55 konr_trab: thanks!

8:56 clgv: ,(println "I am back!")

8:57 &(inc 0)

8:57 lazybot: ⇒ 1

8:57 clgv: ah lazybot is back :)

9:05 gfredericks: is the latest clojure still 1.5-RC1?

9:06 TimMc: I think RC2

9:14 no7hing: seems like this has been picking up speed in the last couple of weeks: http://dev.clojure.org/display/design/Promises

9:14 can one dare to hope for that being in 1.6?

9:16 as in: is there some history of design documents popping up and then appearing in (one of) the following releases

9:17 clgv: no7hing: well 1.6 is nowhere near so there should be a high probability ;)

9:18 Ember-: still waiting for 1.5 final

9:19 Vinzent: Swank still doesn't work with the latest RC :(

9:21 alexnixon: I'm seeing a bug in production ca

9:21 *sigh* try that again..

9:22 clgv: no7hing: well you can use these features with the linked lib

9:23 alexnixon: I'm seeing a bug in my compojure application whereby a "deref" call throws an InterruptedException (however there are no .interrupt calls in my code). So something is calling .interrupt on my thread, but I have no idea what. Minimal example of the exception here: https://www.refheap.com/paste/8859

9:24 does anyone know in what circumstance this might occur?

9:26 answering my own question: looking at the implementation of future-cancel, it seems that may interrupt a thread. So in Clojure, if you cancel a future which is blocked by a deref, you may get an InterruptedException. Is this a bug?

9:26 no7hing: @clgv do you mean with clique?

9:28 it's been some month since i've looked in there

9:28 weavejester: alexnixon: Interrupts generally result in an InterruptedException for threads.

9:28 no7hing: looks like it's coming along nicely though

9:29 clgv: no7hing: yeah. thats the one linked on the page

9:29 alexnixon: weavejester: yeah that's fair enough, what I find surprising is InterruptException bugging me when I'm using only Clojure constructs, despite it not being mentioned in the docs

9:30 weavejester: alexnixon: It sounds like a doc problem then. My guess is that it's desired behaviour, as otherwise you wouldn't know if a future was canceled or not.

9:34 no7hing: checked it last time in september and he's really been on a run since then

9:36 alexnixon: weavejester: it doesn't seem particularly intuitive to me. The exception is being thrown from within the thread that is being cancelled. So if it gets cancelled when on line 26 (say, computing (+ 2 2)) it doesn't throw an exception. If it gets cancelled when on line 27 (deref @p 1 :foo), it does throw an exception.

9:36 weavejester: (that's what I believe to be true, though I could be wrong)

9:37 weavejester: I believe InterruptedException only occurs for blocking I/O

9:37 Which deref does, I think

9:38 I might be wrong about that though, looking at the docs

9:38 alexnixon: it uses http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html under the hood

9:38 (futures, that is)

9:40 and promises are built on CountDownLatches http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/CountDownLatch.html#await()

9:40 which is an InterruptedException-throwing blocking call

9:51 clojure-newb: hey guys, I'm looking for a concise/elegant way to remove a given item from every nested vector in a vector, always the same element… was hoping to find a 'delete-in', any ideas ?

9:51 clgv: alexnixon: yeah a promise uses a countdownlatch

9:51 clojure-newb: data might be [[123 "blurb" :something][321 "more blurb" :something]]

9:51 and lets say I want to remove :something

9:52 gfredericks: clojure-newb: do you need the resulting structures to be vectors as well?

9:52 clojure-newb: gfredericks: not particularly

9:53 gfredericks: ,(map #(remove #{:something} %) [[123 "blurb" :something][321 "more blurb" :something]])

9:54 clojure-newb: gfredericks: nice, using sets ?

9:55 gfredericks: yeah, #{:something} is a function that returns :something when you pass it :something or nil otherwise

9:55 so it works as a predicate here

9:55 clojure-newb: cool, thanks!

9:55 gfredericks: ,(map #{:something} [1 2 something [:something] true])

10:04 arrdem: is there a clojure debugger... some way to step through the evaluation of a form?

10:19 w00t working combinator...

10:29 luxbock: what is the reason for why this: https://www.refheap.com/paste/8861

10:29 gives me this: CompilerException java.lang.RuntimeException: Can't have fixed arity function with more params than variadic function, compiling:(NO_SOURCE_PATH:1)

10:31 gfredericks: can I extend a protocol to arrays? how does that work with array types being parameterized?

10:31 arrdem: luxbock: the issue here is simple, in the (format-cards <card>) case which one gets called?

10:31 luxbock: see... the [& cards] takes 0 OR MORE arguments

10:31 luxbock: there is no minimum of 1 as you assume here

10:32 luxbock: ah

10:32 I see

10:32 does the problem go away if I add in ([] nil) or do I also have to add ([card & cards] stuff)?

10:33 appears it won't

10:33 arrdem: luxbock: you want to add [card & cards], or reduce out your [card] case into [ & cards]

10:33 luxbock: alright

10:33 thanks

10:34 arrdem: no problem

10:34 gotta earn my keep in this chan somehow XP

10:39 oskar__: What is the easiest way to replace a word in a string with (word), or something like that, i.e., I want to be able to reference the match in the replacement

10:42 AtKaaZ: ,java.io.File/separator

10:42 ,(-> "c:\\some" (.split "\\"))

10:42 &(-> "c:\\some" (.split "\\"))

10:42 lazybot: java.util.regex.PatternSyntaxException: Unexpected internal error near index 1\ ^

10:42 AtKaaZ: &File/separator

10:42 lazybot: java.lang.RuntimeException: No such namespace: File

10:42 AtKaaZ: &java.io.File/separator

10:42 lazybot: ⇒ "/"

10:43 S11001001: &(-> "c:\\some" (.split "\\\\"))

10:43 lazybot: ⇒ #<String[] [Ljava.lang.String;@90f268>

10:43 S11001001: &(-> "c:\\some" (.split "\\\\") seq)

10:43 lazybot: ⇒ ("c:" "some")

10:43 AtKaaZ: oh really?

10:43 that's odd

10:43 S11001001: AtKaaZ: the selection of string methods that actually interpret their args as regexes is utterly arbitrary

10:43 I would trust String methods as far as I can throw them

10:44 arrdem: TIL S11001001 can throw bytes

10:44 S11001001: which is 0mm, since they are abstractions and not things I can pick up and throw

10:44 jkkramer: ,(clojure.string/replace "a word in a string" #"(word)" "**$1**") ;oskar__

10:45 AtKaaZ: it's just that I've seen this code (.split File/separator) which obviously works with "/"

10:45 but fails on windows :))

10:45 S11001001: for example replace(CharSequence,CharSequence) does literal replacement, replaceAll(String,String) does regex replacement

10:45 it's dumb.

10:45 AtKaaZ: that's what it does in java too right?

10:46 oh you mean under the hood those are used by clojure

10:46 S11001001: not so much under the hood as sitting on top of the hood, flipping you the bird

10:47 AtKaaZ: lol

10:50 craigbro: morning

10:52 phuff: G'morning :)

10:53 I have some config that defines which libraries to require at runtime

10:53 Like {:libspec "myproj.services.myservice"}

10:53 And I want to look at a variable in (myproj.services.myservice/short-name)

10:54 Or call a function in it

10:54 I can require it like this: (require (symbol (:libspec service-definition)))

10:54 But I'm having trouble figuring out how to refer to the variables in it when the libspec is in a string like that.

10:55 I tried: (ns-resolve (symbol (:libspec service)) (symbol "short-name")) to get the value of short-name in the lib specified in (:libspec service) but it didn't return the string I was looking for.

10:58 jkkramer: phuff: ns-resolve returns a var, which must be deref'd to get its value

10:59 phuff: jkkramer So if I want to get a variable who has a fully namespace-qualified symbol as defined in a string I don't use ns-resolve?

11:02 jkkramer: phuff: ns-resolve is fine (assuming doing what you're doing at runtime is a good idea)

11:02 &(ns-resolve 'clojure.core 'map)

11:02 lazybot: java.lang.SecurityException: You tripped the alarm! ns-resolve is bad!

11:03 jkkramer: anyway, that returns a var and @(ns-resolve 'clojure.core 'map) returns the value - the map function in this case

11:03 phuff: Ah @ is what I'm looking for!

11:03 I was trying intern

11:03 But that wasn't quite right either

11:03 jkkramer: @var is the same as (deref var)

11:04 phuff: Intern kind of does the same thing though doesn't it?

11:04 jkkramer: no, intern creates a var

11:04 phuff: It looks like it can read a var, too, though?

11:04 jkkramer: intern returns a var if it exists, otherwise creates it

11:05 i think

11:05 anyway, reading the docs will answer it. gotta go

11:11 phuff1: Thanks for the help jkkramer

11:40 * gfredericks rages at korma some more

11:41 devinus_: gfredericks: is korma bad?

11:42 gfredericks: just magical

11:42 and changing apparently

11:42 AtKaaZ: magillion (magical cameleon)

11:43 gfredericks: I'm trying to figure out how it manages connections

11:43 or how to hook into clojure.java.jdbc to transform the return values from queries

11:48 seancorfield: ping

11:48 seancorfield: gfredericks: pong?

11:49 gfredericks: seancorfield: I'm trying to wrangle korma into doing what I want and am curious about your opinion re. clojure.java.jdbc

11:49 specifically I'm trying to support postgres arrays, and in particular I want to have them returned from a SELECT as sequences

11:50 my issue doing this in a korma transform function is that the transform function might be run after the connection is closed, and apparently the java.sql.Array type used needs to read stuff from the connection

11:50 so turning it into a seq at that point fails

11:50 I was curious if clojure.java.jdbc could support arbitrary transformations on types coming out, or something like that

11:51 I was looking at the resultset-seq function and can see a point in there where the transformation could be done, but that would require patching

11:51 was just mulling thoughts trying to figure out whether this is best done at the korma level or within c.j.jdbc

11:53 seancorfield: Yes, I've been considering that because it would make supporting a couple of Oracle quirks a bit easier.

11:53 gfredericks: one thought was a protocol in c.j.jdbc for reading jdbc types

11:53 which I guess would default to identity

11:53 to give the current behavior

11:53 seancorfield: My initial thinking was "No, it should be done by the user" but then - like you - I found a couple of places where it's too late for the user to do it :(

11:54 c.j.jdbc is getting a fairly major overhaul at the moment so now is the time for stuff like this if you can come up with a clean way to do it via optional keyword arguments or something (or protocols - I hadn't considered that path).

11:54 gfredericks: well I expect korma could be modified to make sure the stuff gets done before the connection is closed; I guess I thought there might be other reasons it could be nice at the c.j.jdbc level; worth asking at least

11:55 seancorfield: I could have a protocol patch ready pretty fast I think

11:55 seancorfield: 'k

11:56 Git has the latest source (in the 0.2.4-SNAPSHOT - which will actually become 0.3.0 due to the API changes)

11:56 TimMc: korma chameleon

11:57 craigbro: me gusta korma

11:57 gfredericks: seancorfield: I think we're on 0.2.2, but hopefully the patch will be equally valid at both points

11:58 craigbro: gfredericks: i am heavy user of korma too

11:58 gfredericks: seancorfield: would a pull request be a good place for further discussion? or a jira ticket?

12:04 seancorfield: https://github.com/fredericksgary/java.jdbc/commit/c5ea0ac2b8a0fedc383b985c90c3f69956b1f287

12:04 tests still pass

12:12 technomancy: gfredericks: you troll you

12:13 gfredericks: technomancy: wat? why?

12:14 technomancy: "would a pull request be a good place to discuss a change to a contrib library?" =)

12:14 gfredericks: oh; yeah, I honestly couldn't remember if there were some edge cases where that was acceptable

12:14 after more thought it does sound unlikely

12:15 TimMc: I think CLJS takes PRs, but not contribs.

12:16 gfredericks: I knew I wasn't crazy

12:16 TimMc: no idea why the difference?

12:16 TimMc: Nope.

12:18 augustl: what does #' mean in a macro?

12:19 llasram: &#'var

12:19 lazybot: java.lang.RuntimeException: Unable to resolve var: var in this context

12:19 mattmoss: var, methinks

12:19 craigbro: whois maintaing korma now?

12:20 llasram: &#'deref

12:20 lazybot: ⇒ #'clojure.core/deref

12:20 pjstadig: clojurescript does not take pull requests

12:20 llasram: There we go -- an example that isn't lies

12:20 pjstadig: that was the source of the whole thread on the clojure ML

12:20 augustl: hmm

12:20 gfredericks: that it used to? or somebody thought it should?

12:20 pjstadig: https://github.com/clojure/clojurescript/pull/20#issuecomment-11119404

12:21 llasram: &(map class [#'deref deref])

12:21 lazybot: ⇒ (clojure.lang.Var clojure.core$deref)

12:21 edtsech: craigbro: alexbaranosky

12:22 craigbro: thanks

12:23 augustl: llasram: I don't get it at all :)

12:25 gfredericks: augustl: it means the same inside a macro as outside

12:25 the reader expands it to (var foo)

12:25 augustl: ah

12:25 gfredericks: var is a special form that looks up the var that a symbol refers to

12:25 llasram: My pedagogical approach needs work

12:25 (inc gfredericks)

12:25 lazybot: ⇒ 14

12:25 gfredericks: phew; no more unluck

12:27 augustl: attempting to grok the "context" macro in compojure

12:28 clerksy: Is there a way to call "lein test" from nrepl? I am a long time vim user currently trying out emacs. I would like to not have to leave emacs and hit the command line.

12:28 craigbro: clersky: M-x shell RET lein test

12:28 clerksy: Ahh

12:29 craigbro: Thanks, that clearly applied to all term commands then.

12:29 craigbro: well, all term cmds that don't need a real tty

12:29 aka, don't use curses and just spit text to stdout

12:29 clerksy: Yeah

12:29 craigbro: however, you can also to M-x terminal

12:29 if you want those

12:30 it'll do auto paging etc..

12:30 you can run top inside it etc...

12:31 clerksy: craigbro: Thanks :)

12:56 TimMc: pjstadig: I could have sworn CLJS had a friendlier development model, including use of git as collaboration tool.

12:56 Morgawr: hello, I'm not sure if this is the proper place to ask but is it normal that the default example for the clojurescript one project (bare app with clojurescript) doesn't work? I input my name http://www.morgawr.eu/clj/#form here and it doesn't show me the following view...

12:57 it works fine in development mode, but after I build it, that's what happens

13:01 technomancy: Morgawr: I get the impression clojurescript one isn't actively maintained

13:01 Raynes: I never found it all that useful to begin with.

13:01 People mostly just misinterpreted what it was for, probably because of its weird name.

13:02 Morgawr: I was mostly looking for a way to get started with clojurescript.. Like, I just want a simple environment where I can create powerful clojure functions that I can use in a web page

13:02 progo: Humm... I've got enlive deftemplate NPEing on me. Googled for some results for bad paths but I use absolute paths that are correct.

13:02 Morgawr: everybody pointed me to clojurescript one as the best place to start tinkering

13:05 luxbock: is there an easy way to use a map as though it's keys and values were reversed?

13:05 technomancy: luxbock: you can do (zipmap (vals m) (keys m))

13:06 luxbock: alright, thanks

13:06 technomancy: or if you're feeling fancy (apply zipmap ((juxt vals keys) m))

13:07 (don't actually do that)

13:07 luxbock: hehe

13:07 arrdem: herm... so I started a clojure codebase for my compilers class and turns out I can only get away with a clisp. should I do a straight port and just get used to (setf), or try to add (reader?) macros to get clojure atop clisp?

13:09 technomancy: arrdem: you could help pjstadig with his elisp compiler =)

13:09 CL is basically a superset of elisp

13:09 arrdem: do they actually require clisp, or will any common lisp implementation do?

13:10 arrdem: technomancy: the prof has a 1k+ line code generator for SPARC in ANSI clisp, so there's a lot of reason to use clisp over clojure XP

13:10 but any clisp

13:10 'll do

13:11 technomancy: "clisp" is the GNU implementation of common lisp

13:11 arrdem: s/clisp/common lisp/g

13:11 Raynes: CL is the commonly abbreviated form of "Common Lisp".

13:12 technomancy: if you're allowed to use ABCL you could probably use clojure's data structures

13:12 but I don't imagine it would be much fun

13:13 dnolen: Morgawr: you're probably better off starting with lein-cljsbuild and going through this http://github.com/magomimmo/modern-cljs

13:14 Raynes: dnolen: That's also a weird name.

13:14 :p

13:14 arrdem: ok well thanks for the hints... pjstadig's compiler looks cool

13:14 Raynes: Clojurescript is, by definition, modern.

13:14 ChongLi: haha

13:14 modern cljs

13:14 Raynes: Calling it 'modern cljs' makes it sound like he is revitalizing a 30 year old language.

13:15 ChongLi: that's the whole point

13:15 I love it

13:15 technomancy: yeah, I think it's intended to be ironic

13:15 Raynes: It's possible he knew the irony.

13:19 dnolen: Raynes: heh, true but at least it starts from first principles

13:19 Raynes: dnolen: Oh, it looks great.

13:21 mcohen3: anyone used something like (.scheduleAtFixedRate (Executors/newScheduledThreadPool 1) to schedule a function? this seems to work fine if i pass something like #(println "hello") but if i use the name of the var of my function, it never seems to fire

13:21 pulling my hair out on this one

13:21 i've tried #(my-function) and just my-function as the arg

13:21 no joy either way

13:22 seancorfield: gfredericks: sorry, got pulled away... the source for 0.2.2 is radically different to 0.2.4-SNAPSHOT so you'll definitely need to work out a patch against master

13:22 I'm open to a discussion back and forth on github first prior to a patch on JIRA (since dnolen and nadamin seem to have set a good precedent there :)

13:23 ChongLi: a link to this modern cljs github should be on a wiki somewhere

13:23 this is great

13:23 llasram: mcohen3: Just passing `my-function` as the Runnable should work fine. I'd guess your function is throwing an exception or otherwise failing to act as expected

13:24 seancorfield: gfredericks: oh, that protocol commit is much simpler than i expected... nice...

13:26 luxbock: how do I turn a numeral character into an integer? i.e. \9 = 9

13:26 progo: (Integer. (str \9))

13:26 llasram: &(Long/parseLong (str \9))

13:26 lazybot: ⇒ 9

13:26 AimHere: ,(integer/parseInt \9)

13:26 luxbock: ah

13:27 Raynes: &(Long. \9)

13:27 lazybot: java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Long

13:27 Raynes: &(Long. "9")

13:27 lazybot: ⇒ 9

13:27 mcohen3: thanks llasram

13:27 Raynes: &(Long/parseLong \9)

13:27 lazybot: java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String

13:27 Raynes: Heh

13:27 augustl: woha, macros! Writing my first useful macro DSL after 6 or so months of Clojure, pretty neat stuff

13:27 TimMc: &(- (int \9) 48)

13:27 lazybot: ⇒ 9

13:27 TimMc: ^ don't do that

13:28 AimHere: &(- (int \9) (int \0)) might be better style, although not good either

13:28 lazybot: ⇒ 9

13:28 Raynes: augustl: Hope it is a macro DSL around a usable functional interface.

13:28 dnolen: ChongLi: done

13:30 augustl: Raynes: hmm, not following

13:30 Raynes: pretty sure the answer is yes though

13:31 Raynes: augustl: Your code shouldn't be based around macros. The idea is to write your code with plain functions and then, if you want, write some macros to make working with that function-based interface nicer.

13:31 I wasn't assuming the former, but I was mentioning it just in case.

13:31 augustl: Raynes: np, I appreciate it :)

13:33 ChongLi: dnolen: which wiki is this?

13:33 dnolen: ChongLi: look at the CLJS github landing page, there's a tutorial link now, and under the main wiki page a tutorials section

13:33 and link to modern-cljs from there

13:34 ChongLi: ahh nice

13:34 TimMc: &(- (int \9) 16r30)

13:34 lazybot: ⇒ 9

13:35 ChongLi: I think it's pretty amazing how github has basically become the social network for programmers

13:35 is that the right term for it?

13:35 I guess it's more than that

13:36 AimHere: Social? Programmers? What sorcery is this?

13:36 ChongLi: the really cool thing about it is that all the stuff is part of the repo so if github ever turned on the users they'd already have all their data cloned locally

13:37 AimHere: When I were a lad, programmers were made to sit alone in darkened rooms with green screen terminals, to be let out only to gather pizza and caffeinated beverages. Social networking was something they were actively shunned from

13:40 ChongLi: haha

13:50 TimMc: ChongLi: What are you on about, IRC is clearly the social network for programmers.

13:50 I can tell because that's what I use.

13:50 Raynes: http://i.imgur.com/2Fer8.gif when I have to go where people are.

13:50 ChongLi: haha

13:53 luxbock: is there a way that I could extend Clojure's >, < and = to compare playing cards that are represented as {:rank :ace, :suit :spade} and some other maps to represent their rankings?

13:54 cbp`: what's the deal with clojure-doc.org

13:54 seems down most of the time

13:54 AimHere: I don't think clojure supports operator overloading

13:54 luxbock: alright, so I'll just write my own operators

13:54 dnolen: luxbock: you cannot override >, <. = can be overridden if you're using deftype

13:55 technomancy: luxbock: you can use :refer-clojure :exclude in the ns clause to bring in a different definition of anything in clojure.core

13:55 but you can't extend the ones in clojure.core

13:56 ibdknox: wow, I never realized they picked clojure-doc.org

13:56 that was dickish

13:57 technomancy: ibdknox: eh? it's the same people as the people maintaining clojuredocs.org

13:57 the long-term plan is to merge the two

13:57 ibdknox: wat

13:57 I though it was a rogue effort originally

13:58 technomancy: yeah, it's just blocked on getting a proper clojure web UI written for the existing clojuredocs API

13:58 ibdknox: in that case it makes even less sense... a subdomain would've been far smarter

13:58 well that's good :)

13:58 confusing for now, but in the end a great outcome

13:58 technomancy: the original maintainer was MIA for a long time; they probably had access to the machine but not the DNS records

13:59 possibly still MIA?

13:59 TimMc: next.clojuredocs.org would be nice... if they could get it.

13:59 ibdknox: ah

14:00 amalloy: i have to say, if it's really the same people they've done a terrible job of saying so. i, like ibdknox, thought it was some totally different group of guys rudely using a near-identical domain

14:00 ibdknox: yeah, I remember the threads

14:00 it was definitely a splinter thing in the beginning

14:01 technomancy: the original maintainer disappeared and did a half-hearted handoff to one of the guys behind the new effort IIRC

14:02 whole thing was a bit of a mess from the start; closed-source rails app =(

14:02 TimMc: $kill

14:02 lazybot: KILL IT WITH FIRE!

14:03 amalloy: luxbock: if you're interested, one of my first clojure projects was a card-game player, and the card-ranking mechanism is pretty simple at https://github.com/amalloy/ddsolve/blob/master/src/ddsolve/mechanics.clj#L31-L50. there's no real need to make > and < recognize cards

14:05 don't take the project as a whole too seriously; i recognize now that it's loaded with bad ideas. but ranking cards is easy enough

14:05 Raynes: amalloy: trollface

14:05 amalloy: Whoa, one of your first clojure projects? So you started around the time defrecord was invented?

14:05 amalloy: yes, i started just as 1.2 was coming out

14:05 Raynes: Jesus, how on earth are you better at Clojure than I am if I've been doing it so much longer? Sheer experience to begin with?

14:06 I'd guess so.

14:07 ibdknox: Raynes: he's actually an AI designed solely to write clojure code and troll #clojure.

14:07 Raynes: the guy we've met is a paid actor

14:07 Raynes: He must be well paid.

14:07 ChongLi: hmm, would core.logic be good for doing card game rules?

14:07 Raynes: He lives 3 miles from me. Or at least, will in two weeks.

14:07 amalloy: he would have to be, to put up with smelly humans all the time

14:08 i mean, i am also a human and do not find humans in general smelly at all

14:08 Raynes: Something fishy is going on here.

14:32 TimMc: How do I tell lein2 to use my credentials.clj.gpg for Clojars?

14:33 DEPLOY.md tells me to set :creds :gpg for Clojars, but I don't know where that goes.

14:34 technomancy: TimMc: I think in :repositories in the :user profile; lemme check

14:36 gfredericks: I need to learn to use irssi better; nearly missed seancorfield's replies :/

14:36 TimMc: What URL do I use for Clojars?

14:36 technomancy: TimMc: you can use #"clojars"

14:36 ChongLi: gfredericks: lastlog is your friend

14:37 gfredericks: it tells me it would print 2107 lines

14:37 TimMc: technomancy: So, any repo URL containing "clojars" will get my credentials?

14:37 * gfredericks tries it

14:37 ChongLi: put a query after it

14:37 gfredericks: ooh

14:37 like my nick

14:38 ChongLi: /lastlog -clear

14:38 TimMc: I suppose as long as the set of repos I try to push to is controlled by me...

14:38 ChongLi: to get rid of it

14:38 technomancy: TimMc: right; I guess that could go wrong if you are tricked into using lein on a project with a hostile :repositories entry

14:38 gfredericks: lastlog is my friend

14:39 TimMc: #"^https://clojars.org/.*" should be fine.

14:39 technomancy: I thought irissi was for vim users?

14:39 TimMc: it's just https://clojars.org/repo/ fwiw

14:40 ChongLi: irssi is just an irc client

14:41 TimMc: technomancy: profiles.clj: {:user {:repositories [["clojars" {:url #"^https://clojars.org/.*", :creds :gpg}]]}} then?

14:41 gfredericks: technomancy: I was using erc for a while. abedra said it was terrible and I should use irssi so I switched back unquestioningly.

14:41 technomancy: TimMc: sure

14:41 what

14:41 craigbro: I'm prety sue itjustuploads your public key

14:41 gfredericks: also amalloy was always complaining about my away thing which I never understood.

14:42 craigbro: and doesn't ship any private keys

14:42 gfredericks: (I never understood the away thing; I usually understand amalloy)

14:42 technomancy: ChongLi: I'm using "vim users" here as a shorthand for "people who don't use Emacs but still like things that run in a terminal" =)

14:42 ChongLi: technomancy: oh

14:42 I use irssi and emacs

14:42 TimMc: technomancy: "https://clojars.org/repo/ and #"^https://clojars.org/.*" have a type mismatch merging profiles." -- but then it knows to look for GPG credentials anyhow...

14:42 ChongLi: I guess that makes me a weird edge case

14:44 I've been using irssi since long before I ever tried emacs, however

14:44 technomancy: TimMc: oh, my bad. all you need in the user profile is this: :repositories [["clojars" {:creds :gpg}]]

14:44 TimMc: the regex goes in credentials.clj.gpg

14:44 TimMc: Is that "clojars" string a regex, or a literal match?

14:44 *name match

14:44 technomancy: TimMc: in that case "clojars" is a literal match, yes.

14:45 so that profile merge will apply it to the existing clojars repositories entry

14:45 TimMc: Ah, OK.

14:45 technomancy: probably could use some clarification in the docs

14:45 gfredericks: is lastlog an irc feature or irssi?

14:45 ChongLi: is there any way to get a cljs browser repl without it starting a web server right on the spot? I'm already using ring to serve my application

14:45 TimMc: And I guess I need gpg-agent running as well.

14:46 ChongLi: gfredericks: I couldn't tell you, I've been using irssi exclusively for so long

14:46 haha

14:48 irssi has lots of nice scripts, by the way

14:48 http://scripts.irssi.org/

14:58 gfredericks: technomancy: you hate protocols?

14:58 Frozenlock: Oh wow... ibdknox's lecture at clojure conj stops at a huge cliffhanger! https://www.youtube.com/watch?v=V1Eu9vZaDYw

14:59 technomancy: gfredericks: I hate how people use protocols without understanding that they're sacrificing flexibility for performance.

14:59 gfredericks: also I love vars

14:59 gfredericks: technomancy: inflexibility versus what approach? multimethods?

15:00 technomancy: gfredericks: versus anything that uses vars

15:00 gfredericks: like robert.hooke?

15:00 pjstadig: technomancy: what you're saying doesn't make sense

15:00 technomancy: no, like defn and defmulti

15:00 pjstadig: protocol functions are put into vars

15:00 gfredericks: is this about :reload and such?

15:01 Raynes: *shrug*

15:01 I've never understood why he doesn't like them.

15:01 Frozenlock: technomancy: If I have java objects that I want to convert to maps (each with its own method), are protocols still bad?

15:01 Raynes: They serve a specific purpose and are faster than multimethos for that purpose.

15:01 pjstadig: protocol functions are functions and they live in vars

15:02 * gfredericks is terribly curious about protocol impl

15:02 pjstadig: you can map them, comp them, wrap them, partial them

15:02 technomancy: pjstadig: sorry, I was referring to records and the fact that they usually go hand in hand

15:02 gfredericks: imagine this: you have two objects which print identically but are not equal

15:02 pjstadig: yeah records are a pain if you recompile them, because clojure generates an interface

15:03 technomancy: also, protocols usually force awkward arity choices upon you

15:03 in many cases where they're used people introduce nonsense hierarchies which aren't actually used by the function but are just used for purposes of dispatch

15:03 gfredericks: technomancy: what was the identical-printing-objects thought related to?

15:03 ChongLi: to me protocols seem most useful if you want to implement your own collections with deftype or something

15:04 technomancy: gfredericks: reloading records

15:04 ChongLi: otherwise just use maps and vectors

15:04 pjstadig: protocol functions can have multiple arities

15:04 they can't take primitive hints though, so that's definitely a tradeoff

15:04 and i guess they can't take varargs either

15:04 gfredericks: technomancy: I'm curious if you approve of https://github.com/fredericksgary/java.jdbc/commit/c5ea0ac2b8a0fedc383b985c90c3f69956b1f287

15:05 technomancy: pjstadig: they can have multiple arities, but they force you to put the dispatch object first, which often interferes with what the function is actually about

15:05 pjstadig: yeah sure that's a tradeoff

15:06 i think the best practice is to use protocol functions as an internal implementation method, and have public functions that call them

15:06 so you can use varargs and order the args how you like

15:06 technomancy: gfredericks: in that case you're probably justified given that you're likely to be in perf-critical code

15:07 it bugs me when I see them exposed in application-level code

15:07 gfredericks: pjstadig: dnolen's approach of the -foo naming convention for protocol fns seems to have that organization as a side-effect

15:07 * Frozenlock is all confused about the difference between protocols and multimethods

15:07 gfredericks: technomancy: yeah I haven't seen any compelling uses for protocols/types/records in app code

15:07 danlarkin: phil is right

15:07 protocols are balllllllllllllllllllllllllllls

15:07 technomancy: gfredericks: also you're undeniably intertwingled with all kinds of crazy class hierarchies there anyway, so normal rules of taste don't necessarily apply

15:07 gfredericks: :)

15:07 bbloom: gfredericks: yeah, i do that -foo protocol method and foo no - public method for *all* my protocols

15:08 pjstadig: danlarkin: butt out

15:08 danlarkin: protocols can sC-u 42 u ck it

15:08 technomancy: danlarkin: oh man you beat me to it

15:08 ChongLi: Frozenlock: multimethods have you specify your own dispatch function

15:08 pjstadig: you just saw me talking to phil

15:08 :-p

15:08 danlarkin: no you butt out pjstadig

15:08 ChongLi: and then define methods on the value which results from that dispatch function

15:08 technomancy: ~gentlemen

15:08 pjstadig: (he's looking at my laptop screen)

15:08 technomancy: aw come on clojurebot; ruining my timing

15:09 danlarkin: srsly

15:09 technomancy: clojurebot: gentlemen

15:09 pjstadig: the tubes must be clogged

15:09 hiredman: ~ping

15:10 Frozenlock: ChongLi: Protocols do it too, don't they? (extend-protocol class fn...

15:10 dnolen: gfredericks: that protocol fn + fn naming style was actually already in place in CLJS

15:11 ChongLi: Frozenlock: no, protocols dispatch on types

15:12 you could write a multimethod that uses even? as its dispatch function, for example

15:12 and then do different things whether the number is even or odd

15:12 as a silly example

15:14 AimHere: (defrecord EvenNumber [x] ...)

15:14 Frozenlock: ChongLi: Silly example, but straight to the point :)

15:14 gfredericks: dnolen: did you specifically backport core.logic to that style? now that I think about it I'm not even positive core.logic does have that style :/

15:15 TimMc: technomancy: And what is Clojars' releases URL?

15:15 technomancy: TimMc: https://releases.clojars.org/repo/ but you never need creds for that

15:15 TimMc: ?

15:15 technomancy: because you deploy to it through the regular repo + promotion

15:15 TimMc: "No credentials found for releases"

15:15 It sure sounds like lein is trying to find it.

15:16 technomancy: are you trying to deploy to it?

15:16 TimMc: "lein deploy"

15:16 dnolen: gfredericks: oh yes, the CLJS version of core.logic uses that style. When the CLJ/CLJS story improves I'm planning having one codebase w/ the CLJS protocol style

15:22 bbloom: dnolen: how up-to-date does the cljs core.logic stay?

15:27 ChongLi: are there any plans for some kind of CLJ/CLJS subset for common libraries?

15:32 bbloom: ChongLi: it's something that lots of folks are interested in

15:32 it seems like a self-hosting cljs compiler is a more pressing desire that would make that sharing between platforms easier to achieve

15:33 TimMc: technomancy: Ah, it is `lein deploy clojars`.

15:33 ChongLi: that would be pretty cool

15:33 would it run on headless V8 a la node?

15:34 we'd finally be able to write some fast-starting shell scripts in clojure

15:41 dnolen: bbloom: doesn't stay up to date at all

15:41 bbloom: dnolen: yeah, that's what i figured. it's a pita to maintain two libs :-/

15:42 i was working on my little dom manipulation library in clojurescript, but the implementaiton wasn't interesting: the interface was the interesting bit... so i used Apache Batik for an SVG DOM and then worked out the interface all in clj instead of cljs... the iteration times were much better

15:42 dnolen: bbloom: yes and they probably actually need to be slightly different for performance reasons as well. PHMs are not as fast in CLJS

15:43 bbloom: dnolen: how big is the perf gap?

15:45 dnolen: bbloom: around 6-8X for zebrao last time I checked. CLJS takes 17ms-20ms, CLJ ~2.5ms

15:45 bbloom: dnolen: any idea the underlying source of the slowness?

15:46 dnolen: bbloom: I can't use PHMS

15:47 bbloom: those CLJS numbers are within 1.5X of miniKanren under Racket & Chez Scheme so they are pretty good.

15:47 bbloom: dnolen: heh, yeah that's impressive

15:47 dnolen: bbloom: it is.

15:48 bbloom: you'll definitely being able to do serious logic / constraint stuff in the browser.

15:48 be able

15:48 ChongLi: PHM?

15:49 bbloom: ChongLi: persistent hash map

15:49 ChongLi: oh

15:49 bbloom: the backing type for most map objects

15:49 ChongLi: they aren't in cljs?

15:50 bbloom: they are, he's just saying they are a tad slower than clj on the jvm

15:50 ChongLi: ah

15:50 bbloom: dnolen: although i'm curious why that's the case...

15:51 dnolen: bbloom: PHM does a lot of allocation, we're also missing native bit population count operator (not sure if that's a bottleneck but it's suspicious)

15:52 so I avoided PHMs

15:52 it's been a while since I checked JSC or SM, but back when I originally did the PHM benchmarks, SM & JSC were 8-10X slower

15:52 V8 is better but still far cry from JVM

15:53 ChongLi: does jvm have popcount?

16:00 dnolen: ChongLi: it does

16:01 ChongLi: man, javascript is the craziest language that people actually use

16:01 implicit coercions on equality operations? wow

16:02 TimMc: ChongLi: Doesn't PHP do that?

16:02 AimHere: Perl too, I thought

16:03 TimMc: &(.bitCount 42)

16:03 lazybot: java.lang.IllegalArgumentException: No matching field found: bitCount for class java.lang.Long

16:03 TimMc: &(Long/bitCount 42)

16:03 lazybot: ⇒ 3

16:04 TimMc: 3 million Blub programmers can't be wrong!

16:04 ChongLi: haha

16:09 dnolen: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1418

16:09 is what bit-count looks like in CLJS

16:12 brehaut: dnolen: minor minor quirk, "Counts the number of bits set in n" [v]

16:12 docs say n, args says v

16:13 ticking: am I the only one finding incanter very unclojury and rather common lispy ^^?

16:16 gfredericks: how do I build a contrib project for pushing to clojars?

16:17 the pom.xml has some odd parent entry in it that I assume takes special handling

16:19 dnolen: brehaut: thanks

16:20 ticking: it's an old Clojure library.

16:22 ticking: dnolen, possible, I've seen many other old libs though that don't use implicit variable bindings and macros everywhere ^^

16:24 technomancy: ticking: yeah, but those libs got it right by luck =)

16:24 Sgeo: Are recruiters evil?

16:25 bhenry1: hello

16:25 technomancy: Sgeo: most are. possibly not all.

16:26 Sgeo: How do I be careful?

16:26 Because I've been talking to one, I think

16:26 gfredericks: try to keep them on the phone

16:26 ask them where the bomb is

16:26 and how to disarm it

16:26 stay calm

16:26 Sgeo: Someone suggested that the only reason he asked me to make changes to my resume rather than changing it directly was because I used LaTeX

16:28 bhenry: i just did a `git pull` on my emacs.d from emacs-live and there is no more clojure-jack-in. can someone point me at the documentation of changes?

16:28 Sgeo: Probably doesn't help that I didn't give an answer when he asked how much I was looking for

16:28 ticking: technomancy hrhr

16:28 Sgeo: Money... stuff... is beyond me

16:29 craigbro: nrepl-jack-in?

16:30 TimMc: Sgeo: I pretty much just hang up on recruiters at this point. THere might be some nice ones, but I'm done wasting time on the jerks.

16:30 Sgeo: What, exactly, do the jerks do that are evil

16:30 Or jerk-y?

16:31 technomancy: Sgeo: most recruiters cast a wide net because taking the time to actually making sure that a candidate is a good fit for a position does not scale

16:31 dnolen: ticking: yeah I'm with technomancy. Early Clojure libs went wild with dynamic binding & macros

16:32 bhenry: craigbro: thanks!

16:32 pjstadig: technomancy: the other really annoying thing with protocols is that they don't play nicely with M-.

16:32 technomancy: pjstadig: hush, you're only encouraging him

16:33 oh wait

16:33 Raynes: alex_baranosky: Is there a way to find out which fact is taking a bazillion years (infinite looping) when running midje tests?

16:35 Oh wow, what luck. It happened to be the first one I commented out.

16:35 That's dadgum magical.

16:36 craigbro: many, binary search is fast!

16:36 s/many/man

16:36 gfredericks: Raynes: actually you were just 1 over the max-tests limit

16:37 augustl: looking for suggestions on how to better implement "doit" https://www.refheap.com/paste/8875

16:38 clerksy: Ok, I am the only one who finds paredit annoying as can be?

16:38 TimMc: Sgeo: They call me at work. On my work phone.

16:38 AimHere: You're not, clerksy

16:38 technomancy: clojurebot: paredit?

16:38 clojurebot: paredit tutorial is http://p.hagelb.org/paredit-outline

16:38 clerksy: I am just picking this up, but man if forces parens in wrong spots and I still cant find how to remove them

16:38 augustl: clerksy: I love it! If you're the type of person that isn't a good fit for paredit, you should change your personality :)

16:38 TimMc: How antisocial is that?

16:38 gfredericks: augustl: wow man what the heck is that doing

16:38 Frozenlock: clerksy: No, but apparently it's the best thing since butter, so don't say it... :P

16:39 Sgeo: TimMc, o.O

16:39 augustl: gfredericks: mapping the second item in a list

16:39 clerksy: technomancy: Thanks, I will check this out.

16:39 TimMc: Also they usually don't take the time to find out anything about me.

16:39 augustl: gfredericks: it's for some sexp rewrites for a macro..

16:39 AimHere: I occasionally go into paredit mode and think 'Okay, I can see the point of this' and then I spend 2 minutes trying to delete a loose pair of parens and I turn it off again for 6 months

16:39 technomancy: clerksy: actually I was trying to remember if I had already taught clojurebot a certain factoid

16:39 gfredericks: augustl: destructuring would help

16:39 technomancy: clojurebot: paredit |is| not for everyone, but what you need to understand is how to become the kind of person that paredit is for.

16:39 clojurebot: In Ordnung

16:39 technomancy: there we go

16:39 TimMc: haha

16:40 augustl: exactly :)

16:40 Raynes: clerksy: You get used to it. It's a lot more useful than it is annoying.

16:40 TimMc: technomancy: Unfortunately, clojurebot has misinterpreted that. You included an " is " later in the factoid.

16:40 gfredericks: ,((fn doit [f xs] (map (fn [[a b & cs]] (list* a (f b) cs)) xs)) '((123 "foo" 456) (123 "bar" 456)))

16:40 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval29$doit>

16:40 augustl: gfredericks: ah

16:40 technomancy: TimMc: I thought |is| forced it to be at the right place?

16:41 clerksy: Raynes: I hope so.

16:41 gfredericks: ,((fn doit [f xs] (map (fn [[a b & cs]] (list* a (f b) cs)) xs) '((123 "foo" 456) (123 "bar" 456)))

16:41 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

16:41 TimMc: technomancy: That's only for forgetting, I think.

16:41 gfredericks: ,((fn doit [f xs] (map (fn [[a b & cs]] (list* a (f b) cs)) xs) '((123 "foo" 456) (123 "bar" 456))))

16:41 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval87$doit>

16:41 Raynes: clerksy: When you find yourself in a cave and it's dark and you're likely to be eaten by a grue, you'll be happy you can wrap yourself in protective parens with a single keystroke.

16:41 technomancy: TimMc: curses

16:41 TimMc: several, yes

16:41 gfredericks: augustl: I give up; you can debug it :)

16:41 technomancy: clojurebot: paredit |is| not for everyone, but what you need to understand ís how to become the kind of person that paredit ís for.

16:41 clojurebot: Alles klar

16:41 technomancy: TimMc: tada!

16:42 augustl: gfredericks: didn't know about list*, nice

16:43 clerksy: it's probably annoying to not be able to do anything you want, but that's the power of it

16:43 TimMc: technomancy: ...nice.

16:43 Unfortunately, there's no way to kill the old one.

16:43 augustl: gfredericks: much better, thanks :)

16:43 technomancy: blargh

16:44 gfredericks: augustl: for super funs use (partial map ...)

16:44 TimMc: augustl: Needs more destructuring.

16:44 gfredericks: i.e., (def doit (partial map ...))

16:44 technomancy: TimMc: I could break into hiredman's place of residence, but I think he runs it off-site

16:44 * gfredericks thinks "hiredman's place of residence" would be a terrible name for a rock band

16:45 augustl: ended up with this: (map (fn [[x1 x2 & xs]] (list* x1 (str "prefix-" x2) xs)) xs)

16:45 hiredman: I should write a bnf for clojurebot factoids and redo the parser

16:47 TimMc: &(let [do2 (fn [f] (fn [[a b & c]] (list* a (f b) c)))] (map (do2 #(str "prefix-" %)) '((123 "foo" 456) (123 "bar" 456))))

16:47 lazybot: ⇒ ((123 "prefix-foo" 456) (123 "prefix-bar" 456))

16:47 augustl: now write a do-n :)

16:53 pjstadig: hiredman: haha you and bnf

16:55 ticking: dnolen, it's really interesting to see how the style changed, thanks for the insight :D

17:03 maio: how can I reduce list so that I get every Nth element of it?

17:04 AimHere: .(map first (partition-all 5 (range 50)))

17:04 &(map first (partition-all 5 (range 50)))

17:04 lazybot: ⇒ (0 5 10 15 20 25 30 35 40 45)

17:04 maio: nice, thanks :)

17:07 augustl: mmm, decomplecting

17:08 Frozenlock: Very nice! It's a shame that I always forget about partition.

17:09 TimMc: bnf bnf bnf bnf wubwubwub

17:10 tomoj: I guess the expectation with ring's session middleware is that you return a response with {:session (update-session (:session req))} ?

17:11 i.e. "don't change the session at all" is (fn [app] (fn [req] (assoc (app req) :session (:session req))))

17:11 which still calls write-session

17:21 augustl: tomoj: I've only used the cookie store

17:21 works well enough for me :)

17:22 technomancy: tomoj: I think if you return a map without a session key it shouldn't change it?

17:22 you have to explicitly say :session nil to clear it IIRC

17:38 Frozenlock: Damnit github, stop messing my readme.org files!

17:39 Raynes: Damnit Frozenlock, stop using org-mode for readmes.

17:39 technomancy: github's org implementation is a lost cause

17:40 brehaut: markdown all the things :(

17:43 Frozenlock: brehaut: I'd rather write a txt

17:43 Or write an org and then export to txt. Mouhahaha!

17:43 Raynes: Frozenlock: Why not write org and export to markdown?

17:43 ;)

17:44 Frozenlock: Didn't know it could... must be the single file format I've never exported an org file to. o_O

17:45 Raynes: Frozenlock: Dunno if it can. Pandoc can do pretty much anything these days. I one exported kleenex to handkerchief.

17:46 bbloom: Raynes: does pandoc produce decent results?

17:47 Raynes: bbloom: I was using it to write my book at one point.

17:47 bbloom: Raynes: i meant for conversions

17:47 Raynes: bbloom: I was using it to convert markdown to latex. Do the math.

17:47 bbloom: ah ok

17:47 Raynes: :p

17:47 * bbloom adds 2 and 4, gets 7

17:48 Frozenlock: Should I refer to hash-maps as maps, or smaps?

17:48 Raynes: Ginger smaps.

17:48 bbloom: Frozenlock: not all maps are hash maps

17:49 Frozenlock: (╯°□°)╯︵ ┻━┻

17:49 weavejester: Does anyone know of a safe Clojure pr-str implementation?

17:49 bbloom: weavejester: what do you mean by "safe" ?

17:50 weavejester: One where (= x (read-string (pr-str x))) is always true

17:50 bbloom: can't exist really

17:50 technomancy: sure it can

17:50 weavejester: Er, let me clarify that - always true or throws an exception.

17:50 bbloom: well it certainly DOESN'T

17:51 weavejester: ok, well that's a different thing :-)

17:51 you can implement that trivially as an assertion type thing

17:51 technomancy: weavejester: so I forgot about this from our discussion earlier, but my first attempted patch for Clojure was to fix this: http://dev.clojure.org/jira/browse/CLJ-17

17:51 weavejester: Unfortunately I ran into a problem with records

17:52 bbloom: (defn pr-str-safe [x] (let [s (pr-str x) y (read-str s)] (assert (= x y)) s)))

17:52 weavejester: technomancy: Interesting

17:52 bbloom: Doesn't work with records

17:52 bbloom: weavejester: it throws an exception is they aren't equal, which is one of your requirements

17:53 technomancy: weavejester: reader syntax for arbitrarily-named keywords/symbols is definitely the way to go in the long-term

17:53 weavejester: (let [x #foo {:a 1}] (= x (read-string (pr-str x))))

17:53 That is always false

17:53 bbloom: is that a tagged literal or a record?

17:53 weavejester: A record isn't like a map, apparently. Printing and then reading it results in a value that is not equal to the original

17:53 A record

17:53 Raynes: bbloom: I hereby challenge you to a game of texas hold 'em.

17:54 bbloom: Raynes: um, ok... but why?

17:54 weavejester: I also tried (= (pr-str x) (pr-str (read-string (pr-str x))))

17:54 Raynes: Because poker is fun.

17:54 weavejester: But I realized that wouldn't work with maps, due to key ordering

17:55 bbloom: Raynes: heh, indeed, but i don't play online - in person only

17:55 dpwright: Hello, I'm having a little trouble compiling/serving a LESS css file using Dieter with Compojure/Ring -- I'm not sure if this is the right room to ask about this sort of thing or if there's somewhere more specific, but I thought I'd try here first

17:55 bbloom: Raynes: and only with cash :-)

17:55 Raynes: I really would hate to take your paycheck from you.

17:55 technomancy: lazybot plugin

17:55 bbloom: i don't have a paycheck, so it wouldn't be an issue :-P

17:55 besides, i wouldn't want to steal your milk money

17:56 Raynes: Oooh burn.

17:56 bbloom: although i'm not really sure why we're trash talking about poker all of a sudden, lol

17:56 brehaut: dpwright: just ask your question. if someone can help, they will

17:56 dpwright: The long and short of it is I'm getting a null pointer exception whenever I try to access a file which exists in the folder I've specified as dieter's assets folder

17:57 weavejester: Maybe I should write an edn-printer

17:57 dpwright: You can see the stacktrace if you go to wedding.test.dpwright.com and click the "link" link... "sample.less" is a file in the resources/assets/css folder

17:58 that link was generated with dieter's link-to-asset function

17:58 my suspicion is that I'm hooking the dieter middleware in wrong, or something

17:58 bbloom: weavejester: if you want to extend fipp, i'd be happy to help

17:58 weavejester: fipp?

17:58 bbloom: weavejester: github.com/brandonbloom/fipp

17:59 weavejester: bbloom: Ahh, well I'm not really after a pretty-printer

17:59 Just a way of storing Clojure data structures

17:59 bbloom: but it's almost as fast as a normal printer :-) and my plan is to be able to compile a non pretty printer statically

18:01 technomancy: all I want from a pretty-printer is the ability to reformat my code like this: http://technomancy.us/50

18:01 weavejester: bbloom: Hm… it seems like they'd be different goals...

18:02 bbloom: technomancy: totally doable :-P

18:02 weavejester: how so?

18:02 technomancy: bbloom: I assumed so; just thought I'd check to make sure

18:04 weavejester: bbloom: Well, pretty printing is about making things easier for a human to read. An EDN writer would be focused on adhering safely to a spec that, as far as I can tell, in some cases is subtly different from Clojure.

18:04 Or rather, stricter than Clojure

18:05 bbloom: weavejester: so the \i part of "fipp" is for being idiomatically data driven. i'd like to evolve towards a model where you can generate various types of output from common input documents. ie a pretty formatted representation, or one with color coding, or an html representation, or compile a non-pretty fast printing version, etc

18:06 weavejester: it's not there yet, and i need to put some thought into the details of that document format (it will likely evolve to be somewhat DOM-like in the sense that each node has a tag, some attributes, and some children) and how to process it

18:06 weavejester: Hmm, it feels a little complex...

18:06 TimMc: weavejester: (fn [& _] (throw (RuntimeException.))) is a safe implementation. :-P

18:07 weavejester: TimMc: :P

18:07 clojurebot: :negative/num-1 + :positive/num-1 = :zero/zero

18:07 bbloom: weavejester: it's more complex than a single hand coded print routine, but as you've discovered, that doesn't scale

18:07 weavejester: bbloom: Doesn't scale?

18:07 I'm dealing with heavily io-bound data. Scaling isn't the problem for me :)

18:08 bbloom: weavejester: i mean scale in the design sense

18:08 in order to get print/read to work correclty, it requires people write correctly bijective functions

18:08 weavejester: The problem is storing a data structure that can be always be read.

18:08 bbloom: you can generate those functions from a grammar!

18:08 weavejester: Ye-eeesss…

18:08 bbloom: fipp is only interested in the print side of the equation for now, but the same ideas can be applied: data all the things

18:09 weavejester: I was kinda looking for a solution I could implement in… say… an hour :)

18:09 bbloom: yeah, not gonna happen even if you go the naive route of hand coded functions lol

18:09 kovas: lol

18:10 weavejester: bbloom: Well… I think it might be possible

18:10 I mean, pr-str works, it just doesn't validate.

18:10 So I just need to ensure that a data-structure adheres to the rules of EDN

18:10 bbloom: use that asserting version i wrote above ^^ use that during development

18:10 weavejester: bbloom: The asserting function doesn't work with records, and I need to store records.

18:11 bbloom: i dont understand what the issue is with records

18:11 weavejester: Okay, try this...

18:12 bbloom: ,clojure.reflect.Field

18:12 clojurebot: clojure.reflect.Field

18:12 bbloom: ,(pr-str (clojure.reflect.Field. 1 2 3 4))

18:12 clojurebot: "#clojure.reflect.Field{:name 1, :type 2, :declaring-class 3, :flags 4}"

18:12 bbloom: ,(read-string (pr-str (clojure.reflect.Field. 1 2 3 4)))

18:12 clojurebot: #clojure.reflect.Field{:name 1, :type 2, :declaring-class 3, :flags 4}

18:12 bbloom: seems to work to me...

18:13 ,(let [obj (clojure.reflect.Field. 1 2 3 4)] (= (read-string (pr-str obj)) obj))

18:13 clojurebot: true

18:13 bbloom: works fine

18:13 weavejester: Uh… hm… it does for me now as well...

18:13 Let me retry with the data from before.

18:14 Ahah

18:14 It's because I used map->record

18:14 dpwright: This is how I'm passing the middleware to the handler I've specified using the lein-ring plugin as my ring handler: https://gist.github.com/4599677

18:15 weavejester: Or… huh, map->record works under some circumstances.

18:15 And not under others

18:15 dpwright: (I'm just getting started with ring and compojure and figuring how it all fits together, so I'm not sure this is correct)

18:15 weavejester: Maybe if it's in a different namespace...

18:16 dpwright: trying to access any file which doesn't share the first portion of its filename (before the extension) with a file in the assets directory results in a 404, but anything which does (for example, I have sample.less in assets; I could try sample.foo, sample.blah, sample.anythingelse), results in this null pointer exception

18:17 bbloom: ,(clojure.reflect.Field. 1 2 3 4)

18:17 clojurebot: #clojure.reflect.Field{:name 1, :type 2, :declaring-class 3, :flags 4}

18:17 bbloom: ,(= (clojure.reflect.Field. 1 2 3 4) {:name 1 :type 2 :declaring-class 3 :flags 4})

18:17 clojurebot: false

18:17 bbloom: ,(= {:name 1 :type 2 :declaring-class 3 :flags 4} (clojure.reflect.Field. 1 2 3 4))

18:17 clojurebot: false

18:17 bbloom: weavejester: not sure what issue you're having

18:17 TimMc: ,(doc map->record)

18:17 clojurebot: No entiendo

18:18 weavejester: bbloom: I'm finding that under some circumstances, (= x (read-string (pr-str x))) returns false for some records I created.

18:18 bbloom: weavejester: are you sure you don't have old instances?

18:18 weavejester: TimMc: By map->record I mean map->{record name}

18:18 bbloom: if you re-evaluate the defrecord, then the types are different for new instances

18:19 weavejester: bbloom: It's a new REPL, and the problem occurs when running in the main class, too.

18:19 bbloom: Hang on, I'm trying to work out how to minimally reproduce it.

18:19 bbloom: weavejester: try to isolate it in a new project

18:19 weavejester: That's what I'm doing :)

18:19 brehaut: dpwright: i cant answer you dieter question, but re:ring/compojure, do you understand that compojure basically just creates ring functions, and that ring functions just map a request to a response?

18:22 TimMc: weavejester: "sometimes" -- some objects in the same REPL, or some REPL sessions?

18:22 dpwright: brehaut: I understand in so much as I know that's what compojure's doing, but having never written ring functions without compojure or used ring without the lein-ring plugin I couldn't really claim to understand what the ring functions compojure outputs would actually look like/represent

18:23 gfredericks: probability a random ping-pong game contains the score 7-11: 1989/8192

18:23 weavejester: TimMc: I'm starting a new REPL each time to test it.

18:23 brehaut: dpwright: have a look at http://brehaut.net/blog/2011/ring_introduction (sorry for tooting my own trumpet)

18:24 weavejester: Odd...

18:24 brehaut: dpwright: you particluarly want the preamp, 'the basics…' and 'compojure' sections.

18:24 weavejester: I get true when running a REPL in the project that defines the record

18:24 brehaut: s/preamp/preamble/

18:24 weavejester: And false in another project that depends on the record

18:25 The other project has a :main namespace though, so maybe that's it...

18:26 Hm, no. Even if both environments start off as blank "user" namespaces

18:26 dpwright: brehaut: Thanks! I think I've come across this page before, back when I was trying out noir, and I skipped it at the time because noir hides a lot of that away

18:26 weavejester: And I run the same code

18:26 dpwright: I'll read it through properly now

18:26 weavejester: The project repo REPL works, the dependent project REPL doesn't...

18:27 Curious.

18:27 I'm using a checkouts dir, so I know the code is identical.

18:28 hiredman: weavejester: checkouts will make it be less likely to work

18:28 weavejester: hiredman: Hm, why?

18:29 hiredman: weavejester: I imagine what you are seeing is records with the same "name" that are backed by different jvm classes with the same name

18:30 weavejester: hiredman: Yes, that's my thought, but I don't know why that would be the case.

18:30 Okay, here's what I'm doing:

18:30 hiredman: which could happen if you aot compile (which generates classes for records) then turn around and eval a .clj

18:30 weavejester: (require 'foo.core)

18:30 hiredman: checkouts just give .clj src, and I ampretty sure the jar is still on the classpath too

18:30 weavejester: (def f (foo.core/map->Foo {:id 1}))

18:31 (= f (read-string (pr-str f)))

18:31 TimMc: weavejester: Get the classes of the input object and the read-back object and compare them.

18:31 weavejester: In project "foo", this returns true

18:31 In project "bar", which has a dependency on "foo", this returns false,

18:31 hiredman: weavejester: I imagine if you reload the srouce for foo.core comparison will come out fine

18:31 have you cleared out classes recently?

18:32 weavejester: These are from blank REPLs.

18:32 TimMc: lein clean

18:32 weavejester: Ohhh

18:32 Good idea!

18:32 TimMc: There's a classes dir, possibly in ./target

18:33 weavejester: Highly possible. Project "foo" is just a library. Project "bar" has a -main gen-class.

18:34 hiredman: weavejester: yeah, so you could have some stale transitively compiled code

18:34 weavejester: Ah, yes, that works now that I've lein-cleaned. Let's see if it works with a :main namespace now as well

18:35 Yep, it does.

18:36 Ah geez, I should have guessed it was an unclean targets dir with an obsolete record class.

18:36 hiredman: Thanks a lot!

18:36 TimMc: (-> (map->Foo {:a 1}) class (.getResource "/clojure/lang/RT.class"))

18:37 hiredman: TimMc: no /

18:37 TimMc: ^ Something like that, but with Foo's class in the path string and run once on each object might have told you what you needed to know.

18:37 weavejester: Resources never begin with a /

18:37 TimMc: In this case they do.

18:37 weavejester: Really? Huh...

18:37 TimMc: I mean, empirically.

18:38 hiredman: TimMc: most likely a quirk of a particular classloader

18:38 TimMc: Perhaps.

18:38 weavejester: So anyway, this bug is kinda odd, because it means the map->Foo function was returning a different class to the one read-string was constructing.

18:39 I guess a quirk of the classloaders...

18:39 TimMc: clojurebot is requiring no slash; my REPL is requiring the presence of one.

18:39 weavejester: I'm not sure why it would be different. Maybe something specific to nREPL...

18:39 I thought this error occurred outside of nREPL, but maybe I imagined that.

18:43 hiredman: weavejester: classloading can get weird, it is mutating state after all

19:02 jballanc: I may be smoking something...but is there a "standardized" way of providing a default implementation for a protocol method?

19:02 bbloom: jballanc: extend to java.lang.Object ?

19:02 jballanc: I vaguely recall a hack to define defaults using a macro and metadata

19:02 bbloom: yeah...that's the sort of hack I'd kinda like to avoid

19:02 bbloom: jballanc: how is that a hack?

19:03 isn't that exactly what you want?

19:03 or rather: how is that different than what you want?

19:03 jballanc: I just want any type that implements the protocol to get the method

19:03 not every object

19:04 bbloom: Oh, ok, sorry, my brain is elsewhere :-P

19:04 hiredman: sounds like it should be a function

19:04 not a protocol function

19:04 Raynes: That's just a function, jballanc.

19:04 jballanc: well, that's what I'm doing now

19:04 Raynes: You don't need a protocol for that.

19:04 bbloom: yeah what they said :-)

19:04 jballanc: well, no I mean I have a protocol with 3 functions

19:04 two are different for each type

19:04 but the third is shared

19:05 bbloom: you can use extend

19:05 (def common-bits {:the-fn (fn [this x y z] ...)})

19:05 hiredman: so your protocol is not granular enough

19:05 jballanc: hiredman: yeah...this is probably YAGNI

19:05 bbloom: (doseq [t [TypeA TypeB]] (extend t common-bits))

19:05 hiredman: the third shared bit should be a function written in terms of the protocol

19:06 jballanc: good point

19:06 bbloom: but in the common case, hiredman is right

19:06 jballanc: btw...has defn- fallen out of favor?

19:07 I thought I had read that a while back

19:07 Raynes: I don't use it.

19:07 I know a few other people who don't care for it.

19:07 technomancy: I like it

19:07 Raynes: It doesn't matter, but I prefer it because there is unlikely to be any more convenience macros for creating private vars in clojure.core.

19:08 hiredman: private is silly

19:08 bbloom: i use it, but only b/c there isn't a good mechanism for building a public API namespace from the components of several implementation namespaces

19:08 Raynes: And if they aren't going to cover everything, they shouldn't cover anything.

19:08 bbloom: oddly, i miss that __ALL__ hackery from python

19:08 Raynes: ^:private is a lot more descriptive than defn-

19:09 technomancy: anything that makes it more likely for authors to be careful about implementation details is OK in my book

19:09 jballanc: yeah, in this case I want to write a very generically-named convenience like "exists?"

19:09 but I worry about it leaking

19:09 pjstadig: you could letfn like (letfn [(foo [a] (* a2))] (defn frobnicate [b] (foo b)))

19:10 bbloom: kovas: speaking of mathematica, do you know of any algebra systems in clojure? i know that there is that mathematica bridge and whatnot, but i'm just curious to see how other people have approached implementing a simple algebra system in clojure. i think i want a really really simple one for basic linear expressions and keyword getters

19:10 pjstadig: closures are a nice classic way to encapsulate

19:10 tomoj: "finger trees in clojurescript" sweet! "Concrete measure type should be bound to these vars with with-measure macro" aww

19:10 kovas: bbloom: i saw something on github.. lemme see if i can find it

19:11 hiredman: pjstadig: but encapsulation is silly

19:12 bbloom: kovas: i was considering putting together a really simple one suited to my particular needs. my purposes are basically analogous to angular's expressions & filters, but with some differences

19:12 hiredman: from a consumer of libraries standpoint, why would you limit the amount of functionality exposed?

19:12 kovas: bbloom: theres https://github.com/bmillare/dj.math , but who knows what it does

19:12 bbloom: i would do my own if i was you

19:12 bbloom: kovas: that's the plan, but was just curious

19:13 kovas: bbloom: everyone seems to have their own idiosyncratic take in this space

19:13 bbloom: which space are you referring to? symbolic systems? or binding expressions?

19:13 pjstadig: hiredman: no it's not. it seems silly to say it's silly

19:13 technomancy: pjstadig: he's just messing with you

19:13 kovas: symbolic systems

19:13 bbloom: kovas: yup

19:14 kovas: and algebra

19:14 which may or may not have some reasonable symbolic system underneath it

19:14 i did a pretty fun google scholar search last night

19:14 hiredman: pjstadig: it is, as a consumer of libraries, when I want to use function X, but function X is private, or let bound or whatever, it is annoying

19:14 kovas: search term: prolog compiler term rewriting

19:14 bbloom: yeah, i just need a basic algebraic system: pretty much simple arithmetic, get-in, assoc-in, etc

19:15 technomancy: hiredman: wait are you joking or not?

19:15 bbloom: kovas: needs to be pluggable tho, b/c i'm gonna want like number -> currency formatted string, and then parsing back the other way

19:15 hiredman: encapsulation leads to attempts to be overly generic, while limiting the ability to actually reuse the code, by hindering people trying to customize it to their needs

19:15 technomancy: I am not

19:16 clojure's private is slightly less hideous then java's

19:16 bbloom: kovas: but i don't need systems of equations or anything, just single output in both directions... i do.. however.. need compilation :-)

19:16 technomancy: hiredman: as a consumer of libraries it's very annoying for me to bring in a function and then to have it change in a future version because it turned out to be an implementation detail

19:16 hiredman: technomancy: *shrug* if you don't want api churn stop updating deps

19:16 kovas: bbloom: yeah i hear you on that

19:16 technomancy: hiredman: not always an option

19:17 I'm glad I have the ability to rely on implementation details when I deem the time is right, but doing it by default is just plain crazy

19:17 kovas: bbloom: the literature is fun but a long way from being immediately useful

19:17 bbloom: have you looked at "lenses" ?

19:17 bbloom: kovas: yes, but lenses are not what i want at all

19:17 pjstadig: hiredman: as a consumer of my library you'll use the function i let you use *shrug*

19:18 bbloom: kovas: lenses are concatenative and compositional in a way that i simply don't need. they introduce a bunch of ambiguity and complexity that i don't care about

19:18 kovas: bbloom: don't you just want rules for (currency (number x)) and (number (currency y)) ?

19:18 yes i agree

19:19 bbloom: kovas: little more complex than that, b/c it might be: (format-number the-number the-format-string)

19:19 kovas: though i feel they could be made simpler, if you remove some of their requirements

19:19 bbloom: kovas: in that case, i need to be able to say "well, the-format-string is a modifier, not an input"

19:19 or just say "the format string isn't two-way bindable"

19:19 kovas: not an input because its not gonna change?

19:19 i see

19:19 bbloom: you need some kind of type system

19:19 a very simple one will do

19:20 kovas: most types can be emulated with another layer of symbolic wrapping

19:20 bbloom: yes

19:21 and i don't mind if it's a little trickier or more work to implement a new function in this world

19:21 b/c the included set should be sufficient for most needs

19:21 kovas: things get more complicated before they get simpler

19:21 just like term rewriting :)

19:22 bbloom: and even if you need a custom expression/filter/converter/whatever, you only need a few of them & they are very specific to your app, so forcing people to write two annotated functions for convert & convertBack is fine

19:23 jballanc: hiredman: but then what about convenience functions? in my case, I want to do a head request on a url to check for existence

19:23 kovas: I'm having flashbacks just thinking about the topic

19:23 bbloom: kovas: ha

19:23 hiredman: jballanc: and?

19:23 kovas: the number of things to worry about seems large

19:24 but if your over the hump in terms of implementation thats promising

19:24 jballanc: hiredman: well, that doesn't seem like a method that anyone would care to use outside of my library

19:24 but, more importantly in my mind, what do I call it?

19:24 bbloom: kovas: i'm over the hump on model -> view -> platform

19:24 kovas: still need to work out the finer points of model <- view <- platform

19:24 hiredman: jballanc: yeah, but on the flipside, what is the advantage to hiding it?

19:24 kovas: bbloom: so is the UI just one big data structure, or are there references between a set of structures?

19:25 jballanc: hiredman: if everyone only used "require", none ;-)

19:25 bbloom: kovas: there are exactly 2 atoms: model & view

19:25 jballanc: well...require without a :refer :all

19:25 but I've been burned by trivial naming conflicts too many times in the past...

19:25 kovas: ok

19:25 hiredman: jballanc: people have to explicitly bring in names from your namespaces, you should not worry about polluting theirs

19:26 kovas: well that makes things simpler

19:26 bbloom: kovas: yup :-)

19:26 kovas: bbloom: is view totally derived from model, or does it have its own state as well?

19:27 jballanc: hiredman: yeah, I guess I can see that p.o.v. too...which is why I asked

19:27 bbloom: kovas: (platform/start-app initial-model unexpanded-view)

19:28 pjstadig: you can't design a library expecting that people could be depending upon any and every function you define

19:28 that just makes for software too tightly coupled

19:28 bbloom: kovas: where those two values are NOT atoms

19:28 pjstadig: interfaces and implementations are a good thing, and it is good that they are separated

19:30 kovas: bbloom: can you save the current state of the UI as a value?

19:30 bbloom: kovas: you bet your ass you can :-)

19:30 kovas: tight

19:30 yeah that was basically my goal for the widgets in session

19:30 bbloom: kovas: but the view is platform dependent

19:30 kovas: make them interactively, come back to them, share them, extract and put inside in larger apps

19:31 bbloom: kovas: you can also save the state of the model as a value and that's portable between views (assuming your views are well formed)

19:31 arrdem: can anyone point me to a good CL package demo? #lisp is pretty dead ATM.

19:31 kovas: ok

19:32 i don't understand what it means to be well formed

19:32 just that they assume a certain structure in the model?

19:32 bbloom: kovas: yeah, basically they act on a model of the same schema

19:33 the schemas are not-reified as of yet

19:33 kovas: have you watched stu's "orm is a problem of our own making" talk?

19:33 bbloom: no, but i also hate ORMs :-P

19:33 i'll add it to the viewing queue

19:33 kovas: it made me reconsider if its a great idea to have the model be one big tree

19:34 theres just a moment in there

19:34 where he rants against document databases

19:34 the claim being, documents are a bad way to store data because of the schema lockin

19:34 bbloom: i think the model as one big tree is a bad way to store data, but it's not a bad way to operate on it

19:34 kovas: but great as the output of query

19:34 yeah

19:34 bbloom: i envision that most apps would have a separate view model

19:35 and i consider it a separate problem to synchronize the model and view model

19:35 kovas: right

19:35 bbloom: for now, i'm only interested in the view model

19:35 brehaut: kovas: thats not quite his argument; he says its stupid for anything that isnt documents

19:35 kovas: fiar

19:35 fair

19:35 brehaut: right :)

19:35 bbloom: kovas: do you have a link to that talk

19:35 ?

19:36 kovas: http://www.infoq.com/presentations/Impedance-Mismatch

19:36 pretty good talk

19:37 bbloom: kovas: enqueued

19:37 kovas: my dream right now is to have a direct translation from datomic to UI and back

19:37 even if the UI is pretty simple and dumb

19:38 and I'm wondering if you can attach view or view-model info to the attributes

19:38 so in the db you would have something like [page-entity :left-column left-column-content-entity]

19:39 and :left-column would have some appropriate view function attached to it which is applied to the content to give you the realized UI

19:39 bbloom: kovas: i view all of that as higher level stuff that i don't need to think about yet :-)

19:39 kovas: yeah

19:40 for sure

19:40 or, lower level in a sense

19:40 bbloom: everything i'm building is designed to be a target for both humans and computers

19:41 ohpauleez: Out of curiosity, are there any other Clojure folks who have a Leap Motion dev unit?

19:41 bbloom: initially, a design tool, but eventually, higher order code as well

19:41 kovas: right

19:41 is this personal project, or something for salesforce?

19:41 bbloom: kovas: i quit salesforce after only a few months

19:41 kovas: lol

19:42 if only i could sell a startup and spend the rest of my days solving big problems

19:42 bbloom: kovas: in short: making applications is too damn hard and i think i'm the crazy bastard to fix it. so i'm gonna do that & i have a year or two of runway to prove that

19:42 kovas: thats awesome

19:43 it sure is too damn hard

19:43 just don't fall into the trap of premature optimization on "lets make money off this" :)

19:44 bbloom: kovas: i had a 1year vest that i didn't wait out. this is savings from the first time i started a company ... i didn't use them that time since i got funded :-P

19:44 kovas: badass

19:45 bbloom: i'm always happiest when i'm poor :-P haha

19:45 although the food isn't as good....

19:45 kovas: lol. if you need some help getting $$ of your hands, you know where to send the check

19:45 off

19:46 where are you moving to in nyc?

19:47 bbloom: kovas: no idea yet

19:47 apartment hunt next week

19:47 kovas: i moved here in january last year

19:48 its a little rough coming in the middle of winter

19:48 but at least theres a higher vacancy rate

19:52 bbloom: what are the experiences that made you optimal for solving this problem?

19:52 you mentioned something about this yesterday

19:53 bbloom: i doubt #clojure cares about my life, so i'll take this over to a private msg

20:32 Frozenlock: kovas: Nice video, but as Datomic isn't OSS, it leaves an informercial aftertaste in my mouth :/

20:33 kovas: frozenlock: true. i'll take free-as-in-beer tho.

20:34 frozenlock: for me, it happens to hit home very directly.

20:42 TimMc: technomancy: I'm tempted to start using ^:api instead of ^:internal.

20:55 brainproxy: so cool ... been working on this clojure-based REST gateway thing for like 7 months; works great on linux and mac; fired it up for the first time this evening on win7

20:55 using lein.bat

20:55 required 0 code changes to work properly

20:56 bbloom: nice

20:58 cark: java really IS run anywhere =P

20:59 brainproxy: cark: i know, i was just resigned to the fact that *something* somewhere inside would breadk or have to be tweaked

20:59 but it didn't, made me smile for sure

21:00 cark: I have a similar experience to yours...been developing under windows not even knowing if the application would end up on linux or solaris. Enventually it did end up on solaris, never had to change a line in clojre either

21:01 funny thing is i'm mostly clueless about any unix =P

21:02 still ended up doing support for postgres on solaris =(

21:02 brainproxy: hehe

21:03 tmciver: brainproxy: sounds cool. Do you have a url to that project?

21:03 cark: nope

21:03 brainproxy: tmciver: it's a commercial product, all closed source unfortunately

21:04 tmciver: tease

21:04 brainproxy: tmciver: i hope at some point we can pull out some of the generic pieces and open source them

21:05 we've been busy building abstractions on top of datomic, and I think there's a lightweight framework lurking in there somehwere for modeling forms and views as entities and functions in datomic

21:50 Frozenlock: Given this "(defmulti my-multi (fn [smap] (:some-k smap)))", I would expect "(defmethod my-multi :val-of-key-from-smap [x] (print "yeah!"))" to work.. but it doesn't. Am I not dispatching on the value retrieved in a map?

21:51 gfredericks: Frozenlock: looks fine to me

21:51 have you tried rebooting?

21:51 Frozenlock: No o_O

21:51 gfredericks: what's not working?

21:51 Frozenlock: Rebooting, like in the 90's?

21:52 gfredericks: yeah sometimes the start menu gets stuck

21:52 Frozenlock: No method in multimethod 'my-multi' for dispatch value: {:some-k :some-value}

21:52 gfredericks: IMPOSSIBLE

21:53 Frozenlock: What?

21:53 clojurebot: what is 2d6

21:53 gfredericks: I'll go try it

21:53 Frozenlock: I'm rebooting my repl, shouldn't be long..

21:54 gfredericks: Frozenlock: worked fine for me

21:54 Frozenlock: Ah! It works now.

21:54 gfredericks: yeah must've been the start menu

21:54 Frozenlock: Is this dangerous to use in production, or is it really just sometimes in the repl?

21:54 gfredericks: I have no idea what was wrong

21:55 did you do several defmultis on the same fn name?

21:55 Frozenlock: Hopefully IT WILL NEVER HAPPEN AGAIN! :)

21:55 Thanks for the help

21:55 Yes

21:55 gfredericks: I guess it could be something like that :/ not sure how they're implemented

21:56 muhoo: state

21:56 objects. java. trouble.

22:03 amalloy: yes, defmulti is broken by design

22:04 ie, (defmulti foo f) (defmulti foo g) ;; the second defmulti didn't do anything, and the dispatch function is still f

22:05 * gfredericks knows now

22:06 bbloom: grumble grubmle death to def

22:06 tpope: what "design" is that?

22:07 bbloom: tpope: i think the premise is that if you reload a file, you don't want to break any other namespaces that installed methods into your dispatch table

22:07 tpope: ah

22:08 yedi: http://blog.getprismatic.com/blog/2013/1/22/the-magic-of-macros-lighting-fast-templating-in-clojurescript

22:08 bbloom: defmethod basically "installs" a handler into some mutable cell owned by defmulti

22:08 and that has all the usual problems associated with mutation and state :-/

22:11 muhoo: bbloom: thank you for macroexpanding

22:15 spjt: Is there some way to limit a clojure process to a single thread?

22:16 gfredericks: spjt: I expect s/clojure/java/ should give you the same answer

22:18 Frozenlock: bbloom: But isn't a multi limited to its namespace?

22:18 spjt: I saw some examples of how to limit it in Java, looks complicated.

22:18 Frozenlock: spjt: Everything looks complicated in java :p

22:18 gfredericks: Frozenlock: no you can extend a multimethod from anywhere

22:18 Frozenlock: that's most of the point of multimethods

22:18 spjt: I guess I'll just run it in Parallels with only one core active.

22:19 Frozenlock: gfredericks: So if you load a library with a defmulti named "foo", "foo" is locked for everyone else??

22:19 lazybot: Frozenlock: Definitely not.

22:20 jkkramer: lazybot is correct

22:20 gfredericks: Frozenlock: I can't reconcile that statement with the rest of the conversation

22:20 jkkramer: methods are "installed" into the var of the defmulti, which is namedspaced

22:20 gfredericks: (defmethod some.other.ns/varname ...)

22:21 jkkramer: my favorite defmulti feature: (defmulti foo "docstring" f) (defmulti foo "docstring" f) ;; obliterates foo's docstring

22:21 Frozenlock: Ahh ok! Well that's what I meant by limited to its namespace

22:22 gfredericks: Frozenlock: crisis averted!

22:22 Frozenlock: Indeed, I was about to scrap all my new shiny defmultis :p

22:27 spjt: Maybe I could ask in a more clojurey way. Basically, what I'm doing is running a bunch of sends, using a function that takes a "long" time to complete. Does the agent prevent writes while the function is running?

22:27 Frozenlock: yedi: Brilliant

22:30 yedi: im still trying to understand how they accomplished it... need to wrap my head around macros

22:31 gfredericks: macros: they are things to use

22:31 yedi: it's crazy that they got it so much faster than all the other cljs templating libs

22:31 Frozenlock: yedi: is it? cljs still seems to be a small world

22:32 gfredericks: yeah I don't think crate even tries

22:33 Frozenlock: It looks like it uses the same templating; I'll be able to switch the library without too much problem.

22:34 gfredericks: Frozenlock: it'll be less composable though

22:34 or at least I assume the more you break stuff into separate functions the more the perf suffers

22:34 * gfredericks speculates wildly

22:45 hiredman: ~apropos clojure

22:45 clojurebot: Programming Clojure is a Book Edition. (http://www.freebase.com/view/m/0dg9_5h)

22:45 hiredman: ~apropos java

22:45 clojurebot: Java Virtual Machine is a Video Game Platform. (http://www.freebase.com/view/m/045rk)

22:46 amalloy: (inc lazybot)

22:46 lazybot: ⇒ 12

22:46 hiredman: hah

22:48 technomancy: bbloom: FWIW the hard-locked dispatch function is a completely different problem from defmethod updating the method table

22:48 bbloom: in what way?

22:48 technomancy: they're two separate problems

22:49 bbloom: the assumption is that some other namespace somewhere is dependent on your dispatch function

22:49 technomancy: though I suppose the brokenness around the former was introduced specifically in order to deal with complications around the latter

22:49 bbloom: yup...

22:49 technomancy: so they're related, but still two separate distinct problems

22:50 it's easy to imagine a defmulti that allowed the dispatch function to be updated without blowing away the method table

22:50 hiredman: technomancy: the method table and the dispatch function are tied to each other via the cache of dispatch function results

22:50 technomancy: and if it weren't for Jira and the broken contribution process I would be tempted to try to fix that

22:50 bbloom: technomancy: lol. did you speak up in that crazy thread?

22:50 i feel like your involvement with lein should carry some weight

22:50 technomancy: bbloom: I've said everything I have to say

22:50 bbloom: heh

22:51 technomancy: except that I think a separate cljs mailing list is a good idea

22:52 bbloom: technomancy: *shrug* i don't think it would hurt, but i haven't seen significant cljs-specific mail traffic

22:52 technomancy: hiredman: sure but during development you shouldn't have any qualms about blowing away the cache

22:55 bbloom: that thread is just people yelling at Andy Fingerhut and Sean Corfield anyway

22:55 no one who's actually in a position to make a difference will even touch it

22:57 bbloom: technomancy: at least stuart halloway is on the electronic CA thing

22:59 technomancy: oh, I missed that

Logging service provided by n01se.net