#clojure logs

2012-11-12

00:32dakroneibdknox: hey, I'm in Raleigh, gimme a holler when you're here and would like to compile lighttable on a 10.6 machine
04:04sunkencityrylehso there's no defmulti- why not?
04:08Apage43sunkencityryleh: (defn- foo [] … is the same as (defn ^:private foo [] ….
04:09Apage43so you can (defmulti ^:private foo blah)
04:10Apage43the shorthand version is only provided for defn, but you can use the metadata syntax (^:private) with all of the things that create vars
04:10sunkencityrylehok so I'll just add the metadata then. I wondered if there was another reason. tnx.
04:11iZZardHi
04:12iZZardI need to ask a few questions..
04:13iZZardWhats the primary platform for clojure?
04:13_ulisesiZZard: don't ask to ask :)
04:13_ulisesiZZard: I'd say the JVM
04:13iZZardYeah,
04:14iZZardCould clojurescript replace it in the future?
04:14_ulisesno idea and it'd depend on what you're building I'd say
04:15iZZardhmm.. I want a stable reliable platform for many years... for say Research?
04:16_ulisesI'd go for the JVM
04:16_ulisesit's been around for a long time, it probably will be around for many more years
04:16clgviZZard: no I dont think so
04:16_ulisesnot saying that JS won't; just saying that the JVM is already here
04:17clgvclojurescript compiles to javascript whose vms can not compete with the jvm, afaik
04:18algernonjs is single-threaded
04:18algernonthe JVM isn't
04:18clgvthe mission statement is (last time I read it) to get clojure on all platforms that support javascript, not to replace clojure's implementation on the jvm
04:20iZZardSo should I conclude that the JVM implementation will be kept primary (more documentations, code and people) till the open source JVM exists?
04:20iZZardand ClojureScript a side project?
04:21clgv"till the open source JVM exists" what should that mean?
04:21cmnsounds like it should say "while"
04:21iZZardEnglish is not my native....
04:22clgvcmn: no I meant the semantic behind that
04:22iZZardOracle dosen't get Barmy....
04:22cmnthe semantics change from till to while
04:23iZZardSo what about it?
04:23mattishi, how does line-seq handle blocking IO? does it need the stream to close before I can evaluate the elements?
04:24clgvclojurescript wont replace clojure imho
04:24cmnthat wouldn't make any sense, no
04:24iZZardCan you assure it to me... I will be greatfull to you :)
04:25clgviZZard: assure? do you want to sue someone if agaisnt all odds it wont?
04:30iZZard`So what about it?
04:30iZZard`Sir?
04:30clojurebotI will hold the money!
04:31cmnyou won't get a press release stating that
04:31cmnclojure is mainly made for the jvm
04:31iZZard`hey I am simply a 17 year old school going boy.....
04:31clgviZZard: if you want assurance you will have to make a contract with clojure/core I guess. then you have legal backup ;)
04:32iZZard`Ok, 'assure' looks a bit 'legal'......
04:32clgviZZard: ah well then just start learning clojure ;)
04:33clgvit wont harm you to learn more than one language
04:33iZZard`Yeah, that's what I am doing... I want to make it my primary language too.
04:34iZZard`guys... Ok don;t assure it. Just tell me your views. :o
04:34iZZard`dont
04:34_ulisesiZZard`: clojure on the jvm is a pretty good bet for the next few years I'd say
04:34clgvif you want to choose between clojure and clojurescript, you should decide based on the applications/programs you want to write. currently, clojurescript is mainly used in web development, though chris granger uses it for lighttable as well (which is not classic web dev, I'd say)
04:35iZZard`Light Table uses chromium sandbox... thats web dev
04:35algernoniZZard`: both will exist for the foreseeable future.
04:35clgvwith "not classic web dev" I wanted to express that there is no classic web application running on a server as result ;)
04:36iZZard`So both do not compete with each other?
04:36algernonnope, they don't
04:36algernonthey compliment each other
04:36clgvno. I never used clojurescript so far ;)
04:37iZZard`So Clojure will be primarily for the JVM till the JVM exists?
04:43clgvalgernon: ah they are using JS as well?
04:44iZZard`hmm?
04:45ChongLithere are some very important differences with data structures between JVM and CLJS
04:45ChongLisome of ClojureScript's data structures lack the structural sharing found in their JVM equivalents
04:46algernonclgv: yes
04:47iZZard`Can I say, that JVM will be the primary target in the future?
04:47ChongLilooks that way to me
04:47clgvalgernon: so do they have a way to expose APIs of binary libs to JS?
04:49iZZard`Thank You.... You have assured me.
04:49iZZard`:)\
04:49algernonclgv: they have js bindigs for most glib-based libs, yup. (via some GObject introspectiong thingy I haven't looked into - I just use the results :)
04:49ChongLibesides, I don't think you have to worry about the JVM going anywhere
04:50ChongLito say it has an enormous userbase would be an understatement
04:50clgvalgernon: ah good to know. thx.
04:50iZZard`I was worrrying about clojure going away from JVM..
04:50ChongLiClojure is designed to tap into and leverage that ecosystem
04:50ejackson,(doc drop-while)
04:50clojurebot"([pred coll]); Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns nil."
04:51ChongLiiZZard`: even if it did you'd still be able to work with what is available now for a long time
04:52iZZard`ChongLi: But it won't... right? :)
04:52ejacksoniZZard`: rest easy, the JVM is likely to remain the primary target
04:52iZZard`Thanks..
04:52iZZard`There's a haskell book called 'Learn You Some Haskell For Greater Good'
04:53iZZard`Is there a clojure equal?
04:53sunkencityrylehis memoization thread local?
04:54sunkencityrylehas in memo-ttl ?
04:54sunkencityryleh,(doc memo-ttl)
04:54clojurebotIt's greek to me.
04:57ejacksoniZZard`: depends what you want, LYHFGG is pretty unique
04:58ejacksongenerically, you can't go wrong with http://www.clojurebook.com/
04:58ejacksonthe baba-yaga legs on the web page are an added bonus :)
04:59sunkencityrylehhm "Engaged Java developers are usually found working in demanding environments solving nontrivial, often domain-specific problems. "
04:59sunkencityrylehshouldn't that be "Enraged Java developers...
05:00clgv:D
05:01ejacksonindeed, indeed.
05:02clgvejackson: and I though "baba yaga" is russian for "witch"
05:03jakubHsunkencityryleh: you are completely right :)
05:03ejacksonyeah, one who's house is on chicken logs, right ?
05:03ejacksonchicken legs !!
05:04ejacksonhttp://en.wikipedia.org/wiki/Baba_Yaga
05:04clgvuuuh, that could be right. My memory on the movies is quite blurry ;)
05:05ejacksonthis is from my misspent your playing Sierra quest games - I think she turns up in Quest for Glory :)
05:05ejacksons/your/youth/
05:07sunkencityrylehI liked the orally clojure programming book. But I really wish there was a clojure nutshell book.
05:07sunkencityrylehoreilly
05:08PudgePacketI just installed leiningen on windows, any way to check where it actually installed itself to ?
05:10PudgePacketah nevermind, i figured it out
05:10thorwili'm using friend with the interactive-form workflow. attempting to login redirects to http://localhost:8080/login?&login_failed=Y&username=. now how could i go about finding out what exactly goes wrong?
05:13andrewmcveigh|wothorwil: looks like your login fn is not returning a username key.
05:17thorwilmy code: https://www.refheap.com/paste/6569
05:19thorwilPOST to /login is handled by friend automatically. the redirect from /login to /login?&login_failed=Y&username= implies that friend indeed handles the POST, right?
05:20andrewmcveigh|woyeah, that's what usually happens, but (from memory) usually, the &username=username - so I think somehow the username is not getting passed in at some point
05:22thorwili'm actually surprised its not just "?&login_failed"
05:25andrewmcveigh|wothorwil: I'm not seeing anything wrong with the "friend" part of your code. I can't really comment on the moustache bits, I've never used it.
05:28thorwilnow where does firefox show request bodies
05:36ebraminiohi, is this some kind of pattern matching in clojure where this (let [[l & *left] left
05:36ebraminio[r & *right] right] ...)
05:36ebraminiobe equal to
05:36ebraminio(let [l (first left)
05:36ebraminio*left (next left)
05:36ebraminior (first right)
05:36ebraminio*right (next right)] ...)
05:38ebraminioi just want to know what clojure call this, no more :)
05:38ejacksondestructuring ?
05:41ebraminioejackson, thanks :)
05:41thorwilandrewmcveigh|wo: the POST body my form creates is correct. or does friend expect client-side hashing?
05:42andrewmcveigh|wothorwil: no, not on the client side.
05:44andrewmcveigh|wothorwil: it expects the login/user fn to return a map of {:username ... :password "hashstr"} - in this case your (def users) map should do that for users "admin" & "jane"
05:46thorwilyes, i'm working closely following the examples
05:48andrewmcveigh|wothorwil: is your immutant/moustache using ring?
05:48thorwilandrewmcveigh|wo: yes
05:49andrewmcveigh|wothorwil: maybe your ring request map is not using wrap-keyword-params ?
05:50andrewmcveigh|wonot sure that made sense...?
05:50thorwilandrewmcveigh|wo: oh, that sounds like a good lead. thanks so far, i will look into that after lunch
05:51andrewmcveigh|wothorwil: np, hope it helps.
07:18sunkencityrylehWhere can i find vimclojure with nrepl support? "The branch 'nrepl' does not exist." https://bitbucket.org/kotarak/vimclojure/src/43edac157b14/?at=nrepl
07:20andrewmcveigh|wosunkencityryleh: I don't think there is one yet.
07:21sunkencityrylehhm, seems like there should be one in bitbucket somewhere https://bitbucket.org/kotarak/vimclojure/issue/82/use-nrepl
07:23andrewmcveigh|wothat branch did exist at one point (iirc), but I don't think it was ever finished/working.
07:23sunkencityrylehah, ok.
07:23sunkencityrylehdamn, back to copy & paste then I guess.
07:25andrewmcveigh|woIt would be nice to have, an nRepl vimclojure for sure.
07:28ambrosebsTim Pope was talking about making a Clojure plugin for vim on twitter.
07:28clgvandrewmcveigh|wo: you are sold to vim definitively? other wise there is Emacs or Eclipse+CCW
07:28ambrosebsNot exactly sure what he meant.
07:28sunkencityrylehI used emacs for 10+ years but switched to vim because the key commands was giving me trouble with RSI
07:29sunkencityrylehwrists are much better now
07:29andrewmcveigh|woclgv: I'm pretty heavily invested in vim, but I've been contemplating giving emacs another go recently.
07:30sunkencityrylehthough I guess emacs is the way to go for LISP
07:30sunkencityrylehmaybe I could try evil mode
07:30luciansunkencityryleh: it's pretty good
07:31ambrosebstpope: Are you going to write a new Clojure plugin for vim?
07:37tickinganybody some insight on math.cobinatorics? It's supposed to be lazy, but blows up on infinite sequences, so I'm not sure how lazy it _actually_ is.
07:41clgvticking: what exactly do you use?
07:41sunkencityrylehlucian: setting it up now
07:41ambrosebsDo we know which Conj Unsessions will be presented?
07:42augustlambrosebs: I haven't been informed at least
07:42augustl(and i have a suggestion on the list)
07:42tickingclgv, combinations
07:43clgvticking: what does your blowing-up code look like?
07:43ambrosebsI guess we'll find out in the next few days :)
07:44tickingclgv, (take 5 (combinations (range) 2))
07:44augustlambrosebs: I e-mailed them about it actually, I'll post here when I know more
07:45tickingclgv, I suspect its lazyness be to precalculate all elements of the form (1 x), but as x is infinite it will stall
07:45clgvticking: well it's input is not allowed to be infinite
07:45clgvticking: see here https://github.com/clojure/math.combinatorics/blob/master/src/main/clojure/clojure/math/combinatorics.clj#L70
07:47tickingclgv, right but this also means that it will use a huge amount of memory for huge lazy seq right?
07:49clgvticking: yes
07:49tickingclgv, that is what I had feared :( I had hoped that it only needs to hold the current element plus some meta information
07:50tickingclgv, thanks ^^
07:51clgvticking: but there is a formula to build that sequence you are looking for from (range)
07:52tickingclgv, the range thing wasn't what my production code looks like, there the seq is finite but a few gigs large ^^
07:52tickingclgv, I just wanted to check how lazy it actually is and a infinite seq seemed appropriate to test
07:53tickingclgv, in reality I'm calculating the levenstein distance between a huge bunch of words ^^
07:53clgvticking: you want the inverse function here: http://en.wikipedia.org/wiki/Pairing_function
07:54tickingclgv, yeah but the infinite range thing would be even easier with (map #([1 %]) (range)) ;P
07:54tickingclgv, as range is infinite, you will never reach the tipping point :D
07:54clgvticking: ah you only want the (1 n) tuples?
07:55tickingclgv, no it was an example to check how lazy combinations is
07:55tickingas I said above ^^
07:56tickingmy production seq is a few hundred mb of different words, that I wan't to calculate the levenstein distance between
07:57clgvfor `combinations` it has to fit into memory once.
07:58ChironHi, how to write a public field of java object in clojure ? https://github.com/nathanmarz/storm-contrib/blob/master/storm-kafka/src/jvm/storm/kafka/TestTopology.java#L31
07:59tickingclgv, yeah, I had hoped it doesn't :D
07:59tickingclgv, but it should be handable ^^
07:59noidiChiron, IIRC (set! (.bar foo))
08:00noidi(set! (.bar foo) value)
08:00tickingclgv, thanks a lot ^^
08:00clgvticking: well you could use the function I told you about above to avoid it
08:01tickingclgv, right and use it over the indices
08:01tickingclgv, I'll see how much will fit in memory and adapt if nessesary thanks :D
08:03ambrosebsaugustl: that would be great
08:06_ulises|awaywhen in the nrepl, where do the println messages go?
08:11clgvstdout
08:18_ulisesclgv: fair enough; does that go to some buffer in emacs?
08:18_uliseswith the old slime setup messages went to the minibuffer or even to the repl buffer
08:19_ulisesoh but they do here with nrepl too
08:19_ulisesnot when printing from another thread though :/
08:21clgvin CCW+Eclipse the println from another thread went to console output and not to the repl output
08:21clgvso maybe there is some analogue in emacs?
08:23_ulisesclgv: I'd hope so; otherwise I'll have to do proper debugging instead of my ghetto-println debugging
08:24clgv_ulises: if this will be more than a toy project you should start using logging. tools.logging might help you there.
08:24_ulisesclgv: that's what I was just thinking
08:25_ulisesclgv: while I have your attention, have you any experience with agents? I seem to remember that there was a *agent* var which pointed to the currently running agent?
08:25clgv_ulises: yes, this variable exists. I never used it though
08:25clgv,(doc *agent*)
08:26clojurebot"; The agent currently running an action on this thread, else nil"
08:26_ulisesah, so it still exists, great, thanks
08:27_uliseshum, logging doesn't strike me as active...
08:29sunkencityrylehwhich clojure mode should I use for emacs to get nrepl (I now run with evil mode)
08:30_ulisessunkencityryleh: I use the one that comes as part of the elpa packages
08:32sunkencityryleh_uilses: I installed "clojure-mode" and "nrepl" now with marmalade
08:34Sgeo,{(Object.) 1 (Object.) 2} ; this makes sense but I can imagine it tripping up people
08:34clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: (Object.)>
08:42sunkencityrylehhm, nrepl seems to work pretty nice. but how the hey can i now do M-x nrepl when my meta key is ESC?
08:42sunkencityryleh(running evil mode in vim)
08:42sunkencityrylehemacs
08:42sunkencityryleh:)
08:43augustlsunkencityryleh: in sequence
08:44augustlpress esc, then x
08:44augustlor does evil mode override esc?
08:44sunkencityrylehyes :( I just found the section on "defining your own escape" in evil-modes docs
08:47augustlprint screen maybe? Not a button I use a lot at least ;)
08:50sunkencityrylehaugustl: maybe left alt could do the trick
08:50augustlthat's the default one yeah
08:50augustlunless you run that strange OS some people seem to prefer, it's just called "10" or something I think.. ;)
08:51jweiss,[(-> nil lazy-seq) (-> nil lazy-seq seq)]
08:51clojurebot[() nil]
08:52jweissthat confuses me
08:52sunkencityrylehnothing js ever easy when not in linux
08:54jweissah nevermind, (seq '()) is nil according to the docs
09:03sunkencityrylehah, case closed. Had to check "Use alt as meta key" in terminal preferences. Successfully flipped a bit with M-x butterfly in evil mode after.
09:05augustlsunkencityryleh: ah, why not use Cocoa emacs? :)
09:07sunkencityrylehaugustl: terminal is the way to go, multitask with Control-Z.. oh wait, that doesn't work in emacs.
09:10sunkencityrylehah, this is the shit. Damn, it has only taken a couple of years for clojure to get a decent repl, but now, it's good!
09:21augustlsunkencityryleh: sounds like an artifact of the lack of window management in OS X :)
09:22sunkencityrylehaugustl: well, if I didn't do design from time to time I'd run linux with the tiling awesome window manager. I used to run wmii and was very happy with that.
09:25LicenserI've a odd problem with noir, I want to set a cookie value and it crashes with a 500, not even stack trace o.O.
09:26augustlsunkencityryleh: I'm currently experimenting with running Linux in a virtualbox with Win8 as a host, works very well so far actually
09:26augustl(so that I can use tablet features when I'm not programming)
09:29sunkencityrylehLicenser: I recently added [org.slf4j/slf4j-api "1.6.6"] [org.slf4j/slf4j-log4j12 "1.6.6"] and a log4.properties file to my compojure project and removed the wrap-exception middleware. A lot better exceptions and insight into what is happening. maybe that could work on noir as well.
09:30Licensersunkencityryleh thanks for the hint I'll see if that is an option :)
09:30sunkencityrylehaugustl: VMs are nice as long as you don't have to compile lots of C++ :)
09:31augustltrue.. there's a performance loss
09:31sunkencityrylehmostly it doesn't matter but there are some things.
09:31sunkencityrylehit's very nice to be able to save a working copy of the programming environment
09:33_ulisessunkencityryleh, augustl: I experimented running an EC2 instance as dev. env. and NX for the gui
09:33_ulisessunkencityryleh, augustl: it works pretty well actually
09:34augustl_ulises: how do you run the GUI elsewhere? VNC or something?
09:34_ulisesaugustl: NX - it's an optimised X protocol which includes compression, encryption, etc.
09:35_ulisesaugustl: it's far more performant than pure X and VNC
09:35_ulisesaugustl: http://www.nomachine.com/
09:36augustl_ulises: very interesting, I'll look that up, thanks
09:36sunkencityrylehI ran an ec2 instance for a while and used an ssh client on the iPad. but the control characters didn't work all that great from a bluetooth keyboard so I gave it up.
09:36augustlthin clients ftw, my dream is to use a microsoft surface pro for real work :)
09:38augustlthe surface pro is, after all, a real computer. It's hard getting work done on Windows when you work in a unix env though.. Hence the idea of using linux in virtualbox for work stuff.
09:41sunkencityrylehI find the web browser experience on windows 8 absolutely horrible. Coded a windows8 app awhile ago though in c# and it was a lot of fun. Had the idea to use clojure-clr but didn't have the time to get it up (was a hackathon). Liked the await stuff in c#.
09:47_zachIs there a particularly good way to extend a particular protocol implementation to all types that meet a certain interface?
09:48_zachRight now I'm extending LazySeq, PersistentVector, etc... in reality, I just want everything that's sequential
09:48augustlsunkencityryleh: I'm mostly using the desktop for now, since I don't have a tablet yet.. Tablet part would be mostly for reading PDFs and stuff.
09:51clgv_zach: extend on clojure.lang.Sequential
09:52znDuff_zach: I just tested that extending clojure.lang.ISeq works...
09:52_zachThank you both.
09:52_zachThat makes perfect sense.
09:53znDuffHmm.
09:54_zachThat's okay, I have a much better idea what to look for now. Thanks!
09:56clgv,(map #(instance? clojure.lang.Sequential %) [[] () (lazy-seq) (cons 1 nil) {} #{}])
09:56clojurebot(true true true true false ...)
09:56clgv&(map #(instance? clojure.lang.Sequential %) [[] () (lazy-seq) (cons 1 nil) {} #{}])
09:56lazybot⇒ (true true true true false false)
09:58_zachThanks clgv
10:25randomenduserhello, I'm reading 'Clojure Programming' and just read "lojure regex literals yield are entirely
10:25randomenduserequivalent to those you might create within Java, and therefore use the generally ex-
10:25randomendusercellent java.util.regex regular expression implementation
10:25randomenduser(sorry for the spam)
10:26randomenduserwhat makes java's regex good? how does it compare w/pcre?
10:28solussdis there any way to add assertions / :pre conditions to the auto-generated constructor functions for records (i.e. ->Record and map->Record)?
10:28znDuffrandomenduser: the Java documentation explicitly covers differences from PCRE.
10:29znDuffrandomenduser: search for "Comparison to Perl 5" in http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
10:29randomenduserznDuff: ahh, thanks. should've searched for 'perl' instead of 'pcre' :P
10:30TimMcI don
10:30TimMcI don't know if Java's regex engine can be called "excellent", but it's not shitty.
10:32mmitchellAnyone have an opinion on what the best emacs start-kit w/clojure support is?
10:32znDuffmmitchell: emacs-live
10:32znDuffsolussd: I've seen some 3rd-party implementations defrecord, ie. "defrecord2", which might be a place to start if you want to add features
10:32TimMchttp://swtch.com/~rsc/regexp/regexp1.html <-- interesting comparison of regex engines with pathological cases.
10:33mmitchellznDuff: ok cool, have you tried the original technomancy start-kit?
10:33znDuffmmitchell: ages ago.
10:33randomenduserI thought pcre was the desirable standard for regular expressions, why not ensure compatibility? reading the differences, they seem minor, but why not go for complete compatibility?
10:34znDuffrandomenduser: Actually -- I'd say that Java's standard picks up too many things from PCRE.
10:34randomenduserznDuff: why is that?
10:34znDuffrandomenduser: PCRE supports features which don't lend themselves to performant implementation. See also TimMc's link.
10:35randomenduserznDuff: gotcha, reading it now :)
10:35TimMcWhat I'd like to see is something that first check the pattern for certain characteristics, then picks an engine to use for it. :-P
10:36TimMcYou'd have to make sure that there are no pathological cases in the analysis step.
10:36randomenduserTimMc: sounds like a project to me
10:36TimMcWell, one problem is that the different engines out there generally have different feature sets, which complicates things.
10:37gauravagI am trying to write a simple tail recursive algorithm to find gcd of two numbers.. It is in this gist..
10:37gauravaghttps://gist.github.com/4060000
10:37gauravageven with relatively small numbers like 21 and 7
10:37randomenduserwell you could pick the lowest common denomenator and annotate your implementation w/a big disclaimer
10:37gauravagI get a ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1374)
10:37gauravagin the repl..
10:38znDuffrandomenduser: if one were using the lowest-common-denominator, you'd only need one engine for that -- which already exists, and is tremendously fast.
10:38gauravagcan someone help me with the aboce?
10:39randomenduserznDuff: oh, looks like I have more reading to do then >.>
10:39gfredericksgauravag: a side note is that you don't need loop there
10:39TimMcWhat you could do is check if the pattern is a member of that set, then use the super-fast engine for it.
10:39gfredericksyou can recur to the function itself
10:40gauravagI thought loop and recur were used for optimization by tail recursion
10:40gfredericksyes but you can use recur without loop
10:40TimMcSo is fn/recur.
10:41gfredericksin any case I'm not convinced the algorithm is correct; so it might have something to do with that
10:41gfredericksI can imagine it exploding into large negative numbers
10:41gfredericksyou could add a println to check that
10:42gauravagI really am just starting now with clojure.. not really sure how I add println..
10:43TimMcjust say (println x y) after the loop line
10:43TimMcThe loop body can have multiple expressions, and only returns the value of the last one after executing them in sequence.
10:44gauravagall right cool..
10:44gauravagbtw I called the function using (gcd 4 2)
10:44gauravagreturn 2, which is right
10:44gauravagbut with any number higher it bombs
10:45gfredericksmy guess is that if it's wrong it's related to the fact that (- x y) isn't always smaller than y
10:46gauravagI always called it using x being created than y
10:46gauravaggreater*
10:46gauravaglet me try this very quickly..
10:47gfrederickssure but if you call it with 14 and 5 for example
10:47gfredericks14 - 5 = 9, which is still greater than 5
10:47TimMcI seem to recall the Euclidian GCD algorithm requiring that you switch the numbers if they are in the wrong order.
10:48gfredericksyeah that would probably fix it
10:48gfredericksthe more efficient way of fixing it is using rem instead of subtraction
10:49gauravag(rem 21 7) gives 0!
10:49AWizzArdIs there a Leiningen plugin that works with Leiningen 2 (Preview 10), which packs a webapp into a .war file?
10:49gauravagam I doing something wrong here?
10:49mmitchellznDuff: so does the latest emacs-live require nREPL running in my projects in order to connect?
10:51znDuffmmitchell: it no longer supports slime/swank, if that's what you're asking.
10:51gauravagthanks guys.. updating the gist with the right algo..
10:52mmitchellznDuff: ahh ok, yes that's what I was asking, thanks. Is getting my app setup with nREPL pretty straight forward?
10:52ejackson,(* 3 7)
10:52clojurebot21
10:55znDuffmmitchell: it's not easier or harder than slime or swank, usually. There are corner cases where there are differences in ease-of-setup -- nrepl is easier to get going inside an OSGi container, for instance.
10:57mmitchellznDuff: cool ok, yeah just went through some of the nREPL docs, looks straight forward
11:02gfredericksgauravag: (rem 21 7) => is what you'd want for your algorithm
11:03gauravaggfredricks: yeah.. I have added a comment.. the last one shows the updated algorithm..
11:04gauravagI wasn't aware that the sub can be replaced by rem though.. thank you for the tip..
11:07gauravaggfredricks: it still has a few rough edges though..
11:32edwAnyone here know how to make a JS array a sequence in CLJS, off-hand?
11:33scriptorwouldn't just seq work?
11:34edw(Trying to use a JS object as an argument to GET-IN...)
11:34edwOne would think...
11:35edwAnd that would be correct! It helps to specify the arguments of GET-IN in the correct order.
11:42muhooAWizzArd: "lein ring war"
11:42muhooAWizzArd: actually "lein ring uberwar"
12:29TimMcgauravag: (if (< x y) (recur y x) ...)
12:30TimMcMaybe that does it?
12:30degI'm trying to do output within map within a with-open, but the stream is already closed. I assume that I'm misunderstanding the scoping model, or something...
12:30deg(with-open [w (clojure.java.io/writer "hrules.chrif")] (map #(doto w (.write %)) [1 2 3 4 5]))
12:30degIOException Stream closed java.io.BufferedWriter.ensureOpen (:-1)
12:30technomancyclojurebot: map?
12:30clojurebotmap is hiredman
12:30technomancyaw come on clojurebot
12:30technomancyclojurebot: map?
12:30clojurebotmap is *LAZY*
12:30technomancy^^ there we go
12:30TimMcclojurebot: forget map |is| hiredman
12:30clojurebotI forgot that map is hiredman
12:31technomancyTimMc: I'm afraid that might be his inference engine kicking in
12:31TimMcugh
12:31technomancyhiredman is lazy -> map is hiredman perhaps?
12:36ieslickI'm using the latest leiningen2 and trying to launch something that runs perfectly with lein swank, but I keep getting NullPointer or ClassDefNotFound errors using 'lein2 run'
12:36ieslickI must be missing something basic around the classpath and main
12:37ieslicke.g. Exception in thread "main" java.lang.NoClassDefFoundError: experiment/infra/protocols/Lifecycle at experiment.main__init.load(Unknown Source) at experiment.main__init.<clinit>(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at clojure.lang.RT.loadClassForName(RT.java:2056) at clojure.lang.RT.load(RT.java:419) at clojure.lang.RT.load(RT.java:400) at clojure.core$load$f
12:41AWizzArdmuhoo: ah nice, I didn’t know that this was already integrated into ring.
12:44TimMc~botsmack
12:44clojurebotOwww!
12:44raekieslick: it sounds like you have ahead of time compiled code in your classes/ dir
12:45raekand that you changed to a new clojure version
12:45technomancynoclassdef is usually not from clojure version mismatches
12:45ieslick<raek> It's a freshly pulled git distribution, I deleted target/classes, reran deps, etc. WIll look into version issues
12:46technomancyieslick: protocols break when the underlying class files get wiped out from under them
12:46technomancyieslick: unlike regular Clojure defns they're unable to fall back to the JIT-compiled equivalents
12:46technomancyone of many reasons not to use them if you don't need the speed they provide
12:47ieslicktechnomancy: so a fresh compile, followed by lein run should resolve?
12:47technomancyieslick: depends on where the protocols are defined and where they're consumed
12:48ieslickYeah, I tend to prefer multimethods but did some work with Relevance and Stuart Sierra added a bunch of protocols to the system
12:48technomancyah, bummer
12:51ieslickHowever, all the protocols are in a single file with no external dependencies and are pulled in by a number of subsystems that implement or use them. Pretty simple.
12:52ieslicklein deps :tree shows the use of a global :exclusion of clojure.org/clojure
12:53ieslickIf I remove that from the project.clj, then I clearly have version issues. I should have only clojure 1.4 pulled in with that added to top of projects.clj
12:58ieslickSimple question then: is it imperative to aot compile protocol files for use in lein run vs. interactive use in lein swank?
12:58technomancybest to completely avoid AOT if possible
12:58technomancyor rather: AOT everything, but during deployment only
12:59ieslickSo add :aot :all to the deploy profile in lein2?
13:00technomancysure
13:00ieslick(Appreciate the help, this part of clojure is fairly opaque to me despite a few years with the language, I rarely do anything outside lein swank)
13:00technomancyyou can do it from the command-line as well: lein compile :all
13:00technomancyyeah, my only experience with protocols is basically just helping people over IRC who find themselves in protocol-driven messes =)
13:00ieslickUltimately trying to get this as part of an autodeploy script using chef... :)
13:01ieslickFortunately day to day use of protocols in the lein swank context has been a non-issue
13:03ieslickSurprised there isn't a canonical "learning to live with defprotocol" document on Google...maybe when the curent project is over I'll add one!
13:04ivenkysAny suggestions for Clojure for Java,C++ devs ?
13:04antares_ivenkys: learning materials?
13:05llasramHuh. I haven't run into this problem when using protocols... Requiring the namespace which defines the protocol should create and load the class...
13:05ivenkysantares_: yup - google and stackoverflow are full of suggestions , but ultimately confusing - i am looking for people who have "walked that way"
13:05technomancyllasram: yeah, but if other code that uses the protocol has been AOTed then it can be a real mess
13:06antares_ivenkys: http://blip.tv/clojure/clojure-for-java-programmers-1-of-2-989128, http://blip.tv/clojure/clojure-for-java-programmers-2-of-2-989262, clojurebook.com and http://clojure-doc.org
13:07ivenkysantares_: are those videos the famous "ant demo"
13:08antares_ivenkys: I don't think so
13:08ivenkysantares_: ah ok - thanks -
13:12llasramtechnomancy: Oh, right. I was thinking of the no-AOT case, which is what I try to go for
13:13mdainesI must be missing it in the docs, but how to do you reload your code in lein? Doing (require ...) again doesn't do it
13:14mdainessorry, lien repl
13:14antares_mdaines: try (require … :reload :all)
13:16mdainesHmm, was :all added recently? I get an unsupported op error.
13:17mdainesSorry, typo. Got it
13:17mdainesThanks, antares_
13:17TimMcantares_: Not :reload-all ?
13:20nightfly_Does emacs nrepl mode give you something like slimes C-c C-k and C-c C-c for compiling the currently edited file?
13:21technomancynightfly_: sure; in most cases the bindings are the same
13:26eggheadin maven, is there any way to get the same effect as 'lein uberjar' from the output of 'lein pom' ?
13:28eggheador is there any suggested way to integrate lein into jenkins?
13:29technomancyegghead: there's a jenkins plugin for lein, but it's so simple to just shell out that I don't know if it's worth bothering with
13:30eggheadtechnomancy: just a pre-build execution phase directly invoking lein?
13:30eggheadi.e. maintaining lein on the build box rather than via jenkins?
13:31technomancyegghead: right. you can manually install the lein plugin, or you can manually install leiningen itself.
13:32technomancyI haven't done jenkins in a while but it doesn't seem like a lot of value-add
13:34nightfly_technomancy: Awesome! I guess I just tried C-c C-c, had it not work, and assumed all the bindings would be different.
13:35technomancyC-c C-c is an alias for C-M-x IIRC
14:01ChironHi, I have a seq of files and i want to post them to an endpoint in one post . i don't want to create a post for each file . would u please help with a snippet if that using clj-http ?
14:03piranhaThere was long discussion about reactive programming for uis in clojurescript in clojure-dev. I've read it and wikipedia page on reactive programming and it seems that unfortunately I'm unable to learn without examples. Can somebody share a link to CLJS app using reactive programming style? I just don't get idea at all. :(
14:04technomancypiranha: have you looked at elm at all?
14:04augustlpiranha: not really an answer, but iirc the most common way to do UI programming in a functional style is to keep the mutable tree structure representing your UI, and treat it as I/O
14:04technomancynot cljs, but it looks like they have a lot of this stuff figured out: http://elm-lang.org/
14:04piranhatechnomancy: nope
14:04piranhaah!
14:04piranhathis elm
14:05piranhayes, a bit... and also at RxJS
14:05piranhaaugustl: well, right, that's what I thought, and I even have started laying out my own thoughts: http://github.com/piranha/mesto - some in-memory storage (atom), which has ability to notify subscribers about updates
14:06piranhabut as I think about it more, I'm wondering if I'm doing something really wrong, because of my bias towards Backbone.js-like model layer
14:06augustlUI programming is the only perfect use case for OO I'm aware of though.. just sayin' :)
14:07nbeloglazovChiron: you want to use multipart post requests?
14:07piranhaso if somebody could give me some feedback on that, that would be equally nice to good example :))
14:07piranhaaugustl: well... that's an uneasy thought, hah :-)
14:07Chironyes
14:07piranhawhy would someone use cljs then? :P
14:07augustlI don't ;)
14:07nbeloglazovdid you try functions from clj-http.multipart?
14:07augustlbut now I'm _definitely_ not answering your question
14:08piranhaaugustl: :-)) sure, thanks anyway
14:10nbeloglazovChiron: I think it's something like (multipart/create-multipart-entity (map #(multipart/make-file-body {:content %}) [file-1 file-2 file-3])))
14:14Chironthat is clj-http ?
14:17nbeloglazovChiron: yes
14:18nbeloglazovAt least it's in repo: https://github.com/dakrone/clj-http/blob/master/src/clj_http/multipart.clj
14:19Chironoh i see
14:22Chironwhere to set the endpoint url ?
14:29nbeloglazovChiron: there is actually an example on main page: https://github.com/dakrone/clj-http Search for "Multipart form uploads"
14:30Netfeedwhat's the best way to destruct the the content from a form into a regular hash in noir? i don't want to do something like {:keys [foo bar]} but i rather want it to be something like {:foo 1 :bar 2}
14:31rodnaphNetfeed: is that not what u start with?
14:31nbeloglazovI have 2 almost identical pieces of code. They both solve task 120 on 4clojure: https://www.4clojure.com/problem/120 . One of them passes all tests, the other fails with timed out exception. Only difference that I use (* v v) in the first and (Math/pow v 2) in the second. Is it caused by clojail?
14:31nbeloglazovhttps://www.refheap.com/paste/6589 code
14:32Netfeedrodnaph: honestly, i'm not really sure, i can't find any good examples for how i just get the "raw" in hash
14:33technomancynbeloglazov: Math/pow forces everything into floats unfortunately
14:33technomancykind of ridiculous really
14:33nbeloglazovBut there is on difference between 2 versions on local computer
14:33rodnaphNetfeed: i'd (println req) if u can see the console
14:33nbeloglazovBut on 4clojure first one executes about 1-2 second. And second takes about 10 seconds with time out
14:38Netfeedooh, should be {:as params} got to learn to read the docs properly
14:48TolstoyGot a function (defn foo [x] ...)
14:48TolstoyA string "(foo 1)".
14:48amalloydon't do it, man
14:48TolstoyBut (eval (read-string "(foo 1)")) doesn't apply the function.
14:48Tolstoyamalloy: this is just a one-off hack for some testing, not a Real App and Best Practice.
14:49amalloyeval is probably in a namespace/context where foo isn't imported
14:49TolstoyUnable to resolve foo "blah".
14:49amalloyiirc it runs in clojure.core
14:49TolstoySo, some sort of intern thing?
14:49amalloyuh?
14:50amalloyi mean, you can probably (binding [*ns* (find-ns 'the-ns-with-foo)] (eval ...))
14:51TolstoySo eval inside a namespace doesn't automatically, uh, do the evaluation in the context of the namespace?
14:51amalloy*ns* isn't bound at runtime, and if it were the results would be more confusing
14:53TolstoyThe binding you mentioned above got rid of the exceptions. Am I misunderstanding that eval calls a function?
14:54amalloypretty much everything in clojure calls a function at some point
14:54amalloyeval invokes the compiler on a form, in a null lexical context, and runs the bytecode that gets output
14:54noidiis there any way to do `foo.bar += 123` in ClojureScript?
14:54TolstoyAh, I'd messed up the expression. Seems to work, now.
14:55TolstoyThanks!
15:02antares_noidi: ClojureScript data structures are immutable. Use an atom.
15:04znDuffnoidi: it _can_ be done, but it's not at all idiomatic. Can you provide more details on your use case?
15:43ToBeReplacedpreferred way to reconstruct url from request map? seems dirty/wrong to do (URL. (name scheme) server-name server-port uri)
15:47trmswis anyone successfully using ritz + slime?
15:48trmswI can start the server and slime-connect doesn't give an error, but it doesn't give me a repl either
15:50wingywhat does "sid" stand for?
15:51trmswSidney?
15:51wingysomething with id
15:51wingylike uid = uniquie identifier
15:51amalloyi know some folks named sid
15:51wingy:)
15:54jkkramerToBeReplaced: https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/util/request.clj#L4
15:54ToBeReplacedjkkramer thanks
15:57trmswwingy: session id / special id / string id? Depends on context
16:02rbxbxAny thoughts as to why I'd be seeing "Error loading project.clj" when running lein new (or any other command that shouldn't require presence of said file ie: `lein repl` or just `lein`)
16:02wingytrmsw: yeah .. session id was a good shot
16:03rbxbxtrmsw wingy session id is what I've typically seen
16:42zackzackzackIs it possible to do something like lein-checkouts but with java source files instead of clojure?
16:50ieslickSolution to earlier AOT loading problem in a main statement due to Protocols...
16:51ieslickDirectly referring to a protocol-carrying namespace from an aot compiled file like a -main function is the problem
16:51ieslickIf you have no _direct_ dependencies, then it loads fine. I presume that the classloader environment during compilation is different than during normal loading and that explains the errors
16:56technomancyhm... I wonder if we could move auto-AOT of :main to the uberjar task
16:57technomancy~60% of the time it's useless
16:57clojurebotforget botsnack is scoobysnack
16:57technomancyclojurebot: you're a laugh a minute; you know that?
16:57clojurebotha ha
16:58mdainesIs there a naming convention on defrecords? CamelCase Skewer-Case ?
16:58amalloycamel
16:58ieslickIt might be nice to require AOT compiling of main explicitly so it's less surprising when it barfs
16:59technomancyieslick: yeah, I think the current behaviour is too clever
16:59mdainesamalloy, thanks. Is that because of Java interaction?
16:59technomancyieslick: it made sense before the run task existed
16:59amalloyyes. a defrecord creates a named java class
17:07tgoossenshi
17:07tgoossensI don't understand what is going on here: ,reduce (fn [m i] (+ m 1)) 0
17:07tgoossens,reduce (fn [m i] (+ m 1)) 0
17:07clojurebot#<core$reduce clojure.core$reduce@188ae07d>
17:08tgoossenswhat does this line of code mean?
17:09zackzackzack,(reduce (fn [m i] (+ m 1)) 0)
17:09clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
17:09tgoossensit a solution for the problem here: http://www.4clojure.com/problem/22#prob-title
17:09tgoossensmy solution might be a bit overcomplicated
17:09tgoossens,(fn [coll] (loop [index 0 c coll]
17:09tgoossens (if (empty? c) index (recur (+ index 1) (rest c)))))
17:09clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
17:09tgoossens
17:09zackzackzackreduce takes a function and a list and "folds" the list according to the function
17:09tgoossensyes
17:10tgoossensi know reduce. but i don't understand the way it is used there
17:10tgoossensi thought you had to do (reduce ...)
17:10tgoossens(syntax misunderstanding)
17:11zackzackzackYou do. When you are using it that way in 4clojure, you are putting that code directly in there
17:11tgoossensoh. yes of course
17:11tgoossensstupid me
17:12zackzackzackYou probably want (partial reduce #(inc %1)) or something
17:13tgoossensmm thats also cool
17:13tgoossensi guess that my solution is a bit bloated
17:13zackzackzackYeah, this does it, (partial reduce (fn [m i] (+ 1 m)) 0)
17:14tgoossensnot even sure whether it is efficient what i wrote
17:14amalloytgoossens: your solution is fine. 4clojure solutions are sometimes written in as few characters as possible for fun
17:15zackzackzackYeah, the one I gave is just using a bunch of built in functions from clojure to make it short.
17:15danlarkin8
17:15hiredman7
17:16tgoossensi just discovered 4clojure
17:18tgoossensits funny
17:19mdainesWith records, can you "extend" them? For example, defrecord Alpha [a b c] ... defrecord Beta [... d]
17:19wingywhat is new in 1.5?
17:24Bronsareducers?
17:24clojurebotreducers are http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
17:27technomancypoll: does anyone rely on the fact Leiningen makes :main trigger AOT outside the uberjar task?
17:27technomancyI believe this is a misfeature but don't want to break things
17:30muhooit does? weird.
17:31technomancyit used to make sense before the run task existed because :main used to only be about uberjars
17:31wingyBronsa: need to understand it .. so hard
17:31llasramtechnomancy: nack
17:32Raynesmuhoo: So, are you sold on monads yet?
17:33technomancy2/2 in favour; motion passes
17:34llasramI love democracy!
17:35technomancyclojurebot: monad labyrinth is http://oglaf.com/labyrinth/
17:35clojurebotRoger.
17:50TimMchmm
17:50TimMcclojurebot: monad labyrinth is http://oglaf.com/labyrinth/ (SFW, but has NSFW links)
17:50clojurebotIk begrijp
17:51TimMcclojurebot: forget monad labyrinth |is| http://oglaf.com/labyrinth/
17:51clojurebotI forgot that monad labyrinth is http://oglaf.com/labyrinth/
17:51tgoossenswhats the difference between rest and next
17:51amalloy(= next (comp seq rest))
17:52technomancyTimMc: ah yes, good call; thanks
17:53tgoossensso the differnce is
17:53tgoossensit will return nil
17:54tgoossensand rest will return empty set
18:02TimMcempty seq
18:14tgoossenswhy would someone do this: (fn [xs] (= (map identity xs) (reverse xs))) instead of just (fn [xs] (= xs (reverse xs)))
18:14tgoossenshas it to do something with laziness?
18:15amalloy&(= "racecar" (reverse "racecar"))
18:15lazybot⇒ false
18:15tgoossensinteresting
18:15amalloy&(= (seq "racecar") (reverse "racecar"))
18:15lazybot⇒ true
18:31SgeoUh
18:31SgeoI didn't just crash tryclj, did I?
18:32unnalinetsplit!
18:34SgeoHow can I print out all the digits of Float/MAX_VALUE?
18:37hyPiRion,(printf "%f" Float/MAX_VALUE)
18:38clojurebot340282346638528860000000000000000000000.000000
18:39SgeoAh, thank you
18:40ieureIs there some way to speed up lein? I'm on 1.7.x and it takes upwards of 3m to uberjar a project with ~600 LOC.
18:41ieureActually, never mind.
18:41ieureI have 800mb in resources
18:41ieureI bet that would do it, eh?
18:41technomancyieure: any particular reason you're still on 1.x?
18:41ieuretechnomancy: Inertia.
18:42technomancysomeone just told me they sped up uberjar by a factor of 1 hella by upgrading to 2.x
18:42ieureIs 2.0 final?
18:42ieureLast I checked it was still pre-release.
18:42technomancyit's super stable
18:42technomancyit's only still in preview due to a technicality
18:42technomancyeven that will be addressed in a week or two
18:43ieureAwesome.
18:43ieureThis is a side thing.
18:43ieureReal work uses Maven to build the few Clojure projects.
18:43technomancysounds like fun
18:43ieureBecause most of our stuff is Scala, and it was easier to build Clojure with Maven than to rejigger Jenkins to know about another project type.
18:43ieureIt's fine.
18:44technomancyhuh... so that's the second time that's come up today. what benefit do you get from jenkins integration?
18:44technomancyI've never used it for anything other than "here's a couple shell commands to run"
18:44ieureIt drives the whole build and release cycle.
18:44ieurePush code to the repo -> Jenkins builds it tells you if something broke.
18:44technomancysure?
18:44technomancywhy do you need tool integration for that?
18:45technomancyisn't that what exit codes are for?
18:45ieureWe don't need anything on the leon side.
18:45TimMc~leon
18:45clojurebotleon is a good sign it's time to turn off auto-"correct"
18:45TimMc:-D
18:45ieureHah.
18:45ieureYeah.
18:45ieureBut we'd have to create a setup that knows how to invoke lein, run tests, etc.
18:45technomancyso it's just a uniformity thing?
18:45ieureYeah.
18:46ieureManaging Jenkins jobs is a pain, so we have a tool to create jobs for different build types. And it doesn't know about lein, because this was the first thing I did that used Clojure.
18:46ieureSo rather than fuck with that, I just used Maven.
18:47technomancylein do test, uberjar && s3cmd put target/myproj-*standalone.jar s3://builds/ # <- typically what I'd use
18:47ieureTrust me, I know how to set up Jenkins to do stuff.
18:47technomancyor even better, just shell out to bin/ci so it's all first-class
18:47ieureThat introduces its own set of issues.
18:48technomancyhow so?
18:48eggheadI just set it up with lein test && lein uberjar, then showed jenkins where the artifacts live
18:48eggheadi.e. target/*standalone.jar
18:48ieureNow you have a hundred copies of bin/ci in your repos all mostly alike but often slightly different.
18:48mammothhello guys
18:48eggheadoh hi mammoth
18:48ieureSo you start a new project and cargo-cult bin/ci from another one.
18:49ieureAnd if you need to change how they all run, you have to go update N repos.
18:49technomancyieure: yeah, but otherwise you have situations where have to change your job config when a branch gets merged
18:49technomancybut yeah, the target bucket should probably be in an env var or something
18:49mammothdoes clojure have equivalent of java arrays as datastructure?
18:49mammothand if yes, how is immutability handled?
18:50eggheadmammoth: what are you looking for in a java array
18:50ieuretechnomancy: Sometimes. So we have a tool that creates or recreates job configs. So if you need to make a change, you change it in one place and regen all the jobs.
18:50technomancyieure: yeah, if you've already gone down the path of a tool to write job configs I guess that makes sense
18:50eggheadclojure has clojure.lang.PersistentVector which maybe does what you want
18:50TimMcaka vector
18:51technomancyI had a hell of a time trying to automate that and would argue it's not worth the hassle personally
18:51mammothegghead: say I have a strategy game in mind. This game needs array to put terrain in. Also for implementing patfinding.
18:52mammoth*pathfinding
18:52ieuremammoth: Why can't it use a vector?
18:53mammothieure: seems wastefull for rectangular map. You think it isn't?
18:53technomancymeasure twice, cut once
18:54eggheadsuch is the price we pay for immutability
18:54ieuremammoth: Guess it depends on how big your map is, but I'd just roll with it.
18:54mammothhere's the problem: the map is supposed to be, huge. Like, stupid big.
18:55eggheadperhaps it should be in a datastore?
18:56Apage43mammoth: if the thing is sparse and tiled, perhaps use a map of coordinate pairs to things that live there
18:57mammothApage43: that's actually a possibility. Terrain could be vectorized (mountain height here instead of keeping whole thing in memmory) Still not sure what to do with pathfinding thing.
18:58Apage43well your pathfinding really just needs to know if a location is traversible
18:59mammothegghead: how would you handle it in a datastore?
18:59Apage43so as long as you can provide a (can-i-go-to? x y)
18:59Apage43you should be okay
18:59mammothso you think I should implement pathfinding in java?
18:59mammothand clojure would only have handle to it?
19:00Apage43I'm just a bit lost as to what the issue is
19:01mammothissue is that clojure seems to lack java array, and any other way to implement terrain seems a bit wasteful.
19:02callenmammoth: what makes it unreasonable to use a vec?
19:02mammothnothing is unreasonable per se.
19:02eggheadpremature optimization etc etc
19:02callenmammoth: what's the problem then?
19:02callenmammoth: why not make it with a vec and then optimize it if there's an actual problem?
19:03mammothegghead explained it for you :)
19:03callenmammoth: Clojure's design makes it really easy to perform Indiana Jones style swaps of data structures after the fact without restructuring tons of code.
19:03callenmammoth: well...don't?
19:03callenseriously, don't prematurely optimize, it upsets me.
19:03mammothlol :-)
19:04Apage43if you -have- to go there, the support is there
19:04callenright which is kinda my point.
19:05callenmammoth: so what's the problem then?
19:07eggheadlol callen
19:07mammothI am basically exploring (just exploring at this point, don't get your hopes up) weither clojure is viable for creating RTS-style game (not exactly rts but you get the idea). The thing I would hat most is to seriously bite into it only to find out that something can't be done after I am commited.
19:07egghead'indiana jones style swaps of data structures' -- nice
19:07callenmammoth: okay so, this is actually a pet subject of mine. I have some strong opinions but bear with me.
19:08mammothwhat is pet subject of yours? Optimization?
19:08mammoth*hate most
19:08callenmammoth: making games in not-C/C++
19:08callenmammoth: generally speaking, when you make a game in a higher-level environment than C/C++, you've got a few options. 1. browser 2. JVM 3. C#/Mono 4. the rest
19:08callenthe "rest" can be summarized as frameworks like Love, PyGame, etc.
19:09callen#4 is good for validating a basic, small, limited version of an idea.
19:09callenbut you can't really make a finished or shippable product that way.
19:09callenC#/Mono is a fairly well-trodden realm and has about the same extent of universality as a game well-engineered in C++
19:09callenBastion was a MonoGame, and it was on NativeClient for Google Chrome, Win, Mac, Lin, etc.
19:09callenthere are still some serious limitations
19:10callenthe JVM isn't as well explored, but obviously you've got Minecraft and some odds and ends.
19:10callenhere's the problem, the problem with games is that usually if you're trying to make a fairly modern game...especially a real-time one, using a HLL will bite you hard at some point
19:10eggheadfrom what I understand people don't really use clojure for the performance, and all performance sensitive stuff ends up being implemented in java
19:10callenegghead: depends on the problem, but basically yes. This isn't about that though.
19:10callenand it may or may not be possible to work around the issues, but it's not always possible.
19:10mammothcallen: the thing about RTS is that they are really turn based, but turn expires quickly (in AoE 0.25 times per sec).
19:11technomancyjust use ocaml, duh
19:11technomancy=)
19:11callenThe problem with games just isn't raw throughput, which is the sort of thing people often use Java for
19:11callenit's latency and real-time
19:11_tcaGARBAGE COLLECTION
19:11callenalso the graphics pipelines are INSANELY immature.
19:11callen_tca: I didn't want to be that direct, but yes.
19:12callenmammoth: the immaturity of the graphics pipelines combined with GC and the inability to get directly at the hardware will eventually fuck you unless you're not trying to make a very real-time or graphically intensive game.
19:12callenmammoth: even Minecraft has performance issues at many levels and in many situations, which is absurd.
19:12mammothcallen: I am gonna use Panda3d for graphic stuff. I'll write small client in python and jvm will be a server with actuall game.
19:12_tcahe was alreayd in here talking about it a couple weeks ago
19:12_tcafrom what he said it sounded like clojure should be fine
19:12callenmammoth: mock up however suits you, just be aware that you'll run into a brick-wall eventually.
19:13callenif you expect more intensive graphics or real-time behavior.
19:13callenif neither of those are an issue, then you're probably fine.
19:13mammothcallen: I don't expect ANY graphic
19:13mammothcallen: that's panda3d for.
19:13mammothcallen: nor any phisics
19:13callenI don't think that's a very accurate or realistic way of putting it.
19:13mammothcallen: physics
19:13callenpanda3d is still graphics.
19:14mammothcallen: which is at client
19:14mammothwhile JVM is server
19:14callenmammoth: I don't think it's profitable to discuss it much further. Just do your thing man :)
19:14callenmammoth: don't preoptimize, just go make it.
19:14callensee what happens.
19:15mammothcallen: but seriously, if it doesn't have true real time (like fps), nor does it handles graphic, what exactly can go wrong, assuming suitable data structures are in place?
19:16mammothcallen: I am not saying it can't I just don't see what can
19:16callenmammoth: you can't really make general statements like that, it depends entirely on what you're doing.
19:16callenmammoth: I can imagine a lot going wrong, but I've been programming long enough to have my youthful optimism curb-stomped a long time ago.
19:16callenmammoth: just. go. do. it.
19:17callenseriously, stop talking to us about it. go make something.
19:17callen100,000 people talk about what they'd like to make everyday on the internet instead of coding. Don't be one of those people.
19:17mammothcallen: so my optimism can be curb-stomped, too?
19:17mammothlol
19:17callenmammoth: go make.
19:17mammoththanks
19:17mammothI will sir
19:18technomancycallen: but can mongodb _actually_ scale?
19:19eggheaddepends, do you need your data to be consistent?
19:19callentechnomancy: as a mongodb user, I will now proceed to violently vomit blood on your shoes.
19:19callenegghead: MongoDB is a consistent data store actually. It's CP.
19:19callenIt's just not highly available unless you make consistency trade-offs
19:19callenwhich is true of anything.
19:19eggheadright
19:20callenI think you mean durable, which it is.
19:20callenIf you remember to turn journaling on.
19:20callenif you don't, you deserve to lose your data. Tough cookies.
19:20eggheadnot everything is atomic, is it?
19:20callenAll document operations are atomic.
19:20callenDon't follow the fads unless you're willing to read the manual.
19:21eggheadmeh, I don't admin our mongo cluster, I just use it
19:21egghead:)
19:21Apage43whoaaa
19:21callenegghead: just speaking in general about the complainers.
19:21callenegghead: I'm not that big a fan of MongoDB, it's just that most people complain about the canards, not the real problems.
19:41amalloyanyone know if there's a good way in core.match to match a seq like "at least three elements, the second of which is :foo"? i've tried ([x :foo y & more] :seq), but as of 0.2.0-alpha9 that matches even with only two elements, binding y to nil and more to ()
20:19muhooRaynes: yeah, amalloy's explanation, as was to be expected, was decisively authoritative.
20:20muhoothe real problem is that i'm spending too much time writing java.
20:21muhooor, at present PROCRASTINATING from writing java :-/
20:33amalloymuhoo: i'm still getting the hang of them myself. it's amazing some of the functions you can write that work on any monad rather than some particular monad. yesterday i saw: powerSet = filterM (const [True,False]); powerSet [1,2,3] -- returns [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]]
20:38brehautamalloy: by not referring to a particular monad are you refering to filterM rather than powerset?
20:39amalloyyes
20:42amalloysomeone said "hey, here's something useful that makes sense for anything monadic", and wrote filterM; when applied to lists it happens to do this awesome thing
20:44brehautyeah, from memory a bunch of the functions that are sort of intended to work with the IO monad as control flow functions, have similar cool utility with other monadic structures
20:44brainproxyamalloy: i'm not sure what filterm does exactly, but I'll look to add it to protocol.monads
20:44brainproxyalready have liftM
20:45brehautit'd be sad day if it didnt
20:45brainproxy:)
20:45brehautwhats the deal with protocol.monads vs algo.monads?
20:45HodappI just wrote 'disclojure' in my notes instead of 'disclosure'. Screw all of you.
20:45brehaut(other than the implementation strategy)
20:45amalloybrehaut: iirc algo.monads is a bit rubbish?
20:45brainproxybrehaut: it's the implementation strategy, for the most part
20:46brainproxybut then you don't have to setup the computations using with-monad
20:46brehautamalloy: in my experience, its a bit blunt, but did the job ok
20:47brainproxybrehaut: trivial example
20:47brainproxy(m/plus [(list 1 2) (list 3 4)])
20:47brainproxywill automatically do the right thing
20:47brehautright
20:47brainproxyas plus is defined on the type
20:48brainproxyalso (m/plus [(m/maybe nil) (m/maybe 1])
20:48amalloybrehaut: well for example, its Maybe doesn't satisfy the monad laws? because it uses nil as m-zero. you can't have a Just Nothing or a Maybe Maybe x
20:48brehautamalloy: aha yes thats true. so protoocol.monads has a real maybe type then?
20:48brainproxyamalloy: that's taken care of with protcol-monads, but the factory function for maybe still does nil -> maybe-zero-val for convenience
20:48brainproxyhowever, the monad laws are still obeyed
20:49amalloywhat factory function?
20:49brainproxy(m/maybe value)
20:49brainproxyreturns type core.monads.Maybe
20:49brainproxywith value inside it
20:49brainproxyso m/maybe is the factory
20:49amalloysure, sounds reasonable
20:50amalloyas long as there's a way to create a Nothing or a Just explicitly, which i assume there is
20:50brainproxysee https://github.com/michaelsbradleyjr/protocol-monads/blob/examples/test/monads/test/core.clj#L288
20:50brainproxyI've been doing a lot (!) of work on my examples branches of my protocol-monads fork
20:50brainproxyI'll be merging into master probably tongith, and will push to clojars
20:51brainproxyjimduey may merge in my stuff at some point
20:51brainproxyback to the maybe thing... long story short, if you want to pass nil around inside Maybe, you can
20:51brainproxyyou would just write a non nil->maybe-zero-val casting factory for maybe
20:54brehautso is algo.monads effectively dead at this point?
20:54brehautor are they being developed in paralell?
20:54brainproxybrehaut: i think konrad hinsen is still maintaining it
20:55brainproxylast commit was a couple of months ago, but it's pretty mature
20:55brainproxynot a bad tool, just has some tradeoffs
20:55brehautit does. i've got a lib that depends on it, and its been in snapshot for ages. im just wondering if its worth cutting my losses
20:55brainproxyas does protocol-monads, which is still in pretty raw form
20:55brehautright
20:56brainproxyi've got to run, but feel free to hit me up about p-m in the future; btw, I'm learning as I go
20:56brainproxy3 weeks ago I didn't know anything about monads
20:56brainproxyso I'm definitely not an expert
20:56brehauthaha nice work :)
20:56brainproxybut turning p-m inside out has been a good education
20:57brehautyup. nothing like writing monads to learn them
20:57brainproxybtw, if you play w/ my examples branch, note that StateTransformer and WriterTransformer have not yet been brought fully in line w/ all the adjustments I've made to the library
20:58brainproxybut I'll finish those tonight, "finish" being a relative term
20:58brehautthanks for the warning
20:59brainproxyif you end up being interested, maybe in contributing, take a look at https://github.com/michaelsbradleyjr/protocol-monads/blob/examples/NOTES.md
20:59brainproxythere's some todo and ideas stuff in there, would love feedback
21:02brehautbrainproxy: thats a lot of notes
21:58boodlehow can I determine the current directory path of my clojure application?
22:03amalloybrainproxy: how does protocol-monads handle letting you specify which monad you want to use, rather than inferring it from an input argument? for example, filterM doesn't take in any monadic values. in haskell, it can infer the monad instance from the expected return type at the call site, but in clojure you have to be able to give it a hint somewhere
22:07brehaut,(System/getProperty "user.dir")
22:07clojurebot#<SecurityException java.lang.SecurityException: denied>
22:08brehautboodle: ^ probably works outside of a sandbox
22:08ToxicFrogbrehaut, boodle: it does.
22:08boodlebrehaut: ty, *compile-path* seems to get me 'close enough'
22:08ToxicFroguser=> (System/getProperty "user.dir")
22:08ToxicFrog"/home/ben/Downloads"
22:09brehautboodle: if you cant find a clojure answer when googling, try searching for a java answer
22:10brehautboodle: no better way to get better than to start converting one liners over
22:10ToxicFrogboodle: for stuff like this it's a pretty simple conversion - the java is 'System.getProperty("user.dir")', so the Clojure is either (.getProperty System "user.dir") or (System/getProperty "user.dir"), depending on whether System.getProperty is static or not
22:10ToxicFrogIn this case, it's static, so it's the latter.
22:10boodlebrehaut: true. ToxicFrog ty
22:27shanemookHi i'm working on a kata to make change for a give value. Given 50 cents i'd like to get an array back with two quarters, so [25 25].
22:27shanemookWhat is the functional way to do this?
22:28shanemookI could create a variable and divide the value by 25 to insert the quarters but not sure that's correct for functional
22:31brehautim assuming you dont have a 50c piece?
22:33amalloyprobably filed under: american coins which are actually accepted by vending machines
22:33amalloyplus pennies, i guess, because while machines usually won't take those, the problem is insoluble without them
22:34shanemookNo 50c pieces. quarters, dimes, nickles and pennies.
22:34shanemookShould I use the dotimes macro and divide the value by 25? And return 25 for each?
22:35brehautyou should be able to do this with a reduce
22:35amalloynoooo. you want reduce
22:35shanemookI'll read up on reduce. Thanks guys.
22:35amalloyor loop/recur, if you prefer
22:37shanemookhow do I get the initial collection to pass in to reduce? If I just have a value of 50 I don't see how I iterate two times to add the quarters to the array
22:39brehautthats quite a fun little problem
22:40brehauti made use of into and repeat, as well as quot
22:40shanemookWould I do a (range 1 (ammount / 25)) to get get a collection? And then ignore the values and return 25
22:40amalloyi must have three separate gists solving this problem, but it's so hard to search for gists that i'll never know
22:40shanemookI feel like I'm learning to program for the first time with functional. All thumbs.
22:42brehautheh
22:43brehautam i correct that your common coins are 25, 10, 5 and 1?
22:43brehaut(rather than your whacky names)
22:43shanemookYes
22:43shanemookWhat, everyone isn't American?? heh...
22:44brehautfor a slightly harder version of the problem, solve for NZ denominations (under a dollar) 50, 20, 10 5
22:45amalloyfor a version that's NP-complete, add in a 45-cent coin
22:46brehautha
22:50amalloybrehaut: is that harder because of the "round to the nearest 5" aspect, or something else?
22:50brehautyeah just that
22:51brehautthe so called 'swedish rounding'
22:51brehautwait
22:51brehautapparently we dont have 5 cent pieces here any more
22:51brehautwho knew
22:51brehautapparently for 6 years
23:02cshellDoes anyone have any links to detailed descriptions on how Clojure does it's class loading? In particular I'm able to load clojure.lang.RT and get its class loader, but when I execute the load function from Java, I get a clojure/core and clojure/core_init file not found error
23:07Sgeo_There's a lot of repetitive code in RT.javca
23:07Sgeo_RT.java
23:08technomancyboilerplate? in Java
23:08technomancyit's unpossible
23:08Sgeo_I assume the code was generated with some external tool?
23:08Sgeo_I'm mostly looking at all the array manipulation functions
23:11cshellI'm trying to upgrade the IntelliJ Leiningen plugin to use 2.0 and use leiningen-core, but interop is failing because it can't find the clojure.core files on the classpath, even though RT is on the stack
23:12cshellI'm thinking it has to be a classloading problem, but it doesn't make any sense to me
23:15PeregrinePDXibdknox, I tested LightTable with crunchbang too and had no problems. Aezop sure does seem pretty antagnostic.
23:32mattmoss@Raynes: If you're there... I'm using conch. See https://gist.github.com/4063931 . My problem is that I'm unpredictably losing lines, so that sometimes my regexp test will never pass because the line that should have matched was lost.
23:32mattmossIs this something you've seen before? Or do I really need to dig into Java IO streams, un/buffered and all that...
23:35Raynesmattmoss: Never seen that before, but I also haven't really used it a whole lot.
23:35mattmosshmm, ok
23:36Raynesmattmoss: read-line is literally just a clojure.core/read-line call on the stream, so I'm not sure what to say. :<
23:36mattmossYeah, I know about that... and I read most of the conch code to understand what was going on, where the streams were basically coming from.
23:37Raynesmattmoss: Perhaps your code could be written with conch.sh instead? It always consumes all data.
23:37RaynesMy only other idea would be that maybe the process is being destroyed or something before you can consume all the data? *shrug*
23:37mattmossRaynes: I'll have to look. I thought i needed the lower-level so I could parse process output.
23:38RaynesYou should be able to do all that with conch.sh as well.
23:38cshellANyone know how to get the collection of current classloaders in JAva?
23:38Sgeo_I am thinking in Clojure-y ways while working with threads in a non-Clojure language.
23:38Raynesmattmoss: Look at the examples in the readme. You can get a simple lazy-seq of output from the process.
23:38Sgeo_This could turn out really bad.
23:38RaynesA lazy-seq of lines even. It's magical.
23:39mattmossRaynes: Ok, I'll check out conch.sh again. Maybe I'm doing something subtley bad.
23:39mattmossRaynes: thanks fo the ideas.
23:47brainproxyamalloy: can you tell me more about filterM?
23:48amalloybrainproxy: ah! did you get my question earlier? i think i've worked it out from reading your fork of protocol-monads, but i'm not sure
23:48brainproxyamalloy: i did, just got back from errands :)
23:48brainproxymy guess is that by spec'ing a factory as first argument you could accomplish the same thing
23:49amalloyyeah, it looks like that's what you do with m/do as well
23:49brainproxyright
23:50Sgeo_I'm actually writing Clojure code that I intend to use for real things :)
23:50Sgeo_Although not at this moment, I have more important stuff to work on
23:51brainproxySgeo_: shame on you for being practical
23:51Sgeo_heh
23:51Sgeo_Well, "Making a thing that will only be noticed by a community of about a dozen people" might not count as "practical"
23:52RaynesSgeo_: I'm pretty sure the Clojure community consists of more than a dozen people.
23:52amalloybrainproxy: i implemented a kinda haskell-flavored clojure version of filter-m at https://www.refheap.com/paste/6615
23:53amalloya little too busy to really explain it atm, though, so maybe ask brehaut or sgeo about filterM in general?
23:53Sgeo_Raynes, and I'm guessing that exactly 1 member of the Clojure community cares about one particular knockoff of an old 3d universe
23:53Sgeo_old 3d virtual universe
23:53brainproxyamalloy: sure, if I can get the idea I'll take a crack at it to ... looking at various google search results related to filterM
23:54Sgeo_I really should get back to work on my mess of Python+PHP code
23:54rboydanyone used quil (https://github.com/quil/quil)? I'm struggling with something that ought to be really easy
23:54mattmossRaynes: the conch.sh stuff seems to require that the process complete before I read from :in, correct?
23:55RaynesRead from :in?
23:55mattmossI mean :out, whoops.
23:55RaynesNo.
23:55Raynes(yourprogram "arg1" "arg2" {:seq true}) = a lazy sequence of output from the process, populated in realtime.
23:56brainproxyamalloy: alright, well I'll make a note re: filterM, for now I'm going to try finish up my adaptations of state-t and writer-t
23:58mattmossHmm, okay, I'll try again. I called execute directly (since my prog isn't on the PATH), but maybe I missed something.
23:59Raynesmattmoss: Look at let-programs
23:59mattmossRaynes: checking it out now.