#clojure logs

2011-07-01

00:04dnolenis there any literature on efficient incremental tree building in a functional programming language ?
00:14devndnolen: yes ;)
00:15dnolendevn: heh, links? I see zippers could work but they seem to slow down w/ the depth of the tree. It's seems like you could do it with CPS but I don't see how yet...
00:15devndnolen: finger trees? :X
00:16devnconstant time in lots of cases
00:16devndnolen: maybe not what you're looking for -- perhaps I'm misunderstanding what you mean when you say incremental
00:17dnolendevn: I'd like to incrementally construct a parse tree.
00:17devnoh.
00:17devnhmm
00:18devnhttp://www.cse.chalmers.se/~bernardy/FunctionalIncrementalParsing.pdf
00:18devndnolen: ^Is that more along the lines of what you're looking for?
00:22devndnolen: after thinking about it I guess finger trees are probably the wrong way to go for walking incrementally
00:23dnolendevn: yeah I saw that paper, seems to recommend zippers as well.
00:23devndnolen: *nod*
00:24devnyeah, zippers seem to be de rigueur
00:24devnbased on what I've read anyway...
00:25devn</pretentious>
00:25tomojwhat are you parsing?
00:26devntomoj: my guess is a code walker
00:26dnolentomoj: hmm I think I'm wrong about the efficiency of zippers, interesting.
00:27dnolendevn: tomoj: no, I've struggling with how to optimize core.logic for the parsing case.
00:27devndnolen: what was the assumption?
00:27devn(w/r/t zippers)
00:27dnolendevn: just bad microbench really.
00:28devnwhat does that mean?
00:28devn(not being antagonistic, just generally curious)
00:29dnolenProlog DCG let's you take a stream of characters and efficiently produce a parse tree, there's no separate lex, parse phases.
00:29devnDCG?
00:29dnolendevn: testing the perf of the modification + descent, not modification cost once descended.
00:29dnolendevn: Definite Clause Grammar
00:30devnI recently received the art of prolog in the mail
00:30dnolendevn: they are quite cool.
00:30dnolendevn: whoa.
00:30devnI'm excited/scared to crack it open
00:31dnolendevn: Prolog is the shit, pardon my french. http://www.cs.nmsu.edu/ALP/2011/06/bpsolvers-solutions-to-the-third-asp-competition-problems/ show how much Prolog still has to offer.
00:31brehautdevn: thats the Serious Prolog book right?
00:31devndnolen: It's cool how we were talking about datalog at clojure conj and now one of my favorite libraries is core.loigc
00:31devnlogic*
00:32devnIt's exciting to think how much can be done in a years' time.
00:32dnolendevn: there's a lot left to do, narrowing in on perf a lot now.
00:32devn*nod*, but even still, it's very cool to see. thanks for it.
00:32devnbrehaut:
00:33devnbrehaut: "Serious" -- I don't know. I don't find it to be that daunting, honestly. The Craft of Prolog might be a different story.
00:33brehautdevn: i have the bratko book, which is a relatively gentle introduction to it
00:33devnThink: The Little Schemer vs The Seasoned Schemer
00:33dnolenwaiting on William Byrds and Daniel Friendman paper on miniKaren CLP programming is nerve wracking, exciting.
00:34devnI'm not familiar with William Byrds
00:34devn:X
00:34dnolenWilliam Byrd, Daniel Friedman - miniKanren creators. no core.logic w/o them.
00:34devnThis is my treasure trove of resources on prolog so far: http://paste.lisp.org/display/96726
00:35devndnolen: d'oh. shoula known that.
00:35devnshoulda*
00:35devnDid you read nakkaya's post today?
00:35dnolendevn: yes quite cool, if not generally useful
00:36devnheh, it's timely I think
00:38devnI think there's a groundswell of people who are realizing with some tooling and a little bit of community we could hack on C, Java, etc. in Clojure by just doing a bit of research
00:40devnI know that's terribly vague but I've felt something recently, watching the mini-functional-dsls pop up that can just be used wherever without fear, and really 'getting it'.
00:41devnAgain terrible vague, maybe you follow... The point is, no matter how much I think I get it, the more I realize there's something else to it.
00:41devnterribly*
00:42devnInsert some deeply philosophical notion of the nature of reality here.
00:43devnContinuity of becoming and all that A.N.W. jazz.
00:45devndnolen: Are there any tasks a prolog newb could help out on with core.logic?
00:46dnolendevn: I'm loathe to foist any core.logic on anyone yet. I'm still trying to understand it myself.
00:47devndnolen: that being said, any stuff you'd touch with a 3 foot pole? ;)
00:48devnIt's only 3 feet, and yet, it's 3 feet away!
00:48devndnolen: any ideas on monte carlo simulations in clojure?
00:49devnliterature appreciate
00:49devnappreciated*
00:49dnolendevn: no. current big goal is to get DCG optimization stuff in. Then play around with parsing Clojure and feeding it into a rudimentary type checker and get some basic notion of performance. After that I'm probably going to dive back into predicate dispatch + core.logic with gusto.
00:50devnI've never known you to do anything without gusto
00:50dnolendevn: no don't know anything about monte carlo simulation beyond it's usefulness in computer Go
00:51devnI'm never going to have enough time in my life to consume what I've already implicitly agreed to.
00:52dnolentell me about it.
00:58devndnolen: have any brilliant ideas on how to match valid paren'd sexps where all sexps are contained in a single line?
00:59dnolendevn: ?
00:59devnso this line you're reading right now (would (recognize (this (is (a valid) s) expression)))
01:00devnwhere the signal to noise ratio is high
01:02dnolendevn: what is this for?
01:04cheierdevn: rainbow-delimiters?
01:14devndnolen: parsing irc logs of course
01:14devndnolen: I have a really ugly, bespoke solution right now that bothers me
01:15dnolendevn: maybe one day core.logic, why not fnparse?
01:15devnIs that still around? I felt like the last time I used it, it wasn't finished.
01:16dnolendevn: still around I think.
03:55neotykGood morning everyone!
04:08fliebelneotyk: Morning
04:09ejacksonhello alls
04:21seancorfield__mornin' ejackson
06:49taliosWhere does one find info on the current state of clojure-contrib?
07:23neotykHi talios, I was trying to fix clojure-maven-plugin to work with swank-clojure 1.3.1 today
07:23neotykbut neither maven 2 nor maven 3 can build current master
07:24taliostry curret development branch
07:24talios+n
07:24neotykanyway only change is that no port file is needed with new swank-clojure
07:24taliosmmm, no port - I thought that was fixed ages ago - maybe thats on development?
07:24neotyklet me see
07:25taliostrying to chase down some "it breaks in 1.3.x" issues currently actually for a new release
07:25talioscan't for the life of me find details on the current breakdown of contrib libs tho :(
07:25taliosI know I saved that URL somewhere
07:26neotykcan't help you with that one
07:27neotykin develop branch I still see portfile been used
07:27neotyklet me see if I can build on it
07:27neotykwhich maven it is expected to build with?
07:28neotykError resolving version for 'org.apache.maven.plugins:maven-site-plugin': Plugin requires Maven version 3.0
07:28taliosI'm using 3.x, but it -should- work with 2 as I've not changed any deps. or maybe I did?
07:28neotykI might have borked my local repo
07:28taliosahh - remove the site plugin fromt the pom.
07:29taliosI don't actually build a maven site so no point having it :)
07:29taliosI think I added that ages ago when I started looking at adding maven reports - but then got sidetracked with work.
07:30neotykok, progressing
07:32taliosany joy:
07:32talios?
07:32neotykqdox failed on compile mojo
07:33neotykand that is why I don't like developing maven plugins
07:33taliosqdox is EVIL
07:34neotykand when it gets to integration testing, I'm already thinking of getting drunk
07:34taliosat least that old one. It barfs all over the place ;( hit me yesterday at work as well. qdox 2.0 is due soon tho - hopefully that fixes all maner of issues
07:34taliosneotyk: run with -Dinvoker.skip=true to skip the ITs
07:34neotykonce I get there
07:35neotyk;-0
07:35taliostho that qdox issue is odd. what version of maven? 2.2?
07:35taliosI don't recall having that issue when I was using 2.x, but that was so long ago now.
07:36neotykmvn3 is not working on my local repo
07:36neotykmy change is very local
07:36neotykbut it requires swank-clojure 1.3.1
07:36ahritaurhello. problem is: i have simple app (compojure) and i want to deploy it to GAE. but i use enlive and moustache too, so i have a strange problems when trying to launch this app on a local server from sdk. exception here http://paste.org.ru/?oaj0lr and code is here http://paste.org.ru/?j75md1
07:36neotykI can submit pull req
07:36taliossure :)
07:37ahritauri think that problem is stupid, but im newbie in clojure.
07:37taliosdoes your m3 problem sound like "artifact not found" even if its in your local? we've traced a nasty aether bug in mvn3 and trying ( TRYING ) to get someone in sonatype to fix it :(
07:38taliosproblem doesn't occur -if- you use a mirror to download your maven artifacts
07:41ilyak,(concat 1 [2 3] 4)
07:41clojurebotjava.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
07:41ilyakI guess I'll have to make my own concat
07:44talios,(concat [1] [2 3] [4])
07:44clojurebot(1 2 3 4)
07:46neotyktalios: no idea what it is with my mvn3, don't have patience to care for it
07:46neotyktalios: submitted pull req, though it compares against your master, so it looks huge, while it is just one commit
07:48neotyktalios: fixed it: https://github.com/talios/clojure-maven-plugin/pull/38
07:50taliosneotyk: sweet, will pull that in, is 1.3.1 released? I could have sworn I'd pulled a similar patch awhile ago. odd.
07:52neotyk1.3.1 was released already
07:53neotyktalios: maybe it was just a foresight
07:55neotykbut careful with that patch, it will work with 1.3.1 but not with anything earlier
07:57talioswas going to ask about that :) I might have to break my "rule" and include a depdendency on swank-clojure 1.3.1, will mean one less dep needed for users which is good
07:58neotykor make it scope optional
07:58taliostrue
08:17ilyakIs there a function in clojure like (def negate [pred] (fn [x] (not (pred x)))?
08:18raekcomplement
08:18ilyakthanks!
08:20nizzeHi! Clojure newbie here.
08:20nizzeI just did (source map)
08:21nizzeWhy is the function so complicated? Is it cause of performance or laziness?
08:46ebaxtThis must be implemented in Clojure :p http://make-everything-ok.com/
08:52hoecknizze: its because of performance and laziness :)
08:59hoecknizze: earlier versions of map (e.g. this one from 2008: https://github.com/clojure/clojure/blob/a25af8d4b183e0bd3220e155e41efc4baa991922/src/clj/clojure/core.clj#L1240) are a bit simpler
09:00hoecknizze: and mapping over a single argument, leaving chunked seqs and mapping over more than two arguments aside, is as simple as https://github.com/clojure/clojure/blob/a25af8d4b183e0bd3220e155e41efc4baa991922/src/clj/clojure/core.clj#L1246
09:07nizzeThanks.
09:07nizzeCan you then explain me why Haskell's version of map is much more simple?
09:12CozeyHi, is there some way to speedup lein's startup ?
09:13lnostdal-laptopi think configuring the jvm to start in client mode as opposed to server mode will help
09:14lnostdal-laptopoh, and there's some info about this at the bottom here https://github.com/technomancy/leiningen
09:14hoecknizze: where are the sources for haskells map?
09:14nizzehttp://www.haskell.org/onlinereport/standard-prelude.html
09:14nizzectrl-f to map
09:15hugodtalios: http://clojure02.managed.contegix.com/display/design/Contrib+Library+Names if you haven't yet found it
09:15raekCozey: you can also use lein interactive
09:16Cozeyraek: good point
09:16talioshugod: hazah! cheers
09:16nizze map :: (a -> b) -> [a] -> [b] map f [] = [] map f (x:xs) = f x : map f xs
09:17Cozeyok, but no client mode on 64bit perhaps there is no difference
09:17hoecknizze: yeah, found it, I'd say is because haskell has operators and pattern matching and laziness built into the compiler
09:18hoecknizze: whereas clojures laziness lies in the lazy seq datastructure, so in clojure you have to wrap the function body in a lazy-seq macro
09:19nizzeTjamkl
09:19jolynizze: haskell's also just deals with one collection and only with lists. Clojure's works with multiple sequences of various collections
09:19nizzeThanks!!
09:20joly(given my little understanding of Haskell)
09:21nizzeJoly, what does "multiple sequences of various collecitons" mean?
09:22joly,(map + [5 6 7] [1 2 3])
09:22clojurebot(6 8 10)
09:22joly,(map inc #{5 6 7})
09:22clojurebot(6 7 8)
09:22nizze,(map inc [1 2 3])
09:22clojurebot(2 3 4)
09:23nizzejoly, should that case be "zipped" and then reduced?
09:23nizze(map + [5 6 7] [1 2 3])
09:26jolynizze: looks like maybe zipWith would do it
09:38nizzejoly: One more thing, why isn't map implemented as macro?
09:39gfrlog`nizze: why would it need to be a macro?
09:39nizzeAnd why isn't if implemented as macro?
09:39taliosmacros are evil.
09:39taliosjust saying.
09:39nizzegfrlog`: I I understood everything correctly it would be faster.
09:39gfrlog`nizze: I think if is a special form
09:40nizzetalios: Why is that? Hygienic things?
09:40gfrlog`by my own reasoning, it is a special form because you need some fundamental built-in way to do conditional evaluation
09:40gfrlog`so all the other macros will output if expressions
09:40gfrlog`(e.g., cond)
09:40gfrlog`nizze: I have no idea why you think macros would make map faster
09:41taliosmacro overuse makes debugging a pain in the bum, also writes out more bytecode that you need. reuse is good.
09:41nizzetalios: So when are macros called for?
09:41gfrlog`macros aren't needed until you want a new kind of syntax
09:41schasiIf something is not a var, (ref, atom, agent), then what is it? In terms of "variables"
09:41nizzeI come from Ruby land and there it's an obsession to roll up DSL for everything.
09:41gfrlog`schasi: a local variable?
09:42schasigfrlog`: Because macros are "evaluated" at compile time. That could make them "faster"
09:42gfrlog`schasi: all they do is rearrange the code. At some point it has to turn into actual non-macro code
09:42schasiSo there is kinda 5 types of variables? local, var, atom, ref, agent? So to speak
09:43gfrlog`schasi: I can imagine various people around here yelling about your terms, but *I* think you're not too far off-base :)
09:43gfrlog`mostly I think we try to avoid the word "variable"
09:43taliosbinding
09:43gfrlog`the first of your five cannot vary
09:44jolynizze: macros are used when you want to control when argument evaluation takes place, or to help with syntax. You can't do some things with them
09:44gfrlog`the others are called "reference types"
09:44joly,(#(% true true) or)
09:44clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/or
09:44schasigfrlog`: yes :D But well. Ahem. Identifiers, maybe?
09:44jolyfunctions compose better and are generally preferred for that reason
09:45jolynizze: ^
09:45gfrlog`schasi: as a name for the whole group?
09:45schasiyes
09:45nizzejoly: Thanks.
09:46gfrlog`schasi: I'm not sure we'd want to group them together at all. the reference types are for managing the relationship between state and identity. the locals are just for making code more readable
09:46nizzeOkay. What's the difference between :keywords and 'symbols
09:46schasiAnd I find it rather strange so far that vars are global and can be dynamically overridden. Which makes them differ from local identifiers, which can't and are looked up lexically. If I got that right
09:46gfrlog`schasi: any code with locals can be transformed into code without locals
09:46nizzeI red the explanation in the manual but only thing I got wast that there were some rule regarding what kind of chars can be in :keyword and 'symbol
09:46Chousukenizze: keywords evaluate to themselves
09:47gfrlog`schasi: yeah, that feature doesn't get used very often, for obvious reasons
09:47taliosmmm, almost 2am, I should crash. night all.
09:47Chousukenizze: symbols evaluate to whatever value is bound to said symbol in the evaluation context.
09:47schasigfrlog`: Right now I am actually not sure anymore what a local is. Do you mean a parameter to a function? Or something created with let, which is not a reference type?
09:48gfrlog`schasi: both of those
09:48Chousukenizze: and you can have several separate symbols that have the same name, too.
09:48gfrlog`theoretically (let) could be transformed into a function, so that the bound symbols are the function parameters
09:48nizzeChousuke: So 'symbol <- Protected symbol <- un protected?
09:48nizze(i.e. evaluated)
09:48Chousukenizze: quoted
09:48Chousukenizze: quote is a special operator that prevents evaluation
09:49nizzeIs quote magic or is it defined somewhere?
09:49gfrlog`should be a special form
09:49raeknizze: it's a special form, so it's implemented in the compiler
09:49gfrlog`which is as good a definition of "magic" as any
09:50nizzeI will count "special form" as magic
09:50gfrlog`:)
09:50schasilol
09:50nizzeThanks guys.
09:50nizzeI much like turtles all the way down. And as little syntax as possible.
09:51schasi"Any sufficiently advanced technology is indistinguishable from magic"
09:53lnostdal-laptophttp://paste.lisp.org/display/123070
09:53lnostdal-laptopin CL i recall something related to this via &allow-other-keys or :allow-other-keys .. but i guess that's sort of the opposite of what i'm looking for here since clojure "allows by default"
09:53fliebelHow do I get a seq from an Enumeration?
09:54stuartsierra`enumerator-seq`
09:54fliebelah, sweet :)
09:55gfrlog`lnostdal-laptop: the only thing I know of off the top of my head is to use a precondition
09:55wastrelacronyms
09:55gfrlog`(or write a macro)
09:56lnostdal-laptopmh, yeah, not sure but anything but a macro would mean repetition
09:57gfrlog`lnostdal-laptop: yeah, at least some minimal repetition
09:57gfrlog`lnostdal-laptop: I've found sometimes it's better to adjust what you want from the language than to rewrite the language with macros :)
09:58lnostdal-laptopyes
09:58gfrlog`lnostdal-laptop: it's a dynamic language, so this kind of situation comes up a lot. I deal with it by writing tests.
09:58lnostdal-laptopi'm hoping i don't have to do this
09:58lnostdal-laptop..write a macro for something like this
09:59gfrlog`if you absolutely need compile-time guarantees, then clojure's not a good choice
09:59gfrlog`although I guess you weren't asking about compile-time specifically, so I retract that statement
09:59lnostdal-laptopoh, it doesn't have to be compile time
09:59lnostdal-laptopyep
10:00gfrlog`lnostdal-laptop: you could avoid most of the repetition by creating a (has-only-keys?) function and throwing that in the precondition
10:00gfrlog`(fn [& {:keys [a] :or {a "default"} :as m}] {:pre (has-only-keys? m :a)} (println a))
10:00lnostdal-laptopyeah, perhaps (meta ...) or something can read out arg-list info?
10:01gfrlog`if you're doing this a lot, a macro could also reduce the repetition that you already have
10:01gfrlog`(i.e., you have 'a' twice)
10:01lnostdal-laptopyeah, i'm having a lot of keys here
10:01gfrlog`so I think something like (named-arg-fn [a "default", b "foobar"] ...)
10:02gfrlog`you could have that give you not only the destructuring but also check that no other keys are present
10:02gfrlog`if you don't want defaults for everything then it'd be a bit more complex
10:02hoeckor find a way to patch the destructuring function and provide a :keys-only clause
10:03gfrlog`lnostdal-laptop: is the whole point of this to be able to catch typos easier?
10:03hoeck((fn [& {:only-keys [a]} (+ a a)) :b 10) -> exceptoin
10:04lnostdal-laptopyeah, gfrlog` .. so i'm not stuck wondering why :a ends up with "default" even though i surely have changed it
10:04Chousuke:only-keys? :/
10:04gfrlog`lnostdal-laptop: I think that's a more general problem that's better dealt with by testing :)
10:05Chousukeor a code analysis tool
10:05Chousukebut it's going to be a lot of work to write one.
10:06lnostdal-laptopjust run-time is fine, ChanServ
10:06lnostdal-laptopChousuke,
10:06lnostdal-laptop(see? .. i made a typo.... :P)
10:06ChousukeI don't really agree with checking the keys in principle though. what if you *want* to pass in a map that has extra keys?
10:06Chousukejust don't make silly typos :P
10:06lnostdal-laptopboth things should be possible
10:06gfrlog`lnostdal-laptop: ^ that too :) it's not very clojure-like
10:07Chousukebesides, if you just test your functions you'll catch something like that pretty easily :)
10:07Chousukeone of the nice things about Clojure is that you *can* test things independently
10:08lnostdal-laptopyeah, but repetition
10:08Chousukerepetition? :/
10:08gfrlog`you mean the repeated a?
10:08lnostdal-laptoptesting is just another word for what i'm really after here .. it doesn't change anything
10:08lnostdal-laptopno .. the typo'ed :a
10:08Chousukein more strict languages it's hard to even test such things because you can't run code that's not complete yet :P
10:09Chousukebut in Clojure functions are often self-contained so you can just call them from the repl and see if they work
10:10gfrlog`Chousuke: isn't that more about composing pure functions than it is about static vs. dynamic?
10:10Chousukeyes.
10:13lnostdal-laptophttp://paste.lisp.org/display/123070#1
10:14lnostdal-laptop..and i can use &rest to catch all .. like the :as thingy in clojure
10:15lnostdal-laptop..so CL is strict here by default, but switches to the clojure way via the &allow-other-keys option
10:16mjg123Hi all - what's the idiomatic clojure which reads an inputstream into a string
10:16mjg123?
10:17gfrlog`mjg123: I think slurp does that?
10:17gfrlog`the java IO classes confuse me, that's the only reason I'm not positive
10:18mjg123gfrlog`, perfect :)
10:18gfrlog`mjg123: good good
10:19lnostdal-laptophttp://paste.lisp.org/display/123070#2 .. i suppose i could extract meta-data for the function in a pre-condition test
10:19lnostdal-laptop..to avoid having to repeat the keys
10:19gfrlog`lnostdal-laptop: you can access the function object from the function itself?
10:19lnostdal-laptopgfrlog`, i would guess so .. since the pre-condition test runs at run-time; not compile-time
10:20gfrlog`lnostdal-laptop: it doesn't need metadata
10:20lnostdal-laptophow so?
10:20gfrlog`lnostdal-laptop: it's just macro expanded into assert expressions
10:20gfrlog`so (fn [x] {:pre (pos? x)} (inc x)) would expand to...
10:20lnostdal-laptop..of course it needs to know about the argument list, or i'll have to type the keys again
10:21gfrlog`(fn [x] (assert (pos? x)) (inc x))
10:21gfrlog`lnostdal-laptop: my guess is you can't programamtically access the argument list of the function you're in without a macro to make that available. But there might be a clojure feature I don't know about.
10:22lnostdal-laptophttp://paste.lisp.org/display/123070#3
10:23gfrlog`lnostdal-laptop: ah, yeah if it's a def'ed function I guess that would work
10:23gfrlog`and perhaps for an anon-fn you could just name it...lessee
10:23gfrlog`,((fn get-args [x y z] (:arglists (meta get-args))))
10:23clojurebotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: sandbox$eval579$get-args
10:23gfrlog`,((fn get-args [x y z] (:arglists (meta get-args))) 1 2 3)
10:23clojurebotnil
10:24gfrlog`maybe w/o defn there's no metadata
10:24lnostdal-laptopneed the ns-reslove stuff
10:24lnostdal-laptop..before passing it to meta
10:24gfrlog`lnostdal-laptop: I don't think that'll work for these, as there's no var
10:24gfrlog`,((fn get-args [x y z] (:arglists (meta (ns-resolve get-args)))) 1 2 3)
10:24clojurebotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$ns-resolve
10:25gfrlog`,((fn get-args [x y z] (:arglists (meta (ns-resolve *ns* get-args)))) 1 2 3)
10:25clojurebotjava.lang.ClassCastException: sandbox$eval591$get_args__592 cannot be cast to clojure.lang.Symbol
10:25gfrlog`,((fn get-args [x y z] (:arglists (meta (ns-resolve (ns-name *ns*) get-args)))) 1 2 3)
10:25clojurebotjava.lang.ClassCastException: sandbox$eval595$get_args__596 cannot be cast to clojure.lang.Symbol
10:26gfrlog`,((fn get-args [x y z] (:arglists (meta (ns-resolve (ns-name *ns*) 'get-args)))) 1 2 3)
10:26clojurebotnil
10:26gfrlog`I think the ns-resolve is returning nil there
10:27lnostdal-laptop,((fn get-args [x y z] (:arglists (meta #'get-args))) 1 2 3)
10:27clojurebotjava.lang.Exception: Unable to resolve var: get-args in this context
10:27lnostdal-laptopok, it works here
10:27lnostdal-laptop=> ([x y z])
10:27lnostdal-laptopwhich is correct
10:27gfrlog`lnostdal-laptop: did you def it at some point?
10:27lnostdal-laptopnope
10:28gfrlog`cause it sure doesn't work for me and I wouldn't expect it to
10:28gfrlog`what about just #'get-args by itself?
10:28lnostdal-laptopoh, wait ..
10:29lnostdal-laptopyeah, doesn't work with anon fns
10:30gfrlog`lnostdal-laptop: and with that strategy you're still repeating something (the function name), as well as making it harder to rename your functions
10:30lnostdal-laptopyup
10:34jaohm. so there's no way to make ns A re-export names it's using from a second package B (so that anyone importing A also imports B's names), is there?
10:35gfrlog`jao: I think there is
10:35gfrlog`I saw a contrib library do it once...
10:35jaogfrlog`, i've seen solutions manipulating the ns symbol maps explicitly... yes
10:36jaoi was thinking of something in core
10:36raekjao: nothin in core
10:36gfrlog`I can't remember if it used something from core or not
10:36gfrlog`welp never mind then, I'll stop looking :)
10:36jao:)
10:36gfrlog`and now I remember it was c.c.mock
10:36jaothanks anyway
10:37raekhttp://clojure.github.com/clojure-contrib/ns-utils-api.html
10:37raekmaybe you are thinking of 'immigrate'
10:37gfrlog`yeah, that's how c.c.mock.test_adapter imports c.c.mock
10:37stuartsierra`immigrate` does not work.
10:37raekit has some caveats
10:38jaoraek, ah thanks
10:38raekjao: I would not recommend using it
10:38jaoimmigrate is was i was thinking of
10:38jaowell, a working version of it
10:39raekif you update the vars in the "original" namespace, the vars of the namespace that called immigrate won't be updated
10:39jaoi see. most inconvenient.
10:40raekif the functions are public anyway, i think it's simpler to just let the user of the namespace require two namespaces instead of one
10:40jaoare there any plans to add this functionality in the future to core clojure?
10:41stuartsierraOne of the properties of a Var is the namespace it belongs to, so no.
10:41jaoraek, well, in simple cases yes. but transitivity might mean a handful of requires that have to be maintained during refactorings.
10:41gfrlog`well apparently I was wrong about vars
10:41raekcompojure used to use immigrate but does nowadays
10:42raek*doesn't
10:42stuartsierraIf you need a convenient way to make multiple namespaces available without repeating :use/:require directives, you can write a helper function which calls `refer` and call it at the top of your namespace.
10:42raekyou kind of always have that problem if you rename a ns
10:43jaostuartsierra, aha, that sounds like a plan
10:43jaostuartsierra, thanks
10:44jcromartieIs rhickey ever on much anymore?
10:45gfrlog`stuartsierra: why should a var be associated with a namespace?
10:45gfrlog`(I imagined a "namespace" was a map from symbols to vars, which wouldn't require the vars knowing about the namespace[s])
10:45stuartsierraI dunno, but that's the way it works.
10:46gfrlog`hmm... and it knows the symbol too
10:46gfrlog`I could see it being metadata...oh well
10:51fliebel$findfn 0 [5 0 1 2 0 4 0 1 4] [[5] [1 2] [4] [1 4]]
10:51sexpbot[]
10:51gfrlog`fliebel: clojure.string/split for seqs?
10:51fliebelgfrlog`: yea...
10:52fliebelI could do a recursive split-at maybe...
10:52gfrlog`yeah I was just thinking of using loop
10:52gfrlog`split-at can't be right though
10:52raek,(take-nth 2 (partition-by #{0} [5 0 1 2 0 4 0 1 4]))
10:52clojurebot((5) (1 2) (4) (1 4))
10:52gfrlog`split-with is it
10:53gfrlog`kay I'll shut up now
10:53fliebelraek: yuk, feeding the CG, arn't you?
10:53gfrlog`he's coding faster :)
10:54gfrlog`~optimize
10:54clojurebotI don't understand.
10:54gfrlog`clojurebot: optimize?
10:54clojurebotNo entiendo
10:54fliebelgfrlog`: I see..
10:54gfrlog`ggggrg
10:55gfrlog`clojurebot was supposed to have something snarky to say about premature optimization
10:55raekfliebel: the GC?
10:55gfrlog`the carbage gollector of course
10:56fliebelgfrlog`: Yea, I know...
10:57gfrlog`fliebel: thinking about that makes me want to start adding comments to my code when I write something that could be made faster by complicating it
10:57gfrlog`like ; SLOW
10:58gfrlog`then I'm acknowledging the fact, but not doing anything about it unless it becomes necessary
10:58jcromartie^{:slow true}
10:58gfrlog`yeah I thought of that too...I like SLOW for grepping
10:59gfrlog`like TODO
10:59jcromartiemetadata FTW though
10:59jcromartie:SLOW would be fine
10:59gfrlog`jcromartie: maybe I don't use metadata well enough
10:59lnostdal-laptopso in 1.3.x .. defstruct is out and defrecord is better?
10:59gfrlog`jcromartie: I wouldn't know what to do with that
10:59jcromartieyou can have greppable metadata
11:00lnostdal-laptopfliebel, thank the jvm
11:00lnostdal-laptop:)
11:00jcromartiesearching namespaces for metadata on vars is pretty easy, I wonder if there's any fn that makes it easier
11:00jcromartieapropos and find-doc are my new best friends
11:00jcromartiethey should appear if you type "help" at the repl
11:01gfrlog`does anybody object to "premature" optimization when something can be made an order of magnitude faster?
11:01jcromartiethat's not really premature
11:01jcromartieis it?
11:01gfrlog`"order of magnitude" was a bad word there
11:01jcromartiehow much does it complicate the public API
11:01gfrlog`jcromartie: I think of "premature" as being "optimizing before you have a problem"
11:02jcromartiewell I had some code where changing one keyword made it two orders of magnitude faster :)
11:02jcromartiesorry symbol
11:02jcromartie:) thinking in C-type languages today
11:02gfrlog`jcromartie: you changed Thread/sleep to prn?
11:02jcromartiehah hah
11:03jcromartiechanged from conj to into
11:03gfrlog`hmm
11:03gfrlog`I'm curious the context
11:04jcromartiemerging new information into a markov chain trigram occurrence structure
11:19jcromartiewhat's the deal with namespace metadata
11:21gfrlog`yeah what's the deal!
11:21gfrlog`,(meta *ns*)
11:21clojurebotnil
11:25stuartsierra`ns` supports reader metadata on the namespace name.
13:14ahritaurhello guys anybody here who use clojure-compojure with eclipse? i'm interested with "full integration" - with leiningen etc. Is it real? I mean: edit, build and then launch web-browser.
13:52derp__what is a {}? is it a hash-map?
13:52gfrlog`(type {})
13:52gfrlog`,(type {})
13:52clojurebotclojure.lang.PersistentArrayMap
13:52derp__ah
13:52technomancyderp__: it's a map. the specific implementation class is irrelevant
13:53derp__is there a way to create a map within a map?
13:53gfrlog`,(type (zipmap (range 10000) (range 7 280833)))
13:53clojurebotclojure.lang.PersistentHashMap
13:53technomancy,{{}}
13:53clojurebotjava.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1
13:53derp__I just tried (def a {:b {}}) and got an error, so I assume not
13:53technomancywat
13:53gfrlog`,{{} {}}
13:53clojurebot{{} {}}
13:53technomancyoh duh
13:53gfrlog`:)
13:54gfrlog`derp__: that looks good to me -- what error?
13:54gfrlog`(all the general clojure collections can be nested arbitrarily)
13:54derp__gfrlog: lol, I'm an idiot. I have been typing "b:" instead of ":b" in the repl for a while
13:55gfrlog`derp__: apologize to your poor repl
13:55derp__the poor thing does deserve better
13:59S11001001,(do {{}} 'hi-there)
13:59clojurebot1
14:00S11001001huh
14:00gfrlog`,(do {{}})
14:00clojurebot1
14:00gfrlog`,(do :wut)
14:00clojurebot:wut
14:00gfrlog`,(do {:foo 'bar})
14:00clojurebot{:foo bar}
14:01gfrlog`,(read-string "(do {{}})")
14:01clojurebot1
14:01gfrlog`wut it doing.
14:01S11001001,(do {{}} :wha)
14:01clojurebot1
14:01amalloy1 is the error message for the exception
14:01amalloynot for any obvious reason
14:02gfrlog`,(type (do {{}} :wha))
14:02clojurebot1
14:02gfrlog`aah okay. so it's not actually returning 1 :)
14:02gfrlog`that's encouraging. Thanks clojurebot for making that clear.
14:03gfrlog`&(type (do {{}} "can sexpbot do better?"))
14:03sexpbotjava.lang.ArrayIndexOutOfBoundsException: 1
14:03amalloy&(do {{}} 20)
14:03sexpbotjava.lang.ArrayIndexOutOfBoundsException: 1
14:03gfrlog`sexpbot: botsnack
14:03sexpbotgfrlog`: Thanks! Om nom nom!!
14:06S11001001&(do (array-map 1 2 3) 42)
14:06sexpbot⟹ 42
14:13amalloyS11001001: funny. PersistentArrayMap.createWithCheck only checks that none of the keys are the same
14:13amalloy&(array-map 1 2 3)
14:13sexpbotjava.lang.ArrayIndexOutOfBoundsException: 3
14:14S11001001&((array-map 1 2 3) 1)
14:14sexpbot⟹ 2
14:15amalloyi think the exception is getting thrown by clojure.lang.RT when it tries to print the map
14:15amalloy&(seq (array-map 1 2 3))
14:15sexpbotjava.lang.ArrayIndexOutOfBoundsException: 3
14:18S11001001&((array-map :a :b :c) :c)
14:18sexpbotjava.lang.ArrayIndexOutOfBoundsException: 3
14:20amalloyhuh. well, i see what's going on, but personally i think array-map should do the same checking as hash-map does
14:42amalloyCaused by: java.lang.RuntimeException: java.io.IOException: success ;; i do so love java
14:45ilyakHi *
14:45ilyakI'm using clojure's defrecord
14:45ilyakit's like (defrecord Download [id date-time region ip])
14:45ilyakand if I swap region and ip my program slows down 2.5x times
14:46ilyak(defrecord Download [id date-time ip region]) => 2.5x times slowdown
14:46ilyakWTF??
14:50gfrlog`ilyak: won't that change what your code does?
14:51gfrlog`ilyak: or are you changing all the (new Download ...) calls too?
14:52hiredmanilyak: also you need to reload all code that accesses :region and :ip to get new inline caches, I believe
14:53ilyakgfrlog`: I sure do
14:53ilyakhiredman: I restart the process each time, and the effect is stable
14:54gfrlog`ilyak: is it possible to create a minimal example, perhaps where you create two differente (defrecord)s and do some basic performance tests, outside the context of the rest of your code?
14:55ilyakI'm trying
14:55cemerickejackson: I think you'll appreciate this: http://www.statisticalengineering.com/frequentists_and_bayesians.htm
14:55ilyakThe only idea I have is that defrecord constructor is lazy in some bizzare way
14:55ilyakand that it skips initializing the last member, which is ip, which doesn't get used
14:55ilyakunless it's not last, in which case it does
14:56hiredmanilyak: have you cleared out classes?
14:56hiredman./classes/
14:59ilyakOh, you imply that maybe I'm converting a field access to assoc?
14:59ilyakI'll definitely check
15:04ilyakI think you're probably right. Sigh for ccw not being able to recompile classes on its own
15:06ejacksoncemerick: I do lurlllve me some good stats throw down.
15:06ilyakYeah, it looks like that it was writing wrong types into wrong slots
15:06ilyakand then trying to use wrong types in inappropriate context
15:06ilyakstill it's mystery why it didn't fail instead of busy working
15:08ejacksoncemerick: a good tract that gets into this 'division' is http://www.cambridge.org/gb/knowledge/isbn/item1155795/?site_locale=en_GB by Jaynes
15:10jweissfn takes an option name as the first arg. how do you get that name back? it's not in the meta
15:11jweiss,(meta (fn heresthename [] 1))
15:11clojurebotnil
15:11gfrlog`jweiss: I would expect it to just be a local variable, and not accessible programmatically
15:11gfrlog`i.e., just for recursion
15:11gfrlog`or other self-reference
15:11jweissoh. that kinda sucks
15:11gfrlog`jweiss: whyso?
15:12gfrlog`,(macroexpand '(fn foo [] :foo))
15:12clojurebot(fn* foo ([] :foo))
15:12jweissok, so if i do (def x (fn-that-returns-fn)) is it not possible to get the kind of metadata that defn gives it?
15:12jweissi mean, i guess i could apply it myself since i control that function
15:12pcavs_jweiss: you could always write a your own macro to throw the function name into the meta data? I don't know what the use case for that would be, but it's possible
15:12jweisspcavs_: i'm trying to do trace
15:13jweissand non-defn'd fns don't have the metadata
15:13cemerickejackson: looks interesting, but probably *way* over my head?
15:13gfrlog`jweiss: can a function ever generally access itself in any way that doesn't involve hard-coding the var-name or something else?
15:13ejacksondoubt it - the description is more frightening than the book.... lemme just go upstairs and have a gander at mine
15:14jweissgfrlog`: well i just want the var to have more info than it does
15:14gfrlog`jweiss: how would you get to the var?
15:14jweissoh wait srry, i want the actual fn to have more data than it does :)
15:14gfrlog`same question -- how do you access the fn?
15:15jweissmy trace fn just has it passed to it
15:15jweissand it wants to print out the ns and name
15:15gfrlog`okay, so you're not trying to do something from inside the fn
15:15gfrlog`I see
15:15jweissfn's defined with defn have metadata
15:15gfrlog`right
15:15gfrlog`you could...rebind clojure.core/fn :)
15:16jweissi think i can just add some meta to the fn :)
15:17cemerickejackson: actually, the ToC gives me much hope that it's relatively comprehensible
15:25ejacksoncemerick: its a funny one, lots of discussion, and not actually a great deal of maths.
15:26cemerickejackson: So I gather. The title should be a little more lighthearted in that case. "So I heard you like stats", or something.
15:27kryftejackson: Oo, Jaynes
15:27kryftcemerick: Jaynes is very readable.
15:28cemerickkryft: we'll find out soon enough if he can penetrate a dullard like myself. :-P
15:28ejacksoncemerick: more like 'frequentists are stupid, like macaques'
15:28kryftcemerick: He's very opinionated, and a mathematician complained to me that his statements about Gödel's incompleteness theorem don't make a lot of sense, but for understanding Bayesian inference, it's great.
15:29ejacksoncemerick: I really, really like MacKays book http://www.inference.phy.cam.ac.uk/mackay/itila/
15:29kryftI wonder why I inserted that last comma.
15:29kryftgfrlog`: *drumfill*
15:29gfrlog`:)
15:30matthias__hmm, i have a map and in it is a number, i checked it is 0. but when i try to coerce that number into a double, i get a nullpointerexception Oo
15:30kryftcemerick: Yeah, MacKay's book is great too.
15:30ejacksonand you can read on your screen free of charge, which is a plus. A bit more mathsy, calculation wise, though.
15:30clojurebotYou don't have to tell me twice.
15:30gfrlog`matthias__: sounds weird. can you show us the code?
15:31ejacksoncemerick: oh dear, you bought it already !
15:32matthias__http://pastebin.com/twBLSNT8 there it is, gfrlog`
15:33matthias__i only put the double in to test, the nullpointerexception comes somewhere out of rotation-matrix without it
15:34gfrlog`matthias__: so you're saying that (double (:player-angle state)) throws an exception?
15:35matthias__yeah
15:35gfrlog`,(double (:player-angle {:player-angle 0}))
15:35clojurebot0.0
15:35matthias__the same code used to work actually...
15:36matthias__and :player-angle is in the map. at least it is at the time of the breakpoint
15:36cemerickejackson: I'm sadly fast and loose with the book purchases. I've got four heavy-hitters waiting for me on my desk already. :-/
15:36gfrlog`matthias__: if I was debugging it I would add (let [pa (:player-angle state)] (prn pa) (prn (type pa))) to the top of the function
15:36ejacksoncemerick: you and me both :)
15:37gfrlog`matthias__: and see what it spits out
15:38gfrlog`matthias__: or check the type using your swank voodoo :P
15:38matthias__omg
15:39ejacksoncemerick: so, being nosy, what are these Barry Bonds Books ?
15:39matthias__im an idiot, thanks gfrlog` :S
15:39gfrlog`anytime
15:43cemerickejackson: Pearl's Causality is the most serious one
15:44cemerickAlso, Hopcraft and Ullman's Automata Theory (1979 ed)
15:44ejacksoni've not read that one.
15:45cemerickejackson: http://t.co/TyLvDnQ
15:46cemerickThe later editions are apparently pretty watered down
15:47cemerickI can get hand-wavy stuff anywhere, so I wanted to get the authoritative, rigorous approach
15:50amalloygfrlog`: c'mon, you missed a perfect chance to use juxt
15:51amalloy(prn ((juxt identity type) (:player-angle state)))
15:51gfrlog`amalloy: I was trying to figure out if you were on or not
15:51amalloyvery clever scheme
15:52amalloyand what you discovered was that for fifteen minutes i wasn't
15:52gfrlog`yep
15:54gfrlog`(defn make-vector-from-three-fns-and-two-args [f g h x y] [(f x y) (g x y) (h x y)])
16:11rbuchmann,(update-in '(1 2 3 4) [1] #(+ 1 %))
16:11clojurebotjava.lang.NullPointerException
16:12rbuchmannWhat do I miss here...? O_o
16:12amalloyvectors aren't lists
16:12amalloyer, other way round: lists aren't vectors
16:12amalloy&(update-in [1 2 3 4] [1] inc)
16:12sexpbot⟹ [1 3 3 4]
16:13rbuchmannso, if I want to do that on a general sequence I have to do (vec ..) first=
16:13rbuchmann?
16:14rbuchmannIf I have to update something in a nested sequence of lists, what do I do?
16:15rbuchmann*list of lists
16:16rbuchmannturning it into a zipper or the like seems like overkill
16:17rbuchmannseems a little silly that update-in doesnt work, considering stuff like nth is well defined
16:19amalloyrbuchmann: update-in is supposed to be fast
16:20amalloyit only works with Associative
16:20amalloythose are both good reasons not to make it work for lists
16:20rbuchmannhm, okay
16:20rbuchmannSo how would I go about updating a nested list?
16:20raekby index?
16:20raekthen you want nested vectors
16:21raeklists/seqs are not the right data structures for random access and updates
16:21rbuchmannhm, and if I have stuff in the generation process that returns lazy seqs? should I always (vec ...) it then?
16:22raekif you choose vectors as you representation, then yes
16:22raek*your
16:22rbuchmannokay, thanks
16:25rbuchmannI was working on http://4clojure.com/problem/43 , but I guess I am on the wrong track :D
16:27rbuchmannI believe it does
16:27rbuchmann:)
16:28rbuchmannthat wasn't exactly what I had in mind ^^
16:28gfrlog`I'm hoping it will crash the site
16:28raekisn't the number given as the second argument always the length of the input list?
16:29gfrlog`raek: on prob-43? no...
16:29raeker, I kinda looked at this in a mirrored way
16:31gfrlog`rbuchmann: got it! https://gist.github.com/1059331
16:31rbuchmannhaha
16:31rbuchmannnice
16:31gfrlog`there was a bug in it the first time, but I fixed it
16:32derp__why doesn't this code work?
16:32derp__,(do (def a (fn [] ({:b "test"}))) (a :b))
16:32clojurebotDENIED
16:32gfrlog`derp__: ##({:b "test"})
16:32sexpbotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: PersistentArrayMap
16:32gfrlog`you're calling a map with no args
16:32gfrlog`maps want a key :)
16:33gfrlog`not to mention your function a takes no args, and then you're calling it with one arg :) so it can fail on two places
16:33gfrlog`rbuchmann: actually there oughta be a mildly cleverer way to do it...
16:33rbuchmannshould be ((a) :b)
16:33derp__ah
16:33raekderp__: 1) you call a with one arg, but it accepts zero 2) you call the map {:b "test"} as a function
16:34amalloygfrlog`: for a while we did have hidden tests
16:34amalloybut they confused a lot of users, and we don't really care if losers like you hard-code the test cases
16:34gfrlog`amalloy: your site didn't say I was a loser
16:34amalloyit's in an html comment
16:34gfrlog`oh okay
16:34derp__well I what I want to do is create a function that returns a dynamically made map
16:35gfrlog`derp__: why dynamically?
16:35gfrlog`derp__: why not (constantly {:foo "bar"})
16:35gfrlog`(I guess I mean your example sure didn't seem dynamic -- it seems like a constant function)
16:36rbuchmannI guess it was meant as a theoretical example
16:36gfrlog`rbuchmann: this is a bit cleaner: https://gist.github.com/1059341
16:37gfrlog`derp__: if it's not a constant function, you can just remove the parens from around the map in your example and it should work
16:37rbuchmannamalloy: you're involved in that site? nice, I like it
16:38amalloyrbuchmann: if you're interested you can see a lot of neat solutions by searching for #4clojure on twitter
16:38derp__gfrlog: thank you!
16:38gfrlog`derp__: yessir
16:40raekthere, #43 solved :)
16:40amalloyrbuchmann: *spoiler* my favorite solution is https://gist.github.com/1059351 (i didn't come up with it, but saw it on twitter)
16:40gfrlog`amalloy: have you ever tried to solve each problem with juxt?
16:40rbuchmannamalloy: aaah, I got to partition, but couldn't see how to use it effectively after that
16:40rbuchmannthat ones very nice
16:41rbuchmannhaha
16:41rbuchmannyes, mine is a *tad* longer too
16:41raekhttps://gist.github.com/1059347 well, here it is
16:41raek*spoiler* etc
16:41amalloyraek: i know, right!? mine was https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/seq.clj#L19 before i saw that one posted on 4clojure
16:42amalloyand then i was ashamed
16:42rbuchmannhehe
16:45amalloy*chuckle* raek, i like how you were careful enough to doall, just in case
16:46raek:-)
16:49raekamalloy: ...but you would get a StackOverflowError if you called it with (range 10000) and 1 otherwise!
16:49amalloyexactly! good save
17:24hippytaf1hi..can anyone give me a link to a good lispbox tutorial...downloaded the lispbox package as lisp in a box is defunct, but the tutorial I was following was for commom lisp not clojure common list...so I wasted a whole afternoon (of very sparse free time)
17:25hippytaf1I'd rather spend my sparce free tim with lisp than python or c
17:26hippytaf1having read a this http://www.gigamonkeys.com/book/
17:26clojurebotI think you mean gnir.
17:26amalloyhippytaf1: maybe technomancy's emacs-starter-kit?
17:26hippytaf1thanks bot
17:26hippytaf1got a link amalloy
17:26hippytaf1?
17:27technomancyhippytaf1: there's clojurebox, but as far as I know it's pretty dated and windows-only
17:27amalloy$google emacs technomancy emacs-starter-kit
17:27sexpbotFirst out of 865 results is: technomancy/emacs-starter-kit at master - GitHub
17:27sexpbothttps://github.com/technomancy/emacs-starter-kit/blame/master/starter-kit-lisp.el
17:30hippytaf1thanks sexpbot, that seems like some source code though :)
17:31hippytaf1appreciate the link though...always amazes me how compact lisp source code is
17:32hippytaf1technomancy: thanks dude, just looking for an easy way to set up the environment so I can learn the language :)
17:33hippytaf1for me on linux I can try to learn python quite easily, but I have seen that lisp is far superiror even than c
17:34hippytaf1bash is fairlt simple and all precedural languages are learnable, but lisp has something else...and the syntax makes sense ll
17:34hippytaf1lol
17:36gfrlog`hippytaf1: it's quite the thing
17:38hippytaf1defining functions with lisp...there is no nonsense...(defun capitalism-sucks () (format t "yes it does"))
17:38hippytaf1gfrlog`: it has opened my eyes
17:38gfrlog`:)
17:38hippytaf1lisp makes sense more than any other language I've looked into
17:39hippytaf1namely python, bash and c
17:39hippytaf1bash is a must for a linux user
17:39gfrlog`I like clojure's choice of immutable data structures
17:40hippytaf1as opposed to persistent ones?
17:40gfrlog`no; they're immutable and persistent
17:41gfrlog`I like both parts
17:41hippytaf1ah i see
17:41hippytaf1and that makes sense to me
17:41hippytaf1define something and it is defined
17:41hippytaf1and then use what is defined
17:44hippytaf1not ephemerial
17:45hippytaf1anyway...a tutorial about setting up an ide for coljure and then
17:46hippytaf1I'll bugger off :)
17:46technomancyhippytaf1: the swank clojure readme combined with the leiningen tutorial will get you pretty far
17:46gfrlog`the eclipse plugin is called counterclockwise
17:47hippytaf1technomancy: got a link?
17:47hippytaf1and then I will never bother you again
17:47hippytaf1untill I have another question :)
17:49gfrlog`hippytaf1: googling "swank clojure readme" leads to https://github.com/technomancy/swank-clojure
17:50hippytaf1gfrlog`: thanks...did google it, and yes, I was being lazy asking for a link :)
17:52hippytaf1thanks guys
17:52gfrlog`yessir
17:55gfrlog`,(numerator 5/1)
17:55clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Ratio
17:55hiredmaninteresting
17:55gfrlog`I figured there'd be a clojure.core/ratio to help me out...
17:55hiredmanI wrote numerator so that could be my fault
17:56hiredmanI guess
17:56gfrlog`ha
17:56gfrlog`is there a way to coerce to ratio?
17:56__name__,(ratio 1 2)
17:56clojurebotjava.lang.Exception: Unable to resolve symbol: ratio in this context
17:56__name__,(/ 1 2)
17:56clojurebot1/2
17:56gfrlog`__name__: ##(type (/ 2 1))
17:56hiredman,(map bean (.getConstructors clojure.lang.Ratio))
17:56sexpbot⟹ java.lang.Integer
17:56clojurebot({:declaringClass clojure.lang.Ratio, :typeParameters #<TypeVariable[] [Ljava.lang.reflect.TypeVariable;@1a3e9cb>, :class java.lang.reflect.Constructor, :synthetic false, :accessible false, :name "clojure.lang.Ratio", :declaredAnnotations #<Annotation[] [Ljava.lang.annotation.Annotation;@4a25d5>, :exceptionTypes #<Class[] [Ljava.lang.Class;@19efe65>, :parameterAnnotations #<Annotation[][] [[Ljava....
17:56__name__##(type (/1 2))
17:56hiredman,(clojure.lang.Ratio. 5 1)
17:57clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigInteger
17:57__name__##(type (/ 1 2))
17:57sexpbot⟹ clojure.lang.Ratio
17:57hiredman,(clojure.lang.Ratio. (bigint 5) (bigint 1))
17:57clojurebot5/1
17:57gfrlog`hiredman: those are viable options; thanks
18:04hippytaf1technomancy: missed the leinigen tutorial bit earlier...
18:04hippytaf1bookmarked for the next time I a get a significant space of free time :)
19:31duck1123What's the best way to "pop" a value off a set? The best I've found is (let [s #{:foo :bar} i (first s)] (disj s i))
19:39Scriptorduck1123: do you mean remove a value from a set? Otherwise sets aren't really supposed to have an order
19:39Scriptorso pop has no meaning when it comes to sets
19:40duck1123what I wanted to do was just remove one element at random from the set
19:40Scriptorah
19:40duck1123the modified set goes back in the ref, and the removed item is returned
19:40duck1123I got it working, but it doesn't seem very elegant
19:41duck1123I'll probably replace it with an ordered queue of some sort, but I want to maintain uniqueness
19:42duck1123and really, I don't care too much about the order if it ever gets to this point
19:42ampleyfly(disj s (rand-nth (seq s))) perhaps
19:42duck1123that's basically what I have, but I just used first
19:43ampleyflywell, isn't the set ordered somehow?
19:43hiredmanwhy not use a queue and a set?
19:43duck1123hiredman: how do you mean?
19:44hiredmanpushing is: check if in set, if not alter set to contain and alter queue to contain
19:44hiredmanpoping is peek+pop+disj
19:45duck1123Here's my use case. If a discovery is done on a remote user, but the domain hasn't been discovered then I need to queue the discovery of the user until the domain is done.
19:45duck1123that's basically what I have right now
19:46hiredmanwith the set to keep form queueing the same thing over and over?
19:46duck1123I have the added complication that I have a map of sets
19:46duck1123right, I only really need to discover the user once
19:57Scriptorwhat's the general differences between functions and their * forms?
19:57Scriptorlike, list and list*, and fn and fn*
19:57Scriptorwait, ignore the fn*
19:58amalloythe * forms are different :)
19:58hiredmanfoo* can be used to implement foo
19:58Scriptorah, so it's the more abstracted version?
19:58amalloyScriptor: hiredman's definition is the most common, but not everyone uses it
19:58amalloyless abstracted
19:58Scriptorright
21:00bdeshamanyone know of a good tutorial for getting nailgun working with MacVim?
21:35hiredmandnolen: is there a way to make a logic var that only unifies with objects of a particular type?
21:48hiredmanI'd like to be able to do something like ^Symbol ?a and have ?a only unify with symbols
21:51dnolenhiredman: not w/o some kind of general constraint system no. But it's looking like that will be a part of core.logic sooner rather than later.
21:54dnolenhiredman: miniKanren folks submitted their CLP paper to the Scheme Workshop 2011 and they're gonna pass it along to me if it gets accepted (which I'm sure it will).
21:57dnolenhiredman: er, now that I think about it you can do what you want with project, but it's a bit verbose.
21:57dnolen(project [v] (== (type v) Symbol))
21:57hiredman:/
21:59dnolenhiredman: you could always hide that behind your own goal fn tho, so you can write, (typeo v Symbol)
22:00dnolen(defn typeo [x t] (project [x] (== x t)))
22:00hiredmanright, thanks
22:02dnolenhiredman: only thing to watch out for is that since it uses project, order matters. order wouldn't matter with a proper constraint system in place.
22:03dnolen(typeo v Symbol) (== v 'a) would not fail for example.
22:11dnolenhugod: I just pushed a real 0.6.1
22:17hugoddnolen: thanks :)
22:17dnolenhugod: np
22:17hugodnow I have no excuse to get going
23:42amalloyso suppose i were defining a macro that just quotes its argument. do folks prefer (defmacro quote* [x] (list `quote x)) or (defmacro quote* [x] `'~x)?
23:47amalloyof course it's not useful in isolation; i'm writing a macro that does more data-structure fiddling than template-replacing, so it's not already in a backtick-form