#clojure logs

2009-01-03

00:07Chousertraffic here: http://spreadsheets.google.com/pub?key=p1hkQs__fVybaFUEpdsigMg&oid=4&output=image
00:08Chouserarbitrary units.
00:31nibbsanone working with compojure?
00:31nibbsis it possible to use javascript with it to?
00:31nibbswhat about the clojure-javascript compiler someone is working on?
00:37dhayanibbs: contrib has clojurescript that Chouser worked on, but I don't know the status of that.
01:06nibbshttp://sourceforge.net/projects/clojure-contrib
01:06nibbswhere is the actual downlod to contrib?
01:08dhayahttp://clojure-contrib.googlecode.com/svn/trunk
01:37chrisnhow does one create a runnable jar file with clojure? Looking at clojure main, it is kind of weird.
01:37chrisnmain.clj, that is
02:03dhayachrisn: (:gen-class) to generate a main() method, and a Manifest file, didn't work for you?
02:03chrisndhaya: Thanks. I used gen-class then created -main[& args]
02:03chrisnI may be using an old version
02:03chrisnof clojure
02:04chrisn(defn- -main[& args] blah blah)
02:04chrisnthe -main part is what I thought was weird.
02:04chrisnBut it worked...
02:05chrisnI also don't quite understand gen-class
02:05chrisnBut I don't need to right now.
02:22falconairHi, I'm having trouble instantiating Line2D.Double from clojure "new Line2D.Double(10, 10, 100, 100 );"
02:22falconairhow does one instantiate nested classes?
02:23falconairoops, just found it
02:24falconairLine2D$Double <== dollar sign
02:54nibbshow do I pull contrib from svn, i dont know svn
02:58dhayanibbs: http://code.google.com/p/clojure-contrib/source/checkout
02:59dhayasvn checkout http://clojure-contrib.googlecode.com/svn/trunk/ clojure-contrib-read-only
03:01dhayaIf git is your thing, you can pull from a git mirror using: git clone git://github.com/kevinoneill/clojure-contrib.git
03:54nibbsI have compojure.jar in C:/clojure/ , I have it in my classpath.
03:54nibbshow do I import it from the repl?
04:13nibbsis it require or :require?
04:22hiredmandepends where you use it
04:22hiredmanin (ns ...) it is :require
04:26nibbscompojure.jar in C:/clojure/compojure.jar
04:26nibbshow do I then import it from the repl?
04:34nibbsuser=> (use 'compojure.http)
04:34nibbsjava.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0)
04:35hiredmanuh
04:35hiredmanlast I checked compojure was more than a single jar
04:36nibbsi pulled from github, or cloned to be exact
04:36nibbs+jetty
04:36nibbsuser=> (use 'compojure.jetty)
04:36nibbsjava.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest (NO_SOURCE_FILE:0)
04:36nibbsu
04:37nibbswtf they are there
04:37hiredmanare the jars in your classpath?
04:38nibbsyes
04:39hiredmanare you sure?
04:42nibbshmm now require worked'
04:42nibbs(require '[compojure.html :as html])
04:42nibbshow do I require several different ones?
04:46hiredman(doc require)
04:46clojurebotLoads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents define a library of
04:46nibbsworks:
04:46nibbs(require '[compojure.html :as html])
04:46nibbsdoesnt work:
04:46nibbs(require '[compojure.jetty :as jetty])
04:47nibbs(require '[compojure :as cpj])
04:58nibbscome on someone?
04:59nibbs(require '[compojure.validation :as val])
04:59nibbsvalidation is a dir
04:59nibbshow do i import a .clj file?
04:59nibbscompojure is a dir with 2 dirs a nd a bunch of .clj files
04:59nibbsi can import the dirs but how the rest?
05:00nibbsand how do I import seevral names ?
05:00nibbs(require '[compojure.html :as html])
05:00nibbs(require '[compojure.validation :as val])
05:00nibbshow do I merge them?
05:14nibbsjava.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest (NO_SOURCE_FILE:0)
05:15nibbs(import '(org.mortbay.jetty Server))
05:15nibbswtf it IS there
05:33nibbswho created compojure?
05:38nibbs(import '(org.mortbay.jetty Server))
05:38nibbsthat is the stuff not working it seems
05:38nibbsbut the classpath is correct goooood
05:40nibbsah
05:41nibbsweeeee!
06:18nibbswho created compojure? i have some comments
06:19nibbsit seems great
06:19nibbsbut the example could use require instead of use and thus use the namespace
06:19nibbswould b eeasier to follow the examples then
06:24PuzzlerIs there something like def- which is analogous to defn- to make a private definition?
06:26nibbswhere does GET come form in compojure?
06:46nibbs(def pod-server
06:46nibbs (jetty/http-server {:port 8080}
06:46nibbs "/main" main-servlet))
06:46nibbswhats wrong with that?
06:49StartsWithKnibbs: GET is in compojure.http under "public macros" section
06:51nibbsyeah i found it
06:51nibbsbut i have a problem with jetty/http-server
06:51nibbsi can create it and start it if i leave out "/main"
06:51nibbsabove
06:51nibbsbut then I cant find the site
07:07nibbs(defserver my-server
07:07nibbs {:port 8080}
07:07nibbs "/*" my-main-servlet
07:07nibbs "/other/*" another-servlet
07:07nibbs ...))
07:07nibbsthats the example in compojure
07:07nibbsbut it doesnt work...
07:11arbscht_nibbs: how does it fail?
07:12nibbsHTTP ERROR: 404
07:12nibbsNOT_FOUND
07:12nibbsRequestURI=/main
07:12nibbsPowered by Jetty://
07:12nibbsi will aste
07:12nibbspaste
07:13nibbshttp://paste.lisp.org/display/72999
07:14nibbs(jetty/http-server {:port 8080}
07:14nibbs {"/*" main-servlet}))
07:14nibbsi tried that, is that correct?
07:14arbscht_that is not like the example
07:14nibbsbecause then in contstucts correctly but stioll doesnt show up
07:15nibbsin / or /main
07:15nibbsi tried as example
07:15nibbsthen i get error no mathcin ctor
07:17nibbsthe sevrer starts obv
07:17nibbsbut doesnt serv correctly
07:20nibbsanyone with an example of a working compojure-example?
07:20arbscht_nibbs: http-server and defserver expect routes/servlets as arguments, not in a map
07:21arbscht_try something like this: (defserver pod-server {:port 8080} "/*" main-servlet)
07:22nibbslike i said i get:
07:23nibbsuser=> 2009-01-03 13:21:08.159::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
07:23nibbsjava.lang.IllegalArgumentException: No matching ctor found for class org.mortbay.jetty.servlet.ServletHolder (web.clj:45)
07:23nibbsu
07:23nibbswhen using that form
07:24arbscht_nibbs: your main-servlet is a function, not a servlet, too
07:26arbscht_nibbs: also, to make it easier, do something like this at the start: (ns nibbs (:use (compojure http jetty html))
07:26arbscht_you won't need to qualify symbols like http/defservlet then
07:27nibbsI hate use
07:27nibbsI want the package/function deal
07:27arbscht_makes for hard reading
07:27nibbsnah the opposite, you see where stuff comes from
07:28nibbsbut basically i need to change main-servlet?
07:28nibbsor just pass it?
07:29arbscht_see how the servlet is defined in the example
07:29arbscht_it isn't wrapped in a function
07:32nibbsah see
07:32nibbsnow i get another error but progress at least :)
07:34nibbshttp://hpaste.org/13568
07:34nibbslissppaste doesnt work
07:36arbscht_what are you server and servlet definitions now?
07:36arbscht_your
07:37nibbshttp://hpaste.org/13569
07:39arbscht_try setting your server pattern to "/*", to dispatch podly-servlet. iirc servlet routes are relative to the * in the server definition
07:40nibbsbooya!
07:40nibbscool
07:40nibbsso much thanks youll have thanks for the rest of youe life!
07:41arbscht_heh, np :)
07:42PuzzlerIf you want to mark a multimethod as private, do you just annotate the defmulti with a private meta, or do you also have to mark all the methods?
07:42leafwPuzzler: the methods are accessible on dispatch from the defmulti, so I guess one needs to set defmulti as private only.
07:48nibbsso Compojure is great to organize a site logically but let's say I want to do the html statically, how can I call a specific site like main.html?
07:53arbscht_nibbs: I don't know if this is the best way, but you can use http/serve-file
08:05nibbsis there no decent application or program for laying out websites? doing statically feels so 95...
08:22leafwin clojure/core.clj, in the definition of =, there are a few interesting meta tags that I know nothing about
08:23leafwcan anybody explain what the :inline does? And the :tag Boolean?
08:23leafwis the :tab the return type?
08:23leafwthe :inline-arities is even more mysterious
08:23kotarak:tag Boolean is information for the Compiler. So that it can avoid reflection.
08:24leafwkotarak: for the return type, I assume.
08:25kotarakI think so, yes.
08:25leafwthe :inline is also present in (defn compare ... and it looks like its repeating the whole function as a list, like for an eval or a defmacro.
08:25kotarakThe :inline stuff is also a hint, that the compiler can use the code instead of a function call.
08:26leafwbut that "hint" is a function on itself -- although for =, it's a java method call.
08:26leafwoh I see, for 'compare' as well. Replace it with a java method call.
08:26kotarakI guess it's actually a macro.
08:26leafw:inline (fn [x y] `(. clojure.lang.Util equal ~x ~y))
08:26kotarakThe the compiled code contains the code directly instead of a function call to =.
08:27kotarakLooks macroistic, no?
08:27leafwyes and no
08:27leafwits still a fn with 2 args
08:27leafwas if it was for an eval, or a macro as you say
08:27leafwhum, it's a fn that returns the macro code, kind of thing.
08:27kotarakA macro is nothing different then a function. It's just called at compile time.
08:28leafwthen that's what it may be
08:28leafwand the :inline-arity?
08:28kotarakMaybe, that only the named arities are inlined?
08:28leafwis it perhaps the method to choose from the 20+ methods present in IFn ?
08:28leafwby the number of args?
08:28leafwit's a bit cryptic, but it makes kind of sense
08:29kotarakProbably there is no other attribute to distinguis them.
08:29leafwtrue.
08:30nibbs(http/serve-file "C:/" "clojure/progs/pod/front.html")
08:30nibbshow am i supposed to do?
08:30nibbsicant get it to work
08:30nibbscompojure.http/serve-file
08:30nibbs([path] [root path])
08:44Chouser(doc definline)
08:44clojurebotExperimental - like defmacro, except defines a named function whose body is the expansion, calls to which may be expanded inline as if it were a macro. Cannot be used with variadic (&) args.; arglists ([name & decl])
08:51nibbsah got it working
08:52kotarakcongrats
08:52scodeI have a namespace/code loading issue, and I'm obviously missing something. If I (require x.y.z), have p in my CLASSPATH, and p/x/y/z.clj exists - it still just fails with a ClassNotFoundException. If I first (load "/x/y/z.clj") I get the same result.
08:53scodeIn this case I have test/myns.clj containing just (ns test.myns).
08:53scodeAnd my attempted user simply use (require test.myns).
08:53kotarak(require 'x.y.z) note the quite
08:53kotarakquote
08:54scodekotarak: When I do that, it goes looking for test/myns/myns.clj instead of test/myns.clj.
08:54kotarakThen you are using a really old version.
08:54kotarakHave a look at the december release
08:54scodeOh ;)
08:54scodeThanks.
08:55kotarakhere a pointer: http://code.google.com/p/clojure/downloads/list
08:55scodeYeah no problem, I'm maintaining the freebsd port anyway. Just hadn't got the latest tree on this machine.
08:55scodeI had missed that changes to this were recently done.
08:56scodeThat did it, thanks!
08:57kotaraknp :)
09:09nibbswhen I have a HTML file and a CSS file with the layout, how do I call that file? like should I open the html-file still? and how does it know where to look for the css-file?
09:13nibbsis there no documentation-system for Clojure? I started writing one, perhaps I should finish it. like: (doc-gen "C:/clojure/programs/hmm.clj") -> hmm.html
09:13nibbswhich has function-names and their arguments and metadata
09:14Chousernibbs: there's something that produces http://clojure.org/api but that is wiki markup not html, and I don't think the code is available.
09:14kotarakI mostly use (doc), anyway.
09:14nibbssure but sometimes you want to overlook a whole package
09:15kotarakyes
09:22Chousukethere was some other place with documentation too
09:23Chousukeapparently generated from the docstrings etc.
09:23Chousukeit was posted on the google group some time ago, but I don't remember the details :/
09:25kotarakhttp://d2nbqsesuabw8o.cloudfront.net/tmp/doc-1116/index.html
09:25Chousukeright
09:26kotarakHmm.... How does this main thing work again?
09:26Chousukethat's a bit outdated though :P
09:26kotarakI thought a namespace with a main function is turned into a class, which can be called from java.
09:27kotarakjava my.name.space
09:58Chousukekotarak: yeah.
09:59kotarakyeah?
10:00ChousukeI think you just need to defn main
10:12kotarakBut it complains about not finding the class.... (Yes. Everything is in the classpath. (ns .. (:gen-class)) (defn -main ...) works)
10:16ChousukeI'm looking at clojure.main and it only defns a "main" :/ I wonder what it does differently.
10:17kotarakno clue...
10:53nibbsanyone good with html? http://hpaste.org/13577 , why doesnt that generate the stylized page? must i have the complete path to front.css?
10:57karmazillathe body tag should be outside the head tag
10:58karmazillaand the meta, title and style should be inside head
10:58scode /na
10:58scodeOops, soryr.
11:01duck1123does anyone know if clojure needs any special permissions for classloading?
11:02Chouserit uses its own dynamic classloader, which interferes with applet containters for example
11:03nibbskarmazilla: "and the meta, title and style should be inside head", how do you mean? there is no head-tag in the css-file, should i add one? or do you mean inside <!-- ?
11:03duck1123I'm getting a permission denied exception from Tomcat after switching OS's to Ubuntu
11:04duck1123lisppaste doesn't seem to be working for me
11:04Chousukenibbs: the tags
11:04Chousukenibbs: meta, title and style are children of head
11:05nibbsChousuke: ok but are they in the wrong document then? should they be in.html?
11:05Chousukeyou have the tags in the css file?
11:06Chousukea css file is not supposed to contain HYML tags.
11:06ChousukeHTML*
11:06Chousukejust the CSS
11:07Chousukeyou don't even need <style> with a separate CSS file :)
11:08nibbsI dont know why title is in .css, doesnt make snese
11:09nibbshttp://hpaste.org/13577
11:09nibbsthose 2 are separate files
11:10RSchulzYour <body> element is inside your <head> element.
11:10RSchulzBody has to come _after_ head.
11:10Chousuke http://hpaste.org/13577#a1
11:11ChousukeI fixed it.. I think.
11:11ChousukeI'm not sure about the type attribute for link
11:11Chousukebut something at the back of my consciousness kept telling me link tags need one :P
11:12RSchulzI usually recommend using XHTML, unless it's just some one-off / throw-away kind of thing.
11:12Chousukeyeah
11:13RSchulzSomeone recommended these, but I've yet to see if I think they're very good: http://reference.sitepoint.com/html http://reference.sitepoint.com/css
11:13Chouserthere are people who know and understand html, xml, and http very well that recommend against xhtml.
11:14RSchulzAccording to http://reference.sitepoint.com/html/link you have your <link> element correct.
11:14RSchulz(Whether the href= attribut is correct depends on the layout on your server and how it's presented to the clients, of course.)
11:14RSchulzReally? Why?
11:14ChousukeChouser: I think the problem with xhtml is that any error will halt page rendering.
11:14Chousukeso you can't have user-supplied html
11:15RSchulzThat's pretty much browser-dependent, but who defends incorrect markup?
11:15Chousukebut I think it's still good to write xhtml; you can serve it as HTML.
11:15ChousukeRSchulz: no, the xhtml standard requires that you stop if there is an error.
11:15ChousukeRSchulz: many sites depend on user-supplied markup.
11:15RSchulzUser-supplied content sounds like an invitation to mischief and XSS attacks...
11:16ChousukeI'd still write things like page templates in xhtml.
11:16RSchulzIf there's anyone here who's attending the DC study group at 1:00 this afternoon, do you know if there's WiFi at that venue?
11:19duck1123It's usually a good idea to run any user-supplied markup through a sanitation algorithm anyway. Well-formedness checks can easily be part of it.
11:19nibbshmm it works when just doubleclicking the front.html but it doesnt work when I do http/serve-file from compojure, any ideas?
11:20StartsWithKnibbs: compojure uses jetty?
11:20StartsWithKif so, did you configure your mime types?
11:21nibbsisnt there some click-and-drag layout-program for html? i think it nis insane to do it statically...
11:22nibbsStartsWithK: 1. yes 2. no. what are those and how do I do that?
11:22duck1123nibbs: There are, but part of the EULA, you have to give up your soul
11:22nibbslol
11:23duck1123but if you're looking for a good XML editor, I used to love Oxygen
11:23nibbsi was hoping weebly would get more advanced but it seems to stay at noob-level(which i am but i need more advanced stuff)
11:23duck1123I haven't used it in a while as I'm now 100% emacs, but it has some nice layout features
11:24StartsWithKnibbs: http://is.gd/etUU you should add .html (just "html") extension for "text/html" in your server config
11:25StartsWithKso when you serv static files with ResourceHandler wrap him in ContextHandler set your ContextPath ResourceBase and MimeTypes
11:27duck1123compojure should handle the setting of mimetypes for you
11:28nibbsyeah im not messing with contexthandler contextpath etc at all
11:29StartsWithKi'm looking at serve-file and yes, it dosn't use ResourceHandler for static files, it should :)
11:30StartsWithKi guess when you should return then [{"Content-Type" "text/html"} (serv-file your-file)] then from your controller
11:30StartsWithK(i don't use compojure just so you know, only jetty)
11:30nibbsok
11:31nibbsperhaps it is easier to use directly?
11:31duck1123I use compojure, but not with Jetty
11:31nibbsi dont have a controller
11:31nibbsduck1123: and how do you do with this then?
11:32StartsWithKcontroller/servlet/view i don't know how compjure calls it
11:33RSchulzIs Compojure basedon on an MVC architecture?
11:33duck1123you need to create you own controller for your defservlet
11:33duck1123RSchulz: it doesn't need to be, but it lends itself to that style easily
11:34RSchulzWhere is it hosted?
11:34RSchulzThe sources, that is.
11:34duck1123clojurebot: compojure?
11:34clojurebotcompojure is http://github.com/weavejester/compojure/tree/master
11:34RSchulzThanks.
11:35duck1123when it first started, it was a whole framework like rails, now it's just the library
11:35RSchulzThank you, clojurebot
11:35duck1123clojurebot: botsnack
11:35clojurebotthanks; that was delicious. (nom nom nom)
11:35RSchulzIt's _less_ than it once was??
11:35RSchulzRight, right. botsnak. I should have remembered that.
11:35duck1123less is sometimes more
11:35RSchulzSure, but has it lost functionality??
11:35StartsWithKthere is no sql/orm in compojure, was it there before?
11:36duck1123not really, you just have to make your own folders
11:36duck1123but it means that you can do it however you want
11:36nibbsduck1123: what class is this controller thou speak of?
11:36duck1123I really recommend following the servlet api guidelines
11:37duck1123nibbs: for instance, I have a net.mycyclopedia.controller that has just my defservlet and all the path locations
11:37nibbsyeah I noticed that before there was a lot of fodler socming with it, boot app etc. kind of prefer this, it doesnt obfuscate. just small and nice
11:38duck1123that's not entirely true, as I am now using gen-class to create a class for Tomcat to pick up
11:38RSchulzLau_of_DK (not here at the moment) is working on an SQL access library for Clojure. Search for ClojureQL.
11:38duck1123clojurebot: clojureql?
11:38clojurebotclojureql is http://github.com/Lau-of-DK/clojureql/tree/master
11:38StartsWithKthat will be cool when finished, its on github?
11:38RSchulzThat bot is quite the know-it-all, isn't it??
11:39duck1123if it didn't know it, I was going to teach it
11:39StartsWithKcan i just make one remark with clojurebot, it should respond with NOTICE like a good bot
11:39RSchulzhiredman: Clourebot recommendation above
11:40RSchulzStartsWithK: Is that an IRC protocol thing?
11:40StartsWithKyes
11:40StartsWithKprivmsg (normal text) is for humans, notice for bots, becouse you never respond to notice
11:40StartsWithKso there in no chance that two boots get in an loop
11:41StartsWithKbots*
11:41RSchulzI don't know, that could be fun to watch. ... For about 20 seconds.
11:42duck1123anyone here a wiz with java security and classloaders? http://gist.github.com/42897
11:43duck1123I've been getting this error since I switched to ubuntu
11:47scodeHow do you throw/catch exceptions in clojure? I suddenly realized I don't think I've seen that yet and I am unable to find it in the API section. Googling yields some references to contrib libraries that do it. Is there an idiomatic way to do exceptions in Clojure?
11:47RSchulz(doc try)
11:47clojurebotexcusez-moi
11:47RSchulzIt's a special form.
11:48RSchulzIt's documented here: http://clojure.org/special_forms
11:49scodeThanks!
11:50scode(I didn't realize the API section didn't contain everything under the sun :)
11:50RSchulzIt's generated by code from doc strings and special forms don't carry doc strings.
11:51nibbsthe thing is I don't know much about html, css, MVC, webdev in general. so I don't really know what I need to do.
11:52RSchulzPerhaps the place to start is with some tutorial material on those foundation technologies, then?
11:52RSchulzThere's tons out there, books, articles, tutorials, Web sites, etc.
11:52StartsWithKnibbs: http://www.w3schools.com/ for simple html/css tutorials, https://developer.mozilla.org/en/JavaScript#Documentation javascript
11:53RSchulzThat's good content, though I don't really care for their presentation.
11:53RSchulzIt could use the Tom Hickey touch...
11:54StartsWithKand, this may be strange, but to get startet with web dev, and if you know python look at http://www.cherrypy.org/
11:54duck1123There's always the official w3c specs' if you are a masochist
11:54StartsWithKi know its not clojure but on the first page is small working example that shows how easy is to use it
11:57nibbsi already have some woking webapps in webpy
11:57StartsWithKif you don't want to go in the trouble of learing css for layout, maybe framework like http://code.google.com/p/emastic/ or http://code.google.com/p/blueprintcss/ will help you with that
12:05RSchulzBlueprint has relocated: http://www.blueprintcss.org/
12:29nibbsin MVC-layout, would V be the actual html-pages?
12:29nibbsand model the databse functions
12:30nibbsand C the handlerfunctions that takes requests from V to M and back?
12:30Chousukeyeah.
12:35nibbsI should start using namespaces for my own files. i have my programs in C:/clojure/progs, should i add C:/clojure to the classpath then? then refer to them as progs.program ?
12:36RSchulzIn the MVC for Web apps, the Views are often page templates such as JSP / ASP / GSP, etc., since static content is usually not an interesting part of responding to a request.
12:39Chousukenibbs: yeah
12:42RSchulzAnd I'd say it's not quite right to think of requests coming from the View. It comes from the user.
12:42RSchulzIn Web apps, the fact that the result of view rendering is HTML interpreted by a browser which is also the user's agent can lead to some confusion on this point.
13:19dcnstrcthi peoples. just thought I'd report that playing with Clojure + couchdb4j is a lot of fun
13:25Lau_of_DKGood evening everyone
13:26Chousukeevening
13:37MarkVolkmannWhat is the function that returns the name of the current default namespace?
13:41gnuvince*ns*?
13:41MarkVolkmannAh, thanks! So it's a special variable and not a function.
13:42gnuvinceHappy to help :)
13:43gnuvinceIf you want the name, (ns-name *ns*)
13:43gnuvince(doc ns-name)
13:43clojurebotReturns the name of the namespace, a symbol.; arglists ([ns])
13:55fandahello all!
13:56fandai found 2 little bugs
13:56fanda1) this Reference isn't updated according to the menu on the left:
13:56fandahttp://clojure.org/Reference
13:57nibbshonestly, is Clojure on Android possible for real applications or will it be to slow or use to much memory?
13:57fanda2) new files added in the last Clojure check-ins don't have Eclipse licence, but CPL
14:00nibbshttp://hpaste.org/13579
14:00gnuvincenibbs: why would it be significantly slower than Java?
14:00nibbscant I just force-push it?
14:00nibbsgnuvince: runtime type-checking
14:02gnuvincenibbs: I don't imagine it would have that big of an impact
14:02PuzzlerGood morning.
14:03PuzzlerHey, last night I worked on some code for contrib. I've already sent in a contributor agreement. What's the process for submitting code? Do I just post to to the clojure google group as an attachment?
14:06nibbsin html/page_functions: (defn include-css
14:07nibbsdoes that sovle what we talked about before perhaps?
14:07gnuvincePuzzler: I think Rich would prefer you add the code to the Google Code page now
14:07gnuvinceI seem to recall reading something like that
14:12nibbshow do I import several : (:require (compojure [html :as html])) into one?
14:13nibbs(:require (compojure [html :as html http :as http])) etc
14:33Lau_of_DKChousuke: Is your version of Clojurebot in action ?
14:34ChousukeLau_of_DK: ask hiredman, he's the one running clojurebot
14:34Lau_of_DKOh, I thought you usurped for some reason
14:35ChousukeI just thought it would be fun to play with it some and ended up making something that might be easier to work with than the earlies clojurebot.
14:35Chousukeearlier*
14:35Lau_of_DKk
14:41ChousukeI was supposed to poke it some more today, but instead I spent the whole day doing nothing.
14:41Chousukewhich is a good way to spend a day, sometimes.
14:42Lau_of_DKThats true
14:42Lau_of_DKWait...
14:42Lau_of_DKIm uncertain of my answer, I'll have to think it over
14:45Lau_of_DKYes a day of rest is good, once a week :)
15:44hiredmanclojurebot: latest?
15:44clojurebotlatest is 1192
15:45hiredmanhmmm
15:45hiredmanthat is incorrect
15:45duck1123bad clojurebot
15:46Chousukehiredman: is it v2? :/
15:46hiredmanno
15:46hiredmanI guess I may as well do that now
15:48Chousukebackup the brain files :P
15:48durkabraaaiiinnnsss
15:49durkakotarak: feature request: check-completeness on \ef
15:58hiredmanhere goes
15:58clojurebotsvn rev 1193; Added uniform metadata handling for atoms/refs/agents/vars/namespaces Note - breaking change for agent/ref when supplying validator - validator must be passed using :validator option Added :validator and :meta options to agent/ref/atom Added alter-meta! and reset-meta! for reference types renamed set-validator to set-validator! Validators now can simply return false, or throw Refactoring, added IMeta, IRefer
15:58clojurebotsvn rev 1194; Added watcher support for agents/atoms/refs/vars Watchers must be agents (add-watcher reference :send/:send-off an-agent an-action)
15:58clojurebotsvn rev 1195; fixed typo in add-watcher docs, explained var watchers
15:58hiredmanclojurebot: how much do you know?
15:58clojurebotI know 115 things
16:00hiredman,(System/getProperty "java.class.path")
16:00hiredmanhmmm
16:01hiredmanthat will need fixing
16:01Lau_of_DKhiredman: Does it still fall for the ol' loop/recur trick ?
16:02hiredmanit kills running code after 10 seconds
16:02hiredmanor it does when the evaluating is working
16:04duck1123hiredman: have you locked it down so that no one can execute scripts on your host?
16:05duck1123I've always wondered if java could be locked down enough that it's somewhat ok to have an exposed repl
16:07Chousuke,(+ 1 1)
16:07clojurebot2
16:07hiredmanhmmm
16:07hiredman,(println "foo")
16:07clojurebotfoo
16:07Chousukehiredman: System/getProperty is not allowed in a sandbox
16:07hiredman,(System/getProperty "java.class.path")
16:07clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read) (NO_SOURCE_FILE:0)
16:07Chousukeright.
16:07hiredmanyeah, but i was looking for that exception
16:07Chousukewhat was wrong with it though
16:07hiredmanI know what it is
16:08hiredmanI run it in a jvm with a very low memory ceiling
16:08hiredmanso it needs a few minutes after start up to clear things up, or starting new threads fails
16:08Lau_of_DK,(loop [] (recur))
16:08Chousukemaybe the exceptions should be trimmed a bit
16:09clojurebotExecution Timed Out
16:09Lau_of_DK,(println "still here")
16:09clojurebotstill here
16:09Lau_of_DKThats cool
16:12Puzzlerhow long does it take before it times out?
16:12Chousuke10 seconds.
16:12Chousukeshould make that configurable.
16:12Chousukeit is now, but it's a global variable instead of a value in the property map :/
16:18kotarakdurka: Ok. Noted. :)
16:19kotarakgeez. a second too late.
16:33fffejis there an alternative syntax I've missed for creating structures? e.g. if I do (defstruct foo :a :b :c) do I have to do (struct foo 1 2 3) to initialize it or is there a short-hand I've missed?
16:34Chousukeare you sure you need a struct though?
16:34Chousukeyou could just use a map. :)
16:34Chousukebut no, I'm not aware of any shorthand.
16:34fffejtrue - it's to represent a point in 3D space
16:34pdfffej: there's also (struct-map foo :a 1)
16:34Chousukefffej: maybe a vector then?
16:34fffejpd: that also feels quite clunky, I was hoping for something like foo-create
16:35fffeji could use a vector, but i'm pretty sure i'm only going to need 3 dimensions :)
16:35Chousukearen't structs just maps though?
16:36pdyes
16:36kotarakstructs are maps with some optimisation for the keys
16:37fffejwhat would be the idiomatic way of representing a point in Clojure? Am I barking up the wrong tree with struct?
16:37ChouserThere's a patch floating around to let you say (foo 1 2 3) instead of (struct foo 1 2 3), but rhickey has rejected it (at least temporarily) because I think he has bigger plans for struct maps.
16:37Chousukefffej: perhaps a map is fine
16:37Chousukefffej: it allows you to do (:x point) :)
16:38fffejchousuke: true, that's what i'm doing with the struct though
16:38Chousukeyeah, I guess it's fine for your use then.
16:38fffejchouser: bigger plans are good - Lisp's structs are richer (for example, couldn't find a way of including a struct within a struct)
16:38Chousukefffej: you can write a macro to create the foo-create for you
16:38Chouserfor a point, I'd use a struct-map or a vector.
16:39ChouserChousuke: or a function
16:39fffejchousuke: true, I was hoping that already existed in some corner of Clojure I hadn't visited yet - I'll stick with my (struct point 1 2 3) for now and see what the future brings
16:39ChousukeChouser: that wouldn't def it though?
16:40Chouserfffej: you can nest any kind of collection inside any other collection, including structs in structs
16:40fffejchouser: what's the syntax for that?
16:40Chousukefffej: (struct point 1 2 3) is as long as (create-point 1 2 3) anyway.
16:40ChouserChousuke: sorry, you're right -- I misread what you were saying. You were another level meta than I. :-)
16:41Chouser{:a 1 :b {:b1 :x :b2 :y} :c 3}
16:41Chouserthat's a map as a value of another map. you can also use maps (or anything else) as keys.
16:42Chousukefffej: or (struct myvec (struct point 1 2 3) (struct point 3 2 1)) if you want all structs :P
16:42fffejchouser: but what about with a defstruct, like with lisp I'd do something like (defstruct (sphere (:include point) radius))
16:43Chousukefffej: a struct is in clojure is a map that is guaranteed to contain some keys
16:43Chousukethe values are irrelevant.
16:44fffejI'm probably saying it badly - if I have a set of known keys in one struct, how do I put them in another without repeating the keys?
16:44ChousukeI don't think you can do that without some macros :/
16:46fffejchousuke: thanks :) I just wanted to make sure I wasn't missing anything, and it looks like I'm not
16:46Chousukeremember that you can add keys to a struct instance, just like any other map
16:46Chousukeor actually
16:46Chousukethat's wrong; since the result will be a different instance :P
16:49fffeji put the code in question at http://paste.lisp.org/display/73029, I'd appreciate any thoughts on how I could make it clearer. It's just a port of some ray tracing code from Ansi Common Lisp (next on the list is paralellizing it with pmap)
16:55Chousukefffej: you could add a higher-order function "point-op" that takes an [op & points] and returns (struct point (apply op (map :x points)) (apply op (map :y points)) (apply op (map :z points)))
16:55Chousukefffej: dunno what that does to speed, but it might make it clearer :)
16:56fffejchousuke: thanks, clearer is good. I was going to use pmap and map the ray-trace function between different width and height (e.g. divide it into 2x2 images and compute them at the same time.
16:59Lau_of_DKHas anyone fixed some type of pretty printing for clojure yet, or will I have to do it myself?
17:00ChousukeI think Chouser was working on it at some point.
17:01Lau_of_DKGood
17:01Lau_of_DKChouser: I need it soon, can you mail it to me?
17:01Chousuke:D
17:01Chousukeyou phrased that wrong.
17:01Chousukeyou should've said "pls mail me the codes"
17:03RaynesRayne wants a Clojure eclipse plugin.
17:05kotarakIsn't it called clojure-dev?
17:06Lau_of_DKRaynes: Ever heard of Emacs?
17:06ChouserLau_of_DK: on the google group.
17:06RaynesLau_of_DK: Emacs doesn't cut it for JVM languages for me.
17:07Lau_of_DKRaynes: Then you havent configured it correctly
17:07kotarakI think clojure-dev is an Eclipse plugin. But I'm not sure about how far it is already.
17:08Lau_of_DK(which actually is the answer for everything where you find Emacs insufficient)
17:08RaynesLau_of_DK: I configured it fine, I just don't care to use it for JVM languages.
17:08ChousukeLau_of_DK: indeed
17:08ChousukeLau_of_DK: my complaint about emacs was that it wasn't vim-like enough.
17:08ChousukeLau_of_DK: solved with configuration
17:08RaynesI'd like to note that I use emacs for everything else.
17:08Lau_of_DKChousuke: Yea, Emacs can among other thing, do everything
17:08Chousukeyeah
17:09kotarakgood olde M-x butterfly.
17:09Chousukeit's a platform, kind of like the JVM
17:09Chousukemost people just think it's a bloated editor :/
17:09Lau_of_DKYea, only more extensible
17:09Chousukewell yeah
17:09Lau_of_DKYou can even have fly-make for most languages right there in good ol' emacs
17:09Chousukeand probably not as fast :P
17:09kotarakIt lacks a decent editor, though. (<- the usual joke)
17:09Lau_of_DK(including java-script)
17:10Chousukekotarak: nah, viper is decent.
17:10kotarakLau_of_DK: what's fly-make?
17:10Chousukeincremental compilation?
17:10Lau_of_DKIts where everything you typed is compiled/executed and any errors will be displayed directly
17:11kotarakAh. Like :make in vim.
17:11Lau_of_DKPossibly, but I wouldnt think so
17:17Chousukekotarak: :make is not automatic though.
17:17Chousukekotarak: nor is it as well integrated as flymake
17:18Chousukeintegration with external programs is where vim fails, hard.
17:18Lau_of_DKnor does it support *.*
17:18Lau_of_DKyea kota, big time
17:18Lau_of_DK:))))
17:18Lau_of_DK(just teasing)
17:18Lau_of_DKVim has one thing going for it and thats Gorilla, other than that its abandon-ware
17:19Chousukeeven gorilla shows the fact that vim isn't designed to interface with external components :/
17:19kotarakGorilla is terrible hack. As is the rest of Vim.
17:19kotarakBut Vim is a good hack. :)
17:19Chousukethe editor wars could be solved by implementing a proper vim in elisp
17:20kotarakOr even better: Vijure. :)
17:20Chousukeviper+vimpulse is okay, but some hardcore vim users will probably find it lacking.
17:20Chousukeit's good enough for me though.
17:21kotarakIn Vim I know where to look when I have a problem.
17:21kotarakFor emacs I have to learn that again...
17:21kotarakBig obstacle.
17:21ChousukeI guess
17:21ChousukeI never got that deep into vim
17:21Lau_of_DKI think getting started with Emacs, using Viper+vimpulse, is a bit like switching from your old Fiat to a brand new Mercedes, and insisting on moving your seats and steering wheel from the fiat to the Mercedes, but hey thats just me
17:22Lau_of_DKkotarak: C-h t
17:22ChousukeLau_of_DK: but the seats and the wheel are infinitely more comfortable.
17:22Lau_of_DKNo theyre not, you just know them
17:22Chousukeno, really.
17:22kotarakIt's more like going from a Fiat to a Renault....
17:22Lau_of_DKHey kotarak, no need to bring the french into this
17:23Lau_of_DKAnyway, I think this analogy talk got a little out of hand, sorry
17:23ChousukeI consider the vim modal interface superior to emacs' bag of shortcuts
17:23kotarakWhen I look at the SLIME threads, I think SLIME isn't less hacky than Gorilla... at least for CLojure.
17:23Chousukebecause vim is actually learnable; something that emacs shortcuts lack.
17:23Chousukeer, no. not learnable: "discoverable"
17:24Lau_of_DKChousuke: Ever tried C-h b ?
17:24Chousukewhat does that do?
17:24Lau_of_DKShows you all the short-cuts in a given mode
17:24Lau_of_DKPretty discoverable if you ask me
17:25kotarakI tried to turn on some sane highlighting in emacs. And it took me an afternoon before I gave up. The things in the help didn't work. But more likely I'm just too stupid to use emacs.
17:25Chousukeah, but in vim you can apply previously learned and discover things without even looking at help
17:25Chousukelike I did with d% :)
17:27ChousukeI knew d, which is delete, and %, which means "matching paren/bracket/whatever" and d% does exactly what you'd expect.
17:27kotarakThe basic idea of vi is simple: operator + motion.
17:27kotarakOr range + command.
17:27Chousukeyeah
17:29Chousukefor me, viper is like the perfect compromis
17:29Chousukee
17:30ChousukeI can do most things vim can do, and have access to emacs when needed :/
17:31kotarakI like the rendering of Vim more than Emacs. Don't know why I have this feeling. Just, somehow, nicer...
17:31Chousukerendering?
17:31kotarakDisplay of font and stuff.
17:32ChousukeI use vim from a terminal. :/
17:32kotarakWhen I compare my MacVim with Aquamacs the Vim feels somehow smoother. I don't know. Really. Can't explain.
17:32kotarakI used to, but not anymore.
17:32kotarakWas too much pain of Windows.
17:32Chousukemacvim is a bit more maclike I guess.
17:32kotaraks/of/on
17:32kotarakProbably. Has some nice integration.
17:33Chousukeaquamacs preferences still just does M-x customize :P
17:34Chousukebut any rendering problems are definitely solvable with it :)
17:34ChousukeI don't even know how many configuration variables emacs has, but I'd guess it goes past a thousand.
17:38Lau_of_DKkotarak: Try Emacs23, font rendering is VASTLY improved
17:46chrisnHey Lau, are you willing to try out my demo again?
17:47RaynesI think Lau_of_DK is too addicted to Emacs. I suggest editor rehab :>
17:47Lau_of_DKchrisn: I absolutely am - But Im headed to bed now, if you have something specific you want me to try out can you send me an email with instructions? If its just git pull and run, then I can do it tomorrow and get back to you ?
17:47chrisngit pull, build, ./run_wave_demo
17:47Lau_of_DK<Raynes> I think Lau_of_DK <#Garbage not received> hab :>
17:47Lau_of_DK??
17:48Lau_of_DK ./run_wave_demo
17:48Lau_of_DK./run_wave_demo: 5: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java: not found
17:48Lau_of_DK
17:48chrisnah
17:48Lau_of_DKIve got 2 minz, what do I need to modify ?
17:48chrisnI have to do that to get java 6 to work
17:49chrisnon my mac
17:49chrisnedit the script and just try java.
17:49Lau_of_DKk
17:49chrisnwe will see how good opengl support you have on your computer
17:49Lau_of_DKoh man thats a nasty script
17:50chrisnI don't trust classpath
17:50Lau_of_DKhehe, I can tell
17:52Lau_of_DKchrisn: Can we make a deal. For tomorrow you make a working jar file, then I'll pull, type java -jar lambi.jar, and thats it? :)
17:52Lau_of_DKI cant reconstruct that entire script in 2 minutes here
17:52chrisnwhat didn't work?
17:53chrisnok, we can try that.
17:53Lau_of_DKCool, sorry it didnt work, have a good night
17:53chrisnDo you have mydoggy window toolkit?
17:53chrisnk lates.
17:53Lau_of_DKno
17:53chrisnk
17:54chrisnWould it be a good idea to have a git repository that contains versions of clojure, clojure-swank, clojure-contrib, and slime that are all known to work with each other?
17:59Chouserthe flow of new code and patches from the google group are becoming overwhelming as well.
18:49dreishAm I correct in saying that clojure.contrib.sql/transaction is a classic example of what not to do with macros?
18:51kotarakdreish: it's not a shiny example. It should be a function transaction* taking a function and a helper macro transaction which basically looks `(transaction* (fn [] ~@body))
18:51dreishMy thought exactly.
18:51chrisnwhy the that design?
18:51dreishI'll freely admit I didn't understand this three days ago. And someone wrote this more than three days ago. :)
18:52chrisnwhy not just the macro?
18:52kotarakBecause it's not necessary.
18:52dreishchrisn: As a macro that spits out 18 lines of code, every time you call it, you're rubberstamping the same 18 lines of code all of your program.
18:52chrisnah I see
18:52chrisnA lot of macros aren't necessary.
18:52dreishAs a single function, the JVM can profile it, optimize it, and inline it where needed and where appropriate.
18:53kotarakthe macro plus function macro* is a usual pattern
18:54kotarakchrisn: then they should be written as functions.
18:54chrisnwell, couldn't you say the same about with-open?
18:54kotarakThis is mostly convenience, that you don't have to type (fn [] ...) all over the place, I guess.
18:54chrisninstead of a macro, it could take a function that takes one arguments.
18:55chrisnargument
18:55dreishA lot of macros just do things like allowing the user to avoid having to write the (fn [] ...) themselves, which is nice. Only a handful really need to be very long, and they're using doing something very complicated.
18:55kotarakWhere macros are really necessary are things like if, cond or or.
18:55kotarakWhenever we have to control the evaluation.
18:55chrisnor when you need to call set! a million times because of the time of gridbagconstraints
18:55dreishOr for, or let destructuring ...
18:55chrisnthen I wrote sets!
18:56chrisnthe design. Jesus I can't type today.
18:56chrisnI see now.
18:56karmazillafn is a macro :)
18:57kotarakit needs to control the evaluation of the argument vector.
18:59chrisnI got used to F# and ML where higher level functions and the ease of declaring new functions made a lot of macros unnecessary
18:59chrisnclojure's #( syntax also makes a lot of macros unnecessary
19:00chrisn(fn [ a b c] is a little wordy
19:00dreishchrisn: Sometimes it's nice to avoid the #(), though, because your caller might want a #() inside that, and #() doesn't nest.
19:01chrisntrue. I found that out the old fasioned way
19:01chrisnfashioned
19:01chrisnI am done
19:01chrisnThanks!
19:01hiredman#() disapears at read time, doesn it?
19:01kotarakyep. It is translated into a (fn....)
19:02dreish,'#()
19:02dreishWell, cjbot should be saying (fn* [] ())
19:02hiredmanso, uh, what dreish said doesn't matter
19:03hiredman,(identity '#())
19:03clojurebot(fn* [] ())
19:03dreishhiredman: What, the part about how they don't nest?
19:04hiredmanyeah, because by the time you macro is runing #() should all have been read and expanded?
19:04hiredmanyour
19:04dreishhiredman: I was referring to chrisn's statement that macros are unnecessary because you can just require callers to pass you a lambda, which only costs an extra # keystroke.
19:05dreishThat's fine except then you can't use other #()s within it.
19:05hiredmanok
19:05hiredmanas long as no one on the internet is being wrong
19:06hiredmanthe non-nesting #() bites me all the time
19:06dreishYo dawg, we heard you liked lambdas ... etc.
19:08hiredmanclojurebot: haskell?
19:08clojurebotYo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you compute.
19:08karmazillatoo much sugar will give you diabetes. so not trying to nest #() is better for your health
19:08kotarakclojurebot: #() is not a replacement for fn
19:08clojurebotRoger.
19:09duck1123karmazilla: thankfully, that's not an issue
19:09hiredmanclojurebot's sandbox code is full of thunks and thunk passing
19:17Chousukebecause it's a very convenient way to wrap stuff around code :)
19:51chrisnHow do you guys setup your ant clojure compile task?
19:51chrisnDo you use the CLASSPATH environment variable, or do you set it all manually?
19:52ChouserI just run 'ant' -- nothing in my CLASSPATH env var
19:53chrisnThen is your ant build.xml hardwired to for each target?
19:54Chouseroh, you're talking about building things other than clojure itself? yeah, I don't do that. :-)
19:54chrisnI guess it seems reduntant for me to specify both clojure in my CLASSPATH and also in my ant task
19:54chrisnyep
20:01chrisnyou can do -Dclasspath=$CLASSPATH in your ant invocation and then use that variable inside ant
20:01chrisnThen I have specified where clojure is only once
20:01chrisnfinally
20:03chrisn:Chouser did you get your slime/clojure/swank setup worked out?
20:03chrisnI want to update to the latest clojure and contrib but I am a little worried about it
20:16ChouserI don't use those either -- perhaps you mean to ask Chousuke (I know it's confusing -- he apologizes)
20:17chrisnI decided to risk it
20:17chrisnNow my compilation steps just skip over the clj files
20:17chrisnbut not certain my build setup isn't messed up
20:20chrisnit was my build setup
20:21chrisnWould you happen to know a command from java that will use the system-specific command to open up a file?
20:21chrisnOn mac, for instance, you call open
20:21chrisnI am not certain what you use on linux or windows.
20:23pjb3When using proxy to extend a class, how do you define a constructor?
20:24Chouserchrisn: I don't appear to be doing you much good -- I'm not even sure what you're talking about. Not 'slurp' I suppose?
20:24chrisnno, I mean in the editor appropriate for that file :)>
20:24chrisnfor instance, I have glslv and glslf files bound to the mac text editor
20:24RSchulzYo, pjb3, you met my friend Bruce earlier today?
20:24Chouserpjb3: proxy returns a new instance, so there's no need or opportunity to provide a constructor
20:24chrisnfrom the command line, if I call "open wave.glslv" it opens them in my text editor
20:25pjb3RSchulz: I did!
20:25Chouserchrisn: ah! but you mean from within java not on the command line?
20:25chrisnyep
20:25RSchulzCool.He's a great guy
20:25chrisnI just don't know java's system calls very well
20:25pjb3RSchulz: Yeah, I think we had a good time
20:25chrisnin C I would might try "system"
20:25Chouserchrisn: sorry, no I don't. :-/ I saw some code that opened a web browser though, if that helps at all...
20:26RSchulzGood. I think between his Java work and his long experience with Lisp, he'd be an asset in the community.
20:26chrisnthat code is in contrib, correct?
20:26chrisnfor javadoc stuff, right?
20:26Chouserchrisn: http://paste.lisp.org/display/61362 perhaps in contrib as well
20:26Chouseroh, no, that's not right
20:26pjb3Chouser: Oh I see, any initialization I would do in a ctor I could just do to the object after proxy returns it
20:27Chouserpjb3: sure
20:27pjb3Except for calling private methods
20:27chrisn:Chouser, what about classes that have to have constructor arguments?
20:27chrisnthis happens all the time in swing, for instance.
20:27Chouserproxy lets you pass values to the superclass' constructor
20:28Chouserbut I don't think anything in proxy lets you get to private members of the superclass
20:28Chousernor protected members, I think.
20:29pjb3Chouser: Ok, so hopefully I don't need to do that :)
20:30Chouserpjb3: right. though even in Java I don't think you can get to the private members of your superclass, can you? So protecteds are the only thing different.
20:31pjb3Chouser: yes, put you can define an anonymous class that extends some other class, with a ctor that accesses private things in there
20:31pjb3if that makes an sense
20:31Chouserhm, ok. I know very little Java. Certainly none of this newfangled inline anonymous class stuff.
20:32Chouserchrisn: well, I think I found the code I was looking for, to cause your native browser to open a particular page. ...but it's in elisp. :-P
20:32chrisnI am fine with that
20:33chrisnDoes it shell out, or is it an emacs-specific command
20:33chrisn?
20:33Chouseremacs-specific, I think. Toward the bottom of this page: http://bc.tech.coop/blog/081120.html
20:35chrisnHe is using a swing html pane, it looks like to me.
20:35chrisnNot general to any file
20:41RSchulzpjb3: bsseely_ is among us.
20:42pjb3bsseely_: Welcome!
20:42bsseely_hey!
20:42bsseely_Paul, right?
20:42pjb3bsseely_: Yup
20:42pjb3I'm working on Keith's fahernheit/celsius program
20:42bsseely_cool, making progress?
20:43pjb3Yeah, learning about swing, I haven't really used it much
20:44bsseely_I've used it some
21:09TDSmithhi
21:11TDSmithI've been playing with clojure recently- there are some things I really like about it, but...
21:11TDSmithIt seems like a moving target- a lot of the code snippets I'm finding online don't work with the newest version.
21:12TDSmithThat's natural, with a new language, but I'm wondering if there are some examples that are kept in sync with the newest version?
21:12Chousuke"yes"
21:12Chousukebut if you ask me where, then I can't answer :/
21:12TDSmithI've never been very good at reading docs- I like code samples beter ;)
21:12TDSmithheh
21:12TDSmithOK ;)
21:13Chousukethe documentation is pretty... scattered.
21:13Chousukethe clojure book betas maybe?
21:13arbschtsome code is typically updated quickly, such as compojure and swank-clojure
21:13arbschtand there is clojure itself
21:13TDSmithYeah, well- like I said, I understaznd why that is the case.
21:13Chousukeyeah.
21:13Chousukethough 1.0 shouldn't be too far away
21:14Chousukethings are already stabilising.
21:14arbschtby clojure, I mean clojure-contrib, too
21:14TDSmithCool.. actually I really like what I've seen of it so far.
21:15TDSmithI'm generally more partial to Lisp-2s, but...
21:16TDSmithClojure looks to me like it might turn into a lisp that would be a real alternatice to CL for real work.
21:16RSchulzWhat does a Lisp-2 really get you?
21:17TDSmithHmm- I'm not saying that it's a better design, necessarily- just that I'm more comfortable with it.
21:18bsseely_Lisp-2 has been claimed to be better for macros
21:18RSchulzI think it's more important that symbols be separated from names of storage locations, as Clojure does it.
21:18TDSmithWell, it makes hygiene.. different a least...
21:19RSchulzVive la differance!
21:19TDSmithSure- I
21:19TDSmith'm not really craxcking on lisp-1s...
21:19TDSmithI'm just a lot more used to lisp-2s
21:20ChousukeI don't think clojure macros have hygiene problems.
21:20TDSmithI've never really been able to wrap my head arounf hygienic macros in scheme, though I'll admit that I haven't tried very hard.
21:21ChousukeI don't even know how they work
21:21Chousukeclojure macros look like CL macros, ` is just slightly different :)   
21:22Chousukeand as far as I can tell, it's harder to shoot yourself in the foot than with CL :/
21:22bogoliskHi, I'm not trying to troll, I'm just curious about clojure (well I like functional language). What's the difference between lisp (CL) and clojure?
21:22Chousukein what regard?
21:22RSchulzIsn't it the case that Clojure's syntax quote (backquote) namespace-qualifies the symbols it encountersj part of that?
21:22TDSmithHmm- well I want to be careful in what I say because I have just recently started to look azat clojure but...
21:23bogoliskand what are the advantages of clojure over scheme?
21:23Chousukebogolisk: how about access to a HUGE library of existing code.
21:23TDSmithit did seem to me that the macros work a bit differently than in CL because of the hygiene issue.
21:23TDSmithAnd at first glance I think that, all other things being equal I preferred the CL syntax, but...
21:23bogoliskChousuke: oh, so the main difference is the interaction with java libraries?
21:24Chousukethat's just a bonus.
21:24TDSmiththat's as very small nit to pick.
21:24RSchulzWell... What would you have to do in a Clojure macro to capture a symbol from the environment in which it is appplied?
21:24RSchulzThat's the question, right?
21:24ChousukeRSchulz: you have to do ~' I think
21:25Chousukeit's pretty difficult to accidentally capture symbols :/
21:25RSchulzYes, but that would work only for a symbol given as an argument.
21:25Chousuke'~foo too.
21:25RSchulzPresumably the user of the macro wants that connection, so it's not really "capture," is it?
21:25Chousukewell it's capture, but intentional
21:25Chousukeunintentional capture is the evil thing.
21:26RSchulzPresumably.
21:26ChousukeI can't think of a situation where that happens :/
21:26RSchulzIf you just inadvertently use a symbol in a Clojure macro expansion, it will be qualified to the namespace of the _macro_, not that of its invocation.
21:26RSchulz... Of the macro _definition_, that is.
21:27RSchulzBut CL macros do nothing to protect you from inadvertant capture. That's the whole "hygiene" problem, right?
21:27chrisn:bogolisk I am not sure this answers your question, but I am using clojure because it (and F#) are the only really interesting languages I might be able to use on a daily basis.
21:28chrisnI guess I am just a little burnt on java, c, c++, and c#.
21:28ChousukeRSchulz: I'm not sure.
21:28chrisnI don't feel I could use scheme at work
21:28bogoliskI'm still trying to see where it's different from other Lispies
21:28chrisnah
21:28chrisndifferent question
21:28ChousukeRSchulz: I don't see why a Lisp-2 is any better from a hygiene perspective than a lisp-1
21:28RSchulzChousuke: That's my understanding.
21:28RSchulzNo, that's a separate issue, I think.
21:28chrisnAnd there are uses for un-hygienic macros
21:29chrisnPeople always freak out about hygene. There is always gensym
21:29chrisnit just isn't a huge deal...
21:29Chousukewhat's the point in lisp-2 anyway? /:
21:29RSchulzThe fact that every symbol, no matter how it enters your program, is a potential locus of a binding is a stark contrast with Clojure, at leatst.
21:29Chousukesomeone educate me. I'm ignorant.
21:30TDSmithHmm- but I think that clojure's macros are different from CL's precisely because of that difference- so it must be significant to some degree, mustn't it?
21:30RSchulzbsseely_: Help us out here. You're experienced with Lisp-2s.
21:30ChousukeTDSmith: it's rather significant, yeah.
21:30chrisnYeah, some people really hate unhygienic macros. I personally think they are sometimes pretty cool.
21:30TDSmithI have to admit that I like the Lisp-1 syntax for function invocation.
21:30ChousukeTDSmith: clojure's macros are every bit as powerful as CL's, but you're less likely to accidentally make a badly behaving macro.
21:31TDSmithYeah, I wasn't suggesting they were less powerful.
21:31bsseely_sorry, I haven't been following the thread...
21:31chrisn:Chousuke I am not certain that is true
21:31chrisnfinding my example of crazy non-hygienic macro now
21:32RSchulzWe're trying to untangle the Lisp-1 / Lisp-2 and hygienic / unhygienic macros...
21:32Chousukemacros in clojure don't have to be hygienic, do they?
21:32TDSmithThough I have to admit that being equivalent in power seem like a rather low bar to set- not that I'm suggesting that clojure doesn't clear highher bars than that, of course,
21:32Chousukeyou can capture and introduce all the names you want, it's just not easy to do accidentally.
21:32TDSmithI used to think that syntax wqasn't very important...
21:32RSchulzChousuke: It's pretty hard to unintentionally capture a variable from the invocation environment, isn't it? (In Clojure).
21:33Chousukeyeah
21:33Chousukeit's not too difficult to intentionally do it htough.
21:33chrisnhow do you capture intentionally?
21:33TDSmithAnyway I'm not setting out to criticize Clojure's macros here...
21:33RSchulzIs there more to the "hygiene" issue than that? (Inadvertent variable capture, i.e.)
21:33ChousukeI think you need to use ~'varnametocapture
21:34TDSmithI don't know enough about Clojure to be able to do that.
21:35TDSmithI did just note some cases where the macro facility does seem constrained by the fact that it's a lisp-1.
21:35dreishCan you give an example?
21:35RSchulzActually, I don't think the Lisp-1 / Lisp-2 issues really intersects with the hygienic macros issue. Does it?
21:36TDSmithHmm- well I think I can find a post by Rich Hickey top a mailing list explaining that that's the case...
21:36Chousukesomething like `(let [~'varname 1] stuff) will expand to (let [varname 1] stuff) that would capture a name.
21:36TDSmithYou do have to be a bit more careful about capture in a lisp-1.
21:36RSchulzIs syntax-unquote an inverse of plain quote?
21:36Chousukejust `(let [varname 1]) becomes (clojure.core/let [user/varname 1]) which is an error
21:37Chousukeso you can't really accidentally capture things.
21:37chrisnah. That error made me think it was impossible
21:37chrisnPaul Graham's On Lisp, chapter 14 talks about anaphoric macros
21:37dreishTDSmith: How do you have to be careful about capture in Clojure? It seems to me you have to go out of your way to _get_ variable capture.
21:37chrisnThose rely on capture to work.
21:37TDSmithExactly ;)
21:37Chousukechrisn: anaphoric?
21:38RSchulz"Backward referencing."
21:38Chousukecan you show a small example and I'll try to make a clojure version of it.
21:38chrisnthanks, I would have had to look it up
21:38TDSmithCapture is sometimes useful.
21:38chrisnOn Lisp is free
21:38chrisndownload the pdf, check out chapter 14.
21:38Chousukeyeah, but I don't want to search it right now :D
21:38dreishTDSmith: Useful enough you'd be willing to type ~' where needed?
21:38chrisnok, hold on
21:38TDSmithProbably ;)
21:39dreishWell, there you go. Problem solved.
21:39TDSmithAnyway I didn't claim that it was an issue of great importance...
21:40Chousukeanyway, there's more to clojure than the novel syntax-quote
21:40dreishI think it is pretty important, if you think macros are a good thing. I think Clojure has an excellent solution to the problem.
21:40Chousukethe idea that lists are not the core of lisp is something that should not be forgotten :)
21:40RSchulzMacros? Are they still around?
21:40TDSmithAre macros still around?
21:40chrisnin his example you need to be able to refer to a variable in the macro from code the macro is expanding
21:41TDSmithIs that the question?
21:41RSchulzchrisn: Then that variable should be an argument to the macro invocation.
21:41Chousukechrisn: that is possible.
21:41chrisnno, it is a specially named variable
21:41TDSmithI'm fairly sure that even when I don't write macros I do reference a few occasionally ;)
21:41Chousukechrisn: the proxy macro I think binds "this" to be used in the proxy code.
21:41TDSmithbut maybe I misunderstood you there.
21:42chrisnAh!
21:42chrisnyou are right
21:42chrisnthat would do it
21:43chrisnhttp://paste.lisp.org/display/73035
21:44chrisnI love lisp :).
21:45dreishif-let is similar, but you pick the name.
21:45RSchulz(doc aif)
21:45Chousuke(defmacro aif [condition & body] `(let [~'it condition] ~@body))
21:45Chousukeoops
21:45Chousuke~condition
21:46Chousukeand, er.
21:46dreishNeed an if in there somewhere.
21:46Chousukeadd (if ~'it
21:46RSchulzWait... Is (aif ...) in Clojure?
21:46dreishRSchulz: I don't see it. Closest thing is if-let.
21:46chrisnso the ~' is the magic
21:47dreish(defmacro aif [condition & body] `(if-let [~'it ~condition] ~@body) ; Maybe that would work.
21:47RSchulzchrisn: I think you should paste only things that are self-contained, given Clojure core (and, possibly, Cloure Contrib)'
21:47Chousukechrisn: (aif 2 it) -> 2 :)
21:47RSchulzOtherwise, it's not possible to interpret them.
21:47Chousukein my repl here :P
21:47Chousukelet's see
21:48RSchulzclojurebot: You there?
21:48dreishI think mine works too.
21:48RSchulzClojurebot is off-line!
21:48Chousukeoh boo.
21:48chrisnRShulz: that was an example from On Lisp, I didn't think it was possible on clojure
21:48RSchulzSo is hiredman.
21:48RSchulzWe're alone...
21:48RSchulzDefine "possible!"
21:48ChousukeI wanted to demonstrate that macro with clojurebot
21:49RSchulz(Turing completeness and all...)
21:49Chousukebecause I know magics to define macros with clojurebot!
21:49chrisnwell, literally. I couldn't figure out how to capture a variable without an error
21:49Chousukechrisn: that is a good thing :)
21:49Chousukechrisn: it means it's not likely to happen by accident
21:50chrisnOh, I never did it by accident before ;). I always mean it when I confuse people
21:50RSchulzGreat. Just what we need. The "Obfucated Clojure" contest!
21:50RSchulzAs if it's not hard enough to decipher without the attempt to obfuscate...
21:50Chousukeanyway (defmacro aif [condition & body] `(let [~'it ~condition] (if ~'it ~@body))) works
21:51TDSmithmeh..
21:51TDSmithanyway I wasn't suggesting that a lisp-1 or a lisp-2 was absolutely better.
21:52RSchulzEach are absolutely better than the other.
21:52dreishTDSmith: You're a rare person, then.
21:52ChousukeRight. I don't care about that for now: what does being a lisp-2 get you?
21:52RSchulzAnd the universe shall collapse upon itself.
21:52Chousukeexcept having to use funcall to call functions.
21:52TDSmithwell- I suppose that that is equivalent to what I said...
21:53RSchulzChousuke: _That_ is the question. What's the virtue of a Lisp-2?
21:53TDSmithYeah.. actually my first lisp was scheme (though many people don't accept that as a lisp)...
21:53dreishChouser: I think the biggest advantage is that it's familiar for people who are familiar with Lisp-2.
21:53Chousukeand being able to have functions and variables with the same names. Which I don't consider a good thing.
21:53TDSmithI remember thinking funcall wazs just terrible...
21:54TDSmithBut that was a long time ago ;)
21:54RSchulzAll you need is "apply" and "eval"!
21:54RSchulz(Or so some book cover told me.)
21:54TDSmithHmm...
21:54TDSmithall you need is lambda
21:54dreishI thought you didn't need eval? You can write it in terms of the seven primitives.
21:54RSchulzDefining a thing is not all there is!
21:55RSchulzIt's better to replace one thing with seven? Occam is turning over in his grave!
21:55TDSmithLet him ;)
21:55dreishEven with eval, you'll still need the other seven, so I think that's eight.
21:56Chousukeyou can write everything with lambda alone I guess
21:56Chousukebut that's going to be horrible.
21:56TDSmithThe onluy way to evaluate whetehr or not it is better to replace one thing with seven is to try it.
21:56Chousukeparticularly if you want to do arithmetic :D
21:56dreishLike a Turing machine? Numbers are represented by how many levels of lambda nesting you return?
21:56chrisnhttp://groups.google.com/group/clojure/browse_thread/thread/27912d9dcaec2f24
21:57chrisnIf I had seen this, I never would have talked about anaphorisms
21:57TDSmithExactly- Lisp actually comes from that idea.
21:57karmazillafunctions that implement methods for a gen-class... how do I get at the "this" reference?
21:57TDSmithBut of course...
21:57Chousukeah, that's the thread where I wrote about macros
21:57ChousukeI should re-read what I wrote to refresh my memory :/
21:57Chouserkarmazilla: first arg of each method defn
21:58karmazillaroger
21:58RSchulzChousuke: You're Jarkko?
21:58TDSmithAnyway that's another good reason to ignore arguments about equivalent power...
21:58chrisnChousuke does sound like Jarkko Oranen
21:58chrisn...
21:59ChousukeRSchulz: yeah.
21:59RSchulzWell, then... Make up your mind...
21:59TDSmithAlonzo Church came up with a formalism that is equivalent to.. well, lots of things... well before there were actually computers.
22:00Chousukeanyway
22:00ChousukeI should be sleeping.
22:00RSchulzYeah, well that equivlance is not a reason for us to write in assembly or some other very-low-level language.
22:00TDSmithI agree ;)
22:01TDSmithSyntax matters.
22:01RSchulzI have a hard enough time expressing myself in first-order-logic, which I have to do in my theorem-proving work.
22:01chrisnI am not sure syntax does, but ease of abstraction *definitely* does
22:01Chousukerather than that, the SICP gurus would say that the tools of abstraction matter
22:01RSchulzI consider FOL the assembly of declarative languages.
22:01TDSmithwell- like I said- when I was young I thought syntax was unimportant.. but...
22:01ChousukeASM has rather crappy tools for abstraction
22:01Chousuke... why did I make that an acrony,
22:01Chousukeanyway.
22:02RSchulzSweet dreams!
22:02TDSmithASM has beautiful tools for abstraction...
22:02TDSmiththe best..
22:02Chousukeyeah. good night. or morning.
22:02RSchulzAll of which exist in your mind...
22:02TDSmithit has lousy tools for defining syntax.
22:02RSchulzWell, Chousuke may need sleep, but I need dinner.
22:02chrisnIf you love asm's abstraction systems, check out Factor
22:02RSchulzSee ya' all later.
22:03chrisnIt really does have good abstraction systems; but you are still manipulating the stack so you do a lot of nip dip slip etc.
22:03ChousukeTDSmith: defining syntax is just a tool for abstraction :)
22:04TDSmithSure...
22:04TDSmithIt's _all_ equivalent, after all...
22:05TDSmith\]If you're smart enough you don't need abstraction.
22:05TDSmithUnfortunately people are never smart enough to be able to do without it ;)
22:05chrisnthat is an odd stance.
22:05TDSmithReally?
22:05chrisnlearning works by forming abstractions
22:06chrisnThe ease of creating new abstractions tends to be a limiting factor in learning any non-trivial system
22:06TDSmithHmm- well I'm talking about computation, not learning...
22:06chrisnI know. The thing is, you mind can only handle a fixed number of things at once.
22:06chrisnperiod
22:07ChousukeTDSmith: I mean syntactic abstraction is just another form of abstraction.
22:07chrisnAnd it isn't that high for anyone.
22:07Chousukeand the number of different abstraction tools and how "easy" they are to use determines the power of a language.
22:07chrisnThat is the religion that I subscribe to, yes
22:08chrisnNot sure I could prove it in any substantial way
22:08Chousukethe lisp macro system is an amazingly powerful syntactic abstraction system.
22:08Chousukebut not the only one
22:08Chousukethere's the C preprocessor, for once.
22:08Chousuke-e
22:08Chousukeer
22:08Chousuke-c
22:08Chousukeor C++ templates.
22:08chrisnWell, any compiler is a syntactic abstraction system
22:08chrisna macro is just an extension of a compiler.
22:09Chousukewell, yeah, their "lisp" is just an implementation detail :/
22:09chrisnbingo
22:10ChousukeI like to think that all compilers have a lisp at the core because code represented as a data structure is a kind of a lisp
22:10TDSmithright- your mind can only handle a limited number of things...
22:10TDSmiththat's what I'm saying...
22:10TDSmithabstractions address insufficiencies in human cognition.
22:11chrisnhmm. That is one way to look at it
22:11chrisnMore likely they define human cognition
22:11chrisnclojurebot online?
22:11hiredmanpower outage
22:11TDSmithAt any rate... the argument that things are of "equivalent powere" is ...
22:12TDSmith*power
22:12TDSmithI mean writing code into adress space one byte at a time is just as powerful... trivially.
22:12hiredmannope, the server it runs on is still offline
22:13chrisnyep. And now I see why you said "if you were smart enough..."
22:13TDSmithExactly- I didn't mean you specifically...
22:13chrisnThe other limiting factor is how much can one person type
22:13TDSmithHmm...
22:13chrisnI know (and I knew then, too :) )
22:14TDSmithI think if you were smart enough that would cease to be a limiting factor....
22:14chrisnBecause you would write LISP in assembly.
22:14chrisnAnd then just program in lisp
22:15TDSmithNo- because you would write software that wrote your software for you, and retire to a beach in the caribbean.
22:16chrisnHmm, if you goal is to live your life on a beach you can do that now, but I see what you mean.
22:16TDSmithwell that's a hard phiosophical question... what should we do if we eventually make things that are much higher achievers than we are?
22:17TDSmithBut the point I am making is actually abiut syntax...
22:17chrisnWell, I personally believe that most of the first world has everything materially a human could ever need and they would be better off working on themselves as individuals than producing more shit.
22:17chrisnbut back to syntax...
22:18TDSmithHmm- I have a diferent belief- I believe that human wants are unlimited.
22:18TDSmithbut back to syntax...
22:18chrisnyou can only eat so much.
22:18TDSmithSure.. but my wants are not limited to food.
22:18hiredmanI am an endless gaping maw of desire
22:18hiredman*shrug*
22:18TDSmithexactly.. me too
22:18chrisnWell, I bet a lot of your wants are driven by your ego. Address that and you would not want much.
22:19chrisnMine are almost entirely driven by mine...
22:19hiredmanso, speaking of clojure
22:19TDSmithHmm- I understand that idea under current circumstances...
22:19hiredmanI was thinking, I hate writing php
22:20TDSmithAnyway, the point is that good notation matters.
22:20chrisnyep, so hiredman, how do you launch a process that can open a file using the program registered with the system in a cross platform manner?
22:20hiredmanso I should write a register machine in php, then write a compiler in clojure (that compiles some kind of lisp) and targets the register machine
22:20chrisnwhy are you dealing with php?
22:20hiredmanwebsite I have responsibility for, and webhost I have no control over
22:21chrisnthey don't use java on the web host?
22:21chrisnno tomcat or anything like that?
22:21TDSmithmeh- I have written some php for money. Evil language, IMHO.
22:21hiredmanuh, I doubt it
22:21hiredmanthey still only run php4
22:21chrisnwhere are you?
22:22TDSmiththat is what I wrote in- wass a few years ago.
22:22hiredmanin 2003 apparently
22:22chrisnin some technology time vortex?
22:22chrisnheh
22:22TDSmiththe most confused reference semantics I have ever seen...
22:22chrisnno kidding
22:22hiredmanI found this tool that dumps ast for php in some xml form
22:22chrisncan it convert back?
22:23hiredmanbut for a 13 character php file, the AST is over 3000 characters
22:23hiredmanchrisn: it claims too
22:23chrisndid you 13 character php file include another 3000 character php file?
22:23hiredmanno
22:24hiredmanit was something like <?php $x; ?>
22:24hiredmanthe simplest I could think of
22:24chrisnHow fast do the 3000 characters grow?
22:24chrisnDid you try a range of files, or just one?
22:24hiredmanjust the one
22:24chrisnIt could always output the same header or something
22:25hiredmanthat is very possible
22:25hiredmanI could not get the tool to go the other way, xml -> php
22:25chrisnoh hm.
22:25hiredmanit claimed to have been built without xml support, but had no problem dumping xml
22:25hiredmananyway
22:27chrisnMy buddy wrote a template processor for clojure
22:27hiredmanI started working on something that just generates php code directly, all of which is really a waste, I should just do the leg work to get the site moved to a different host
22:27chrisnYou could write a php code generator
22:28chrisnBest solution by far
22:28hiredmanyeah, it reads a file full of (defn foo [] bar) and outputs a bunch of function foo () { bar; }
22:29chrisnusing the clojure reader?
22:29hiredmanyes
22:30chrisnFeel like running a demo I wrote?
22:30chrisnIts opengl
22:30chrisnand shaders
22:30chrisnand you can edit the shaders
22:31hiredmanactually, I don't have a working jvm on this machine
22:31chrisngood god man
22:31hiredmanit was on a harddrive that died
22:32hiredmanand I have not replaced it
22:32TDSmithhmm- yeah.. generating php code is tricky because it is not very structured
22:32hiredmanYes
22:32hiredmanI cheat, I have a (literal "") that just dumps a literal string into the php code output
22:33TDSmithyeah.. well it's one of those things you can do if you're "smart enough" ;)
22:34chrisnlol
22:35hiredmanugh, figuring out when to put a semicolon
22:37TDSmithsyntax matters.
22:39TDSmithIf for no other reason... if you _have_ to generate lisp as a string for some reason, at least it's regular.
22:39hiredmanwell lisp is basically an ast
22:40TDSmithI always like to tell people that it's "pre-parsed".. basically the same idea.
22:40hiredmanwhen they invented lisp, the plan was to add syntax later, but they wanted to starting writing code in it asap
22:40hiredmanno time for syntax
22:41TDSmithAnd it turned out good ;)
22:41TDSmithBut I have to say that things like Lisp 1.5 don't look attractive to me.
22:42hiredmanhttp://en.wikipedia.org/wiki/M-expression
22:42TDSmithBut that's what great about Lisp... it evolves.
22:42TDSmithYep, I am familiar with that idea
22:42hiredmaninteresting the use of square brackets
22:42TDSmithActually Lisp was more of an accident than that...
22:42hiredmanalmost like that hot new language all the buzz is about
22:43TDSmithI don't think McCarthy ever meant that his formalism ought to be implemented.
22:44TDSmithAnyway- Ivory soap was an accident too...
22:44TDSmithand it floats ;)
22:46TDSmithBut it is certainly a lot easier to work with lisp that with other languages because it is "pre-parsed"
22:47TDSmithSeems o striker the write balance between "If you were smart enough" and "You can't possibly be that dumb"
22:47chrisnI would think lisp-php would be a lot easier than php-lisp
22:47TDSmithHmm- yes.
22:48TDSmithBut both are impossible beyond a small subset.
22:48chrisnimpossible?
22:48chrisnthat seems rather strong
22:48TDSmithErr- unless you're smart enough ;)
22:48TDSmithI mean practically.
22:49chrisnI would say, if you could write an irc bot that dynamically compiles clojure and returns the result.
22:49chrisnYou might just be able to write lisp-php
22:49hiredmanuh
22:50hiredmanit just, you know, (eval (read))
22:50TDSmithhmm... what?
22:50hiredmanthe difficulty is in the sandboxing
22:51hiredmanman, I really wish clojurebot was back up
22:51TDSmithThe problem with this is that read is not likely to like PHP...
22:51TDSmithYou can't write a meta-circular evaluator for PHP in LISP, generally...
22:51chrisnbut php does have eval
22:51hiredmanTDSmith: oh no, Iwas talking about the irc bot
22:52TDSmithah. I see..
22:52TDSmithsorry ;)
22:52chrisnwhy not write a lisp interpreter in php?
22:53TDSmithPHP's eval is basicsally crippled because...
22:53hiredmanchrisn: that is not a bad idea
22:53TDSmithErr- why would you?
22:54TDSmithanyway php is just strings.
22:54TDSmithbut it ios not evn copnsistrently just strings...\
22:54TDSmitherr- spelling
22:55hiredmanit would be easier
22:55TDSmith?
22:55hiredmana lisp interpreter in php
22:55hiredmanso you just feed it lisp
22:55TDSmithhmm...
22:56TDSmithThat's a terrible idea.
22:56hiredmanI bet it would be far easier then generating php
22:56TDSmithI'm sure it would ;)
22:56hiredman(says the guy who was writing a php generator at 3am last night)
22:57TDSmithHmm-
22:57chrisnat least you were using your time productively...
22:57TDSmithyou do see that macros are just a means of writing lisp generators, right?
22:59TDSmithThis gets obscured by backquote notation in CL, but...
23:00TDSmithThe point is tht you can deal with the language on the level of symbols when generating shit...
23:00TDSmithPHP is just no homoiconic enough to get a marriage license.
23:01hiredmanas of right now http://gist.github.com/43001 goes into the compiler and http://gist.github.com/43002 comes out
23:02hiredmanwhich is not exactly valid php
23:02hiredmanthere is at least one missing semi-colon
23:03TDSmithhmm- doesn't look like PHP to me ;)
23:03hiredmanwell, should be run through a pretty printer or something
23:03TDSmithmeh...
23:03ericlavigneWhy do you want to create PHP code?
23:04chrisnhiredman: you should use a template language to specify the pieces of php
23:04TDSmiththe problem is that you are embedding so much information into these ugly unstructured srtings.
23:04TDSmithBut I understnad...
23:04chrisnSo that you can just do essentially lambda replacement. It would be a ton easier.
23:04TDSmiththe answer is likely- I have to interface to PHP...
23:05hiredmanchrisn: interesting
23:05danlarkinTDSmith: use some sort of RPC (rest, soap, xml-rpc) ... don't generate code, it will be the biggest headache ever
23:05TDSmithhrrm- what?
23:06hiredmanright now, I have a list of forms like (if ) where there is a specific function that knows how to translate that form in to php
23:06TDSmithYes, that is my point....
23:06TDSmithit is unfortunate that you have to do that, but...
23:06chrisnright. I might read in a file that looked like "if ( $condition ) { $stuff }"
23:07hiredmanthe actual translator is a multimethod that dispatchs on first
23:07TDSmithbasically lisp falls down in that case, to some dewgree...
23:07chrisnThat part wouldn't change.
23:07Chouserdid you look at clojurescript at all?
23:07chrisnThis would just help you get the semicolons right
23:07hiredmanChouser: nope
23:07TDSmiththe big wingwith lisp is being able to deal with code in a level that is not azbout characters and strings.
23:07chrisnActually, not sure it helps a ton coming from lisp.
23:08Chouserhiredman: translates clojure to javascript. might be informative to you. ...or possibly not. :-)
23:08chrisnI generated a ton of c++ code once using python
23:08chrisnthe code templates were key
23:08hiredmanTDSmith: well, I deal with the lisp code as a data structure, and feed it through some funtions, which output strings
23:09chrisnI think an interpreter is the simplest way to go.
23:09hiredmanmaybe
23:09chrisnFull translation to php is really going to hurt.
23:10hiredmanreally, the simplest thing, is just to figure out how to get away from this horrible webhost
23:10hiredmanbut that has nothing to do with clojure
23:11hiredmanand is not something I can do at 3am
23:11ericlavignethis is all about a webhost? no need for PHP libraries?
23:12hiredmanthe webhost of a website I made the mistake of volunteering to look after only offers php4
23:12ericlavigneVPS rental is not so expensive as the time spent creating a PHP generator :-(
23:13hiredman:P
23:13hiredmanI have a webserver, I could move it to, I would not even need to rent a VPS
23:14ericlavigneoh, but you have existing code for the site in PHP?
23:14hiredmanwow, there are two clojure groups on facebook
23:14hiredmanyessir
23:16danlarkinditto!
23:19ericlavigneA search for Clojure also turned up the LispNYC facebook group.
23:21hiredmanyeah
23:27TDSmithwhy do you have this horrible webhost?
23:28TDSmithlinode is like $30.00 a month and you can run what you want.
23:28hiredmanit is somebody else's fault
23:28TDSmithwwwww
23:28TDSmith;)
23:29ericlavigneperhaps follow the RPC suggestion given earlier, with the Lisp part running on your own server
23:30hiredmanheh
23:30hiredmanthat would be cute
23:36NafaiI pay $19.95 formy Linode
23:37Nafai384 MB of RAM, 12 GIG of storage, 100 GIG (or maybe it's 200) of transfer
23:37danlarkinNafai: that's not a bad deal
23:38NafaiYeah, pretty nice
23:38NafaiI'm IRCing from it right now
23:40hiredmanI know a guy who does IT for a fish processing plant, he has a freebsd box shoved in the corner somewhere for me
23:42hiredman$0 a month
23:42hiredmanexcept sometimes the power goes out and clojurebot vanishes
23:43chrisnNafai: - do you have a terminal based irc client
23:44Nafaichrisn: Yeah, I'm using irssi + screen. But I have also used bip and an ssh tunnel to connect to it from a graphical client from my desktop
23:45Nafaihttp://www.travishartwell.net/blog/2006/04/20_1810
23:46chrisnthat is a damn sophisticated chat setup.
23:47NafaiBeen working well for me for almost 3 years now
23:48chrisnEssentially you run a proxy connected 100% of the time and then you access the proxy from wherever you want?
23:49NafaiYup
23:49NafaiAnd since I use an ssh tunnel to access it, it's protected
23:49NafaiAnd I can be connected from multiple places
23:49Nafaiat the same time
23:50chrisnSo when you want to spend time in multiple places at the same time, you can be connected from every one of them?
23:51NafaiHeh. Yes.
23:52chrisnDo you think you will be able to use clojure professionally?
23:53NafaiMe? Not in the near future.
23:53chrisnI hope that I can either use clojure or F# some time soon.
23:54NafaiWhat do you do currently?
23:54chrisnI am a senior dev tech for NVIDIA
23:55NafaiCool
23:55chrisnI run a team of developers doing projects to help NVIDIA hit niche markets.
23:55hiredmanOh, REALLY
23:55chrisnI have been trying to push for a more functional language for CUDA with no success.
23:55chrisnyep
23:56hiredmaninteresting
23:56danlarkinpatch the JVM to use the GPU :)
23:56chrisnYou can right now
23:56NafaiI think functional programming would fit well with that
23:56chrisnjogl has glsl support
23:56chrisnIt will partially
23:57chrisnI wrote a small demo in clojure where you can edit the glsl files and watch the graphics change.
23:57NafaiCool
23:57danlarkinOoo
23:57danlarkinthat's neat
23:58chrisnI need to refactor the code and come up with a non-stupid name, but when that is done I will announce it on the mailing list.