#clojure logs

2010-09-06

00:10technomancyseancorfield: also: lein tasks have to have an ns form to be actual tasks
01:00notsonerdysunny~pastebin
01:00clojurebotGabh mo leithscéal?
01:11Raynesnotsonerdysunny: gist.github.com is a popular choice.
01:38notsonerdysunnyRaynes: thx ..
02:12tnoborioThe communication has not been so understood well about ctor problem.
02:13tnoborioI wrote sample Java Class. http://gist.github.com/565876
02:15tnoborioI wrote sample class Hoge instead of java.io.File.
02:15tnoborioThe result is the same.
02:54seancorfieldtechnomancy: i have
02:54seancorfield(! 797)-> cat leiningen/hello.clj
02:54seancorfield(ns leiningen.hello)
02:54seancorfield(defn hello "I'm just a plugin that says Hello."
02:54seancorfield [project] (println (str "I'm a leiningen plugin that says Hello " (:name project) "!")))
02:54seancorfieldit works in lein help hello
02:54seancorfieldand lein hello
02:54seancorfieldbut doesn't show in lein or lein help
02:54seancorfieldjust fyi
04:32esjHello Peoples
06:16fliebelmorning
06:18mrBlissmorning
06:19esjwotcha
06:26bartjchouser, thank you for lazy-xml -> it is unbelievably simple and makes dealing with xml fun!
06:27fliebelAre there some sanity checks I can perform on my own Clojure code? I'm trying to revive my Clojure skills with a lot of exercises, and since I don't have anyone to look after me all the time, I might be writing bogus code :) Things I'm already doing: Unfolding nested code, making fns of repetitive things, try to look for existing functions to replace my plumbing and hang in here a lot.
06:28RaynesI've always found it odd that XML is represented so differently from JSON in Clojure. Is there any particular reason for that? You use zippers to traverse XML, but JSON is transformed directly into Clojure maps and data structures by the parsers.
06:29fliebelRaynes: Might be that the lazy SAX parsrers suit zipping better.
06:30RaynesI didn't think of that.
06:30RaynesLaziness.
07:10opqdonutwhat's the simplest way to call a clojure function from java
07:10opqdonutpreferably by name
07:11opqdonutbasically, I have a class written in Java, but I'd like to keep the implementation of one method on the clojure side
07:12Chousukethe RT class in Clojure has useful methods
07:12Chousukeyou can use those to get the var of the function you need and then call invoke on it
07:13Chousukethere's no documentation, but it shouldn't be too difficult to understand if you just read the source file
07:13raekhttp://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Invoking_Clojure_from_Java
07:17opqdonutrelatedly, what's the opposite of slurp?
07:17mrBlissspit
07:19Raynes-> (doc spit)
07:19sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/spit)
07:19RaynesOf course.
07:19opqdonutah
07:19opqdonuthmm, that's only in 1.2 right?
07:20RaynesIn 1.1, it's in seq-utils.
07:21RaynesErrrrr, not seq-utils.
07:22RaynesIn 1.1, it's in duck-streams.
07:23raekwhat was clojure.contrib.io? half way from clojure.contrib.duck-streams to clojure.java.io?
07:23Raynesraek: It was originally just duck-streams renamed.
07:27opqdonutthanks
07:52Dranikhello all!
08:08bartjI think emit in clojure.contrib.lazy-xml always emits to the stdout
08:08bartjis there a function which will store the "emit" to a variable instead ?
08:14bartjI am looking at http://github.com/richhickey/clojure-contrib/blob/bbe248f90e6ec33d5e85d2267fa1caf8c7cb99a7/src/main/clojure/clojure/contrib/lazy_xml.clj
08:17grc (pop (list)) throws an exception as the docs state that it should, but
08:17grc (pop (java.lang.PersistentQueue/EMPTY)) returns a PersistentQueue. What
08:17grc am I missing?
08:23jgracinbartj: with-out-str macro captures all output and returns it as string.
08:26bartjjgracin, big thanks
08:44bartjer, there is no "ignore" option while inserting records in clojure.contrib.sql ?
08:44bartjie. if there are duplicate rows, I would like to over-ride the existing rows ?
08:48bartjhmm, update-or-insert-values does the job
09:14bartjsilly question
09:15bartjI feel the "insert-values" method in clojure.contrib.sql should also support a "ignore clause"
09:15bartjapart from forking the file, what I can I do to ask the author (scgilardi) to include it ?
09:25raekbartj: you could create a ticket for it at the clojure-contrib assembla space
09:26raekif you have signed the Contributor Agreement, you can send in a patch for it too
09:28bartjraek, thanks!
09:36bobo_has anyone thought about submiting a talk to jfokus? (swedish java conferance)
10:54technomancyseancorfield: weird; I tried that exact same thing and it works here
11:00seancorfieldthx technomancy i'm sure i'm just doing something wrong
11:41blais(let [b (ref nil)] (dosync (ref-set b b)))
11:41blaisWill generate a stack overflow. Why won't Clojure let me create circular refs?
11:42LauJensen blais: a reference is a mutable thing, putting a mutable thing inside of a reference is redundant, as the security that the ref was supposed to provide is now void
11:43AWizzArdblais: Not that I want to defend the current behaviour, but why do you need it?
11:43LauJensen(let [b (ref nil)] (dosync (ref-set b @b))), would work and is what you'll se in most applications
11:45blaisAWizzArd: just messing around. OTOH I do have a legitimate need for circular references in some piece of code (parsing a language, wanting to refer to parsed type definition objects, which may be recursive).
11:45AWizzArdblais: refs may contain other refs.
11:45blaisAWizzArd: CL lets you do it.
11:45AWizzArd,(let [a (ref nil), b (ref nil)] (dosync (ref-set a b)))
11:45clojurebot#<Ref@1e0937b: nil>
11:45blaisNo way to do it without refs?
11:45LauJensenblais: Did you understand what I wrote above?
11:46blaisYes.
11:46AWizzArdblais: you most certainly will not need this. Refs can contain other refs, and this should work for practical cases.
11:51blaisLet me define the problem another way: I'm creating a DSL which defines various types. Each of these types may refer to each other. In the first pass I tag such references and do a bit of validation (I don't want to force the user to define types in a particular order). In a second pass, I will resolve the type references. This will create a circular data structure.
11:51blaisHow would you approach this problem without creating temporaries?
11:57blaisAWizzArd: your example is not circular.
11:57blais,(let [a (ref nil) b (ref a)] (dosync (ref-set a b)))
11:57clojurebot#<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@101ba6f: #<Ref@16eb456: #<Ref@
11:57blaisThis one was.
11:57blaisResults in StackOverflow.
11:57blaisI suppose ref-set attempts automatically resolve a ref when it is provided one.
11:58LauJensen,source ref-set
11:58clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
11:58LauJensensource ref-set
11:59LauJensen~source ref-set
11:59msapplerhey anybody else developing an action/rpg diablo kind of game in clojure?
11:59blais(This clojurebot is fun.)
11:59msapplerI am willing to share code / experience ;)
12:03AWizzArdblais: btw, there is no stack overflow
12:04AWizzArdI forgot, just remembered.
12:04AWizzArdYour code worked.
12:04AWizzArdBut, your repl tries to print the result.
12:04AWizzArd,(let [b (ref nil)] (dosync (ref-set b b)))
12:04clojurebot#<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@163fa09: #<Ref@
12:04AWizzArd,(let [b (ref nil)] (dosync (ref-set b b)) 55)
12:04clojurebot55
12:04AWizzArdJust make sure you work with those refs, but don't try to print them.
12:05AWizzArd,(let [b (ref nil)] (dosync (ref-set b b)) (class @b))
12:05clojurebotclojure.lang.Ref
12:05AWizzArd,(let [b (ref nil)] (dosync (ref-set b b)) (= b @b))
12:05clojurebottrue
12:07blaisAh! Thx AWiz. The docs for *print-circle* indicate it's not used yet.
12:07blaisWow, this is useful for CLers learning clojure: http://hyperpolyglot.wikidot.com/lisp
12:10AWizzArdblais: yes, though it is not very correct in respect to Clojure.
12:10AWizzArdRunning in emacs can also be done via M-x slime
12:11AWizzArdMaking a standalone is possible. Though typically you can simply compile it to a double-clickable .jar file (vs .exe).
12:12AWizzArdblais: it says CL is not case-sensitive, which is wrong. CL *is* case-sensitive, but also case-translating.
12:13blaisAWiz: looks like a wiki page, feel free to amend.
12:16AWizzArdblais: good point
12:22AWizzArdblais: unfortunately I can not edit it. But it contains tons of litte errors.
12:35bartjAWizzArd, case-translating ? that is the first time I heard that word!
12:38AWizzArdbartj: comes directly from the mouth of Kent Pitman
12:39bartjAWizzArd, can you please be kind enough to explain what it means ?
12:40bartjyou mean it has built-in functions to convert to camel-case, etc?
12:42AWizzArdbartj: it means that CL per default translates everything to upper-case.
12:43bartjAWizzArd, would that affect me as a programmer ?
12:43AWizzArdIn Clojure this would work if the reader would call .toUpperCase on the input, if it does not find something that stops it from doing so.
12:44bartjAWizzArd, I mean how would this feature (case translation) help CL users ?
12:45AWizzArdHistorically LISP was used on machines that only supported uppercase chars.
12:45AWizzArdFor better compatibility this case translation was built into CL.
12:46AWizzArdIn principle it does not affect you, if you don't use specific reader macros.
12:47blais,(seq? {})
12:47clojurebotfalse
12:47blais,(seq? [])
12:47clojurebotfalse
12:48blais,(seq? '())
12:48clojurebottrue
12:48blaisWhat is the idiomatic way to verify that an object is a sequable?
12:48AWizzArd,(coll? {})
12:48clojurebottrue
12:48blaisHa.
12:48blaisThx.
12:48AWizzArd,(map coll? [{} [] ()])
12:48clojurebot(true true true)
12:49AWizzArd{} and [] don't implement the ISeq interface.
12:49blaisYa, exactly what I'd been looking for.
12:52blaisWhat's the idiomatic way to check that an object supports the map interface?
12:52blais,(type {})
12:52clojurebotclojure.lang.PersistentArrayMap
12:52blaisHmm.
12:53emh,(map? {})
12:53clojurebottrue
12:53blais*blush*
12:54blais(Thought I'd tried that a second ago.)
12:56blaisSomebody ought to write a book like the Little Schemer for Clojure. Would be awesome.
13:26blaisIs there an idiomatic way to check that an object is of a specific type, as created by defstruct?
13:27hiredmandefstruct doesn't create types
13:27blaisI see a trick in the clojure libraries, to use a field as a type market.
13:27blaiss/market/marker/
13:27sexpbot<blais> I see a trick in the clojure libraries, to use a field as a type marker.
13:27hiredmanit creates maps that may be more efficient when sharing the same keyset
13:28blaisYep, but... how do I check that an object I receive is of that type?
13:28blaisOh, there is no type.
13:28blaisHmm.
13:28blaismap? returns false for those objects.
13:29hiredman,(map? (struct (create-struct :foo) 1))
13:29clojurebottrue
13:30blaisI'm using struct-map.
13:31hiredman,(map? (struct-map (create-struct :foo) :foo 1))
13:31clojurebottrue
13:34blaisAaaah got it. An error on my side, had misused create-struct vs. struct.
13:41nlogaxwhen i'm messing around in the (lein) repl, and start a jetty server via compojure for example, can i interrupt it without getting thrown out into the shell?
13:45bobo_nlogax: you want the shell to return after starting jetty?
13:45bobo_then join? false is what you want
13:46bobo_http://gist.github.com/555465 like that
13:48nlogaxbobo_: i was thinking more like killing jetty and returning to the repl (instead of everything dying, leaving me in bash). but that might do the trick, thanks!
13:49bobo_nlogax: http://github.com/swannodette/enlive-tutorial/blob/master/src/tutorial/template1.clj
13:50bobo_if you look at the bottom, you can see how to be able to start/stop the server
13:50nlogaxcool, thanks again :)
13:50bobo_:-)
13:53raek,(type ^{:type :foo} {:a 1, :b 2})
13:53clojurebot:foo
13:54raekblais: ----^
13:55raektype is define as something like this: (defn type [x] (or (:type (meta x)) (class x)))
13:58blaisraek: nice. Thx.
14:01blais,(let [a '(typereff nil)] (= (first a) 'typereff))
14:01clojurebottrue
14:01blais,(let [a `(typereff nil)] (= (first a) 'typereff))
14:01clojurebotfalse
14:01blaisWhat gives? Does syntax-quote do something to my symbols?
14:02raekyes
14:02raek,`conj
14:02clojurebotclojure.core/conj
14:03raekthis is for avoiding symbol capture
14:04raek,`(~'typereff nil) ; possible, but not something that one normally should need to do
14:04clojurebot(typereff nil)
14:05blaisA bit of a gotcha...
14:06raekthat is, there is most probably a better way to do it
14:07blaisI'll try to use a keyword. The 'typereff in the example above is used to tag some parts of a larger datastructure for future processing.
14:08chouseror just use `typereff when you go to compare it
14:08raekyou could use ordinary quote or list
14:08chouserthat way you get a nice namespaced symbol - less chance of accidental collision
14:08raektrue
14:09raekthe use case looks much more of the one of keywords...
14:09blaisOh, good point.
14:09raeks/of/like/
14:09sexpbot<raek> the use case looks much more like the one like keywords...
14:09blaisThx chouser.
14:09chouseryou can namespace keywords too, if you want.
14:09chouser,::foo
14:09clojurebot:sandbox/foo
14:10blaisAaaaaha _that_'s what this is. I had seen those in the contrib module, had no idea. Thx.
14:39blaisThis is getting a bit confusing, w/ cons vs. lists now:
14:39blais,(list? '(:typeref int32))
14:39clojurebottrue
14:40blais,(list? `(:typeref int32))
14:40clojurebotfalse
14:40blais,(type '(:typeref int32))
14:40clojurebotclojure.lang.PersistentList
14:40blais,(type `(:typeref int32))
14:40clojurebotclojure.lang.Cons
14:40blaisI guess that's why; where's the elegance in this?
14:41blaisIs there an elegant way to check that something is a "list or a cons cell"?
14:42kencauseyAre you sure you care? You should as much as possible code to Sequences and not care which exact implementation it is.
14:42kencauseyOr is this a question of testing for 1 or more than 1?
14:44blaisKen: the problem is this: sometimes creating lists appears to create PersistentList, sometimes (when using `) it creates Cons. It makes it a little tricky to mix-n-match them, doesn't it? Unless there's a way to check for both, and one has to take into account the possibility of either in the routine that processes the output.
14:45blaisI mean, I've just been caught by this one just now, some of my functions use syntax-quote to put lists together, and others don't. Now I have this weird animal made up of PersistentList and Cons objects and I need to process it.
14:45kencauseyright, so perhaps you can explain why you need to know which one it is? It sounds like you are worrying about a problem you don't have. But I could of course be wrong.
14:46blaisI suppose I should be careful how I create it from now, knowing that syntax-quote doesn't return a list.
14:46blaisWhat's the "normal" course of action?
14:47kencauseyI'm a little too inexperienced to answer that, I simply know that for the most part you deal with Sequences and don't have to care whether it is Cons or a PersistentList or even perhaps a Map.
14:48blaisWell I have a generic function that uses (cond) to process a hierarchical data structure, and it does something different for lists and maps. The syntax-quote problem broke it.
14:49kencauseypost some code and maybe someone more experienced than I will be interested in commenting
14:49hoeckblais: maybe you want seq? instead?
14:50hoeckblais: that returns true for anything that prints with normal parens
14:52hoeck,(map seq? [(concat '(1) '(2)) (list 1 2 3) (cons 1 '(2 3)) [] {}])
14:52clojurebot(true true true false false)
14:54blaisThat would work.
14:54blaisThx.
15:30dbergclojure/java newbie here. downloaded clojure and clojure-contrib 1.2. (require 'clojure.contrib.str-utils) a file not found exception is thrown
15:30dbergis that fixed in the CLASSPATH env var?
15:31fielcabralis that a backquote?
15:31fielcabraloh guess not
15:32dbergyou mean before 'clojure.contrib.str-utils?
15:32fielcabralyes
15:33dbergnope, single quote
15:33blaisdberg: What's your setup and how are you attempting to run Clojure?
15:34dbergrunning ubuntu, downloaded 2 zip files for clojure and clojure-1.2
15:34dbergrunning java -jar clojure.jar
15:34dbergmy guess is that somehow it has to access clojure-contrib.jar
15:34blaisRight.
15:35blaisI found invocation of Clojure a little tricky when I started.
15:35blaisTHere are a couple of ways I like to do it:
15:35blais- Use Leiningen, which downloads all the libraries for you.
15:35blais- Write a script that invokes java --like you did-- with all the jars you need.
15:36dbergleiningen is a buil tool then
15:36chouserbut don't try to use -jar or $CLASSPATH, generally.
15:36blaisThe second way is when I'm done; when I'm developing I use the "lein swank" command and evaluate from Emacs.
15:37blaisleiningen also downloads all the dependencies you need. If you're on a fast network connection it's probably the easiest way to get setup.
15:37blaischouser: why not?
15:37dbergnice, checking it now
15:38blaischouser: driving manual, works great when I need it, no magic. Simple. What's wrong with it?
15:38chouseravoid $CLASSPATH because any command-line args (like -cp or -jar) override it
15:38dbergohhh, I see
15:38chouseravoid -jar because you can only specify one -- it overrides everything else
15:38dbergI was trying to set it without success
15:38chouserif you know what you're doing, you can make things work with any of them, but it's var simpler (especially when starting) to only use -cp
15:43fielcabralCould you share a good mnemonic/tip for remembering what comes after :require or :use in the ns form?
15:44technomancyfielcabral: rauol: require/as, use/only, lol.
15:44fielcabral:-)
15:44LauJensentechnomancy: you still not getting query windows?
15:45technomancyLauJensen: no, it's working; I just sat down.
15:45LauJensenI thought you worked standing up
15:46technomancytrue, but it's a holiday in the US
15:46technomancyso to celebrate I am sitting down. =)
15:47LauJensenFantastic :)
16:01pcc1for some java interop I need to set the contents of a specific java collection object to the contents of a seq. is there a builtin way to do this?
16:03rainerschusteri'm REPLing around with clojure-clr. can someone give me a hint on how to call a func in a STA in order to launch a WPF window? i grep ed the source, the samples, the group ...
16:07LauJensenpcc1: I suppose your java collection has an 'add' function you can call and pass it the seq? (.add obj seq)
16:08pcc1LauJensen: I meant something like (doto obj (.clear) (.addAll seq)))
16:09LauJensenor just (doto obj .clear (.addAll seq))
16:11pcc1LauJensen: yes, that works, thanks
16:11blaisClojure core already defines atom? as (not (coll?)). If I redefine as (defn atomp [x] (= (type x) clojure.lang.Atom)), is that heresy?
16:12blaisAn integer is (not (coll?)), that doesn' tmake it an atom. Not sure I understand the rationale.
16:12fielcabralcoll?
16:12clojurebotReader syntax of collections has gotchas
16:13LauJensenblais: There's atom in the english sense, and then there's atom in the clojure.lang.Atom sense. What you're suggesting probably makes sense for your app domain, but the -p predicate isn't seen in Clojure-land - In fact I frown upon it :)
16:13LauJensenWhat you can do is refer clojure.core and rename atom? to core-atom?) and then define your own atom?
16:14blaisRight, not an idiomatic name. I was just thinking of using atoms as temp storage (OMG mutable data structurrrrs!) instead of my two-step process for parsing. In my second pass I'll "change" (OMG!!!!!) the atoms.
16:15blaisSo I need to check for atoms, and I found that definition of atom? from core, not coll?, weird, anyone knows why?
16:15blaisLau: thx. I'll avoid the -p's.
16:17LauJensenblais: I know that the OMG was very popular in Ruby circles, but in Clojure it never got further than the p predicates :)
16:18blaisHahaha :-)
16:23LauJensenMan I wish I had more money to buy impressive Apple hardware: http://www.youtube.com/watch?v=iaz63L8x0Z8
16:44rainerschustersomebody using the CLR version?
17:02kotarakweren't types suposed to support mutable fields?
17:03kotarakok. never mind
17:04raekI think there is a volatile-mutable metadata key
17:04raekhttp://efreedom.com/Question/1-3132931/Mutable-Fields-Clojure-Deftype
17:05raekI don't know if this still works though
17:05kotarakraek: found out that ^:keyword doesn't work. Which is a pity (on a first sight). Have to use ^{:keyword true}  instead
17:15raekhow is test namespaces related to the namespace-under-test nowadays?
17:15raeke.g. what would be the test namespace for foo.bar.x?
17:21raekI know it used to be foo.bar.test.x, but I think heard that it had changed...
17:30technomancyraek: if you don't use clj-stacktrace I recommend foo.bar.test-x since clojure.stacktrace makes it hard to distinguish between foo.bar.x and foo.bar.test.x in some cases
17:30technomancybut yeah... you should use clj-stacktrace
17:30technomancythen it's not an issue
17:37raekyes, that convention was what I was looking for... thanks!
17:46AWizzArdblais: how is it going so far?
17:59raek,(into {} (for [x ['() () nil], y ['() () nil]] [[x y] (= x y)]))
17:59clojurebot{[() ()] true, [() nil] false, [nil ()] false, [nil nil] true}
18:00raek,(= [1 2 3] '(1 2 3))
18:00clojurebottrue
18:00raek,(= [] ())
18:00clojurebottrue
18:00raek,(= nil ())
18:00clojurebotfalse
18:00raekhrm
18:01seancorfieldtechnomancy: i double-checked and i can't get my new leiningen task to show up in the basic task list / help - even tho' the task runs and lein help hello shows the correct doc stuff
18:02seancorfieldtechnomancy: that's with 1.3.1 snapshot... should i send you the file?
18:33alpheusHaving a little trouble getting protocols. I think a protocol establishes a set of function signatures, where the function chosen at runtime will be discriminated by the type of the first argument and the arity (where type is either a Java class or something set up by defrecord or deftype). Is that about right?
18:34blaisAnyone having problems re-evaluating (ns) directives? I get this, for example: "spit already refers to: #'clojure.contrib.io/spit in namespace: merced.parser". Is there a workaround?
18:37LauJensenblais: That one is a true pain :( (:use [clojure.contrib [io :exclude [spit]]]) . I dont know why it simply doesn't give the warning
18:47blaisLau: thx, but it's still not happy.
18:47blaisI'll have to reboot by VM.
18:48blaisOH
18:48blaisYes, I see.
18:48blaisReboot VM, use with exclude. Ta-daa. Thanks,
19:07pdk,(* 3 2.58)
19:07clojurebot7.74
19:08pdk,(* 2 2.58)
19:08clojurebot5.16
19:09pdk,(* 2 1.74)
19:09clojurebot3.48
19:11pdk,(+ (* 7 2.58) 2.44 (* 2 1.78))
19:11clojurebot24.060000000000002
19:23fielcabralHi all. Is there an easier way to do this? I want to write a function like this: (defn place-chooser [like-speed? like-type? not-banned?]
19:23fielcabral (fn [place] (and (when like-speed? (like-speed? place))
19:23fielcabral (when like-type? (like-type? place))
19:23fielcabral (when not-banned? (not-banned? place)))))
19:23fielcabral
19:23fielcabralI want to return a function that and's the three preds.
19:24fielcabralbut the three preds could be all nil
19:24fielcabralis there a way to combine them?
19:24ssiderishow about using [& preds] as the parameter
19:24ssiderisand then iterate over the passed predicates
19:25fielcabrallike a do kind of loop?
19:25ssiderisit would not limit it to 3... but still
19:25ssiderisI suppose it would be a loop/recur
19:25fielcabralor apply?
19:26fielcabrali'll try that, thank you
19:42brianstamand(+ 1 2)
19:42clojurebot3
19:45chouserfielcabral: in your example, nil for any of the preds means the fn will return nil, doesn't it?
19:45brianstamandWhenever I call .setForeground for a JLabel, or .setText, within a (proxy [ActionListener] the program actually runs as expected but the REPL returns a bunch of exceptions. Anyone know what is going on here?
19:46brianstamandEverything actually works just fine but when the ActionEvent occurs like 50 lines of Exception text scroll past in the REPL.
19:49brianstamand(def x "hello")
19:49brianstamandx
19:57bortrebI think clojure is just awesome :)
19:58bortreb,(+ 1 2)
19:58clojurebot3
20:02ssiderisbrianstamand: not that I'll know the answer, but what kind of exceptions do you get?
20:06brianstamandssideris: null pointer exception
20:06brianstamandIt seems that I'm passing an empty list to java somewhere
20:07brianstamandand then clojure just prints the exception and keeps executing the code - so the code works fine but the exception stack trace is printed to the REPL
20:07ssiderisyeah exceptions in general don't necessarily kill your program
20:09brianstamandI've been able to cause the exception to occur by doing, for instance, ((.setText convert-label "hello")). The extra parens cause it
20:10brianstamandNow I just have to figure out which parens are unnecessary in my original program :P
20:21chousertwo open parens together is very rarely what you mean in clojure
20:30brianstamandchouser: yeah, I figured it out. I was under the impression that I had to pass the 2nd argument of (let) a single list. So I had an extra set of parens around all the stuff I wanted let to take. i.e. (let [x y] ((+ 1 2) (+2 3)))
20:30brianstamandThe extra set of parens got passed to java as nil and threw the null pointer exception
20:36dreish`(foo {~@(range 10)}) throws an exception. Is there a better way to do that?
20:36dreishI got it: `(foo ~(apply hash-map (range 10))).