2010-07-05
| 00:14 | Blackfoot | if i :use a namespace with :as, do its functions get put in the current namespace *in addition* to being able to refer to them with the :as symbol? |
| 00:16 | technomancy | Blackfoot: :use works with :only; :require works with :as. |
| 00:17 | technomancy | well, :use might work with :as, but it's weird; better not to try it. |
| 00:19 | Blackfoot | oh man, you're right i see that in the documentation now |
| 00:19 | Blackfoot | and you are right, it seemed to work until it stopped with weird errors |
| 00:29 | itistoday | what is the purpose of with-local-vars? |
| 00:29 | itistoday | how is it different from binding? |
| 00:30 | TeXnomancy | with-local-vars is for mutable locals. it's not really ... good to use. |
| 00:30 | TeXnomancy | no idea why it's even included in Clojure, though it's a neat trick |
| 00:31 | itistoday | TeXnomancy: but aren't the locals mutable with binding? |
| 00:31 | itistoday | i used set! with them in binding just fine |
| 00:31 | TeXnomancy | itistoday: binding doesn't affect locals |
| 00:31 | TeXnomancy | it only affects vars |
| 00:31 | TeXnomancy | vars and locals look like the same thing, but they are really different. |
| 00:31 | itistoday | TeXnomancy: then i must not understand the difference |
| 00:31 | TeXnomancy | locals are literally immutable |
| 00:32 | itistoday | what's the difference between a local and a var? are they two different things? |
| 00:32 | TeXnomancy | if you do something like ((fn [x] (def x 1) (println x)) 2) it will print 2 |
| 00:32 | TeXnomancy | because in the context of the function, the local binding of x "wins" over the top-level var that def defines |
| 00:33 | itistoday | so why would you want to use with-local-vars? |
| 00:33 | TeXnomancy | vars are entirely a top-level thing |
| 00:33 | TeXnomancy | I can't think of a reason. |
| 00:34 | TeXnomancy | basically an identifier like x in that fn will only look for a var if the compiler determines there's no local named x in scope. |
| 00:34 | itistoday | TeXnomancy: isn't with-local-vars ... sortof defeating the purpose of a var then? essentially creating a ... local? |
| 00:34 | itistoday | but a local that is a var...? |
| 00:35 | TeXnomancy | yeah. maybe you could make a case that it could be needed in some situations for performance, but I'm not sure I buy that. |
| 00:35 | itistoday | here's where rich talks about it: http://groups.google.com/group/clojure/browse_thread/thread/3c22b35f079e0de6/95fc0b334ab77c1f |
| 00:35 | TeXnomancy | in fact, in most cases it will hurt perf since vars involve one extra lookup |
| 00:37 | itistoday | i don't think he explains what its purpose for existence is there... |
| 00:37 | Blackfoot | anyway to get more than one error at a time with ./lein compile? |
| 00:38 | TeXnomancy | hah; he wrote it just so that other people wouldn't implement their own crappy version. =) |
| 00:38 | TeXnomancy | itistoday: sounds like almost just a proof-of-concept. |
| 00:38 | TeXnomancy | Blackfoot: I don't think you can get more than one error from clojure.core/compile, which lein compile uses. |
| 00:39 | Blackfoot | ok thanks |
| 00:39 | itistoday | TeXnomancy: heh, ok, hope that's all it is. really should be more documentation on it though, as it could encourage its use, and if it's not good to use it... why do that? |
| 00:40 | TeXnomancy | itistoday: if I had to guess I'd say rich would take it out if he didn't have to worry about backwards-compatibility and people complaining |
| 00:40 | TeXnomancy | but I don't want to put words in his mouth. |
| 00:42 | itistoday | TeXnomancy: maybe i should ask on the list? |
| 00:42 | TeXnomancy | if you're curious. |
| 00:42 | itistoday | i am too curious for my own good |
| 00:43 | itistoday | like what's up with not=? why not != ? :-p |
| 00:44 | TeXnomancy | probably to match better with when-not, if-not, etc. |
| 00:44 | TeXnomancy | maybe to keep people from complaining it looks like perl? |
| 00:45 | itistoday | i don't think we have to worry about that! :-p |
| 00:45 | itistoday | perl is horrid |
| 00:45 | TeXnomancy | well with the old #^{} syntax there were legitimate complaints |
| 00:46 | itistoday | i definitely agree |
| 00:46 | itistoday | well, still not as bad as perl |
| 00:46 | itistoday | but i'm *very* happy to see the new style in 1.2 |
| 00:47 | itistoday | still, it doesn't make sense to have =, and then do not=. it should be consistent. either equal & not-equal, nor != and = |
| 00:47 | itistoday | s/nor/or |
| 00:47 | TeXnomancy | equal is way too long for something as fundamental as = |
| 00:47 | itistoday | i agree, so not= should be != :-) |
| 00:48 | TeXnomancy | and != is far from being universal; lots of people use ≠ |
| 00:48 | itistoday | i don't even know how to type that |
| 00:48 | itistoday | != is common to most imperative languages, java included |
| 00:48 | TeXnomancy | well, not programmers, but you know. =) |
| 00:48 | itistoday | every coder knows != |
| 00:49 | TeXnomancy | I think it's nice that "(if (not (=" collapses to "(if-not (=" |
| 00:49 | TeXnomancy | or rather (if (not=; either way. |
| 00:49 | Hodapp | .NE. |
| 00:50 | itistoday | yeah, i like if-not, when-not, etc. too |
| 00:50 | itistoday | if-! would be weird :-) |
| 01:03 | Raynes | TeXnomancy: You know, there is a guy in #haskell called technogeeky. :o |
| 01:03 | TeXnomancy | Raynes: yeah, I used to hang out with a technoweenie too |
| 01:04 | TeXnomancy | began to get really annoyed by IRC clients who use cycling completion instead of unambiguous |
| 01:39 | itistoday | say i have a local bound to some function in some namespace, how do i get the namespace of that function? |
| 01:39 | itistoday | ((fn [f] (______ f)) foo/bar) => foo |
| 01:42 | TeXnomancy | functions don't have namespaces; only vars do |
| 01:43 | itistoday | TeXnomancy: ok, well out of curiosity, how would you do it for a var? |
| 01:44 | TeXnomancy | ,((fn [f] (namespace f)) #'clojure.core/reduce) |
| 01:44 | clojurebot | java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named |
| 01:46 | TeXnomancy | oh cripes; I misspoke |
| 01:46 | TeXnomancy | ,(:ns (meta clojure.core/reduce)) |
| 01:46 | clojurebot | nil |
| 01:46 | TeXnomancy | hmm... works fine here |
| 01:47 | itistoday | doesn't work here, i only have {:line 774} |
| 01:47 | itistoday | ,(meta clojure.core/reduce) |
| 01:47 | clojurebot | {:line 774} |
| 01:48 | TeXnomancy | maybe it's fixed/broken in later/earlier versions |
| 01:48 | TeXnomancy | actually reduce is a bad example since there's definitely a bug that screws with its metadata in the latest |
| 01:48 | TeXnomancy | ,(:ns (meta clojure.core/+)) |
| 01:48 | clojurebot | #<Namespace clojure.core> |
| 01:48 | TeXnomancy | dun dun dun! |
| 01:49 | itistoday | hmmm |
| 01:49 | itistoday | so... this is a bug that it doesn't work for reduce? |
| 01:50 | itistoday | is there a ticket for it? |
| 01:50 | TeXnomancy | it's a bug that reduce's metadata is cleared; there's at least a discussion on the mailing list |
| 01:51 | itistoday | TeXnomancy: but in my own user defined functions it doesn't list the namespace |
| 01:52 | TeXnomancy | itistoday: it works for defn; I don't think it would ever work for a fn that wasn't attached to a var since those are truly anonymous |
| 01:52 | itistoday | TeXnomancy: doesn't work for defn in the repl... |
| 01:52 | TeXnomancy | weird; works for me |
| 01:53 | TeXnomancy | (defn h []) (:ns (meta h)) ;; <= #<Namespace user> |
| 01:53 | itistoday | oh wait |
| 01:53 | itistoday | it does... i see... it's cause i tested it on a function that i swapped out with alter-var-root |
| 01:58 | itistoday | how do i create a new namespace and copy all the vars of another into it? (essentially copy a namespace but give it a different name) |
| 02:00 | itistoday | oh, just refer |
| 02:00 | itistoday | ok |
| 02:02 | TeXnomancy | refer doesn't copy the vars, it just makes them accessible |
| 02:02 | TeXnomancy | it's not transitive |
| 02:02 | TeXnomancy | there's no built-in way to do what you ask afaik |
| 02:03 | TeXnomancy | but you might look at nstools |
| 02:03 | itistoday | where's that? |
| 02:03 | itistoday | oh |
| 02:03 | itistoday | http://code.google.com/p/clj-nstools/ |
| 02:06 | itistoday | TeXnomancy: thanks, i'll add this to my list of things to explore |
| 02:16 | rubydiamond | how many of you use emacs |
| 02:25 | zmila | according to http://devender.wordpress.com/2009/12/08/what-ide-do-you-use-for-clojure/ 26% |
| 02:25 | zmila | but there was yet another poll with more voices |
| 03:31 | Bahman | I'm planning to write a business suite (accounting, inventory, sales, etc) using Clojure... |
| 03:31 | Bahman | and did some research regarding its DB connectivity and came across the following: |
| 03:31 | Bahman | SQL wrapper in contribs, FleetDB and MongoDB |
| 03:31 | Bahman | I'm wondering which one of them is fine for my purpose? |
| 03:32 | Bahman | I'd rather avoid JPA or Hibernate as the resulting code is like an awkward Java (written in Clojure). I mean I'm looking for some clojure libs. |
| 03:32 | Bahman | I'd appreciate any hints/ideas. |
| 03:38 | scottj | there are several other libs for nosql dbs, couchdb is pretty popular. |
| 03:42 | scottj | SQL: olap tools (I don't know anything about them but they seem popular in business), schemas, column types, better query tools, sql. |
| 03:47 | Bahman | scottj: Thanks. Well OLAP is supposed to run on a warehouse which is not necessarily the operational database. |
| 03:47 | Bahman | re query tools: you're right. |
| 03:49 | scottj | but don't most of them expect the warehouse to be SQL? |
| 03:50 | Bahman | That's right...it's none of our business...that's something the ETL processes have to worry about :-) |
| 03:56 | scottj | why are you making a new ERP system? |
| 03:58 | Bahman | scottj: At this stage I'm just planning but yes the goal is a business suite. |
| 04:00 | Bahman | I'm and have been member of some prominent OS ERPs for about 5 years...those projects have their own pros and cons...I think I have learned from their mistakes. |
| 04:26 | LauJensen | Hopefully you learned a little from their success as well :) |
| 04:28 | Bahman | LauJensen: I have to think about that ;-) |
| 04:32 | LauJensen | I realize that the jvm can boot with a max heap size of 6Mb, but any idea how a small utility will run with that small amount of space? I imagine the jvm+clojure alone will take up more than that |
| 05:15 | Licenser | aloaeh! |
| 05:16 | Licenser | LauJensen: class Bla { void main() { System.out.println(1 + 1);}} might more or less run |
| 05:29 | raek | I have a strong feeling that in clojure circles I'm going to be known as "the encoding guy"... |
| 05:30 | talios | There could be worse things to be known as. |
| 05:46 | LauJensen | yea, like 'Licenser', the guy who puts a license on everything :((( |
| 05:47 | Licenser | LauJensen: funny storry the name has nothing to do with licenses in the end :P |
| 05:47 | LauJensen | oh .. :) |
| 05:54 | Bahman | Perhaps it has all sort of things to do with license in the beginning ;-) |
| 05:58 | Licenser | Bahman: it was a typo |
| 05:59 | Bahman | When registering the nick? What was it supposed to be? Just curious :-) |
| 05:59 | Licenser | No back back back when I was young and naiv, it stuck with me since then, and seriousely noone else uses the name :P I'm the one and only Licenser on the interwebs, not many people can claim that |
| 06:00 | Bahman | I bet so! |
| 06:08 | LauJensen | Licenser: There are many names which arent in use on the internet, and there are good reasons for it :) |
| 06:08 | Licenser | But mine is cool too! |
| 06:08 | LauJensen | Lunch! :) |
| 08:31 | puredanger | why does subseq only work on sorted collections? seems like merely being a seq should be enough? |
| 08:34 | neotyk | ,(doc subseq) |
| 08:34 | clojurebot | "([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true" |
| 08:34 | neotyk | puredanger: looks like there needs to be an order to create a subset |
| 08:37 | puredanger | neotyk: yeah, I can see why it needs a sorted collection in how it's defined |
| 08:38 | puredanger | just wondering how the equivalent would be for a plain seq (if I'm willing to accept the O(n) perf) |
| 08:38 | puredanger | maybe subvec would suffice for my needs |
| 08:39 | neotyk | and subvec is O(1) |
| 08:43 | Chousuke | puredanger: O(n) subseq can be emulated with drop and take |
| 08:44 | Chousuke | subseq itself is intended for quick access to ranges of stuff. |
| 08:49 | LauJensen | Interesting: http://stackoverflow.com/questions/3169051/code-golf-word-frequency-chart - Python solution in 266 characters, Scala in 592 lines :) |
| 08:50 | Hodapp | that's characters, not lines |
| 08:51 | LauJensen | Oh yea he mis-typed :) |
| 08:52 | LauJensen | I'll cancel the blogpost :D |
| 08:58 | puredanger | Chousuke: yeah, that's better actually (this is in a test and that's clearer) |
| 09:52 | AWizzArd | rhickey: Hello! |
| 09:52 | AWizzArd | rhickey: Can we please have defrecord/deftype markers (empty Interface)? :-) |
| 09:53 | rhickey | AWizzArd: please submit a ticket for that |
| 09:53 | AWizzArd | ok |
| 09:53 | AWizzArd | thank (: |
| 09:53 | AWizzArd | +s |
| 10:32 | mitkok | hey, guys. Anyone using vimclojure |
| 11:39 | smiley- | http://stackoverflow.com/questions/3169051/code-golf-word-frequency-chart so who will write a solution in Clojure? :) |
| 11:58 | AWizzArd | ,(instance? Integer/TYPE (.length "hallo")) ; why is it false? |
| 11:58 | clojurebot | false |
| 11:58 | AWizzArd | ,*clojure-version* |
| 11:58 | clojurebot | {:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"} |
| 11:59 | neotyk | ,(class Integer/TYPE) |
| 11:59 | clojurebot | java.lang.Class |
| 11:59 | Blackfoot | Bahman: i have not personally used the mongodb connector, but that would be the first i look into for your application |
| 11:59 | neotyk | ,(class (.length "hallo")) |
| 11:59 | clojurebot | java.lang.Integer |
| 12:00 | arohner | AWizzArd: Integer/Type is the primitive, java.lang.Integer is the boxed class |
| 12:05 | Bahman | Blackfoot: Thanks for the hint. |
| 12:08 | AWizzArd | So, with the exception of writing Integer/TYPE directly into the code there is no way to get my hands on an unboxed primitive. |
| 12:08 | arohner | AWizzArd: locals coerced using (int x), (long x), etc are primitives |
| 12:09 | arohner | AWizzArd: what are you trying to do? |
| 12:10 | arohner | for now, primitives can only exist inside functions. Primitives are boxed crossing function boundaries, including across the boundary of (.length "hello") |
| 12:22 | AWizzArd | arohner: serialization and deserialization |
| 12:23 | arohner | AWizzArd: oh, and your library distinguishes between boxed and unboxed numbers? |
| 12:27 | AWizzArd | arohner: it may be usable from Java too. |
| 12:28 | AWizzArd | Don't know if this ever could run into problems. Probably not. |
| 15:27 | fuchsd | Howdy! I'm new to clojure; please forgive me if this is not the correct place to ask, and feel free to tell me to rtfm (though the location of the specific fm would be helpful ) |
| 15:27 | fuchsd | I'm coming from Python and I'm looking for something simliar to os.path.join |
| 15:27 | fuchsd | I have two strings and I'd like to join them to make a path in a platform-independent way |
| 15:28 | fuchsd | (also sorry if those msgs showed up a bunch of times; having trouble with my irc client) |
| 15:28 | fuchsd | Specifically, I'm trying to write a leiningen plugin, and I'd like to create a file in the project dir + a user specified dir |
| 15:29 | fuchsd | (using clojure 1.1) |
| 15:30 | fuchsd | Is there a clojure function to do this? Or a Java method maybe? |
| 15:31 | itistoday | fuchsd: http://richhickey.github.com/clojure-contrib/str-utils2-api.html |
| 15:32 | itistoday | fuchsd: see the function 'join' there |
| 15:32 | boojum | fuchsd, http://java.sun.com/docs/books/tutorial/essential/environment/sysprop.html |
| 15:33 | boojum | ,(System/getProperty "file.separator") |
| 15:33 | clojurebot | java.security.AccessControlException: access denied (java.util.PropertyPermission file.separator read) |
| 15:33 | fuchsd | Awesome, that's what I'm looking for |
| 15:34 | fuchsd | using that join function with file.separator |
| 15:34 | fuchsd | Thanks! |
| 15:34 | raek | fuchsd: you can use java.io.File too |
| 15:34 | fuchsd | Nice, thanks |
| 15:35 | raek | (defn file-path [path] (reduce #(File. %1 %2) path)) |
| 15:35 | raek | I used this in one of my projects |
| 15:35 | boojum | fuchsd, also see interpose |
| 15:35 | raek | it takes a collection of path segments and joins them in a platform independent way |
| 15:37 | fuchsd | raek: thanks! |
| 15:37 | itistoday | how do i use 'use' to include only a single function from clojure.contrib.str-utils2? |
| 15:38 | raek | (ns ... (:use [clojure.contrib.str-utils2 :only (the-single-function)])) |
| 15:38 | itistoday | no, using use |
| 15:38 | itistoday | (not ns) |
| 15:44 | itistoday | raek: any idea? |
| 15:45 | raek | (use '[clojure.contrib.str-utils2 :only (the-single-function)]) |
| 15:45 | raek | same, but with a quote |
| 15:45 | itistoday | thanks, i was trying this: (use '(clojure.contrib.str-utils2 :only (join))) |
| 15:46 | itistoday | why doesn't it work with a list? |
| 15:47 | itistoday | oh i see |
| 15:48 | itistoday | to use a list you have to do: (use '((clojure.contrib.str-utils2 :only (join)))) |
| 16:21 | Blackfoot | proxy: Note that while method fns can |
| 16:21 | Blackfoot | be provided to override protected methods, they have no other access |
| 16:21 | Blackfoot | to protected members |
| 16:21 | Blackfoot | but do they still have access to other protected methods? |
| 16:25 | hoeck | Blackfoot: no |
| 16:26 | hoeck | Blackfoot: btw, gen-class circumvents this by making all protected methods public in the generated class |
| 16:26 | Blackfoot | hoeck: ok thanks, saved me a lot of time. i will use gen-class to override the protected function i'm interested in |
| 16:30 | hoeck | Blackfoot: but gen-class will not make protected final methods public |
| 16:30 | Blackfoot | ok |
| 16:31 | hoeck | got bitten by this recently |
| 17:46 | mudgen | hello |
| 17:47 | mudgen | does anybody know how to load clojure.jar with a URLClassLoader ? |
| 17:48 | mudgen | and have it work? |
| 17:57 | itistoday | mudgen: i'd try asking on the list |
| 17:59 | mudgen | the clojure googe group list? |
| 18:00 | icefox | noob question: I see there is a clojure 1.0 deb package with ubuntu these days, but reading around it sounds like I should compile from git, would this be correct? |
| 18:02 | kotarak | icefox: no need to compile: http://github.com/clojure/clojure/downloads |
| 18:02 | itistoday | mudgen: yes |
| 18:09 | neotyk | icefox: you could also use leiningen with [org.clojure/clojure "1.2.0-master-SNAPSHOT"] |
| 18:09 | neotyk | [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] as :dependencies |
| 18:10 | icefox | thanks, i'll read up on leiningen |
| 18:10 | neotyk | you're welcome, lein is very convenient |
| 18:10 | kotarak | icefox: clojure 1.1.0 is probably a better choice for a newbie |
| 18:11 | neotyk | kotarak: true, true |
| 18:11 | icefox | While being able to apt-get clojure seemed nice, seems like I shouldn't be on 1.0 |
| 18:11 | icefox | s/be on/learn from |
| 18:12 | neotyk | icefox: usually installing jvm application from package manager is not a best idea |
| 18:12 | itistoday | reading joy of clojure, and am confused |
| 18:12 | itistoday | which macro is preferred and why: http://paste.pocoo.org/show/233932/ |
| 18:13 | raek | the last one |
| 18:13 | itistoday | if i had to guess i'd say the second is preferred. i'm not sure, but the first might be susceptible to variable capture, correct? |
| 18:13 | raek | yes |
| 18:13 | Chousuke | yes. |
| 18:13 | itistoday | hmmm |
| 18:14 | itistoday | that should be mentioned in JoC |
| 18:14 | itistoday | thanks guys |
| 18:14 | raek | (let [it 5] (awhen true (println it))) |
| 18:14 | Chousuke | but the first has the property that "it" refers to the condition's value in the body |
| 18:14 | Chousuke | so you can do (when it (print it)) |
| 18:15 | Chousuke | or hm, a better example would be (awhen (some-fn) (print it)) |
| 18:15 | raek | hrm, yes |
| 18:15 | itistoday | oh, i see, yeah, of course |
| 18:15 | Chousuke | it's generally considered bad style to make such macros but it's sometimes useful |
| 18:15 | itistoday | soon this will click faster, i promise :-p |
| 18:15 | raek | simply put: the first one introduces "magic variables" |
| 18:15 | itistoday | gotcha |
| 18:16 | Chousuke | the latter one does too but you don't know what they are :) |
| 18:16 | Chousuke | (it'll be it__2398 or something) |
| 18:16 | kotarak | proxy captures for example this |
| 18:16 | raek | so they wont accidentally collide with another one in use |
| 18:17 | Chousuke | Clojure doesn't have true unique symbols like CL though |
| 18:17 | itistoday | Chousuke: you're saying variable capture is still possible, even with gensym? |
| 18:17 | itistoday | like, if i *tried* to break it? i could? |
| 18:17 | Chousuke | yes, but that's not really a problem. As long as you don't explicitly try to create a collision, none will happen :P |
| 18:17 | itistoday | hehe |
| 18:18 | itistoday | i'll have to start adding __#### to my symbol names from now on, just for shits |
| 18:18 | Chousuke | you'd have to somehow figure out the state of the gensym serial number variable and calculate what the next one will be. |
| 18:18 | Chousuke | it's not very easy though |
| 18:18 | Chousuke | ,`foo# |
| 18:18 | clojurebot | foo__5001__auto__ |
| 18:18 | Chousuke | ,`foo# |
| 18:18 | clojurebot | foo__5004__auto__ |
| 18:19 | itistoday | looks easy enough :-) |
| 18:19 | itistoday | ,`foo# |
| 18:19 | clojurebot | foo__5007__auto__ |
| 18:19 | itistoday | +3 :-) |
| 18:19 | Chousuke | well, hmm |
| 18:19 | Chousuke | ,(+ 1 1) |
| 18:19 | clojurebot | 2 |
| 18:19 | Chousuke | ,(= `foo# 'foo_5010__auto) |
| 18:19 | clojurebot | false |
| 18:19 | Chousuke | oops |
| 18:19 | Chousuke | ,(= `foo# 'foo__5013__auto) |
| 18:19 | clojurebot | false |
| 18:19 | Chousuke | gah, I obviously need some sleep :P |
| 18:19 | itistoday | hmmm |
| 18:20 | kotarak | ,`foo# |
| 18:20 | Chousuke | ,(= `foo# 'foo__5016__auto__) |
| 18:20 | clojurebot | false |
| 18:20 | clojurebot | foo__5021__auto__ |
| 18:20 | Chousuke | ,(+ 1 1) |
| 18:20 | clojurebot | 2 |
| 18:20 | Chousuke | ,`foo# |
| 18:20 | clojurebot | foo__5026__auto__ |
| 18:20 | kotarak | ,(= `foo# `foo__5024__auto__) |
| 18:20 | clojurebot | false |
| 18:20 | itistoday | lol |
| 18:20 | Chousuke | see, evaluating anything else in the middle changes it |
| 18:21 | itistoday | ,`foo# |
| 18:21 | clojurebot | foo__5032__auto__ |
| 18:21 | neotyk | ,(= `foo# `foo#) |
| 18:21 | clojurebot | false |
| 18:21 | itistoday | ? |
| 18:21 | itistoday | ,`(= foo# foo#) |
| 18:21 | clojurebot | (clojure.core/= foo__5039__auto__ foo__5039__auto__) |
| 18:22 | neotyk | ,(let [f `foo#] (= f f)) |
| 18:22 | clojurebot | true |
| 18:22 | itistoday | ,(prn `foo# `foo#) |
| 18:22 | clojurebot | foo__5045__auto__ foo__5046__auto__ |
| 18:22 | itistoday | there's your problem |
| 18:22 | itistoday | it has to be in the same syntax quote |
| 18:23 | itistoday | ,(= `foo# 'foo__5049__auto__) |
| 18:23 | clojurebot | true |
| 18:23 | itistoday | i win!!! :-) |
| 18:24 | neotyk | itistoday: +1 |
| 18:24 | leafw | a new kind of roulette |
| 18:24 | itistoday | :p |
| 18:28 | Blackfoot | is there a way to get more backtrace in the repl? |
| 18:29 | Blackfoot | lein repl? |
| 18:29 | itistoday | Blackfoot: maybe ask on #leiningen? |
| 18:30 | Blackfoot | huh didn't know they had a channel |
| 18:30 | technomancy | Blackfoot: try clj-stacktrace |
| 18:32 | neotyk | technomancy: do you have idea why rober/hooke.clj is not found in lein-javac? |
| 18:32 | technomancy | neotyk: lemme see |
| 18:33 | technomancy | neotyk: did you make hooke a dev-dependency of lein-javac? |
| 18:33 | neotyk | don't thinks so, lemme see |
| 18:33 | neotyk | technomancy: normal deps |
| 18:37 | neotyk | technomancy: with dev-deps same error |
| 18:37 | neotyk | more like warning actually, as it works |
| 18:40 | neotyk | this is only when building lein-javac, if I have normal deps on r/h that I don't get this warning while using plugin |
| 19:06 | itistoday | technomancy: you there? |
| 19:06 | itistoday | technomancy: i think i've figured out what with-local-vars is for |
| 19:12 | itistoday | why can I call set! on *warn-on-reflection* ? |
| 19:14 | chouser | itistoday: because the repl gave it a thread-local binding before giving you a prompt. |
| 19:15 | itistoday | chouser: i see, do you happen to know how it did that? |
| 19:15 | robink | lein swank using leiningen 1.2.0-RC2 doesn't seem to work. |
| 19:15 | chouser | I do, but it is a deep, deep secret. |
| 19:15 | itistoday | something like: (binding [*warn-on-reflection* false] (run-repl)) ? |
| 19:15 | robink | Too many arguments to def |
| 19:16 | chouser | itistoday: right. http://github.com/clojure/clojure/blob/4bec81db4ee4e9e4227a66bb1a04ba06e95ea9b6/src/clj/clojure/main.clj#L27 |
| 19:17 | itistoday | chouser: cool, thanks! |
| 19:22 | itistoday | chouser: btw, loving tJoC! making my way through it as we speak. Finishing chapter 7 currently. Only real qualm i have is the bashing of putting closing parens on their own lines at the start. :-p |
| 19:22 | robink | Ah, needed to use 1.2.1 |
| 19:23 | chouser | itistoday: too early for such assertions? |
| 19:23 | itistoday | chouser: well, just based on the current version is all (i didn't think the reasons for stacking parens up is very good, to make it makes code hard to read) |
| 19:24 | itistoday | s/to make/to me/ |
| 19:24 | sexpbot | chouser: well, just based on the current version is all (i didn't think the reasons for stacking parens up is very good, to me it makes code hard to read) |
| 19:24 | itistoday | wow... |
| 19:24 | itistoday | nice one sexpbot! |
| 19:24 | chouser | oh, you disagree with that style of code, not the way we mention it? |
| 19:25 | itistoday | chouser: "Although a familiarity with C-style languages like Java and C# will compel a new Clojure programmer to close their forms according to instinct, Lisp-like languages reject that practice as it leads only to confusion." |
| 19:25 | itistoday | i don't like that sentence |
| 19:26 | itistoday | i personally feel the exact opposite, and i've seen this expressed by a lot of people, though not outright usually, that stacking up parens makes Lisp code hard to read. |
| 19:26 | itistoday | JoC asserts that doing it C-style "leads to confusion" but doesn't explain why |
| 19:27 | itistoday | i think stacking them up makes it hard to read code, and i have good reasons for that assertion. |
| 19:29 | itistoday | chouser: i have no problem with the fact that the examples in the book though use the typical paren style. i just don't like that it discourages the other style without providing reason. |
| 19:29 | chouser | ah. I'll see if we can justify it better. But I fully believe that if you stick with Clojure long enough you'll come to appreciate this style. |
| 19:29 | chouser | style. |
| 19:31 | itistoday | chouser: i'm pretty sure i won't. :-p. My eyesight, though 20/20, isn't good enough to pick apart that code sometimes without real consternation. when parens are done C-style, I can instantly understand and see where one function ends and another begins. |
| 19:32 | itistoday | sometimes the separation (indentation from the left margin), is just a single space wide! |
| 19:40 | Chousuke | itistoday: the parens will feel lonely :P |
| 19:41 | itistoday | Chousuke: i understand you're joking, but the sad thing is that i've actually heard that used as a justification for it |
| 19:42 | Chousuke | itistoday: the point is that putting closing parens on their own lines just adds noise; you won't be matching them by eye anyway, as the indentation is supposed to tell you how the code is grouped |
| 19:42 | itistoday | Chousuke: An emphatic no. :-p |
| 19:42 | itistoday | the parens don't "add noise". they shape the structure of the code |
| 19:42 | itistoday | therefore they are very useful. |
| 19:42 | Chousuke | the parens on their own lines add noise |
| 19:43 | itistoday | no, they don't |
| 19:43 | Chousuke | yes they do :P |
| 19:43 | itistoday | do braces on their own add noise in C? |
| 19:43 | itistoday | or in Java? |
| 19:43 | itistoday | does 'end' add noise when it's put on its own in Ruby or Python? |
| 19:43 | itistoday | or Lua? |
| 19:43 | itistoday | NO. |
| 19:43 | Chousuke | No, but they're fundamentally different in those languages. |
| 19:43 | itistoday | Doesn't matter. |
| 19:43 | Chousuke | you're actually supposed to look at them, given how the language works :P |
| 19:43 | Chousuke | with lisp, you don't read the parens. |
| 19:44 | itistoday | maybe you don't, but i do |
| 19:44 | itistoday | you don't because you stack them |
| 19:44 | Chousuke | you'll get over that. |
| 19:44 | itistoday | no, i won't |
| 19:44 | itistoday | i've tried |
| 19:44 | Chousuke | yes you will |
| 19:44 | Chousuke | you'll have too |
| 19:44 | Chousuke | -o |
| 19:44 | itistoday | it's pretty arrogant of you to say that |
| 19:44 | Chousuke | you won't be able to read others' code :P |
| 19:44 | itistoday | considering you know nothing about me |
| 19:44 | Chousuke | It's not arrogant, it's just reality. |
| 19:44 | itistoday | sorry, it's your reality applied to me |
| 19:44 | itistoday | in other words, your viewpoint |
| 19:45 | itistoday | which is just that, a viewpoint |
| 19:45 | Chousuke | I'm not saying you won't be able to learn it, I'm saying you will have to learn it |
| 19:45 | itistoday | you don't think i've tried? |
| 19:45 | itistoday | i've been coding in lisp for years now |
| 19:46 | Chousuke | At any rate, you'll be in a minority if you use parens like braces in C |
| 19:46 | itistoday | yes, for now |
| 19:46 | itistoday | but i think intelligent decisions will eventually win over stupid ones |
| 19:47 | Chousuke | for ever, if I can help it :P |
| 19:47 | Chousuke | I think the C way just looks horrible in lisp |
| 19:47 | Blackfoot | is pr-str and eval good enough for simple map serialization? |
| 19:47 | Chousuke | and it doesn't help |
| 19:47 | itistoday | Chousuke: we'll see. :-) |
| 19:47 | mikem | Blackfoot: don't use eval, use read |
| 19:47 | Chousuke | itistoday: have you tried using a structural editor? |
| 19:47 | Chousuke | itistoday: like paredit. |
| 19:48 | itistoday | Chousuke: yes. i hate paredit |
| 19:48 | itistoday | you know why you love paredit? |
| 19:48 | itistoday | because you stack your parens |
| 19:48 | itistoday | you need paredit |
| 19:48 | Chousuke | I love it because it lets me stop worrying about getting trivialities right. :P |
| 19:48 | Blackfoot | mikem: great thanks |
| 19:49 | Chousuke | It relieves me from the need to match parens, and I can just work with the structure directly. |
| 19:49 | Chousuke | it's much more efffective |
| 19:49 | Chousuke | -f |
| 19:49 | itistoday | Chousuke: but in the end your code ends up unreadable |
| 19:50 | Chousuke | except it doesn't. |
| 19:50 | Chousuke | because I indent properly |
| 19:50 | itistoday | can i see some examples? |
| 19:50 | itistoday | if your code looks anything like the standard code it's unreadable |
| 19:51 | Chousuke | "standard code"? |
| 19:51 | itistoday | what you call the majority |
| 19:51 | Chousuke | you're just asserting that stacked parens are unreadable now |
| 19:51 | Chousuke | which is not the case |
| 19:51 | itistoday | you said you "indent properly" |
| 19:51 | itistoday | i'd like to see what that means |
| 19:52 | itistoday | if it means what i think it does, i would contend that you're not indenting properly |
| 19:52 | itistoday | at least not in a way that 99% of developers understand |
| 19:52 | Chousuke | http://github.com/Chousuke/clojure/blob/clojure-reader/src/clj/clojure/lang/reader.clj |
| 19:52 | Chousuke | standard-ish emacs indentation |
| 19:53 | Chousuke | if that code is not readable, it's because it's hackish :P |
| 19:56 | itistoday | it's not as bad as some of the Lisp code that i've seen, but that's because for some reason you don't have very many instances there of ... what's the word... where a parameter to a function is used far past the function start and it ends up indented to the left of the code above it |
| 19:56 | itistoday | the worst i found is line 37 |
| 19:56 | itistoday | but i think that's just a coincidence |
| 19:56 | itistoday | that this code doesn't happen to have a lot of that |
| 19:57 | Chousuke | I don't think there's much problem with that at all |
| 19:57 | itistoday | it's unreadable |
| 19:57 | itistoday | how is that not a problem? |
| 19:57 | itistoday | how are you supposed to know what function those parameters belong to? |
| 19:57 | Chousuke | parameters? where? |
| 19:58 | itistoday | line 37 |
| 19:58 | itistoday | the call to make-rh-hepler |
| 19:58 | Chousuke | there's a just a function call at the end of a letfn block |
| 19:58 | Chousuke | it's pretty obvious |
| 19:58 | itistoday | it's only slightly more obvious in your code |
| 19:58 | itistoday | because it happens to be in the tail position |
| 19:58 | itistoday | with nothing below it |
| 19:59 | itistoday | *and* because nothing else is at that indentation level |
| 19:59 | itistoday | but that's not always the case |
| 19:59 | itistoday | again, this is less readable than if you were to use C-style indentation |
| 19:59 | itistoday | It's not clear whether make-rh-helper is inside the letfn or outside of it |
| 19:59 | itistoday | what tells you it's inside of it? |
| 20:00 | Chousuke | well, first of all the fact that the code actually compiles, but the indentation does. |
| 20:00 | itistoday | lol |
| 20:00 | Chousuke | granted, that function is almost at the verge of being too long |
| 20:00 | Chousuke | it should be made shorter. |
| 20:00 | itistoday | ok, considering your first reason is hopefully a joke |
| 20:00 | itistoday | and that you're not using compilation to determine where it is |
| 20:01 | itistoday | you say indentation does |
| 20:01 | itistoday | what is the indentation? |
| 20:01 | itistoday | 1 space |
| 20:01 | itistoday | one single fucking space |
| 20:01 | Chousuke | two spaces |
| 20:01 | itistoday | oh |
| 20:01 | itistoday | ok, excuse me |
| 20:01 | itistoday | it's so small i can't tell |
| 20:01 | itistoday | two spaces |
| 20:02 | itistoday | i don't know about you, perhaps years of being forced to do this has managed to give you super reading powers |
| 20:02 | itistoday | but it takes me a while to figure that out |
| 20:02 | itistoday | to make *sure* it's in the function and not outside of it |
| 20:02 | itistoday | and that was a relatively benign example |
| 20:02 | itistoday | i've seen far worse |
| 20:02 | itistoday | is that right? |
| 20:03 | itistoday | that two spaces should be your only clue as to something so important? |
| 20:03 | itistoday | what other language has that? |
| 20:03 | itistoday | i can't think of a single one |
| 20:03 | Chousuke | if it really bothers you, you can use rainbow parens or paren highlighting |
| 20:03 | itistoday | i don't use Vi |
| 20:03 | Chousuke | neither do I :P |
| 20:03 | itistoday | the readability of your source code should *not* depend on the editor used to view it |
| 20:03 | Chousuke | I can sort of see your point, but I don't think it's a big issue |
| 20:04 | itistoday | it's a huge issue to others |
| 20:04 | itistoday | not to you |
| 20:04 | itistoday | but have you ever heard of people complaining about Lisp's parenthesis? |
| 20:04 | Chousuke | lisp code would look absolutely horrible with C-style braces |
| 20:04 | itistoday | haha |
| 20:04 | Chousuke | because you'd have opening and closing brackets every other line |
| 20:04 | itistoday | that's what my code looks like, and i think it's beautiful |
| 20:04 | Chousuke | a 10-line function would bloat to 30 lines |
| 20:05 | itistoday | so what, it's more readable |
| 20:05 | itistoday | and you don't have to always not stack them |
| 20:05 | Chousuke | and about that I vehemently disagree :P |
| 20:05 | itistoday | this is dogma that's been drilled into you |
| 20:05 | itistoday | an unfortunate decision someone made in the lisp community that has plagued it till now |
| 20:06 | itistoday | no other language has indentation that does this |
| 20:06 | itistoday | *every* other language has indentation rules that are clear and consisent |
| 20:06 | itistoday | the spacing of the indentation in Lisp is variable! |
| 20:06 | itistoday | it goes from 1 space, to over 10 spaces |
| 20:06 | Chousuke | actually, no. |
| 20:07 | Chousuke | indentation is either 2 spaces or aligned parameters. |
| 20:07 | Chousuke | 2 spaces per level, that is. |
| 20:07 | itistoday | really? |
| 20:07 | itistoday | what about line 26? |
| 20:07 | itistoday | what is that? |
| 20:08 | itistoday | it's neither 2 spaces |
| 20:08 | itistoday | nor aligned with the paraemters |
| 20:08 | Chousuke | it actually is |
| 20:08 | Chousuke | the vector is considered a parameter. |
| 20:08 | Chousuke | but I think that's an emacs fail more likely |
| 20:09 | Chousuke | it should indent two spaces after (add-char |
| 20:09 | itistoday | what about line 169, or 166? |
| 20:09 | itistoday | or fuck, 168! |
| 20:09 | itistoday | that's 1 space! |
| 20:09 | itistoday | haha |
| 20:10 | itistoday | see? your indentation is bonkers |
| 20:10 | Chousuke | seems like it is. |
| 20:11 | Chousuke | 169 and 166 are fine though |
| 20:12 | itistoday | oh you're right, the ( on 26 looked like it was 1 space farther |
| 20:12 | itistoday | anyway, that's not the big issue |
| 20:12 | itistoday | the big issue is that i can't tell what parameters belong to what functions |
| 20:12 | itistoday | and neither can anyone else coming to lisp, or using it for several months |
| 20:13 | itistoday | to be able to quickly discern that sort of thing has to take some serious training |
| 20:13 | Chousuke | I think that if it's a problem then you perhaps need to restructure the code. |
| 20:14 | itistoday | yes, it's a problem with how the code is structured |
| 20:14 | itistoday | which is why i'm encouraging you to restructure it and indent it properly :-P |
| 20:14 | Chousuke | mind, I'm talking about the structure, not the text :P |
| 20:15 | Chousuke | I think the paren-stacking became the norm because you're not supposed to pay attention to the text |
| 20:16 | itistoday | i have no idea what you mean by that |
| 20:16 | itistoday | i pay attention to my code |
| 20:16 | Chousuke | but I suppose closing parens on their own line might in some cases communicate the structure better. |
| 20:16 | itistoday | otherwise it breaks |
| 20:16 | Chousuke | but I'd rather use a comment instead ;P |
| 20:17 | itistoday | Chousuke: i think it always communicates the structure better. |
| 20:17 | itistoday | http://github.com/taoeffect/dragonfly-newlisp/blob/master/example-site/dragonfly-framework/plugins-inactive/db/database_orm.lsp |
| 20:18 | itistoday | but i suppose if you're used to stacking them, that will look terrible |
| 20:18 | Chousuke | well, for most of those functions it's simply unnecessary :P |
| 20:19 | itistoday | yeah they're mostly short, but 'create-dbobj' is a good example i think |
| 20:20 | itistoday | and notice how it's readable on github, without syntax highlighting or rainbow parens or paren matching or any other fancy editor things |
| 20:20 | itistoday | it's just readable |
| 20:20 | Chousuke | and some of them are difficult to read anyway because you have things like (first (dbobj-assoc-rows obj:db obj:table (map first obj:revert-set) obj:finder 1)) on a single line |
| 20:21 | itistoday | it takes a lot of arguments... |
| 20:21 | itistoday | would you suggest putting them each on their own line? |
| 20:22 | Chousuke | yes? It helps a lot. |
| 20:22 | Chousuke | especially when the arguments look very similar |
| 20:22 | itistoday | ok, i could agree with that :-) |
| 20:22 | Chousuke | (the obj: stuff) |
| 20:32 | robink | Is there a way to remove the 'versions differ' warning in SLIME? |
| 20:36 | itistoday | robink: if you find out please let me know :-D |
| 20:39 | robink | itistoday: Heh, 'k :-) |
| 20:41 | itistoday | Chousuke: btw, if you don't read parens in Lisp why don't you set their color to the background color and be down with it? |
| 20:42 | itistoday | referring to this: "with lisp, you don't read the parens." |
| 20:43 | itistoday | s/down/done/ |
| 20:44 | itistoday | foooooo |
| 20:44 | itistoday | s/o+/o/ |
| 20:44 | sexpbot | fo |
| 20:44 | itistoday | foooooo |
| 20:44 | itistoday | p |
| 20:44 | itistoday | s/o+/o/ |
| 20:44 | itistoday | ah... of course, only the previous comment |
| 21:02 | arohner | how do you mvn install a clojure.jar built from scratch? |
| 21:03 | arohner | 'ant' correctly produces a usable clojure.jar, but 'mvn install' builds an unusable jar, and then installs it |
| 21:07 | itistoday | arohner: mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure -Dversion=1.2.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file |
| 21:07 | itistoday | i think |
| 21:08 | itistoday | arohner: 0 guarantee that will work |
| 21:08 | arohner | itistoday: that's at least close enough to get me started. Thanks |
| 21:08 | itistoday | np |
| 21:09 | itistoday | arohner: let me know if it works :-) |
| 21:25 | bortreb | arohner: if you built it yourself, you might consider specifying a different groupId |
| 21:34 | dabd | Is clojure 1.2.0 going to support annotations? |
| 21:56 | chouser | dabd: I think so, in defrecord and gen-class IIRC |
| 22:19 | dabd | chouser: thx |
| 22:22 | mudge | hey, are there any clojure t-shirts or hats? |
| 22:25 | mudge | when is this irc channel busy? |
| 22:25 | cad_from_austin | Quick question - a query to mysql for a datacount is returning this map - {:count(*) theNum} |
| 22:25 | cad_from_austin | How do I get the number? |
| 22:29 | _mst | (themap (keyword "count(*)")) would work, but it's a bit gross :) |
| 22:30 | _mst | I'd be tempted to modify the sql to do a select count(*) as thecount, and then use :thecount |
| 22:31 | cad_from_austin | Mmmm... that makes sense. Thank you _mst |
| 22:45 | arohner | mudge: it's probably busiest weekday mornings (american time) |
| 23:11 | chouser | mudge: http://www.zazzle.com/clojure |
| 23:17 | itistoday | chouser: thanks to your link, I was lol'd in memory at this: http://www.youtube.com/watch?v=JCjs-QhJYcs <- https://encrypted.google.com/search?q=ich+bin+ein+nerd <- http://www.zazzle.com/ich_bin_ein_nerd_tshirt-235025057064586625 |
| 23:19 | itistoday | (don't know if you've seen the show though, it's great) |
| 23:20 | itistoday | a better clip: http://www.youtube.com/watch?v=3C4PqyH6Ga4 |
| 23:41 | cais2002 | a quick question, in REPL, how do I cancel a line that's half-typed. in shell/cmd, I can do Ctrl+C. but doing that on REPL will terminate the REPL |
| 23:54 | itistoday | cais2002: C-a C-k is what i do |
| 23:55 | cais2002 | itistoday, does not seem to work |
| 23:56 | itistoday | cais2002: i guess it depends on where your repl is. I use OS X's terminal, which supports some emacs bindings |
| 23:56 | cais2002 | right.. i am on Win7, unfortunately |
| 23:57 | cais2002 | I had to spend quite some time to change leiningen to work in Win7 |
| 23:57 | itistoday | have you considered installing ubuntu? |