2012-08-12
| 00:08 | howard_ | Good morning/afternoon/evening. Does anyone know if there is any known issue using (read-line) with clojure-contrib/server-socket? |
| 00:09 | howard_ | I noticed that in my program, read-line will run into what appears to be infinite loop when a client disconnects |
| 00:23 | llasram | howard_: Probably not the best time to ask for help -- midnight US EDT and 9pm US PST on a Saturday :-) |
| 00:27 | gfredericks | it's still worth a try though |
| 01:28 | brainproxy | anyone tried making a rootbeer-clojure float? |
| 01:28 | brainproxy | https://github.com/pcpratts/rootbeer1 |
| 03:58 | Bahman | Hi all! |
| 03:59 | Bahman | Anybody using borneo library for Neo4j here? |
| 04:00 | Bahman | Is it possible to set attributes for relationships using that library? |
| 04:00 | Bahman | https://github.com/wagjo/borneo |
| 04:13 | Bahman | Found it. http://wagjo.github.com/borneo/borneo.core-api.html#borneo.core/set-prop! |
| 04:29 | wuehli | und ich kann es auch verstehen, dass Excel so populär ist |
| 04:29 | wuehli | ouch, sorry |
| 05:33 | ro_st | anyone using midje have a solution for test coverage? |
| 06:52 | McMartin | Does it deliberately choke on certain constructs? |
| 06:53 | Raynes | Anything in particular? |
| 06:53 | McMartin | I keep getting timeouts on the only problem I have left to solve, and my local copy of the solution solves all the problems combined in under a second. |
| 06:53 | McMartin | Which is Latin Square Slicing |
| 06:54 | McMartin | I rewrote a sequence that used nth to instead use take/drop and that at least cause *some* test cases to resolve |
| 06:54 | Raynes | *shrug* |
| 06:54 | Raynes | Some things just take longer in the sandbox. |
| 06:54 | Raynes | It sucks, but it's hard to fix it. |
| 06:54 | Raynes | It certainly isn't deliberant. |
| 06:55 | Raynes | deliberate* |
| 06:55 | McMartin | Also, for some problems (this one included) there's this 15 second delay before anything happens |
| 06:55 | McMartin | This doesn't happen with all problems |
| 06:55 | McMartin | Is this a known thing one can trip over? |
| 06:55 | Raynes | The time outs? Yes. |
| 06:55 | McMartin | No, this isn't strictly a timeout |
| 06:55 | McMartin | It's a big delay at the start, possibly compilation delay? |
| 06:55 | McMartin | But some problems seem to get hit by it way harder than others |
| 06:56 | talios | woohoo - there's a new La Clojure build that supports IntelliJ IDEA 12 available. rockin. |
| 07:27 | howard | If you are looking for a Clojure implementation of document database engine, please check out https://github.com/HouzuoGuo/ClojureDB |
| 07:31 | McMartin | The other possibility is that there is a completely unreasonable timeout on this problem. |
| 07:34 | hyPiRion | McMartin: It's Clojail, and I don't like it either ;( |
| 07:35 | McMartin | Right, but what I mean is, it goes green-green-green-green-green-green-green-green-green-red-with-timeout |
| 07:35 | McMartin | When it works at all, anyway |
| 07:35 | McMartin | My localside testing shows a 25x slowdown on that test case. |
| 07:35 | McMartin | All the way down to a quarter of a second |
| 07:36 | McMartin | So if the timeout is set to like 100ms, that would also explain this |
| 07:36 | hyPiRion | Ah. |
| 07:37 | McMartin | Whoa hey |
| 07:37 | McMartin | Maybe that will work better |
| 07:37 | hyPiRion | heh |
| 07:38 | hyPiRion | I suspect you already know that for-comprehensions is a no-no. Go loop whenever you can. |
| 07:38 | McMartin | I've been getting the reverse the results from the clojail, as it happens. |
| 07:39 | McMartin | loop-recur is my natural state, having wandered to Clojure from Scheme and its named lets. |
| 07:39 | hyPiRion | It's a shame though - for comprehensions solve a lot of the problems very elegantly. |
| 07:39 | McMartin | SUCCESS. |
| 07:39 | McMartin | Well, that's the thing; for works in places where recur has murdered me |
| 07:40 | McMartin | At any rate, I am now in fact #1. |
| 07:40 | hyPiRion | Congratulations. |
| 07:41 | McMartin | ALso, at some point it became 0440, I should probably try sleeping |
| 07:41 | McMartin | Sleeping the sleep of VICTORY |
| 07:41 | McMartin | Anyway, thanks to those who reminded me that there are things I should mess with. |
| 07:41 | hyPiRion | hahah |
| 07:42 | McMartin | And now to translate my real projects into proper Java because I'm going to target Froyo phones =( |
| 07:45 | McMartin | Anyway, check out this horrible meta-for I had to make: |
| 07:45 | McMartin | (defn nest-ranges [xs] (if (empty? xs) '(()) (let [sub (nest-ranges (rest xs))] (mapcat (fn [n] (map #(conj % n) sub)) (range (first xs)))))) |
| 07:46 | hyPiRion | wow, mapcat |
| 07:46 | hyPiRion | long time, no see. |
| 07:46 | McMartin | Not only that, actual lists |
| 07:46 | hyPiRion | heg |
| 07:46 | McMartin | You give it a vector of bounds and it gives you a sequence of vectors iterating up to those bounds as if you'd declared them as for variables in that order |
| 07:47 | hyPiRion | 4clojure - for your obfuscating needs. |
| 07:47 | McMartin | Sorta |
| 07:48 | McMartin | It's pretty straightforward if you tab it into proper whitespacing |
| 07:48 | McMartin | It's just a problem you almost never need to solve, because the *number of loop variables* is usually constant |
| 07:49 | McMartin | It turns out my algorithm for that 4clojure problem, however, was a case where they weren't. |
| 07:49 | hyPiRion | yeah |
| 07:49 | McMartin | (There's a loop of possible alignments of rows, where the number of variables is the current size of latin square we're searching for) |
| 07:51 | McMartin | OTOH, I think solving http://www.4clojure.com/problem/113 actually made me a worse programmer. |
| 07:56 | hyPiRion | McMartin: Well, it's just a reify, isn't it? |
| 07:57 | hyPiRion | but yeah, it's not exactly pretty. |
| 07:59 | McMartin | Yes, now I know how to use reify to do that |
| 07:59 | McMartin | As a result, I am now a worse programmer |
| 07:59 | McMartin | It's like mastering PHP~ |
| 08:07 | hyPiRion | McMartin: haha |
| 08:07 | hyPiRion | You should look up reify and how to extend types and so forth - it's not that hard. |
| 08:12 | McMartin | Yeah |
| 08:12 | McMartin | I've played with proxy in Swing some |
| 09:25 | magopian | hello there: i'm working on problem 121 on 4clojure.org, and wondering if there's any way to evaluate something like '(+ 1 2) without using eval? |
| 09:26 | gfredericks | well it's a list |
| 09:26 | gfredericks | so you can check if the first thing is '+ |
| 09:26 | gfredericks | and then add the other things if it is |
| 09:27 | gfredericks | the trickiest part is probably getting the recursion right for the arbitrarily nested cases |
| 09:29 | magopian | gfredericks: mmmm i think i get it |
| 09:29 | magopian | then i'll need to see how i can use '{a 1 b 1} in the ":or" part of a map binding-form |
| 09:30 | magopian | it's strange that i can't just "apply (first l) (rest l)" on '(+ 1 1) |
| 09:30 | magopian | well, at least, it's strange to me ;) |
| 09:31 | gfredericks | cuz it's a symbol; to get a symbol into a var or function you have to use resolve or eval, both of which are probably prohibited there because it would sidestep what they're getting at |
| 09:31 | magopian | sure |
| 09:31 | magopian | so + is a symbol, not a function? |
| 09:32 | magopian | or is it a symbol only because it's inside a list? |
| 09:33 | gfredericks | there's three things going on |
| 09:33 | gfredericks | ,(type '+) |
| 09:33 | clojurebot | clojure.lang.Symbol |
| 09:33 | gfredericks | + unevaluated is a symbol |
| 09:33 | gfredericks | which is just data |
| 09:33 | gfredericks | ,(resolve '+) |
| 09:33 | clojurebot | #'clojure.core/+ |
| 09:34 | gfredericks | when you resolve it _in the context of your namespace_, you get back a var |
| 09:34 | gfredericks | so + in another namespace might refer to a different var |
| 09:34 | magopian | and in the var, there's the function |
| 09:34 | gfredericks | ,(deref (resolve '+)) |
| 09:34 | clojurebot | #<core$_PLUS_ clojure.core$_PLUS_@5506ff2e> |
| 09:34 | gfredericks | yep, you deref the var and there's the actual function you want |
| 09:35 | magopian | i'm going to re-read that several times ;) |
| 09:35 | magopian | so i could use resolve and deref instead of eval ? |
| 09:35 | gfredericks | when you use vars in normal code, the resolving is done at compile-time, and the derefing is done at runtime |
| 09:35 | gfredericks | if 4clojure didn't forbid it you could |
| 09:35 | magopian | oh ok got it ;) |
| 09:35 | magopian | anyway, it's not the point of the exercise (to use eval or resolve+deref), but i think i understand now ;) |
| 09:36 | gfredericks | that's cool it took me a year or so :D |
| 09:36 | magopian | awesome, thanks a ton gfredericks that was _really_ clear and understandable ;) |
| 09:36 | gfredericks | no problem |
| 09:36 | magopian | (i love 4clojure ;) it really got me to like functional programming ;) |
| 09:37 | gfredericks | (inc 4clojure) |
| 09:37 | lazybot | ⇒ 1 |
| 09:37 | magopian | i still have to discover what is clojure especially good at, compared to other functional programming languages, like common lisp |
| 09:37 | cshell | magopian: data tranformation and manipulation |
| 09:38 | magopian | thanks again gfredericks ;) |
| 09:38 | Scriptor | magopian: also, common lisp isn't as functional as clojure |
| 09:38 | magopian | cshell: you mean, thanks to its data structures? |
| 09:38 | magopian | Scriptor: you mean, "not as pure" ? |
| 09:38 | magopian | i'm still just discovering functional programming, so bear with me ;) |
| 09:39 | Scriptor | magopian: not really purity, just in general clojure embraces a functional style and immutability more |
| 09:39 | Nikelandjelo | ,((resolve '+) 1 1) |
| 09:39 | clojurebot | 2 |
| 09:39 | Scriptor | also, 4clojure is a double-edged sword |
| 09:39 | hyPiRion | huh, resolve. |
| 09:39 | Nikelandjelo | ,((deref (resolve '+)) 1 1) |
| 09:39 | clojurebot | 2 |
| 09:39 | Scriptor | I thought my reverse interleave was clever until I saw the usual solution |
| 09:39 | Nikelandjelo | When I do (resolve '+) I get a var, not function, right? |
| 09:40 | hyPiRion | ,(resolve 1) |
| 09:40 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Symbol> |
| 09:40 | xeqi | Nikelandjelo: invoke on a var is defined to deref automatically |
| 09:40 | magopian | Scriptor: can you explain why it's a double-edgd sword? |
| 09:40 | Nikelandjelo | xeqi: thanks |
| 09:41 | Scriptor | magopian: look above, it was mostly tongue-in-cheek :) |
| 09:41 | magopian | Scriptor: ok, got it ;) |
| 09:41 | Scriptor | only in that when you think you do have a good solution there always seems to be a better one |
| 09:41 | magopian | yeah, i feel that with nearly each problem i solve ;) |
| 09:41 | hyPiRion | ,(let [evl (fn [x] ({'* *, '+ +, '- -, '/ /} x x)] (map evl '(+ - * / + 1 2 3))) |
| 09:41 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: ]> |
| 09:41 | hyPiRion | eww |
| 09:41 | hyPiRion | ,(let [evl (fn [x] ({'* *, '+ +, '- -, '/ /} x x))] (map evl '(+ - * / + 1 2 3))) |
| 09:41 | clojurebot | (#<core$_PLUS_ clojure.core$_PLUS_@5506ff2e> #<core$_ clojure.core$_@182cce06> #<core$_STAR_ clojure.core$_STAR_@50d5f71> #<core$_SLASH_ clojure.core$_SLASH_@225693fe> #<core$_PLUS_ clojure.core$_PLUS_@5506ff2e> ...) |
| 09:42 | wmealing__ | hyPiRion, my headd.. |
| 09:43 | hyPiRion | wmealing__: sorry. |
| 09:45 | magopian | hyPiRion: it's missing a ") '(" between the operators and the args ;) |
| 09:45 | hyPiRion | I realized. |
| 09:47 | tomoj | what might a (non-clojure)-code generation framework look like? |
| 09:47 | hyPiRion | code generation? |
| 09:47 | tomoj | I note the cljs compiler is in imperative style |
| 09:48 | hyPiRion | Oh, parsec maybe? |
| 09:49 | tomoj | (code ["function (x) {"] (indent ["return x;"]) ["}"]) |
| 09:49 | tomoj | trying to work that out now but I don't think it's right |
| 10:56 | Frozenlock | Perhaps I'm late to the party and you've already discussed it, but could this work with clojure? http://news.ycombinator.com/item?id=4371851 |
| 11:06 | hyPiRion | Frozenlock: theoretically, yes |
| 11:07 | hyPiRion | However, it doesn't cover the following: |
| 11:07 | hyPiRion | 1. native methods 2. reflection 3. dynamic method invocation |
| 11:08 | hyPiRion | Which is basically what Clojure is :p |
| 11:20 | eru` | How would I accomplish something like (let [x (some-ajax-call) y (another-ajax-call)] (f @x @y)) in ClojureScript? |
| 11:20 | Frozenlock | hyPiRion: So I should not get excited about this :( |
| 11:28 | ticking | is anybody using emacs on a mac, with [] maped to alt-number commands? I don't know how to switch from meta to als… |
| 11:40 | hyPiRion | Frozenlock: At least not yet. |
| 11:43 | unlink | Is there something like Maybe in Clojure? (Boxing values) |
| 11:50 | danielglauser | Does anyone know what the ampersand means in this line of code? |
| 11:50 | danielglauser | (catch Object _ |
| 11:50 | danielglauser | (log/error (:throwable &throw-context) "unexpected error") |
| 11:50 | danielglauser | What is &throw-context ? |
| 11:54 | _ato | danielglauser: https://github.com/scgilardi/slingshot/blob/master/README.md (about halfway down the page) |
| 11:55 | danielglauser | _ato: You know, I have that page open and read a good chunk of it…Thanks! |
| 11:55 | alexyakushev | Is there some kind of `constantly` macro that creates a function of any arguments and evaluates its body every time when called? |
| 11:57 | gfredericks | alexyakushev: that wouldn't save much over just (fn [& _] my-body) would it? |
| 11:57 | _ato | danielglauser: also ampersand by itself doesn't mean anything, it's just part of a symbol name like the question mark in "any?". But by convention it's used for hidden macro arguments with special context information, see also: http://blog.jayfields.com/2011/02/clojure-and.html |
| 11:59 | hyPiRion | alexyakushev: constantly? |
| 11:59 | hyPiRion | ,(doc constantly) |
| 11:59 | clojurebot | "([x]); Returns a function that takes any number of arguments and returns x." |
| 11:59 | hyPiRion | oh, I see. |
| 12:00 | hyPiRion | ,(doc repeatedly) |
| 12:00 | clojurebot | "([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it" |
| 12:00 | clj_newb | is there a function to parse a Character to a number other than (Character/digit) ? |
| 12:01 | cjfrisz | How do you read something from a file as though it's a sequence/S-expression? |
| 12:01 | cjfrisz | A la Scheme's read? (http://scheme.com/tspl4/io.html#./io:s81) |
| 12:02 | alexyakushev | hyPiRion: constantly returns the same value every time, but I want it to be revaluated |
| 12:02 | alexyakushev | ,(map (constantly (rand)) (range 5)) |
| 12:02 | clojurebot | (0.9167970343709244 0.9167970343709244 0.9167970343709244 0.9167970343709244 0.9167970343709244) |
| 12:03 | hyPiRion | ,(repeatedly 5 rand) |
| 12:03 | clojurebot | (0.9477552907069643 0.4584298110320799 0.15597111467683888 0.6704665582926552 0.9412675879153743) |
| 12:03 | alexyakushev | hyPiRion: yep, I know about repeatedly, but that's not what I want, that was just a demonstration |
| 12:04 | hyPiRion | Hm. |
| 12:05 | hyPiRion | You could always wrap it in a (fn [&] ...), to get the same result |
| 12:05 | alexyakushev | I can, I just thought maybe there is already a macro for that |
| 12:05 | alexyakushev | hyPiRion: actually what I exactly need is (defmacro const [& body] `(fn [& _#] ~@body)) |
| 12:06 | hyPiRion | okey, I don't think there is one. |
| 12:06 | alexyakushev | hyPiRion: Thanks anyway! |
| 12:06 | hyPiRion | constantly, repeatedly, partial are the closest I know of |
| 12:06 | hyPiRion | no problem |
| 12:07 | VickyIyer | Hello All, I am trying out a small example but for some reason when I run it I am getting an arity exception, can some one tell me what the problem is: (defn hypt[x y] |
| 12:07 | VickyIyer | (let [x2 (double-me x) |
| 12:07 | VickyIyer | y2 (double-me y)] |
| 12:07 | VickyIyer | (Math/sqrt (+ x2 y2)))) |
| 12:08 | VickyIyer | (hypt [23 45]) |
| 12:08 | VickyIyer | ArityException Wrong number of args (1) passed to: double-me$hypt clojure.lang.AFn.throwArity (AFn.java:437) |
| 12:09 | hyPiRion | VickyIyer: when you say (defn hypt [x y] ...), you say that there are two arguments passed to the function, x and y. Thus, (hypt x y) is correct, while (hypt [x y]) is only one argument. |
| 12:09 | hyPiRion | try out (hypt 23 45) instead |
| 12:10 | VickyIyer | oh ok, now it ran thanks, but then the arguments must be passed as a vector right |
| 12:11 | hyPiRion | VickyIyer: No - it's just to tell how many arguments the function will have. |
| 12:12 | hyPiRion | or do you mean that in (defn foo arglist ...), the arglist must be a vector? If that's what you meant, you're correct |
| 12:13 | Scriptor | VickyIyer: no arguments should be getting passed as a vector in your example |
| 12:13 | VickyIyer | what I am confused about is when I define the function I define it as (defn hypt [ x y]....) which basically means that a vector is taken as an input then my understanding was to call this function we must also use a vector like (hypt [2 3]) this is what is conkfusing me |
| 12:13 | Scriptor | defn uses a vector to list the parameters it has, but that doesn't affect the type of the parameters |
| 12:14 | Scriptor | VickyIyer: that doesn't mean it takes a vector, that's just the syntax for defn |
| 12:14 | Scriptor | just like in python you have def foo(a, b) |
| 12:15 | Scriptor | that doesn't mean foo takes a tuple of a and b, it just means foo takes two parameters, a and b, and python uses parentheses to group the arguments |
| 12:15 | Scriptor | *group the parameters |
| 12:15 | VickyIyer | ok so what do I have to do to send a vector as an input |
| 12:16 | Scriptor | a vector is just a value, so you pass it as anything else |
| 12:16 | hyPiRion | Try out (defn hypt [[x y]] instead, if you have two elements |
| 12:16 | metellus | (defn foo [[a b]]...) would take a vector containing a and b |
| 12:16 | Scriptor | uhm |
| 12:16 | metellus | or you could do (defn foo [a]) where a is a vector |
| 12:16 | Scriptor | I think destructuring might be a bit too advanced for now |
| 12:16 | Scriptor | VickyIyer: (defn hypt [a b] ...) takes two parameters, so you can pass it two vectors |
| 12:17 | Scriptor | (hypt [1 2 3] [4 5 6]) |
| 12:17 | clj_newb | Is there a function to execute a function to a every item in a seq? |
| 12:17 | hyPiRion | clj_newb: map is probably what you're looking for |
| 12:17 | VickyIyer | ok I kind of got it, probably once I work through the examples the concepts would become stroger, thnks a lot for all the help |
| 12:18 | hyPiRion | ,(map inc [1 2 3]) |
| 12:18 | clojurebot | (2 3 4) |
| 12:18 | clj_newb | thanks |
| 12:18 | Scriptor | clj_newb: map is mostly used when you want a new list from the old list |
| 12:18 | Scriptor | if you want to do something like print each element of a list, you need something else |
| 12:18 | hyPiRion | VickyIyer: It's a bit confusing at first, but it's easier once you've programmed a little with Clojure. |
| 12:19 | Scriptor | doseq, in that case |
| 12:20 | hyPiRion | Hmm, how many printlns does clojail fire off before stopping the printing? |
| 12:20 | hyPiRion | I want to try, but there's no point of spamming the channel. |
| 12:24 | Scriptor | hyPiRion: I just pm'd it (doseq [x (range 100)] (prn x)) |
| 12:25 | Scriptor | but it might have a higher max for pm's |
| 12:25 | Scriptor | hmm, something higher than 99 |
| 12:31 | cjfrisz | Huh...turns out "read" works very much like I wanted it to |
| 12:31 | cjfrisz | How did I misread that so badly? |
| 12:44 | hyPiRion | Scriptor: Heh, it's over 100 by far. |
| 12:47 | clj_newb | is it possible to reload a file? refresh its functions (using leiningen) |
| 12:49 | clj_newb | (use 'my-ns.core) is not working (I cant make it work) |
| 12:51 | lysu | hi, help, I have a function (defn f [p & more] (do something)), and an vector (def arr ["1" "2"]), how can I call 'f' as (f p "1" "2") like java not (f p ["1" "2"])? |
| 12:53 | _ulises | lysu: see apply |
| 12:53 | _ulises | ,(doc apply) |
| 12:53 | clojurebot | "([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args." |
| 12:54 | clj_newb | (apply f arr) |
| 12:54 | clj_newb | I think |
| 12:54 | Iceland_jack | ,(apply + [1 2 3 4]) |
| 12:54 | clojurebot | 10 |
| 12:54 | _ulises | ,(apply + 1 [2 3 4]) |
| 12:54 | clojurebot | 10 |
| 13:01 | lysu | ...oh, I see. apply has [f x args] parameters,thank you...I must more read documentation |
| 13:52 | hcastro | can someone help me understand why this query consistently returns nil yet when i run it in the management studio i get results? https://gist.github.com/3333360 |
| 15:12 | qmx | what are the cool kids using for parsing w/ clojure? |
| 16:07 | clojure-newcomer | hey guys, is it possible to get any info about a multi method, like name ? |
| 16:07 | clojure-newcomer | I'm passing a function into another function, and would like to get the name of the function being passed in |
| 16:08 | clojure-newcomer | unsure how to get more than 'clojure.lang.MultiFn@xxxxxx' |
| 16:14 | bbloom | clojure-newcomer: some objects can have metadata |
| 16:14 | bbloom | in the case of functions & other top level definitions, most of that metadata lives on their vars |
| 16:15 | clojure-newcomer | bbloom: so I could introspect on the passed in multi methods metadata ? |
| 16:15 | bbloom | the var is just a mutable indirection around a name and value, which you can get with either (var foo) or the shorthand #'foo |
| 16:15 | bbloom | ,(meta identity) |
| 16:15 | clojurebot | nil |
| 16:15 | bbloom | the identity function doesn't have any meta! |
| 16:15 | bbloom | but the var does: |
| 16:15 | bbloom | ,(meta #'identity) |
| 16:15 | clojurebot | {:ns #<Namespace clojure.core>, :name identity, :arglists ([x]), :added "1.0", :static true, ...} |
| 16:16 | bbloom | turns out, vars are callable too! |
| 16:16 | bbloom | ,(#'inc 5) |
| 16:16 | clojurebot | 6 |
| 16:16 | clojure-newcomer | bbloom: thanks for your help |
| 16:16 | clojure-newcomer | I'll go dig deeper on this |
| 16:17 | bbloom | yeah, def interesting |
| 16:18 | bbloom | but to solve your problem, presumably for debugging purposes, you can just say "my function takes a var, not a function" and then use meta and :name on it. but really, you wouldn't want to do that outside of a debugging/testing/experimenting environment. it makes your function less useful b/c it makes the assumption that it will only ever be called with a NAMED and TOP LEVEL function. but without a var, that could also be an anon functi |
| 16:18 | bbloom | any other type of callable |
| 16:24 | bbloom | ,(-> #'inc meta :name) |
| 16:24 | clojurebot | inc |
| 16:24 | clojure-newcomer | bbloom: nice, thanks |
| 16:38 | clojure-newcomer | bbloom: your last works in REPL but not in my prof… any ideas ? I get 'unable to resolve var: xxx in this context |
| 16:39 | clojure-newcomer | *prog |
| 16:39 | bbloom | ,#'asdf |
| 16:39 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve var: asdf in this context, compiling:(NO_SOURCE_PATH:0)> |
| 16:39 | bbloom | ,#'inc |
| 16:39 | clojurebot | #'clojure.core/inc |
| 16:39 | bbloom | ,#'asdf/inc |
| 16:39 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve var: asdf/inc in this context, compiling:(NO_SOURCE_PATH:0)> |
| 16:40 | bbloom | clojure-newcomer: the var you're trying to get at must be in scope |
| 16:41 | clojure-newcomer | bbloom: hmmm its from a file I include via a :use |
| 16:42 | bbloom | can you create a minimal repro and send it on a paste bin? |
| 16:42 | bbloom | you'll probably figure out the issue while you're creating the minimal reproduction ;-) |
| 16:44 | clojure-newcomer | bbloomer: probably because I am using [dispatch-func] and then later on #'dispatch-fund… rather than directly referencing the multi method ? |
| 16:44 | clojure-newcomer | *bbloom… unsure what happened with my typing then |
| 16:44 | clojure-newcomer | sorry :-) |
| 16:44 | bbloom | what are the square brackets? |
| 16:44 | bbloom | an argument list? |
| 16:44 | clojure-newcomer | its an argument to the function where I am trying to do this |
| 16:45 | bbloom | ah yeah, that's not a var :-) |
| 16:45 | bbloom | that's a symbol |
| 16:45 | clojure-newcomer | bbloom: ok, yup, showing my newbness |
| 16:45 | clojure-newcomer | bbloom: is this all impossible then ? |
| 16:46 | bbloom | so in short: symbols are string-like-things that refer to other things; keywords are string-like things that refer themselves; vars are objects which provide thread local storage and are identified by symbols |
| 16:46 | bbloom | clojure-newcomer: you just need to understand a little more deeply what's going on: |
| 16:46 | bbloom | ,((fn [x] (type x) 'inc) |
| 16:46 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 16:46 | bbloom | ,((fn [x] (type x) 'inc)) |
| 16:46 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval127$fn> |
| 16:46 | bbloom | ,((fn [x] (type x)) 'inc) |
| 16:46 | clojurebot | clojure.lang.Symbol |
| 16:46 | bbloom | heh. i suck at parens aparently |
| 16:47 | bbloom | anyway |
| 16:47 | bbloom | note that the VALUE of x is a symbol |
| 16:47 | bbloom | ,((fn [x] (type x)) #'inc) |
| 16:47 | clojurebot | clojure.lang.Var |
| 16:47 | bbloom | see the difference? |
| 16:48 | clojure-newcomer | bbloom: working through it now |
| 16:48 | clojure-newcomer | ... |
| 16:49 | bbloom | clojure-newcomer: however, if you're a noob, you probably shouldn't fuck with this at all. resist the urge to prematurely generalize :-) |
| 16:50 | clojure-newcomer | bbloom: definitely a noob... |
| 16:50 | bbloom | clojure-newcomer: is this your first lisp too? |
| 16:50 | clojure-newcomer | trying to find a way to dispatch on content type in a composure powered app |
| 16:50 | clojure-newcomer | bbloom: yes |
| 16:50 | clojure-newcomer | I fought it for years :-) |
| 16:51 | bbloom | clojure-newcomer: haha, it's ok. once you "get" symbols, you'll be like "do'h! of course! that makes perfect sense! How did I ever write code before without all of these things?" |
| 16:51 | bbloom | i don't know anything about composure |
| 16:51 | bbloom | but you almost definitely don't want to dispatch based on function name |
| 16:51 | bbloom | that's a very ruby-ish thing to do |
| 16:51 | bbloom | (is that we're you're coming from? ;-)) |
| 16:52 | clojure-newcomer | bbloom: what would be the clojure _way_ / alternative ? |
| 16:52 | bbloom | clojure prefers immutable DATA |
| 16:52 | clojure-newcomer | yes, I have done a fair bit of Ruby |
| 16:52 | bbloom | so i presume composure uses ring? where you get HTTP request and response maps? |
| 16:52 | bbloom | and there is a :content-type key or something? |
| 16:52 | clojure-newcomer | and you are right I am not only trying to dispatch based on a function… but on a multimethod… (even more dangerous ? ) |
| 16:53 | clojure-newcomer | bbloom: oh, I see what you are suggesting… interrogate request to determine path which in turn means I know the function |
| 16:53 | clojure-newcomer | ? |
| 16:53 | bbloom | yeah… that just seems strange multi methods exist to facilitate dispatching, so dispatching on a dispatch primitive seems uncessary |
| 16:53 | bbloom | yeah, so you can dispatch on a property of the request map |
| 16:54 | clojure-newcomer | bbloom: I'm kind of dispatching to negotiate API version and user agent… and then separately to negotiate content type to wrap the result of the former dispatch… sound mental ? |
| 16:54 | clojure-newcomer | bbloom: coolio, I will try what you suggest… and thanks for the help! |
| 16:54 | bbloom | (defmethod respond-by-content-type (fn [request] (get request :content-type))) |
| 16:54 | bbloom | soorry, that should be defmulti |
| 16:54 | bbloom | (defmulti respond-by-content-type (fn [request] (get request :content-type))) |
| 16:55 | bbloom | that's saying: define a multimethod called respond-by-content type who's dispatch function is "get the content type from the request" |
| 16:55 | bbloom | and since keywords can be called like functions and behave similar to 'get, you can do: |
| 16:55 | clojure-newcomer | bbloom: looks like the kind of thing I want to do |
| 16:55 | bbloom | (defmulti respond-by-content-type :content-type) |
| 16:55 | bbloom | then you do: |
| 16:56 | bbloom | (defmethod respond-by-content-type :json [request] ….) |
| 16:56 | bbloom | or :application/json or whatever it is |
| 16:56 | bbloom | or maybe it's "application/json" as a string |
| 16:56 | bbloom | *shrug* |
| 16:57 | bbloom | in OOP terms, you can think about it as defining a ContentTypeResponder class and then making a function get_content_type_responder(content_type) that you then call responder.respond(request) where each TypeResponder subclass has a respond(request) method |
| 16:58 | bbloom | only with a lot less typing, a lot less class names, and a lot more flexibility |
| 16:58 | clojure-newcomer | bbloom: loving multi methods, been waiting for something like this for years :-) |
| 16:59 | bbloom | clojure-newcomer: multimethods have been around since at least the 80s :-) |
| 17:00 | bbloom | clojure-newcomer: everything old is new again! |
| 17:00 | clojure-newcomer | haha |
| 17:00 | bbloom | probably much further back than that |
| 17:00 | clojure-newcomer | bbloom: I'm from the Java gen :-( |
| 17:00 | clojure-newcomer | I missed all the cool stuff |
| 17:01 | bbloom | it's ok, i got my start on Visual Basic 3 :-/ it's never too late to go back to basics |
| 17:01 | clojure-newcomer | Jeez :-) |
| 17:03 | bbloom | anyway, in the ruby world |
| 17:03 | bbloom | to get dynamic dispatch, you need to use either inheritance or send by name |
| 17:04 | bbloom | so you see a lot of foo.send("abc_#{xyz.get_foo.type.name.underscorize}") |
| 17:04 | bbloom | stuff like that |
| 17:04 | bbloom | right? |
| 17:04 | clojurebot | Equal Rights for Functional Objects is Baker's paper on equality and why it's impossible to define sensible equality in the presence of mutable data structures: http://www.pipeline.com/~hbaker1/ObjectIdentity.html |
| 17:04 | clojure-newcomer | bbloom: oh yeah, the nasties |
| 17:04 | bbloom | you shouldn't need to do that in clojure land b/c you have an extensible dispatch mechanism |
| 17:05 | bbloom | it's called a hash table! |
| 17:05 | bbloom | you can do the same thing in ruby, if you make a hash table of types to functions to call |
| 17:05 | bbloom | that's all multimethods are under the hood |
| 17:05 | bbloom | they are some function of argument to dispatch key, and then a map of those keys, to their respective functions |
| 17:06 | clojure-newcomer | haha, now you are making it sound easy :-) |
| 17:06 | bbloom | not easy: simple ;-) |
| 17:06 | clojure-newcomer | true |
| 17:09 | clojure-newcomer | bbloom: right I am gonna go make this thing work! Thanks for taking the time to stop me from committing acts of evil with this language :-) |
| 17:10 | bbloom | clojure-newcomer: my pleasure. good luck! |
| 17:10 | clojure-newcomer | thanks! |
| 17:12 | mytrile | Hey, guys. My problem is emacs related. I have clojure-swank leiningen plugin installed, but when I connect to the server in emacs and try to evaluate some function it gives me "Window #<window 3 on core.clj> too small for splitting". I'm also using emacs-live. Any ideas ? |
| 17:40 | bbloom | dnolen: you there? |
| 17:49 | nodename | Help please: running "cljsc nodels.cljs {:target :nodejs} >out/nodels.js". this was fine last time but now I get "WARNING: The form (. this toString) is no longer a property access. Maybe you meant (. this -toString) instead?" |
| 17:50 | nodename | What have I done? |
| 17:50 | bbloom | nodename: did you upgrade clojurescript? |
| 17:50 | nodename | maybe I need to? |
| 17:51 | bbloom | probably not |
| 17:51 | bbloom | just wondering if you did |
| 17:51 | nodename | not sure |
| 17:51 | bbloom | and are you calling toString somewhere in your code? |
| 17:51 | bbloom | either as .toString or (. x toString) or something like that? |
| 17:51 | nodename | not at all |
| 17:51 | bbloom | ok |
| 17:52 | bbloom | well it *might* be fixed in a newer version of clojurescript, but in short the issue is that java and javascript have differing semantics for member access |
| 17:52 | nodename | here is nodels.cljs (copied from somewhere) that worked earlier: |
| 17:52 | bbloom | consider obj.method(arg) |
| 17:52 | nodename | $ ls |
| 17:52 | nodename | browserconnect/ getgen/ nodehello/ nodels/ |
| 17:52 | nodename | ; This one doesn't yet work with :optimizations :advanced |
| 17:52 | bbloom | then consider (obj.method)(arg) that works in javascript, but not java |
| 17:53 | bbloom | in javascript, you can get methods without invoking |
| 17:53 | nodename | oops, here it is: |
| 17:53 | bbloom | so in clojurescript (.-method obj) will return a function, but (.method obj) will call it |
| 17:54 | bbloom | that change required cljs.core be fixed up a bunch, so the warning was added |
| 17:54 | nodename | ; This one doesn't yet work with :optimizations :advanced |
| 17:54 | nodename | (ns nodels |
| 17:54 | nodename | (:require [cljs.nodejs :as nodejs])) |
| 17:54 | nodename | (def fs (nodejs/require "fs")) |
| 17:54 | nodename | (def path (nodejs/require "path")) |
| 17:54 | nodename | (defn file-seq [dir] |
| 17:54 | nodename | (tree-seq |
| 17:54 | bbloom | generally, the warning is totally safe to ignore |
| 17:54 | nodename | (fn [f] (.isDirectory (.statSync fs f) ())) |
| 17:54 | nodename | (fn [d] (map #(.join path d %) (.readdirSync fs d))) |
| 17:54 | nodename | dir)) |
| 17:54 | nodename | (defn -main [& paths] |
| 17:54 | nodename | (dorun (map println (mapcat file-seq paths)))) |
| 17:54 | nodename | (set! *main-cli-fn* -main) |
| 17:54 | nodename | ~ |
| 17:54 | clojurebot | No entiendo |
| 17:54 | hyPiRion | nodename: Use a pastebin please. |
| 17:54 | gfredericks | ~refheap |
| 17:54 | clojurebot | I don't understand. |
| 17:54 | ibdknox | ~gist |
| 17:54 | clojurebot | gist is forget ~paste |
| 17:54 | ibdknox | ~paste |
| 17:54 | clojurebot | paste is not gist.github.com |
| 17:54 | ibdknox | lol |
| 17:55 | hyPiRion | ~botsnack |
| 17:55 | clojurebot | Thanks, but I prefer chocolate |
| 17:55 | gfredericks | clojurebot: refheap is gist |
| 17:55 | clojurebot | You don't have to tell me twice. |
| 17:55 | hyPiRion | heh. |
| 17:55 | Raynes | ibdknox: His paste factoid is broken beyond repair. |
| 17:55 | nodename | @hyPiRion ok, sorry |
| 17:55 | ibdknox | Raynes: haha apparently |
| 17:55 | bbloom | heh. |
| 17:55 | Raynes | ibdknox: Do you have any cljs -> node experience, by chance? |
| 17:55 | gfredericks | ~refheap |
| 17:55 | clojurebot | refheap is forget ~paste |
| 17:55 | bbloom | nodename: in short, you can probably just ignore the warning |
| 17:55 | Raynes | dnolen isn't here for me to bug him. |
| 17:56 | nodename | @bbloom thanks, but I also have a run error: |
| 17:56 | nodename | $ node out/nodels.js |
| 17:56 | nodename | The "sys" module is now called "util". It should have a similar interface. |
| 17:56 | ibdknox | Raynes: I got it working briefly, but then got fed up with it |
| 17:56 | nodename | and no ls output |
| 17:56 | Raynes | Bleh. |
| 17:56 | bbloom | Raynes: i haven't tried cljs->node, but i've got experience with both. maybe i can help? |
| 17:56 | bbloom | nodename: ah, yes, that was just fixed in clojurescript |
| 17:57 | bbloom | nodename: https://github.com/clojure/clojurescript/commit/67e120c53774cae1a71b0a021fcdd5e3f8f888ab |
| 17:57 | nodename | Oh hold up, hold up! if I add an argument such as . I get output! |
| 17:57 | Raynes | bbloom: Well, it was all working fine until I put code in a second cljs file. Now I'm getting a weird error. I can move my code into one single file and everything is peachy. Not sure what is going on. http://github.com/Raynes/refh/tree/cljs |
| 17:57 | Raynes | TypeError: Cannot read property 'q' of null |
| 17:58 | bbloom | Raynes: can you create a minimal repro? ie copy the two files & then delete code until you can't delete any more, but it still fails? |
| 17:58 | Raynes | The js output is so optimized that I can't tell what the problem is. |
| 17:58 | nodename | @bbloom ah, so recommend I update clojurescript? |
| 17:58 | bbloom | nodename: yeah, give that a try |
| 17:58 | Raynes | bbloom: It is just because of the refheap.cljs file. |
| 17:59 | nodename | pleae, from where? |
| 17:59 | Raynes | bbloom: I can move all of that code to core.cljs and it works fine. |
| 17:59 | Raynes | The code is fine afaict, it's the fact that there are two files that seems to be tripping it up. |
| 17:59 | Raynes | It might be a bug. |
| 18:00 | bbloom | Raynes: it's probably a bug :-P but let's try to isolate the issue |
| 18:00 | Raynes | I'm not sure how much more isolated I can get it. |
| 18:00 | bbloom | pastebin? |
| 18:00 | Raynes | You can delete every bit of the code in refheap.cljs and still get the error. |
| 18:00 | bbloom | oh whoops |
| 18:00 | djanatyn | I just grabbed the fs library by editing my project.clj and running lein deps. How do I use it in the REPL? |
| 18:00 | bbloom | you sent the file |
| 18:00 | bbloom | er github link |
| 18:00 | Raynes | I sent the entire repo. |
| 18:00 | bbloom | looking now |
| 18:00 | Raynes | :p |
| 18:01 | bbloom | Raynes: your code is bugged :-P |
| 18:01 | bbloom | .-strobj makes an assumption about the type of the map object |
| 18:02 | Raynes | That isn't my code. |
| 18:02 | bbloom | well whoever's code that is, it's bugged |
| 18:02 | Raynes | (as in, I didn't write it) |
| 18:02 | Raynes | It isn't the problem though. |
| 18:02 | djanatyn | do I need to (require) something? |
| 18:02 | ibdknox | hah |
| 18:02 | ibdknox | I need to fix tht |
| 18:03 | Raynes | *shrug* |
| 18:03 | ibdknox | I wonder if that has somehow introduced some subtle bug |
| 18:03 | bbloom | well, you're getting a null reference exception |
| 18:03 | bbloom | and .-strobj will be null |
| 18:03 | bbloom | in many cases |
| 18:03 | Raynes | I've deleted that code entirely and it still happens. |
| 18:03 | nodename | bbloom: thanks! |
| 18:03 | bbloom | perfect. now we're isolating :-) |
| 18:03 | Raynes | And moving it to core.cljs makes it work fine. |
| 18:04 | kleini\ | what's a good command line debugger for clojure? |
| 18:04 | bbloom | if refheap.cljs contains ONLY the namespace declaration, does it work? |
| 18:04 | Raynes | It does not. |
| 18:05 | bbloom | Raynes: what if you omit the ns declaration too, & just compile the two files? |
| 18:05 | bbloom | Raynes: and how are you invoking the compiler? |
| 18:05 | Raynes | lein cljsbuild |
| 18:07 | Raynes | bbloom: It wont compile without a namespace declaration. |
| 18:07 | bbloom | Raynes: what about with the ns declaration, but without the require clause? |
| 18:07 | ibdknox | yeah you can't compile an empty file |
| 18:08 | Raynes | bbloom: Same thing. |
| 18:08 | bbloom | hmm |
| 18:08 | bbloom | you have a circular dependency |
| 18:08 | bbloom | cor erequires refh.refheap |
| 18:08 | bbloom | and refheap requires core |
| 18:08 | bbloom | er no it does |
| 18:08 | bbloom | never mind |
| 18:08 | bbloom | sorry |
| 18:08 | Raynes | I was about to ask what universe. |
| 18:08 | Raynes | :p |
| 18:09 | bbloom | github played a little trick on me with that goofy sliding animation |
| 18:09 | bbloom | :-P |
| 18:09 | Raynes | Does the order that these things get compiled in matter? Because I have no idea what the order is. |
| 18:11 | bbloom | Raynes: In theory, it shouldn't. when compiling A with a reference to B, the compiler will pause to go compile B, unless it already has been |
| 18:12 | bbloom | i don't really trust lein cljsbuild tho… the few times i tried to use it, it did weird stuff and i don't like the auto-compilation behavior. I invoked the compiler by hand in a build script or so & manually wired up my own repls |
| 18:13 | Raynes | If I couldn't use lein-cljsbuild, I'd probably just not use clojurescript. |
| 18:13 | gfredericks | or, if there is not a pen nearby, I have to convince myself that what I thought of ain't funny. |
| 18:14 | kleini\ | window move 7 |
| 18:14 | kleini\ | sorry :P |
| 18:15 | bbloom | Raynes: does it work if you turn advanced optimizations off? |
| 18:15 | bbloom | if the answer is no, then the error message will be far more enlightening |
| 18:18 | Raynes | bbloom: TypeError: Cannot read property 'cljs$lang$maxFixedArity' of null |
| 18:19 | bbloom | Raynes: we'll that's a step forward! :-) |
| 18:20 | bbloom | hmm…. soo that property is checked when calling apply |
| 18:20 | bbloom | did it print a stack trace? |
| 18:21 | bbloom | seems like somebody is trying to (apply nil …) |
| 18:23 | Raynes | bbloom: https://www.refheap.com/paste/4295 |
| 18:24 | bbloom | Raynes: what's at /Users/anthony/code/refh/refh.js:12328:17 ? |
| 18:25 | Raynes | cljs.core.apply.call(null, cljs.core._STAR_main_cli_fn_STAR_, cljs.core.drop.call(null, 2, cljs.nodejs.process.argv)); |
| 18:25 | Raynes | bbloom: ^ There's your null apply. |
| 18:26 | bbloom | yup, cljs.core/*main-cli-fn* is nil! |
| 18:26 | bbloom | :-P |
| 18:27 | bbloom | looks like that code is generated out of nodejscli.cljs |
| 18:27 | Raynes | bbloom: So I guess it is expecting *main-cli-fn* to be in refheap.cljs then. |
| 18:28 | Raynes | To be bound, I mean. |
| 18:28 | Raynes | Sounds like a compilation order issue to me. |
| 18:28 | Raynes | *shrug* |
| 18:29 | bbloom | Raynes: no |
| 18:29 | bbloom | look at build in closure.clj |
| 18:29 | bbloom | unless lein cljsbuild is bypassing that |
| 18:29 | bbloom | it compiles all source files |
| 18:29 | bbloom | & then compiles nodejscli.cljs |
| 18:29 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: then in this context |
| 18:30 | bbloom | oh DUH. i know the issue! |
| 18:31 | bbloom | your file is being compiled |
| 18:31 | bbloom | not run |
| 18:31 | bbloom | then that's going into a big bag of namespaces |
| 18:31 | bbloom | which are being compiled, not run |
| 18:32 | bbloom | so it's not compile order, it's execution order |
| 18:32 | bbloom | nodejscli is being executed before the code that sets the main fn |
| 18:32 | Raynes | Why has God forsaken me!!!1! |
| 18:33 | bbloom | i'm not exactly sure how to go about fixing that... |
| 18:37 | bbloom | Raynes: you should file a bug against cljs |
| 18:37 | bbloom | include the error message, stack trace, and the line code i asked you for, and point towards nodejscli.cljs |
| 18:37 | bbloom | then i'd pester dnolen to look at it ;-) |
| 18:37 | bbloom | anyway, i gotta run |
| 18:37 | bbloom | good luck! |
| 18:47 | cmajor7 | cemerick.friend => is there a way to redirect to a different uri dynamically? It seems that the only redirect uri that is looked at is a static: ":default-landing-uri": http://bit.ly/Tw3l5N |
| 18:48 | cmajor7 | *on a successful auth |
| 19:03 | Raynes | Dear Jira, thank you for notifying me to let me know that I commented on and/or created an issue 5 seconds ago. |
| 19:04 | talios | It's just trying to be helpful. |
| 19:04 | McMartin | That is science |
| 19:05 | Raynes | Dear Printer… meh, don't even get me started on printers. |
| 19:06 | grizlo42 | Raynes: https://twitter.com/ktoro/statuses/199577756995031041 |
| 19:07 | qmx | lol |
| 19:07 | Raynes | lol |
| 19:07 | McMartin | Subtle |
| 19:08 | qmx | ironically enough, after with fiddling with github issues I missed JIRA a lot :P |
| 19:08 | grizlo42 | McMartin: I think that was what he was going for... |
| 19:09 | grizlo42 | its more of a least of all evils deal |
| 19:09 | McMartin | Argh, my old coworker's appletalk printer routine is now running through my head |
| 19:09 | McMartin | Appletalk was rather infamously chatty |
| 19:09 | McMartin | So he would impersonate printers on appletalk networks |
| 19:10 | McMartin | "I'm a printer! I'm a printer! Does anyone have any documents they want to print? 'Cause I can! Because I'm a printer! Are you a printer? That's too bad, being a printer (like me! I'm a printer!) is great!" |
| 19:10 | McMartin | There were hand gestures |
| 19:10 | qmx | looks scary |
| 19:21 | Frozenlock | Is every jquery function wrapped in jayq? |
| 19:37 | the-kenny | Frozenlo`: I don't tink so. `parents' for example isn't in the .jar in my project |
| 21:05 | Raynes | dnolen: ping |
| 21:09 | JanFrederic | Raynes, I worship His Shadow. |
| 21:24 | djanatyn | I'm having trouble using the fs library I got from clojars. |
| 21:24 | djanatyn | it defines a function, name, that's already defined in clojure.core. |
| 21:24 | djanatyn | so, I tried to exclude that by using :exclude |
| 21:24 | djanatyn | I think I'm doing it wrong. |
| 21:26 | djanatyn | http://sprunge.us/VIKg?cl -- does anything stand out in this snippet as being wrong? |
| 21:26 | djanatyn | I think it *might* have something to do with my emacs setup. I'm not really sure how the REPL and the files I edit are connected. |
| 21:27 | jeremyheiler | You shouldn't have to quote it. Either way, I would probably use require instead. (ns clojureblog.core (:require [fs.core :as fs])) |
| 21:27 | djanatyn | what's the difference between using use and require? |
| 21:28 | jeremyheiler | by deafult require forces you to use the fully qualified name. so if I require clojure.string, in order to use "join" i would need to say (clojure.string/join "-" [seq of stuff]) |
| 21:29 | djanatyn | okay. so it wouldn't try to overwrite the (nam)e function - it would just add (fs/name) |
| 21:29 | jeremyheiler | But if I use (:require [clojure.string :as string]) i would say (string/join "-" [seq of stuff]) |
| 21:29 | jeremyheiler | yeah |
| 21:29 | djanatyn | cool! thank you for your help. |
| 21:29 | jeremyheiler | np |
| 21:30 | djanatyn | I changed it and tried recompiling, but now I'm getting an error |
| 21:30 | djanatyn | java.lang.IllegalStateException: name already refers to: #'fs.core/name in namespace: clojureblog.core |
| 21:31 | Frozenlo` | I'm trying to use jayQ and clojurescript to do this simple example: http://jqueryui.com/demos/datepicker/ but can't figure it out... So far I have (bind $datepicker :click $/datepicker). I get this error each time I click my text-field: Uncaught TypeError: Object #<Datepicker> has no method 'apply' |
| 21:31 | djanatyn | well. after restarting emacs I don't get that error. thanks! |
| 21:31 | jeremyheiler | djanatyn: good lol |
| 21:32 | jeremyheiler | was thinking something like that was the issue |
| 21:47 | qmx | is there any "autotest" runner for clojure.test? |
| 21:47 | qmx | or should I look at another test framework? |
| 22:09 | djanatyn | one more question; in the REPL, I type (use 'foo.core) to load the core.clj file in the project I'm currently working on |
| 22:10 | djanatyn | then I edit that file in another buffer, and compile it with C-c C-k. However, if I add new functions and definitions, the REPL doesn't reflect that unless I type (use 'foo.core) again. |
| 22:10 | djanatyn | Is there any way to have the REPL automatically load the file whenever it changes? that's how I worked whenever I wrote common lisp with SLIME. |
| 22:11 | djanatyn | or is the clojure workflow different, and should I be doing this another way? |
| 22:12 | xeqi | I usually use C-c M-n to change to the namespace in the file |
| 22:13 | xeqi | and using C-c C-k to add/change functions works like that |
| 22:17 | djanatyn | xeqi: I don't completely understand what you did |
| 22:17 | djanatyn | did you make a new function and bind it to C-c M-n? did you change the namespace of your REPL? |
| 22:20 | xeqi | oh, blah.. I don't see that binding in clojure-mode |
| 22:20 | xeqi | recently trnasistioned to nrepl.el and must of picked it up there |
| 22:23 | xeqi | I think just using (in-ns 'your.namespace.here) in the repl will do the same thing |
| 22:25 | djanatyn | yes, it does! :D thank you very much! |
| 22:49 | estebann | is there a way to test if a symbol is namespace qualified? |
| 22:51 | xeqi | &(map namespace ['x 'foo/x]) |
| 22:51 | lazybot | ⇒ (nil "foo") |
| 22:51 | estebann | heh |
| 22:52 | estebann | I missed that somehow. |
| 22:52 | estebann | thanks |
| 23:23 | Bahman | Hi all! |
| 23:23 | jeremyheiler | Hello |
| 23:25 | talios | 'lo |
| 23:25 | gfredericks | Hel' |
| 23:40 | treehug | is there someway to make clojure print out more meaningful textual representation of Java arrays? it gives me something like #<double[][] [[D@44022631> by default |
| 23:42 | jeremyheiler | treehug: try using pprint |
| 23:43 | treehug | oh yeah that's perfect. thanks! |
| 23:43 | jeremyheiler | np |