2012-07-15
| 00:21 | wingy | good morning |
| 00:34 | gfredericks | you shouldn't have said that so loud; my son woke up and thinks it's morning |
| 00:39 | devth | i'm pretty sure this used to return true: (seq? [1 2 3]). at least my 6 month old source code assumes so. |
| 00:39 | devth | my clojure is super rusty - is there a function that returns true for both lists and vectors? |
| 00:40 | devth | looks like coll? is what i'm looking for. |
| 00:44 | zakwilson | ,(doc coll) |
| 00:45 | zakwilson | ,(doc coll?) |
| 00:45 | zakwilson | ,(clojure.repl/doc coll?) |
| 00:46 | musicalchair | &(doc coll?) |
| 00:46 | lazybot | ⇒ "([x]); Returns true if x implements IPersistentCollection" |
| 00:48 | devth | cool. |
| 01:20 | technomancy | https://github.com/technomancy/limit-break |
| 01:24 | duck1123 | so does the repl have the full scope? |
| 01:24 | technomancy | yeah |
| 01:24 | duck1123 | sweet |
| 01:24 | technomancy | it's not as nice as swank.core/break, but it's a start |
| 01:25 | technomancy | well, it's basically useless right now because it requires trampoline and stdin |
| 01:25 | technomancy | but it's a start |
| 01:25 | technomancy | 25 lines |
| 01:30 | yonatane | would a clojure IDE written from scratch in clojure be cool or redundant? |
| 01:31 | duck1123 | there's clooj and light table |
| 01:32 | duck1123 | possibly others |
| 01:32 | yonatane | is light table going to handle projects? |
| 01:32 | sproc | I'm trying out Clojure and running into an issue trying to load a data structure from a file with load-file: http://pastebin.com/qnBRCg97 |
| 01:33 | duck1123 | yonatane: that's the plan, I believe |
| 01:40 | georgek | hi, I'm trying out the simple example of lein-cljsbuild (with lein2) on Windows XP, everything works up to 'lein ring server-headless 3000', when I get the error "Could not locate example/routes__init.class or example/routes.clj on classpath" |
| 01:41 | duck1123 | sproc: have you verified that you're getting the correct command line args? |
| 01:41 | georgek | no, I'm just following the readme in the example |
| 01:42 | duck1123 | georgek: is example.route what you named your file? |
| 01:43 | georgek | it's named example.routes which conforms to the error msg |
| 01:43 | georgek | I copied the example from lein-cljsbuild to my directory |
| 01:44 | duck1123 | so you have a file at src/example/routes.clj with a ns of example.routes |
| 01:44 | georgek | right |
| 01:46 | duck1123 | the advanced example? Looks like it has a non-standard clj src path. Make sure you either have it in src/ or that you have the :source-path key set in project.clj |
| 01:47 | georgek | it's the simple example, yes the source-path is set in project.clj |
| 01:47 | georgek | sorry I answered 'right' to the spirit of your first question :) |
| 01:48 | sproc | duck1123: I modifed the app to print the command-line args, and they were as expected. Then I uncommented config-map and noticed that those print statements didn't execute before the stack trace was printed, despite them coming first. The exceptions are from clojure.lang.Compiler; is it trying to compile rather than interpret? |
| 01:48 | duck1123 | if you launch a repl can you require the ns? |
| 01:49 | georgek | I haven't launched a cljs repl before, or do you mean a clj repl? |
| 01:50 | duck1123 | a clj repl. It can't hind your clj files here |
| 01:50 | duck1123 | sproc: I know there's an issue with defining vars within a do, I wonder if something similar is hapening here |
| 01:51 | duck1123 | best I could say is "don't do that" |
| 01:51 | sproc | duck1123: within a 'do'? |
| 01:52 | sproc | I'm not familiar with that term. |
| 01:52 | duck1123 | sproc: Yeah, I can't remember the full details, but if you do something like (do (def a 1) (+ 1 a)) it wouldn't work... or something |
| 01:52 | sproc | duck1123: Oh, I see |
| 01:52 | sproc | duck1123: Alright, I think I can work around that. Thanks for the help. |
| 01:53 | duck1123 | I would just read the data from the file, and assign it in your ns |
| 01:54 | duck1123 | you can look at what I do here" https://github.com/duck1123/ciste/blob/master/src/ciste/config.clj |
| 02:15 | Tcepsa | I also have a cljs question: In the ns form at the beginning of the cljs file, I'm attempting to (:use [clojure.string :only [split]]) and then later on I call (split "60 61 62" #" ") but it doesn't seem to work. |
| 02:15 | Tcepsa | (clojure.string/split "60 61 62" #" ") works just fine though |
| 02:16 | Tcepsa | Aside from "well just do it that way then!" what should I be doing so that I can just call split instead of having to fully qualify it? |
| 02:25 | cheater__ | hey guys what am i doing wrong? user=> (if (2 > 1) 2 3) |
| 02:25 | whamied | prefix notation :) |
| 02:25 | cheater__ | this gives me: ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn |
| 02:25 | cheater__ | hmm |
| 02:25 | cheater__ | right |
| 02:25 | cheater__ | i keep forgetting that always |
| 02:25 | cheater__ | damn |
| 02:26 | whamied | its okay ull get used to it :) |
| 02:27 | cheater__ | is there a good pastebin for clojure? |
| 02:28 | duck1123 | refheap is fairly popular, if not gist |
| 02:28 | cheater__ | i've written a recursive function and it's broken :) |
| 02:28 | cheater__ | trying to implement nth |
| 02:28 | cheater__ | oh wait i think i know what's up |
| 02:29 | cheater__ | https://www.refheap.com/paste/3616 |
| 02:29 | cheater__ | any tipz? |
| 02:30 | IceD^ | hey guys |
| 02:30 | cheater__ | hi |
| 02:30 | IceD^ | I'm tasked to create java bindings for our services, but I cba writing any java |
| 02:31 | IceD^ | 'd like some good tutorial on wrapping clojure in java classes |
| 02:31 | cheater__ | write one! |
| 02:32 | cheater__ | duck1123, whamied - any ideas why this function isn't behaving like nth? :) |
| 02:34 | whamied | it looks to be working for me |
| 02:34 | whamied | be sure to use defn |
| 02:34 | whamied | instead of just fn |
| 02:35 | whamied | that way you can reference it later on |
| 02:36 | duck1123 | looks like you're both peeling of the top element and decrementing the index |
| 02:36 | cheater__ | no i have fn because it's for 4clojure |
| 02:36 | cheater__ | and the error was that 4clojure wanted it all on one line |
| 02:36 | cheater__ | derp |
| 02:36 | whamied | ohh okay haha |
| 02:36 | whamied | so you got it to pass now? |
| 02:40 | georgek | so I've been trying some things with no luck. One weird thing is that starting lein repl from the cljsbuild-example-simple starts the repl with the intro text, but then prints 'nil' and the repl basically is frozen. |
| 02:40 | georgek | I can create an empty lein new project with clojure 1.4 and the repl works normally |
| 02:43 | cheater__ | whamied: yup! |
| 02:43 | whamied | great! |
| 03:01 | cheater__ | guys why does this return [3 2 1] and not [1 2 3]? ((fn foo [x] (when (> x 0) (conj (foo (dec x)) x))) 3) |
| 03:02 | cheater__ | i basically see conj (conj (conj [] 1) 2) 3 |
| 03:02 | duck1123 | ,(conj [1] 2) |
| 03:03 | cheater__ | duck1123: not sure what you mean? |
| 03:03 | duck1123 | conj inserts into the most efficient place for the datatype |
| 03:03 | duck1123 | so vectors and lists insert differently |
| 03:03 | cheater__ | oh |
| 03:04 | duck1123 | Clojurebot is gone |
| 03:04 | cheater__ | yeah |
| 03:05 | cheater__ | does clojure have pattern matching? |
| 03:05 | duck1123 | &(conj [1] 2) |
| 03:05 | lazybot | ⇒ [1 2] |
| 03:05 | sjl | cheater__: google around for core.match |
| 03:06 | cheater__ | no i meant like argument pattern matching |
| 03:06 | cheater__ | kinda like erlang or haskell |
| 03:06 | cheater__ | i think you mean regex? |
| 03:06 | sjl | cheater__: No, core.match has nothing to do with regexes |
| 03:06 | sjl | It's pattern patching. |
| 03:06 | sjl | *matching |
| 03:06 | cheater__ | oh right yeah |
| 03:07 | duck1123 | I think someone tried to build something like that once, but no |
| 03:07 | cheater__ | duck1123: https://github.com/clojure/core.match/ looks good |
| 03:07 | duck1123 | we have multimethods |
| 03:07 | sjl | It's not integrated tightly into the language like haskell, but it's still acceptable concise to use |
| 03:07 | cheater__ | mhm |
| 03:08 | sjl | I'm sure you could write a macro to define functions with pattern matched args using core.match |
| 03:08 | sjl | I'm not entirely sure it'd be a good idea though... |
| 04:02 | xumingmingv | macro can not be passed to a HOF right? |
| 04:03 | Raynes | No. |
| 04:04 | arohner | xumingmingv: but you can do (map #(my-macro %) [:a :b :c]) |
| 04:04 | cheater__ | are there higher order macros? |
| 04:04 | arohner | no, but there is an old contrib project playing around w/ applying macros |
| 04:06 | cheater__ | what does the hint here mean? http://www.4clojure.com/problem/27 |
| 04:07 | cheater__ | Hint: "racecar" does not equal '(\r \a \c \e \c \a \r) |
| 04:08 | xumingmingv | https://github.com/xumingming/storm/blob/issue72/src/clj/backtype/storm/testing4j.clj#L58 |
| 04:08 | xumingmingv | https://github.com/xumingming/storm/blob/issue72/src/clj/backtype/storm/testing4j.clj#L85 |
| 04:08 | xumingmingv | then do you have any advice how to extract a common function from these two functions? |
| 04:09 | xumingmingv | here , with-local-cluster and with-tracked-cluster are macros. |
| 04:09 | xumingmingv | all the logic are the same, just used different macro |
| 04:10 | scottj | cheater__: I think they just want you to know that a string is not a list of characters, you have to seq on a string to get that (or use a function that itself calls seq). not sure how helpful that is |
| 04:11 | cheater__ | oh |
| 04:12 | scottj | cheater__: ahh, I see, it probably is necessary to know that |
| 04:12 | cheater__ | thx scottj |
| 04:21 | logaan | with datomic is it possible to traverse a reference in reverse as part of a query? |
| 04:23 | logaan | as in this example: https://gist.github.com/3115870 |
| 04:35 | fureddo | Hi, I'm new to Clojure. I'm trying to implement a simple card games to get into the language. |
| 04:36 | fureddo | I have a deck of cards defined as (def deck (ref '(c1 c2 c3 c4 c5))) where c1 c2 c3 are cards. I want to pop a card off the deck. How can I do that? |
| 04:39 | fureddo | If I call pop, I lose the card on the top. That's ok, but I want to move the top card into another list instead. Do I need to copy the top card using (peek deck)? |
| 04:39 | logaan | when you de-ref your deck you will get an immutable value |
| 04:39 | logaan | this means that you can query it multiple times without loosing any info |
| 04:41 | logaan | so you can call do: |
| 04:41 | logaan | (let [deck @deck top (first deck) new-deck (rest deck)] [top new-deck]) |
| 04:41 | logaan | and you'll get back a vector (which you can think of as a tupple, with the new deck (sans the card you popped) and the card |
| 04:41 | fureddo | I see... Interesting. |
| 04:41 | logaan | you may then chose to reset! the deck back to new-deck |
| 04:46 | logaan | figured it out. updated gist with solution if anyone's curious. |
| 05:47 | cheater__ | Raynes: hey, can i get lazybot in #codez ? |
| 05:54 | cheater__ | guys how can i find my clojure.jar? i can't seem to find it anywhere, and i can run lein repl |
| 05:59 | cheater__ | found it :)) it was named differently. |
| 07:54 | cheater | does clojure have TCO or do i need to call recur? |
| 07:55 | cheater | so basically if in my definition of funcfoo, if i call funcfoo in the tail, will i get a stack overflow? |
| 07:56 | cheater | there's one too many "if" there :) |
| 07:59 | hyPiRion | you'll have to use recur. |
| 08:08 | antares_ | cheater: recur exists because JVM and JavaScript VMs do not have TCO |
| 09:11 | wingy_ | is there an error in the doc here: http://clojuredocs.org/clojure_core/clojure.core/defprotocol |
| 09:11 | wingy_ | shouldn't extends? take a protocol first and then a type |
| 09:12 | wingy_ | oh |
| 09:12 | unnali | doesn't it? |
| 09:12 | wingy_ | my mistake |
| 09:12 | wingy_ | haha |
| 09:12 | wingy_ | just woke up .. must be it |
| 09:12 | unnali | :D! |
| 09:17 | wingy_ | so basically there is 2 polymorphism systems in clj .. one using multimethods and another using data types (defrecord, deftype) and protocols (defprotocol) |
| 09:18 | wingy_ | the latter was added for java interop? |
| 09:18 | wingy_ | so that you can write clj code and use them in java right? |
| 09:19 | wingy_ | also a simpler polymorphism based on type rather than dispatching value |
| 09:19 | wingy_ | better performence i guess |
| 09:20 | cjfrisz | I'm a big fan of data types myself |
| 09:20 | wingy_ | wasn't the point of FP not to think in classes/objects |
| 09:20 | cjfrisz | Although I'm a speed junkie |
| 09:21 | cjfrisz | Records and protocols may resolve to classes and objects, but the concept is still valid and very useful |
| 09:21 | cjfrisz | Scheme has a similar record system |
| 09:21 | cjfrisz | As does Haskell |
| 09:22 | unnali | cjfrisz: ... Haskell's widely believed to be bollocks (despite heavy use) ... |
| 09:23 | cjfrisz | unnali: ... Touche? |
| 09:23 | cjfrisz | I'm not a big types guy, but I hung out with a whole bunch of them while I was getting my MS |
| 09:23 | wingy_ | there is no inheritance in the type/protocol system in clj? |
| 09:23 | cjfrisz | Type guys (and girls), that is |
| 09:24 | cjfrisz | wingy_ : There *is* inheritance, but it's waaaay more awesome than Java |
| 09:25 | antares_ | wingy_: multimethods let you easily implement inheritance-like semantics. Protocols do not have inheritance, thanks god. That's what makes them flexible. |
| 09:26 | wingy_ | antares_: yeah |
| 09:45 | wingy_ | does anyone know what the problem is here: https://gist.github.com/3116981 |
| 09:46 | wingy_ | hm it worked in lein repl but not in Light Table |
| 09:46 | wingy_ | what is wrong with light table |
| 09:46 | schani | wingy_: i've had a very similar problem with a defprotocol/deftype |
| 09:46 | wingy_ | they changed something in defrecord in clj 1.5? |
| 09:47 | schani | it seems lighttable does some strange magic with defprotocol |
| 09:47 | schani | i thought lighttable used clojure 1.4? |
| 09:48 | wingy_ | *clojure-version*=> {:major 1, :minor 5, :incremental 0, :qualifier "ibdknox5"}|| |
| 09:48 | schani | hmm |
| 09:50 | wingy_ | why is it allowed to not implement all methods by interface in a defrecord? |
| 09:50 | schani | wingy_: quite strange - even after connecting to a clj 1.4 lein project, it reports version 1.5 |
| 09:51 | wingy_ | schani: yeah i think it is using some feature in 1.5 so it must be on 1.5 |
| 09:51 | schani | i'm not familiar with 1.5 at all, so no idea |
| 09:51 | wingy_ | since it's using 1 jvm so it cannot switch |
| 09:52 | schani | it's supposed to switch when you do "connect" |
| 09:52 | wingy_ | probably the end implementation could be running 2 jvms .. one for our project and the other for light table |
| 09:52 | cjfrisz | Wow...you can tell that I've been out for a while when I didn't even realize that 1.5 was ready for public consumption |
| 09:52 | wingy_ | cjfrisz: its not |
| 09:52 | wingy_ | still in development |
| 09:53 | wingy_ | anyone who knows why im not enforced to implement all methods by interface in my record? what is the point? |
| 10:14 | duck1123 | wingy_: that's by design |
| 10:16 | wingy_ | duck1123: what is the purpose? |
| 10:16 | duck1123 | not forcing the programmer to have to implement a million methods before they can tes |
| 10:17 | duck1123 | it should throw an exception for the rest IIRC |
| 10:17 | wingy_ | but if all collections are implementing an Iterable protocol but now they are not forced to implement the methods a user will find it weird that its documented it is using that interface but the "count" method is missing |
| 10:17 | wingy_ | for some implementations |
| 10:18 | wingy_ | you mean before they can test? |
| 10:19 | duck1123 | but if the call count, it'll just throw the not implemented exception saying that it was supposed to be implemented, but never was. |
| 10:20 | duck1123 | If you're implementing a protocol, you should implement all the methods, but no one is forcing you to |
| 10:24 | wingy_ | i c |
| 10:24 | wingy_ | i get an AbstractMethodError yobistore.core.Person.run_slow()Ljava/lang/Object; yobistore.core/eval1089 (NO_SOURCE_FILE:1) error when trying to access a method not implemented yet |
| 10:25 | wingy_ | the error message wasn't to clear about what was hapepning |
| 10:25 | wingy_ | i guess everyone should read it as NOT IMPLEMENTED YET |
| 10:25 | duck1123 | I'm thinking of gen-claas that has the clear error message |
| 10:27 | duck1123 | were you re-defing the protocol in the repl? |
| 10:28 | cheater | hi again |
| 10:28 | cheater | does clojure have automatic tco? |
| 10:28 | duck1123 | cheater: no, use recur |
| 10:29 | cheater | antares_: hmm just saw your answer |
| 10:29 | cheater | duck1123: ok |
| 10:29 | cheater | duck1123: are there targets that do tco? |
| 10:29 | duck1123 | recur has the benefit of asserting it is actually a tail call |
| 10:30 | cheater | i understand, as antares_ said, that recur exists because JVM and JS are too stupid to figure it out |
| 10:31 | duck1123 | cheater: That was the original reason, but it's also a design decision at this point. Rich said he wouldn't add TCO unless he could guarantee it would work in all cases |
| 10:31 | duck1123 | is most cases, you can get what you want without needing recur anyway |
| 10:31 | cheater | right |
| 10:32 | cheater | can i? |
| 10:32 | cheater | by just recursing, without taking care around the stack overflows? |
| 10:32 | wingy_ | duck1123: yeah |
| 10:33 | duck1123 | most of the time when you want to recur, you can make it a lazy seq to acomplish the same goal |
| 10:33 | cheater | ah ok i see what you mean |
| 10:33 | cheater | how do you make lazy stuff? |
| 10:33 | cheater | some sort of yield kw? |
| 10:33 | wingy_ | cheater: lazy-seq |
| 10:33 | cheater | l@@king, thx |
| 10:33 | duck1123 | (lazy-seq (cons ...)) |
| 10:34 | cheater | yeah just read the doc |
| 10:35 | duck1123 | Programming Clojure did a good job of explaining how to not need recur. (at least in the 1st edition) |
| 10:35 | cheater | hey speaking of doc, i like that it works like in python. one question though. is there something like python's "dir"? |
| 10:35 | cheater | docs in the repl are the biggest help ever when learning a new lang |
| 10:36 | cheater | i dread haskell for that reason |
| 10:37 | wingy_ | (doc doc) |
| 10:38 | hyPiRion | &(doc doc) |
| 10:38 | lazybot | ⇒ "Macro ([s]); " |
| 10:38 | wingy_ | do you guys think a java crash course could be helpful in understanding clojure |
| 10:39 | wingy_ | seems that the java interop is everywhere. perhaps it could be good to know the fundamentals about java? |
| 10:39 | cheater | not from what i've seen so far |
| 10:39 | hyPiRion | It's good to know the JVM, but not essential. |
| 10:40 | hyPiRion | ,(doc doc) |
| 10:40 | hyPiRion | Weird, the doc shouldn't be like that. |
| 10:41 | wingy_ | ,(source doc) |
| 10:41 | Bronsa | &(doc doc) |
| 10:41 | lazybot | ⇒ "Macro ([s]); " |
| 10:41 | wingy_ | &(source doc) |
| 10:41 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: source in this context |
| 10:41 | cheater | i know exactly 0 about java but then i'm a cold beginner |
| 10:41 | duck1123 | It's helpful to know your way around a javadoc |
| 10:41 | wingy_ | lynda java crash course seems nice |
| 10:42 | hyPiRion | &(doc assoc) |
| 10:42 | lazybot | ⇒ "([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)." |
| 10:42 | wingy_ | why is there & and , for running code |
| 10:42 | wingy_ | different bots? |
| 10:42 | hyPiRion | yes. |
| 10:42 | wingy_ | who owns these bots? can i just create one and use it here? |
| 10:43 | duck1123 | , = clojurebot & = lazybot |
| 10:43 | duck1123 | hiredman and Raynes respectively, I believe |
| 10:47 | Bronsa | you can also eval an expression inline like ##'this |
| 10:47 | lazybot | ⇒ this |
| 10:47 | hyPiRion | lazybot: botsnack |
| 10:47 | lazybot | hyPiRion: Thanks! Om nom nom!! |
| 10:47 | hyPiRion | I find that oddly comforting. |
| 10:49 | wingy_ | lazybot: hello |
| 10:49 | wingy_ | :( |
| 10:52 | wingy_ | when will 1.5 come out? |
| 11:05 | wingy_ | one good way to learn clj i think is to read stackoverflow questions .. so many great answers |
| 11:09 | wingy_ | so there are 4 reference types (var, ref, agent, atom) for changeable state .. but when i define the latter 3 it seems that i bind them all to a var (def v (ref 0)). this mean that the latter 3 are values which have to be bound to a var? |
| 11:12 | duck1123 | they don't have to be bound to a var, but they often are |
| 11:12 | hyPiRion | You can bind them with a let as well. |
| 11:13 | hyPiRion | &((fn [a] (swap! a inc)) (atom 0)) |
| 11:13 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: in this context |
| 11:13 | hyPiRion | &((fn [a] (swap! a inc)) (atom 0)) |
| 11:13 | lazybot | ⇒ 1 |
| 11:49 | wingy_ | duck1123 hyPiRion: ok so they are values just like collections and scalar values but Var is not a value |
| 11:49 | wingy_ | Var is a mere reference to it's binding value |
| 12:04 | wingy_ | it says in the doc "Only Java fields, Vars, Refs and Agents are mutable in Clojure." |
| 12:04 | wingy_ | isn't atom mutable as well? |
| 12:41 | edon | hello, what resource would you suggest for learning clojure to someone that is already quite familiar with functional programming? |
| 12:44 | hyPiRion | edon: 4clojure.com |
| 12:56 | kmicu | wingy_: atoms are mutable |
| 12:57 | kmicu | edon: http://clojurebook.com/ |
| 13:11 | wingy_ | they should provide a github repo for us to change the reference doc |
| 13:14 | kmicu | wingy_: it is not so hard to join dev http://clojure.org/contributing |
| 13:16 | duck1123 | In the mean time, you could add examples to clojuredocs |
| 13:17 | wingy_ | i want to correct doc |
| 13:17 | wingy_ | ill read it though later |
| 13:17 | hyPiRion | kmicu: About that, would it still be possible to join clojure-contrib, even though it's not monolithic anymore? |
| 13:18 | hyPiRion | I suppose yes, but I've not really looked into it. |
| 13:22 | duck1123 | If you have a contrib lib that didn't make it, it's because it was either ill-conceived, or no one cared about it |
| 13:22 | duck1123 | I'm sure if you were willing to be point on it, you could get it promoted |
| 13:23 | duck1123 | but check if there's a non-contrib that has taken it's place |
| 13:25 | hyPiRion | duck1123: I meant "join" as in signing the CA with both clojure and clojure-contrib on it. |
| 13:42 | georgek | hi, I'm trying to get the cljsbuild example at https://github.com/emezeske/lein-cljsbuild/tree/master/example-projects/advanced working, and I can get up to 'lein trampoline cljsbuild repl-launch firefox http://localhost:3000/repl-demo', but then I get 'Could not find the main class: and. Program will exit.' -- this is on Windows, so it's some file path issue; I've seen references to changing colons to semicolons in a cljs build scri |
| 13:42 | georgek | pt but I don't know where to do this using cljsbuild, any ideas? |
| 13:45 | duck1123 | georgek: still no luck with that? |
| 13:45 | georgek | I've made progress actually, just a different problem that's the same :) |
| 13:45 | duck1123 | oh, that, ok. :) |
| 13:45 | georgek | sometimes using Windows is like wearing a hairshirt I guess |
| 13:46 | duck1123 | You know what Windows is good for? Running a linux VM. :) |
| 13:46 | georgek | ha |
| 13:46 | georgek | yes, I have one sitting here I can use |
| 13:46 | georgek | I'm just stubborn ;) |
| 13:48 | duck1123 | does repl-rhino work? |
| 13:49 | georgek | I haven't tried it |
| 13:49 | georgek | let me find the syntax |
| 13:49 | kmicu | georgek: example-projects/simple works? |
| 13:49 | duck1123 | on the subject of cljs and repls. What's the current state of running cljs repls inside of emacs? |
| 13:49 | georgek | yes kmicu |
| 13:50 | georgek | I've done it successfully with cljs one duck1123 |
| 13:50 | kmicu | duck1123: no problem? ;) |
| 13:50 | georgek | there are other ways like with inferior-lisp too |
| 13:50 | sirsublime | Hey, everybody! Could someone help me out with leiningen? I need to compile some Java code, but even the simplest class fails. |
| 13:51 | duck1123 | are you guys just launching with a terminal inside emacs, or what? |
| 13:51 | kmicu | georgek: cljs1 works on windows, but it is half year old :] |
| 13:51 | duck1123 | I'm just now turning my attention back to cljs |
| 13:52 | georgek | yes kmicu, and with lein1x only it seems, that's why I'm trying cljsbuild |
| 13:52 | georgek | duck1123, you can do with with a terminal, or inferior-lisp directly |
| 13:53 | georgek | duck1123, repl-rhino gives the same error, 'could not find the main class: and.' -- file path problem somewhere |
| 13:54 | georgek | at least it's narrowed down to either cljs, lein, or cljsbuild ;) |
| 13:54 | georgek | my working directory does not contain spaces btw |
| 13:55 | georgek | is there a way to print what paths cljs is using in process |
| 13:55 | kmicu | georgek: maybe because folders start with dot? https://github.com/emezeske/lein-cljsbuild/blob/master/example-projects/advanced/project.clj#L20 |
| 13:55 | duck1123 | not sure of cljs, but lein classpath might help you |
| 13:57 | georgek | yep I bet it's bombing on my .m2 file path, in 'Documents and Settings' |
| 13:57 | georgek | lein puts .m2 there as it's the user home though |
| 13:57 | georgek | maybe a way to reconfigure that |
| 13:58 | kmicu | georgek: but then simple version fo example project should faild also? |
| 13:58 | TimMc | sirsublime: What --version of lein? And how are you instructing lein to compile the Java? |
| 13:58 | duck1123 | lein has a :local-repo key |
| 13:58 | georgek | maybe not kmicu, as simple does not launch a repl |
| 13:59 | georgek | something to do with repl launch screws it up? |
| 13:59 | georgek | simple is just compilation |
| 14:00 | darrenaustin | Hey folks. Newbie here. I was trying to install kibit for lein 1.x and ran into a NPE when running "lein plugin install jonase/kibit 0.0.4". Anyone know what might be causing this? |
| 14:00 | georgek | what OS? |
| 14:01 | duck1123 | Is it normal that my cljs repl has no line editing capabilities at all? |
| 14:01 | darrenaustin | Lion on a Mac. |
| 14:04 | sirsublime | Alright, Lein version 1.7.1 |
| 14:05 | sirsublime | I have a simple class in src/java as follows: |
| 14:05 | sirsublime | package clj2java; |
| 14:05 | sirsublime | import clojure.lang.IFn; |
| 14:05 | sirsublime | import clojure.lang.RT; |
| 14:05 | sirsublime | import clojure.lang.Symbol; |
| 14:05 | sirsublime | import clojure.lang.Var; |
| 14:05 | sirsublime | public class Clj2Java { |
| 14:05 | TimMc | ugh |
| 14:05 | sirsublime | public static void main(String[] args) { |
| 14:05 | sirsublime | System.out.println("Hello."); |
| 14:06 | sirsublime | } |
| 14:06 | sirsublime | } |
| 14:06 | sirsublime | Sorry. |
| 14:06 | TimMc | sirsublime: Use a pastebin. |
| 14:06 | TimMc | I have you on /ignore. |
| 14:06 | TimMc | duck1123: I noticed that too. |
| 14:06 | sirsublime | There we go: http://pastebin.com/3dv84Pmv |
| 14:07 | duck1123 | ok. I used rlwrap and it's slightly better now |
| 14:07 | duck1123 | I'll just do that in the future |
| 14:07 | sirsublime | Very basic stuff. |
| 14:07 | TimMc | sirsublime: OK, do you have a pastebin link now? |
| 14:07 | sirsublime | Yep, here it is: http://pastebin.com/3dv84Pmv |
| 14:08 | TimMc | OK, could you pastebin the project.clj file? |
| 14:09 | sirsublime | Here's project.clj: http://pastebin.com/9kad3ZiR |
| 14:10 | sirsublime | This is very basic stuff. I just want to set up lein to compile java, so I can do some actual work. My idea was, that a class this basic should compile with no problems. But I guess I am missing something. |
| 14:11 | hyPiRion | sirsublime: Ok, where did you place the java-file? |
| 14:12 | hyPiRion | the path to it should be src/java/clj2java/Clj2java.java |
| 14:13 | sirsublime | Alright, this explains everything. Sorry, I'm not used to Java's strict path requirements. |
| 14:13 | hyPiRion | No worries |
| 14:15 | TimMc | sirsublime: You got the syntax wrong for :java-source-path. |
| 14:15 | TimMc | https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj#L171 |
| 14:16 | TimMc | sirsublime: By the way, Java and Clojure *both* have strict path requirements. |
| 14:16 | sirsublime | Ok, **now** it works. |
| 14:17 | duck1123 | so if I call repl/connect from my webpage and use repl-listen, I should be able to require my lib, right? |
| 14:17 | duck1123 | "Error evaluating:" (require (quote [jayq.core :as jayq])) :as "cljs.user.require.call(null,cljs.core.vec([\"\\uFDD1'jayq.core\",\"\\uFDD0'as\",\"\\uFDD1'jayq\"]));\n" |
| 14:17 | sirsublime | Well, I've started with the language not long ago. Never even touched Java before. So, thanks for the help. :) |
| 14:18 | sirsublime | Btw, is there any way to make the error messages a bit friendlier? Or do you guys just learn to read them like the Matrix code? |
| 14:18 | TimMc | The latter. :-) |
| 14:18 | duck1123 | sirsublime: given time, your eyes learn to find the important parts |
| 14:19 | duck1123 | usually, just look for your clj file names |
| 14:19 | TimMc | Some of the compile errors are pretty opaque, unfortunately. Runtime stack traces are a lot easier to read. |
| 14:19 | TimMc | In the REPL, use (pst) to get a nice stack trace after something errors out. |
| 14:21 | kmicu | georgek: did you get "Running ClojureScript REPL and launching command: (firefox http://localhost:3000/repl-demo)... after running "lein trampoline cljsbuild repl-laun..."? |
| 14:21 | sirsublime | Oh, thanks, guys. :) |
| 14:27 | georgek | kmicu, yes |
| 14:27 | georgek | I think the error is unrelated to the launch-repl command |
| 14:28 | georgek | I'm nuking my lein as we speak and starting from scratch at a top level dir, see if that fixes file path issues |
| 14:34 | duck1123 | Ok, I'm still having no luck requiring any namespace from cljsbuild's repl. What am I missing? |
| 14:37 | georgek | silly question, but are you using :as? |
| 14:37 | duck1123 | yes |
| 14:38 | duck1123 | (require '[jayq.core :as jayq]) |
| 14:43 | georgek | i wonder if you have to use it in a ns |
| 14:43 | georgek | just watched an old screencast where they did that, though that was 9 months ago |
| 14:53 | georgek | so in trying to get lein on Windows up to a dir path without spaces, I edited the .bat (https://raw.github.com/technomancy/leiningen/preview/bin/lein.bat ) to set lein_home where I wanted. However it still creates its .m2 in my user home dir, which is below ".../documents and settings/..." as usual, anyone know how to set the .m2 location? |
| 14:59 | duck1123 | you can set :local-repo in your project (possibly also in profile?) |
| 14:59 | georgek | good idea about profile, I'll check that -- there must be a system-wide setting too though? |
| 15:08 | ro_st | is it possible to have noir serving / but somehow have nginx or apache serving all the static assets? |
| 15:08 | ro_st | i want to be able to take advantage of html5boilerplate's caching configs |
| 15:10 | duck1123 | ro_st: If all your static resources have a static component (ie. /assets/) you can just have your http server bypass the proxy and serve those directly |
| 15:12 | ro_st | cool |
| 15:13 | georgek | so it appears I can change where maven stores its artifacts if I can get to the maven settings.xml (normally in /conf/settings.xml) but this doesn't seem to be in the lein jar, does lein even use the maven settings.xml? |
| 15:13 | georgek | otherwise maven stores in user.home/.m2 by default |
| 15:13 | georgek | which I'm trying to avoid |
| 15:25 | georgek | so this is weird; now I have lein in a dir path without spaces, but .m2 is still in a path with spaces; running the cljsbuild advanced project now doesn't give me the 'Could not find the main class: and. Program will exit.' error, but instead Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: EOF while reading, starting at line 1 |
| 15:25 | technomancy | georgek: lein1 uses settings.xml (by accident) lein2 uses :local-repo in project.clj IIRC |
| 15:25 | technomancy | or you can put it in your :user profile to use it across all projects |
| 15:26 | georgek | cool, thanks, I'll try that |
| 15:42 | georgek | my profile's local-repo isn't working somehow, here's the profile and error, https://www.refheap.com/paste/3618 |
| 15:42 | georgek | it looks right according to what technomancy just said and this SO answer, http://stackoverflow.com/questions/11460283/how-can-i-make-leiningen-2-respect-the-local-repository-path-in-mavens-settings |
| 15:43 | technomancy | needs a closing } |
| 15:43 | georgek | son of a biscuit |
| 15:51 | georgek | cool, it's very close, now I'm just getting this weird reader error when trying to launch the repl with trampoline, https://www.refheap.com/paste/3619, Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: EOF while reading, starting at line 1 |
| 15:51 | georgek | the page is served at localhost OK |
| 15:52 | technomancy | if you export DEBUG=y you can see exactly what shell command trampoline is using |
| 15:57 | georgek | interesting, while lein now downloads artifacts to my local-repo, the trampoline command uses artifacts from the old .m2 location in user.home/.m2 |
| 16:00 | technomancy | hm; that'd be a bug. not sure if it's one in leiningen or pomegranate. |
| 16:00 | georgek | i'm going to try reboot for the heck of it |
| 16:01 | wingy_ | clojuredocs is best .. the examples are such a valuable source |
| 16:10 | yonatane | In the Transients page it says: "Note that not all Clojure data structures can support this feature, but most will. Lists will not, as there is no benefit to be had.". Why is that? |
| 16:11 | yonatane | you know what, let me read through first |
| 16:14 | Raynes | cheater: You certainly can. |
| 16:15 | Raynes | cheater: Do you own that channel? |
| 16:20 | georgek | so setting local-repo in lein profiles and/or the project.clj downloads artifacts to the local-repo; running ring with lein ring server-headless port works and uses the local-repo; but then when running lein trampoline like 'lein trampoline cljsbuild repl-launch firefox http://localhost:3000/repl-demo', it starts downloading to the maven default, not local-repo |
| 16:20 | Raynes | technomancy: I've switched to nrepl.el. I feel so liberated. |
| 16:21 | technomancy | Raynes: muahaha |
| 16:23 | Raynes | technomancy: It's so awesome. SO AWESOME. |
| 16:23 | Raynes | Shivers me timbers. |
| 16:24 | technomancy | it's not _that_ awesome ... yet |
| 16:24 | technomancy | it's the potential awesome that'll get you |
| 16:24 | Raynes | technomancy: It is not SLIME, which makes it awesome. |
| 16:24 | Raynes | technomancy: Why is it that C-c C-d opens a new buffer? |
| 16:25 | technomancy | as opposed to...? |
| 16:25 | ned | Raynes: what are the advantages of nrepl.el over slime |
| 16:25 | Raynes | Printing to the existing repl buffer. |
| 16:26 | technomancy | Raynes: mostly because it's designed to be invoked from clojure-mode buffers |
| 16:26 | Raynes | ned: It isn't SLIME and doesn't require crazy hacks for there to be a 'jack-in'. |
| 16:27 | Raynes | That's my favorites. |
| 16:27 | Raynes | Those are my favorites* |
| 16:27 | wingy_ | if i change a state in a ref/atom/agent, could the previous state still be retrieved or is it "lost" since i have no reference to it? |
| 16:27 | technomancy | Raynes: it doesn't even print stack traces yet, much less clj-stacktrace |
| 16:27 | technomancy | speaking of which, I need to bug Chouser about obsoleting that too |
| 16:28 | Raynes | ned: nrepl.el isn't better than SLIME in functionality yet, but the whole concept is loads better. |
| 16:28 | Raynes | Might even be some releases every now and then! |
| 16:28 | ned | Raynes: hmmm im playing with it now |
| 16:30 | Raynes | technomancy: You're kinda ruining the excitement. |
| 16:31 | technomancy | Raynes: no, I'm trying to get you to prove me wrong |
| 16:31 | technomancy | Raynes: grab one of these and join the party: https://github.com/kingtim/nrepl.el/issues |
| 16:31 | Raynes | technomancy: Well you're right, so how w... |
| 16:31 | Raynes | Oh, I see. |
| 16:31 | Raynes | Yeah, no, Raynes doesn't do elisp. |
| 16:31 | technomancy | curses! |
| 16:31 | Raynes | refheap.el was out of necessity. |
| 16:31 | Raynes | :p |
| 16:32 | technomancy | well in that case there's plenty of backend pieces still needed: https://github.com/technomancy/limit-break |
| 16:32 | technomancy | https://github.com/kingtim/nrepl.el/issues/13 |
| 16:32 | Raynes | technomancy: Can I call it gadget? |
| 16:32 | technomancy | Raynes: no, it has to be Javert |
| 16:32 | technomancy | sorry |
| 16:33 | Raynes | NO DEAL!!1!!! |
| 16:33 | technomancy | it Has Been Decided |
| 16:33 | gtrak`` | has it been thought of before, maybe to fix clojure android dev by porting clojurescript to emit java? that would remove the run-time heaviness |
| 16:35 | gtrak`` | you don't really need eval there either |
| 16:35 | gtrak`` | maybe not 'fix', but another option |
| 16:36 | Raynes | technomancy: Okay, I'll consider this. |
| 16:36 | Raynes | technomancy: I'll do this if you do stacktraces. ;p |
| 16:37 | eph3meral | so, recently I saw some JavaScript code that used dollar signs for variable names, like $myVar etc, note that I'm not talking about the jQuery style of $(myVar)... the dev in question, when asked why, I believe said that it came from clojure or it was a standard or stylistic suggestion from clojure |
| 16:37 | eph3meral | where the $ indicates a local var |
| 16:38 | eph3meral | and all other vars are global or are properties of an instance or class |
| 16:38 | Raynes | I think he might be on drugs. |
| 16:38 | eph3meral | hahah, he was pretty weird |
| 16:38 | eph3meral | I'm being told it's Scheme in ##javascript |
| 16:39 | Raynes | Clojure certainly has no convention like that. |
| 16:39 | eph3meral | Scheme i a "dialect" of lisp right? |
| 16:39 | eph3meral | Raynes, ok great, thanks, that's what I wanted to know |
| 16:39 | Raynes | Scheme is indeed a dialect of Lisp as well. |
| 16:40 | mononofu | is there a better REPL than the default one? |
| 16:41 | technomancy | mononofu: yes, thank goodness |
| 16:41 | eph3meral | Raynes, cool thanks, g'day :) |
| 16:41 | technomancy | the default one's a joke |
| 16:42 | mononofu | technomancy: great, I was a bit put off by it. could you give me a name or a link? |
| 16:42 | technomancy | oh yeah; sorry |
| 16:42 | technomancy | try `lein repl` from http://leiningen.org |
| 16:43 | mononofu | thanks :D |
| 16:43 | cheater_ | i strongly suggest you use lein 2 for the repl |
| 16:43 | cheater_ | because it's so much better |
| 16:44 | yonatane | Regarding transients again, so where a mutable vector can mess with its existing internal array, a list would have to rebuild itself anyway? Is that why transient lists are pointless? |
| 16:44 | yonatane | and on the other hand, a list is not rebuilding itself all the time, and will behave the same as a transient |
| 16:46 | yonatane | actually i'm thinking about functions like replace. I'm not sure how it is implemented for lists. |
| 16:48 | gtrak`` | yonatane, PersistentList is a pretty simple class |
| 16:49 | gtrak`` | it has 3 fiields: private final Object _first; |
| 16:49 | gtrak`` | private final IPersistentList _rest; |
| 16:49 | gtrak`` | private final int _count; |
| 16:51 | Raynes | technomancy: swank.commands.inspector is what I should be looking at, right? |
| 16:55 | yonatane | gtrak``: so to replace a value in the middle of a list, you'd have to tear it apart |
| 16:55 | gtrak`` | yea |
| 16:55 | gtrak`` | there's no benefit |
| 16:55 | gtrak`` | it's just a cons cell with a count |
| 16:56 | yonatane | unlike vector where you have random access to the internal array |
| 16:56 | gtrak`` | yonatane, yes, but it's not really an 'array' |
| 16:56 | yonatane | yeah |
| 16:57 | gtrak`` | yonatane, actually, in java LinkedList is usually slower than ArrayList even when you think you would use one due to cache misses |
| 16:58 | yonatane | not sure what cache misses are |
| 16:59 | yonatane | but i read that allocating the array should be really fast |
| 16:59 | yonatane | and copying. not sure |
| 17:00 | yonatane | will check |
| 17:02 | gtrak`` | yea... copying the array when you need to grow it is generally faster than the aggregate lookups of list elements spread in different parts of heap. If you don't do a lot of inserts in the middle it'll lose? |
| 17:02 | wingy_ | it says in the reference doc "Most data structures are immutable" .. what data structures are mutable in clj? |
| 17:04 | georgek | does anyone know what/where the difference might be here -- when running 'lein trampoline repl' the contents of the temp trampoline file (created with the Windows batch file) all refer to jars in my :local-repo; but when running something like 'lein trampoline cljsbuild repl-launch firefox http://localhost:3000/repl-demo' it starts downloading jars to the original default .m2 repo in user.home/.m2 |
| 17:04 | gtrak`` | wingy_, transients |
| 17:04 | wingy_ | gtrak``: right |
| 17:04 | georgek | so trampoline knows about the local repo, but not when downloading what it thinks is missing |
| 17:05 | Raynes | technomancy: Holy crap. Raw :use and everything. |
| 17:19 | wingy_ | what is the best way to make an iOS and Android app in clj land |
| 17:19 | sjl | Do I need to do something special to get line/numbers and/or locals with clojure-mode + lein-swank? http://i.imgur.com/DoD7I.png |
| 17:19 | wingy_ | cljs + phonegap with clj remote server? |
| 17:20 | Raynes | sjl: Where do you expect line numbers? |
| 17:20 | sjl | ah right, nevermind on the line numbers |
| 17:20 | Raynes | In this case, there is no line number where the error occurred because you executed the code in the repl. |
| 17:22 | sjl | yeah, I see the line numbers working when I move the problem inside the actual file |
| 17:23 | sjl | but there are still no locals listed |
| 17:26 | georgek | does anyone have a cljs project that uses lein2 I could try to run to see where my setup is failing? the cljsbuild examples are for lein1x |
| 17:27 | georgek | the failure point is when I try to launch a repl, I can compile a project and run the web server OK |
| 17:37 | Raynes | technomancy: ping |
| 17:43 | sproc | I'm loading some external config parameters, and so my config file just contains a Clojure map with values defined, and then I'm loading a (load-file "file") in my application; is this a good practice? |
| 17:44 | sproc | The reason I'm prompted to ask is that it seems to work fine if I call (load-file) from the top level, but if I wrap it in a let, all of a sudden nothing can see the map. I've got the same namespace declared in both files (application and config file). |
| 17:45 | georgek | the let binding is only in the let |
| 17:46 | sproc | I'm not binding that in the let, though, the only let-binding I'm doing is unrelated and then the (load-file) is called within the body of the let. |
| 17:46 | sproc | Since the config file uses "(def config-map ...)" I would expect everything from that point on to be able to see it. |
| 17:47 | Raynes | sproc: I recommend just putting the raw map in the file and then doing (def config (read-string (slurp "yourconfigfile.clj"))) |
| 17:52 | sproc | Raynes: Thanks! That works. |
| 17:52 | wingy_ | i love lynda courses |
| 17:53 | wingy_ | i reask my previos question: if i change a state in a ref/atom/agent, could the previous state still be retrieved or is it "lost" since i have no reference to it? |
| 18:09 | AWizzArd | wingy_: the previous state is lost. |
| 18:13 | wingy_ | AWizzArd: aight |
| 18:21 | haspaker | Is anyone here familiar with SublimeREPL? |
| 18:24 | dnolen | haspaker: I have used it in the past for ClojureScript |
| 18:25 | haspaker | dnolen: Do you know how to update it so the changes I have made in the main document takes effect? |
| 18:26 | haspaker | So that I don't have to restart it. |
| 18:26 | haspaker | I could use "(use ____ :reload-all)", but that is quite cumbersome |
| 18:27 | dnolen | haspaker: nope, Sublimer |
| 18:27 | dnolen | haspaker: SublimeREPL is not an optimal Clojure dev env in my experience. |
| 18:27 | dnolen | haspaker: works for simple stuff only. |
| 18:28 | haspaker | Yeah, seems so |
| 18:28 | dnolen | haspaker: could of course be improved, compile-file is really the critical missing bit. |
| 18:28 | dnolen | haspaker: auto recompiling on save is not desirable IMO |
| 18:29 | haspaker | I just want something simple but effectiva |
| 18:29 | haspaker | *effective |
| 18:29 | haspaker | Guess I'll have to go back to Eclipse and CounterClockwise |
| 18:29 | dnolen | haspaker: or you could submit a patch for compile-file. |
| 18:30 | devn | (Math/round 10.5) => 11, (defn guess-a-number [] (Math/round (+ @a-num @another-num))) => Exception |
| 18:30 | haspaker | Don't know how to do that, unfortunately |
| 18:30 | devn | wat? |
| 18:31 | dnolen | ,@1 |
| 18:32 | devn | dnolen: these are atoms |
| 18:33 | dnolen | devn: is that CLJS? |
| 18:33 | devn | dnolen: no, i was asking for a friend who apparently has this problem, but i dont |
| 18:33 | devn | so im not sure what his issue is |
| 18:33 | devn | i also dont know which clj version so hmm |
| 18:34 | dnolen | ,(Math/round (+ 1 2)) |
| 18:34 | dnolen | devn: has nothing to do w/ atoms, will blow up on that too. |
| 18:53 | scottj | sjl: ritz gives you line numbers for code entered at repl. |
| 19:17 | saua | hey, could anyone explain what i'm not understanding about this: https://gist.github.com/3119100 |
| 19:20 | gfredericks | saua: I assume your missing paren on line 4 has nothing to do with it? |
| 19:20 | gfredericks | ah I know what it is |
| 19:21 | gfredericks | seems like every day somebody comes in here confused about -> |
| 19:21 | gfredericks | &(clojure.walk/macroexpand-all '(-> "two words" #(clojure.string/split % #" ") last)) |
| 19:21 | lazybot | ⇒ (last (fn* "two words" [p1__73668#] (clojure.string/split p1__73668# #" "))) |
| 19:21 | cshell | what's the clojure equivalent of instance of? satifies? |
| 19:21 | gfredericks | &(doc instance?) |
| 19:21 | lazybot | ⇒ "([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false" |
| 19:22 | gfredericks | &(doc satisfies?) |
| 19:22 | lazybot | ⇒ "([protocol x]); Returns true if x satisfies the protocol" |
| 19:22 | cshell | awesome, thanks |
| 19:22 | tomoj | saua: (-> "two words" (clojure.string/split #" ") last) |
| 19:23 | tomoj | if you actually want a fn for some reason you need (-> "two words" (#(clojure.string/split % #" ")) last) |
| 19:23 | clintm | is fetching the maven index with 'lein search xx' the first time broken for everyone or am I doing something wrong? |
| 19:23 | saua | i see. thanks |
| 19:23 | gfredericks | clintm: I have almost nearly never got `lein search` to do anything useful :( |
| 19:23 | saua | i think i understand -> now |
| 19:23 | gfredericks | saua: it's syntactic |
| 19:24 | clintm | gfredericks: seems to work ok for me - though I'm new to this. this is lein2, btw. |
| 19:24 | gfredericks | oh I'm afraid of lein2 |
| 19:24 | clintm | gfredericks: err, it did, i guess. |
| 19:25 | clintm | hrm - maybe if I delete the self-install jar and rerun lein upgrade |
| 19:25 | gfredericks | &(doc ->) |
| 19:25 | lazybot | ⇒ "Macro ([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc." |
| 19:27 | tomoj | I'd think e.g. (-> foo ((fn [{:keys [bar baz]}] ...)) ...) should be useful but I don't remember doing that much.. |
| 19:29 | gfredericks | that's a lot of punctation |
| 19:39 | wingy_ | yeah lein search is not as powerful as npm search |
| 19:40 | technomancy | just needs a few tweaks to the query analyzer: https://github.com/technomancy/leiningen/issues/243 |
| 19:40 | technomancy | any takers? |
| 19:45 | cshell | wow, i just figured out the idiomatic way to use protocols - I was using them like java interfaces with new records for implementations |
| 19:47 | technomancy | the best way to use protocols is to implement Clojure-in-Clojure |
| 19:47 | cshell | I agree - it's just taking some time :) |
| 19:47 | cshell | to break the java habits |
| 19:48 | technomancy | I mean there aren't very many other sensible uses for them |
| 19:49 | cshell | I wasn't taking advantage of the fact that the first arg could be bound to an existing type - I was creating a new record which implemented the protocol and then took existing types as secon arguments |
| 19:55 | technomancy | any reason you're not using multimethods? |
| 19:59 | cshell | hmmm |
| 19:59 | cshell | I'm using only single, type based dispatch |
| 20:04 | technomancy | multimethods are pretty great at that =) |
| 20:06 | wingy_ | now i get why Java is so bloated |
| 20:07 | pppppaul | Java has gas |
| 20:12 | wingy_ | ok the only thing so far great is the code completion and auto doc in Eclipse IDE |
| 20:13 | pppppaul | emacs all the way |
| 20:15 | wingy_ | pppppaul: even for java? |
| 20:15 | pppppaul | um |
| 20:15 | pppppaul | no |
| 20:15 | pppppaul | java isn't meant to be programmed by hand |
| 20:15 | wingy_ | :) |
| 20:17 | wingy_ | im going through java just to be a better clj progrmamer |
| 20:17 | wingy_ | programmer |
| 20:17 | wingy_ | quite a lot of fun |
| 20:17 | wingy_ | but clojure is the way to code .. no bullshit |
| 20:17 | pppppaul | indeed |
| 20:18 | pppppaul | can actually code without an editor |
| 20:18 | wingy_ | i mean are we meant to write code or write class hierachies |
| 20:18 | wingy_ | yeah but maybe that is not fun? |
| 20:19 | wingy_ | editor helps you with the parens |
| 20:20 | pppppaul | parens in clojure can get hairy |
| 20:21 | pppppaul | it's really not as big of a deal as other synatxes |
| 20:21 | technomancy | nothing beats a magnetized needle and a steady hand |
| 20:21 | wingy_ | jezz java+eclipse is so the 90s |
| 20:22 | wingy_ | i doubt they can see anything beyond their keyboard |
| 20:22 | wingy_ | it's such an innovation killer |
| 20:29 | wingy_ | eclipse is bloated, java is bloated. it's a bloat culture :) |
| 20:32 | kreig1 | awoo |
| 20:32 | kreig1 | is there a seperate clojurescript channel now? |
| 20:32 | wingy_ | kreig1: yes |
| 20:37 | xumingmingv | I have seen the usage of :private metadata in clojure.core, why not just use def- ? |
| 20:42 | gfredericks | does that exist in 1.4? |
| 20:42 | gfredericks | no apparently not |
| 20:48 | wingy_ | gfredericks: you mean exists in 1.5? |
| 20:49 | gfredericks | not that I know of |
| 20:58 | wingy_ | emacs is the best editor for clojure? |
| 20:59 | wingy_ | is it worth learning emacs although i think i will switch to light table next year? |
| 21:03 | Frozenlo` | wingy_: Yes. |
| 21:03 | Frozenlo` | You might end up doing more than just clojure in emacs :) |
| 21:03 | Frozenlo` | Like... oh I don't know... EVERYTHING |
| 21:05 | gfredericks | when will light table get org-mode support? |
| 21:05 | Frozenlo` | Let's implement Emacs in light table! |
| 21:06 | kreig1 | haha |
| 21:07 | kreig1 | emacs + slime is alright |
| 21:07 | kreig1 | its what I live in basically |
| 21:07 | gfredericks | &(let [things ["ruby" "clojure" "java" "erlang" "python" "brainfuck"]] (format "Let's implement %s in %s!" (rand-nth things) (rand-nth things))) |
| 21:07 | lazybot | ⇒ "Let's implement clojure in clojure!" |
| 21:07 | gfredericks | lazybot: you said it! |
| 21:08 | wingy_ | Yo Dawg. I heard you like editing code. So we put an editor in your editor so you can edit while you edit |
| 21:10 | pipeline | clojure-in-clojure would be hilarious if only to see the author run rings around himself for java interop |
| 21:10 | pipeline | like pypy's pain with c modules, only more complicated |
| 21:11 | gfredericks | wouldn't it just emit bytecode? |
| 21:20 | wingy_ | the only way to run a static method with no args is: (. Runtime getRuntime) ? |
| 21:20 | wingy_ | since (Runtime/getRuntime) is trying to get the static field |
| 21:23 | gfredericks | that doesn't sound right |
| 21:23 | gfredericks | (Runtime/getRuntime) works for me |
| 21:24 | wingy_ | oh |
| 21:24 | wingy_ | my ba |
| 21:24 | wingy_ | d |
| 21:24 | wingy_ | i forgot to wrap it |
| 21:25 | wingy_ | (.totalMemory Runtime/getRuntime) -> (.totalMemory (Runtime/getRuntime)) :D |
| 21:26 | wingy_ | i strongly advice beginners to learn Java .. you know how JVM works and many Java APIs that is useful in your clj app |
| 21:26 | sproc | I'm putting Oracle's ojdbc.jar on the class path and then doing a (Class/forName "oracle.jdbc.OracleDriver") in my program and it is throwing a ClassNotFoundException. Why? |
| 21:28 | sproc | Nevermind, I found something on Google; it seems Clojure uses a different classloader. |
| 21:30 | evildaemon | How do I deal with binary files in clojure? |
| 21:30 | sproc | Carefully. |
| 21:31 | evildaemon | sproc: I think that's always a condition when doing operations on bins. |
| 21:31 | gfredericks | evildaemon: at worst, the same way you'd do it in java |
| 21:31 | evildaemon | gfredericks: Okay. |
| 21:31 | sproc | Anyone know the name of Clojure's classloader? |
| 21:31 | gfredericks | evildaemon: clojure.java.io might have stuff |
| 21:42 | xeqi | sproc: DynamicClassLoader |
| 21:43 | sproc | I ended up having to do (clojure.lang.RT/loadClassForName "oracle.jdbc.OracleDriver") |
| 21:43 | sproc | DynamicClassLoader doesn't include a forName() method. |
| 21:44 | sproc | Err, of course it doesn't |
| 21:49 | gfredericks | clojure projects involve a lot of namespacing mechanisms; github username, maven group name, clojure namespace, git branch... |
| 21:50 | gfredericks | I guess that doesn't really have anything to do with clojure in particular |