#clojure logs

2012-04-11

00:00amalloybut i recently overdid it, i think, in trying to make a mutable database "look" immutable from the clojure POV. it's not a clear line to draw
00:01ppppaulwkmanire, datomic DB
00:01ppppaullol
00:02ppppaulcouchdb is immutable too
00:02ppppaulsorta
00:02wkmanireI've never heard of either of those.
00:02wkmanireBut I'm pretty sure that couchdb is mutable.
00:02ppppaulnope
00:02ppppaulunless you tell it to be
00:02ppppaulyou have to tell it when to mutate
00:02ppppaulwhich could be never
00:03muhoomutate or gc?
00:03ppppauli've been working with it for about a year
00:03ppppaulwell, gc
00:03ppppaulbut you can see all the garbage/revisions up until then
00:03muhooi'm trying to wrap my brain around couchdb atm
00:04ppppaulcouchapps are pretty cool
00:04muhooafter decades of sql, i feel a bit lost in how to structure data to make it nosql-idiomatic
00:04bbloomspeaking of datomic, i asked over in #datomic yesterday, but the room is pretty quiet… are there IRC logs?
00:04bbloomi'm curious to see the recent discussions over there
00:04muhooi.e. i have a compulsion for 3rd normal form i'm trying to recover from :-)
00:05wkmanireouch
00:05ppppaullol
00:05ppppauldo your dbs even work?
00:05muhoohehe
00:05muhoothey're not "web scale", but yes they waork
00:05wkmaniremuhoo: I'm tired of databases doing anything other than storing and returning data.
00:05ppppaulcouch is neat in that you can make your tables when you need them
00:05ppppauland when you make a table it gets mega indexed/cached
00:06muhoooh, i'm so irritated with orm's and activerecord, i'm eager to learn a better way, believe me
00:06wkmaniremuhoo: Microsoft had a brilliant idea and interfaced .Net with SQL Server so you can now write .Net libraries that run CLR code directly against database structures before they are returned by your Stored procedures, queries etc...
00:06bbloommuhoo: tell me about it. active record is *killing* me :-/
00:06muhoowkmanire: isn't that kind of like couchdb views?
00:06amalloybbloom: Raynes offered to have lazybot log for them, and i think the response was "gosh that sounds interesting, we should file a jira issue for discussing whether we want that"
00:07ppppauli think couchdb views are like stored procedures
00:07muhoobbloom: square peg, round hole, indeed.
00:07wkmaniremuhoo: I've only read about couchdb in passing. I've not actually used it.
00:07muhooi've played with it. i have to admit the idea of running views in clojure has me salivating
00:07bbloomamalloy: i see being built on the JVM isn't without problems… the enterprise mind poison is strong :-P
00:07ppppaulyou prob want your views in the db
00:07muhoobut, if i use a hosting server, i have to write them in js. or maybe cljs (experimental)
00:08wkmaniremuhoo: In imperative land there is a huge push to unit test all of the behaviors of your application. Any logic that gets moved into a sproc gets a lot harder to test and isn't encapsulated by your business classes.
00:08ppppauloh, those views
00:08wkmanireI've been burnt by that over and over again.
00:08ppppaulclojurescript views would be nice
00:08ppppaulit's not so hard to test views in couchdb
00:08bbloomwhile trying to contribute to CLJS, my limit experience with JIRA has quite unpleasant
00:09bbloomto the point that I kinda don't want to contribute….
00:09ppppaulyou can write curl unit tests
00:09bbloomGitHub has just spoiled me so much
00:09amalloybbloom: cljs is so much easier to contribute to than jvm-clojure
00:09bbloomyup, i've got a few patches that dnolen merged for me
00:09amalloydnolen is like a hero straight out of some greek myth
00:10muhooindeed. cljs, core.logic....
00:10muhoothere are so many heroes in clj land actually
00:10amalloyevery clj patch i've filed has been dropped on the floor; every cljs patch has been merged in under 24 hours
00:10muhoothese guys are immensely smarter than me. it's scary and inspirational and depressing all at the same time.
00:11bbloommy latest cljs patch has a pretty big impact on the compiler
00:11muhooamalloy: i have a feeling that rhickey really didn't want to be linus torvalds
00:11bbloomso i don't blame dnolen for taking his time to review it :-)
00:11wkmaniremuhoo: Smarter is a function of time and effort.
00:11ppppaulis there going to be a clojure 1.4?
00:12muhooi.e. he wasn't trying to start a huge community, he was trying to write something cool, then to make some money, not to be a leader of an opensource community
00:12muhoowkmanire: that is a very positive way to look at it.
00:12ppppaulyou can fork clojure
00:12amalloyppppaul: they're at like beta 84 now, should be out Real Soon Now
00:12ppppaullead the revolution
00:12ppppaulwhat's the new dirt on 1.4? i haven't used it since 1.2
00:12ppppaul1.3 wouldn't work for me :(
00:13muhooppppaul: wat?
00:13amalloywell, it fixes a lot of the breaking changes 1.3 introduced for no reason
00:13ppppaulwell, it broke my 1.2 projects to upgrade to 1.3
00:13amalloywhile leaving in the ones it introduced for a reason
00:13ppppauloh cool
00:13alexbaranoskylol
00:13arohner_amalloy: what breaking changes did 1.3 introduce, aside from contrib?
00:13amalloy&(class (int 1))
00:13lazybot⇒ java.lang.Long
00:13arohner_oh right
00:13bbloomlol.
00:13alexbaranoskyadded the reader stuff
00:13wkmaniremuhoo: Thats one of the reasons I'm here actually. Its nice that everything I see looks alien for a change.
00:13amalloy(= \a \a) causes a reflection warning
00:14ppppaul...
00:14wkmaniremuhoo: I'm going to get a lot more bang for my buck (smarter for my time) here for a little while.
00:14amalloyexceptions get wrapped in N layers of RuntimeException, where N is unpredictable
00:14muhoowkmanire: i had a pretty severe anxiety attack recently. luckily cemerick's book saved me from self-destructino
00:14wkmaniremuhoo: Cemerick's book? Sorry to hear that.
00:14muhoowkmanire: why sorry? the book is fantastic.
00:15wkmaniremuhoo: Condolences for the anxiety attack.
00:15wkmanireI've never heard of Cemerick or his book.
00:15muhoowkmanire: clojurebook.com
00:15wkmanireAh, I lied.
00:15wkmanireI was recently recommended to buy this.
00:15wkmanireBut I didn't know th ename of the author.
00:16bbloomhttp://www.4clojure.com/ has been extremely helpful for learning the std lib
00:16bbloomonce i followed some smart folks, it was really nice to learn new tricks by looking at other's solutions
00:17muhooso much of the clojure stuff was utterly impenetrable to me. his book is very practical, and i'm really a sysadmin/webmonkey kind of guy, so it was a huge relief to see examples i could relate to.
00:17wkmaniremuhoo: Thanks for the advice. Did you start off in CS with imperative languages too?
00:17muhooyep, bash, c, python, ruby, js, etc. some scheme.
00:18wkmaniremuhoo: Trust me, I understand exactly what you mean.
00:20muhoogood to know. it was pretty funny on here for a while, lots of serious heavyweight devs talking about things that made my head spin trying to read.
00:21bududoes anyone know how to get cljsc to pack everything inside a single file, i'm getting "cljs is not defined"
00:22ppppauli'm not really sure how in datomic queries happen in the app code...
00:24bbloomppppaul: if I understand it correctly, it happens by fetching database segments directly from block storage and loading them into an embedded database w/ query engine
00:24bbloombudu: cljs is in clojurescript's bin
00:24bbloomit's just a simple script that wraps the closure/build function
00:25budubbloom: i mean the js namespace, not the script
00:25bbloomsorry, my brain parsed that as cljsc
00:26bbloom:-P
00:26budui'm trying to compile some files that could get run by a browser and nodejs at the same time
00:26bbloomwhen do you get cljs is not defined?
00:27buduif i'm compiling with this command:
00:27buducljsc test.cljs '{:optimizations :simple :pretty-print true}' > test.js
00:27buduthere's no cljs namespace defined anywhere
00:27budubut with:
00:27buducljsc test.cljs '{:optimizations :simple :pretty-print true :target :nodejs}' > test.js
00:27buduthere is
00:28ppppaulso if i'm using datomic and i have a 1PB db... what happens?
00:28bbloompppaul: presumably a lot of garbage collection due to cache invalidation :-)
00:29ppppaulhaha
00:29ppppaulis datomic meant to be a local db? like couchdb?
00:29bbloombut more seriously, i read that datomic can join multiple data sources
00:29bbloomso if your memory set is huuuuge
00:29bbloomyou could set up a funnel of peers
00:29bbloomeach operating on a segment
00:30bbloomand map/reducing to a smaller set of data
00:30bbloomwhich could act as a data source for down the stream
00:30bbloomthe same way you handle 1PB of data w/ any thing really :-)
00:30ppppauldatomic has a java shell?
00:30ppppaullol
00:31bbloombudu: what do you mean "no cljs namespace defined anywhere"? you grepped the output?
00:33wkmanirewhoever wrote this trycjl.com tutorial needs to be evaluated.
00:33wkmanire"Clojure has a great set of immutable and persistent data structures. Vectors, lists, maps, sets, I get chills."
00:33amalloyRaynes: hey look, someone's talking about you!
00:36wkmanireRaynes: Your tutorial is fun, I hope you finish it.
00:36wkmanireRaynes: Is this project on github? I'd like to follow it if it is.
00:38xeqihttps://github.com/Raynes/tryclojure ?
00:39wkmaniremuhoo: That book is available for kindle so I went ahead and bought it just now.
00:39muhoogreat!
00:39wkmanirewhoever gets kick backs for advertising it in the IRC should go claim their credits.
00:39wkmanire:D
00:39muhoothe only person here who does is, IIRC, the author
00:40yoklovheh, muhoo convinced me to get it too
00:40muhooi'm just grateful it exists. full disclojure: i have no connection with the book or its authors.
00:41amalloyi've SEEN you palling around with cemerick in here! shill!
00:41wkmaniremuhoo: You should establish one.
00:41wkmaniremuhoo: You might be able to mutate the state of your bank account at this rate.
00:42muhooamalloy: he convinced ME to buy it :-)
00:42muhooi spent the full $35 before it went on sale too :-/
00:42bbloom(reset! @account-bbloom 10000000000000000)
00:42bbloomif only it were that easy
00:43bbloomwhoops no @
00:43bbloomwhatever :-P
00:43muhooi do have an interest in more people using clojure who come to it from a similar place as i do
00:44muhoo,(reset! @account-bbloom 10000000000000000)
00:44amalloy(swap! bloom-account (comp last (partial iterate inc))) is more reflective of the real process
00:44wkmaniremuhoo: I'm unfortunately not going to get to leave the windows world any time soon. And if I felt so compelled, would still not be able to leave the imperative world for some time after that.
00:44clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: account-bbloom in this context, compiling:(NO_SOURCE_PATH:0)>
00:44wkmaniremuhoo: I'm hoping to learn a lot of new stuff I can take back to the imperative world to make my 9 to 5 more interesting.
00:44muhooyou do clr stuff?
00:44wkmanireyep.
00:44wkmanireEvery day.
00:44wkmanireincluding today.
00:44muhoowell, there is clojure-clr, i'm told.
00:44wkmanireI don't even want to look at it.
00:45muhoohahha
00:45wkmanire.Net already has F# for FP.
00:45muhoolike a starving man looking through the plate-glass window at the people eating chocolat cake, eh?
00:45wkmanirenot tsay that clojure-clr shouldn't exist
00:45wkmanireJust saying, I'm looking to move out of windows and CLR developement all together.
00:45amalloywell, F# doesn't have macros
00:45wkmanirenot to*
00:46bbloomamalloy: they are working on some interesting things for type-safe code generation
00:46bbloomhttp://msdn.microsoft.com/en-us/library/hh156509(v=vs.110).aspx
00:46amalloyi wonder which .NET language i would pick, if someone told me i had to work on the CLR but could pick my language
00:46brehautamalloy: it does have a syntax quotation thing though i think
00:46muhooamalloy: it wouldn't be clojure-clr?
00:46amalloytoo bleeding-edge for me
00:47cemerickmuhoo: if it makes you feel any better, I have zero control over O'Reilly's pricing, etc.
00:47wkmanireI'm going to enjoy 4clojure.com
00:47muhoowkmanire: i'm making a similar transition.
00:47amalloyand likely to have many confusing *almost*-the-same moments
00:47muhoocemerick: it's ok, i wanted the pdf, and the only place to get it was oreilly at the time.
00:47wkmanireamalloy: I'm doing web dev with VB.Net
00:48amalloyokay, that's not the one i would pick
00:48ibdknoxC# is a fantastic language
00:48ppppaulso to use datomic i need to have something running on amazon :(
00:48ppppaulc# is fantastic?
00:48brehautamalloy: its not macros but http://msdn.microsoft.com/en-us/library/dd233212.aspx
00:48brehautpppaul: monads!
00:48brehautahem. sorry. LINQ!
00:48wkmanirecemerick: I just bought your e-book. Would you mind signing it for me?
00:49ppppaule-sign
00:49technomancyClojure%20Programming.pdf.asc
00:49muhooi've heardquite a few people commenting on how msft has started-- surprisingly-- getting stuff right lately. i noticed it correlated strongly with the retirement of billg, interestingly.
00:49ibdknoxlol
00:49wkmanireIt is getting better
00:49wkmanireI've just had my fill.
00:49ibdknoxeh, they have a long way to go
00:49ibdknoxand I'd be surprised if they get there
00:49wkmanireThey don't provide interfaces anywhere
00:49ibdknoxnot for lack of trying
00:49ppppaulMS-lisp is going to be a show-stopper
00:49wkmanireYou have to abstract away their code constantly to enable unit testing.
00:50wkmanireOr mock the hell out of i t.
00:50brehautmuhoo: its more to do with people like erik meijer and don syme having been there long enough for their work to have made it out of the lab
00:50amalloyi remember finding C# 1.0 distasteful, but i was impassioned with java at the time. since then it does seem to keep getting better
00:50wkmanireI can go on and on with my complaints.
00:50bbloommuhoo: I used to work at msft (now I run a startup and use zero msft tech). It has nothing to do with lately: the managed languages group has been doing great work for a long time
00:50ibdknoxamalloy: C# is nothing like C# 1.0
00:50brehautamalloy: C#1 is a distasteful Java ;)
00:50amalloy*chuckle*
00:51bbloomC# 3's Linq was my gateway drug to FP
00:51wkmanireA lot of the classes that you might want to inherit from are not inheritable or do not expose overridable members
00:51wkmanireSo you end up wrapping them
00:51wkmanireor dealing with it.
00:51ibdknoxthe platform is one thing
00:51amalloybut see, F# would also tempt me, and i might want to use C++ just to leverage my C experience
00:51ibdknoxbut the language is excellent
00:52cemerickwkmanire: Come find me at a conf sometime, and I'll sign whatever you like. :-)
00:52amalloyi suspect if i were under pressure to actually get something done, i would learn C#
00:52bbloomif you know java, there isn't much to learn
00:52wkmanirecemerick: I might just take you up on that.
00:53ppppaulC is not C++
00:53bbloom…unless you need to do win32 interop
00:53bbloomthen you're opening pandora's box
00:53ibdknoxI'm not sure that's true
00:53brehautamalloy: F# has a full OO sub syntax that you can use pretty much anywhere where C# would be used
00:53wkmanirecemerick: I bought your book because your cohort recommended it by the way.
00:53ibdknoxjava doesn't even have first class functions
00:53wkmanireHe's admitted to at least 2 sales since I've /joined this channel.
00:54wkmanirebut still proclaims his innocence.
00:54bbloomibdknox: sure it does, they are just absurdly verbose & called anonymous classes
00:54ppppauljava has first class ints
00:54ppppauland strings
00:54ppppaulwhat more do you need?
00:54xeqibut functors
00:54ibdknoxbbloom: that's a bit of a stretch
00:54cemerickwkmanire: sadly, I've not built my own affiliate network yet :-P
00:54ibdknoxdelegates then
00:54ibdknoxand and and
00:54bbloomi worked on C# & VS integration for xbox — I'm quite familiar with C#
00:55ppppauli really like how i can put exception handling everywhere in my java apps
00:55ibdknoxbbloom: I was PM for C# and VB
00:55ibdknox:)
00:55bbloomit's heads and shoulders above java for day to day use
00:55wkmanireI wish I could have spent my .Net time with C# instead of VB.
00:55bbloomibdknox: awesome. we may even know each other already haha
00:55wkmanireNot because I prefer the syntax, but because C# was the favorite son.
00:56wkmanireIt got all of the new features first, and more third party open source guys latched onto it.
00:56brehautwkmanire, really? you dont like having to type FUNCTION all over the place?
00:56wkmanirebrehaut: Visual Studio types most of that crap for you.
00:56brehautbut its still there, in all caps, yelling at you
00:56wkmanireI type P space F space myFunction ....
00:56amalloycalling you Dim
00:57brehaut(inc amalloy)
00:57brehautits still broken isnt it
00:57amalloyi dunno, man. it's a myster
00:57amalloyy
00:57amalloy$login
00:57lazybotYou've been logged in.
00:57amalloy$loaded?
00:57lazybot:autoreply :brainfuck :clojure :debug :dictionary :eball :embedded :fortune :github :google :haskell :help :internal :javadoc :karma :knowledge :leet :lmgtfy :load :log :logger :login :macro :mail :max :mute :operator :ping :rotten-tomatoes :rss :sed :seen :shorturl :timer :title :translate :utils :weather :whatis :yesno
00:57amalloywell, it alleges to be active. god knows
00:57amalloy$logout
00:57lazybotYou've been logged out.
00:58muhooin tools.logging and log4j is there a way to get it to stop printing "sun.reflect.NativeMethodAccessorImpl invoke0" every time it logs something?
00:58wkmanireI once toyed with the idea of working with Mono before I started learning Python as a good footstep into developing from a linux box. But the Vb support for Mono and VB in Sharp develop was laughable.
00:58wkmanireVB is definitely the bastard child.
00:59amalloy$dec lazybot
01:00muhoowkmanire: could be worse.. you could be using..... PHP
01:00wkmaniremuhoo: At least with PHP 5+ you can pretend like it doesn't suck.
01:01brehautthats a hell of a lot of playing pretend
01:01muhoooh it still sucks.
01:02muhoobut it has features that you can use to make it smell like javascript, or java, or whatever
01:02amalloy5.3 has closures!
01:03muhooanonymous functions, and closures, yes.
01:03muhooand eval, well it's had eval for a long time
01:03amalloyevery time you use them it feels like one more needle in your eye, but they're there
01:03muhooi'll never forget the first time i learned scheme, then went back to doing PHP. my code was an unreadable disaster
01:03amalloyi learned clojure while doing PHP at my day job
01:04wkmanireI don't hate working with PHP. At the risk of sound like egotistical, I hate working on PHP that I didn't write. Because I never know what the hell is in my scope.
01:04wkmanireIt seems like every side job I get to work on a PHP site has been copy and pasted together by a bunch of script kiddies hired from sites like ODesk.
01:05amalloyi definitely remember a decision i made to use a closure in PHP when really any sensible person would have used an interface
01:05wkmanireNo offense to odesk, I know there is a lot of talent floating around there.
01:05amalloywkmanire: your PHP looks like that to everyone else, btw
01:05wkmanireamalloy: More than likely.
01:06amalloythe PHP i wrote looks like that to me, probably
01:06wkmanireI'm gonna go get a beer and start reading my shiny new e-book.
01:06wkmanireMy english are starting to badder.
01:06amalloyjust add beer, that'll fix it
01:10ppppauljavascript can smell nice
01:11wkmanireToo bad cemerick parted.
01:11wkmanireI wanted to thank him for targeting python guys.
01:12wkmanireppppaul: JS is one of my favorite languages.
01:12ppppaulglad to hear that... you'll like clojure even more
01:17amalloywkmanire: you can tweet him, or use lazybot's $mail
01:17wkmanireamalloy: I'm not much of a twit.
01:18wkmanireBut I'll be frequenting this channel.
01:18wkmanireI'm sure I'll get an opportunity to thank him properly.
01:18amalloy$mail amalloy check it out, a mail message for myself
01:18lazybotMessage saved.
01:18jaenIncidentally, what did a :haskell keyword did in lazybot's module list? ;d
01:18wkmanire$mail lazybot Message saved.
01:18lazybotYou can't message the unmessageable.
01:18wkmanire$mail unmessageable wanna bet?
01:18lazybotMessage saved.
01:18amalloy$heval map succ [1,3..9]
01:19amalloyhm, i guess my haskell is bad? i know he evals it
01:19amalloy$heval [1,2]
01:19jaennow, that's proper haskell you wrote there I think
01:19amalloymaybe that's broken
01:20amalloylast time i tried to eval haskell it worked; not sure if he's sick today or what
01:20jaenMaybe he's just lazy ; d
01:24amalloy$mail Raynes can you check out the haskell plugin? $heval isn't working; maybe he just needs a restart
01:24lazybotMessage saved.
01:25amalloywhere's that polyglot bot? rublets or something?
01:26wkmanireoh man
01:26wkmanireI must be living under a rock.
01:26wkmanireWhen did Oracle acquire Java?
01:26wkmanireI thought Sun owned Java.
01:26brehauthaha
01:26brehauta few years ago now wasnt that?
01:26brehautoracle bought all of sun
01:26wkmanireWow
01:27wkmanireThat must have been a big ticket.
01:27wkmanireSun had some huge enterprise clients didn't they?
01:27brehaut2009 they were aquired
01:27wkmanireThe last time I worked with Java was 2004ish.
01:28amalloyas long ago as 2009? the wound feels fresher
01:29brehauteverything is slower in the land of oracle
01:31amalloyspeaking of which, did you hear oracle has plans for all the way up to JDK 12?
01:31brehauthaha really?
01:31brehautwont that be due in 2083
01:32wkmanire:D
01:32amalloy2021
01:32amalloyhttp://www.infoworld.com/d/application-development/oracle-lays-out-long-range-java-intentions-188739
01:32amalloy(but seriously, who thinks they can release 5 versions in just 9 years)
01:33muhoonice, clojure.tools.logging totally ignores any log4j.properties files
01:33muhooand sends everything to the console :-/
01:33brehautamalloy: i struggle to believe they can release 2 versions in 9 years
01:33muhooamalloy: that's fud.
01:34muhooan old ibm/at&t trick
01:34amalloyi, uh, i'm pretty sure FUD means something else
01:34muhooyou lay out your roadmap, and enterprise CTOs can pooh-pooh any competitor's bright idea by saying "Oh, well $bigcorp has got that on their roadmap, no need to switch."
01:35amalloyi guess i can see how you might make them feel similar
01:36arohner_muhoo: c.tools.logging does zero configuration of log4j
01:36muhooarohner_: does it read it?
01:36arohner_muhoo: no. it only sends messages to log4j/ whatever logging lib you have on classpath
01:36arohner_it's log4j's responsibility to read log4j.properties
01:37muhoooh. so if i don't explicitly add log4j to project.clj deps, then tools.logging just sends stuff out stdout?
01:37arohner_oh, yeah. It's probably going to java's built-in logger
01:37amalloyjava's logging ecosystem is incredible
01:38muhooincredible in what sense of the word?
01:38amalloylike, it is impossible to believe that things are the way they are
01:38muhoooh like "inconceivable"? http://www.youtube.com/watch?v=Z3sLhnDJJn0
01:39muhooarohner_: thanks
01:39arohner_muhoo: and if you're doing new development, you should probably look at logback
01:40muhooyes, i am, and i will, thank you
01:43wkmanireWhew
01:43wkmanireBeer #2, the final of the night.
01:43wkmanireIs there a preferred emacs major mode for Clojure?
01:44muhoowkmanire: i've been using clojure-mode
01:44muhoowkmanire: http://github.com/technomancy/clojure-mode
01:45wkmaniretechnomancy is a busy feller isn't he.
01:45wkmanireI'm already downloading leiningen
01:45muhooindeed.
01:45wkmanirenow I'll be downloading clojure-mode from him too.
01:45muhoothere are a bunch of guys here who are pretty amazing.
01:48muhooas for logging, i'm hoping longbottom gets released soon
01:48laurusCould someone help me understand what is wrong with this simple function? http://paste.lisp.org/display/128887
01:49bbloomwhat's it supposed to do?
01:49johnwaynerHi. I've got a program which calls interate with a step function to create sucessive versions of the hashmap. I'm trying to process these iterations as quickly as possible. I'm using visualvm to try to find any obvious hotspots. The one that always sticks out at 88% is clojure.lang.Keyword.hashCode(). I'm reusing a very limited set of hashcodes as keys in my maps, so I would expect these to be cached and not rehashed every time
01:49johnwaynerAny ideas what I'm doing wrong? (the code is quite complicated otherwise I'd provide some of it)
01:49amalloywell, you passed a one-argument function to reduce, which calls its function with two args
01:49laurusbbloom, it's supposed to calculate that expression for each number in the sequence numbers, and add them all up.
01:50amalloylaurus: you want (reduce + (map #(...) numbers))
01:50bbloomcan also (apply + ...
01:51amalloy*shrug*
01:51laurusamalloy, why does reduce call a function with two arguments?
01:51bbloom6 of one :-)
01:51bbloom`(doc reduce)
01:51laurusOh, wait, I see.
01:51amalloybut then you can't call yourself a map/reduce expert, bbloom
01:51bbloom,(doc reduce)
01:51johnwaynerJeez, I should have re-read that before hitting enter. I'm obviously using a limited set of KEYWORDS as keys in my maps...
01:51clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
01:52wkmaniremuhoo: Ok, got clojure-mode byte-compiled and installed.
01:52wkmanireNow its time to install leiningen
01:52laurusamalloy, it worked, and I understand why. Thank you!
01:53muhoowkmanire: have you been an emacs user before?
01:53wkmaniremuhoo: I'm rabid.
01:53wkmaniredoes clojure-mode integrate a REPL?
01:53amalloywkmanire: swank/slime
01:54amalloy(lein includes a swank server)
01:54johnwayner... interesting, Keyword.hashCode just returns the cached hash...
01:54wkmanireamalloy: I'm sticking this on my windows box so I have something fun to help distract me during my work day.
01:55wkmanireamalloy: Can you link me to a tut on how to set this up?
01:56amalloywkmanire: if you have lein and clojure-mode installed, there is no setup
01:56wkmanireOk.
01:56wkmanireI'll finish installing lein
01:56amalloyjust visit a buffer inside of a project created by lein new (it will have a project.clj somewhere), and M-x clojure-jack-in
01:56wkmanireI saw that function!
01:57amalloyemacs fine lein on your path, fire it up, negotiate a swank port/version, and you're in a slime repl
01:57wkmanireI try C-H F clojure-jack-in
01:57wkmanirenot documented
01:57wkmaniretried*
01:57wkmanireAlso, I'm not familiar with swank
01:59muhoowkmanire: docs here https://github.com/technomancy/swank-clojure
01:59amalloywell, that's something to get used to. but for a while at least, you can treat it as a repl with easy copy/paste from your source files, within emacs
01:59wkmanirethanks
01:59amalloy~swank
01:59clojurebotswank is trust the readme and the readme only. all others will lead you astray.
02:00muhooit's true
02:00amalloyi don't trust clojurebot when he talks about swank, even, just in case
02:01wkmanireAt 2am
02:01muhoonah, it's more fun that way
02:01amalloyyou should just move to a better timezone
02:01amalloyso it's not so late all the time
02:01wkmanireI hate windows.
02:01wkmanireIt makes this so much harder than it should be.
02:01muhooamen
02:02muhooyou're an emacs user stuck doing vb on windows?
02:02muhoothat explains the beers
02:03wkmanireI spend almost all of my off hours in linux land
02:03wkmanireBut, tomorrow, bright and early at around noon.
02:04wkmanireI'm going to log back into my windows machine and start trying to track internet traffic through other companys' websites using vb.net.
02:04wkmanire:(
02:05muhoosorry to hear it man
02:05wkmaniremuhoo: Thats ok.
02:05wkmanireHere in a few months I'm going to try to make a switch.
02:05muhoowell, if it makes you feel any better, i've been making a living doing PHP for a while
02:05wkmanireHopefully it will go well.
02:06wkmaniremuhoo: At least I could do PHP from my linux box and from Emacs.
02:06wkmanirethere isn't a good VB.Net mod
02:06wkmaniremode*
02:06muhoothat's why i was doing it, actually.
02:06wkmanireand I don't know ELisp well enough to mak one.
02:06wkmaniremake*
02:06wkmanire(nor have I the desire to learn ELisp)
02:06wkmanirenot that desperate yet.
02:06wkmanireI'll learn it eventually though.
02:07muhoothe weirdest thing about elisp is its scoping, but if you're used to java and php, it's not new.
02:07wkmanireclosures don't scare me.
02:07muhoosorry javascript
02:07wkmanireI like 'em.
02:08wkmanireI like Python closures a bit more than Javascript closures.
02:08muhoono i mean no modules org-mode-some-long-function-name-because-no-namespaces-thats-why
02:08wkmanireI shouldn't be able to mutate things in a long distance parent scope 6 calls up the stack.
02:08wkmaniredistant*
02:09wkmanirePython at least makes you work for it if you want that.
02:09muhooso you got that lein installed yet? :-)
02:09wkmanireI just finished running the self installer batch file.
02:09muhooit's a 20-second process, walked a customer through it today, that was fun.
02:09wkmanireI had to install 64bit curl and add it to my path.
02:09wkmanirethe batch file took care of the rest
02:10wkmanireOk, so amalloy mentioned setting up a project?
02:10wkmanirewat dat mean?
02:10muhooyep, "lein new projectname"
02:10muhoothen "cd projectname", "lein repl", and you are in business
02:10wkmanirewell, lein installer did not put lein on my path.
02:10wkmanirewhere did it install it?
02:11muhooon linux, ~/.lein
02:11amalloywkmanire: python doesn't really have closures. i mean, it has named inner functions, which are closures, but you can't have lambdas
02:11wkmanirepython has lambdas
02:11wkmanirewhat do you mean?
02:11muhoopython *used* to have lambdas
02:12muhoothey got moved to a library, IIRC, in like 2.4 or so
02:12wkmaniresquare = lambda x: x * x
02:12amalloyit has limited lambdas. the "feature set" allowed in named functions is larger than the one for lambdas
02:12wkmanireWell that is certainly true.
02:12amalloyyou can't just "build a function anywhere", which is the whole point of lambdas. some lambdas you're required to give a name to
02:13amalloyhttp://symbo1ics.com/blog/?p=1292 is a recent blog post about the ramifications of that distinction
02:13wkmanireadded to my "to read" bookmarks.
02:14wkmanirethat list is getting longer than I can stomach.
02:15wkmaniresomething weird happened.
02:15wkmanireIt installed leiningen to the equivelant of ~/.lein
02:15wkmanire~\.lein\self-installs\leiningen-1.7.1-standalone.jaf
02:15clojurebotGabh mo leithscéal?
02:15wkmanire~wat
02:15clojurebotIt's greek to me.
02:15wkmanire~same
02:15clojurebotGabh mo leithscéal?
02:16wkmanire.jar*
02:16muhoojav?
02:16wkmanirebut I can't seem to run the jar file.
02:16muhoowait,
02:16wkmanireit has no main.
02:16muhoono you run lein
02:16muhooput lein in your path
02:16muhoomake it executable
02:16muhoothen run "lein"
02:16wkmanireI don't know where it is.
02:16muhooit sets up the cp and runs the jar
02:17muhoodid you wget it?
02:17wkmaniremuhoo: In case you missed it, I'm setting this up on a windows machine
02:17wkmanireSo I can play with it during brain farts while I'm working.
02:17amalloywkmanire: the executable is the .bat, not the .jar
02:17muhoooh fun
02:17wkmanireah!
02:17wkmanireI see
02:17amalloyit does the work of opening up the jar for you
02:17wkmanireok
02:17wkmanireone sec
02:18wkmanireok ready to rock.
02:18muhooyay!
02:18wkmanireI thought that was just an installer.
02:18amalloyit installs itself if necessary
02:18muhoocould you imagine an InstallSheild lein?
02:18amalloyyou can blow away the jar and keep using the .bat - it just gets another copy
02:19muhoolein has a lot of funny recursive stuff like that.
02:19wkmanireUnderstood.
02:19wkmanireOk, I started up my project
02:19wkmaniregoing to try to hijack it with emacs now.
02:19wkmanirejack-in
02:19wkmanirewhatever the terminology is.
02:20amalloyi think jack-in is supposed to evoke memories of the matrix, plugging clojure into your skull
02:20wkmanireahhh, fond memories.
02:21wkmanireamalloy: Unless you're not talking about shadowrun
02:22laurusWhen moving through a list in Clojure inside a function such as map, is there a way to get the current position of the list?
02:23wkmanireamalloy: "Could not start swank server: That's not a task. Use \"lein help\" to list all tasks."
02:23wkmanireany ideas?
02:23amalloyoh, you need to install the swank plugin
02:23amalloyit should be in the swank readme, how to do that
02:23wkmanirelooking
02:23amalloy&(doc map-indexed)
02:23lazybot⇒ "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
02:27wkmanirecrap
02:27wkmanirethe installer shit all over the place.
02:28muhoothere's an easier way, just run the repl in a comint-mode buffer
02:28muhooi haven't messed with swank yet, i'm sure i will though at some point.
02:29wkmanirehttp://pastebin.com/VSNqg2tF
02:29wkmanireI'm going to try again as admin.
02:29muhoowkmanire: https://refheap.com/paste/1992
02:30wkmanirewhere does this go?
02:30muhoogranted, i'm on linux, and i know sweet FA about windows, so ymmv
02:30muhoothat's in my .emacs
02:30muhoomy cheap way of running repls without swank
02:30wkmanireI'm not going to give up just yet.
02:31muhoo"couldn't delete" does smell like a permissions issue though.
02:31wkmanireI was running as admin.
02:31wkmanirehmm
02:32muhoowell, what is C:\Users\wkmanire\AppData\Local\
02:32muhooTemp\lein-2d8b965f-63b9-4cb4-9ab0-033ea5588228\lib\cdt-1.2.6.2.jar
02:32laurusamalloy, I'm not sure that's the one I need
02:32laurusI am trying to loop through a list of 50 items and output this to a text file: "1 firstvalue\n2 secondvalue..."
02:33amalloyif you don't think map-indexed is the solution to that problem you are missing something fairly fundamental, but i'm not sure what
02:33muhoocdt is some eclipse thing, eh?
02:33amalloy&(map-indexed vector '[a b c d e])
02:34lazybot⇒ ([0 a] [1 b] [2 c] [3 d] [4 e])
02:34laurusamalloy: I don't need to apply "f to 0", I just need it to literally print 0.
02:35amalloyso write a function g that prints 0 and then calls f, whatever makes you happy
02:35laurusamalloy, ah, I see, I didn't get that
02:35laurusI didn't realize you can just plug in "vector" there
02:36muhooamalloy: you are right. i'm stunned by what a monstrous right royal PITA logging is on java, even using logback
02:36muhooit's like dealing with the italian bureaucracy.
02:38muhoo"simple" logging framework: http://www.slf4j.org/images/concrete-bindings.png
02:39wkmanirewell crap
02:39wkmanireI can't get lein to work
02:39amalloywkmanire: does stuff other than lein swank work? like, can you lein new? lein repl?
02:40wkmanirelein new worked.
02:40amalloy(not that i know how to help you either way)
02:40muhoowkmanire: cd into your project
02:40wkmanirelein repl worked as well
02:40muhoooh
02:40muhooso lein is working, clojure is working, swank is not working?
02:40wkmanireI think that is correct.
02:40amalloyit sounds like he can't install the swank plugin
02:40wkmanirethe installer is downloading the jar file and putting it into the plugin directory.
02:40wkmanireBut the installer is bombing out before it finishes
02:41wkmanirebecause of some kind of permissions issue in a temp directory.
02:41muhoomanually clear out the temp directory and try again?
02:42wkmaniredid that
02:42wkmanireI'll give the stack trace
02:42wkmanirejust a sec
02:42muhooyou might have to ping technomancy on this one, i dunno.
02:43wkmanirehttp://pastebin.com/kVLGAB32
02:44wkmaniremuhoo: Yeah, I think so.
02:44muhooor, submit it as an issue on github maybe
02:44laurusHere is a short program I just wrote, I haven't finished it yet since I think I am doing something fundamentally wrong. http://paste.lisp.org/display/128888
02:44laurusI feel like every time I want to map over something, I can't "get inside" far enough
02:45laurusFor example, for a list of lists, is there any way to map over those inner lists without making an anonymous function?
02:45muhoowkmanire: but, like i said, i've been using clojure for months now with no swank, haven't missed it.
02:45wkmaniremuhoo: There is a similar issue already submitted but I can't seem to get the same results as that user.
02:45wkmanireIt's 2:40, gonna have to hit the sack.
02:45muhooaaare
02:45wkmanireI'll start reading the book and bug you guys some more tomorrow.
02:46wkmanireNice to meet you all.
02:46wkmanireGood night.
02:46muhoohave fun, and welcome!
02:46andyfingerhutlaurus: You can map over an inner list with a named function, if you prefer.
02:46laurusandyfingerhut, what is the best way?
02:46laurusI couldn't finish the program yet because I didn't want to create yet another confusing function
02:47laurusI feel like I am creating a big mess.
02:47andyfingerhutI'll just toss out a couple of possibilities. I'd almost recommend trying to write it in each way, and see if you have a preference.
02:47laurusOK!
02:47andyfingerhutAnother is for, which you can nest calls to.
02:48andyfingerhutI don't recall off the top of my head, but you might be able to do a nested map using a single for with multiple bindings.
02:48laurusAm I on the right track, by the way?
02:48laurusI mean, does that program look like a normal Clojure program or is it "wrong"?
02:49laurusWhen I run the program, I suppose I will call it like this: (writedata (createlist (100))
02:50andyfingerhutStill aborbing some of it.
02:54laurusI'm tempted to use loop in an imperative style.
02:55andyfingerhutI just commented with an alternate version of createlist that I think is equivalent, but not sure.
02:56laurusandyfingerhut, thanks I'll look now
02:57laurusandyfingerhut, yes, equivalent :)
02:57laurusandyfingerhut, that's fantastic!
02:57laurusAh, I see what you're doing
02:58laurusBy using the ->> macro you can avoid creating all these anonymous functions and calls within calls
02:58andyfingerhutI prefer -> and ->> when they are used in a chain with an initial value and at least two expressions that operate on them afterwards, but that is more of a personal preference of mine.
02:58laurusI think it looks good! I suppose the whole program could somehow be composed that way?
02:58andyfingerhutI didn't remove any anonymous functions. I did remove some intermediate named things that were only named to be used once.
02:59laurusAh ok I see.
02:59laurusDo you see what I'm trying to do?
02:59andyfingerhutnot yet. I'm a little slow on the uptake tonight :)
02:59amalloylaurus: i strongly recommend ##(doc for) for iterating over nested lists
02:59lazybot⇒ "Macro ([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost ... https://refheap.com/paste/1993
02:59laurusamalloy, ok
03:00amalloy&(let [inputs '[[a b c] [d e f]]], (for [xs inputs, x xs] (keyword x)))
03:00lazybot⇒ (:a :b :c :d :e :f)
03:01amalloytbh i recommend `for` even for simple lists; it's usually prettier than (map #(...) xs)
03:01laurusamalloy, how would you fix this program?
03:03amalloywhat is it you're trying to do? right now it doesn't even compile
03:03laurusI know, I couldn't finish it
03:03laurusI want to print out "1 calcresult1\n2 calcresult2..."
03:03laurusThe createlist function is the one that creates calcresult1, calcresult2, etc.
03:03amalloyand calcresult is (ichiban 1)?
03:04laurusYes :P Sorry for the stupid names
03:04amalloyso what is with the PI/4 and - stuff?
03:05laurusBasically, the function called ichiban creates a result
03:05laurusAnd createlist creates a result out of that result.
03:05laurusThe one that should be printed to the file.
03:06laurusBasically I feel like continuing in this style for any calculation-oriented program will create a giant mess of unreadable nested maps
03:06andyfingerhutlaurus: Take a look at paste 3. I messed up paste 2.
03:06amalloyi agree, to the point that i can't figure out what you're doing enough to fix it
03:07laurusamalloy, yeah. I'm totally confused now too.
03:07laurusIs there some kind of guide for people doing math or science using Clojure?
03:08laurusThis sounds stupid, but "this is really easy to do in Python".
03:08amalloyit's easy in clojure too
03:09amalloybut so far i don't think anyone understands the goal
03:10andyfingerhutlaurus: It can be confusing when accustomed to writing imperative style code to write functional style code. It can feel "unnatural", because you know how to crank it out in a few seconds in imperative style from long practice, and feel like a fish out of water in a different style.
03:10amalloydo you have a link describing in some mathematical notation what you want? the clojure you've written doesn't lend itself to reading
03:10laurusI want to print out "absolute value of pi/4 minus delta(n)" where delta(n) is "sum (-1)^k / (2k + 1) from k = 0 to n".
03:10amalloyah, cool
03:10andyfingerhutlaurus: Did you look at annotation 3? See if it looks interesting.
03:10laurusandyfingerhut, yes, that's great, thanks!
03:11andyfingerhutExcept I think I've reversed the subtraction between Pi/4 and delta(n).
03:14amalloylaurus: do you have expected outputs somewhere to verify my solution is correct?
03:16laurusamalloy, let me check it one sec :)
03:16laurusOh, it's not pasted
03:16amalloyhttps://gist.github.com/237543a6327f100512ad is definitely not the fastest solution
03:16laurusUm, I don't. But it declines roughly linearly
03:16laurus:)
03:16laurusThere shouldn't be negative numbers, for sure
03:17laurusOh, amalloy, it's 2k + 1.
03:18amalloyyes, that's what (inc (* 2 k)) is
03:19amalloyoh, i left out the abs that you had in your original but not in the problem statement just now
03:19amalloyoh. no, you included it, i'm just dumb
03:20laurusAh, thanks
03:20amalloyanyway, you can add a Math/abs right before the -, and then it does what you described
03:20laurusYes, I did that thanks :)
03:20laurusSo to write the data to a file, what should I do?
03:21andyfingerhutAnd if you want a little speed optimization, you could replace (apply * (repeat k -1)) with (if (even? k) 1 -1), but that is perhaps less clear, too.
03:21amalloyandyfingerhut: i think there are bigger targets here, like the whole apply + thing can be memoized and/or simplified
03:22Lajla&(symbol? (symbol "I worship His Shadow")))
03:22lazybot⇒ true
03:22andyfingerhutI like printf if you want the output to be text.
03:23andyfingerhutOh, except if you want the output to go to a file, you would have to wrap it in something like (binding [*out* wrtr] <code that does printf here> )
03:23amalloylaurus: (spit "somefile.out" (clojure.string/join \newline (for [[idx delta] (deltas n)] (str idx " " delta))))?
03:24amalloyyeah, that works
03:24wei_what's the best way to read from a config file and but still have defaults? (binding [config/config (merge defaults-map (parse-file "test.cfg")) (run!)) ?
03:24andyfingerhutYeah, slurp and spit are cool for things that you know will easily fit in memory all at once.
03:25amalloyagreed, if you want to run this on a million numbers at once, don't use spit or join
03:25wei_er, (binding [config/config (merge defaults-map (parse-file "test.cfg"))] (run!))
03:26laurusamalloy, thanks. This is a very nice learning process for me!
03:27andyfingerhutwei_: Looks good to me. Merge is nice for such things.
03:31chrisrlaurus: try stick it out, for the first few months heavy math/numerics was massive pain point in clojure for me, but after you figure it out having access to the clojure+java ecosystem is (IMO) vastly superior to python/sage, matlab, octave et al
03:32wei_andyfingerhut: thanks. as a followup, say I have test1/run and test2/run. how would I write (call-run "test1") so that it calls the right run function?
03:35andyfingerhutwei_: You want call-run to take a string that is the name of a namespace?
03:35wei_yup
03:37andyfingerhutSomeone else probably knows something cleaner, but I think (apply (resolve (symbol "test1" "run"))) works
03:39andyfingerhutOr even leave out the "apply"
03:40laurusamalloy, thanks a million
03:40lauruschrisr, that's good to hear :)
03:41laurusI will stick it out!
03:50fliebelI remember reading someone claiming continuations are worse than goto, but I forgot why. Anyone know?
03:53rahcolawell continuations aren't exactly the easiest concept to grok
03:54rahcolaatleast if they are first-class values, and can be stored
03:56jaenI never got people saying that goto sucks ; d
03:57twhumePotential noob-question: I have a function which takes a map, and in some circumstances has trouble getting values from the map. Given the code:
03:57twhume (println m)
03:57twhume (println (clojure.string/join ", " (keys m)))
03:57twhume (println (first (keys m)))
03:57twhume (println (get m (first (keys m))))
03:57twhumeI get the output:
03:57twhume{Google Inc 14.399999999999997, Clearleft Ltd 12.000000000000002, Future Platforms 4.8}
03:57twhumeGoogle Inc, Clearleft Ltd, Future Platforms
03:57twhumeGoogle Inc
03:57twhumenil
03:57twhumeI don't understand why I'm getting that last "nil". Surely the fact that the map contains they key and a value associated with that key, means it should return 14.399999999999997 ?
03:58twhumeAny ideas? I'm v new to Clojure so suspect it's something deeply obvious I'm missing.
04:00andyfingerhuttwhume: Is "Google Inc" a string?
04:01twhumeYes. Would that make a difference though? I'm never referring to it as a string in the line (println (get m (first (keys m)))) ?
04:01hoecktwhume: its the result of the call to println (if you're on a repl)
04:01wei_andyfingerhut: thanks! that works except I had to use deref instead of apply
04:01andyfingerhutI was only concerned if it was a symbol, since some chars aren't 100% supported in symbols, although they sometimes work.
04:02hoecktwhume: sorry, ignore me
04:02twhumehoeck: no, this isn't on the repl. This is cut and pasted from code. The reason I've got this level of debugging in is that my code was throwing a NullPointerException further in when trying to get the value for one of those keys.
04:03hoecktwhume: I was too fast in recognizing that specific pattern :)
04:03twhumeandyfingerhut: Hmm; shouldn't be a symbol, but could I have inadvertently converted it to one, I wonder. This same code works for a unit-tested map with single-word keys...
04:03jaenthume: Weird, this seems to work for me allright.
04:03fliebel&(let [m {:foo 3}] (println (get m (first (keys m)))))
04:03lazybot⇒ 3 nil
04:04twhumejaen: yeah, I have some unit tests which seem to work just fine with it too. Must be something about the map itself, I guess; in my unit tests it's constructed manually, in my "real" code it's created by another function. Any pointers for things to look for?
04:05andyfingerhutTry printing (class (first (keys m))) ?
04:05andyfingerhutIt shouldn't make any difference that I can think of -- just grasping for straws.
04:05andyfingerhutAre the keys a mutable data type?
04:06hoeckor use prn instead of println (this will print strings with their quotes)
04:06twhumeandyfingerhut: returns java.lang.String both in my unit tested code, and the real stuff.
04:06andyfingerhutThose are immutable, so no clues there.
04:06rahcolatwhume: could you make a gist?
04:07rahcolawith the constructing function also included
04:07twhumeOne difference I can see: my working code passes in a clojure.lang.PersistentArrayMap, my not-working code passes in a clojure.lang.PersistentTreeMap ...?
04:08twhumerahcola: will do
04:10fliebelhuh, where did you get the treemap from?
04:10fliebelI only get ara and hash maps
04:10fliebel*array
04:10twhumerahcola: https://gist.github.com/2b7b99137ce4e9ee2474
04:11andyfingerhutfliebel: It is possible to make one by calling sorted-map
04:11fliebelandyfingerhut: Thanks
04:12twhumeandyfingerhut: yeah, that's what I'm doing.
04:12andyfingerhutCould your comparator function be bad?
04:12andyfingerhuti.e. not satisfy the properties a comparator function should, like transitivity?
04:13twhumeandyfingerhut: are you looking at the gist now? Which comparator function do you mean?
04:14andyfingerhuttwhume: Your sort-map-by-value calls sort-map-by. The first arg is a comparator fn
04:15twhumeHow would that result in th
04:15twhume
04:15twhumeurk
04:15twhumeHow would that result in a get on that map returning nil, when the key I'm "get"ting is there tho? I can see how an iffy comparator might result in problems sorting or constructing the map, but not its subsequent behaviour.
04:15andyfingerhutI'm not sure yet. Still thinking. But a bad comparator function can make sorts go wrong, and sorted data structures give bad answers.
04:16andyfingerhutThe comparator function I think is used in looking up keys in the map.
04:16rahcolasort-map-by-values looks funny in anycase
04:16twhumerahcola: this is my first proper clojure code so I expect big chunks to be iffy :-(
04:16rahcolaatleast with sort and sort-by, the comparator fn should satisfy the java.util.Comparator
04:17twhumeandyfingerhut: I think you've nailed it. I changed the "<=" to "<" in the comparator, and suddenly my gets are working.
04:17rahcola(into (sorted-map-by (fn [key2 key1] (<= (m key1) (m key2)))) m)
04:18twhume(and I can see that <= might not be transitive)
04:18twhumeWould you concur that this is a reasonable fix? I'm not sure I get what's happening behind the scenes to account for this behaviour.
04:19andyfingerhuthttp://stackoverflow.com/questions/1528632/how-do-you-use-sorted-map-by-in-clojure
04:19andyfingerhutYou might want compare instead of < or <=
04:20twhumeHah, that's where I got the code that was broken, I think (see Rafael's comment about using <= instead of compare)
04:21twhumecompare works fine too tho (just checked).
04:21rahcola< nor <= should work
04:21rahcolabecause the comparator should return -1,0,1
04:21rahcolanot boolean values
04:21twhumeandyfingerhut: any idea what's caused this problem? I get that the comparator was wrong, but how did that make the subsequent get return nil?
04:22twhume(I suspect my mental model for how this is working behind the scenes - map is created, then consumed - is wrong)
04:23amalloya broken comparator breaks everything about a sorted collection, period. once you get to "the comparator is wrong", no other questions are useful
04:23andyfingerhutI don't know for sure, but I believe sorted-map's are implemented by binary search trees, where when a search is done, the given search key is compared against stored keys, and the results tell the search routine whether to go down to the left or right child. If that comparison routine is bad, it is possible to store a key in the tree, but never find it again.
04:24rahcolatwhume: it seems place-tuples is just set to (ref {}) and then never updated
04:24amalloyandyfingerhut: correct, sorted-map uses a red-black binary search tree
04:24twhumeok andy - thanks very much for your help (and rahcola, amalloy!)
09:05RaynesIt's a Wednesday, people. Activate and complain about your jobs and such.
09:05Iceland_jackDamn jobs.
09:05lstollIt's almost thursday.
09:05jkdufairDamn objective c. Why can't clojure run on iOS?
09:05RaynesIt's barely Wednesday.
09:06RaynesI'm surprised nobody is working on a clj->objc compiler.
09:06RaynesOnce you start compiling to PHP, things are going downhill.
09:06rodnaphhaha https://github.com/rodnaph/clj-php
09:06rodnaph:D
09:07Raynes:p
09:07oakwisejkdufair: try clj->gambit->c?
09:07jkdufairI understood that eval is verboten on iOS. Then I find out that the framework we are using at work - Rhodes - is running an entire ruby stack on the device. Not sure how that flies
09:07rodnaphRaynes: it's just an exercise. not a real thing.
09:08RaynesI read some Objective-C code a few days ago.
09:08RaynesI had to have prescription eyedrops to get it out of my eyes.
09:08rodnaphthe inline parameter syntax is kinda nice in obj-c - that's about it tho.
09:14jkdufairi'm a big smalltalk fan, so i thought i'd be more of an objc fan, but it seems to be the bastard stepchild of smalltalk and a rusty 1957 nash rambler
09:15jkdufairclj -> gambit? how's that work?
09:17Rayneshttps://github.com/takeoutweight/clojure-scheme
09:18jkdufairhey that's pretty cool.
09:19jkdufairdo i see that rich and stuart h are working on this?
09:21TEttingerClojure on the CLR -> Mono -> MonoTouch = iPhone Clojure
09:22TEttingerjust costs... money
09:23jkdufairclj -> objc would be cool
09:23S11001001via gambit sounds less insane
09:23pjstadigjkdufair: clojure-scheme? no, it's a fork of clojurescript so it has commits from rich and stu
09:23cemerickjkdufair: doesn't look like it.
09:27jkdufairah cool
10:31dnolenCLJS users please try master when you get a chance
10:31dnolenI made quite a few changes to address direct invocation, shouldn't really make any difference to most folks - but issues sensible warnings for the edge cases.
10:33wkmanireGood morning.
10:43cemerickFor your consideration: Friend, an extensible authentication and authorization library for Clojure Ring webapps and services http://wp.me/p10OJi-d6
10:51fdaoudcemerick: excellent!
11:02weavejestercemerick: I like the use of derive and keywords for the roles in Friend
11:02cemerickweavejester: yeah, I'm *way* too happy about that :-)
11:02Raynesweavejester: What is your real first name?
11:03RaynesIf you don't mind me asking.
11:03cemerickOf course, the values in :roles can be anything, of course.
11:03weavejesterRaynes: James
11:03RaynesOh yes. I knew that. I'm not sure why I thought I didn't.
11:05weavejestercemerick: I'm a little uncertain about the workflow… when it comes to authentication/authorization, too many overly-complex libraries have left me suspicious of such things
11:06cemerickweavejester: I mostly share your reluctance. It's the thinnest thing I could come up with and still retain the sort of development experience I wanted.
11:07cemerickI'm certain things will need to be rejiggered a bit. e.g. this is a good indication that something's not quite right: https://github.com/cemerick/friend/blob/master/src/cemerick/friend/openid.clj#L82
11:07wkmanireI cannot get Technomany's swank-clojure plugin installed.
11:07wkmanire:/
11:08Raynescemerick: Add BrowserID and I'm in.
11:08cemerickRaynes: Add BrowserID and you're in. :-)
11:08RaynesI totally didn't know you were going to say that.
11:08cemerickhah
11:08wkmanirelein keeps trying to delete temp files it doesn't have rights to delete
11:08weavejestercemerick: I'm not sure I entirely understand the workflows. I mean, I can understand their purpose, but not how they work
11:09cemerickRaynes: You've already done the hard work. Bridging it to a Friend workflow should be cake.
11:09cemerickweavejester: The docs are far from comprehensive. Pepper me with questions at your convenience.
11:10cemerickI sent an ANN to ring-clojure, but I think it was auto-moderated. That might be the best forum for a proper discussion once you're ready.
11:11weavejestercemerick: Looks like there are 2 pending messages
11:12weavejestercemerick: Shall I remove one? They look like they're duplicates.
11:12cemerickweavejester: yes, please. I was worried I fat-fingered a second.
11:13RaynesMan, I do that so often.
11:13RaynesI don't even use google groups because of that crap.
11:13weavejestercemerick: Okay, done.
11:14fdaoudring-clojure?
11:14weavejesterfdaoud: The google group
11:15fdaoudweavejester: oic. thanks.
11:16weavejestercemerick: I think I understand workflows now, after reading through more carefully. I'll ask some questions on the Ring group, as I'm curious as to your reasoning on some things. There are likely scenarios I haven't thought about.
11:17jsabeaudryWhich profiler do people use with clojure? (I'm using VisualVM however I find it very rudimentary)
11:17wkmanireWell, I added a comment to the existing issue for the problem I'm having on technomancy's github account.
11:17wkmanireGuess I'll just have to wait on this one for a bit.
11:17cemerickweavejester: well, same here :-)
11:18jtoyis there a more idiomatic way to write this? (let [ json (json/parse-string line)] (if (nil? json) [] (vector ( map json ["name" "description" "id" "count"]))))
11:19jsabeaudryjtoy, if-let would help
11:19weavejestercemerick: I like :identity and :roles. But… hm… I'd have been tempted to make the workflow middleware, and add those keys to the request.
11:20jtoyjsabeaudry: ok, ill look into if-let, I've never used it
11:20cemerickweavejester: the identity is added to the request
11:21fliebeljtoy: Would select-keys help?
11:21weavejestercemerick: Oh, so… what's the reasoning for workflows not being middleware? Or are they?
11:21jtoyah cool, i was wondering if this existed in clojure
11:22mefestohey everyone
11:22Raynesmefesto: Long time no see.
11:22jtoyfliebel: would that replace the vector/map piece? I am still ltotally confused with sequence/vectors , i only got that to work from testing on the repl,
11:22mefestoRaynes: yeah work is killing me :)
11:22RaynesWe'll always have Raleigh/Durham. <3
11:23mefestotrue true
11:23mefestoi missed the last conj but plan to be at the next one
11:23fliebeljtoy: dunno, I think it would return a map, so it's just an alternative...
11:24weavejesterjtoy: Why do you need the vector part anyway? Usually a seq will do, unless you need fast indexing.
11:24Raynes(if-let [json (json/parse-string line)] (select-keys json ["name" "description" "id" "count"]) [])
11:24jtoyweavejester: I need to return the data in a vector, the other functions that use it need a vector
11:24Raynesjtoy: ^ Untested.
11:24weavejesterjtoy: Also, (vector '(1 2)) => [(1 2)]. You might want (vec '(1 2)] => [1 2]
11:25weavejesterjtoy: Are you sure they need it as a vector?
11:25cemerickweavejester: I didn't think middleware was right for authentication processing. Too much power and responsibility for the middleware author, and configuration and ordering complexity for the user.
11:26jtoyweavejester: yes, also you are right, i think i need vec
11:27weavejestercemerick: That's true… I think I'll need to look into Friend further and come back with a more thoughtful response.
11:32cemerickweavejester: That is to say, there's plenty of auth middleware about already. I don't think anyone is being particularly well-served by it. Part of my response is to take away some of the rope, build a box (one as shallow as possible), and make the rules therein very clear.
11:33cemerick(not that I've made anything as clear as it needs to be w.r.t. docs :-)
11:34weavejestercemerick: I agree with the reasoning. I'm just not completely certain about the interface yet. The idea that workflows can return responses *or* authentication maps seems a little… untyped, so to speak.
11:35jtoynm i wnt vector and not vec
11:35cemerickweavejester: my kingdom for an Option ;-)
11:36jkkramercemerick: nice work so far, appreciate the effort. I have an app with three roles: anonymous user, anonymous user with implicit account, registered user, and admin. going from anon to anon-with-account requires action but no "credentialing". Friend is flexible enough to handle that with a custom workflow, yes?
11:37cemerickweavejester: but yes, you're absolutely right. I'm not thrilled with that aspect of things, either. I've been contemplating requiring them to return a ring response with an optional authentication map therein. Still thinking.
11:37gfredericksokay so if I just have a single cljs file that I'm compiling to a single js file without any closure/cljs deps included, can goog/cljs be included as static unchanging files? and where would I get that?
11:37weavejestercemerick: Admittedly I don't have a better solution, either ;)
11:38cemerickjkkramer: Certainly. That workflow would be a function that creates the placeholder account and returns the corresponding authentication map.
11:39cemerickjkkramer: That's actually exactly how most anyone would use the openid workflow, since logging in for the first time generally registers you with the app at the same time. With openid, it's the credential function that would do the work.
11:39jkkramerok, cool
11:40gfredericksCurrently using this to compile from maven: https://refheap.com/paste/2004
11:40jkkramercemerick: any plans to make password reset flows easier? that's another thing i've re-invented several times for different apps -- generate reset token, email user with special url, expire the token after a while, etc.
11:40RaynesYay! Over 2000 pastes
11:41RaynesBeen getting a lot of pastes from rubeque lately.
11:42cemerickjkkramer: Not at present. Sounds like a good companion library though, for someone that knows how that sort of thing should work :-)
11:45antares_I am trying to implement clojure.core.cache for Monger and getting "CacheProtocol" is not a protocol from the compiler. What am I doing wrong? https://gist.github.com/48422a63cbbec00a1e0e
11:45antares_java.lang.IllegalArgumentException: interface clojure.core.cache.CacheProtocol is not a protocol
11:46Na-Fiannhi, I'm trying to learn clojure by doing the 4clojure.com exercises. However, at exercise 21, I get an error message from the website, where it works fine for me. the Error is "You tripped the alarm! nth is bad!". However, I'm not using nth (the objective is to implement that function). Any idea why the following might trip the alarm? http://pastebin.com/fFrDy9j8
11:47Raynes4clojure macroexpands its input. I'm guessing letfn expands into code that uses nth.
11:47RaynesHrm, or not.
11:48RaynesOh, destructuring.
11:48RaynesYeah, that's probably what is causing it.
11:48ngwhi *
11:48Na-Fiannahh
11:48Na-Fiannhm
11:49ngwI'm using korma for my SQL, does the library give a way to validate data?
11:49Na-Fianndammit, that was my favorite bit here -_-
11:49RaynesSometimes this happens for the silliest of reasons, but there aren't easy ways to prevent form happening. The usual recommendation is to try writing it in a slightly different way.
11:50jkkramerantares_: you need to import CacheProtocol -- (:import [clojure.core.cache CacheProtocol])
11:50ngwwhat I'm not able to understand is where does Korma sits: does it only generates the SQL or is it, to say, "for models"?
11:50ngwbecause I can as well build functions to validate for example an email format
11:51ngwbut I don't know if that's the right idiomatic way
11:52Na-FiannRaynes, yeah that was the problem. Thanks
11:52RaynesNa-Fiann: Sorry it had to happen in the first place. :|
11:52antares_jkkramer: I did and it does not help. Updated gist: https://gist.github.com/48422a63cbbec00a1e0e
11:53antares_ngw: I believe there's noir.validation. And https://github.com/michaelklishin/validateur/, a standalone library.
11:54jkkramerantares_: does changing clojure.core.cache.CacheProtocol to just CacheProtocol in your extend-protocol call help?
11:55antares_jkkramer: I tried imported value initially, I believe it does not
11:55ngwoh nice
11:55ngwthank you antares_
11:58ngwwow, it's pretty cool
11:59ngwsearching for validation at the db layer was probably some rails brain damage, thank you *
11:59jkkramerantares_: how about cache/CacheProtocol (and remove the :import line)? I believe clojure creates an interface with the same name as the protocol. interfaces are imported, but protocols can be got via :require/:use…I think
12:00antares_ngw: there's nothing wrong with validation at the db layer. Validateur is mostly used in that setting. noir.validation maybe be different.
12:00antares_jkkramer: sigh, you are right
12:01jkkramerclojure.core.cache.CacheProtocol = interface, clojure.core.cache/CacheProtocol = protocol
12:01antares_jkkramer: right
12:08antares_jkkramer: thank you very much, several tests already pass.
12:25fliebelWhat would be a neat way to organize a lot of parameters from a gui into one function? I started adding a few, and the if statements are already getting out of hand. I think I need some higher order magic.
12:28fliebelI'm reading data from an oscilloscope, but with 2 channels and a lot of modes, the acquisition gets a little out of hand.
12:32hiredmanfliebel: rules engine
12:32fliebel$google rules engine
12:32lazybot[Business rules engine - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Business_rules_engine
12:35fliebelhiredman: Anything particular? It seems swats of if statements is also a rules engine.
12:36RickInGAdnolen: I just saw on twitter that you have heard that a cljs book is in the works... have any more info?
12:36dnolenRickInGA: nope heard that from cemerick
12:37hiredmanfliebel: really, what makes you say that?
12:37cemerickRickInGA: it's a well-known secret at this point, I think.
12:37fliebelhiredman: The above link "The first class processes so-called production/inference rules. These types of rules are used to represent behaviors of the type IF condition THEN action"
12:38RickInGAdnolen: ok, thanks. Is there a good way to start with CLJS for people that need a bit of hand holding? I have peeked at cljs a few times, and just not known where to start
12:39dnolenRickInGA: ClojureScript is just Clojure sans concurrency stuff - I recommend using lein-cljsbuild.
12:42RickInGAdnolen: cemerick: thanks
13:06autodidaktotechnomancy: Do both lein 1.x and lein 2.x project.clj files use the same syntax for dev dependencies?
13:07autodidaktoThat is, ":profiles {:dev {:plugins [" ?
13:09dnolenJS-centric but still interesting w/ respect to CLJS - http://www.meteor.com/main
13:10autodidaktoer. i'm trying to straighten out the use of dev-dependencies/plugins on a project basis
13:13RickInGAdnolen: that is pretty cool
13:14dnolenRickInGA: yeah, caching DB data on clients and supporting queries is the future. I'd rather use Datomic Datalog queries over MongoDB tho.
13:14jaenI see reactive interface is pretty big nowadays ; d
13:15dnolenMeteor client packages are neat, but we already have that with lein
13:16RickInGAibdknox has a cljs template that recompiles when you save a file, noir does the same.
13:16RickInGAdon't know about wiring into the database
13:17dnolenRickInGA: it's not the direct wiring into the database that is interesting - just caching + queries.
13:17dnolenclearly any real solution needs to deal with privileges
13:21RickInGAdnolen was your talk at jsconf recorded?
13:23dnolenRickInGA: yes
13:27technomancyautodidakto: plugins don't need to go in profiles
13:27technomancythey can just be at the top-level of defproject since they aren't transitive
13:27autodidaktorephrase: Should lein plug... err
13:27autodidaktohmm
13:27technomancy:dependencies inside the :dev profile are just for things that need to run inside the project
13:28autodidaktoOk. So I have a plugin that I want for my project, i open up my project.clj..
13:28autodidaktoand do I use -> :dev-depencies, or {:dev {:plugins ?
13:28autodidaktoor :profile {:dev {:plugins ?
13:29technomancy:plugins [[lein-whatevs "0.1.0"]]
13:29autodidaktolein 1.x and 2.x, same?
13:30technomancyyes, unless you need 1.6 or older
13:30technomancy:plugins is new in 1.7
13:30autodidaktogotcha...
13:30autodidaktoworking on the lein-ritz README... i think they confused the instructions
13:30autodidakto2.x, they use "{:dev {:plugins" and 1.x they use ":dev-dependencies"
13:31technomancyboo
13:32autodidaktoheh. Both should be (defproject ... :plugins [[...]] then..
13:32technomancyyeah, that's basically why 1.7 was released =)
13:32technomancyto get :plugins support into the 1.x branch
13:33autodidaktoperfect. Thanks :)
13:33autodidaktoBtw, do you have any opinion about lein-ritz (swank-clojure replacement that adds debugging, i think) ?
13:33technomancyI haven't tried it myself, but I like the idea.
13:34autodidaktoWas talking to the author. He said that it has come a long way. I offered to help cleanup the readme
13:35technomancyin the long run I would like to see a shift towards nrepl
13:35autodidaktodoes nrepl do debugging?
13:36wkmaniretechnomancy: Hey, I added a comment to an issue a windows user reported for your clojure-swank plugin.
13:36wkmanireI've been trying to install it on a windows box.
13:37technomancyautodidakto: not yet, but I think it's more productive to focus on a single backend
13:37hugodautodidakto: the instructions for 2.x refer to the .lein/profiles.clj file, that provides a cross project way of using lein-ritz
13:37wkmanireThat user was able to re-run the install command for the plugin after the first time it failed, and the second time it worked. I haven't had the same success.
13:37technomancyautodidakto: oh yeah, for something like lein-ritz you shouldn't put it in project.clj anyway; my bad
13:37cpineraHi there! Newbie question: anyone has experience configuring emacs/slime for CL & Clojure? I'm interested in learning Clojure, but I'm afraid I'll have to re-install slime and re-configure my emacs setup from the ground up.
13:38hugodautodidakto: adding lein-ritz, a development tool, to your project.clj is perhaps not the nicest thing to do
13:38technomancywkmanire: hmm... I don't really know much about Windows, but it sounds like you have permissions issues; maybe you were using Leiningen as another user?
13:38yoklovtechnomancy: a shift to nrepl over slime?
13:38technomancyyoklov: some day
13:38wkmaniretechnomancy: I'm runing it as administrator from the console.
13:38wkmanireWindows attempt at a terminal emulator.
13:39wkmanireWindows'*
13:39wkmanirerunning*, wow, I need to focus.
13:39yoklovi wasn't aware nrepl could offer that level of interactivity
13:39technomancywkmanire: I don't understand, shouldn't administrator have permissions to do anything?
13:39wkmanireYeah, it should.
13:39technomancyyoklov: it doesn't yet; it's got a long way to go
13:39yoklovi see.
13:40wkmaniretechnomancy: Is there a way I can manually complete the installation process from where it died?
13:40wkmanireI really want to get the REPL running in an emacs buffer.
13:40technomancywkmanire: you could check out swank-clojure 1.4.4, run "lein uberjar", and copy the uberjar into your plugins dir
13:41wkmaniretechnomancy: Already cloned swank-clojure, I'll give uberjar a shot.
13:41technomancywkmanire: or you could use inferior-lisp
13:42technomancyM-x run-lisp in a clojure-mode buffer
13:42wkmaniretechnomancy: Would that be the same thing?
13:43technomancyno, it's a simplified version
13:43technomancybut if all you want is a repl in an emacs buffer, that's it
13:43autodidaktohugod: Nonetheless, the readme does offer those (broken) instructions to add it to your project.clj ... but since you both agree, I will remove those instructions from the readme entirely
13:44wkmaniretechnomancy: I bought cemerick's book and am trying to get my tooling set up the way most folks do it for wokring out of emacs.
13:44wkmanireI'll give the uberjar approach a try first.
13:44wkmanireworking*
13:44technomancyunfortunately windows is pretty different from the way most folks work
13:45wkmaniretechnomancy: Trust me, I'd much rather be doing this from my Linux box.
13:46autodidaktosorry, disconnect... wkmanire: don't let tooling slow you down for now. you'll figure it out as you go along. make progress in the book :)
13:47technomancyM-x run-lisp is definitely the simplest way to go
13:47wkmanireok.
13:48wkmanireWell, I think I build from the master branch because it created swank-clojure-1.5.0-SNAPSHOT.jar
13:48wkmanireI'll try to run-lisp approach now.
13:49autodidakthugod: I'll remove the project.clj instructions, then?
13:50wkmanireYeah, instant success.
13:50wkmaniretechnomancy: If you would like me to do anything to help you troubleshoot this installation issue on windows feel free to contact me on github.
13:51hugodautodidakt: makes sense to me
13:51wkmanireI would eventually prefer to do this the "right" way.
13:51technomancywkmanire: sorry, I wouldn't know where to start
13:52twhumeI'm having trouble with max-key, probably betraying a fundamental misunderstanding. If I do
13:52twhume(def fl (list (magicInk.Global.feedback. "A" 2), (magicInk.Global.feedback. "B" 1)))
13:53twhume(max-key :modifier fl)
13:53twhume… why do I get (#magicInk.Global.feedback{:objname "A", :modifier 2} #magicInk.Global.feedback{:objname "B", :modifier 1}) returned and not a single item (#magicInk.Global.feedback{:objname "A", :modifier 2}) ?
13:55twhumeIs it something to do with passing a list of records into max-key…?
13:55ibdknoxdnolen: RickInGA: meteor is relatively straightforward to build in clj/cljs
13:56RickInGAibdknox: I was thinking after some of the stuff you had built, it couldn't be that far away
13:56ibdknoxdnolen: I built some of the basics of it already, though didn't continue with it. The problem with such a system is that the code has to exist in both contexts, and that usually has very real consequences.
13:56ibdknoxI also don't really understand the value of having an api to the database directly
13:56ibdknoxseems like a disaster waiting to happen
13:57RickInGAibdknox: yeah, probably. Still looked cool :)
13:57ibdknoxthe coolest part for me was their reactivity implementation
13:57ibdknoxwhich is also the easiest to reimplement
13:57ibdknox:)
13:58RickInGAreactivity = pushing changes to the clients?
13:58ibdknoxthe code automatically knowing what things might cause a fragment to change
13:59ibdknoxno meta data needed to explain the bindings
13:59ibdknoxit just happens
13:59RickInGAah, yeah, that is neat
14:01ibdknoxI have a little library that haven't pushed anywhere
14:02ibdknoxcalled bridge that is the first part of their dev experience: a pluggable way to send random assets/messages to the client as soon as they're available
14:02ibdknoxI was using it for auto CSS loading on save
14:02Raynesibdknox: You have a little library for everything.
14:03ibdknoxRaynes: maybe. :p
14:03autodidakthugod: I've spent the last hour or two pouring over the install instructions, fighting with words, struggling for clarity... Check it out and confirm that I'm on the right path
14:03autodidakthttps://github.com/autodidakto/ritz/blob/develop/README.md
14:03RickInGAjcrossley: I want to get a user group started. any ideas for good meeting places?
14:03fdaoudgo fetch a crate, then do a waltz, jayq! you'll have better korma and won't be left in the noir.
14:03ibdknoxlol
14:04autodidaktRickInGA: lady's night at chippendales
14:05RickInGAjcrossley3: just saw I typed your name wrong...
14:05jcrossley3RickInGA: ?
14:05mkjcrossley3: it was missing a 3
14:06mk(and so might not have triggered your irc notify)
14:06jcrossley3ah, i c now
14:06RickInGAjcrossley3: I said that I wanted to start a user group and wondered if you had any ideas where we could host it. Then it occured to me that you might not have been alerted
14:07jcrossley3RickInGA: i don't know of a place offhand, but i can ask around
14:09RickInGAjcrossley3: thinking about finding a coffee shop easy access from interstates, and make finding a better space an agenda item
14:10jcrossley3RickInGA: good idea
14:1218WAARKKYAgg. sorry for the nick change spam. I hate freenode.. or maybe it's my client. oh well
14:16troessnerguys, my current company is hosting a party for some bright, young, err, programming talents. i am trying to come up with a task they can use to hack on. since i'd also like to learn something, i am thinking of something practical in clojure
14:16troessneris there anything that comes to your mind that you are missing in clojure?
14:16troessnersome small libraries maybe that you love from other languages?
14:16troessnershould be something that's doable in 2 - 3 days
14:17jsabeaudrytroessner, what I'd like is to be able to call ioctl from clojure
14:17Iceland_jack“A type system”
14:17ibdknoxlol
14:1718WAARKKYIceland_jack: turing complete?
14:17troessner:-)
14:17Iceland_jack18WAARKKY: I would insist
14:17mktroessner: merely providing bindings to an existing java lib might not be too fun
14:18S11001001troessner: bug tracker for dogfooding, good enough for dogfood
14:18jsabeaudryI just found out that (mod i 8) won't be optimized as (bit-and i 7) :(
14:18mktroessner: this is probably not something many people will use at all, but I've been curious about how opengl might be used with clojure
14:18troessnerjsabeaudry, i think that's way to complex for some 19 years old with no experience in clojure
14:19troessnerS11001001, should be something that they feel is valued by the community.....
14:19S11001001troessner: community of programmers, or who?
14:19ibdknoxmk: ztellman has a lib for opengl https://github.com/ztellman/penumbra
14:20troessnerS11001001, the clojure community
14:20troessnerS11001001, i come from ruby / python - my first thought was something along "fix some bugs in rails"
14:20mktroessner: you might look at the gsoc proposals for some ideas
14:20troessnerbut i want to learn something too
14:21troessnerand i don't know much about clojure or lisp for that matter
14:21mkibdknox: interesting, thanks
14:21ibdknoxtroessner: if you're new, I wouldn't worry about building something useful - just build something fun :)
14:22troessneribdknox, true, but i don't want them to do something like the x-th draft for a web framework
14:23troessnersomething that requires you to grasp basic languae concepts
14:23troessnerand is usefull at the same time
14:23troessnerwould be perfect
14:23jsabeaudrytroessner, do your young programming talents have experience with something in particular?
14:23troessnerjsabeaudry, unfortunately that varies - the first one in java, the second one in haskell, the third one in JS and python
14:24mktroessner: the last few mini-projects I saw linked in here included a roguelike game, and a game-of-life like simulation. Seeing people do fun things in clojure is good publicity
14:24technomancy"something useful" is probably too ambitious for getting started.
14:25gtoastIs there a function to lazily join to sequences together, so after seq A is exhausted elements come from seq B?
14:25troessnertechnomancy, hmm, good point
14:25yoklovclojure's surprisingly great for making games
14:25mkit can also be boring, unless you yourself feel the frustration caused by not having this useful thing
14:25yoklovsomething which is usually a pain in functional languages
14:25raekgtoast: concat and lazy-cat
14:25gtoastraek: thanks
14:2518WAARKKYraek: if i ever make a podcast/book/website for clojure, it's so going to be called "lazy-cat"
14:25troessnermk, yoklov, technomancy hmmm, i like the idea of a game
14:26mkboth of those examples I mentioned were written by yoklov
14:2618WAARKKYyoklov: text based? swing?
14:26raekgtoast: concat calls seq on its arguments though (allows you to pass seqable things like arrays and vectors)
14:26ibdknoxthere's some source code for pong on my github
14:26raeklazy-cat is fully lazy
14:26yoklov18WAARKKY, swing, as text based ends up being being a hassle with java
14:2618WAARKKYibdknox: i'm there
14:26mkyoklov: can you link the demo of the roguelike, and the hex thing?
14:26ibdknoxit's not finished
14:2618WAARKKYyoklov: I've been toying with the idea of a text game... hassle in java? do explain
14:27ibdknoxand probably sucks compared to what I would do now... but it does work :)
14:27yoklovroguelike game: http://thomcc.github.com/dunjeon/ cellular automata: http://thomcc.github.com/hex/
14:28yoklov18WAARKKY, i just mean console output can be weird, you have to use lein trampoline to get stdin to work right, i don't know. swing's cleaner
14:28yoklov(hex is in clojurescript)
14:29ibdknoxthe code I mentioned: https://github.com/ibdknox/clojure-pong
14:29mkyoklov: I see you ported the roguelike to cljs. No diagonal movement keys?
14:29yoklovmk: nah. I don't really have a good reason for why not, to be honest.
14:30ibdknoxtroessner: oh right, I also built the live game editor... lol
14:30ibdknoxforgot about that
14:30ibdknoxthat has all the code needed for something mario-esque
14:30mkyoklov: I think I just saw two monsters merge into one
14:31yoklovmk: you did. that can happen if they have the same health and occupy the same position. its a fairly rough-around-the-edges game.
14:31ibdknoxtroessner: which might also help if you want to just get people started quickly - no setup required. http://www.chris-granger.com/2012/02/26/connecting-to-your-creation/
14:3118WAARKKYyoklov: how is it that fp is good for games? summarize!
14:3218WAARKKYibdknox: Build a functioning game in your editor? heh. And i thought it was jsut a demo..
14:32ibdknoxoh no
14:33ibdknoxit's not vaporware
14:33ibdknoxthat actually works
14:33ibdknoxlol
14:33yoklov18WAARKKY, fp usually isn't, but clojure makes it nice. immutability is a boon because you don't have to worry about getting into an inconsistent state and stuff, i don't know.
14:33mk18WAARKKY: clojure isn't so strict with fp that it lacks the various state-changing things that make things difficult
14:33ibdknoxI definitely wouldn't say it's easier to write it in Clojure though
14:33ibdknoxhaving done both a few times now
14:33ibdknoxwith the same games
14:3418WAARKKYmk: ahh. was about to mention "functional reactive programming"
14:34yoklov18WAARKKY, look at the source for dunjeon and see if things like that appeal to you: https://github.com/thomcc/dunjeon/blob/master/src/dunjeon/core.clj
14:34yoklovFRP is, in my experience, too slow to be useful.
14:3418WAARKKYyoklov: Thanks, I'll check it out
14:3518WAARKKYibdknox: not easier? explain :)
14:36yoklovit's short. essentially being able to structure your code as a bunch of transformations over data structures is neat. tick is essentially: (-> game-state (tick-player input) autoheal tick-monsters update-vision)
14:37ibdknoxthings like update are complicated a bit by not being able to update in place
14:37ibdknoxdoing it *did* affect the way I write games in other languages now though
14:37mkibdknox: update in place?
14:37troessneribdknox, that looks interesting, thanks! i'll look into that
14:37ibdknoxI think much more about behaviors
14:39ibdknoxmk: yeah, if (-> ...) is your only real way to chain a series of mutations, you can't do relatively simple things like (if x (cool x) (zomg x)) without reworking things a bit, or constantly evaluating the conditionals in different places
14:40ibdknoxin most programs you can get away with that because truly not that many things are mutable
14:40ibdknoxbut in a game..
14:40ibdknoxeverything is mustable
14:40ibdknoxmutable*
14:40ibdknoxotherwise you have a very boring game :)
14:40fdaoudtroessner: other ideas for games: http://landoflisp.com/source.html
14:41mkibdknox: how do you end up reworking things?
14:41ibdknoxhiding conditionals in functions is what I ended up doing
14:42ChousukeI don't think there's anything inherently mutable about a game
14:42yoklovibdknox: yeah, the fact that (->) is a macro is sometimes annoying, as it means it doesnt work well with ifs and whatnot
14:42Chousukebut it's hard to make efficient without mutation
14:42ibdknoxfwiw, the last time I wrote a little example game for someone, I did it in JS directly and found it much easier
14:42ibdknoxChousuke: sure, I went down that route too and it was disgusting to write any real game logic :(
14:43Chousukeyou'd probably need logic programming to go with it :P
14:43yoklovChousuke, have you written many games? they are sort of inherently stateful
14:43Chousukeyoklov: in practice I guess. :P
14:43technomancyyoklov: state can be tracked on the stack without mutable state
14:44technomancyout of the tarpit, etc
14:44yoklovtechnomancy, yeah, and thats what i've ended up doing when making games in clojure
14:44yoklovbut its a bit
14:44yoklovawkward. much better in clojure than in, say, haskell
14:45yoklovwhere it just ends in cursing
14:46Chousukewhat was that proof of concept where you could alter parameters of the game engine and replay your actions? that was cool
14:46Chousukebut it's probably too slow to be of much use in a real game :(
14:48yoklovChousuke, are you talking about http://www.chris-granger.com/2012/02/26/connecting-to-your-creation/ ?
14:48Chousukeyeah, that one
14:49yoklovit's extremely neat
14:49yoklovits a little slow but very fast for clojurescript code
14:50Chousukethat would be awesome in a roguelike :
14:50Chousukeyou could do time travel
14:50Chousukeand then cause all sorts of weird things to happen
14:51yoklovsomething like time travel is probably a good example of something which would be easier to implement in a functional language than in an imperative one
14:51nlewbest selling point for functional programming I've ever heard
14:52Chousukeor you could recover from game engine crashes by just rolling back to the previous state (while preparing a bug raport from the faulty state)
14:52aperiodicit would be cool to see a braid clone written in clojure
14:52Chousukereport*
14:52aperiodici imagine that doing all the time manipulation in that game would be easier than in an imperative language
14:54yoklovbut slower, and braid had it work so smoothly
14:54ibdknoxthe latest versions of CLJS should dramatically improve the speed there
14:58yoklovyeah, maps are still slow though :(
14:58ibdknoxnot too much longer :)
14:58yoklovno?
14:58clojurebotno is tufflax: there was a question somewhere in there, the answer
14:58ibdknoxsomeone has a persistentHashMap impl somewhere
14:59yoklovoh, the javascript one?
14:59yoklovor in cljs
14:59ibdknoxCLJS
14:59ibdknoxpersistent vectors made it in
15:00ibdknoxand I remember a tweet saying hashmaps weren't far behind
15:01cpineraWhat is the difference between defn and defn- ?
15:01mefestocpinera: defn- is private to the namespace
15:02cpineramefesto: got it. Thanks!
15:03yoklovibdknox: neat. then all thats left are chunked seqs and transients
15:06cpinerasorry for these very basic questions. What does the @ symbol mean when it's prepended to a variable that is being passed to a function?
15:07S11001001cpinera: @anything = (deref anything)
15:07cpineraS11001001: perfect. Thanks!
15:07S11001001deref is a function
15:09cpineraS11001001: Am I ok to assume that I'll need to deref most anything I send to java methods, since they can most surely have side-effects?
15:09S11001001deref is a function that operates on IDerefs, and has little to do with purity
15:10S11001001incidentally, you can look for sugar using quotes
15:10S11001001&'@anything
15:10lazybot⇒ (clojure.core/deref anything)
15:10S11001001&'`(list ~a ~b ~c)
15:10lazybot⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/list)) (clojure.core/list a) (clojure.core/list b) (clojure.core/list c)))
15:11yoklovand then once you know the name of the function
15:11yoklov(doc deref) can help you lots
15:11yoklov(in your repl)
15:11clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
15:12cpineraGot it. Thanks for the explanation and the link!
15:40Cr8gah, maybe my attempts to learn emacs would be going better if I didn't have a keyboard with blank keys.
15:4218WAARKKYCr8: we put a hardware Qwerty->Dvorak adapter on your keyboard cable as a joke
15:42Cr8if they make those, i am buying one, and doing that to somebody
15:4218WAARKKYhehe they do
15:43Cr8they do
15:43Cr8alright
15:43Cr8fff
15:43Cr8expensive
15:4318WAARKKYthe joke would be priceless.... or at least, if you do it enough times it will be worth it
15:4818WAARKKYahh yes. perfect
15:48fliebelI hope neotyk read that... hm, he isn't even on.
15:4918WAARKKYspread the news
15:5718WAARKKYWe'll all done it from time to time.... to time...to time...
15:5718WAARKKY*We've
16:06RickInGAsamaaron: I am using your live config, but it doesn't give me paredit or syntax highlighting when I am editing a cljs file. Is that normal?
16:09mrb_bkdnolen: have you checked out "lisp in small pieces"
16:10dnolenmrb_bk: I have a copy but only read the first few pages - looks amazing. I want to finished Dan Friedman et al's Essentials of Programming Languages first.
16:11mrb_bkdnolen: ah yeah, that's on my list too
16:11mrb_bkbeen specifically curious about a book about implementing lisps in a non-lisp
16:12rads dnolen: I saw your tweet: "I'd be more excited about Meteor if I hadn't seen most of that stuff working in ClojureScript already." what stuff are you talking about exactly? running code in the browser?
16:14ibdknoxrads: it wouldn't take much to make the best parts of meteor in clj/cljs
16:14dnolenrads: there wasn't anything significant in the demo that you can't do in Clojure/ClojureScript or Clojure/ClojureScript libraries etc.
16:15wei_is there such thing as "map" with a state threaded through?
16:15radsI see. it sounded like there was something already out there I could take a look at
16:16ibdknoxrads: if I get antsy enough, maybe there will be ;)
16:17Bronsawei_: reduce+atom?
16:17ibdknoxwei_: I'm not sure I understand the question
16:20wei_hm, let me try to rephrase
16:20amalloyreductions or reduce are both sufficient. using an atom as part of a reduce is probably a crime
16:21ibdknoxyeah that's scary lol
16:21wei_yeah, I probably don't need an atom since the state is localized to the map
16:22emezeskeBronsa: ,(reduce (fn [[state result] item] [(inc state) (conj result (+ state item))]) [0 []] [1 2 3 4 5])
16:22ibdknoxjust reduce then
16:22Bronsaoic
16:22radsibdknox: I'll be watching. the reactive part of the API confuses me right now
16:22amalloyBronsa: ##(reduce (fn [[state result] item] [(inc state) (conj result (+ state item))]) [0 []] [1 2 3 4 5])
16:22lazybot⇒ [5 [1 3 5 7 9]]
16:22ibdknoxrads: oh, why? I thought that was the most interesting part lol
16:22amalloypersonally i prefer (map second (reductions ...))
16:23radsibdknox: I just dont' understand how it works behind the scenes very well
16:23ibdknoxrads: it's pretty clever
16:23radsit's very interesting
16:23emezeskeOoh, reductions, veery interesting
16:23wei_ok. i think that'll do what I want- thanks!
16:23wei_for completeness, why is reduce + atom scary
16:24emezeskewei_: That introduces mutability where it's not required.
16:24amalloy&(map first (reductions (fn [[prev state] item] [(+ state item) (inc state)]) [nil 0] [1 2 3 4 5]))
16:24radsI've tried to read up on functional reactive programming before but the literature was a bit over my head at the time
16:24Bronsabecause now that i notice, it'd be useless.
16:24lazybot⇒ (nil 1 3 5 7 9)
16:24radsit seems there aren't a lot of solid implementations around
16:25ibdknoxrads: their implementation is actually only like 50 lines I think, fwiw
16:25radsI saw the link from the documentation. I'll have to read it more closely
16:26amalloyor really, just write it by hand: ##((fn step [[x & xs] state] (lazy-seq (when x (cons (+ x state) (step xs (inc state)))))) [1 2 3 4 5] 0)
16:26lazybot⇒ (1 3 5 7 9)
16:27ibdknoxI don't use lazy seqs enough
16:27amalloyibdknox: i <3 lazy-loop (from useful) as a nicer way to write a lot of lazy-seqs
16:28amalloy(lazy-loop [[x & xs] [1 2 3 4 5], state 0] (when x (cons (+ state x) (lazy-recur xs (inc state)))))
16:28Bronsahttps://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L105-119
16:28amalloymacroexpands to the above lazy-seq
16:28wei_wow, there's so many ways to do this
16:29wei_i think I like the reductions version best since it's more succinct
16:29ibdknoxvery cool
16:38yoklovwow, there are some uh, pretty useful functions there
16:38RaynesDamn it.
16:38yoklovi'd have a million uses for take-shuffled
16:38Raynesamalloy: I concede. I'm just going to like useful from now on and not complain about it.
16:38amalloyhaha i'm glad someone wants take-shuffled. i wrote it because it was an interesting function to write; i'm not sure i've ever needed it
16:39yoklovi usually just do (take n (shuffle coll))
16:39aperiodicsamaaron: tried my kinect thing with the quil 1.0.0 release this morning... no luck :(
16:39yoklovbut the laziness could definitely be beneficial
17:01RickInGAI am trying to use an html canvas from clojurescript. I am trying to copy a piece of this example: http://nakkaya.com/2012/01/31/clojurescript-canvas-a-simple-breakout-implementation/
17:02RickInGAMy code is this, and it doesn't seem to do anything: https://refheap.com/paste/2012
17:03yoklovRickInGA, any errors on the page?
17:03RickInGAyoklov none that I am aware of, not sure how to check
17:03RickInGAI am using Chrome, not sure how to open console
17:04yoklovin chrome, right click -> inspect element
17:04yoklovthen the console tab
17:04yoklovalso, dom/getElement means you need an ns form with (:require [goog.dom :as dom])
17:05RickInGAah, I have an uncaught error, no protocol mehtod iSequable.seq defined
17:05yoklovhm
17:06yoklovgo to your scripts tab, click the little stop sign at the bottom until it turns purple, and refresh the page (without closing the inspector)
17:06RickInGAyoklov I was concerned about that, because the cljs github page had get-element, which I do have working appending to "content"… but I have not found a combination of capitalization and dashes to work for my canvas
17:06yoklovdoes your canvas have <canvas id="surface"></canvas>
17:06yokloverr look like
17:07yoklovand try (.getElementById js/document "surface")
17:07RickInGA<canvas height="500" id="surface" width="500">
17:07yoklovokay, thats good
17:08RickInGAyoklov: change (dom/getElement to (.getElementByID ?
17:08yoklovyes
17:08RickInGAlose the dom/ ?
17:09yoklovmhm, (.getElementById js/document "surface")
17:09RickInGAUncaught Error: No protocol method ISeqable.-seq defined for type function: function () {
17:09RickInGA var a = "surface".getElementByID();
17:09yoklovthats what (dom/getElement) does, in all likelihod
17:09RickInGA return cljs.core.Vector.fromArray([a.getContext("2d"), a.width, a.height])
17:09RickInGA}
17:09yoklovokay, look in the right hand side
17:09yoklovunder locals
17:09yoklovsee what "a" is
17:09yokloverr scope variables > locals
17:10yoklovit should be a canvas element type of some sort
17:11RickInGAin scope variables it just says not paused
17:11yoklovoh actually
17:11yoklovno i see whats wrong
17:11RickInGAah, found pause… progress :)
17:11yoklovyou're doing (.getElementById "surface")
17:11yoklovyou want
17:11yoklov(.getElementById js/document "surface")
17:13RickInGAyoklov same error
17:13yoklovhm
17:13yoklovoh
17:13yoklovhaha
17:13yoklov(fill-rect surface [0 0 10 10] [255 255 255]) should be (fill-rect (surface) [0 0 10 10] [255 255 255])
17:14RickInGAduh, yeah, thanks
17:14yoklovand then everything else you had before should work.
17:18kjellskiis there anything I can do about the emacs elpa install of swank-clojure is failing in emacs with the output of "File exists: /Users/me/.emacs.d/elpa/clojure-mode-1.7.1/clojure-mode.el
17:18RickInGAyoklov: not yet, but thanks for the help
17:19yoklovRickInGA, what's wrong now?
17:20RickInGAyoklov: same error.
17:20yoklovkjellski, i don't think you need swank-clojure anymore
17:21RickInGAyoklov ok, new error :)
17:21yoklovoh?
17:21senthilare Vectors equivalent to Array in Ruby?
17:21RickInGAcannot call method 'call' of undefined
17:21yoklovsomething is nil which you're using as a function
17:21yoklovsenthil, more or less, but vectors are immutable
17:22jtoyso does clojure have libraries that allow for async program?
17:22senthilyoklov: like most other data types right?
17:22yoklovyeah, all of clojures datatypes are immutable
17:22kjellskiyoklov, I was just following the instructions on dev.clojure.org ...
17:22jtoyi mean evented programming, sorry
17:22senthilyoklov: nice, thx!
17:23yoklovkjellski, you should only need clojure-mode
17:23yoklovand then
17:23jtoyi want to write a small daemon to do url unrolling, and i want to use one small daemon to do it
17:23yoklovclojure-jack-in
17:23technomancykjellski: where are these instructions? they are really out of date
17:23kjellskiyoklov, I tried that, but somehow emacs doesn't know anything about the jack-in stuff....
17:24kjellskitechnomancy, http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
17:24technomancykjellski: the version of clojure-mode you have is from 2010
17:24jtoyor does clojure have a green threads library?
17:24kjellskitechnomancy, so what would you suggest? try to reinstall it through elpa?
17:24yoklovjtoy: you probably want to look into agents
17:24technomancykjellski: no, get rid of elpa entirely
17:24senthil"user=> (vector 1 2 3) == [1 2 3]" => "#<core$_EQ__EQ_ clojure.core$_EQ__EQ_@73325573>"
17:25technomancyelpa is deprecated; it has an ancient version of clojure-mode
17:25senthili thought "==" would return true/false
17:25kjellskitechnomancy, whohoooo ^^ and how do I get started then?
17:25technomancykjellski: you can get clojure-mode either from git or marmalade
17:25RickInGAyoklov I think the example I am using just has too many moving parts. can you point me to an example that draws anything at all onto a canvas. I just want to know how to address it
17:25yoklovsenthil, you want (== (vector 1 2 3) [1 2 3])
17:25yoklovbut
17:25yoklovthat will still be wrong
17:25yoklovbecause == is for numbers
17:25senthilyoklov: err, right
17:26yoklov,(= (vector 1 2 3) [1 2 3])
17:26clojurebottrue
17:26kjellskitechnomancy, thanks!
17:26technomancykjellski: where did you see elpa mentioned?
17:26yoklovRickInGA, not really, do you have any experience with javascript?
17:26technomancyit shouldn't be in any of the official docs
17:26senthil,(== 1 1)
17:26clojurebottrue
17:26jtoyagents look like its for aysnc state change, can i use it for async io ? ALA node.js ?
17:26kjellskitechnomancy, nowhere… just tried it the "easy way..."
17:26technomancyoh, ok; cool
17:27yoklovjtoy: i don't know, sorry
17:27technomancyI've asked the elpa maintainer many times to put up a deprecation notice; no dice so far =(
17:27RickInGAyoklov some, but none with canvas. I am trying to read a book about canvas but executing in cljs.
17:29RickInGAare there any guidelines for translating from js to cljs?
17:29senthilyoklov: the diff. between = and == being latter only cares if values (not type) are the same?
17:30yoklovsenthil, == is for numbers
17:30yoklov,[(= 3 3.0) (== 3 3.0)]
17:30clojurebot[false true]
17:30senthilyoklov: ah
17:31mk== has nothing to do with the java == or the js ===
17:31autodidaktomk: what about the ruby <=>
17:31autodidaktoall your base are belong to the spaceship operator!
17:31senthilyoklov: got it, thx again
17:33mkautodidakto: that's (compare)
17:33mk,(compare 9 3)
17:33clojurebot1
17:33jtoy,(1)
17:33clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
17:33autodidakto,1
17:33clojurebot1
17:33autodidakto,'(1)
17:33clojurebot(1)
17:33mk,(int 1)
17:33clojurebot1
17:34RickInGAyoklov: thanks for the extensive help… I have to go
17:34autodidaktojtoy: though shalt quote they list when used as data
17:34autodidakto*thy list
17:34autodidakto,(+ 0 #_(+ 1 1))
17:34clojurebot0
17:35mkjtoy: 1 is not a function that evaluates to itself
17:35jtoyyeah, oops
17:35autodidakto,[1]
17:35clojurebot[1]
17:36autodidaktomk: common mishap in lisp, and i think it would be even easier to make in clojure because you get use to not having to quote [] and {}
17:36mkhmm, vectors complect efficiency/implementation with ... executability
17:38autodidaktoexecutability? i thought lists were that
17:38mkautodidakto: they are
17:38autodidaktothen you mean lists, not vectors. correct?
17:38mkthere is no real issue with treating [1] as if it were (1) (both would be an error)
17:39mkautodidakto: no, I guess I mean that they complect efficiency and non-executability
17:39yoklovthat would suck
17:39kjellskitechnomancy, I'm having a hard time to get this all going… I've already installed Emacs.app because I failed with Aquamacs… is it really that hard all the time? now clojure-mode.el tells me lein is not installed but I can run it in the shell...
17:39autodidaktokjellski: got the swank clojure plugin installed?
17:39mkyoklov: in what sense? (I probably agree)
17:40yoklovif [1] were an error
17:40yoklovand i needed to do '[1]
17:40kjellskiautodidakto, how? I've already removed all the elpa stuff...
17:40autodidaktokjellski: there are two parts. Emacs and Lein. Emacs needs clojure-mode, Lein needs swank plugin
17:41kjellskiautodidakto, AHA! ^^ now, how do I get the clojure-mode back in action?
17:41yoklovkjellski, you want Emacs.app anyway
17:41jtoyis there a way to have nested #'s ?
17:42autodidaktokjellski: you mean how to you install the package?
17:42mkyoklov: right. But when you use [], it's not always clear whether you want an efficient list, or a non-executing list
17:42aperiodicjtoy: nested anonymous function literals -- #(...) -- are not allowed
17:42yoklovjtoy no. use (fn [arg etc] …)
17:42bradwrightkjellski: you probably have PATH fail, that happens on OSX
17:42autodidaktokjellski: are you familiar with package management? M-x install-package, elpa, etc?
17:42technomancykjellski: that's a common problem with Macs
17:42kjellskiautodidakto, yes, I'm completely new to emacs...
17:42technomancynothing to do with lein or Clojure specifically; it's just that OS X doesn't propagate your environment variables
17:42autodidaktokjellski: technomancy: oh! did you isntall it via homebrew?
17:42mkjtoy: you might clean your nested #s up with ->
17:42bradwrightkjellski: https://gist.github.com/2046593 might help
17:42autodidaktolemme pastebin you the code i use..
17:43jtoymk: nice, I should try with -> I've never used that
17:43kjellskibradwright, where should this go?
17:43autodidaktobradwright: and you call that in your init.el after that defun?
17:43bradwrightIn your Emacs config
17:43bradwrightautodidakto: yeah
17:43clojurebotI don't understand.
17:43bradwrightSomething like that anyway
17:44technomancyneither do I, clojurebot.
17:44technomancyneither do I
17:44bradwrightI've refined it since - that function is pretty ugly
17:44yoklovmk: i'm unsure of what you mean by that
17:44yoklovre: efficient vs non-executing
17:45autodidaktoyoklov: vectors are more effecient than lists, that's why we use them
17:45yoklovit's just a data structure literal. when eval sees a list it evaluates it, when it sees a vector it's a literal
17:45autodidaktoyoklov: but if we just want efficiency, fine, but why change the function-in-caller spot syntax?
17:45mkyoklov: yeah. Technically, you could have 4 things: executable lists, exec vectors, nonexec lists, nonexec vectors
17:46gfredericksI'm about to initiate a small library wrapper around aleph for defining http proxies -- am I ooverlooking something that already exists?
17:46yoklovwhat would the benefit of having executable vectors
17:46autodidaktokjellski: with that gist, you'd have to past "(set-exec-path-from-shell-PATH)" after it
17:46kjellskibradwright, do I need to do a (require path) in my .emacs file or should i paste it directly in there? I've now put it into .emacs.d/path.el
17:46aperiodicwhy would you want executable vectors? vectors and lists are equally good (asymptotically) at iterating; vectors are just better at random access
17:47bradwrightkjellski: reload that Gist
17:47aperiodicwhen you execute a form, you're not accessing the elements randomly
17:47kjellskibradwright, and now?
17:47bradwrightkjellski: copy the entire thing into your scratch buffer
17:47kjellskibradwright, okay
17:47bradwrightkjellski: then run M-x eval-buffer
17:48bradwrighti.e pretty Meta and X, then type "eval-buffer" and hit RETURN
17:48bradwrightPress, not pretty
17:48bradwrightUgh, Liox
17:48mkyoklov: unsure, it might make certain apply-forms more efficient? (though seqs probably take care of that). The point is that we can use lists to represent execution, or not (by quoting)
17:48yoklovmk: it would make use of the literals more of a pain
17:49yoklovfor what would be at best a minimal benefit
17:49kjellskibradwright, now I've evaded that scratch...
17:49jtoywhat way do yo guys recommend to see if 2 lists have any of the same elements?
17:49bradwrightkjellski: your Emacs exec-path should now be the same as your shell path
17:49bradwrightkjellski: so leon etc. should work
17:49bradwrightLein
17:49autodidaktoyoklov: you'd have to quote them everytime, yeah. but it is a ideological compromise, i think
17:49bradwrightFFS Lion auto correct
17:49kjellskibradwright, okay...
17:49mkyoklov: yeah. My thought was just that vectors were complected, because they represent both non-executablity and efficiency, two concepts that are fully distinct
17:50autodidaktobradwright: setenv persists across reboots?
17:50mkjtoy: what do you mean? in your code?
17:50yoklovjtoy: i would probably do (empty? (clojure.set/intersection (set list1) (set list2))) or something like that
17:50bradwrightautodidakto: no, you need to put that in your emacs.d somewhere
17:51autodidaktobradwright: plus he needs to call the function in his emacs.d, correct?
17:51jtoyyoklov: what if they are large though? it will go through every element
17:51yoklovwell, intersections gonna need to do that anyway
17:51bradwrightautodidakto: I updated my Gist to the full snippet required
17:51bradwrightIncluding calling the function
17:51mkjtoy: err, make an intersection seq, and then do isempty? I think that might be lazy
17:52jtoyyoklov: i wanted to have it stop if there was an intersection
17:52offby1jtoy: if they happen to be sorted, you can do better
17:52bradwrightautodidakto: https://gist.github.com/2046593
17:52jtoyi mean on the first match
17:52jtoybut i don't even care about the match
17:52autodidaktobradwright: thanks :) sorry to be pedantic about it. i understand your comments, but i have a feeling that kjellski wasn't fully
17:52autodidaktounderstanding
17:52bradwrightautodidakto: sure, no worries :)
17:53yoklovjtoy: (some (set l1) l2)
17:53ibdknoxjtoy: is there something wrong with the set comparison?
17:54jtoyibdknox: no, i didn't know about it, the 2 lists i compare are always about 150 elements, wasn't sure if its bad to convert them constantly like that
17:54yoklovmk: i don't think that vectors represent efficiency.
17:54ibdknox150 elements is tiny ;)
17:54yoklovthey represent a data structure.
17:54mkyoklov: the same data structure as a '(list), just more efficient
17:54aperiodicno
17:54yoklovthey certainly don't represent non-execution. it's lists that represent execution.
17:54ibdknoxjtoy: in general, it's best to just roll with it. If it ends up being too slow, then try and make it faster
17:55ibdknoxotherwise you're optimizing for no reason
17:55yoklovmk: lists aren't less efficient than vectors.
17:55yoklovthey just support different operations.
17:55ibdknoxmk: huh?
17:55ibdknoxit's nothing like a list
17:55aperiodicmk: vectors have efficient random access. they are way less efficient than lists for things like concatenation/subrange removal
17:55jtoyibdknox: true, i am running this inside hadoop, so is a little hard to optimize
17:56kjellskiautodidakto, it keeps telling me this: "Could not start swank server: /bin/bash: line 1: lein: command not found\n"
17:56mkaperiodic: yes, right. Mostly. Our vectors are implemented with the log32 tries, aren't they?
17:56yoklovyeah
17:57autodidaktokjellski: you added the code from the (updated) gist and restarted?
17:57mkon the other hand, our lists are not implemented in a way that makes getting the last element anything short of O(n) - right?
17:58yoklovyeah, but getting the first element is O(1)
17:58kjellskiautodidakto, yes
17:58gfrederickslet's invent reverse linked lists!
17:58ibdknoxgfredericks: it will change *everything*.
17:58kjellskiautodidakto, I've put the gist into .emacs.d/path.el and have a (require 'path) in my .emacs
17:59mkyoklov: which is effectively equivalent to the vector's O(log32n) - I guess that's why I'm thinking of vectors as efficient over lists
18:00autodidaktokjellski: M-S-; (getenv "PATH")
18:00mkgfredericks: yeah, but the middle elements! what we really need are skiplists. Or like... tries
18:00gfrederickshmmmmm
18:00gfredericksokay, so decide which middle element you're interested in, and use a regular linked list for the right side and a reverse linked list for the left side!
18:01mkactually, why aren't our lists just implemented in the same way as vectors?
18:01yoklovmk: at the end of the day the performance of each data structure is an implementation detail
18:01yoklovmk: because its a different API.
18:02yoklovif you want a vector use a vector. if you want a list use a list. you seem to have the idea that lists are inherently worse than vectors, but they address different needs.
18:02mkyoklov: how's that? Do you mean conj? Because conj is terrible.
18:02gfredericksvectors don't have O(1) add-time
18:02yoklovmk: why is conj terrible
18:03technomancyclojurebot: recite the litany against cons
18:03clojurebotexcusez-moi
18:03technomancyclojurebot: litany against cons?
18:03clojurebotlitany against cons is "I must not cons. Cons is the perf-killer. Cons is the little death that brings total obliteration. I will face my cons and permit it to pass over me and through me, and when it has gone past I will turn my GC to see its path. And where it has gone there will be nothing; only I will remain."
18:03ibdknoxlol
18:03mkyoklov: some needs (like access time of O(1) in favor of the equally-fast Olog32n) just don't matter
18:03yoklov-_-
18:03ibdknoxhaha
18:05gfredericksmk: if we're gonna use all one thing why not something more generic that can add/remove in all positions?
18:05mkwhy is cons evil?
18:05gfrederickscertainly any advantage of vectors over finger trees are needs that just don't matter
18:05technomancyallocation/GC is the most common cause of perf issues
18:06mkgfredericks: perhaps I erroneously think that our vectors have fast middle insertion/removal. If not, then let's use finger trees for everything
18:06technomancyfinger trees are really slow
18:06mknevermind then!
18:06gfredericksmk: by insert I mean not update, but actual insert
18:07mkgfredericks: right, so do I
18:07gfrederickstechnomancy: you mean in principle or just the particular clojure impls? what makes them inherently slower?
18:07gfredericksmk: no inserting/removing in the middle of a vector is O(n) I'm 97% sure
18:07dnolenmk: someone needs to implement the datastructure that Phil Bagwell talked about at the Clojure/conj
18:07technomancygfredericks: part of what makes vectors fast is the fact that they can be implemented in terms of arrays
18:08technomancythere are optimizations all the way down the stack to make arrays fast
18:08gfredericksI guess that makes sense
18:08technomancybut I dunno; I'm just parrotting what I've heard from chouser and rich
18:08mkgfredericks: I'm not sure why that would be... I was imagining that the nodes in the tree were ...replicated? from top to bottom on insertion into our vectors (I'm not describing this well)
18:09dnolengfredericks: PersistentVectors work better in terms of modern hardware. Finger Trees only sound good on paper.
18:09yoklovwhat data structure did phil bagwell talk about at clojure/conj?
18:10dnolenyoklov: get the slides here, http://github.com/relevance/clojure-conj/tree/master/2011-slides
18:10gfredericksmk: it's hard for me to describe simply, but I believe due to the vector impl all efficient operations preserve the position of each element within its length-32 array
18:10dnolenyoklov: would be a big deal if someone did them. I wouldn't be surprised if ClojureScript gets fast insertion and concatenation first!
18:10gfredericksso deleting in the middle requires shifting every element to the right one position to the left in its array
18:11mkgfredericks: I see. I didn't think that was the case, but you may be right
18:11aperiodicmk: i think you're making assumptions about the performance characteristics of vectors solely based on the fact that vectors are implemented as tries, which might (IMO, probably) not be true, since vectors only have to support an array-like API. i would urge you to look at the implementation of vectors, and do some performance testing, before declaring arrays the be-all and end-all of data structure performance
18:11aperiodics/arrays/vectors/ in the last sentence there
18:12gfredericksmk: as high-level evidence I would point out that I don't believe there are any core functions for doing such things to vectors
18:12dnolenaperiodic: vectors in Clojure are implemented as tries.
18:12yoklovdnolen: uh, that… file has no extension and isn't text, pdf, gzip, svg, or anything i can determine.
18:12yoklovany clue?
18:12dnolenyoklov: pdf likely.
18:13mkaperiodic: I'm not saying they are (and true arrays definitely are not). I'm just saying that we can give up some of the minor performance differences (if the differences really are all minor) for conceptual simplicity
18:13dnolenyoklov: here's the paper http://infoscience.epfl.ch/record/169879/files/RMTrees.pdf
18:13yoklovdnolen: yeah, tried that and the other ones in there
18:13yoklovah, thanks
18:14dnolenmk: "minor performance" difference? what between vectors and lists?
18:14aperiodicdnolen: the assumptions of performance characteristics might not be true, not the implementation of vectors. that was ambiguous, oops.
18:15gfredericksdnolen: he's suggesting that lists are only slightly better than vectors at anything
18:15mkdnolen: I'm thinking of, for example, O(1) on head insertion vs O(log32n) - that sort of difference might not matter
18:15gfredericksat least if you ignore the beginning vs end difference
18:16dnolenmk: lists and vectors are useful for very different things. happy I can take advantage of that.
18:16mkgfredericks: I am not. I'm saying that if they are indeed only slightly better, then we might think of doing away with the two distinct structures
18:16dnolenmk: they aren't slightly better. they're insanely great.
18:16gfredericksmk: is that not a superset of what I said?
18:17mkgfredericks: I state the conditional, you say that I state the antecedent of the conditional
18:17aperiodici can insert an arbitrary amount of things into any point in a list in O(1) time. i will be at your door with pitchforks and torches if that's not the case
18:17mkdnolen: what's the best example of that?
18:17yoklovmk: lists don't sound like much, but really they hit an algorithmic sweet spot, which is why lisps have gotten on with them for so long
18:17gfredericksmk: I'm going to go give the kid a bath; I'll grant you any claim you make about what I just said.
18:18aperiodicO(1) is not O(log32 n). please stop trying to handwave away the difference.
18:18mkgfredericks: :)
18:18amalloyaperiodic: when log32 n is at most 5, it's the same as 1
18:19mkaperiodic: not handwaving, just appealing to "programmer time is more important". If I really need that O1, I'd probably just write it in java
18:19mkI mean C
18:19dnolenmk: to each his own.
18:21aperiodicmk: i'm not convinced that taking away vectors saves me time
18:21ibdknoxquite the opposite
18:21mkfor the record, I agree that certain implementations of lists are a much better idea for some operations. But if we could implement a structure that is effectively as fast as both linked lists and vectors, we might consider using that
18:21aperiodicand i really don't want to write C if i'm concerned about programmer time, that seems totally bacwkards
18:21ibdknoxhaving vectors and lists is very useful just from a visual stand point
18:22mkaperiodic: I mean the opposite - if you're worried about O(1) on list insertions, you might not care about how much time and complexity it takes to get the efficiency you need
18:22yoklovand from a "porting existing lisp code/not horrifying lisp programmers by entirely doing away with lists" point of view
18:23mkibdknox: yeah, I agree with the visual aspect, and the part about lists being executable and vectors not
18:23ibdknoxthat alone makes it worthwhile
18:24ibdknoxhaving done numerous user test on code readability
18:24ibdknoxyou can't overestimate the value that has
18:24ibdknoxlo
18:24ibdknoxl
18:25yoklovhaha, yeah, without lists it would be a sea of square brackets, as opposed to a sea of various matched delimeters :p
18:25mkibdknox: yeah, totally agreed - I have nothing against () and [], just the underlying performance (and the behaviour of e.g. conj)
18:25dnolenmk: we're patiently waiting for you to implement RBB-Trees for us.
18:25ibdknoxhaha :)
18:25mkdnolen: :)
18:25yoklovmk: how do you think conj should work?
18:26mkyoklov: it shouldn't ;)
18:27aperiodicmk: sure, if you can hand me a data structure that has O(1) random access and O(1) concatenation, or close enough that I can't construct an example where I can see the difference, I'll take it. w
18:27mk,[(conj [1] 2) (conj '(1) 2)]
18:28clojurebot[[1 2] (2 1)]
18:28yoklovconj gives you performance guarantees, not order guarantees
18:29yoklovwhen you don't care about the order of your items, its nice to be able to swap out a [] with a () or a #{}.
18:30yoklovand then if you use conj you know that it will be inserted in the fastest way possible,.
18:31mkseems like it'd be a good idea to just implement an efficient bag
18:31yoklovthats what sets are.
18:32jtoywhy does the reply get garbled up sometimes?
18:33mkyoklov: sets aren't quite bags - but sure, use sets, avoid conj
18:33jtoyi can't use commmandline history
18:33mkjtoy: which reply?
18:33jtoyrepl
18:33mkjtoy: which repl?
18:33jtoylein repl
18:33technomancyjtoy: lein1 or lein2?
18:33jtoytechnomancy: I'm on lein1 now
18:34yoklovmk: you seem to have a problem with having more than one data structure
18:34technomancyoh. hmm... lein1's repl is ... not very good, I guess.
18:34technomancyjtoy: are you using rlwrap?
18:35jtoytechnomancy: i didn't do anything to add it, so if its not default then no
18:35technomancytry installing rlwrap; lein repl will use it if it's installed, and it's way better than the built-in stuff
18:36jtoyok, thx
18:36mkyoklov: only when the differences are trivial in nearly all cases
18:37jtoywhat is the right way to do this? (clojure.set/intersection (set (.split "this is a test" "\\s+")) (set ("this" "you")))
18:37mkwho was it who was looking for something to assign to some students for a several-day coding exercise?
18:38yoklov*shrug* i don't think th edifferences are trivial, but whatever.
18:38emezeskejtoy: ("this" "you") is trying to call "this" as a function
18:38jtoyemezeske: doh
18:38mkyoklov: they aren't - I didn't realize that insertion time was O n
18:38emezeskejtoy: You could use a vector, or quote the list
18:39emezeskejtoy: Or even better, use the set literal #{"this" "you"}
18:40mkjtoy: have you learned the difference between vectors and lists?
18:40jtoysomewhat, the part i get more confused on is with maps and seq and lazy
18:41mkjtoy: what do you think the difference is?
18:41jtoythe difference is they are all confusing :)
18:42mkjtoy: :) lists are for executing, while [] are usually for representing data-stuff
18:42gfredericksor bindings
18:42jtoymk: yeah, i got that, I use [] so far for binding and arugments
18:43mkjtoy: arguments usually belong in a list
18:43gfrederickswut
18:43gfredericks(fn [a b c] b)?
18:43ibdknoxhaha
18:43mk,(+ 1 2 3 4 5 6) -- the numbers being arguments
18:43clojurebot21
18:44gfredericksclearly we're both wrong
18:44mkperhaps
18:44gfrederickslet's make this an argument
18:44yoklovprobably he means the arguments list of a function?
18:44gfredericksthe first of a finger tree of arguments
18:45mkyeah I'm attempting to unsuccessfully point out that lists are for functions and their arguments, while vectors are for data-stuff
18:45gfredericksand locals
18:45gfrederickslocals is maybe more accurate than "bindings"
18:45ibdknoxhttp://i.imgur.com/04937.png
18:46mkarguments and bindings are "data stuff"
18:46gfredericksthey don't have anything to do with runtime data...
18:46gfredericks(fn [a b] [a b]) ;; <-- two totally different uses of vectors
18:46emezeskeI think the main point to make is that vectors evalutate to themselves, whereas lists evaluate by trying to call their first element as a function
18:46emezeske,[list 5]
18:46clojurebot[#< clojure.lang.PersistentList$1@1ae5cd8> 5]
18:46emezeske,(list 5)
18:46clojurebot(5)
18:47mkgfredericks: neither gets executed
18:47gfredericksthey're still distinct things though
18:47gfredericksconceptually they're quite different
18:47yoklovi agree with emezeske
18:47gfredericksthe fn macro could just as well be a list
18:47mkI agree with emezeske too
18:48gfredericks(fn (a b) [a b]) is unambiguous
18:48gfredericksit's just not as readable
18:48gfredericksit has nothing to do with the list/vector data structures
18:48gfredericksI must be trolling if nobody agrees with me
18:48mkgfredericks: don't you need to quote that inner list?
18:48gfredericksmk: not if the macro supports it
18:49gfrederickse.g., the ns macro lets you use unquoted lists almost everywhere
18:49gfredericks(ns foo.bar (:require baz)) does not call the :require function
18:49emezeskeWell, macros are a special case, because macros can do whatever the heck they want with their arguments
18:50gfrederickssure but MOST of the vectors you see in source code are there for macros, not because they represent runtime data structures
18:50mk,((fn '(x) x) 1)
18:50clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
18:50gfrederickslet, loop, binding, fn, defn, etc...
18:50emezeskegfredericks: That's true, but it's a convention rather than any intrinsic property of vectors vs lists
18:51gfredericksemezeske: it is, but it seems silly to ignore when telling a beginner that vectors are used for data-y things
18:52mkgfredericks: bindings are data-y things
18:52mkyou don't execute a binding
18:52gfredericksokay; I guess if that makes sense to everyone else that's all that's important
18:56emezeskegfredericks: Your points are valid. I don't profess to know how to teach Clojure ^_^
18:58offby1"Your points are valid. I wish to subscribe to your newsletter"
18:59AimHereSimpsons reference
19:00AimHereSo whether that's 'inside' I don't know
19:00emezeske^_^
19:01gfredericksemezeske: clearly the key to learning clojure is whatever I have most recently had an insight about
19:01offby1also ancient, also not really that funny (except to me)
19:02gfredericksoffby1: I for one welcome your new robot overlord references
19:02emezeskeHey, I get that one!
19:02offby1ayup
19:43tacomanwhat's the best way to restart a running Clojure program I'm testing in SLIME?
19:46bobzhangcan anyone tell me why nothing happened for this piece of code ?'(.start (Thread. #(/ 3 0)))'
19:48offby1I suspect the thread ran, but the repl didn't print the resulting value
19:48offby1or the exception doesn't get raised in the repl thread
19:48bobzhangoffby1: you can join the thread, stil nothing happend
19:49offby1*shrug*
19:49offby1just guessing
19:50emezeskebobzhang: Futures can be nice for that: ##@(future (/ 3 0))
19:50lazybotjava.lang.SecurityException: You tripped the alarm! future-call is bad!
19:50emezeskebobzhang: When you dereference the future, if there was an exception, it will be thrown
19:51bobzhangemezeske: thanks. But why the code above does not propogate the exception?
19:53emezeskebobzhang: I don't understand what you mean
19:53emezeskebobzhang: When I paste that in my REPL, I see a divide by zero exception
19:58bobzhangemezeske: future works, I mean the original code
20:02gfredericksdoes core.match require clojure 1.3?
20:03emezeskebobzhang: Yep, I was referring to the original code. I paste (.start (Thread. #(/ 3 0))) into my REPL, and I see a DBZ exception.
20:04yoklovcan anybody think of a more elegant way to do this? https://refheap.com/paste/2018 (specifically the (concat (mapcat …) (mapcat …)) part, but the reduction/function in general?
20:05bobzhangemezeske: weird. I tested in repl, it raised exception, in slime, not, though
20:11emezeskebobzhang: Note that the future way is probably better; the exception gets propagated to the caller instead of just being raised mysteriously in the background
20:12emezeskebobzhang: Which probably has something to do with why slime noticed the future error but not the thread one
20:19picklesis there a core or contrib function that will both filter on a predicate and apply a function to the filtered items?
20:19picklesa sort of filter-map
20:19picklesgoogle hasn't yielded anything thus far
20:20technomancy,(for [n (range 10) :when (even? n)] (inc n))
20:20clojurebot(1 3 5 7 9)
20:20technomancypickles: ^
20:20pickleshm
20:21pickleslooks like it should work!
20:21picklesthanks technomancy
20:21pickles(nice screenname, btw)
20:22technomancynp
20:24picklesI seem to overlook for loops in functional languages
20:24gfredericksit's more "list comprehensions" than "for loops"
20:24gfredericksit is called "for" probably to be confusing
20:24gfredericksand "for" is short
20:25picklestrue
20:33yoklovweird.
20:34yoklovi think the google closure compiler just crashed.
20:35yoklovran out of memory while compiling cljs output. thats… not really the part of the toolchain that i'd expect to crash.
20:37FrozenlockHow can one change the header in Noir?
20:38gfrederickssomebody told me that scala lets you flag function arguments so that the forms given become the body of a function -- i.e., the function is passed, letting you delay evaluation
20:38gfredericksessentially a special case of what you can do with macros
20:39gfredericksmost of the macros I write just do that :/
20:45gfredericksI wonder if flatland/useful has a def-with-macro macro
20:49emezeskeyoklov: here's my attempt: https://refheap.com/paste/2019
20:49emezeskeyoklov: it doesn't produce vectors, though
20:49yoklovhm
20:50yoklovthats interesting
20:50emezeskeyoklov: I went for pure readability, no idea how efficient it would be
20:52emezeskeyoklov: One problem I see is that it passes over the top and bottom vectors twice
21:00yoklovhm, yours seems to be faster than mine
21:00Lajlayoklov, behold
21:01emezeskeyoklov: interesting
21:01Lajla&(symbol? (symbol "I worship His Shadow"))
21:01lazybot⇒ true
21:01LajlaYES
21:01LajlaI broke your stuff
21:02yoklovemezeske: yeah, but when i make the vector bigger yours stays around the same but mine actually gets faster, so i don't think i can trust my benchmarks.
21:02emezeskeyoklov: ^_^
21:03nodenameI need some help building a library in lein with both Java and clj source. I've tried and tried but when I use this lib from a small clojure program I get a Class Not Found when my clj lib code imports the class
21:03yoklov100ms for 1000x1000, 40ms for 4000x4000. go figure (yours was cleanly under 20ms for both)
21:04nodenameI may have a classpath issue
21:05nodenameanyone?
21:05clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
21:05emezeskeyoklov: heh
21:06nodenameclojurebot: thanks, I already did that
21:06clojurebotHuh?
21:10emezeskenodename: If you haven't tried it yet, "lein classpath" will show you were it's looking
21:13nodenameemezeske: hmmm
21:17nodenameemezeske: lein classpath shows the library jar on the classpath for my app; do the Java classes have to be in any particular package? They're separate from my clj src in the lib...
21:20gtoastIn the documentation for doall there's a 2 arity version
21:20gtoastIts not really documented. Does anyone know what it does? (doall n coll)
21:20gfredericks,(doc doall)
21:21clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."
21:21emezeskenodename: You could do something like "jar tf my-library.jar" to see if it contains the files you think it does
21:21gfredericks,(source doall)
21:21clojurebotSource not found
21:21gfredericks$source doall
21:21lazybotdoall is http://is.gd/ubI870
21:21emezeskenodename: I don't know much about packaging java libraries with lein, so I probably can't help much more than that
21:21gfredericksgtoast: my guess is only walks n items
21:22gtoastgfredericks: Yea thats what I thought. just wanted to confirm.
21:22gfredericksgtoast: glancing at the source confirms it
21:22FrozenlockUsing Noir, I want to generate a file and let the user download it without writing it on disk. I should probably start with an easier task: How can I let the user downlad a file already on my disk? With my first goal in mind, I suppose I _should not_ use the ring's wrap-file-info. Any suggestions on how to do that?
21:22brehautFrozenlock: the :body of a ring response may be a file
21:23weavejesterFrozenlock: In the body of your response, return an input stream
21:24FrozenlockThanks! Isn't there a part where I should put the content-type "application/octet-stream", or something like that?
21:24nodenameemezeske: the .class files are where I expect them to be in the jar. I think I'm going to put the java and clj src in the same tree and see if that helps. Thanks
21:24weavejesterFrozenlock: "application/octet-stream" is kinda a catch-all content-type. There might be something more specific.
21:25emezeskenodename: Good luck!
21:25weavejesterFrozenlock: You can use the ring.util.response namespace to easily add content types etc. to a response.
21:32Frozenlockweavejester: gotcha! I'm looking at your source right now, it might inspire me, especially guess-mime-type ^^
21:42nodenameNow I have my java-source-path the same as my source-path, and "lein jar" fails with a ZipException duplicate entry of my core.clj. I'm sure I've seen a working example of a lein project with both clj and java somewhere on github... this is very frustrating
21:48amalloynodename: https://github.com/flatland/clojure-protobuf is one such example, if you want to compare/contrast
21:48nodenameamalloy: thanks!
21:48amalloyit currently runs under lein1; it depends on some plugins that don't exist yet on lein2, or something
21:55xumingmingvwhat's the effect when we add a hyphen at the beginning of a function? e.g. defn -test
21:57gfredericksxumingmingv: that's the default prefix that gen-class looks for
21:58gfredericksalso I think has meaning in clojurescript; so depends what you're looking at
21:59xumingmingvi mean just clojure
21:59xumingmingvso def -test means define a instance method named test in the generated class?
22:03yoklovanybody know what the following error means: https://refheap.com/paste/2023 (cljs macro weirdness)
22:05yoklov(or just my own noobishness)
22:08nodenameFYI: My ZipException duplicate entry problem was fixed by Raynes a while ago. I just needed to update lein to 1.7.1
22:10amalloynothing leaps out at me, yoklov. looks correct, and i don't know anything about cljs's special macro environment
22:10yoklovit macroexpands right :/
22:10yoklovor at least doesnt mess with the doseq
22:10yoklovcljs needs macros in a separate file
22:10yoklovthats all
22:11yoklovah
22:11yoklovthe compiler needed to be restarted i guess.
22:11yoklovor rather, it ran out of memory shortly after and stopped complaining after i restarted it
22:12yoklov(well, google closure compiler ran out of memory)
22:34RickInGAyoklov: thanks again for the help earlier. I managed to reduce the complexity from the example and get something working
22:35yoklovoh? thats good, i was going to gist in a few functions i'd been using to manipulate the canvas so you could sort of see how it translated
22:36RickInGAthe example had a lot going on, it was tough for me to see what was cljs, what was js interop and what was html properties
22:38RickInGAit aint fancy, but it does draw a square, which is a great first step! https://refheap.com/paste/2024
22:40yoklovoh, you can do (set! context.fillStyle "#ffffaa")
22:40yoklovif you want to, i mean.
22:42RickInGAyoklov: yes, that worked. does that work because it was a set! or can I change the next line too?
22:43yoklovhm, try it?
22:43yoklovi actually havent been able to it documented anywhere.
22:43yoklovor at least, not where it works
22:43RickInGAyoklov: nope, replacing second line doesnt work
22:43yoklovyeah, i think its just in set then.
22:44yoklovwhich is a bummer
22:45RickInGA.fillrect context x y w h somehow looks better anyway
22:45yoklovoh, for method calls yeah
22:45yoklovbut
22:46yoklov(.-width canvas) would be nice as canvas.width
22:47RickInGAand now that it is working, I am going to call it a night.
23:23wkmanireGood evening.