2010-06-07
| 00:00 | rava | ty |
| 00:01 | trptcolin | sure |
| 00:38 | _brian2_ | hi, is there a way to convert a string, say "{:foo "bar"}" to its clojure form? |
| 00:39 | tomoj | ,(doc read-string) |
| 00:39 | clojurebot | "([s]); Reads one object from the string s" |
| 00:39 | _brian2_ | ok, thnks! |
| 01:39 | jartur | Hello, everyone. I have another thrilling question. |
| 01:39 | jartur | Does anybody know of a way to connect REPL to the running app? |
| 01:39 | jartur | Is there a way at all? |
| 01:49 | jartur | Looks like No =) |
| 01:51 | jartur | Okay |
| 01:51 | jartur | clojure.contrib.server-socket should be it |
| 02:00 | jartur | It's so easy, I feel embarrassed. But google didn't want to show me the way. |
| 04:27 | LauJensen | Morning all |
| 04:39 | robink | LauJensen: Good morning. |
| 04:43 | TheBusby | morning |
| 04:46 | _exterm | morning |
| 05:03 | LauJensen | There's still a few seats left for the next Conj Labs (http://conj-labs.eu) so let me know if you're interested |
| 05:23 | esj | Morning Good People. |
| 05:35 | LauJensen | lypanov: Where there's a will there's a way |
| 05:35 | LauJensen | :) |
| 05:36 | lpetit | Morning all |
| 05:36 | LauJensen | Morning Mr. Petit |
| 05:37 | esj | wotcha. |
| 05:37 | lpetit | counterclockwise users in the room ? |
| 05:42 | lpetit | apparently no ... :-( |
| 05:45 | esj | lpetit: I used it briefly but the lack of paredit drove me back to the dark god Emacs. |
| 05:48 | zmila | lpetit, me :) as usual |
| 05:49 | lpetit | esj: the force is with counterclockwise nowadays = 80% of paredit has been ported to it! |
| 05:50 | lpetit | esj: It's called "Structural Editing Mode" (because paredit means nothing to eclipse users), and comes in two flavors: "default" (does not get in your way, e.g. does not prevent you from deleting single open or close paren), and "advanced mode" (my preferred) which tries hard (as paredit does) to prevent you from breaking the structure of your code |
| 05:50 | lpetit | zmila: ! :) |
| 05:50 | lpetit | zmila: did you update to the last version ? |
| 05:50 | esj | lpetit: Great news! I'll give it a spin then :) |
| 05:51 | zmila | i have 57.stable |
| 05:52 | lpetit | zmila: if you're a windows user and are annoyed by the bug on windows concerning "cannot delete file" .., I encourage you to upgrade to 58.stable and give feedback ! |
| 05:54 | zmila | lpetit, i did not see this bug |
| 05:54 | zmila | till now I deleted no clj file :) only adding |
| 05:55 | lpetit | zmila: bug occured when you launch the REPL, and while the REPL is running, you edit and save clojure files |
| 05:56 | LauJensen | Im very fond of Emacs, especially with par-edit disabled |
| 05:57 | lpetit | LauJensen: ccw paredit tries to be more user friendly in the "default" mode |
| 05:59 | LauJensen | But its like training wheels - Its a habit you need to grow out of |
| 06:00 | LauJensen | How have you improved it lpetit ? |
| 06:02 | lpetit | LauJensen: separated the features which "surprise you". e.g. when you try to delete a paren, intentionally wanting to temporarily break the structure of your code, but paredit doesn't let you do so, "for your own good". In default mode, this command is not active. |
| 06:03 | lpetit | LauJensen: and there's a note in the status bar indicating if you're in the default mode or in the status mode. And jumping from one to the other can be made by keyboard shortcut, entry in the contextual menu of the editor, or by clicking on the message on the status bar. |
| 06:04 | lpetit | LauJensen: stopped working on porting paredit features yet. Working on improving the overall perf. |
| 06:04 | LauJensen | Ah ok, especially the 'non babysitter feature' is nice |
| 06:05 | lypanov | LauJensen: if you have another session at a later date i'll have better luck :) |
| 06:05 | esj | LauJensen: i like my babysitter, she's cute |
| 06:05 | esj | very curvy |
| 06:07 | LauJensen | lypanov: We are working on some, still Europe but perhaps a little different in scope :) |
| 06:09 | lypanov | hopefully our company will grow a bit and i'll be able to join. at this point i'm still 100% on forging ahead full speed. no time for clojure :( |
| 06:09 | lypanov | stuck in RoR land. (though its not that bad with v 3) |
| 06:10 | LauJensen | lypanov: I've never dug into RoR - Can you recommend any projects for scouting out the basics? |
| 06:11 | lypanov | LauJensen: ror 2 stinks frankly. but there are a few good presentations on 3 by the lead. not sure about canonical good projects alas. |
| 06:12 | lypanov | ror 3 is still not out, so not much yet available on it alas. :( |
| 06:12 | lypanov | its the first version that doesn't make we want to weep though. |
| 06:13 | lypanov | LauJensen: if i spot a talk that doesn't assume existing ror 2 knowledge will pass it along. can't find anything with a very quick google. |
| 06:14 | lypanov | anyone know how clojure in clojure is coming along? |
| 06:14 | LauJensen | k |
| 06:14 | LauJensen | lypanov: no idea, cgrand might have a clue |
| 06:14 | lypanov | i'd still love to replace jquery + js with lots of clojure code. |
| 06:15 | LauJensen | lypanov: via scripjure, clojurescript, what? |
| 06:17 | lypanov | LauJensen: via clojure itself. currently doesn't exist. |
| 06:18 | lypanov | i like the gwt model of single language for server / client. |
| 06:18 | lypanov | having the same for clojure would make web app devel so much more fun. |
| 06:19 | lypanov | LauJensen: basically i'd want aot js compilation |
| 06:20 | LauJensen | k |
| 06:33 | lypanov | does anyone have any opinions / knowledge on good visually orientated code editors much like the self environment but a bit more modern? |
| 06:34 | lypanov | being the complete apple ho that i am, i'd just love to hack out clojure on an ipad. |
| 06:34 | LauJensen | haha |
| 06:34 | lypanov | (html5, touch, no app store) |
| 06:34 | LauJensen | I would like to shake your hand sir, you're the first I've ever met who wants an Ipad |
| 06:35 | LauJensen | "Uuuh I wish my Iphone was too big for my pocket and that I was unable to make calls from it" |
| 06:35 | LauJensen | Or that my websites looked like this: http://bradcolbow.com/archive/view/the_brads_test_how_your_site_looks_on_the_ipad/ |
| 06:35 | lypanov | LauJensen: i was in a room last week with 5 of them.. and this was in .nl. freaky. |
| 06:36 | unfo- | LauJensen, ahahahhaha :D |
| 06:36 | lypanov | LauJensen: it looks terrible at an angle, but straight on, i can't see the smudges. |
| 06:36 | lypanov | (nor the light, but i'm used to reflective screens now also) |
| 06:37 | LauJensen | seriously, Steve must be laughing his butt off that people are actually buying his products - I wish I could be paid to have so much fun |
| 06:37 | lypanov | you have a mac right? |
| 06:37 | LauJensen | No - I've gotten rid of all of my Mac gear |
| 06:37 | lypanov | ah. ;) |
| 06:38 | lypanov | honestly, i understand where you're coming from. i just wish that someone else would have products worth buying. |
| 06:38 | lypanov | (not talking about laptops here) |
| 06:38 | LauJensen | hmm, actually ipad did win one comparison, I wasnt aware before now |
| 06:38 | LauJensen | http://techcrunch.com/2010/01/30/ipad-v-a-rock/ |
| 06:38 | lypanov | :P that ones great. |
| 06:39 | lypanov | ah, saw a better one. this ones silly. |
| 06:39 | lypanov | the other one said "battery: unlimited" |
| 06:39 | eevar2 | apple's releasing new stuff today, no? |
| 06:39 | lypanov | eevar2: yeah but not h/w. |
| 06:39 | lypanov | well, other than iphone. |
| 06:39 | lypanov | anyway. as i said, i'm an apple ho. |
| 06:39 | lypanov | i verily admit to insanity. |
| 06:39 | LauJensen | I wish I could get my hands on the prototype: http://img.hexus.net/v2/news/apple/ipad-joke-1.jpg |
| 06:40 | lypanov | LauJensen: have you used one? |
| 06:40 | LauJensen | No of course not |
| 06:40 | lypanov | k. |
| 06:40 | LauJensen | Do I look like an iTard? :) |
| 06:41 | lypanov | you used to be, did you grow a beard recently? :) |
| 06:41 | LauJensen | hehe |
| 06:41 | lypanov | anyway. i regret my mention of apple ho. |
| 06:41 | LauJensen | Why, did I hurt your feelings? |
| 06:42 | lypanov | should i say "OMG I WANT A CLOJURE APP ON MAH ANDROID PAD :(" |
| 06:42 | lypanov | LauJensen: naah, just that it got off topic. |
| 06:42 | LauJensen | Ok :) |
| 06:42 | lypanov | i was more interested in actual movement on touch interfaces for programming. |
| 06:42 | lypanov | i think they could really kick ass. |
| 06:42 | lypanov | syntax free langs are the only ones that its possible with. |
| 06:43 | LauJensen | Well, in terms of development, anything from Apple is truely uninteresting |
| 06:43 | lypanov | *nod* but i'm talking about a website. |
| 06:43 | lypanov | and the ipad is the only readily available large multi touch device atm. |
| 06:43 | lypanov | but lets say something else does come out, and i'm talking about that. |
| 06:43 | lypanov | lets call it the LauPad |
| 06:44 | lypanov | i still think that visual touch orientated development is a progression that would afford many things we currently can't do easily without a fair bit of interaction. |
| 06:44 | eevar2 | the iphone store is supposedly a lot better than android et al. in terms of making actual sales |
| 06:45 | lypanov | yeah. but as i said, i want a clojure dev env. |
| 06:45 | LauJensen | eevar2: Due to the large user base no doubt |
| 06:45 | lypanov | i'm not interested in selling it. nor in native apps. |
| 06:45 | lypanov | apple would block any app i wrote anyway. |
| 06:45 | eevar2 | LauJensen: and willingness to pay |
| 06:46 | lypanov | i won't touch a non open sourced editor again in a few life times, and wouldn't want to force it upon others either. |
| 06:46 | lypanov | imagine where textmate could have been by now if it was open. |
| 06:47 | lypanov | anyway. i'll go off and look for some papers. someone must have done something interesting in the area. |
| 06:48 | eevar2 | LauJensen: then again, the people telling me android users won't buy stuff are into add based revenue ;) |
| 06:48 | lypanov | ad based < closed source < open source |
| 06:48 | lypanov | nothing is worse. |
| 06:48 | eevar2 | lypanov: and gpl < mit/bsd |
| 06:49 | lypanov | yup. |
| 06:49 | lypanov | well, for applications sometimes i disagree. |
| 06:49 | lypanov | but plugins must always be bsd/mit and libs also. |
| 06:50 | lypanov | even agpl is nice. i just wouldn't ever want to be the consumer of it ;) |
| 06:50 | lypanov | i'm gonna disappear as #clojure hasn't been more offtopic in a while :P |
| 07:41 | rhickey | anyone with examples of Java APIs that require your class have a particularly named static method? |
| 07:43 | telmich | hello |
| 07:44 | LauJensen | hi telmich |
| 07:47 | karmazilla | rhickey: in spring, you can instantiate beans by specifying a static factory method |
| 07:48 | rhickey | karmazilla: must it have a particular name? |
| 07:48 | karmazilla | rhickey: no |
| 07:49 | rhickey | I'm interested in the case where an API says, you must have a static method called "___" |
| 07:51 | esj | clojure.lang.IPersistentCollection calls for equiv. Any pointers on what this is and how it differs from Object.equals ? |
| 07:54 | powr-toc | I've just update slime to 20100404 (from elpa) and tab completion has stopped working in the REPL buffer... It just says "No dynamic expansion found for user> foo" |
| 07:54 | powr-toc | any idea how to fix it? |
| 07:56 | telmich | I'm wondering, how to get the zip-reader running |
| 07:57 | telmich | I'm trying to get this file running http://github.com/panter/edu/blob/master/clojure/imdb/src/imdb/movies_by_years.clj and installed clojure via lein |
| 07:58 | telmich | when removing the comment and having downloaded the required files before, I get the error "java.lang.Exception: Unable to resolve symbol: zip-reader in this context (NO_SOURCE_FILE:50)" |
| 07:59 | telmich | where lein is downloaded from http://github.com/technomancy/leiningen/raw/stable/bin/lein |
| 08:44 | rhickey | cemerick: got any examples of Java APIs that require your class have a particularly named static method? |
| 08:46 | cemerick | hrm |
| 08:48 | rhickey | cemerick: you were suggesting injecting a static method with a particular name might interfere with interop requirements |
| 08:49 | cemerick | oh, I was just saying that if you also want to allow the definition of static factory fns, then you'd want to push any automatically-generated statics into some "safe" mangled territory, e.g. Foo/_record, Foo/_ctor, etc. |
| 08:50 | rhickey | cemerick: so they have to be then wrapped in order to not be ugly? |
| 08:51 | cemerick | rhickey: we're still in the context of the map factory fn? |
| 08:51 | rhickey | yes |
| 08:53 | cemerick | no, the "wrapping" would be there so as to present a consistent interface, and get out of the territory of Foo-from, etc. |
| 08:54 | cemerick | The static factory fn that happens to be a static method is an impl detail. |
| 08:56 | rhickey | cemerick: unless you have a recipe for avoiding ongoing non-modular accumulation in (record ::Foo ...), it's definitely on the ropes |
| 08:56 | rhickey | its not an implementation detail, it's an implementation impediment |
| 08:57 | cemerick | I missed what the modularity issue is. (record Foo ...) just becomes a macro to (Foo/_record ...), no? |
| 08:58 | rhickey | if macro, can't be applied |
| 08:58 | cemerick | ah, right |
| 08:58 | rhickey | can't be used in data-driven manner |
| 08:58 | cemerick | well, that's separate from this modularity issue |
| 08:59 | rhickey | not really, if you didn't care about apply or data-driven use the macro wouldn't have modularity issues |
| 09:01 | cemerick | back in a sec |
| 09:51 | cemerick | rhickey: from left field: perhaps the most sensible thing would be to determine how factory fns should work in general, and then figure out how these various default/standard factory fns fit into that. |
| 09:54 | rhickey | cemerick: I have pages of notes around this already, just trying to shake out the (record Foo ...) option. If I thought it was the nicest thing ever but couldn't implement well, it won't go in |
| 09:55 | rhickey | conceptually, they are very simple - they are functions that call the ctor, but take arguments that differ from the ctor's |
| 09:56 | cemerick | rhickey: I understand, but stepping back, those "userland" factory fns presumably wouldn't fit into the (record Foo ...) regime, and they wouldn't fit into a Foo-from option either. The key is not in the implementation, but in the UI, as it were. |
| 09:57 | rhickey | cemerick: what do you mean by userland? |
| 09:57 | cemerick | factory fns for which the impl is user-defined, as opposed to canned / provided by default |
| 09:58 | rhickey | cemerick: having the generated either target or be replaced by user code is easy |
| 09:58 | cemerick | couldn't parse that :-) |
| 09:59 | rhickey | it is easy to make the canned/provided version either target or be replaced by the user-impl |
| 09:59 | cemerick | ah |
| 10:00 | cemerick | sure |
| 10:00 | cemerick | what I'm driving at is that these canned factory fns should probably be handled just like those userland factories -- in terms of where the vars live (if any) where the static methods are (if any), etc. |
| 10:05 | hugod | rhickey: could the data-driven use be covered by (record (some form) ...) expanding to (invoke-factory-using-reflection (some form) ...)? or am I misunderstanding "data-driven"? |
| 10:05 | rhickey | hugod: there will be no reflection based things |
| 10:06 | rhickey | so data driven implies some sort of self registration by the record into some sort of dispatcher |
| 10:08 | chouser | to be modular, that implies the registration is held at the classloader? which suggests a static method of the class itself? |
| 10:08 | hugod | to prevent modularity issues, each namespace could maintain some registration data for the dispatcher? |
| 10:09 | rhickey | chouser: I'm not sure modular and dispatcher are compatible at all |
| 10:09 | a_strange_guy | just a stupid question: What was the original reason to switch from 'Foo as a fn living in a Var to 'Foo beeing a auto-imported java classname? |
| 10:09 | cemerick | a_strange_guy: only java.lang.* stuff is auto-imported. |
| 10:10 | rhickey | cemerick: no, defrecord Foo imports Foo |
| 10:10 | chouser | is modularity a general problem for multimethods dispatching on type? |
| 10:10 | cemerick | oh, didn't think a_strange_guy's Q was related to records, my bad :-/ |
| 10:11 | rhickey | a_strange_guy: because deftype started generating named classes, so too confusing to have user.Foo and user/Foo |
| 10:11 | rhickey | chouser: yes |
| 10:12 | rhickey | chouser: but not inherent, as with factories, who's fn itself refers to the type |
| 10:13 | cemerick | back to basics, perhaps. Strawman time: https://gist.github.com/a455d0afd7478092b141 |
| 10:13 | cemerick | apply is nice, but direct usage is probably 90% of the game, and is needed for the interop story anyways. |
| 10:14 | rhickey | cemerick: ick |
| 10:14 | a_strange_guy | bleh, dont like static factories |
| 10:15 | cemerick | rhickey: interesting, I thought that's what you were aiming for for user-defined factories anyway. |
| 10:15 | rhickey | a_strange_guy: vs what? |
| 10:16 | a_strange_guy | static factories and constructors mean that I have to re-eval not only the defrcord form but all it's users |
| 10:16 | a_strange_guy | else they keep producing the old version of the record |
| 10:17 | cemerick | without static factories *and* ctors, I think you're left with vanilla maps. :-) |
| 10:17 | rhickey | well, the dynamism is an important point, and a difference between (record Foo ...) and (record ::Foo ...) |
| 10:18 | rhickey | you can always build dynamic things on static, but not vice-versa |
| 10:18 | rhickey | so, I understand a_strange_guy's point |
| 10:19 | a_strange_guy | well i really don't think that static things are needed at all |
| 10:19 | a_strange_guy | except maybe for Interop |
| 10:19 | rhickey | a_strange_guy: what about performance? |
| 10:20 | a_strange_guy | is there one? |
| 10:20 | rhickey | a_strange_guy: one what? |
| 10:20 | a_strange_guy | calling a fn wrapping the ctor or calling the ctor directly? |
| 10:21 | rhickey | a_strange_guy: a perf difference? yes |
| 10:22 | a_strange_guy | meh, I put too much hope into the JIT ^^ |
| 10:23 | rhickey | the JIT is awesome, but saying something is dynamic makes it volatile, which inhibits inlining |
| 10:27 | a_strange_guy | and what about direct binding? |
| 10:28 | rhickey | a_strange_guy: avoids that by taking the value out of the var, remembering it, and thus making it non-dynamic |
| 10:29 | a_strange_guy | this would be IMHO preferrable |
| 10:29 | a_strange_guy | making the default record construction dynamic |
| 10:29 | rhickey | a_strange_guy: same result, must re-eval |
| 10:30 | a_strange_guy | sure, but only where we have perf bottlenecks |
| 10:31 | a_strange_guy | making the default static seems like premature optimization |
| 10:32 | rhickey | a_strange_guy: I don't se what you mean by default. The dynamic must be built upon the static |
| 10:32 | rhickey | if you don't want to call the ctor, don't |
| 10:32 | rhickey | if it didn't exist, then what? |
| 10:33 | a_strange_guy | the way i understand the JIT is: |
| 10:34 | a_strange_guy | static -> full inlining |
| 10:34 | a_strange_guy | wrapper fn in a var -> no inlining |
| 10:35 | a_strange_guy | wrapper fn in a var + directly bound at callsite -> full inlining? |
| 10:35 | rhickey | only if there is something static to inline to |
| 10:36 | a_strange_guy | the wrapper fn would call the native ctor |
| 10:36 | rhickey | defrecord now provides an accessible named ctor. Don't use it if you want dynamism |
| 10:36 | rhickey | a_strange_guy: I understand all this, sheesh |
| 10:37 | rhickey | the class exists, it has the name you gave it, the constructor has the same name. These are baseline facts. You want a function, you can write one that calls these things. You want one generated by defrecord, propose a name |
| 10:39 | a_strange_guy | looking at the IRC logs i don't think that i could provide a better name |
| 10:40 | rhickey | not auto-importing the class and commandeering its name for the factory fn would preclude importing it |
| 10:41 | a_strange_guy | LISP-1: you only have one namespace, so use it wisely xD |
| 10:42 | Twey | Haha |
| 10:43 | a_strange_guy | my proposal would be to return to Foo beeing a fn in a var, but having metadata on the var to find the correct class |
| 10:43 | a_strange_guy | and some magic for extend and type-hints |
| 10:44 | a_strange_guy | but I don't think that this is thought throgh till the end |
| 10:45 | a_strange_guy | my english sucks :-) |
| 10:49 | a_strange_guy | that would mean that (Foo "some" "args") calls the fn dynamically, |
| 10:49 | cemerick | a_strange_guy: we've been there already |
| 10:50 | a_strange_guy | hmm |
| 10:50 | cemerick | that is, that's what records started with |
| 10:50 | Joreji | Hey guys, I have a java app from which I start a new thread which itself loads a clojure class. Is there some way to set the COMPILE_PATH variable before the class is being loaded (i.e. from the java code with something like Var.pushThreadBindings) |
| 10:51 | Joreji | ? |
| 10:51 | cemerick | Joreji: why do you care about *compile-path* if you've already got a classfile? |
| 10:52 | a_strange_guy | jeah, i just liked that simplicity |
| 10:54 | cemerick | The current state is strictly simpler than if Foo were a fn. Now you have easy access to the generated class, and using it is just like using any other class. |
| 10:55 | rhickey | admittedly hosty and less dynamic |
| 10:55 | cgrand | on Foo/record and apply, what about not making Foo/record a static method but a static field pointing to a IFn? (this would require modifying the compiler to support calling a fn in a static field) |
| 10:55 | Joreji | cemerick: Well, I want other classes to be compiled before loading the class. Basically during start-up of clojure. |
| 10:56 | a_strange_guy | cgrand: there ist still a problem with redefining the defrecord |
| 10:56 | Joreji | I've modified clojure to do that, however I need a way to set the COMPILE_PATH to something different before the clojure start-up. |
| 10:56 | cemerick | a_strange_guy: the same "problem" exists with macros. *shrug* |
| 10:56 | rhickey | cgrand: it complicates the semantics of (Foo/bar ...) quite a bit |
| 10:56 | cemerick | Joreji: do you need to compile a class, or *load* a class? |
| 10:57 | Joreji | cemerick: compile. |
| 10:57 | cemerick | Joreji: this is in a deployment environment? |
| 10:57 | Joreji | cemerick: ... and then load, I guess. |
| 10:57 | Joreji | cemerick: It's on android. |
| 10:58 | Joreji | Not sure what you mean by deployment environment. |
| 10:58 | cemerick | Joreji: then I'm really confused -- don't you need to AOT-compile everything you want to get onto the device? |
| 10:58 | a_strange_guy | rhickey: is making Foo a fn in a var again completely out of question? |
| 10:59 | rhickey | cemerick: I've made that argument also (same re-eval as macros), but people expect otherwise. I feel we are approaching a real divide between people needing perf and those desiring dynamism at all times |
| 10:59 | Joreji | cemerick: No. Android has its own compiler for the dalvik vm which compiles java vm bytecode code to dalvik vm bytecode. I can thus do: .clj (clojure source) -> .class (compiled java) -> .dex (compiled dalvik) |
| 10:59 | bartj | reading russian data present in a mysql table and spewing it to the output, all I get is garbage |
| 11:00 | cemerick | Joreji: right, I understand that, but doesn't that workflow need to happen before the app is loaded onto the device? |
| 11:00 | rhickey | cemerick: putting a good knob/swithc on that is tricky |
| 11:00 | bartj | using clojure.contribl.sql -> does that take an encoding parameter? |
| 11:01 | Joreji | cemerick: Not really. All required components are available on the device, so it is possible to do it there. |
| 11:01 | cemerick | rhickey: I'm not particularly sympathetic to those that push for hardcore dynamism. That makes a lot of stuff really hard across the board, it seems (and again, you're tied up with macros anyway). |
| 11:01 | bartj | nope, none of the clojure.contrib.sql takes any encoding parameters? |
| 11:01 | a_strange_guy | it's more a divide between "perf as default and dynamism when needed" and "dynamic as default and perf when needed" |
| 11:02 | cemerick | Joreji: Interesting. Well, anyway, yes, you can use pushThreadBindings from Java. Grep the clojure source for how to do that. :-) |
| 11:02 | cemerick | (not a very common requirement) |
| 11:03 | rhickey | if people have to annotate every thing explicitly in order to be fast, then fast programs will be very ugly (see CL) |
| 11:03 | Joreji | cemerick: Hmm. I've already tried using: Var.pushThreadBindings(RT.map(Compiler.COMPILE_PATH, path)); |
| 11:03 | Joreji | cemerick: Alas that didn't work, so I expected it to require clojure already being initialized. |
| 11:04 | cemerick | a_strange_guy: perf must be the default. No one puts up with slow anything for very long. |
| 11:04 | cemerick | Joreji: well, yes, clojure must be fully initialized for that to work, I'd presume. |
| 11:04 | cemerick | Although just referencing RT should do that. |
| 11:04 | candera | cemerick: Rubyists might say otherwise |
| 11:05 | cemerick | candera: exactly! :-P |
| 11:05 | a_strange_guy | cemerick: The reverse argument is also true |
| 11:05 | candera | :) |
| 11:05 | a_strange_guy | The python and ruby people rewrite stuff in C to make it fast |
| 11:05 | Joreji | cemerick: As in: import clojure.lang.RT ? |
| 11:06 | cemerick | a_strange_guy: no, it's not. You can always layer on dynamism if you really need it, as rhickey has said. You can't make a heavily-dynamic system as fast it it would be if it were static, no matter how hard you try. |
| 11:06 | candera | "Make easy things easy and hard things possible" |
| 11:06 | cemerick | Joreji: Probably on first reference (i.e. RT.map will init the class, not the import) |
| 11:07 | cemerick | though I suppose dalvik might be different in subtle ways |
| 11:07 | Twey | Python doesn't any more so much… you've got Cython and RPython and stuff instead |
| 11:07 | Twey | a_strange_guy: ^ |
| 11:09 | hugod | Joreji: *compile-path* is initialised from the clojure.compile.path property - is that what you want? |
| 11:10 | a_strange_guy | cemerick: sure you cant make a dynamic system as fast as a static one, but that is a straw man. The goal is to provide the knobs to make a dynamic system more static, so that it can become as fast as a static system |
| 11:12 | a_strange_guy | and adding dynamic layers on a static system isn't always a good idea |
| 11:12 | cemerick | a_strange_guy: I'll refer to rhickey's comment about CL. Further, defaults matter a lot. You should not have to work harder to get a system that performs to its fullest. Advanced users that want über-dynamism can be expected to jump through a few hoops though. |
| 11:13 | cemerick | Besides, are you looking for macros to operate at runtime? If not, then referring to defrecord ctors aren't a problem either. |
| 11:13 | fogus | candera: I think that the Ruby guys have made a conscious decision to trade speed in execution for speed in development time. |
| 11:14 | a_strange_guy | there is a big difference between macros and static ctors |
| 11:14 | a_strange_guy | macros do stuff that can't be done at call time, only at compile time |
| 11:14 | Joreji | hugod: I'll try that out now, thanks for pointing it out! |
| 11:15 | Twey | fogus: False dichtomy |
| 11:15 | Twey | fogus: In doing so, they throw away the chance to do both |
| 11:15 | candera | fogus: Yep. My point was simply to counter cemerick's statement, as it's dependent on what you're doing. I'm actually happy to have a language that defaults more in the perf direction. |
| 11:15 | cemerick | a_strange_guy: the point is that if the macro definition changes (or if a defrecord class changes) you need to reload all your usages in order to get the new behaviour/classes. |
| 11:17 | fogus | Twey: It's only a false dichotomy if you think Ruby can be fast. ;-) |
| 11:17 | Twey | Haha. |
| 11:17 | Twey | It probably can, though. Haskell manages to be pretty fast, after all, and it's much higher-level than Ruby. |
| 11:17 | candera | Wasn't someone in here the other day claiming that JRuby was going to get faster than Clojure "pretty easily"? |
| 11:17 | fogus | Twey: But my point was not that severe. I think speed in development time is just as legitimate as speed of execution... thankfully Clojure allows both. |
| 11:17 | Twey | Aye |
| 11:17 | a_strange_guy | I just don't accept the "macros and ctors are similar cases" argument |
| 11:18 | a_strange_guy | normally your code isn't littered with macros everywhere |
| 11:18 | cemerick | heh |
| 11:18 | Chousuke | well |
| 11:18 | Chousuke | not with macros that YOU wrote :P |
| 11:18 | cemerick | I was going to say. :-) |
| 11:19 | a_strange_guy | having many defrecords in a namespace is realistic |
| 11:19 | cemerick | The whole point of them is that they *are* classes with fields, permitting host-esque performance. There's a tradeoff there compared to regular maps. |
| 11:20 | a_strange_guy | yeah |
| 11:20 | a_strange_guy | but you can't use regular maps instead |
| 11:20 | a_strange_guy | because they don't allow protocols |
| 11:20 | cemerick | right, because regular maps can only be dispatched dynamically |
| 11:20 | cemerick | that's what multimethods are for |
| 11:21 | a_strange_guy | Protocols are dispatched dynamically too... |
| 11:21 | cemerick | no, they're dispatched based on the static type of the first argument |
| 11:22 | a_strange_guy | s/dynamic type/static type/ |
| 11:22 | sexpbot | Protocols are dispatched dynamically too... |
| 11:24 | lypanov | fogus: heya. just wondering if manning has said anything about epub editions of the clojure book? i only read on my iphone and it hates pdf's :( |
| 11:24 | fogus | lypanov: I think epub will be available when the book is finally published. |
| 11:24 | a_strange_guy | IMHO you shouldn't be punished to reloading your code if you wan't to do explorative programming with defrecords |
| 11:24 | candera | lypanov: I've been reading on iPod as well. It's not an awesome experience, no. But GoodReader's text mode does reasonably well with it. |
| 11:25 | lypanov | fogus: :( *nod* thought so. |
| 11:25 | fogus | lypanov: Sorry. |
| 11:25 | cemerick | a_strange_guy: punished? |
| 11:25 | lypanov | candera: it seemed to really mess up the text i was reading. example code was seriously messed up for example. |
| 11:25 | lypanov | maybe i should try latest stanza. |
| 11:26 | candera | lypanov: Yeah, I have to flip back over to the regular view for code. |
| 11:26 | lypanov | fogus: not your issue. just hope they change the way they publish meaps in the future. |
| 11:26 | a_strange_guy | cemerick: I fix a typo in a defrecord form |
| 11:26 | lypanov | if the dang ipad was here already i'd be reading :) |
| 11:26 | candera | lypanov: +1 on both |
| 11:27 | a_strange_guy | but have to reeval every defn where the type gets created |
| 11:27 | cemerick | a_strange_guy: again, same situation as with macros. Again, defrecord and its kin generate a class. |
| 11:27 | lypanov | candera: i even wrote a new app to do it. but the width of the content is just slightly too high to fit in landscape even with pixel tweaking. |
| 11:27 | lypanov | candera: (pdf reader with page turn via swipe) |
| 11:28 | lypanov | great for papers though. but i'd prefer an ipad or higher res iphone to most content on the iphone currently. |
| 11:28 | candera | lypanov: PDF on iPhone is definitely suboptimal. iPad would be perfect if a) I could fold it up to fit in my pocket, and b) someone other than Apple made it. :) |
| 11:28 | a_strange_guy | cemerick: most macros just wrap some forms in a thunk, and expand to a call to a fn |
| 11:29 | a_strange_guy | so you can actually fix most macros by just fixing the underliing fn |
| 11:29 | cemerick | some are like that yes -- many, many others are now |
| 11:29 | cemerick | not* |
| 11:30 | lypanov | candera: yeah... god the m$ thing looked beautiful. |
| 11:30 | a_strange_guy | I don't want to get in an argument here, but most people try to make macros fixable at runtime |
| 11:30 | cemerick | a_strange_guy: FWIW, absolutely no one here is against dynamic development. I think the consensus is that we'll accept a dent in dynamism for maximal perf, though. |
| 11:31 | cemerick | There's massive classes of macros that exist to do work at compile time rather than runtime. That's not a hit on them, that's their entire purpose. |
| 11:33 | a_strange_guy | what I am trying to say is that static constructors are a big pain in the ass in Javaland |
| 11:34 | cemerick | heh, along with all manner of other things! :-D |
| 11:34 | a_strange_guy | they try to work around that stuff with all the DI bullshit |
| 11:34 | cemerick | indeed |
| 11:34 | a_strange_guy | so why import static constructors fom Java |
| 11:34 | cemerick | Because we want to be fast. |
| 11:35 | a_strange_guy | xD |
| 11:36 | cemerick | There's lots to hate in the JVM world. Lots more to love IMO. One of the biggest parts to love is that the JVM is smokin' fast. If you didn't want to take advantage of that, then there's far, far less of a reason to use the JVM. |
| 11:36 | a_strange_guy | nobody stops you fom writing (new namespace.Foo <args>) if perf is needed |
| 11:36 | cemerick | Same with the CLR, BTW. |
| 11:37 | cemerick | Sure, but defaults matter. You line everyone up, and they'll care about perf far, far, far more than development-time dynamism. |
| 11:37 | a_strange_guy | actually 'new could do some magic and allow (new Foo <args>) |
| 11:37 | cemerick | Again, macros present the same issues. |
| 11:37 | cemerick | Oy. |
| 11:38 | cemerick | magic == indirection |
| 11:38 | a_strange_guy | indirection == bad? |
| 11:39 | a_strange_guy | actually this would seem logical |
| 11:39 | cemerick | I remember when I suggested (a long time ago) to rhickey that some conditional be added to new. I got taken to school. :-D |
| 11:40 | cemerick | indirection has a perf penalty |
| 11:40 | Twey | (= 'indirection 'abstraction) |
| 11:40 | cemerick | The language should not get in people's way. |
| 11:40 | a_strange_guy | 'new is a special form that allows fast and hosty object creation |
| 11:40 | Twey | And abstraction is good |
| 11:40 | cemerick | Twey: actually, that's not true. Macros are a good abstraction, but need not introduce any indirection. |
| 11:41 | Twey | cemerick: Macros are indirection by definition |
| 11:41 | Twey | They introduce an extra layer between the code you write and what actually happens |
| 11:41 | cemerick | only at compile time :-) |
| 11:41 | candera | "There is no problem in CS that cannot be solved by adding a layer of indirection. There is no problem in performance engineering that cannot be solved by removing one." |
| 11:41 | a_strange_guy | new could do this 'magic' at compiletime |
| 11:41 | Twey | candera: Hehe |
| 11:42 | a_strange_guy | if the first form is not a class but a Var |
| 11:42 | Twey | In some cases, abstraction can lead to better performance |
| 11:42 | Twey | Good abstractions add semantic information to operations, which allows the compiler to make optimisations based on it |
| 11:42 | Twey | Also, see lazy evaluation |
| 11:43 | a_strange_guy | ill sketch my idea up... |
| 11:44 | cemerick | a_strange_guy: so you're going to propose radically changing one of the core host interop operators? |
| 11:45 | a_strange_guy | there is no change, 'new still performs fast, hosty and direct object creation |
| 11:46 | cemerick | a_strange_guy: in any case, my hat's off to you. Good luck. :-) |
| 11:50 | a_strange_guy | no offence taken |
| 11:54 | hugod | cgrand: to run the enlive tests, I had to add clojure-contrib as a dev-dependency in project.clj |
| 11:55 | cemerick | contrib isn't a direct dep anyway? |
| 11:55 | cemerick | hugod: feh, nm, I thought we were in #pallet :-P |
| 11:56 | cgrand | hugod: thanks, I should update the tests to use clojure.test too |
| 11:58 | rhickey | poll: if you had to qualify a defn with some metadata tag in order for it to have these characteristics: direct-linked, could take/return primitives, non-closure, no self-reference as object/HOF (self-call ok), what tag would you use? |
| 11:58 | rhickey | :static? |
| 11:58 | rhickey | :fast? |
| 11:59 | AWizzArd | :static is okay, and it will remind people of static typing |
| 11:59 | cgrand | :static |
| 12:00 | a_strange_guy | :static |
| 12:01 | rhickey | note that you could still use the resulting fn as a HOF/IFn |
| 12:01 | a_strange_guy | although i wouldn't use defn to define it |
| 12:01 | AWizzArd | I would be glad about any optional information that is known at compile time. |
| 12:02 | candera | I've always thought static was a horrible keyword. The semantics for those of us who have been doing C-family programming for 20 years are right, but in and of itself I think there must be something better. |
| 12:03 | cgrand | rhickey: is that an asnwer to my kludgy defhintedfn? |
| 12:03 | rhickey | cgrand: perhaps, I'm measuring the difficulty now. But it covers a lot of things, including the 'knobs' for direct-linking, etc |
| 12:03 | hiredman | :metal |
| 12:04 | hugod | :native |
| 12:04 | candera | :bare? |
| 12:05 | a_strange_guy | I would like :native, but that would confuse Java-people |
| 12:06 | a_strange_guy | so :static or :statically-linked-and-really-fast-do-not-use-if-not-needed xD |
| 12:06 | Twey | Haha |
| 12:06 | AWizzArd | Well, I think this is all about static information, that won't change at runtime, and are known at compile time. |
| 12:07 | rhickey | also static as in the opposite of dynamic |
| 12:07 | AWizzArd | As long this is optional it's great. |
| 12:07 | rhickey | it would be an important difference in direct linking, moving the decision to the fn definition and away from the caller. Not that you have control over that right now, that's the current architecture |
| 12:09 | a_strange_guy | meh... |
| 12:09 | rhickey | cgrand: I've had statics and defstatic on the todo list for a while, this would unify several things and deliver in the context of fns. |
| 12:09 | AWizzArd | Whatever the key is, be it :static or whatever, what is the value? Just a true/false? Or a record of information? |
| 12:09 | rhickey | true |
| 12:10 | AWizzArd | ah ok |
| 12:10 | AWizzArd | Well, in that case :fast is also fine. |
| 12:11 | rhickey | :fast was a joke |
| 12:11 | cgrand | I guess that most of core fns would be marked as :static then and the special-case for direct-binding removed |
| 12:11 | rhickey | cgrand: exactly |
| 12:13 | rhickey | since primitive args/return would only be supported for :statics, using them without saying :static could either: A) be an error, B) be implicitly :static true |
| 12:13 | lpetit | rhickey: what would happen if someone tries to rebind such a var ? |
| 12:14 | rhickey | lpetit: nothing. you might do this as part of fixing code interactively, with the caveat that you must re-eval any consumer code to see the effect, just like with macros |
| 12:14 | AWizzArd | A) ==> the compiler should signal an error |
| 12:16 | lpetit | rhickey: new semantic (direct linking, non closure, no self reference apart from itself) => new "public API" keyword ? that is why not :static as the metadata , but the preferred usage be via e.g. defstatic / defnstatic ? |
| 12:17 | lpetit | s/keyword/command/ |
| 12:17 | sexpbot | rhickey: new semantic (direct linking, non closure, no self reference apart from itself) => new "public API" command ? that is why not :static as the metadata , but the preferred usage be via e.g. defstatic / defnstatic ? |
| 12:17 | a_strange_guy | lpetit: agreed |
| 12:17 | rhickey | lpetit: I'm not quite sure I understand |
| 12:18 | a_strange_guy | defn shouldn't hve a semantic change |
| 12:18 | a_strange_guy | if you see that a corefn is defined with defstaticfn or similar |
| 12:18 | rhickey | I'm sure people will get tired of (defn {:static true} foo ...) just like with :private |
| 12:19 | lpetit | rhickey: yes, defn having a semantic change seems odd to me. Maybe internally (or for power users), why not have the :static keyword metadata, but for "normal" users, having defstatic will *clearly* prompt in their mind that they are dealing with a new kind of definition |
| 12:20 | lpetit | rhickey: this looks more like a new kind of definition than a variant to me |
| 12:20 | lpetit | rhickey: :private was ok, a variant with a different scope. But once you have the var in your hands, everything happens like usual. |
| 12:21 | a_strange_guy | rhickey: do you plan to compile this down to static methods? |
| 12:22 | rhickey | lpetit: well, we're back to layering. It is a variant, and I'm not opposed to a defsomethingshort, but lots of things yield defns, and metadata flows... |
| 12:22 | rhickey | a_strange_guy: I'm not planning anything yet |
| 12:24 | lpetit | lpetit: just like defmacro is a defn with a :macro true metadata, but nobody in current code writes it with anyhting but defmacro, I would see defstatic, with still (as for defmacro) the :static metadata keyword. Oh this would be really consistent: defmacro / :macro , defstatic / :static |
| 12:25 | rhickey | lpetit: but defmacro could turn into something completely different tomorrow |
| 12:25 | rhickey | the fact that a macro is a fn is an implementation detail |
| 12:26 | lpetit | rhickey: wouldn't it be the same for defstatic ? |
| 12:26 | rhickey | No, the things inside defstatic vars would be guaranteed to be IFns |
| 12:26 | lpetit | rhickey: with some constraints at definition time, but not visible to the caller |
| 12:27 | lpetit | rhickey: but the need to reeval user code if the definition changes ... |
| 12:27 | rhickey | right, and some linkage directives |
| 12:27 | rhickey | higher-order usage would go through the var, as would (#'my-static-fn ...) |
| 12:33 | lpetit | rhickey: higher-order function via the var would then "loose" the "no boxing" property ? |
| 12:33 | rhickey | lpetit: right |
| 12:38 | lpetit | does somebody know if there is a version of try-clojure.org which works with 1.2.0 snapshot ? |
| 13:14 | LauJensen | (clojure-version) |
| 13:14 | LauJensen | ,(clojure-version) |
| 13:14 | clojurebot | "1.2.0-master-SNAPSHOT" |
| 13:24 | bartj | reading this string - "Детские сады, детские центры, дошкольное образование, прогимназии, ясл" from a MySQl database prints jibberish in Java |
| 13:24 | bartj | I am using the clojure.contribl.sql library |
| 13:25 | bartj | does one have to decode UTF-8 strings while displaying on the console? |
| 13:25 | bartj | what I see is this - "Ðбразивные инÑтрумент оптом |
| 13:25 | bartj | " |
| 13:26 | mefesto_ | bartj: can you read the value in the database by some other means to make sure it was inserted w/out error? |
| 13:26 | bartj | mefesto: yes, I am able to do so in Perl |
| 13:27 | bartj | with no charset supplied... |
| 13:32 | mefesto_ | bartj: have you tried manually specifying the character encoding in the jdbc url connect string? |
| 13:33 | bartj | mefesto_: no, I will look in the documentation right now... |
| 13:40 | bartj | mefesto_: yes, retried specifying the encoding as follows - "useUnicode=true&characterEncoding=utf8" |
| 13:40 | bartj | mefesto_: does not work as expected... |
| 13:40 | mefesto_ | bartj: and you are sure that the server itself is using utf8 too? |
| 13:41 | bartj | mefesto_: er, you mean the mysql server? |
| 13:41 | mefesto_ | yeah |
| 13:41 | bartj | mefesto_: yes |
| 13:42 | bartj | bartj: "CHARSET=utf8" is specified while creating the mysql tables |
| 13:43 | bartj | mefesto_: I am able to read the db values from a Perl program.... |
| 13:44 | mefesto_ | bartj: yeah, i was just thinking that maybe for some reason connector/j wasn't able to auto detect the correct encoding but perl was... |
| 13:45 | bartj | mefesto_: which should not be the problem, since we have specified the encoding in the URL string? |
| 13:45 | mefesto_ | bartj: yeah |
| 13:53 | tcrayford | is printing it out the problem? |
| 13:54 | tcrayford | iirc slime/swank might not work that well with utf8 (it works, but needs some configuration set up_ |
| 13:54 | bartj | tcrayford: no, because, I am able to print it out in Perl? |
| 13:54 | tcrayford | when you display the string in the repl I mean |
| 13:54 | chouser | good question. Since the String should be unicode-aware, it would be helpful to know if it made it correctly into the String or not. |
| 13:54 | bartj | This URL quite nicely explains what the problem is - http://linux.kieser.net/java_pg_unicode.html |
| 13:54 | bartj | though the problem and the solution both are for PostgreSQL |
| 13:55 | tcrayford | that's somewhat nasty :/ |
| 13:55 | chouser | bartj: maybe check the length of the string to see if it is right or not? |
| 13:56 | candera | You should be able to write it to a file and view it, no? That will bypass display-related issues. |
| 13:57 | chouser | if the length is right, the problem is in printing the string. If the string is too large, the problem is getting it from the db into the string. |
| 13:57 | bartj | no, writing to a file doesn't help |
| 13:58 | bartj | tcrayford: you refer to the URL I pasted? |
| 13:58 | candera | Meaning I'm wrong and that doesn't tell you anything, or you tried writing it to a file and it's still garbage in the file? |
| 13:58 | tcrayford | bartj: yes |
| 13:59 | bartj | candera: I tried writing to a file and it's still garbage |
| 13:59 | candera | Are you sure the editor you used to view it knows what the encoding of the file is? |
| 13:59 | candera | e.g is there a BOM at the beginning |
| 13:59 | chouser | that doesn't prove much, if the thing writing the file or the thing reading the file chooses the wrong encoding. |
| 13:59 | bartj | candera: BOM? |
| 14:00 | candera | Byte Order Mark. Seen often when serializing XML. A couple of bytes that help readers of the file detect the encoding. |
| 14:00 | chouser | I'd check the length of the string while it's still in java, no IO having been done since reading from the db connection. |
| 14:01 | candera | bartj: are you on Windows? |
| 14:02 | bartj | candera: No, Linux - Ubuntu |
| 14:02 | bartj | regarding the string length, doing a length(column) on mysql gives a value of 261 |
| 14:03 | candera | Ah. I don't know the editor landscape there. On Windows at least, some editors fail to deal with encoding and some get it right. |
| 14:03 | bartj | and doing a .length() after reading it from the Db in Java gives a 42 |
| 14:03 | chouser | whoa |
| 14:03 | bartj | I mean 52 |
| 14:03 | chouser | so there's definitely something broken there. too short? maybe it's tripping over a null or something. |
| 14:03 | bartj | candera: It displays quite nicely when I output it on the bash command line using a Perl progam |
| 14:03 | chouser | not a display issue |
| 14:04 | bartj | candera: so, I am pretty certain it is not a display issue |
| 14:04 | candera | Yeah, if the length is goofed up, that's not it. |
| 14:04 | candera | Sorry for the red herring. |
| 14:05 | chouser | bartj: you don't have a .getBytes() method you can try instead of .getString() or seomthing? |
| 14:06 | chouser | bartj: you've seen this page? http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-charsets.html |
| 14:08 | bartj | chouser: yes |
| 14:08 | bartj | I suspect the problem is that I am encoding characters twice! |
| 14:09 | bartj | but decoding the db output (in Java) does not seem to solve it... :( |
| 14:09 | chouser | not if it's already too short |
| 14:10 | bartj | chouser: I am not sure if the comparision I did is apt? |
| 14:11 | chouser | the column is a string in the db, not bytes or something else? |
| 14:11 | chouser | if so, then length(col) should be your gold standard. |
| 14:12 | chouser | Java strings can contain nulls and such without the .length() method failing, so whatever chars make it into the string will be counted. |
| 14:13 | chouser | the question being then the format of the data sent by the server to the jdbc driver, and then how the driver interprets that to create the Java string. Surely those are the only two places left to mess it up. |
| 14:15 | bartj | the string length of this is - "Детские сады, детские центры, дошкольное образование, прогимназии, ясли": 71 |
| 14:15 | chouser | I see nothing but blanks and commas between those quotes. :-) |
| 14:16 | bartj | chouser: ha |
| 14:16 | chouser | but we're not trying to solve my IRC client's unicode problems, so that's ok. |
| 14:18 | neotyk | ,(count "сады") |
| 14:18 | clojurebot | 4 |
| 14:20 | neotyk | ,(.length "сады") |
| 14:20 | clojurebot | 4 |
| 14:20 | KirinDave | well played, java |
| 14:20 | neotyk | bartj: what's the problem? |
| 14:21 | neotyk | I had quite some problems with PL encoding while ago |
| 14:22 | bartj | neotyk: I am unable to display unicode strings (russian for now) from mysql database |
| 14:22 | neotyk | what is your connection string? do you set client encoding (jdbc driver)? |
| 14:24 | bartj | jdbc:mysql://localhost/db?useUnicode=true&characterEncoding=UTF-8 |
| 14:24 | bartj | neotyk: yes |
| 14:25 | bartj | the string size is 71, but when I read it from the mysql database it shrinks |
| 14:26 | neotyk | and you see those characters in mysql client |
| 14:26 | bartj | , (count "Детские сады, детские центры, дошкольное образование, прогимназии, ясли") |
| 14:26 | clojurebot | 71 |
| 14:26 | bartj | yes, absolutely |
| 14:30 | mozinator | hi guys, fetching clojure from leiningen doesnt seem to work anymore for me, anyone else noticed this ? [WARNING] repository metadata for: 'snapshot org.clojure:clojure:1.2.0-master-SNAPSHOT' could not be retrieved from repository: clojure due to an error: Error transferring file |
| 14:32 | lancepantz | |
| 14:32 | chouser | mozinator: Can you fetch it from build.clojure.org instead? |
| 14:34 | mozinator | chouser, I can download it from here: http://build.clojure.org/snapshots/org/clojure/clojure/1.2.0-master-SNAPSHOT/ |
| 14:34 | mozinator | chouser, maybe its the same error I encountered in the past on debian linux, a missing java keystore |
| 14:35 | ysph | mozinator: i am able to fetch with [org.clojure/clojure "1.2.0-master-SNAPSHOT"] |
| 14:36 | mozinator | strange.... openjdk works, but sunjdk does not work on debian linux |
| 14:36 | zakwilson | Ahh... a channel that isn't full of Apple stuff. |
| 14:36 | zakwilson | Should I be using 1.1 or 1.2 for my personal project? |
| 14:36 | chouser | 1.2 |
| 14:36 | zakwilson | No hesitation there. Alright, I'll switch over. |
| 14:36 | ysph | mozinator: what version of sunjdk? |
| 14:37 | chouser | :-) |
| 14:37 | mozinator | sun-java6-jdk 6.20-dlj-1 |
| 14:37 | ysph | 1.6.0_12-b04 here |
| 14:37 | ysph | the new oracle vms are known to reject previously valid signatures |
| 14:37 | zakwilson | What's the appropriate contrib version to go with that? |
| 14:37 | ysph | may or may not be a factor |
| 14:38 | mozinator | ysph, I am going to check if I can reproduce the problem with a manually downloaded jvm |
| 14:38 | chouser | zakwilson: latest snapshots of each should be ok |
| 14:41 | mozinator | ok, I can reproduce the problem with a manualy downloaded JVM from oracle |
| 14:41 | mozinator | ysph, I think your theory is right |
| 14:45 | LauJensen | Im wondering what happens under the hood when I do (drop 150000 (read-lines "log")) |
| 14:46 | LauJensen | contrib.io.read-lines |
| 14:48 | ysph | LauJensen: how far under the hood? |
| 14:48 | ysph | mozinator: it seems plausible, our Eclipse RCP build stopped working after a routine upgrade to 6.20 because of rejected certs |
| 14:49 | LauJensen | ysph: Far enough to see how wasteful it is |
| 14:49 | kotarak | LauJensen: it opens a reader on log |
| 14:50 | LauJensen | kotarak: Sure, but what goes on with the 15000 lines? |
| 14:50 | chouser | technomancy: ? |
| 14:50 | kotarak | LauJensen: they are obviously read when you call seq on it |
| 14:50 | technomancy | chouser: we have a game at work where every time we run into issues with Oracle's JVM, I get a point, but whenever there's a problem with OpenJDK, they get a point. |
| 14:50 | technomancy | chouser: so far we are tied. |
| 14:50 | chouser | heh |
| 14:51 | ysph | technomancy: this latest round might put you over the top |
| 14:51 | technomancy | ysph: it does sound pretty wretched |
| 14:51 | zakwilson | After upgrading to Clojure and contrib 1.2, I cannot connect to Swank on a remote machine. I don't think I changed anything else. |
| 14:52 | LauJensen | kotarak: So drop doesn't have any tricks for lazy-seqs where it moves the line-pointer instead of actually consuming each dropped line |
| 14:52 | LauJensen | ? |
| 14:52 | chouser | zakwilson: oh, man, I'm sorry -- I should have qualified my recommendation. I don't use swank, and it often lags a bit. I dunno if 1.2 works properly there yet or not. |
| 14:52 | kotarak | LauJensen: how could it know how far to read into the file for line without knowing in advance where the linebreaks are? |
| 14:53 | LauJensen | Good point :) |
| 14:53 | zakwilson | chouser: no problem. I'll poke at it a bit and if it doesn't start working, it won't be hard to downgrade. |
| 14:54 | LauJensen | kotarak: But I just dont get it, its currently getting to the last line of a 65MB file in 400ms |
| 14:55 | ysph | zakwilson: there is a swank-clojure 1.2.0 in the repos that works for me locally |
| 14:56 | zakwilson | ysph: I have 1.2.1. Starting it with lein swank works locally, but I can't connect to the remote. |
| 14:56 | kotarak | LauJensen: do you have it in cache? (read: memory) |
| 14:56 | LauJensen | no |
| 14:56 | zakwilson | Wait... maybe I did something stupid. |
| 14:57 | zakwilson | Nope. Connection refused |
| 14:57 | LauJensen | ~source group-by |
| 14:58 | zakwilson | nmap of local from remote shows port 4005 closed. nmap of remote from remote shows port 4005 open. I have not changed any firewall settings on remote. |
| 14:59 | kotarak | zakwilson: did you start with 127.0.0.1 to listen? |
| 14:59 | a_strange_guy | I think that #'ns-unmap -ing imported classes has some wierd consequences |
| 14:59 | a_strange_guy | http://gist.github.com/429027 |
| 15:00 | zakwilson | kotarak: I ran "lein swank". If it takes any options, I'm not aware of them. |
| 15:01 | tomoj | zakwilson: don't you want to look at nmap of remote from local? |
| 15:02 | zakwilson | tomoj: Uhh... yes. I said it backwards, but did it forwards. nmap of remote from local shows port 4005 closed |
| 15:02 | tomoj | do you really want it to be open, anyway? |
| 15:02 | ysph | zakwilson: what does netstat -tln on remote say regarding 4005? |
| 15:02 | zakwilson | tomoj: both machines are on my LAN. I do want it open. |
| 15:03 | tomoj | ah |
| 15:03 | zakwilson | ysph: netstat -tln|grep 4005 comes up blank. |
| 15:04 | zakwilson | ysph: I should note that remote is running Mac OS and might have a slightly different netstat than you expect. |
| 15:05 | ysph | if you run it without grep is should say something like "Active Internet connections (only servers)" |
| 15:06 | ysph | zakwilson: how about netstat -l -p tcp |
| 15:08 | zakwilson | ysph: that doesn't show a line with 4005, but it does show the active ssh connections. netstat -an does show a line with 4005: |
| 15:08 | zakwilson | tcp4 0 0 127.0.0.1.4005 *.* LISTEN |
| 15:11 | ysph | zakwilson: this looks somewhat promising, http://github.com/hugoduncan/lein-remote-swank |
| 15:13 | zakwilson | ysph: I tried that when using Clojure 1.1 and it failed to start Swank on the remote machine. |
| 15:14 | troutwine | Would someone be so kind as to comment on this: http://groups.google.com/group/clojure/browse_thread/thread/6225680aad195dc0 |
| 15:14 | troutwine | I swear that lein was working just fine not but a few days ago. :/ |
| 15:14 | cschreiner | sudo? |
| 15:15 | mozinator | troutwine, I just had the same error |
| 15:15 | mozinator | troutwine, its the new oracle jdk |
| 15:15 | Twey | troutwine: Looks to me like it can't download swank-clojure-1.2.1.jar from anywhere |
| 15:15 | jdmmmmm | troutwine: try this: :dev-dependencies [[swank-clojure "1.2.1"]] |
| 15:15 | troutwine | Oh good, I've not gone mad. |
| 15:16 | troutwine | jdmmmmm: I'll give it a go. |
| 15:16 | troutwine | mozinator: How is the new Oracle JDK causing this? |
| 15:16 | hugod | zakwilson: I haven't tried the lein-remote-swank plugin in a while - I'll take a look to get it working with 1.2 |
| 15:17 | mozinator | troutwine, I am not really sure , but when I switch between openjdk and the new oracle jdk things go from working to not working |
| 15:17 | TimMc | LauJensen: I took a look at your website's code... I guess what I really need to look at is a dynamic site's code. |
| 15:17 | zakwilson | hugod: cool. Currently, it's failing to rsync. |
| 15:17 | troutwine | jdmmmmm: That did it. I don't understand why, though. Can you explain the difference? |
| 15:18 | mozinator | troutwine, ok, clearly you have another problem :) |
| 15:18 | TimMc | LauJensen: I'm interested in finding a site that uses data from the DB to generate HTML pages based on templates. |
| 15:18 | hugod | zakwilson: probably a host key checking problem, or maybe invalid rsync options for your os |
| 15:19 | ysph | apparently lien swank as of 1.2 takes args such as lein swank 4005 "localhost" |
| 15:19 | LauJensen | TimMc: check out templates.clj. All the templates take arguments, they can come from a DB if you prefer. There's really nothing more to it |
| 15:19 | troutwine | mozinator: Hanging out as I do on Debian Stable, I don't think I'm using Oracle's Java yet. |
| 15:19 | LauJensen | And the dynamic bit is in admin.clj/webview.clj where all the urls served are dynamic |
| 15:19 | ysph | ref: http://stackoverflow.com/questions/2752720/how-to-reconnect-to-slime-swank-clojure-session |
| 15:20 | zakwilson | hugod: It stopped working after I rewrote project.clj. I may have somehow broken something with remote-user and remote-path, but I'm not sure how I'd do that as they seem pretty simple. |
| 15:21 | zakwilson | Problem solved, I think. Just before ysph posted that, I looked up the source for lein-swank and tried specifying a host. Evidently, it was using the loopback interface. |
| 15:21 | jdmmmmm | troutwine: I have no idea. It could have been uploaded with a different groupId previously and then removed. I just go with what's in clojars. |
| 15:24 | TimMc | LauJensen: Oh, the admin stuff... I'll take a look as soon as my work machine stops crapping itself. |
| 15:25 | troutwine | jdmmmm: I believe I understand. I was instructing lein to request swank-clojure from clojure.org, rather than from where-ever availiable. |
| 15:26 | zakwilson | My problem had nothing to do with the Clojure version. I ran lein clean to get rid of the old Clojure version and also got rid of the old lein-swank version. |
| 15:26 | jdmmmmm | troutwine: It's all based on how it's identified (groupId/artifactId in clojars or other public maven repos). |
| 15:32 | zakwilson | New problem: "lein swank" doesn't seem to be honoring jvm-opts |
| 15:34 | korre | zakwilson: what is jvm-opts? |
| 15:35 | zakwilson | A project.clj key that supposedly passes arguments to the java command line |
| 15:35 | korre | a ok |
| 15:36 | korre | whell so you can patch swank or use a shell script to start upp swank |
| 15:37 | zakwilson | Or I can edit the leiningen shell script, which is what I've done in the past. Still, that option was created to avoid having to do so and I'd like to use it. |
| 15:39 | korre | so what are you using the comand line args for in swank mode? |
| 15:40 | bartj | to all the kind souls who helped with the encoding issue, thanks! - the problem is solved |
| 15:41 | Licenser | hello my lispy friends |
| 15:41 | LauJensen | Hi Licenser |
| 15:41 | Licenser | greetings LauJensen |
| 15:41 | korre | who told you i had a lisp? |
| 15:41 | Raynes | korre: McCarthy. |
| 15:41 | Raynes | He sensed it. |
| 15:42 | a_strange_guy | cemerick: you remember us dicussing new+dynamic-fns-in-vars+defrecord? |
| 15:42 | a_strange_guy | this was my idea: http://gist.github.com/429080 |
| 15:42 | zakwilson | korre: the one I need is -Xmx2048M, but I've been playing with other optimizations to see if I can get more speed. |
| 15:42 | a_strange_guy | horray for metadata in clojure |
| 15:44 | bartj | chouser: The primary problem with the encoding issue was that the database and the 'server' were not utf8... |
| 15:45 | bartj | chouser: in mysql you could do - "show variables like '%char%';" |
| 15:46 | korre | zakwilson: i thought lien started up new process's... if that is the case then modifying the script shouldnt help |
| 15:47 | chouser | so it was stored right in the table, but the server was putting it on the wire wrong. |
| 15:47 | zakwilson | korre: I killed the old one first |
| 15:49 | cemerick | a_strange_guy: I'm sunk in elsewhere, can't look at that too closely atm. If you throw in some comparative benchmarks, and they're comparable with the existing way, you might want to run it by rhickey. I doubt he'll want to change defrecord so significantly (again), but anything's possible if your idea is better. |
| 15:50 | mmarczyk | good morning (ugt) |
| 15:51 | mmarczyk | LauJensen: hurray on your open-sourcing of your site-baking code :-) |
| 15:51 | bartj | chouser: yes! |
| 15:56 | Licenser | fear! I'm bac! |
| 16:04 | LauJensen | mmarczyk: hooray :) |
| 16:06 | mmarczyk | lol, I misspelled hooray :-) |
| 16:07 | kotarak | well, it was almost hurry |
| 16:07 | kotarak | hurra |
| 16:07 | mmarczyk | yup |
| 16:07 | mmarczyk | and apparently "hurrah" is a word in English too |
| 16:08 | kotarak | hurra is german :) |
| 16:08 | mmarczyk | and also Polish :-) |
| 16:09 | LauJensen | and Danish |
| 16:10 | mmarczyk | well now, we've just found some linguistic common ground ;-) |
| 16:11 | Twey | Ah, but do you have ‘huzzah’? |
| 16:12 | mmarczyk | incidentally, how's ClojureQL coming along? I was thinking of providing a direct mapping from CQL query expressions to the internal structures I'm using in this project: https://www.assembla.com/wiki/show/adqc at some point |
| 16:12 | LauJensen | mmarczyk: Eventually 'hurra' will also be adopted into the Swedish language, but unfortunately they have been unsuccesful in teaching the population words with more than 4 letters. There's progress though. |
| 16:12 | mmarczyk | (that's Clojure in GSoC -- I'm going to post to the mailing list about this soonish, but probably after wrapping up the piece I'm working on right now) |
| 16:13 | LauJensen | mmarczyk: We're hit a small bump in the road, which Budu and I are trying to help kotarak resolve. Hard to give a deadline |
| 16:13 | LauJensen | (hard=impossible) |
| 16:13 | mmarczyk | oh, not really asking for that, just pinging for progress |
| 16:13 | LauJensen | progress is slow, but fortunately there's not many miles left |
| 16:14 | mmarczyk | sounds optimistic enough |
| 16:15 | LauJensen | Cynicism never had a chance :) |
| 16:15 | mmarczyk | well, s/slow/not happening/ would be worse :-) |
| 16:27 | mjg123 | Hi. If I have a list of numbers-as-strings, how to convert it to a list of numbers? |
| 16:27 | mjg123 | something like: (map java.lang.Integer/parseInt ("1" "2" "3")) ? |
| 16:27 | a_strange_guy | ,(map #(Integer/parseInt %) ("1" "2" "3")) |
| 16:27 | clojurebot | java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn |
| 16:27 | candera | ,(map #(java.lang.Integer/parseInt %) ["1" "2" "3"]) |
| 16:27 | clojurebot | (1 2 3) |
| 16:28 | mjg123 | oh, so the java call is not a function by itself? |
| 16:28 | candera | Correct. |
| 16:29 | LauJensen | (map read-string ["1" "2" "3"]) |
| 16:29 | LauJensen | $(map read-string ["1" "2" "3"]) |
| 16:29 | sexpbot | => (1 2 3) |
| 16:29 | mmarczyk | oh, welcome back, sexpbot |
| 16:29 | a_strange_guy | java calls expand to either the 'new or the '. (dot) special form |
| 16:29 | mmarczyk | and that's if the source the strings are coming from can be trusted |
| 16:30 | mmarczyk | $(map read-string "#=(println :foo)" "2" "3"]) |
| 16:30 | sexpbot | java.lang.Exception: Unmatched delimiter: ] |
| 16:30 | mmarczyk | $(map read-string ["#=(println :foo)" "2" "3"]) |
| 16:30 | sexpbot | => :foo (nil 2 3) |
| 16:30 | mmarczyk | but, um |
| 16:30 | mmarczyk | $(require '[clojure.contrib.java-utils :as ju]) |
| 16:30 | sexpbot | java.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/require clojure.contrib.java-utils) |
| 16:30 | mjg123 | in fact I have lists of Character, not String... |
| 16:31 | mmarczyk | ouch. never mind |
| 16:31 | mmarczyk | (that's was about the SecurityException) |
| 16:32 | a_strange_guy | $#=(String. "foo") |
| 16:32 | sexpbot | Command not found. No entiendo lo que estás diciendo. |
| 16:32 | a_strange_guy | $[#=(String. "foo")] |
| 16:32 | sexpbot | Command not found. No entiendo lo que estás diciendo. |
| 16:32 | a_strange_guy | $(vec #=(String. "foo")) |
| 16:32 | sexpbot | java.lang.Exception: EvalReader not allowed when *read-eval* is false. |
| 16:33 | LauJensen | $(map #(-> % str read-string) [\1 \2 \3]) |
| 16:33 | sexpbot | => (1 2 3) |
| 16:34 | mjg123 | annnd that's project euler #8 done, thanks :) |
| 16:34 | LauJensen | http://clojure-euler.wikispaces.com |
| 16:35 | mjg123 | I thought you weren't supposed to do that! |
| 16:35 | LauJensen | Well... |
| 16:35 | mjg123 | :) |
| 16:35 | mjg123 | I won't look |
| 16:35 | LauJensen | Gotta jet - Good night all |
| 16:37 | mmarczyk | good night! |
| 16:40 | ska2342 | Reference types are supposed to hold one of Clojures datastructures. Has there been any discussion on holding e.g. POJOS, and what pitfalls await the programmer? |
| 16:42 | mmarczyk | mjg123: as an alternative solution, (require 'clojure.contrib.java) (for Clojure 1.2; used to be java-utils), then (clojure.contrib.java/wall-hack-method clojure.lang.LispReader :matchNumber [String] nil "123") => 123 |
| 16:42 | mmarczyk | ska2342: you're forgoing all the safety guarantees if you put something mutable behind a reference type |
| 16:45 | ska2342 | mmarczyk: yes, thank you. Actually I am more interested in some readable material that sums the reasons for not doing so up. Ah, whatever, not so important, I gues.. |
| 16:50 | mmarczyk | hm, you could do some rummaging around the google group, this does come up occasionally (although I regret to say I have no links at hand) |
| 16:50 | mmarczyk | but basically, the whole idea behind the reference types is that they allow you to operate on snapshots of your data |
| 16:51 | ska2342 | mmarczyk: it's OK, thank you. :-) |
| 16:51 | mmarczyk | for a Ref r, you can say, at any time, @r, and you're sure to get something consistent back; that's clearly no longer the case if that thing can change |
| 17:27 | chouser | it seems that dynamic typing allows me to solve problems that I don't undestand as fully as I would need to if I were to solve them with static typing |
| 17:28 | chouser | I suppose there might be differing opinions as to whether that's good or not. |
| 17:28 | Bootvis | the question is: is that a good thing? |
| 17:28 | chouser | :-) |
| 17:29 | TakeV | Is there a tutorial for using interfaces? I've seen a demo, but I don't quite understand them. |
| 17:33 | TakeV | Er, *protocols |
| 17:34 | chouser | Halloway has a very good video on them. |
| 17:34 | chouser | TakeV: http://vimeo.com/11236603 |
| 17:35 | TakeV | Thank you. |
| 17:35 | chouser | TakeV: let me know if that's sufficient for them to make sense to you |
| 17:35 | chouser | I'm considering doing a talk on protocols, but if that video is sufficient, maybe I need to find another topic. |
| 17:37 | ska2342 | chouser: it is, if you are familiar with the expression problem. I had to read some other sources to get that and then it made sense to me. |
| 17:43 | zakwilson | I want to convert a number to its ascii equivalent. What's the Clojure version of CL's code-char? |
| 17:46 | zakwilson | Oh, it's simply char |
| 18:07 | TakeV | chouser: More information is always good. |
| 18:37 | Licenser | :) |
| 19:22 | vIkSiT | lo all. is there a way to pass "default" values to a fn definition? |
| 19:25 | ysph | vIkSiT: typically you provide multiple defs as in (defn foo ([x] (foo x 5)) ([x y] (* x y))) |
| 19:29 | Raynes | ysph: He's gone. |
| 19:29 | ysph | snap |
| 19:29 | ysph | rather impatient eh? |
| 20:04 | kensanata | I have a little swing app that lets me draw tiles. When the user presses a key, the app should switch to a different tile. Coming from Emacs Lisp, I want to do something like this: (def current-tile FLOOR_TILE) (defn get-tile [] current-tile) (defn set-tile [tile] (set! current-tile tile)) -- what's the Clojure way of doing this? |
| 20:05 | kensanata | I tried various variants resulting in IllegalStateException... :) |
| 20:05 | technomancy | kensanata: probably an atom, unless you need to be able to coordinate changes across threads. |
| 20:05 | technomancy | atoms are the simplest of the reference types |
| 20:06 | kensanata | Ok, will read up on atoms. Thanks. :) |
| 20:33 | charliekilo | noob compojure question: is it ok to use agents in Compojure? ... I remember that creating threads (which to my knowledge agents do), is not allowed in containers like Tomcat, Jetty. |
| 20:35 | boredomist | How could I create an instance of a nested Java class? Say I want to use Y from some.package.X.Y where X is also a class, for example |
| 20:39 | lancepantz | you (import '[some.package X]') then refer to it as X$Y |
| 20:40 | lancepantz | err (import '[some.package x]) |
| 20:41 | boredomist | Great, thanks :) |
| 20:41 | lancepantz | np |
| 20:49 | ataggart | charliekilo: so long as you do it properly, creating new threads from webapps running tomcat, etc. is fine. |
| 21:23 | herdrick | question: is there a way to make memoized functions ignore, for the purpose of memoization, some of it's arguments |
| 21:23 | herdrick | i.e. have the cache be keyed only on certain args? |
| 21:32 | ataggart | not with the default implementation, but I recall a good post that made memoize a bit more flexible. lemme see if I can pull it up |
| 21:34 | ataggart | http://kotka.de/blog/2010/03/The_Rule_of_Three.html |
| 21:37 | defn | Where would (identity form) give you something you don't necessarily expect? |
| 21:39 | tomoj | where you're expecting something strange? |
| 21:39 | defn | heh, cgrand had a little clojure riddle he posted on twitter |
| 21:39 | tomoj | primitives maybe? |
| 21:39 | defn | where is ((identity X) arg1 .. argN) equal to (X arg1..argN) |
| 21:40 | tomoj | oh, I see it |
| 21:40 | tomoj | interesting |
| 21:42 | vIkSiT | hi all |
| 21:42 | tomoj | is his next tweet the answer? |
| 21:42 | hugod | zakwilson: I have brought lein-remote-swank up to date. Let me know if you have any issues. |
| 21:42 | vIkSiT | If I've got a fn called myfn, invoked as (myfn a b) - whats the best method to run this function with values of in (range 0 10)? |
| 21:43 | vIkSiT | values of a* |
| 21:43 | vIkSiT | (like, repeatedly run this function, sort of a test harness) |
| 21:43 | mmarczyk | well |
| 21:44 | mmarczyk | taken literally, that's not a very difficult riddle :-) |
| 21:44 | mmarczyk | no extra constraints? |
| 21:44 | vIkSiT | mmarczyk, none :) so, I can think of two ways of doing it.. |
| 21:44 | tomoj | presumably only interesting answers will be accepted |
| 21:45 | mmarczyk | vIkSiT: map, for, doseq... :-) |
| 21:47 | mmarczyk | for cgrand's riddle, there are two huge obvious classes of answers... it would be quite interesting to discover whether there are any possibilities outside those |
| 21:47 | vIkSiT | ah, is there a way to do it using loop? |
| 21:47 | tomoj | clojurebot: loop? |
| 21:47 | mmarczyk | vIkSiT: well, sure, but why? |
| 21:47 | vIkSiT | mmarczyk, ah, thats the one I couldn't get to work.. |
| 21:48 | mmarczyk | (loop [i (range 0 10)] (myfn i b)), with b to be supplied by the surrounding lexical context |
| 21:48 | vIkSiT | (btw, which riddle was just referenced here?) |
| 21:48 | mmarczyk | ouch, I mean |
| 21:48 | tomoj | loop doesn't work that way |
| 21:49 | vIkSiT | mmarczyk, clojure.lang.LazySeq cannot be cast to java.lang.Number :) loop won't work that way.. |
| 21:49 | vIkSiT | thats what I was assuming too.. |
| 21:49 | mmarczyk | yeah, typed a for form, then switched to "loop" by replacing the initial symbol :-P |
| 21:49 | vIkSiT | hehe |
| 21:49 | tomoj | vIkSiT: if you're throwing away the return values, use doseq |
| 21:49 | mmarczyk | (loop [i 0] (when-not (== i 10) (myfn i b) (recur (inc i)))) |
| 21:50 | KirinDave | So we gotta write a clojure to objc combiler. |
| 21:50 | KirinDave | Err, compiler |
| 21:50 | mmarczyk | here you go, but it's best accomplished in a different way |
| 21:50 | KirinDave | So that we can get something resembling clojure onto the iPhone. :\ |
| 21:50 | vIkSiT | tomoj, mmarczyk - ah in either case, the return value won't be available.. |
| 21:51 | tomoj | if you want the return value, use for |
| 21:51 | mmarczyk | also, this is assuming you're throwing away the results; if you want, say, to build a vector of them, (loop [i 0 r []] (if-not (== i 10) (recur (inc i) (conj r (myfn i b))) r)) is one possibility, though for normally be better |
| 21:52 | mmarczyk | vIkSiT: then doseq is indeed your best bet: (doseq [i (range 0 10)] (myfn i b)) |
| 21:52 | vIkSiT | aaaah. that last loop is quite enlightening, thanks.. yes, the for and doseq are cool. |
| 21:52 | tomoj | ,(= (range 10) (range 0 10)) |
| 21:52 | mmarczyk | tomoj: oh, right :-) |
| 21:53 | mmarczyk | KirinDave: that's not really going to work with the current wording of the dev agreement |
| 21:53 | KirinDave | mmarczyk: Can they tell? |
| 21:53 | KirinDave | Probably not. |
| 21:53 | mmarczyk | sure, if they care to |
| 21:54 | KirinDave | Well, I am not sure. |
| 21:54 | KirinDave | I've written code generating compilers that people couldn't tell before |
| 21:54 | KirinDave | For C++ even |
| 21:54 | Raynes | $(= (range 10) (range 0 10)) |
| 21:54 | sexpbot | => true |
| 21:54 | KirinDave | Fairly complex. |
| 21:54 | mmarczyk | well, I'm wishing you luck, of course |
| 21:54 | vIkSiT | hrm, clj to objc sounds like fun :) |
| 21:54 | mmarczyk | I've seen some machine-generated code and it was always pretty obvious that no human's written it |
| 21:54 | Raynes | tomoj: When at first, clojurebot doesn't succeed, try, try sexpbot. :p |
| 21:55 | mmarczyk | but I'm not saying that you can't do better |
| 21:55 | mmarczyk | the "common wisdom" seems to be that that's actually pretty hard |
| 21:55 | tomoj | I would be incredibly surprised if objc compiled from clojure looked anything like human-written objc |
| 21:56 | KirinDave | tomoj: It might not be idiomatic. |
| 21:56 | KirinDave | And it might require a very comprehensive library |
| 21:56 | mmarczyk | plus all this is without bringing up the feeling of insecurity I'd have if I knew I was consciously doing things in a way incompatible with the dev agreement for the platform I was working on |
| 21:56 | KirinDave | But guys, I'm blue skying here. Come on. |
| 21:56 | KirinDave | mmarczyk: Actually it's really unclear what apple wants to do there.. I mean, are they really gonna kill games using Lua? |
| 21:56 | KirinDave | They haven't done that entirely yet. |
| 21:57 | mmarczyk | not to say I don't believe such legal shenanigans as Apple is performing right now should be banned due to the way in which they complicate (make impossible?) interoperability, because I do :-P |
| 21:57 | Lajla | mmarczyk, how do you specy ranges in clojure. |
| 21:58 | tomoj | banned by whom? |
| 21:58 | Lajla | Something I, as the greatest programmer except the MCSA should surely be told. |
| 21:58 | Lajla | Like, (range 0 10) does that work? |
| 21:58 | mmarczyk | tomoj: I meant "made illegal" |
| 21:58 | Lajla | ,(range 0 10) |
| 21:58 | tomoj | crazy |
| 21:58 | mmarczyk | where it's not illegal already. |
| 21:59 | Lajla | Oh, it's above there coindidentally. |
| 21:59 | Lajla | $(range 10) |
| 21:59 | sexpbot | => (0 1 2 3 4 5 6 7 8 9) |
| 21:59 | mmarczyk | well, I don't care enough to really argue that particular point |
| 21:59 | Lajla | $(range 0 4 2) |
| 21:59 | sexpbot | => (0 2) |
| 21:59 | Lajla | What's with the new bot? |
| 22:00 | tomoj | if there's anyone I'd be more afraid of than apple/MS/google/whoever to have in control of such things, it's the government :) |
| 22:00 | herdrick | ataggart: thanks |
| 22:00 | mmarczyk | tomoj: not sure what you mean by this |
| 22:00 | herdrick | that is interesting |
| 22:00 | tomoj | Lajla: "specy" ? |
| 22:00 | Lajla | tomoj, oui |
| 22:01 | mmarczyk | the government mandating which languages we can use -- I don't even want to think about that |
| 22:01 | Lajla | We used to have a different one that worked by a comma |
| 22:02 | mmarczyk | but a law being passed to prevent companies from these kinds of outrageous interference with people targetting their platforms in languages they don't control seems rather different |
| 22:02 | tomoj | heh i |
| 22:02 | mmarczyk | to the point where I can't see that the two ideas are really related |
| 22:02 | tomoj | I imagine a C++ country, a clojure country, a ruby country, etc, all going to war in cyberspace |
| 22:03 | Lajla | C++ would win, stupid people are surprisingly powerful in large groups. |
| 22:03 | mmarczyk | in fact, isn't it already explicitly legal to reverse engineer where that is done for interoperability reasons, right? both in US and EU |
| 22:05 | mmarczyk | of course the current trend is to prevent consumers from circumventing DRM even where this would be for purposes compatible with fair use... locking up content being sold to consumers in formats which might well become a problem in and of themselves (a server goes down and you can't play your track...) is apparently perfectly legal |
| 22:05 | mmarczyk | I wonder if I should perhaps discontinue ranting at this point :-) |
| 22:12 | zakwilson | hugod: I will give it a try tomorrow. I'm currently away from my LAN. |
| 22:32 | vIkSiT | hmm. so I've got this tree traversal function here: http://paste.lisp.org/display/111243 |
| 22:32 | vIkSiT | is there an idiomatic way to conver this to loop/recur, and somehow conj the results into a seq? |
| 22:32 | vIkSiT | convert* |
| 22:33 | mmarczyk | you don't need the do around the or, for one thing |
| 22:33 | mmarczyk | also, how about in-order for a name :-) |
| 22:34 | vIkSiT | hehe, yes, the name will change ;) |
| 22:34 | vIkSiT | ah yes the do is gone now. |
| 22:35 | mmarczyk | but, um, this will just print the leaves left-to-right, right? |
| 22:35 | vIkSiT | yes? |
| 22:36 | vIkSiT | in-order should do left, root, right? |
| 22:36 | mmarczyk | yup |
| 22:37 | tomoj | won't that always return false? |
| 22:37 | mmarczyk | how about (->> bt (clojure.walk/prewalk (fn [{:left left :right right}] [left right])) flatten (map #(partial println "Visited"))) or some such thing |
| 22:38 | mmarczyk | oh, sorry, that's (fn [{left :left value :value right :right}] [left value right]) |
| 22:39 | Raynes | clojure.walk? |
| 22:39 | mmarczyk | for loop/recur, you'd have to rewrite this in continuation-passing style |
| 22:39 | Raynes | :| |
| 22:40 | mmarczyk | Raynes: hi! nice to see sexpbot again :-) |
| 22:40 | vIkSiT | hmm clojure.walk. must look that up. |
| 22:40 | mmarczyk | what's wrong with clojure.walk? |
| 22:41 | Raynes | mmarczyk: <3 sexpbot :D |
| 22:41 | Raynes | mmarczyk: Nothing wrong with it. I just have no clue what it is. |
| 22:41 | mmarczyk | oh :-) |
| 22:41 | vIkSiT | mmarczyk, hmm yes, was wondering if thats the most efficient or not. also, I wanted to re-learn consing recur resulsts :) |
| 22:42 | vIkSiT | ,(doc clojure.walk/prewalk) |
| 22:42 | mmarczyk | I find it superbly useful in ast transformations where all disambiguation can be performed based on the looking down the tree :-) |
| 22:42 | mmarczyk | $(doc clojure.walk/prewalk) |
| 22:42 | sexpbot | => ------------------------- clojure.walk/prewalk ([f form]) Like postwalk, but does pre-order traversal. nil |
| 22:42 | Raynes | mmarczyk: dysinger ran sexpbot out of #clojure for a while. sexpbot overcame and burned down his house. <3 |
| 22:42 | mmarczyk | clojurebot's gone for a walk apparently |
| 22:42 | vIkSiT | aah |
| 22:42 | mmarczyk | Raynes: way to go! :-) |
| 22:42 | dysinger | are we still talking about this ? |
| 22:42 | vIkSiT | well, I guess I should look at how prewalk is implemented then :) trying to do this from first principle |
| 22:43 | Raynes | dysinger: sexpbot and I still love you. <3 |
| 22:43 | mmarczyk | dysinger: no, by this point we're just sorry about your house ;-) |
| 22:43 | mmarczyk | vIkSiT: oh I can tell you that -- it's implemented in a wicked cool way :-) |
| 22:43 | dysinger | sorry guys I have real work to do |
| 22:43 | dysinger | thanks for calling my attention though |
| 22:44 | Raynes | You're welcome. |
| 22:44 | Raynes | Sourpuss. :( |
| 22:45 | vIkSiT | oh that IS nice |
| 22:45 | vIkSiT | I like the inner outer implementation |
| 22:45 | Raynes | I should make sexpbot's doc special like clojurebot's. That line of -'s at the beginning is rather offputting, especially for long docstrings. |
| 22:46 | vIkSiT | Raynes, +1 |
| 22:46 | Raynes | It's better if the documentation is longer than 300 characters though, because sexpbot gist's evaluation results that are over 300 characters (or is it 200?). |
| 22:46 | Raynes | $(range 1 1000) |
| 22:46 | sexpbot | => (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 ... http://gist.github.com/429531 |
| 22:46 | Raynes | gists* |
| 22:47 | vIkSiT | this is pretty cool too - http://rosettacode.org/wiki/Tree_traversal#Clojure |
| 22:47 | vIkSiT | is the "walk" idiom a functional thing? or is that more clojurian? |
| 22:48 | tomoj | I wonder how deep your tree has to be to blow the stack |
| 22:48 | vIkSiT | tomoj, yes thats the reason I was trying to convert this into loop/recur |
| 22:51 | tomoj | not sure how that would be possible |
| 22:52 | mmarczyk | (loop [bt bt q (clojure.lang.PersistentQueue)] (let [{:keys [left right value]} bt items (drop-while nil? [left value right])] (condp == (count items) 1 (do (println "Visiting" (first items)) (if-not (empty? q) (recur (peek q) (pop q)))) 2 (recur (first items) (conj q (second items))) 3 (recur (first items) (into q (rest items)))))) |
| 22:52 | hiredman | ~scala {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)} |
| 22:52 | mmarczyk | vIkSiT: I actually wrote this right here, no testing, but maybe you can give it a try ;-) |
| 22:53 | mmarczyk | Raynes: cool idea with the gist, though I trust egregious misuse is being prevented somehowb :-) |
| 22:54 | Raynes | mmarczyk: How would someone misuse that? |
| 22:54 | mmarczyk | um, (range) ...? |
| 22:54 | Raynes | mmarczyk: It would time out. |
| 22:54 | hiredman | clojurebot: ping? |
| 22:54 | clojurebot | PONG! |
| 22:54 | mmarczyk | how large would it get though |
| 22:55 | Raynes | mmarczyk: If it times out, it doesn't give anything to gist. |
| 22:55 | mmarczyk | then you could use (range n) for just the right n |
| 22:55 | Raynes | And it still wouldn't be large enough to cause problems, I imagine. |
| 22:55 | Raynes | And I could lower the timeout if necessary. |
| 22:56 | Raynes | Oh noes, clojurebot is back. sexpbot's claim to fame has been interrupted. :p |
| 22:56 | mmarczyk | I wonder, ranges materialise pretty quickly |
| 22:58 | Raynes | mmarczyk: I could count the size of the output, if it was an actual problem, but that wouldn't be very efficient. Unless gist has a very low limit on what size a gist can be, it shouldn't ever pose a problem. |
| 22:58 | riddochc | Maybe if sexpbot choose a more risque name people would use it instead? ;) |
| 22:59 | Raynes | I was kidding. <3 clojurebot |
| 22:59 | Raynes | But sexpbot does prove useful in situations like the one a moment ago where clojurebot disappeared briefly. :D |
| 23:00 | mmarczyk | Raynes: if you feel this way... I promise not to try to break it :-) |
| 23:00 | Raynes | mmarczyk: If you can break it, by all means, go for it. :p |
| 23:00 | clojurebot | forget Clarity of mind means clarity of passion, too; this is why a great and clear mind loves ardently and sees distinctly what it loves. -- Pascal |
| 23:01 | mmarczyk | Raynes: all of a sudden I feel evil :-) |
| 23:02 | mmarczyk | $(doall (map #(* 2 #^Integer %) (range 4000000))) |
| 23:02 | sexpbot | Execution Timed Out! |
| 23:03 | mmarczyk | oh come on. |
| 23:03 | mmarczyk | $(doall (map #(* 2 #^Integer %) (range 2000000))) |
| 23:03 | mmarczyk | $(range 2500000) |
| 23:03 | sexpbot | Execution timed out. |
| 23:03 | sexpbot | java.lang.Exception: Thread stopped! |
| 23:03 | _brian2_ | noob question > from the tree exmple, I m just trying to understnd the first function , what is f in (defn walk [node f order] ... |
| 23:03 | mmarczyk | Thread stopped? |
| 23:03 | mmarczyk | $(range 2500000) |
| 23:04 | sexpbot | Execution timed out. |
| 23:04 | sexpbot | java.lang.Exception: Thread stopped! |
| 23:04 | mmarczyk | $(range 1000000) |
| 23:04 | sexpbot | java.io.IOException: Error writing to server |
| 23:04 | mmarczyk | ohhh, that's something new :-) |
| 23:05 | mmarczyk | oh, alright... admittedly I should have queried the bot |
| 23:06 | mmarczyk | _brian2_: were are you getting that from? |
| 23:07 | _brian2_ | somebody just cited http://rosettacode.org/wiki/Tree_traversal#Java |
| 23:09 | Raynes | mmarczyk: I suspect that java.io.IOException: Error writing to server is the breakage you were looking for. |
| 23:09 | mmarczyk | _brian2_: apparently the idea is that node is a binary tree with data on interior nodes |
| 23:09 | mmarczyk | a node looks like {:left left-branch :val value-at-current-node :right right-branch} |
| 23:10 | mmarczyk | f is a function which you wish to call on every element of the tree |
| 23:10 | Raynes | mmarczyk: I'll catch that error and handle it specially. <3 |
| 23:10 | mmarczyk | and order is a vector of keywords |
| 23:10 | mmarczyk | possible entries: :left :visit :right |
| 23:10 | mmarczyk | walk does these things in order at each node |
| 23:10 | mmarczyk | :left means walk the left subtree, :right similarly |
| 23:11 | mmarczyk | :visit means call the given function on the current node |
| 23:11 | mmarczyk | Raynes: :-) |
| 23:11 | _brian2_ | I take it its a clssic comp sci problem (?) |
| 23:12 | _brian2_ | I never took a comp sci class |
| 23:12 | Raynes | danlarkin: I don't think I'm on a bot ego trip. :\ I just like to unsuccessfully mess with hiredman about clojurebot. |
| 23:12 | mmarczyk | _brian2_: it's also one of the basic day-to-day programming problems |
| 23:12 | _brian2_ | ok, cool |
| 23:12 | mmarczyk | with all the stuff being represented as trees |
| 23:12 | _brian2_ | thats better ;-) |
| 23:13 | mmarczyk | :-) |
| 23:21 | mmarczyk | vIkSiT: http://gist.github.com/429563 |
| 23:22 | mmarczyk | here's a loop/recur-based tree walk |
| 23:22 | mmarczyk | not pretty. :-( |
| 23:25 | _brian2_ | danlarkin : I am having a problem with getting clojure-json write to file example |
| 23:26 | danlarkin | oh! yes I saw your issue |
| 23:26 | danlarkin | then I got distracted :) |
| 23:26 | _brian2_ | ok, thanks |
| 23:26 | vIkSiT | mmarczyk, aah. looks interesting though :) |
| 23:26 | danlarkin | I think the problem is you're not opening the FileWriter in a with-open, so it never gets closed (which means the buffer isn't flushed) |
| 23:27 | danlarkin | at least in the example you pasted |
| 23:28 | _brian2_ | ok, I dont see any with-open in your posted exmple code |
| 23:29 | danlarkin | it may be poor sample code :) |
| 23:29 | _brian2_ | ;-) |
| 23:35 | vIkSiT | hmm how do I print out a clojure.lang.PersistentQueue? |
| 23:35 | vIkSiT | mmarczyk -to debug? |
| 23:36 | danlarkin | _brian2_: let me know if that works out for you |
| 23:36 | _brian2_ | ok |
| 23:36 | _brian2_ | thnks! |
| 23:38 | vIkSiT | hrm. |
| 23:39 | mmarczyk | vIkSiT: just wrap it in a print(ln) |
| 23:39 | vIkSiT | mmarczyk, well, that just shows #<PersistentQueue clojure.lang.PersistentQueue@a2272bf8> :) |
| 23:39 | vIkSiT | During my do, I do a (prn (peek q)) |
| 23:39 | vIkSiT | which works fine .. but just wanted to see the entire thing at once.. |
| 23:40 | mmarczyk | vIkSiT: really? in that case, perhaps (println (str "#:PQ" (seq the-queue))) |
| 23:40 | vIkSiT | aha |
| 23:40 | mmarczyk | or skip the #:PQ if you're not worried about confusing it with a list |
| 23:40 | vIkSiT | (seq q) does the trick |
| 23:40 | mmarczyk | yup |
| 23:40 | vIkSiT | yes in my case its a nice tree |
| 23:40 | vIkSiT | whew. level order is complex |
| 23:41 | vIkSiT | https://gist.github.com/aa0a0095fe386f490b6f |
| 23:43 | vIkSiT | interesting I didnt know cond could get a :done |
| 23:46 | tomoj | huh? |
| 23:48 | mmarczyk | vIkSiT: hm? :-) |
| 23:48 | mmarczyk | (looking at the new gist now) |
| 23:52 | trptcolin | is there a way to use binding to replace Java methods? |
| 23:53 | mmarczyk | trptcolin: nope. you might be able to use proxy to mock them out though |
| 23:54 | mmarczyk | not that that's likely to help a lot... |
| 23:54 | trptcolin | mmarczyk: it definitely confirms that i'm not crazy :) |
| 23:55 | mmarczyk | trptcolin: happy to hear that ;-) |
| 23:56 | _brian2_ | danlarkin : is it supposed to look something like: (with-open [o (FileWriter.) ] (json/encode-to-writer [1 2 3 4 5] o "/tmp/foo.json")) |
| 23:59 | danlarkin | no, pass the path as an arg to the FileWriter constructor |