#clojure logs

2012-08-24

00:03jeremyheilerDoes (or has) anybody get "could not locate lein jacker [...] on classpath" when using lein-ring?
00:07cldwalkerhi, is there a recommended library for paginating html pages?
00:11technomancytake/drop would be great except for the fact that drop forces a bunch of work that gets thrown away
00:15technomancyif anyone's running lein from git, please update to the latest master; it will become preview9 if no issues are reported
00:24l1xhey guys
00:25l1xis there a good way to find all the elements in a lazy seq which are lets say smaller than 10?
00:25amalloy&(doc filter)
00:25lazybot⇒ "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
00:25l1xthx
00:32NotActuallyOnFirHello!
00:32NotActuallyOnFirI am apparently violating the irc naming convention length.
00:32NotActuallyOnFirI am apparently "NotActuallyOnFir" which is entertaining.
00:34NotActuallyOnFirI have a question, if anyone is alive. I'm trying to use the native-deps plugin, but leiningen doesn't feel like recognizing "native-deps" as a task.
00:34l1xamalloy: filter itself is not good for a lazy sequence because it is going to go through all the elements and those are infinite lets say in the fibonacci sequence, i found take-while which is good for this scenario, but thanks anyways
00:34amalloyyou asked for all of them, mate
00:34SgeoHey, is Light Table just a realization of old Smalltalk concepts?
00:35SgeoAs in, it's not sensible to look at code as plain text?
00:35casionSgeo: yes, no
00:35l1xamalloy: yeah my question was not clear :)
00:36NotActuallyOnFirAnyone? Native-deps? I've got my regular old deps, but my native-deps are being elusive.
00:38shaungilchristyou probably need older version of lein?
00:38SgeoWait. Light Table is going to be a commercial product?
00:38shaungilchristI jut ran into this w/ latest not supporting bootstrap as task so installed version that was up on port
00:39NotActuallyOnFir"up on port"?
00:39casionSgeo: that seems to be the plan
00:39Sgeo:(
00:40casionyou could use emacs or eclipse
00:41shaungilchristsorry NotActuallyOnFir I am using osx - port is a package manager.
00:41amalloypersonally i'm happy with emacs, but if light table turns out to be a better product, only a fool would begrudge spending $50 on a tool that improves something you spend like a hundred hours a month with
00:41amalloy(here wildly assuming $50 is the price point; substitute whatever number is right)
00:42casionI agree with amalloy
00:42friopretty much
00:42SgeoThe kickstarter says it will be open source and licenses are for packaged distributions
00:42shaungilchristI imagine there will be a free version for individuals and then a "team" version - but that is pure speculation
00:42casionI've been using emacs for non-lisp things for a good while, and I love it… but light table shows fantastic promise
00:42amalloylast i heard the platform was free and plugins or packages or something were going to be for sale
00:42casionI would gladly switch over when the time comes
00:43casionI've paid thousands for IDEs in the past
00:43casion$50 would be pretty tame IME
00:44l1xlooks nice
00:44wmealing_how does that work ?
00:44wmealing_"licenses are for packaged distributions"
00:44wmealing_so, if you download it, its open source
00:44wmealing_and if your a distro, you have a different license ?
00:45shaungilchristbut if you work for mega-corp that actually prefers to pay people for license keys so they can put them on their internal wiki..
00:47SgeoIs it possible to rename a namespace?
00:47NotActuallyOnFirOK, so if native-deps is borked in the new version of leiningen, is there any functionality in leiningen that handles native libraries, or am I back to manually extracting files and setting my library.path manually?
00:48SgeoAnd unrelatedly to that question, but relatedly to the Light Table stuff, how does Light Table deal with side-effecting functions?
00:54muhoowas just looking at a jsfiddle, and realized lighttable is kind of likd clojurefiddle
00:54muhooand himera is like cljsfiddle
01:17Raynesmuhoo: What drugs do you use?
01:17muhooheh
01:19RaynesSo I don't get any?
01:20RaynesYou're either a great friend or no friend at all.
01:21muhoodude, i actually had to fire up intellij and mess with a bunch of java
01:21muhooso maybe that's the drug. you don't want any, trust me.
01:22muhooandroid + clojure = nil
01:22RaynesI use TextEdit for Java.
01:22muhoo:-0
01:23RaynesAnd I compile to bytecodes by hand.
01:23muhooi was using emacs for java, and the fail was too strong.
01:23RaynesIf you're going to use a primitive language, might as well do it primitively.
01:23muhooassembler in edlin!!
01:25muhoosadly the nifty html5 stuff i was going to do in cljs, doesn't work on the ancient android 1.6 donut browser i'm delivering on.
01:34SgeoIf I read refs outside of a transaction, might I see an inconsistent view of the world?
01:35francisHello all, just want to make sure that I'm approaching this problem correctly. I've got to http post an xml document to a remote server. Currently, I'm just using clj-http.client and it throws back a 200 with an xml response as the body. I want to be sending it a body that is a (valid) xml string right?
01:39francishttp://paste.lisp.org/display/131181
01:42jeremyheilerfancis, if you want to send xml with the POST, then you'll probably have to use :form-params or :multipart
01:43jeremyheilermabye?
01:45jeremyheilernvm. perhaps you could set the content type for xml?
01:46jeremyheilerman, it's late. i should probably stop trying to think...
01:46francisand then just pass it a string? (EG: (def xml-doc "<xml>valid</xml>"))
01:46francisI'm actually getting a response back that it's well formed, but dosn't have the correct auth info
01:47jeremyheilerhow is it expecting you to authenticate?
01:47francispart of the xml doc I'm sending it
01:48francis<username>blah</username><password>sfuff</password>
01:48francisI append that to the top of my request
01:48jeremyheilerok
01:53francisThe specific error message I'm getting back is "<ErrorDescription>The XML document is well formed but the document is not valid</ErrorDescription>"
01:53franciswith some other tags and whatnot
01:53francisI feel like it might just be throwing that in general though
01:53franciswait, duh
01:53francisjust try as json
01:54francisyeah, damn - gives the same error back
01:54jeremyheilerare you sure just appending the auth xml at the beginning of the document is correct?
01:55francis"The Request message consists of two complete XML documents. The first document is an AccessRequest. It is immediately followed by (concatenated to) a Request. When a client application is undergoing testing and integration, the document combination should be sent to the URL: https://wwwcie.stuff.com/ups.app/xml/Request&quot;
01:56francisThe doc definately has me thinking so
02:12clj_newb_2385async- is kind of long to type; is there a satdnard convention to denote that this clojurescript function is asynchronous?
02:13SgeoWhy does the implementation of doto use gensym directly instead of an autogensym#
02:13clj_newb_2385emezeske: are you a key contributor to clojurescript?
02:14amalloySgeo: try rewriting it with an auto and see
02:15SgeoI .. don't think I understand how auto works well enough
02:16amalloySgeo: short answer, then: auto-gensyms are only "consistent" within a single syntax-quoted form
02:16amalloy&[`(x#) `(x#)]
02:16lazybot⇒ [(x__50520__auto__) (x__50521__auto__)]
02:17amalloyand you can't write doto with gensyms without using the binding's name in at least two different quoted forms
02:17clj_newb_2385&`[(x#) (x#)]
02:17lazybot⇒ [(x__50529__auto__) (x__50529__auto__)]
02:17Sgeohmm. I'd imagine this limits their utility quite a bit
02:17clj_newb_2385so why not "lift" the ` ?
02:17amalloynot really
02:17amalloyclj_newb_2385: try rewriting it and see
02:17clj_newb_2385in fact, maybe this is because I'm bad at writing macros; but I always only have one `
02:17emezeskeclj_newb_2385: I've contributed a couple minor patches
02:18SgeoActually, I imagine there's a different way to write doto.... don't know if that gets rid of the auto though
02:18clj_newb_2385oh gah ... doto ... the java interop
02:18clj_newb_2385no thanks, I like my sanity
02:18SgeoConceptually, it's sort of like a comp of functions, who why not rewrite it into that?
02:18amalloydoto has nothing to do with java interop
02:18amalloythat's just one useful application
02:19emezeskeclj_newb_2385: Oh, I didn't see the word "key" in your question. I am definitely not a key contributor.
02:19clj_newb_2385Sgeo: stealing from haskell?
02:19Sgeoclj_newb_2385, yes. I am a fan of Haskell.
02:20clj_newb_2385emezeske: ah. for some reason, when I do "lein search clojurescript", [emezeske/clojurescript ... ] has 4 entires
02:20SgeoThe nice thing would be that using such would mean no particular argument position has special significance if you use lambdas
02:20clj_newb_2385Sgeo: port over haskell's type system
02:20clj_newb_2385the only thing I feel clojure lacks ... is an ability to detect errors before runtime
02:20Sgeoclj_newb_2385, I'm not that insane (or that smart)
02:21emezeskeclj_newb_2385: At one time I maintained a few clojurescript packages, before the upstream folks were releasing them regularly
02:21SgeoBut yes, I like static typing
02:22Sgeo"do" is officially on my list of concepts, along with "yield" and "functor", that has utterly unpredictable meaning from language to language
02:22Sgeos/concepts/words/
02:22clj_newb_2385also "return"
02:22clj_newb_2385>> also means different things in haskell
02:23Sgeoclj_newb_2385, well, I think "return" is only an outlier in Haskell
02:23Sgeodo is a general purpose looping mechanism in Common Lisp, and a grouping construct in Clojure
02:23Sgeoyield means one thing in C# and Python and a different thing in Ruby
02:24SgeoAnd functor.... I don't think there are even two languages that use the same meaning.
02:27SgeoWhy doesn't Clojure have a macroexpand that macroexpands subforms?
02:27SgeoIs there any reason to omit that?
02:28tomojit's in tools.macro
02:28SgeoAh
02:28tomojreason not to have it in core? dunno
02:28shaungilchristwow I am pretty impressed by the clojurescriptone dom testing stuff. This may be a nice way to sneak some clojure into my 9-5
02:28SgeoWait, let is a macro?
02:29shaungilchristlet is usually syntactic sugar and or a macro for lambda immediately applied
02:31SgeoHmm, I guess if I want to use doto and use a nonstandard position, I could write something like
02:31tomojlet* is the special form, let adds destructuring
02:32Sgeo&(doto 5 (#(- 6 %)) (+ 3))
02:32lazybot⇒ 5
02:32SgeoAlthough is that too ugly, hmm
02:33SgeoWait, what.
02:33akhudekSgeo: are you thinking of -> ?
02:33akhudeknot sure if -> works with lambdas
02:33Sgeoakhudek, I guess seeing that doto didn't mean interop made me think that doto would.. be not necessarily a thing for mutable thingies
02:34amalloy&(doto (atom 5) (swap! inc)) ;; *shrug*
02:34lazybot⇒ #<Atom@d4c046: 6>
02:35Sgeo&(-> 5 (#(- 6 %)) (+ 3))
02:35lazybot⇒ 4
02:35amalloyit is, but you can't have everything
02:35amalloy&(-> 5 (->> (- 6)) (+ 3)) also works
02:35lazybot⇒ 4
02:36Sgeo($ 5 (comp #(- 6 %) (partial 3))
02:36Sgeooops
02:36Sgeo($ 5 (comp #(- 6 %) (partial 3)))
02:36clojurebotwhat is cells
02:36Sgeo^^not that ugly I think?
02:39SgeoI guess I could concede varargs and have $ do an implicit comp
02:40Sgeo($ 5 #(- 6 %) #(/ % 3))
02:40SgeoAlso, ignore the $ and comp above, I'm a derp
02:40SgeoI should try things at a repl
02:41SgeoClojure is largely functional, why not use functions instead of macros when they fit (like here)
03:11Sgeo&(map #(% 2) [(partial + 1) (partial * 3)])
03:11lazybot⇒ (3 6)
03:25francisDoes anyone know of an article/resource that clearly explains http post? I'm not 'getting it' even though I can post data to servers and such
03:28tomojhttp://tools.ietf.org/html/rfc2616#section-9.5 ?
03:32francistomoj: Thats the sort of stuff I've been reading, thanks though
03:37tomojyou may get better results if you indicate better your confusion
03:40francisSorry, that was terribly ambigous my confusion is stemming from having to interface with another sever with POST. Seems easy enough, given clj-http.client. You just would make a request like so: (clj-http.client/post "https://someurl.com/something&quot; {:body "some data"})
03:40francisAnd then that server should just be like "Oh, tight - data, I'll send back a response"
03:40francisright?
03:40clojurebotflatten |is| rarely the right answer. What if your "base type" is a list
03:41tomojdid you already try setting the content type?
03:41francisyeah
03:41francisbut there is no documentation (that I can find) indicating what I can pass it
03:41francisshould everything be a string?
03:41francisthen they would have to parse each string
03:41francisand I keep running into URI encoding
03:41kralhola
03:42francisbut that, to me at least seems to be for get
03:42tomojwell, posts with content type application/x-www-form-urlencoded use urlencoding
03:43tomojand those are pretty common
03:43tsdhIs it possible to extend a protocol on a reification of another protocol? Basically, I'd like to extend a protocol to the CollReduce/CollFold reifications returned by the reducer fns.
03:44tomojfrancis: do you have an 'nc' command available?
03:44francisnc?
03:44clojurebotmultiple inheritance is http://www.piratejesus.com/nerdcore/nerdcore017.gif
03:44francisin emacs?
03:44tomojon the command line
03:44francisyeah
03:45tomojif so you can do e.g. `nc -l 8080`, then change the url in your post to localhost:8080/yada
03:45tomojto see exactly what you're sending over (.. maybe you already have accomplished this some other way?)
03:45tomojtsdh: no
03:46tsdhtomoj: Guessed that, but wasn't sure. Thanks.
03:46tomojwhich protocol, I'm curious? your own?
03:46tsdhtomoj: Yes, my own.
03:47francisI'm getting a connection refused, though I would need a server running for it to grab the post body right?
03:48tomojmaybe your nc is different than mine, for me `nc -l 8080` starts a server on port 8080
03:48francisnevermind, the connection terminated while it was sending
03:48francisanyway yeah - it reutrns a bunch of symbols and stuff
03:49tomoja bunch of symbols? you mean.. text?
03:49francisit shows up as text in my shell, but like so '€n
03:50francisfrom
03:50francis(client/post "https://localhost:8080&quot; {:body "some test text" :content-type :xml})
03:50francisI'm guessing I've got to decode it
03:50franciswait
03:50francisduh
03:52tomojhttps?
03:52clojureboteg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging
03:52tomojclojurebot: you're chatty today
03:52clojurebotwhat should I do today, it is the weekend and all
03:52francisno, encoding text as xml
03:52francisthough there is that too
03:53francisif that is what :content-type does
03:54tomojhttps://gist.github.com/c5fe830d0471f1afe50f
03:54tomojthat is what I see..
03:55francisI see the same thing when I remove the ssl encryption
03:55tomojand the body looks like you expect, your xml?
03:55francisyeah
03:56tomojyou might also try :content-type "text/xml" I guess
03:56tomojother than that HTTP can't help you.. the server must not like your body?
03:56francisokay
03:56francisthats what I was sort of hoping to hear
03:57tomojwhat status code is it returning?
03:57francis200, with an error message
03:57tomojlol
03:57francis(on actaual application)
03:57tomojHTTP really can't help you
03:57tomojbecause whoever wrote that application isn't really using it :)
03:58franciswait what?
03:58francis200 is a sucess code
03:58francisright?
03:58clojurebottechnomancy: you're right I should explain the reason. The reason is I would like to be able to call aether with an extra parameter for introducing my own :transfer-listener.
03:59tomojhttp://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1
03:59tomojclojurebot: botsmack
03:59clojurebotbotsmack is headdesk
04:00francisThat makes it sound to me as if it is being used
04:00francisI get back a response
04:00francisit gives an 'OK'
04:00tomojyeah they're using HTTP in some sense
04:00tomojby "really" I mean something like "correctly"..
04:01tomojyou should be getting an error code
04:01francisI am
04:01tomoj200 is not an error code
04:01tomojerror codes are at least 400
04:01francisno, the body that gets returned is an xml doc containg the error code
04:02tomojby "error code" I refer to the response status code number, like 200 ("OK") or 400 ("Bad request")
04:02tomojer, "error code" would be status code numbers >=400, specifically
04:03francisright, not found ect ect
04:03tomojpresumably this should be a 400, if it's your body that's the problem
04:04francismy impression is that it takes my request, says "hey, we parsed this, it didn't have the info we wanted, so we returned this XML with some info"
04:04francisI get that back
04:04tomojtoo bad they are not more specific..
04:05francisit tells me the xml doc is well formed, but
04:06francishold up
04:07augustlfor "settings" for a ring app, I'm considering adding a middleware that adds a :myapp-env to each request. Any other suggestions? :myapp-env will be a map containing the database to use, and some other config stuff.
04:07francis(:body (client/post "stuff")) returns a string of XML saying with error info and a description "the xml document is well formed but the document is not valid"
04:08francisstill though
04:08francisIf I know I can just pass it xml as a string, thats progress
04:08francisthanks
04:12tomojit's interesting that clj-http only has extensible output coercion, not input coercion
04:13francisYou'd only need that as a server though, and ring has something to do that (I would imagine)
04:13francisthat's my impression anyway
04:13francisif I'm way off base, please - correct me
04:15tomojI would like to do (http/post url {:body (protobuf Foo :foo 1) :content-type :x-protobuf})
04:15tomoj(on the client)
04:17_uliseshow can I add documentation to vars?
04:17francis{:^doc "string"} - if I'm not mistaken
04:18francis(def {:^doc "doc string here"} thing "whatever")
04:18tomoj(def ^{:doc "foo"} foo)
04:18tomoj(defn foo "foo" [])
04:18hyPiRion,(:doc (meta #'meta))
04:18clojurebot"Returns the metadata of obj, returns nil if there is no metadata."
04:19_ulisesthat did it
04:19_ulisesthanks!
04:20francistomoj: to me the client is the user - they wouldn't need input coercions, except for the response from the server
04:20francisand I think there is something to handle that
04:21francis:accept
04:22tomojby client I refer to the clojure instance calling clj-http.client/post
04:22tomojclj-http automatically does input coercion for json :form-params
04:23tomoje.g. (http/post url {:form-params {:foo "bar"} :content-type "json"})
04:23tomojit automatically json-encodes the form-params and uses that as the body
04:23tomojif it were extensible you could do similar magic for xml, protobuf, whatever
04:24francisare you just looking at source for this?
04:24francisI found almost no documentation
04:24SgeoWait, what's #' in Clojure?
04:24tomojyeah
04:24tomojthe docs mostly just show a bunch of examples
04:24SgeoIn Common Lisp it's (function) which is a form which, given a symbol representing a function, gives back the function
04:24SgeoBut Clojure is a Lisp-1
04:25tomoj&'#'foo
04:25lazybot⇒ (var foo)
04:25francisSgeo: what like this? #(stuff %)
04:25tomoj&(doc var)
04:25lazybot⇒ "Special: var; The symbol must resolve to a var, and the Var object\nitself (not its value) is returned. The reader macro #'x expands to (var x)."
04:25Sgeofrancis, no, what tomoj said
04:25augustliirc # is deprecated for some uses, like (defn #^ReturnTypeHere ...)
04:25francisoh, nifty
04:27gunsSgeo: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L100
04:27SgeoEvalReader?
04:28SgeoIs that like CL's #.
04:28gunsIt reads the next character after # and dispatches on that
04:28SgeoClojure> (bindings [*read-eval* true])
04:28Sgeojava.lang.SecurityException: You tripped the alarm! *read-eval* is bad!
04:29Sgeo(On TryClj)
04:30tomoj(read-string "#=(+ 1 2)")
04:32SgeoI thought the reader was supposedly side-effect free?
04:33tomojonly if *read-eval* is false
04:34tomojotherwise it will do whatever you tell it to do..
04:34tomoj#= is almost obsolete
04:35tomojthe new literal stuff can replace most uses of it, I think
04:35Sgeo"new" literal stuff?
04:35SgeoWhen was it used before?
04:37tomoj&(binding [*print-dup* true] (pr-str (struct (create-struct :foo) "foo")))
04:37lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
04:37tomojoh bollocks
04:41tomojexample here http://dev.clojure.org/jira/browse/CLJ-976
04:41tomojgoogle for 'extensible reader' or 'reader literals'
04:45tomojhttp://www.infoq.com/interviews/hickey-clojure-reader
05:23magopianthis frustration when you come up with what seems a nice solution to a 4clojure problem, but it fails miserably on longer sequences because of a timeout
05:24magopian(yeah, computing permutations on a 11-long sequence yields nearly 40millions possibilities... so what :)
05:25Sgeofor is just like Python generator expressions and Haskell list comprehensions, right?
05:26magopianSgeo: regarding python, yeah, i'm pretty sure that's the same
05:26broquaintAlong those lines, Sgeo.
05:26magopianSgeo: it's not the same as python's list comprehension i believe, as for in clojure is lazy
05:27Sgeomagopian, hence why I said "generator expression"
05:27Sgeo(Which are lazy)
05:27magopianyup );
05:28magopianwas just confirming ;)
05:29SgeoWhat's fn* ?
05:31Sgeofuture-cancel "Cancels the future, if possible."
05:31SgeoI think the Foundation should attempt to contain it as an SCP
05:34ro_stis there a version of flatten that doesn't recur?
05:34ro_stie, it only does one level down
05:34ro_sti have a seq of seqs of two-item vectors which i want to apply hash-map
05:35Bronsa(partial mapcat identity)
05:35Bronsa,(mapcat identity '[[a b [c d]] [e f]])
05:35clojurebot(a b [c d] e f)
05:36igstan,(+ 1 2)
05:36clojurebot3
05:36ro_stthanks Bronsa!
05:37Sgeomapcat is bind on sequences, isn't it? And identity is id. In Haskell, join = (>>= id)
05:37SgeoSo... that makes sense. I learn something new every day
05:53Sgeoloop/recur makes good sense for some use cases for TCO, but what if I want to represent state as being which function I'm in at the time?
05:53SgeoAs in, one function does some work, then calls another if x condition is met, etc.
05:54magopianSgeo: trampoline?
05:54magopiannot sure it'll fit your needs though
06:04tomojwould that macro not implement TCO?
06:06Raynestomoj: Good morning Mr. Sir.
06:07tomojmorning
06:08SgeoDoes Clojure have macrolet or symbol-macrolet?
06:09Raynes$cd macrolet
06:09Raynes$kill
06:09lazybotKILL IT WITH FIRE!
06:09Rayneslazybot no work
06:09SgeoHmm https://github.com/clojure/tools.macro/
06:09RaynesIt doesn't have it built in, but there is an implementation.
06:10Raynes$clojuredocs macrolet
06:10Raynes$login
06:10lazybotYou've been logged in.
06:10Raynes$loaded
06:10RaynesI give up.
06:10RaynesDon't know how to use my own bot.
06:11cemerickwe all knew they'd go rogue eventually
06:12SgeoWhat is the ^{:dynamic true} stuff about?
06:20Sgeodoall is sequence_
06:20SgeoOh, or is it sequence, and dorun is sequence_
06:20ejacksoncemerick: if they ever get control of hiredman's Clojure Rover, we're doomed.
06:21cemerickSgeo: ^:dynamic controls whether a var is dynamic or not
06:21cemerickSee http://clojure.org/vars
06:22SgeoAh, so binding can't just affect any var.... of course it shouldn't
06:22SgeoI guess I was thinking that the separation of binding/var fixed all issues, but... yeah
06:23clgvRaynes: lazybot seems to have a crysis since a while ;)
06:24clgv*crisis
06:25SgeoThere's no such thing as saving an image, is there?
06:25SgeoBecause I think I like images.
06:33ro_stargh. i thought i could (apply hash-map '(["1" "2"] ["3" "4"])) to get back {"1" "2" "3" "4"}
06:33ro_stbut i'm getting "No value supplied for key: ["1" "2"]"
06:34ro_stah i'm a doofus. apply hash-map works on a flat seq
06:39clgvSgeo: humm you can change the value of *compile-files* than you will have an image in your "classes" folder.
06:40igstan,(into {} '(["1" "2"] ["3" "4"]))
06:40clojurebot{"1" "2", "3" "4"}
06:40nbeloglazov$source clojure.string split
06:40lazybotSource not found.
06:40nbeloglazov$source clojure.string/split
06:40lazybotclojure.string/split is http://is.gd/GcEANF
06:40clgvclgv: but you would have to store uncompiled stuff.
06:41clgvouch
06:43Sgeo&(#(#(list %)) 5)
06:43lazybotjava.lang.IllegalStateException: Nested #()s are not allowed
06:45nbeloglazov$cd-search macrolet
06:45lazybotclojure.contrib.macro-utils/symbol-macrolet: http://clojuredocs.org/v/679; clojure.contrib.macro-utils/macrolet: http://clojuredocs.org/v/658
06:47nbeloglazovRaynes: I like `clojuredocs` more than `cd-search`. How about adding it to set of commands?
06:48nbeloglazovI think it's more intuitive
06:48clgv$help
06:48lazybotYou're going to need to tell me what you want help with.
06:49clgv$help plugin
06:49lazybotTopic: "plugin" doesn't exist!
06:49clgvhumm he needs a feature list ^^
06:49nbeloglazov$help source
06:49lazybotnbeloglazov: Link to the source code of a Clojure function or macro.
06:49clgv$list
06:49lazybotI know about these topics:
06:49nbeloglazov:)
06:49clgvhe knows nothing ^^
06:50wmealing_ignorance is bliss
06:50nbeloglazov$list something
06:50lazybotI know about these topics:
06:51Raynes$whatis source
06:51lazybotsource is http://github.com/flatland/lazybot
06:51nbeloglazov$help whatis
06:51lazybotnbeloglazov: Pass it a key, and it will tell you what is at the key in the database.
06:51Raynes$whatis Raynes
06:52lazybotRaynes does not exist in my database.
07:04nbeloglazov$rwhatis
07:04lazybotThe_Matrix is everywhere. It is all around us. Even now, in this very room. You can see it when you look out your window or when you turn on your television. You can feel it when you go to work... when you go to church... when you pay your taxes. It is the world that has been pulled over your eyes to blind you from the truth. That you are a slave, Neo. Like everyone else you were born into bondage. Born into a prison that you cannot
07:05cemericklazybot's really bought the farm now
07:06cemerickRaynes just needs to hook it up to rapgenius or something for the ultimate entertainment bot.
07:07clgv$debug
07:07lazybotclgv: It is not the case that you don't not unhave insufficient privileges to do this.
07:07clgvlol
07:10SgeoHmm. I think I really like condp
07:12nz-,(doc condp)
07:12clojurebot"([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, i...
07:29SgeoSuppose I have a function that takes a callback, and I want to write code in a more sequential manner. I note that via promises, I can make a promise, pass in a callback that will deliver on the promise, and then attempt to deref the promise. Is this a reasonable use of promises, or are there better solutions?
07:29Sgeo(Assuming I'm in a separate thread)
07:30clgvSgeo: can I have a drawn sketch? ;)
07:33clgvSgeo: read it 3 times and not yet completely sure what you want to do
07:34Sgeohttp://paste.lisp.org/display/131183
07:35SgeoPretend that i-take-a-callback has a good reason for taking a callback --- maybe it's taking an event handler that will only fire once (ok, not a good way to explain that)
07:36clgvSgeo: it looks pretty strange. could you describe what you really need?
07:37SgeoWant to use an event-based API as though it had functions that retrieved the "next" event that is, for example, a click.
07:38SgeoOh, hmm, my code doesn't quite work as I intended
07:40Sgeohttp://paste.lisp.org/display/131183#1
07:46clgvSgeo: so you want to wait for the first event?
07:47clgvSgeo: that's what your code would manage then - and it makes only sense if there is another thread triggering the event
07:47SgeoOn a related note, how easy/annoying is the JNI to work with?
07:47SgeoNote that I don't really know Java that well. It's the highly-functional lisp that attracts me to Clojure.
07:48Sgeo(And the libraries)
07:50clgvSgeo: never really used JNI myself. but I read one or two articles about it and it seemed more complicated than python's C interface
07:50SgeoOh fun.
07:52clgvtry it ^^
07:58Sgeo" The let special form is used here for efficiency in the event that the first parameter, number, is passed as an expression instead of a simple value."
07:58SgeoSuddenly, I don't trust this person to write macros.
08:03Sgeo...I think I've read this piece of drivel disguised as a popular guide to Clojure before.
08:11zoldarSgeo: do you mean that this around-zero macro is leaky?
08:13Sgeozoldar, I mean that I think it's insufficient to say that it's an "efficiency" issue. If the expression happens to be impure, running more than once can cause observable confusing behavior.
08:13clgv Sgeo: link?
08:13Sgeohttp://java.ociweb.com/mark/clojure/article.html
08:13zoldarSgeo: ah, right
08:14jrajavSgeo: What would you recommend?
08:16clgvSgeo: he doesnt read that bad though. maybe he slipped on that one ^^
08:16SgeoIf it's not going to elaborate on why it's necessary, might just say "efficiency and safety" and "a possibly impure expression"?
08:24SgeoUgh, how much Java stuff am I going to end up learning if I get into Clojure?
08:26clgvSgeo: depends on how much you will need java libs.
08:26SgeoThreads themselves afaict are created and started via Java classes and methods
08:26hyPiRionSgeo: Not much, java String is the only thing I work with.
08:26Sgeoclgv, even basic math and threading seems to call into the Java interop in a user-exposed way
08:27clgvSgeo: yeah that's a pity
08:27hyPiRionIf you're working heavily with threads, then you should learn them.
08:27stuartsierraYou rarely need to call Thread.new in Clojure: Futures and Agent send-off will create threads as needed.
08:28SgeoDo promises create threads, wait, that makes no sense
08:28clgvwhen the reducers lib is ready, there are even less cases where you have to create threads or threadpools yourself
08:28clgvSgeo: no
08:28clgvSgeo: then you need a future
08:37nz-is there somewhere introduction or something like that to reducers?
08:38vijaykirannz-: did you see rhickey's talk http://vimeo.com/45561411 ?
08:38nz-not yet
08:40vijaykiranthat with blog posts on clojure.com should give enough info to start and experiment with reducers I think
08:46SgeoI should try to port the TardisT monad transformer to Clojure
08:47SgeoAlthough that would require me to understand the Tardis monad, as well as monad transformers.
08:49stuartsierraI've never heard of the Tardis monad, but it has an awesome name.
08:50john2xhello
08:52mmitchellwould someone mind telling me what i'm doing wrong here? I'm attempting to create reduce-like function. I'd like this to be lazy, and so with large inputs, using something like (take 3 ...) would cause work to be done for only 3 items. Any tips? https://gist.github.com/3450179
08:53mmitchellthe time prints immediately, but the actual time to produce results seems way to long
08:54Sgeostuartsierra, http://hackage.haskell.org/packages/archive/tardis/0.3.0.0/doc/html/Control-Monad-Tardis.html
08:55clgvmmitchell: well thats not how lazy-seq works.
08:56mmitchellclgv: I'm reading through this now: http://clojure.org/lazy#Making%20Clojure%20Lazier--The%20current%20seq%20model
08:56clgvmmitchell: you can use `reductions` which is lazy
08:56mmitchellclgv: ok, i'll have a look
08:59SgeoThe chance of me understanding both it and the way monads work in Clojure is... probably not that high
09:07SgeoAre monads easier to learn for people who started in Haskell than people who started in Clojure?
09:08Sgeo"Rather, 'a' can be used in the following expressions to access the basic values contained inside the monadic value returned from '(f3 x)'."
09:08SgeoThat's... not quite accurate. Monads are not necessarily containers. But I don't know a better way to put that.
09:08Fossii suspect monads aren't "easier to learn" for anybody ;)
09:09chouserit's the state monad that's the brain-twister
09:13Chousuke_I don't find monads particularly difficult anymore. some implementations of them might not be obvious, but the concept itself is pretty straightforward
09:14nvysuppose I have some hash list X, which I want to process through a special function of mine, and pass it another process for more processing. But the first process may have some requirements of X, and I want to expose the fact that there is a wrong input to the user. When there is no bad input, then I want to process it with the second process, and if the requirements aren't met, I want to do the same thing, and so on..
09:15nvycan someone describe such a workflow? I'm too used to raising exceptions in the imperative world
09:16Chousuke_sounds like you want the Either monad or something similar :P
09:17Chousuke_you can use exceptions in clojure though, it's fine.
09:18nvyis there any reading that I could do relating to this perhaps? :)
09:19Chousuke_using exceptions is not a bad idea in a case like this I think, if I understand you correctly
09:20nvywell, in this specific application... I receive some XML as user input, and I want to verify that: 1) it is valid, 2) it is indeed Atom XML
09:20nvyand then do further processing on it
09:20Chousuke_Though it will be a good idea to separate the input checking and exception-throwing from the actual processing functions.
09:21nvywhat's CL Sgeo ?
09:22nvyCommon Lisp?
09:22SgeoYes
09:22Chousuke_conditions would be fun but it's not really possible on the JVM without sacrificing interop transparency
09:22nvyall these Lisps are so new to me. I started trying to get hang of emacs for the first time in my life
09:22stuartsierraIt's hard to implement conditions without manipulating the stack, which the JVM doesn't support.
09:25nvythese "conditions" remind me of coroutines, Sgeo, am I on the right track?
09:26SgeoMight be able to build conditions on coroutines, but don't need coroutines for conditions
09:26SgeoAfaict, it's possible to do it with dynamically scoped variables and first-class functions
09:28naegcan this list comp be made nicer or replaced? http://bpaste.net/show/6qLdugRuSEubf13MBttD/
09:30nvyok Sgeo, understood
09:30Sgeonvy, I was sorely disappointed when I actually understood why the condition system wouldn't let me trivially implement continuations
09:31nvynaeg: I believe that the if part can be replaced with (max x y), and you should have a look at :when keyword for the for. (but I'm a newbie)
09:33naegnvy: the if part actually has some other test in it and since I want to iterate over all x and y, :when is no option for me afaik
09:33SgeoDoes the monad library for Clojure have a way to define monad transformers?
09:34SgeoI might have more luck just transliterating TardisT into Clojure than trying to understand it as a monad.
09:34SgeoI suspect that it relies on laziness though
09:35achengSgeo: as a side note, stack traces when using monads will not be very useful
09:35SgeoStack traces in Clojure are actually useful sometimes?
09:35Sgeo</stereotyping>
09:36acheng"oh look, i'm in m-bind. and now i'm in m-result. and back in m-bind. ooh"
09:36chouser1Clojure stack traces contain a wealth of useful information, hidden under a huge pile of noise.
09:38achengre stacktraces: for my users' use case, i floss all references to certain packages and then expand it with the source of the fn's involved. very transparent for them
09:38Sgeo(def parser-m (state-t maybe-m))
09:38SgeoI take it monad transformers in Clojure-world are actually functions
09:38SgeoIs my head going to explode?
09:40achengSgeo: depends on how awesome your head is
09:40john2xI'm going through 4clojure at the moment, and I'm kind of stuck
09:41jimdueySgeo: all monad transformers are functions. They take a monad and return a monad.
09:41john2xhow do I get a sum of numbers in a list? like sum() in most langauges.. (+ (1 2 3)) doesn't work..
09:41wmealing_(+ listname)
09:41Sgeo,(apply + '(1 2 3)
09:41clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
09:41Sgeo,(apply + '(1 2 3))
09:41clojurebot6
09:41Sgeo,(+ '(1 2 3))
09:41clojurebot#<ClassCastException java.lang.ClassCastException: Cannot cast clojure.lang.PersistentList to java.lang.Number>
09:42jimdueySgeo: http://www.clojure.net/2012/03/05/Transformers/
09:42brainproxyinterested in rdf/rdfa, but clj-plaza and hiccup-rdfa look a bit stale... any thoughts?
09:42duck1123actually, for the case of +, I think reduce is better
09:42john2xah reduce it is. thanks!
09:42duck1123clj-plaza is good, I was updating it the other day
09:42nbeloglazov&(time (reduce + (range 1000000)))
09:42lazybot⇒ "Elapsed time: 383.682792 msecs" 499999500000
09:43nbeloglazov&(time (apply + (range 10000000)))
09:43lazybot⇒ "Elapsed time: 2043.416524 msecs" 49999995000000
09:43nbeloglazov&(time (reduce + (range 10000000)))
09:43lazybot⇒ "Elapsed time: 2013.09087 msecs" 49999995000000
09:43brainproxyjimduey: I saw you speak last year at StrangeLoop on monads... wasn't into clojure at the time, so it was a bit confusing, but I still have the notes I took from your presentation :)
09:43Sgeojimduey, in Haskell, they're not functions (well, I guess you can call them type-level functions)
09:44john2xhmm what's the difference between apply and reduce?
09:45nbeloglazovjohn2x: did you read doc for apply and reduce?
09:45jimdueybrainproxy: glad to see you came over to the good side. :)
09:45brainproxyduck1123: you have a fork?
09:46duck1123brainproxy: yes, check out my fork, it should be 1.3+ compatible
09:46duck1123I think it's net.kronkltd/plaza
09:46john2xapply applies the function to each item, and reduce applies the function to each item while passing the result to the next iteration?
09:47duck1123I yanked out a lot of stuff I didn't need, mind you. Intended to put it back as a separate library, but haven't yet
09:47Sgeoapply applies the function as though the list was expanded into the arguments
09:47arrdemjohn2x: take another look at apply, you described map.
09:47duck1123but it works pretty well for my needs. I was re-writing a bunch of stuff the other day, but I haven't pushed it yet
09:48nbeloglazov,(doc apply)
09:48clojurebot"([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."
09:49duck1123(reduce + [1 2 3 4]) => (+ (+ (+ 1 2) 3) 4), (apply + [1 2 3 4]) => (+ 1 2 3 4)
09:49brainproxyduck1123: cool... i will take a look, thanks for the tip :)
09:51SgeoMy mind just went numb
09:51SgeogetPast getFuture sendPast sendFuture use the tardis function in their definition. tardis uses all of thse.
09:53duck1123there's a tardis function?
09:54Sgeohttp://hackage.haskell.org/packages/archive/tardis/0.3.0.0/doc/html/src/Control-Monad-Tardis-Class.html
09:54SgeoI'm sure I once knew what the rec in that do is, but I forgot
09:58djcoinDoes the Clojure folks around here tends (or plan to) to use monads, lenses and other functional stuff ?
09:59jimdueydjcoin: some do. I like the way monads and arrows make code simpler. Many others are not impressed.
10:01jimdueySgeo: Tardis looks mind bending. Thanks.
10:01jimdueyAre you porting it to Clojure?
10:01Sgeojimduey, it's something I vaguely want to do, but I don't even understand it at this point.
10:02SgeoAnd don't know how well it would work in Clojure: As far as I know, it relies on laziness.
10:02jimdueySgeo: I was just thinking this morning that I needed to write another blog post about something monadic. Perhaps one on the reverse state monad and one on a tardis transformer.
10:03Sgeojimduey, cool
10:03jimdueyDo they have any practical use?
10:03Sgeojimduey, no idea
10:03jimduey:)
10:03SgeoI think there is some example of practical use somewhere
10:04Sgeohttps://github.com/DanBurton/tardis/blob/master/Control/Monad/Tardis/Example.hs
10:05jimdueySome light reading for this evening.
10:05SgeoLooking at all this DoRec stuff, I think domonad may be unsuitable syntactic sugar for the Tardis monad.
10:06SgeoAnd may need to be modified
10:07Sgeohttp://www.haskell.org/ghc/docs/6.12.3/html/users_guide/syntax-extns.html
10:07SgeoLook for "The recursive do-notation"
10:08djcoinjimduey: Sgeo : as you seems to be in functional stuff, may I ask the question of why did you choose clojure over scala, haskell and such ? (I'm making the choice to move to clojure in the weeks but if you can shed some light on your own choices :) - many thanks !)
10:09john2xwhat's clojure's And/Or operator?
10:10arrdemjohn2x: .... (and) (or)
10:10jeremyheiler&(doc and)
10:10lazybot⇒ "Macro ([] [x] [x & next]); Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true."
10:10john2xoh. lol. thanks
10:10SgeoI'm sort of only getting back into Clojure now. I think the things I want most are convenient and community-accepted macros (Template Haskell is a macro system for Haskell, but it's ugly and often frowned upon), and the plausibility of changing a program while it runs for development purposes.
10:11jimdueydjcoin: I came to Clojure first, then discovered the functional paradigm. There's so much to learn here, I haven't moved on to Haskell. Particularly with the typed clojure work Ambrose is doing.
10:11SgeoActually having a sizable community is nice too (Scala and Haskell do too, but it's why I'm choosing Clojure over, say, any Scheme or Racket)
10:12djcoinYeah Typed Clojure would be awesome (inspired from Racket it seems)
10:12djcoinThanks a lot for your inputs
10:15arrdemdjcoin: I learned CLISP and Scheme first, but struggled with them because I found that they were very self-contained communities and languages. The kind of place where you roll your own "like a man" instead of using a library. Then I found Clojure and between Clojars, Lein and the easy java interop all is well.
10:17djcoinarrdem: I come from python/javascript (i do RIA with GIS stuff), and i'm becoming tired of those languages. I don't know lisp-like much, what do you use those kind of language for ? AI (cliché ;) ) ?
10:19arrdemdjcoin: no, not AI... Clojure I have used for a lot already the others I learned just because I found the implimentation, notation, macros and functional approach mind-bending and worth learning.
10:21arrdemand yeah, I came from C++, C and Python before I drank the Lisp kool-aid
10:21naegdjcoin: I'm new to clojure too, but you can basically do everything. Web, database, drawing stuff, ... guess almost everything you could do with java. but it's ofc very suitable for AI, algorithmic problems, etc.
10:22SgeoI'm the sort of person who can never actually stick with a language
10:22naegknow that feel, bro
10:22naeghi scriptor
10:22scriptorhey naeg
10:23naegscriptor: I'm not sure whether it was you or piranha being interested in it - but I managed to transliterate the clojure conways game of life into python
10:23djcoinHuhu
10:24scriptornaeg: ah, nice, how was it?
10:24djcoinYeah i know that feel too - but I guess I may stop sometimes spending time looking at language and learn more in other fields
10:24naegscriptor: http://bpaste.net/show/2RM4RfewQbrCJr1Hnf6p/
10:24djcoinNot sure it makes sense :b or is incompatible of course
10:24naegscriptor: some guys in #python didn't really like what i was doing^^
10:24scriptorhehe
10:24scriptorfigures
10:25naeg?
10:25scriptorit's pretty unpythonic, I guess
10:25naegit is, yeah
10:25naegjust wanted to know how far you can push FP in python
10:26naegand it's almost 1:1 with the clojure solution
10:26scriptoris the clojure solution online somewhere?
10:26naegscriptor: I can paste mine, just a second. you could also help me with one problem I'm having there if you have time
10:27naegscriptor: http://bpaste.net/show/s5aUgEV54mHZ9CGx5ALo/
10:28naegscriptor: I tried to combine empty-board and populate into create-world, but I'm unsure about the list comp and the (vec)
10:28naegnot sure whether that is idiomatic in clojure or there is a better way to do it
10:28e_svedangexcuse me gentlemen, i'm trying to find information on how to access a gensym:ed symbol from an expression that i pass into a macro... is this possible?
10:33scriptornaeg: hmm, why do you need to call vec in create-world?
10:34bosiewhats the point of constantly?
10:34naegscriptor: because otherwhise all of it would would be a list. shouldn't I use vectors for this kind of things?
10:34scriptorbosie: when you need to pass something a function instead of a value
10:34bosiescriptor: ah
10:35bosiescriptor: completely missed "returns a function" and the importance of it
10:35scriptornaeg: true, it's better for contains
10:35Sgeobosie, identity can be useful too
10:35Sgeo,(doc identity)
10:35clojurebot"([x]); Returns its argument."
10:36bosiehm
10:36bosieSgeo: don't get it
10:36bosieSgeo: thats for when you need to pass in …. a number and get one back?
10:36bosieor sth
10:36SgeoAn example someone else showed earlier (of how to do this particular operation):
10:37Sgeo,(mapcat identity [[[1 2 3]] [[4 5 6]]])
10:37clojurebot([1 2 3] [4 5 6])
10:37scriptorit makes it convenient to filter out all falsy values from a collection as well
10:37scriptor,(filter identity [1 nil false])
10:37clojurebot(1)
10:38SgeoThat is, you're not often going to be doing (identity foo), but you might pass identity into something expecting a function
10:39bosieSgeo: trying to wrap my head around your example
10:39bosie(identity [[1]]) returns [[1]]
10:39Sgeomapcat takes a function and a sequence, and applies the function to each element, like map, then concatenates the result
10:40bosieright
10:40bosieso the two elements it works on are [[1 2 3]] and [[4 5 6]]
10:40bosieapplying identity on those yield the same resrult
10:40SgeoYes.
10:40bosieso concaneting should actually make no difference
10:40SgeoAnd then the cat part of mapcat ... hmm
10:40bosieright
10:41Sgeojimduey, feel like describing bind on lists today?
10:41bosieSgeo: true
10:41Sgeo,(concatenate [1 2 3] [4 5 6)
10:41clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
10:41bosieSgeo: the cat works on each element
10:41Sgeo,(concatenate [1 2 3] [4 5 6])
10:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: concatenate in this context, compiling:(NO_SOURCE_PATH:0)>
10:42bosiei get it
10:42scriptornaeg: what is living-cells, by the way? Specifically why is first called on it?
10:43bosiethx Sgeo
10:43naegscriptor: look at the glider and light-spaceship defintion below. first is called because & puts it into a list
10:44naegscriptor: it's a set with the coordinates of the cells which should be alive
10:44jimdueySgeo: http://www.clojure.net/2012/02/02/Monads-in-Clojure/ Look at the 'Binding' section
10:44Sgeojimduey, I meant explaining to bosie
10:44naegscriptor: you can try it out with (create-world 4 4 glider)
10:45jimduey:) Sorry. most of my brain is already at work.
10:45scriptornaeg: ah, right. Is there a reason for living-cells to come after the &?
10:45SgeoSince >>= is a flipped mapcat
10:45bosiejimduey: where do you work
10:45jimdueyLonocloud
10:45naegscriptor: because I wanted it to be optional. one could do (create-world 4 4) this way
10:45bosiejimduey: liking it?
10:45scriptorgot it, contains would always return false and it would be a blank board
10:46jimdueyLove it. Get to work with some of the smartest people I've met on some hard problems.
10:46bosieheh
10:46naegI'm not sure whether this is the right way to make it optional though
10:46bosiejimduey i guess they have a pride in excellency eh? not the usual 80/20 perspective ? ;)
10:47jimdueyMost definitely.
10:47SgeoAnother time that identity _would_ be useful, is if Clojureists generally used the Cont monad
10:47scriptornaeg: another alternative is using the multiple arity feature
10:47Sgeojimduey, since you're a monad person, is Cont implemented in some library?
10:48Sgeo(The continuations monad, in case you're not familiar with "Cont" because that's the Haskeller's name)
10:48naegscriptor: would you recommend to do so? never heard of it before
10:48jimdueySgeo: Yeah. Konrad's algo.monads has it. And my protocol-monads library does as well.
10:48jimdueyhttps://github.com/jduey/protocol-monads
10:48scriptornaeg: it's when a function can be defined using different arities, ie different implementations depending on the number of arguments
10:49SgeoProtocols make me feel icky
10:49bosiejimduey: what are you using at work?
10:49bosiejimduey: programming language
10:50SgeoIt's like a less general multimethod system
10:50naegscriptor: but clojure doesn't have these keyword arguments like python? e.g. def create_world(w, h, cells=()) and when you call it you either do create_world(4,4) or create_world(4,4,cells=[[0,1], [0,2]])
10:51scriptornaeg: doesn't use keyword args, one sec let me write up an example
10:52arrdemnaeg: the usual solution is to have Clojure generate a map from keywords and values at the end of your function's arguments
10:52jimdueybosie: We're 99.9% Clojure
10:52bosiejimduey: i envy you
10:52jimdueyI have to say it's pretty great.
10:52bosiedoes sound like it
10:52scriptornaeg: https://www.refheap.com/paste/4608
10:52naegarrdem: but when I'm having only one argument, I can directly use &, right?
10:53arrdemnaeg: thing (fn [a b c &{:keys [foo bar baz] :or {:foo 1 :bar 2 :baz 3} :as tail}]
10:53naegmap would be overkill in that case, imo
10:53scriptorjimduey: what's the other 0.1%?
10:53jimdueySgeo: I actually have come to like protocols. They allowed me to implement monads using only a single macro. Whereas Konrad had to use all kinds of macrology in algo.monads
10:54naegscriptor: would you change create-world to use this? it would be basically the same, just with only 2 args there would be no if
10:54jimdueyscriptor: A little java and clojurescript
10:54scriptornaeg: right, your current method is more concise, so I'd probably keep it the same
10:54naegbut I learnt something new, thanks
10:56scriptornaeg: also, for can take in multiple arguments, so you could create an empty x by y board like so https://www.refheap.com/paste/4610
10:56scriptors/multiple arguments/multiple bindings
10:57duck1123I usually find the rest-arg keyword maps to be more annoying then they are worth.
10:57duck1123whenever I do that, I find that I regret it and change it to take an actual map
10:58clgvduck1123: you could try [clojure.options "0.2.2"] for better syntax and documentation support for options
10:59naegscriptor: I tried to do so, but it didn't work
10:59naegyours seems not to work either
10:59naegit returns just a list of " " instead a list of lists of " "
10:59scriptorah, good catch
11:00naegi played around with multiple bindings for a few mins, then just decided to make a second for
11:01duck1123clgv: interesting. starred for later. The thing that usually makes me mad is when I already have the options in a map and have to figure out how to apply them
11:01Sgeojimduey, are the applicative and functor functions defined in monad libraries?
11:01clgvduck1123: I mostly needed it when having several layers of functions with keyword-arguments. you always dont know what option you can specify for the lower layers
11:02SgeoSince all monads should be applicatives and functors, it should be easy to write <$> and <*>
11:02SgeoAlthough I'd need to think about it a bit because of the whole not currying by default thing
11:03jimdueySgeo: nope
11:04Chousuke_many haskell techniques end up kind of cumbersome in Clojure
11:04Chousuke_in particular, point-free style is often pointless :P
11:05scriptorclojure's not a fan of indian food, clearly
11:05SgeoChousuke_, I think -> should be replaced with a function
11:06clgvSgeo: nooo! please dont! then you couldnt use it for java interop
11:07SgeoGah, I used to know the definitions of fmap and <*> for monads
11:07SgeoWait, fmap = liftM and <*> = ap, I think
11:07SgeoSo I can cheat
11:07Chousuke_Sgeo: yeah, it really can't be replaced with a function.
11:08Sgeo(-> 5 #(+ 3 %) #(* 2 %))
11:08Sgeo?
11:08dnolenSgeo: yuck
11:08SgeoI think being unable to specify which argument it goes in is uglier
11:09Chousuke_nah, that's just how it works
11:09Chousuke_in practice, -> and ->> are what you need the most.
11:09Chousuke_people have implemented their own "generic" versions but I don't think they're used much, really.
11:09duck1123you can even chain them together somewhat
11:10nvy(?doc ->)
11:13SgeoAnyways.... to write fmap in curried or uncurried form. That is the question.
11:17SgeoYeah, with variadic functions, would make most sense to ...
11:17SgeoNot worry too much about the mixing of fmap and <*> and just make a useful function?
11:20jkkramerI'm a java logging noob. I'm writing a library that creates and executes sql statements, which I'd like to log. However, I want to ensure that consumers of the lib can opt in or out of seeing these (trace-level) logs in a standard way. If I use tools.logging, what kind of config should I use to accomplish this?
11:21jkkramer(any suggested reading on the topic is welcome, too)
11:25duck1123if you're writing a library, other than tools.logging, you should keep the choice of logging backend out of it. Specify what you like for testing though
11:26duck1123I find that log4j works pretty well
11:27achengjava interop question: typing java.lang.Double/parseDouble at the repl fails with "unable to find static field" ... but using it at the repl works. why?
11:27achengby "using" i mean just calling it like (java.lang.Double/parseDouble "3.2")
11:27jkkramerduck1123: alright, so I just don't configure anything lib side? just use tools.logging macros? what if a consumer lib hasn't done any log configuration?
11:28djcoin( jimduey: https://github.com/jduey/fruit-exchange <= the link in the title of the project is broken)
11:29acheng,java.lang.Double/parseDouble
11:29clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: parseDouble in class java.lang.Double, compiling:(NO_SOURCE_PATH:0)>
11:29acheng,(java.lang.Double/parseDouble "3.14")
11:29clojurebot3.14
11:29jeremyheileracheng: Because Java methods cannot be referenced directly like that.
11:29achengjeremyheiler: so i can't include it in a call to comp ?
11:30acheng,(comp str java.lang.Double/parseDouble)
11:30clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: parseDouble in class java.lang.Double, compiling:(NO_SOURCE_PATH:0)>
11:30S11001001,#(Double/valueOf %) ; acheng
11:30clojurebot#<sandbox$eval103$fn__104 sandbox$eval103$fn__104@7e9bd781>
11:31dnolenjonasen: did you see ekeko?
11:31achengS11001001: thanks
11:31duck1123jkkramer: You'll probably want to pick a log backend for your test environment, so you could set up some sane filters based on that backend and your namespaces. Just don't clobber the root logger
11:32duck1123I had an issue for a while where Korma was setting all my logging to debug. It annoyed the hell out of me.
11:32jonasendnolen: I did. but I haven't had time to study it yet
11:34jkkramerduck1123: yeah that's what I'd like to avoid (writing a lib in a similar niche as korma). what's the proper way to "pick a log backend for a test environment" using project.clj / log config? I'm pretty clueless and not sure where to look for examples of best practice
11:35duck1123jkkramer: https://github.com/duck1123/ciste/blob/master/project.clj
11:35duck1123notice log4j is a dev dependency. users of this lib are free to choose whatever backend they like, but the tests will use lg4j
11:37duck1123of course, now that I look at this, I'm not sure if my log4j properties is the best it can be
11:37dnolenjonasen: seems very similar to scape but w/ core.logic instead.
11:37jkkramerduck1123: excellent thanks. so if someone uses your lib without choosing or configuring a logging backend, it won't blow up or anything?
11:38jonasendnolen: and somehow depends on Eclipse if I understood it correctly
11:38duck1123Good question. I think c.t.logging has a fallback to printing. I'll have to give that a try
11:38dnolenjonasen: only in that it is an Eclipse plugin.
11:39dnolenjonasen: Eclipse exposes the Java AST, they use core.logic to query over that.
11:39dnolenjonasen: these guys have been working on this problem for a long time w/ Smalltalk (SOUL), should be interesting to see where it goes.
11:39jonasendnolen: definitely!
11:40jkkramerduck1123: I just know it's pretty common for non-java-background clojure authors like me to be oblivious to logging concerns, so want to accommodate that
11:40jonasendnolen: I'll probably install Eclipse and try the demo this weekend
11:41dnolenjonasen: it got me thinking that core.logic AST query engine for JS (via Esprima or some such) would be kinda cool.
11:41duck1123jkkramer: I know how you feel. I'm just finally getting to the point that I feel confident that I know where my library is logging and why
11:42duck1123I still want to try out timbre, but haven't had the time
11:42jonasendnolen: I've been thinking about doing something with JS too. What's Esprima?
11:43dnolenjonasen: it parses JS and generates the AST as JSON, http://esprima.org
11:44jonasendnolen: Thanks for the link, I'll take a look
11:56mmitchell(defn map-count [coll f] (map (comp count last) (group-by f coll)))
11:56mmitchellis there a clojure.core way of doing this?
12:00S11001001,(doc frequencies)
12:00clojurebot"([coll]); Returns a map from distinct items in coll to the number of times they appear."
12:01S11001001; mmitchell
12:01scriptorhow often are transients used by regular clojure devs?
12:01mmitchellS11001001: awesome! thank youl
12:02kencauseyI'm having trouble running clojurescriptone (Debian 64bit, OpenJDK 7): http://paste.lisp.org/+2T85
12:02technomancyscriptor: I've never seen them used directly, just via into
12:02SgeoOh hey algo.monads has a m-lift
12:03SgeoIt seems to be a macro, I'm not sure how necessary that is.
12:04clj_newb-2840e is a javascript event callback. Why does clojurescript force me to type (.-keyCode e) instead of e.keyCode ? the lattter is so much more readable
12:06shaungilchristabstract the pain away
12:09duck1123has anyone ever taken a stab at allowing javascript object properties to be accessed via destructuring? Would that even be possible?
12:10SgeoYou know what would be funny? If by studying this Clojure code I actually ended up understanding Cont better than I did when trying to grasp it in Haskell
12:11duck1123(fn [{:properties [keyCode] :as e}] ...)
12:12duck1123it doesn't, but it would be
12:16nDuffclj_newb-2840: That's a hard question to answer without going into a lot of background. Are you familiar with language isomorphism as a concept?
12:39nDuffDoes partial preserve type hints?
12:45duck1123nDuff: I'm pretty sure it does
12:58Sgeo,(println "Hello")
12:58clojurebotHello
12:58Sgeo,(dosync (println "Hello"))
12:58clojurebotHello
12:58Sgeo!!!
12:58SgeoWhy does that work?
12:58Sgeo,(dosync (io! (println "Hello")))
12:58clojurebot#<IllegalStateException java.lang.IllegalStateException: I/O in transaction>
12:58shaungilchristhaha
12:59SgeoWhy isn't println defined with io! in its definition?
13:00duck1123that would be a lot of overhead when it's generally not needed
13:01antares_Sgeo: because you cannot add io! everywhere, that's why
13:01antares_Sgeo: specifically you cannot modify Java libraries doing I/O. So clojure.core/io! is for your own code.
13:02technomancySgeo: that would make it really annoying to add debugging calls too
13:03Chousuke_println isn't really a "dangerous" IO operation in most cases anyway.
13:33thorbjornDXdestructuring is so badass
13:33RavenThat it is.
13:34thorbjornDXI thought keyword arguments in python were cool, now they seem like more of a hinderance
13:34thorbjornDX(even though I can't write a damn thing in clojure so far, haha)
13:41RavenI really liked the way keword arguments are done in common lisp.
13:41antares_Monger 1.2 RC1 is released: https://github.com/michaelklishin/monger/blob/master/ChangeLog.md
13:47XPheriorWould it be unheard of to load all rows of a database, lazily, and use filters to get a result, as opposed to using Korma?
13:50nDuffXPherior: That'd be pretty awful, yes.
13:50XPheriornDuff: Why?
13:50nDuffXPherior: ...a RDBMS does a lot of work to be able to do indexing, query optimization, &c., and you're throwing that out of the window. In short, it'll be vastly, dramatically slower.
13:51XPheriornDuff: Yeah I suppose that makes sense. My idea was that I could package filters into functions. So rather than calling (where {:a b}) 5 or 6 times throughout a file, I could just have a referentially transparent function that's tested.
13:52nDuff...personally, by the way, I spent much too much time fighting korma, and have enjoyed my life much more since I switched to clojure.java.jdbc
13:52nz-,(doc reify)
13:52clojurebot"([& opts+specs]); reify is a macro with the following structure: (reify options* specs*) Currently there are no options. Each spec consists of the protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args+] body)* Methods should be supplied for all methods of the desired protocol(s) and interface(s). You can also define overrides for meth...
13:52nDuff(and rolled my own thin query-builder layer)
13:53XPheriornDuff: I see. Is it on Github?
13:53nDuffNo, and it's not really good enough for me to want to release it -- it's very much something that has exactly as much functionality as I need right this minute, and no more.
13:53XPheriorGot'cha.
13:54nDuffthat said, for all korma talks about being composeable, it's full of macros (which aren't, very much), has hardcoded assumptions making it hard to use DB-specific extensions, &c.
13:54XPheriorThe macro thing has bitten me a few times.
13:56TimMcnDuff: Aw c'mon, what's the harm? Just put it up on a pastebin. What's the worst that could happen? :-P
13:57TimMc(Besides, y'know, someone taking the code and inflicting it upon the world in the form of a hacked-together library.)
14:00nz-nDuff: have you tried clojureql?
14:01nDuffnz-: No, I haven't. Looks interesting.
14:03nz-nDuff: i looked briefly at both clojureql and korma and picked korma, and it was not easy start
14:14cemericktechnomancy: is there some talk somewhere about what's coming down the pike?
14:14technomancycemerick: just rumblings from IRC and the mailing list
14:15cemerickeh, must have missed it
14:16cemerickI'm tempted to just write my own. I don't much care about databases other than postgres, and the closer to jdbc I am (within reason) the better.
14:17cemerickAs it is, I already monkeypatch c.c.jdbc to make it return vectors from queries instead of maps *shrug*
14:17technomancycemerick: http://comments.gmane.org/gmane.comp.java.clojure.user/59832
14:17technomancyspecifically the suggestions from hiredman, which I hope are carried to fruition
14:17cemerickoh, right jsql, I remember now
14:19cemericktechnomancy: sounds like a massive undertaking
14:19technomancyperhaps. needs to happen though; c.j.jdbc is really awkward.
14:19jkkramerI have a working sql-as-data-structures lib; not ready for prime time though
14:19technomancyI hate how (sql/with-connection db/db [...]) is basically always on my clipboard when doing repl work.
14:19technomancyoh dang
14:20technomancyI'm an idiot
14:20technomancy(sql/with-connection db/db (clojure.main/repl))
14:20cemerickIt's not directly comparable, but the result would probably have similar scope as sqlalchemy, which is a beast
14:20technomancyjkkramer: have you looked at seancorfield's jsql and the mailing list thread above?
14:21cemericktechnomancy: or just alter-var-root and be done
14:21technomancyyeah, there's that too
14:21cemerick(You'll not be able to use clojure.main/repl from nrepl.el)
14:21cemericknDuff: Seems like a life's work, really :-)
14:22technomancycemerick: yeah, this is a remote dyno anyway; drawbridge hasn't been ported to nrepl.el either =\
14:22cemerickoh right, that thread is where I mentioned CTEs and such. Very, very handy for generating SQL from datalog-esque queries.
14:23jkkramertechnomancy: yeah. the goals for jsql and my lib (https://github.com/jkk/honeysql - WIP) are a little different. honeysql does purely sql -> string, no db management. Developing another lib as a layer on top which handles DB, relations, etc
14:23jkkramersql -> string + params, rather
14:23technomancyhrm
14:23jkkramersql data structure -> string + params
14:23cemericktechnomancy: you need deuce, pronto :-P
14:23technomancyjkkramer: oh, gotcha. I think that's what hiredman suggested jsql turn into.
14:23technomancyso that's very interesting to me
14:24technomancya low-level sql compiler that other libraries could target
14:25jkkramerthat's the goal of honeysql
14:25technomancyyou should probably sync up with seancorfield anyway, since that's what jsql *should* be =)
14:27jkkramerI'll do that. Planning a alpha-level release soon; would like to have something tangible to contribute rather than intensions
14:27unlinkHow do I get metadata on a function in a defn?
14:28unlinkSimilar to the effect of (def f (with-meta (fn [] ...) {:some "metadata"}))
14:34mybuddymichaelunlink: Are you talking about (defn ^{:foo "bar"} foo-bar (...
14:38shaungilchristis anyone actually using clojure-clr?
14:38nDuffshaungilchrist: The survey covers taht.
14:38nDufferr, that, even.
14:38shaungilchristsorry - survey?
14:38nDuffhttp://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
14:39shaungilchristop delivered
14:40shaungilchristthat does answer my question but not what I was hoping for haha.
14:42shawnlewisIs it possible to make a macro that expands like this: (or-pred :id [4 5 6]) -> (or {:id 4} {:id 5} {:id 6}). Note I don't want a fully-qualified "or" as this is being passed into another macro (korma)
14:43clj_newb_2840https://github.com/clojure/clojurescript/wiki/Exception-Handling <-- how does exception handling actually work in clojurescript? is it implemented?
14:43cemericknDuff: that's saved now :-)
14:43cemerick~survey
14:43clojurebotsurvey is http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/
14:44metellusget with the times, clojurebot
14:47shaungilchristis there anything that has surpassed enfocus wrt dom manipulation? It looks pretty rad
14:50shawnlewisfigured it out. you need to do: ~(symbol "or") to get an unqualified symbol within a backtick clause
14:50zerokarmaleft,`((symbol "or") ~(for [v [4 5 6]] '{:id v}))
14:50clojurebot((clojure.core/symbol "or") ({:id v} {:id v} {:id v}))
14:51shawnlewis,`(~(symbol "or") ~(for [v [4 5 6]] '{:id v}))
14:51clojurebot(or ({:id v} {:id v} {:id v}))
14:51zerokarmalefthrm
14:52shawnlewis,`(~(symbol "or") ~@(for [v [4 5 6]] '{:id v}))
14:52clojurebot(or {:id v} {:id v} {:id v})
14:52zerokarmaleftneed ~v
14:52shawnlewisya
14:53shawnlewis,`(~(symbol "or") ~@(for [v [4 5 6]] `{:id ~v}))
14:53clojurebot(or {:id 4} {:id 5} {:id 6})
14:53zerokarmaleft,`(~(symbol "or") ~(for [v [4 5 6]] `{:id ~v}))
14:53clojurebot(or ({:id 4} {:id 5} {:id 6}))
14:53shawnlewisthe tricky part is that ~(symbol "or")
14:53zerokarmaleftah splice also
14:57joly,`(~'or true false)
14:57clojurebot(or true false)
14:58jolyshawnlewis: ^
14:59TimMcclojurebot: survey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
14:59clojurebotIn Ordnung
14:59TimMcclojurebot: forget survey |is| http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/
14:59clojurebotI forgot that survey is http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/
15:02shawnlewisjoly: sweet
15:04hyPiRionHm.
15:06mrb_bkdnolen: thanks again man, great talk last night
15:06dnolenmrb_bk: np! was really tons of fun!
15:07mrb_bkdnolen: definitely! and i woke up remembering some embarrassing shit i did, which is always awesome!
15:07solussddoes anyone here remember the programming tutorial (for non-programmers) that was an online clojure interpreter that stepped the user through each programming concept page by page? it was only a few pages long…. can't for the life of me find it with google, but wanted to point someone at it. It was discussed on the mailing list a few months ago
15:07jeremyheilersolussd: ClojureScriptOne?
15:07technomancytryclj.com?
15:07dnolenmrb_bk: haha yes the mutual trolling portion of the evening was hilarious.
15:08mrb_bkdnolen: haha, yes
15:08solussdneither of those…
15:08mrb_bkglad i didn't give them my business card
15:11solussdthis was more step-by-step tutorial. something you could point a non-programmer at and they'd get it.
15:12solussdit doesn't even mention its clojure until a page or so in
15:12technomancysolussd: casting spels?
15:14solussdthat's not it either… this was very HTML5y
15:16technomancyndimiduk: hey, you'll be interested in this: https://github.com/technomancy/leiningen/pull/746/files
15:16technomancycourtesy of llasram
15:18ndimiduktechnomancy: slick!
15:18technomancyndimiduk: should be going out in a release later today
15:20solussdfound it! talkingtomachines.org
15:21technomancywow, that's pretty slick
15:22scriptordamn, can't believe I didn't see this before
15:22pjstadig,[(nth "foo" 1) (get "foo" 1)]
15:22RaynesPeople keep doing these cute little tutorials. I wonder if contributing something like it to tryclojure is something they actively think about and decide against. It's like people are allergic to it.
15:22clojurebot[\o \o]
15:22pjstadig,[(nth (StringBuilder. "foo") 1) (get (StringBuilder. "foo") 1)]
15:22clojurebot[\o nil]
15:22pjstadig:-/
15:22S11001001Raynes: following standards
15:22S11001001Raynes: fear of comparison?
15:23solussdraynes: I think this is more focused on the non-programmer, where tryclojure assumes some familiarity with programming
15:23scriptorpeople might want a different interface from a repl
15:24pjstadigRT.get explicitly checks for only String or arrays when indexing with an integer, then it calls RT.nth
15:24pjstadigRT.nth allows also for CharSequences
15:24pjstadigbut you can't index into a CharSequence using get and a number
15:28xeqidoes vim have a nrepl front end?
15:28technomancyxeqi: it's unfinished IIRC
15:28technomancyblocked on a haskell client implementation
15:29eggsbyhmm, how can I get the pomfile from lein pom to see my :main/-main method ?
15:30technomancyeggsby: where would you expect it to be?
15:32bosieis a function still poor if it reads from (def something somevalue) ?
15:33bosieor only if its defonce? or in neither of the two cases?
15:35emezeskebosie: s/poor/pure ?
15:35bosieemezeske: sorry, yes
15:35bosieemezeske: most of my functions are poor though ;)
15:35emezeske:)
15:36solussdbosie: it's pure as long as it doesn't change anything externally and always returns the same output for any given input
15:36RaynesI'm not sure it is pure though.
15:36RaynesYou can change the root values of vars.
15:37RaynesIf you never do that, you can certainly pretend its pure.
15:37RaynesBut it isn't actually pure.
15:37RaynesBut it doesn't matter at all.
15:37bosiesolussd: if i can change def and the output of the function depends on it in some way, it isn't giving the same result for the same parameter values
15:37bosieRaynes: how could i change it so?
15:38bosiethough
15:38solussdif it's using a def'd constant, then it is pure. :D e.g. def ^:const blah 3) (defn pure [x] (* blah x))
15:38Raynes^ this
15:38solussdbosie: but you don't "def" things at runtime, usually
15:39solussdi mean, it's like redefining gravity.
15:39Raynes(def x 3) (defn foo [y] (+ x y))
15:39bosiesolussd: maybe not on purpose… ;)
15:39solussdclojure lets you change the constants of nature, but you don't have to
15:39RaynesIf you call foo with 3, you get back six.
15:39RaynesIf you change x to 6 and call foo with 3, you get 9.
15:39RaynesDifferent results, same params, no change to the function, not pure.
15:40solussdyeah, but you had to change the meaning a def'd symbol
15:40bosieRaynes: my point. but wouldn't defonce prevent that?
15:41bosiehmm
15:43Raynesbosie: You can change the root of a var defined with defonce too.
15:44RaynesSo no.
15:44solussdunlike functions that create or consume the results of side-effects functions in clojure that use def'd symbols are pure, in the practical sense. I mean, you can change the root binding of a function too, but we consider (defn pure-func [x] (my-func 3 x)) to be pure, even though I could, technically change the root binding of my-func
15:45RaynesI don't consider it to be pure at all.
15:45RaynesBut I also don't care.
15:45RaynesBecause if you think about it, not much *is* pure, since you could alter the vars in clojure.core and change pretty much every function in Clojure.
15:46bosieRaynes: how come? coming from oop, i find testing/using pure functions to be a treat compared some state using function
15:46RaynesIt just doesn't matter.
15:46bosieok
15:46RaynesNobody is going to use alter-var-root to exploit the impurity of a function, and if they do they're either doing something extremely specific or very wrong.
15:47RaynesIt doesn't matter practically, like solussd said.
15:50cprice_is it considered bad form to use (binding [*ns* ...) ?
15:51pjstadig,(get "foo" 7/3)
15:51clojurebot\o
15:51zerokarmaleftpjstadig: heh
15:51pjstadigaccepts any instance of Number and calls intValue on it
15:52pjstadig,(get "foo" 1.3333333)
15:52clojurebot\o
15:52antares_cprice_: not necessarily but maybe libraries like tools.namespace or bultitude can do what you need?
15:52cprice_antares_: thanks, not familiar with those, will check them out
15:52pjstadig,(get (vec "foo") 1.3333333)
15:52clojurebotnil
15:53pjstadiginteresting little corners of clojure here
15:53Raynescprice_: Not really. I guess it depends on what you're using it for.
15:53cprice_i want to (load) a file that defines some functions. the file does not specify a namespace, but I want to control what namespace the functions get defined in.
15:54zerokarmaleft,(get "foo" Double/NaN)
15:54clojurebot\f
15:54zerokarmalefthaha
15:54antares_cprice_: then it's ok but look at those libraries first
15:54metellus,(= 0 Double/NaN)
15:54clojurebotfalse
15:55metellusphew
15:56pjstadig,(= 0 (int Double/NaN))
15:56clojurebottrue
15:56cprice_i'm looking at them. nothing in there is immediately jumping out at me. thanks for the pointer though, good to know about them!
15:56metellusI'm not sure how I feel about that.
15:58dnolen,(int Double/NaN)
15:58clojurebot0
15:58dnolen,(int Double/POSITIVE_INFINITY)
15:58clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: Infinity>
15:58metellus,(int nil)
15:58clojurebot#<NullPointerException java.lang.NullPointerException>
15:58dnolen,(int Double/NEGATIVE_INFINITY)
15:58clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: -Infinity>
15:59pjstadig(.intValue Double/POSITIVE_INFINITY)
15:59pjstadig,(.intValue Double/POSITIVE_INFINITY)
15:59clojurebot2147483647
16:01hyPiRion,(.longValue Double/POSITIVE_INFINITY)
16:01clojurebot9223372036854775807
16:01metellus,(inc (.longValue Double/POSITIVE_INFINITY))
16:01clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
16:02pjstadig,(unchecked-inc (.longValue Double/POSITIVE_INFINITY))
16:02clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
16:04hyPiRion,(unckeched-inc (.longValue Double/POSITIVE_INFINITY))
16:04clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: unckeched-inc in this context, compiling:(NO_SOURCE_PATH:0)>
16:04hyPiRion,(unchecked-inc (.longValue Double/POSITIVE_INFINITY))
16:04clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
16:04hyPiRionhm
16:05pjstadigah
16:05pjstadigyes, i've seen this before
16:06pjstadig,(unchecked-inc (long (.longValue Double/POSITIVE_INFINITY)))
16:06clojurebot-9223372036854775808
16:06pjstadigbecause of the way the argument flows through the Java code in Clojure it's allowed to overflow
16:06pjstadiger, i mean throw an overflow exception
16:06zerokarmaleft,(int Double/POSITIVE_INFINITY)
16:06clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: Infinity>
16:07zerokarmaleft,(int (inc Double/POSITIVE_INFINITY))
16:07clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: Infinity>
16:07pjstadigwhich i guess is technically correct according to the doc string since you're supposed to pass a primitive long
16:07zerokarmaleft,(.intValue (inc Double/POSITIVE_INFINITY))
16:07clojurebot2147483647
16:07pjstadighowever it is interesting that .longValue isn't inferred as primitive long
16:07pjstadig,(unchecked-inc ^long (.longValue Double/POSITIVE_INFINITY))
16:07clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: long, compiling:(NO_SOURCE_PATH:0)>
16:08hyPiRionOh, I think I get why.
16:08pjstadig,(doc unchecked-inc)
16:08clojurebot"([x]); Returns a number one greater than x, a long. Note - uses a primitive operator subject to overflow."
16:08hyPiRion,(class (long 1))
16:08clojurebotjava.lang.Long
16:08hyPiRion,(class (.longValue 1.0))
16:08clojurebotjava.lang.Long
16:09pjstadigthat's because the primitive long is getting boxed as a Long
16:09pjstadigbut unchecked-inc should be able to take a primitive long argument without boxing
16:09hyPiRionoh well.
16:09meliponehello
16:09pjstadigbut because the compiler cannot infer that it boxes it which sends it through the version of unchecked-inc that takes a Number
16:10pjstadigwhich will throw an exception
16:12meliponeI have a lein project with some java code. I get this message at the lein repl prompt "Compiling 1 source file to /somepath/class 1.5 1 warnes warning: [options] bootstrap class path not set in conjunction with -source 1.5 " Any ideas?
16:12meliponeoops, the message got mangled. Should be:
16:13meliponeCompiling 1 source file to /somepath/classes warning: [options] bootstrap class path not set in conjunction with -source 1.5
16:14achengmelipone! on your previous question about deserialization, the issue you had was what i meant by version mismatch. it was the version of your type
16:14dnolen,(do (set! *warn-on-reflection* true) (.intValue Double/POSITIVE_INFINITY))
16:14clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set>
16:14dnolenin anycase (.intValue Double/POSITIVE_INFINITY) triggers reflection
16:15dnolen.intValue is a method, but Double/POSITIVE_INFINITY is a primitive. reflection is required return type not known.
16:15pjstadig,(unchecked-inc (.longValue Double/POSITIVE_INFINITY))
16:15clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
16:15meliponeacheng: are you referring about my current question about boostrap class path?
16:15pjstadig,(unchecked-inc (.longValue ^Double Double/POSITIVE_INFINITY))
16:15clojurebot-9223372036854775808
16:16mmitchellis there a clojure.core way to get the *ordered* difference between one collection and another?
16:16dnolenpjstadig: yep
16:16achengmelipone: no :) it's about your question from many days ago
16:16pjstadigdnolen: so that's why the compiler is not able to infer that .longValue returns a primitive long...interesting
16:17hyPiRion,(binding [*warn-on-reflection* true] (.intValue Double/POSITIVE_INFINITY))
16:17clojurebot2147483647
16:17hyPiRion*shrugs*
16:17meliponeacheng: oh, hello! yes, I did solve that somehow
16:19meliponeacheng: yes, it was some version mismatch
16:24meliponehow about my current question on lein compilation of java?
16:26achengmelipone: sorry. i don't know about that.
16:31achengmelipone: is there a #leiningen channel?
16:32jeremyheileracheng: yes
16:35meliponeokay, i'll ask there
16:36meliponejoin #leininghen
16:36meliponejoin /leininghen
16:36acheng /join
16:36acheng leiningen
16:36meliponegrrrrr.... thanks
16:36nDuff/join #leiningen (rather)
16:36achengha!
16:36achengsigh
16:40TimMc/say /commands without running them
16:40astoddardcan anyone help me troubleshoot a native dependency issue with leiningen2 ?
16:42technomancyastoddard: probably not, but it doesn't hurt to try
16:43xeqiouch, but true
16:49bosieis there a function with which i could apply two functions onto a list containing hashes? e.g. [{:blah "blah"},{:blah "blah2"}] and i want the value of :blah from the second entry
16:49hyPiRionfrom a list or a vector?
16:50hyPiRion,(get-in [{:blah "blah"} {:blah "blah2"}] [1 :blah])
16:50clojurebot"blah2"
16:50gnarmisnice
16:51bosieneat
16:52bosiethough i was really asking because i am wondering if there is a way to apply two functions on a value
16:53hyPiRionbosie: You can use comp to compose functions, if that's what you're asking for.
16:55bosiehyPiRion: hmm
16:55nz-,(apply merge {} '({:blah "blah"},{:blah "blah2"}))
16:55clojurebot{:blah "blah2"}
16:56bosiehyPiRion: i guess in combination with partial
16:56S11001001,(conj {:a :b :d :q} {:a :c :b :d})
16:56clojurebot{:b :d, :a :c, :d :q}
16:57hyPiRion,((comp :blah nth) [{:blah "blah"} {:blah "blah2"}] 1)
16:57clojurebot"blah2"
16:57bosiehyPiRion: yes but preloading nth with 1
16:58hyPiRionYeah, then you'd have to fire off some anonymous functions
16:58bosiehyPiRion: wouldn't a partial not work?
16:58bosietrying it
16:59hyPiRionbosie: partial is an anonymous function ;)
16:59bosieah ok
16:59hyPiRionBut yeah, it really depends
17:00hyPiRionnth can't be partialed with a position, as the order of the functions aren't in the correct way
17:00hyPiRion/s/functions/arguments
17:00bosieye
17:00bosiefeature request.
17:00bosie;)
17:01technomancythat'll go over well
17:01hyPiRiontechnomancy: not happy enough with #() ?
17:03S11001001,(do (defn flip [f a b & args] (apply f b a args)) ((partial flip (comp :blah nth) 1) [{:blah "blah"} {:blah "blah2"}]))
17:03clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
17:03S11001001mmm
17:03scriptortechnomancy: could write an apply-reverse function that just does apply on a reverse() of the args
17:04scriptorhttps://www.refheap.com/paste/4621
17:04amalloytechnomancy: you don't want rpartial, you want partial+flip
17:04amalloy(partial (flip nth) 2), for example
17:04technomancyamalloy: sounds like a breakdance move
17:04technomancythat'd be sweet
17:04amalloythe breakdance move, or flip?
17:05technomancypartial+flip
17:05amalloyrather: flip as a breakdance move, or as a function in core?
17:05nz-,(doc flip)
17:05clojurebotCool story bro.
17:05technomancyI don't actually know anything about breakdancing, so I can't take the joke further.
17:05technomancymy apologies.
17:05amalloyanyway, i wrote a library for flip-related functions a while ago
17:05amalloyprobably a little bit overengineered, but entertaining
17:06amalloyhttps://github.com/amalloy/hot-potato
17:07technomancycools
17:08scriptordoesn't look very overengineered
17:08technomancyvery clever.
17:08technomancyfar too clever, of course. but clever.
17:08amalloythat may have been the first unhygenic macro i wrote on purpose
17:09dnolen~guards
17:09clojurebotSEIZE HIM!
17:09technomancy~gourds
17:09clojurebotSQUEEZE HIM!
17:10amalloy(inc technomancy)
17:10lazybot⇒ 37
17:10technomancybrazenly stole that from #emacs
17:11technomancywell, both of those actually
17:11amalloynot sure whether to inc or dec you for stealing from #emacs
17:11Raynes(inc technomancy)
17:11lazybot⇒ 38
17:13technomancyin #emacs, karma is determined by rand-int
17:13hyPiRion,(list (rand-nth '[inc dec]) 'technomancy)
17:13clojurebot(dec technomancy)
17:13lazybot⇒ 37
17:15hyPiRionWell..
17:15arrdem(inc technomancy)
17:15lazybot⇒ 38
17:15arrdemsince when is ~gourds a thing...
17:16technomancyit's useful for when, um... you need someone squeezed.
17:25arrdem,(defn rkarma [nic] (list (rand-nth '[inc dec]) nic))
17:25clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
17:25arrdemfooie.
17:26nDuffHmm.
17:26nDuffIt'd be a fun project to rewrite clojurebot to run code that the JVM sandbox denies inside a short-lived VM sandbox
17:27arrdemthat would be interesting... I suppose I'd have to patch the bot to add (rkarma) anyway.
17:28RaynesThat's also the wrong bot.
17:28nDuffqemu/kvm makes setting up sandboxes of that variety very much trivial, and as long as the initial state can sit in the block cache, setting them up can be very, very fast (evalbot and sbot in #bash work that way in entirety)
17:29arrdemRaynes: so which is the right one?
17:29Rayneslazybot does karma stuff.
17:29nDuff...would want to have serial connectivity only to the outside world (no direct networking) to prevent it from being used for anything malicious...
17:29RaynesAlso, I'm working on a project with a friend that uses selinux to sandbox various languages and allow you to evaluate code over an API.
17:29arrdemRaynes: yeah but if clojurebot says it lazybot'll pick it up
17:31arrdemasside from trusting #clojure users to not abuse the bot, is there a way to 'deny' access like that?
17:37arrdem(long nDuff)
17:38brainproxyanyone willing to give me some feedback on a macro? the ideas is to wrap a func's "post args" forms in some forms that setup database context
17:38brainproxybut I want to support multi-arity dispatch in addition to the simple case
17:38amalloy~anyone
17:38clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
17:39brainproxyhttps://gist.github.com/3455905
17:40brainproxythat works fine, but I think maybe it could be further refined, or maybe that is the best way to do it
17:40brainproxynot sure
17:40unlinkmybuddymichael: no, I want the metadata on the function, not the var.
17:41amalloyjust throw away the first clause, and convert (fn [x] x) to (fn ([x] x)) before you call the second clause
17:41brainproxyamalloy: oh derp, yeah, that's perfect :D
17:43arrdemamalloy: can you explain the second version? my intuition is that it's equivalent to (eval (list (first x) x))
17:43arrdemwell... no ditch the (eval)
17:46nDuffarrdem: Hmm? The JVM security model is pretty good, but I still prefer the read-only VM approach. If you're discarding all your state when finished, and have a hard limit on execution time, and don't have any networking... there's not much trust involved.
17:52brainproxyamalloy: sweet, that works well.. revised ver https://gist.github.com/3455905
17:52pandeirois there currently a way in cljs to do type-based dispatch for things like js/HTMLElement vs js/HTMLDivElement vs js/Object?
17:53arrdempandeiro: multimethods are your friend
17:53pandeiroarrdem: ok not protocols
17:54pandeiroi guess it's not possible for cljs to ascertain the hierarchy HTMLElement => HTMLDivElement ?
17:54pandeirofor example
17:54dnolenpandeiro: we don't currently traverse the prototype chain.
17:54arrdempandeiro: I claim no knowlege of CLJS
17:55dnolenpandeiro: some more work would need to be done to support that.
17:55pandeirodnolen: you forgot 'patches welcome'
17:55dnolenpandeiro: ;)
17:55pandeiroor maybe you already realized that was beyond me
17:55pandeiro:)
17:55pandeirothanks for the info
17:55arrdemdnolen: you don't have (supers)?
17:56dnolenarrdem: supers does not exist, no.
18:02dnolenpandeiro: hmm, now that I think about it seems weird that if you extend-type js/Element that it doesn't automatically work for HTMLDivElement since we do extend the Element prototype ...
18:02dnolenpandeiro: it's not working for you right?
18:04pandeirodnolen: i tested it the other day and no
18:05pandeiroi was trying to implement a basic protocol that dispatched on HTMLElement and passed in an HTMLDivElement
18:07dnolenpandeiro: did you check that they are actually in a prototype chain?
18:09pandeirodnolen i remember discovering it through the chromium console, yes
18:09pandeiroi could not get to that information through the repl though
18:09pandeiroi think I was using __proto__ in the console
18:09pandeiroand at the repl all i could get out of using __proto__ was [Object object]
18:10dnolenpandeiro: yeah __proto__ isn't really part of the standard, tho widely supported.
18:11pandeirodnolen: np not a feature request, just making sure i wasnt missing something
18:12dnolenpandeiro: definitely something to look into. Speaking of which, there'll eventually be a lot of work to do if ES6 gets classes ...
18:16pandeirodnolen: unrelated, when i try to lisp-eval-region a (ns ... ) & forms that haven't been compiled yet at the browser REPL, the REPL becomes unresponsive. known bug?
18:17dnolenpandeiro: no idea
18:18dnolenpandeiro: REPL becomes unresponsive if there's an uncaught error is the only thing I've seen like that.
18:18pandeiroyeah actually the browser is suddenly unable to POST to :9000 when it happens
18:19dnolenpandeiro: and refreshing the browser doesn't help?
18:19pandeirodidn't try that
18:20pandeirodnolen: ...and can no longer reproduce
18:20pandeiroweirdness
18:21pandeirolast question i promise: clj : clojure.lang.ILookup = cljs : ILookup ?
18:21pandeiroprotocols not namespaced?
18:21eggsbyis there a way to make some assignment impossible to re-assign?
18:22eggsbyi.e. protected from re-def at some later point..
18:22pandeiroeggsby: defonce
18:22dnolenpandeiro: they are namespaced, but clojure.core is used
18:22dnolenpandeiro: in Clojure those aren't protocols they are interfaces.
18:22eggsbydefonce allows dynamic redef tho right pandeiro ?
18:22pandeironot sure eggsby
18:22eggsbyi.e. (defonce something 1) (def something 2) ;; something is 2
18:23eggsbyit's just that defonce will not redef if it already has been def'd, not that it protects from future def
18:23pandeirodnolen: so I can do (deftype Schwa [a b] ILookup ...) ?
18:23dnolenpandeiro: yes
18:27Raynesibdknox: ping
18:28Frozenlockpong!
18:41pandeiroprotocols are a terrible match for methods with variable arities yes?
18:44dnolenpandeiro: works for different arities - but a problem if you need rest arg.
18:44pandeiroah right of course
19:00steffi_shello, i am trying some java midi stuff and get this error:
19:00steffi_sException in thread "main" java.lang.IllegalArgumentException: Can't call public method of non-public class: public javax.sound.midi.MidiChannel[] com.sun.media.sound.AbstractPlayer.getChannels(), compiling:(core.clj:7)
19:01steffi_sany ideas?
19:01steffi_sit works on a linux machine, but this error happens on mac
19:02staincom.sun sounds like do-not-touch
19:03arrdemstain: agreed. everything breaks when you try to use it on openjdk (gee I wonder why...)
19:05stainthe interface method is javax.sound.midi.Synthesizer.getChannels()
19:05stainso perhaps you have to.. uh.. cast it
19:05stainnot very clojure like!
19:07steffi_sthis is where it comes from: (def synth (MidiSystem/getSynthesizer))
19:10stainodd, that's typed as Synthesizer in http://javasourcecode.org/html/open-source/jdk/jdk-6u23/javax/sound/midi/MidiSystem.java.html
19:24muhooi have a bunch of libraries i use in the repl, added to my profiles.clj :user profile. i'm now building a project that needs to be aot compiled. and lein is trying to aot compile all my :user dependencies . i can force them not to load by adding them to :aot-exclude-ns, but that's a LOT of ns'es
19:25muhoooh, btw, this is for android, and :aot :all-with-unused is necessary
19:28xeqiI wonder if you could add them to the :repl profile instaed
19:31muhooi didn't know there was one! will try that, thanks
19:32muhoo(inc lein-droid)
19:32lazybot⇒ 1
19:41stainuser=> (defn channels [^Synthesizer s] (.getChannels s))
19:41stain#'user/channels
19:41stainuser=> (channels synth)
19:41stain#<MidiChannel[] [Ljavax.sound.midi.MidiChannel;@129b073>
19:41stainto bad steffi_s did not have the patience..
19:41stainthink this should be a Clojure bug though
19:41stainuser=> (bean synth)
19:41stainIllegalAccessException Class clojure.core$bean$fn__5177$fn__5178 can not access a member of class com.sun.media.sound.AbstractMidiDevice with modifiers "public" sun.reflect.Reflection.ensureMemberAccess (Reflection.java:65)
19:42stainor is it a JDK error - it should be allowed when it is in the interface
19:51SgeoI don't think I ever liked how do in Haskell was buit-in syntax
19:52casioneverything about haskell's syntax is awful
19:54Sgeocasion, I think it's nice until you feel like you need Template Haskell to extend it
19:54xeqiI like the point free stuff
19:55casionI find nothing about it intuitive
19:55casionin my experiecne, you can't reason about the syntax
19:55emezeskecasion: Do you find general mathematical notation intuitive?
19:56casionemezeske: nope
19:56casionand it's not
19:56emezeskeDo you think it's bad?
19:57technomancyheh; the idea that software can be intuitive
19:57casiondepends on the feild
19:57emezeskeCan you define intuitive?
19:57SgeoThe reason I'm playing with Lisps more than Haskell now is because of the ugliness of Template Haskell and the difficultness of modifying a program while it runs
19:58technomancyemezeske: "intuition: immediate (not inferred) a priori knowledge or experiential belief"
19:58casionemezeske: I think a simple definition in this context, is being able to determine something with limited or non-existant knowledge of the context
19:58technomancythe idea that it's a term which can apply to software (especially notation) is silly; all notation is learned.
19:58emezesketechnomancy: haha
19:59casiontechnomancy: some notation is more deriviative than others
19:59casionsuch as most lisps
20:00technomancycasion: sure, you can have notation that relies upon fewer a priori experiences, that doesn't make it less reliant
20:01emezeskeHow could a programming language, or even a spoken language for that matter, be intuitive
20:01scottj"fewer a priori experiences"?
20:01casiontechnomancy: I think in this context, intuitive has to refer to limited knowledge
20:01xeqif○g , which one gets applied first again?
20:01emezeskeWithout having learned it first
20:02technomancycasion: yes, it has to if you assume it's a term that it's possible to apply to software. =)
20:02casionemezeske: I think this discussion is worthless if we're going to say that 'intuitive' means no prior knowldge
20:02casionone has to assume at least limited knowledge
20:02emezeskeThat's my point, though, "intuitive" just means that you have enough prior knowledge
20:02casionin the context of any notation at least
20:02casionif there's a better word for that, I'd be fine using it
20:03emezeskeThings can't be intuitive without the right a priori knowledge
20:03casionI agree
20:03technomancyI guess usage dictates language, and that you have to bend the word that way for the same reason you eventually have to give up and accept that "anyways" is an English word, but you don't have to like it.
20:03SgeoHmm, so this article criticize condp, but for its form (not enough grouping (parens or brackets)), not for its functionality
20:03SgeoI must say I really think I like condp's functionality.
20:04technomancybut it means that "intuitive" applied to software has a different meaning from the original word.
20:04emezeskeI kind of thing the word intuitive lacks any meaning for talking about e.g. Haskell's syntax
20:04emezeskeFor a Haskell expert, it is intuitive
20:04casiontechnomancy: yes, and if there's a better word for what I'm trying to convey, I will gladly use that
20:04casionbut I could not think of a better word
20:05arrdemcasion: I suppose my software eng. prof would call it "bloody obvious" not intuitive.
20:05technomancyusually when people say software is intuitive, they mean it's familiar or accessible
20:06emezesketechnomancy: Right. And if we strive for that definition of "intuitive", we'll just end up with tons of C-inspired syntax everywhere
20:06casionhow I'm using it, I mean that you can see something unfamiliar in syntax of application of syntax and be able to reason about it with limited knowledge
20:06emezeskecasion: That's nonsense. Before you knew any programming language, you couldn't reason about it at all
20:07emezeskecasion: You had to learn the rules somewhere
20:07casionif I know the basics of calling a function in haskell, when you approach a guard, it's not at all obvious what it may be
20:07casionbut in lisp, you could fairly easly figure out what cond is
20:07casionwith similarly limited knowledge
20:07emezeske... you could?
20:07xeqibut function application and macro application look the same, and act very different
20:08emezeskecond could do literally anything, and you have only 4 letters (its name) to know what
20:08emezeskeYou obviously have to read the docs on cond
20:08casionemezeske: and where are the docs on | ?
20:09casionyou'd have to know that you want to know what a guard is to begin with
20:09technomancyit sounds like you're talking about consistency
20:09casionobviousness is probably a better term
20:09technomancywhich is a lot easier to nail down than intuition; intuition is pretty vague and difficult to discuss with precision.
20:09casionconsistency is probably related
20:10emezeskecond is not obvious, at all
20:10emezeskeConsistent, maybe
20:10casionemezeske: you said it yourself.. at the very least you know what to look up
20:10casiona single pipe is not obvious, and for that matter you can't really even serach for that, you'd have to browse
20:10casionit's a very simple example for sure
20:11casionjust trying to convey my point clarly
20:11emezeskeSo programming languages should have their syntax based on what characters Google lets you search for?
20:11gfredericksgoogle searching for any non-alphanumeric character would surprise me
20:11arrdememezeske: no, but the syntax should make obvious __what__ you are googling for
20:11casionemezeske: it has nothing to do with google. someone who's never encountered | will, imo, have no idea what they should look for
20:11technomancyduckduckgo does a pretty good job of letting you use characters
20:12xeqilike #{} [] () ' ` ~ #= #'
20:12casionor THAT they should be looking for something
20:12emezeskecasion: You just said you "can't really even search for that"
20:12casionemezeske: why would you misquote me on IRC?
20:12emezeske...
20:12casionbefore that, same line "member:casion: a single pipe is not obvious, and for that matter"
20:13casionmentioning the search was an addendum to the main point
20:14emezeskehttp://2.bp.blogspot.com/-UUBBVvfBUcM/T1t8Zi673mI/AAAAAAAAA0c/uEdZ-PA4IpI/s280/homer-simpson-bush-gif.gif
20:14arrdem(inc emezeske)
20:14lazybot⇒ 2
20:16casionyay ice cream
20:16arrdem(> '.')># waffle
20:17xeqiwaffle cones, the best of both worlds
20:17arrdemxeqi: I was gonna do that but ASCII failed me...
20:19arrdems/#/U+1F368/g
20:20casionarrdem: is that haskell? ;)
20:21arrdemcasion: http://www.marathon-studios.com/unicode/U1F368/Ice_Cream
20:21casionyeah, I looked it up
20:21casionwas trying to make fun of myself
20:27SgeoI think some Clojurers coming from Haskell might use macros where a variadic function might do
20:27SgeoHaskell ... was going to say that it doesn't have variadic functions, but that's not true.
20:27casionI'm learning both at the same time
20:28casionand clojure has been smooth going, and very pleasant
20:29casionhaskell is very cool, but I constantly get confused with it
20:30casionreally wish clojure had the warning/error system haskell does
20:30Sgeocasion, I'm somewhat familiar with Haskell, you can ask me for help if you need (although #haskell is probably a good choice)
20:30casionSgeo: thank you
20:30dnolencasion: don't think it'll ever baked in, but Typed Clojure seems to be progressing ...
20:30SgeoYou're welcom
20:30Sgeoe
20:31casionmost of the time, as I was explaining above, it's a matter of not even knowing what I need to ask
20:31casiondnolen: yeah, but one can irrationally dream :)
20:31dnolencasion: I don't think it needs to be baked in either.
20:31arrdemdnolen: I presume this is an effort to add a GHC style type-prover to Clojure?
20:32dnolenarrdem: not GHC style, more like Typed Racket.
20:34casiontyped clojure looks neat
20:34casionI was not aware of it till now
20:38SgeoHmm
20:38SgeoIs Reducers a bit like using the Foldable stuff?
20:39djanatyn the 48 hour game jam I plan to use clojure in is starting in 23 minutes!
20:39djanatynI'm...still a little worried. :\ I'm not very experienced with the Penumbra library
20:39dnolenSgeo: does Foldable force you to consider the direction of the fold?
20:39dnolendjanatyn: good luck!
20:39djanatynI have lispbuilder-sdl as a backup plan, but I'm going to try my best to finish a game using clojure
20:40Sgeodnolen, hmm, yes. Although in defining a Foldable structure you only need to provide foldr or foldMap
20:40dnolenSgeo: yes so direction is problematic. if you want to know what Reducers is all about best to check out Guy Steele's talk: Cons Considered Slightly Harmful.
20:40djanatynhuh. does clojure have foldr and foldl? I only used reduce
20:40dnolendjanatyn: it does not
20:41djanatynoh.
20:41dnolendjanatyn: in Clojure Reducers fold doesn't specify direction - specifically to take advantage of parallelism via Fork/Join for some data structures.
20:42dnolenReducers are also about eliminating allocations
20:45arrdemtangential: can you guys reccomend a Java completion plugin for Java under Vim or should I drink the kool-aid and learn Emacs
20:47emezeskearrdem: I take it you want something more sophisticated than ctags?
20:48arrdemno idea, I'm just shopping around in the hope of not going back to Eclipse for my coursework.
20:50emezeskearrdem: Well ctags lets you do simple completion, but nothing like what Eclipse does
20:51emezeskearrdem: There's also eclim (I think that's the name) that lets you use a headless eclipse as an autocompletion backend
20:51arrdemyeah I may just end up with that
20:53SgeoIs core.logic purer than Prolog?
20:54dnolenSgeo: not really, esp. compared to modern Prolog implementations.
20:54Sgeoo.O
20:55arrdemwhat does 'purity' mean in this context?
20:56dnolenSgeo: modern Prolog have many niceties, disequality, tabling, CLP(FD/Q/R) etc some like CiaoProlog are really trying fix the deeper issues w/o sacrificing what makes Prolog great.
20:56dnolenarrdem: the need for non-relational operators.
20:59dnolenarrdem: by that I just mean things that prevent programs from running in any direction you like.
21:00majykI just installed lein 2preview9 and it appeared to bootstrap itself but when I run lein it complains about missing dependencies : Check :dependencies and :repositories for typos.
21:00majykI'm new to lein so it's quite possible something else is wrong
21:01majykI followed the directions on the github page
21:02jeremyheilermajyk: can you gist/refheap your project.clj?
21:03majykI don't have a project.clj (yet). I just installed lein, it bootstrapped, it's in my path, I can execute it. Even if I run lein version I get Check :dependencies and :repositories for typos.
21:04jeremyheilerhmm do you have a ~/.lein/profiles.clj file?
21:04majykand info about free floating Jars
21:04majykjeremyheiler, nope. The only thing in ~/.lein is the self-installs folder
21:05xeqitechnomancy: ^
21:05majykthis is a completely fresh install. I'm a complete lein noob
21:06xeqiits entirely possible its borked, preview9 was release ~30m ago
21:06majykyeah, I noticed on the mailing list so I was like, let me grab that!
21:06majykthanks guys for the help
21:08majykis the 2.0 branch the preferred branch to be using at this point?
21:08arrdemyes...
21:08majykok, thanks
21:08arrdembut there's still a lot of 1.0 around
21:09djanatynokay, the competition has started! :D
21:09dnolentechnomancy: so lein2 repl outside of a project doesn't work anymore?
21:09jeremyheilerdjanatyn : good luck!
21:09djanatynsetting up a git repository, pushing to github, grabbing dependencies and writing a project.clj with leiningen, and then I'll take a walk to think about the theme
21:09djanatyntheme is "evolution". anybody else who wants to participate can too :) http://ludumdare.com/compo
21:14majykI went back to 2preview8 and it now works fine for me
21:27Raynesdjanatyn: lein gitify can do all that for you except for the walk.
21:27RaynesWell, all the git stuff.
21:27djanatynoh. I noticed lein set up a nice .gitignore file for me
21:27djanatynhttps://github.com/djanatyn/ld48
21:34ibdknoxdjanatyn: are you doing a Clojure game or a ClojureScript game?
21:34djanatynclojure
21:35djanatynalso, man. I really really don't know OpenGL
21:35ibdknoxlol
21:35djanatynis there any resource that I could look at to get some hints? I'm reading through the examples that come with penumbra
21:35djanatynI really should have prepared more. I have tons of time, thankfully
21:36dnolenibdknox: so it looks like people are already doing some fancy IDE stuff w/ core.logic ;)
21:36ibdknoxdnolen: oh?
21:36dnolenibdknox: http://github.com/cderoove/damp.ekeko/wiki/Example-Ekeko-Queries
21:37dnolenibdknox: I tried to ping you about this the other day, but I take it you're pretty heads down during the week.
21:37ibdknoxdnolen: just had demo day, and we've got about 40 investor meetings, so thing have been a hair bit hectic
21:37dnolenibdknox: :O
21:38ibdknoxdnolen: in good news I think we're going to get a couple of the big guys to bite. :)
21:38dnolenibdknox: sweet!
21:38ibdknoxWe'll soon be hiring like crazy
21:38ibdknoxdnolen: this looks like some awesome stuff
21:38djanatynaaaaaaaand my first issues are starting >_>
21:39dnolenibdknox: yes, they've been at it a long time. It actually a use case I always dreamed about, these guys did it once in Smalltalk so they saw core.logic and got this up and running pretty fast it seems.
21:40djanatynhttp://i.imgur.com/poqS7.png -- trying to get a black triangle working. any tips?
21:40dnolenibdknox: the fact they're working this for Java perhaps bodes well for getting it working on a simpler language like JS ;)
21:40djanatynthis is after running "lein deps"
21:41djanatynerrm, let me pastebin that
21:41ibdknoxdnolen: I was looking at the output of esprima the other day, wondering if I could run that on top of rhino and then look through it with core.logic
21:42dnolenibdknox: yes I've been bringing that up :)
21:43ibdknoxdnolen: lots of exciting opportunities here!
21:43djanatynhttp://dpaste.org/8YyOG/
21:44ibdknoxdjanatyn: try using ztellman's version? (I know nothing about penumbra)
21:44ibdknoxpenumbra "0.6.0'
21:44ibdknox"
21:44ibdknoxminus the single quote
21:46djanatynit says that 0.6.9 is the clojure 1.3 version, and all examples I've seen of ztellman's version uses 1.2.0
21:48ibdknoxah
21:49ibdknoxdjanatyn: if you want to just do a 2d game, you could use quil
21:49djanatyn:O
21:49djanatynsweet, thank you!
22:01dnolenibdknox: oh, and it looks like even Facebook uses Prolog to analyze their code - http://github.com/facebook/pfff/blob/master/h_program-lang/database_code.pl
22:03djanatynthank you so much, ibdknox!
22:16ibdknoxdnolen: neat! Maybe I'll try playing around with some of this stuff this weekend. I have to actually learn core.logic though :)
22:16ibdknoxdjanatyn: np! Processing is a lot easier than opengl, so that should make your game creating much more enjoyable
22:43erick1hola
22:43erick1es en ingle
22:43erick1s
22:44erick1$$$$$$$$$$$$$$$$$$$$$
22:44erick1$_$
22:44erick1:-D
22:44erick1:-((
23:08emezeskedjanatyn: Have you looked at the NeHe tutorials?
23:09emezeskedjanatyn: They're pretty old, but they have a lot of basic stuff
23:10djanatynemezeske: I decided to use quil (processing) instead
23:10emezeskeOpenGL is not very forgiving, probably a good choice for really rapid dev
23:49john2xwhat is clojure's equivalent to other langauges' mydict['key'] = value?
23:51amalloy&(doc assoc)
23:51lazybot⇒ "([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)."
23:54amalloyi wonder why assoc's docstring mentions vectors at all. it implies that vectors and maps are all it will work on
23:56amalloy&(-> (reify clojure.lang.Associative (assoc [this k v] [1 2 3 k v])) (assoc 'ignored 'who-cares))
23:56lazybot⇒ [1 2 3 ignored who-cares]