#clojure logs

2014-12-13

00:40ghadishaybantrying to beat rhickey's performance on clojure.core/range is super hard
00:41ghadishaybanhad this systems class in university where you were graded according to a giant benchmark scoreboard
00:53rritochghadishayban: Are you using doall within your benchmark? Range is lazy so to truly benchmark it you need to ensure all operations are within the timer.
00:57rritochghadishayban: Looking at the code, I'd expand out the ararities like C would do with inline functions. I'd also pretest for step 1 and use the inc function instead of + whenever step = 1 which is a common case and inc "should" be faster than + in some cases.
01:01ghadishaybanrritoch: yeah I'm on it
01:01ghadishaybanrritoch: benchmarks are here if you want to play along http://dev.clojure.org/jira/browse/CLJ-1515
01:02ghadishaybanrritoch: expand arities of what?
01:03rritochghadishayban: No, but I've made some of my own efforts regarding benchmarks, ultimatly since bytecode is interpreted it's really difficult to get any real advantages since there's no guaranteed time for bytecode, unlike assembly where most instructions use a set number of clock cycles.
01:04rritochghadishayban: The 0,1 and 2 ararity versions just call the 3 ararity version. I'd copy/paste the code in and deal with them separately.
01:05TEttingerararity?
01:05TEttingeris that different from arity?
01:05rritochex. zero ararity automatically uses step 1 so you can use inc and avoid any tests for negative, etc.
01:06rritochTEttinger: yes, that is what I mean
01:06TEttingerheh, I wasn't sure if ararity was a new term for array arity or something
01:07rritochnope, just a mild case of ADD I guess
01:08rritoch(attention deficit....)
01:11ghadishaybanrritoch: range is a subtle problem with many different cases. We're trying to improve it to take advantage of IReduceInit for transducers in 1.7
01:15rritochghadishayban: Ok, well there are a lot of ways of doing it. I'm just going off the code I see. I don't remember if it's python or ruby, but another option is to create a range class which implements a lazy sequence, that would probably be the fastest
01:16rritochghadishayban: I believe it's python that does that
01:18rritochghadishayban: You could even still optimize the arities by having a static constructor that produces different child clases based on arity.
01:18rritochghadishayban: ie. Range/create ...
01:18arrdemghadishayban: the abstraction of a transducer over (range) is still just a foldr, right?
01:20rritochghadishayban: I suppose it's not called a static constructor, maybe a static factory method?
01:20rritochghadishayban: terminology aside, it's still faster
01:22rhg135rritoch: doesn't clojure have RangeSeq?
01:23cflemingghadishayban: What's the state of invokedynamic on JDK 7?
01:23ghadishaybanarrdem: the Range knows not of the transducer, just the fact that it is being reduced over
01:24cflemingghadishayban: I had a feeling I'd read in a few places that it wasn't really ready for production use until JDK 8 - performance problems and bugs IIRC
01:24ghadishaybanrritoch: see the patch clj-1515-9 for a Range.java class
01:24rritochghadishayban: I'm actually looking at the class now, I never noticed it
01:25rhg135,(class (range))
01:25clojurebotclojure.lang.LazySeq
01:25rhg135Nvm
01:26ghadishaybanthe current range class in core is old and unused
01:26rhg135Ah
01:26rhg135I'm not crazy yet
01:26ghadishaybancfleming: apparently jdk <7u45 is not so good
01:27cflemingghadishayban: Ok, but recent versions should be ok?
01:27ghadishaybancfleming: even 8 has issues. 99% of them fixed in 8u40, the fixes just landed in the last 10 days
01:27ghadishayban8u25 is pretty good
01:27ghadishaybanfor clojure purposes good enough, for JRuby or Nashorn, they need more =)
01:28cflemingghadishayban: There was some discussion on the ML of dropping support for JDK6, presumably to investigate invokedynamic - that's inconvenient for me personally, but if JDK 7 is sufficient then it's probably worth it.
01:28ghadishaybanyeah I saw
01:28rritochghadishayban: Well, that looks like the way to go, but it looks like it would need some improvements since it doesn't implement all the interfaces that LazySeq does.
01:28ghadishaybanit's unfortunate for JetBrains case
01:28cflemingghadishayban: Just wanted to make sure I wasn't totally ignorant in my arguments :)
01:29cflemingghadishayban: Yeah, no doubt. I'm going to get a hold of them to see what their homegrown JDK plans are.
01:29ghadishaybanyeah I mean it's not really fair for jetbrains to mandate a jdk that has been EOLed for years on users
01:29ghadishaybanthen again it's mandated because of pesky issues, UI or crashes, that are still open
01:29cflemingghadishayban: They don't so much mandate it as inform users that the recent ones don't work.
01:30ghadishaybanyeah I ran it on both 7 and 8 no issues besides the graphics switching
01:30cflemingghadishayban: Yeah, that one's pretty bad for me personally unfortunately, I do all my work on a laptop
01:30ghadishaybanjetbrains is probably in a similar rock<->hard place as rich or clojure would be
01:30ghadishaybanme too
01:31ghadishaybanrritoch: which interfaces are missing...i feel like you are shooting from the hip
01:33Jaoodcfleming: don't you get tired more rapidly working all the time on the laptop?
01:33rritochghadishayban: Wow, your going to insult me for trying to help you? You can lookup that answer yourself!!!
01:34cflemingJaood: Well, I work about half time at a coworking, and there I plug in an external kb/mouse/screen
01:34cflemingJaood: But it's still the laptop driving it
01:35ghadishaybanrritoch: please simmer down. people working on Range have spent upwards of a month on it, i only respectfully ask that you consider the problems (which are manifold) before prescribing a quick solution
01:37ghadishaybancfleming: also noticed a two finger scroll regression
01:37ghadishaybancfleming: fortunately 0 crashes though
01:37cflemingghadishayban: yeah, there are other issues - alt no longer works as a modifier, I believe
01:38cflemingghadishayban: Yeah, I've had 10+ users report crashes, and I don't have that many users
01:38rritochghadishayban: I have 30 years programming experience, so yes, I can answer some issues instantly where it takes your team months of deliberation to come up with solutions that are often not even optimal.
01:38rritochghadishayban: This is exactly why I've forked clojure
01:39andyfrritoch: With respect, the people spending a month working on optimizing the code are not new to programming, either.
01:39cflemingghadishayban: The crashes are also selected from the pool of people on OSX using JDK 7+, so the proportion must be pretty high
01:39rritochghadishayban: There are very few issues you can run into that I haven't run into dozens of times already
01:39arrdemI'm gonna get beer. this is gonna be good
01:39cflemingarrdem: Pass the popcorn, please
01:39andyfMy dancing isn't that good, guys :)
01:40rritochandyf: Spending months optimizing code, or even years, isn't unusual at all, but these are cases I've already dealt with.
01:41rritochandyf: When I started programming, computers were VERY slow. Optimization wasn't a luxary back then, it was a necessity.
01:42rritochandyf: It is the reason I took up assembly language
01:42andyfI would suggest that ghadi saying "it feels like you are shooting from the hip", that was not intended as an insult, but a request to be more specific about your meaning. It would be surprising if they missed some interfaces being implemented from simple lack of looking. Don't take offense too easily, and please try not to give any.
01:43rritochandyf: who is really shooting from the hip now?
01:43andyfI'm not sure we are assigning the same meaning to that phrase.
01:44rritochandyf: Either way, this is my mistake. If anyone had actually looked you would have seem my mistake quickly. I didn't notice it implements ASeq which is where the missing interfaces came from.
01:45rritochandyf: Err, extends
01:46andyfI feel like people are actually sitting around eating and drinking.
01:46rhg135Party at #clojure!!
01:46clojurebotNo entiendo
01:46arrdemcfleming: one thing I like about texas. these people will put spiced cheese on anything.
01:47rritochandyf: Technically though, I'm not completely wrong as IPending isn't implemented, though I'm not sure what IPending is really used for
01:48cflemingarrdem: That does sound good.
01:48cflemingarrdem: What about spicy wings? Do they have those?
01:49cflemingandyf: I actually did just eat a bunch of guacamole, but sadly I have no beer
01:49andyfcfleming: Would gladly pass you a Newcastle Brown Ale if it weren't so far.
01:49arrdemcfleming: we have pluckers, it's pretty good
01:50JaoodIf Range.java is not used anymore, why is it still in the codebase?
01:50cflemingandyf: Nice selection, thanks!
01:50arrdemJaood: good question. why do we still have clojure.parallel?
01:51andyfrritoch: I don't know if there is a way to say this that sounds respectful, but it is meant that way. I do respect experience in any field, including programming. However, when one brings up their years of experience to a discussion too often, it can sound like an appear to authority.
01:51andyfs/appear/appeal/
01:51Jaoodarrdem: no idea, why?
01:52cflemingarrdem: I see that the pluckers website says "If you don't like our wings, we'll give you the bird". Why would I want the bird if I didn't like it?
01:52arrdemJaood: wish I knew. just making the point that there's trash that never got taken out around.
01:52ghadishaybanJaood: yeah there's a handful of old things in the codebase. not tooo much, but some
01:52arrdemcfleming: thatsthejoke.jpg
01:53rritochandyf: If anyone had actually looked, instead of doing exactly what they accused me of, they would have noticed that IPending wasn't implemented.
01:53andyfI mean, honestly, if you were discussing a programming problem with someone, and you disagreed, and they had 40 years of experience, would you stop looking for reasoned arguments?
01:53rritochandyf: Though I did miss a few interfaces from ASeq, which no one would have known if I hadn't stated it myself.
01:54rritochandyf: Nope, I'd go back to the code first before making myself look ignorant.
01:56rritochandyf: I have met a few people that can outcode me in ways that make anyone here look like newbies. People who can program assembly directly in hex for example, people who can construct valid TCP/IP packets by hand (in hex), etc.
01:56rritochandyf: The only authority in programming is the hardware
01:56arrdemrritoch: dude. have you read anything about how the clojure contributing process works.
01:56cflemingWhen I started programming it were uphill both ways
01:57andyfImpressive feats, for sure. I can't honestly say I know that anyone here would look like a newbie by comparison, because I don't know their abilities in detail. That takes time.
01:57arrdemcfleming: from the bottom of a gravitational singularity?
01:57cflemingarrdem: Ha, that would have been too easy
01:58arrdemcfleming: TIL other Clojurians are capable of infinite time feats. clearly I need to up my game.
01:58rritochandyf: It takes more than time. I tried, memorizing even the x86 instruction set is insanely difficult. I couldn't do it. I also had no drive to memorize the TCP/IP structure, though I suppose that is very useful when writing servers.
02:00rritocharrdem: Yes, I learned the process from clojure-dev after submitting some features for review.
02:00ghadishaybanis the T in TDD for testosterone
02:00arrdem(inc ghadishayban)
02:00lazybot⇒ 1
02:01andyftestosterone driven desire
02:01arrdemghadishayban: dude how are you that low karma
02:01arrdem(identity arrdem)
02:01lazybotarrdem has karma 39.
02:01rritocharrdem: But I also see that clojure only accepts 1% of the features, which is why forking clojure is a better option than dealing with the bureaucracy.
02:01arrdemghadishayban: clearly you need to lurk harder
02:01ghadishaybanarrdem: i'm trying. came here to talk actually
02:02seancorfield(inc ghadishayban)
02:02lazybot⇒ 2
02:02arrdemrritoch: I will refer you as politely as I can to the latest entry on my blog which explains in great detail how aquainted I am with these frustrations.
02:02seancorfieldlink or it didn't happen! :)
02:03andyfseancorfield!
02:03arrdemhttp://arrdem.com/2014/12/11/oxcart_going_forwards/
02:03arrdemseancorfield: ohai there
02:03seancorfieldThank you
02:03arrdemseancorfield: <3
02:03rritocharrdem: Well, when I can come up with a trademark-safe name for this fork I intend to allow anyone to add features to it. Making it a melting pot if you will, of proof of concept projects.
02:03andyfYou might like a new feature in Eastwood's next release -- configuration that overrides the :arglists of functions, so Eastwood uses them for wrong-arity checking rather than the :arglists metadata. Makes most of the java.jdbc arity warnings disappear.
02:04arrdemrritoch: I'm good. Got two forks of my own. Already opted out of running a "community clojure" edition twice.
02:04rritocharrdem: This should help clojure in their decisions to accept projects since developers will be able to use this to prove and discover any issues with proposed features.
02:05cflemingarrdem: I actually once ported a non-trivial action space shooter game from ARM assembly code to x86. True story.
02:05cflemingarrdem: I had a lot more time when I was younger, but even then it was stupid.
02:06andyfcfleming: Wait, who wrote it in ARM to begin with, and why?
02:06cflemingandyf: I did, I wrote it on an Acorn Archimedes
02:06cflemingandyf: As for why, I was young and stupid
02:06andyfHuh, didn't know ARM went back that far.
02:07arrdemI'd make back in my day jokes but I'm the second youngest person her
02:07arrdem*here
02:07arrdemRaynes: HAHA STILL OLDER THAN YOU
02:07rritochDoes anyone know if the name clojure is actually a trademark?
02:07andyfIt is.
02:07cflemingrritoch: Yes it is.
02:08rritochI figured it was, but it isn't noted as such
02:08pdkclojit
02:08rritochSo yeah, I still need a trademark safe name, I was going with clojureplus but there's no way I can defend that name so I'm stuck until I can find a decent name for it.
02:09ghadishaybani'm pretty sure incremental change under constraints is the real engineering challenge
02:09rritochMy current plan is to have this build using the latest release of clojure to ensure a measure of compatiblility.
02:09rritochSimilar to how C++ was originally programmed in C
02:10ghadishaybanthat being said -- arrdem you thought of a tracing JIT?
02:10rritochBut this name issue is always a bother.
02:10arrdemghadishayban: for Clojure?
02:10ghadishaybansome bastard hybrid of the Truffle approach with a tracing approach
02:10rritochMaybe I should just generate a UUID and use that as a name, lol
02:10ghadishaybanwould need concurrently-safe tracing
02:10arrdemghadishayban: your talk is the first I've heard of InvokeDynamic
02:11arrdemrritoch: it's been done before. check the logs.
02:11seancorfieldandyf: good to know but I have a ticket open on java.jdbc to fix the arg lists.
02:11ghadishaybaninvokedynamic is very cool and necessary in bytecode land
02:12ghadishaybanbut something more radical-er could make an interesting thesis
02:12arrdemhehe
02:12seancorfieldarrdem: there's a new way to officially load clojure into a host app - does it still suffer the same overhead as RT?
02:12ghadishaybanand maybe finally motivate me to use refs/dosync to keep track of code
02:12arrdemseancorfield: what's this? first I've heard of it..
02:13rritocharrdem: But do the other versions build with leiningen? https://github.com/rritoch/clojureplus/blob/master/project.clj
02:13ghadishaybanarrdem: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/java/api/Clojure.java#L50
02:13rritocharrdem: Anyhow, I still have a long list of problems, including the tests aren't running from leiningen.
02:13seancorfieldWe use RT right now but it's not official / supported.
02:14arrdemrritoch: dude what part of "my own fork" don't you get.
02:14rritocharrdem: Well, you never provided a link so how could I know in detail what you've done?
02:15rritocharrdem: If you did use leiningen, did you solve the unit test issue?
02:15seancorfieldI tried to rewrite cfmljure from RT to the new java.api but couldn't get it working reliably. I'll take another run at it at some point. Class loader issues.
02:15arrdemghadishayban: seancorfield: I'll do some digging but I'm pretty sure RT is in the reach set of the "new" API
02:16seancorfieldarrdem: thanks. I hadn't dug far. I just wanted to update my library to an official api.
02:16seancorfieldRight now RT is a critical part of our infrastructure.
02:17arrdemhoboy. you are literally my worst nightmare :P
02:17dagda1_if I am using clojure.string/replace then this works (clojure.string/replace "fade.in" #".?\bin\b" "") but how do I build up the expression with a var? I've tried.....
02:17seancorfieldHi gigasquid !
02:17dagda1_ (clojure.string/replace "fade.in" #(str ".?\b" "in" "\b") "") but it errors
02:18arrdemseancorfield: https://github.com/arrdem/clojure/tree/arrdem <- fork that moves a bunch of stuff out of RT to Util, adds RT.init back. that's what I'm playing with.
02:18seancorfielddagda1_: (re-pattern (str ...)) I think.
02:19arrdemseancorfield: dagda1_: yep re-pattern
02:19andyfdagda1_: Also realize that any single backslash inside of #"" needs to be a double backslash in ""
02:19arrdem$grim clojure.core/re-pattern
02:19lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/re-pattern
02:19dagda1_seancorfield: k, that works
02:28rritocharrdem: Anyhow, if you can come up with a trademark safe name for a community edition, I wouldn't mind maintaining it, but all the names I can think of are used, jlisp, xlisp
02:29andyfandylisp. Definitely call it andylisp.
02:30rhg135,(str ”clk-" (java.util.UUID/randomUUID))
02:30clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
02:30arrdem(rand-nth (for [w (line-seq (io/file "/usr/share/badwords"))] (str w "lisp")))
02:30rritochandyf: Hmm, that is an awesome name
02:31ghadishaybanarrdem: lol the rand-nth on a for comprehension is an evil twist
02:31arrdemghadishayban: <3
02:31rritochandyf: Are you assigning that to the public domain so I can use it?
02:31rritochandyf: It implies "And why lisp?"
02:32rritochandyf: considering this is meant to adopt the features the community wants, the name has symmetry
02:32andyfI don't have it trademarked, I know that. I won't stop you from using it.
02:33rritochandyf: Cool :)
02:34rritochandyf: We're good, I checked with my VP, and her only condition is that I don't rename it again tommorow.
02:35rritochandyf: There isn't really a big budget for this project, but we'll see what we can do.
02:37andyfIf it had a budget, I think that would be a first for a fork of Clojure, or indeed nearly any programming language implementation
02:38rritochandyf: I own vnetpublishing, it is a community of freelance developers. We're very far from a corporate structure, my VP is my wife :)
02:38andyfMy wife promoted herself to president.
02:39rritochandyf: We're trying to get away from freelance development and produce a product, to do that we need a platform capable of web 5.0
02:39rritochandyf: lol
02:39cflemingseancorfield: When you mention a new way of embedding Clojure do you mean API.java?
02:39arrdemandyf: good on her
02:40andyfthese comments are making me thirsty
02:41ghadishayban(inc andyf)
02:41lazybot⇒ 13
02:43arrdemandyf: out of beer. have some karma instead.
02:43arrdem(inc andyf)
02:43lazybot⇒ 14
02:45andyfLooks like you can have both at the same time: http://averybrewing.com/our-ales/karma/
02:45cflemingBelgian pale ale, yum
02:45arrdem$google full sale black lager
02:45lazybot[Session Black Lager | Full Sail Brewing Company] http://www.fullsailbrewing.com/session-black.cfm
02:45arrdem^ I need to find somewhere local that sells this stuff
02:47andyfage verification for a *web site* about beer. I sure hope that is a joke, and not some legal restriction.
02:48rritochandyf: Anyhow, thanks for the idea. andylisp.org is registered so I just need to move and delete clojureplus
02:48andyfwow. That was fast.
02:49rritochandyf: I've been working on a web 5.0 platform for 3 years, this is a serious project
02:49rritochandyf: I can't be held up for months and years just because clojure wants to go through a process of rejection
02:51rritochandyf: The project started in PHP, but PHP doesn't provide any persistence so it was useless past web 3.0
02:51andyfrritoch: Anyone can fork any open source project subject to the license, and every open source project has decision makers deciding what changes are made, and what doesn't. I'm not ecstatic about the rate of change in Clojure, but I like it enough to keep using it.
02:53rritochandyf: This is meant to be a community version. We hope to provide a more democratic solution. Such as putting features on their own branches and allowing the community to vote on what gets included.
02:53rritochandyf: This isn't really meant to replace clojure. Just as a temporary solution until clojure has the features we need.
02:54arrdem"we"
02:54arrdemrritoch: so um... what are you doing about feature expressions?
02:54rritochardem: We = the community
02:59rritocharrdem: For now, nothing. I'm still working on core features of clojure that I need for specific purposes. CLR is proprietary so I have no intention of supporting it.
02:59rritocharrdem: ClojureScript is another issue that can be dealt with
03:00arrdemso.... the "fork to add the features we need" is going to ignore the #1 reported pain point of Clojure users. Yep. 5/5 will be contributing.
03:00rritocharrdem: But if people want it than AndyLispScript and AndyLispCLR can be created, but they'll still fall under andylisp.org
03:01rritocharrdem: No, if people want to add features they can, but I won't necissarily be contributing to the branches I have no interest in, like the CLR branch.
03:03rritocharrdem: Andyf put the name andylisp into the public domain, and I secured it from potential registered trademarks by registering andylisp.org
03:03rritocharrdem: The community is now free to do what they want with the name andylisp
03:05andyfI must say that 'naming a new Lisp variant' was not on my list of things to do this morning. :)
03:07arrdemI'll make sure that andylisp.core makes it into Grimoire 0.4.0.
03:07amalloyis CLR still proprietary? i thought they open sourced that a little while ago
03:07cflemingYeah, it's all OSS now
03:08cflemingIIRC they're going to officially support on other platforms too.
03:10rhg135cfleming: when they do I'll stop calling evil
03:12rritochandyf: Technincally I'd say your parents played a big role in it, lol
03:13rritochEither way, freedom isn't really free, In this case it only cost about $25 which is a small price for the greater good.
03:18sveriHi, what is the most idiomatic way to provide a default value for a function argument if the given argument is empty? All I can think of is the :or syntax in a map destructuring, but I dont want to pass a map extra for that
03:19rritochAnyhow know the proper way to label the clojure trademark? I'm using Clojure (TM. Rich Hickey) but since it's not registered I'm not sure what the convention is.
03:19rritochErr, anyone.
03:20andyfsveri: Defining multiple arities for a function, where a 2-arity version calls the 3-arity version of itself with the extra default value, is pretty common.
03:21sveriof course -.- How could I forget about that
03:21sveriandyf: thank you
03:24arrdemthat's the one thing I'm getting progressively less impressed with about our multiple arity functions... we really only use the low arities for partial applications of the "full" arity.
03:25andyfI think you are safe simply saying "The name Clojure is trademarked by Rich Hickey." in a footnote, and putting TM after uses of the word Clojure, but I'm no intellectual property lawyer. Lots of people use Clojure all over the place without putting a (TM) after it.
03:28rritochOk, I deleted clojureplus in prefrence of andylisp https://github.com/rritoch/andylisp so that deals with any trademark issue, licencing won't be changed but I would prefer that contributions come under the MIT license.
03:30rritochMIT should be compatible with eclipse public license
03:44andyfStill not an intellectual property lawyer, but I wonder whether it is kosher to leave all of the "clojure" occurrences in namespaces. It seems likely that it should not be distributed as a jar with clojure anywhere in the name.
03:46rritochandyf: The clojure namespaces are copyrighted, you can't just rename them and have them magically become yours. The eclipse license allows the code to be used in other applications.
03:47rritochandyf: Some changes will be needed so andylisp.core becomes an automatic namespace but that's about it.
03:48rritochandyf: Though I should add a disclaimer that this version is "Use at your own risk" since this isn't meant to be used for production environments.
03:48andyfI'd recommend not using clojure as any part of a name of a JAR file, or Maven dependency artficact/group id, or whatever those things are called.
03:50rritochandyf: Well that will take time, but I see your point. Clojure should remain a dependency, and this should truly extend it.
03:52rritochandyf: But that may make integrating these proof of concept projects into clojure.core more difficult in the long run.
03:52rritochandyf: As I said, I have no intention of replacing clojure. This is for proof of concept projects.
03:53rritochandyf: To prove that new features are viable, efficient, and maintainable.
03:53TEttingersounds good, rritoch.
03:53TEttingersorta a bleeding edge testbed
03:54rritochTEttinger: Exactly :)
03:55TEttingerflowjure might also be a good name
03:55TEttingersince the idea is for it to be upstream
03:55rritochTEttinger: Heh, the ruling was that I'm not allowed to change the name, so this is what I'm stuck with.
03:55andyfI don't have answers to all the questions, but for example, if someone wants to use it in, say, a Leiningen project, they will have to put a dependency in that is something different than [org.clojure/clojure "1.7.0"]
03:56rritochI really like the name, because the first question everyone asks about it, is why it should be used compared to others.
03:56TEttingerwill it even look on clojars?
04:02rritochTEttinger: Yes, this isn't a new language. It is still clojure. As of now I haven't even verified that this fork is viable. The only hosting company I know of that would finance this is unreliable so for now it doesn't have it's own repository.
04:02TEttingerfinance?
04:02TEttingeris github not an option?
04:03rritochIt is on github, but github doesn't provide a maven repository, does it?
04:03TEttingerahhhh
04:03TEttingermaven repo, gotcha
04:15rritochandyf: this version of clojure is compiled using leiningen
04:15rritochandyf: So you can simply use :excludes to change the clojure version
04:15rritochandyf: eventually
04:17rritochandyf: I just need to create a runtime in the org.andylisp namespace, with it's own main entrypoint, to make this possible. And then I can remove all clojure sources from it.
04:19rritochandyf: clojure uses a lot of finals so this will probably need to wrap the clojure runtime.
04:20rritochandyf: As I said, no proof that this is viable yet
04:21rritochandyf: But if it speeds up the development of clojure, than it could be useful.
04:21rhg135Clojure withdrawal: it's a thing
04:46SagiCZ1rhg135: it is
04:52rhg135SagiCZ1: that just means it's good stuff
04:57bitcrusherhmm got a firefox path error when using clj-webdriver, anyone know how to solve it?
05:13dysfunis this a bit naughty? https://github.com/korma/Korma/blob/master/src/korma/core.clj#L521 will clojure just ignore the type hint?
05:16bitcrusherman i hate those auto play videos that hide on the side
05:17dysfunflashblock?
05:21SagiCZ1dysfun: well design websites?
05:23rhg135dysfun: clojure uses: tag for hints
05:24m1dnight1guys, is there an idiomatic way to "wait" on an atom?
05:25m1dnight1I want to write a function that when it is called it blocks. each time the atom changes (i.e., some sort of watcher) I want to do some check, and if not okay, wait for the next change
05:25m1dnight1any ideas?
05:25rhg135m1dnight1: don't use atoms is my idea
05:25m1dnight1.. :p
05:26rhg135Sounds like manifold can do this
05:28rhg135I'm sorry I read promise
05:29rhg135add-watch
05:29m1dnight_yeah, the addwatch, but I want to surround it with a blocking operation
05:29m1dnight_i'm not sure how to go about it
05:30m1dnight_I would add an add-watch (fn [] (if-something-true just fall through)) otherwise wait on the next change of the atom
05:30rhg135Any particular reason?
05:30m1dnight_Yes, I'm implementing STM/actors for my thesis
05:30rhg135Ah
05:31m1dnight_and an actor that has been invoked from an actor within a transaction has to monitor that trasnaction
05:31m1dnight_(to make sure he does not commit before his parent does)
05:31rhg135AFAIK watches are run sync
05:32rhg135$grimoire add-watch
05:33justin_smith(inc ghadishayban) ; Testosterone Driven Development, lol
05:33lazybot⇒ 3
05:33rhg135$grim add-watch
05:33rhg135Meh
05:34justin_smith$grim clojure.core/add-watch
05:34lazybothttp://grimoire.arrdem.com/1.6.0/clojure.core/add-watch
05:34rhg135thx
05:34justin_smithit would be nice if that plugin automatically tried clojure.core
05:34rhg135m1dnight_: ^
05:37rhg135Im in no hurry to try S(leep) D(eprivation) D(riven) D(evelopment) so gn *
05:37m1dnight_cool, i'll check it out
05:37m1dnight_thanks guys
05:51dysfunrhg135: ah, so :type is actually just an arbitrary metadata key?
05:52justin_smith,(type (with-meta {:a 0} {:type "foo"}))
05:52clojurebot"foo"
05:52dysfunthat was my next question :)
05:52justin_smith,(type {:a 0})
05:52clojurebotclojure.lang.PersistentArrayMap
05:54dysfunso presumably it's to allow you to fake the type without changing the type hint?
05:54justin_smithit's for hacks related to things that dispatch on type
05:54dysfun*nod*
05:54justin_smithcomes up with multimethods
05:55dysfunaha
05:55dysfunty
06:59whodidthispeoples, if i have an om component how do i listen for keyboard events in it
07:04whodidthiswell, i guess addeventlistener but problem is i only want to listen to dem events while using the component
07:16mikosanyone know how to parse arrays in POST data? such as {"user[name]" "John Doe"}, i'm using compojure
07:16mikosis there a way to parse that data so there's a nested 'user' map in the params?
07:17trisshey all. is there anything special needs to be done when adding dependencies to a chestnut project?
07:18trissI'm trying to use hum (https://github.com/mathias/hum) in a project
07:18trissI've added in to project.clj and am requiring it in one of my libraries
07:19trissbut im told Uncaught Error: Undefined nameToPath for hum.core
07:19trisswhen I connect to set up with a browser
07:27whodidthiswhoops wrong channel
07:34mikosah, looks like i may need wrap-nested-params =)
07:35trissoh a lein clean fixed everything!
07:39trissok.... I'm about to extend hum from https://github.com/mathias/hum. Would anyone care to comment on how idiomatic this library looks?
07:39trissis there anything that sticks out as not clojure like?
08:03bitcrusherhow do i update my libraries, i am using lein ancient but it is still using the older selenium drivers 2_39, I want to use 2_42
09:18stephenmac7Is clojure statically typed?
09:19dnolen_stephenmac7: it is a dynamically typed language, however core.typed allows you to write typed Clojure
09:19stephenmac7dnolen_: Is it a compiler plugin or something of the sort, or is it just a library?
09:19dnolen_stephenmac7: just a library
09:20stephenmac7Hm. I'll take a look.
09:20stephenmac7I come from a background of discovering the greatness of static typing late
09:20stephenmac7dnolen_: It causes runtime errors or compilation errors?
09:21dnolen_stephenmac7: static typing means compilation errors
09:22stephenmac7dnolen_: Just making sure. Other similar libraries I've used cause runtime errors, which doesn't really qualify
09:22stephenmac7Thank you
09:53ajmccluskeyIs there a clear preference between defining private helper fns at the top level and defining them in let bindings of the function that uses them? Assuming only one top level fn uses them.
10:08gigasquidHi seancorfield!
10:20apricityi'm using a cider nREPL in emacs and I evaluated a form using C-x C-e. I know the evaluation is taking a while because my laptop fans kicked in highspeed. Other than the fans running how can I know if the form is still evaluating?
10:22dnolen_apricity: you can't evaluate anything else
10:22apricityif i try to eval something else will it queue it up to be evaled next?
10:22dnolen_apricity: once evaluated you should see the result immediately - you probably evaluated an infinite sequence - it will never return
10:23dnolen_apricity: it should normally far as I know
10:23apricityit's not an infinite loop; I just kept increasing the input size slowly to try and get a feel for the asymptotic time complexity
10:25apricityi am just new to clojure and emacs and was wondering how to tell if it's still running, how to tell it to stop, and if there is any debuggin features like breakpoints that i could use
10:30apricityI found that C-c C-b interupts any pending evaluations
10:39stephenmac7Okay, so I'm trying to solve a problem on 4clojure but it says:
10:39stephenmac7"You tripped the alarm! nth is bad!"
10:39stephenmac7Any idea how to fix that?
10:40SagiCZ1stephenmac7: dont use nth in your solution
10:40stephenmac7SagiCZ1: My solution is:
10:40stephenmac7(fn disgusting-name-because-4clojure-has-issues [[x & xs] cnt] (if (= cnt 0) x (disgusting-name-because-4clojure-has-issues xs (- cnt 1))))
10:41SagiCZ1ok i dont see any nth in there
10:41stephenmac7(Originally it was called my-nth
10:41stephenmac7)
10:41SagiCZ1you dont need to name the function in 4clojure btw.. (fn [args] ... ) is fine
10:41stephenmac7SagiCZ1: Yes, but then I can't call myself
10:42stephenmac7Unless I do something stupid like use the y-combinator
10:42dnolen_stephenmac7: destructuring vector syntax macroexpands into calls to nth
10:42SagiCZ1i think you can do that using recur
10:42dnolen_stephenmac7: recur
10:42stephenmac7What is this recur?
10:42stephenmac7(Sorry, I'm new to clojure, not fp)
10:42SagiCZ1you can use it instead of the function name
10:43dnolen_stephenmac7: self recursion
10:43SagiCZ1if you want to use recursion.. which you do here
10:43stephenmac7Oh, got it
10:43dnolen_stephenmac7: w/o consuming stack
10:43SagiCZ1but note, that if recur is in a 'loop' block, it will recur to the begining of the 'loop'.. not to the function
10:43stephenmac7So, is that better than using the real name?
10:43stephenmac7Unless I'm in a loop?
10:44SagiCZ1stephenmac7: it may be less readible but uses no memory, so you can recur any number of times without stack explosion
10:44stephenmac7dnolen_: So, how would I go about getting the head without using destructuring?
10:44SagiCZ1stephenmac7: use (first..)
10:44SagiCZ1,(first [42 5 6 3])
10:44stephenmac7Ah, it's called first not head
10:44clojurebot42
10:44stephenmac7Why can't they just check the code instead of the expansion?
10:45SagiCZ1stephenmac7: they dont check the code at all.. they just subsitute your function for the ___ and run the code
10:45stephenmac7If they don't check, how would they know it expands to nth?
10:45stephenmac7Do they just check if nth itself is called?
10:45SagiCZ1i guess they expand it first and then check the blacklisted symbols
10:46stephenmac7Hm.
10:46stephenmac7How would I get the tail?
10:46SagiCZ1stephenmac7: last
10:47SagiCZ1,(last [1 2 3 42])
10:47clojurebot42
10:47stephenmac7That's the last element, not the tail
10:47SagiCZ1,(next [1 2 3 42])
10:47clojurebot(2 3 42)
10:47SagiCZ1,(rest [1 2 3 42])
10:47stephenmac7,(let [[x & xs] [1 2 3 42]]) xs)
10:47clojurebotnil
10:47clojurebot(2 3 42)
10:47stephenmac7So, next and rest
10:47SagiCZ1yes, they are the same but differ in their behavior when the collection is empty
10:47SagiCZ1,(rest [])
10:47clojurebot()
10:48SagiCZ1,(next [])
10:48clojurebotnil
10:48stephenmac7So (fn [xs cnt] (if (= cnt 0) (first xs) (recur (next xs) (- cnt 1))))
10:48stephenmac7I see
10:48stephenmac7Rest looks nicer though
10:48stephenmac7Actually, nevermind
10:48stephenmac7,(rest [1])
10:48clojurebot()
10:48stephenmac7,(rest [])
10:48clojurebot()
10:48stephenmac7^ I don't like that
10:49SagiCZ1yeah so maybe you would like next
10:49stephenmac7,(next [1])
10:49clojurebotnil
10:49stephenmac7,
10:49clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:49stephenmac7,(next [])
10:49clojurebotnil
10:49stephenmac7Just as bad
10:49stephenmac7Why can't next give me an empty list for [1]?
10:50stephenmac7If [1] is somewhat like (cons 1 '()) or whatever cons is in cljoure
10:50stephenmac7*clojure
10:50SagiCZ1i dont think clojure vectors are the same as lisp's lists
10:51stephenmac7Fine
10:51stephenmac7,(next '(1))
10:51clojurebotnil
10:51stephenmac7I think those are like lisp's lists
10:51SagiCZ1i guess
10:52stephenmac7Well, guess I'll just have to deal
10:55dnolen_stephenmac7: vectors are not like lists, random access
10:55dnolen_[] is not an empty list, it's an empty vectro
10:55dnolen_() is an empty list
11:29justin_smithstephenmac7: () is an empty list, linked list like in common lisp or scheme. [] is a vector, which has efficient random access and efficient append, and is implemented as a tree
11:35zandNoob question for you all: is it possible to return multiple vales NOT in a collection?
11:35justin_smithno
11:35SagiCZ1zand: no
11:35zandah ok
11:35SagiCZ1zand: clojure returns always just one value
11:36zandso if I want to pass args (to apply for example) how would you do that?
11:36justin_smithwith a collection. A collection is just one value.
11:36zande.g I want to be able to do (apply [+ '(1 2 3)])
11:36AimHere,(apply + 1 2 3)
11:36SagiCZ1,(apply + '(1 2 3))
11:36clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
11:36clojurebot6
11:37mmgJustin_smith
11:37mmghttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentList.java#L100
11:37mmglooks like a linked list
11:38justin_smithmmg: that's what I said
11:38SagiCZ1mmg: which is what lisp list is
11:38justin_smith,(type [])
11:38clojurebotclojure.lang.PersistentVector
11:38justin_smith,(type (list 1 2 3))
11:38clojurebotclojure.lang.PersistentList
11:38mmgoh whoops, misread your reply thought it was a question >.>
11:57stephenmac7justin_smith: Thanks for the info
11:58stephenmac7But why on earth can [] hold values of different types?
11:58SagiCZ1clojure is dynamic languag
11:59SagiCZ1it has no type checking before runtime
12:00justin_smithSagiCZ1: that's not strictly true. Some things are checked. but vectors are only defined to hold Object.
12:00justin_smithfor example (nil x) is caught at compile time
12:00justin_smith&(if true 'x (nil 'x))
12:00lazybotjava.lang.IllegalArgumentException: Can't call nil
12:01justin_smithclearly a compile time error, see?
12:01SagiCZ1ok.. so IFn is checked
12:01justin_smithnot quite
12:01justin_smith&(if true 'x ("hello" 'x))
12:01lazybot⇒ x
12:01justin_smithno compile time check for IFn, just for calling nil
12:02justin_smith,(into-array String ["hello" "world"]) ; other things are checked too
12:02clojurebot#<String[] [Ljava.lang.String;@5b20be>
12:02justin_smith,(into-array String ["hello"
12:02clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
12:02justin_smith,(into-array String ["hello" 42])
12:02clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: array element type mismatch>
12:03justin_smithwait, never mind, that is not a compile time check, it's a run time check
12:30leandrohi. i want to read a map which key is a (read-line). how to do that? (get mymap :(read-line)) :(
12:31justin_smithleandro: what do you think : does?
12:31SagiCZ1the key is the function read-line?
12:33leandroi want to give the key via read-line
12:33justin_smithleandro: :foo is read by the clojure reader as "the keyword foo" - this can be convenient for maps, but you don't need keywords
12:33justin_smith,(get {"hello
12:33lxsameerhey guys, my lein freeze without any output , how can I debug this
12:33clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
12:33justin_smitherr
12:33justin_smith,(get {"hello" 1} "hello")
12:33clojurebot1
12:33justin_smithslippy fingers today
12:34leandrohmm ok
12:35justin_smith&(get {"hello" 1} (binding [*in* (java.io.BufferedReader. (java.io.StringReader. "hello\n"))] (read-line)))
12:35lazybotjava.lang.SecurityException: You tripped the alarm! push-thread-bindings is bad!
12:35justin_smithblurg
12:35justin_smithanyway, that also returns 1
12:36justin_smithlxsameer: you can use jstack, which comes with the jdk, to see what the jvm is doing
12:36justin_smithlxsameer: or jvisualvm, if you want a full on visual tool that also includes that info
12:37lxsameerjustin_smith: cool, thanks
12:37leandrojustin_smith: with a string instead of a keyword works fine, but i'm still curious about how interpolate a value for a keyword
12:38justin_smith,(get {:hello 1} (keyword "hello"))
12:38clojurebot1
12:38justin_smithbut really you don't need keywords as often as many clojure programmers think you do
12:38justin_smithuse keywords for literals, outside input can stay strings
12:38SagiCZ1,(keyword "string")
12:38clojurebot:string
12:39justin_smith,(name :keyword) :P
12:39clojurebot"keyword"
12:39leandroamazing, thanks
12:40justin_smithname / keyword / symbol are universal converters between any two of those types
12:40justin_smithwell actually not quite ##(symbol (name :key))
12:40lazybot⇒ key
12:40justin_smithyou need name in the middle sometimes
13:00stephenmac7Is there a foldl for clojure?
13:03justin_smithit's easy to write one for vectors, but no
13:04stephenmac7justin_smith: Okay, thanks. Also is there something like conj but with flipped args?
13:04justin_smithcons for lists, but nothing for vectors
13:04stephenmac7Finally, a real lisp function in clojure
13:04stephenmac7cons actually exists
13:05stephenmac7,(cons 1 '(2 3 4))
13:05clojurebot(1 2 3 4)
13:05justin_smithexpecting clojure to be just like lisp will make you miss most of the best things about clojure
13:05justin_smithI was a common lisp user before I came to clojure myself
13:06stephenmac7justin_smith: Actually, the only experience I have with lisp is reading the little schemer and the beginning of the land of lisp
13:06stephenmac7I'm a Haskell user myself, but decided it would be nice to know a JVM language
13:06justin_smithstephenmac7: my vector-specific foldl https://www.refheap.com/94848
13:06stephenmac7So, adding to the front of a list feels natural
13:07justin_smith,(conj '(1 2 3) 0)
13:07clojurebot(0 1 2 3)
13:07justin_smithconj adds wherever adding would be most efficient
13:07justin_smithmost efficient is specific to the data structure
13:07stephenmac7,(conj [1 2 3] 4)
13:07clojurebot[1 2 3 4]
13:07justin_smithright
13:07stephenmac7That's weird
13:07justin_smithno, it's efficient
13:08stephenmac7Why not just have two functions?
13:08justin_smithlike most things in clojure, conj is not specific to a datatype or class, it is aimed at an interface
13:08justin_smiththe interface being that for persistent collections
13:08justin_smith,(conj {:a 0} [:b 1])
13:08clojurebot{:b 1, :a 0}
13:09justin_smith,(conj {1 2 3 4 5} 6 7)
13:09clojurebot#<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms>
13:09justin_smithoops
13:09justin_smith,(conj #{1 2 3 4 5} 6 7)
13:09clojurebot#{7 1 4 6 3 ...}
13:09justin_smith,(conj () :a :b :c)
13:09clojurebot(:c :b :a)
13:10ctfordPersonally, I think it would be nice if conj was paired with an unconj - it's not much of a contract if you have to be aware of the concrete type whenever you use it.
13:10stephenmac7Hm. Haven't worked with a language with polymorphic functions for a while, except when it replated to typeclasses.
13:10stephenmac7Feels weird
13:10stephenmac7*relates
13:11justin_smithctford: you only have to be aware if you care about where insertions happen. And if you care about where you are inserting, you should be conscious of your collection type whether you use conj or not.
13:12ctfordjustin_smith, you always care about where the insertion happens sooner or later, don't you? Otherwise, conj could be noop and you wouldn't notice.
13:12justin_smithctford: the thing conj always does is ensure the result contains the argument added to the collection provided
13:12ctfordthe only way you could not have to care is if there were a read function on the interface, and a contract on how they interact.
13:13justin_smiththat's a contract
13:13ctfordjustin_smith, true.
13:13stephenmac7So, if I wanted to reverse a list or array, it would probably not be the best idea to use conj without checking the type
13:13justin_smithchecking or forcing it yeah
13:13ctfordjustin_smith: I guess I rarely get by with simply knowing the entry is somewhere in the collection. :-)
13:14justin_smithstephenmac7: vec and seq and set are your friends
13:14justin_smith,(seq [1 2 3])
13:14clojurebot(1 2 3)
13:14justin_smith,(set [1 2 3])
13:14clojurebot#{1 3 2}
13:14justin_smith,(vec [1 2 3])
13:14clojurebot[1 2 3]
13:14stephenmac7What if I'm trying to preserve the type?
13:15ctfordjustin_smith: I guess you could say that seq shares a contract with conj - if you conj it in, it will be somewhere in the resulting seq.
13:15justin_smith,(map (fn [x] (into (empty x) (conj (seq x) :a))) [[:b :c :d] '(:b :c :d) #{:b :c :d}])
13:15clojurebot([:a :b :c :d] (:d :c :b :a) #{:c :b :d :a})
13:16stephenmac7So, (= (reverse [1 2 3]) [3 2 1]) and (= (reverse '(1 2 3)) '(3 2 1))
13:16stephenmac7,(reverse [1 2 3])
13:16clojurebot(3 2 1)
13:16justin_smithstephenmac7: probably best to start with seq
13:16stephenmac7,(vec (reverse [1 2 3]))
13:16clojurebot[3 2 1]
13:16justin_smithseq is cheap on every input type
13:17justin_smiththen you can use into
13:17justin_smithinto / empty to preserve type
13:17stephenmac7,(doc into)
13:17clojurebot"([to from] [to xform from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined. A transducer may be supplied."
13:19m1dnight_Does anyone know any better way to do: map a function over a sequence, if i find a particular element, replace it, if not, add something in the end of sequence
13:19m1dnight_what I'll do now is iterate to check if the particular element is there and then do a map in the consequent branch and an insert in the alternative
13:19stephenmac7Hm. justin_smith: Seems I don't need to preserve type
13:19jeff___Have any of you guys that work at java shops been able to convince management to let you use clojure on the job?
13:19stephenmac7= doesn't seem to check types
13:19m1dnight_jeff___: I believe gfredericks did so
13:20justin_smithstephenmac7: no, it does not ##(= [1 2 3] '(1 2 3))
13:20lazybot⇒ true
13:20stephenmac7In that case, I can just use seq
13:20Farehi
13:21Faredoes a type hint ^T say that nil is accepted as part of T, or excluded?
13:21jeff___gfredericks: are you around?
13:21Fareis there a way to distinguish nullable and not-nullable?
13:21stephenmac7Don't even need seq
13:21justin_smithFare: all classes are nullable on the jvm
13:21stephenmac7,((partial reduce conj '()) [1 2 3])
13:21clojurebot(3 2 1)
13:22stephenmac7,((partial reduce conj '()) {1 2 3})
13:22clojurebot#<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms>
13:22stephenmac7,((partial reduce conj '()) #{1 2 3})
13:22clojurebot(2 3 1)
13:22justin_smith,(#(into () %) [1 2 3])
13:22clojurebot(3 2 1)
13:22stephenmac7,(seq #{1 2 3})
13:22clojurebot(1 3 2)
13:22justin_smithstephenmac7: ##(= '() ())
13:22lazybot⇒ true
13:23stephenmac7Why doesn't it have to be quoted?
13:23justin_smithit's unambiguous - it couldn't be a function call
13:23Fareso it's OK to declare ^String x and bind x to nil.
13:23stephenmac7But we can't do
13:24stephenmac7,(= (hotdogs) '(hotdogs))
13:24clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hotdogs in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:24stephenmac7,(= (:hotdogs) '(:hotdogs))
13:24clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :hotdogs>
13:24stephenmac7Got it
13:24justin_smithstephenmac7: it's special cased for the empty list
13:24stephenmac7,((partial into ()) [1 2 3])
13:24clojurebot(3 2 1)
13:25justin_smithif you know how many args you are getting, partial is wasteful
13:25stephenmac7What do you mean?
13:25justin_smithit creates a varargs function, and puts the args into a list
13:25stephenmac7Oh.
13:25justin_smithyou don't need to do any of that if you know how many args you are getting
13:26justin_smithalso #(foo %) is more concise than (partial foo)
13:26stephenmac7,((fn [xs] (into () xs)) [1 2 3])
13:26clojurebot(3 2 1)
13:26justin_smithyou don't like #() syntax?
13:26stephenmac7What's this #()?
13:26justin_smith,'#(+ % %)
13:26clojurebot(fn* [p1__51#] (+ p1__51# p1__51#))
13:26justin_smithit's a reader shorthand for anonymous functions
13:27stephenmac7Nice
13:27stephenmac7I don't like the % sign though
13:27stephenmac7Is there an alternative?
13:27justin_smithno
13:28stephenmac7Hm.
13:28stephenmac7,(#(into () %) [1 2 3])
13:28clojurebot(3 2 1)
13:28stephenmac7Interesting
13:29justin_smith(fn [x] (into () x)) is the same thing, just more verbose, so I guess that is an alternative of sorts
13:29stephenmac7No, this is a little better still
13:29stephenmac7at least for code golf, if anything :)
13:29justin_smithit took me a long time to accept #(), precisely because # and % are so clumsy to read
13:30stephenmac7Then again...
13:30stephenmac7,(into () [1 2 3])
13:30clojurebot(3 2 1)
13:30stephenmac7Guess I didn't really have to make a function at all
13:31justin_smitheven better, if you can get away with it
13:31stephenmac7It's just 4clojure
13:31stephenmac7TBH, I don't like the way they do this. It would be nice if you had to write an actual function
13:32stephenmac7that isn't in the scope of the actual problem
13:32justin_smithI use an fn for every answer on there myself
13:34stephenmac7I'm kind of liking clojure, but this lack of types makes me feel insecure :P
13:35justin_smithstephenmac7: I like prismatic/schema for type data structure declarations that are strictly opt in, and runtime checks that I can turn on if I choose. But it's not the same as static checks, of course.
13:36stephenmac7I looked that up and saw something called clojurescript
13:36stephenmac7What is that?
13:37justin_smithit is clojure, compiled to javascript
13:37stephenmac7Interesting.
13:37justin_smithlargely but not completely compatible with jvm clojure
13:37justin_smithyou still need jvm clojure to compile clojurescript
13:38justin_smiththere is also clojureclr for the .net runtime, which does not need the jvm clojure to compile
13:39stephenmac7Hm. Haven't really looked into these things)
13:39stephenmac7*.
13:39stephenmac7The parenthesis are taking over my keyboard
13:39justin_smithin fact targetting clr is almost as old as targetting the jvm
13:40stephenmac7(write '(might as well) '(in lispy style))
13:40stephenmac7justin_smith: Anyway, thanks for your help and time
13:41justin_smithnp
13:41stephenmac7Obviously, I'm missing a bit of info about clojure
13:41stephenmac7Leraning the language, not the background or ecosystem, probably isn't the best
13:41justin_smithstephenmac7: did you see this recent post? http://getprismatic.com/story/1418367480649?share=MTg0Mjc4.MTQxODM2NzQ4MDY0OQ.Z5zi6GfaVZ8NuO8Ma-09w0f6USI
13:42justin_smithsome great resources there (some of which you already know)
13:42stephenmac7Yes, I'm reading "Clojure for the Brave and True"
13:42stephenmac7But the rest looks interesting
13:43stephenmac7Never had a list like that for Haskell, it was "read LYAH then read haddock"
13:43justin_smithbitemyapp has a good set of intro resources. He used to hang out here until he decided he hated clojure.
13:44justin_smith~haskell
13:44clojurebothaskell is pharaonic mass slave labour
13:44justin_smith?wat
13:44justin_smith~haskell
13:44clojurebothaskell is pharaonic mass slave labour
13:44justin_smiththere was an old factoid "you can only talk about haskell after 9 pm PST" or something like that, specifically targetted at bitemyapp when he hung out here
13:45stephenmac7pharonic mass slave labor?
13:45stephenmac7~ruby
13:45clojurebotChunky bacon!
13:45awkorama~ada
13:45stephenmac7Interesting
13:45clojurebotIt's greek to me.
13:45stephenmac7~clojure
13:45clojurebotclojure is music
13:45stephenmac7Ofc
13:45stephenmac7~assembly
13:45clojurebotCool story bro.
13:45arrdemo/
13:45stephenmac7~fun-with-the-bot
13:45clojurebotGabh mo leithscéal?
13:46chef__~scheme
13:46clojurebotscheme is Scheme is like a ball of snow. You can add any amount of snow to it and it still looks like snow. Moreover, snow is cleaner than mud.
13:46stephenmac7~clisp
13:46clojurebotI don't understand.
13:46stephenmac7Doesn't like that
13:46stephenmac7~python
13:46stephenmac7Really doesn't like that
13:46stephenmac7Anyway, thanks
13:47justin_smithit does rate limiting
13:48stephenmac7Hm.
13:48stephenmac7~python
13:48stephenmac7Still too much for it
14:05m1dnight_Okay, i'm having the (list?) issue when it's a Cons
14:05m1dnight_is there a higher level check I can use?
14:06m1dnight_Or do I have to find out where I cons'd instead of conj'd?
14:06justin_smithm1dnight_: list? is never what you want
14:06m1dnight_:(
14:06m1dnight_i'm sorry sensei, but what do I do then?
14:06justin_smith,(list? (list 1 2 3))
14:06clojurebottrue
14:06m1dnight_,(list? (cons 1 (cons 1 nil)))
14:06clojurebotfalse
14:06m1dnight_it's of type Cons
14:06justin_smith,(seq? (cons 1 (cons 2 nil)))
14:06clojurebottrue
14:07m1dnight_ooooh :)
14:07m1dnight_that's what I needed
14:07justin_smith,(seq? [1 2 3])
14:07clojurebotfalse
14:07m1dnight_thanks a bunch justin smith
14:07justin_smithnp
14:07m1dnight_(inc justin_smith)
14:07lazybot⇒ 159
14:08justin_smith(identity rritoch)
14:08lazybotrritoch has karma 1.
14:08m1dnight_(identity m1dnight_)
14:08lazybotm1dnight_ has karma 1.
14:08m1dnight_what, I have one?
14:09m1dnight_cool \o/
14:09arrdemjustin_smith: WE DO NOT SPEAK ITS NAME
14:09justin_smith(identity m1dnight)
14:09lazybotm1dnight has karma 1.
14:09justin_smith(identity identity)
14:09lazybotidentity has karma 0.
14:30munderwoHey all. How have people best dealt with callback hell in javascript interop. I’ve seen some people use core.async but im having issues getting that work and nice and clean.
14:31munderwoI have a javascript lib that requires three levels of callbacks to get what I want. which is ya know a little frustrating.
14:31SagiCZ1channels should help you though
14:31SagiCZ1they were designed to make callbacks more straightforward
14:32justin_smithmunderwo: even if you must provide a callback, the callback can just be a function that puts a value on a channel, the logic can all be in a go block if you do it right
14:32munderwothats what I thought. So I guess one way is to pass c channel all the way to the bottom?
14:33munderwoand the last function puts a value on it? Then in a go block I just do a <! to get that value off and continue?
14:34justin_smithright, you could even do a series of <! calls in the go block, for the various stages of nested callback
14:35SagiCZ1on other note, could someone explain to me the naming convenctions for core.async? if is in clojure.core why do i have to manually require it? so its not in the core? is it 3rd party?
14:35justin_smithSagiCZ1: core.* means blessed by rhickey
14:35munderwoyeah, I got the first way working. and Im just trying to get the second to work, by having each seperate function return a channel in one big let block.
14:35justin_smithcore.typed, core.match, core.async
14:35SagiCZ1blessed but not actually part of the core
14:35justin_smithright
14:35SagiCZ1thanks for clarification
14:36justin_smithorg.clojure/core.*
14:37munderwothis is what I have at the moment for version 2.
14:37munderwohttps://www.refheap.com/94852
14:37munderwoBut I seem to be getting a channel from it rather than the file blob that I want.
14:38munderwoIm wondering if in all the functions I should just be returning the chan instead of doing the (go (<! c))
14:38justin_smithI think that would simplify things - only need the (go (<! c)) for test
14:38justin_smiththe rest can just pass chans
14:43munderworight.
14:44munderwoI think I might be starting to understand core.async in clojurescript. Its actually quite different to the clojure version
14:45munderwowhat I ended up with
14:45munderwohttps://www.refheap.com/94853
14:45munderwoIt would be nice to be able to remove the <! from the test function… buuutt I dont think thats gonna happen
14:46munderwoIt is one of the interesting things about using core.async in clojurescript, It kinda infects the codebase.
14:48justin_smithit does that in general (but more so in cljs)
14:48justin_smithwhich is part of why there are ztellman/manifold and prismatic/graph which do similar things in different ways (and infect codebases less)
14:48justin_smithztellman's talk at the last conj is a nice comparison between the three
14:51brucehaumanman I am having a heck of a time with clojure namespace resolution in a leinigen plugin
14:56brucehaumanfigured it out :)
15:30lxsameerhey guys, My lein freeze with no output. I get the traceback by jstack and here it is http://dpaste.com/0360P3M what's the problem how can i fix it ?
15:45gfrederickslxsameer: looks like it's waiting on some sort of maven io thing
15:46gfredericksnot sure about the how to fix it part
15:46lxsameergfredericks: hmmm, very weird
15:52martinklepschIs there some time I should expect clojars to need until it can verify my pgp key via a keyserver?
15:59arrdemIf you've pushed to MIT or any of the usual PGP keyservers it should be pretty much instintaneous.
16:11martinklepschso what other reasons can there be for 401, ReasonPhrase:Unauthorized when deploying to clojars?
16:12martinklepschI think I got the gpgthing right, checked my ssh public key on clojars and if I have the private key in ~/.ssh
16:12arrdemare you trying to upload over https?
16:13arrdembecause IIRC that's off right now
16:18martinklepscharrdem: that could be the reason
16:24martinklepscharrdem: over https I got the error above, http gives me 405, ReasonPhrase:Not Allowed
16:25arrdemmartinklepsch: yeah I think that's expected. try uploading over ssh
17:05stbghey there I am wondering if someone can provide some light into a NullPointer exception I am having
17:08andyfstbg: If you put some details in a paste and explain some context of how it occurs, and perhaps a stack trace, someone might be able to help.
17:08arrdem~anyone applies but I can't activate it because reasons
17:10stbg@andyf yap I have it right here http://pastebin.com/JyJ73NaY
17:11stbgThe code actually does what it needs to but I think when the recursion unwinds a null pointer exception gets thrown out of n owhere
17:11andyfWhich is line 53 in your source?
17:12stbg(insert-triad (assoc-in triad (conj letters letter) {}) (conj letters letter) (inc pos) word)
17:12stbgor 14 in the pastebin
17:13dagda1what do tansducers give us that are not already possible with functional composition or the threading macro?
17:16stbgandyf: line 8 in the pastebin should actually be uncommented
17:17SagiCZ1dagda1: from my understanding, they are one more level of abstraction
17:17SagiCZ1you could ask what clojure gives us that is not already possible with language x
17:17SagiCZ1probably nothing
17:18dagda1SagiCZ1: I'm just trying to find out why they came about or what problem they solve
17:18SagiCZ1dagda1: they abstract data transformations
17:19dagda1SagiCZ1: a trasform being a functional composition
17:20tbaldridgedagda1: if you go and write map or filter from scratch, only using cons, you'll notice that inside map is a call to cons. Transducers abstract away cons (or actually conj) so that the creation of the resulting datastructure is decoupled from the map/filter logic
17:21dagda1tbaldridge: so I could replace conj with some other function?
17:21tbaldridgeright, like conj! or put! into a core.async buffer, or something else
17:22tbaldridgebut it's all abstracted, so you can create a transform once, and use it with multiple creation functions (known as reducing functions).
17:22tbaldridgeexamples of reducing functions are conj, conj!, +, etc.
17:23sveriHi, is there some documentation for luminus on how to respond with bytecode for a route?
17:24dagda1tbaldridge: do you know why xform is often used as an argument name in the transducer examples?
17:25andyfstbg: You have an extra set of parentheses around the arguments of the "do". Thus the return value of the recursive call is attempted to be invoked as a function.
17:26andyfAnd that pastebin site you used makes my browser CPU spike. Maybe ads.
17:27stbgandyf: Thanks I see it, that's what I get for working late at night, sorry about pastebin, which one do you use?
17:27andyfgist.github.com, but there are a bunch of them. The CPU spike isn't the end of the world -- just kinda weird.
17:28tbaldridgedagda1: xform is a transducer (aka a transform), when you're ready to use a xform transduce will call (xform rf) to create the final reducing function
17:28tbaldridgedagda1: have you watched Rich Hickey's strangeloop talk?
17:28tbaldridgeHe goes over this sort of stuff
17:28dagda1tbaldridge: I have not, I must do this. Thanks
18:06oskarth,(remove (or #(= % 'a) #(= % 'b)) ['a 'b 'c])
18:06clojurebot(b c)
18:07oskarthwhat am I missing? how do I compose multiple predicates?
18:07tbaldridge,(doc everyp)
18:07clojurebotCool story bro.
18:07tbaldridgeehh...whats that fn called again...
18:07oskarth,(doc every-pred)
18:07clojurebot"([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical false result against the original predicates."
18:08tbaldridgebut you want or,
18:08Frozenlock,(remove #(or (= % 'a) (= % 'b)) ['a 'b 'c])
18:08clojurebot(c)
18:08Frozenlockyour 'or' returned the first function
18:08oskarthoh
18:09oskarthI see, thanks both :)
18:09andyfoskarth: some-fn is the "or" analog of every-pred
18:10oskarth,(doc some-fn)
18:10clojurebot"([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns the first logical true value returned by one of its composing predicates against any of its arguments, else it returns logical false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical true result against the original predicates."
18:10andyfThe Clojure cheatsheet lists them next to each other: http://jafingerhut.github.io
18:10oskarthah yeah
18:10andyfwhich only helps much if you remember the name of at least one of them :)
18:11oskarthin this case #(or ...) seems like the simplest solution
18:11andyf,(remove '{#a b} '[a b c])
18:11clojurebot#<RuntimeException java.lang.RuntimeException: No reader function for tag a>
18:11andyf,(remove '#{a b} '[a b c])
18:11clojurebot(c)
18:11arrdemif I fork Clojure, first thing imma do is rename some to any?
18:12oskarthoh, that's even nicer
18:12andyfbe careful with nil/false there
18:13andyfbut ok if those are not possibilities.
18:13Frozenlock,(remove '#{a b nil} '[a b c nil])
18:13clojurebot(c nil)
18:13Frozenlocknice gotcha
18:14oskarthhm yeah
18:14andyf,(remove #(contains? '#{a b nil} %) '[a b c nil])
18:14clojurebot(c)
18:15arrdemandyf: (partial contains ..)
18:15andyfsome day I may have partial ingrained in my habits, but not yet
18:15arrdemI mean... partial does exactly the same thing since we don't actually have currying :C
18:16andyf,(remove #(contains? '#{a b nil Double/NaN} '[a b c nil Double/NaN])
18:16clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
18:17andyf,(remove #(contains? '#{a b nil Double/NaN} %) '[a b c nil Double/NaN])
18:17clojurebot(c)
18:17andyfHmm. I thought that would not remove the Double/NaN, since it isn't even equal to itself.
18:19andyf,(remove #(contains? '#{a b nil Double/NaN} %) ['a 'b 'c nil Double/NaN])
18:19clojurebot(c NaN)
18:20mikoshttps://gist.github.com/anonymous/f6f51ca04658cc34174a
18:20mikosis there a better way to do this?
18:20andyfThere. In my first example with Double/NaN, the ' outside the [] quoted it and made it a symbol.
18:20mikosthe ifs in the let feel weird to me :)
18:20andyfanyway, deep dark corner case. Avoid Double/NaN if you can.
18:21Frozenlockmikos: why?
18:21mikosno idea, Frozenlock! just wondering if it's the best way :)
18:22arrdemmikos: the ifs are fine, just throw some newlines in there.
18:22mikosthanks, arrdem!
18:22gfredericksI'm trying to figure out how unicode works on the jvm and feel like I have a theory; does anybody know enough about it to sanity-check?
18:22gfredericksin particular I'm trying to figure out what regexes do
18:23arrdemmikos: if you really want to yack shave
18:24mikosyak shave, that's a new one for me!
18:24mikosi think i know what it means :)
18:24arrdemmikos: (as-> (:label crumb) v (cond-> (:active crumb) [:strong v]))
18:24TEttingergfredericks, maybe I do?
18:25arrdemhttp://www.catb.org/jargon/html/Y/yak-shaving.html
18:25arrdemmikos: for this I'd keep the if, but the cond-> update pattern scales really really nicely to what would otherwise be a shitload of nested ifs doing updates.
18:26arrdemhttps://github.com/arrdem/spitfire/blob/master/src/spitfire/whac.clj#L510
18:26arrdemcase in point
18:26andyfmikos: left a comment of a modified version using :keys that shortens things a bit
18:26mikosthanks arrdem, andyf!
18:27andyfgfredericks: I know a little bit about it, but maybe not enough to check your theory.
18:28gfredericksTEttinger: andyf: okay here I go
18:28gfredericksso normal people use UTF-8 and the jvm uses UTF-16, which puts it at a disadvantage wrt the larger characters
18:28TEttingernon-BMP ones, yeah
18:28gfredericksso it's okay for \uFFFF and under
18:29andyfa disadvantage in that non-BMP are sorta rare, but different encoding lengths are common with UTF-8?
18:29gfredericksdisadvantage only in being incomplete and/or difficult to describe
18:29TEttingeralso java uses UCS-16 I think, not sure the difference
18:30gfrederickseverything over \uFFFF is represented as a pair, with the high half \uD800-\UDBFF and the low half \UDC00-\UDFFF
18:30gfrederickswhich presumably means that a \uD800-\UDBFF character in isolation is some weird degenerate thing
18:31andyfTEttinger: According to UTF-16 wikipedia page, UCS-2 is "everything is 2 bytes long" and thus I think ignores everything not in the BMP, by not being able to encode it.
18:31TEttingererr, UCS-2 yeah
18:31andyfgfredericks: Yes, surrogate pairs in isolation are a sign of a bug somewhere, most likely
18:31andyfor bad data from elsewhere
18:31gfredericks,(re-matches #"." "\ud800")
18:31clojurebot"?"
18:31gfredericks,(re-matches #"." "\ud800\udc00")
18:31clojurebot"𐀀"
18:31gfredericks,(re-matches #"." "\ud800\udb00")
18:31clojurebotnil
18:32gfredericks^ these are some behaviors I have noted
18:32gfredericks,(re-matches #".." "\ud800\udb00")
18:32clojurebot"??"
18:32andyfyour 2nd example is matching the pair of Java chars?
18:32gfredericksit's one unicode char but two java chars
18:32andyfgot it
18:32gfredericksso the regex intelligently recognizes it as one char
18:32andyfand 3rd example is invalid pair?
18:32gfredericksright
18:32gfrederickswhich DOES match as two chars
18:33andyfbut strangely, not as one
18:33gfrederickskinda makes sense to me
18:33gfredericksyou only get "two as one" for valid pairs
18:33andyfin an "I can guess how the implementation might have gone this way, given Java's history"
18:33gfredericksso I'm wondering if this is a decent summary of the edge cases
18:33gfredericksor is there a lot I'm missing somewhere
18:35andyfI don't know enough to say whether you've covered all of the edge cases, but perhaps you have. Generative testing with large fraction of non-BMP chars and invalid surrogate pairs might help verify.
18:36andyfI suspect if someone cares a whole lot about regex matching and large char sets, and avoiding edge cases, they use Perl.
18:36andyfOr a different regex matching library than Java's built-in one.
18:37TEttinger,(char 0x100000000)
18:37clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for char: 4294967296>
18:37andyfe.g. maybe ICU lib is better at saner behavior here: http://site.icu-project.org
18:37andyfbut I haven't tested it to find out
18:38gfredericksokay thanks andyf && TEttinger
18:38andyfThe Unicode property support column on this page may give some clues here: http://en.wikipedia.org/wiki/Comparison_of_regular_expression_engines
18:39TEttingerthis is interesting, andyf and gfredericks http://site.icu-project.org/home/why-use-icu4j
18:40andyfTom Christiansen has thought more about this than I bet anyone, and has worked hard on Perl's regex matching in this area. He has filed bugs with the Java development team in this area, and realizes that some of these things take a long time and a lot of testing to get right.
18:40gfredericksooh interesting
18:42andyfAlso perhaps here: http://userguide.icu-project.org/strings/regexp#TOC-Differences-with-Java-Regular-Expressions
18:43andyfMaybe wait for Java 12?
18:43andyf:)
18:43andyf(i.e. perhaps by then the built-in regex support will support Unicode more completely)
18:44andyfAlthough to be fair, perhaps Java's built-in regex support is reasonable when restricted to strings that don't have unpaired surrogates.
18:48andyfgfredericks: Do you expect to get 'malformed' UTF-16 strings, i.e. having unpaired surrogates, in some application? Or can they be discarded or treated as errors?
18:52gfredericksandyf: I'm generating the strings, so I'm just trying to figure out what's reasonable
18:53andyfI suspect there are all kinds of weird things that can happen, not only with regexes, in many parts of the Java lib, if given strings that have unpaired or wrongly-paired surrogates.
18:54gfredericksspeaking of which it looks like test.check only generates characters up to 255 o_O /cc reiddraper
18:55andyfJust as I expect you'd get errors if you have a file you attempt to decode using UTF-8 but the byte sequence is not a valid UTF-8 byte sequence.
18:57amalloygfredericks: it's fine, though, because nobody's ever had errors caused by two-byte characters
18:58andyfamalloy: More likely, nobody wants to debug them, because the libs get in their way :)
18:59gfredericksso if there existed a gen-unicode-char generator, would it be reasonable for it to generate every 2-byte value except the surrogates, along with every valid pair? (i.e., high+low for everything in the high/low range respectively)
19:00andyfgfredericks: that sounds way more reasonable than allowing it to generate single-Java-char unpaired surrogates.
19:03andyfIt might be nice to have it generate surrogate pairs with a larger probability than a uniform range would lead to, but I guess a uniform range over the whole Unicode code point range would mostly be surrogate pairs.
19:07mi6x3mclojure, is it possible that I get a cyclic depdency with a namespace that is fully empty?
19:11andyfDo you mean you want a "fully empty namespace", but you get a cyclic dependency when you try to create one?
19:12mi6x3mwell it's not supposed to be empty
19:12mi6x3mbut even when it is I get the error
19:12mi6x3mwhen I try to reference it
19:12andyfOr do you mean you get an error message about a cyclic dependency, but it is confusing because one namespace isn't printed?
19:12mi6x3mthe namespaces involved are printed
19:12amalloyif you have two namespaces which both depend on each other, it doesn't matter if any of them are empty
19:12mi6x3mand the one in the middle is empty
19:12amalloyit's still a cycle
19:13mi6x3mamalloy: how could they depend on each other if one is empty?
19:13andyfempty, meaning the namespace exists, but has nothing defined in it, other than an ns form?
19:13mi6x3myes
19:13mi6x3monly (ns viewer.example-src)
19:14mi6x3mit could be a counterclockwise issue
19:16mi6x3mI understand, it's no a dependency in the code
19:16mi6x3mit's a "load" dependency
19:16mi6x3mbut I still see no cycle
19:16andyfI don't see how that could be part of a cycle
19:17andyfbut best to check the other namespaces reported in the cycle to see if they contain one.
19:18mi6x3m[viewer/example]->viewer/example_src->[/viewer/example]->/viewer-core
19:18mi6x3mand example_src is empty
19:22andyfCan you require one of those namespaces without error from a plain lein repl, started from outside CCW?
19:23mi6x3mandyf: let me try that, thanks for the patience
19:37mi6x3mandyf: I found it
19:37mi6x3mand it's a rather bizare error
19:37mi6x3mI have a test namespace with the same name
19:37mi6x3mand it seems to be included ....
19:38mi6x3mleiningen is seemingly confused
19:52alpheusShould this clojurescript let me use a tagged literal #ncms.core/foo? (cljs.reader/register-tag-parser! "ncms.core/foo" identity)
19:52alpheus(keys @cljs.reader/*tag-table*) => (inst uuid queue js ncms.core/foo), and
19:52alpheus(@cljs.reader/*tag-table* "ncms.core/foo") => #<function identity(x) {return x;}
19:53kenrestivois this the most idiomatic way to process a map with nested state to add... more nested state? (into {} (for [[k m] some-map] [k (assoc m {:new-important-info (some-operation m)})]))
19:53alpheusBut the expression #ncms.core/foo 1 is an error
19:53kenrestivoumm, actually assoc not merge. same question tho (into {} (for [[k m] some-map] [k (assoc m :new-important-info (some-operation m))]))
19:54alpheuskenrestivo: maybe update-in is what you're looking for?
19:55kenrestivoupdate in, sure, except i'm trying to perform the operation on several m's in that some-map
19:55kenrestivobut i guess (keys some-map) plus update-in might work too. still seems insufficiently golfy to me tho
20:00kenrestivohmm, reduce-kv plus assoc or update-in maybe.
20:00anneliesThis doesn't make any sense to me: https://gist.github.com/rightfold/2a0f34e717d9c3d31fbf
20:01anneliesOh wait nevermind. :)
20:02anneliesNevermind that, I _am_ confused. :S
20:10anneliesIs it because the compiler constructs a cons cell when expanding '(1 2) to (quote (1 2))?
20:10anneliesor rather, the reader
20:11trissI'm going to be adding quite a lot to a library as I work on a project...
20:12trissat the moment I've got fancy reloading going on with figwheel
20:12trissI added the library as a dependency in project.clj and everything was hunky dory
20:14gfredericksannelies: ##(type ''(1 2))
20:14lazybot⇒ clojure.lang.PersistentList
20:14trissbut because I wanted nice auto-reloading I thought removing it from there and simply adding a link (unixy ln -s to my project would then alow me top use it
20:14gfredericksnevermind I dunno
20:15anneliesgfredericks: I think the reason clojure.lang.Cons appears is because the reader constructs a cons cell when expanding '(1 2) to (quote (1 2)), whereas it doesn't when you spell out quote directly as (quote (1 2)).
20:15gfredericksannelies: the two things aren't the same in any case, since it's dealing with the full form (quote (1 2)) in the second case
20:15trissi.e. reuire it just as i was before.
20:15triss^require
20:15anneliesgfredericks: yah I just noticed :p
20:16anneliescontext: http://stackoverflow.com/questions/27465223/clojure-list-and-macros
20:16gfredericksannelies: but for most purposes a PersistentList is equivalent to a Cons
20:16anneliesYeah, but Cons isn't a subtype of IPersistentList so list? returns false.
20:17gfrederickssure
20:20trissbut now I'm finding none of my clojurescipt will even compile
20:21anneliesYeah, I read the reader source and the reader creates a cons cell when expanding '(1 2) to (quote (1 2)), but spelling out (quote (1 2)) manually doesn't.
20:22anneliesmeh
20:22gfredericksannelies: are you doing something where this makes a difference?
20:23anneliesNo, just wondering why list? returns false when used in a macro that is passed '(1 2) vs (quote (1 2))
20:23trissnever mind... sorted it... sorry for the noise
20:23annelies(defmacro islist [f] (list? f)) , (islist '(1 2)) #_false , (islist (quote (1 2))) #_true
20:24gfredericksannelies: list? isn't an appropriate test for macro usage like that; I think seq? is best
20:25anneliesok
20:25anneliesthanks
20:25gfredericksnp
20:30gfredericksomg I give up regexes
20:30gfredericks,(def ascii (apply str (map char (range 128))))
20:30clojurebot#'sandbox/ascii
20:30gfredericks,(re-seq #"[x&&]" ascii)
20:30clojurebot("x")
20:31gfredericks,(re-seq #"[a-c&&]" ascii)
20:31clojurebot("a" "b" "c")
20:31gfredericks,(re-seq #"[a-cx&&]" ascii)
20:31clojurebot("x")
20:31gfrederickswhat on earth is this.
20:36gfredericks,(re-seq (re-pattern "[qd-fva-cxy&&]") ascii)
20:36clojurebot("q" "v" "x" "y")
20:37gfredericksit's the "if you put two ampersands at the end of your character class all of the ranges become NOOPs" rule that we were all taught in college
20:55amalloygfredericks: i'm telling you, intersections are just bad
20:58gfredericksamalloy: I'd been assuming this edge case (empty right side) wasn't an intersection at all
20:58gfredericksi.e., that it was a noop
20:58gfredericksbut now I see it's a goofy-op
20:59amalloywhy would it be a no-op?
20:59gfrederickscuz funny parser
20:59gfredericksit certainly seemed like one when I wasn't trying ranges
20:59gfredericks,(re-matches #"[ab&&]" "b") ;; for example
20:59clojurebot"b"
21:00gfredericks,(re-matches #"[ab&&]" "&") ;; no & match
21:00clojurebotnil
21:00gfredericks,(re-matches #"[ab&&&]" "&") ;; except for 3
21:00clojurebot"&"
21:00gfredericks,(re-matches #"[ab&&&&]" "&") ;; but not 4
21:00clojurebotnil
21:00gfredericks,(re-matches #"[ab&&&&&]" "&") ;; but 5
21:00clojurebot"&"
21:00gfredericksw00h!
21:03gfredericksI've been trying to read Pattern.java; I can't imagine what sort of weird impl would cause this behavior though
21:08andyfmi6x3m: Eastwood can detect files with the wrong namespace name in them. Try it out to see if it would have caught that.
21:09andyfMost tools are confused if there is such a mismatch.
21:16amalloygfredericks: the behavior for && &&& &&&& &&&&& doesn't seem too crazy, if you pretend that using && for intersections makes sense to begin with
21:17amalloy[a&&], a intersected with nothing; [a&&&], a intersected with &; [a&&&&], a intersected with nothing intersected with nothing; [a&&&&&] a intersected with & intersected with nothing
21:19gfredericksamalloy: but intersecting with nothing should give you nothing
21:19gfredericksi.e., that doesn't explain why [a&&] matches "a"
21:21amalloyno, but taking the behavior of [a&&] as an axiom, the rest sorta follows from there
21:22gfredericksso it's NOOP and '&' alternating, not intersection and '&'
21:22gfredericksexcept for this new range twist I just discovered
22:30munderwoSaturday night in doing some clojurescript.. I feel like I should be less happy about this ;)
22:31munderwothe Paul Simon is helping as well.
22:34gfredericksSaturday night in doing some regex
22:35andyfyou should be happy if you are enjoying programming in a language that helps you express things well
22:37gfredericks&(re-pattern (str "[" (clojure.string/join "&&" (repeat 10000 "x")) "]"))
22:37lazybotjava.lang.StackOverflowError
22:37mgaaremaybe some Elton John instead... "Saturday night's all right for Clojure"
22:37munderwoWell I think I have it better than gfredericks …
22:37andyfgfredericks is exploring dark mysteries
22:38gfredericksfor science!
22:41munderwo“I can call you mapcat, and you can call me any?”
22:49TEttingergfredericks, this is madness!
22:49TEttingeryou'll stack overflow us all!
23:17vivekramaswamyHello all, a quick question, what is the command to delete a form. (if (empty? my-array) (do this) (else do this)). I want to delete the whole if statement form my clojure code. Thanks in advance
23:17vivekramaswamysorry forgot to mention, I am workingon emacs
23:18gfredericksamalloy: oh I think I figured it out
23:19amalloyvivekramaswamy: are you looking for C-M-k?
23:19justin_smithvivekramaswamy: paredit makes it very easy to work by forms
23:19gfredericksamalloy: when you end a char class with &&, I think it intersects the whole thing with the last thing before the &&
23:19vivekramaswamyC-M-k would be Cntl+Alt+k right
23:20amalloymhm
23:20justin_smithvivekramaswamy: usually, yes. Or Escape - C-k if you want more prefix and less chording
23:20amalloygfredericks: how does that fit with your [a-cx&&] example?
23:20Frozenlockvivekramaswamy: you can take a look at https://github.com/magnars/expand-region.el
23:21amalloythat intersection (a-c with x) should be empty
23:21gfredericksamalloy: it's as if writing [a-cx&&x]
23:21vivekramaswamysure thanks a lot C-M-k worked. I will definitely take a look
23:22gfredericksnot quite so simple...looks like it has some optimizations with single characters where they all get merged together no matter where they endu p
23:22gfredericks,(def ascii (apply str (map char (range 128))))
23:23clojurebot#'sandbox/ascii
23:23gfredericks,(re-seq #"[abc-def&&]" ascii)
23:23clojurebot("a" "b" "e" "f")
23:23gfredericks,(re-seq #"[abc-defg-h&&]" ascii)
23:23clojurebot("g" "h")
23:23gfredericksyou basically just get the last "thing"