2011-03-20
| 00:02 | mec | i think just using 1.3 from the repl would be less painful than this |
| 00:02 | mec | repl from the command prompt* |
| 00:02 | scottj | mec, maybe you have an old version of swank-clojure |
| 00:03 | mec | im using :dev-dependencies [[swank-clojure "1.2.0"]] |
| 00:03 | scottj | 1.3.0-SNAPSHOT |
| 00:03 | mec | ah was looking for that but couldnt find any refrence to it |
| 00:04 | scottj | http://clojars.org/search?q=swank-clojure |
| 00:04 | pdk | actually where is 1.3 standing for release timeline now anyway |
| 00:04 | pdk | are we getting into release candidates soon |
| 00:05 | scottj | you could look at jira |
| 00:06 | mec | 1.3.0-SNAPSHOT is sitll giving me exceptions |
| 00:06 | scottj | pastebin it |
| 00:08 | mec | https://gist.github.com/878064 https://gist.github.com/878066 |
| 00:10 | scottj | oh yeah, I think that's actually a real bug, there's an open ticket for it on swank-clojure I think it started with alpha6, not sure though |
| 00:12 | mec | wow alpha5 works so far, thanks |
| 04:13 | fmw | public class TermsFilter extends Filter { Set<Term> terms=new TreeSet<Term>(); [...] } how do I access that terms field (its a field, right?)? When I run (. (TermsFilter.) terms) I get java.lang.IllegalArgumentException: No matching field found: terms [...] |
| 04:17 | fmw | I guess (.terms (TermsFilter.)) is more idiomatic, but that still gives the same error. |
| 04:23 | brehaut | fmw you need to have access to it |
| 04:24 | fmw | brehaut: so its a private field? |
| 04:24 | brehaut | fmw: my rusty java memory tells me its protected? |
| 04:24 | brehaut | make it public and see if it changes it |
| 04:25 | fmw | brehaut: I'm trying to implement a third party API (from Lucene) |
| 04:25 | brehaut | fmw: oh. i have heard that that is not the most pleasant |
| 04:26 | fmw | brehaut: the Lucene API in particular or implementing a 3rd party API in general? ;) |
| 04:26 | brehaut | lucene from clojure in particular |
| 04:27 | brehaut | also idiomatic java would haveyou leave that field as protected and add a public getter |
| 04:30 | Raynes | brehaut: Could you develop an application that uses some strange brain wave manipulation so that I can text-to-speech JoC to myself while sleeping and reap all the benefits of having actually read the whole text? |
| 04:31 | Raynes | I want to read the whole thing so bad, but I am so easily distracted that it'll take me a year. |
| 04:31 | brehaut | heh |
| 04:32 | Raynes | I swear, man, if they hadn't closed the doors at the Conj during talks, I'd have wandered out chasing after something shiny. |
| 04:32 | brehaut | Raynes: if you dont read it fast enough the orielly book will come out and you'll not be ready to read a book with cgrand content |
| 04:32 | brehaut | man i wish i could make it to a conj |
| 04:33 | Raynes | I want to read The Joy of Clojure as a prerequisite to my restructuring+partial rewriting of my own book. Alas, things are moving to slowly. |
| 04:33 | brehaut | i know the feeling eh |
| 04:34 | fmw | brehaut: this is the first Java API I'm implementing from Clojure so far, but apart from this particular issue it has been fine. As to the idiomatic Java comment, adding a subclass with a public getter is what I had in mind. I'm going to read up on clojure proxies and try that now. |
| 04:35 | brehaut | if its private a proxy wont be able to access the field. if it is protected it might be able to |
| 04:39 | brehaut | fmw: im not really the person to be answering java interop questions; ive done very little myself |
| 04:40 | fmw | brehaut: I'll try and see what happens, thanks :) |
| 04:40 | brehaut | no worries |
| 04:40 | fmw | everyone is very excited about the Joy of Clojure, I see ;) |
| 04:41 | brehaut | fmw: its a pretty fantastic book |
| 04:41 | brehaut | its got a lot of quite deep content about the why of stuff |
| 04:41 | fmw | what sets it apart from books like Programming Clojure by Halloway? |
| 04:42 | brehaut | aside from two years more clojure? |
| 04:42 | fmw | ah, the deep content about the way of stuff, I guess. |
| 04:42 | brehaut | its expects a certain familiarity with either a lisp or java |
| 04:42 | fmw | AFAIK Programming Clojure is also based on 1.2? |
| 04:43 | fmw | JoC assumes the familiarity? |
| 04:43 | brehaut | yeah TJoC does |
| 04:43 | Raynes | Programming Clojure is 1.1 |
| 04:44 | fmw | I've been considering to get the early access version (manning is spamming me with discount codes anyway), but at this point its probably more convenient to wait for the print version from Amazon :( |
| 04:44 | brehaut | ive only skimmed a friends copy of Programming Clojure. it seemed more like a good introductory text |
| 04:44 | fmw | it is |
| 04:45 | fmw | I liked it quite a lot, as well as the Clojure part of Bruce Tate's Seven Languages book |
| 04:45 | brehaut | im curious where the orielly book (Clojure Programming?) will fall |
| 04:46 | Raynes | brehaut: It'll be a 1.3 book. So will mine. |
| 04:46 | brehaut | for sure |
| 04:47 | fmw | ah, it says it will be released on March 25th in print now |
| 04:48 | fmw | doesn't list a release date on Amazon yet, though, so wondering if I'll have to wait longer than the 25th. |
| 04:52 | brehaut | fmw: oh other reasons that set apart TJoC: Lovecraftian footnotes, Wilco references and a generally pretty witty tone hiding in the corners |
| 04:58 | brehaut | Raynes: has nec-ev been behaving itself? |
| 04:58 | fmw | brehaut: seems fun, although I have never read anything by Lovecraft and have no clue who Wilco is;) |
| 04:59 | Raynes | Haven't actually done anything with it yet. |
| 04:59 | brehaut | fmw: wilco is a band. they are pretty great. basicly, its enjoyable reading which makes it easier to get through the necessary but otherwise dry sections |
| 04:59 | brehaut | Raynes: its probably for the best |
| 05:01 | fmw | I see :) |
| 05:09 | fmw | brehaut: ah, I figured out how to access private/protected fields: (clojure.contrib.reflect/get-field org.apache.lucene.search.TermsFilter "terms" flt) |
| 05:09 | brehaut | fmw; huh thats interesting |
| 05:10 | fmw | brehaut: pretty cool functionality, one of the things that make Clojure even more effective at interacting with Java than Java itself |
| 06:28 | zmyrgel | what would be a good way to do unit testing in clojure? |
| 06:28 | opqdonut | there are a couple of test frameworks |
| 06:28 | opqdonut | but maybe you'll want to start with clojure.test |
| 06:28 | zmyrgel | I mean I have lein project and I want to test some functions but they are private in their own namespace |
| 06:29 | opqdonut | I'd just make them public |
| 06:29 | opqdonut | what's the harm? |
| 06:29 | zmyrgel | overall structure in my opinion |
| 06:30 | zmyrgel | I'd hate to turn all my functions public just so I can test them |
| 06:30 | opqdonut | or you can put the tests in the ns itself, which is what I prefer |
| 06:31 | opqdonut | it just seems like the clojure test tools are more geared toward separate test namespaces |
| 06:31 | opqdonut | of course you can use the @' trick to access private functions |
| 06:31 | zmyrgel | @' trick? |
| 06:33 | opqdonut | gah, can't find the right combination of weird characters |
| 06:34 | opqdonut | ah, #' |
| 06:35 | opqdonut | http://paste.lisp.org/display/120688 |
| 06:37 | zmyrgel | ah, that seems to be just what I'm looking for my unit tests |
| 06:37 | opqdonut | https://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards <- the coding standards suggest it too |
| 06:37 | opqdonut | (second-to-last bullet point) |
| 06:39 | zmyrgel | thanks for the link |
| 06:39 | zmyrgel | gotta read it and then check that my project follows the standards |
| 06:54 | SergeyD | Hi, is it a Clojure/Java bug if binded var restores its old value unpredictably inside the same thread? |
| 06:57 | SergeyD | Simplified: (def myvar "oldvalue") (binding [myvar "newvalue"] .. myvarIsNew ... myvarIsNew ... myvarIsOld) |
| 06:57 | SergeyD | I use "(prn (. (Thread/currentThread) getId))" to print the current thread id |
| 07:01 | Zealous | so.... how does ns macro works for use again |
| 07:01 | Zealous | (:use [ring.middleware.reload :only wrap-reload] |
| 07:09 | Zealous | error: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (core.clj:1) |
| 07:09 | Zealous | goddamn why can't compiler at least tell me which symbol it was or something |
| 07:10 | SergeyD | Zealos, use this syntax "[ring.adapter.jetty :only [run-jetty]]" |
| 07:11 | SergeyD | Zealos, it usually helps to search for an example or tutorial |
| 07:17 | Zealous | thanks |
| 07:18 | Zealous | namespace manipulation is one of the worse things abotu clojure for beginners |
| 07:18 | Zealous | unlike java which has 1 form, clojure has like 4 |
| 07:21 | SergeyD | I heard a lot of times that error messages are quite bad in Clojure right now. That does not stop me though :) |
| 07:22 | Zealous | right, it could be way way better |
| 09:57 | angerman | jikes. |
| 09:58 | angerman | incanter.core/decomp-eigenvalue produces correct eigenvalues but wrong eigenvectors. |
| 10:08 | zakwilson | (filter (memfn isFile) (.listFiles folder)) <-- isFile does reflection here. Can I use a type hint without putting the result of (.listFiles folder) in a variable, and if so, what's the syntax? |
| 10:10 | raek | ,(set! *print-meta* true) |
| 10:10 | clojurebot | java.lang.IllegalStateException: Can't change/establish root binding of: *print-meta* with set |
| 10:10 | raek | ,(macroexpand-1 '(memfn ^java.io.File isFile)) |
| 10:10 | clojurebot | (clojure.core/fn [target__3915__auto__] (. target__3915__auto__ (isFile))) |
| 10:11 | raek | hrm, I'm not sure you can do it with the memfn macro |
| 10:11 | raek | but you can with #(.isFile ^java.io.File %) |
| 10:12 | zakwilson | Yep, works, thanks. |
| 10:17 | zakwilson | (defn foo [a b] (/ (int (count a)) (int (count b)))) <-- call to divide can't be resolved - why? |
| 10:20 | opqdonut | zakwilson: because clojure sucks, mostly |
| 10:21 | opqdonut | getting the arithmetic ops to not reflect can be a bit hard sometimes |
| 10:21 | opqdonut | zakwilson: try unchecked-divide |
| 10:22 | zakwilson | I did, and that eliminated the reflection warning. It's less pretty though, and doesn't have any measurable effect on speed. |
| 10:22 | opqdonut | yeah |
| 10:23 | opqdonut | the reflection reporting in 1.2 isn't perfect. it doesn't report some things that cause reflection, and seems to report reflection in places where there isn't any or it doesn't matter |
| 10:23 | opqdonut | but it's still a valuable tool |
| 10:25 | zakwilson | It doesn't matter here because that code wasn't an inner loop, but I wanted to understand it for situations where it is. |
| 11:09 | sharat87 | I am writing a compojure app and am currently running the server with `lein ring server-remote 5000` which works fine, but I want to run the server myself, in my app's core module and I am unable to find any API help on how to do this |
| 11:10 | sharat87 | does anybody know how I can achieve this? I'm not sure I presented my problem well, if there are any gaps, please feel free to ask for details |
| 11:10 | sharat87 | and also, this is my first with clojure :) |
| 11:31 | fliebel | sharat87: I think the Jetty wrapper is the place to look. |
| 11:37 | sharat87 | fliebel, yeah, I am reading the source of lein-ring project on github and trying to figure something out... |
| 11:37 | sharat87 | I feel I am quite close... yet so far :) |
| 11:38 | fliebel | sharat87: http://mmcgrana.github.com/ring/adapter.jetty-api.html#ring.adapter.jetty/run-jetty |
| 11:38 | sharat87 | yes, the handler object is what I am trying to figure out |
| 11:39 | fliebel | sharat87: The handler is just your ring app. |
| 11:44 | sharat87 | um, what's a ring app? I have my app declared with (site main-routes) with main-routes declared with defroutes from compojure, I think |
| 11:46 | sharat87 | fliebel, oh yeah, you're right, its just the app I needed to send |
| 11:47 | sharat87 | I was sending (var app) instead of app, which I saw in the lein-ring source :) |
| 11:47 | sharat87 | guess I should understand stuff before I copy-past ha! :) |
| 11:47 | sharat87 | thanks a lot fliebel |
| 11:48 | fliebel | you're welcome :) |
| 12:13 | TimMc | Note to self: "Wrong number of arguments passed to foo" probably means I have (apply foo ...) somewhere in my code. |
| 12:13 | opqdonut | oh, I've never had that type of bug |
| 12:15 | TimMc | Yeah, I was doing (apply map vector vs) and vs was nil instead of being a collection. |
| 12:16 | TimMc | This is one of the reasons I am suspicious of the supposed benefits of returning nil instead of throwing exceptions. |
| 12:16 | opqdonut | I'm sceptical too |
| 12:26 | fliebel | Does anyone have a nice snippet using promise? It seems a useful thing, but I never actually use it. |
| 12:32 | fliebel | For most cases where I would think a promise makes sense, a future makes more sense. Except for interop'y things and 'mutable' bindings. Like… (.putOnStuff javaThreadLoopEventThing (promise)) or (let [p (promise)] (do stuff) (deliver do-more-stuff)) |
| 12:32 | jamesswift | hi. quick opinion check. i would like to add a simple text search feature to my clojure app. a search to result in a seq of ids to original text sources. i'm guessing lucene is one of the simplest libs for this or is it over kill? any simple example clojure code existing for this? |
| 12:37 | TimMc | jamesswift: Fulltext search is hard to get right. Using a large-ish lib for it would not be inappropriate. |
| 12:42 | jamesswift | TimMc: OK thanks. Will have a proper look at Lucene then. |
| 12:48 | Zealous | what's wrong with using regex for full text search :) |
| 12:48 | jlf | hi #clojure, does the error "Unable to resolve artifact" during lein deps indicate that a dependency has gone missing from the remote repos or that my project.clj is broken? |
| 12:49 | Zealous | I think it could be either |
| 12:49 | jlf | project.clj and session transcript at http://paste.lisp.org/display/120696 |
| 12:49 | technomancy | jlf: cloud be either one, but it's bad form to remove published artifacts |
| 12:49 | fliebel | Zealous: Well, nothing, if you check 5 times 200 characters. |
| 12:49 | technomancy | on the remote side |
| 12:49 | TimMc | jlf: dependency missing from remote repos would be indistinguishable from a misspelled name in your project.clj |
| 12:50 | technomancy | jlf: in this case it's a bug in cascalog |
| 12:50 | technomancy | it's declaring dependencies on jars that aren't in any of the configured repos |
| 12:50 | jlf | technomancy: ah, thanks. i'll ping nathanmarz. |
| 12:51 | talos | hello :) |
| 12:51 | technomancy | jlf: it's an easy problem to make since the developers always have that stuff already on their machine, so they'd never notice it's not in the default repos. |
| 12:51 | talos | can i call clojure from jruby? |
| 12:51 | talos | or jython? |
| 12:52 | technomancy | talos: jruby works: https://github.com/technomancy/clojure-gem |
| 12:52 | jlf | technomancy: who's the clojars maintainer? it'd be sensible to public newly uploaded packages in a sandbox iff they build successfully. |
| 12:52 | talos | thx :) |
| 12:52 | jlf | s/public/publish/ |
| 12:52 | sexpbot | <jlf> technomancy: who's the clojars maintainer? it'd be sensible to publish newly uploaded packages in a sandbox iff they build successfully. |
| 12:52 | technomancy | talos: though there are still problems with transaction retries caused by jruby functions |
| 12:52 | fliebel | talos: Jython also works… https://github.com/rplevy/clojure-python |
| 12:53 | technomancy | jlf: the clojars maintainer disappeared a while ago =( |
| 12:53 | jlf | o_O |
| 12:53 | technomancy | it desperately needs someone to take it over |
| 12:55 | talos | is java part of clojure normally usage? |
| 12:56 | technomancy | talos: not as much these days. but it depends on what you're doing. |
| 12:57 | TimMc | talos: Are you referring to using clojure.lang classes by name in Clojure? |
| 12:57 | talos | i dont know much |
| 12:57 | talos | i just hate java |
| 12:57 | TimMc | Or to using the Java standard libraries from Clojure? |
| 12:58 | talos | like functional and dinamic languages |
| 12:58 | TimMc | Or perhaps having a mix of Java and Clojure code in a given project? |
| 12:58 | talos | my question i that in order to use clojure you depend on java? |
| 12:58 | technomancy | it's very rare to see Clojure projects that include Java source code |
| 12:59 | talos | ok :) |
| 12:59 | technomancy | it's common to see Clojure projects that use Java classes, but it's not required like it used to be. |
| 12:59 | fliebel | But it's very common to see Clojure projects use some existing Java code. |
| 12:59 | TimMc | talos: Clojure depends on the JVM and uses Java internally, but you do not need to write .java files in order to write Clojure. |
| 13:00 | talos | ok,thx you much guys |
| 13:00 | talos | :) |
| 13:01 | TimMc | talos: https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/gui.clj#L132 <-- this is about as close as I get to Java |
| 13:01 | TimMc | Most of my code is written in a more functional style. |
| 13:06 | talos | i saw the code,for gui what are the options? |
| 13:06 | talos | java swing? |
| 13:07 | TimMc | talos: You can use any Java library from Clojure code. |
| 13:08 | talos | do you see a big future in clojure? i like it but i total newbie |
| 13:13 | talos | bye guys thx you :) have a nice day |
| 14:06 | nickik | why does this throw a NullPointerExeption? http://paste.lisp.org/display/120698 |
| 14:08 | Zealous | no idea, I'm using moustache :) |
| 14:09 | nickik | it throws it a line 11 |
| 14:09 | nickik | deftemplate |
| 14:10 | raek | nickik: probably because it cannot find the file on the classpath |
| 14:10 | Zealous | maybe selector returns nil? |
| 14:10 | nickik | but it worked befor and i dont think i changed anything |
| 14:10 | raek | nickik: "resources/templates/404.html" should be sufficient |
| 14:11 | raek | sorry, "templates/404.html" |
| 14:11 | raek | assuming resources/ is the dir that is at the same level as src/ |
| 14:12 | raek | deftemplate throws NPE when it cannot open the file (not a very helpful error) |
| 14:13 | nickik | src and resources are both toplevel (readme, project.clj) |
| 14:14 | nickik | if i just write "404.html" where does it lookup the file? in the src directory? |
| 14:14 | raek | what does (require '[clojure.java.io :as io]) (io/resource "templates/404.html") return? |
| 14:14 | raek | nickik: in all directories (and jar files) on the classpath |
| 14:15 | raek | so it looks for src/404.html and resources/404.html |
| 14:15 | nickik | is resources on the classpath automaticly? |
| 14:15 | raek | with leiningen, yes. |
| 14:16 | raek | but if the directory didn't exist when you started clojure, you might need to restart it |
| 14:16 | raek | ...or hack it in with (add-classpath "file://complete/pat/to/resources") |
| 14:18 | nickik | im restarting everything |
| 14:19 | nickik | another questions if you have images in a template where do the start the lookup |
| 14:19 | nickik | *links to images in a template |
| 14:20 | raek | well, if the page is served as /foo/bar.html, and it contains a <img src="baz.png" /> the browser will request /foo/baz.png |
| 14:20 | raek | and you have to make your routes serve that file |
| 14:20 | raek | (there is middleware for handling that) |
| 14:22 | raek | see http://clojuredocs.org/ring/ring.middleware.file and http://clojuredocs.org/ring/ring.middleware.file-info |
| 14:24 | nickik | ah ok thx |
| 14:25 | phenom_ | what happened to clojure.contrib.string ? |
| 14:25 | raek | it became clojure.string |
| 14:32 | sineer | Anyone knows why (:import com.foo.bar MyClass) gives me ClassNotFoundException running my test.clj this way: java -jar /path/to/clojure.jar test.clj ... yet java com.foo.bar.MyClass works! So my CLASSPATH env var is set properly I believe.. |
| 14:34 | sineer | ahj -jar overwrite -classpath uh.. never mind |
| 14:35 | raek | sineer: also, it should be (:import (com.foo.bar MyClass)) |
| 14:36 | sineer | raek: sorry I did made a typo in my short example.. |
| 14:36 | sineer | I keep messing ()s up.. |
| 14:36 | sineer | err it not only overwrite the -classpath but I cannot set -classpath manually when I run java -jar ? |
| 14:37 | nickik | if i just want to serve the content of a static file. how would i do that? |
| 14:37 | sineer | I guess the right question is how to start clojure using "clojure" instead of "java -jar" and append the proper classpath ? |
| 14:38 | technomancy | sineer: launching clojure manually using the "java" command is usually more trouble than it's worth. |
| 14:39 | phenom_ | technomancy: know how to create a project that has java/clojure interop? default project layout assumes only clojure |
| 14:39 | phenom_ | with lein |
| 14:40 | sineer | This is what clojure --help gives me: f0x# clojure --help |
| 14:40 | sineer | Usage: java -cp clojure.jar clojure.main [init-opt*] [main-opt] [arg*] ... so my clojure start script (1.2 from FreeBSD Ports) isn't helping.. |
| 14:40 | raek | sineer: clojure does not have a standard launcher |
| 14:41 | raek | the majority of launcher scripts available are for getting a repl to play with, but are generally insuffiecient when you want to have code in more than one file |
| 14:42 | raek | phenom_: newer versions of leiningen have lein-javac built in |
| 14:42 | raek | just fill in :java-source-path in the project.clj |
| 14:44 | raek | sineer: when you do have multiple source file or depenency jars, I'd suggest you use a build tool like leiningen, cake or maven |
| 14:44 | sineer | raek: yeah.. thanks.. I think i'll have to do that soon indeed... |
| 14:45 | raek | nickik: this example project serves static files (but uses moustache for routing, rather than compojure) https://github.com/raek/lcug-guestbook |
| 14:46 | technomancy | phenom_: there's no skeleton for that; you can just add a :java-source-path into project.clj |
| 14:46 | technomancy | :java-source-path can even just be "src" for minimal clutter |
| 14:50 | technomancy | someone's working on a lein plugin to allow more different tyes of skeleton generation; might be interesting. |
| 14:51 | sineer | wtf is this: Exception in thread "main" java.lang.IllegalArgumentException: No matching ctor found for class java.lang.ProcessBuilder (doh.clj:20) ?? |
| 14:51 | sineer | generated byt this line: No matching ctor found for class |
| 14:51 | sineer | err (def proc (new ProcessBuilder "ls")) |
| 14:52 | raek | btw, epresent rocks for making clojure presentations |
| 14:52 | technomancy | raek: nice! =) |
| 14:53 | raek | technomancy: I looked at you conj presentation slides to learn it. it's neat! |
| 14:54 | technomancy | raek: unfortunately presentation software is one of those things (like gitjour) that offers very little motivation to continue maintaining after the conference is over |
| 15:11 | not-timmc | sineer: That's a varargs constructor. You'll need to pass a String array in. |
| 15:11 | sineer | not-timmc: yeah I figured it out.. thanks too :-) |
| 15:14 | not-timmc | sineer: (ProcessBuilder. (into-array String ["ls"])) |
| 15:14 | not-timmc | You can use that shorthand for constructors. |
| 15:15 | sineer | cool! |
| 15:16 | not-timmc | You can also leave out the "String" in my example, since into-array will use the class of the first element, but if you are using a variable from another part of your program it is nice to have that type check. |
| 15:18 | not-timmc | sineer: http://clojure.org/java_interop has a lot of this stuff |
| 15:19 | not-timmc | I wish it mentioned varargs, though -- it's a common stumbling block. |
| 16:39 | thorwil | fun with appengine-magic: com.google.appengine.api.datastore.Key cannot be cast to clojure.lang.IFn |
| 16:40 | thorwil | i reduced stuff down to: (ds/defentity Article [^:key path, text]) |
| 16:40 | thorwil | and (defn submit-article [] (ds/save! (Article. "foo" "blabla"))) |
| 17:46 | phenom_ | anyone know how to make type hints show up in a macro/ |
| 17:46 | d5dq | (for (i 0 (< 1 10)) (print i)) |
| 17:46 | brehaut | d5dq: ? |
| 17:47 | d5dq | brehaut: do you know why that for loop doesn't seem to work |
| 17:47 | brehaut | d5dq: beacuse thats not for-loop notation in clojure |
| 17:48 | d5dq | damn, I copied from someone's clojure code though |
| 17:48 | brehaut | d5dq: there are two forms you want to look at: for, doseq |
| 17:48 | brehaut | really? |
| 17:48 | brehaut | curious |
| 17:48 | d5dq | yea, maybe it used to be supported? |
| 17:48 | raek | phenom_: if you (set! *print-meta* true), then you will see metadata when you do (macroexpand-1 '(your-macro ...)) |
| 17:48 | brehaut | so if you want a lazy seq, you use for, if you want side effects (eg printing) you use doseq |
| 17:48 | brehaut | d5dq: ##(doseq [i (range 1 10)] (print i)) |
| 17:48 | sexpbot | ⟹ 123456789nil |
| 17:49 | d5dq | sweet thanks |
| 17:49 | brehaut | &(for [i (range 1 10)] (print i)) |
| 17:49 | sexpbot | ⟹ (123456789nil nil nil nil nil nil nil nil nil) |
| 17:51 | brehaut | d5dq: sexpbot made a wee bit of a mess of that, but its returned a lazy seq of nils (print returns nil) as well as printing all the values. do-seq returned one nil |
| 18:23 | devn | hey everyone |
| 18:28 | brehaut | morning devn |
| 18:40 | d5dq | can someone tell me why this is not working: https://gist.github.com/878748 |
| 18:40 | phenom_ | hmmm, raek: I see the metadata but im still getting refelction warnings though I see the type hints |
| 18:42 | d5dq | nm found the problem |
| 18:42 | d5dq | wrong order |
| 18:44 | raek | phenom_: I guess you could try evaluating the macroexpansion and observe what form the compiler complains about |
| 18:46 | raek | the compiler shouldn't be able to tell if the code comes from a macro or directly from the original source |
| 18:47 | raek | are you sure typehints are in place for the call it warns about? |
| 19:18 | phenom_ | raek: turns out I had to fully qualify the class of the hint, or import those classes in the calling .clj |
| 19:20 | brehaut | phenom_: good to know. and well done |
| 20:12 | devn | i wonder if we're being robbed on github due to the fact that most clojure apps are small enough that simply packaging with jquery with it makes it show up as a js repository |
| 20:27 | not-timmc | devn: What's an example of a Clojure app with jQuery in it? Like, a web app? |
| 20:27 | not-timmc | Or do you mean .js in doc files? |
| 21:11 | ymasory | which is the "official" clojure-mode repo? |
| 21:33 | phenom_ | are 1.3 nightly builds available from maven ? |
| 22:39 | tomoj | neither bot agrees, but for me ((fn [] {:foo})) throws the expected error while (do (defn foo [] {:foo}) (foo)) and (letfn [(foo [] {:foo})] (foo)) return {} |
| 22:40 | tomoj | ..why? |
| 22:44 | xlarsx | {:foo} is a dictionary so you need a key/value {:foo 1} for example |
| 22:44 | xlarsx | => {:foo} |
| 22:44 | xlarsx | java.lang.ArrayIndexOutOfBoundsException: 1 |
| 22:48 | xlarsx | the 3 options throws the same Exception |
| 22:48 | tomoj | not for me, as I said |
| 22:49 | xlarsx | (I'm using Clojure 1.2.0) |
| 22:49 | tomoj | hmm, in a bare repl they all throw |
| 22:49 | tomoj | in my slime repl the latter two return {} |
| 22:50 | tomoj | must be something crazy swank-clojure does |
| 23:52 | devn | not-timmc: many of them... |
| 23:52 | devn | not-timmc: granted you could just remove the JS and source it from google, but either way, kind of a bummer |
| 23:57 | brehaut | devn i think they some sort of filter to by filename. |