#clojure logs

2014-03-29

00:32charehow do we make lein new use clojure 1.6 in the generation
00:51technomancychare: use lein 2.4.0
00:52technomancy(which hasn't been released yet)
00:52chareso its buggy?
00:53technomancyno, just needs a few more changes https://github.com/technomancy/leiningen/issues?milestone=15&state=open
01:22amalloytechnomancy: it was a trick question: all software is buggy
01:23technomancyoh nap
01:23technomancysnap
01:26charewhat should I use for editor for clojure, whats the difference between sublime text, light table, etc...
01:29rootexchare: haven't tried it but lighttable looks more beginner friendly
01:41ned-chare: emacs or LT
01:47Raynesamalloy: Unless written in Haskell and confirmed to compile.
01:47Raynes;)
01:48amalloy$heval head []
01:48lazybot⇒ *Exception: Prelude.head: empty list
01:48amalloyBLAM
01:57amalloyprobably better as: head brokenHaskellPrograms where brokenHaskellPrograms = []
03:16chareis there a text editor that will format clojure code nicely, like gofmt does for go
03:19bitemyappamalloy: actually, there's a safe Prelude that avoids that.
03:20amalloyi know
03:20bitemyappthere's also a List type that is required to have at least one element
03:20TEttingerwhat? bitemyapp has returned?
03:20bitemyappand partial functions are one of the few sources of runtime errors.
03:20bitemyappTEttinger: only to troll on behalf of your Lord and Savior.
03:20TEttingerF#?
03:20bitemyappTEttinger: Saint Haskell.
03:20bitemyappExupery de GHC
04:12cYmen_Good morning...
04:13cYmen_Why are partial function sources of runtime errors
04:13cYmen_?
04:16SegFaultAXcYmen_: Do you mean partially applied functions?
04:16SegFaultAXOr functions that are only defined for a subset of their domain?
04:17cYmen_SegFaultAX: I think bitemyapp and TEttinger were talking about partially applied functions...
04:17SegFaultAXOh, I missed the context, then.
04:18bitemyappnope.
04:18bitemyappnot currying, partial functions.
04:18bitemyappcYmen_: 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.
04:18SegFaultAXPartial application isn't the same as currying. :)
04:18bitemyappcYmen_: so if you have a function that takes an argument of type Maybe a
04:19bitemyappcYmen_: and the possible values a Maybe a can be include: Just a or Nothing
04:19bitemyappcYmen_: 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.
04:19bitemyappcYmen_: Haskell can warn you at compile time when you've failed to pattern match all possibilities. Partial functions are quite avoidable.
04:20bitemyappIn 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!
04:20SegFaultAXAnd if you want to learn more about it, go to #haskell.
04:21cYmen_:)
04:21bitemyappSegFaultAX: why? i
04:21bitemyappI am here all night >:)
04:21SegFaultAXbitemyapp: Welcome back. But this is not #haskell.
04:22SegFaultAXAlso, Clojure/West was pretty great. It would have been awesome if you could have come.
04:22bitemyappSegFaultAX: 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.
04:22bitemyappSegFaultAX: I would've spent literally the entire conference 1. Trolling about Haskell 2. Teaching Haskell
04:22SegFaultAXbitemyapp: Heh, ok. Well at least try and keep it on topic.
04:22bitemyappMaybe.
04:23SegFaultAXThere are plenty of people who need help in #haskell. :)
04:24bitemyappSegFaultAX: I'm a concurrent event stream processor. I'm helping them too.
04:24bitemyappcurrently profunctors, upstar, strong functors, comonadic coalgebras, lenses, and Edward Kmett are under discussion.
04:24bitemyappIndistinguishable from Magic.
04:25SegFaultAXCool, enjoy!
04:25bitemyappSegFaultAX: you should learn about Free Monads and relate 'em back to macro-driven DSLs.
04:26TravisDbitemyapp: seriously, please stay on topic
04:27bitemyappTravisD: you can use free monads in Clojure.
04:27bitemyappTravisD: it'd be a little hard to keep it pure without type system assistance, but perfectly doable/practicable.
04:27bitemyapplittle bit manual with typeclasses as well...either way, fun exercise.
04:30yotsovanybody know of a text / talk / whatever explaining the decision clojure, clojurescript, edn (and clojure-clr I guess) to be so separate, without interdependencies?
04:32SegFaultAXyotsov: 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.
04:32SegFaultAXLikewise cljs is another reimplementation on top of the javascript runtime.
04:33SegFaultAXedn is entirely separate. It's a general purpose serialization format that happens to share Clojure syntax for value literals.
04:35alewbitemyapp: I heard you left california?
04:35alewbitemyapp: who's going to present haskell at the clojure meetups now?
04:36bitemyappalew: I'm in Austin, TX
04:36bitemyappalew: me, via Skype.
04:37alewbitemyapp: what's to do in Austin?
04:38bitemyappalew: not get wrecked by taxes. cheap food/beer. Be surrounded by polite dog people.
04:39bitemyappalew: 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.
04:39yotsovSegFaultAX: 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 (
04:39yotsovtimes)
04:40bitemyappyotsov: 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
04:41SegFaultAXActually there is a significant amount of work on this topic, in particular around tools.analyzer.
04:42yotsovyes, I was thinking about analyzer too, it was ported from cljs to clojure
04:42SegFaultAXCreating a self-hosted Clojure implementation (clojure-in-clojure) is the first step to achieving what you're describing.
04:42bitemyappby 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.
04:42SegFaultAXbitemyapp: That's far from nothing ever changing, though.
04:43bitemyappthe "nothing's going to change" had a scope modifier
04:43bitemyappall of that was with regards to the separate repos and what I said should make a lot more sense with that in mind.
04:43bitemyappwords need explicit type annotations.
04:43yotsovSegFaultAX: 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
04:44bitemyappyotsov: Bronsa and all them are the people to poke about that.
04:44SegFaultAXyotsov: If you're interested in the particulars, there was a great talk by Tim Baldridge at Clojure/West.
04:44SegFaultAXYou could also contact him directly if you want more information about the progress on tools.analyzer.
04:45yotsovSegFaultAX: thanks will check it, havent gotten yet to watching the clojure/west videos
04:45cYmen_oooh there are videos?
04:45bitemyappyotsov: https://github.com/Bronsa
04:45SegFaultAXyotsov: https://www.youtube.com/watch?v=KhRQmT22SSg
04:45yotsovcYmen_: this is what I supposed... havent looked
04:46yotsovbitemyapp: thnaks
04:46bitemyappSegFaultAX: http://i.imgur.com/SaTkzm3.gif
04:46SegFaultAXcYmen_: Yes, they were live editing the videos as the talks were going on.
04:46SegFaultAXMany of them were out the same day as the talk.
04:47cYmen_SegFaultAX: Are they all on this youtube channel?
04:47SegFaultAXYes.
04:47cYmen_Excellent.
04:47SegFaultAXDo yourself a favor and watch John Hughes' talk.
04:47alewwhat is the purpose of tools.analyzer? clojure semantics in clojure?
04:47SegFaultAXI had dinner with him the night before... such a fricken cool guy.
04:48SegFaultAXalew: The talk I posted above has more color on that topic.
04:48SegFaultAXalew: I suggest watching it if you're interested.
04:48alewSegFaultAX: can you provide a basic overview?
04:49SegFaultAXalew: Sure. tools.analyzer provides the basic AST analysis and transformation necessary for building a self-hosting clojure.
04:50SegFaultAXIt's an extensible, self documenting, data driven code analyzer.
04:50alewSegFaultAX: Oh I see, so it does all the semantic analysis
04:50SegFaultAXalew: Yes.
04:50SegFaultAXAmong other things.
04:50alewSegFaultAX: seems like it would be useful for buliding tooling around Clojure
04:50alewwhat else is there?
04:51SegFaultAXalew: Platform/implementation-specific tooling for starters.
04:51SegFaultAXSee jvm.tools.analyzer, for example.
04:52SegFaultAX(JVM-specific extensions to the analyzer for things like deftype, defprotocol, etc)
04:52alewRight, but those are seperate from tools.analyzer
04:52SegFaultAXNope, I lied. It's tools.analyzer.jvm :)
04:53SegFaultAXYes. tools.analyzer is designed to be platform agnostic. Each impl will have an extension on top of t.a that is platform-specific.
04:55yotsovSegFaultAX: this is an excellent talk, thanks for pointing to it
04:56SegFaultAXyotsov: You're welcome.
04:56SegFaultAX(And I agree, it is an excellent talk)
04:57alewOh, they are also working on an emitter
04:59SegFaultAXalew: Yes.
05:29amalloySegFaultAX: bronsa was in here earlier saying he'd gotten tools.emitter.jvm to emit clojure.core
05:30SegFaultAXamalloy: No shit?
05:30SegFaultAXThat's awesome!
05:30amalloyhttp://logs.lazybot.org/irc.freenode.net/%23clojure/2014-03-28.txt
05:30amalloyit's not tested/fully-working yet, it sounded like
05:31SegFaultAXStill, progress.
05:32SegFaultAXAlright I'm falling asleep at the keyboard. Night all.
05:50alewYou can't rely on meta data staying after filtering or mapping can you?
05:50amalloyon the sequence itself? you can rely on it not staying
05:50alewthe elements inside
05:51alewthe 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
05:52alewso I was planning on creating a map with the values inside the object and attaching the original object as metadata
05:52clgvalew: build a proxy that adds a map implementation?
05:53alewclgv: looking into proxy now
05:57clgvalew: 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
05:57clgvalew: readonly access is easy for both
06:03alewclgv: what is the different between proxy and reify?
06:03alewdifference*
06:04clgvalew: reify can not inherit from classes it can only implement interfaces
06:04clgvthere is more but I guess that's the relevant part for your problem
06:06alewclgv: I wanted to be able to treat it like a persistent map
06:06clgvalew: but the java object itself is not persistent?
06:07alewclgv: It's not
06:07clgvalew: you need to keep that java object around because of what?
06:07clgvotherwise you could just convert it
06:08alewclgv: the java object has some information in it that ties it to a resource in an api
06:08alewclgv: 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
06:09clgvalew: so it is not actually holding the map data but querying it from the resource?
06:09alewclgv: It grabs a local copy of the remote resource
06:10clgvalew: 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)
06:11clgvalew: but it all depends on the surrounding scenario.
06:12alewclgv: I'm trying to build a reasonable abstraction around the google spreadsheet api
06:12alewclgv: which is one of the most terrible things I have ever experienced
06:13clgvalew: 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
06:15alewclgv: that was one way I was thinking of approaching it, but was trying some other things out first
06:15alewclgv: I'll probably go with that as it seems to make it most interoperable
06:18Fenderhi there, anyone has an idea how I can get a seq of a transient vector without persisting it?
06:20Fenderits 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
06:21Fenderone option is (map v (range (count v)))
06:21Fenderwhich is bad for obvious reasons
06:30clgvFender: why dont you need a seq of the transient vector in the first place?
06:31clgv*do
06:33FenderI need to calculate aggregates (min, mean, max ...) on vecs
06:34Fenderhowever, these vecs get new numbers from time to time
06:34clgvwell just loop-recur over the vector. you cant be more efficient than that
06:34Fenderin the end I am only interested in the aggregates, so I will discard the vecs
06:35Fenderso you say access by index for example
06:35clgvyes
06:36clgvthat's more efficient for persistent vectors as well compared to sequence access
06:36Fenderactually I'd do that, it just seems clumsy
06:36Fenderorly?
06:36clgvhide it in an aggregate function with similar parameters as reduce
06:37clgvyes, for a mental image just compare java arrays and singly linked lists
06:38FenderI know but I thought any seq based on an array (or vec) is inherently faster due to e.g. cpu caching
06:38clgvthe only thing that might be more efficient than index access on vectors is reduce since the vector implements traversing for reduce internally
06:38Fenderregardless of indexed or seq-ed access
06:38clgvbut it remains a seq which adds a lot of overhead ;)
06:39Fender...like internally saving the last visited index
06:39Fenderhmm, that's a point
06:39Fenderbut isn't that just one field?
06:40FenderIOW, isn't the seq on a vec itself realized as a transient?
06:40clgvwhat do you mean?
06:40Fender(= (seq v) (map v (range (count v)))
06:41Fender?
06:41Fenderor: what is the overhead apart from a single double-word saving the last visited index on the vec?
06:42clgvClojure uses value based comparison so that will be true as well as (= v (map v (range (count v))) is true
06:42Fenderthe question was more about the implementation than about the result^^
06:43clgvthe answer was that that expression doesnt tell you what you wante dto know about the implementation ;)
06:43FenderI just don't have the means to phrase the implementation in a high level language :)
06:44clgvwell a seq object object is created for every elementn of the vector while you traverse the sequence
06:44clgvthat is the overhead I meant which is not present when you access by index
06:46Fenderok, so basically one object for each element in the index
06:46Fenderehm, each element in the vector
06:46clgveach element of the vector, yes
06:48Fenderok, that's a lot
06:48Fenderhmm, that helps already, thx
06:48Fenderand I think I gotta make some things more efficient...
06:48Fenderthx!
06:50clgvFender: do you know how much elements you get in advance?
06:51Fenderno, I just know it will increase by the time
06:51Fenderbut I could calculate some upper bound
06:51clgvif 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
06:52Fenderyes I though of arrays specifically
06:52Fenderthe problem is, sometimes I get null values, so it'd be an array of objects
06:52clgvjust make sure that then mutable state does not leak to the outside ;)
06:53Fenderand the I get all the casting hassle
06:53Fenderno worries there, even in my Java times I made practically every method static
06:54Fenderat a time when I didn't know about functional programming, lisp or clojure
06:58FenderI am trying to test what you said
06:58Fender(do (let [r (range 9999999)
06:58Fender v (vec r)]
06:58Fender (time (doall (seq v))
06:58Fender )) 1)
06:58Fendervs
06:59Fender(do (let [r (range 9999999)
06:59Fender v (vec r)]
06:59Fender (time (doall (map v r))
06:59Fender )) 1)
07:00Fenderhowever, I don't get the expected results (1100ms vs 2200ms) but the thing is that indexed-access itself requires a seq
07:00Fenderor I just a loop over a transient int
07:01Fenderand who knows what's optimized away
07:14clgvFender: 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
07:59tomjackhttps://www.refheap.com/8bf04dc83b069d143b0d9b98a
08:02tomjackO_O
08:03clgvso what did you expect?
08:05tomjackit not to be 5am
08:05clgvah thats fine, it isnt over here :P
08:35mercwithamouthhmm 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
08:38llasramThat just means its completely stable :-D
08:39mercwithamouthllasram: lol that was going to be my next post. "either that's a really good thing or really bad"
08:39mercwithamouthalright...i'll just give it a whirl today. lets see
08:40llasramYeah, wasn't meant to be *entirely* facetious. I'm not using clutch, but the CouchDB API is pretty straightforward
08:40llasramAt my company I don't think we've touched our internal CouchDB client library in more than a year
08:41llasramYep -- almost exactly 1 year!
08:42mercwithamouthnice...well thats a good sign.
09:14gozalais there anyway to bundle arbitrary js file with a cljsbuild ?
09:16vijaykirangozala: check https://github.com/emezeske/lein-cljsbuild/blob/master/sample.project.clj#L127
09:18gozalavijaykiran: thanks, I tried externs but it does not seems to append content of js file I want to include :/
09:18gozalareading post from the comment
09:19vijaykirangozala: there should also be :libs option
09:22gozalavijaykiran: thanks
09:22gozalavijaykiran: looks like :foreign-libs is a thing that may work for me
10:02mercwithamouthhmm is there a way to restart the repl in light table?
10:07mercwithamouthi'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:18clgvmercwithamouth: is that folder really contain an underscore on the filesystem "galactic_donut"?
10:19milindahi 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:20milindaplease let me know if any of you have a idea on doing this
10:20milindaI am not sure whether defining a new type wrapping priority-map is the best way
10:22mercwithamouthclgv: nope
10:22mercwithamouthactually...yes it does...and i did not create it
10:22mercwithamouthinteresting. changnig
10:23clgvno it must contain that underscore for the classloader to find it
10:23clgva frequent error is that it contains a hyphen instead
10:23mercwithamouthmy project has a dash but yes...it seems the lein template did create it as as galactic_donut under my source folder
10:24mercwithamouthi see...how would one fix that? new to java and clojure. in project.clj?
10:24clgvright, it does matter for namespaces only not for the project folder itself
10:25mercwithamouthahh i see
10:25mercwithamouthi shouldn't use '-' anyways...to avoid that.
10:25mercwithamouthok
10:27clgvwell sometimes it is pretty usefull for naming
10:27mercwithamouthjust something to look out for...
10:28mercwithamouththats just odd..why is it inconsistent? my repl definitely started up before with that namespace
10:29vijaykiranmercwithamouth: clojure namespace compile to Java classes and they can't have "-"s in the name
10:29mercwithamouthahh now i see 100%.
10:30mercwithamouththere's a conversation on stackoverflow. if i'd gotten to joy of clojure already i'd know =(
10:31mercwithamouthhttp://stackoverflow.com/questions/4420944/why-does-clojure-convert-dashes-in-names-to-underscores-in-the-filesystem/4451693#4451693
10:31gfredericksthere's a jira ticket complaining that clojure should allow dashes in the filesystem as well
10:32mercwithamouththanks
10:40pjstadigis there a way to unify with metadata in core.logic?
10:40pjstadiglike (with-metao obj meta x)
10:44gfrederickspjstadig: afaik you should be ashamed of yourself for thinking to ask that question
10:48pjstadiggfredericks: i regretted it as soon as I asked it
10:49pjstadigi should have my clojure club card revoked
10:49clgv"meta unification" sounds like a research proposal, doesn't it? ;)
10:53gfredericksthat's what "art of the meta-object protocol" actually refers to
10:55clgvgfredericks: I did not hear it in the context of logic programming and unification yet..
11:00technomancydashes on the filesystem would be awesome
11:00technomancythe whole insistence upon .clj files matching .class files is madness
11:04bodie_what's the recommended way of installing clojure and lein? should I assume my distro repos are outdated?
11:07vijaykiranas the page says - if the repo is having 2.x (latest) use it, otherwise just follow - http://leiningen.org
11:08vijaykiranif you have lein - you don't usually install clojure separately
11:24clgvbodie_: install leiningen manually and leiningen will get you clojure ;)
11:24bodie_that's what I ended up realizing.. heh heh. thanks :)
11:29Bronsaso I just find an expression E that works when invoked as E but not when invoked as ((fn [] E))
11:29Bronsafound*
11:30clgvwhat's that expression?
11:30rootexits secret
11:30clgvthat would be mean ;)
11:31Bronsahttp://sprunge.us/BAgH?clj
11:31Bronsathere's a good reason why that doesn't work but it's still surprising at first
11:32clgvis it similar to try to embed objects into source?
11:34clgvBronsa: you can get the error one step earlier by "((foo))"
11:49Bronsaclgv: right
11:51Bronsaclgv: 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:03bodie_anyone have thoughts about clojure for desktop applications?
12:03bodie_favorite gui toolkit, "no that's dumb", etc
12:04MAN_IS_ME
12:08clgvbodie_: take a look at seesaw
12:09bodie_"It happens to be built on Swing, but please don't hold that against it." hehe. okay, thanks :)
12:27FOSScookieCan you guys give me any reasons as to why I should pick clojure over something like Racket?
12:27milindaanyone has any idea on implementing priority-map with limited capacity?
12:29michaniskinFOSScookie: excellent access to java libraries, immutable collections from the very bottom, runs on the JVM, nice hygenic macro system
12:30FOSScookieIs there anything in Java which can approach this beauty for plotting though? http://docs.racket-lang.org/plot/renderer3d.html
12:31michaniskinFOSScookie: probably not, racket is mas elegante, but maybe you like this: https://github.com/liebke/incanter
12:44luxbockis there no type hint for ^ratios?
12:44luxbocklike how would one type hint a collection of ratios
12:46llasramluxbock: That would only be useful if you had a Java array of Ratio instances
12:47luxbockare type hints not useful for clojure collections? I'm very new to this
12:47luxbockI 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:47luxbockwhat is the difference between using #^String vs. ^String?
12:48ambrosebsluxbock: depends on the situation
12:48ambrosebsztellman did a great talk recently on this http://www.youtube.com/watch?v=iQwQXVM6oiY
12:49ambrosebsluxbock: prefer the latter, identical but the former is deprecated
12:49ambrosebsconsider it deprecated at least
12:49luxbockyep I have watched his talk, I should probably watch it again though
12:49luxbockok, thanks
12:50bodie_compojure vs noir?
12:50bodie_total noob
12:50ambrosebsyou almost never care about the concrete type of a clojure collection, unless you have a great reason
12:50ambrosebswrt type hints
12:50bodie_also... if anyone knows anything about seesaw, stumbling on the walkthrough for that.
12:50luxbockaha
12:51luxbockwhere 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:51luxbockdoes this seem like a reasonable approach?
12:51llasramluxbock: Turn on reflection warnings
12:51michaniskinbodie_: http://www.luminusweb.net/
12:51ambrosebsluxbock: ztellman's example with ^Counted .nth is one case for example. If that's in a tight loop, then go for it
12:51llasramluxbock: The only places (non-primitive) type hints can possibly help are where you get reflection warnings
12:51luxbockllasram: yep did so, but I did not get any warnings before I accidently type hinted a wrong variable
12:52llasramluxbock: Then simple reference type hints will not help you any further
12:52luxbockok
12:52bodie_michaniskin, why?
12:52llasramluxbock: Next step is to make sure any parts which should be using primitives are not boxing, which is a bit more difficult
12:52llasramztellman has a library which helps
12:53michaniskinbodie_: 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:53luxbockwhich one is it? he has many of them
12:53llasramluxbock: https://github.com/ztellman/primitive-math
12:54luxbockthanks, though now that I think about it I think my code is not even using any primitive math operations
12:54bodie_Ah, I see. Luminus and Noir are built on Compjure and Ring (while Noir is less current.)
12:54llasramluxbock: Then congratulations -- you're done! :-D
12:54luxbockI should probably read Clojure High Performance Programming
12:55michaniskinbodie_: 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:55ambrosebsluxbock: are you having performance issues?
12:55bodie_I can dig that. I'm less looking to make something "real" right now and more to learn the ins and outs :)
12:55bodie_I appreciate the pointer
12:56luxbockambrosebs: not really, I'm mostly just playing around
12:56ambrosebsluxbock: cool
12:56luxbockI 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:59michaniskinbodie_: you might also want to look at http://clojure-liberator.github.io/liberator/
12:59bodie_interesting
12:59michaniskinbodie_: and http://hoplon.io
13:01ambrosebsluxbock: right, from here you'd find the bottlenecks in the Clojure version and rewrite them. Can be very subtle.
13:01bodie_hoplon.io looks pretty neat :)
13:02michaniskinbodie_: you're welcome in #hoplon if you run into any problems :)
13:02michaniskinor if you don't, too
13:03bodie_I'll check it out
13:03bodie_thanks :)
13:12angeliniIs 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:13ambrosebs,(let [[f & r] [1 2 3]] [f r])
13:13clojurebot[1 (2 3)]
13:13angelinioh perfect, thanks
13:14S11001001angelini: NB: this will call `seq' on the rest part, if that matters.
13:29TravisDIf 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:43llasramTravisD: You don't need lein at all for that -- just make your shebang line invoke `clojure.main`
13:44TravisDllasram: I guess the issue i'm having is that I don't know where the clojure executable is
13:45llasramI see. Well, then maybe https://github.com/kumarshantanu/lein-exec
13:45llasramNot being able to use any dependencies makes it pretty low-value though
13:46TravisDah, I see
13:47michaniskinTravisD: http://github.com/tailrecursion/boot
13:48michaniskinnot lein exactly, but it's a thing
13:48TravisDthanks! I'll check it out
13:57whodidthisdnolen_: 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:57dnolen_whodidthis: if you're doing this via set state that will be a problem yes, it needs to come in via props
13:58whodidthisi mean any input by user
13:58whodidthiswhile the html has loaded but javascript hasnt
13:59dnolen_whodidthis: you mean the browser prepopulating?
14:01whodidthisno not autofill
14:02dnolen_whodidthis: it would clear if you haven't set the state of the input somehow, either via props or setting state
14:04milindahow can I extend clojure data structure such as priority-map and override only couple of functions
14:04milindasuch as assoc and into
14:06bbloommilinda: that's generally not a great idea. might be better if you tell us your goal, there may be a nicer approach
14:06whodidthisno 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:09milindabbloom: I want a priority-map with limited capacity
14:09bbloommilinda: 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:10bbloommilinda: ie do you hand a priority-map out to folks, or do you provide an API that people call in to?
14:10milindabbloom: I thought of doing that. But I thought defining a new type based existing priority-map is better
14:10bbloommilinda: better how?
14:11milindaI mean I can re-use it accorss different implementation
14:11dnolen_whodidthis: you need to set the state of the input as the user types
14:11milindabasically I am implementing top-k words streaming algorithm
14:11bbloommilinda: do you have immediate plans to do that? or is this premature generalization?
14:12bbloommilinda: 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:12dnolen_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:12bbloommilinda: 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:13milindabbloom: thanks, I'll try that. I am new to clojure so I thought extending the type is the way to do this
14:14bbloommilinda: 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:14bbloommilinda: would you create a new type for that?
14:15rootexbbloom: would rsubseq suffice there?
14:15rootexerr rseq
14:15bbloommilinda: 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:16bbloomrootex: no
14:17bbloommilinda: 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:18milindabbloom: tanks for the insight. I think I was thinking in the java way even I am writing clojure
14:19bbloommilinda: 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:19milindabbloom: :)
14:26whodidthisdnolen_: https://github.com/whodidthis/om-nashorn
14:27dnolen_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:28whodidthisi cant set the state of the input as the user types while the script is loading
14:28whodidthisor do you mean on willmount or whatever
14:29whodidthisill try that later if that is the case
14:31dnolen_whodidthis: you're simply not setting the value of the input - set it to the blank string so it's a controlled input
14:31rootexbbloom: would you consider bad learning algorithms in a imperative language while learning clojure?
14:31dnolen_whodidthis: as the the user types, you will need to change the value in order to avoid issues
14:31dnolen_whodidthis: I really recommend going through the basic tutorial - you will save yourself a lot of confusion
14:32rootexbbloom: since you were talking about the mindshift and all :)
14:36whodidthis=( 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:46jarjar_primemorning :_)
14:52marcuscreoMorning
14:54dnolen_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:55dnolen_whodidthis: but I don't really see the point either, it won't take very long to download production compressed gzipped JS
14:55dnolen_whodidthis: and yes, this just how React works, nothing to do w/ Om
15:09yedihow do you add a local project as a dependency to your project?
15:15yotsovyedi: 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:20whodidthisdnolen_: 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:21dnolen_whodidthis: that doc isn't really relevant to the issue - React needs to control the DOM - that's the issue
15:22dnolen_whodidthis: but again I don't really see the problem here, especially because of script caching on the client
15:22dnolen_if the user has visited the page before, it will be instantaneous
15:24whodidthisright, ill just disable the forms and probably need to disable links too
15:24yediif 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:25yediand how would that get deployed/packaged to a client?
15:34bbloomrootex: not sure i follow your question
15:44martinklepschwhats the go-to thing for handling xml in clojure? clojure.xml or data.xml
16:19arohnerhow do I turn off :pedantic? in lein? I have :pedantic? false in my project.clj, doesn't seem to do much
16:19arohner`lein deps :tree` NPEs for me
16:21arohnerlooks like it's hardcoded on
16:44martinklepschwhats the go-to thing for handling xml in clojure? clojure.xml or data.xml or any other even?
16:56l3dxI'm getting "Assert failed: (vector? (:dependencies project []))" when running lein ring server - help me please :)
16:59Anderkentl2x: https://github.com/weavejester/lein-ring/issues/61 maybe?
16:59Anderkentwhat version of lein ring are you using?
16:59l3dx0.8.10
17:03Anderkenthm, can you post your project.clj to refheap/gist?
17:03Raynesa refgist.
17:03RaynesA gistheap.
17:03bodie_geap
17:04TEttingergif
17:04AnderkentTEttinger: that's a different g
17:04l3dxstrange 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:04Anderkenttht's definitely weird
17:05Anderkent.. run a clean!
17:05Anderkent:P
17:06l3dxdidn't help :p
17:06l3dxhttps://gist.github.com/tskardal/5d8e6f1bd1a3aa488d7b
17:06zspencerProbably a dumb question; but how would I create n of a thing?
17:06TEttingerzspencer: repeat ?
17:06zspencerthat... makes sense.
17:06zspencerI was stuck on "iterate" which required some amount of inputs
17:06TEttinger,(repeat 5 "yes")
17:06clojurebot("yes" "yes" "yes" "yes" "yes")
17:07zspencer,(repeat 5 (fn 1))
17:07clojurebot#<CompilerException java.lang.IllegalArgumentException: Parameter declaration 1 should be a vector, compiling:(NO_SOURCE_PATH:0:0)>
17:07zspencer,(repeat 5 #(+ 1 %))
17:07clojurebot(#<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:07TEttingeralso there's repeatedly for zero-arg fns
17:07zspencerNice thanks
17:08TEttingerwait did you just want 5 identical fns, or to call them?
17:08Anderkentl3dx: that looks reasonable; I guess the next thing I'd check is any user profiles
17:08Anderkentyou might have an old version of lein-ring as a plugin in a user profile, for example
17:08zspencerto call them
17:09zspencer,(repeatedly 5 #(rand-int 5))
17:09clojurebot(2 0 0 1 3)
17:09zspenceris exactly what I needed
17:09l3dxAnderkent: in .repl/profiles.clj ? (sorry, I'm a bit noobish)
17:09Anderkent~/.lein/profiles.clj
17:09clojurebotCool story bro.
17:09l3dxyesh. no lein-ring there
17:10TEttingerzspencer, heh that's what I usually use repeatedly for. that or rand-nth
17:13Anderkentl3dx: do you get the exception before the server starts or after?
17:14l3dxbefore
17:14Anderkentl3dx: also try `lein pprint` and see if there's something suspicious
17:14Anderkentmhm. Can't reproduce here
17:14Anderkentlast resort : nuke your .m2
17:14l3dx'pprint' is not a task. See 'lein help'.
17:14l3dxhm
17:15Anderkentoh yeah forgot
17:15Anderkentthat's a plugin
17:16Anderkentadd {:user {:plugins [[lein-pprint "1.1.1"]]}} to your ~/.lein/profiles.clj
17:19l3dxnuking .m2 didn't help
17:19l3dxwhat do I look for in the pprint output?
17:21Anderkentlein-ring or maybe leinjacker? TBH I'm out of ideas
17:21Anderkentesp. since you say it works on another machine
17:21l3dxit does
17:21Anderkentmaybe try removing all your user profiles temprarily (if you had any), or checking what user profiles the other machine has
17:21l3dxI even tried jumping back some revisions
17:21Anderkentin theory this shoulnt happen
17:22l3dxalso, it worked on this machine earlier today
17:22Anderkenthuh!
17:22gfredericksTimMc: is cider-inspector the thing you've been nagging me to build the last 6 months?
17:22l3dxmhm!
17:22l3dxwhatever. I don't bother spending more time on it
17:23l3dxI'll leave it alone for a while :P
17:23l3dxthanks though!
17:26TimMcgfredericks: Dunno, and how do you always know when I've just sat down at my computer?
17:26TimMcWho are you get out of my house!
17:26marcuslol
17:27TimMcgfredericks: It might be.
17:28gfredericksdangit how do I make it install cider 0.6.0
17:28gfredericksis that not out yet?
17:30gfredericksthey don't have it tagged yet
17:30gfredericksdo I just make a directory ~/.emacs.d/elpa/cider-0.6.0 and put all the *.el files in it?
17:32l3dxAnderkent: 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:34l3dxstill, the only dep I have in my user profile is catnip
17:37gfredericksno that didn't work it still retrieved 0.5.0
17:37gfrederickswhatever
17:37martinklepschwhats the go-to thing for handling xml in clojure? clojure.xml or data.xml or any other even?
17:41steckerhaltergfredericks: 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:42steckerhaltergfredericks: or use the melpa repo, I guess it will give you the latest version too
17:42gfrederickswhat command does C-c C-z map to in cider-mode?
17:42gfredericksMy C-z is captured by tmux so I'm trying to remap it
17:43gfrederickssometimes I wish the cider readme listed function names in its keyboard shortcuts section
17:43gfredericksoh I bet autocomplete would give me a hint
17:43Averellyou can send-keys C-z
17:44amalloymartinklepsch: probably data.xml. it's not perfect, but i don't think anything else is better
17:47gfredericksAverell: good to know, thanks
17:47gfrederickscider-switch-to-relevant-repl-buffer is my best guess
17:49zspencerNew problem: It looks like set/union is incredibly slow
17:49amalloygfredericks: can't you just C-h b, and look at whatever keystroke you're interested in?
17:50zspencerWould it make more sense to just deal with a list and then coerce it into a set at one point?
17:53amalloyzspencer: 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:54zspencerI'm using game of life to learn how to do clojure sequences better
17:54zspencerI've got a set of cells defined with x/y coordinates
17:54bob2gfredericks, C-h m will show a list of key bindings
17:55zspencerMost of the cpu usage seems to be tied up in set operations
17:55zspencerset/union etc
17:56zspencerI guess it's doing deep comparisons of the hashes every time I do a set/union or set/difference
17:56amalloyzspencer: a vector of vectors is a lot more efficient than a giant bag of coordinate pairs
17:57amalloybecause you can look up just the one(s) you care about quickly
17:57zspencerAlternatively instead of a set I could use a map where the keys are a unique index
18:00gfredericksamalloy: C-h is rebound to backspace
18:00amalloygfredericks: whatever your help key is. you monster
18:01gfredericksI just wanted it to be the same as bash
18:01btbngrhmm. 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:01amalloybtbngr: C-j
18:01btbngrgreat, thanks.
18:03gfredericksWhy does (do (ns foo.bar) (def x 42)) successfully define x in the foo.bar namespace?
18:03btbngrand while I'm at it, but a silly request, can I get cider-repl to syntax hilight the input expression?
18:03gfredericksI thought ns was side-effecting and def resolved the vars at compile time
18:04gfrederickseven (do (in-ns 'foo.bar) (def x 42)) works
18:04gfrederickshow on earth
18:05Bronsagfredericks: thanks to the workaround for the gilardi scenario
18:05Bronsaexpressions in a top-level do are split and evaluated one at a time
18:05gfredericksBronsa: that is by far the most reasonable thing that could possibly be the case
18:06gfredericksBronsa: what's a realistic use case for this?
18:06Bronsa(do (require 'some.ns) (some.ns/function))
18:06gfredericksand why would I type that?
18:07gfredericks(has to be a top-level thing, right?)
18:07gfredericksI guess a macroexpansion might do that
18:07Bronsayeah, it's usually done in macros
18:07Bronsagfredericks: http://technomancy.us/143
18:08gfredericksI'm gonna redub it "The Technomancy Scenario"
18:16bodie_anyone feel like defending your choice of clojure over scala?
18:17vijaykiranbodie_: sbt
18:17rhg135yes, fun, bodie_
18:18bob2far simpler, far less of people wnadering into the syntax weeds, better concurrency primitives
18:19SegFaultAXDefinitely simpler. As someone who uses both languages, Scala is an unbelievably complex language.
18:20rhg135i've never used scala, but i can say clojure is a fun language to use
18:20bodie_do you feel the memory characteristics are suitable for production code? I've heard rumors that clojure has undesirable recursive behavior, or something.
18:20SegFaultAXI also prefer Clojure's focus on values and transformations over those values.
18:20SegFaultAXbodie_: What do you mean "undesirable recursive behavior"?
18:20rhg135SegFaultAX: agreed
18:21michaniskinSegFaultAX: loop/recur vs TCO
18:21rhg135it's much more efective imo
18:21rhg135loop/recur IS explicit TCO
18:21SegFaultAXbodie_: 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:21michaniskinlol i mean calling recur from non-tail position, then
18:22gfredericksnot allowed
18:22michaniskinmy point exactly
18:22SegFaultAXmichaniskin: What is your point?
18:22rhg135not in scala either
18:22SegFaultAXrhg135: Huh?
18:23michaniskini was just saying that real TCO is something people complain about with respect to recursion in clojure, is all
18:23michaniskinvs scheme or whatever
18:23rhg135i mean scala will not tell you if a non-tail call is made
18:23SegFaultAXIs recur somehow not real?
18:23rhg135it'll let the stack explode
18:23bodie_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:23btbngrrhg: 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:24rhg135btbngr: ah didn't know ;)
18:24vijaykiranrhg135: I think you can use @tailrec annotation to get a warning
18:24bodie_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:24rhg135as i said no scala here
18:24SegFaultAXbodie_: 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:24bodie_eh. let's say vs java
18:24rhg135actually...
18:25rhg135the jvm is pretty damn good
18:25bodie_I guess that's a bad comparison since Java programs can be well or horribly designed
18:25bob2with sufficient effort, it generates the same bytecode as java
18:25SegFaultAXEhhhh
18:25bob2but if you're asking on irc you're presumably not really demanding the best possible performance
18:25bob2so give it a go - it's very likely to be fast enough
18:25bodie_;) this is really more a mental exercise, but I'm curious how people who have more experience than I do feel about it.
18:26bodie_prolly if I do something with teh big datas I'll just be using mapreduce to do it anyway :P
18:26rhg135tbh it's awesome to be able to write code and patch it while running
18:26bob2my 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:26SegFaultAXbodie_: 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:27SegFaultAXbodie_: 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:27rhg135also the focus on values helps see the core of your problem
18:27bodie_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:27bodie_yeah, I'm just curious :)
18:27SegFaultAXbodie_: But Scala and Java introduce another set of problems (which aren't related to performance) that you must contend with.
18:27bob2?
18:27SegFaultAXThat's the tradeoff we make when using Clojure.
18:27bob2java, clojure, python all can blow their stack
18:27bodie_well yeah
18:28btbngrbodie_: 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:28bob2solution: don't write deeply recursive code
18:28bob2this isn't scheme
18:28TEttingerbodie_: 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:28bob2(or use recur)
18:29SegFaultAXAnd plus even efficient structural sharing isn't going to be as memory efficient as whomping on mutable state all day.
18:30bodie_hmmm
18:30SegFaultAXbodie_: Here's my suggestion to you: write the smallest possible implementation of what you're building in a variety of languages and measure.
18:30SegFaultAXMeasure performance, measure throughput and latency, and measure your own happiness while writing the code.
18:31btbngrbodie_: 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:31bodie_I think that makes sense :) and I do feel good about clojure, generally. and bad about scala. heh
18:31bodie_good point, btbngr
18:32SegFaultAXbodie_: Scala has some interesting things to be sure. But the drawbacks are also substantial IMHO.
18:32bodie_I was actually vaguely pondering using it to interoperate with scala... lol
18:32bodie_anyway, I think I need to get out of fantasyland and make some choices here. thanks all for the input :)
18:32btbngrclojure* wee. not enough sleep.
18:32TEttingerI 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:33SegFaultAXTEttinger: Presumably the JVM is a motivating factor here. Though I guess he did say something about golang.
18:33bodie_Go doesn't typically have system level deps
18:33bob2statically link all the things
18:33bodie_so it's pretty easy to distribute on a variety of platforms
18:33SegFaultAXAnd that's great, except you have to write all your code in Go.
18:34btbngr:)
18:34bodie_hehe.... right.. which is.. something a little different. but I come from C world originally, so it's kinda comfy for me
18:34SegFaultAXThe only thing that stops me from looking at Go seriously is the lack of generics.
18:34bodie_I think almost every design choice in Go is a sound one, and an intentional one. but it's not for every purpose
18:35bodie_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:35bodie_at least, that's how we approach it
18:35bob2untyped pointers?
18:35btbngrScala 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:35bodie_it's .... intensely opinionated
18:35SegFaultAXbodie_: Simple, I want to implement a "map" function. :)
18:36SegFaultAXAnd 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:36bodie_must defend Go's honor another time gentlepeoples ;) adieu!
18:37SegFaultAXbtbngr: What do you like about Scala in paticular?
18:37bodie_bob2, empty interfaces are magic
18:37btbngrSegFaultAX: the type system is interesting. It *almost* let's you do proper functional programming.
18:38SegFaultAXbtbngr: But *almost* isn't good enough :(
18:38btbngrSegFaultAX: until you end up cursing the day it was designed because the lack of hindley-milner, yeah, exactly.
18:39SegFaultAXI think most Scala users would say lack of HM is a feature. ;)
18:39btbngrthe feature of "I get to spend the next half hour figuring out the type annotations and variances for all these vars is".
18:40SegFaultAXbtbngr: Scala may as well not have type inference at all for all the good it does.
18:40bob2also "I confused the compiler so I fix this inscrutable error by adding more declarations" is not as rare as it should be
18:40SegFaultAXIt can't even infer simple expressions most of the time.
18:40btbngrbob2: scala is particularly pathological in that regard
18:40bob2though, since I do like clojure, I don't want to get on too high a compiler-error horse
18:41akhudekcss really drives me crazy sometimes
18:41SegFaultAXbtbngr: Frankly I'd rather go for Haskell if I'm looking for static types.
18:41btbngrThat 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:41btbngrSegFaultAX: 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:42SegFaultAXbtbngr: core.typed!
18:42SegFaultAX:)
18:42btbngryeah, i ran into that. *DOES IT WORK*?
18:42SegFaultAXakhudek: I basically gave up on trying to learn CSS. I'll let the front-end people figure it out. :)
18:43akhudekSegFaultAX: that's a very good idea
18:44btbngrI'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:44SegFaultAXI 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:44btbngrno, no, it's not you. css is just shit.
18:45akhudekSegFaultAX: I have no issue with the visual thinking
18:45akhudekbut sometimes it just does wacky things
18:45akhudeklike now for instance, there is a transparent div and another underneath it with :hover properties
18:45akhudekbut it just won't ever activate :hover
18:46akhudekI cannot reproduce it in jsfiddle eitehr
18:46akhudekmaddening
18:46btbngrakhudek: pointer-events: none
18:46btbngrshould punch through that. in some browsers...
18:48akhudekbtbngr: that does it, thanks. What on earth are the rules for who gets the event though?
18:48akhudeksimple mockups of similar situations on jsfiddle suggests that events will pass through transparent divs without this
18:50btbngrreally? 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:50btbngrhttp://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:52akhudekbtbngr: ok, thanks, I'll read that through
19:21benzapSimple question for you guys, is there a (max ...) function that takes into account a max value criterion?
19:22hyPiRionbenzap: not sure what you mean, but perhaps max-key is what you want?
19:22marcuscreolike a function as criteria?
19:22marcuscreoyeah
19:22hyPiRion,(max-key :foo {:foo 2} {:foo 4})
19:22clojurebot{:foo 4}
19:22benzapah ok
19:22benzapthat looks like what I want
19:23hyPiRion,(max-key (fn [n] (if (odd? n) -1 n)) 2 4 5 9)
19:23clojurebot4
19:24marcuscreo(print "I'm a n00b")
19:24marcuscreo,(print "I'm a n00b")
19:24clojurebotI'm a n00b
19:24marcuscreoahhh
19:24marcuscreocool!
19:24marcuscreo;-)
19:27RaynesIf you ##(println "embed code like this"), lazybot picks it up and evaluates it for you.
19:27lazybot⇒ embed code like this nil
19:27zspencerlet's say I have two collections: ["a" "b"] ["1" "2"]
19:27RaynesHypothetically.
19:27marcuscreoHow is lazybot different from clojurebot?
19:28zspencerand I want to convert them to keywords for every possible combination
19:28Raynesmarcuscreo: They're completely different bots with completely different codebase.
19:28RaynesThey overlap in functionality a bit, but are otherwise entirely different.
19:28zspencerI don't suppose there's a reasonable way to do that?
19:28marcuscreo##(print "I'm a n00by")
19:28lazybot⇒ I'm a n00bynil
19:28zspencer,(map keyword ["a" "b"] ["1" "2]) ;; doesn't do what I want
19:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
19:28zspencer,(map keyword ["a" "b"] ["1" "2])
19:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
19:28marcuscreo,(print "I'm still a n00by)
19:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
19:28zspencer,(map keyword ["a" "b"] ["1" "2"])
19:28clojurebot(:a/1 :b/2)
19:28marcuscreo,(print "I'm still a n00by")
19:28clojurebotI'm still a n00by
19:29Raynesmarcuscreo: You can also private message the bots ;)
19:29hyPiRion(inc Raynes)
19:29lazybot⇒ 45
19:29marcuscreosorry!
19:29Rayneszspencer: Could you elaborate a bit more?
19:29RaynesExpected output would be great.
19:30zspencerbasically I want that to return (:a/1 :a/2 :b/1 :b/2)
19:30zspencerI could do it with a nested reduce statement; but it seems like there'd be a built in function for it
19:31Anderkent,(for [n ["a" "b"] s ["1" "2"]] (keyword n s))
19:31clojurebot(:a/1 :a/2 :b/1 :b/2)
19:31hyPiRion,(keyword "a" "1")
19:31clojurebot:a/1
19:31hyPiRion,(map keyword ["a"] ["1"])
19:31clojurebot(:a/1)
19:32zspencerAh nice, so for can take multiple sequences
19:32zspencer(inc Anderkent)
19:32lazybot⇒ 10
19:32Raynesfor would be more or less completely useless if it didn't.
19:32Anderkentmuahaha imaginary internet points!
19:32Anderkentyeah I don't really use for much except for exactly this purpose; it doesnt seem to come up that often though
19:36TravisDCan I attach metadata to any value?
19:37RaynesNo.
19:38hyPiRionjust iobjs
19:38Raynes&(with-meta 1 {})
19:38lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IObj
19:38RaynesIt's utterly infuriating, isn't it?
19:39Anderkentyes!
19:39TravisDwhat's an iobj?
19:39AnderkentTravisD: any clojure object
19:39TravisDah
19:39hyPiRionwell yeah, almost any clojure object
19:39Anderkentoh?
19:39FrozenlockEh... 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:40hyPiRion,^:foo 1/2
19:40clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
19:40TravisDSo you can't apply it to java primitives? Are there other things?
19:40Anderkentjava objects in general
19:40TravisDah
19:40Anderkentstrings, classes, blah balh
19:40TravisDfrustrating
19:40Anderkent,(type 1/2)
19:40clojurebotclojure.lang.Ratio
19:41scottjFrozenlock: markdown-mode or org-mode+export
19:41TravisDIs the restriction a technical one? Or is there some reason to only have metadata for some types of things
19:41Anderkentit's super frustrating, I wish i could have :line and :column on every read thing
19:41RaynesFrozenlock: A markdown renderer?
19:41Rayneshttps://github.com/Raynes/cegdown
19:41hyPiRionTravisD: The restriction is partly due to performance, from what I gather.
19:41AnderkentTravisD: kinda, metadata lives in the object; pure java objects just dont store them
19:42hyPiRionTheoretically Clojure could box everything, but that wouldn't be efficient.
19:42gfrederickskeywords intentionally can't take meta
19:42Frozenlockscottj: Thanks, exporting org-mode was actually what I did in another project. i was wondering if there was anything new under the sun. :-)
19:42TravisDew
19:42Anderkentwell yeah because they're supposed to be singletons
19:42FrozenlockRaynes: looking now, thanks
19:44TravisDbrb
19:46bjeanesgfredericks: why's that?
19:46bjeanesoh because they are intern'd?
19:50RaynesFrozenlock: 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:57FatsDTIn clojurescript, I Should be able to doseq over a NodeList, right?
19:58FatsDTI'm getting an error telling me otherwise. "[Object NodeList]is no ISeqable"
20:06dnolen_FatsDT: NodeList is not ISeqable, you can make it work with (prim-seq some-node-list)
20:11FatsDTdnolen_: Thank you
20:13marcuscreo(print "hello")
20:13marcuscreosorry!
20:20btbngr,(print "That's okay")
20:20clojurebotThat's okay
20:23marcuscreo##(print "Thanks!")
20:23lazybot⇒ Thanks!nil
20:23marcuscreoI don't know which is tougher to pick-up, Clojure or IRC. ;-)
20:23btbngrhehe
20:24gfredericksbjeanes: yep
20:25seancorfielddnolen_: I spent the afternoon of the Clojure/West hackfest going through the Om tutorials... very impressive stuff!
20:26seancorfieldStill seems like a lot of code to create web applications but it's making more sense now :)
20:26dnolen_seancorfield: thanks! needs a bit more work but it's getting there
20:27lynaghkdnolen_: I'm also just now digging into om
20:27dnolen_lynaghk: cool
20:27marcuscreoI think "create a web framework" is the new "hello world" for a language
20:28lynaghkdnolen_: 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:28dnolen_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:28dnolen_for generic component anyway
20:28lynaghkdnolen_: and it's not obvious to me what the proper way is to pass in the key/value into a child component
20:28lynaghkdnolen_: rich's point regarding?
20:29dnolen_lynaghk: it does need to be associative out of the box, but you can extend other types to the cursor protocol.
20:29dnolen_lynaghk: React forces everything to flow in via props
20:29seancorfielda vector is associative tho', yes?
20:29lynaghkdnolen_: ah
20:29dnolen_lynaghk: this is fine is many cases, but there are some things that get annoying because of this
20:30seancorfieldWhat did Rich have to say about Om? I missed that...
20:30dnolen_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:30dnolen_having to pass things in from above is the primary issue
20:33seancorfieldYou need declarative Dependency Injection :)
20:34gfredericksdangit; sending a "clone" msg from an nrepl middleware does not cause cider to open a new repl buffer :/
20:41ivan(clojure.tools.namespace.repl/refresh) doesn't reload my tests; am I doing something wrong?
20:42dnolen_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:42lynaghkdnolen_: sounds good to me. I still need some time to internalize the basics, though
20:43lynaghkdnolen_: about 30 minutes in at the moment = )
20:45seancorfieldBy 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:53charewhen i do "lein ring server" what exactly does that do, how do i know what is the entry point main f unction?
20:54TravisDI'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:55coventrychare: see the [:ring :handler] field here: https://github.com/weavejester/lein-ring#install
20:58coventrychare: Also, these tutorials on ring are very helpful. https://www.google.com/search?q=site%3Alearningclojure.com+ring&amp;oq=site%3Alearningclojure.com+ring&amp;aqs=chrome..69i57j69i58.2463j0j7&amp;sourceid=chrome&amp;espv=210&amp;es_sm=91&amp;ie=UTF-8
21:00seancorfielddnolen_: 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:11btbngrhuh. core.typed works quite well!
21:18arnaudsjhi, does anybody know if it possible to declare a dynamic value for :name (within :gen-class block)?
21:19bob2's XY sensor dings
21:19arnaudsjbasically I want the :name value to be set dynamically based on the namespace declared above.
21:24ivantools.namespace wasn't reloading things because the machine writing files had a slow clock and the file timestamps weren't new enough
21:27bodie_can anyone convince me that my time will be better spent on clojure than on jruby? (not particularly familiar with ruby fwiw)
21:27btbngrruby runs like molasses
21:28zspencerWell, I'd go with the fact that clojure from the ground up is designed to be friends with the JVM
21:28zspencerwhile JRuby is more "Welp, I guess our language is slow so we need to port it to the JVM!"
21:28bodie_btbngr, jruby runs on jvm, a la clojure. or so i'm told
21:28bodie_heh
21:28zspencerWhat problem(s) are you trying to solve?
21:29btbngrbodie_: so? ruby has call/cc, which is pretty much impossible to implement on the jvm at any speed.
21:29btbngrhttp://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=all&amp;lang=clojure&amp;lang2=jruby&amp;data=u64q
21:29zspencerMany ruby libraries don't play nicely with jRuby;
21:30bodie_problem: I seek the Philosopher's Stone
21:30bodie_:P
21:30zspencerYou may want to check the library ;
21:30zspencer;)*
21:30btbngrso 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:30bodie_haha.
21:31zspenceryea, ruby and gaming don't play well together.
21:31zspencerBasically due to GC issues in the past; advanced game dev tools never emerged
21:31rubygeekwhat games are there written in clojure?
21:31bodie_right now, I'm kind of just going down a hyperlink rabbit hole of information. it's a fun journey.
21:31gfredericksthe cider repl captures an initial \, and prompts for a command - does anybody know what you can do there?
21:32btbngrrubygeek: no idea.
21:32zspencerbodie_: what langs are you already familiar with?
21:33bodie_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:33bodie_uh, Perl, Python, C and C++, and currently crash course in Go
21:33bodie_oh and Java
21:33bodie_lots of java -_-
21:33bodie_was mandatory in school
21:33zspencerClojure is going to be the least like those languages
21:33zspencerwell, I guess Elixir also
21:34bodie_right, that's not a problem for me. I'm not looking for another imperative language
21:34zspencerso 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:34rubygeek+1
21:34zspencerI don't know enough about elixir (I thought it was a dynamic strongly typed functional language, right?)
21:34bodie_it's basically a ruby clone for erlang vm
21:35bodie_i.e., you get hot swapping, and erlang interop
21:35bodie_which is nice for some things, but erlang itself is already pretty handy dandy
21:35btbngrthat it is.
21:36bodie_I'm just seeing a lot of comparisons of LISPs to Ruby, which surprised me for some reason, but it makes sense
21:36bodie_so I'm wondering if I shouldn't pursue that train of thought
21:36zspencerwell, ruby was heavily influenced by lisps
21:36btbngrugh. I'm pretty sure I've seen every programming language that isn't C called "a lisp" at some point.
21:36zspencerbut also perl
21:37zspencerso *waves hands*
21:37bodie_lol btbngr
21:37bodie_perl is less of a lisp, more some other kind of much worse speech impediment ;P
21:37btbngrruby has call/cc and first class lambdas... but that doesn't really make it a lisp. (imo)
21:37bodie_maybe tourettes
21:38bjeanesruby has more influence from smalltalk than lisp in design, I think
21:38btbngrif it's not lots of irritating and superflous parentheses, i don't count 'em ;)
21:38bodie_right, so someone was saying lack of first class continuations is a drawback of clojure, which I don't know enough to evaluate
21:39bjeanesguh was hoping instaparse worked in clojurescript but i looks like it does not :(
21:40bjeanes:sad:
21:40btbngrmeh. 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:41bodie_i thought that's why we were all here
21:41bodie_i for one require a space heater in my foot region
21:41AimHere,(loop [] (recur))
21:41clojurebotExecution Timed Out
21:42bodie_lol
21:42btbngrhehe, I was wondering what would happen there.
21:43bodie_welp, thanks for the navel-gazing session. i'll probably spend some time in clojure-world and see how it goes :)
21:43bodie_any gotchas I should keep an eye open for?
21:43bodie_or learn about, rather
21:45zspencerSometimes recur summons cthulthu
21:45bodie_excellent
21:45bodie_let the madness begin
21:45zspencerAlso, prepare to lose yourself for days in happy coding land
21:46trap_exitdoes anyone have an example of doing web rtc chat using clojurescript?
21:46trap_exitI'm looking for a minimal example
21:48zspencerOK, 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:48zspencershould I be casting the keys to a set and then differincing them then select-keysing it?
21:48zspencerbecause that seems... obtuse
21:49coventryzspencer: http://clojuredocs.org/clojure_core/clojure.data/diff
21:49zspencerso I'd diff the keys and select keys
21:49zspencerbecause the values are irrelevant in this case
21:51gfredericks,(let [m1 {:a 1 :b 2} m2 {:b 2 :c 3}] (->> (keys m1) (remove #(contains? m2 %))))
21:51clojurebot(:a)
21:51gfrederickszspencer: ^
21:51zspencerooh remove is new for me
21:51RaynesIt's the opposite of filter.
21:51zspencerI feel like there are about a million low level functions that I really need to just learn
21:52Raynes(let [m1 {:a 1 :b 2} m2 {:b 2 :c 3}] (remove #(contains? m2 %) (keys m1)))
21:52RaynesJust because I hate using ->> just because it exists and is pointy.
22:06akhudekin clojurescript, do you need to untap tapped channels when you are finished with them, or will garbage collection take care them?
22:14noprompt$seen dnolen_
22:14lazybotdnolen_ was last seen talking on #clojure 1 hour and 32 minutes ago.
22:58munderwoHi 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:05bodie_okay. one last question. why should I learn this instead of haskell?
23:05gfredericksis 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:05bodie_yeah, I get it, they're totally different
23:06tmciverbodie_: why choose? Learn both.
23:06TEttingerindeed
23:06bodie_limited time, and I desire a really productive tool to get up to speed quickly with.
23:07rplacabodie_: as you can tell, a lot of Clojure folks are also Haskell fans (myself included)
23:07bodie_so I guess you use Clojure for JVM interop?
23:07rplacabodie_: having said that, Clojure IMO is a much more productive environment
23:07bodie_maybe I'll learn Haskell first so I can be smarter about Clojure when I learn it.
23:08bodie_I'm kinda new to fp.
23:08_ericis there a function to tell me if something is a long or not?
23:08rplacaif you're interested in theory, Haskell (or one of the ML family) is fascinating
23:09rplacabodie_: but if you want to write cool programs, I think Clojure is way ahead
23:10bodie_that's kinda how I feel based on a cursory overview -- and I think Clojure just "feels" really fluid
23:11rplacabodie_: yeah, after 5 years I still feel the same way
23:11bodie_nice :)
23:11bodie_if you were me, what would you be doing instead? ;)
23:11rplacaI was gave a talk on Clojure and the state of flow :)
23:11bodie_ahhh
23:11bodie_good stuff
23:11rplacas/was/once
23:12bodie_i have a fuzzy parser :P
23:13cddr``When using prismatic's schema, how would you declare that some key is required only when another key has a certain value?
23:24_ericis there something that is the "inverse" of select-keys?
23:25_ericI want to say, "give me a map that is all of the keys that aren't [this list]"
23:25Frozenlock(dissoc my-map [:k1 :k2 :k3]) ?
23:26scottjapply dissoc
23:26Frozenlockah yes, apply
23:26_ericoh, right
23:26_ericsweet
23:26_ericthanks
23:38charewhat does #<...> mean in [:a {:align "left", :href #<URI http://google.com&gt;} ("google")]
23:40bjeaneschare: it just means it is an object of the URI class
23:40FrozenlockI'm doing something I know is bad... [:div.some-bootstrap-class] :-/
23:41charebjeanes is that syntax something you can type in a repl to create a java object?
23:41FrozenlockAny suggestion on methods to prevent bootstrap from leeking everywhere in my code?
23:41bjeanesunfortunately not
23:41zspencerFrozenlock: look into less mixins
23:42charebjeanes this example is just illustrating what the type will be, its not legal code or data?
23:42Frozenlock(with this music https://www.youtube.com/watch?v=1qP-NglUeZU)
23:43bjeanesthe output in that case is not homoiconic so not particularly helpful
23:46amalloy#<...> is how clojure prints out things which don't have a reader syntax