#clojure logs

2013-08-07

00:04johnmn3I'd like to use Austin as a browser repl. Is there a cljs function to put in my project's cljs source to do so, rather than having to inject from the clj/ring side?
00:05johnmn3I'd like to be able to make this an "off-line" app, so I am trying to limit logic on the server side for now.
00:06callenRaynes: whoa
00:12johnmn3plus, I'm not using enlive or hiccup or compojure, so I'm not sure how I'd inject it.
00:13xeqijohnmn3: I've copied the sample project but put the dependencies and src/clj in the :dev profile
00:14xeqiadded a helper method for setting up a brepl, basically made a runnable server for dev time
00:15xeqiit seems like it would be possible to turn something similar into a plugin for starting "offline apps" for dev
00:19johnmn3xeqi: it appears that browser-connected-repl-js just inserts ";goog.require('clojure.browser.repl');clojure.browser.repl.connect.call(null, '%s');" into the html
00:19johnmn3where %s is filled by the function (cemerick.austin/repl-env)
00:20johnmn3which produces something like: http://localhost:42520/3141/repl/start
00:21johnmn3so it pretty much has to come from the server, otherwise it doesn't know what port/session to connect to.. okay, I think I understand.
00:21cemerickjohnmn3: what's the use case?
00:22johnmn3I'm working on a project that doesn't already have enlive, composure or hiccup in use, so I didn't want to have to include those just to inject the repl
00:22johnmn3I am using ring already
00:22cemerickjohnmn3: how are you producing your HTML?
00:24johnmn3mostly a static html file, and then modifying it on the client side. It does have ring.middleware.resource and ring.middleware.file-info on the server side. I'm playing with the clj-browserchannel project from github, trying to make a chat webapp out of it.
00:25johnmn3there is a function (defn handler [req] {:status 200 :headers {"Content-Type" "text/plain"} :body "Hello World!"})
00:25johnmn3does that take a :script argument?
00:26callenhttps://github.com/kickstarter/rack-attack does this exist for Ring yet?
00:27cemerickjohnmn3: You can set up a ring handler to return the result of (browser-connected-repl-js), and add the result to a new <script> tag
00:29callenI'm going to assume it doesn't exist.
00:30johnmn3cemerick: okay, I'll take that route
00:31cemerickI should probably make that function accept an argument, so it can be dropped in as a ring handler
00:33callentechnomancy: please talk about Skaro and OCaml :(
00:35robinkcemerick: Gotcha, thanks.
00:35robinkcemerick: Does clj-http support requesting the cert for a certain CN when setting up an SSL socket?
00:36cemerickrobink: I have no idea. But, if it's a PITA/impossible with java.net.*, it's either really easy with clj-http, or reasonable/possible with the underlying apache bits.
00:40technomancycallen: I was expecting it to be shorter than the scheme version because destructuring allowed the clojure version to be significantly shorter
00:41technomancybut the board drawing code turned out to be hairy. probably could just be rewritten.
00:41robinkcemerick: Gotcha
00:41technomancycallen: but not having any nil in the whole language? zomg <3
00:42johnmn3cemerick: do you mean something like (str "<script>" (browser-connected-repl-js) "</script>") ?
00:43cemerickjohnmn3: perhaps; depends on how you're adding the script tag in the clojurescript/javascript in the static page
00:46callentechnomancy: that is pretty sweet. :)
00:46callentechnomancy: I'd prepurchase RWO if there was a concurrent implementation.
00:46callenI would kill for an OCaml LLVM with a concurrent GC
00:47technomancysupposedly there's an experimental concurrent implementation
00:47technomancythe eigenclass.org guy was ranting about it years ago when all that was way over my head
00:47callentechnomancy: nah, it's too much like my experiences with Guido van Rossum.
00:48callentechnomancy: grumpy bumblefuck francophone (OCaml) refuses to admit concurrency is necessary, is eventually grudgingly shoved along to a half-assed implementation suffering from the neglect of the BDFL
00:48callenpass.
00:48callenRust doesn't have nil either.
00:48callenOcaml is 10 years too late.
00:48seancorfield`callen: for about a decade i worked with a language that had no concept of nil / null :)
00:48technomancyeigenclass.org hasn't been updated in years =(
00:49callenseancorfield`: you were using something arcane, not thoughtful :P
00:49seancorfield`if you managed to assign null somehow to a variable, you could no longer dereference that variable - it ceased to exist! :)
00:49callenthat's still a runtime error :(
00:49callenthe point is to break out the Option/Maybe at compile time.
00:50callenif you're going to bother at all anyway.
00:50callenThe GIGO of Clojure works well enough for me, if I'm honest.
00:50callenhell, I even wrote a GIGO wrapper to some clj-time stuff out of laziness recently.
00:50noidiGIGO?
00:50callengarbage in garbage out.
00:50callenI adore it.
00:50noidiah, right
01:06robinkcemerick: Actually, when I first ran into this issue, it was with drawbridge trying to connect to an HTTPS-secured nREPL, and failing since clj-http never requested anything but the default certificate.
01:17cemerickrobink: do you think that drawbridge is somehow related to the cert problem?
01:17robinkcemerick: Not at all.
01:17robinkcemerick: The problem is undoubtedly with clj-http, HttpClient or java.net.*.
01:17robinkcemerick: I just don't know where it lies.
01:18robinkcemerick: The default behavior of clj-http and/or HttpClient should be to request a cert with a CN equal to the value of the Host: header.
01:18robinkcemerick: but it doesn't, and I'm still trying to figure out how to override that.
01:19cemerickrobink: if you're having issues with all of these libraries, I'd be worried about some network or JDK configuration problem
01:20robinkcemerick: That's also a possibility, but with other HTTPS clients I'm able to obtain a cert whose CN matches the Host: header when connecting to a server that hands out multiple certs on a single IP/port.
01:20robinkcemerick: So the problem could indeed lie with the Java configuration, but it seems like a pretty glaring issue for a stock install of Java.
01:20cemerickrobink: are you using an oracle jdk, or other?
01:21robinkcemerick: Oracle JDK, mostly.
01:21robinkcemerick: Occasionally sun-jdk-1.6, but will probably stop using it now that it's clear it's not getting any more security updates.
01:21robinkcemerick: I'm also happy to give IcedTea a go.
01:22cemerickok; some of the more neckbeardy JDKs have less-than-useful root certs, thought maybe there'd be a correlation
01:22cemerickThis might actually be a worthwhile #java topic, if you're willing to brave the hordes.
01:23tsantosneckbeardy! lol
01:23robinkcemerick: Heh, I might. It would certainly be good to know how to directly coerce Java's net/SSL classpath to request a cert of my choosing.
01:24johnmn3cemerick: hah, I opened a normal browser repl and then connected to the austin repl by pasting in url :)
01:25cemerickjohnmn3: yeah, that's the escape hatch
01:25cemerickjohnmn3: if you're just looking for any browser-repl, then use `cemerick.austin.repls/exec`
01:26cemerickall the messing about with javascript is only necessary if you want a browser-REPL connected to your application running in a GUI browser
01:26johnmn3cemerick: yea, I may have both going.
01:27harjawhat validation library you guys suggest to be used nowadays? Valip has not updated since 1.2
01:27harjaor is it still a good bet?
01:28johnmn3my main reason for trying austin was that the brepl kept on crashing out on me. It would easily break and I'd have to relaunch cljsbuild's repl-listen and refresh the page
01:31cemerickjohnmn3: "crashing out" is a bit nonspecific, but it is hoped that austin will be less persnickety than the cljs stock browser-REPL
01:33johnmn3cemerick: persnickety was the technical term I was looking for. :) if I manage to recreate one of the causes I'll report back.
01:34cemericksounds good :-)
01:40johnmn3aye, tis the broken pipe
01:42johnmn3and now it refuses to reconnect no matter how many times I refresh and I have to restart the repl and then refresh again.
01:42johnmn3java.net.SocketException: Broken pipe
01:43johnmn3oh wait... it just worked after the 4th refresh... hmm
01:43dark_elementjohnmn3 turning off cache helps but i think you are doing that already.
01:44dark_elementjohnmn3, also brepl crashes for me as well. It's very hard to know when brepl is actually connected to browser.
01:46johnmn3dark_element: I'm not sure if I'm turning off the cache. what's that about?
01:47dark_elementjohnmn3, well mostly you get older compiled js sometimes.
01:48johnmn3ah
01:53dark_elementcemerick, Is it a good idea to show connection state of browser in cljs repl?
01:55cemerickdark_element: you mean, in the browser?
01:56dark_elementcemerick, I was thinking of in emacs buffer actually but browser is not bad idea either.
01:56cemerickThe browser is a more accessible target. Not everyone uses emacs. :-)
01:58dark_elementcemerick, even though i can check network calls in browser dev tools I can't exactly say what's going on. Some status messages would be helpful.
01:58cemerickjohnmn3: FWIW, it can take the compiler some time to get its business in order when you first connect; if you get impatient and reload, then you'll see a broken pipe error. I generally keep an eye on my CPU gauge as an indication of things...
01:59dark_elementcemerick, Maybe push it to some global variable like window.cljsrepl.status
01:59johnmn3cemerick: okay. thanks. I'll wait it out next time.
02:01cemerickdark_element: I don't know how much that would end up telling you. If we can set that, then everything is working. If we can't, it's not. There's not a lot of room in between that is amenable to troubleshooting AFAICT.
02:02mischovHmm. So does doing extend-protocol with clojure.lang.ISeq to catch PersistentVectors, etc?
02:02mischovnot catch*
02:03dark_elementcemerick ohh ok. I thought there are multiple states during the connection.
02:03cemerickdark_element: not at any level I'm aware of
02:03dnolenmischov: vectors are seqable but not seqs
02:03mischovdnolen: Bugger.
02:04dnolenmischov: you probably want to extend to ISequential
02:04dark_elementcemerick, also the setting status in repl/emacs will take care of other cases like two browser windows fighting for one repl.
02:04dnolenmischov: er Sequential I think
02:05johnmn3(val {1 2}) doesn't work in clojurescript?
02:06mischovdnolen: You nailed it. A king among Clojurians, truly.. :D
02:06mischovdnolen: And I totally should have knew that. I just dealt with something about seq? vs sequential?...
02:06mischovknown, even
02:06johnmn3ah, nevermind
02:07johnmn3(val (first {1 2}))
02:07johnmn3map is not mapentry
02:07cemerickdark_element: that will more likely just turn into a println...or, maybe an nREPL response with a particular shape, when it's running in an nREPL environment
02:10dark_elementcemerick, yes println is good. Instead of trying to evaluate something to check if repl is connected to a browser, it's better that repl prints it.
02:11cemerickdark_element: nm, that will be incredibly irritating while things are working properly
02:14harjawhat's the idomatic way to map a variable name as string to the value contained in the var? (eval (symbol "foobar")) sounds a bit overkill :)
02:14dark_elementcemerick, the message will print only when a new window or same window gets reloaded.
02:16dnolenharja: generally a bad idea, but you can use resolve for that
02:18cemerickdark_element: yeah, maybe; fundamentally, I'd rather work on fixing whatever makes connection problems more likely, etc
02:18seancorfield`harja: (deref (resolve (symbol "the-ns" "the-varname")))
02:18harjadnolen: okay, well I'm just doing a shorthand macro for doing stuff. is that a wrong approach to begin with?
02:18harjai.e. given "user" i want to do validation that is named "user-validator" etc
02:19dnolenharja: you shouldn't need to resolve in a macro unless your interacting with the runtime in some way.
02:19harjaokay, so what's the best way to refer "user-validator" when the user -part is given as the parameter
02:20dark_elementcemerick, all right
02:21dnolenharja: you should explain your goals more clearly - why do you think you need a macro here in the first place?
02:22dnolenharja: that is, is auto resolving the validator actually adding any value
02:23dnolenharja: if you just want an answer, you don't need resolve for that, just generate the symbol you want from the symbol the macro received.
02:24harjadnolen: thats a discussion worth a while I think :) Basically I have just a bunch of database tables, and an API to insert stuff to it. Given that I want to check some constraints prior to inserting data to it, I thought that it would be neat to be able to just say (entities/set! foo foo-fields) from the API side and let that take care of the rest
02:24harjafoo-fields was the stuff that came from the client
02:25dnolen(defmacro foo [some-sym] `(do ~some-sym ~(symbol (str some-sym "-validator")))) should give you some ideas
02:27harjadnolen: Ah! I had something like that in mind but did not get that you could just use the symbol as is :)
02:27harjaas you can probably tell, I'm just at the beginning of my clojure/lisp -journey
02:28dnolenharja: np, enjoy!
02:31harjaThe possibilities with code generating code is just something that does not stop to amaze me... probably this is comparable to a situation I just found a hammer and want to find anything that resembles a nail :)
02:41harjasince I started, is this a good approach? It seems to work, at least :) https://www.refheap.com/e1fc429bed03ef4559cdbae18
03:19harjaIs there a "pdb.set_trace()" (python) equivalent in clojure? Such that I could see what is going on in the middle of a request coming from an HTTP client
03:25noidiambroseb_, is it possible to mark a "Definition missing" warning as ignored?
03:25ambroseb_noidi: use (ann ^:no-check var t)
03:28noidiambroseb_, that works, thanks!
03:29noidiI'm very positively surprised by how usable core.typed is already
03:29noidiit has come a long way in a short time (for such an ambitious project(
03:30ambroseb_noidi: I've been fairly quiet about it ;)
03:30ambroseb_I'm building up to 0.2.0.
03:31ambroseb_I shall then staple USE IT on the front
03:32noidiyes, it seems quite usable already
03:33noidiit wasn't quite there yet the last time I checked, but now I haven't run into any major problems after two days of use
03:35ambroseb_noidi: excellent.
03:41callennoidi: what is this you're using?
03:48noidicallen, core.typed
03:54callenah okay
04:13danielszmulewiczdnolen: `brew install clojurescript`: cljsc, browser-repl and repljs become available from anywhere on a mac.
04:14danielszmulewiczdnolen: I issued a pull request on homebrew
04:14callenwell not "from anywhere", just from any shell with /usr/local/bin in the path.
04:14danielszmulewiczcallen: you got the idea
04:18danielszmulewiczdnolen: Basically, it does automatically what this instructs to do manually: https://github.com/clojure/clojurescript/wiki/Quick-Start.
04:24llasramdanielszmulewicz: The "NOTE" at the top of that page isn't kidding. You really really really want to just use anything about Clojure/Script via Leiningen
04:25llasramAll of the tooling and workflow stuff is built around Leiningen
04:25callendanielszmulewicz: just use Leiningen.
04:25callenhomebrew is for plebs.
04:26llasramOver here in rational argument corner...
04:26danielszmulewiczit is orthogonal from leiningen
04:26callenllasram: I'm bad cop, you're good cop. Remember?
04:26llasramThe issue is that not using Leiningen nets a sub-optimal experience
04:26ro_st-polishes his pleb badge-
04:27llasramI know several people who bailed on Clojure because they installed the homebrew or fink package for it and found it unusable
04:28danielszmulewiczit gives you `cljsc` on the command line outside of any project
04:28callenfunny how damaging such things can be.
04:28callendanielszmulewicz: that's not really a good thing.
04:28llasramdanielszmulewicz: I get that, but why do you want that?
04:28callendanielszmulewicz: you need to learn to use Leiningen.
04:28danielszmulewiczdon't use it. You obviously don't get the use case
04:28callenclearly we're the ones who haven't thought of things
04:29danielszmulewicztroll
04:29llasramdanielszmulewicz: What is the use case you have in mind?
04:32danielszmulewiczllasram: extensions in emacs
04:33danielszmulewiczllasram: I want to have the compiler globally available for tooling purposes
04:33llasramdanielszmulewicz: Writing Emacs extensions in ClojureScript, bouncing through a node.js process?
04:33callenthere is no node.js bridge to emacs.
04:34callenso you're not only not using leiningen, you're writing your own protocol to communicate between node.js processes and emacs?
04:34callendanielszmulewicz: who is John Galt?
04:34callenllasram: this man doesn't need us, he's a self-made man. Let him continue with his Objectivist ways.
04:35llasramcallen: As nicely as possible -- please stay off my side :-)
04:35callenLeiningen is for weak socialists that need help managing their packages.
04:35callenllasram: pfft, as if I were ever on the side of communists and backbiting anti-capitalists.
04:35callenllasram: I say down with Leiningen, up with the peoples' proletariat!
04:35callena proletariat dictatorship of the homebrew will spread throughout the world!
04:36llasramheh
04:38callenllasram: has anybody tried a PR to delete the Clojure and ClojureScript recipes?
04:39danielszmulewiczllasram: it's part of a foundation, I'm still experimenting
04:40llasramcallen: I don't know. I don't use OS X myself and hadn't really thought about it. If the Clojure one still exists, it might be a good idea
04:41llasramdanielszmulewicz: Cool. That sounds interesting. Best of luck :-)
04:44danielszmulewiczllasram: thanks!
05:13shdwprinceIs there a function or smth for swapping function arguments?
05:14llasramshdwprince: Example?
05:15shdwprincellasram: (defn x [a b] (prn a b)), (x 1 2) -> 1 2, ((swap x) 1 2) -> 2 1
05:16llasramAh, no -- you just use the #(...) reader macro in that sort of situation
05:17llasramAlthough it doesn't arise that often, and frequently means the underlying function's arguments are in the wrong order in the first place :-)
05:18shdwprincellasram: drop and take in update-in...
05:19llasramAh. Fair enough! Honestly not something I've run into myself, but definitely not insane
05:19llasramYou can always write your own `swap` function if it makes your code read cleaner
05:20shdwprincellasram: but it's not in core
05:20clojurebotidiomatic clojure uses dashes to separate words
05:20llasramWell, yes. But why does that matter?
05:21shdwprincellasram: refer always, noone dont know function that you using as part of language
05:23llasramIf I understand your first point, it honestly isn't a generally useful function. It's limited to two-argument functions, and there just aren't that many situations where you need to swap two arguments. You can always refer it where you need it
05:25hyPiRionllasram: (defn swap [f] (fn [& args] (apply f (reverse args)))) ?
05:25llasramAnd for the latter -- that's a nature of a Lisp. Building the language from both top-down and bottom-up. As long as you pick sane names, use them consistently, and make it easy to track down definitions (explicit :refer), it's fine
05:25llasramhyPiRion: Ok, that's a little more general :-) I'm still skeptical how frequently useful pure argument order-reversal is
05:26shdwprincellasram: haskell has like-that function in haskell's core, so it useful enough
05:26llasramThe only case I can think of I where I frequently want that is str/split, and I'm pretty sure that's just because the argument order there is Clojure-wrong
05:26TEttinger(partial (swap /) 0)
05:26shdwprincellasram: and I afraid of writing my-own solution if there is another one from contributors
05:27TEttingerif it wasn't swapped it would error, if it is it just generates 0s
05:27TEttinger(defn swap [f] (fn [a b] (f b a)))
05:28TEttingerhyPiRion's is more flexible nvm
05:28llasramshdwprince: I'd argue it's more useful in Haskell because of the point-free style idiom. That style is much less common in Clojure because the necessary nesting of parens makes the alternative (explicit anonymous function) more readable after one or maybe two HOF combinations
05:29llasramshdwprince: As for needing to write it -- as the proposed definitions show, you'd probably spend more time digging it up from somewhere than just writing it
05:30llasramIf you pull in something like flatland/useful, it's probably in there, but that's a purely personal preference
05:30shdwprincellasram: I'm only newbie in clojure, and wan't to do things right
05:32llasramThen I'd definitely suggest writing it yourself. Put it in your own kitchen-sink of utility functions. See how often you use it.
05:34llasramAnd I didn't mean that in a sarcastic "you won't use it" sense. I mean literally -- see how often you use it, and other utility functions you write. Keep the ones you use, cull the ones you don't.
05:35shdwprincellasram: but in most cases #() do the job, and nothing needed to be required
05:35llasramI'd argue so, yes
05:37TEttinger#() or (fn [a b] ...) if you're already in an anonymous function with #()
05:38shdwprinceTEttinger: i'm newbie, but not so much :)
05:38TEttingerI think I recently stopped being a newbie, now I'm just inexperienced :) 4clojure has been very helpful
05:38TEttingerI still need to learn macros
05:39jonasenmy (datomic) datalog tutorial is now live at http://learndatalogtoday.org
05:39shdwprinceTEttinger: macroses is fantastic when you came from not lisp, but debuging it in clojure is really painfull
05:39jonasenfeedback welcome
05:40ejacksonjonasen: that'll be really useful
05:40jonasenejackson: I hope so
05:44shdwprincejonasen: huh, never dig in logic programming
05:50jonasenHN submission at https://news.ycombinator.com/item?id=6171722
05:55pocketHi.
05:55pocketI starting learning clojure with 'programming clojure 2nd'.
05:56pocketAnd when I trying to get very long list of Fibonacci number with example code in the book.
05:57pocketwhitch define fibs as (def fibs (lazy-cat [0 1] (map + fibs (rest fibs))))
05:58pocketThen I try to run: (take 10000 fibs). It gives me an error about Integer Overflow.
05:59pocketBut when I try it again. It doesn't give any error. Just return very short list, just containing 90~93 items.
06:00llasrampocket: In Clojure, the way lazy sequences are realized doesn't guarantee that self-referential sequences like that will work
06:00llasramYou can do it, but only by knowing and depending on certain implementation details
06:00llasramThe specific behavior you're seeing is that you're holding the head of a lazy sequence which is realized up to the point where the exception was thrown
06:01pocketSo when I encountered such error, I should restart repl?
06:02llasramNo -- you just need to recompile your namespace / repeat the definition
06:02llasramAlthough like I said, self-referential lazy seqs aren't a good idea
06:03pocketHmm.. thanks.
06:03aroemersjonasen: nice website about datalog!
06:04pocketIs there any option or flag to shutdown repl when I encounter some exception?
06:04shdwprincepocket: humm.. why
06:04shdwprince?
06:04shdwprincepocket: for what reason?
06:05pocketSometimes I didn't notice such error and I just think 'why this code doesn't work?'. So shutdowning repl is good for me to notice an error.
06:06pocket(Sorry for my stupid head..)
06:06shdwprincepocket: (clojure.repl/pst) prints stack trace if you got an exception
06:07shdwprincepocket: errors noticed with exceptions, names of them printed in repl, but without stack traces
06:08shdwprincepocket: usually there is no errors in your's code, that can fail and repl can't handle it
06:09shdwprinceoh, i should try it
06:10shdwprince&(/ 1 0)
06:10lazybotjava.lang.ArithmeticException: Divide by zero
06:10shdwprince&(clojure.repl/pst)
06:10lazybotjava.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.lang.Throwable
06:13pocketThank you for advice and examples.
06:25harjais there a way to call [f g] [a b] for lists? i.e. (f a) (g b)
06:25llasramharja: It's not quite clear to me what you mean. Can you elaborate?
06:26harjai have a list of elements, and i want to apply functions from another list to the elements in the same index
06:26samrathow can I check whether or not I'm running with a :dev or :prod profile? from within a program, I mean
06:27harjai think it can be done with map
06:28samratI'm trying to hot-reload code with http-kit only if it is :dev. the docs mention an in-dev? function but doesn't say how thats implemented
06:29llasramharja: Oh, yeah: (map #(%1 %2) [f g] [a b])
06:29harjallasram: exactly.
06:29llasramWell, there you go :-)
06:30sandbagsis the use of 'eval' bad form? In solving a macro example from "Clojure in Action" I took a different tack to the book and seem to need to use eval to make my approach work https://gist.github.com/mmower/c2fe70504df903ac2538
06:30harjaYeah, figured it out myself too
06:30harjathanks!
06:30llasramnp, and glad you so-figured!
06:30llasram~eval
06:30clojureboteval is DENIED
06:30llasramhah
06:31sandbagsi'm condition, from other languages such as Ruby, to consider eval with suspicion
06:31llasramIt used to have some pithy saying about `eval` usually meaning you didn't write your code to run at the correct time in the first place
06:32sandbagsokay given the rand-nth approach i took to the macro, was there some other way to express it than using eval?
06:32llasramOh, you don't need `eval` there
06:32sandbagswithout the eval my macro seemed to return the expression, rather than evaluating it
06:32llasramYou can just call `rand-nth` on `exprs` at maro-expansion time
06:33llasramsandbags: Untested, but something like this: (defmacro randomly [& exprs] (rand-nth exprs))
06:34llasramUnless I misunderstand what you want?
06:35sandbagswell from the gist, the book solution is below mine
06:35sandbagsthe idea is to evaluate a random s-exp from those passed in
06:35llasramOh, I see -- it's supposed to select a separate random expression to evaluate at run-time, not a single one at macro-expansion time
06:36sandbagsi'm not quite sure how those would be different
06:37llasramThe solution I proposed would pick one of the expression when macro expanded. Anywhere you used it would be fixed to that result, no matter how many times you call the function containing the expansion
06:37clgvsandbags: what is the exact goal? can you give examples?
06:37sandbagsllasram: ah, i see, yes the former
06:37llasramThe solution from the book picks a separate random expression each time the expansion is evaluated
06:37sandbagsllasram: but isn't the macro expanded at each call site?
06:38llasramYes, but only once at each site
06:38sandbagsllasram: ah yes
06:38llasramsandbags: So the two problems with `eval` are: (a) It's expensive (needs to invoke the compiler each time it's called), and (b) doesn't have access to the lexcal scope
06:38llasramE.g., this raises an exception: (let [a 1] (eval 'a))
06:38llasramWhich is probably not what you want
06:38sandbagsright
06:39llasramSo to avoid those problem, you generally avoid eval. When you really need it, it's usually obvious that you really need it
06:39sandbags(randomly (println "amit") (println "deepthi") (println "adi"))
06:39sandbagsclgv: ^^^ the book example
06:39clgvllasram: did you ever really need it?
06:40sandbagsllasram: okay so i've learned that i also need to treat eval with suspicion in clj so that was valuable :)
06:40llasramclgv: I've got a few utility macros wrapping `case` which `eval` the target expressions
06:41llasramclgv: And I'm working on a project which needs to invoke the compiler at runtime to build schema-specific de/serilaization code
06:41sandbagsllasram: so i'm having trouble making your version work which seems to be about variable scope of 'exprs'
06:42sandbagsllasram: but were you saying that your version would give you a single expansion at any particular call site?
06:42llasramYes
06:42clgvllasram: ah ok. I did not need eval in the last 3 years ;)
06:42llasramclgv: Oh yeah, it's totally rare
06:43sandbagsis there another way of doing my rand-nth based solution that doesn't require eval?
06:43sandbagsi was thinking of mapping the expressions into anonymous functions and applying or something like that
06:43sandbagsbut it feels rather clunky
06:45sandbagspresumably the source to cond holds some clue
06:46llasramIn Clojure, `cond` is just a macro over `if`
06:46sandbagsand if is a special form right
06:46clgvsandbags: In principle there is no other way. in the details you may vary
06:47sandbagsclgv: ?
06:47llasramThe `rand-nth` on `fn` approach would definitely work, and is arguable the better solution (can be O(1), whereas the `cond` solution is O(n))
06:47llasramAlthough now that I'm thinking about it, you could just use `case` instead :-)
06:47llasramsandbags: Yeah, in Clojure `if` is a special form
06:48sandbagsso the case solution would be an optimised form of the cond solution they use in the book
06:49llasramPretty much
06:49clgvsandbags: the book solution is to complicate imho. since only one expression is selected...
06:49clgvllasram's solution does the same much simpler
06:50sandbagsi can see how the case the solution would work... i didn't like the cond approach because it didn't seem especially elegant having those useless evaluations when you already know what the answer is
06:50sandbagsand rand-nth can deliver an expression more easily, but the lack of access to lexical scope from eval is a bummer
06:50clgvwhy don't you go with the already suggested (defmacro randomly [& exprs] (rand-nth exprs)) =
06:51clgv?
06:51sandbagsclgv: because it doesn't do the same thing
06:51sandbagsclgv: and this is, anyway, an exercise i am thinking about
06:51sandbagsnot a problem i am trying to solve
06:51sandbags(also if it doesn't actually seem to work)
06:51clgvsandbags: it does the same thing as the second macro in your gist
06:52llasramclgv: Oh, you're right. That's really bizarre.
06:52llasramI'm going to say that's a bug in the book
06:52llasramsandbags: You said this is /Clojure in Action/?
06:53sandbagsah, so i'm actually solving a different problem :)
06:53sandbagsllasram: yes
06:53sandbagspg 184 of whichever MEAP version I have
06:53clgvI dont have the book ;)
06:53sandbagsit's very hard to tell which one that is
06:53llasramUnless there's been a recent edition, I was really underwhelmed by that book. If you haven't checked it out already, I'd check out /Clojure Programming/ (the O'Reilly one) instead
06:53sandbagsi have that one also
06:54sandbagsI'm reading CiA 2nd ed
06:54clgvthen better read that one ^^
06:54llasramOk, cool. And once/if you already have some Clojure under your belt, IMHO /Joy of Clojure/ is the best of the lot
06:54sandbagsyes i have that one also :)
06:54llasramExcellent :-)
06:54sandbagsCiA seemed best paced for me atm
06:54clgvyou were on a shoppin spree? ;)
06:54sandbagspretty much
06:54sandbagsO'Reilly and Manning had deals
06:54llasramOk. I haven't seen the MEAP / new edition yet, so will withold judgement
06:55sandbagsso i hoovered them up
06:55sandbagsthe O'Reilly book went a bit too fast at a certain point for me
06:55sandbagsCiA seemed a somewhat easier pace
06:55sandbagsi also have Brian Maricks FP for the OO programmer
06:56sandbagsbut it wasn't really finished last time i tried reading it
06:56sandbagsto complete the set i also have the Prag's Clojure book by Stu Holloway
06:56sandbagsbut i didn't get on with it at first reading
06:57sandbagsbut i may have been trying to treat it like their Programming Ruby book which was more of a tutorial/intro
06:58sandbagsi've been an OO/imperative programmer a lot of years so i felt i could use all the FP ammo I could get :)
06:59sandbagsto return to the problem i have
06:59sandbagsthe cond/case solution actually isn't right then?
06:59sandbagsin the sense that it will always select the same expression at each call-site
07:00sandbagsactually i guess i should re-read what problem they thought they were solving
07:01sandbagsoh, they solve it again later as
07:01sandbags(defmacro randomly-2 [& exprs] (nth exprs (rand-int (count exprs))))
07:01llasramWhich is the same as (rand-nth exprs) :-)
07:02sandbagsright, without the use of quoting
07:02sandbagsah, because they want to evaluate that
07:02llasramExactly
07:03sandbagsexcept, as you say
07:03sandbagsit has the problem that it's a single expression randomly choosen at expansion time
07:04sandbagsso when used in a function it might not be what you expect
07:04llasramSounds like a documentation problem to me :-)
07:04clgvsandbags: it does not select the same expression at every call site - in case you want to see that fast add some more different printlns and evaluate that example repeatedly
07:04sandbagsclgv: here's my example https://gist.github.com/mmower/43a7497569f9e9129789
07:05sandbagsoh wait
07:05sandbagsno that's right
07:05clgvif you redefine the function again you'll end up with a different println in 2 of 3 cases
07:05sandbagsyes
07:07clgva better example for a usefull macro would be an `if-let-all` or `when-let-all` provided you now `if-let`/`when-let`
07:07sandbagsi misunderstood the distinction when i set out to solve the problem
07:08sandbagsso i was solving a slightly different problem of creating a macro that would expand to a construct that evaluated a randomly chosen expression
07:08sandbagsrather than expanding to a randomly chosen expression
07:08clgvwell, then you indeed need no macro ;)
07:08sandbags?
07:09sandbagswithout a macro how do i avoid my expression set being evaluated at call time?
07:09clgvhumm ok, with the expressions yes but for selecting at runtime a function suffices
07:09sandbagsthen i'd have to quote all the expressions no?
07:10clgvI meant only selecting things randomly at runtime is clearly a function ;)
07:10sandbagsclgv: well, yes
07:11llasramclgv: Unless you don't want the non-selected forms to be evaluated. Kind of like an if/case/cond, but with random selection of the evaluated branch
07:12sandbagsyes
07:12sandbagsi think i'm going to try writing it using the "hoist to function and apply" approach just to see if i can make it work
07:12ro_stjonasen: woo, front page on HN!
07:12sandbagsthanks for the help llasram, clgv
07:14llasramsandbags: have fun!
07:14jonasenro_st: heh.. thanks again for your help
07:14ro_stsure thing :-)
07:14clgvro_st: how does HN rank? the post only has 8 points...
07:15ro_stno idea, clgv
07:15jonasenclgv: you should vote for it if you think 8 points is not enough :)
07:16clgvjonasen: I was curious how it came on the first page - since ro_st comment seemed to imply that this is an accomplishement. but unluckily he doesnt know...
07:17jonasenclgv: I have no idea how it works either... luck I guess
07:18clgvpoints divided by uptime?
07:18kmicuGive me a link!
07:18ro_stclgv: front page of HN is high exposure. that's an accomplishment. whether that's a difficult or easy accomplishment is another thing :0)
07:18ro_sthttp://www.learndatalogtoday.org/chapter/2
07:18ro_sthttp://www.learndatalogtoday.org/
07:19clgvhmm ranking decreased with more points so maybe it's that quotient
07:20kmicuDatalog? Upvoted by definition.
08:01clgvhttp://amix.dk/blog/post/19574 ^^
08:02ro_stnice find!
08:04clgvcalling it algorithm is overkill ;)
08:09nifffhello room. how can i update a vector similar to a[4]=5;
08:10ejackson,(assoc [1 2 3 4 5] 4 5)
08:10clojurebot[1 2 3 4 5]
08:10ejackson,(assoc [1 2 3 4 5] 4 15)
08:10clojurebot[1 2 3 4 15]
08:10h455m0hi
08:42lgs32aDoes anybody know what the criteria are to gain performance through reducers? Often I find that especially for medium-sized sequences, using reduce or reduce with pmap performs better.
08:51snake-johnIgs32a: reducers use under the hood java fork-join so for medium size sqquences the over-head of fork-join does not pay of
08:52lgs32aThank you. Do you have a #1 reading resource about fork-join?
08:53clgvlgs32a: if pmap gets you a speedup reducers should give you even more. but be careul to nut use sequences with reducers since processing those cannot be parallelized
08:54lgs32anot use sequences as input or output?
08:55clgvlgs32a: as input
08:55lgs32aok so i shoud use them with sets and hash-maps only?
08:55clgvlgs32: you can try sequence as input and vecotr as input and compare
08:56clgvvectors preferrably. I dont know if hash-maps or sets work
08:56clgvyou might try or check the source
08:56llasramlgs32a: To get a speed-up from using reducers, you need to (a) use a vector as input, (b) have the vector be very large (more than thousands), and (c) use `fold`, not `reduce`
08:56clgvdo not use pmap, except you really want this half-lazy parallelized behavior
08:57llasrams,a speed-up,a speed-up due to parallelism,
08:57llasramIf you have a small number of individually computationally expensive tasks, then `pmap` is more appropriate, although not really great
08:58llasramClojure's concurrency story is great, but it's parallelism story could use some love :-)
08:58lgs32ahehe
08:58clgvpmap almost always sucks because of its lazy characteristics...
08:58lgs32ai am using pmap almost always in special places with doall
09:00llasramclgv: Eh. I'd argue that `pmap`'s bigger problems are the bad interaction w/ chunked input, the inability to control level of parallelism, and the inability to relax in-order result semantics
09:00clgvthe doall doesnt solve its core problem. imagine you have 4 parallel processing threads for pmap. then pmap processes batches of size 4 in parallel and only starts a new batch after the previous is done. so if one job of the batches last much longer than the others you have 3 idle threads and that can happend for every batch...
09:01lgs32aok
09:01llasramThat's not quite true. It doesn't do batches like that. But it does enforce in-order production of results, so in clgv's example it won't start evaluating the 5th expression until the first is done
09:02clgvbefore reducers I just used javas executors...
09:02llasramBut if the first one finishes before the other three, it will happily pick up the 5th etc
09:02clgvllasram: yes and if the first is the longer lasting 3 threads are idle that long
09:02llasramYep
09:03clgvllasram: we observed that in experiments of one of my students
09:03lgs32aBut is that a problem? I can wait for all threads to finish before I start consuming the sequence
09:04lgs32ai mean the result
09:05llasramlgs32a: Basically it sacrifices some degree of potential parallelism in order to give you your results in the same order as the input (in constant space)
09:05llasramIf you don't need the results to be in-order, then it's sub-optimal
09:05lgs32ayes ok now that is a good argument
09:05lgs32athanks
09:06lgs32ai have a quite expensive parser/interpreter/analyzer running over a large bunch of files, and the result order really does not matter
09:06lgs32aso i will try that with a vector as input and r/fold
09:06lgs32ainto a set
09:06llasramAs clgv suggested, I'd actually check out using Java executors more directly
09:07clgvllasram: by using reducers or javas executors you can have results also in the same order as they were in the input
09:07lgs32athanks guys :)
09:07ejacksonlgs32a, also check out the Iota library
09:08ejacksonit'll let you feed a file into reducers, to great effect
09:08lgs32awell loading the file actually consume the very least and insiginificant amount of time
09:09ejacksonok, I misread 'large bunch' for 'large'
09:09lgs32ano its just that its insiginifact compared to the time the parser, interpreter and analyzer take
09:10lgs32aand they should run for multiple files in parallel
09:10llasramclgv: Sure, but with different performance characteristic. E.g., you'd need potentially unbounded memory to realize just the first `n` results
09:10lgs32abut i will check out iota, thanks
09:10llasramclgv: (if executing over an infinite seq)
09:10clgvllasram: yeah if you need parallelized lazy that is the only valid case for pmap...
09:11llasramclgv: Right. So I'm just saying that's what it is :-). It's definitely not the end-all-be-all, and I think Clojure would greatly benefit from a library which provided more fine-grained but still straightforward ways of achieving parallism
09:16llasramOh, and I was spreading some minor misinformation -- you can set the group-size run in parallel via reducers `fold`, so don't *require* a very large vector to see benefits
09:16llasram(default group-size is 512, which is what I was remembering)
09:33gdevlast night our Java Users Group was all about edn datalog and simulant, good times had by all
09:33gdevhiredman, I even gave the presentation "edn Inaction"
09:41dotemacsAny issues if non ASCII names are used for function names ?
09:41clgvdotemacs: no, except that it might be difficult to write them depending on the characters ;)
09:42Ember-utf-8 is fine
09:42dotemacsclgv: thats great :) I mean, I tried it already it worked as expected, but I figured I'd ask about it here
09:42dotemacsEmber-: thanks
09:43Ember-in my honest opinion, any programming designed after year 2k which doesn't support utf-8 as basic encoding for it's source code files is braindead
09:43clgvdotemacs: I used alpha and beta for parameters in configuration ^^
09:43Ember-programming -> language <- designed
09:44Ember-forgot a very important word from my sentence :)
09:48gdev(defn ¼ [n] (* n (/ 1 4)))
09:49TheBusbyvia proxy/reify, can you add a method to an existing map? Ex (.foo {:a 1})
09:50tim__TheBusby: no, but you can do that with protocols
09:51gdev(defn ¥->$ [n] (* n 0.01))
09:51TheBusbytbaldridge: you wouldn't have an example of the syntax for that would you?
09:52tbaldridgeTheBusby: in the example here: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/extend-type you can use any Java type as the first argument to "extend-type"
09:52llasramgdev: Not `¥→$` :-)
09:53gdevllasram, good catch thanks
09:54llasramClojure: the new APL!
09:55tbaldridgeAPL is the one language that I can tell non-programmers: "It looks just as alien to me as it does to you". That stuff is scary.
09:56llasramIt looks kind of like it might be straightforward once you get used to it. Just very, very dense, so you need to go token-by-token to unpack it
09:59tbaldridgeBTW, if anyone wants a awesome example of APL, check this out: http://www.youtube.com/watch?v=a9xAKttWgP4
09:59tbaldridgeand yeah, it looks super dense
10:00clj_newb_2345is there a simple regex that describes nested /* */ comments ?
10:01ordnungswidrigtbaldridge: http://www.youtube.com/watch?v=xP5-iIeKXE8 (life in life)
10:03tomjackordnungswidrig: :D
10:03TheBusbytbaldridge: much thanks!
10:04ordnungswidrigtomjack: and we all still wait for cinc :)
10:05tomjackcinc?
10:06tbaldridgetomjack: clojure-in-clojure
10:06ciphergothThere must be a better way than (map (partial + 5) (range))
10:07ciphergothto generate (5 6 7 ...)
10:07tomjackah of course
10:07tbaldridge, (take 6 (range 5 Integer/MAX_VALUE))
10:07clojurebot(5 6 7 8 9 ...)
10:07clgv,(range 5 Long/MAX_VALUE)
10:07clojurebot(5 6 7 8 9 ...)
10:07clgvprint-limit ^^
10:07tomjackis the "inc" in there a coincidence? I don't think I had noticed it before
10:08ciphergothheh :)
10:08ciphergothseems like something of a hack, but OK!
10:08tbaldridgeciphergoth: look at the source of range, the default max value is implemented almost the same way
10:11clgv,(range 5 -1)
10:11clojurebot()
10:11clgvoh damn ^^
10:11tbaldridgeclgv: range has some odd edge-cases
10:12ordnungswidrigciphergoth: (drop 5 (range))
10:12ciphergothordnungswidrig: (drop n (range)) gets slower as n grows
10:14tomjack(def ∞ Double/POSITIVE_INFINITY)
10:15gdevto implement infinity from scratch, you must first create the universe
10:19clgv,(let [∞ Double/POSITIVE_INFINITY] (+ ∞ ∞))
10:19clojurebotInfinity
10:19clgvunluckily it does not convert to the symbol^^
10:20gdevif you want that, use APLbot
10:22tomjack(defmethod print-method Double ...)
10:22tomjack:(
10:23clgvyeah I know..
10:23clgvwhat is APLbot?
10:25gdevclgv, an irc bot i just made up so that i could reference a previous joke about using utf-8 characters
10:30gdev*gdev doesn't have cookies enabled
10:46Fer`Hi all. Is there a release date for clojure 1.6?
10:47tbaldridgeFer`: no. Why do you ask?
10:47Fer`Also, is there a tutorial around for core.async? Do I have to know golang or read CSP?
10:47nDuffFer`: many, of varying levels of quality. If you run across one that uses Thread/sleep, run away. :)
10:47Fer`tbaldridge: Just wondering when core.async will have an stable version
10:48tbaldridgeFer`: https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj
10:48nDuffFer`: that's not really tied to 1.6.
10:48tbaldridgeFer`: the two are unrelated, core.async runs on 1.5
10:48Fer`I see
10:48silasdavisI'm using liberator and trying to get redirected after a post request
10:49silasdavisI'm using the example of that library's site but using curl I don't get any text response
10:49Fer`But there's no date for an stable core.async release either then?
10:49tbaldridgeFer`: core.async is stable-ish. We haven't changed the public APIs in months, and I'm not aware of any breaking changes in the works
10:49Fer`ok
10:50clgvtbaldridge: maybe you should cut a stable release then ;)
10:51tbaldridgeclgv: yeah, yeah, I know. :-P
10:52clgvtbaldridge: is it a considerable effort or can you just shout at stuart halloyway like david nolen does? ;)
10:59clgvnDuff: so that's how you hacked into the linux kernel? ;)
11:00nDuffclgv: Heh. Only kernel work I was doing back then was on the input core, and didn't end up escalating things in that direction, no. :)
11:02ToBeReplaceddoes anyone have an example of linking a seq of monotony periods to execution?
11:03alandipertToBeReplaced: are you talking about discrete event simulation a la cron? maybe something like https://github.com/aredington/monotony interests you
11:03snake-johnhi this is the first time that I am looking at pedestal. There is the "data model" and the "application model" Am I right the data model exists behind the seems as a tree in a atom. But the application model is just a queue where certain delta structures are added to and taken from?
11:03alandipertToBeReplaced: also the newly released https://github.com/candera/causatum for something way fantastical
11:04ToBeReplacedalandipert: i'm referring to monotony, yes -- eventually though you need to go from the periods it returns to a thread processing current time against them; i'm looking for a gist of that
11:04rkneufeldsnake-john: Close. The application model is still "kept" as a tree, but you're seeing deltas of what changes in that tree.
11:06alandipertToBeReplaced: ah. i don't know of any examples of that but a queue or a core.async channel may be The Way
11:07Fer`Is the usual way to read/parse edn str/read-string?
11:07alandipertToBeReplaced: e.g. you enqueue periods and they're processed every tick by some consumer based on wall time
11:07alandipertFer`: see the clojure.edn ns for various flavors of 'safe' read
11:07ToBeReplacedFer`: clojure.edn/read
11:07Fer`Oh i see
11:08Fer`apropos didnt return anything for "edn" :P
11:08snake-johnGee my feeling says to me that pedestel it is well thought and as I contain
11:08snake-johnsorry just hit the return button to early.. pedestal is well thought out but there are so many new terms
11:09ToBeReplacedalandipert: it wouldn't quite work that way; i think you are underselling the technical problem
11:09alandipertToBeReplaced: i'm a programmer, it's in my nature :-)
11:09rkneufeldsnake-john: definitely
11:10ToBeReplacedalandipert: i like that monotony separates creating sequences of periods from execution b/c that's a different problem; every scheduling system you ever find puts everything under one big enterprise product
11:12snake-johnIt is still difficult to see what transform-enable in the application model buys me. (since its not data)
11:17alandipertToBeReplaced: by 'processing current time against them' do you mean 'periodically compare current time to the next period and determine if it should be processed' and then manage the processing such that there are timeouts/overrun protections?
11:20ToBeReplacedalandipert: possibly; haven't thought about the problem in detail -- i meant it broadly
11:20alandipertToBeReplaced: if so i can't really imagine a better way to do it than by putting periods on a queue or channel and having a worker pool that consumes/processes
11:21alandipertToBeReplaced: i am underselling but i can't think of any other general advice that wouldn't be affected by specifics of your problem, things like resource contention and worker distribution
11:24snake-johnfrom reading the docs transform-enable reminds me of REST and the link tag. So transform-enable states the possible changes that can be applied to a value. Am I right?
11:57lgs32aWhat are your suggestions on dynamically loadable (pre-compiled, without source-code) plugins for .jar standalone apps written in Clojure
11:57lgs32ai mean suggestions how to implement such thing
12:00clgvlgs32a: leiningen uses naming conventions. but you can also provide API functions to register the extensions of the plugin
12:01lgs32aso i could deploy a compiled jar, have a plugin loader in it, later deploy a plugin-jar, and have it possible for the compiled jar to load the plugin jar?
12:02lgs32ahow would i write the api and expose it to the plugin-jar
12:02lgs32aand especially how would i access it from the main program
12:16mheldhey y'all
12:17mheldare there any books out there that specialize in using clojure in AI -- kinda like PAIP w/ clojure?
12:30technomancylibrary idea: a namespace full of right-variants of built-in functions (rpartial, rreduce) named dexter
12:41justin_smithI always thought clojure was sinister, now I realize why
12:41technomancydun dun dun
12:43technomancyhttps://en.wikipedia.org/wiki/Dexter_and_sinister
12:43justin_smithnDuff: nope, but some Latin would help
12:43nDuffAhh.
12:44babilen*ba dum tsh*
12:44rasmustoI like it
12:47diphtherialfor those of you who use lighttable, do you find its continuous evaluation feature to be a benefit or a hindrance?
12:47diphtheriali'm not sure if i'm doing something wrong, but it seems to significantly slow down my machine whenever i attempt to use it
12:48diphtheriali can also imagine it being disastrous if it tried to materialize an infinite sequence or something... (still a clojure newbie, not sure if that makes sense)
12:49seancorfieldLT only materializes part of each sequence when displaying it - typing (range) is safe.
12:50nDuffdiphtherial: when I use Light Table, I'm trying to quickly come to understand someone else's code. It's pretty handy for that.
12:50seancorfieldI'm finding I like having my active file editor as a live eval REPL... I can try things out inline in amongst the code without having to switch windows etc
12:50lgs32ai prefer evaluation from the repl. if i want to inspect values inside of a function i can println them.
12:51lgs32ai recommend to learn emacs with nrepl, you can switch buffers then instead of windows
12:51lgs32ai find lighttable an interesting project but consider it far from being usable at the time.
12:52seancorfieldI use Emacs with nrepl primarily. But I am also using LT one day a week to help Chris with testing etc.
12:52diphtherialinteresting, thanks for the opinions, and good that it doesn't materialize the whole thing...
12:52seancorfieldLT is a much more approachable experience for folks new to Clojure who are not already Emacs users
12:52diphtheriali went down the vim path, but i'm not any more productive with it than with using a graphical editor
12:53diphtherialthis is likely some mental insufficiency on my part, so i don't blame the editor
12:53lgs32a@seancorfield i noticed that lighttable always complains about my ns declarations. i use vectors instead of lists like (:require [clojure [set :as set]])
12:55lgs32a@diphterial: if you can take a few days off to learn emacs you will find it very rewarding!
12:55hiredmana. you should use vectors b. you shouldn't do sub things like that
12:55hiredman[clojure.set :as set]
12:55hiredmanc. this is irc not twitter you leave out the @
12:56diphtheriallgs32a: i'll try it :) i have nothing but time anyway
12:56lgs32ahiredman why b? when correctly indented, the namespace declaration is why more readable and it compiles.
12:57hiredmanlgs32a: incorrect
12:57diphtheriali know editor opinions run deep; i apologize for asking about them again and risking conflict
12:57lgs32a^^
12:57lgs32ahiredman: what do you mean?
12:58ToxicFrogI took four months off to learn emacs once and it didn't go well, although possibly it's just not well suited to C++ and Lua work?
12:58hiredmanyou are adding levels of nesting, and implying a grouping where none exists
12:59technomancylgs32a: also it makes grepping hard if you want to rename a namespace or move a defn
12:59technomancy(wouldn't be a problem except we don't have proper find-usages tools yet)
12:59rasmustodiphtherial: I haven't been able to make the emacs switch, and vim has suited my clojure work so far (fireplace + paredit.vim)
13:01lgs32aToxicFrog: Doing C++ in emacs is not easy but certainly possible.
13:01technomancyC++ is never easy
13:01justin_smithdiphtherial: nah, I have known some right idiots who are very productive in vim. Like any tool it needs usage before competancy gains. vim and emacs are the kind of tools where those gains can keep happening for a long time, that is the tradeoff for the sharp beginning curve
13:01lgs32acheck out clang-complete
13:02ToxicFroglgs32a: this was a few years ago, I don't do much C++ work these days.
13:02diphtherialjustin_smith: fair enough, perhaps i just didn't stick with it for long enough
13:02ToxicFrogBut my main objection was that most of the features I wanted were contained in huge, poorly documented elisp scripts that often needed manual updating/bugfixing.
13:03lgs32awell there are some ide environment like things
13:04lgs32abut again, what you say is right. however for a functional language it is a great environment. needless to say that I do 90% of all my computer work in emacs
13:04lgs32aeven webbrowsing or chatting here
13:04ToxicFrogThe impression I came away with is that emacs would be a great editor if I had started using it fifteen years ago when I had more patience and spent the intervening time gradually customizing it.
13:04lgs32aone great thing is that emacs extension language is elisp which will seem immediately familiar to clojure programmers
13:05ToxicFrogelisp reminds me a lot more of common lisp than it does of clojure. I'm not a fan.
13:05justin_smithyeah, calling elisp "scripts" is a bit funny, 95% of emacs functionality is implemented in elisp files - it basically would not be a usable editor without the elisp code
13:06lgs32ayes. somebody is already implementing emacs in clojure (deuce). certainly it would be nicer to have clojure instead of elisp as an extension language
13:06lgs32abut do you prefer vim-script over a lisp?
13:07justin_smithlanguages emacs is in the process of being implemented in (off the top of my head): haskell, guile scheme, ocaml, clojure, common lisp
13:07technomancyelisp and CL are very similar. it's pretty awkward but better than any other embedded language I've ever seen.
13:07justin_smithlanguages implementing a usable emacs: c+elisp
13:07technomancyheh; so true
13:08ToxicFroglgs32a: no, I dislike vimscript slightly more. My solution thus far has been to use ST2 and customize in Python.
13:08ToxicFrogAlthough I did use JEdit with Scala extensions for a while.
13:09ToxicFrog(and yeah, I don't like CL either)
13:10justin_smiththere are implementation reasons - dynamic vars really make sense in an editor ui, they map nicely to ui contexts / file modes
13:10supersymI found I need very little besides what LightTable atm gives me
13:11supersymregex search/replace, multiline editing.. for that I take subl2 though :P
13:11technomancyjustin_smith: yeah, but lisp-2 is only justifiable in that "we didn't know better at the time; sorry"
13:11supersymfigured not to want the pain of learning emacs atm
13:11justin_smithtechnomancy: true enough
13:12technomancyalso equality is just such a mess
13:13technomancythough not significantly worse than any other language that doesn't default to immutability
13:13lgs32atrue true
13:14mishok13if I have a function and it's memoized version and I want to have both function available -- what would be the preferred naming convention?
13:14mishok13*it's -> its
13:14bbloomequality is always a mess
13:14clgvmishok13: I did not hear of one so far
13:14ToxicFrogjustin_smith: IMO, dynamic vars are great to have as an option, and I love clojure's support for them. Having them as default is questionable. Having them exclusively is mental, although I understand that elisp supports lexical scoping as of some recent version.
13:15technomancybbloom: my favourite is not being able to use case on strings because they're not eq. uuuugh.
13:15mishok13clgv, that sucks
13:15technomancybbloom: but "equality is always a mess" strikes me as something you're more likely to say if you spend too much time in JS land
13:15clgvmishok13: why? just establish a personal one
13:16technomancymishok13: depends on why you're exposing the un-memoized variant
13:16bbloomtechnomancy: i don't use emacs or know elisp, but i say "equality is always a mess" b/c of all the stuff discussed in that EGAL article
13:17bbloomtechnomancy: in JS (and php, etc) equality isn't just a mess. it's FUCKING BROKEN
13:17mishok13technomancy, that actually got me thinking if I should exposes non-memoized version
13:17bbloomclojure's equality is at least somewhat sensible
13:17mishok13but even than, how would you call the non-memoized version?
13:18technomancymishok13: I submitted a patch to make c.c/memoize leave the non-memoized fn as metadata on the memoized one.
13:18technomancydidn't get accepted, but I still think it's a great idea if you only need it for weird edge cases
13:19mishok13that's a nice idea
13:19justin_smithmishok13: (def +-5* (partial + 5)) (def +-5 (memoize +-5*))
13:19mishok13care to share the code?
13:19clgvtechnomancy: are there use cases where a lib really defines a memoized function in a variable? usually the user needs to be able to set the scope of memoization
13:20justin_smithmishok13: done that way, both are available, a * on the end usually indicates "for internal usage mostly but accessible"
13:20mishok13justin_smith, yeah, that's what I'm doing right now
13:20mishok13but it just doesn't feel right
13:20mishok13dunno why
13:20technomancyclgv: not necessarily in a lib, but in an application, sure.
13:21fogus|awaytechnomancy: core.memoize does that. It's at the :clojure.core.memoize/original key
13:21technomancyclgv: "this should be memoized, but I need to blow away the cache or I can't test it properly"
13:21clgvtechnomancy: erm what?
13:22technomancyclgv: when using memoize to speed up idempotent fns that write to disk
13:26callenllasram: the Clojure formula is problematic too. I *do* use OS X and it's no excuse.
13:27llasramcallen: I agree you should totally PR a removal then
13:34tbaldridgednolen: can you get me a minimal use case for that set! core.async bug?
13:35dnolentbaldridge: (let [x (js-obj)] (go (set! (.-foo x) "bar")))
13:35tbaldridgednolen: thanks, I'll make that into a test
13:36callenRaynes: the atoms probably aren't going anywhere.
13:38callenI might consider a multi-arity underlying function, but the top-level API would be the same.
13:38callenat minimum, it would only be a case of removing the pathing thingy, the caching stuff would stay.
14:15Raynescallen: ...okay?
14:15Raynescallen: We're talking about selmer?
14:15RaynesAnyways, I'm indifferent. I won't likely be using it anyways. :3
14:17callenRaynes: I explicitly told yogthos that you, "weren't a customer"
14:17callenRaynes: and yes, Selmer.
14:17callenRaynes: that doesn't mean I don't like feedback and food for thought. There's one atom in particular I'm considering killing off.
14:17Raynescallen: I would hope that yogthos considers my advice regardless of whether or not I'm a customer.
14:18yogthosRaynes: under advicement :)
14:18callenRaynes: I'm sure we both do, but users get priority.
14:18callenand solving their problems > code niceness
14:19callenor at least, those are my priorities.
14:19RaynesI don't think it has anything to do with code niceness, but *shrug*.
14:19yogthosfor now it's likely to stay as is though, until I get time to think of doing it with no impact ;)
14:19callenRaynes: I think having less stateful code is about code nicenss.
14:19callenniceness*
14:19RaynesYou're obviously set in these ways, and arguing about it doesn't help me get anything done.
14:19RaynesSo enjoy your global mutable state! :)
14:19callenRaynes: well, not so obviously, since because of your feedback there's an atom I'm considering killing off
14:19callenand replacing with a config map.
14:19callentechnomancy: you haven't even looked at the library in question.
14:20callentechnomancy: also I have a vested interest in avoiding global mutable state since I'm an http-kit user.
14:20callenworse would be thread locals, but that's another horse.
14:20technomancyjust sounds like awfully familiar discussion, that's all
14:20callenand I am considering improvements based on the feedback.
14:20yogthosso far the only solution I see is using a closure to initialize the parser
14:20callenI'm not about to turn the memoization atom into a series of self-returning closures though.
14:21yogthosbut then the user has to manage it
14:21yogthosI'm not sure there's a win from user perspective in that case
14:21callenyogthos: so the idea I had for the config/path atom stuff was to actually put an intermediate fn between the outer fn the user calls, and an inner one it wraps
14:21callenyogthos: and the wrapped inner fn is multi-arity and optionally accepts a config map of sorts for what used to be the atom.
14:22yogthosyeah that would be fine
14:22callenyogthos: I'll cogitate on it more, but that's roughly what I was thinking of in the interest of maintaining API compat.
14:22yogthoswe also want to stay compatible with clabango ideally
14:22yogthosand I've got a meeting here :)
14:22callenthere's nothing wrong with global state when it's necessary and makes sense. It's undue use thereof that is problematic.
14:22yogthosafk
14:23callenyou're all using services and computers that make prolific use of mutable state, global and otherwise. It's a practical decision not a philosophical one.
14:23tbaldridgecallen: famous last words...
14:23callenby complaining about code you haven't even looked at, on the basis of the mere mention of 'state', you discredit yourselves and make the community seem more dogmatic than it merits.
14:23callentbaldridge: don't shame yourself.
14:23tbaldridgehttp://xkcd.com/292/
14:23Rayneslol
14:24callentbaldridge: have you seen the code in question?
14:24callentbaldridge: do you have a patch?
14:24RaynesOne moment please.
14:24tbaldridgecallen: of course not, I just randomly spew memes to mess with people
14:24Rayneshttps://github.com/yogthos/Selmer/blob/master/src/selmer/parser.clj Will everyone please look at this code so that callen will shut up about who has seen the code or not? :p
14:24supersymcallen: agrees
14:25tbaldridgeThis is the internet, you can't censor me simply because I don't know what I'm talking about.
14:25technomancyI'm not talking about the code at all; I'm questioning the logic of listening to other users over the guy who's been through all this before.
14:25callentechnomancy: what we're doing isn't comparable with the problems with Noir at all.
14:26callentechnomancy: and in fact, I'm planning improvements to lib-noir to *fix* problematic uses of state that break when used in non-affine async thread pools such as I use in my work
14:26callentechnomancy: so I am deeply and intimately familiar with the possible problems thereof, planning concrete fixes to address them, and know exactly where the code in question stands on that front.
14:27technomancyk, sounds good
14:27callentechnomancy: it is also worth reminding that the primary author of Selmer is a major contributor/co-author to lib-noir as well.
14:27callentechnomancy: save the witch hunt for dumbfuck noobies, I'm not in the goddamn mood for critique from people who have no code to offer.
14:28callentechnomancy: I trust and respect Raynes as much as you do.
14:28supersymfor my learning/amusement, whats the problem exactly? all the atoms scattered around or?
14:28callensupersym: not here, I'll answer questions in privchat.
14:28callenI'm not in the mood for LEL MEMES right now.
14:28supersymsure
14:29Raynessupersym: FWIW, you're going to get exactly callen's side of this story in PM which is that we're all dumb fp programmers with superiority complexes who don't understand the problem scope.
14:29RaynesWhich isn't quite what I was going for with my concerns.
14:30Rayneshttp://www.youtube.com/watch?v=YOXpKUu6pUg
14:31callensupersym: we use a few atoms. Some are necessary and not going anywhere, one or two are potentially unnecessary and could be replaced with something cleaner.
14:31callensupersym: the first priority was maintaining API compatibility with a previous library, this means args/arity couldn't change
14:31supersymyeah
14:31callenatom not going anywhere: memoization atom.
14:31supersymgotcha
14:31callenit's legitimately global state, meaning, there's no coordination, all threads should actually be sharing the memo atom.
14:32callenatom potentially going bye-bye: config path thingy.
14:32supersymwell I just thought your arguments about not being a religion are actually pretty sane... as long as you/we are aware of side-effects/concurrency limitations
14:33RaynesSo, how about that John Carmack?
14:33supersymRaynes: should I know him? :P
14:33RaynesNot if you never cared about video games at all.
14:33callensupersym: and we are. When global state is semantically intended to be global, it's thread-safe, and returning closures would actually involve coordinating and surfacing that state as a global anyway, a global atom makes perfect sense.
14:33supersymaha... yeah I see :P
14:33supersymI like wolf3d
14:33supersymcool titles on his name
14:33ToBeReplacedcallen: from afar, looking at parser.clj, it seems like the cache / last-modified check belongs as a separate concern -- it seems like a bunch of different webdev type projects all implement their own methods of checking for changed files
14:33RaynesI <3 Doom.
14:34ToBeReplacedcallen: have you seen that abstracted out anywhere?
14:34Raynessupersym: He joined the Oculus Rift team as CTO is why I mentioned him.
14:34supersymyeah doom was pretty damn sweet...
14:34Raynes:p
14:34rasmustoRaynes: I'm feeling good about jumping on the kickstarter bandwagon early
14:34callenToBeReplaced: the last modified thing is a little questionable, it was a clever local dev thing yogthos chucked in.
14:34ToBeReplaceds/abstracted/separated
14:34gtrakRaynes: looks like good news
14:34callenToBeReplaced: the memo atom for the memoization/caching isn't going anywhere. That's not even up for debate unless somebody has a specific implementation to discuss.
14:34supersymaha... those VR goggles,... nice :)
14:34callenthe other atoms I'm more open to alternatives for.
14:35ToBeReplacedcallen: i'm not questioning design here -- i'd need a lot more time with the code to say anything meaningful
14:35callenToBeReplaced: Selmer is one in a long series of libraries modeled after a codebase I've spent the last 6 years with.
14:36callenToBeReplaced: this is partly why I'm not super interested in off the cuff remarks from people that see the word, "state" and reflexively whine.
14:36tbaldridgewe need a clojurebot macro for that
14:37ToBeReplacedcallen: the last-modified bit is interesting though; i'm wondering if there's room for a dev plugin that accomplishes tasks like that one that library creators could code against
14:37ToBeReplacedex. (watch-resources change-hook re)
14:37callenToBeReplaced: there's a template lib utilities library floating around. I could add to that but there isn't a ton that's worth extracting.
14:37callenToBeReplaced: we explicitly avoided watch-resources/change-hook type behavior.
14:37callenToBeReplaced: that's shit is a fucking rathole and will eat you alive.
14:37muhoomy god, the template flamewards are still ongoing?
14:38callenmuhoo: no, the war is won. Selmer is a thing.
14:38callenmuhoo: github.com/yogthos/Selmer
14:38RaynesHah!
14:38RaynesClassic.
14:38ToBeReplacedcallen: isn't that what you do in that parser though?
14:38callenmuhoo: the library the community needs, but not the one it wants.
14:38RaynesThe king of the north announcing his victory before the fight as even begun.
14:38callenToBeReplaced: not at all. We're checking last-modified on each render synchronously.
14:39hyPiRionoh what
14:39ToBeReplacedcallen: oh oh oh, you meant like, background-job-with-hook vs. explicit-check-on-action
14:39Raynesmuhoo: Anyways, this wasn't a flamewar about templating libraries but about the design of this particular templating library involving global mutable state as a library.
14:39callenToBeReplaced: asynchronous filesystem event callbacks are horrendously unreliable and not a good idea for anything that needs to work reliably. That goes double for JVM services.
14:39hyPiRionemplate wars back from its 2 month hibernation?
14:39muhooo_0
14:39callenhyPiRion: war is won son.
14:39hyPiRionbattles are fought.
14:39llasramTemplateWars sounds like it could be a pretty fun video game
14:39RaynesAfter war, nobody wins.
14:39technomancy"crusade" might be a better term at this point.
14:40callenmuhoo: they don't like pragmatic decision making where a solution fits the problem and semantics just because it has the word 'state' attached to it.
14:40RaynesI wish you'd stop dismissing everyone's opinions like that.
14:40callenmuhoo: I'd already stated an openness to a particular change/improvement as a result of feedback about state, but the rest of them smelled blood and here we are.
14:40RaynesI mean, it's fine for you to be fine with this particular design and these decisions, but don't do that shit.
14:40callenRaynes: I wish people would stop pretending I haven't been humping problems like this for years.
14:40RaynesThat's all I ask.
14:41RaynesI wish you'd stop pretending that they haven't. :\
14:41ToBeReplacedcallen: not going to disagree there; it just felt like the last-modified check was out of place... seems like a dev-time tool, where dirty hacks seem appropriate
14:41callenI've got the benefit of having already taken in feedback and plan to respond to it.
14:41callenNobody has budged an inch in response to anything I've said.
14:41muhoo,gentlemen
14:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: gentlemen in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:41callenmuhoo: ouch.
14:41muhoo&gentlemen
14:41lazybotjava.lang.RuntimeException: Unable to resolve symbol: gentlemen in this context
14:41tbaldridge~gentlemen
14:41clojurebotYou can't fight in here. This is the war room.
14:41muhootbaldridge: thank you
14:41callenToBeReplaced: it is, there's a dev flag in the config for that.
14:41dnolenfn->ilookup idea from yesterday + hashmap destructuring is interesting - http://gist.github.com/swannodette/6176916
14:43TimMccallen: Having beat your head against a problem a lot does not mean you are Always Right.
14:43RaynesLe sigh.
14:43RaynesWhat have we become
14:43callengiven that we aren't discussing or analyzing any actual code
14:43tbaldridgednolen: rofl...that last example.
14:43callenexcept for ToBeReplaced, god bless him.
14:43ToBeReplaceddnolen: cool -- every time i think about doing this i decide the reduce-kv version is more readable for the people aroud me
14:43callenthis is essentially a waste of time.
14:43Rayness/.*/dismissed/
14:44dnolentbaldridge: :)
14:44callendnolen: https://github.com/uncomplicate/fluokitten
14:44dnolenToBeReplaced: definitely not something I recommend, but maybe there's something useful here in some cases
14:44Raynes"Fit well into idiomatic Clojure - Clojure programmers should be able to use and understand Fluokitten like any regular Clojure library."
14:44Rayneshhheheheheh
14:45ToBeReplaceddnolen: can you think of an example? i'm assuming speed for when you don't actually need a map?
14:46lgs32awhat is the war about?
14:46callenRaynes: that laughter made me choke, bravo.
14:46hiredmandnolen: shouldn't you pass the not found value in to the fn?
14:46Raynescallen: :p
14:47gtrakRaynes: is that sort of an admission that it's anything but idiomatic?
14:47TimMcOh, speaking of templating libs -- I saw a really freaking cool idea on reddit the other day. Someone was talking about a templating engine that put parts of the template into the DEFLATE literal tables.
14:47hiredmanilookup is a great interface to implement because it is small, and once you do you get map destructuring
14:47dnolenhiredman: not-found seems weird since how can you know you're outside the domain of the function? (exceptions?)
14:47TimMcThe idea is to make the browser's gzip expander do template expansion for you.
14:47hiredmandnolen: if you pass it in to the function the function can decide
14:47dnolenToBeReplaced: hash-maps too large to express as a real map?
14:47dnolenhiredman: ah good point
14:47hyPiRionToBeReplaced: whenever you want to pass a function, but the API needs a map
14:48technomancyTimMc: whoa that's nuts.
14:48TimMcI think it's just vaporware, and might be fragile, but... *drool*.
14:50arcatanTimMc: that's really cool and really horrible at the same time. is there an implementation?
14:53callenhttps://github.com/mxcl/homebrew/pull/21733
14:53ToxicFrogTimMc: that's sick
14:54dnolentbaldridge: have you watched the Advanced Go Concurrency Patterns video? What do you think of the nil channel pattern? cc bbloom
14:55bbloomdnolen: i watched it a while ago, but forget what that one is. link to slides to refresh my memory?
14:55tbaldridgednolen: ditto
14:55dnolenbbloom: if you set a channel to nil it always blocks
14:56tbaldridgeerr, I haven't seen it, but I'd like slides
14:56tbaldridgewhat use is that?
14:56dnolenhttp://www.youtube.com/watch?v=QDDwwePbDtw
14:56dnolenhttp://talks.golang.org/2013/advconc.slide#1
14:57bbloomis that a memory management "feature"? ie if you try to write to a nil channel, you'll block & then your goroutine will be GCed?
14:58tbaldridgewouldn't a nil channel be the same as (chan) that no one ever writes to?
15:00dnolentbaldridge: bbloom: actually I think this is a workaround for the fact that they don't have dynamic selecto?
15:00dnolendynamic select
15:00bbloomthey have dynamic select, it's in the reflection package
15:01hiredmanit is new
15:01bbloomhttp://golang.org/pkg/reflect/#Select
15:01hiredmanprior to 1.1 they didn't
15:01bbloomah ok
15:01bbloomso you'd start w/ a maximal set and then force them to nil & select would basically block/ignore the nil channels?
15:01bbloomyeah, sounds like a hack and a half to me
15:02TimMcarcatan: No implementation that I know of. This was in the context of a reddit.com/r/crypto discussion of compression attacks against HTTPS.
15:02ToxicFrogWhat's dynamic select?
15:02tbaldridgednolen: to answer the question, I know Ghadi had an implementation at one point, and Rich vetoed it, I don't remember why, but this is probably it.
15:03dnolenbbloom: yeah, based on those slides it definitely what it's for, to take channels in/out select
15:03bbloomToxicFrog: "dynamic" meaning the set of channels to multiplex on is known only at runtime
15:03bbloomToxicFrog: like a map lookup instead of a switch statement
15:04ToxicFrogAah.
15:04ToxicFrog...Go doesn't/didn
15:04ToxicFrogt have that?
15:05bbloomit has it now here: http://golang.org/pkg/reflect/#Select
15:05bbloomhiredman says it was added post 1.0
15:05tbaldridgenope, and the original version of core.async didn't either. But that was back before it was announced.
15:06hiredmanI remember it wasn't there when I original started playing with go, and as added around the time I stopped
15:07bbloomtbaldridge: it's super useful to have :-) glad it's in there. in general, i like having both dynamic and static versions of operators for explicit staging
15:09dnolenbbloom: tbaldridge: lovely you can alts! over a set :) gotta love Clojure
15:10tbaldridgednolen: I think that's a docstring bug
15:10bbloomcan you alts! over a set? there was a bug before where nth was a required operation :-)
15:10tbaldridgethe random select requires nth
15:10bbloomah.
15:10tbaldridgeyeah, it's a bug. But (vec my-set) should work :-P
15:11dnolentbaldridge: yes but nth works on seqables
15:11tbaldridge, (nth #{1 2 3})
15:11clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$nth>
15:11bbloomno, it works on seqs, not seqables
15:11tbaldridge, (nth #{1 2 3} 3)
15:11clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: PersistentHashSet>
15:11dnolentbaldridge: bbloom: oh it works in ClojureScript :)
15:11bbloomheh, is that a clojure or a clojurescript bug? :-)
15:11tbaldridgeyeah, well, real programmers use the JVM
15:12bbloombrb in a bit
15:12dnolenit probably should just work on seqables IMO
15:13horofoxwhat web framework do u guys recommend me?
15:13tbaldridgealthough having nth work on a unsorted set is a bit odd. It's unsorted, so how would know what nth would be?
15:14tbaldridgeIt makes sense in this use case, but doesn't really in the more general use.
15:15hiredmanthat nth works on seqs is odd
15:15tbaldridge(inc hiredman)
15:15lazybot⇒ 24
15:15dnolentbaldridge: there are two cases in ClojureScript where we basically make nearly an type work, IReduce and ICounted
15:15hiredmanseqs are not good for random access
15:16dnolenwe actually preserved this behavior from the original CLJS implementation
15:16dnolenhiredman: but water under the bridge given destruction support for seqs I'd say
15:16dnolendestructuring
15:16technomancyhiredman: I think the "n" in the name kinda implies O(n)?
15:17tbaldridgelol
15:17hiredman,(doc nth)
15:17clojurebot"([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."
15:17hiredmanseqs with O(n) are called out as an exception there
15:17dnolenso for ClojureScript "for sequences" -> "for seqables"
15:18Raynestpope: You need to get into Elixir, man. It's in dire need of someone to write a better vim indent script. :p
15:19hiredmandnolen: my point is just that the waters are a little murkier than "it probably should just work on seqables IMO" might lead someone to believe
15:22dnolenhttp://github.com/clojure/clojurescript/blob/791834558b61459ece6c124af6186580a65128a1/src/cljs/cljs/core.cljs#L928
15:22dnolenthat was almost 2 years ago
15:23callenRaynes: I need somebody to make my programming language papyrus compatible.
15:23hiredmanso?
15:24hiredman(it also shows nth taking linear time for everything, not just seqs)
15:25hiredmanoh, default impl
15:25dnolenhiredman: might be a bug might not be is all, anyways a minor thing - perhaps seqs is as far down the slippery slope as Rich intended it to go and this is an oversight in CLJS.
15:27bbloomfwiw, i agree that nth shouldn't work on sets
15:27hiredmananyway, I don't accept the clojurescript code base as an authority to be bowed to, it has flaws here and there and a scope
15:28dnolenbbloom: now it's question how many CLJS depend on this behavior :P
15:28dnolenCLJS programs
15:28hiredmandoing everything like it is done in the clojurescript codebase is not a recipe for making a language I like, you have a hand on the tiller of the clojurescript code base so it should not be a surprise you feel differently about that
15:28dnolenbbloom: not sets specifically but seqables
15:28bbloomdnolen: if it throws an exception, then it's a trivial fix to add "seq" to your code to opt in to undefined nth order :-)
15:29bbloomanybody who relies on this is also relying on the particular order that their sets are seq-ed in
15:29bbloomi bet they'd be happy to have that bug presented to them in terms of a sensible error message :-)
15:30dnolenhiredman: I don't have too strong opinion on this - we tried to avoid mucking around with what was originally done, certainly I didn't have any hand in this behavior.
15:30tbaldridgethe only time having nth work on a set would be useful is when you're doing exactly what core.async is doing: (nth my-set (rand-int (count my-set)))
15:31dnolenbbloom: yeah, I actually prefer that core fns like nth don't have differing expectations
15:31`fogusClojureScript should be viewed as a gift handed down from Olympus and never sullied!
15:31bbloomtbaldridge: and, in theory, each collection type could define a random sample function
15:31bbloomjust like coll-reduce, you could have coll-sample
15:32hiredmandnolen: sure
15:32bbloomb/c you can get log time sampling of sets, you don't strictly need ntyh
15:32bbloomnth*
15:33tbaldridgebbloom: can you get random sampling assuming the same values in the set each time?
15:33hiredmanmaps don't support nth either at the moment
15:33dnolenso linear-nth should probably be changed to throw if not given ISeq
15:34bbloomtbaldridge: you mean like sampling multiple values without replacement?
15:34bbloomreduce sample disj ?
15:34aaelonyI seem to be misusing merge badly. What's the best way to get from '({:t "abc", :u "c"} {:t "def", :m "e"} {:t "abc", :m "d"}) to ({:t "abd" :u "c" :m "d"} {:t "def" :m "e" :m nil }) ?
15:34hiredmannth on sets could be seen as a deterministic random sampling of a range of values from an immutable datastructure
15:35`fogusBut really, there are probably mistakes in it (I worked on it) if something doesn't makes sense then it should change.
15:35hiredman(nth s 0) is "in a repeatable way, give a random element from the set" (nth s 1) is "in a repeatable way, give me a random element from the set, but not what I would get for (nth s 0)" and so on
15:35tbaldridgebbloom: right we want non-deterministic sampling of the coll
15:36bbloomtbaldridge: sample == random == non-deterministic, no?
15:36aaelonysorry, that should have been… What's the best way to get from '({:t "abc", :u "c"} {:t "def", :m "e"} {:t "abc", :m "d"}) to ({:t "abc" :u "c" :m "d"} {:t "def" :m "e" :m nil }) ?
15:37tbaldridgebbloom: in that way, would you consider this to be random? (seq (set (range 10)))
15:37stuartsierraWhy would you want `nth` to work on sets in the first place?
15:37bbloomtbaldridge: (comp seq set) is undefined, but deterministic
15:37bbloomthe other of … is undefined, but deterministic
15:38hiredmanstuartsierra: I think destructuring in loops and stuff would be a little easier
15:38bbloomalthough that's an implementation detail, really. in theory the set could use randomness, like a skip list or something
15:38tbaldridgehiredman: huh?
15:38bbloomthen it would be non-deterministic too
15:38hiredman(loop [[x & xs] foo] ...)
15:38stuartsierra(loop [[x & xs] (seq foo)] ...)
15:38hiredmanyou need to (seq foo) to make that really generic
15:38hiredmanstuartsierra: sure
15:39bbloomhiredman: right, but when you add that "seq" a red flag should go off that you're doing a coersion to an unknown order
15:39tbaldridgestuartsierra: this all comes from a CLJ vs CLJS bug with core.async. Passing a set to alts! breaks in CLJ not in CLJS, because CLJS supports nth on a set
15:39bbloomyou're explicitly throwing the order away
15:39hiredmanbbloom: generally I don't care about order, I just want to process the things
15:39bbloomsure, use reduce :-)
15:40hiredmanbbloom: as my coworkers can tell you, I do
15:40hiredmana lot
15:40yazirianhaha yeah
15:40hiredmanyazirian: thanks man
15:40yazirianreduce accumulates the men from the boys (so to speak)
15:41bbloomtbaldridge: so to clarify what i was saying…. if you need to take one or more random elements from a collection, you can do so in better than linear times for everything but linked lists, pretty much
15:41hiredmanclojurebot: reduce |accumulates| the men from the boys
15:41clojurebotRoger.
15:41bbloomtbaldridge: not having nth doesn't mean you can't do it. you just need to bring datastructure specific knowledge to bear on the problem, like reducers do w/ fold/combine
15:41tbaldridgebbloom: right I understand now.
15:42tbaldridgesooo....back to the problem at hand, I think we can fix this by having a guard in alts! that converts to a seq if needed.
15:42bbloomtbaldridge: now we just need an ICollSample protocol :-)
15:44bbloomis dnolen gonna take the breaking fix? :-)
15:44bbloomfor cljs, i mean
15:44dnolentbaldridge: that sounds reasonable, it would be nice to not have to do the conversion - but doesn't this wreck havoc for priority true?
15:44dnolen:priority true
15:45Raynescallen: wat
15:46tbaldridgenah, it won't change much at all: https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L193
15:47bbloomtbaldridge: ah yeah, so if you just add a sequential? check on the very next line, you should be good for sets
15:47tbaldridgeor do the conversion at the top so we don't take a perf hit every time
15:47bbloom(nth (if (sequential? ports) ports (seq ports)) idx)
15:48bbloomoh right, in a loop. yeah
15:48bbloomhoist my irc-based patch ^^ :-)
15:49bbloomhttp://dev.clojure.org/jira/browse/ASYNC-6
15:51dnolenCLJS fixed, nth only works on ISeq now https://github.com/clojure/clojurescript/commit/a113b08a8c2811b0590cc6a36b2e9e5adc1c4c1e
15:52dnolenthere were no tests for the prior behavior so that's promising
15:52bbloomKABOOM
16:02konrIs anybody using datomic-pro? The jar at clojars is quite outdated
16:03`foguskonr: I don't think the pro jars are meant to be on Clojars
16:04hiredmankonr: datomic has it's own maven repo they publish to these days
16:08konrhiredman: so I'd install a .jar from that repo? I've also noticed that there is a datomic.*.jar in the distribution zip, but it apparently doesn't include the dependencies, so I'd need to either add them to my project.clj or somehow add them to the jar, right?
16:10callenRaynes: vim is ancient and out of date. -> Papyrus.
16:10Raynescallen: Make sense, man.
16:11RaynesI need to yell at evil-mode's author for using gitorious
16:12callenRaynes: gitorious is awful, sadly FSF nuts usually use Emacs.
16:13callenI admire the FSF for what they're working towards, but working with them is ughhhhh sometimes.
16:15konrhiredman: nevermind, there is a maven-install script at bin/ :)
16:26RaynesI think I might switch back to Emacs tonight.
16:26RaynesOr more like switch back to Vim living inside Emacs, since evil-mode pretty much implements the whole damn editor.
16:27gtrakis paredit and stuff usable that way?
16:27rasmustoRaynes: what's your hybrid setup like? I'm curious to try emacs, but I'm pretty stuck in vim muscle memory
16:27Raynesgtrak: Yes. It really doesn't effect Emac's normal behavior at all.
16:28Raynesrasmusto: Just evil-mode. No extra configuration.
16:28bbloomi've said it before, but i know it's heresy around these parts: i don't feel the need for paredit in vim, since i'm pretty adept with text-objects
16:28RaynesText objects don't solve the problems that paredit solves at all.
16:28rasmustobbloom: have you used vim-sexp?
16:28gtrakI've seen a vim user try out evil-mode and like it, but I didn't understand enough about his crazy-fast finger hacks to know why or what implications it could have for my workflow.
16:28rasmustoit feels like paredit-lite to me, but still gives you slurps and barfs and the like
16:28callenbbloom: I'm the same way, but in Emacs.
16:29callenI don't need paredit.
16:29bbloomRaynes: ok well text objects + other normal vim stuff
16:29RaynesHaving text objects in Emacs is something I think people would eat right up if they knew about it.
16:29callenI think the way I structure my code might make paredit less apparently useful as well.
16:29bbloomrasmusto: nope
16:30stuartsierrakonr: datomic-pro doesn't publish JARs to a Maven repository.
16:30bbloomrasmusto: this looks interesting though. seems like paraedit's ideas in a more-vim-like-package
16:30stuartsierrakonr: datomic-free JARs should be available on Clojars, I think.
16:32stuartsierraYes, https://clojars.org/com.datomic/datomic-free
16:32stuartsierraFor some reason Clojars search doesn't show the latest version.
16:33timvishercemerick: so i have a plain old html file that needs to connect out to the browser repl server
16:33ToBeReplacedif I do a (while true (swap! a inc) inside of a future, future-cancel returns true, but f continues to calculate -- why is this?
16:33technomancy(doc future-cancel)
16:33clojurebot"([f]); Cancels the future, if possible."
16:33technomancy"if possible" means it sets the thread interrupt flag IIRC
16:33timvisheri don't see any way to get the port in the javascript source to always be correct without templating it in via a dynamic request served by ring or summat
16:34technomancyif the flag is never checked ... welp.
16:34timvishermake any more sense?
16:34RaynesCancelling futures is kind of like "Hey Mr future could you plz stop? No? Okay… I'm sorry."
16:34dnolentbaldridge: now this looks fun (re net-chan) :) http://users.uom.gr/~iliass/Publications/Conferences/S05_cspcons_SETN.pdf
16:34Raynescanceling*
16:35rasmustobbloom: yeah, that's how I felt about it. I'm going to give it a shot, as paredit gets in my way more than I'd like
16:35tbaldridgednolen: yeah I'm going to have to read that one tonight.
16:35ToBeReplacedtechnomancy: almost there -- so even though @fut returns CancellationException, .isDone is true, etc, the thread in the future may still be computing
16:36bbloomrasmusto: i generally dislike when my editor does ANYTHING other than precisely what i instruct it to do. things like auto paren insertion drives me nuts. first shit to turn off if you ever have to use VS or IDEA
16:36ToBeReplacedtechnomancy: i'm all sorted, plenty of java docs for this stuff
16:36technomancybbloom: the worst is when your runtime just GCs the memory out from under you. it's like "hey, I was gonna use those bytes"
16:36rasmustobbloom: I agree except for when you're dealing with sexprs (mostly)
16:37bbloomtechnomancy: i don't see how that's remotely the same thing
16:37rasmustobbloom: and auto-indent etc.
16:37gtrakrasmusto: if paredit gets in your way, you know there are some ways to override it, right? like C-w doesn't care.
16:37bbloomauto indent annoys the hell out of me whenever it fucks up
16:37TimMcbbloom: So you dislike indenta
16:37TimMcOh.
16:38bbloomi use it, but i frequently edit the rules
16:38technomancyemacs's auto-indent is never wrong, by definition =)
16:38bbloomlol
16:38rasmustobbloom: 95% of the time it's a blessing, though
16:38dnolenLisp World Problems
16:38bbloomrasmusto: 92% of the time ;-)
16:38bbloomdnolen: i was explaining datomic to someone the other day and then they asked all these questions about "what happens if"
16:39TimMcIt's always right 98% of the time.
16:39bbloomand every time the answer was "you already have this problem with your sql database"
16:39gtrak98% of the time, it's right every time.
16:39bbloomdnolen: if all the hard bits are solved, you've got extra brain cycles to think about the bike sheding bits :-)
16:39rasmustoI've had ggVG= break indenting if I have especially nasty/long functions
16:39rasmusto(exactly 5% of the time)
16:46shane__Hello all I am new to clojure. Is this the correct chat room for getting started questions such as emacs, nrepl, etc?
16:46nDuffshane__: sure.
16:47shane__I think I have everything setup however when building web apps with clojure I can't seem to reload code in the repl
16:47shane__Is there some trick that I am missing?
16:48nDuffshane__: you need to be sure your vars are involved in runtime evaluation
16:48nDuffshane__: otherwise, changing the functions they point to doesn't take effect without a reload.
16:48nDuffshane__: can't really speak in _too_ much more detail without a specific implementation to poke at.
16:49shane__specifically with compjoure
16:49shane__I am working through the tutorial on heroku
16:49shane__https://devcenter.heroku.com/articles/clojure-web-application
16:50shane__Once I call run-jetty everything works however if I make modifications to defroutes
16:51shane__the changes don't show up unless i restart jetty
16:52nDuffshane__: yup. Short form is that it's not a new project, or related to your editor setup.
16:53nDuffshane__: compojure is building composed functions; redef'ing the individual components doesn't change them, because the vars' targets have already been composed..
16:53technomancyshane__: argh; let me fix that
16:53technomancywe have some people at heroku who don't understand how repls work =\
16:54stuartsierraYou could always rebuild the functions when you want to reload….
16:55technomancyfixed
16:55technomancyshane__: (run-jetty #'routes ...) is the way to do it
16:56shane__whoop that was fast!!!!
16:56shane__Thank you very much!!!!!
16:56technomancyno problem
16:57shane__Man I heard that the clojure community was great! I wasn't expecting such a quick and awesome response!
16:58shane__technomancy and stuartsierra thanks very much!
16:58stuartsierraI didn't do anything, just obliquely referenced a different technique. :)
17:05gdevshane__, most times, I still have a question I posted a few months ago I'm still waiting to hear back on though
17:09stuartsierragdev: I doubt anyone here remembers what that question was. :)
17:10gdevstuartsierra, i can't even remember
17:10gdevit illustrates the importance of answering questions fast i guess
17:12hiredman*shrug* it's not like questions are entitled to answers
17:13callen+1's please: https://github.com/mxcl/homebrew/pull/21733
17:14gdevhiredman, I agree
17:14gdevand with that, I'm shutting the peanut gallery down for the rest of the day.
17:14RaynesI don't want to be involved with that.
17:14RaynesThey're just going to tell you to scatter and die, callen.
17:15technomancyremoving a package without a deprecation notice? nice.
17:16technomancyis that a thing people do in homebrew land?
17:16callentechnomancy: it's more of a shot across the bow.
17:17callentechnomancy: this is what a deprecation typically looks like: https://github.com/mislav/homebrew/commit/0cba6491782127552e5d299b7337d3d6a00ca257
17:18callencaveats don't actually stop install.
17:18callenand the goal is a no-op.
17:18callenRaynes: you want the result, you just don't have the taste for blood >:)
17:19RaynesNot really.
17:19RaynesI want a caveat.
17:19callenI can PR a caveat.
17:19RaynesAt least then we don't have to deal with the "BUT IF IT'S IN HOMEBREW IT MUST BE THE RIGHT WAY TO DO IT WTF UR RONG" people.
17:20callenthat would be nice.
17:21technomancyI dunno; "I'm using homebrew and ..." is usually enough to trigger my "all bets are off" heuristic.
17:22callenwe should add a macro/bot-response for homebrew.
17:22callenif one doesn't exist.
17:22technomancy~macports
17:22clojurebotmacports is not a package manager, it's a satire about package management.
17:22technomancywould be difficult to top that unfortunately
17:22callenthat's a good start.
17:24technomancywell I'll browse wondermark for a few hours looking for something appropriately snarky, but I can't promise results.
17:24muhoo~java logging
17:24clojurebotjava logging is clown shoes
17:24muhoothat's still my favorite
17:25callenit's accurate.
17:25callenthat's why I use Timbre :P
17:25technomancynot actually relevant but http://wondermark.com/121/
17:28bts-i'm trying to set up logging for my first production clojure app right now. what do most people do when a dependency uses its own arbitrary logging library?
17:29JayIS there any opening in Closure ????????
17:29JayJOB
17:29Jayclojure*
17:29hiredmanbts-: most logging libraries in java are super duper configurable so you use a shim of that logging library to redirect logging to some other
17:29Jaytypo**
17:30Jay?????
17:30bts-hiredman: thanks
17:30Jay????
17:31JayAny opening in Clojure ?
17:33Jay???????
17:34callenJay: stop spamming.
17:34TimMcJay: Everybody saw your question, stop adding more lines.
17:34JayLOL!
17:35JayWhy i need learn language if there is no opening in that language :D
17:35TimMcAlso, I probably wouldn't hire anyone who used on average three question marks per sentence.
17:35callenJay: some people enjoy programming for its own sake, we're not here to find you a job.
17:35nDuffJay: There are certainly openings. Nobody who behaves you do in public is going to get one of them, though.
17:35callenJay: and you come off as a bit of an idiot, which makes people telling you about a job opening even less likely.
17:36JaynDuff, LOL i work in Corporate LOL!
17:36callenJay: even if you are a solipsist, you should learn how not to behave like one.
17:36hyPiRionTimMc: None of them contain two or three though. Clojurebot would've acted on it.
17:37JayLOL
17:37hyPiRionclojurebot: any opening in clojure???
17:37lazybothyPiRion: How could that be wrong?
17:37callenJay: stop saying "LOL", it's devoid of content. Say something or don't speak at all.
17:37hyPiRionoh, that was a lazybot thingy
17:37clojurebotclojurebot is http://images2.fanpop.com/images/photos/3000000/Arrowed-teen-girl-squad-3099521-570-420.jpg
17:38JayI have right callen who the hell are .. I might have sued you
17:38callenwe really need mods.
17:38TheMoonMaster^
17:38gtrakit's probably not good for clojure if people who sound childish learn it and get jobs?
17:39TheMoonMasterIt's good for any language.
17:39Jaylol i already job
17:39callenJay: then leave, since that's all you're interested in and your needs are satisfied.
17:39TheMoonMasterBut you don't already English.
17:39TimMctechnomancy: You around to squash a troll?
17:39JayEnglish is not my language**
17:40bosiegtrak:
17:40TheMoonMasterYou don't already English.
17:40clojurebotEnglish is the official language of the universe
17:40bosiegtrak: i wish i had a job where i could use clojure
17:40JayI dont care for English
17:40TheMoonMasterThen stop using it.
17:40TheMoonMasterOtherwise you do care.
17:40TheMoonMasterThe care is strong in you, Jay.
17:40JayI will learn chinese
17:41Jay:D
17:41gtrakbosie: It's pretty sweet :-). I hope there will be more clojure jobs faster. Jay: go troll #english
17:41Jaytroll ?
17:41bosiegtrak: you use it fulltime commercially?
17:41gtrakyes, I've been doing it full-time for almost 2 years.
17:42JayI dont find any job in Clojure in my country... But i see lot of forums and things
17:42hyPiRionHey guys, remember that there's a command named /ignore.
17:42hyPiRionJust in case anyone forgot.
17:42blrm(inc hyPiRion)
17:42lazybot⇒ 20
17:42TimMcAnd in some clients, /ignore -replies Jay
17:42Jaylol
17:42TimMcThat's a nice one, because it nukes the entire conversation (if properly nick-addressed).
17:43blrmTimMc: i wasn't aware of that, awesome
17:43muhoo(inc TimMc )
17:43lazybot⇒ 3
17:43callenTimMc: I didn't even know that one existed after years of irssi use! thank you!
17:43bosiegtrak: may i ask where? you can PM me if you dont want to make it public
17:43callen(inc TimMc)
17:43lazybot⇒ 45
17:44callenmuhoo: you inc'd the wrong person.
17:44callenmuhoo: note the space.
17:44gtraksure, Revelytix, in Baltimore.
17:44sinistersnarehello, is there any way to add local dependencies without install maven, only lein?
17:44JayLOL!
17:44sinistersnarei have a few jars i want to add to my project
17:44sinistersnarebut i dont want to install maven onto all my systems
17:44gtrakbosie: there's also a St. Louis office
17:45bosiegtrak: man. data science in clojure on hadoop. i am seriously jealous. its exactly what i am looking for hehe
17:46technomancysinistersnare: you can do `lein deploy` on files from disk these days
17:46gtrakbosie: I do mostly compojure stuff
17:47bosiegtrak: thats odd. i figured you would be using cascading + cascalog and not clojure as a web language
17:47callenbosie: I do mostly web stuff as well.
17:47gtrakbosie: we have a query engine built on top of cascading, too, but it's in maintenance mode
17:47hiredmanbts-: https://github.com/pedestal/pedestal/blob/master/service/project.clj#L42 is an example of pull in lots of logging framework shims that redirect logging all in to the logging system you really want
17:47bosiegtrak: why clojure for web?
17:48Jayclojure i dont like IT
17:48sinistersnaretechnomancy: so if my internal jars are in the ./lib/ folder, i can add that to my :dependencies in my project.clj?
17:48gtrakbosie: the whole product's clojure. NOT java, basically :-)
17:48TheMoonMasterI can't see myself using Clojure for web stuff. But I could see it being used for services that the web stuff might tlak to.
17:48TheMoonMastertalk*
17:48bosiegtrak: gotcha. but no love for cascalog?
17:48callenTheMoonMaster: you just haven't used nice libraries yet :)
17:48gtrakbosie: I wasn't part of that decision, but it was evaluated
17:49sinistersnareim not quite sure what 'lein deploy' does, "Deploy jar and pom to remote repository."
17:49sinistersnareim a clojure newbie...
17:49callenRaynes: I think they're into it.
17:49mgaaresinistersnare: it's used to upload your stuff to package repositories
17:49technomancysinistersnare: hm; should remove the word "remote" from there
17:49TheMoonMastercallen: Well, that and I can't exactly justify using it for client sites.
17:49gtrakI would recommend cascalog unless you really need to drop down, imo hadoop is a messy beast.
17:49Raynescallen: Looks like it, yep.
17:49technomancysince it works on file:///home/me/.m2/repository too
17:49callenRaynes: thank you.
17:50sinistersnarecan i use it on a non-maven repository?
17:50callenRaynes: your much more eloquent and constructive words are very helpful.
17:50sinistersnarei just want it to be *project.clj-location/lib
17:50sinistersnare*
17:50Raynescallen: I'm still with you that I wish they'd not even consider the cljsc shit at all though, fwiw. Clojurescript is hard enough without that confusing them. :\
17:50bosiegtrak: are you a 'data scientist'?
17:50technomancysinistersnare: you can create a new repository anywhere on disk
17:50gtrakbosie: nope :-). just a programmer.
17:50technomancybut it'd still be in maven format
17:50bosiegtrak: may i PM you?
17:50gtraksure
17:51sinistersnareok, i dont mind the format; the user will only have lein installed
17:51sinistersnarethough
17:51Raynescallen: And I also wish that they wouldn't have the any clojure-related packages except for leiningen. I just try to take the path that will be both sufficient for our needs as a community and not asking too much of people who don't understand how it works.
17:51callenTheMoonMaster: you're a contractor?
17:51JayClojure LOL !
17:51callenRaynes: well if I can fly a PR under the radar I'll do it.
17:51technomancysinistersnare: right; there is no longer a need for mvn
17:51sinistersnareoh great
17:51TheMoonMastercallen: For now, yeah.
17:52Jayjust a C !
17:52callenTheMoonMaster: meh. you can always advocate for using whatever you want. it's all a question of trade-offs.
17:52technomancyJay: you're welcome to stay around if you wish to contribute to the conversation, but stuff like that is gonna get you booted
17:52TheMoonMastercallen: I'd kind of be screwing the client in a way. There aren't *that* many Clojure web devs.
17:52callenTheMoonMaster: that's up to you to determine.
17:53patchworkTheMoonMaster: The more clojure sites, the more clojure webdevs
17:53callenTheMoonMaster: all my projects are either personal or long-term maintenance (relative to the lifespan of the company)
17:53TheMoonMasterRight, a lot of the use cases I see don't make sense.
17:53callenTheMoonMaster: but until people start forcing the matter and start using Clojure even where it's not necessarily enabling maximum fungibility of developers it's not going to spread.
17:53TheMoonMasterEspecially since I'm a Rails developer and it's way easier to sell people on that as well.
17:53callenNode.js took off because ignoramuses used it where it didn't remotely make sense.
17:53Jaytechnomancy : I understand But like i said no one needs clojure... If no clients i wont even touch the language
17:54bts-hiredman: thanks a lot!
17:54callenJay: we don't care.
17:54technomancyJay: you're free to not touch it; that's your decision
17:54Jaycallen: I dont care either
17:54callenJay: then /part
17:54Jaywho the f! are u callen
17:54mgaarefwiw Jay is trolling in #haskell too :D
17:54technomancymgaare: good to know; thanks
17:55TheMoonMasterI wouldn't call this trolling.
17:55Jaymgaare ?? :D LOL ! Not me
17:55JayI love haskell
17:55justin_smithaaelony: did you get an answer earlier?
17:56Jaymgaare mind your words ...
17:57sinistersnareim sorry to keep asking the same words, but in other words, is using 'lein deploy' what i need to do to add local jars? all i want to do is append the classpath with a folder; and my lack of understanding 'lein deploy' isnt really going my way :p
17:57aaelonyjustin_smith: didn't get an answer but I've got something somewhat workable that i'm unhappy with...
17:58mgaaresinistersnare: no. If you have a .jar, put it in the project's lib folder and you will be able to get at it
17:58sinistersnareits in the lib/ folder
17:58sinistersnaredo i need to do anything else?
17:58justin_smithaaelony: maybe (def apply-default (partial merge {:t "abc" :m "d"}))
17:58justin_smiththat may or may not improve on what you have
17:58@technomancysinistersnare: you can use `lein deploy` to put jars from anywhere on the filesystem into the repo where lein can find them
17:59sinistersnarei just want them in the dir where my project.clj is, i dont need them anywhere else
17:59tieTYTi've heard lisp referred to as "a programmable programming language". 1) I assume that is referring to macros 2) I assume that it's necessary to have homoiconicity to write macros the way lisp does. If my assumptions are correct, 3) why is homoiconicity necessary? Why can't java be just as programmable as clojure? (I've never written a macro)
17:59justin_smithsinistersnare: you can add to source-paths in your project.clj
17:59aaelonyjustin_smith: thanks, I will try that. I'm doing something terrible like a (get (merge-with merge (group-by …) (group-by …))) within a for loop
18:00justin_smith(map (partial merge {map with default values}) hashes) ?
18:00aaelonylooks promising
18:01mgaaresinistersnare: this post has some more info for that: http://www.elangocheran.com/blog/2013/03/installing-jar-files-locally-for-leiningen-2/
18:02nDufftieTYT: if you want an case-in-point type example, the core.async library is actually a pretty good one.
18:02sinistersnarethanks, ive been searching google, but have been fruitless; glad you found something
18:02nDufftieTYT: ...it implements functionality for Clojure as a library which other languages need to have built into the compiler to support.
18:02aaelonyit has to essentially construct a union of the things to look for from 2 (or more) seqs, then for each thing found, go through each seq by thing and consolidate the things that are found into one record
18:03shane__Does anyone know of any clojure user groups that meet in Boise Idaho
18:04shane__Nothing came up on google
18:04JayI'm not saying i dont want to learn clojure all i'm saying is learning language must be fruitful ....like getting JOB :) ... NOT FOR TIMEPASS
18:04nDufftieTYT: If you don't have homoiconicity, you have a completely different language to use when writing macros. A much, much harder one, because they're operating on parse trees that weren't really built to be manipulated or understood by humans.
18:04tieTYTnDuff: although i haven't looked, I assume that I won't be able to understand that code
18:04patchworkJay: I have been using clojure professionally for 2 years now, several other people I work with do as well
18:04aaelonyfwiw, here is what I have (that I'm unhappy with but mostly seems to work)… https://www.refheap.com/17365
18:05nDuffpatchwork: don't feed the troll
18:05justin_smithaaelony: so you could use (set (mapcat keys hashes)) to get all the keys in all the hashes
18:05justin_smithaaelony: then (select-keys mp (vec keys-set)), if I understand you correctly
18:05patchworknDuff: I keep a troll zoo, closet troll sympathizer
18:06nDufftieTYT: ...there _are_ non-homoiconic languages that support macros, by the way -- Boo is one of them.
18:06nDufftieTYT: ...but while working with macros is supported in theory there, there's a huge difference between supported in theory and actually usable for difficult things.
18:06mgaaretieTYT: the main 'secret sauce' macro in core.async takes a normal-looking function call, and behind the scenes turns this into a state machine that implements go-like goblocks
18:07justin_smithworking on things in terms of parsed tokens in a transperently defined nesting gains you much when constructing macros
18:08JayThank you patchwork
18:08justin_smithI mean you can cause a string to be evaluated in any language, if you jump through a hoop or two (and maybe have a copy of the compiler sitting around)
18:09aaelonyjustin_smith: not sure I follow your suggestion
18:10tieTYTi see
18:10tieTYTdoesn't C++ have macros?
18:10justin_smithaaelony: I probably misunderstand what you were doing, looking at your paste now
18:10tieTYTthat #NDEFIF stuff or whatever?
18:10justin_smithtieTYT: yes, both as macros and something they call templates
18:10aaelonyjustin_smith: ok, cool
18:10justin_smithwhich are really macros
18:11tieTYTi think the problem is I've yet to come across a problem in clojure that would make me write a macro
18:11ToxicFrogtieTYT: yes, although C/++ macros have some differences from Lisp macros that makes them rather sadmaking to use
18:11tieTYTso I have no way of saying, "what if I wanted to do this in java? How would I be screwed"
18:11justin_smithtemplates in c++ are a better comparison to macros
18:11callenRaynes: WE'RE BLACKLISTING THIS BITCH :D
18:11Raynescallen: Quick, hop on and warn them about the clojurescript pull request too!
18:12justin_smithtieTYT: macros are when you need to change how something is evaluated - imagine if every fn needed a do in it
18:12justin_smithimage if every def needed the symbol arg quoted
18:12justin_smith*imagine if
18:12pbostromtieTYT: think of it this way: public String foo() { return "bar" } is not a usable data structure in Java, you would have to take an extra step to parse that into something you can manipulate, however (defn foo [] :bar) is both Clojure code and a usable data structure, a list with 4 elements
18:12ToxicFrog(they are basically a textual expansion/token replacement phase that happens before compilation proper, using their own language, rather than fully fledged functions with the type AST => AST)
18:12Raynescallen: Look at us, a 'speakin for the Clojure community. We're warriors.
18:13mgaareC++ templates are also a good illustration of why homoiconicity is so important for macros. Templates are more or less only good for type polymorphism and generating extremely long compiler errors
18:13callenRaynes: I just want that fucking formula gone.
18:13ToxicFrogFormula?
18:13RaynesToxicFrog: For krabby patties.
18:13tieTYTpbostrom: I feel like I understand the parts of that sentence, but not the whole :P
18:13RaynesThey're taking all our business.
18:13justin_smithmgaare: so true
18:13ToxicFrogRaynes: I am terribly confused
18:14tieTYTthanks for the help. I feel like I don't get it yet, but I think i need to need a macro before I can understand this better
18:14callenToxicFrog: killing off problematic Clojure homebrew Formula
18:15ToxicFrogtieTYT: clojure code is also valid clojure data structures. Clojure macros are not just a find-and-replace on the source code as they are in some other languages, but clojure functions themselves, which takes a data structure representing executable clojure code, and return a similar structure.
18:15callenRaynes: I pulled in the clojurescript issue/PR.
18:15ToxicFrogWhich makes them both (a) vastly more powerful and (b) much more pleasant to use than e.g. cpp macros.
18:15ToxicFrogI used macros recently but I can't actually remember why.
18:15Raynescallen: Looks good. Progress.
18:15callenit's nearly impossible to write a reliable cpp macro, even a trivial one.
18:15justin_smithtieTYT: a key part of understanding it is that a compiler for almost any real language generates a data structure called an AST. Lisps are handy in that the source code is almost exactly the same, structurally, as the initial AST - so you can manipulate the AST without a huge conceptual burden to make programmer friendly syntaxes
18:15callenanybody who says otherwise hasn't written much C or cpp macros.
18:15callensimilarly, anybody who thinks C is "simple" hasn't dived very deep.
18:16ToxicFrogcallen: "clojure homebrew formula"?
18:17jtoysilly question, why doesnt active_users get passed to sort-by? (cond->> (active_users) true ((sort-by params)))
18:17callenToxicFrog: silly mac user stuff, we're trying to keep the muggles from stumbling about.
18:19jtoycan I pass (()) in the ->> macros and have the forms get data?
18:19justin_smith(()) wont' work because you cannot call ()
18:19Raynescallen: I got the comments.
18:20jtoyhere is a better example: (cond->> [1 2 3 4] true ((sort-by count)))
18:20jtoyjustin_smith: so can I change it to work here?
18:20justin_smithI misread your question
18:20rasmustojtoy: I think you have one too many sets of parens on '((sort-by count))
18:20justin_smithinstead of ((sort-by count)) do (#(sort-by count %))
18:21rasmustojustin_smith: he's doing thread-last, so no need for the anon fn
18:21justin_smithahh
18:21justin_smithheh
18:21rasmustojustin_smith: I tend to do that when I need to switch from thread-first to thread last, it's ugly :P
18:21ToxicFrogcallen: aah
18:22jtoyI sort of see, so why do i sometimes need to do (#()) vs () ?
18:23ToxicFrog,(doc cond->>)
18:23clojurebot"([expr & clauses]); Takes an expression and a set of test/form pairs. Threads expr (via ->>) through each form for which the corresponding test expression is true. Note that, unlike cond branching, cond->> threading does not short circuit after the first true test expression."
18:23callenRaynes: progress progress! Exciting :D
18:23rasmustojtoy: (->> 'foo (#(somefn % 'bar)))
18:23Raynescallen: :D
18:23sinistersnare,(doc ->>)
18:23clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
18:23rasmusto(->> 'foo (somefn 'bar)) will thread 'foo in after 'bar
18:23ToxicFrog,(doc sort-by)
18:23clojurebot"([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array."
18:23callenRaynes: samueljohn is awesome.
18:24ToxicFrogHrm
18:24ToxicFrogIs there a reason you can't just
18:24ToxicFrog,(cond->> [1 2 3 4] true (sort-by count))
18:24clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: count not supported on this type: Long>
18:25ToxicFrogWhups
18:26jtoyic, thx
18:28Raynescallen: Let me answer this. You're going to get impatient. :p
18:28ToxicFrog,(cond->> [1 2 3 4] true (sort-by identity))
18:28clojurebot(1 2 3 4)
18:29ToxicFrog,(cond->> [1 2 3 4] true (#(sort-by identity %)))
18:29clojurebot(1 2 3 4)
18:31justin_smith,(cond->> [1 12 :a 3 :b 4 :d] (comp even? number?) (sort-by #(java.lang.Math/sin %)))
18:31clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number>
18:32justin_smith,(cond->> [1 12 :a 3 :b 4 :d] (filter (comp even? number?)) (sort-by #(java.lang.Math/sin %)))
18:32clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$filter>
18:32justin_smithwhatever
18:32rasmustojustin_smith: what are you trying to do with the cond->> macro?
18:32hyPiRionjustin_smith: (comp even? number?) doesn't make sense
18:32hyPiRiondo (every-pred number? even?) instead
18:32justin_smithyeah, of course
18:32justin_smiththanks
18:33justin_smithI'll switch over to pming the bot
18:34Raynescallen: I'm impressed. You didn't chew anyones faces off or anything. :P
18:35callenRaynes: I can be nice when I care.
18:35callenRaynes: I'm a fucking saint at work to my coworkers, comparatively.
18:35callenbecause my coworkers are nice people.
18:37callenRaynes: I think this might actually work.
18:37Raynescallen: Considering we have every single maintainer in that pull request, I bet.
18:38Raynescallen: Holy balls we're the same person all of a sudden.
18:38callenI kno rite.
18:39callenthey're going to think we're a coordinated marketing team.
18:39callenRaynes: LOL
18:39callenRaynes: HE CLOSED the cljs PR!
18:39RaynesHooray!
18:40Raynescallen: We've inevitably made an enemy of that poor Daniel fellow.
18:40callenI'm prepared to do battle a decade from now by sword.
18:40callenRaynes: should I add the Leiningen caveat?
18:40callenI think it makes sense.
18:42callenyeah, dunzo.
18:43TimMcWhat are you hooligans on about?
18:43callenTimMc: getting Clojure removed from homebrew :)
18:43Raynescallen: I'd add it.
18:43callenRaynes: caveat is in, what about doc URL?
18:44RaynesProbably worth adding. Link to whatever we'd link a new user to.
18:44callengot it.
18:44callentechnomancy: what's the best URL to Leiningen for documentation that isn't likely to change?
18:44callenI know of the markdown in ./doc/ but I wasn't sure what would be best.
18:44technomancycallen: http:/leiningen.org#docs maybe?
18:45callensweet, thanks.
18:46technomancycallen: if it's for people who just installed they should do `lein help tutorial`, `lein help faq`, etc
18:46technomancyoh, with | less
18:47callentechnomancy: we have lein help and lein repl in there.
18:47callenI'm trying hard not to make things seem any more complicated than necessary so that the PR flies through.
18:47RaynesPointing to the docs gets them to the tutorial.
18:48callenyep
18:48technomancyI guess you can assume they're online if they just installed the package, sure
18:48callenyep.
18:52TimMcHeh, best of luck.
18:52callenTimMc: >:D
18:59subusnarlhello, this is a fairly specific question, but how can i add the following files to me :dependencies in lein? http://libgdx.badlogicgames.com/nightlies/maven/com/badlogic/gdx/gdx/0.9.9-SNAPSHOT/
19:01subusnarlwould it be [com.badlogic.gdx/gdx "0.9.9-SNAPSHOT"] with the :repository set as [["libgdx" "http://libgdx.badlogicgames.com/nightlies/maven/com/badlogic/gdx/&quot;]]
19:01subusnarli mean http://libgdx.badlogicgames.com/nightlies/maven&quot;
19:15callenRaynes: gerd dermmert, so close.
19:18arthurmacielhello!
19:19callenarthurmaciel: hi
19:19arthurmacielI'm quite new to clojure and I'd appreciate any web framework recommedation. Someone that has been used for production for example.
19:20Trinaryis compojure + libnoir still a good starting point for web frameworks?
19:22callenTrinary: yes but a comprehensive example would be Luminus.
19:23callenhttp://www.luminusweb.net/
19:23callenarthurmaciel: Trinary ^^
19:24Trinarynice
19:28arthurmacielcallen: do you use it for day-to-day tasks? It seems marvellous
19:29callenarthurmaciel: yeah, I just got done helping yogthos move it from Clabango to Selmer.
19:29callenarthurmaciel: I use http-kit + standard luminus libraries
19:33arthurmacielcallen: no SXML for clojure?
19:36callenarthurmaciel: I don't know what that is.
19:37callenarthurmaciel: are you asking about templating?
19:38callenarthurmaciel: ohhh that.
19:38callenarthurmaciel: https://github.com/weavejester/hiccup
19:39callenI recommend Selmer for actual views/templating
19:40technomancyhiccup is pretty great though
19:40Raynescallen: I think you might be accidentally arguing with someone who agrees with you.
19:40callenRaynes: not arguing.
19:40callenjust reinforcing.
19:41arthurmacielcallen: yes, something like that. After meeting SXML any templating strategy seems too bloated to my ignorant eyes.
19:41callenarthurmaciel: github.com/yogthos/Selmer/
19:45Raynescallen: I think my last comment iwll clear things up.
19:45sinistersnarehi again; this time around, im hoping someone has some libgdx (java library) experience! i found this piece of code on github, and am wondering if its necessary to call dispose on the BitmapFont and the SpriteBatch
19:45sinistersnarehttps://gist.github.com/sinistersnare/6179928
19:46sinistersnareyou would regularly need to call dispose
19:46sinistersnareon those objects because they are run natively via JNI, but they dont exist out of the context of the show function. so im not sure how i would call dispose onto it
19:47arthurmacielcallen: why do we need [%endfor%] when we already have a closing parenthesis? :)
19:48callenarthurmaciel: I've worked on large projects, DTL/Selmer style libraries were a godsend there.
19:50callenand it works well in small projects too.
19:50justin_smithsinistersnare: if you need to call dispose, than something exists - should they be stored between calls to show? if so you need to make some allowance to allocate and dispose them explicitly
19:51arthurmacielcallen: just in case, is it possible to use luminous with hiccup?
19:51sinistersnarewell, i guess they need to be stored in between calls to show, because i need to dispose of them eventually
19:52justin_smithyou could have an init function that returns a handle to the resources, and a cleanup function that takes that handle as an arg
19:53sinistersnareim not sure how to do that :p
19:53justin_smithreturn a map
19:53justin_smith(from the init function)
19:54justin_smithand pull the values out of the map to dispose them
19:54justin_smithor, return an anonymous function that will dispose the resources from the init function, if that makes more sense
19:54technomancyRaynes: you could point the homebrew guys to http://dev.clojure.org/jira/browse/CLJ-366 as proof of the fact that they don't really have any interest in solving that particular problem
19:55sinistersnarejustin_smith: so they would be stored globally still?
19:56justin_smithsinistersnare: pseudo-clojure: (defn allocate [] (let [resources {:font (BitMapFont.) :spirtes (SpriteBatch.)}] resources))
19:56justin_smiththen you write a function that takes a resources map like that, and disposes of them
19:57justin_smithsinistersnare: or (defn allocate [] (let [sprites (SpriteBatch.) font (BitMapFont.)] (fn [] (dispose sprites) (dispose font))))
19:58justin_smiththen you hold onto the function returned by allocate, and call it to dispose the resources
19:58justin_smithneither approach uses any global resource
19:58sinistersnarehmm
19:58sinistersnaregimme a second to ponder that...
19:59justin_smiththe general idea is that allocate returns something each time called, and you use that thing it returns in some way to do your cleanup
20:00sinistersnareok
20:00sinistersnareso give me a second to try and use it
20:00justin_smithnp
20:02callenarthurmaciel: yes
20:02callenarthurmaciel: you can use anything you want with Luminus, it's like anything else, just a bag of libraries. Pick and choose what you want.
20:02callenarthurmaciel: the culture in Clojure is to let people use and combine libraries however they want, not to force decisions via a framework.
20:04sinistersnareim so confused. this is what i have now, but im not sure what to do
20:04callenRaynes: you're much better at this than I am.
20:04dnolenEjecta is pretty sweet - make interactive iOS application with ClojureScript - http://impactjs.com/ejecta
20:04arthurmacielcallen: good to know (about hiccup and clojure philosophy)
20:04sinistersnarehttps://gist.github.com/sinistersnare/6179928 and with this, i just call (allocate) to release the objects?
20:04dnolengoing to get even nicer with iOS 7 with official JSC Obj-C bridge
20:05callenarthurmaciel: it's worth noting that I describe this as the Clojure culture even though it's not something I'm 100% subscribed to for all use-cases.
20:06arthurmacielcallen: good to know you're being honest :)
20:06justin_smithsinistersnare: you would call the value returned by allocate
20:06sinistersnareyes
20:07sinistersnaredid i use it correctly in the let form of the show method?
20:07sinistersnareim a clojure newbie, as you most probably know
20:07justin_smithsinistersnare: yeah, and then you would call (memory) to dispose it
20:07justin_smithso maybe memory should have a different name, like cleanup or dispose
20:07sinistersnareyes i agree
20:08sinistersnarebut doesnt memory itself have a scope that doesnt exist out of the show function anymroe
20:08sinistersnareshow function at all*
20:08justin_smithit does have that scope if you pass it out
20:08sinistersnarehow can i pass it out?
20:09justin_smithwhat does (.addActor stage label) return?
20:09sinistersnarevoid
20:09justin_smithok, so after that line, just have memory
20:09justin_smithas the return value
20:09sinistersnareoh that sounds good
20:09sinistersnarevery interesting proposition
20:10justin_smithand if multiple calls to show can share the same allocated sprites and fonts, then you can pass those in, and separate the allocation from the showing altogether
20:11justin_smithalternatively, since you are already using a def'd stage, you could similarly def a "cleanup" function on the top level of the namespace
20:11justin_smithwith a similar declare / def pattern
20:11justin_smithbut when you do things that way the code is not re-entrant
20:11sinistersnareim not quite sure i understood that D:
20:12justin_smithwhat if you wanted to use that namespace two places in the same app
20:12sinistersnareanother question: what does the ^ do?
20:12justin_smiththey would only have one stage
20:12justin_smithit is declaring the type
20:12justin_smithit indicates metadata, in general
20:12sinistersnareoh ok
20:12sinistersnareso its ignored by the reader?
20:13justin_smithnope, used by the reader
20:13sinistersnareD:
20:13sinistersnaredamnit
20:13sinistersnareok
20:13justin_smithcertain optimizations are possible with type tagging
20:13justin_smithit prevents reflection
20:13kristofDoes anyone know if typed clojure does type inference?
20:13sinistersnareso would it be better if i called (declare) on the allocated objects?
20:14technomancykristof: not really =(
20:14kristofI know that's hard if the whole program isn't typed to begin with but I think it'd be cool to, you know, annotate a block of code with only a few type annotations and then have a type checker infer the remaining types within the rest of that code
20:14justin_smithsinistersnare: the most durable design is to make a function that returns all allocated objects and configuration (an init), and then pass it or bind it when using other code in the namespace
20:15justin_smithsinistersnare: but for basic stuff that does not need to be re-entrant you can do quite a bit with def as long as you are aware of that limitation
20:15sinistersnaregod damn im sorry, im just so confused; i understand what your saying, but im not sure how to implement it
20:15technomancykristof: some people say there are inherent incompatibilities between hindley-milner and the JVM
20:15technomancyas for as interop is concerned
20:15justin_smithsinistersnare: one sec, let me try to find some simple code that works that way
20:15sinistersnarethanks so much
20:16hiredmantechnomancy: with oop style sublcassing, like jvm types have
20:17bbloomyeah, you can do hindley-milner w/ protocols & just call all the java things "Object"
20:17kristoftechnomancy: Not even Haskell has true Hindley-Milner, to be honest. So it's not a true-to-the-paper implementation that matters, but reducing type annotations where they can be inferred.
20:18kristofOh, question
20:18kristofWhat's the deal with pods right now?
20:18kristofAre they still happening or has no one taken the reins on that?
20:18hiredmanlet me ask you this
20:18brehauthaha pods
20:18hiredmankristof: what are pods?
20:18clojurebotGabh mo leithscéal?
20:19bbloomhiredman: i think he means http://dev.clojure.org/display/design/Mutex+references+(pods,+nee+cells)
20:19hiredmanbbloom: shhhhh
20:19kristofhiredman: It was in one of Hickey's keynotes. The idea is to remove policy dictation from transients.
20:19bbloomas far as i know, the only public info about them is rich chit chatting about them in a talk or two & here in irc a long time ago
20:19technomancyhttp://p.hagelb.org/mystery.gif
20:20kristofhiredman: A pod would be a tool for encapsulation. You shove in a value, and you have your transient inside, and you have procs (with type of proc: transient -> transient) and then something would cook inside and bam! A value comes out.
20:20hiredmankristof: sure, I was at the keynote
20:21kristofThe point of separating policy would be to implement transients in a way that's not really possible right now, at least I think. Something to do with thread numbers or whatever.
20:21hiredmankristof: I ask because if your answer is hand wavey, then my answer to "what is going on with them?" would be "why do you care?"
20:21kristofAnyway, I don't know much about it, so I was just wondering what was going on with it at the moment since the web yields very little results.
20:22hiredmanthe answer is: nothing, they are sort of abstract concept you can draw on to design things, but no one has done a general reusable implemenation
20:23kristofhiredman: Alright! Thank you for explaining.
20:24Foxboronhttp://hastebin.com/jomotosupi.lisp
20:24Foxboroni can't seem to figure out why this wont work
20:30aaelonyseeing something realy strange via lein deps: "Exception in thread "FileRepositoryConnector-1" …" https://www.refheap.com/17371
20:31shokyFoxboron: what's add? and then?
20:32Foxboronshoky: other functions. But i wrote the code again from scratch and it works
20:33RaynesHoly shit aaelony
20:33RaynesYou're pulling bytes from the twilight zone.
20:34aaelonyaaelony: is that all?
20:34RaynesDear God, now you're talking to yourself. Get this man some help!
20:34aaelonytranslation?
20:35aaelonysilence of the raynes?
20:36Raynesaaelony: I was making pointless jokes that apparently didn't quite hit home.
20:36aaelonyraynes: ah, but I welcome attempts at humor
20:44justin_smithsinistersnare: maybe something like this https://www.refheap.com/17372
20:44justin_smiththat doesn't do anything interesting, but it is the general idea
20:48sinistersnareok, the dispose function is called at the destruction of the application
20:48sinistersnarewhere is reset! coming from?
20:48justin_smithreset! is a function on atoms
20:48sinistersnareoh
20:48justin_smithhttp://clojure.org/cheatsheet
20:50justin_smithI learned much of what I know about clojure by following links on that cheatsheet
20:51sinistersnareyeah, ive seen it; but i dont think im experienced enough with programming in general to understand half enough of it
20:51sinistersnarewhat are the point of atoms?
20:51sinistersnaretheyre mutable?
20:53justin_smithhttp://clojure.org/atoms
20:54justin_smithit holds an immutable value, but you can use it to manage state
20:54sinistersnareoh sorry, i was looking at this: and it wasnt helpful :p http://clojuredocs.org/clojure_core/clojure.core/atom
20:54justin_smithyeah
20:54justin_smiththe cheatsheet is not perfect
20:59dnolenI made a ClojureScript Ejecta XCode project template, write native iOS games with Lisp & CSP today https://github.com/swannodette/Ejecta
20:59dnolencheers
21:00bbloomneat
21:00sinistersnarednolen: i suppose you mean clojurescript, not necessarily Lisp?
21:00bbloomsurely garbage collection will murder your perf and battery life
21:00bbloombut hey, fuck javascript!
21:00bbloom:-)
21:01sinistersnarejustin_smith: thats so complicated D:
21:02justin_smithmaybe overengineered (thinking like I am writing a library not an app)
21:02justin_smithyou could just have run start by doing (reset! resource (get-resource)) and and by calling (cleanup @resource)
21:02justin_smithand handle the creation and disposal in get-resource and cleanup
21:04sinistersnareok i need to think more and harder
21:05justin_smithhttps://www.refheap.com/17372/edit simplified
21:06sinistersnareok let me try and implement it
21:06sinistersnaremay take a few minutes due to brain exhaustion
21:08callentechnomancy: https://github.com/mxcl/homebrew/pull/21733 please speak up.
21:08callendnolen: you too ^^
21:08sinistersnareim so glad i have a friend on facebook i can talk to and do some good rubber duck debugging, because now it makes more sense. https://en.wikipedia.org/wiki/Rubber_duck_debugging
21:09Raynescallen: Dude doesn't know when to quit.
21:09callenRaynes: at all.
21:09sinistersnarebut my question is: why do you use an atom? i understand, its like a wrapper around an immutable object, but im not sure what its use particularly is. maybe ill reread the article on it on clojure.org
21:10sinistersnareok
21:10sinistersnareso for every thing i need to do (.dispose nativeObject) i need an atom for?
21:10danielszmulewiczdnolen: Hi, do you have a comment regarding whether or not the quick start guide for clojurescript should be made available as a homebrew formula? Ther's a discussion going on here: https://github.com/mxcl/homebrew/pull/21733
21:11callendanielszmulewicz: I already asked him to comment.
21:12danielszmulewiczcallen: good
21:12sinistersnarejustin_smith: ^
21:12callendanielszmulewicz: I think you'll find the sentiment here is against continuing to enable pathologically broken installations.
21:12callendanielszmulewicz: which confuse new users and mislead them as to how to use Clojure.
21:13danielszmulewiczcallen: clojure should be removed. I agree with that.
21:13justin_smithsinistersnare: the reason is because you should not do resource allocation at code reading time
21:13callendanielszmulewicz: then please say so in that thread. that wasn't clear from the comment.
21:13justin_smithso a top level def is not a good idea
21:13danielszmulewiczI did
21:13danielszmulewiczI edited
21:13justin_smithan atom allows setting that up when you start the app running
21:13justin_smith*direct top level def
21:13justin_smithof course the atom is a def
21:13sinistersnareso its like how in java you declare methods, and instantiate them in the constructor?
21:14sinistersnare(im a java guy...)
21:14justin_smithits like creating an array at compile time, and putting something in it at run time
21:14sinistersnareok cool
21:15sinistersnareso i need an atom for every resource?
21:15justin_smithyou could use one to store them all if you get them all at once
21:15justin_smithlike I was showing you before with the hashmap literal
21:15justin_smith{:font (BitMapFont.) :sprites (Sprite.)} or whatever
21:16justin_smiththen you can get the things out and dispose them later
21:16sinistersnareok great
21:16sinistersnarethat sounds good
21:16sinistersnare:D
21:19danielszmulewiczcallen: regarding last comment, please enlighten me. I have a directory with a single clojure source file, no project.clj. How do I compile it to js with lein alone?
21:21RaynesI'm not actually sure what callen meant there either, though I think it's a non-issue.
21:21RaynesIt would be trivial to add another subtask to lein-cljsbuild to invoke the compiler in a one off situation like you describe.
21:21RaynesAnd if it doesn't already exist somebody should add it.
21:22calleninstead of enabling broke-as-hell use patterns.
21:22RaynesAfter that, it's a trivial matter of adding lein-cljsbuild to your :user profile and wah-lah.
21:22danielszmulewiczPlease stay on topic
21:22danielszmulewiczI'm not talking about easing in new users into clojurescript
21:23callendanielszmulewicz: then you've seriously misapprehended what Homebrew cares about.
21:23callenit's not a dumping ground for experienced users' convenience.
21:23RaynesI don't think I wandered off topic. Did you direct that at callen?
21:23callenRaynes: I don't think I was off-topic either.
21:23danielszmulewiczWell, I'll be happy to hear that from homebrew folks
21:23callendanielszmulewicz: read the thread, lol.
21:24callenthey care about users, especially ones operating with less than an abundance of information.
21:24RaynesI mean, I'm leaving the thread alone. I'm obviously not enough of a big shot ClojureScript guy to have an opinion on the matter, so *shrug*.
21:24callenI think that's rational, myself, and I'm trying to help them accomplish that with the benefit of some domain expertise.
21:24RaynesI know when I'm beat. :)
21:24danielszmulewiczHomebrew doesn't discriminate between users. It's a package manager for christ sake, not udemy
21:24justin_smithsinistersnare: hey, I think this is actually the best way to do it given the code you have: https://gist.github.com/noisesmith/6180538 (I forked your gist)
21:24callendanielszmulewicz: you always gotta pick your priorities/primary use-case.
21:24callenpackage managers are definitionally not for experts.
21:25callenexperts don't need package managers to build things from source.
21:25callendanielszmulewicz: you must've missed the boat on that one.
21:25callenwell now you know.
21:25callenhomebrew is principally about ease of use on the Mac.
21:25justin_smithsinistersnare: with what I posed, screen gets its resources automatically, then you just need to call its dispose when you are done with the screen
21:26callenbecause macports and Fink were *awful*.
21:26RaynesHere's what I see: "Hmm, I want to play with <insert ClojureScript library here>! brew install clojurescript. Wait… Wtf… Now what? Better go to #clojure and bitch for 30 minutes while I refuse to install leiningen because this exists and obviously must be The Right Way, and then I need to write a blog post about how bad Clojure is and how terrible the community is."
21:26sinistersnarejustin_smith: it just dawned on me that that works, because the let form works for all of the Screen
21:26Raynesdanielszmulewicz: ^
21:26RaynesThat's my opinion, plain and simple, and I'll leave it at that.
21:27sinistersnareWOOOHOOOO GIANT ERROR!
21:28justin_smithsinistersnare: congratulations?
21:28sinistersnarei dont think its with that code though
21:28sinistersnaredamn :(
21:28danielszmulewiczRaynes: This is why we display caveats, and I propose to rename the formula to clojurescript-compiler
21:28sinistersnareit says theres something wrong at (5:22) of this https://www.refheap.com/17373 which seems to bee the (clojure.gdx.MyGame.) call
21:29callendanielszmulewicz: won't change anything, they'll brew search clojurescript
21:29callenthey'll still think it's authoritative despite the caveats.
21:32sinistersnarei think it has a problem with generating the class, is there something wrong with this file? https://www.refheap.com/17374
21:33fowlslegs Hello!
21:34fowlslegs(#(assoc %1 %2 0) {} [:a :b :c]) ;=> {[:a :b :c] 0}
21:34justin_smithsinistersnare: I have no experience with gen-class, maybe someone else here can help
21:34fowlslegsbut
21:34justin_smithsinistersnare: but I would suggest trying to create an instance of the class in the repl
21:34sinistersnareok, it worked before; im not sure what ive done D:
21:34sinistersnareok
21:34justin_smithnarrow down your usage, find the simplest thing that makes an error happen
21:34fowlslegs([:a :b :c] {[:a :b :c] 0}) ;=> IllegalArgumentException Key must be integer clojure.lang.APersistentVector.invoke (APersistentVector.java:265)
21:35justin_smithfowlslegs: that is trying to call the vector
21:35justin_smithwhat you want is to call the map
21:35justin_smithreverse the args
21:35fowlslegsIsn't it a vector of keys that all point to the same keyval?
21:35FoxboronFirst clojure lib shipped, woop :3
21:35justin_smithvectors only take number as args
21:35justin_smith,([:a :b :c] 1)
21:36clojurebot:b
21:36metellusfowlslegs: the vector itself is the key in the map
21:36justin_smithfowlslegs: map lookup does not work that way
21:36fowlslegsOkay metellus that makes sense.
21:37justin_smith,({[:a :b :c] 0} [:a :b :c])
21:37clojurebot0
21:37justin_smith[:a :b :c] is not a list of keys, it is the key
21:37fowlslegsThen how do I make Clojure recognize that I am talking about the key [:a :b :c] and not the vector [:a :b :c]?
21:37metellusand in your original (#(assoc %1 %2 0) {} [:a :b :c]), %1 is the vector [:a :b :c] and %2 is nothing
21:37justin_smithwhat I showed above
21:37fowlslegsOh thanks justin
21:37justin_smithor you could explicitly use get
21:38fowlslegsYes you could
21:38fowlslegsDanke everyone
21:59TakeVIs there any case when a precondition for a function under {:pre [(test? x)]} doesn't work?
22:02gtrakTakeV: does this answer your question? https://gist.github.com/gtrak/6180725
22:05TakeVgtrak: Not really. The problem is that my preconditions were working, and then for no apparently reason my unit tests just started failing. They weren't getting the exception thrown to them in the cases I set up to fail the preconditions.
22:06gtrakhmm, it's an AssertionError, firstly, not an Exception
22:07TakeVgtrak: My apologies.
22:07gtrakso maybe your tests are catching the wrong thing
22:07gtrak?
22:08TakeVgtrak: No, I'm catching an AssertionError. Let me paste the code.
22:09TakeVgtrak: http://pastebin.com/jGTFWreE
22:11bbloomambrosebs: i might actually use core.typed if there was a lein plugin to check a directory of type annotations just like i normally run unit tests
22:11gtrakI get the assertion error
22:11bbloomlein test => lein unit + lein type
22:11gtrakoh wait, I'm getting another exception first
22:12ambrosebsbbloom: is (is (check-ns 'my-ns)) too hard? ;)
22:13bbloomambrosebs: yes, i want type "discovery" just like how lein searches for tests :-)
22:13ambrosebsbbloom: fair enough. Sounds boring to write though :)
22:14TakeVgtrak: Yeah, for some reason I feel like it's skipping the preconditions.
22:14gtrakit's running them, but they're both returning true
22:14bbloomambrosebs: surely somebody around here enjoys that sort of stuff
22:14gtrakI can see it with the dbg macro
22:14bbloomambrosebs: but the boring stuff is what drives adoption. ask technomancy
22:14clojurebotRoger.
22:15gtrakoh wait..
22:15ambrosebsbbloom: I'll make a discover-typed-namespaces function and then hopefully someone will plug it in.
22:16bbloomambrosebs: heh :-) i just want to have a type/ directory next to my src/ and test/ directories
22:16gtrakdoh :-)
22:16ambrosebsbbloom: ah.
22:17gtrakTakeV: flip the order of the docstring and precondition :-)
22:17gtrakthat'll teach you to use docstrings
22:17ambrosebsbbloom: you could just add it to the classpath no?
22:19TakeVgtrak: Oh man, that is a silly error. Thanks for the help. :)
22:19gtrakno probs
22:19TakeV(Also the official docs need to be updated, because they say to use doc strings first... >_>)
22:19bbloomambrosebs: i realize that this is totally doable and relatively straightforward. but realize i often don't bother writing unit tests either. this is a plea for brain dead nice-to-haves that guide behavior. sometimes i copy paste my bottom-of-file tests into real unit tests when i release projects. if the lein project template had a type/ directory, i might put a type hint or two in there and run the type checker
22:20bbloomambrosebs: even better if i got 90% of the checking done via inference
22:21ambrosebsbbloom: sounds pretty optimistic :). core.typed needs a lot of handholding. You can put the annotations where you like though.
22:22bbloomambrosebs: if i keep asking for impossible things, maybe some of them will become real :-)
22:22ambrosebsbbloom: true!
22:24ambrosebsbbloom: core.typed may never be satisfying enough for someone of your ... patience
22:25ambrosebs:)
22:25bbloomambrosebs: many adjectives have been used to describe me. patient was never one of them.
22:25ambrosebsbbloom: haha
22:25bbloomdammit future. hurry up and get here!
22:27ambrosebsbbloom: I hope someone gets so pissed off with core.typed being so picky that they implement inference :)
22:27gtrakbbloom wants newer shinier things to complain about :-)
22:29ambrosebsbbloom: the unfortunately reality is you'd be putting a type annotation or 20 in type/
22:29bbloomambrosebs: is inference particularly hard for clojure?
22:30bbloomambrosebs: i'd imagine that if you only cared "oh, this is a map" rather than "this has keys :x and :y", then inference would be pretty standard, no?
22:32ambrosebsbbloom: yes. Your probably wishing for a slightly different tool to core.typed.
22:32ambrosebsbbloom: core.typed wants to be uncompromisingly precise.
22:32brehautin contrast to javascript which is compromisingly imprecise
22:33ambrosebsbbloom: tools like Dialyzer for Erlang look kind of like inference but only give errors when things *always* go wrong. core.typed fails on "maybes".
22:33bbloomambrosebs: playing devils advocate. isn't uncompromisingly precise equivalent to running the code? ;-)
22:34ambrosebsbbloom: I'll rephrase. I want it to be able to check interesting properties, so it needs to be unforgiving.
22:34bbloomambrosebs: ah ok
22:35ambrosebsbbloom: that also means annotations.
22:35bbloomambrosebs: i really want a few "levels" of type checking, just like i want a few levels of testing. i don't just have unit tests. sometimes i have integration tests or load tests or whatever
22:36ambrosebsbbloom: Yes, me too. It's a different tool though, core.typed can't have knobs like that.
22:36bbloomambrosebs: the compiler does some kinda low level type *safety* checking & then i want to get fully inferred type "correctness" checking & only then move on to proving more interesting properties, like program correctness :-)
22:36bbloomand, just as with testing, if i go after higher level tests like integration tests, i kinda have to assume the units are tested.
22:37bbloomif i get fully inferred types, that's basically akin to low test coverage :-)
22:41ambrosebsbbloom: when you say inference, are you assuming the types will be inaccurate at that point, compared to the program correctness checking?
22:41ambrosebsbbloom: because that sounds more feasible.
22:42bbloomambrosebs: in theory, some level of type checking could happen with ZERO annotations going off the primitives & some annotations from core and libs and stuff. that type checking is of low value, since the type inferencer is a constraint solver TRYING to succeed. but that doesn't mean that's not useful to prove that the code at least MIGHT make some sense from a types perspective
22:43bbloomambrosebs: but if i find a bug, i might add like ONE type annotation to prove my understanding of the bug & act as a regression protection. then suddenly the inferenced types are marginally more valuable
22:46ambrosebsbbloom: I'm in my own little world in fully annotated land, so I'm struggling to see how that would look.
22:46ambrosebsbbloom: I'm just seeing a sea of type errors and warnings
22:47ambrosebs:)
22:49bbloomambrosebs: on a purely "marketing" note. you're likely to get some more co-contributors if you can provide value to projects w/o them having to fully-annotate everything :-)
22:50sinistersnarehey guys, im getting an EOF while reading error, does anyone think they can help me with this code? https://gist.github.com/sinistersnare/44e3e50bcec04237c700
22:50ambrosebsbbloom: yes. that's the trick isn't it.
22:51sinistersnarecompiling:(cljdx/core.clj:7:1)
22:51sinistersnareis where it says it is
22:51brehautsinistersnare: you have an extra ) at the end of the ns form for drop?
22:51ambrosebsbbloom: the Typed Racket ancestry makes it difficult :)
22:51ambrosebsbbloom: blame samth
22:51sinistersnarewoohoo another error
22:52brehautsinistersnare: but you are missing one at the end of cljdx.core's ns
22:53sinistersnare=\ sometimes this IDE is weird, heres the error too https://gist.github.com/sinistersnare/44e3e50bcec04237c700
22:53sinistersnarein that
22:53brehautsinistersnare: unexpected EOF while reading in clojure typically means you've missed a closing paren
22:53sinistersnareoh that makes sense :D
22:53sinistersnarewoohoo another error!
22:53sinistersnare:p
22:53brehautsinistersnare: the error tells you the last form it started reading too
22:53brehaut"starting at line 1," of core.clj
22:54sinistersnareClassNotFoundException with drop, this is where i knew there was one, because i have no idea how to do classes in clojure
22:54brehautsinistersnare: gen-class is kinda weird and requires AOT compilation i believe
22:54sinistersnareim trying to build it
22:54sinistersnarewhen i hit the "build" button in the IDE, it gives me this
22:55brehautsinistersnare: i believe you need a gen-class property in the namespace, as well as something in the lein project
22:55sinistersnareoh ok
22:55sinistersnarei tried to find documentation, but i was having trouble
22:55brehautapparently so
22:56brehautits a dark corner of clojure
22:56sinistersnareyep
22:56sinistersnareim just trying to do a java framework interop :D
22:56brehautapparently
22:58zRecursive,(doc ->>)
22:58clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
22:58brehautsinistersnare: is com.badlogic.gdx.Game a class or interface?
22:58sinistersnareAbstract Class
22:58sinistersnareScreen is an interface
22:59sinistersnarebut you can see that with the proxy form i guess
23:00brehautsure. i think you can reify interfaces btw
23:02sinistersnarehow?
23:02clojurebotwith style and grace
23:02sinistersnareLOL
23:02brehaut~botsnack
23:02sinistersnaresometimes clojurebot brings some good points to the table
23:02clojurebotbotsnack is scoobysnack
23:02brehauthttp://clojure.github.io/clojure/clojure.core-api.html#clojure.core/reify
23:05brehautsinistersnare: http://clojure.org/compilation http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/ns http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/gen-class i think thats the relevant documentation
23:05sinistersnarejesus
23:06brehautnobody said it was friendly documentation
23:06sinistersnaretrue i guess
23:06brehautyou can skip the 'compile step with lein i think
23:06sinistersnareim using lein, but im still a little...idk
23:06brehautyou just need to put the relevant classes into :aot
23:06sinistersnarethis was supposed to be a short project :p
23:06brehautha
23:06sinistersnareoh really? that makes sense
23:06brehauterr 'class' i mean namespace
23:06sinistersnareDAMNIT
23:07sinistersnarejava.io.FileNotFoundException D: this is some error filled code
23:07brehautyou have cljdx.core, and you want cljdx.drop i believe
23:08sinistersnarein :aot i have cljdx.drop now
23:08sinistersnarethat got rid of the ClassNotFoundException
23:09sinistersnarenow its the FileNotFound, cant find myscreen.clj on classpath
23:09brehautand you've shifted your get-class to the ns form?
23:09brehaut(and keywordized it?)
23:09sinistersnareyes, ill update the gist
23:10sinistersnarehttps://gist.github.com/sinistersnare/44e3e50bcec04237c700 tjjis should work
23:10sinistersnarethis* what did i type
23:11brehautsinistersnare: you need to move all the specifics from your (get-class up into the (:gen-class )
23:11zenoliHmm...where did ceil and its ilk from the old clojure.contrib.math end up? Do I really have to use java.lang.Math/ceil?
23:13sinistersnareok, but i still get the filenotfound
23:13sinistersnarebecause i think that has something to do with it not seeing myscreen.clj on the classpath
23:14brehauti have no idea sorry
23:14brehauti played with gen-class about 4 years ago, and havent needed or wanted to since
23:14sinistersnareits ok
23:14sinistersnarei understand!
23:15zRecursive,(+ 9.575 0.005)
23:15clojurebot9.58
23:16sinistersnarethats some good math
23:16zRecursive,(printf "%.2f" 9.575)
23:16clojurebot9.58
23:17zRecursivegreat ! in C, it outputs 9.57
23:18zRecursivethen Clojure doesnot use IEEE 754 resentation for float ?
23:21zRecursive(format t "~$~%" 9.575) => 9.57 in Common Lisp
23:23futilewat
23:23johnmn3evening
23:23futilemorning
23:24zRecursivein fact 9.58 is what need :)
23:24johnmn3a long time ago, while learning clojurescript, I had a hard time working with the asynchrony while trying to get bytes from a file: https://www.refheap.com/12580/raw
23:24johnmn3wondering if the new core.async will allow me to get around that problem
23:24johnmn3and both set the callback and... call back in the same function
23:25brehautzRecursive: clojure uses's javas doubles for its floats which im pretty certain are IEEE doubles
23:26johnmn3correction... I'm not setting a callback in that example
23:27zRecursivebrehaut: even if using double, CL still returns 9.57: (format t "~$~%" 9.575d0) => 9.57 ...
23:27brehautwait, since when has string formatting being an internal representation?
23:27johnmn3using callbacks is what I had to resort to to get it to work... But I'd wished it would just work like I'd written it, as that is how my brain thought about it in clojure
23:32brehautzRecursive: http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax for all the specific details about formating strings
23:38zRecursivebrehaut: thx
23:51callenClojure is no longer in Homebrew.
23:51sinistersnareis that bad?
23:52callenno, it's good.
23:52callenpeople should be using Leiningen.
23:52sinistersnareis leiningen in homebrew?
23:52callenof course.
23:53bbloomseems like an alias from clojure -> leiningen would be nice
23:54callenbbloom: we decided against that.
23:54callenfor very good reasons.
23:54callenif you attempt to install clojure from homebrew, it will tell you to use Leiningen and why.
23:54bbloomoh, that counts as an alias in my book
23:55callensadly alias has a specific meaning in Homebrew-landia.
23:55TEttingersinistersnare! I was just using libGDX! kinda
23:55callenwhat we did was a removel + blacklist + documentation update.
23:55sinistersnareTEttinger: with clojure? how?
23:55sinistersnarei have it ok working, but idk
23:55sinistersnareactually i dont...
23:55TEttingerno, actually I just got it as a maven dep
23:56TEttingerbecause libgdx was a dep of a java lib I needed
23:56TEttingersinistersnare, if your problem was with leiningen and libgdx, I think I could help
23:57TEttingerotherwise, probably not
23:57sinistersnarei got the building workin
23:57TEttingerI only needed the non-GDX parts of "SquidLib"
23:58sinistersnarenow i just need to get my knowledge of clojure working!
23:59sinistersnareinstead of using a local repo, this is my project.clj, it uses libgdx.badlogicgames.com maven repo
23:59coventryHow can I determine where value-types is defined in <https://github.com/pedestal/pedestal/blob/master/app/src/io/pedestal/app/dataflow.clj&gt;? Any why does entering the io.pedestal.app.dataflow ns in the repl not give me a value-types function?
23:59sinistersnarehttps://www.refheap.com/17377