#clojure logs

2011-08-08

00:00jsnikerisamalloy: thanks for your help as usual
04:57neotykGood morning everyone!
04:58lnostdal-laptophello dr. nick!
05:01ejacksonmoring neotyx
05:04neotykguys and galls I made some progress on clojure/clojurescript and websocket sample application, if you would like to see it: http://lab01.kungfoo.pl:8108/
05:09ejacksonneotyk: i most certainly would... I'm currently trying to figure out how to get cljs to print a string representation of an object
05:10ejacksonyou'd thing you could just do (str [1 2 3]), but putting that through a setTextContent renders and [object Object] annoying !
05:11neotykejackson: code is not yet ready to be published, but I demo it this Wednesday, so will publish it then
05:11ejacksonneotyk: I can't select the text box in Firefox in your app
05:11ejacksonbut can in safari
05:11ejacksonit tells me : No WebSocket supported, get a decent browser.
05:11ejacksonhahahaha
05:11neotykejackson: what version of ff?
05:12neotykexactly
05:12ejackson5.0.1
05:12ejacksonprobably some security setitng
05:12ejacksoni'm a little paranoid
05:13neotykI use chrome for development and testing
05:13neotykand from time to time check it on safari
05:14neotykFF didn't work for me as well, but I have old version
05:14ejacksonneotyk: is there some difference between (str [1 2 3]) and "[1 2 3]" in CS ? I can render one, but not the other :(
05:15neotykone is vector other one is string
05:15neotykno, actually both are strings
05:16ejacksonindeed
05:17neotykso first one is [object Object]
05:17neotykright?
05:17clojurebotEqual Rights for Functional Objects is Baker's paper on equality and why it's impossible to define sensible equality in the presence of mutable data structures: http://home.pipeline.com/hbaker1/ObjectIdentity.html
05:17ejacksonyeah, but why ? I'm not understanding that
05:18ejacksoneven (. [1 2 3] (toString)) becomes [object Object]
05:18ejacksonbummer
05:18neotykI guess it's js object you are getting
05:20neotykwhat if you would do (str (vec [1 2 3]))
05:20ejacksonlet me see
05:20ejacksonsame
05:20ejacksonhow irritating !
05:22neotykmaybe printing is not yet ported
05:23ejacksonhmm.....
05:24ejacksonmust be
05:25ejacksonbut the whole groovy thing is to be able to pass clojure datastructures back and forth to the server, how is this possible without the printer ?
05:25hiredmanstr has never been about round tripping datastructures
05:25hiredmanuse prn, pr, pr-str, prn-str and friends
05:26ejacksonhiredman: aha ! thank you
05:27neotykand read them with read-string
05:28ejacksonand we have a winner
05:28ejacksonI had the read-string down, but he pr-str was the missing piece
06:31ordnungswidrigdoes anybody know of a static blog generator in clojure, like jekyll et al?
07:21triyoHi guys. Is it possible, by any general means, to :require Clojure code in the ClojureScript namespace? Say for instance, I have utility function that directly translate from Clojure to ClojureScript, really power lies in the ability to reuse that function across the application layer boundaries if thinking in an example of Front-end (browser-based) and back-end.
07:22triyo*really=real
07:22triyoAnyone any thoughts on this?
07:26triyoSo take for instance a validate component. The `logic` part of the component would be referenced from both the fron-end and the back-end of the application, thus satisfying the DRY principal.
07:26triyo*validate=validation
07:37triyoSeems to me like :refer-macros would make this possible as ClojureScript's macros are written in Clojure
07:56krumholthi, can i write a macro that evaluates to no code? i want to write a macro that depending on a condition inserts code or nothing. is that possible?
07:59triyoBy nothing you mean nil?
08:00triyoan (if ..) form would give you `something` when condition is met. When condition is not met it would return nil.
08:00opqdonutkrumholt: sure, just return nil from the macro
08:00opqdonutwhen you want no code
08:01krumholtthats what i do right now
08:01triyo,(if (=1 2) "will not evaluate")
08:01clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: =1 in this context, compiling:(NO_SOURCE_PATH:0)>
08:01triyo,(if (= 1 2) "will not evaluate")
08:01clojurebotnil
08:02krumholtbut nil is not the same as nothing at all
08:02triyowhat is `nothing`?
08:02krumholtwhitespace
08:03triyoThen return empty string -> ""
08:03opqdonut:D
08:03opqdonutnil is very much the same as nothing as far as macros are considered
08:03opqdonutchanging a form to nil is what (comment ...) does, for example
08:03krumholtim trying to make an example (+ 1 2 (maybe 3)) and i want maybe to check a condition known at compiletime and then insert 3 or nothing at all
08:04triyonope
08:04triyoinsert 0
08:04opqdonutoh, right
08:04triyoin your case for that operation type
08:04krumholti could do that but that would only work for numbers
08:04krumholtnot for text
08:04opqdonutyou can't really do that. you need a macro that wraps around the + expression
08:04opqdonutand introspects it for occurrences of maybe
08:04opqdonutand then maybe deletes them
08:04krumholtopqdonut, ah nice thanks. thats actually what i want
08:05opqdonutkrumholt: you'll might want to use clojure.walk for traversing the expression
08:06krumholti'll look at that thanks again
08:06opqdonutbtw,
08:07opqdonut,(+ 1 2 #_(+ 5 6))
08:07clojurebot3
08:07depywoot!
08:07depy,(+ 1 2)
08:07clojurebot3
08:07depynice! :D
08:07opqdonut(of course that's not toggleable)
08:07triyohmm what reader is that?
08:07triyo#_
08:07triyopretty cool
08:07opqdonutit's been in clojure since forever
08:08opqdonutdocumented on e.g. http://clojure.org/reader
08:08triyoOh sweet, like a commenting effect on pre-eval
08:08triyoYup just saw the docs
08:09depyWhy is #_ used for? I can't think of any case where to use this... :)
08:09depyJust curious..
08:10triyoWhen you want to exclude a form from being evaluated under certain conditions I'd say
08:10opqdonutcommenting stuff out
08:10opqdonutwhen (comment ...) isn't applicable
08:10opqdonutand you don't want to munge the line structure to make ;; possible
08:11triyothat'd suite krumholt requirement with the maybe construct quite nicely.
08:11triyoin the macro def
08:11depycouldn't u solve this by using "if" ?
08:12triyoNo, as it retunes nil
08:12triyo(+ 1 2 (maybe 6))
08:12opqdonuttriyo: but you can't emit a #_ from a macro, since #_ is a reader feature
08:12opqdonutand anyway, I'm guessing krumholt wants to programmatically change whether stuff is included or not
08:13opqdonutof course he could just write out all the different cases in a cond, but that cond might be huge
08:13triyoyup, my guess too, I see what you mean
08:14triyoI must say though, to achieve that with a type system like that of Haskell is insanely simple without the use of macro system.
08:14opqdonutwell, no
08:15opqdonutthat's actually one of the things you can't do easily in a non-lisp language
08:15opqdonutomit parts of expressions
08:15triyoits not really an omission as such.
08:16triyoIts pure compile time polymorphism
08:16triyoyou define what `maybe` instance for specific type means
08:16opqdonutfor a special case like monoids (emitting a type-dependent "0") the haskell solution is quite neat
08:16triyofor in case if integer, it may mean zero
08:16triyo:)
08:16triyothats what I mean,
08:17opqdonutwell it does take some trying to get to a situation where omitting is necessary even in clojure
08:18opqdonutmost variable-argument-length functions handle nil as absence of a parameter
08:18triyoyup, and that is one of the neatest things in my opinion in Clojure.
08:19triyo,(map #(* % 2) nil)
08:19clojurebot()
08:20triyoimagine if we had to instead write conditional nil checks on each of those calls?
08:21triyowhere this notion fails though is on java interop though.
08:22triyoresulting in NPEs
08:23triyowold be cool if you could say (.getFile should-be-url), where should-be-url is actuall a null pointer reference.
08:23triyojust first impression, I;m sure its not simple as that
08:34leonidnil is just an empty list
08:34triyoyup
08:35triyolisp in general as far as I remember
08:37triyoI remember seeing it in the Micro-manual for LISP written by John McCarthy in 1978 in this paper -> https://docs.google.com/fileview?id=0B0ZnV_0C-Q7IOTRkNzVjZjMtMWE1NC00YzQ3LTgzMWEtM2UwY2I1YzdmNmM5&amp;hl=en
08:38triyoThe variables T and NIL are permanently assigned the values T and NIL, and NIL is the name of the null list ().
08:41opqdonutexcept in clojure () (the empty list) is not nil but the empty sequence is nil
08:47leo2007To use clojure well, does one have to know Java (some basics)?
08:47triyo,(if '() "yes, nil" "no, not nil")
08:47clojurebot"yes, nil"
08:48opqdonuti think you got those the wrong way around
08:48triyooops :)
08:48triyoyup
08:48leonid,(nil? '())
08:48clojurebotfalse
08:48leonid,(= nil '())
08:48clojurebotfalse
08:48triyothat better.
08:49triyoso what does the def for nil look like?
08:49leonid,(nil? (seq []))
08:49clojurebottrue
08:50leonidstill confused about lists and sequences
08:51raekleo2007: imho, you should at least know about the way java programs are structured (packages, classes, fields, methods, nested classes, et.c.) and how you access these with the interop syntax
08:52raekso that you can read the javadoc for a java library and write clojure code that uses that library
08:52leo2007raek: thanks.
08:53dnolenleo2007: I barely know any of those things and I've been using Clojure for 3 years :P but then I don't rely on that kind of interop much.
08:53raekbut you also need to know about a few java classes, mainly the I/O ones
08:53leo2007dnolen: good to know ;)
08:53triyoAdditionally, you want to know how to interpret the java stack traces that clojure produces up on exceptions
08:53leo2007I think I'll pick up some Java.
08:54MenthyLauJensen: is the SQL IN operator supposed to be working in ClojureQL 1.0 ? Looking at sources I was expecting (select (table :authors) (in :name ["John" "Luke" "Mark" "Matthew" ])) to work..
08:54dnolenleo2007: if you intend to use Java libs a lot, yeah you gotta learn some Java. But there's a lot of interesting work to do w/o Java libs.
08:54raekso it can be a good idea to look around in the java.io and java.net packages
08:55leo2007OK. I think I will.
08:59leo2007raek: I'd like to get a notice when you finish.
09:09leo2007after running ant in clojure, I see two jars: clojure-1.3.0-master-SNAPSHOT.jar and clojure.jar
09:09leo2007are they the same?
09:19Menthyleo2007: Usually in IDE's clojure.jar is a built in clojure version used as default by the clojure plugin of your IDE. I doubt they're the same.
09:21vinzent_hm, can somebody explain me what's the essense of the noir? it looks like its defpage is the same as compojure's GET\POST etc macros, defpartial is hiccup's defhtml... am I missing something?
09:31leo2007in short, what exactly is Leiningen?
09:32vinzent_the build tool for clojure
09:33Menthyleo2007: Leiningen is a dependency management and build tool. It's used to download libraries & the libraries they depend on, and to build clojure projects (generate executable jars)
09:34MenthyLeiningen itself leans heavily on similar java tools called Maven (for dependencies) & ant (for building)
09:35leo2007Anyway, so in order to run swank-clojure, it has to be added to a project?
09:38ejacksonanybody got a second to review a blog post on AJAX queries in Clojurescript for me ?
09:38Menthyleo2007: depends if you want to run it in your project, or if you want to use it in your editor/IDE to develop projects. If the latter, what is your current or intended development setup ? (OS, editor/ide) ?
09:39leo2007osx, emacs,
09:44ejacksonoh well.... i hope I guessed correctly. I'm sure I'll be swiftly punished if not :)
09:44ordnungswidrigejackson: i'd review it
09:45ejacksonhttp://boss-level.com/?p=119
09:45ejacksonthank you ordnungswidrig
09:46ordnungswidrigejackson: after deriving functional test cases from requirements all day, I need a break to reanimate my brain
09:46solussdhow do I turn the string "{'a' 2}" into a clojure map?
09:46ejacksonordnungswidrig: oh dear lord, that sounds horrific.
09:46ordnungswidrigejackson: test cases for *gulp* manual execution
09:48Menthyleo2007: not much experience with emacs, I'm new to clojure coming from the Java side as opposed to lisp. Took me a fair bit to find a workable IDE/REPL without having to resort to Emacs
09:48triyoI have a strange behavior when including (:require-macros [myns.mymac :as mymac]) in my CLJS script. I get an error at runtime that `mymac` is undefined.
09:49Menthysolussd: (println (read-string "{\"a\" 2}"))
09:50triyoIs there something specific that one needs to do to call the macro in the referenced macro module I wish to use?
09:52solussdMenthy, the string is of the form "{'a' 2}" and read-string turns it into {a 2}. Is there a way to preserve the single-quoted a?
09:53solussderm, or a double quoted "a"
09:53vinzent_solussd, replace all ' -> " in the string :)
09:53solussdi want strings mapped to integers
09:54solussdbut then when I try to turn it into a map I lose the double quotes.
09:54solussd(using read-string)
09:54Menthysolussd: ,(read-string "{\"a\" 2}")
09:54solussd ,(read-string "{\"a\" 2}")
09:54clojurebot{"a" 2}
09:55solussdmy repl must not be feeling well
09:55solussdah.. my bad. thanks!
09:56Menthysolussd: Probably pprinting the string contents only. yw
09:59crazyFoxMenthy: so which IDE/REPL do u use now?
10:00Menthycrazyfox: IntelliJ Idea & LaClojure + Leiningen plugins
10:00crazyFoxah. never looked at that so far...
10:00Menthycrazyfox: There were some problems with that combination and environment variables not being put into REPL, but they've been fixed now
10:03leo2007Menthy: I can understand that ;)
10:03Menthycrazyfox: Tried Netbeans & Enclojure , Eclipse & CounterClockWise and IntelliJ IDEA (community edition) & LaClojure, and found the latest the easiest to work with when using Leiningen
10:03triyoI disabled my mouse and learned Emacs + slime + swank-clojure 3 years ago.
10:03triyoThere where not any IDEs bck then
10:04triyofor clojure dev.
10:04triyo7 more years of emacs and I'll be a novice ;)
10:04leo2007I am already using slime. So would like to configure it to cover clojure too.
10:05crazyFoxi am hesitant to start with emacs. it just seems soo big to me
10:05triyoIf you dev on a Mac, there is a cheat. Run Aquamacs to easy in to Emacs
10:06leo2007triyo: how to start a standalone clojure swank server ?
10:06triyolein swank, if you run leinigen
10:06MenthySame here, just checking out clojure is pretty mindbending up till now, let alone having to use a completely new editor & hotkeys
10:07crazyFoxtriyo: i dont posess a Mac. Unfortunately shall i say?
10:08triyocrazyFox: yup, sorry to hear that ;)
10:08leo2007triyo: I have the script lein.
10:09crazyFoxim going to try out clooj today. see how it feels...
10:09triyoAquamacs runs Emacs under the hood. So you can do all you can do in Emacs with an addition to key bindings for Mac. So for instance.. cmd-key + s will save the file as expected instead of doing ctrl+x, ctrl+s to save.
10:10triyoleo2007: ok so in your project.clj file add -> :dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]]
10:10triyoand then from command line run `lein swank`
10:11leo2007I run lein and it downloaded this file leiningen-1.6.1-standalone.jar
10:11triyoafter few second it will launch the server listening on default port 4005
10:11triyodid you follow the installation instruction in https://github.com/technomancy/leiningen/blob/master/README.md?
10:13triyothe readme has everything you need to know to install leiningen and get started
10:13leo2007triyo: it didn't mention the leiningen-1.6.1-standalone.jar thing
10:14triyoOk maybe I'm missing a part of the dialog. Why do you need the standalone jar?
10:14leo2007triyo: it keeps downloading itself
10:15triyoSo you followed the installation instructions as the per the readme?
10:15leo2007every time I launch `lein' it says Downloading Leiningen now...
10:16triyohmm
10:16leo2007triyo: not much to follow, it is just a short paragraph.
10:16triyoSo you run `lein self-install`
10:16triyo?
10:17leo2007sure.
10:17vinzent_maybe some problem with permissions?
10:17MenthyWhen you run "lein self-install" it downloads the jar and places it in a user dir. However, if you haven't got HTTP_PROXY and HTTPS_PROXY setup, it can't download the jar but creates an empty jar file in that directory
10:18Menthy(at least that happened to me on Windows)
10:18triyoThere should be a .m2/ dir in your home dir
10:18leo2007why do I need to set up proxy?
10:18leo2007there is .m2
10:18triyowith the downloaded files in relevant sub dirs
10:18MenthyIf you're behind a proxy, that is.
10:19leo2007getting this error: http://paste.pound-python.org/show/10717
10:20triyoHmm can't find the clojure.jar on classpath I'd guess based on the msg
10:22leo2007triyo: so the installation is too brief for someone who doesn't know java.
10:23triyoleo2007: well the problem here is that this is not suppose to happen.
10:23leo2007I have clojure/ and swank-clojure/ in the same directory
10:23leo2007both are git repos cloned from github
10:23triyoLeiningen doesn't need clojure in place when installing itself. It probably downloads clojure first and then bootstrap it, but for some reason fails to locate it on classpath
10:25triyoI'm no leiningen expert thought. Man to chat to is technomancy
10:25triyoHe is usually on this list
10:25triyo`chat`
10:26triyo*though
10:30leo2007triyo: thanks though. I guess I'll have to wait for technomancy to show up.
10:32triyosorry I couldn't help any further.
10:55raekleo2007: which lein version are you using? stable or snapshot?
10:56leo2007raek: how to check if it is stable or devel?
10:56raekleo2007: what was the URL of the script that you downloaded?
10:57leo2007LEIN_VERSION="1.6.1"
10:58raeki.e. did you download https://github.com/technomancy/leiningen/raw/stable/bin/lein or https://github.com/technomancy/leiningen/blob/master/bin/lein ?
11:00raekleo2007: does your internet connection have a "captive portal" or something else that might intercept HTTP requests?
11:01leo2007raek: possible I am in China where many sites are blocked by the government.
11:01raekyou could try removing everything in .m2 and run "lein self-install" again
11:01leo2007raek: it is the stable version.
11:01raekok, good.
11:02leo2007I am trying that.
11:02raekbtw, you don't need to clone any git repos unless you are making changes in code
11:03leo2007rake: I run lien self-install and it finishes.
11:03leo2007I can find a file leiningen-1.6.1-standalone.jar in the dir the script is invoked.
11:04leo2007nothing in .lein or .m2
11:04raekweird
11:04leo2007it is
11:04leo2007I use rcirc on GNU Emacs 23.3.50.1 (Mac OS X 10.6.8)
11:04raekmaybe you have an old version of wget installed
11:04leo2007no
11:04raekleo2007: which OS are you using?
11:04leo2007I have no wget just curl from osx
11:05leo2007osx
11:05gtrak`hmm, I'm trying to log something to the swank repl (using c.c.logging) during C-c C-, testing, but nothing shows up on the repl except the stacktrace from the test. What could I be missing?
11:05raekleo2007: I've heard that some version of curl on OS X causes problems
11:06leo2007that is weird indeed.
11:06leo2007raek: is it possible to start swank without lein?
11:07leo2007I am happy to leave lein for later time.
11:07raekleo2007: see this thread: http://www.mail-archive.com/clojure@googlegroups.com/msg38722.html
11:08leo2007a blocked url here.
11:08vinzent_leo2007, maybe you'll be kucky with cake? it's a leiningen analogue
11:09raekleo2007: I would suggest fixing curl instead of skipping lein, since the latter will make lots of clojure development stuff uneccesarily complicated
11:09leo2007raek: but the curl in OSX works just fine for many other things in the past few years.
11:10raekleo2007: what about this one: http://groups.google.com/group/clojure/browse_thread/thread/8884666f2913f725/534799708df0e8dc?lnk=gst#534799708df0e8dc
11:11raekbut maybe this is an unrelated problem
11:11leo2007raek: leiningen is successfully downloaded: -rw-r--r-- 1 leo staff 8.9M 8 Aug 23:04 leiningen-1.6.1-standalone.jar
11:11raekleo2007: so you don't get any .m2 directory in your home directory?
11:12leo2007raek: not from lein, I got one from running mvn
11:12leo2007.m2 is about 27M here
11:13raekleo2007: oh, sorry. the file should be installed in .lein/self-installs/
11:13gtrak`ah, nevermind, I found a way by throwing an exception with the string I need to see
11:13raekdoes it exist there?
11:14leo2007there is that dir but it is empty.
11:15raekleo2007: could you try to move the .jar-file there?
11:15leo2007done
11:16raekleo2007: the file should be downloaded to that place. can you open a leiningen issue for this? https://github.com/technomancy/leiningen/issues/new
11:16leo2007raek: seems to be running now.
11:17raekjust write that the leiningen jar file gets downloaded to the current directory rather than .lein/self-installs/ and what OS and version of curl you use
11:17raekthis is obviously a bug, and it would be great if it was reported so that it's not forgotten
11:18leo2007raek: done.
11:18PPPaulhello
11:19PPPauli have a list of keywords and i want to use them as arguments to defstruct. suggestions?
11:19leo2007raek: thanks very much. Now I am connecting to swank.
11:19PPPaulshould i use apply-macro?
11:19raekPPPaul: you have to write a macro that expands to the defstruct call you want
11:19PPPauli am
11:20PPPaulmy macro is getting confusing
11:20raekapply-macro should never be used, really
11:20PPPaul(defmacro def-csv-importer2 [table-name]
11:20PPPaul `(do
11:20PPPaul (defstruct ~(symbol (str table-name "-struct")) ~(symbol (str table-name "-fields" )))))
11:21PPPaulthe 'table-names-field' is a list
11:21leo2007not quite, it connects to my Common Lisp.
11:21raekleo2007: how do you connect from emacs? M-x slime-connect?
11:21PPPaulapply is the function that i want, but maybe there is a better way to do it with macros
11:21leo2007raek: yeah,
11:22raekif you start a swank server on port 4005, and then conenct to that port with slime-connect, then you should not get Common Lisp
11:23dnolenPPPaul: you do know that defstruct is deprecated right?
11:23PPPauloh
11:23PPPaulsuggestions then? should i use a record?
11:23leo2007raek: this time, it connects to the right one.
11:23dnolenPPPaul: why do you want to use defstruct?
11:23raekPPPaul: the list of fields must be available at macro expansion time
11:23PPPaulcus i used it before for something similar
11:24dnolenPPPaul: it's recommended to use plain maps unless you see some specific advantage.
11:24PPPaulthe list is made by the macro, or by anther macro... it's available
11:26PPPauli'm using a struct because my data is well defined
11:26raekPPPaul: the macro must access that list and generate a defstruct form with the elements as arguments
11:26PPPauli know that, i just don't know how to do that
11:26PPPauli tried ~@(symbol... and got an error
11:27vinzent_dnolen, is it deprecated, really? it'd be nice to use it when you need just a map, but have to create similar maps in some places
11:27PPPaulwhich is why i thought i should use apply-macro
11:27PPPaulmaybe i should look up record
11:27dnolenPPPaul: even if your data is well defined, you can probably still use a map.
11:27vinzent_(so you dont have to write {} and keys every time)
11:27PPPauldefstruct is a map
11:27dnolenPPPaul: just trying to sort what you think is the advantage in terms of functionality.
11:27PPPauli don't think there is any
11:27raekPPPaul: (defmacro def-csv-importer2 [table-name] (let [args (deref (resolve (symbol (str table-name "-fields" ))))] (list* `defstruct (symbol (str table-name "-struct")) args)))
11:28PPPaulcept having less code
11:28PPPaulthanks
11:28PPPauloooooh
11:28PPPauli see
11:28raekbut I don't know if I would recommend this approach...
11:28PPPauli haven't used (list*.... before
11:28raekit feels very hackish
11:28PPPaulhmmm
11:29raekperhaps this would be cleaner if the macro could call the function that generates the field names instead of accesing a specially named var
11:29PPPauli'm going to look up a different approach, since defstruct is deprecated
11:29dnolenvinzent_: it is deprecated. You can use defrecord now, but defrecord is more tedious to work with than just plain maps. Which is good. It encourages using defrecord only when you really need it.
11:30PPPauli guess i want my macro to do too much
11:30raekplain maps are fine most of the time
11:30PPPauli'm doing this as a way to learn macros
11:30PPPauloh
11:30PPPaulwhat about deftype?
11:31raekit defines a new type, but it doesn't work as a map like a record does
11:31PPPaulok
11:31vinzent_dnolen, yes, that's why I thought I can use defstruct for such purpose
11:31raekdefrecord for new language features, defrecord for data
11:31vinzent_raek, yeah, it's just helps sometime to type less :)
11:31PPPaulso defrecord is a big difference from defstruct?
11:32raekyes, it participates in the whoe protocols thing
11:32dnolenvinzent_: PPPaul: if you're going to use defrecord as defstruct was intended, it's good for that.
11:32dnolenit only gets annoying when you start extending to protocols and interfaces.
11:33raekand each record field is a jvm class field, so the data is represented fairly compact
11:34leo2007raek: this elisp error seems slime upstream has changed something that causes this error: http://paste.pound-python.org/show/10721
11:34leo2007I am running slime 2011-07-03
11:36raekleo2007: from Known Issues of the Leiningen readme: "Also the official CVS version of SLIME is not supported; it often breaks compatibility with Clojure."
11:37leo2007raek: i see.
11:37raekslime does not have stabe releases, only snapshots
11:37raekiirc
11:38raekleo2007: but swank-clojure ships with a "matching" version of slime. this is the version that is used if you use the "clojure-jack-in" approach
11:39raekdunno if there is a convenient way of keeping your CL setup while using slime with clojure
11:40raekwhen you run M-x clojure-jack-in it evals the bundled slime.el file. maybe that will override your CL slime for that emacs session so that it works for clojure.
11:41ordnungswidrigIt there something like drop-until?
11:41leo2007raek: yeah, it would a headache for common lisp.
11:42leo2007raek: it wonder why is that difficult to keep in sync with slime CVS, the protocol hasn't changed much.
11:42ordnungswidrigsuch that (drop-until #(> % 25) [10 20 30]) gives [20 30]
11:42raekcould be worth a try to leave your CL slime setup as it is and use the clojure-jack-in approach to see if that works
11:43ejacksonordnungswidrig: a perverted drop-while ?
11:43ordnungswidrigejackson: I need the item before the first item that drop-while would give me
11:43ejacksonaaah
11:48ordnungswidrig,(let [[a b] (split-with #(>= 50 %) [10 20 30 35 40 50 60])] (concat [(last a)] b) )
11:48clojurebot(50 60)
11:48ordnungswidriga little pervert but does the job
11:49leo2007raek: thanks.
11:49raekleo2007: did it work?
11:51leo2007raek: no but I can fix it later.
11:53edwIs there some established way to "symbolify" a map's (string) keys, or should I write up something de novo?
11:53leo2007most of my slime setup for other languages is gone.
11:53leo2007after swank-clojure loading its own slime.el
11:54edwEr, actually I'm interesting in keywordifying keys, not symbolifying them...
11:54ejacksonordnungswidrig: :)
11:58raekedw: http://clojuredocs.org/clojure_core/clojure.walk/keywordize-keys
11:59edwThanks!
12:22PPPauli'm trying to create records using lists from a file. i try this but it doesn't work (i've tried some variations too) (apply store-rec. [nil nil nil nil nil nil nil nil nil nil nil nil])
12:23hiredmansotre-rec. is not a fn
12:23PPPauli figured
12:24PPPaulwhat should i use instead?
12:24PPPaulns.store-rec?
12:24PPPaulactually, i tried that and it didn't work
12:24vinzent_PPPaul, you can't, it's a special form
12:25hiredmanvinzent_: no it isn't
12:25PPPaulso, how do i programmatically create records?
12:26PPPauldo i need to make a macro for doing that?
12:26vinzent_hiredman, then, mm... reader macros? Foo. -> (new Foo)? or what?
12:27hiredmanvinzent_: only for (store-rec. ...) (... store-rec. ...) is nothing
12:27PPPaulso (new store-rec [nil nil....])?
12:27vinzent_ah, that's what i meant
12:28PPPauli get a ctor error
12:29PPPaul(new store-rec [nil nil nil nil nil nil nil nil nil nil nil nil]) -> No matching ctor found for class
12:29vinzent_PPPaul, i think you have to write wrapper function (in 1.2), (apply (fn [arg1 arg2] (Rec. arg1 arg2)) [...])
12:29PPPaullol
12:30PPPaulthat seems like a huge pain
12:30PPPaulis that fixed in 1.3?
12:31PPPaulcus if it is i'll use that instead
12:31coopernursehi folks. can anyone suggest a sql db migration library? ideally one I can invoke from lein. I tried drift but got some puzzling ClassNotFound errors running the lein create-migration task. lobos looks good, but doesn't seem to be runnable from lein.
12:32vinzent_I've heard there is map->Foo and ->Foo fns in 1.3
12:32vinzent_PPPaul, also maybe there is something in java reflection api that'll help you
12:32PPPaulreflection api.... gah
12:32dnolenPPPaul: writing a wrapper function takes almost no code, you often want to have default fields, easier to just define your own ctor fn.
12:32PPPauli don't want to touch java or interop right now
12:33PPPauli am doing something super simple, i would rather it be pure clojure
12:33PPPaulthis seems like basic functionality
12:34vinzent_coopernurse, you can write a lein task yourself, it shouldn't be too difficult
12:35coopernursevinzent_: ok, I'll google that. I assume I can just write a .clj file in my project and somehow tell lein about it?
12:35coopernursefound it in the faq. "You can also include one-off tasks in your src/leiningen/ directory if they're not worth spinning off;" I will try that
12:36triyoIt seems that only way to require a Clojure code in from the ClojureScript namespace is via :require-macros. Anyone know if this is true and if so, why macros and not standard functions too?
12:37vinzent_coopernurse, btw, if you'll write general-purpose lein task for lobos, i'd love to use it :)
12:37coopernursevinzent_: heh, ok. looks like lobos doesn't have any notion of state -- so one would have to write something that stores which migrations have been applied. or am I missing something?
12:38coopernursedrift seems to be closer to what I'm after
12:38PPPaulhas anyone here used records in clojure 1.3?
12:38coopernurseso it may be faster for me to try to troubleshoot the ClassNotFoundExceptions I'm getting
12:40hiredmanPPPaul: look, you want to do something like (Foo. bar baz) where bar and baz are names the binding of which are delayed till runtime
12:40hiredmanhow do you do that?
12:40vinzent_coopernurse, it seems that currently lobos has only utilities to operate on tables - and that's all. let me google drift, haven't seem it...
12:40coopernursevinzent_: https://github.com/macourtney/drift
12:41vinzent_thanks
12:41PPPaulyeah, how do i do that?
12:41PPPauleven the Foo. is created at runtime from a file def
12:41PPPaulthat part is done via macros
12:42vinzent_PPPaul, macros are all about compile time
12:42hiredmanin fact dnolen told you how to do it
12:42PPPauli'm trying to get a function to read in a map and create a list of records from it
12:42hiredman(fn [bar baz] (Foo. bar baz))
12:42PPPaulthe wrapper function seems really weird
12:43hiredmanwell, you want a fn right?
12:43hiredmanapply takes a fn
12:43PPPauli'm not giving 'Foo.' in my function
12:43PPPauli'm given 'Foo'
12:44dnolenPPPaul: all these shenanigans could be avoid if you just used plain maps and fns ;)
12:44hiredmanso you will need the macro that generates Foo to generate a make-foo fn and use that
12:44PPPaul(defn csv-file-to-record [csv-file record]
12:44PPPaul (->> (parse-csv-file csv-file)
12:44PPPaul (map #(apply (record)%),,,)))
12:44hiredmanno
12:45coopernursevinzent_: I'd be curious if you get the same error I did when trying drift out of the box
12:45PPPauli think i'm not going to use records if i have to jump through hoops to do something simple like creating a new one without knowing it's name
12:46coopernurseI opened a github ticket with what I'm seeing.. pretty basic
12:47vinzent_coopernurse, ok, let me try that...
12:47coopernursevinzent_: cool, thanks
12:47PPPauli'm wondering that if i use clojure 1.3 i don't have to do all this BS with records (as in they are more complete)?
12:48technomancywhy not stick with maps?
12:48PPPauli was using maps
12:48PPPaulthen someone told me defstruct was deprecated
12:48PPPaulso i switched
12:48PPPaulnow i'm fucked
12:48PPPaullol
12:49PPPaulwhy would records even exist if they don't work in such a common use-case?
12:49technomancymaps aren't defstructs
12:49PPPaulwell
12:49technomancymaps are way simple
12:49PPPauli thought that they were
12:49PPPaulstructs are maps, no?
12:49technomancymeh
12:50PPPauli just want my code to be simple and tiny
12:50PPPaulso, does anyone have experience using records in 1.3? are they better?
12:51vinzent_PPPaul, just use maps then!
12:51lnostdalmaps are not defstruct
12:51PPPaulhmmm
12:52PPPaulok
12:52PPPaulbut from what i've seen defstruct was made to make certain things involving maps easier.... no?
12:52dnolenPPPaul: simple and tiny means using the highest level constructs - maps and functions. defrecord is lower-level and host-y.
12:52dnolenPPPaul: no, defstruct was about performance.
12:52PPPauldefstruct code looks pretty, though
12:53PPPauldefstruct work well for reading in a csv file
12:54PPPaulat least in terms of code simplicity
12:54PPPaulcan i get the same code simplicity with maps?
12:54vinzent_coopernurse, it works here. the same project.clj, config with in-memory versions from the readme, lein create-migration foo throws no exceptions
12:54coopernursevinzent_: interesting. what version of lein?
12:54technomancyPPPaul: it will be much simpler with maps
12:54vinzent_1.5.2
12:55coopernursevinzent_: I'm on 1.6.1 - wonder if that matters
12:55coopernurseI'm reading the source to leiningen/create_migration.clj
12:55PPPaulok, if i can't get my code working in an hour or so i'll do everything with maps. but i think it'll be more confusing cus i wont see my keys or values in the code
12:55coopernursequite short, but a little over my head..
12:56vinzent_coopernurse, may bel the only way to know is to test it :) although I don't know how to setup properly different versions of leiningen...
12:57lnostdalthe key-names will be the "function names", PPPaul .. if needed (if things become nested perhaps) you can just pass the maps around to functions which will deal with them "for you"
12:57coopernursevinzent_: yes, I'm not sure either.
12:57coopernursesource file is here: https://github.com/macourtney/drift/blob/master/src/leiningen/create_migration.clj
12:58coopernurseI'm not sure what the `(do ... ) block means. not familiar with the backtick operator yet
12:58PPPaulyeah, i was just hoping that all of this junk related to making structs or records was done for me (in terms of programmable constructors) i had success with defstructs in the past, though
13:01vinzent_coopernurse, i think it's just evals the code in the context of the project. ` is allows kind of templating (unqoting some exprs). so it fails on requiring file... btw, it's no clear why not just write (require 'drift.generator)
13:01coopernursevinzent_: figured out how to do multiple lein versions (quite easy) - copy the lein bash script to a new name and change the LEIN_VERSION at the top
13:01coopernursevinzent_: sadly I'm still getting the same error with 1.5.2
13:02coopernursevinzent_: not sure what's different about my environment.. I'll try his sample from the readme
13:02coopernursemaybe I'm fat fingering the deps or something
13:02vinzent_ok...
13:03technomancycoopernurse: that's not really a good way to switch lein versions
13:03technomancybetter to grab bin/lein from a tag on github
13:03coopernursetechnomancy: ok, thanks
13:03coopernursejust doing this for a quick test
13:06coopernursevinzent_: success! I was invoking the 1.6.1 lein on my last command
13:06coopernurseso it appears the problem is lein 1.6.x compatibility
13:06coopernurseI'll update my github ticket, but this is a fine workaround for now
13:09vinzent_coopernurse, glad to hear :) btw, from the eval-in-project doc: "... If the form depends on any requires, put them in the init arg"
13:09coopernursevinzent_: that's from the lein docs?
13:10vinzent_https://github.com/technomancy/leiningen/blob/master/src/leiningen/compile.clj#L134
13:11coopernursevinzent_: ah, very good.
13:14vinzent_so that was the "Gilardi Scenario" :)
13:18coopernursevinzent_: heh, yes, it appears so now that I read Phil's article about it
14:00coopernurselein new foo creates: src/foo/core.clj -- is there any difference/advantage to this vs creating src/foo.clj? is core.clj special in any way? (similar to __init__.py in python)?
14:00Vinzentit's just a convention
14:01coopernursethanks
14:01amalloyVinzent, coopernurse: that's not really true
14:02Vinzentwhy?
14:02amalloycore is not special in any way, but because we live in java it's not a good idea to have single-segment namespaces. you want at least one directory (and usually one is plenty) under src/ before you start adding source files
14:02amalloyjava doesn't like the default pakcage, which is where stuff in src/foo.clj would end up
14:05ibdknoxamalloy: I didn't know data.xml had something in it that would homogenize a bunch of vectors for me
14:06amalloyibdknox: i added it a few weeks ago
14:06Vinzentah, true - I just meant "core" isn't special
14:06ibdknoxamalloy: sweet
14:06ibdknoxamalloy: do you happen to have a version of data.xml that works in ClojureScript? :D
14:06amalloyhah, good point
14:06ibdknoxhehe
14:07ibdknoxwhat function does the homogenizing?
14:07amalloythe AsElements protocol, and sexps-as-fragment helper
14:08amalloyit's all defined in pure clojure with protocols, so you probably could just copy all the code before attribute/emit, which are the only ones dealing with java types
14:08ibdknoxyeah, it looks like it
14:09ibdknoxmaybe we should just add a clojure.xml (maybe some other name) to cljs
14:09amalloyand hopefully those Element records would be more convenient for the client to use than generated DOM? of course they'll want DOM eventually, but a converter is easy
14:09ibdknoxyeah
14:09ibdknoxI agree
14:09amalloylovely
14:09ibdknoxI sent off my CA last week
14:10ibdknoxhopefully I can contribute to ClojureScript soon
14:10ibdknoxwe should just drop something like this in there, because this would be useful in a ton of contexts
14:17amalloyibdknox: i'm not really involved in cljs, but since i wrote it i could commit it to cljs for you if you can get anyone to agree on it
14:21ibdknoxamalloy: they didn't approve me for Clojure-Dev, I assume because my CA hadn't arrived yet. So once I can actually get on there, I'll see what people have to say about it.
14:24amalloy~ca
14:24amalloy$whatis ca
14:24lazybotca does not exist in my database.
14:24amalloyi hate you both
14:24ibdknoxlol
14:25hiredmanhuh, I what clojurebot's problem is
14:26amalloy,1
14:26amalloypoor guy
14:27ibdknoxlol, that was more than 24 hours ago
14:27amalloyibdknox: he's been repeating that set for a while
14:28hiredman~ca
14:28clojurebotCA is Contributor Agreement: http://clojure.org/contributing
14:28amalloywe also got a nice "(notice) null"
14:28ibdknoxhaha
14:28ibdknoxhe's sick :(
14:28hiredmanif you'll notice between those notices the bot was restarted
14:28amalloyhiredman: really? i saw those twice last night, and once just now
14:29hiredmanright
14:29amalloyokay
14:29hiredman(how do people irc with join/parts turned off?)
14:29amalloyi only have so much vertical space :P
14:29hiredmanthe bot just keeps the set of stuff scraped from the clojars website in memory
14:30amalloyright, i understand
14:30hiredmanthe null thing was a bug exposed once the bug that stopped the clojars notices from being sent was fixed
14:31technomancyhiredman: tab completion replaces part messages
14:32technomancyit'd be semi-nice I guess if you could just hide them by default instead of having them not written to the buffer at all, but meh
15:02vertegal /leave
15:11gtrak``It's not a big deal at all to me, but just curious, why does the clojure compiler seem so slow? I wonder if it's just so much more dense than java and it has to figure out all the dynamic stuff
15:14amalloyi wonder what tests you've done to make you think that the clojure compiler is slower than javac
15:15gtrak``just subjective ones, not trying to incite anything, I really like clojure :-)
15:18gtrak``I guess I could profile it, but maybe you know off the top of your head what dominates the time?
15:19amalloyi don't think it does, though. i mean, compiling a *single* java file might be faster than compiling core.clj
15:20amalloyat any rate the main bottleneck is (i think) that core.clj bootstraps the whole language out of compiler primitives every time you start it up
15:20gtrak``does it have to do that more than once during an AOT phase in lein?
15:22gtrak``it might just be stuff around it more than the compiler itself, compiling one file with C-c C-k is instant
15:24crazyFox,(for [y (range 3) x (range y)] [y x])
15:24clojurebot([1 0] [2 0] [2 1])
15:24crazyFoxis this a bug in for?
15:24hiredmanno
15:25crazyFoxwhy dosnt y start at 0?
15:25hiredman,(range 0)
15:25clojurebot()
15:25MasseRcrazyFox: Ending is exclusive
15:25MasseRStart is inclusive
15:25MasseR,(range 0 2)
15:25clojurebot(0 1)
15:26MasseRNo 2
15:26crazyFoxi know. that not my point.
15:26crazyFox(range 3)
15:26crazyFox,(range 3)
15:26clojurebot(0 1 2)
15:26crazyFoxit starts with 0
15:26crazyFoxbut my y up there starts with 1 instead of 0
15:27MasseROh, sorry I read you wrong
15:27amalloycrazyFox: because when y is 0, x == (range y) == ()
15:27amalloyso no iterations happen
15:27crazyFoxah!
15:27crazyFoxthank you for pointing that out
15:28gtrak``,(for [y (range 0 3) x (range 0 y)] [y x])
15:28clojurebot([1 0] [2 0] [2 1])
15:28technomancyclojurebot: lua called, it wants its crazy one-indexed functions back
15:28clojurebotfunctions are maps
15:29amalloytechnomancy: imo java.util.Date is enough index-confusion for a whole language
15:30gtrak``,(for [y (range 0 3) x (range 0 (inc y))] [y x])
15:30clojurebot([0 0] [1 0] [1 1] [2 0] [2 1] ...)
15:30technomancyoh man don't get me started
15:31technomancythe Clojure compiler should ideally issue warnings for every instance of java.util.Date that it sees.
15:31technomancyactually, javac should too
15:31amalloyhaha
15:31crazyFoxgtrak'': its ok. i figured it out by now :D
15:31gtrak``just trying for myself
15:31crazyFoxoh sure
15:33amalloytechnomancy: so we should use TimeUUID instead?
15:33technomancydefinitely
15:35mjg123Good evening
15:36mjg123I would like to split my clojurescript app up, it's too big for one file
15:36mjg123so I create core.cljs and ui.cljs
15:36mjg123and in core, I (:require ui :as ui), but it won't compile
15:36mjg123is there a working demo somewhere?
15:37mjg123I can see the twitterbuzz source, and I seem to have the same setup. But I don't know what command is used to build then.
15:37amalloymjg123: your require syntax is wrong
15:38amalloydoublecheck against twitterbuzz (or any clojure program)
15:38mjg123yes - sorry - I typed it into irc wrong. I have the same code as twitterbuzz
15:40mjg123it looks like this: https://gist.github.com/1132536
15:43mjg123I added a description of what I'm doing to build and what the error is to https://gist.github.com/1132536
15:47mjg123is there a need for the namespace structure (game.ui) to match the directory structure (game/ui) ?
15:48Chousukemjg123: yes
15:49Chousukefoo.bar corresponds to foo/bar.clj
15:49mjg123Chousuke: then that is the problem :)
15:49mjg123Ahhhh
15:49mjg123Yes, thansk
16:14malkomalkois there anyway to force clojure to not give me back a large float in exponential form?
16:17hiredmanmalkomalko: what do you mean?
16:17malkomalko999222333111.23 => 9.9922233311123E11
16:17malkomalkoI'd like 999222333111.23
16:18hiredmanso you'd like to change the format of how it is printed out?
16:18hiredmanthe *format* is what you are looking to change?
16:18malkomalko*yes*
16:19hiredmanwell, perhaps the `format` function?
16:28amalloy,(format "%.15f" 999222333111.23)
16:28clojurebot"999222333111.230000000000000"
16:28amalloymalkomalko: fiddle with it, but something like that
16:29malkomalkoright, but that'd give us a string, and you can't add strings.. if we parse that again, I think we'd end up where we started no?
16:29hiredman9.9922233311123E11 is a string
16:29amalloywhat. this question makes no sense re the last question
16:29hiredmannumbers have no format
16:30malkomalkothat number is in a map that is being used to generate a json string
16:31malkomalkothe json-string library is outputting in exponential
16:31hiredmanthat is a bug in that library
16:31malkomalkojust wanted to know if there was a way to tell it to print without it, is all
16:32hiredmanjson encoding has nothing to do with clojure's printing
16:32st3fan,(* 2 21)
16:32clojurebot42
16:32st3fanheh awesome
16:32hiredmanand fyi, that number may be too large to represent as a javascript number (so encoding it as json may not be a good idea)
16:32amalloyhiredman: how is that a bug? doesn't json use/support the same exponential format?
16:33hiredmanamalloy: no idea, there are a lot of json readers out there
16:43lobotomystupid question time: what's the best way of using a library such as math.combinatorics? just pull it from git and copy to wherever?
16:46dnolenlobotomy: if it's deployed to maven central it's easy but I don't think math.combinatorics is yet.
16:52lobotomyso just pull from git then?
16:53dnolenlobotomy: you could use the version from 1.2.0 contrib.
16:54dnolenlobotomy: are you not using lein/cake?
16:54lobotomyhmm, i'm using leiningen yes
16:54dnolen[org.clojure/clojure-contrib "1.2.0"] I would think then.
16:55SomelauwAre there any plans to convert clojure to c or native code or is that considered a bad idea?
16:56amalloySomelauw: never
16:56RaynesNo known plans. Not to say it's completely off the table forever and evers. Sometime in the next 300 years or so, I'm sure someone will try.
16:56SomelauwWhy never?
16:57technomancyyou need a runtime
16:57SomelauwWhat do you need a runtime for?
16:57dnolenSomelauw: Clojure's design assumes high performance GC.
16:58SomelauwYou can use c libraries right?
16:59dnolenSomelauw: hmm ... though ClojureScript does greatly relax what is expected from the host.
16:59dnolennoone expects really incredible performance from JavaScript tho...
17:00SomelauwIs it really hard to convert clojure to c without preserving performance. I know haskell can be compiled really efficiently and haskell should benefit from good GC as well, I think.
17:02dnolenSomelauw: noone's saying it can't be done ... rather how much work is involved and is it worth the effort?
17:03dnolenClojureScript seems adequate w/ a lot less effort.
17:04SomelauwI am not great at javascript, but maybe. Can clojurescript also be ran serverside?
17:05RaynesYes, with nodejs.
17:05RaynesBut ClojureScript isn't actually working with nodejs at the moment, given http://dev.clojure.org/jira/browse/CLJS-43 so it might be a bit before you can try it out.
17:05SomelauwOkay, I will check it out.
17:48jhicknershould this work in clojurescript? -- (js/console.log "foo")
17:48jhicknerit looks like it compiles to this: goog.global['console']['log'].call(null, "foo")
17:49jhicknerbut I get an Illegal invocation error when running it in the browser
17:54dnolenjhickner: did you try (.log js/console "foo") ?
18:01jhickner@dnolen that works! thanks
18:13leonid_Rank Username Problems Solved
18:13leonid_75 leonid 75
18:13leonid_consistency
18:15amalloy*chuckle*
18:15amalloyleonid_: time to change your username
18:16maaclShouldn't "{:x1 1}" and (pr-str {:x1 1}) be the same in ClojureScript? if I try to pass to js/encodeURIComponent I get differing results.
18:41ibdknoxmaacl: I'm pretty sure that CLJS represents keyword using a different symbol
18:41ibdknoxit's not a colon
18:41ibdknoxso those wouldn't be the same
18:41ibdknoxinternally that is
18:42ibdknoxmaacl: nm, I read that wrong
18:42Raynesibdknox: It's killing me: what is the meaning of your IRC nickname?
18:43ibdknoxhaha
18:43maaclibdknox: Ah, tricky - do you know of a cljs function that produces the expected result?
18:44ibdknoxRaynes: it's from long ago in high school, IB = International Baccalaureate, D=dork, Knox = a name I like lol
18:44RaynesInteresting.
18:46ibdknoxmaacl: I misread your original statement, that *should* work. What are you getting instead?
18:49ibdknoxthis works at the REPL
18:49ibdknox(= (pr-str {:x1 1 }) "{:x1 1}")
18:49ibdknoxoh
18:50ibdknoxencodeURIComponent escapes the ":" character
18:50maaclibdknox: "{:x1 1}" > %7B%3Ax1%201%7D whereas (pr-str {:x1 1}) gives %7B%22%5CxEF%5CxB7%5Cx90'x1%22%201%7D
18:51maaclibdknox: yes, which is need if you want to pass clojure form in a query string
18:52ibdknoxmaacl: hm, that is odd. You probably do this as a post though.
18:53ibdknoxmaacl: just to make sure nothing gets lost in translation
18:54maaclibdknox: but the problem arises before I submit it...
18:54ibdknoxmaacl: do you have the latest cljs?
18:54maaclibdknox: I believe so
18:55ibdknoxClojureScript:cljs.user> (js/encodeURIComponent (pr-str "{:x1 1}")) => "%22%7b%3ax1%201%7d%22"
18:56maaclibdknox: hm, very strange - I get the same at the REPL
18:56maaclibdknox: must look elsewhere
19:13sjlDoes Clojure have a way to replace a subsequence of a Vector? Something like Python's list slicing (lst[10:20] = [1,2,3]), but immutable?
19:32arohnertechnomancy: M-x slamhound has a high probability (75%+) of making Emacs completely unresponsive. Have you heard of any issues like that?
19:34arohnerusing it from the repl appears to work fine
19:34technomancyarohner: there are some unresolved infinite loops in the elisp, but C-g has been able to take care of everything I've run into so far
19:35arohnertechnomancy: C-g works unreliably for me. and sometimes, the ns declaration that is added after a C-g is different from what (reconstruct ...) returns
19:36technomancyhm; I haven't seen that.
19:36arohnertechnomancy: it appears to be differences of whitespace
19:37technomancyoh, sure
19:37arohnerspaces missing, etc
19:37technomancyit performs some cleanups
19:37amalloysjl: no. if the two slices are the same size, you can do it with multiple assocs
19:37technomancyI haven't been using it as much as I'd like, primarily due to the pretty-printing being crap.
19:37arohnertechnomancy: yes, but I'll see [hiccup.page-helpers:only[link-to]]
19:37amalloybut if the slices are different sizes, you just can't do it efficiently, so you might as well use concat on seqs raterh than messing with vectors
19:37technomancyarohner: hm; haven't seen that myself, but it doesn't surprise me too much
19:37sjlamalloy: Yeah, that's what I'm going to do I guess. I was wondering if there was something that would be faster. Seems like a lot of assocs if it's a long subsequence.
19:37technomancyhopefully after strange loop I'll be able to spend some time polishing the pretty-printing
19:38ibdknoxtechnomancy: you presenting at strange loop?
19:38technomancyibdknox: yeah, on Emacs
19:39amalloysjl: vectors are optimized for use cases different from that
19:39amalloyc'est la vie
19:39ibdknoxtechnomancy: awesome, good luck with that. :)
19:39technomancythanks
19:39sjlamalloy: Is there another data structure better for it? I could use a map, but it seems like a waste since all the keys are just sequential integers
19:40amalloyi'm pretty sure finger trees can be built with fast concat and fast indexed-lookup, if you're desperate for performance on a large sequence
19:40sjlHmm, I guess I'll just use the multiple assocs for now and if it turns out it's a bottleneck I'll look into changing it
19:40sjlThanks
19:41amalloysjl: if you don't need fast indexed lookup, concat is probably fine
19:42amalloytogether with take, drop, and all the other lazy-seq stuff
19:43sjlamalloy: Indexed lookup is definitely what I need (it's an array of blocks representing Minecraft chunks, and I'll need to index into it to get values for specific blocks)
20:11gfrlogevery time I want to push a jar to clojars I have to change the public key (since I never push from the same computer twice in a row); that's annoying in and of itself, but now even that's not working...
20:12gfrlogwhen I try to update the public key it says my username is already taken :|
20:12hiredmanyou should use an ssh agent
20:12gfrlogto have the same key on all my computers?
20:13hiredmanno
20:13hiredmanwell, maybe
20:13amalloygfrlog: i have the same key on all my computers. i'm sure there's something a little insecure about it, esp as hiredman seems uneasy, but it's simple and makes sense
20:13hiredman*shrug*, I guess I don't yuse other computers except via ssh and sshagent forwards my key
20:14gfrlogin every other context involving keys, using multiple keys is not an issue
20:14technomancyclojars could definitely use some more features
20:14hiredmangfrlog: clojars is open source, send a pull request
20:15gfrloghiredman: my primary complaint is about the key-changing bug
20:15gfrlognot the multiple keys feature
20:15amalloyconceptually, at least, you "should" have the same key. the key is supposed to identify *you*, not a computer
20:15hiredmangfrlog: sure, send a pull request to fix it
20:15gfrlogamalloy: don't like pseudonyms?
20:16amalloygfrlog: i don't introduce myself to everyone i meet with a different name :P
20:16gfrloghiredman: what? just because I didn't pay for clojars means I can't expect people to fix it for me?
20:16hiredmanamalloy: or assuming some kind of pki, they keys you use should all be signed by your "actual" key
20:16hiredmangfrlog: expect all you want
20:16gfrlog:)
20:17amalloyhiredman: also reasonable, though probably too complicated for me
20:17hiredmanI've never changed my key on clojars so it's unlikely that I will bother fixing it
20:17amalloyyeah, i didn't even know it was an option. why would you want to
20:17hiredmanthat I don't want to go anywhere near the web ui
20:18gfrlogwell even if I decide I like the one-key idea, I'm stuck at the moment because I doubt I have access to the key currently registered
20:18gfrlogat least for the next week or so
20:19hiredmangfrlog: https://github.com/ato/clojars-web/issues
20:19amalloy"but officer, my house has lots of keys in it! if you let me into my house, i'll be happy to show you the key there to prove it's my house!"
20:19gfrloghiredman: thanks, I was wondering where the repo was
20:24bortrebI remember an excellent video posted to the mailing list some time ago about "solving the expression problem with clojure" does anyone know where that video is?
20:40kencauseybortreb: are you sure it was a video? http://www.ibm.com/developerworks/java/library/j-clojure-protocols/
20:41bortrebit was in fact a video. I love the paper but I wish I could find the video :(
20:41bortrebmaybe he took it down after publishing the paper?
20:41kencauseythis was linked at the bottom: http://www.infoq.com/presentations/Clojure-Expression-Problem
20:41dnolenhmmm … pattern matching on primitive arrays could fun ...
20:42dnolens/fun/be fun
20:42lazybot<dnolen> hmmm … pattern matching on primitive arrays could be fun ...
20:42hiredmanon ByteBuffers
20:42dnolenhiredman: I'm assuming there are methods to pull them apart? (never used 'em)
20:43bortrebthanks kencausey -- that's a great video, but the one I'm looking for is by Stuart Sierra, the same one who wrote the paper.
20:43hiredmandnole: yes
20:44hiredmangetInt, getFloat, getChar, etc
20:44dnolenhiredman: what about sub ByteBuffers ?
20:44hiredmansub bytebuffer?
20:44dnolenlike subvec say
20:45hiredmanah, you can slice them
20:45dnolenvery interesting ...
20:45dnolenhiredman: I'm thinking about reserving vector notation for anything that supports random access + subvec/slicing.
20:45hiredmanthe api is very mutable
20:45clojurebotYou don't have to tell me twice.
20:45hiredman~botsnack
20:45clojurebotThanks! Can I have chocolate next time
20:47kencauseybortreb: Well, he doesn't mention it on his site while he does mention the developerworks article, so it seems unlikely.
20:47dnolenhiredman: it's interesting to me to be able to support rest notation w/o discarding the type.
20:48hiredmanah, yes
20:48raekbortreb: there are some videos here: http://alexott.net/en/clojure/video.html
20:48hiredmanhttp://www.infoq.com/presentations/Clojure-Expression-Problem
20:48raekbut the only one I found was the one by Chris Houser that kencausey and hiredman linked
20:49dnolenhiredman: so if you bring the type into the protocol, you can blast through data structure w/ pattern matching.
20:51bortrebI guess he either took it down for some reason or my memory is faulty. thanks anyway!
20:55gfrlogit is difficult to debug clojars without access to the database :/
20:55hiredmanyou can get a dump of the db
20:56gfrlogI guess it wouldn't have anything sensitive
20:56hiredmanit is sanitized
20:57gfrloghiredman: where would I get such a thing?
20:57hiredmanthe readme
20:57gfrlogthx
20:58gfrloghiredman: oh that's a static snapshot?
20:58gfrlogI'm not sure that would help me debug my username which used to work but now doesn't
20:58gfrlogparticularly I'm wondering if my username is also a group name
21:00sjlUgh, I think I'm going to have to use a byte-array instead of a Vector of Integer objects for memory.
21:01hiredmanhave you see primitive vectors?
21:01sjlhiredman: No… those sound promising.
21:01hiredman(require 'clojure.gvec)
21:01hiredman,(require 'clojure.gvec)
21:01clojurebotnil
21:02hiredman,(doc clojure.gvec/vector-of)
21:02clojurebotHuh?
21:02hiredmanjerk
21:02sjl,(doc vector-of)
21:02clojurebot"([t] [t & elements]); Creates a new vector of a single primitive type t, where t is one of :int :long :float :double :byte :short :char or :boolean. The resulting vector complies with the interface of vectors in general, but stores the values unboxed internally. Optionally takes one or more elements to populate the vector."
21:03hiredmanoh, I see, gvec is in clojure.core, but a seperate file
21:03sjlSo is the overhead on (vector-of :byte) o(1) or o(length of vector)?
21:04hiredmanno
21:04sjl(I'm storing vectors of ~32,000 items each)
21:04hiredmanit is not an array (not just a blob of memory)
21:04hiredmanit is still a persistent tree structure
21:05sjlAh, hmm, I wonder if it would be worth it then.
21:06gfrlogwhen I create a new clojars account, changing the key works fine.
21:06hiredman*shrug*
21:06gfrlogah ha -- I see my username listed as one of the groups that I'm in
21:06gfrlogso that IS the issue
21:07gfrlognow I don't know if that's an illegal state or not. I'm sure it's my fault somehow
21:07hiredmanis that the issue?
21:08gfrloghiredman: by looking at the code, I concluded that was one of three equally unlikely-seeming explanations
21:08gfrlogI had no reason to think any of them were possible
21:08gfrlogthe code basically says "if your username is a group you cannot update your profile"
21:09gfrlogI don't know if it's intentional or not
21:09gfrlognor do I know yet if I can fix it by just deleting the jar that caused it
21:10gfrlog(presumably the original intention of the code is to prevent _creating_ accounts that are the same as group names)
21:14gfrlogI think I know an acceptable fix. will code and request pull.
21:26gfrlogpull request sent
21:26gfrloghiredman: thanks for the help
21:43bortrebis there a way to give a custom .toString for an object created via reify?
21:44hiredman,(.toString (reify Object (toString [_] "foo")))
21:44clojurebot"foo"
21:47bortrebright -- I forgot the [_] part. thanks!
21:56amalloyi've seen a video on the expression problem too. bortreb wasn't imagining it
21:58kencauseyamalloy: You mean other than Chris Houser's Strangle Loop presentation?
21:58gfrlogI saw a halloway video where he talked about it a bit, but I doubt that's what anybody's thinking of
21:58amalloykencausey: yes, it was one of the stuarts
21:59kencauseyhttp://www.ibm.com/developerworks/java/library/j-gloverpodcast/#halloway
21:59kencauseythat podcast? again that was linked at the bottom of the Mr. Sierra's article
22:00kencauseyor perhaps http://vimeo.com/11236603 ?
22:02amalloykencausey: maybe i'm wrong, and it was chouser after all
23:12iceyI'm doing a tour of the Clojure web stack, and getting to the "(not quite) real time" app phase of things. What is the commonly used stack for comet / server push apps? I *think* it's Compojure / Ring + Aleph.. Anyone using ClojureScript on the client-side yet, or is it all hand-rolled js?
23:17dnolenicey: seems like quite a few folks using ClojureScript now. Aleph for coment / server push seems common.
23:19iceydnolen: do you know if many people are using aleph.websockets, or mostly streaming http? (not a ton of docs out there on it, so i'm just trying to get a feel of a common use case)
23:20dnolenicey: it's been a while since I used aleph, but using aleph for websockets was pretty straightforwards. agree on the docs situation - the aleph ML helpful I think.
23:21iceydnolen: awesome, thanks.
23:21iceydnolen: also - the pattern matching stuff you tweeted about earlier today looks awesome
23:21dnolenicey: thanks. it's a start. lotso stuff todo.
23:25zmarilIf I wanted to learn how to think in lisp, what would be a good resource to read/use? Joy of Clojure and Programming Clojure are good introductions but they aren't quite doing it for me.
23:25Scriptorzmaril: reading the source for various functions helps
23:25Scriptorpersonally...I learned bits of haskell :p
23:26iceyzmaril: it's not Clojure, but I enjoyed Practical Common Lisp
23:26zmarilScriptor: I took a look at a The Haskell School of Expression and it looked like pure math by the end.
23:27Scriptorzmaril: eh, learn you a haskell was what I use
23:27Scriptor*used
23:27zmarilAnd that helps to understand functional programming then?
23:27zmarilicey: Thank you! This looks neat.
23:27Scriptordefinitely, it devotes a good bit of text on how to think in a functional way
23:28Scriptorwhenever it introduced a new function I'd try to implement it myself without looking at the answer and see how it compared
23:30zmarilScriptor: Haskell it is then. Thank you!
23:31Scriptorno prob!