#clojure logs

2011-09-02

00:34skelternet(doc sleep)
00:34clojurebotHuh?
00:36amalloy$javadoc Thread sleep
00:36lazybothttp://download.oracle.com/javase/6/docs/api/java/lang/Thread.html#sleep(long)
00:49jliibdknox: I might have tiny patches for cljs-watch. how do you like them?
00:49ibdknoxjli: for what exactly?
00:49ibdknoxjli: and pull requests will be fine :)
00:52jliibdknox: nothing real yet. bthe current java heap options prevent it from running on my laptop with only 2g ram
00:53ibdknoxI just used the same options that clojurescript used I believe
00:53jliyeah, I had the same problem there. it's just a performance optimization for long-running programs, right?
01:03ibdknoxjli: it's the overall amount of memory the heap can take up, it's likely important if you're compiling a large project, where the heap might get quite large
01:12MasseRWhat's square root named in clojure?
01:13MasseRJust the java version, Math/sqrt?
01:13jliMasseR: yes
01:14MasseROk
02:30jblomowhat's the naming convention for a constant?
02:32jblomowhat if I only want a Var to be dynamic during testing
03:08raekjblomo: vars are usually constants, so no special naming
03:09raekjblomo: I think there is something like 'with-redefs' in Clojure 1.3 that you can use in tests. it replaces the root binding, so the var does not need to be dynamic
03:10jblomoah cool, makes sense. thanks
05:43jedahuI have a macro problem
05:43jedahuhttp://paste.lisp.org/+2O01
05:43jedahuI need to aot compile a gen-class definition
05:44jedahuthis works fine except when gen-class is nested in another macro
05:45jedahuany ideas?
05:45raekjedahu: try `(do (gen-class ...) (defn ...))
05:46raekotherwise the top let form in the macro throws away the gen-class code
05:46jedahuaha!
05:46jedahuthankyousomuch! :-)
05:46raekjedahu: use macroexpand-1 or macroexpand to se what your macro does
05:47raek,(macroexpand-1 '(when condition expr1 expr2))
05:47clojurebot(if condition (do expr1 expr2))
05:48jedahuI used both but didn't twig to what they were telling me
05:48jedahuend of a long day :-)
06:17lnostdal_classes can't be used as a test-constant in case?
06:18lnostdal_seems odd; not knowing java very well, a class is constant isn't it?
06:18lnostdal_e.g. (case (type []) clojure.lang.PersistentVector (println "hi"))
06:19bendlas``lnostdal_: I noticed that too, a few days ago
06:20bendlas``One reason might be, that instead of class switches, one should use protocols
06:20bendlas``anyway, you can do (case (.getName (type [])) "clojure.lang.PersistentVector" ..)
06:21lnostdal_hah, nice hack there :)
06:40ambrosebshave some fun playing with relational arithmatic with core.logic https://github.com/frenchy64/Logic-Starter/wiki/Arithmatic
06:41michaelr525hello!
07:05clgvlnostdal_: another way is to use cond and instance? see ##(doc instance?)
07:05lazybot⇒ "([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false"
07:08pigeonsI'm not a dev, but want to try someone's project, I'm on debian and have the "clojure" package installed. Project comes with a project.clj file. How do I build it? Thanks ;)
07:08lnostdal_ah, yeah, clgv
07:08clgvambrosebs: how about arithm*e*tic? ;)
07:08ambrosebsclgv: ...
07:09ambrosebslive and learn
07:09clgvpigeons: install leiningien and do a lein uberjar and then sart it like a jar
07:09pigeonsthanks!
07:09clgvpigeons: https://github.com/technomancy/leiningen/blob/master/README.md
07:10clgvambrosebs: where is aleph on that page? ;)
07:11clgvI want to add multiples of infinity ^^
07:18ambrosebsnew link https://github.com/frenchy64/Logic-Starter/wiki/Arithmetic :)
07:18ambrosebssigh
07:21clgv:D
08:13aleonhardtcall me mad, but i've been trying to get clojure to work with matlab via JVM bridge. that is, i define java classes with gen-class and try to instantiate them from matlab.
08:14aleonhardtdoesn't work at all, though.
08:14aleonhardtusing lein to produce an uberjar, matlab doesn't want to find my generated classes.
08:14aleonhardtjar works from java, scala, groovy, mirah...
08:15aleonhardthaven't been able to pinpoint the problem. one apparent issue seems to be that matlab can't import clojure.lang.RT for whatever reason.
08:16aleonhardtdoes anyone have any idea where to continue looking?
08:16ordnungswidrig1aleonhardt: which jvm version does matlab use?
08:16aleonhardtordnungswidrig1: let me check.
08:17kephalealeonhardt: if you're on OS X matlab uses the apple JVM, other OSes it uses a built in JVM
08:17kephaleand you have to change it manually somehow, but i forgot those details
08:17ordnungswidrig1maybe it's due do classfile version or like that.
08:17aleonhardtJava 1.6.0_04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
08:17aleonhardti've set the JVM to my system one, using MATLAB_JAVA.
08:18ordnungswidrig1aleonhardt: that should be fine for clojure. what is the exact error message from matlab?
08:19aleonhardtordnungswidrig1: it's fairly generic. "??? Error using ==> import Import argument 'org.bla.MyTest' cannot be found or cannot be imported." -- unfortunately.
08:19aleonhardtinterestingly, clojure.lang.Compiler, clojure.lang.Var, etc. import without hiccups -- clojure.lang.RT, though, can't be found.
08:20aleonhardtbut that may be irrelevant.
08:20aleonhardtas i said, using gen-class, not invoke.
08:20ordnungswidrig1hmm
08:21ordnungswidrig1I don't know matlab, so I think I cannot help any further.
08:21aleonhardtthanks anyway.
08:22kephalehrm… *boots matlab*
08:22aleonhardtit's odd: the jar works from any JVM-using environment. groovy shell, scala shell, java applications. with matlab -- even using system JVM! -- it simply dies.
08:23aleonhardtkephale: hey, that'd be wonderful. if you can get even the tiniest clojure class to work, then I at least know that it's my set-up.
08:26kephaleyou get that error on a "javaaddpath" call?
08:30aleonhardtkephale: nope. javaaddpath('/path/to/package.jar') runs fine.
08:30aleonhardtit's the actual import statement that fails.
08:35aleonhardti'm on R2008b, for what it's worth.
08:40pigeonsclgv: thanks for helping this newbie. I can't get the lein generated uberjar to work yet, some manifest signature and classpath issues, but I can run the project just fine with "lein run", and that's all I need for now
08:40clgvpigeons: good :)
08:42clgvHow can I define a project neutral way to detect whether I am within a jar or not?
08:42kephalealeonhardt: well, i can confirm clojure.lang.Compiler loads fine
08:42clgvpreviously I checked for one of my clj files. but that wont work in a different project.
08:43kephalebut i have a cannot be found error for importing the user-defined class
08:47aleonhardtkephale: got disconnected. any luck?
08:48kephalei have clojure.lang.Compiler loaded
08:48kephalebut matlab can't even find the user-defined class
08:50aleonhardtalright, so it's a real problem...
08:52kephalei dont get the RT issue though
08:52aleonhardtinteresting.
08:53aleonhardthm, i'm pretty sure that i don't know enough about java classloader stuff to get anywhere. damn shame.
08:53kephalebut, depending what you're doing in matlab, you might be able to work the other way
08:53kephaleand have clojure call matlab with matlabcontrol
08:55aleonhardtin this case, unfortunately not. i'm writing a matlab toolbox wrapping a bunch of clojure functions.
08:56kephalemmm… well if you figure it out post it somewhere/here, i'm probably going to have to get this running before long as well : P
08:57aleonhardtwill do. thanks for your help!
08:58kephalegood luck
09:09pyrdamn you clojure, now i have to gain tomcat knowledge
09:09pyri have successfully avoided that for 10 years
09:11manutterhmm, is there a #tomcat channel
09:12pyrmanutter: i'm sure there is :)
09:12manutterI may need that myself some day soon
09:44michaelr525pyr: why tomcat?
09:46michaelr525why not some lightweight alternative such as http://tjws.sourceforge.net/ or winstone?
09:58pyrmichaelr525: good question
09:58pyri want good mechanisms for pushing a simple (ring) webapp to multiple servers
10:01pyrmichaelr525: seems like winstone is out because it hosts a single webapp perserver
10:03coopernu_pyr: perhaps jetty?
10:04pyris that a general recommendation, to stay away from tomcat for deploys ?
10:04chewbrancaI need to stop programming ruby in clojure, I find myself making lots of little utility functions and comprising primary functions out of those utilities, which I don't think is the clojure way
10:04pyrsorry to go a bit off topic
10:04pyr(even though it's directly related to clojure)
10:05coopernu_pyr: tomcat is totally fine -- it just sounds like you wanted to avoid it
10:05chewbrancaalthough, it is beneficial for getting familiar with things, make something small work, move onto the next bit, and once you get these small bits working, recombine them into something bigger and refactor
10:05coopernu_jetty has less configuration
10:05coopernu_both can host multiple war files, which sounds like one of your requirements
10:06michaelr525i'm also thinking what servlet container to use for scalable web app
10:06michaelr525..
10:07chewbrancahow much do you guys break apart functionality? so for instance right now I'm writing a function that will split a block of text on newlines, and then it will split up the words for each line, right now I have a split-lines function, split-words function and a split text function that basically does (map #(split-words %) (split-lines text))
10:08coopernu_chewbranca: that seems reasonable
10:09coopernu_michaelr525: tell me more about scalable. are you doing a normal webapp, or are you using websockets/comet/long polling
10:09pyrcoopernu_: i'm not trying to avoid tomcat in particular
10:10michaelr525i made a rule for myself that a function should express genrally just one idea
10:10pyrcoopernu_: i'm not really trying to avoid anything,really
10:10chewbrancacoopernu_: ok cool, so basically having wrapper functions isn't necessarily frowned upon, I guess it depends on whether you want to use those pieces again
10:10coopernu_pyr: ok, well tomcat is certainly stable
10:10michaelr525coopernu_: normal
10:10coopernu_chewbranca: yep, I think for clojure, small functions are good. easy to test
10:11chewbrancamichaelr525: typically I agree, but is it worth doing (defn split-words [line] (split line #"\s+"))?
10:12coopernu_michaelr525: ok, then jetty or tomcat would both be fine. if you're using HttpSessions, then you might look at tomcat + this session store: http://code.google.com/p/memcached-session-manager/
10:12michaelr525sure, it let's you write the program in english like language
10:12coopernu_another option is to punt and use a PaaS offering like GAE or heroku
10:12coopernu_or elastic beanstalk
10:12chewbrancaok I'll agree with that, just seems like clojure gives you enough expressive power that actually declaring the function is almost as verbose as the function itself
10:14pyrcoopernu_: yeah looks like jetty is very interesting too
10:14chousermaybe (def word-boundry #"\s+") ... (split line word-boundry)
10:14coopernu_pyr: yes, at this point they're more similar than different. jetty has a history of being easier to embed/smaller. e.g. ring bundles it as a dev dependency. tomcat is bigger
10:15coopernu_but in a production environment that isn't a consideration
10:15pyryes
10:15pyreven if i was using jetty
10:15pyri still wouldn't use the embedded version but war deploys
10:15coopernu_right
10:16pyrmuch easier to integrate with jenkins
10:16coopernu_ah, do you plan on hot deploying from jenkins to your app servers?
10:17pyrprobably for staging
10:18coopernu_ok
10:18pyrproduction will pull from blobstore and use pallet most likely
10:18pyri don't want auto deploys to production, never a great idea :)
10:18pyrbut still want one click
10:19coopernu_cool, I wasn't familiar with pallet
10:19pyrpallet is going to be really big
10:19coopernu_googling..
10:19pyrit's the first all in one tool for cloud orchestration, scaling, command and control and configuration management
10:20pyr(in clojure, mind you!)
10:20coopernu_yeah, I'm reading the github readme.. looks like chef or puppet, but written in clojure
10:21pyryep
10:21pyronly it goes one step further than chef & puppet
10:21pyrwhich i like about it
10:21coopernu_tell me more
10:22pyrit was meant from the ground up to spawn vms
10:22pyrthen apply configuration to it
10:22coopernu_reading docs.. "No server".. thank god
10:23coopernu_that is what kept me away from puppet
10:23pyr:)
10:23sridpallet paas in clojure? never heard of it
10:23pyrit's not paas, it's a library
10:23pyrto let you build your automation
10:24manutterhmm, would pallet work with virtualbox on my local dev machine?
10:24pyrcoopernu_: the great thing is that being a clojure library, you can very easily integrate it in your favorite IRC bot, internal webapp, ...
10:24pyrmanutter: yep
10:24manutter:D
10:24pyrmanutter: through vmfest
10:24manuttergot some more googling to do I see
10:24coopernu_pyr: yes, I very much like what I'm reading
10:24pyrmanutter: so test your cloud deploy locally, validate, push to EC2/rackspace/...
10:24coopernu_I may have use for this
10:25manutterme too, most definitely
10:25sridyes, not bad for a relatively new language
10:26sridbecause of existing java libraries, I think
10:26coopernu_srid: agreed, and the build tools like lein, which make it trivial to consume that ecosystem
10:26pyrit relies on jclouds so most of the vm building stuff was done, still
10:27pyrthe crate language is very cool
10:27coopernu_lein/clojars is what I always wished maven was
10:32pyri'll just say it again, while we're on the subject, if someone wants to come work on that kind of problem (infrastructure, backend, storage, recommendation) all in clojure, my company is recruiting in .ch
10:33sridwish i lived in swiz
10:34pyrit's become more & more attractive with the current state of the economy ;)
10:34coopernu_me too. visited zurich during euro 2008 and loved it
10:35pyrin that case it's lausanne, the french speaking part
10:37lnostdal_hm, functions to search in non-associative structures seem to be somewhat lacking
10:37lnostdal_(?)
10:38dnolenlnostdal_: like searching for something in tree structures?
10:38lnostdal_nope, searching in vectors and lists
10:39mmarczyklnostdal_: vectors are associative, you search by index
10:39mmarczykget-in / assoc-in / update-in all work
10:39dnolenlnostdal_: something more than some, filter?
10:39lnostdal_mmarczyk, by value
10:39mmarczykah
10:40lnostdal_oh, i guess some+identity will work .. err, gonna try
10:40lnostdal_, dnolen
10:40clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: dnolen in this context, compiling:(NO_SOURCE_PATH:0)>
10:41lnostdal_#(= % <my item>) ;; i mean
10:41lnostdal_thanks .. forgot about some
10:44raeklnostdal_: once you find the item, what are you going to do with it? if you just want to check whether it's there, consider using a set and 'contains?' instead?
10:44raek*instead.
10:44lnostdal_set doesn't work since there might be multiple entries of the same object
10:45lnostdal_(set [1 2 2 3]) => #{1 2 3}
10:46manutter,(map #(#{2}) [1 2 2 3])
10:46clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval1915$fn>
10:46manutter,(map #(#{2} %) [1 2 2 3])
10:46clojurebot(nil 2 2 nil)
10:47raek,(map #{2} [1 2 2 3])
10:47clojurebot(nil 2 2 nil)
10:47manutter,(some #{2} [1 2 2 3])
10:47clojurebot2
10:48raeklnostdal_: but in that ^ example there is two 2s, and you don't know which one it matched with. so in a sense it's the same thing there
10:48TimMc,(some #{nil} [1 2 nil])
10:48clojurebotnil
10:49manutter$findfn #{life universe everything} 42
10:49lazybotjava.security.PrivilegedActionException: java.lang.Exception: Unable to resolve symbol: life in this context (NO_SOURCE_FILE:0)
10:49manuttero snap
10:49TimMclazybot: How about alife?
10:49TimMcHow about alife???
10:49lazybotTimMc: How could that be wrong?
10:49TimMcmuch better
10:53stuarthallowaywhat say we release Clojure 1.3?
10:53stuarthallowayanybody got a bug that says we shouldn't ?
10:53lnostdal_what about the contribs?
10:53stuarthallowaylnostdal_: ok, fair
10:53stuarthallowaywhich ones in particular?
10:54stuarthallowaystuartsierra is working on setting up a matrix build in Hudson to verify all the modular contribs against 1.2 and 1.3
10:54lnostdal_oh, and i sometimes miss recur from within catches
10:54stuarthallowayall the ones I use are working well, and have been for a while
10:54lnostdal_http://dev.clojure.org/jira/browse/CLJ-667?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel .. i think, but i just googled that right now
10:56lnostdal_yeah, i think that's the one .. the patch applies to 1.3 from git with some slight modifications and it seems to work for me
10:56stuarthallowaylnostdal_: I just moved that ticket into approved backlog
10:56stuarthallowaydon't think I would hold release for it though
10:58TimMcstuarthalloway: So it is definitely not going to be 2.0?
10:59stuarthallowayTimMc: true
10:59TimMcOh well. I'm sure it has been argued to death on the ML.
11:00mmarczykstuarthalloway: I've got sth
11:00mmarczyk,(contains? (transient {:foo}) :foo)
11:00clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>
11:00mmarczyk,(contains? (transient #{:foo}) :foo)
11:00clojurebotfalse
11:00mmarczyk,(contains? #{:foo} :foo)
11:00clojurebottrue
11:00mmarczyklooks buggy...? noticed it recently and didn't post on the ggroup yet
11:00stuarthallowaymmarczyk: is that the same as http://dev.clojure.org/jira/browse/CLJ-829 ?
11:02stuarthallowaytransients have oddities, but they are still alpha
11:02mmarczykstuarthalloway: well, I can't see it being the same at first glance
11:02mmarczykbut wouldn't no for sure without investigating
11:02stuarthallowayand in absence of patches from the community I would ship with known issues in transients
11:02mmarczykok; will posting a ticket about this and trying to come up with a patch be fine?
11:03mmarczykeven if it's for post-1.3
11:03stuarthallowaysure
11:03mmarczykok, thanks; will do
11:03stuarthallowaythank you!
11:03mmarczykstuarthalloway: one more thing
11:04mmarczykI might be crazy, but I recently noticed that :doc metadata appears to be ignored on symbols naming namespaces
11:04mmarczykif you include the doc string in the ns form as a string, it gets attached to the ns object
11:05mmarczykif you attach it as :doc meta to the ns name, it doesn't
11:06mmarczyk,(:doc (meta (the-ns 'clojure.core)))
11:06clojurebot"Fundamental library of the Clojure language"
11:06mmarczyk,(:doc (meta (the-ns 'clojure.set)))
11:06clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.Exception: No namespace: clojure.set found>
11:06mmarczykoh, whatever; it's nil at my repl
11:07pjstadigshipit!
11:08stuartsierraSpeaking of CI builds...
11:08stuartsierraAnybody here familiar with using Zippers for XML parsing
11:08stuartsierra?
11:08stuarthallowaymember:mmarczyk: patch welcoe
11:08mmarczykhm, I went off to find the docs promising meta :doc would be honoured, but cannot find any... nvm & sorry then
11:08stuarthalloway...welcome
11:09mmarczykstuarthalloway: yeah, I'll write one as an enhancement
11:09mmarczykfor 1.4 :-)
11:09mmarczykstuartsierra: why?
11:09stuarthallowayafter 1.4 we get to jump straight to 5.0. It is a JVM tradition
11:10raek:)
11:10stuartsierrammarczyk: Just looking for some advice
11:11chouserstuartsierra: that's cool as long as we can *also* refer to 5.0 as 1.5 and 6.0 as 1.6. Because otherwise it's just not as much fun.
11:11chouserer, stuarthalloway ^^
11:12stuarthallowaychouser: of course!
11:13stuartsierraThere's got to be a better way to do this: https://gist.github.com/1188879
11:14TimMcCan we have clojure-lang 2.0 and Clojure™ 1.3?
11:14chouserstuartsierra: zip-filter?
11:15stuartsierrais that what I need?
11:15chouserit might help. That's what it was made for, extracting useful bits from XML trees.
11:16TimMcActually, the way I refer to the current version of Java is "Java 7" or "Java v1.7" <- "v" means "API version" to me
11:18joegalloClojure 2.0 SE, v1.3
11:18TimMcyeah
11:18TimMcExcept it would be Clojure 1.3 SE, v2.0
11:19joegallonah, the 2 is the marketers, the 1.3 is the engineers, just like java.
11:19TimMcsince Clojure is making big ol' breaking changes without bumping the major number, and Java made (mostly) non-breaking changes while bumping the minor version.
11:19joegallothen we can skip straight on to Clojure 5, v1.4
11:19tomoj&(class (hash-map))
11:19lazybot⇒ clojure.lang.PersistentArrayMap
11:19joegallolike winamp
11:19tomojhmm
11:19TimMcjoegallo: Right, but the marketing version of Clojure *is* 1.3, as it stands.
11:20TimMcAnyway, I *really* shouldn't haul the IRC channel into this again.
11:20TimMctomoj: How about them hashmaps!
11:20joegalloheh
11:21TimMcjoegallo: Actually, I think that's a safe topic, even for versioning: Both Winamp and the Canon Powershot S# skipped version "4" -- and I think it has to do with some Asian language.
11:22TimMcIt's either zn or jp where "four" sounds like "death".
11:23TimMczh, excuse me
11:25Kototamahello i'm having some trouble with compojure
11:26Kototamai have a formular on / and i do a POST on /files but when i click the button, the browser open the /files URL
11:26Kototamai just want to process the POST request but stay on the same page
11:26coopernu_Kototama: can you make a gist with your code?
11:26Kototamasure
11:27manutterKototama: sounds like your form is missing an action tag
11:27manutteror malformed somehow.
11:27manutterhave you done View Source on the page where the form is?
11:27TimMcKototama: If you are on / and you POST to /files, the browser is expected to go there.
11:27TimMcperhaps you want target="_blank"?
11:28Kototamai just copied some Java servlet code and it seems to POST /files and the browser stay on /
11:28Kototamathe target is an iframe in this code
11:28manutterdoh, I'm thinking ajax stuff
11:28TimMcSounds like an HTML issue, not a compojure problem.
11:29TimMcMy guess is that you need to fix your target attribute on the form.
11:29Kototama a POST to any URL redirect the browser to it?
11:29TimMcin general, yes
11:29manutterKototama: is there javascript on the page in the original servlet?
11:30manutterKototama: it may have some client-side code that intercepts the submit and turns it into an ajax call
11:30Kototamayes there are some js
11:30Kototamahttps://gist.github.com/1188930
11:31Kototamahttps://gist.github.com/1188935
11:32manutterKototama: the other possibility is that the original servlet receives the POST on /files, and then does a redirect back to /
11:33Kototamawhat should go in the {:body} of a function responding to a POST so that the page does not change?
11:35Kototamathe original servlet is here https://github.com/carneades/carneades/blob/webservice-01/src/CarneadesWebGUI/src/main/java/org/fokus/carneades/carneadeswebgui/CarneadesServlet.java
11:35coopernu_Kototama: you could try setting the name attribute on the iframe
11:35Kototamai don't see any redirection but i'm really new to web dev
11:35coopernu_[:iframe {:id "lkif-source" :name "lkif-source" ...
11:35coopernu_see - http://stackoverflow.com/questions/168455/how-do-you-post-to-an-iframe
11:36coopernu_but so far it's not really a clojure problem
11:37Kototamaok but then for compojure should it makes more sens to post to / then ?
11:37coopernu_no, I think what you have is fine
11:37coopernu_regarding the compojure routes
11:37TimMcKototama: No, the "POST, redirect to GET" is a common pattern.
11:38TimMcKototama: https://secure.wikimedia.org/wikipedia/en/wiki/Post/Redirect/Get
11:38Kototamaseems to work now
11:38coopernu_great
11:38Kototamamaybe it was just the name in the iframe?
11:38TimMcthat would do it
11:38coopernu_yeah, I think you need the name attribute
11:38Kototamais target targetting a name or an id?
11:38coopernu_name
11:39Kototamacool
11:39Kototamai feel better :-)
11:39coopernu_excellent
11:39Kototamathanks all for the quick help!
11:39Kototamaone more piece of java code that will disappear from this earth
11:39coopernu_heh
11:47stuartsierrachouser: Thanks, much better now. https://gist.github.com/1188879#gistcomment-48813
11:49RaynesKototama: It wont disappear. Once created, it can never be destroyed. It'll always exist down there, deep in the trenches of version control. Waiting...
11:51Kototama:-)
11:51Kototamabut if all go fine, next trainee will have to learn clojure ;-)
11:52Raynesmmarczyk: Long time no chat. I recently stumpled upon the cup of coffee you sent me and smiled. <3
11:53mmarczykRaynes: indeed! I stumbled upon one of the photos yesterday :-)
11:53coopernu_just wrote my first test today that used (proxy) to mock a java interface.. wow. much less verbose than jmock/easymock
12:00mmarczykRaynes: congrats on the book deal, I'll be ordering a copy as soon as that becomes possible :-)
12:00Raynes<3
12:14alpheusRaynes wrote a book? I've been a way from #clojure way too long!
12:14RaynesStill writing it, but yes.
12:17pyrtitle ?
12:23TimMcThat is the last thing one writes.
12:31edoloughlinI'm implementing a REST api using Clojure as the backend and am beginning to feel that I need the equivalent of XML Schema for the maps I'm building. Is there an idiomatic way of doing this?
12:31coopernu_edoloughlin: tell us more about why you feel you need XML Schema. for validation?
12:33edoloughlinPerhaps I haven't structured my code well (this is my 1st serious Clojure project), but I find that the maps I build and then convert to XML/JSON have fields & sub maps added in different .clj files. I'd like there to be a central place where I define the structure of these maps before things get out of hand...
12:37coopernu_I see
12:41coopernu_maybe use defrecord for each element?
12:41coopernu_that would at least provide an artifact in the code that would self document the expected properties of each element
12:44edoloughlincoopernu_: I might do that. Seems like the best option.
12:44edoloughlincoopernu_: Thanks.
12:44coopernu_edoloughlin: no problem. another interesting thing you can do if you use defrecord, is make a serialize protocol, and make json and xml impls
12:45coopernu_and the protocols can switch based on the type of record. that would put all your xml and json serialization for related records in a single place
12:45coopernu_I'm just speaking off the top of my head, I haven't written anything like this myself. but I think that's one of the advantages of using records vs plain maps
12:45coopernu_is that you can use them with protocols
12:46edoloughlinHmm. Wish I'd known about that a while ago ;-/
12:46coopernu_I bet it wouldn't be a terrible refactor
12:46edoloughlinYeah, s'pose most of the hard work's done. It would make things a lot cleaner.
12:56michaelr525back
13:20amcnamarao/
13:40TimMc`fogus: Can you give a succinct problem statement, or a link to a blog entry about it?
13:45amalloyTimMc: i think the problem is basically: (let [x (. obj method)] (x)) is not equivalent to (. obj (method))
13:46amalloybut that's just what i remember hearing; i don't do any cljs
13:46TimMcSomething to do with methods vs. functions, then?
13:46TimMcOK
13:47Scriptoriirc, methods can't be used as first-class functions if you do it like that
13:47amalloyright. js objects have a `this` pointer, which normally gets set to the object they're a method of even if you pass them around some other way, but clojure uses a lower-level mechanism that bypasses that
13:48TimMcI wonder how Mozilla's JavaScript handles Java interop.
13:48TimMcamalloy: I'm not sure that's correct. [].slice doesn't have a "this", you have to bind it.
13:49amalloyTimMc: well, if i'm wrong then let me say in my defense i don't know much about javascript either, i just like answering questions
13:50TimMcheh
13:50TimMctypeof java.lang.String.toString -> "function"
13:52TimMcIt looks like MozJS can wrap methods.
13:56`fogusTimMc: http://dev.clojure.org/display/design/this
13:56TimMcthanks
14:41TimMc`fogus: (defn whee-python [self, a, b] ...)
14:41TimMc:-P
14:49TimMcIs there a REPL I can check out somewhere? I'd like to see what CLJS compiles into.
14:51ibdknoxIs the person who owns learn-clojure.com on here?
14:56TimMcAh, never mind -- for some reason I thought it was already self-hosted.
14:57amalloyTimMc: ask ibdknox, he can probably compile cljs in his head
14:57ibdknoxlol
14:57ibdknoxBasically.
14:58TimMcOK, so what does (defn foo [a b] ...) actually compile into?
14:59TimMc(currently, I suppose)
14:59imadehello, quick question, I have a function that has a parameter with long and decriptive name, but inside the function body I would like to use a shorter name for the same parameter, is (let []) the only way to achieve this?
14:59ibdknoxTimMc: myns.foo = function(a, b) { ....}
14:59amalloywell. as written, probably the empty string, because the compiler sees that "foo" is unused and omits it
14:59ibdknoxamalloy: not until it hits the gclosure compiler
15:00amalloyimade: can you imagine a more convenient syntax that would make sense?
15:01imadeamalloy: I sort of remember there was smth just for that, but let is fine also
15:01manutterimade: (let []) is the best way to do it afaik
15:01imadeamalloy: k thx will use let then
15:02manutterimade: you might be thinking of the :as tag in destructuring?
15:02ibdknox(inc manutter)
15:02lazybot⟹ 3
15:02imadeamalloy: yep, but that works for collections
15:03TimMcTHe only other renaming support I can think of is in :use.
15:03TimMcor :require, I guess
15:03manutterimade: right, it's not what you're really looking for, but I thought you might have been vaguely remembering it
15:04imadeamalloy: as a first attempt I did use :as but then remembered that wait a moment...
15:04TimMc`fogus: So what's wrong with just special-casing the symbol "this" so that it can always be used?
15:04TimMcPretend it is a global.
15:05`fogusTimMc: Because we do not want to preclude the use of this as a legal ClojureScript name
15:05TimMcI was afraid of that.
15:07`fogus(extend-type Foo Bar (baz [this a b] ...))
15:07imadebtw, one more general question. Some problems/algorithms are more suited for imperative style or perform much better in imperative style. How do you deal with this kind of situation in clojure if you can't think of a effective way to implement it in a functional style? One way is to implement that algorithm in Java and call it from Clojure. Just curious.
15:08TimMc`fogus: Right, the Python-style approach. (I don't know the actual origin of that style in OOP.)
15:08`fogusimade: If that's ever the case, then you can bang away at mutable Java things easily with Clojure.
15:08`fogusTimMc: I guess you could look at it that way
15:09TimMcimade: Look into transients.
15:09amcnamaraimade: also note that let bindings hold intermediary state. (ie. let [a 1 b a])
15:09amcnamarawhich can take care of 99% of those imperative-like calculations
15:09`fogusTimMc: Although this in the Clojure code does not refer to the same thing as Python
15:09`fogus's self
15:10TimMc`fogus: Is the issue then that you don't want to have more reserved names in cljs than in clj?
15:10imadek thanks for the inputs
15:10`fogusTimMc: I don't follow
15:10TimMcRight, Python is more strict about context.
15:11TimMc,(let [do "`fogus"] do)
15:11clojurebotnil
15:11TimMc^ example of a reserved name
15:11TimMcHah, this reminds me of anaphoric macros.
15:13`fogusTimMc: If we can avoid adding reserved words then we will
15:13TimMcOK.
15:15dnolenamalloy: mind answering the clojure-dev thread for match?
15:15TimMcAnyway, I think I've misunderstood the problem. You want implicit context-binding when (.method obj) returns the function, yeah?
15:26amalloydnolen: link?
15:26TimMcIs there really a use case for functions that can both have and not have a context?
15:27TimMcibdknox: What currently happens if you use "this" as a variable name? Does it just get munged?
15:28amalloynever mind. response shortly
16:17jliI believe it's the case that javascript regexs can be used for global replace with a flag in the regex, but there's no corresponding flag in java regexes
16:18jliso, is the only way to do global replaces in clojurescript to use javascript's regex literals with js*?
16:18jlie.g. (js* "/regexp?/g")
16:26dnolenamalloy: thx
16:27amalloy(doto #"regexp?" (-> (.global) (set! true)))
16:27fdaoudquick question: is there a function that takes two seqs, e.g. [1 2 3] and [a b c], and returns [[1 a][2 b][3 c]]? (nevermind vectors vs lists)
16:27amalloyclojurebot: zip?
16:27clojurebotzip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))
16:28amalloyjli: which expands to (let [r #"regexp?"] (set! (.global r) true) r)
16:28fdaoudthanks amalloy!
16:31stuartsierraBoom! We have Matrix CI jobs. http://build.clojure.org/
16:45coopernu_nice!
16:47hiredmanamalloy: you should have replied with "and my axe!"
16:48amalloyfeh
16:48amalloysomeone would file a jira ticket about my insufficiently-formal agreement
16:48hiredmanyes
16:48hiredmanI would
16:48dnolenstuartsierra: hey that is coooool.
17:05amcnamaraRandom thought: "Rich Hickey and the Stuarts" would make a great band name.
17:06Bronsalol
17:11stuartsierraI wanted to make a Clojure/Conj band and call it "Function of the Past"
17:14amcnamarastuartsierra: If you do that I'll make a band called Lazy. I'll only play one note at a time, and only when asked.
17:14Bronsalol
17:15stuartsierra"Rich Hickey and the Lazy Cons Cells"
17:23jliamalloy: ho. so "global" is a field on javascript regexs, not java ones, is that right?
17:23amalloyyes
17:24amalloyit's kinda absurd for it to be a field on regexes at all. it should be an argument to replace
17:25jliamalloy: well, what about the other flags? idmsux and all
17:25amalloywhat about them?
17:25jlido you think they should be arguments to regex functions vs. regex fields?
17:25jlioh, nevermind
17:25jliI understand
17:32jlihum, why are \uFDD0 and \uFDD1 safe to use as keyword and symbol prefixes?
17:32stuartsierraI think they're in the "private use area" of unicode.
17:34jliah.
17:39lobotomy_hmm, i take it the clojure.contrib.combinatorics/combinations function is efficient?
17:40lobotomy_doing a combinatorial search algorithm and for some reason i decided to generate combinations in the inner loop
17:40lobotomy_which hopefully isn't actually necessary, but still: probs not worth implementing my own combination generator for that? :)
17:41lobotomy_to elaborate, i'm using the combinations to avoid duplicates, since i often have many identical pieces
17:43amalloyuhhh
17:44amalloyfinding the combinations of a seq of length N is necessarily O(n!). it can't be more efficient than that, so doing it in some inner loop when you don't have to is probably not a good idea
17:46amalloymodulo my bizarre inability to consistently choose either N or n
17:57lobotomy_amalloy, well, if i have say two knights to put on the board, i need some way of not generating the duplicate solutions
17:58lobotomy_i have to go through each combination of all-free-squares choose 2 in any case
17:58lobotomy_so the O(n!) seems unavoidable - and usually (but not quite always) there aren't a gazillion combinations
18:02lobotomy_sure, in e.g. the 8 queens puzzle my solution would first generate the 64 choose 8 different ways of putting every queen on the board, but i guesstimate that in the general case, 1) there will be fewer combinations and 2) there won't really be a better way to deal with duplicate non-generation anyway
18:06amalloy64c8 is a hideously inefficient way to solve N-queens. just do the simple optimization of only looking at each column (say) once, then it's just 8^8
18:13dnolenhas some exciting news about solving problems like nqueens in Clojure ... keeps your eyes peeled ...
18:14grioshi. Does "#(% x)" stand for "(fn[x] x)"?
18:14Bronsano
18:14Bronsamore like (fn [y] (y x))
18:15scottjgrios: #(identity x) is as close to (fn [x] x) as you can get
18:15scottj#(identity %) rather
18:15amalloyscottj: #(do %)
18:15scottjoh yeah, forgot about that one
18:15amalloyand #(identity %) is just identity anyway
18:16griosok thanks
18:16grios#(do %) ... interesting
18:27lobotomy_amalloy, my point was that since i'm not doing the 8 queens puzzle, the solution isn't completely terrible, like it would be for the 8 queens puzzle
18:29griossee you guys
18:29griosbye
20:16livingstonif I want to expose some clojure code to java callers, I can easily use defrecord/defprotocol etc. for instances but what if I have what in java would be a static method on a class? how do I expose something like that?
20:17livingstonbasically I have a clojure function that I'd like java users to call like they usually would a static, but with out the RT.load(...) RT.var("ns", "function") rigamarole that looks "foreign"
20:21livingstonthis is the best I've found so far http://java.dzone.com/articles/java-clojure-interop-calling using gen-class
20:25tomojlivingston: that's the best there is I believe
20:26livingstontomoj: thanks, i'm trying to decide just how much it's worth trying to hide RT
20:27livingstonif you do you can tell Java people "oh, it's just a library" but once RT etc. shows up they start to say "wait a minute..."
20:29tomojdoes it pain you to use gen-class?
20:31tomojthat there is no nicer way to call regular clojure fns is deliberate, see http://dev.clojure.org/display/design/Improvements+to+interop+from+Java (esp. first comment)
20:34livingstontomoj: yeah I'm mostly sympathetic to all that... but importing is still a bit of an issue. people have RT.load before they can find the var.
20:35livingstonthat's not that huge an issue but it ups the "weirdness" ante.
20:36tomojand then it's all invoke
20:37tomojI don't see how anything but gen-class could make them happy, even if there _were_ an easy way to get ahold of the var
20:37tomojs/easy/easier/
20:38livingstonthe invoke I'm ok with. that's ok. I think the java guys can deal with that. the dynamic code loading though a call may be bothersome (nevermind that's what the java class loader is doing)
20:39tomojand then everything is Object too?
20:39livingstonjava people (that do interesting things) aren't un-use to things like .invoke() because if they do anything with visitors / call-backs that's the only way for them.
20:39livingstonwill they have to type-cast ever return? as function parameters that not a deal, the compiler will silently lift them to Object for them.
20:40tomojyeah, they will
20:40livingstontomoj: yeah they will ? have to cast every return?
20:40tomojyeah
20:40tomojgen-class lets you specify param and return types
20:41livingstonhm. that may bother them a bit.
20:41livingstoncan I specify return types on defprotocol? not yet right?
20:42tomojdunno, if you can I think just for clojure's sake, not to change the actual type signature
20:43livingstonthat would be highly useful for this.
20:43tomojwhat's wrong with gen-class?
20:44livingstonotherwise you would have to use actual java interfaces instead of protocols
20:44livingstontomoj: I have a lot of record/protocols already set up on the clj side, I just wanted to expose them to the java guys.
20:45livingstonthe "constructors" though are pure functions right now, that get you one of those, then they have protocols to call, that's easy, but the return types are still mildly problematic.
20:45livingston(stupid statically typed language ;) )
20:49tomojwell, I guess you could provide any statics with gen-class and also expose the stuff you've got :/
20:49livingstonat this point I"m resigning to just have them deal with it ;)
20:55livingstonis there a simple way to call a function that would take key word parameters from java? or do they have to get the keyword symbols to pass into invoke?
21:00amalloyhow else could it work?
21:00amalloyhaha whoops, missed a chance to use a bot. could it work any other way??
21:00lazybotamalloy: Definitely not.
21:00livingstonmagic, I don't know... I didn't think so, just checking
21:01amalloy*shrug* you could write a little clojure wrapper that does the keyword conversion
21:01livingstoni'm just afraid they'll look them up everytime.
21:01amalloybut i guess then you couldn't pass any strings that *aren't* keywords
21:36NetpilgrimHi. I'm playing around with records and protocols for the first time and get an exception with a few simple code lines as shown here: https://gist.github.com/1190370 Could somebody have a look and explain the problem to me?
21:37NetpilgrimArgh, never mind!
21:37amcnamarapaste the exception
21:37NetpilgrimDamn typo, I hadn't seen after reading the code a dozend times.
21:38livingston,(doc reduce)
21:38clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
21:41NetpilgrimBut perhaps someone could look at the posted problem nevertheless and explain the following to me: I had mistyped a function name add-conn as add-con but the exception message reads “Can't define method not in interfaces: add_conn” – it doesn’t refer to the mistyped function name.
21:46dnolenNetpilgrim: you can't define multiple arities for protocol fns.
21:46livingstonyes you can but not like that
21:47Netpilgrimlivingston: How would I do it?
21:47livingstonyou have to do (defprotocol p (fn [x] [x y]))
21:47Netpilgrimlivingston: Ah, thanks.
21:47iceydnolen: your link on HN in the "Clojure Hills of Abstraction" thread (http://news.ycombinator.com/item?id=2955389) is [dead]ed - I'm guessing your comment double posted and you deleted the wrong one. Anyways, you're the only one who suggested slimv and VimClojure... you might want to re-add your comment
21:48dnolenicey: ? looks ok here.
21:49iceydnolen: look at the thread in anonymous mode - it will look fine to you if you're logged in as you
21:49iceyerr, incognito mode
21:50livingstonNetpilgrim: the second definition clobbers the first and it says there is no two argument version
21:51iceydnolen: crazy, it killed the second one too. i wonder if one of the links is banned or something
21:51Netpilgrimlivingston: That explains it.
21:52tomojwow
21:52tomojI didn't think protocol fns could have multiple arities either
21:52dnolenlivingston: wow, somehow I totally missed that.
21:52dnolenlivingston: I guess rest args is what aren't supported.
21:53livingstonI would assume that could be done to, you can do it in java too but I've never tried
21:53tomojso how do you implement both arities?
21:53tomojjava's is just compiler sugar over an array as last param, isn't it?
21:53dnolenicey: weird, oh well.
21:53livingstontomoj: Netpilgrim had it right except for the protocol def
21:54Netpilgrimtomoj: https://gist.github.com/1190395
21:54iceydnolen: I'll send an email, maybe it will get fixed. It sucks, because nobody else has mentioned VimClojure or slimv in that thread
21:54tomojthanks
21:54livingstonoh well then maybe it couldn't do it since there's no way to make a jave interface of it, but I think it could with the var arg, it would take some messing with to get the code right though
21:58tomojan & in the arglist seems to be interpreted as a regular parameter
21:58livingstonin the protocol? lol
21:58tomoje.g. (deftype T [] P (p [x & z] &)) returns the second arg
21:58amalloyprotocols don't have varargs
21:59amalloyand never will; it is an undesired feature
21:59livingstonamalloy: why?
21:59tomojand by whom? :)
22:00amalloyhttp://stackoverflow.com/questions/5401378/do-clojure-protocols-allow-one-to-have-a-variadic-method-the-way-funcions-do-wit
22:02livingstonthere's not much detail in that
22:04amalloy"Protocol methods are intended to be a "low-level" mechanism, with higher-level APIs, including variable arity, built out of ordinary functions." how much more is there to say?
22:04livingstonit seems like that could just create a var-arg interface signature -- you wouldn't get destructuring but you'd get the array, although even the destructuring doesn't seem hard, grab the array, destructure it in a let and then call the function implementation
22:05livingstonyou also get java interop with the protocol and that seems oddly limiting
22:06livingstonI mean you could just accept an array too, it's not that huge, but whatever
22:07tomojhuh
22:07tomojwhen I look at that google groups post, there is a break right in the spot where you have a nbsp
22:07tomojodd
22:08fbru02hi ! where is re-gsub in 1.3 ?
22:08amalloy$findfn "jaja" #"a" "b" "jbjb"
22:09lazybot[clojure.string/replace]
22:09amalloytomoj: i replaced the newlines with spaces when pasting? is that what you mean?
22:09fbru02amalloy: thanks
22:10amcnamarawhoa, how does that function work?!
22:10amcnamara$findfn "a" "o" "ao"
22:11lazybot[clojure.core/str clojure.contrib.string/as-str]
22:11amcnamaradamn that's cool
22:12tomojamalloy: no, your message had a no break space in between "ordinary" and "functions", where I see a break in the browser
22:12tomojwhat's a no break space for anyway?
22:12amalloydunno
22:12tomojfigured it was for.. no breaks
22:13livingstontomoj: it is
22:13livingstonwhere is this though?
22:13amcnamaraits for words you don't want to appear on separate lines, like names
22:13tomojoh, I don't see the nbsp in the browser. that's comforting :)
22:14livingstonif there is any other whitespace around it though it'll then break...
22:14livingstonor if it's not actaully there,..
22:14amcnamaraalso good for keeping empty table cells from collapsing :)
22:15livingstonamcnamara: wasn't that only due to some crappy non-compliance in one of the browsers during the browser wars?
22:16amcnamaralivingston: Probably, the 90s were full of i'll-fix-this-later hacks... that are still around
22:16amalloyamcnamara: it iterates through a few namespaces (core, string, set, contrib/string) and calls every function with the supplied args, to see which ones return the right result
22:16livingstonI do remember no end of futzing with crap like that (back when I uses to work with ASP 1)
22:19amcnamaraamalloy: Neat concept. Though probably heavy to process.
22:19livingstonif you know the order of the arguments
22:20amcnamaralivingston: I'm actually worried that the same thing is happening again, with all the talk of HTML5 browsers are in a race to put non-finished standard components into their releases
22:20livingstonyeah we shall see
22:21livingstonhaving the acid tests (or whatever the hell they are called) out before the spec seems to be helping some
22:21amcnamara10 years from now we'll be pulling our hair out over old chrome and ff idiosyncracies.
22:21livingstonmaybe although two viable free browsers seems to be producing some stability
22:22livingstonis chrome actually really in the wild or is it just a geek toy still?
22:22amcnamaraI think its picking up popularity
22:22amcnamarabut my opinions are pretty skewed.
22:23amalloylivingston: clojure functions generally take their arguments in a pretty predictable order
22:24livingstonfor the most part
22:24amalloygranted it takes some time to get used to that, but i didn't know $findfn was going to return string/replace; i just asked it for a function that takes its args in the order that replace "must"
22:24amalloyyeah, everything but nth. grrrrr nth
22:26amcnamaranth gets me every time.
22:26livingston(doc ,nth)
22:26clojurebot"([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."
22:26amcnamaramaybe they'll fix it for clojure 2.0
22:28livingstonwhy is that anyway?
22:28amalloyamcnamara: bet you a dollar?
22:28amalloy$google common lisp elt
22:28lazybot[lispdoc documentation for "elt"] http://lispdoc.com/?q=elt
22:28livingstonthat would break a ton of stuff
22:29amalloylivingston: i assume it's a holdover from some other lisp
22:29livingstonoh huh, I forgot elt was that way
22:29livingstonI only even remembered elt as being 0-based and nth being 1-based
22:30livingstonI rarely called elt (although I knew it was there and understood it)
22:31amcnamaraI'll open a bug report and patch it myself!
22:31amcnamaraamalloy: for a beer.
22:31amalloyamcnamara: i hope your soul can survive being crushed
22:31amalloyby the patch being soundly rejected
22:31livingstonright... because it's a simplifed form of aref
22:32sridi am using cake. 'cake repl' launches faster and that convinces me to keep using cake. i do wonder if I can launch a cake repl client within emacs (analogous to M-x clojure-jack-in)
22:32livingstonit makes sense when I look at the other things around it.
22:32amalloysrid: cake swank
22:32livingstonsrid: why do you need to keep launching it? I've been known to keep development repls open for weeks even months
22:33sridlivingston: i keep running non-repl commands (eg: `lein run`) that has startup cost which accumultates to the point of frustration
22:33sridand i have to relaunch repl after 'lein deps'
22:33amcnamarasrid: M-x term, never leave the comfort of emacs.
22:34amalloysrid: lein interactive
22:34sridamcnamara: nice, cake autocomp. wonders in m-x term
22:36sridexcept terminal locks up all the C-x ... bindings
22:37amcnamarayeah, if it didn't you wouldn't be able to quit out-of-control procs
22:37amcnamarabut I'm trying to figure out a way to toggle focus, if I do I'll ping you.
22:37amalloywhy not just use M-x shell?
22:38amalloyi guess i don't understand what issue you're trying to solve
22:38sridcake autocomp. doesn't work in M-x shell
22:39sridlikely possible to disable emacs's TAB complete. whatever. enough yak shaving
22:41sridanyway, settled on `cake swank` and M-x slime-connect. repl in emacs with autocomp goodies.
22:46tomojlein interactive somehow lets you not restart the repl after deps?
22:46tomojoh, no, just startup alleviation, huh
22:46amalloyright
23:03amcnamarasrid: got it! http://www.gnu.org/s/libtool/manual/emacs/Term-Mode.html
23:03amcnamaraone C-c will get you C-x bindings
23:04amcnamaratwo will send kill signal to term process
23:56jblomois there a function that will seqify something if it doesn't implement ISeq
23:56jblomolike stick it in a list?
23:56jblomo(seq' 5)
23:56amalloyjblomo: that's probably not what you want
23:57amalloysince ##(instance? clojure.lang.ISeq [1])
23:57lazybot⇒ false
23:57livingstonjblomo: huh?
23:57livingstonlist ?
23:57livingston##(list 5)
23:57lazybot⇒ (5)
23:57amalloylivingston: he wants to leave '(5) alone, and turn 5 into '(5)
23:57jblomoexactly
23:58jblomoamalloy: you're right, I don't care about instance? ISeq
23:58amalloyjblomo: (a) your specification is probably wrong, because ISeq doesn't describe all seqable things, and (b) when you want to do this, it's usually because you've written something else badly
23:58livingston(defn huh [x] (if (seq x) x (list x)))
23:58amalloylivingston: (huh 5) ; exception
23:58livingstonor rather (if (seq? x) ... I think
23:59jblomoamalloy: i'm writing a fucntion that can either take a string or list of strings
23:59amalloyjblomo: see, told you you'd written something wrong already :)
23:59jblomohaha
23:59amalloyjust make it take a list of strings. if you want to special-case the length-one list, then go ahead