#clojure log - Jul 01 2011

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:04 dnolen: is there any literature on efficient incremental tree building in a functional programming language ?

0:14 devn: dnolen: yes ;)

0:15 dnolen: devn: 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...

0:15 devn: dnolen: finger trees? :X

0:16 constant time in lots of cases

0:16 dnolen: maybe not what you're looking for -- perhaps I'm misunderstanding what you mean when you say incremental

0:17 dnolen: devn: I'd like to incrementally construct a parse tree.

0:17 devn: oh.

0:17 hmm

0:18 http://www.cse.chalmers.se/~bernardy/FunctionalIncrementalParsing.pdf

0:18 dnolen: ^Is that more along the lines of what you're looking for?

0:22 dnolen: after thinking about it I guess finger trees are probably the wrong way to go for walking incrementally

0:23 dnolen: devn: yeah I saw that paper, seems to recommend zippers as well.

0:23 devn: dnolen: *nod*

0:24 yeah, zippers seem to be de rigueur

0:24 based on what I've read anyway...

0:25 </pretentious>

0:25 tomoj: what are you parsing?

0:26 devn: tomoj: my guess is a code walker

0:26 dnolen: tomoj: hmm I think I'm wrong about the efficiency of zippers, interesting.

0:27 devn: tomoj: no, I've struggling with how to optimize core.logic for the parsing case.

0:27 devn: dnolen: what was the assumption?

0:27 (w/r/t zippers)

0:27 dnolen: devn: just bad microbench really.

0:28 devn: what does that mean?

0:28 (not being antagonistic, just generally curious)

0:29 dnolen: Prolog DCG let's you take a stream of characters and efficiently produce a parse tree, there's no separate lex, parse phases.

0:29 devn: DCG?

0:29 dnolen: devn: testing the perf of the modification + descent, not modification cost once descended.

0:29 devn: Definite Clause Grammar

0:29 * devn needs to read about that

0:30 devn: I recently received the art of prolog in the mail

0:30 dnolen: devn: they are quite cool.

0:30 devn: whoa.

0:30 devn: I'm excited/scared to crack it open

0:31 dnolen: devn: 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.

0:31 brehaut: devn: thats the Serious Prolog book right?

0:31 devn: dnolen: It's cool how we were talking about datalog at clojure conj and now one of my favorite libraries is core.loigc

0:31 logic*

0:32 It's exciting to think how much can be done in a years' time.

0:32 dnolen: devn: there's a lot left to do, narrowing in on perf a lot now.

0:32 devn: *nod*, but even still, it's very cool to see. thanks for it.

0:32 brehaut:

0:33 brehaut: "Serious" -- I don't know. I don't find it to be that daunting, honestly. The Craft of Prolog might be a different story.

0:33 brehaut: devn: i have the bratko book, which is a relatively gentle introduction to it

0:33 devn: Think: The Little Schemer vs The Seasoned Schemer

0:33 dnolen: waiting on William Byrds and Daniel Friendman paper on miniKaren CLP programming is nerve wracking, exciting.

0:34 devn: I'm not familiar with William Byrds

0:34 :X

0:34 dnolen: William Byrd, Daniel Friedman - miniKanren creators. no core.logic w/o them.

0:34 devn: This is my treasure trove of resources on prolog so far: http://paste.lisp.org/display/96726

0:35 dnolen: d'oh. shoula known that.

0:35 shoulda*

0:35 Did you read nakkaya's post today?

0:35 dnolen: devn: yes quite cool, if not generally useful

0:36 devn: heh, it's timely I think

0:36 * dnolen is psyched to have a reason to finally use zippers

0:38 devn: I 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

0:40 I 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'.

0:41 Again 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.

0:41 terribly*

0:42 Insert some deeply philosophical notion of the nature of reality here.

0:43 Continuity of becoming and all that A.N.W. jazz.

0:45 * devn goes home to his cave to organize thoughts and return well-rested

0:45 devn: dnolen: Are there any tasks a prolog newb could help out on with core.logic?

0:46 dnolen: devn: I'm loathe to foist any core.logic on anyone yet. I'm still trying to understand it myself.

0:47 devn: dnolen: that being said, any stuff you'd touch with a 3 foot pole? ;)

0:48 It's only 3 feet, and yet, it's 3 feet away!

0:48 dnolen: any ideas on monte carlo simulations in clojure?

0:49 literature appreciate

0:49 appreciated*

0:49 dnolen: devn: 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.

0:50 devn: I've never known you to do anything without gusto

0:50 dnolen: devn: no don't know anything about monte carlo simulation beyond it's usefulness in computer Go

0:50 * devn adds something else to his reading list

0:51 devn: I'm never going to have enough time in my life to consume what I've already implicitly agreed to.

0:52 dnolen: tell me about it.

0:58 devn: dnolen: have any brilliant ideas on how to match valid paren'd sexps where all sexps are contained in a single line?

0:59 dnolen: devn: ?

0:59 devn: so this line you're reading right now (would (recognize (this (is (a valid) s) expression)))

1:00 where the signal to noise ratio is high

1:02 dnolen: devn: what is this for?

1:04 cheier: devn: rainbow-delimiters?

1:14 devn: dnolen: parsing irc logs of course

1:14 dnolen: I have a really ugly, bespoke solution right now that bothers me

1:15 dnolen: devn: maybe one day core.logic, why not fnparse?

1:15 devn: Is that still around? I felt like the last time I used it, it wasn't finished.

1:16 dnolen: devn: still around I think.

3:55 neotyk: Good morning everyone!

4:08 fliebel: neotyk: Morning

4:09 ejackson: hello alls

4:21 seancorfield__: mornin' ejackson

6:49 talios: Where does one find info on the current state of clojure-contrib?

7:23 neotyk: Hi talios, I was trying to fix clojure-maven-plugin to work with swank-clojure 1.3.1 today

7:23 but neither maven 2 nor maven 3 can build current master

7:24 talios: try curret development branch

7:24 +n

7:24 neotyk: anyway only change is that no port file is needed with new swank-clojure

7:24 talios: mmm, no port - I thought that was fixed ages ago - maybe thats on development?

7:24 neotyk: let me see

7:25 talios: trying to chase down some "it breaks in 1.3.x" issues currently actually for a new release

7:25 can't for the life of me find details on the current breakdown of contrib libs tho :(

7:25 I know I saved that URL somewhere

7:26 neotyk: can't help you with that one

7:27 in develop branch I still see portfile been used

7:27 let me see if I can build on it

7:27 which maven it is expected to build with?

7:28 Error resolving version for 'org.apache.maven.plugins:maven-site-plugin': Plugin requires Maven version 3.0

7:28 talios: I'm using 3.x, but it -should- work with 2 as I've not changed any deps. or maybe I did?

7:28 neotyk: I might have borked my local repo

7:28 talios: ahh - remove the site plugin fromt the pom.

7:29 I don't actually build a maven site so no point having it :)

7:29 I think I added that ages ago when I started looking at adding maven reports - but then got sidetracked with work.

7:30 neotyk: ok, progressing

7:32 talios: any joy:

7:32 ?

7:32 neotyk: qdox failed on compile mojo

7:33 and that is why I don't like developing maven plugins

7:33 talios: qdox is EVIL

7:34 neotyk: and when it gets to integration testing, I'm already thinking of getting drunk

7:34 talios: at 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

7:34 neotyk: run with -Dinvoker.skip=true to skip the ITs

7:34 neotyk: once I get there

7:35 ;-0

7:35 talios: tho that qdox issue is odd. what version of maven? 2.2?

7:35 I don't recall having that issue when I was using 2.x, but that was so long ago now.

7:36 neotyk: mvn3 is not working on my local repo

7:36 my change is very local

7:36 but it requires swank-clojure 1.3.1

7:36 ahritaur: hello. 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

7:36 neotyk: I can submit pull req

7:36 talios: sure :)

7:37 ahritaur: i think that problem is stupid, but im newbie in clojure.

7:37 talios: does 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 :(

7:38 problem doesn't occur -if- you use a mirror to download your maven artifacts

7:41 ilyak: ,(concat 1 [2 3] 4)

7:41 clojurebot: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

7:41 ilyak: I guess I'll have to make my own concat

7:44 talios: ,(concat [1] [2 3] [4])

7:44 clojurebot: (1 2 3 4)

7:46 neotyk: talios: no idea what it is with my mvn3, don't have patience to care for it

7:46 talios: submitted pull req, though it compares against your master, so it looks huge, while it is just one commit

7:48 talios: fixed it: https://github.com/talios/clojure-maven-plugin/pull/38

7:50 talios: neotyk: sweet, will pull that in, is 1.3.1 released? I could have sworn I'd pulled a similar patch awhile ago. odd.

7:52 neotyk: 1.3.1 was released already

7:53 talios: maybe it was just a foresight

7:55 but careful with that patch, it will work with 1.3.1 but not with anything earlier

7:57 talios: was 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

7:58 neotyk: or make it scope optional

7:58 talios: true

8:17 ilyak: Is there a function in clojure like (def negate [pred] (fn [x] (not (pred x)))?

8:18 raek: complement

8:18 ilyak: thanks!

8:20 nizze: Hi! Clojure newbie here.

8:20 I just did (source map)

8:21 Why is the function so complicated? Is it cause of performance or laziness?

8:46 ebaxt: This must be implemented in Clojure :p http://make-everything-ok.com/

8:52 hoeck: nizze: its because of performance and laziness :)

8:59 nizze: 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

9:00 nizze: 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

9:07 nizze: Thanks.

9:07 Can you then explain me why Haskell's version of map is much more simple?

9:12 Cozey: Hi, is there some way to speedup lein's startup ?

9:13 lnostdal-laptop: i think configuring the jvm to start in client mode as opposed to server mode will help

9:14 oh, and there's some info about this at the bottom here https://github.com/technomancy/leiningen

9:14 hoeck: nizze: where are the sources for haskells map?

9:14 nizze: http://www.haskell.org/onlinereport/standard-prelude.html

9:14 ctrl-f to map

9:15 hugod: talios: http://clojure02.managed.contegix.com/display/design/Contrib+Library+Names if you haven't yet found it

9:15 raek: Cozey: you can also use lein interactive

9:16 Cozey: raek: good point

9:16 talios: hugod: hazah! cheers

9:16 nizze: map :: (a -> b) -> [a] -> [b] map f [] = [] map f (x:xs) = f x : map f xs

9:17 Cozey: ok, but no client mode on 64bit perhaps there is no difference

9:17 hoeck: nizze: yeah, found it, I'd say is because haskell has operators and pattern matching and laziness built into the compiler

9:18 nizze: whereas clojures laziness lies in the lazy seq datastructure, so in clojure you have to wrap the function body in a lazy-seq macro

9:19 nizze: Tjamkl

9:19 joly: nizze: haskell's also just deals with one collection and only with lists. Clojure's works with multiple sequences of various collections

9:19 nizze: Thanks!!

9:20 joly: (given my little understanding of Haskell)

9:21 nizze: Joly, what does "multiple sequences of various collecitons" mean?

9:22 joly: ,(map + [5 6 7] [1 2 3])

9:22 clojurebot: (6 8 10)

9:22 joly: ,(map inc #{5 6 7})

9:22 clojurebot: (6 7 8)

9:22 nizze: ,(map inc [1 2 3])

9:22 clojurebot: (2 3 4)

9:23 nizze: joly, should that case be "zipped" and then reduced?

9:23 (map + [5 6 7] [1 2 3])

9:26 joly: nizze: looks like maybe zipWith would do it

9:38 nizze: joly: One more thing, why isn't map implemented as macro?

9:39 gfrlog`: nizze: why would it need to be a macro?

9:39 nizze: And why isn't if implemented as macro?

9:39 talios: macros are evil.

9:39 just saying.

9:39 nizze: gfrlog`: I I understood everything correctly it would be faster.

9:39 gfrlog`: nizze: I think if is a special form

9:40 nizze: talios: Why is that? Hygienic things?

9:40 gfrlog`: by my own reasoning, it is a special form because you need some fundamental built-in way to do conditional evaluation

9:40 so all the other macros will output if expressions

9:40 (e.g., cond)

9:40 nizze: I have no idea why you think macros would make map faster

9:41 talios: macro overuse makes debugging a pain in the bum, also writes out more bytecode that you need. reuse is good.

9:41 nizze: talios: So when are macros called for?

9:41 gfrlog`: macros aren't needed until you want a new kind of syntax

9:41 schasi: If something is not a var, (ref, atom, agent), then what is it? In terms of "variables"

9:41 nizze: I come from Ruby land and there it's an obsession to roll up DSL for everything.

9:41 gfrlog`: schasi: a local variable?

9:42 schasi: gfrlog`: Because macros are "evaluated" at compile time. That could make them "faster"

9:42 gfrlog`: schasi: all they do is rearrange the code. At some point it has to turn into actual non-macro code

9:42 schasi: So there is kinda 5 types of variables? local, var, atom, ref, agent? So to speak

9:43 gfrlog`: schasi: I can imagine various people around here yelling about your terms, but *I* think you're not too far off-base :)

9:43 mostly I think we try to avoid the word "variable"

9:43 talios: binding

9:43 gfrlog`: the first of your five cannot vary

9:44 joly: nizze: 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

9:44 gfrlog`: the others are called "reference types"

9:44 joly: ,(#(% true true) or)

9:44 clojurebot: java.lang.Exception: Can't take value of a macro: #'clojure.core/or

9:44 schasi: gfrlog`: yes :D But well. Ahem. Identifiers, maybe?

9:44 joly: functions compose better and are generally preferred for that reason

9:45 nizze: ^

9:45 gfrlog`: schasi: as a name for the whole group?

9:45 schasi: yes

9:45 nizze: joly: Thanks.

9:46 gfrlog`: 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

9:46 nizze: Okay. What's the difference between :keywords and 'symbols

9:46 schasi: And 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

9:46 gfrlog`: schasi: any code with locals can be transformed into code without locals

9:46 nizze: I 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

9:46 Chousuke: nizze: keywords evaluate to themselves

9:47 gfrlog`: schasi: yeah, that feature doesn't get used very often, for obvious reasons

9:47 talios: mmm, almost 2am, I should crash. night all.

9:47 Chousuke: nizze: symbols evaluate to whatever value is bound to said symbol in the evaluation context.

9:47 schasi: gfrlog`: 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?

9:48 gfrlog`: schasi: both of those

9:48 Chousuke: nizze: and you can have several separate symbols that have the same name, too.

9:48 gfrlog`: theoretically (let) could be transformed into a function, so that the bound symbols are the function parameters

9:48 nizze: Chousuke: So 'symbol <- Protected symbol <- un protected?

9:48 (i.e. evaluated)

9:48 Chousuke: nizze: quoted

9:48 nizze: quote is a special operator that prevents evaluation

9:49 nizze: Is quote magic or is it defined somewhere?

9:49 gfrlog`: should be a special form

9:49 raek: nizze: it's a special form, so it's implemented in the compiler

9:49 gfrlog`: which is as good a definition of "magic" as any

9:50 nizze: I will count "special form" as magic

9:50 gfrlog`: :)

9:50 schasi: lol

9:50 nizze: Thanks guys.

9:50 I much like turtles all the way down. And as little syntax as possible.

9:51 schasi: "Any sufficiently advanced technology is indistinguishable from magic"

9:53 lnostdal-laptop: http://paste.lisp.org/display/123070

9:53 in 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"

9:53 fliebel: How do I get a seq from an Enumeration?

9:54 stuartsierra: `enumerator-seq`

9:54 fliebel: ah, sweet :)

9:55 gfrlog`: lnostdal-laptop: the only thing I know of off the top of my head is to use a precondition

9:55 wastrel: acronyms

9:55 gfrlog`: (or write a macro)

9:56 lnostdal-laptop: mh, yeah, not sure but anything but a macro would mean repetition

9:57 gfrlog`: lnostdal-laptop: yeah, at least some minimal repetition

9:57 lnostdal-laptop: I've found sometimes it's better to adjust what you want from the language than to rewrite the language with macros :)

9:58 lnostdal-laptop: yes

9:58 gfrlog`: lnostdal-laptop: it's a dynamic language, so this kind of situation comes up a lot. I deal with it by writing tests.

9:58 lnostdal-laptop: i'm hoping i don't have to do this

9:58 ..write a macro for something like this

9:59 gfrlog`: if you absolutely need compile-time guarantees, then clojure's not a good choice

9:59 although I guess you weren't asking about compile-time specifically, so I retract that statement

9:59 lnostdal-laptop: oh, it doesn't have to be compile time

9:59 yep

10:00 gfrlog`: lnostdal-laptop: you could avoid most of the repetition by creating a (has-only-keys?) function and throwing that in the precondition

10:00 (fn [& {:keys [a] :or {a "default"} :as m}] {:pre (has-only-keys? m :a)} (println a))

10:00 lnostdal-laptop: yeah, perhaps (meta ...) or something can read out arg-list info?

10:01 gfrlog`: if you're doing this a lot, a macro could also reduce the repetition that you already have

10:01 (i.e., you have 'a' twice)

10:01 lnostdal-laptop: yeah, i'm having a lot of keys here

10:01 gfrlog`: so I think something like (named-arg-fn [a "default", b "foobar"] ...)

10:02 you could have that give you not only the destructuring but also check that no other keys are present

10:02 if you don't want defaults for everything then it'd be a bit more complex

10:02 hoeck: or find a way to patch the destructuring function and provide a :keys-only clause

10:03 gfrlog`: lnostdal-laptop: is the whole point of this to be able to catch typos easier?

10:03 hoeck: ((fn [& {:only-keys [a]} (+ a a)) :b 10) -> exceptoin

10:04 lnostdal-laptop: yeah, gfrlog` .. so i'm not stuck wondering why :a ends up with "default" even though i surely have changed it

10:04 Chousuke: :only-keys? :/

10:04 gfrlog`: lnostdal-laptop: I think that's a more general problem that's better dealt with by testing :)

10:05 Chousuke: or a code analysis tool

10:05 but it's going to be a lot of work to write one.

10:06 lnostdal-laptop: just run-time is fine, ChanServ

10:06 Chousuke,

10:06 (see? .. i made a typo.... :P)

10:06 Chousuke: I 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:06 just don't make silly typos :P

10:06 lnostdal-laptop: both things should be possible

10:06 gfrlog`: lnostdal-laptop: ^ that too :) it's not very clojure-like

10:07 Chousuke: besides, if you just test your functions you'll catch something like that pretty easily :)

10:07 one of the nice things about Clojure is that you *can* test things independently

10:08 lnostdal-laptop: yeah, but repetition

10:08 Chousuke: repetition? :/

10:08 gfrlog`: you mean the repeated a?

10:08 lnostdal-laptop: testing is just another word for what i'm really after here .. it doesn't change anything

10:08 no .. the typo'ed :a

10:08 Chousuke: in more strict languages it's hard to even test such things because you can't run code that's not complete yet :P

10:09 but in Clojure functions are often self-contained so you can just call them from the repl and see if they work

10:10 gfrlog`: Chousuke: isn't that more about composing pure functions than it is about static vs. dynamic?

10:10 Chousuke: yes.

10:13 lnostdal-laptop: http://paste.lisp.org/display/123070#1

10:14 ..and i can use &rest to catch all .. like the :as thingy in clojure

10:15 ..so CL is strict here by default, but switches to the clojure way via the &allow-other-keys option

10:16 mjg123: Hi all - what's the idiomatic clojure which reads an inputstream into a string

10:16 ?

10:17 gfrlog`: mjg123: I think slurp does that?

10:17 * mjg123 checks...

10:17 gfrlog`: the java IO classes confuse me, that's the only reason I'm not positive

10:18 mjg123: gfrlog`, perfect :)

10:18 gfrlog`: mjg123: good good

10:19 lnostdal-laptop: http://paste.lisp.org/display/123070#2 .. i suppose i could extract meta-data for the function in a pre-condition test

10:19 ..to avoid having to repeat the keys

10:19 gfrlog`: lnostdal-laptop: you can access the function object from the function itself?

10:19 lnostdal-laptop: gfrlog`, i would guess so .. since the pre-condition test runs at run-time; not compile-time

10:20 gfrlog`: lnostdal-laptop: it doesn't need metadata

10:20 lnostdal-laptop: how so?

10:20 gfrlog`: lnostdal-laptop: it's just macro expanded into assert expressions

10:20 so (fn [x] {:pre (pos? x)} (inc x)) would expand to...

10:20 lnostdal-laptop: ..of course it needs to know about the argument list, or i'll have to type the keys again

10:21 gfrlog`: (fn [x] (assert (pos? x)) (inc x))

10:21 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:22 lnostdal-laptop: http://paste.lisp.org/display/123070#3

10:23 gfrlog`: lnostdal-laptop: ah, yeah if it's a def'ed function I guess that would work

10:23 and perhaps for an anon-fn you could just name it...lessee

10:23 ,((fn get-args [x y z] (:arglists (meta get-args))))

10:23 clojurebot: java.lang.IllegalArgumentException: Wrong number of args (0) passed to: sandbox$eval579$get-args

10:23 gfrlog`: ,((fn get-args [x y z] (:arglists (meta get-args))) 1 2 3)

10:23 clojurebot: nil

10:24 gfrlog`: maybe w/o defn there's no metadata

10:24 lnostdal-laptop: need the ns-reslove stuff

10:24 ..before passing it to meta

10:24 gfrlog`: lnostdal-laptop: I don't think that'll work for these, as there's no var

10:24 ,((fn get-args [x y z] (:arglists (meta (ns-resolve get-args)))) 1 2 3)

10:24 clojurebot: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$ns-resolve

10:25 gfrlog`: ,((fn get-args [x y z] (:arglists (meta (ns-resolve *ns* get-args)))) 1 2 3)

10:25 clojurebot: java.lang.ClassCastException: sandbox$eval591$get_args__592 cannot be cast to clojure.lang.Symbol

10:25 gfrlog`: ,((fn get-args [x y z] (:arglists (meta (ns-resolve (ns-name *ns*) get-args)))) 1 2 3)

10:25 clojurebot: java.lang.ClassCastException: sandbox$eval595$get_args__596 cannot be cast to clojure.lang.Symbol

10:25 * gfrlog` gets angry

10:26 gfrlog`: ,((fn get-args [x y z] (:arglists (meta (ns-resolve (ns-name *ns*) 'get-args)))) 1 2 3)

10:26 clojurebot: nil

10:26 gfrlog`: I think the ns-resolve is returning nil there

10:27 lnostdal-laptop: ,((fn get-args [x y z] (:arglists (meta #'get-args))) 1 2 3)

10:27 clojurebot: java.lang.Exception: Unable to resolve var: get-args in this context

10:27 lnostdal-laptop: ok, it works here

10:27 => ([x y z])

10:27 which is correct

10:27 gfrlog`: lnostdal-laptop: did you def it at some point?

10:27 lnostdal-laptop: nope

10:28 gfrlog`: cause it sure doesn't work for me and I wouldn't expect it to

10:28 what about just #'get-args by itself?

10:28 lnostdal-laptop: oh, wait ..

10:29 yeah, doesn't work with anon fns

10:30 gfrlog`: 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:30 lnostdal-laptop: yup

10:34 jao: hm. 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:35 gfrlog`: jao: I think there is

10:35 I saw a contrib library do it once...

10:35 jao: gfrlog`, i've seen solutions manipulating the ns symbol maps explicitly... yes

10:36 i was thinking of something in core

10:36 raek: jao: nothin in core

10:36 gfrlog`: I can't remember if it used something from core or not

10:36 welp never mind then, I'll stop looking :)

10:36 jao: :)

10:36 gfrlog`: and now I remember it was c.c.mock

10:36 jao: thanks anyway

10:37 raek: http://clojure.github.com/clojure-contrib/ns-utils-api.html

10:37 maybe you are thinking of 'immigrate'

10:37 gfrlog`: yeah, that's how c.c.mock.test_adapter imports c.c.mock

10:37 stuartsierra: `immigrate` does not work.

10:37 raek: it has some caveats

10:38 jao: raek, ah thanks

10:38 raek: jao: I would not recommend using it

10:38 jao: immigrate is was i was thinking of

10:38 well, a working version of it

10:39 raek: if you update the vars in the "original" namespace, the vars of the namespace that called immigrate won't be updated

10:39 jao: i see. most inconvenient.

10:40 raek: if 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:40 jao: are there any plans to add this functionality in the future to core clojure?

10:41 stuartsierra: One of the properties of a Var is the namespace it belongs to, so no.

10:41 jao: raek, well, in simple cases yes. but transitivity might mean a handful of requires that have to be maintained during refactorings.

10:41 gfrlog`: well apparently I was wrong about vars

10:41 raek: compojure used to use immigrate but does nowadays

10:42 *doesn't

10:42 stuartsierra: If 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:42 raek: you kind of always have that problem if you rename a ns

10:43 jao: stuartsierra, aha, that sounds like a plan

10:43 stuartsierra, thanks

10:44 jcromartie: Is rhickey ever on much anymore?

10:45 gfrlog`: stuartsierra: why should a var be associated with a namespace?

10:45 (I imagined a "namespace" was a map from symbols to vars, which wouldn't require the vars knowing about the namespace[s])

10:45 stuartsierra: I dunno, but that's the way it works.

10:46 gfrlog`: hmm... and it knows the symbol too

10:46 I could see it being metadata...oh well

10:51 fliebel: $findfn 0 [5 0 1 2 0 4 0 1 4] [[5] [1 2] [4] [1 4]]

10:51 sexpbot: []

10:51 gfrlog`: fliebel: clojure.string/split for seqs?

10:51 fliebel: gfrlog`: yea...

10:52 I could do a recursive split-at maybe...

10:52 gfrlog`: yeah I was just thinking of using loop

10:52 split-at can't be right though

10:52 raek: ,(take-nth 2 (partition-by #{0} [5 0 1 2 0 4 0 1 4]))

10:52 clojurebot: ((5) (1 2) (4) (1 4))

10:52 gfrlog`: split-with is it

10:53 kay I'll shut up now

10:53 fliebel: raek: yuk, feeding the CG, arn't you?

10:53 gfrlog`: he's coding faster :)

10:54 ~optimize

10:54 clojurebot: I don't understand.

10:54 gfrlog`: clojurebot: optimize?

10:54 clojurebot: No entiendo

10:54 fliebel: gfrlog`: I see..

10:54 gfrlog`: ggggrg

10:55 clojurebot was supposed to have something snarky to say about premature optimization

10:55 raek: fliebel: the GC?

10:55 gfrlog`: the carbage gollector of course

10:56 fliebel: gfrlog`: Yea, I know...

10:57 gfrlog`: 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:57 like ; SLOW

10:58 then I'm acknowledging the fact, but not doing anything about it unless it becomes necessary

10:58 jcromartie: ^{:slow true}

10:58 gfrlog`: yeah I thought of that too...I like SLOW for grepping

10:59 like TODO

10:59 jcromartie: metadata FTW though

10:59 :SLOW would be fine

10:59 gfrlog`: jcromartie: maybe I don't use metadata well enough

10:59 lnostdal-laptop: so in 1.3.x .. defstruct is out and defrecord is better?

10:59 gfrlog`: jcromartie: I wouldn't know what to do with that

10:59 jcromartie: you can have greppable metadata

10:59 * fliebel thanks Java for having a nice GC

11:00 lnostdal-laptop: fliebel, thank the jvm

11:00 :)

11:00 jcromartie: searching namespaces for metadata on vars is pretty easy, I wonder if there's any fn that makes it easier

11:00 apropos and find-doc are my new best friends

11:00 they should appear if you type "help" at the repl

11:01 gfrlog`: does anybody object to "premature" optimization when something can be made an order of magnitude faster?

11:01 jcromartie: that's not really premature

11:01 is it?

11:01 gfrlog`: "order of magnitude" was a bad word there

11:01 jcromartie: how much does it complicate the public API

11:01 gfrlog`: jcromartie: I think of "premature" as being "optimizing before you have a problem"

11:02 jcromartie: well I had some code where changing one keyword made it two orders of magnitude faster :)

11:02 sorry symbol

11:02 :) thinking in C-type languages today

11:02 gfrlog`: jcromartie: you changed Thread/sleep to prn?

11:02 jcromartie: hah hah

11:03 changed from conj to into

11:03 gfrlog`: hmm

11:03 I'm curious the context

11:04 jcromartie: merging new information into a markov chain trigram occurrence structure

11:19 what's the deal with namespace metadata

11:21 gfrlog`: yeah what's the deal!

11:21 ,(meta *ns*)

11:21 clojurebot: nil

11:25 stuartsierra: `ns` supports reader metadata on the namespace name.

13:14 ahritaur: hello 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:52 derp__: what is a {}? is it a hash-map?

13:52 gfrlog`: (type {})

13:52 ,(type {})

13:52 clojurebot: clojure.lang.PersistentArrayMap

13:52 derp__: ah

13:52 technomancy: derp__: it's a map. the specific implementation class is irrelevant

13:53 derp__: is there a way to create a map within a map?

13:53 gfrlog`: ,(type (zipmap (range 10000) (range 7 280833)))

13:53 clojurebot: clojure.lang.PersistentHashMap

13:53 technomancy: ,{{}}

13:53 clojurebot: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1

13:53 derp__: I just tried (def a {:b {}}) and got an error, so I assume not

13:53 technomancy: wat

13:53 gfrlog`: ,{{} {}}

13:53 clojurebot: {{} {}}

13:53 technomancy: oh duh

13:53 gfrlog`: :)

13:54 derp__: that looks good to me -- what error?

13:54 (all the general clojure collections can be nested arbitrarily)

13:54 derp__: gfrlog: lol, I'm an idiot. I have been typing "b:" instead of ":b" in the repl for a while

13:55 gfrlog`: derp__: apologize to your poor repl

13:55 derp__: the poor thing does deserve better

13:59 S11001001: ,(do {{}} 'hi-there)

13:59 clojurebot: 1

14:00 S11001001: huh

14:00 gfrlog`: ,(do {{}})

14:00 clojurebot: 1

14:00 gfrlog`: ,(do :wut)

14:00 clojurebot: :wut

14:00 gfrlog`: ,(do {:foo 'bar})

14:00 clojurebot: {:foo bar}

14:01 gfrlog`: ,(read-string "(do {{}})")

14:01 clojurebot: 1

14:01 gfrlog`: wut it doing.

14:01 S11001001: ,(do {{}} :wha)

14:01 clojurebot: 1

14:01 amalloy: 1 is the error message for the exception

14:01 not for any obvious reason

14:02 gfrlog`: ,(type (do {{}} :wha))

14:02 clojurebot: 1

14:02 gfrlog`: aah okay. so it's not actually returning 1 :)

14:02 that's encouraging. Thanks clojurebot for making that clear.

14:03 &(type (do {{}} "can sexpbot do better?"))

14:03 sexpbot: java.lang.ArrayIndexOutOfBoundsException: 1

14:03 amalloy: &(do {{}} 20)

14:03 sexpbot: java.lang.ArrayIndexOutOfBoundsException: 1

14:03 gfrlog`: sexpbot: botsnack

14:03 sexpbot: gfrlog`: Thanks! Om nom nom!!

14:06 S11001001: &(do (array-map 1 2 3) 42)

14:06 sexpbot: ⟹ 42

14:13 amalloy: S11001001: funny. PersistentArrayMap.createWithCheck only checks that none of the keys are the same

14:13 &(array-map 1 2 3)

14:13 sexpbot: java.lang.ArrayIndexOutOfBoundsException: 3

14:14 S11001001: &((array-map 1 2 3) 1)

14:14 sexpbot: ⟹ 2

14:15 amalloy: i think the exception is getting thrown by clojure.lang.RT when it tries to print the map

14:15 &(seq (array-map 1 2 3))

14:15 sexpbot: java.lang.ArrayIndexOutOfBoundsException: 3

14:18 S11001001: &((array-map :a :b :c) :c)

14:18 sexpbot: java.lang.ArrayIndexOutOfBoundsException: 3

14:20 amalloy: huh. well, i see what's going on, but personally i think array-map should do the same checking as hash-map does

14:42 Caused by: java.lang.RuntimeException: java.io.IOException: success ;; i do so love java

14:45 ilyak: Hi *

14:45 I'm using clojure's defrecord

14:45 it's like (defrecord Download [id date-time region ip])

14:45 and if I swap region and ip my program slows down 2.5x times

14:46 (defrecord Download [id date-time ip region]) => 2.5x times slowdown

14:46 WTF??

14:50 gfrlog`: ilyak: won't that change what your code does?

14:51 ilyak: or are you changing all the (new Download ...) calls too?

14:52 hiredman: ilyak: also you need to reload all code that accesses :region and :ip to get new inline caches, I believe

14:53 ilyak: gfrlog`: I sure do

14:53 hiredman: I restart the process each time, and the effect is stable

14:54 gfrlog`: 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:55 ilyak: I'm trying

14:55 cemerick: ejackson: I think you'll appreciate this: http://www.statisticalengineering.com/frequentists_and_bayesians.htm

14:55 ilyak: The only idea I have is that defrecord constructor is lazy in some bizzare way

14:55 and that it skips initializing the last member, which is ip, which doesn't get used

14:55 unless it's not last, in which case it does

14:56 hiredman: ilyak: have you cleared out classes?

14:56 ./classes/

14:59 ilyak: Oh, you imply that maybe I'm converting a field access to assoc?

14:59 I'll definitely check

15:04 I think you're probably right. Sigh for ccw not being able to recompile classes on its own

15:06 ejackson: cemerick: I do lurlllve me some good stats throw down.

15:06 ilyak: Yeah, it looks like that it was writing wrong types into wrong slots

15:06 and then trying to use wrong types in inappropriate context

15:06 still it's mystery why it didn't fail instead of busy working

15:08 ejackson: cemerick: a good tract that gets into this 'division' is http://www.cambridge.org/gb/knowledge/isbn/item1155795/?site_locale=en_GB by Jaynes

15:10 jweiss: fn takes an option name as the first arg. how do you get that name back? it's not in the meta

15:11 ,(meta (fn heresthename [] 1))

15:11 clojurebot: nil

15:11 gfrlog`: jweiss: I would expect it to just be a local variable, and not accessible programmatically

15:11 i.e., just for recursion

15:11 or other self-reference

15:11 jweiss: oh. that kinda sucks

15:11 gfrlog`: jweiss: whyso?

15:12 ,(macroexpand '(fn foo [] :foo))

15:12 clojurebot: (fn* foo ([] :foo))

15:12 jweiss: ok, 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:12 i mean, i guess i could apply it myself since i control that function

15:12 pcavs_: 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:12 jweiss: pcavs_: i'm trying to do trace

15:13 and non-defn'd fns don't have the metadata

15:13 cemerick: ejackson: looks interesting, but probably *way* over my head?

15:13 gfrlog`: jweiss: can a function ever generally access itself in any way that doesn't involve hard-coding the var-name or something else?

15:13 ejackson: doubt it - the description is more frightening than the book.... lemme just go upstairs and have a gander at mine

15:14 jweiss: gfrlog`: well i just want the var to have more info than it does

15:14 gfrlog`: jweiss: how would you get to the var?

15:14 jweiss: oh wait srry, i want the actual fn to have more data than it does :)

15:14 gfrlog`: same question -- how do you access the fn?

15:15 jweiss: my trace fn just has it passed to it

15:15 and it wants to print out the ns and name

15:15 gfrlog`: okay, so you're not trying to do something from inside the fn

15:15 I see

15:15 jweiss: fn's defined with defn have metadata

15:15 gfrlog`: right

15:15 you could...rebind clojure.core/fn :)

15:16 jweiss: i think i can just add some meta to the fn :)

15:17 cemerick: ejackson: actually, the ToC gives me much hope that it's relatively comprehensible

15:25 ejackson: cemerick: its a funny one, lots of discussion, and not actually a great deal of maths.

15:26 cemerick: ejackson: So I gather. The title should be a little more lighthearted in that case. "So I heard you like stats", or something.

15:27 kryft: ejackson: Oo, Jaynes

15:27 cemerick: Jaynes is very readable.

15:28 cemerick: kryft: we'll find out soon enough if he can penetrate a dullard like myself. :-P

15:28 ejackson: cemerick: more like 'frequentists are stupid, like macaques'

15:28 kryft: cemerick: 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:29 * gfrlog` wonders if maybe his statements about Godel's theorem were incomplete

15:29 ejackson: cemerick: I really, really like MacKays book http://www.inference.phy.cam.ac.uk/mackay/itila/

15:29 kryft: I wonder why I inserted that last comma.

15:29 gfrlog`: *drumfill*

15:29 gfrlog`: :)

15:30 matthias__: 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:30 kryft: cemerick: Yeah, MacKay's book is great too.

15:30 ejackson: and you can read on your screen free of charge, which is a plus. A bit more mathsy, calculation wise, though.

15:30 clojurebot: You don't have to tell me twice.

15:30 gfrlog`: matthias__: sounds weird. can you show us the code?

15:31 ejackson: cemerick: oh dear, you bought it already !

15:32 matthias__: http://pastebin.com/twBLSNT8 there it is, gfrlog`

15:33 i only put the double in to test, the nullpointerexception comes somewhere out of rotation-matrix without it

15:34 gfrlog`: matthias__: so you're saying that (double (:player-angle state)) throws an exception?

15:35 matthias__: yeah

15:35 gfrlog`: ,(double (:player-angle {:player-angle 0}))

15:35 clojurebot: 0.0

15:35 matthias__: the same code used to work actually...

15:36 and :player-angle is in the map. at least it is at the time of the breakpoint

15:36 cemerick: ejackson: I'm sadly fast and loose with the book purchases. I've got four heavy-hitters waiting for me on my desk already. :-/

15:36 gfrlog`: 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:36 ejackson: cemerick: you and me both :)

15:37 gfrlog`: matthias__: and see what it spits out

15:38 matthias__: or check the type using your swank voodoo :P

15:38 matthias__: omg

15:39 ejackson: cemerick: so, being nosy, what are these Barry Bonds Books ?

15:39 matthias__: im an idiot, thanks gfrlog` :S

15:39 gfrlog`: anytime

15:43 cemerick: ejackson: Pearl's Causality is the most serious one

15:44 Also, Hopcraft and Ullman's Automata Theory (1979 ed)

15:44 ejackson: i've not read that one.

15:44 * ejackson scampers off to discover Hopcraft

15:45 cemerick: ejackson: http://t.co/TyLvDnQ

15:46 The later editions are apparently pretty watered down

15:47 I can get hand-wavy stuff anywhere, so I wanted to get the authoritative, rigorous approach

15:50 amalloy: gfrlog`: c'mon, you missed a perfect chance to use juxt

15:51 (prn ((juxt identity type) (:player-angle state)))

15:51 gfrlog`: amalloy: I was trying to figure out if you were on or not

15:51 amalloy: very clever scheme

15:52 and what you discovered was that for fifteen minutes i wasn't

15:52 gfrlog`: yep

15:54 (defn make-vector-from-three-fns-and-two-args [f g h x y] [(f x y) (g x y) (h x y)])

15:54 * gfrlog` waits

16:11 rbuchmann: ,(update-in '(1 2 3 4) [1] #(+ 1 %))

16:11 clojurebot: java.lang.NullPointerException

16:12 rbuchmann: What do I miss here...? O_o

16:12 amalloy: vectors aren't lists

16:12 er, other way round: lists aren't vectors

16:12 &(update-in [1 2 3 4] [1] inc)

16:12 sexpbot: ⟹ [1 3 3 4]

16:13 rbuchmann: so, if I want to do that on a general sequence I have to do (vec ..) first=

16:13 ?

16:14 If I have to update something in a nested sequence of lists, what do I do?

16:15 *list of lists

16:16 turning it into a zipper or the like seems like overkill

16:17 seems a little silly that update-in doesnt work, considering stuff like nth is well defined

16:19 amalloy: rbuchmann: update-in is supposed to be fast

16:20 it only works with Associative

16:20 those are both good reasons not to make it work for lists

16:20 rbuchmann: hm, okay

16:20 So how would I go about updating a nested list?

16:20 raek: by index?

16:20 then you want nested vectors

16:21 lists/seqs are not the right data structures for random access and updates

16:21 rbuchmann: hm, and if I have stuff in the generation process that returns lazy seqs? should I always (vec ...) it then?

16:22 raek: if you choose vectors as you representation, then yes

16:22 *your

16:22 rbuchmann: okay, thanks

16:25 I was working on http://4clojure.com/problem/43 , but I guess I am on the wrong track :D

16:26 * gfrlog` decides to find out if 4clojure only tests the given examples

16:27 rbuchmann: I believe it does

16:27 * gfrlog` is going to solve the problem by hard-coding the test cases

16:27 rbuchmann: :)

16:28 that wasn't exactly what I had in mind ^^

16:28 gfrlog`: I'm hoping it will crash the site

16:28 raek: isn't the number given as the second argument always the length of the input list?

16:29 gfrlog`: raek: on prob-43? no...

16:29 raek: er, I kinda looked at this in a mirrored way

16:31 gfrlog`: rbuchmann: got it! https://gist.github.com/1059331

16:31 rbuchmann: haha

16:31 nice

16:31 gfrlog`: there was a bug in it the first time, but I fixed it

16:32 derp__: why doesn't this code work?

16:32 ,(do (def a (fn [] ({:b "test"}))) (a :b))

16:32 clojurebot: DENIED

16:32 gfrlog`: derp__: ##({:b "test"})

16:32 sexpbot: java.lang.IllegalArgumentException: Wrong number of args (0) passed to: PersistentArrayMap

16:32 gfrlog`: you're calling a map with no args

16:32 maps want a key :)

16:33 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:33 rbuchmann: actually there oughta be a mildly cleverer way to do it...

16:33 rbuchmann: should be ((a) :b)

16:33 derp__: ah

16:33 raek: derp__: 1) you call a with one arg, but it accepts zero 2) you call the map {:b "test"} as a function

16:34 amalloy: gfrlog`: for a while we did have hidden tests

16:34 but they confused a lot of users, and we don't really care if losers like you hard-code the test cases

16:34 gfrlog`: amalloy: your site didn't say I was a loser

16:34 amalloy: it's in an html comment

16:34 gfrlog`: oh okay

16:34 derp__: well I what I want to do is create a function that returns a dynamically made map

16:35 gfrlog`: derp__: why dynamically?

16:35 derp__: why not (constantly {:foo "bar"})

16:35 (I guess I mean your example sure didn't seem dynamic -- it seems like a constant function)

16:36 rbuchmann: I guess it was meant as a theoretical example

16:36 gfrlog`: rbuchmann: this is a bit cleaner: https://gist.github.com/1059341

16:37 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:37 rbuchmann: amalloy: you're involved in that site? nice, I like it

16:38 amalloy: rbuchmann: if you're interested you can see a lot of neat solutions by searching for #4clojure on twitter

16:38 derp__: gfrlog: thank you!

16:38 gfrlog`: derp__: yessir

16:40 raek: there, #43 solved :)

16:40 amalloy: rbuchmann: *spoiler* my favorite solution is https://gist.github.com/1059351 (i didn't come up with it, but saw it on twitter)

16:40 gfrlog`: amalloy: have you ever tried to solve each problem with juxt?

16:40 rbuchmann: amalloy: aaah, I got to partition, but couldn't see how to use it effectively after that

16:40 that ones very nice

16:40 * raek does suddenly not feel like sharing his solution anymore...

16:41 rbuchmann: haha

16:41 yes, mine is a *tad* longer too

16:41 raek: https://gist.github.com/1059347 well, here it is

16:41 *spoiler* etc

16:41 amalloy: raek: 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:42 and then i was ashamed

16:42 rbuchmann: hehe

16:45 amalloy: *chuckle* raek, i like how you were careful enough to doall, just in case

16:46 raek: :-)

16:49 amalloy: ...but you would get a StackOverflowError if you called it with (range 10000) and 1 otherwise!

16:49 amalloy: exactly! good save

17:24 hippytaf1: hi..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:25 I'd rather spend my sparce free tim with lisp than python or c

17:26 having read a this http://www.gigamonkeys.com/book/

17:26 clojurebot: I think you mean gnir.

17:26 amalloy: hippytaf1: maybe technomancy's emacs-starter-kit?

17:26 hippytaf1: thanks bot

17:26 got a link amalloy

17:26 ?

17:27 technomancy: hippytaf1: there's clojurebox, but as far as I know it's pretty dated and windows-only

17:27 amalloy: $google emacs technomancy emacs-starter-kit

17:27 sexpbot: First out of 865 results is: technomancy/emacs-starter-kit at master - GitHub

17:27 https://github.com/technomancy/emacs-starter-kit/blame/master/starter-kit-lisp.el

17:30 hippytaf1: thanks sexpbot, that seems like some source code though :)

17:31 appreciate the link though...always amazes me how compact lisp source code is

17:32 technomancy: thanks dude, just looking for an easy way to set up the environment so I can learn the language :)

17:33 for me on linux I can try to learn python quite easily, but I have seen that lisp is far superiror even than c

17:34 bash is fairlt simple and all precedural languages are learnable, but lisp has something else...and the syntax makes sense ll

17:34 lol

17:36 gfrlog`: hippytaf1: it's quite the thing

17:38 hippytaf1: defining functions with lisp...there is no nonsense...(defun capitalism-sucks () (format t "yes it does"))

17:38 gfrlog`: it has opened my eyes

17:38 gfrlog`: :)

17:38 hippytaf1: lisp makes sense more than any other language I've looked into

17:39 namely python, bash and c

17:39 bash is a must for a linux user

17:39 gfrlog`: I like clojure's choice of immutable data structures

17:40 hippytaf1: as opposed to persistent ones?

17:40 gfrlog`: no; they're immutable and persistent

17:41 I like both parts

17:41 hippytaf1: ah i see

17:41 and that makes sense to me

17:41 define something and it is defined

17:41 and then use what is defined

17:44 not ephemerial

17:45 anyway...a tutorial about setting up an ide for coljure and then

17:46 I'll bugger off :)

17:46 technomancy: hippytaf1: the swank clojure readme combined with the leiningen tutorial will get you pretty far

17:46 gfrlog`: the eclipse plugin is called counterclockwise

17:47 hippytaf1: technomancy: got a link?

17:47 and then I will never bother you again

17:47 untill I have another question :)

17:49 gfrlog`: hippytaf1: googling "swank clojure readme" leads to https://github.com/technomancy/swank-clojure

17:50 hippytaf1: gfrlog`: thanks...did google it, and yes, I was being lazy asking for a link :)

17:52 thanks guys

17:52 gfrlog`: yessir

17:55 ,(numerator 5/1)

17:55 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Ratio

17:55 hiredman: interesting

17:55 gfrlog`: I figured there'd be a clojure.core/ratio to help me out...

17:55 hiredman: I wrote numerator so that could be my fault

17:56 I guess

17:56 gfrlog`: ha

17:56 is there a way to coerce to ratio?

17:56 __name__: ,(ratio 1 2)

17:56 clojurebot: java.lang.Exception: Unable to resolve symbol: ratio in this context

17:56 __name__: ,(/ 1 2)

17:56 clojurebot: 1/2

17:56 gfrlog`: __name__: ##(type (/ 2 1))

17:56 hiredman: ,(map bean (.getConstructors clojure.lang.Ratio))

17:56 sexpbot: ⟹ java.lang.Integer

17:56 clojurebot: ({: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:56 hiredman: ,(clojure.lang.Ratio. 5 1)

17:57 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigInteger

17:57 __name__: ##(type (/ 1 2))

17:57 sexpbot: ⟹ clojure.lang.Ratio

17:57 hiredman: ,(clojure.lang.Ratio. (bigint 5) (bigint 1))

17:57 clojurebot: 5/1

17:57 gfrlog`: hiredman: those are viable options; thanks

18:04 hippytaf1: technomancy: missed the leinigen tutorial bit earlier...

18:04 bookmarked for the next time I a get a significant space of free time :)

19:31 duck1123: What'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:39 Scriptor: duck1123: do you mean remove a value from a set? Otherwise sets aren't really supposed to have an order

19:39 so pop has no meaning when it comes to sets

19:40 duck1123: what I wanted to do was just remove one element at random from the set

19:40 Scriptor: ah

19:40 duck1123: the modified set goes back in the ref, and the removed item is returned

19:40 I got it working, but it doesn't seem very elegant

19:41 I'll probably replace it with an ordered queue of some sort, but I want to maintain uniqueness

19:42 and really, I don't care too much about the order if it ever gets to this point

19:42 ampleyfly: (disj s (rand-nth (seq s))) perhaps

19:42 duck1123: that's basically what I have, but I just used first

19:43 ampleyfly: well, isn't the set ordered somehow?

19:43 hiredman: why not use a queue and a set?

19:43 duck1123: hiredman: how do you mean?

19:44 hiredman: pushing is: check if in set, if not alter set to contain and alter queue to contain

19:44 poping is peek+pop+disj

19:45 duck1123: Here'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:45 that's basically what I have right now

19:46 hiredman: with the set to keep form queueing the same thing over and over?

19:46 duck1123: I have the added complication that I have a map of sets

19:46 right, I only really need to discover the user once

19:57 Scriptor: what's the general differences between functions and their * forms?

19:57 like, list and list*, and fn and fn*

19:57 wait, ignore the fn*

19:58 amalloy: the * forms are different :)

19:58 hiredman: foo* can be used to implement foo

19:58 Scriptor: ah, so it's the more abstracted version?

19:58 amalloy: Scriptor: hiredman's definition is the most common, but not everyone uses it

19:58 less abstracted

19:58 Scriptor: right

21:00 bdesham: anyone know of a good tutorial for getting nailgun working with MacVim?

21:35 hiredman: dnolen: is there a way to make a logic var that only unifies with objects of a particular type?

21:48 I'd like to be able to do something like ^Symbol ?a and have ?a only unify with symbols

21:51 dnolen: hiredman: 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:54 hiredman: 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:57 hiredman: er, now that I think about it you can do what you want with project, but it's a bit verbose.

21:57 (project [v] (== (type v) Symbol))

21:57 hiredman: :/

21:59 dnolen: hiredman: you could always hide that behind your own goal fn tho, so you can write, (typeo v Symbol)

22:00 (defn typeo [x t] (project [x] (== x t)))

22:00 hiredman: right, thanks

22:02 dnolen: hiredman: 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:03 (typeo v Symbol) (== v 'a) would not fail for example.

22:11 hugod: I just pushed a real 0.6.1

22:17 hugod: dnolen: thanks :)

22:17 dnolen: hugod: np

22:17 hugod: now I have no excuse to get going

23:42 amalloy: so 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:47 of 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

Logging service provided by n01se.net