#clojure logs

2011-01-02

00:49auseris there a way, with leningen to specify a dependency that is on github and not in clojars?
00:51auseranyone?
00:51clojurebotPlease do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.
00:52qbgI'm not sure you can add github as a Maven repo
00:52auserokay... well. I'm trying to use leningen to specify a dependency that is on github and not in clojars, how would I go about doing that?
00:52auserhm I see
00:52qbgYou could build the project yourself and do lein install
00:52qbgfor a local install
00:53qbg(or so I hear)
00:54qbgOr you could put the project on Clojars under your own group
00:55auserhm... need to investigate
00:55qbgJust pushed my first project to Clojars a few minutes ago; its really easy
00:55auseroh yeah?
00:57qbgYou could also send a message to the owner of the repo on github and tell them to put it on Clojars themselves
01:00auserthat was easy
01:46dakroneauser: since you are using leiningen, you can use checkout dependencies to do what you'd like as well
01:47auserI can?
01:48dakroneyea, check the "I want to hack two projects in parallel, but it's annoying to switch between them." question on the FAQ, it describes how to use what you'd like
01:48ausersweet
01:48dakroneyou basically create a checkouts directory and symlink projects into it
01:49auserhm, which FAQ?
01:50auseroh wait
01:50auserthere it is
02:48amalloybendlas: ##(some :x (transient {:x 1}))
02:48sexpbotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.PersistentArrayMap$TransientArrayMap
02:48amalloyoh. or i guess just ##(:x (transient {:x 1})) :P
02:48sexpbot⟹ 1
03:26auserso... I'm trying to grok how this works: https://github.com/texodus/saturnine/blob/master/src/saturnine/handler.clj#L137-181
03:38amalloyauser: what part? it looks like it's turning the methods you supply into a map, and then iterating through all the handler types, splicing in either your version or the default
03:39amalloyrather, it splices in your versions, and then all the defaults that aren't covered by your version
03:43auserah i see... hm. I guess i need to research defmacro more
03:45auserI see
03:46auserthanks amalloy
03:47auseramalloy: what is the difference between that and say something with a defprotocol
03:47auserif you don't mind
03:49auserwould it be that that allows you to not implement all the methods?
03:49auserthx
05:06fliebelWhat can I do about this? java.lang.ClassCastException: some.reify cannot be cast to clojure.lang.Named
05:10fliebelNothing, thank you.
08:19Licensercookies
08:54fliebelDoes the author of Lamina, Aleph, Gloss, and a few more brilliant libs come in here?
09:05schizoschafhi all. i'm very new to clojure.
09:05schizoschafI try to return a java object from a clojure function. I get a ClassCastException: cannot be cast to clojure.lang.IFn
09:07raekit looks like you are trying to call the return value as a funcion
09:08raek(also, all clojure values are java objects too)
09:08raek&(StringBuilder. "abc")
09:08sexpbot⟹ #<StringBuilder abc>
09:08raek&((StringBuilder. "abc"))
09:08sexpbotjava.lang.ClassCastException: java.lang.StringBuilder cannot be cast to clojure.lang.IFn
09:19schizoschafthank you raek. you were right
09:22schizoschafi have this:
09:22schizoschaf(if(instance? JpegImageMetadata metadata )(.getExif metadata) metadata )
09:23schizoschafthe instance? gives true. the result of (.getExif metadata) should be returned, but gives the classcastexception
10:18_na_ka_na_hellos, how can I await an agent to finish its work completely sent from many different threads (assuming I'm sure no more sends will be done)
10:23_na_ka_na_I can do: assuming all prior sends have been done, I can do (send agt identity) & then (await agt)
10:24_na_ka_na_one more question: do we _need_ to capture the return value of send ?
10:30_na_ka_na_,(let [a (agent [])] @(future (send a conj 10)) (send a conj 20) (await a) @a)
10:30clojurebot[10 20]
10:30_na_ka_na_Is the above code guaranteed to always produce [10 20] ?
11:47kumarshantanuhi, is it possible to access "this" or "super" inside a proxy?
12:39chouserkumarshantanu: yes, this is called just this
12:41kumarshantanuchouser: yes, thanks...noticed here too -- http://clojure.org/java_interop (under proxy)
12:54amalloy_na_ka_na_: yes, that is guaranteed
13:03_na_ka_na_amalloy, thx so I can assume that send queues the function in the agent queue and then only returns
13:03amalloy_na_ka_na_: yes, send will not return until the agent has queued up your action
13:28raekdoes anyone know how to assert that a certain exception is thrown in lazytest?
13:36qbgdeftype is easy to parse using my syntax-rules library (https://github.com/qbg/syntax-rules/wiki/Parsing-deftype, http://clojars.org/org.clojars.qbg/syntax-rules)
13:39AWizzArdAny ideas about which Keyword fits the following purpose well? I implemented a macro that helps to set up UIs with swing. It adds ui components to a specific container. But some components I don't want to add but just create, for example FileChoosers, or tables (it is instead added to a ScrollPane which then gets added to the container, but not the table itself). What is good? :dont-add :noadd :dontadd something else?
13:40AWizzArd:create-only
13:40AWizzArd:create-but-do-not-add ;)
13:40qbg:create
13:40LauJensen:create
13:41AWizzArd[username-label (JLabel. "Username:")]
13:41AWizzArd[open (JFileChooser.) :dont-add]
13:42AWizzArd[color (JColorChooser.) :create]
13:45AWizzArdSo, :create looks better?
13:45AWizzArdI am just not sure if it puts enough emphasis on the widget not being added to its container.
13:46amalloyAWizzArd: :detached maybe?
13:46AWizzArdalso interesting
13:46qbg[:create color (JColorChooser.)]
13:46qbg?
13:48AWizzArdfor conformity the name of the object and its creation form come first, and then all key/value args and all binary args.
13:49AWizzArdThanks for the inputs, I appreciate it.
13:51LauJensenAWizzArd: :invisible?
13:52AWizzArdAlso an option, yes, good idea.
13:52LauJensenbtw - Im still open for bright ideas for names for my CMS system :)
13:52AWizzArdIs it a Clojure cms?
13:53LauJensenyea
13:53AWizzArdLau-Compose
13:53LauJensenhehe
13:53LauJensenCMSjure :(
13:53qbgTerrible name
13:53AWizzArdYou could think about putting your name in.
13:53amalloyLauJensen, AWizzArd: i don't like :invisible
13:53amalloyit suggests to me that it will be added, with (.setVisible false)
13:54qbgLauJensen: What is special about this CMS again?
13:54AWizzArdContentjure Manajing Sysjam
13:54LauJensenHAHA
13:54AWizzArdamalloy: I think it will be between :detach and :dont-add
13:54AWizzArdBut it is good to have many ideas during a brain storming.
13:55LauJensenqbg: oh its a very special system. You get a simple webinterface, where you upload templates and add pages. A template is simply an html files, which somewhere has a <div class="content">. In the page editor you write markdown and with every keystroke a live preview of the final site is generated. Once everything looks fine, hit generate and you got a nice, easily maintained static site
13:55AWizzArdLauJensen: your name sounds catchy, so it could be a cool component of a name for a piece of software.
13:55LauJensenAWizzArd: I think I'd have to grow my ego a little first :(
13:55AWizzArd*g*
13:56qbg(swap! LauJensen update-in [:ego] inc)
13:56qbgenough?
13:56LauJensenNo - I was thinking of something like "Typo4" or "Drupaljure"
13:58qbgI'd probably name it something terrible like Grinddown
13:59LauJensenGrind sounds a little negative to me
14:01qbgMark 'n Bake
14:01LauJensenhehe, clever
14:01bendlasHai
14:03LauJensenbendlas: My hat is off to you for that pull request from last night, big thanks for your good work!
14:03bendlasGlad to help :)
14:06bendlasGot those projected group-by fields sorted out yet?
14:07LauJensenJust about to dig into it
14:07LauJensenI think I'll just revert my last commit and start over. I've thought of a much more elegant way to handle it
14:08LauJensenThen a little website work in my shiny new unnamed CMS and we're 1.0
14:10krumholthello. can someone explain to me why (def c 'x) (let [x 1] (eval c)) will give an exception: Unable to resolve symbol x
14:10qbgHmm... Interactive MarkDown Baker = IMDB; why does this keep happening?
14:11qbgkrumholt: eval doesn't have access to the lexical environment
14:12krumholtqbg, which environment will eval use?
14:12qbgtoplevel
14:14qbgdynamic bindings work with eval though
14:14qbgThere are some eval-in-env macros out there too
14:14krumholtqbg, ok thanks
14:14qbgIt should be noted that eval is usually the wrong thing to do
14:15bendlasLauJensen, nice. I'm off for the drive to Vienna now. Gonna ping when I'm home.
14:15LauJensenHave a good one :)
14:17krumholtqbg, what else should i use?
14:21amalloykrumholt: it depends on what you're trying to do from a larger perspective
14:22krumholtamalloy, i calculate a function at runtime and then i have an expression like (+ x 15 (* x x)) and eval it with a certain value for x
14:24amalloykrumholt: if you can't avoid constructing the function at runtime (say the user gives it to you), you might try (eval `(let [~'x ~the-x-value] ~user-function))
14:24amalloybut if possible you should try to construct the function at compile time, with a macro or some higher-order function
14:25krumholtamalloy, its not possible at compile time
14:27krumholtamalloy, i'll try that thanks
14:31anarsevening
14:33anarsI don't like the feeling of having nested let forms, so I was wondering whether or not it's frowned upon to actually have them
14:35anarsinstead, is there anything "wrong" with having a let form with bindings dependant on other bindings in the same form? e.g., [url (....) contents (client/get url)]
14:37amalloyanars: your sample is perfectly fine and idiomatic
14:37amalloynested let forms are sometimes needed, and i don't see why they're ugly, but i can't think of any time you'd have them *directly* nested
14:39amalloyeg, (let [foo bar] (when (something foo) (let [baz (inc foo)] (do-something-with baz)))) you can't easily condense, but you shouldn't need (let [a b] (let [c b]))
14:42anarsamalloy, that's exactly what I needed to know. thank you.
14:46chettQuick question
14:46chettsay I have (defstruct foo :bar)
14:47chett(def x (struct foo "bar"))
14:48chettand (defn test [fb] (println (:foo fb)))
14:49chettwhy do i get an error with (tets x)
14:49chett*(test x)
14:49anarsbecause the key is called :bar
14:49anarsnot :foo
14:50chouserwhat error? you should get only nil
14:52chettThanks
14:52chettjust a typo
14:54chouserbtw, there's really no reason to use defstruct anymore with Clojure 1.2 or later
14:54chouserdefrecord generally works better
14:55chett^thanks. Working through examples in Halloway book.
15:13ddudeyIf I have a local .jnilib file can I specify it in project.clj?
15:13ddudeyThx :)
16:39hippiehunterdoes anyone have any good resources to help me understand how order of macro expansion affects other expansions?
16:40amalloyhippiehunter: what do you mean, other expansions?
16:43hippiehunterim not sure, but im having a mental block in understanding macros, order of operations seems like a good place to get clarity
16:46amalloyhippiehunter: well, outside-in. the outer-most macro receives its body as a list; it manipulates that
16:47amalloythat macro will return a new list, which is treated as code; if there are more macros in there, then they'll be expanded when they're gotten to
16:49hippiehunterdoes the hygienic'ness mean I dont have to worry about anything other than outside-in?
16:49amalloyeg, (macroexpand '(m1 (m2))) will return '(something-using (m2)); if you macroexpand that again, then m2 will be expanded
16:50raekhippiehunter: "hygenic" is most often refering to the absence of symbol capture
16:50amalloyhippiehunter: more or less. if you nest macros, or want to get around hygiene, you'll have to do some thinking/fiddling with ~', '~, ~foo#, ~'foo# and the like
16:50raeki.e. no shadowing 'let's
16:51hippiehunterwhat does "shadowing lets" mean?
16:51anarshippiehunter: if you have a global symbol, and you rebind it using let, then that new binding will shadow the global.
16:52hippiehunterhow does that apply to macro's?
16:52raekthe macro can inject a let form
16:53anarson a side note, check this out, hippiehunter: http://java.ociweb.com/mark/clojure/article.html
16:54amalloyhippiehunter: i've never had a case where i care about order of macro expansion
16:54amalloythe one that gets me is the order in which ~ applies when constructing a nested macro
16:54hippiehunterI suppose i may just be injecting assumed complexity
16:55amalloyhippiehunter: try writing some simple macros, like the ubiquitous (square x)
16:55raek(defmacro m [exp] `(let [x 1] ~exp)) ; not allowed in clojure
16:56amalloyand you'll see that macros are "automatically" composable without having to worry about ordering: (square (square 2)) will return 16 just like you expect
16:56raekthis macro does nothing, except when the expression you pass in contains an x
16:56raekin that case, the macro will break that code
16:57raekmacros are just functions (well, almost)
16:58raekthey get some unevaluated code, which they can do whatever they want with
16:58raekand return some new piece of code
16:59raekthen the compiler continues as if that code instead
17:00anarsgood example with the shadowing let, raek
17:00anarsdo you understand why shadowing lets in macros can break your code, hippiehunter?
17:00anarsshadowing bindings in general.
17:04raekI think "symbol capture" is a more common term, btw
17:05amalloyright, because shadowing bindings is more general
17:06raekmore common than "shadowing let", sorry
17:06amalloyah
17:06raekfor this particular thing
17:06hippiehunteranars: I think so, but what does the safety cost? or more specifically why is it allowed in other lisps?
17:07raekclojure macros resolve all symbols
17:07raekso conj becomes clojure.core/conj
17:07Raynesraek: Don't you mean syntax quote?
17:08raekRaynes: yes. good catch
17:08Raynesraek: I was just writing about that in the macro chapter of my book. :p
17:08raekand 'let' does not allow one to let a qualified symbol
17:09raekso you use auto-gensymed symbols in that case to get a unique collision-free name
17:10amalloyhippiehunter: CL and clojure allow the same set of things to happen in macros; clojure mostly chooses a safer default
17:11anarshippiehunter: it's perfectly legal to do, and it will compile just fine. but if you rebind a symbol unintentionally inside a macro, and another function uses the original symbol value, then you're out of luck.
17:11anarsthat is if you're using the binding function to rebind, which causes the symbol to be rebound through the entire call stack
17:11anars,doc binding
17:11clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/doc
17:12amalloy&(doc binding)
17:12sexpbot⟹ "Macro ([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before. The new bindings are made i... http://gist.github.com/762871
17:12anarsthere you have it ;)
17:13hippiehunterso bindings is like a single value let that is specifically for shadowing other names?
17:14hippiehunteror is it multi value
17:14hippiehunternvm, i see now
17:15amalloy&(map macroexpand [`(let [x 10] x) `(let [x# 10] x#) `(let [~'x 10] ~'x)])
17:15sexpbot⟹ ((let* [clojure.core/x 10] clojure.core/x) (let* [x__8744__auto__ 10] x__8744__auto__) (let* [x 10] x))
17:15raek'binding' temporarily gives a var a new value in the current thread. it only works on vars and not on function parameters and locals introduced by let
17:16jkn2can someone explain why using (doall) changes the behavior in this case? http://pastebin.com/yvfQrjaD
17:17amalloyjkn2: the first version returns a lazy-seq that points to *q*, and is forced after leaving the binding scope, when the repl decides to print it for you
17:18jkn2ahh... i keep forgetting htat. the binding scope has already been exited
17:18jkn2thx amalloy
17:21amalloyjkn2: you can do it while maintaining laziness: (let [q *q*] (map ...))
17:46amalloyis there a clojure library around for building some kind of table? i'm working on generalizing --help output from command-line scripts and the text manipulation is a pain
17:50amalloyi just found clojure.pprint/print-table, which i can use in a pinch, but it doesn't do word-wrap or any other kind of handling for strings with newlines in them
17:56BobFunk_anyone here with clojure/appengine experience?
17:57amalloyclojurebot: anyone?
17:57clojurebotPlease do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.
17:57BobFunk_playing around with appengine-magic and have a little app running that works when I run it from the repl, but am getting a strange internal server error when trying to run in with the dev_appserver.sh
17:58amalloyBobFunk_: appengine seems to be a hot topic in here recently. no experience myself, but someone will be by eventually, i expect
17:59BobFunk_am just starting to play around with clojure - suspect my main problem is inexperience with how to debug something like this
17:59BobFunk_seems to be related to https://github.com/alienscience/form-dot-clj
17:59BobFunk_the error I get is java.lang.IllegalArgumentException: No matching ctor found for class form_dot_clj.server_side$maxlength$fn__712
18:00BobFunk_in a huge stacktrace
18:01amalloyBobFunk_: sounds a little like a version mismatch, maybe. are you using the same versions of your libraries locally and on ae?
18:02BobFunk_I haven't actually gotten as far as trying to run it on ae - it's just running the ae servlet locally that breaks
18:02raek(those problems only arise if you use ahead-of-time compilation)
18:03BobFunk_raek: pretty sure its related to AOT compilation
18:03BobFunk_since that's what I'm testing - need to run a lein appengine-prepare task that aot compiles the servlet so it can be pushed to app engine
18:04BobFunk_and it's when testing the result that I run into the illegal argument exception
18:04raekthen you're probably using a lib that is AOT compiled for another clojure version
18:05dthurnQuestion:
18:05BobFunk_hmm, could that happen if the project.clj specifies one clojure version and I have lein installed with another clojure version?
18:05dthurnI see a "thrown?" form referenced here: http://richhickey.github.com/clojure/clojure.test-api.html
18:05dthurnBut it's not in the source or accessible to me
18:05dthurnWhat's going on?
18:06raekno, lein uses its own clojure instance
18:06raekdthurn: the 'is' macro interprets it
18:06raekand translates it into something else
18:07raek(also, the current version of the docs is on http://clojure.github.com/...)
18:07dthurnahhh... magical.
18:08BobFunk_so what could make me end up with a version mismatch?
18:08raekone of the libs you are using
18:09BobFunk_and how would I aproach figuring out which lib has this problem?
18:09raekBobFunk_: you could also try to remove all files in classes/
18:11raekBobFunk_: which clojure version do you have in your project.clj?
18:11BobFunk_1.2.0
18:11raekwhat libs are you using?
18:12BobFunk_my /classes dir is empty - removed everything there, and running the lein appengine-prepare task doesn't seem to generate new classes there
18:12BobFunk_https://gist.github.com/762922
18:12BobFunk_^^^ my project.clj
18:15raekhrm, the form-dot-clj jar file contains only source files and no binaries...
18:17raeksame thing for appengine-magic
18:17raekyou could try removing everything in lib/ and do a lein deps again
18:17BobFunk_hehe - was just doing that! :)
18:18BobFunk_hmm - no luck - removed lib - reran lein deps and lein appegine-prepare, but same error when starting the server
18:20BobFunk_I think this started breaking when I had to rename the app to get the appengine script to be able to upload it to the right place - and my first guess was that I hda some aot compiled classes with the wrong namespace lying around - but after clearing lib/ and classes/ I don't know where any old bytecode could be lying around
18:21raekdo you get this problem locally?
18:21mreynolds*Newb question* Is the Clojure-way of listing files simply to use File.listFiles ?
18:21BobFunk_yeah - both locally and after uploading to appengine
18:22amalloymreynolds: i think so
18:22ossareh:refer-clojure is the shiznitz
18:23raekmreynolds: yes. files-seq and the stuff in clojure.java.io might be useful too, but they are only convenience functions for the java stuff
18:23mreynoldsraek: Yeah, I'm looking at file-seq, but haven't gotten too much further (trying to learn how to use doc from the repl), thanks amalloy
18:27raekBobFunk_: I'm afraid I'm out of advice. this might be something specific to how appengine-magic does it magic.
18:32BobFunk_hmm, got it to work by simply commenting out the form validations - must be a problem specific to the forms-dot-clj library
18:32raekvery strange
18:33amalloyBobFunk_: it is version 0.0.3 - use with caution :P
18:33BobFunk_hehe
18:33mreynoldsCan someone shoot me a valid use of the doc function from the REPL (so I can verify my install isn't screwed up)?
18:34raek,(doc conj)
18:34amalloy,(doc first)
18:34clojurebot"([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."
18:34clojurebot"([coll]); Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil."
18:34raek,(doc clojure.set/union)
18:34clojurebot"([] [s1] [s1 s2] [s1 s2 & sets]); Return a set that is the union of the input sets"
18:34amalloyclojurebot: no fair, raek gets higher priority?
18:34clojurebotTitim gan éirí ort.
18:35raeknote that the namespace containing the var has to be loaded before calling doc
18:38mreynoldsthanks, that seems to work
18:38mreynoldsDoh, forgot () around the syntax, heh
18:39amalloymreynolds: when i don't know what to write, i start with (. it's usually right
18:43hippiehunterIm getting java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol can anyone tell me why? http://pastebin.com/ZmrqHdL5
18:44raekhippiehunter: remove the "defn"
18:44amalloyhippiehunter: deftype shouldn't have defns inside it
18:44hippiehunterjust saw that
18:44hippiehunterthanks
18:45hippiehunterare there any plans for noob friendly error messages?
18:46hippiehunterare does that meta'ness preclude it
18:46hippiehunteror*
18:46amalloyhippiehunter: try "human friendly" :P
18:46npoektophi! i want to do smth like (let [field ...] (set! (. obj field) value)). But . doesnt let me do this.
18:47amalloyhippiehunter: my understanding from reading the dev mailing list is that there are plans in motion but they're early stages still
18:48amalloynpoektop: right, . needs to know the field name at compile time
18:50amalloynpoektop: if you want to hack it, the following might work: (clojure.lang.Reflector/setInstanceField obj "length")
18:52npoektopamalloy: thanks. i'll try that
19:10kanakHi, where do I find out about the major things being worked on for clojure 1.3? (Major things == not bugfixes)
19:13a_strange_guykanak: there is a changelog for alpha 4
19:13a_strange_guyhttp://groups.google.com/group/clojure/browse_thread/thread/59a22dcbc6be628f
19:14amalloydo we have a string padding function somewhere? i can write it myself but it's kinda ugly; i want to pad a string with spaces
19:14Raynesamalloy: Can't format do that?
19:15kanaka_strange_guy: thank you. is pods scheduled for 1.3?
19:16a_strange_guythey still arent in the alphas, so 1.3 will be pod-free
19:16amalloyRaynes: yeah, i guess it can, thanks
19:17a_strange_guy$(+ 1 2)
19:18Raynes&(+ 1 2)
19:18sexpbot⟹ 3
19:18kanakdoes anyone know the status of "Joy of Clojure"? Manning site claims that all chapters are Available but that the book is still in "MEAP". What exactly does this mean? is the book in final form?
19:18a_strange_guy,(format (str "%1$#" 20 \s) "padded")
19:18clojurebot" padded"
19:19a_strange_guyformat strings are as readable as perl...
19:19amalloya_strange_guy: and worse than C's format strings, even :P
19:19Rayneskanak: The book is complete. I'm not sure why it isn't out yet.
19:20amalloykanak: it's going through publishing, i think. supposed to be arriving in hard copy this month or next, i forget
19:20kanakRaynes: complete as in only printing is left?
19:21RaynesI believe so.
19:21hippiehunterany idea why this makes a null pointer exception? (defrecord contact-feed [^{Key () :tag List} entry])
19:22kanakRaynes: thanks. i guess i should get the ebook then. I was waiting until it was in a finished state.
19:22a_strange_guyhippiehunter: do you want to use annotations?
19:23hippiehunteryes
19:23kanakhow does Joy compare to "Clojure in Action" in terms of depth?
19:23a_strange_guye.g. is Key a annotation?
19:23a_strange_guyoh
19:23hippiehunterim trying to type a field as java.util.List with @Key
19:23hippiehunteryeah
19:29BobFunk_still trying to figure out why form-dot-clj library is causing problem with app engine
19:29BobFunk_looking into the error No matching ctor found for class form_dot_clj.server_side$check_integer$fn__721
19:30BobFunk_when I unzip the jar that lein appengine-prepare made I see the form_dot_clj dir with the server_side$check_integer$fn__721.class
19:31hippiehunterare you passing the right number of arguments?
19:31BobFunk_anybody know what can cause the "No matching ctor" error?
19:31amalloyhippiehunter: he's not calling that constructor directly, of course
19:32BobFunk_nopes - using a "def-field" macro from the library that ends up using the function
19:33a_strange_guyhippiehunter: try (defrecord contact-feed [^{Key [] :tag List} entry])
19:33hippiehunterthat got it
19:33hippiehunterwhy though?
19:33amalloyBobFunk_: that class represents a clojure function, specifically a closure; somehow or other it's trying to close over a number of bindings that is different from the number it expected
19:34a_strange_guythe syntax for annotation parameters is [arg arg arg] and not (arg arg arg)
19:34amalloyeg, (let [x 1] (fn foo [] x)) turns into a class "foo" with a one-arg constructor expecting to be passed the value of x
19:35amalloy(let [x 1] (fn bar [] 10)) is a class "bar" with a no-arg constructor
19:35amalloysomehow the compiler, or an AOTed something or other, is passing the wrong number of locals to a closure
19:36amalloyBobFunk_: if nothing is AOTed, that simply shouldn't happen; so i'm going to guess that something is AOTed and we just can't find it
19:36hippiehuntera_strange_guy: why do i see {} https://gist.github.com/377213
19:36BobFunk_really don't get why though
19:38a_strange_guyhippiehunter: dunno, ive nerver used parametrized annotations
19:38amalloydo (format) and String/format really not include a variable-width specifier like C's %*?
19:38a_strange_guyBobFunk_: do you get the "No matching ctor" as a naked error, or wrapped in ExceptionInInitializerException?
19:41BobFunk_in the ExceptionInInitializerException
19:41a_strange_guy&(eval '(+ 1 2))
19:41sexpbotjava.lang.SecurityException: You tripped the alarm! eval is bad!
19:42a_strange_guythis means that somewhere a macro embeds a function in a form
19:43a_strange_guy(defmacro embed [obj] obj)
19:43BobFunk_here's basically all the bits of code involved + the stacktrace: https://gist.github.com/762922#comments
19:43BobFunk_and yeah, there's a macro - def-field
19:44BobFunk_that looks up a validation function generator for :integer
19:46amalloyah
19:47amalloyit's trying to (def foo some-function), but it can't embed the function in code
19:47amalloybecause it can't be serialized to a string once it's been compiled
19:48BobFunk_hmm, so it's a problem with macros and AOT compilation?
19:48clojurebotnot a problem, the average bid for it on getacoder is $821.00
19:49a_strange_guy&(binding [*print-dup* true] (let [local 5] (print (fn a-closure [] local))))
19:49sexpbot⟹ #=(sandbox6382$eval8764$a_closure__8765. )nil
19:49a_strange_guyno its a problem with the writer of form-dot-clj xD
19:49BobFunk_hehe
19:49amalloyBobFunk_: yeah. form.clj isn't right if it's trying to do that
19:50BobFunk_hmm, ok - guess I should be looking for another form validation library then
19:50a_strange_guywell its presently a limitation of the way print-dup works right now
19:51a_strange_guyi did once extend the print-dup multimethod to serialize closures properly
19:52a_strange_guyhttps://gist.github.com/313601
19:55amalloya_strange_guy: that's cute
19:55amalloyonly works in a single instance of the jvm though, i imagine
19:56a_strange_guyyeah, no way to access the bytecode of a class on the JVM
19:58amalloya_strange_guy: someone actually did that; it was on the mailing list a few months ago
19:58a_strange_guyreally? without instrumentation?
19:58amalloytrying to write some kind of persistent-ref that acts like an STM construct and also passed through to a database; it took a while but i think he got closures
20:00a_strange_guyah, found it
20:01amalloyhttp://groups.google.com/group/clojure/browse_thread/thread/dd0f77c885bcfb4e/dd89d34843bfc3a8?lnk=gst&amp;q=dref#dd89d34843bfc3a8 looks like the thread
20:05amalloya_strange_guy: hm, maybe it never got finished. it looks like closures are on the todo list; did you find any evidence that it was done?
20:18BobFunk_anyone got a good tip on whats best to use for forms/validations ?
20:19ossarehdoes anyone know what the default behaviour of trying to save a fraction to a table (jdbc) is going to be - i.e. is it cast to a float?
20:21ossarehBobFunk_: I went through this recently - tried most of the libs out there and ended up rolling my own. Sandbar is very good - forms-dot-clj felt a bit too immature.
20:21ossarehSandbar didn't fit for me since it required that you knew, up front, what your forms would be - which I don't. I have the format of a form, but no idea about the actual details until later on.
20:21ossarehi.e. at form submission time.
20:22amalloyossareh: jdbc makes you do .setInt, .setFloat, etc, so there's no default i know of; whatever method you call, it will do that
20:22ossarehamalloy: ah, I'd not seen that last time I went through this - I was just passing it the vectors or maps or whatever clojure.contrib.sql expects - it has been a while.
20:22BobFunk_gonna give Sandbar a try then, since the forms I have right now should be simple enough
20:23BobFunk_at least gonna have a look at the source
20:23ossarehBobFunk_: good luck, feel free to holler at me if you want to ask any questions.
20:25currentBsort of on the subject: what's everyone using for html templating these days?
20:25ossarehcurrentB: without question; hiccup.
20:26ossarehI actually converted html5boilerplate to hiccup
20:26ossarehtis a pretty sweet foundation to begin from
20:26BobFunk_nice - did you put it on github?
20:27ossarehnot yet - I was hoping to build out this project first to ensure it works as I think it should. Also I'm unclear on how best to enforce filesystem dependencies
20:27currentBmy one issue with hiccup is that it doesn't really work if you're outsourcing the design work
20:28ossarehcurrentB: are you getting HTML back from the outsourcer?
20:28currentBideally :)
20:28ossarehcurrentB: if it is xml it shouldn't be too hard to read the doc and output hiccup vectors
20:29ossarehwhich is actually on the slate for me since I don't want to convert html5boilerplate to vectors by hand each time they update
20:30currentByeah i did that for the last web thing I did with clojure
20:31currentBjust didn't feel particularly scalable
20:34ossarehwhat issues did you find with it as a process?
20:40ossarehBobFunk_: would appreciate any comments you have: https://gist.github.com/763017
20:47hippiehunteris there something im doing wrong? Whenever I make a change to a protocol I have to do lein clean or I get error messages like java.lang.IllegalArgumentException: Can't define method not in interfaces: load_unavailability
20:48BobFunk_ossareh: nice! will play around with it :)
20:52amalloyhippiehunter: i think defprotocol has defonce semantics; restarting the repl is probably necessary, but lein clean shouldn't be unless you AOT something
20:55hippiehunterIm only AOT'ing my app-servlet
20:55hippiehunterby something do you mean anything?
20:56amalloyhippiehunter: i don't know enough to be that specific :P
22:23duck1123is there a good place to go to see the docs for clojure and contrib for 1.3? Everything is all 1.2
22:24duck1123or am I best just building my own docs
22:25duck1123I wish there was a document that just gave the lookups "if you were using <this>, use <this> now"
22:34hippiehunterwhy does this line result in dat containing more elements then just token and secret
22:34hippiehunter(let [{:keys [token secret] :as dat} (social/load-from-key social-key)]
22:34hippiehunterhave I missed a caveat or am i mistyping something?
22:34hippiehunterit seems to contain the entire map, rather than just the keys ive asked for
22:44amalloyhippiehunter: you've missed the point of destructuring
22:44amalloydat will be the whole map because you asked for it with :as; you'll also have locals named 'token and 'secret, representing those values from the map
22:45amalloy&(let [{:keys [a] :as m} {:b 2 :a 1}] [a m])
22:45sexpbot⟹ [1 {:b 2, :a 1}]
22:46amalloyif you want to get back a map that only has some subset of the original keys, you want ##(select-keys {:b 2 :a 1} [:a])
22:46sexpbot⟹ {:a 1}
22:48amalloyhippiehunter: that help?
22:48hippiehunteryeah
22:49hippiehunterim a little confused as to the purpose of :as though
22:49amalloyit's for when you want to pull out some keys, but also keep the whole map around
22:49hippiehunterok, thanks
22:49amalloyeg, you need to pass it through to some lower layer, but also want to peek at the :foo key on the way
22:53hippiehunterany idea why i can get select-keys from the auto completion in the search bar of clojuredocs.org but if I type it all the way out, it finds 0 search results? It seems to happen to anything i type with a '-'
23:11amalloyhippiehunter: good question. i imagine - is being interpreted as a search metacharacter of some kind, like "select, NOT keys"
23:12hippiehunterI just took a look on github but ruby is not really my thing
23:29joshua__Anyone ever heard of a tagsoup to markdown converter?
23:36amalloyjoshua__: what would that mean? tagsoup is a program for pretending malformed xml is well-formed; markdown is a format for writing text
23:41joshua__ahhh.. well enlive says it uses tagsoup to get its html so..
23:41joshua__I meant is there a way to convert an html resource grabbed by enlive into markdown.
23:41joshua__I guess I was confused.
23:44amalloyjoshua__: i doubt it. html is much more complete and complicated than markdown; you can convert up to html, but not down to markdown
23:44joshua__amalloy: really I just want to convert a subset of html.
23:45joshua__amalloy, and that subset actually fits within the markdown subset
23:45amalloyjoshua__: you probably have to do it yourself, then. or since you have well-formed xml (courtesy of tagsoup) you might be able to persuade an xslt to do it for you
23:55joshua__amalloy, I found a java stackoverflow thread asking how to do this and they pointed to an xlst stylesheet that does it so I'm going the XLST route. I had never heard of it before today.