#clojure logs

2009-08-21

00:01cemerickthe night of the mutant hybrid CLASSPATH
00:53lowlycoderbesides databses/ the sql interfaace, what's a good solution for persistent storage for clojure aplications?
00:53lowlycodersomething like java hibernate? ...
01:34tomojhmm
01:34tomojmaybe it's too late for me to think clearly
01:35tomojin ruby I can do crazy stuff like this: https://gist.github.com/cae3276f892d692f9017
01:35tomojis it just me or is that impossible in clojure?
01:42Anniepoocertainly you can make a circular list
01:44arbschta naive translation might look like this http://gist.github.com/171688
01:45tomojah, yes
01:45tomojI was thinking just in terms of immutable maps
01:48AnniepooLOL
01:48AnniepooClojure's easy integration of projects occasionally has side effectis
01:49AnniepooThe project I'm working on has a weird napkin look look and feel
01:49Anniepooit's migrated into Waterfront
02:14AnniepooChouser: I think the swing-utils are yours, yes?
02:14Anniepoosorry, that was intended as private
02:55demasI'm going to working with text files from clojure (read and write). I will be thankfull if you give me any information, how-to's, examples.
02:57demasAs I see, Clojure don't have self API for working with files and I need to work with Java classes. Is it right ?
03:00mikem`_demas: there's with-open to help you open/close files
03:00mikem`_,(doc with-open)
03:00clojurebot"([bindings & body]); bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order."
03:02_mstclojure.contrib.duck-streams and line-seq are very useful for reading files line by line
03:09LauJensenTop of the morning guys
03:15Fossihi LauJensen
03:54tomojduuuude
03:55tomojC-c RET = slime-macroexpand-1 is sweet
06:11LauJensenWhen I thought all hope was lost for America, I found one last thing to love: http://imgur.com/kzoxU.jpg
06:14opqdonutauld
07:59adityohey piyush_
07:59piyush_hey tyo
08:20hamzahey guys, how can i access left field of an insets object insets/left return no such namespace error.
08:25Chouser(.left my-insets)
08:26Chouserthe Foo/bar notation is for either a namespace Foo or a class Foo with a static member bar
08:28hamzakk thank you.
08:28hamzathat worked.
08:39carkmhh something i'm not quite sure about with refs
08:39carki have a connection pool
08:39carkit's using a persistentqueue
08:39carkso i need to peek the queue, then if it's not empty, i can remove the connection from the queue
08:40carkshould i (ensure *clients*) before peeking the queue ?
08:41cark~paste?
08:41clojurebotlisppaste8, url
08:41lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
08:42lisppaste8cark pasted "untitled" at http://paste.lisp.org/display/85798
08:42carkin other words : does this make sense or is the ensure redundant ?
08:43Chouserthat's a good question. I still have to think very hard about such things.
08:44carkit seems to me that without the ensure, it might be possible that another thread succeeds in modifying the ref between my peeking and my poping
08:44Chouseryou're going to write to the same ref in either case
08:44Chouserright?
08:44rhickeyif the ref is something you are going to be changing, you need not ensure it. Your transaction works with a snapshot of the world
08:44carkyes there is only one ref
08:45carkmhh
08:46rhickeywrite skew (and thus the need for ensure) only occurs when you make a decision based on a ref you are *not* writing and need to make sure the value read is unchanged at the end of your transaction
08:46carkallright ! thanks a lot that's precisely what i was not understanding
08:47rhickeyensure should rarely be used
08:48carkthanks, it makes for easier code in many places
08:50LauJensenOk, so ensure is only in the case where I'm strictly reading, and need to ensure that I get the same value with multiple reads?
08:51rhickeyLauJensen: no, all transactions work with a snapshot
08:52rhickeyensure is for what I said, when you make a decision that effects a write based upon a ref you are not writing, and need to make sure the value you read is no different when your transaction ends
08:52rhickeythe classic example is, you can make either of two accounts go negative but not both
08:53rhickeyso a transaction making one negative will have to read the other (to make sure it is not negative), and *ensure* that is still the case when it finishes
08:54rhickeythat has nothing to do with seeing different values during the course of your transaction - that never happens
08:55carkthat's very good information right there
08:57LauJensenrhickey: Ok, I gotcha.
08:57rhickeyhttp://en.wikipedia.org/wiki/Snapshot_isolation
08:58rhickeyexcept in the section: Making Snapshot Isolation Serializable, rather than fabricate a write/write conflict you can use ensure in Clojure's STM
08:59rhickeyand should use ensure, as multiple ensures on the same ref don't conflict
08:59carkah i was going to say this was like a fake write
08:59rhickeyfake writes would conflict
09:00rhickeyso you might ensure things like permissions, without conflict
09:01Chouserah! that's the first I've understood the benefits of ensure over fake write.
09:01carkok got it
09:02carklet's say an half-assed fake write then =P
09:02rhickeyChouser: until recently it was just a theoretical promise of the design
09:02Chouserfake writes always conflict while ensure only causes retries when something actually changed?
09:02Chouseryeah, I saw that change go in, just didn't grok the difference.
09:03rhickeyensures conflict with writes, but not with each other
09:05rhickeybut really the best part about ensures is that the say what you intend, fake writes are confusing
09:06lisppaste8raphinou_ pasted "untitled" at http://paste.lisp.org/display/85799
09:06rhickeyadmittedly write skew can be subtle, but snapshot isolation rocks
09:07raphinou_In my pasted code, isn't addListener called on the WPushButton instance?
09:07Chousersnapshot isoloation is an amazing promise. I hope to get a chance to actually take advantage of it some day. :-)
09:07raphinou_it seems to be called to Signal1, but I don't see why
09:08carkraphinou_ : usually you get this error when the number of parameter is wrong or at runtime the type of some parameters is wrong
09:08raphinou_ok cark, I'll look in that direction
09:09Chouserraphinou_: you're calling .addListener on the return value fo WPushButton's 'clicked' method -- is that what you intend?
09:09carkahyes =P
09:10raphinou_Chouser: that might be the problem indeed. I'll check!
09:10carkmaybe use doto
09:10raphinou_or should I instanciate the WPushButton in the let?
09:11cark(.addListener (doto (WPushButton. ....) .clicked) ...
09:12raphinou_I checked and aadListener has to be called on the value returned by clicked
09:12carkah =/
09:12raphinou_cark: has the doto form you posted a different meaning or is it the same?
09:13carknope, doto returns its first argument
09:13raphinou_ok, thx!
09:13carkso it's no good is you need the return value of cllicked
09:16raphinou_indeed, but I'll remember it for other uses!
09:17raphinou_how do I pass arguments to methods called with ..?
09:18raphinou_is this valid ? (.. my_obj method1 (method2 arg1 arg2))
09:18Chouserraphinou_: yes
09:18raphinou_ok, thx
09:18Chouseror: (-> my_obj .method1 (.method2 arg1 arg2))
09:20carki prefer the latter
09:20carkeasier to read
09:23lisppaste8raphinou_ pasted "untitled" at http://paste.lisp.org/display/85802
09:23raphinou_here's the java code I try to translate in clojure
09:24carkwhat is Signal1 ?
09:25LauJensen raphinou: I can paste a few macros I use for swing apps if you paste?
09:25LauJensenhehe.. "if you want"
09:25raphinou_:-)
09:25raphinou_I'm interested, thought this isn't swing. But interested to look at it!
09:26raphinou_Signal1 is a class for implementing a signal/slot system
09:26LauJensenpasting
09:26raphinou_the whole code is at http://www.webtoolkit.eu/jwt#/src/hello
09:26carki think you want (proxy [Signal1$Listener] ....)
09:26raphinou_I'm just learning jwt too, so I can't lean on deep knowledge of that framework....
09:26lisppaste8Lau annotated #85802 "swing macros" at http://paste.lisp.org/display/85802#1
09:27LauJensenSo for button I would eval (onClick button (println "Button has been clicked"))
09:28raphinou_cark: I'll look at it, as I don't know that notation Signal1$Listener
09:28raphinou_thx LauJensen!
09:28carkthe $ is for enclosed classes
09:28carkhum don't remember the proper name of these
09:29carkyou might want to fully qualify the name too
09:29carkas the rules for importing are a bit strange for these
09:29LauJensennp
09:30raphinou_yes cark, I'll try the fqname, as it can't resolve with the $
09:30carkwhere is the javadoc =/
09:32raphinou_hmm, the Signal1.Listener is an interface
09:32raphinou_http://www.webtoolkit.eu/jwt/latest/doc/javadoc/
09:32carkwell it's a nested interface
09:33carki think you could use it as a nested class from clojure, though i'm not sure about that
09:33carkeu.webtoolkit.jwt.Signal1$Listener should do it
09:35raphinou_you're right cark, that's working fine!
09:35raphinou_thanks!
09:35carkgreat =)
09:35raphinou_now checking the code does what I want :-D
09:39LauJensenraphinou_: I think its a good idea to annote your pastes with the solution, once you arrive at it. Could be a help for others in the same situation
09:40raphinou_ha, good suggestion LauJensen. I usually do it on fora and mailing lists, but I don't have the reflex on pastes. Will do!
09:41lisppaste8raphinou_ annotated #85802 "untitled" at http://paste.lisp.org/display/85802#2
09:44LauJensenThats cool man :)
09:54raphinou_ok, my code is working fine. Thanks for the help!
09:54raphinou_I'll blog about it soon, and post it to the google group
09:55carkdid you manage the import section of your ns form ok ?
09:55carkor did you keep the full qualified name in there ?
09:56raphinou_I kept the fully qualified name for now
09:57carkthe trick is to import the nested class too
09:58raphinou_Signal1 is imported, but I can't use Signal1$Listener
09:58cark(ns org.bleh (:import [org.foo Signal1$Listener]))
09:58carkor something like it
09:59carki wouldn't bother you with it if that was not for this blog post !
09:59raphinou_importing Signal1$Listener works
09:59raphinou_I juste tested it when you posted suggestion :-)
09:59carkhehe ok
10:00raphinou_and be sure you don't bother me, I appreciate your help!
10:00cark=)
11:05arohnerlisppaste8:
11:05arohnerlisppaste8: url
11:05lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
11:08lisppaste8arohner pasted "new macro?" at http://paste.lisp.org/display/85810
11:09arohnerI'm thinking about writing a macro something like what I posted. Is there anything that already works like that, or a better way to write the original code so that a macro isn't necessary?
11:10Chouserarohner: hm, defn allows you to define pre- and post- conditions.
11:10Chouseroh, all fns not just defn.
11:11Chouseror you could use cond
11:11carkwhere are those pre-conditions documented ?
11:12arohneryeah, my problem with cond is I have to state the predicates negatively
11:12arohnerwhat I want is sort of the inverse of cond
11:13Chouserarohner: I wonder if you can use condp somehow
11:20arohnercark: I think here's your documentation, for now
11:20arohnerhttp://github.com/richhickey/clojure/commit/0ac482878a1dd520cbee2faa0f5f6ab1082ffa76
11:20carkah thank you
11:25Chouser(condp (fn [t e] (not t)) nil (pred1) "1 failed" (pred2) "2 failed" "all succeeded")
11:25Chousernot very pretty, but maybe better than nested ifs
11:26AWizzArdOh nice, I didn't know that there was a limit of how many chars one can have in one line of code :)
11:27AWizzArdIs that a Clojure, Java or Emacs limit? I sit in Slime/Emacs and do: (apply str (repeat 65533 "0"))
11:28AWizzArdI copy the generated string and try to paste it into the repl. I get an Exception: java.lang.ClassFormatError: Unknown constant tag 34 in class file user$eval__1913
11:29AWizzArdProbably the 65533 chars plus two double-quotes plus EOL break the limit of 2^16 chars per line.
11:31carkmhh i would say it's the function size limit of the jvm
11:31ole3ist the limit of max arguments to apply
11:32AWizzArdthe (apply str ..) is not the problem
11:32carki don't think there is a max argument limit in clojure
11:33cemericknon-variadic fns have a max arg count of 18
11:34cemerickor 20, I forget -- maybe 18 is the limit for proxy method impls
11:36carkright, but you may apply an infinite list to a variadic function
11:37cark,(apply (fn [& items] (take 2 items)) (repeat :a))
11:37clojurebot(:a :a)
11:38carkwhich is neat =)
11:39cemerickAWizzArd: (apply str (repeat 65533 "0") works fine for me (aside from printing out 64K zeros) in enclojure
11:40carkevery time you press enter in the repl you do evaluation
11:40carkwhich means compiling
11:41carkso you hit the jvm limit
11:41Chouserright, I think it's a class bytecode size limit
11:41cemerickit is, but it sounds like emacs/slime is doing something odd when returning values from the REPL
11:42Chouser,(count (read-string (str \" (apply str (repeat 7e5 "0")) \")))
11:42clojurebot700000
11:42carkemacs/clçojure-mode has no trouble returning huge values ... it is sometimes very annoying =/
11:43Chouserhuh. even eval is ok for a string that size.
11:43NeronusAnd let's not talk about infinite lists
11:43carkchouser : nope you're only reading, not evaluating
11:44Chouserright, but when I do (eval (read-string ...)) that also works
11:45carkthat was a mean trick to make my emac print a huge string =P
11:46Chousersorry. (count (eval (read-string ...))) :-)
11:46AWizzArdcemerick: do you copy&paste that produced string into the repl?
11:47cemerickAWizzArd: yup
11:47AWizzArdI also have no problem to generate a very long string and look at it. Emacs shows it. But when I then copy&paste it, only then I get this funny Exception.
11:47cemerickThere's a class being generated somewhere with that value included literally.
11:48cemerickI'll bet the swank interface is using read-string on a vector or map being sent over the wire.
11:48cark,(eval (read-string (str \( "print" \" (apply str (repeat 7e5 "0")) \"\))))
11:48clojurebotDENIED
11:48carkah
11:48carkwell try this
11:48carksame error
11:49Neronuscemerick: How is enclojure these days? Pretty much complete?
11:50AWizzArdcark: yes, that also gives me the same error
11:50cemerickNeronus: it's pretty darn good. Good remote repl capability, solid editor.
11:51carki stand by the bytecode size explanation
11:51cemerickThe debugger works, but it's definitely rough around the edges. Same with code completion.
11:51carkthough that doesn't help you one bit with the problem at hand =)
11:51AWizzArdcark: but why does it work for cemerick?
11:51cemerickbecause I'm not using emacs.
11:51cemerickor swank, or whatever
11:52carki guess enclojure has a different way of doing repl
11:52AWizzArdmaybe swank transports huge objects not correctly to the jvm
11:52carkthere is no swank in my case
11:53Neronuscemerick: Well, I'm going to try it. I'm mostly interested in the debugger and java integration. emacs seems to be lacking in that respect
11:53cemerickcark: IIRC, enclojure uses a streaming model that doesn't wait for the entire result before printing.
11:53AWizzArdcemerick: what OS are you using?
11:54cemerickNeronus: I think you'll like it. I give it a 7/10 right now. :-)
11:54cemerickAWizzArd: OS X 10.5.x
11:54NeronusWe'll see once netbeans finished downloading :)
11:54AWizzArdfunny, now I go to the shell (under Windows) and did a java -cp clojure.jar clojure.lang.Repl and pasted carks eval example.
11:54AWizzArdEven there I get the error. So, it is nothing with emacs/swank.
11:56NeronusFWIW it works finde for me (linux, java 6, clojure HEAD)
11:58AWizzArdmaybe some issue in the jdk for Windows *shrugs*
11:59cemerickAWizzArd: it's possible that different builds of the JVM have different classfile size limits
11:59cemerickread-string on large inputs is never safe
12:01Chousercemerick: why is read-string a problem? I thought we'd pinned this on eval?
12:03cemerickChouser: yes, sorry, eval.
12:03cemerickI was up late. :-/
12:11Neronuscemerick: I downloaded the plugin, installed it in netbeans, restartet netbeans. Am I supposed to be able to create a clojure project now?
12:19gcvdoes Clojure have a way to check if a variable is bound? I'm looking for an equivalent to CL's boundp.
12:19Chouseryou want to know the difference between (def x) and (def x value) ?
12:19gcvexactly
12:21Chouser(.isBound (var x))
12:21ChouserI think that's as good as it gets
12:22Chouserthere's also 'defonce'
12:22Chouser...which uses .hasRoot, not exactly the same as .isBound
12:23Chousukehm
12:23ChousukeI'm getting a weird error when trying to (require) my reader namespace :/
12:24gcvinteresting. .isBound is not bad, but it returns false for things which have been declare'd, rather than def'ed.
12:24Chousukeit says "can't def syntax-quote because clojure.lang.reader refers to #'clojure.core/syntax-quote"
12:25Chousergcv: (declare v) is the same as (def v)
12:26Chouserthey imply slightly different things, but there's no way to tell which was used to create v
12:26stuartsierraChousuke: I think syntax-quote is the expansion of the ` reader macro.
12:27Chousukestuartsierra: nah, it's my own macro.
12:27gcvChouser: got it, makes sense. thank you.
12:27Chousukein the java reader ` expands to what the result of a syntax-quote macro would be
12:27Chouserthe difference with .hasRoot will be for thread-local bindings
12:28stuartsierraChousuke: but if you try to define syntax-quote in your clojure.lang.reader ns, it will conflict with the definition in clojure.core.
12:28Chousukestuartsierra: the only definition is in clojure.core and it's mine :/
12:28stuartsierraOh, then I have no idea what's going on. :)
12:29Chousukeit's working just fine from the repl. just not when I try to create a new namespace which requires my reader namespace
12:29Chousukeand that error is weird
12:31Chousukeactually. let me just try rebuilding the clojure.jar...
12:32Chousukeyeah. that did it :P
12:45wavisteris it impossible to sandbox multiple code bases within the same jvm?
12:47stuartsierraIt's quite possible, there are Java libs dedicated to this.
12:52wavisterok. i've been looking for a class that i could instantiate that would encapsulate a clojure codebase, like x = new clojure.main(); x.evaluateCode(stuff);
12:52cemerickNeronus: There is a clojure project type, but I don't use it.
12:52wavisterbut maybe i'm looking for the wrong thing
12:52cemerickI just use a regular j2se projects.
12:53cemerickI think clojure projects are just a thin veneer around j2se projects
12:54wavistercemerick: projects? is this a design pattern i'm not familiar with?
12:54stuartsierrawavister: You can't do that because Clojure is a compiler, not an interpreter. There is no "instance" of Clojure running in the JVM.
12:54cemerickwavister: IDE project types
12:57wavisterstuartsierra: ok, but if I have a program running and i have some clojure code, how do I call B from A, assuming the clojure code is neither compiled, nor written to be used from java?
12:58stuartsierraYou can use the methods in clojure.lang.RT to load and evaluate Clojure code source code.
12:58cemerickwavister: clojure lib A can require B and make calls to it directly. It's a lot simpler than it sounds like you're thinking it is...
13:00cemerickoh, I see what you're saying. Yes, as stuartsierra said, use RT.load to load your namespaces, and then you can use RT.var to access and invoke different vars defined therein.
13:00stuartsierraThat's for calling Clojure code from Java code, of course.
13:01wavisterok I think that's what I need to look into then
13:01wavisterthere's a lot of methods in RT. looks like much of the api...
13:02wavistercan I load lines of a codebase incrementally?
13:02cemerickvery little of it is relevant from a user perspective
13:02stuartsierraYeah, the important ones are, as cemerick said, RT.var and RT.load. You may also need Var.invoke.
13:03wavisterok
13:07carkwhat's the typep predicate in clojure again ?
13:07carkhum got it
13:08carkinstance?
13:41Chousukeooh.
13:42Chousukemy reader can now read its own source, and evaluating the read data structures does not throw exceptions or screw up the reader
13:43Chousernice
13:44Chousukeit's still missing bits and pieces now.
13:44Chousukethough* :P
13:44Chousukefor example, I still don't support \uNNNN
13:44Chousukebut at least it works!
13:57Chousukenext milestone, reading core.clj :P
13:57Chousukebut I think I'll leave that for another day.
13:58carknice work, though i wonder how is performance
13:59Chousukewell, it doesn't take years. but it's entirely unoptimised at the moment :)
13:59Chouserno reason it has to be worse than the java one
14:01carki hope so
14:01carkas binary serialization is unavailable right now, i use the printer
14:02carkand read back
14:02Chousercark: keywords serialize now. is there something else you're missing?
14:02carkoh i didn't know that
14:03Chouseras of last night
14:03Chouser:-)
14:03carkmhh yes, how about lazy sequences ?
14:03Chousukewell, it does take a second to read itself, which is pretty slow
14:03Chousukebut I think it has lots of room for optimisation
14:03cemerickcark: I'm going to be tackling binary serialization shortly.
14:03cemerickI can't imagine it's going to be particularly difficult.
14:04ChousukeI guess the biggest problem is going to be that it generates lots of small vectors
14:04carki wouldn't mind if infinite sequences serialization was to run out of memory
14:04carki guess that's up to the caller to make sure of that kind of stuff
14:04ChousukeI'll have to get rid of that... but then it means I have to figure out some other way to pass "state" around
14:05carkChousuke : do you have your work on github ?
14:05Chousukeyeah
14:05ChouserI wouldn't assume creating a lot of small vectors are a performance hit -- measure before you eliminate
14:05ericthorsenhmm...gen-class method overload resolution seems undocumented?
14:05Chousukecark: http://github.com/Chousuke/clojure/tree/clojure-reader
14:06ChouserChousuke: but if they are, maybe newnew would help.
14:06carkChousuke : thanks
14:06Chousukebut I make no guarantee that this branch won't go away due to reorganisation or a rebase :P
14:06ChousukeI think I'll have to split out the syntax-quote macro into its own patch at least.
14:07Chousukethe code is also "optimistic" in that it assumes well-formed symbols etc.
14:08Chousukehm, actually, it doesn't take namespaces into account for symbols at all.
14:19duck1123is it better to have your project's config.clj file be a properly namespaced def statement, or a raw data structure that can be read and assigned to a var?
14:19duck1123currently, I've been going with the former, but I'm not so sure
14:22cemerickwe're upgrading our version of clojure over the weekend. Is there any consensus as to the most recent stable point?
14:22Chousernever found a config system I like. Either they machine-writable and you can't do any branches or computation in them, or they're code and can be updated cleanly via a gui or tool. Or they're some scary combination thereof.
14:24duck1123my config file is currently only my db info (I know, there are better ways) passwords for my XMPP connection, and a handful of bools
14:26ChouserI guess unless you specifically want to allow evaluation of stuff (computing config values based on other values, custom variables, external info, etc.) just reading will be faster and has the remote possibility of being written out again (minus comments and formatting).
14:29duck1123That was what was making me think of this. I want to do a install page for my app if I decide to open-source it, and the way most sites I've seen have done it was to write back to the config file. That won't work as well with me having a namespaced config var (as source)
14:30carkwhy not just use an ini file ?
14:30Chouserew
14:30carkhehe well it's hackable by the customer
14:30carkand writable with tools
14:31Chouserini can't handle structure
14:31duck1123I'd use yaml before using ini, but it still feels a shame with clojure having such a great representation
14:31carkif you have structure it's not configuration anymore, it's data
14:31Chouseryou might think you just have a list of simple vars, but then one of them has to be a list of things and suddenly ini hurts.
14:36duck1123What's the best solution if I want to create precisely-formatted clojure code files? I'm thinking of code generators (ala Rails)
14:36carki think c.c.pprint has a code formatter option
14:36Licenser_aloa everyone
14:37carkbut aren't we supposed to use macros for code generation ?
14:37duck1123I've thought about c.c.pprint, but I figured it wouldn't be able to generate quite what I want.
14:38carkmacros remove your preprocessing stage
14:38duck1123cark: macros only take you so far, they can't do the (ns) without being both messy and brilliant
14:39carkmacros can be messy i give you that =)
14:39carkthen again code generation is messy too
14:39duck1123my use case is adding the 3 relevant files for a MVC architecture as well as generating schema files etc
14:40ChouserI'd try really hard to do that without writing new code to files on disk.
14:40Chouserpersonally
14:41Chouserwhat's a schema file? not clojure code?
14:42duck1123well, sql code currently, but I've been wanting to switch that to clojure code
14:43duck1123Basically, I want something to generate anything I need to add a new model to my app
14:44Licenser_duck1123: working on a rails like framework?
14:44duck1123basically, it's mostly what I've come up with after working with compojure
14:45carkthe one time i tried rails, as soon as i understood it was pre-generating code i deleted the whole thing =)
14:45duck1123Adding a new model involes doing exactly the same thing to 3 new files in 3 different folders, with only the names changed
14:46hiredmanthere is clinorm, but that doesn't seem very active
14:46duck1123I use my fork of clj-record
14:47duck1123it works really well because I can multi-method dispatch based on the type of record I have.
14:47hiredmanah
14:48hiredmanI thought clnorm looked kind of emptier then I remembered, I must have been remembering clj-record
14:48duck1123clj-record is the more complete one, I think. We just got a googlegroup the other day
15:01Licenser_I must say the more I look into it the more I start to like clojure
15:02duck1123there's a lot to like about clojure
15:02luisLicenser_: Lisp is fun. :-)
15:02Licenser_God wrote in Lisp!
15:03duck1123I would have to say, programming in clojure has made me more aware of performace characteristics of different datatypes
15:03Chouserif so, it wasn't Clojure. Lisp may be built on itself, but Clojure is built on the JVM.
15:03Licenser_And yes Lisp has a certain charm, while I only got drawn to look into CLojure since they promised a nice suport for paralelism or what ever the fancy word for that was
15:03luisChouser: yawn, is this that Clojure-is-not-a-pure-lisp rant?
15:04Chouserluis: I prefer clojure to any lisp I've ever tried.
15:04duck1123Licenser_: I assume you know http://xkcd.com/224/
15:04luisChouser: ok, just checking. :-)
15:05Licenser_Yes I knwo all the XKCD comic :P but I was reffering to a song
15:05rsynnottBut did god write in lisp-1 or lisp-2? You could get a good crusade or two out of that :)
15:05Licenser_http://www.youtube.com/watch?v=5-OjTPj7K54
15:05Chouserluis: :-) but Clojure picks up a whole lot from Java -- mostly (but not entirely) good.
15:05duck1123god writes in lisp-7, his version of CL is that odd
15:05rsynnottalong with the odd schism over how lisp-2s are almost never actually lisp-2 ;)
15:06rsynnottnormal cl is about lisp-7
15:06Licenser_I can use print and not System.out.print() one thing that makes it a LOT better then Java in my eyes
15:07duck1123Licenser_: it gets better when you consider you can then re-bind *out* and print to whatever you want
15:07Licenser_danlarkin: I know, that is very very very nice ^^
15:07duck1123wrong dan
15:08rsynnottIn reality, of course, he probably got an exemption and got to write it in C, just like all of those military contractors who were meant to be using ADA :)
15:08Licenser_plus it does hot have that ugly mixup of primitiv and object data dypes that java has - at least I didn't stumbled into that yet
15:08Chouseractually it does :-/
15:09Licenser_I quit o.O
15:09Chousernah, it won't hurt too bad.
15:09Licenser_I hate it, hate hate hate hate it. It is one of the things I dislike most about java
15:10Chouseryou can generally ignore the primitive types unless you need them for memory or time efficiency
15:10Licenser_the second you have to use that ugly thing called Integer in java you can toss all your code out of the window and hang your self in an infinit loop
15:10duck1123You only really get into it when you start reading the "... fast as java" threads
15:10luisLicenser_: it's useful to have unboxed types. Java makes it a pain though.
15:11luisLicenser_: though it's better nowadays with automatic (un)boxing isn't it?
15:11Licenser_not sure, didn't ever touched Integer again since I discovered that + isn't working for it
15:12Chousukehm? :/
15:12Licenser_And I likely will never do it until they allow me to at least add two Integers without chaning one gazillion function calls and typecasts. It's like an embargo against silly use of Objects
15:12Chousukeah, in java. :P
15:12luisLicenser_: seems like you haven't used Java with automatic (un)boxing. It's almost bearable now.
15:13Licenser_Chousuke: don't worry in Clojure it works, it was the second thing I tried.
15:13luisLicenser_: works in Java too.
15:13Licenser_luis: I will try that, if I ever see a reason to do so.
15:14Licenser_Then again to try that I'd have to create a new class and all that horible things
15:14hiredmanhttp://blogs.sun.com/jrose/entry/fixnums_in_the_vm some day
15:16Licenser_luis: now I'm pretty impressed
15:16luisLicenser_: how so?
15:16Licenser_that actually works quite well.
15:16luisLicenser_: impressed by Java? :)
15:17Licenser_I let text mate generate my all the silly classes and functions I needed to test it and I acntually it can do: (new Interger(2) + 1.2)
15:17Licenser_That is like a huge leap into the direction of being not entirely horrible
15:18luisOr you can just avoid Java. That works pretty well too.
15:18Licenser_I know, but at least I learned something new today something I'd not expected :P
15:18rsynnotthiredman: in time for the mars landing and fusion power, no doubt ;)
15:18Chouser,(+ 2 (double 1.2))
15:18clojurebot3.2
15:19hiredmanrsynnott: :/
15:20hiredmanI have pictures from one of the mars rovers as my desktop background
15:20Licenser_Chouser: I didn't expected it not to work in clojure, I didn't even expected it not to work in Java when I first ran into this problem which is why it was so extremely frustrating back then.
15:20rsynnottor in time for the sun engulfing earth, if you want fixnums on java _on a mac_
15:20ChouserLicenser_: I understand. I just thought I'd show you the clojure equiv.
15:21Licenser_Chouser: thanks :)
15:21Chouser2 by itself is an Integer. 1.2 would be a Double, but (double 1.2) is a primitive.
15:21hiredmanrsynnott: *shrug*
15:21Licenser_ah sneaky
15:21Licenser_so I could do:
15:21Licenser_,(+ (int 2) (double 1.2))
15:21clojurebot3.2
15:21Licenser_yay
15:21Licenser_<- starts to learn ^^
15:22Chousukeautoboxing happens though.
15:22rsynnott(apple has finally embraced java 1.6, but only quite recently)
15:22Chousukersynnott: and only on 64-bit platforms :P
15:22rsynnottwell, yes, but you can't expect miracles
15:22Chousukebut I suppose that doesn't matter much.
15:22cemerickdo they even sell 32-bit macs anymore?
15:23Chousukeno :)
15:23cschreinerhow to perform a (range 1.0 10.0 0.1) ?
15:23rsynnottApple used actually be a big fan of java, but they've taken to ignoring it of late
15:23Licenser_I want java 1.6!
15:23rsynnottcemerick: not since 2006, I think
15:23cschreinersince range only accepts integers
15:23cemerickthey've been churning out updates pretty good lately
15:23stuartsierra,(take 5 (range 1.0 10.0 0.1))
15:23cemerickesp. if you watch the dev previews
15:23clojurebot(1.0 1.1 1.2000000000000002 1.3000000000000003 1.4000000000000004)
15:23cschreineraha
15:23rsynnottah, but what happens when 1.7 turns up? :)
15:24Licenser_*downloads*
15:24cschreinerwhy this behaviour?
15:24stuartsierracschreiner: floating-point math.
15:24cschreinerok, how do I round? like (round %) ?
15:24stuartsierra,(take 5 (range 1.0M 10.0M 0.1M))
15:24clojurebot(1.0M 1.1M 1.2M 1.3M 1.4M)
15:25kotarakMath/round
15:25cschreinernice, thanks
15:25stuartsierramy last example uses BigDecimals
15:25Chouser,(range 1 3 1/10)
15:25clojurebot(1 11/10 6/5 13/10 7/5 3/2 8/5 17/10 9/5 19/10 2 21/10 11/5 23/10 12/5 5/2 13/5 27/10 14/5 29/10)
15:25cschreinerhey
15:25cschreinerthat IS nice
15:25Chousukeratios!
15:25ChousukeI almost forgot they exist.
15:25Licenser_yes it is very nicely nice
15:25hiredmanhttp://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4617197 Priority: 5-Very Low
15:26hiredmanI love how full product version is java 1.3
15:27weissji get the feeling that calling create-ns inside a let is a bad thing to do? for some reason the namespaces end up not being created?
15:27hiredmanweissj: eh?
15:28weissji guess i better pastie, hiredman, 1 wec
15:28weissjsec
15:28hiredman,(let [] (create-ns 'bob))
15:28clojurebot#<Namespace bob>
15:29kotarak,(let [foo (create-ns 'alice)] foo)
15:29clojurebot#<Namespace alice>
15:29weissj,(all-ns)
15:29clojurebot(#<Namespace clojure.set> #<Namespace hiredman.sandbox> #<Namespace hiredman.schedule> #<Namespace hiredman.clojurebot.seenx> #<Namespace hiredman.clojurebot.dice> #<Namespace hiredman.clojurebot.sb> #<Namespace org.danlarkin.json.decoder> #<Namespace hiredman.clojurebot.delicious> #<Namespace user> #<Namespace hiredman.clojurebot.google> #<Namespace clojure.main> #<Namespace org.danlarkin.json> #<Namespace clojure.core>
15:29weissjhow come they are not there
15:29cschreiner,(map #((.round Math (* % 10)))(take 5 (range 1.0 10.0 0.1)))
15:29clojurebotjava.lang.IllegalArgumentException: No matching method found: round for class java.lang.Class
15:29kotarakweissj: obviously create-ns is not ns. as create-struct is not defstruct
15:30cschreinerany hint?
15:30kotarakcschreiner: Math/round
15:30hiredman,(.contains (all-ns) (create-ns 'bob))
15:30clojurebottrue
15:30hiredmanit is there
15:31weissjhiredman: am i blind? i don't see it
15:31cschreinerkotarak: no
15:31cschreiner, (map #((. Math/round (* % 10)))(take 5 (range 1.0 10.0 0.1)))
15:31clojurebotjava.lang.Exception: Unable to find static field: round in class java.lang.Math
15:31kotarak,(map #(Math/round (* % 10)) (take 5 (range 1.0 10.0 0.1)))
15:31clojurebot(10 11 12 13 14)
15:31hiredmanweissj: clojurebot obviously elides output after a certain length
15:32weissjhiredman: oh ok
15:32hiredmanyou can tell because there is no closing paren
15:32lisppaste8weissj pasted "title" at http://paste.lisp.org/display/85831
15:32cschreineroh, the parantesis
15:32hiredman~map
15:32clojurebotmap is *LAZY*
15:32kotarakcschreiner: and the dot
15:32weissjhiredman, when i run the code i pasted, i don't see the printlns
15:33weissjwell i see the first one, println 'hi
15:33Licenser_~Licenser_
15:33clojurebotI don't understand.
15:33cschreinerso in this case the dot does not denote anything?
15:33Licenser_I want him to say Licenser_ is *LAZY* :(
15:33hiredmanweissj: let me do this again
15:33hiredman~map
15:33clojurebotmap is *LAZY*
15:33hiredmanugh
15:33weissjoh right. :)
15:33hiredmanand def is altering the global namespace
15:34hiredmanso using def inside a function is very icky
15:34weissjhiredman: i am not sure how else to do it
15:34weissji can't do those defs until after i've loaded my properties
15:35kotarakcschreiner: static class methods are called with a /: (Math/round ...) not (.round Math ...) the letter would call the .round method on the Class instance denoting Math, which doesn't exist and hence gives you the error you wrote above
15:35hiredmanweissj: sure you can
15:35hiredmanthey are all atoms, so they are mutable
15:35weissjhiredman: oh i see, i can def them as nil first
15:35Licenser_well see you all later
15:36cschreinerkotarak: ok
15:36cschreinerthanks for clearing that out
15:36kotarakcschreiner: clojure.org/java_interop
15:36kotarakIIRC
15:39cschreinerwhat is the (static?) java method for rounding with decimals?
15:40kotarakcschreiner: you mean to a certain precision?
15:40cschreineryes
15:40cschreinerso my list would look like (0.01 0.02 0.03 ...)
15:41weissjhiredman: that plus the (doall (map ...)) fixed it, thanks!
15:42kotarakcschreiner: dunno, there is with-precision
15:42kotarak(doc with-precision)
15:42clojurebot"([precision & exprs]); Sets the precision and rounding mode to be used for BigDecimal operations. Usage: (with-precision 10 (/ 1M 3)) or: (with-precision 10 :rounding HALF_DOWN (/ 1M 3)) The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP."
15:43kotarakHmm.. dunno
15:43cschreinerso you set this locally?
15:43cschreinerlike, inside a (do ) block
15:43kotarak(with-precision 2 (do-things) (do-more-things))
15:44kotarakcschreiner: no do block necessary
15:44cschreinerAh
15:44cschreinerhmm, helps to actually read the definiton ;-)
15:44cschreineryeah, that solves it, I think
15:45kotarakcschreiner: Everything with "& body" in the arglist doesn't need a do.
15:45cschreinerright
15:45kotarak,(:arglists ^#'for)
15:45clojurebot([seq-exprs body-expr])
15:53cemerickis there really any hope of getting fixnums on the jvm anytime soon? I thought that was effectively a pipe dream.
15:54wtetzner,(rest [1])
15:54clojurebot()
15:55wtetzneri thought if there were no more items, a sequence was supposed to return nil?
15:55wtetzner,(first (rest [1]))
15:55clojurebotnil
15:55kotarak,(next [1])
15:55clojurebotnil
15:55wtetzneroh
15:55hiredman~lazier
15:55clojurebotexcusez-moi
15:55hiredman~lazy
15:55clojurebotlazy is hard
15:55hiredmanbah
15:55kotarakwtetzner: http://clojure.org/lazy
15:56hiredmanalso http://clojure.org/lazier
15:56wtetznerthanks
15:56hiredmanbut I think both pages speak of the change as something brand new, but the change was pre-1.0 so it's been around for months now
15:56wtetznerok
16:03Chouserin 18 months there will be a public draft of the results of considering whether it is practical to add new features to support networking, threads, internationalization, foreign-function interfaces, etc. for a "large" scheme language.
16:03Chouserwe'd better watch out.
16:03Chouserhttp://scheme-reports.org/2009/working-group-2-charter.html
16:03hiredman*snort*
16:03hiredmanLtU has a thread on it
16:03Chousukewait, results of considering whether it's practical?
16:04luisChouser: Scheme is a fine language.
16:04cemerickeh, I can't bag on the schemers
16:04cemerickThey'll probably be around long after CL and clojure are gone
16:05kotarakYes. Scheme is a nice language. I liked for its small core (as I like Clojure for that reason (among others)). I'm not sure I like R6RS, though...
16:06luiskotarak: saying Clojure has a small core (being a JVM language) is a bit disingenious.
16:06Chouserluis: depends on whether you're weighing the whole package or trying to maintain the code base.
16:06hiredmanit is small, compared to say scala
16:07Chousukethe JVM is not counted into the "core". it's something Clojure gets for free. :)
16:07kotarakluis: how does the JVM influence the core of CLojure? Is Basic a huge language, because it runs on Windows?
16:08stuartsierraIs there a fn like select-keys but that removes the given keys?
16:08hiredmanreduce+dissoc?
16:08Chouser,(dissoc {:a 1 :b 2 :c 3 :d 4} :a :c :d)
16:08clojurebot{:b 2}
16:09uninvertedAnybody know why "slime-complete-symbol" in emacs with slime doesn't work with clojure?
16:09hiredmanor just dissoc
16:09stuartsierraRight, dissoc, thanks.
16:09danleiuninverted: works for me
16:09uninverteddonlei: hmm...
16:10danleiuninverted: cvs upped slime, pulled swank-clouren and clojure-mode today (clojure.jar also HEAD)
16:10luiskotarak: I'm using the wrong terminology perhaps. What do you call all that java.lang.* stuff?
16:11danlei*swank-clojure
16:11cemerickluis: Java is certainly clojure's only target at the moment, but that will change in relatively short order
16:11hiredmanuseful for java interop
16:11hiredmanwell, there is Clojure.NET
16:12wtetznerluis: the stuff you import using java.lang etc. is accessing libraries
16:12hiredmanand the currently broken clojurescript
16:12wtetznerit's not part of the core of the language
16:12cemerickyeah, a .NET target that tracks head will probably the first alternative target
16:12hiredmanwtetzner: actually java.lang.* is auto imported :P
16:13wtetznerso then it's an auto-imported library :)
16:13uninverteddanlei: That's not really an option for me; I've got a weird slime/emacs setup held together with twigs and scotch tape, so updating would be hard.
16:13clojurebotfor is not used often enough.
16:13luiswtetzner: a lot of the language seems to defined in terms of what's in java.lang.*; nothing wrong with that, just pointing it out.
16:13Chousukeluis: actually, most of it is defined in terms of clojure's own interfaces.
16:13Chousukeluis: but yeah, there are many java dependencies.
16:14Chousukebut those can be eliminated :)
16:14luisI'm sure they won't be hard to eliminate, sure.
16:14kotarakluis: In Scheme there are strings. In Clojure there are Strings. Does it matter, that Clojure uses a java.lang.String?
16:15danleiuninverted: hm, I've followed head for clojure-mode, swank-clojure, ccl, and slime head since ... a long time, without bigger problems at any point in time. I'd guess it's your combination/duct-tape which somehow messes things up.
16:15stuartsierraluis: Rich's usual answer usually goes something like, Java will remain the primary platform for Clojure in the near future. But we will try to make it easier to port to other platforms.
16:15luiskotarak: suppose java.lang.String is really bloated (I have no idea if it is), then it matters, right?
16:16Chousukethe only problem with java.lang.String is that it's final. :/
16:16Chouserinsufficiently bloated? :-)
16:17stuartsierraThe advantage to java.lang.String is that it's tightly integrated with the JVM, so it's generally quite efficient.
16:17Chousukeyeah. Though interface injection would be cool.
16:17luisstuartsierra: sure. Nobody is arguing that.
16:17stuartsierraThat is, Sun knows lots of people will be using java.lang.String, so it's in their interest to make it as efficient as possible. And they can't do that if people can extend it.
16:17stuartsierraBut I agree interface injection would be cool.
16:18Chousukeit'd be really neat if it were possible to add support for new interfaces, even with the restriction that you can't add new fields.
16:18uninverteddanlei: Probably. Does "Synchronous Lisp Evaluation Aborted" mean anything to you?
16:20danleiuninverted: no, sorry
16:22stuartsierraWould interface injection require changes to the VM, or could it be done in Clojure?
16:22danleiuninverted: since I'm on cygwin emacs since (a few months) I'm using swank/swank-clojure + slime-connect, maybe that does make a difference, but I don't know; no bigger problems here (despite read/read-line/... never returning in a slime repl)
16:22Chouserstuartsierra: it would be a jvm feature, I believe.
16:23stuartsierraah, no fun then.
16:23cemerickstuartsierra: it's ostensibly coming in jdk 7
16:23stuartsierraReally? Interesting, didn't know that.
16:23uninverteddanlei: I have the same problem with read(line) :|.
16:24danleiuninverted: Rich's tip: press return :D seriously: I'd love to get that fixed ...
16:24kotarakwell, we can define an interface in terms on multimethods and then do a (derive String ::Foo), or do I get the idea of interface injection wrong (besides that would not be a java interface, of course)
16:25cemerickstuartsierra: or, to be clear, it's part of JSR 292, and is #4 in the MLVM priority list: http://openjdk.java.net/projects/mlvm/subprojects.html
16:25danleiuninverted: atm I've no idea where the problem lies (concerning read/...)
16:26Chouserkotarak: you're right -- clojure already has this level of flexibility for its own constructs. But if you want the speed of a java method dispatch, you need the jvm to add this support.
16:26Chousukekotarak: It'd be neat to have Strings support IMeta for example.
16:26clojurebotfor is not used enough
16:26kotarakChouser: I'm happy with multimethods. :) Quite happy actually. :)
16:26uninverteddanlei: Also, (do (print "foo") (read)) doesn't work, it reads before printing.
16:26hiredmanit would be nice to, for instance, inject Seqable into String
16:27ChouserChousuke: well, that would require a metadata field, right?
16:27Chousukeyeah... with no-data interface injection that wouldn't be possible I guess.
16:27uninverteddanlei: Not just in emacs, either
16:27hiredmanuninverted: use println
16:27Chouserbut regex.Pattern could be IFn
16:27Chousukeunless you had a global metadata repository for strings.
16:27Chousukewhich would be icky
16:27danleiuninverted: sounds like flushing problem
16:27hiredmanuninverted: output streams need to be flushed, a newline or flush will flush
16:28danleibut the read/... problem has nothing to do with this (i think)
16:28danleijust (read) will freeze slime for me
16:28hiredmanwhich read problem?
16:29danleihiredman: read/read-line freeze the repl for me since a few weeks
16:29kotarakhiredman: a SLIME problem
16:29hiredmanuninverted: use printlnh
16:29hiredmaner
16:29hiredmanoh
16:30hiredmanyeah, you emacers chose your boat
16:30danleiemacs is clearly the best option, even if read is broken atm
16:30danleibut that's just taste, nothing to argue about
16:31kotarakIt wouldn't work with VimClojure also. Since Vim just sends data from a buffer. You can't pass though stdin... So no read from the buffer repl.
16:31ChousukeI'm pretty sure slime has some tunable for that anyway :P
16:34danleiwell, slime is kind of a fast moving target, I'm sure I could get it back to work if I just check out some version ~1month ago, but I'll just wait for the open-source-fairy :)
16:34Chousukeemacs has convinced me that I need a better keyboard though.
16:35uninvertedChousuke: How so?
16:36RaynesI has a Microsoft Ergonomic Keyboard.
16:37Chousukewell, the modifier keys are asymmetrically placed and rather small
16:37uninvertedRaynes: Microsoft and it's keyboards are like McDonalds and Chipotle.
16:37Chousukeon my macbook keyboard that is.
16:37Chousukecurrently I have caps lock as meta and cmd keys act as controls
16:39Chousukedanlei: the meta is needed less :P
16:39danleihm, in emacs, I use meta all the time
16:39Chousukecontrol combos are usually more complicated
16:40danleihm, ok
16:40uninvertedI use CL as control. On my keyboard there isn't that weird gulf.
16:40RaynesI bet I can C-x C-f faster than Chousuke
16:40danlei:)
16:41danleieditor war avoided, keyboard layout war started :)
16:41ChousukeRaynes: I dunno, my right thumb rests on cmd and left index finger on f :P
16:41stuartsierraI love Emacs with my Kinesis Contour Dvorak, worth every penny.
16:41Chouserstuartsierra: that puts the modifiers under your thumbs, right?
16:42stuartsierrayes, all of them, plus space, backspace, delete, & enter
16:42danleisounds nice
16:42uninvertedI'd get one if not for the price and inertia.
16:43ChouserI'm not that discontent
16:43ChousukeIn any case, I'm pretty much completely converted from vim nowadays :P
16:43stuartsierraMine's lasted for 7-8 years, and I'm not gentle with it.
16:43danleibut doesn't have ALL modifiers under the thumbs make you move your whole wrist kind a lot?
16:44stuartsierraNo, the keys are clustered, so you never move your wrists at all.
16:44stuartsierrahttp://www.kinesis-ergo.com/contoured.htm
16:44Chousukeemacs is just forcing me to push its limits.
16:44stuartsierraIt does require re-learning how to type. I have tendinitis, so every little bit helps.
16:45danleistuartsierra: ah, I see, really looks useful
16:45Chousukewith vim I never bothered to do anything beyond basic syntax highlighting because any addons were always a bother to set up :/
16:45uninvertedI've always thought about using vim or viper-mode but I really don't type fast enough for it to be worth it.
16:46kotarakRelearning is so hard.... I tried NEO. (A layout especially for german). But had more trouble getting the hard-wired motions out of the way, than doing productive work. :(
16:46Chousukeviper mode is nice, though it doesn't agree with paredit
16:46Chousukeand paredit is pure bliss :P
16:46kotarakChousuke: I found emacs plugins much harder to setup than plugins for Vim. Most just work.
16:46danleikotarak: that's what keeps me from alternative layouts too
16:47Chousukekotarak: Hmm. well, you know vimscript so maybe that helps :)
16:47uninvertedkotarak: Emacs sort of requires you to learn elisp, but I don't think you really need any VimScript for vim.
16:48ChousukeI'm not an expert with vim, and emacs is more self-documenting.
16:48Chouser:w is vimscript, isn't it?
16:48uninvertedChouser: :)
16:48kotarakChouser: hehe
16:48danleiI've used vi(m) for quite a long time, and was pretty assured that it rules as an editor, but when I started using (and knowing) emacs, I just thought of vi as a kind of moded keyboard-layout. the editor "system" itself is, imho, inferior. (just MY opinion and personal experience with both religions :)
16:48kotarakLet's say Vimscript is a super set of ex commands
16:49ChouserI'm willing to abandon vim for something sufficiently better. I'm just not sure emacs is that.
16:49rzoomcan i send an email to clojure-dev without being a member?
16:49Chousukeand elisp is a plus too. I can look at elisp code and understand it because it's lisp :/
16:49Chousernot sure I'm willing anymore to abandon vim-like key bindings.
16:49uninvertedChouser: You don't really have to abandon it. Look at viper-mode
16:49Chousukelisps aren't fundamentally that different from each other. :P
16:49Chouserrzoom: I don't think so
16:49Chousukeat least, until you get to details.
16:50Chouseruninverted: I have -- it feels pretty clumsy.
16:50kotarakELisp is a plus, but modal editing is better. I'm also yet to find a better alternative. Emacs definitively is not.....
16:50Chouseruninverted: lots of modes don't work quite.
16:51ChouserI've been meaning to look at waterfront. anybody using that?
16:51kotarakI had a look at the implementation, but don't use it.
16:51kotarakI was almost up to start cultjure. ;P Yet another project doomed to death...
16:52uninvertedYou can get something a lot like waterfront in emacs with slime and a lot of cusom keybindings.
16:52uninverted* custom
16:52kotarakVimClojure is sufficient for me....
16:52Chouseri want something a lot like emacs in waterfront
16:52Chouserwell, in clojure.
16:52kotarakIf just Vim had a better scripting language...
16:53kotarak...eg. Clojure :)
16:53Chouserhm... there are bindings for everything...
16:53danleikotarak: Cljim? :)
16:53kotarakJep. :)#
16:53uninvertedChouser: I agree. Clojure is just about the perfect language for an editor. A lisp that's good at string munging.
16:54danlei(looks like dutch)
16:55Chouserwell, texture is my start at it. but stalled, of course, as is almost every project I start.
16:55uninvertedPlus it would run jost about anywhere with the JVM. Imagine emacs on your phone.
16:55hiredmanI think javascript might be a better language for scripting these days
16:56hiredmando you really want your editor to have the jvm startup time?
16:56uninvertedhiredman: Couldn't be slower than emacs
16:56danleiwell, if it's a little like emacs, it wont have to start :)
16:56danlei*won't
16:56JAS415who cares about startup time?
16:57hiredmanwell, I don't use emacs, so...
16:57JAS415do you open and close your editor all day?
16:57danleiemacsclient to the rescue
16:57JAS415lets microbenchmark it
16:57kotarakJAS415: If you are a sysadming... yes
16:57hiredmansometimes
16:57hiredmanyeah
16:57danleiwhy shouldn't an admin use tramp?
16:58hiredmanit depends
16:58uninvertedvi does win for sysadmins because of its ubiquity.
16:59danleithat's somehow a point, if you have no other access than pysical, yes
16:59Chousukea sysadmin would run emacs on his own machine and set emacsclient to connect to that instance over ssh :P
17:00danleiI'd just use tramp
17:00danleiso, basically: yes
17:01Chousukeor use vi, if it's some config file editing.
17:01kotarakIf Vim just hadn't so much niceties. For example C-n completion, or C-xC-f file completion....
17:01hiredmanand then he tries to write the config file he just edited, and it turns out the user his ssh client connected as doesn't have permissions
17:01danleikotarak: ever heard of hippie-expansion?
17:02kotarakdanlei: no
17:02uninvertedkotarak: It's basically the best thing ever.
17:03kotarakuninverted: which has yet to be proven. They say the same about org-mode.
17:03danleikotarak: you can add as many completion-types to it, used in the order of the list of expansions to try. bound to a convenient binding, and you wipe the bottom with C-xC-f file
17:04kotarakdanlei: and they deliver all those fancy, super completions with their plugin? Or do they just provide the infrastructure to define them?
17:04ChousukeI have tabcompletion in my buffers
17:05danleilike: (setq hippie-expand-try-functions-list '(try-expand-dabbrev try-complete-lisp-symbol try-complete-your-grandmother) ... some are built in, some come with modes ... depends.
17:05ChousukeI wonder if combine ido fuzzy completion with that
17:05kotarakdanlei: and it also learns the keywords of all open buffers?
17:06Chousukethough ido is pretty slow for large lists. would probably need some performance tweaking.
17:06danleikotarak: depends on the completions you actually use, for the most cases: yes
17:07danleikotarak: but for that, you can just use slime-complete-symbol, already does that, as far as lisps are concerned. (I especially like partial completion for lisp)
17:08danleiChousuke: you already know smex?
17:08danleiChousuke: nice add-on for ido, for commands
17:09Chousukesmex?
17:09danleiChousuke: http://www.emacswiki.org/emacs/Smex
17:09danleiChousuke: nothing earth-shaking, but I use ido too, and find it useful sometimes
17:10Chousukehmm.
17:10ChousukeI already have ido in M-x but I guess that's a bit smarter.
17:10Chousukeido fuzzy completion is nice but it still introduces noticeable delays when you have many matches ;/
17:11ChousukeI also typo - as . often and noticing that would be nice too :D
17:11Chousukethen I could just type cl.de or something to get clojure-mode
17:11danleiusually I just use partial-completion with M-x, it's still fastest for me
17:12danleismex is just for exploring things, when I'm not sure what I'm looking for
17:13danlei(but anyway: if you already have ido completion for M-x, nothing new, I guess)
17:15ChousukeI wish egg had the ability to control the size of chunks when staging changes :/
17:15Chousukebut it doesn't seem straightforward to implement.
17:16Chousukemagit does it, but magit's interface is not as neat ;(
17:16danleiI just use vc-git atm, eshell for the rest :|
17:17Chousukeand magit gets confused if you name your tracking branch differently from the remote branch you track.
17:17Anniepooanybody using waterfront?
17:18Chousukedanlei: you should try magit. it's really much nicer than git add --patch :P
17:18danleiChousuke: Yes, I really should :\, maybe I'll check it out this weekend
17:18Chousukethe interface is really spartan though.
17:19danleiWell, atm I'm basically just using C-x v v and eshell -- can't get any more spartan I guess :)
17:19ChousukeI only found out by accident that you can specify the remote to push to with the prefix argument to P (push)
17:20Chousukeand the default faces are all grey
17:20Chousukeadd some colour and it becomes much more pleasant :P
17:21danleiso ... would you suggest magit, or egg?
17:21danleiguess I should really take the time to investigate them both ...
17:22Chousukedanlei: well, egg is a lot easier to use but magit has more features (being able to shrink and enlarge chunks for staging is really, really nice)
17:23Chousukemagit seems better maintained too.
17:23danleiChousuke: yes, that's surely a nice one
17:26Chousukebasic usage of magit is easy though: just do M-x magit-status, then you'll get a buffer of changed files, staged and unstaged files which you can scroll with n and p; tab will expand a file for per-chunk staging, s will stage a selected file/chunk, u unstages, and c brings up the commit message window (C-c C-c does the actual commit)
17:26Chousukeand then there are a million other features you can discover via the completely unorganised menu :P
17:27danlei:)
17:27danleiok, thanks, I'll definetly check it out ... no more git add -p :)
17:28Anniepoohmm... I'm writing a GUI editor. So far it's only edited one sort of thing. Now I'm going to add a second mode
17:28danlei*definitely
17:28Anniepoothat edits a second thing in a different way
17:28Chousukeegg instead has a minor mode that activates when you open a git-controlled file. then it overrides C-x v v to mean "next action" (staging modifications or committing), and C-x v s for "status" and C-x v l for history view
17:29danleiChousuke: hm
17:29danleiChousuke: how is it different from vc-git then?
17:29danleiChousuke: that's what I can do right now ...
17:30Chousukedanlei: the status and history buffers have all kinds of functionality. and there's more that what I mentioned
17:30danleiChousuke: ah, ok
17:30danleiChousuke: sounds as if it would be an easier transition
17:30danleiChousuke: but I'll have a look at magit
17:31Chousukewell, egg is a fork of early magit, so they share many of the key commands.
17:31AnniepooI currently have a dispatch-down for the first mode. Is this a sane place for a multimethod, or am I abusing it?
17:31Chousukebut I wouldn't call them similar :)
17:31danlei:) ok, ty
17:31ChousukeBut if egg had the ability to shrink/enlarge chunks I'd definitely use it instead of magit :/
17:32danleijust a matter of time, and some solution including the kitchen sink will be part of emacs proper, I guess ;)
17:33Chousukeheh
17:33Chousukeyeah, that's one of the nice things about emacs.
17:34danleisure is :)
17:34Chousukeit doesn't accumulate bloat. it accumulates features.
17:34danleiI'd say it ... assimilates :)
17:35AnniepooI'd love to be assimilated, but couldn't get it to set up the clojure related modes
17:35ChousukeBut you're on windows, right?
17:35Anniepooyes
17:36ChousukeI had exactly zero problems setting up clojure-mode with clojure-install when I tried it, but I'm on OS X :/
17:36danleiI use cygwin emacs on windows, fire off swank-clojure + slime-connect in emacs and that pretty much does it. (everything HEAD)
17:36devinusIs anybody using clojure that doesn't know Java?
17:36devinusChousuke: what is clojure-install ?
17:37danleiwell ... If you exclude some mandatory course at university, I guess I don't know anything about java ;)
17:37Chousukedevinus: a feature of clojure-mode that downloads slime, swank, clojure and clojure-contrib for you.
17:37Anniepoodanlei, mind if I bug you for help on getting emacs up under cygwin?
17:37danleiAnniepoo: If I can help, I will, sure
17:38Anniepoolovely
17:38ChousukeNow I have a more proper slime setup though.
17:38ChousukeI actually set up clojure as just one lisp for slime. I don't have other lisps but they would be easy to add. :P
17:40Anniepoodanlei, I'm on private to you, are you seeing it?
17:42ChousukeI actually found a nice function from clojure-swank that made setting up the proper command for clojure easy
17:42Chousukehttp://github.com/Chousuke/emacs.d/blob/ec575853806e43434f92c1f28278910afd1dd96b/init-clojure.el
17:45Licenser_what is slime and swank?
17:46ChousukeSLIME is the Superior Lisp Interaction Mode for Emacs and swank is a thingy SLIME uses to talk with the actual lisp instances.
17:47Licenser_ah okay no use for that I'm not an EMACS person
17:47Licenser_thanks for the answer so Chousuke :)
17:47rsynnottit's really very nice; you should consider giving it a go
17:47devinuswhat is the META key for emacs on Macs?
17:48Chousukedevinus: by default, option
17:48Licenser_I startet out of VIM, went to TM on mac since it has a incredile nice integration here on my MAC and I tried the mac emacs port - it just does not work soo well, just as much as gvim is horrible
17:51devinuswhen i try to do M-x slime on emacs on my mac it doesn't do anything it's just trying into the file "slime"
17:52Chousukeslime is not included in emacs by defauly.
17:52Chousuket
17:52devinusChousuke: i know, i have everything set up. i think it's a key issue
17:54cschreinerdevinus: I agree
17:56devinusso i'm using both the ctrl and alt/option keys
17:56devinusneither is M-x
17:58Chousukehm
17:58Chousukeaquamacs?
17:58Chousukein aquamacs it's cmd-x I thkn
17:59Chousukeesc x will work if that doesn't
18:22RaynesClojure and that FlightCaster site got a slashdot. :>
18:27devinuscan you do slime/swank/clojure-mode in aquamacs?
18:28bitbcktYes.
18:28devinusis it the same process?
18:28RaynesAFAIK.
18:28bitbcktclojure-mode + clojure-install works in that env.
18:31bitbcktAquamacs and Carbon Emacs both use CMD as M, by default...
18:44devinuswow
18:45devinusaquamacs with clojure-mode is a great dev environent
18:45devinusi don't even know emacs yet, but i get the feeling that i'll feel rather stupid thinking i could have gone my entire life as a programmer satisfied with just a text editor
18:46bitbckthehe
18:49devinusis there a way to get a darker theme for aquamacs?
18:50bitbcktinstall the color-theme package
18:50bitbcktdevinus: http://www.emacswiki.org/emacs/ColorTheme
18:59mtddevinus: check out the zenburn theme
19:36cschreinerdevinus: emacs is wonderful
19:39uninvertedIs everyone still talking about emacs? :\
19:40bitbcktuninverted: This *is* a Lisp-related channel... inevitable, really.
19:41uninvertedbitbckt: All channels do inevitably gravitate to editors...
19:41bitbckthehe
19:42bitbcktIRC is the event horizon of an Holy War black hole...
20:06AWizzArdIn Compile.java in line 56: int count = args.length; Is count used at some point later?
20:20tomoj,(into [] (map inc [1 2 3]))
20:20clojurebot[2 3 4]
20:20tomojis that efficient?
20:21tomojguess it's still linear
20:42Chouseryes linear, but pretty efficient. into will use a transient vector to build up the result and do an O(1) conversion to persistent before returning it.
20:45Chouserrhickey: why does into use (#( ... )) ?
20:54lowlycoderis there a good clojure/swing tutorial anywhere? I'm trying to translate: http://java.sun.com/docs/books/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start//HelloWorldSwing.java and am a bit stuck
20:54lowlycoderI have (import [javax.swing JFrame JLabel ]) so far
20:55lowlycoderand that's about it
20:55tomojChouser: wait, what?
20:55tomojI figured (map inc [1 2 3]) built up a seq, then the into has to go and copy it into a vector
20:58dreishtomoj: "Built up a seq" doesn't mean anything.
20:59lowlycoderuser=> (import [javax.swing JFrame JButton JOptionPane])
20:59lowlycoderjava.lang.ClassNotFoundException: javax.swing (NO_SOURCE_FILE:2)
20:59lowlycoderwtf ... isn't javax.swing part of standard java?
20:59lowlycoderor am i missing a *.jar file
21:00dreishtomoj: I guess it could, if you hang on to the head, but otherwise a seq is a little closer to an iterator than a list.
21:00tomojdreish: ah, yeah
21:00dreishlowlycoder: Try (import '(javax.swing JFrame ... etc))
21:01lowlycoderthat worked
21:01lowlycoderdreish: thanks ... but isn't [] like '() in the context of import?
21:01lowlycoderi ssee the two swapped back & forh all the time
21:01tomojso into has to consume the seq, where a plain map just leaves it unconsumed
21:01dreishNo, but '() and '[] work about the same.
21:01tomojlowlycoder: put your import inside an ns, then you don't have to quote anything
21:01dreishWith [], the members of the vector are still subject to evaluation.
21:02dreish,[(+ 1 2) (+ 3 4)]
21:02clojurebot[3 7]
21:05lowlycodergot it; thanks :-)
21:05lowlycodertomoj: yes, the inside namespace must have been where I saw the [] w/o the quote
21:09tomojother than that, just check out the java interop section on clojure.org
21:09tomojand doto
21:47ycombinationwhat are the advantages of clojure over Scala and JRuby?
21:48headiuswhat's the advantage of peanut butter over chocolate?
21:49ycombinationheadius: not the same thing
21:49luisycombination: exactly.
21:49luis:-D
21:50ycombinationluis: headius' example is not the same thing as my question.
21:50luisycombination: perhaps you could be more specific in your question.
21:51luisycombination: otherwise, you should read the nice overview in Clojure's website.
21:52ycombinationit seems to me that Scala, Clojure and jruby are popular choices for jvm based shops
21:52tomojhmm. I seem to want transactions to see the snapshot of the "ref world" rather than the in-transaction values. I suspect this means I'm thinking wrongly..
21:53luisycombination: apparently so.
21:53ycombinationhowever I don't know enough about them to assess what are Clojure advantages and disadvantages over them... right now I'm tending towards Clojure
21:54luisycombination: well, go for it. Do you know any other Lisps?
21:54ycombinationI know Java
21:54ycombinationand C++
21:55tomojif you understand the y combinator you should have no problem :)
21:55ycombinationI learned some functional programming with Erlang
21:55luisycombination: I'm sure you'll like Clojure. Get the book, have fun.
21:55ycombinationluis: ok, programming clojure?
21:56luisycombination: right.
21:57ycombinationI'll ask slightly narrower questions then. How fast is Clojure in general? Like Common Lisp?
21:57luisycombination: there are so many CL implementations. Some are quite fast. So is the JVM.
21:58ycombinationluis: SBCL
21:58luisycombination: that one's pretty fast, yeah.
21:59luisycombination: you should be fine with Clojure, I wouldn't worry about that.
21:59ycombinationluis: coming from languages like C++ and Java, I'm not ready to a slow language like jruby.
22:00ycombinationso I wonder if Clojure is generally considered fast. I'm fine with it being 1/10 of java's speed. 1/40 would not be acceptable tough.
22:01tomojeven in the rare case that clojure is too slow, you can just write that part in java
22:01ycombinationtomoj: is it that well integrated with Java?
22:01tomojyep
22:01tomojbut rich says clojure is "as fast as java"
22:01ycombinationtomoj: so I can use any Java library I want?
22:02tomojyep :)
22:02tomojand your clojure data structures can be passed to those libraries, etc
22:02ycombinationthat's groovy... I mean... that's clojure :D
22:02luisycombination: if after profiling you find a piece of Clojure code that's not fast enough there are plenty of ways of optimizing it. Type hints, rewriting in Java, etc.
22:02Anniepoopublic thanks to danlei, who just got me up on emacs/swank/slime/etc after an insane amount of struggle
22:03ycombinationok, what about IDE support? What do you recommend?
22:03Anniepoothough clojure tends to be fast enough if you're really in THAT much of a hurry you'll probably want to use a GPGPU CUDA program
22:04JAS415i think the key is to mix clojure wtih the right java libraries
22:04JAS415then you get speed + lisp power easily
22:04tomojycombination: emacs/swank/slime/etc :)
22:04ycombinationtomoj: oh I'm not familiar with those
22:04tomojif you're not on windows it shouldn't be an "insane amount of struggle"
22:05tomojwell, learning emacs might be a bit of a struggle...
22:05ycombinationtomoj: I'm on MacOSX
22:05luisycombination: I suppose you could start with one you're familiar with then. But soon enough you'll become an hardcore Lisper and fall in love with Emacs. :)
22:05JAS415there's eclipse and netbeans plugins too...
22:05ycombinationI'm familiar with textmate, eclipse and netbeans
22:05AnniepooI use IntelliJ and La Clojure
22:05tomojycombination: imo, get aquamacs emacs, the emacs starter kit, clojure-mode
22:05JAS415i use emacs myself
22:06tomojycombination: I might be blogging sometime soon about getting all that set up
22:06ycombinationtomoj: I like the idea. Any tutorial to learn emacs fast?
22:07AnniepooI'm just learning, found this useful
22:07Anniepoohttp://dsl.org/cookbook/cookbook_14.html
22:07tomojI dunno of any good ones
22:08Anniepoothe tutorial that comes up when you start a newly installed emacs is helpful
22:09Anniepooor by ctrl-h t
22:10ycombinationI will do that then
22:12tomojah, yes, that's how I got started
22:13rzoom_is rhickey the only one who can approve for the clojure-dev google group?
22:14Chouserrzoom_: I believe so
22:17rzoom_okie doke
22:18rzoom_i have a patch ready to go, just waiting for approval
22:24Chouserfor an existing ticket?
22:26rzoom_no
22:26rzoom_adding not-found param to get-in
22:26rzoom_wanted to see if there was any interest
22:27rzoom_i need it for a project i am working on at work
22:27Chouserwell, you can create a ticket on assembla. Dunno if you can attach a patch or not without membership.
22:29rzoom_yeah i am just a watcher
22:29rzoom_was going to just send the patch to dev-group list and see if anyone thought it was worth applying
22:29ChouserI think he prefers unrequested issues be brought up on one list or the other first.
22:30ChouserI haven't figured out when to start a thread -dev vs. clojure.
22:31rzoom_plus i have that ssl-server patch for contrib. will send that to the list as well.
22:34Chouseryeah, I guess -dev's the right place for that. Sorry I can't do anything for you there.
23:02rzoom_Chouser, no problem. thanks for the info :)
23:50ycombinationI built clojure.jar, how do I add it to the "classpath"?