#clojure log - Mar 29 2014

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

0:32 chare: how do we make lein new use clojure 1.6 in the generation

0:51 technomancy: chare: use lein 2.4.0

0:52 (which hasn't been released yet)

0:52 chare: so its buggy?

0:53 technomancy: no, just needs a few more changes https://github.com/technomancy/leiningen/issues?milestone=15&state=open

1:22 amalloy: technomancy: it was a trick question: all software is buggy

1:23 technomancy: oh nap

1:23 snap

1:26 chare: what should I use for editor for clojure, whats the difference between sublime text, light table, etc...

1:29 rootex: chare: haven't tried it but lighttable looks more beginner friendly

1:41 ned-: chare: emacs or LT

1:47 Raynes: amalloy: Unless written in Haskell and confirmed to compile.

1:47 ;)

1:48 amalloy: $heval head []

1:48 lazybot: ⇒ *Exception: Prelude.head: empty list

1:48 amalloy: BLAM

1:57 probably better as: head brokenHaskellPrograms where brokenHaskellPrograms = []

3:16 chare: is there a text editor that will format clojure code nicely, like gofmt does for go

3:19 bitemyapp: amalloy: actually, there's a safe Prelude that avoids that.

3:20 amalloy: i know

3:20 bitemyapp: there's also a List type that is required to have at least one element

3:20 TEttinger: what? bitemyapp has returned?

3:20 bitemyapp: and partial functions are one of the few sources of runtime errors.

3:20 TEttinger: only to troll on behalf of your Lord and Savior.

3:20 TEttinger: F#?

3:20 bitemyapp: TEttinger: Saint Haskell.

3:20 Exupery de GHC

4:12 cYmen_: Good morning...

4:13 Why are partial function sources of runtime errors

4:13 ?

4:16 SegFaultAX: cYmen_: Do you mean partially applied functions?

4:16 Or functions that are only defined for a subset of their domain?

4:17 cYmen_: SegFaultAX: I think bitemyapp and TEttinger were talking about partially applied functions...

4:17 SegFaultAX: Oh, I missed the context, then.

4:18 bitemyapp: nope.

4:18 not currying, partial functions.

4:18 cYmen_: partial functions aren't well known outside of typed functional programming languages. It means you don't have a mapping to an output for every input.

4:18 SegFaultAX: Partial application isn't the same as currying. :)

4:18 bitemyapp: cYmen_: so if you have a function that takes an argument of type Maybe a

4:19 cYmen_: and the possible values a Maybe a can be include: Just a or Nothing

4:19 cYmen_: then a function that assumed a Maybe a would only ever be Just a, is a partial function that will have an exception against a Nothing.

4:19 cYmen_: Haskell can warn you at compile time when you've failed to pattern match all possibilities. Partial functions are quite avoidable.

4:20 In the Haskell lens library, you can actually compose Prisms against sum types (a la Maybe) and see when the collapsed paths are isomorphic with Void, meaning you've matched all possibilities!

4:20 SegFaultAX: And if you want to learn more about it, go to #haskell.

4:21 cYmen_: :)

4:21 bitemyapp: SegFaultAX: why? i

4:21 I am here all night >:)

4:21 SegFaultAX: bitemyapp: Welcome back. But this is not #haskell.

4:22 Also, Clojure/West was pretty great. It would have been awesome if you could have come.

4:22 bitemyapp: SegFaultAX: I'm only here as long as the adults are asleep, then I'll hiss like a vampire and disappear in a puff of brimstoney smoke.

4:22 SegFaultAX: I would've spent literally the entire conference 1. Trolling about Haskell 2. Teaching Haskell

4:22 SegFaultAX: bitemyapp: Heh, ok. Well at least try and keep it on topic.

4:22 bitemyapp: Maybe.

4:23 * bitemyapp vampirically perches in a dark corner to await another opportunity to swoop in

4:23 SegFaultAX: There are plenty of people who need help in #haskell. :)

4:24 bitemyapp: SegFaultAX: I'm a concurrent event stream processor. I'm helping them too.

4:24 currently profunctors, upstar, strong functors, comonadic coalgebras, lenses, and Edward Kmett are under discussion.

4:24 Indistinguishable from Magic.

4:25 SegFaultAX: Cool, enjoy!

4:25 bitemyapp: SegFaultAX: you should learn about Free Monads and relate 'em back to macro-driven DSLs.

4:26 TravisD: bitemyapp: seriously, please stay on topic

4:27 bitemyapp: TravisD: you can use free monads in Clojure.

4:27 TravisD: it'd be a little hard to keep it pure without type system assistance, but perfectly doable/practicable.

4:27 little bit manual with typeclasses as well...either way, fun exercise.

4:30 yotsov: anybody know of a text / talk / whatever explaining the decision clojure, clojurescript, edn (and clojure-clr I guess) to be so separate, without interdependencies?

4:32 SegFaultAX: yotsov: It's not that hard, really. Clojure is a hosted language originally designed for the JVM. Hickey et al later attempted to port it to .Net and found it to be a less than ideal platform.

4:32 Likewise cljs is another reimplementation on top of the javascript runtime.

4:33 edn is entirely separate. It's a general purpose serialization format that happens to share Clojure syntax for value literals.

4:35 alew: bitemyapp: I heard you left california?

4:35 bitemyapp: who's going to present haskell at the clojure meetups now?

4:36 bitemyapp: alew: I'm in Austin, TX

4:36 alew: me, via Skype.

4:37 alew: bitemyapp: what's to do in Austin?

4:38 bitemyapp: alew: not get wrecked by taxes. cheap food/beer. Be surrounded by polite dog people.

4:39 alew: I'm not originally from SF. I lived in NYC before that, hated it there too. I didn't like the people in SF or NYC for the most part.

4:39 yotsov: SegFaultAX: I understand the historical reasons and the advantages of loose coupling. Nevertheless, there clearly are dependencies / common components between edn, clojure and clojurescript. I was curious if people in the community are generally happy with the current loose coupling between these (which seems to be the case), or if there are some plans to couple them tighter, which would help with functionality reuse, potentially (

4:39 times)

4:40 bitemyapp: yotsov: 1. nobody cares 2. nothing's going to change 3. what you're talking about isn't in keeping with how Core is managed 4. nothing's going to change 5. we can barely get them to maintain the edn spec as it is

4:41 SegFaultAX: Actually there is a significant amount of work on this topic, in particular around tools.analyzer.

4:42 yotsov: yes, I was thinking about analyzer too, it was ported from cljs to clojure

4:42 SegFaultAX: Creating a self-hosted Clojure implementation (clojure-in-clojure) is the first step to achieving what you're describing.

4:42 bitemyapp: by point being that they're unlikely to abandon separate repos for separate languages/tools, not that they'll fail to make the toolchain less redundant.

4:42 SegFaultAX: bitemyapp: That's far from nothing ever changing, though.

4:43 bitemyapp: the "nothing's going to change" had a scope modifier

4:43 all of that was with regards to the separate repos and what I said should make a lot more sense with that in mind.

4:43 words need explicit type annotations.

4:43 yotsov: SegFaultAX: thanks, this is precisely this sort of future plan that I was curious about, will google what you mentioned as I hadn't heard about cllojure-in-clojure project

4:44 bitemyapp: yotsov: Bronsa and all them are the people to poke about that.

4:44 SegFaultAX: yotsov: If you're interested in the particulars, there was a great talk by Tim Baldridge at Clojure/West.

4:44 You could also contact him directly if you want more information about the progress on tools.analyzer.

4:45 yotsov: SegFaultAX: thanks will check it, havent gotten yet to watching the clojure/west videos

4:45 cYmen_: oooh there are videos?

4:45 bitemyapp: yotsov: https://github.com/Bronsa

4:45 SegFaultAX: yotsov: https://www.youtube.com/watch?v=KhRQmT22SSg

4:45 yotsov: cYmen_: this is what I supposed... havent looked

4:46 bitemyapp: thnaks

4:46 bitemyapp: SegFaultAX: http://i.imgur.com/SaTkzm3.gif

4:46 SegFaultAX: cYmen_: Yes, they were live editing the videos as the talks were going on.

4:46 Many of them were out the same day as the talk.

4:47 cYmen_: SegFaultAX: Are they all on this youtube channel?

4:47 SegFaultAX: Yes.

4:47 cYmen_: Excellent.

4:47 SegFaultAX: Do yourself a favor and watch John Hughes' talk.

4:47 alew: what is the purpose of tools.analyzer? clojure semantics in clojure?

4:47 SegFaultAX: I had dinner with him the night before... such a fricken cool guy.

4:48 alew: The talk I posted above has more color on that topic.

4:48 alew: I suggest watching it if you're interested.

4:48 alew: SegFaultAX: can you provide a basic overview?

4:49 SegFaultAX: alew: Sure. tools.analyzer provides the basic AST analysis and transformation necessary for building a self-hosting clojure.

4:50 It's an extensible, self documenting, data driven code analyzer.

4:50 alew: SegFaultAX: Oh I see, so it does all the semantic analysis

4:50 SegFaultAX: alew: Yes.

4:50 Among other things.

4:50 alew: SegFaultAX: seems like it would be useful for buliding tooling around Clojure

4:50 what else is there?

4:51 SegFaultAX: alew: Platform/implementation-specific tooling for starters.

4:51 See jvm.tools.analyzer, for example.

4:52 (JVM-specific extensions to the analyzer for things like deftype, defprotocol, etc)

4:52 alew: Right, but those are seperate from tools.analyzer

4:52 SegFaultAX: Nope, I lied. It's tools.analyzer.jvm :)

4:53 Yes. tools.analyzer is designed to be platform agnostic. Each impl will have an extension on top of t.a that is platform-specific.

4:55 yotsov: SegFaultAX: this is an excellent talk, thanks for pointing to it

4:56 SegFaultAX: yotsov: You're welcome.

4:56 (And I agree, it is an excellent talk)

4:57 alew: Oh, they are also working on an emitter

4:59 SegFaultAX: alew: Yes.

5:29 amalloy: SegFaultAX: bronsa was in here earlier saying he'd gotten tools.emitter.jvm to emit clojure.core

5:30 SegFaultAX: amalloy: No shit?

5:30 That's awesome!

5:30 amalloy: http://logs.lazybot.org/irc.freenode.net/%23clojure/2014-03-28.txt

5:30 it's not tested/fully-working yet, it sounded like

5:31 SegFaultAX: Still, progress.

5:32 Alright I'm falling asleep at the keyboard. Night all.

5:50 alew: You can't rely on meta data staying after filtering or mapping can you?

5:50 amalloy: on the sequence itself? you can rely on it not staying

5:50 alew: the elements inside

5:51 the issue is I have some java object that has an inner structure similar but different from a map, and I want to be able to manipulate it as a map but still preserve the other information held in that object

5:52 so I was planning on creating a map with the values inside the object and attaching the original object as metadata

5:52 clgv: alew: build a proxy that adds a map implementation?

5:53 alew: clgv: looking into proxy now

5:57 clgv: alew: adding a map implementation is easy if you choose java's mutable map but probably not that easy if you want a persistent clojure one

5:57 alew: readonly access is easy for both

6:03 alew: clgv: what is the different between proxy and reify?

6:03 difference*

6:04 clgv: alew: reify can not inherit from classes it can only implement interfaces

6:04 there is more but I guess that's the relevant part for your problem

6:06 alew: clgv: I wanted to be able to treat it like a persistent map

6:06 clgv: alew: but the java object itself is not persistent?

6:07 alew: clgv: It's not

6:07 clgv: alew: you need to keep that java object around because of what?

6:07 otherwise you could just convert it

6:08 alew: clgv: the java object has some information in it that ties it to a resource in an api

6:08 clgv: so I want to be able to modify the properties like a persistent map and then copy them back into the object to use it to update the resource via the api

6:09 clgv: alew: so it is not actually holding the map data but querying it from the resource?

6:09 alew: clgv: It grabs a local copy of the remote resource

6:10 clgv: alew: hmm maybe the better approch is to have a reference that holds a plain clojure map with the data and add a watcher function to it which does the copying to the java object (resource)

6:11 alew: but it all depends on the surrounding scenario.

6:12 alew: clgv: I'm trying to build a reasonable abstraction around the google spreadsheet api

6:12 clgv: which is one of the most terrible things I have ever experienced

6:13 clgv: alew: maybe the better approach here is to not try to hide the resource transparently behind a map facade but explicitely program against a service using plain clojure data which gets converted when passed to the service

6:15 alew: clgv: that was one way I was thinking of approaching it, but was trying some other things out first

6:15 clgv: I'll probably go with that as it seems to make it most interoperable

6:18 Fender: hi there, anyone has an idea how I can get a seq of a transient vector without persisting it?

6:20 its single threaded code and I dont want to transient-ize it whenever I add an element just to persistent!-ize it when I read the whole vector again

6:21 one option is (map v (range (count v)))

6:21 which is bad for obvious reasons

6:30 clgv: Fender: why dont you need a seq of the transient vector in the first place?

6:31 *do

6:33 Fender: I need to calculate aggregates (min, mean, max ...) on vecs

6:34 however, these vecs get new numbers from time to time

6:34 clgv: well just loop-recur over the vector. you cant be more efficient than that

6:34 Fender: in the end I am only interested in the aggregates, so I will discard the vecs

6:35 so you say access by index for example

6:35 clgv: yes

6:36 that's more efficient for persistent vectors as well compared to sequence access

6:36 Fender: actually I'd do that, it just seems clumsy

6:36 orly?

6:36 clgv: hide it in an aggregate function with similar parameters as reduce

6:37 yes, for a mental image just compare java arrays and singly linked lists

6:38 Fender: I know but I thought any seq based on an array (or vec) is inherently faster due to e.g. cpu caching

6:38 clgv: the only thing that might be more efficient than index access on vectors is reduce since the vector implements traversing for reduce internally

6:38 Fender: regardless of indexed or seq-ed access

6:38 clgv: but it remains a seq which adds a lot of overhead ;)

6:39 Fender: ...like internally saving the last visited index

6:39 hmm, that's a point

6:39 but isn't that just one field?

6:40 IOW, isn't the seq on a vec itself realized as a transient?

6:40 clgv: what do you mean?

6:40 Fender: (= (seq v) (map v (range (count v)))

6:41 ?

6:41 or: what is the overhead apart from a single double-word saving the last visited index on the vec?

6:42 clgv: Clojure uses value based comparison so that will be true as well as (= v (map v (range (count v))) is true

6:42 Fender: the question was more about the implementation than about the result^^

6:43 clgv: the answer was that that expression doesnt tell you what you wante dto know about the implementation ;)

6:43 Fender: I just don't have the means to phrase the implementation in a high level language :)

6:44 clgv: well a seq object object is created for every elementn of the vector while you traverse the sequence

6:44 that is the overhead I meant which is not present when you access by index

6:46 Fender: ok, so basically one object for each element in the index

6:46 ehm, each element in the vector

6:46 clgv: each element of the vector, yes

6:48 Fender: ok, that's a lot

6:48 hmm, that helps already, thx

6:48 and I think I gotta make some things more efficient...

6:48 thx!

6:50 clgv: Fender: do you know how much elements you get in advance?

6:51 Fender: no, I just know it will increase by the time

6:51 but I could calculate some upper bound

6:51 clgv: if that is really a hot spot and you do not expose those values to the outside you could also just use javas arraylist for example

6:52 Fender: yes I though of arrays specifically

6:52 the problem is, sometimes I get null values, so it'd be an array of objects

6:52 clgv: just make sure that then mutable state does not leak to the outside ;)

6:53 Fender: and the I get all the casting hassle

6:53 no worries there, even in my Java times I made practically every method static

6:54 at a time when I didn't know about functional programming, lisp or clojure

6:58 I am trying to test what you said

6:58 (do (let [r (range 9999999)

6:58 v (vec r)]

6:58 (time (doall (seq v))

6:58 )) 1)

6:58 vs

6:59 (do (let [r (range 9999999)

6:59 v (vec r)]

6:59 (time (doall (map v r))

6:59 )) 1)

7:00 however, I don't get the expected results (1100ms vs 2200ms) but the thing is that indexed-access itself requires a seq

7:00 or I just a loop over a transient int

7:01 and who knows what's optimized away

7:14 clgv: Fender: well that way you use a seq for the access. try to implement an aggregation via seq and via index access on a vector and then use criterium to benchmark both implementations

7:59 tomjack: https://www.refheap.com/8bf04dc83b069d143b0d9b98a

8:02 O_O

8:03 clgv: so what did you expect?

8:05 tomjack: it not to be 5am

8:05 clgv: ah thats fine, it isnt over here :P

8:35 mercwithamouth: hmm what would be the best library for working with couchdb? i'm looking at clutch but it seems it hasn't been updated a year

8:38 llasram: That just means its completely stable :-D

8:39 mercwithamouth: llasram: lol that was going to be my next post. "either that's a really good thing or really bad"

8:39 alright...i'll just give it a whirl today. lets see

8:40 llasram: Yeah, wasn't meant to be *entirely* facetious. I'm not using clutch, but the CouchDB API is pretty straightforward

8:40 At my company I don't think we've touched our internal CouchDB client library in more than a year

8:41 Yep -- almost exactly 1 year!

8:42 mercwithamouth: nice...well thats a good sign.

9:14 gozala: is there anyway to bundle arbitrary js file with a cljsbuild ?

9:16 vijaykiran: gozala: check https://github.com/emezeske/lein-cljsbuild/blob/master/sample.project.clj#L127

9:18 gozala: vijaykiran: thanks, I tried externs but it does not seems to append content of js file I want to include :/

9:18 reading post from the comment

9:19 vijaykiran: gozala: there should also be :libs option

9:22 gozala: vijaykiran: thanks

9:22 vijaykiran: looks like :foreign-libs is a thing that may work for me

10:02 mercwithamouth: hmm is there a way to restart the repl in light table?

10:07 i'm actually running into a few small things. most likely user error... it loaded my project perfectly. now it's throwing an error saying it can't find the namespace i'm using. https://gist.github.com/anonymous/9855010

10:18 clgv: mercwithamouth: is that folder really contain an underscore on the filesystem "galactic_donut"?

10:19 milinda: hi all, what is the best way to extend functionality of https://github.com/clojure/data.priority-map/blob/master/src/main/clojure/clojure/data/priority_map.clj to support limited capacity

10:20 please let me know if any of you have a idea on doing this

10:20 I am not sure whether defining a new type wrapping priority-map is the best way

10:22 mercwithamouth: clgv: nope

10:22 actually...yes it does...and i did not create it

10:22 interesting. changnig

10:23 clgv: no it must contain that underscore for the classloader to find it

10:23 a frequent error is that it contains a hyphen instead

10:23 mercwithamouth: my project has a dash but yes...it seems the lein template did create it as as galactic_donut under my source folder

10:24 i see...how would one fix that? new to java and clojure. in project.clj?

10:24 clgv: right, it does matter for namespaces only not for the project folder itself

10:25 mercwithamouth: ahh i see

10:25 i shouldn't use '-' anyways...to avoid that.

10:25 ok

10:27 clgv: well sometimes it is pretty usefull for naming

10:27 mercwithamouth: just something to look out for...

10:28 thats just odd..why is it inconsistent? my repl definitely started up before with that namespace

10:29 vijaykiran: mercwithamouth: clojure namespace compile to Java classes and they can't have "-"s in the name

10:29 mercwithamouth: ahh now i see 100%.

10:30 there's a conversation on stackoverflow. if i'd gotten to joy of clojure already i'd know =(

10:31 http://stackoverflow.com/questions/4420944/why-does-clojure-convert-dashes-in-names-to-underscores-in-the-filesystem/4451693#4451693

10:31 gfredericks: there's a jira ticket complaining that clojure should allow dashes in the filesystem as well

10:32 mercwithamouth: thanks

10:40 pjstadig: is there a way to unify with metadata in core.logic?

10:40 like (with-metao obj meta x)

10:44 gfredericks: pjstadig: afaik you should be ashamed of yourself for thinking to ask that question

10:48 pjstadig: gfredericks: i regretted it as soon as I asked it

10:49 i should have my clojure club card revoked

10:49 clgv: "meta unification" sounds like a research proposal, doesn't it? ;)

10:53 gfredericks: that's what "art of the meta-object protocol" actually refers to

10:55 clgv: gfredericks: I did not hear it in the context of logic programming and unification yet..

10:57 * gfredericks is just making stuff up

11:00 technomancy: dashes on the filesystem would be awesome

11:00 the whole insistence upon .clj files matching .class files is madness

11:04 bodie_: what's the recommended way of installing clojure and lein? should I assume my distro repos are outdated?

11:07 vijaykiran: as the page says - if the repo is having 2.x (latest) use it, otherwise just follow - http://leiningen.org

11:08 if you have lein - you don't usually install clojure separately

11:24 clgv: bodie_: install leiningen manually and leiningen will get you clojure ;)

11:24 bodie_: that's what I ended up realizing.. heh heh. thanks :)

11:29 Bronsa: so I just find an expression E that works when invoked as E but not when invoked as ((fn [] E))

11:29 found*

11:30 clgv: what's that expression?

11:30 rootex: its secret

11:30 clgv: that would be mean ;)

11:31 Bronsa: http://sprunge.us/BAgH?clj

11:31 there's a good reason why that doesn't work but it's still surprising at first

11:32 clgv: is it similar to try to embed objects into source?

11:34 Bronsa: you can get the error one step earlier by "((foo))"

11:49 Bronsa: clgv: right

11:51 clgv: no the problem is that the fn closes over x, when evaluating a fn clojure defaults to print-dup+read-string using read-eval to invoke the fn ctor and that cannot be done for a closed-over fn

12:03 bodie_: anyone have thoughts about clojure for desktop applications?

12:03 favorite gui toolkit, "no that's dumb", etc

12:04 MAN_IS_ME:

12:08 clgv: bodie_: take a look at seesaw

12:09 bodie_: "It happens to be built on Swing, but please don't hold that against it." hehe. okay, thanks :)

12:27 FOSScookie: Can you guys give me any reasons as to why I should pick clojure over something like Racket?

12:27 milinda: anyone has any idea on implementing priority-map with limited capacity?

12:29 michaniskin: FOSScookie: excellent access to java libraries, immutable collections from the very bottom, runs on the JVM, nice hygenic macro system

12:30 FOSScookie: Is there anything in Java which can approach this beauty for plotting though? http://docs.racket-lang.org/plot/renderer3d.html

12:31 michaniskin: FOSScookie: probably not, racket is mas elegante, but maybe you like this: https://github.com/liebke/incanter

12:44 luxbock: is there no type hint for ^ratios?

12:44 like how would one type hint a collection of ratios

12:46 llasram: luxbock: That would only be useful if you had a Java array of Ratio instances

12:47 luxbock: are type hints not useful for clojure collections? I'm very new to this

12:47 I ported an algorithm from Java to Clojure and I'm not trying to see how much I can improve its speed with type hints

12:47 what is the difference between using #^String vs. ^String?

12:48 ambrosebs: luxbock: depends on the situation

12:48 ztellman did a great talk recently on this http://www.youtube.com/watch?v=iQwQXVM6oiY

12:49 luxbock: prefer the latter, identical but the former is deprecated

12:49 consider it deprecated at least

12:49 luxbock: yep I have watched his talk, I should probably watch it again though

12:49 ok, thanks

12:50 bodie_: compojure vs noir?

12:50 total noob

12:50 ambrosebs: you almost never care about the concrete type of a clojure collection, unless you have a great reason

12:50 wrt type hints

12:50 bodie_: also... if anyone knows anything about seesaw, stumbling on the walkthrough for that.

12:50 luxbock: aha

12:51 where should I start? right now I'm checking every function in my code with (class (func x y z)) to see what it returns, and then using that as a type hint for what the function returns

12:51 does this seem like a reasonable approach?

12:51 llasram: luxbock: Turn on reflection warnings

12:51 michaniskin: bodie_: http://www.luminusweb.net/

12:51 ambrosebs: luxbock: ztellman's example with ^Counted .nth is one case for example. If that's in a tight loop, then go for it

12:51 llasram: luxbock: The only places (non-primitive) type hints can possibly help are where you get reflection warnings

12:51 luxbock: llasram: yep did so, but I did not get any warnings before I accidently type hinted a wrong variable

12:52 llasram: luxbock: Then simple reference type hints will not help you any further

12:52 luxbock: ok

12:52 bodie_: michaniskin, why?

12:52 llasram: luxbock: Next step is to make sure any parts which should be using primitives are not boxing, which is a bit more difficult

12:52 ztellman has a library which helps

12:53 michaniskin: bodie_: you were asking about compojure vs noir just now and said "total noob". luminous is a great way to see how all the parts come toghether in a clojure web application

12:53 luxbock: which one is it? he has many of them

12:53 llasram: luxbock: https://github.com/ztellman/primitive-math

12:54 luxbock: thanks, though now that I think about it I think my code is not even using any primitive math operations

12:54 bodie_: Ah, I see. Luminus and Noir are built on Compjure and Ring (while Noir is less current.)

12:54 llasram: luxbock: Then congratulations -- you're done! :-D

12:54 luxbock: I should probably read Clojure High Performance Programming

12:55 michaniskin: bodie_: you're going to need a lot of things to make a real application, so luminous is a good place to start because a lot of the things you're going to ask in 5 minutes are already laid out for you there :)

12:55 ambrosebs: luxbock: are you having performance issues?

12:55 bodie_: I can dig that. I'm less looking to make something "real" right now and more to learn the ins and outs :)

12:55 I appreciate the pointer

12:56 luxbock: ambrosebs: not really, I'm mostly just playing around

12:56 ambrosebs: luxbock: cool

12:56 luxbock: I haven't run the Java version which I copied vs. my version yet, I'm guessing it's going to be a lot faster

12:59 michaniskin: bodie_: you might also want to look at http://clojure-liberator.github.io/liberator/

12:59 bodie_: interesting

12:59 michaniskin: bodie_: and http://hoplon.io

13:01 ambrosebs: luxbock: right, from here you'd find the bottlenecks in the Clojure version and rewrite them. Can be very subtle.

13:01 bodie_: hoplon.io looks pretty neat :)

13:02 michaniskin: bodie_: you're welcome in #hoplon if you run into any problems :)

13:02 or if you don't, too

13:03 bodie_: I'll check it out

13:03 thanks :)

13:12 angelini: Is there an idiomatic way to destructure a seq’s first and rest in a single fn call? I.e. (let [[first rest] (fn seq)])

13:13 ambrosebs: ,(let [[f & r] [1 2 3]] [f r])

13:13 clojurebot: [1 (2 3)]

13:13 angelini: oh perfect, thanks

13:14 S11001001: angelini: NB: this will call `seq' on the rest part, if that matters.

13:29 TravisD: If I want to have just a standalone clojure script (like a single file with no project or anything), is there an easy way to run it with lein?

13:43 llasram: TravisD: You don't need lein at all for that -- just make your shebang line invoke `clojure.main`

13:44 TravisD: llasram: I guess the issue i'm having is that I don't know where the clojure executable is

13:45 llasram: I see. Well, then maybe https://github.com/kumarshantanu/lein-exec

13:45 Not being able to use any dependencies makes it pretty low-value though

13:46 TravisD: ah, I see

13:47 michaniskin: TravisD: http://github.com/tailrecursion/boot

13:48 not lein exactly, but it's a thing

13:48 TravisD: thanks! I'll check it out

13:57 whodidthis: dnolen_: any idea what could cause om/react to clear any form input after it sets up om/root on client side: https://github.com/whodidthis/om-nashorn

13:57 dnolen_: whodidthis: if you're doing this via set state that will be a problem yes, it needs to come in via props

13:58 whodidthis: i mean any input by user

13:58 while the html has loaded but javascript hasnt

13:59 dnolen_: whodidthis: you mean the browser prepopulating?

14:01 whodidthis: no not autofill

14:02 dnolen_: whodidthis: it would clear if you haven't set the state of the input somehow, either via props or setting state

14:04 milinda: how can I extend clojure data structure such as priority-map and override only couple of functions

14:04 such as assoc and into

14:06 bbloom: milinda: that's generally not a great idea. might be better if you tell us your goal, there may be a nicer approach

14:06 whodidthis: no state on the input at all, i mean the problem is that if the user types anything into a server side rendered om page before om runs on client side they get cleared up

14:09 milinda: bbloom: I want a priority-map with limited capacity

14:09 bbloom: milinda: do you truly need to limit the capacity at the data structure level? or can you simply guard access to an underlying priority-map?

14:10 milinda: ie do you hand a priority-map out to folks, or do you provide an API that people call in to?

14:10 milinda: bbloom: I thought of doing that. But I thought defining a new type based existing priority-map is better

14:10 bbloom: milinda: better how?

14:11 milinda: I mean I can re-use it accorss different implementation

14:11 dnolen_: whodidthis: you need to set the state of the input as the user types

14:11 milinda: basically I am implementing top-k words streaming algorithm

14:11 bbloom: milinda: do you have immediate plans to do that? or is this premature generalization?

14:12 milinda: my guess is that the right thing to do is to simply use a priority map and funnel inserts into that map by a function that bounds the size

14:12 dnolen_: whodidthis: if you are doing this and it doesn't work then that is a bug - if this is the case I need to see a minimal example

14:12 bbloom: milinda: remember, we don't need to encapsulate logic in to objects/types/classes nearly as much as in the OOP world b/c all our stuff is immutable. the only harm people can do with a pointer to your data structure is to themselves

14:13 milinda: bbloom: thanks, I'll try that. I am new to clojure so I thought extending the type is the way to do this

14:14 bbloom: milinda: here's a thought experiment: lets say you want to maintain a map and it's reverse index. ie {:x 1, :y 2} and {1 :x, 2 :y}

14:14 milinda: would you create a new type for that?

14:15 rootex: bbloom: would rsubseq suffice there?

14:15 err rseq

14:15 bbloom: milinda: or simply do something like {:forward {:x 1, :y 2} :reverse {1 :x, 2 :y}} and then write a function (defn add-to-index [db] ...)

14:16 rootex: no

14:17 milinda: there are LOTS of places where you need to maintain extra invariants for data... if we created a new class everytime that happened, we'd be writing java ;-)

14:18 milinda: bbloom: tanks for the insight. I think I was thinking in the java way even I am writing clojure

14:19 bbloom: milinda: if you can't tell, i've seen it happen enough to know exactly what to say to you. so don't feel bad! got some brain refactoring to do, it takes time

14:19 milinda: bbloom: :)

14:26 whodidthis: dnolen_: https://github.com/whodidthis/om-nashorn

14:27 dnolen_: whodidthis: you're not setting the value of the input field - I really recommend reading over the React documentation on forms, and the relevant parts of the Om tutorials

14:28 whodidthis: i cant set the state of the input as the user types while the script is loading

14:28 or do you mean on willmount or whatever

14:29 ill try that later if that is the case

14:31 dnolen_: whodidthis: you're simply not setting the value of the input - set it to the blank string so it's a controlled input

14:31 rootex: bbloom: would you consider bad learning algorithms in a imperative language while learning clojure?

14:31 dnolen_: whodidthis: as the the user types, you will need to change the value in order to avoid issues

14:31 whodidthis: I really recommend going through the basic tutorial - you will save yourself a lot of confusion

14:32 rootex: bbloom: since you were talking about the mindshift and all :)

14:36 whodidthis: =( but i absolutely can not change values or whatever while user has the rendered html file on his hands and browser is downloading main.js and evaluating it. i highly apologize though if this has nothing to do with om and search for another solution. at the very least i can render the html on the server side with disabled inputs but thats pretty sad too

14:46 jarjar_prime: morning :_)

14:52 marcuscreo: Morning

14:54 dnolen_: whodidthis: Ok I think I understand you're issue, you want to set the input while the JS is still downloading - no you cannot do this

14:55 whodidthis: but I don't really see the point either, it won't take very long to download production compressed gzipped JS

14:55 whodidthis: and yes, this just how React works, nothing to do w/ Om

15:09 yedi: how do you add a local project as a dependency to your project?

15:15 yotsov: yedi: regardless of if you are using lein or maven, the idea is that the dependency should be a snapshot, and you need to install it (which will copy the built binaries to your local maven repository) via mvn install or lein install. Once it is "installed" there, your main project should see it

15:20 whodidthis: dnolen_: right, sorry. i guess i was just too hyped up and misunderstood this doc http://facebook.github.io/react/docs/top-level-api.html#react.rendercomponenttostring

15:21 dnolen_: whodidthis: that doc isn't really relevant to the issue - React needs to control the DOM - that's the issue

15:22 whodidthis: but again I don't really see the problem here, especially because of script caching on the client

15:22 if the user has visited the page before, it will be instantaneous

15:24 whodidthis: right, ill just disable the forms and probably need to disable links too

15:24 yedi: if i wanted to include a non code resource (like a .txt or .csv file) in my cljs lib, how could I go about that?

15:25 and how would that get deployed/packaged to a client?

15:34 bbloom: rootex: not sure i follow your question

15:44 martinklepsch: whats the go-to thing for handling xml in clojure? clojure.xml or data.xml

16:19 arohner: how do I turn off :pedantic? in lein? I have :pedantic? false in my project.clj, doesn't seem to do much

16:19 `lein deps :tree` NPEs for me

16:21 looks like it's hardcoded on

16:44 martinklepsch: whats the go-to thing for handling xml in clojure? clojure.xml or data.xml or any other even?

16:56 l3dx: I'm getting "Assert failed: (vector? (:dependencies project []))" when running lein ring server - help me please :)

16:59 Anderkent: l2x: https://github.com/weavejester/lein-ring/issues/61 maybe?

16:59 what version of lein ring are you using?

16:59 l3dx: 0.8.10

17:03 Anderkent: hm, can you post your project.clj to refheap/gist?

17:03 Raynes: a refgist.

17:03 A gistheap.

17:03 bodie_: geap

17:04 TEttinger: gif

17:04 Anderkent: TEttinger: that's a different g

17:04 l3dx: strange thing is that it's working on my desktop, but not the MBP (with the same project.clj - which I'll post in a sec)

17:04 Anderkent: tht's definitely weird

17:05 .. run a clean!

17:05 :P

17:06 l3dx: didn't help :p

17:06 https://gist.github.com/tskardal/5d8e6f1bd1a3aa488d7b

17:06 zspencer: Probably a dumb question; but how would I create n of a thing?

17:06 TEttinger: zspencer: repeat ?

17:06 zspencer: that... makes sense.

17:06 I was stuck on "iterate" which required some amount of inputs

17:06 TEttinger: ,(repeat 5 "yes")

17:06 clojurebot: ("yes" "yes" "yes" "yes" "yes")

17:07 zspencer: ,(repeat 5 (fn 1))

17:07 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Parameter declaration 1 should be a vector, compiling:(NO_SOURCE_PATH:0:0)>

17:07 zspencer: ,(repeat 5 #(+ 1 %))

17:07 clojurebot: (#<sandbox$eval73$fn__74 sandbox$eval73$fn__74@f85fd3> #<sandbox$eval73$fn__74 sandbox$eval73$fn__74@f85fd3> #<sandbox$eval73$fn__74 sandbox$eval73$fn__74@f85fd3> #<sandbox$eval73$fn__74 sandbox$eval73$fn__74@f85fd3> #<sandbox$eval73$fn__74 sandbox$eval73$fn__74@f85fd3>)

17:07 TEttinger: also there's repeatedly for zero-arg fns

17:07 zspencer: Nice thanks

17:08 TEttinger: wait did you just want 5 identical fns, or to call them?

17:08 Anderkent: l3dx: that looks reasonable; I guess the next thing I'd check is any user profiles

17:08 you might have an old version of lein-ring as a plugin in a user profile, for example

17:08 zspencer: to call them

17:09 ,(repeatedly 5 #(rand-int 5))

17:09 clojurebot: (2 0 0 1 3)

17:09 zspencer: is exactly what I needed

17:09 l3dx: Anderkent: in .repl/profiles.clj ? (sorry, I'm a bit noobish)

17:09 Anderkent: ~/.lein/profiles.clj

17:09 clojurebot: Cool story bro.

17:09 l3dx: yesh. no lein-ring there

17:10 TEttinger: zspencer, heh that's what I usually use repeatedly for. that or rand-nth

17:13 Anderkent: l3dx: do you get the exception before the server starts or after?

17:14 l3dx: before

17:14 Anderkent: l3dx: also try `lein pprint` and see if there's something suspicious

17:14 mhm. Can't reproduce here

17:14 last resort : nuke your .m2

17:14 l3dx: 'pprint' is not a task. See 'lein help'.

17:14 hm

17:15 Anderkent: oh yeah forgot

17:15 that's a plugin

17:16 add {:user {:plugins [[lein-pprint "1.1.1"]]}} to your ~/.lein/profiles.clj

17:19 l3dx: nuking .m2 didn't help

17:19 what do I look for in the pprint output?

17:21 Anderkent: lein-ring or maybe leinjacker? TBH I'm out of ideas

17:21 esp. since you say it works on another machine

17:21 l3dx: it does

17:21 Anderkent: maybe try removing all your user profiles temprarily (if you had any), or checking what user profiles the other machine has

17:21 l3dx: I even tried jumping back some revisions

17:21 Anderkent: in theory this shoulnt happen

17:22 l3dx: also, it worked on this machine earlier today

17:22 Anderkent: huh!

17:22 gfredericks: TimMc: is cider-inspector the thing you've been nagging me to build the last 6 months?

17:22 l3dx: mhm!

17:22 whatever. I don't bother spending more time on it

17:23 I'll leave it alone for a while :P

17:23 thanks though!

17:26 TimMc: gfredericks: Dunno, and how do you always know when I've just sat down at my computer?

17:26 Who are you get out of my house!

17:26 marcus: lol

17:27 TimMc: gfredericks: It might be.

17:28 gfredericks: dangit how do I make it install cider 0.6.0

17:28 is that not out yet?

17:29 * gfredericks doesn't know anything about elpa/marmalade/what-do-these-terms-even-mean

17:30 gfredericks: they don't have it tagged yet

17:30 do I just make a directory ~/.emacs.d/elpa/cider-0.6.0 and put all the *.el files in it?

17:32 l3dx: Anderkent: I just had to try _one more_ thing :P moving ring-lein out of the profile definition to the "top level" fixed it. or at least made it work

17:34 still, the only dep I have in my user profile is catnip

17:37 gfredericks: no that didn't work it still retrieved 0.5.0

17:37 whatever

17:37 martinklepsch: whats the go-to thing for handling xml in clojure? clojure.xml or data.xml or any other even?

17:41 steckerhalter: gfredericks: you might try quelpa. it should give you the latest cider from upstream. install it (https://github.com/quelpa/quelpa), then M-x quelpa cider RET

17:42 gfredericks: or use the melpa repo, I guess it will give you the latest version too

17:42 gfredericks: what command does C-c C-z map to in cider-mode?

17:42 My C-z is captured by tmux so I'm trying to remap it

17:43 sometimes I wish the cider readme listed function names in its keyboard shortcuts section

17:43 oh I bet autocomplete would give me a hint

17:43 Averell: you can send-keys C-z

17:44 amalloy: martinklepsch: probably data.xml. it's not perfect, but i don't think anything else is better

17:47 gfredericks: Averell: good to know, thanks

17:47 cider-switch-to-relevant-repl-buffer is my best guess

17:49 zspencer: New problem: It looks like set/union is incredibly slow

17:49 amalloy: gfredericks: can't you just C-h b, and look at whatever keystroke you're interested in?

17:50 zspencer: Would it make more sense to just deal with a list and then coerce it into a set at one point?

17:53 amalloy: zspencer: it's hard to imagine that being a good idea, but there's so little context in your question that nobody can really know

17:54 zspencer: I'm using game of life to learn how to do clojure sequences better

17:54 I've got a set of cells defined with x/y coordinates

17:54 bob2: gfredericks, C-h m will show a list of key bindings

17:55 zspencer: Most of the cpu usage seems to be tied up in set operations

17:55 set/union etc

17:56 I guess it's doing deep comparisons of the hashes every time I do a set/union or set/difference

17:56 amalloy: zspencer: a vector of vectors is a lot more efficient than a giant bag of coordinate pairs

17:57 because you can look up just the one(s) you care about quickly

17:57 zspencer: Alternatively instead of a set I could use a map where the keys are a unique index

18:00 gfredericks: amalloy: C-h is rebound to backspace

18:00 amalloy: gfredericks: whatever your help key is. you monster

18:01 gfredericks: I just wanted it to be the same as bash

18:01 btbngr: hmm. in the cider repl, if i want to insert a newline in a history item, it sends the expression to the repl unless i remove the closing parenthesis. Is there a command I can use to just insert a newline conveniently?

18:01 amalloy: btbngr: C-j

18:01 btbngr: great, thanks.

18:03 gfredericks: Why does (do (ns foo.bar) (def x 42)) successfully define x in the foo.bar namespace?

18:03 btbngr: and while I'm at it, but a silly request, can I get cider-repl to syntax hilight the input expression?

18:03 gfredericks: I thought ns was side-effecting and def resolved the vars at compile time

18:04 even (do (in-ns 'foo.bar) (def x 42)) works

18:04 how on earth

18:05 Bronsa: gfredericks: thanks to the workaround for the gilardi scenario

18:05 expressions in a top-level do are split and evaluated one at a time

18:05 gfredericks: Bronsa: that is by far the most reasonable thing that could possibly be the case

18:06 Bronsa: what's a realistic use case for this?

18:06 Bronsa: (do (require 'some.ns) (some.ns/function))

18:06 gfredericks: and why would I type that?

18:07 (has to be a top-level thing, right?)

18:07 I guess a macroexpansion might do that

18:07 Bronsa: yeah, it's usually done in macros

18:07 gfredericks: http://technomancy.us/143

18:08 gfredericks: I'm gonna redub it "The Technomancy Scenario"

18:16 bodie_: anyone feel like defending your choice of clojure over scala?

18:17 vijaykiran: bodie_: sbt

18:17 rhg135: yes, fun, bodie_

18:18 bob2: far simpler, far less of people wnadering into the syntax weeds, better concurrency primitives

18:19 SegFaultAX: Definitely simpler. As someone who uses both languages, Scala is an unbelievably complex language.

18:20 rhg135: i've never used scala, but i can say clojure is a fun language to use

18:20 bodie_: do you feel the memory characteristics are suitable for production code? I've heard rumors that clojure has undesirable recursive behavior, or something.

18:20 SegFaultAX: I also prefer Clojure's focus on values and transformations over those values.

18:20 * bodie_ stirs the pot a little

18:20 SegFaultAX: bodie_: What do you mean "undesirable recursive behavior"?

18:20 rhg135: SegFaultAX: agreed

18:21 michaniskin: SegFaultAX: loop/recur vs TCO

18:21 rhg135: it's much more efective imo

18:21 loop/recur IS explicit TCO

18:21 SegFaultAX: bodie_: As for memory, there is always a cost to immutability and, arguably, dynamicity. I'm happy to pay that price, personally, since I don't work in a place that requires absolute optimization.

18:21 michaniskin: lol i mean calling recur from non-tail position, then

18:22 gfredericks: not allowed

18:22 michaniskin: my point exactly

18:22 SegFaultAX: michaniskin: What is your point?

18:22 rhg135: not in scala either

18:22 SegFaultAX: rhg135: Huh?

18:23 michaniskin: i was just saying that real TCO is something people complain about with respect to recursion in clojure, is all

18:23 vs scheme or whatever

18:23 rhg135: i mean scala will not tell you if a non-tail call is made

18:23 SegFaultAX: Is recur somehow not real?

18:23 rhg135: it'll let the stack explode

18:23 bodie_: SegFaultAX, could you elaborate a little on that? do you feel you could comment on whether that's a cost that I need to be paranoid about if I'm trying to push the limits of the system?

18:23 btbngr: rhg: that's not true, you can use the @tailrec annotation and the compiler will blow up in your face if your function wasn't actually tail recursive.

18:24 rhg135: btbngr: ah didn't know ;)

18:24 vijaykiran: rhg135: I think you can use @tailrec annotation to get a warning

18:24 bodie_: I'm trying to settle on some backend code, and while Go is nice, I feel like clojure could be fun -- i'm also looking to possibly make a game, and Go doesn't have desirable gc behavior for smooth framerates

18:24 rhg135: as i said no scala here

18:24 SegFaultAX: bodie_: If you're trying to squeeze every last ounce of memory efficiency and speed out of your machine, probably Clojure /and/ Scala aren't going to help you very much.

18:24 bodie_: eh. let's say vs java

18:24 rhg135: actually...

18:25 the jvm is pretty damn good

18:25 bodie_: I guess that's a bad comparison since Java programs can be well or horribly designed

18:25 bob2: with sufficient effort, it generates the same bytecode as java

18:25 SegFaultAX: Ehhhh

18:25 bob2: but if you're asking on irc you're presumably not really demanding the best possible performance

18:25 so give it a go - it's very likely to be fast enough

18:25 bodie_: ;) this is really more a mental exercise, but I'm curious how people who have more experience than I do feel about it.

18:26 prolly if I do something with teh big datas I'll just be using mapreduce to do it anyway :P

18:26 rhg135: tbh it's awesome to be able to write code and patch it while running

18:26 bob2: my experience is that hardly any code that I write is really cpu-bound, and having non-ridiculous ways of handling concurrency and a very pleasant language is far more valuable

18:26 SegFaultAX: bodie_: Unless you're relentless about ensuring no reflection is used and annotation as much as possible so the compiler can optimize your code, Clojure is likely going to be slower in most cases.

18:27 bodie_: Whether that's too slow for what you're trying to do relative to what pure Java can accomplish is not a question we can answer for you.

18:27 rhg135: also the focus on values helps see the core of your problem

18:27 bodie_: that sounds about like what I thought, but there aren't any serious gotchas as in Python's recursive behavior where it'll just crap itself if you recurse too deep? (where too deep defaults to a low number, etc)

18:27 yeah, I'm just curious :)

18:27 SegFaultAX: bodie_: But Scala and Java introduce another set of problems (which aren't related to performance) that you must contend with.

18:27 bob2: ?

18:27 SegFaultAX: That's the tradeoff we make when using Clojure.

18:27 bob2: java, clojure, python all can blow their stack

18:27 bodie_: well yeah

18:28 btbngr: bodie_: proper scheme style tail recursion in general has its woes though. something blows up deep in your code? oh, that's right, you told me to throw away the stacktrace, so i did. have fun.

18:28 bob2: solution: don't write deeply recursive code

18:28 this isn't scheme

18:28 TEttinger: bodie_: I'm still a fan of clojure for most things, but not for games anymore. the pure immutable behavior is great for a lot of things, but hard to port existing imperative (common in game dev) algorithms to.

18:28 bob2: (or use recur)

18:29 SegFaultAX: And plus even efficient structural sharing isn't going to be as memory efficient as whomping on mutable state all day.

18:30 bodie_: hmmm

18:30 SegFaultAX: bodie_: Here's my suggestion to you: write the smallest possible implementation of what you're building in a variety of languages and measure.

18:30 Measure performance, measure throughput and latency, and measure your own happiness while writing the code.

18:31 btbngr: bodie_: also, all is not lost. If you need your core renderer and physics engine in scala? so be it. you can still ffi easily enough from closure. you're in the jvm!

18:31 bodie_: I think that makes sense :) and I do feel good about clojure, generally. and bad about scala. heh

18:31 good point, btbngr

18:32 SegFaultAX: bodie_: Scala has some interesting things to be sure. But the drawbacks are also substantial IMHO.

18:32 bodie_: I was actually vaguely pondering using it to interoperate with scala... lol

18:32 anyway, I think I need to get out of fantasyland and make some choices here. thanks all for the input :)

18:32 btbngr: clojure* wee. not enough sleep.

18:32 TEttinger: I would imagine Racket isn't a bad choice if you wanted many of clojure's features that aren't concurrency-related, and some more for DSL-writing. but then no interop with java or scala.

18:33 SegFaultAX: TEttinger: Presumably the JVM is a motivating factor here. Though I guess he did say something about golang.

18:33 bodie_: Go doesn't typically have system level deps

18:33 bob2: statically link all the things

18:33 bodie_: so it's pretty easy to distribute on a variety of platforms

18:33 SegFaultAX: And that's great, except you have to write all your code in Go.

18:34 * SegFaultAX ducks

18:34 btbngr: :)

18:34 bodie_: hehe.... right.. which is.. something a little different. but I come from C world originally, so it's kinda comfy for me

18:34 SegFaultAX: The only thing that stops me from looking at Go seriously is the lack of generics.

18:34 bodie_: I think almost every design choice in Go is a sound one, and an intentional one. but it's not for every purpose

18:35 so, if it lacks generics, ask yourself why, and what they want you to do instead -- chances are it'll be easier on you

18:35 at least, that's how we approach it

18:35 bob2: untyped pointers?

18:35 btbngr: Scala is quite nice, but I'm rather scared of giving my team unfettered access to it. Most of it's features are a loaded shotgun in disguise.

18:35 bodie_: it's .... intensely opinionated

18:35 SegFaultAX: bodie_: Simple, I want to implement a "map" function. :)

18:36 And the reason it lacks generics is because the go team hasn't found a syntax and style that they like, and it isn't a priority.

18:36 bodie_: must defend Go's honor another time gentlepeoples ;) adieu!

18:37 SegFaultAX: btbngr: What do you like about Scala in paticular?

18:37 bodie_: bob2, empty interfaces are magic

18:37 btbngr: SegFaultAX: the type system is interesting. It *almost* let's you do proper functional programming.

18:38 SegFaultAX: btbngr: But *almost* isn't good enough :(

18:38 btbngr: SegFaultAX: until you end up cursing the day it was designed because the lack of hindley-milner, yeah, exactly.

18:39 SegFaultAX: I think most Scala users would say lack of HM is a feature. ;)

18:39 btbngr: the feature of "I get to spend the next half hour figuring out the type annotations and variances for all these vars is".

18:40 SegFaultAX: btbngr: Scala may as well not have type inference at all for all the good it does.

18:40 bob2: also "I confused the compiler so I fix this inscrutable error by adding more declarations" is not as rare as it should be

18:40 SegFaultAX: It can't even infer simple expressions most of the time.

18:40 btbngr: bob2: scala is particularly pathological in that regard

18:40 bob2: though, since I do like clojure, I don't want to get on too high a compiler-error horse

18:41 akhudek: css really drives me crazy sometimes

18:41 SegFaultAX: btbngr: Frankly I'd rather go for Haskell if I'm looking for static types.

18:41 btbngr: That said, i would *really* appreciate it if the clojure compiler would do weak type inference like sbcl or similar and bitch if I do something obviously wrong.

18:41 SegFaultAX: yeah, haskell is kinda nice. but then I start wanting to do very complicated things with matrices and it deteriorates into pain. I am probably not smart enough/haven't given it enough time.

18:42 SegFaultAX: btbngr: core.typed!

18:42 :)

18:42 btbngr: yeah, i ran into that. *DOES IT WORK*?

18:42 SegFaultAX: akhudek: I basically gave up on trying to learn CSS. I'll let the front-end people figure it out. :)

18:43 akhudek: SegFaultAX: that's a very good idea

18:44 btbngr: I'm picking up clojure for the first time in a few years, so I'm completely new to everything again, even simple static typechecking would make clojure a far bigger win than the rest of dynamic languages we put in production.

18:44 SegFaultAX: I just can't get in that mode of thinking. I don't know why. Maybe I'm not visual enough or something. I mean, I can do the basics. But when it gets to building complex responsive stuff, I'm lost.

18:44 btbngr: no, no, it's not you. css is just shit.

18:45 akhudek: SegFaultAX: I have no issue with the visual thinking

18:45 but sometimes it just does wacky things

18:45 like now for instance, there is a transparent div and another underneath it with :hover properties

18:45 but it just won't ever activate :hover

18:46 I cannot reproduce it in jsfiddle eitehr

18:46 maddening

18:46 btbngr: akhudek: pointer-events: none

18:46 should punch through that. in some browsers...

18:48 akhudek: btbngr: that does it, thanks. What on earth are the rules for who gets the event though?

18:48 simple mockups of similar situations on jsfiddle suggests that events will pass through transparent divs without this

18:50 btbngr: really? how odd. I never had that work, in the tests I tried. display: none is different to opacity. opacity eats events. There's also a *huge* caveat with pointer-events, in that, it's "EXPERIMENTAL". so. enjoy it while it lasts...

18:50 http://stackoverflow.com/questions/3015422/forwarding-mouse-events-through-layers-divs you might want to peek at that for a more robust, and as usual, more messy solution.

18:52 akhudek: btbngr: ok, thanks, I'll read that through

19:21 benzap: Simple question for you guys, is there a (max ...) function that takes into account a max value criterion?

19:22 hyPiRion: benzap: not sure what you mean, but perhaps max-key is what you want?

19:22 marcuscreo: like a function as criteria?

19:22 yeah

19:22 hyPiRion: ,(max-key :foo {:foo 2} {:foo 4})

19:22 clojurebot: {:foo 4}

19:22 benzap: ah ok

19:22 that looks like what I want

19:23 hyPiRion: ,(max-key (fn [n] (if (odd? n) -1 n)) 2 4 5 9)

19:23 clojurebot: 4

19:24 marcuscreo: (print "I'm a n00b")

19:24 ,(print "I'm a n00b")

19:24 clojurebot: I'm a n00b

19:24 marcuscreo: ahhh

19:24 cool!

19:24 ;-)

19:27 Raynes: If you ##(println "embed code like this"), lazybot picks it up and evaluates it for you.

19:27 lazybot: ⇒ embed code like this nil

19:27 zspencer: let's say I have two collections: ["a" "b"] ["1" "2"]

19:27 Raynes: Hypothetically.

19:27 marcuscreo: How is lazybot different from clojurebot?

19:28 zspencer: and I want to convert them to keywords for every possible combination

19:28 Raynes: marcuscreo: They're completely different bots with completely different codebase.

19:28 They overlap in functionality a bit, but are otherwise entirely different.

19:28 zspencer: I don't suppose there's a reasonable way to do that?

19:28 marcuscreo: ##(print "I'm a n00by")

19:28 lazybot: ⇒ I'm a n00bynil

19:28 zspencer: ,(map keyword ["a" "b"] ["1" "2]) ;; doesn't do what I want

19:28 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

19:28 zspencer: ,(map keyword ["a" "b"] ["1" "2])

19:28 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

19:28 marcuscreo: ,(print "I'm still a n00by)

19:28 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

19:28 zspencer: ,(map keyword ["a" "b"] ["1" "2"])

19:28 clojurebot: (:a/1 :b/2)

19:28 marcuscreo: ,(print "I'm still a n00by")

19:28 clojurebot: I'm still a n00by

19:29 Raynes: marcuscreo: You can also private message the bots ;)

19:29 hyPiRion: (inc Raynes)

19:29 lazybot: ⇒ 45

19:29 marcuscreo: sorry!

19:29 Raynes: zspencer: Could you elaborate a bit more?

19:29 Expected output would be great.

19:30 zspencer: basically I want that to return (:a/1 :a/2 :b/1 :b/2)

19:30 I could do it with a nested reduce statement; but it seems like there'd be a built in function for it

19:31 Anderkent: ,(for [n ["a" "b"] s ["1" "2"]] (keyword n s))

19:31 clojurebot: (:a/1 :a/2 :b/1 :b/2)

19:31 hyPiRion: ,(keyword "a" "1")

19:31 clojurebot: :a/1

19:31 * Raynes backspaces...

19:31 hyPiRion: ,(map keyword ["a"] ["1"])

19:31 clojurebot: (:a/1)

19:32 zspencer: Ah nice, so for can take multiple sequences

19:32 (inc Anderkent)

19:32 lazybot: ⇒ 10

19:32 Raynes: for would be more or less completely useless if it didn't.

19:32 Anderkent: muahaha imaginary internet points!

19:32 yeah I don't really use for much except for exactly this purpose; it doesnt seem to come up that often though

19:36 TravisD: Can I attach metadata to any value?

19:37 Raynes: No.

19:38 hyPiRion: just iobjs

19:38 Raynes: &(with-meta 1 {})

19:38 lazybot: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IObj

19:38 Raynes: It's utterly infuriating, isn't it?

19:39 Anderkent: yes!

19:39 TravisD: what's an iobj?

19:39 Anderkent: TravisD: any clojure object

19:39 TravisD: ah

19:39 hyPiRion: well yeah, almost any clojure object

19:39 Anderkent: oh?

19:39 Frozenlock: Eh... I have a long text to write for a webpage and hiccup is less than handy for that. What do you guys use for authoring?

19:40 hyPiRion: ,^:foo 1/2

19:40 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>

19:40 TravisD: So you can't apply it to java primitives? Are there other things?

19:40 Anderkent: java objects in general

19:40 TravisD: ah

19:40 Anderkent: strings, classes, blah balh

19:40 TravisD: frustrating

19:40 Anderkent: ,(type 1/2)

19:40 clojurebot: clojure.lang.Ratio

19:41 scottj: Frozenlock: markdown-mode or org-mode+export

19:41 TravisD: Is the restriction a technical one? Or is there some reason to only have metadata for some types of things

19:41 Anderkent: it's super frustrating, I wish i could have :line and :column on every read thing

19:41 Raynes: Frozenlock: A markdown renderer?

19:41 https://github.com/Raynes/cegdown

19:41 * Raynes toot toot

19:41 hyPiRion: TravisD: The restriction is partly due to performance, from what I gather.

19:41 Anderkent: TravisD: kinda, metadata lives in the object; pure java objects just dont store them

19:42 hyPiRion: Theoretically Clojure could box everything, but that wouldn't be efficient.

19:42 gfredericks: keywords intentionally can't take meta

19:42 Frozenlock: scottj: Thanks, exporting org-mode was actually what I did in another project. i was wondering if there was anything new under the sun. :-)

19:42 TravisD: ew

19:42 Anderkent: well yeah because they're supposed to be singletons

19:42 Frozenlock: Raynes: looking now, thanks

19:44 TravisD: brb

19:46 bjeanes: gfredericks: why's that?

19:46 oh because they are intern'd?

19:50 Raynes: Frozenlock: To make it clear what I mean, you can potentially write your text in markdown and then render it with this and style with css. Possibly modify the output with enlive or laser if you need. I do that in refheap.

19:57 FatsDT: In clojurescript, I Should be able to doseq over a NodeList, right?

19:58 I'm getting an error telling me otherwise. "[Object NodeList]is no ISeqable"

20:06 dnolen_: FatsDT: NodeList is not ISeqable, you can make it work with (prim-seq some-node-list)

20:11 FatsDT: dnolen_: Thank you

20:13 marcuscreo: (print "hello")

20:13 sorry!

20:20 btbngr: ,(print "That's okay")

20:20 clojurebot: That's okay

20:23 marcuscreo: ##(print "Thanks!")

20:23 lazybot: ⇒ Thanks!nil

20:23 marcuscreo: I don't know which is tougher to pick-up, Clojure or IRC. ;-)

20:23 btbngr: hehe

20:24 gfredericks: bjeanes: yep

20:25 seancorfield: dnolen_: I spent the afternoon of the Clojure/West hackfest going through the Om tutorials... very impressive stuff!

20:26 Still seems like a lot of code to create web applications but it's making more sense now :)

20:26 dnolen_: seancorfield: thanks! needs a bit more work but it's getting there

20:27 lynaghk: dnolen_: I'm also just now digging into om

20:27 dnolen_: lynaghk: cool

20:27 marcuscreo: I think "create a web framework" is the new "hello world" for a language

20:28 lynaghk: dnolen_: does all of the app state have to be associative? I'm trying to render tiles that're stored in a map keyed by coordinates

20:28 dnolen_: lynaghk: I actually started thinking about rhickey's point - and I think he's right, I've got a small tweak coming that should make things a lot more sensible.

20:28 for generic component anyway

20:28 lynaghk: dnolen_: and it's not obvious to me what the proper way is to pass in the key/value into a child component

20:28 dnolen_: rich's point regarding?

20:29 dnolen_: lynaghk: it does need to be associative out of the box, but you can extend other types to the cursor protocol.

20:29 lynaghk: React forces everything to flow in via props

20:29 seancorfield: a vector is associative tho', yes?

20:29 lynaghk: dnolen_: ah

20:29 dnolen_: lynaghk: this is fine is many cases, but there are some things that get annoying because of this

20:30 seancorfield: What did Rich have to say about Om? I missed that...

20:30 dnolen_: lynaghk: I have a pretty good idea now how to track dependencies if some lower component needs some app state without having to pass it in from above.

20:30 having to pass things in from above is the primary issue

20:33 seancorfield: You need declarative Dependency Injection :)

20:34 gfredericks: dangit; sending a "clone" msg from an nrepl middleware does not cause cider to open a new repl buffer :/

20:41 ivan: (clojure.tools.namespace.repl/refresh) doesn't reload my tests; am I doing something wrong?

20:42 dnolen_: lynaghk: seancorfield: I've also got "advanced" material coming which will clarify how to bend Om to your will, I've avoided covering the Om specific protocols for now, but I think they are pretty good now and will cover how to extend them to specific needs.

20:42 lynaghk: dnolen_: sounds good to me. I still need some time to internalize the basics, though

20:43 dnolen_: about 30 minutes in at the moment = )

20:45 seancorfield: By the time I was halfway through the Basic Tutorial, I was already modifying the behavior of the form fields and getting ahead of the tutorial... It gets more obvious and more straightforward once you're over the initial hump!

20:53 chare: when i do "lein ring server" what exactly does that do, how do i know what is the entry point main f unction?

20:54 TravisD: I'm reading a bunch of datasets from different files, and I want to make sure I remember where they came from. But, I don't particularly need that information for any of the computations I'm doing. Is metadata the right solution for this problem?

20:55 coventry: chare: see the [:ring :handler] field here: https://github.com/weavejester/lein-ring#install

20:58 chare: Also, these tutorials on ring are very helpful. https://www.google.com/search?q=site%3Alearningclojure.com+ring&oq=site%3Alearningclojure.com+ring&aqs=chrome..69i57j69i58.2463j0j7&sourceid=chrome&espv=210&es_sm=91&ie=UTF-8

21:00 seancorfield: dnolen_: roninhacker's blog post talks about passing channels in the options argument - is that "recommended"? I didn't get a clear sense of what that third argument is for in the tutorials (or at least I haven't yet).

21:11 btbngr: huh. core.typed works quite well!

21:18 arnaudsj: hi, does anybody know if it possible to declare a dynamic value for :name (within :gen-class block)?

21:19 bob2: 's XY sensor dings

21:19 arnaudsj: basically I want the :name value to be set dynamically based on the namespace declared above.

21:24 ivan: tools.namespace wasn't reloading things because the machine writing files had a slow clock and the file timestamps weren't new enough

21:27 bodie_: can anyone convince me that my time will be better spent on clojure than on jruby? (not particularly familiar with ruby fwiw)

21:27 btbngr: ruby runs like molasses

21:28 zspencer: Well, I'd go with the fact that clojure from the ground up is designed to be friends with the JVM

21:28 while JRuby is more "Welp, I guess our language is slow so we need to port it to the JVM!"

21:28 bodie_: btbngr, jruby runs on jvm, a la clojure. or so i'm told

21:28 heh

21:28 zspencer: What problem(s) are you trying to solve?

21:29 btbngr: bodie_: so? ruby has call/cc, which is pretty much impossible to implement on the jvm at any speed.

21:29 http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=all&lang=clojure&lang2=jruby&data=u64q

21:29 zspencer: Many ruby libraries don't play nicely with jRuby;

21:30 bodie_: problem: I seek the Philosopher's Stone

21:30 :P

21:30 zspencer: You may want to check the library ;

21:30 ;)*

21:30 btbngr: so here, (disclaimer: benchmarks mean nothing) ruby is anywhere between 2x and 62x slower than clojure. and you want to make a game, i seem to remember. Are you writing minesweeper?

21:30 bodie_: haha.

21:31 zspencer: yea, ruby and gaming don't play well together.

21:31 Basically due to GC issues in the past; advanced game dev tools never emerged

21:31 rubygeek: what games are there written in clojure?

21:31 bodie_: right now, I'm kind of just going down a hyperlink rabbit hole of information. it's a fun journey.

21:31 gfredericks: the cider repl captures an initial \, and prompts for a command - does anybody know what you can do there?

21:32 btbngr: rubygeek: no idea.

21:32 zspencer: bodie_: what langs are you already familiar with?

21:33 bodie_: I think currently the most interesting things appear to be Clojure, Elixir and possibly JRuby if it's not asinine, which I have yet to determine. not that I would necessarily choose any of those for game programming -- it's just icing on the cake if I can use the same thing for gaming

21:33 uh, Perl, Python, C and C++, and currently crash course in Go

21:33 oh and Java

21:33 lots of java -_-

21:33 was mandatory in school

21:33 zspencer: Clojure is going to be the least like those languages

21:33 well, I guess Elixir also

21:34 bodie_: right, that's not a problem for me. I'm not looking for another imperative language

21:34 zspencer: so if you're wanting to learn new ways to think about code while you make this thing I'd probably go clojure or elixir

21:34 rubygeek: +1

21:34 zspencer: I don't know enough about elixir (I thought it was a dynamic strongly typed functional language, right?)

21:34 bodie_: it's basically a ruby clone for erlang vm

21:35 i.e., you get hot swapping, and erlang interop

21:35 which is nice for some things, but erlang itself is already pretty handy dandy

21:35 btbngr: that it is.

21:36 bodie_: I'm just seeing a lot of comparisons of LISPs to Ruby, which surprised me for some reason, but it makes sense

21:36 so I'm wondering if I shouldn't pursue that train of thought

21:36 zspencer: well, ruby was heavily influenced by lisps

21:36 btbngr: ugh. I'm pretty sure I've seen every programming language that isn't C called "a lisp" at some point.

21:36 zspencer: but also perl

21:37 so *waves hands*

21:37 bodie_: lol btbngr

21:37 perl is less of a lisp, more some other kind of much worse speech impediment ;P

21:37 btbngr: ruby has call/cc and first class lambdas... but that doesn't really make it a lisp. (imo)

21:37 bodie_: maybe tourettes

21:38 bjeanes: ruby has more influence from smalltalk than lisp in design, I think

21:38 btbngr: if it's not lots of irritating and superflous parentheses, i don't count 'em ;)

21:38 bodie_: right, so someone was saying lack of first class continuations is a drawback of clojure, which I don't know enough to evaluate

21:39 bjeanes: guh was hoping instaparse worked in clojurescript but i looks like it does not :(

21:40 :sad:

21:40 btbngr: meh. that's more scheme damage tbh. they're interesting, and you can do quite cool things with them, but they're also horrible for the compiler to optimize and reason about in the general case. plus clojure is heavily immutability based and so first class continuations would probably be an exercise in "I want to loop until my machine catches fire".

21:41 bodie_: i thought that's why we were all here

21:41 i for one require a space heater in my foot region

21:41 AimHere: ,(loop [] (recur))

21:41 clojurebot: Execution Timed Out

21:42 bodie_: lol

21:42 btbngr: hehe, I was wondering what would happen there.

21:43 bodie_: welp, thanks for the navel-gazing session. i'll probably spend some time in clojure-world and see how it goes :)

21:43 any gotchas I should keep an eye open for?

21:43 or learn about, rather

21:45 zspencer: Sometimes recur summons cthulthu

21:45 bodie_: excellent

21:45 let the madness begin

21:45 zspencer: Also, prepare to lose yourself for days in happy coding land

21:46 trap_exit: does anyone have an example of doing web rtc chat using clojurescript?

21:46 I'm looking for a minimal example

21:48 zspencer: OK, I has a dumb again. I have two hashes: { a: 1 :b 2 } { :b 2 :c 3 } I want to get all the keys from the first hash that are not in the second hash

21:48 should I be casting the keys to a set and then differincing them then select-keysing it?

21:48 because that seems... obtuse

21:49 coventry: zspencer: http://clojuredocs.org/clojure_core/clojure.data/diff

21:49 zspencer: so I'd diff the keys and select keys

21:49 because the values are irrelevant in this case

21:51 gfredericks: ,(let [m1 {:a 1 :b 2} m2 {:b 2 :c 3}] (->> (keys m1) (remove #(contains? m2 %))))

21:51 clojurebot: (:a)

21:51 gfredericks: zspencer: ^

21:51 zspencer: ooh remove is new for me

21:51 Raynes: It's the opposite of filter.

21:51 zspencer: I feel like there are about a million low level functions that I really need to just learn

21:52 Raynes: (let [m1 {:a 1 :b 2} m2 {:b 2 :c 3}] (remove #(contains? m2 %) (keys m1)))

21:52 Just because I hate using ->> just because it exists and is pointy.

22:06 akhudek: in clojurescript, do you need to untap tapped channels when you are finished with them, or will garbage collection take care them?

22:14 noprompt: $seen dnolen_

22:14 lazybot: dnolen_ was last seen talking on #clojure 1 hour and 32 minutes ago.

22:58 munderwo: Hi All. Im wanting to build a http proxy with aleph. Had anybody got a project on github that uses aleph for http that I can have a look at? I just want to see a fuller example.

23:05 bodie_: okay. one last question. why should I learn this instead of haskell?

23:05 gfredericks: is anybody familiar enough with tools.nrepl to know why it apparently won't allow two commands to be eval'ing from a single session at the same time?

23:05 bodie_: yeah, I get it, they're totally different

23:06 tmciver: bodie_: why choose? Learn both.

23:06 TEttinger: indeed

23:06 bodie_: limited time, and I desire a really productive tool to get up to speed quickly with.

23:07 rplaca: bodie_: as you can tell, a lot of Clojure folks are also Haskell fans (myself included)

23:07 bodie_: so I guess you use Clojure for JVM interop?

23:07 rplaca: bodie_: having said that, Clojure IMO is a much more productive environment

23:07 bodie_: maybe I'll learn Haskell first so I can be smarter about Clojure when I learn it.

23:08 I'm kinda new to fp.

23:08 _eric: is there a function to tell me if something is a long or not?

23:08 rplaca: if you're interested in theory, Haskell (or one of the ML family) is fascinating

23:09 bodie_: but if you want to write cool programs, I think Clojure is way ahead

23:10 bodie_: that's kinda how I feel based on a cursory overview -- and I think Clojure just "feels" really fluid

23:11 rplaca: bodie_: yeah, after 5 years I still feel the same way

23:11 bodie_: nice :)

23:11 if you were me, what would you be doing instead? ;)

23:11 rplaca: I was gave a talk on Clojure and the state of flow :)

23:11 bodie_: ahhh

23:11 good stuff

23:11 rplaca: s/was/once

23:12 bodie_: i have a fuzzy parser :P

23:13 cddr``: When using prismatic's schema, how would you declare that some key is required only when another key has a certain value?

23:24 _eric: is there something that is the "inverse" of select-keys?

23:25 I want to say, "give me a map that is all of the keys that aren't [this list]"

23:25 Frozenlock: (dissoc my-map [:k1 :k2 :k3]) ?

23:26 scottj: apply dissoc

23:26 Frozenlock: ah yes, apply

23:26 _eric: oh, right

23:26 sweet

23:26 thanks

23:38 chare: what does #<...> mean in [:a {:align "left", :href #<URI http://google.com>} ("google")]

23:40 bjeanes: chare: it just means it is an object of the URI class

23:40 Frozenlock: I'm doing something I know is bad... [:div.some-bootstrap-class] :-/

23:41 chare: bjeanes is that syntax something you can type in a repl to create a java object?

23:41 Frozenlock: Any suggestion on methods to prevent bootstrap from leeking everywhere in my code?

23:41 bjeanes: unfortunately not

23:41 zspencer: Frozenlock: look into less mixins

23:41 * Frozenlock jumps into the google machine

23:42 chare: bjeanes this example is just illustrating what the type will be, its not legal code or data?

23:42 Frozenlock: (with this music https://www.youtube.com/watch?v=1qP-NglUeZU)

23:43 bjeanes: the output in that case is not homoiconic so not particularly helpful

23:46 amalloy: #<...> is how clojure prints out things which don't have a reader syntax

Logging service provided by n01se.net