#clojure logs

2011-04-06

00:52amalloyhey tomoj, feel like translating the 23 lines of clojure at https://gist.github.com/905147 into 200 lines of php for me?
00:52waxroseLOL
00:52waxroseevil
00:54amalloyi especially (don't) look forward to translating that letfn. i expect the swap!/comp/juxt mess will just disappear, at least, when mutable state is easy to get
03:25thorwilhi mids! some of my recent appengine-magic problems were caused by using wrong versions, what remains is that the datastore viewer leaves out properties under certain circumstances, but now that i know, i can live with it
03:27thorwilmids: anyway, do you have an example of a handler to be called by a task queue job? currently just a do-nothing handler that simply doesn't lead to errors would be progress here :)
03:36amalloythorwil: (constantly nil) probably won't cause any problems, but i guess that's not necessarily true
03:37ejacksonmorning
03:39amalloyhola ejackson
03:50thorwilhooray for searching within source at github, this looks like it should provide a solution: https://github.com/jorisbontje/snorri-model/blob/2012a07f48ba43710cfdbb18c4854fdc5f56f30f/src/snorri_model/api.clj
03:54thorwilalas, the problem might sit somewhere else: INFO: Web hook at http://localhost:8080/admin/tasks/delete returned status code 500. Rescheduling...
04:27thorwili can get app engine to shut up with (-> "OK" rsp/response constantly) as handler, but i fail to find a way to put that into a function, to first do something and then return for piece
04:34amalloyuh. #(when (do-actual-work) "OK")?
04:37thorwilamalloy: i just found the problem is not the return, but the argument of the function. it only works as non-argument function, but now i wonder how to get at my request parameters
04:41amalloythorwil: https://github.com/jorisbontje/snorri-model/blob/2012a07/src/snorri_model/core.clj#L54 suggests that his package is using the ring wrap-params middleware, as one might expect. not sure how he exposes it to you, cause i don't really use ring much
04:44thorwild'oh, of course i need wrap-params. i'm forgetting what i already know :/
04:45thorwilthanks amalloy
04:47thorwilwhat's interesting is that i have to remove the constantly, if i wrap the handler in wrap-params
04:50amalloyum, that's because you don't want to return a constant value. you want to return some function of the inputs?
04:52amalloyanyway, i'm gonna go to bed. i'm far from a ring expert, so it's no great loss to anyone
06:43bartjhow can one run the examples in clojure-hadoop ?
06:43bartjwould it be as simple as: java -jar clojure-hadoop-examples.jar ClassName
06:50clgvbartj: you'll get a partial answer if you try ;)
06:55bartjclgv, I did, it was in the source file anyway :)
06:55clgvit did work?
06:55bartjyes, of course
06:56clgvgreat
06:56bartjbut am a bit non-plussed, I don't have hadoop installed on my system
07:01bartjclgv, have you worked with hadoop before?
07:02clgvbartj: no, not at all. otherwise I should have been able to answer your initial question
07:03bartjclgv, no problem, thanks!
07:08bartj&lastseen rhickey
07:08sexpbotjava.lang.Exception: Unable to resolve symbol: lastseen in this context
07:14clgv$seen rhickey
07:14sexpbotrhickey was last seen quitting 2 days and 19 hours ago.
07:16dreamrealis clojure.org responding with a domain registration page for anyone else?
07:17clgvdreamreal: not for me. but I heard there were problems yesterday - it was said that they were resolved
07:19clgv$max
07:19sexpbotThe most users ever in #clojure is 317
07:20dreamrealwell, phooey. Until the DNS stuff gets fixed locally - time-warner, you know - I can't see anything. :(
07:20fogus`dreamreal: Are you seeing one now even after a uber-refresh?
07:21dreamrealfogus`: yes
07:21fogus`dreamreal: I guess some providers have yet to get the DNS info. :-(
07:22Chousuke_yeah, I have the squatter page still too :/
07:22dreamrealfogus`: okay, flsuhing DNS and switching browsers got me the original page
07:22dreamrealchrome is still giving me the register.com page, even after DNS
07:22Chousuke_flushing dns?
07:22fogus`Weird.
07:22dreamrealyeah, windows. ipconfig /flushdns
07:23Chousukeah, hm
07:24dreamrealany IDE support for clojure?
07:25ttmrichterdreamreal: Emacs and some not-very-stable stuff for Eclipse.
07:25dreamrealhmm, k
07:27clgvdreamreal: counterclockwise is pretty stable for eclipse. didnt have any crashes yet (since Okt 2010)
07:27ttmrichterI haven't even managed to get counterclockwise to install.
07:27clgvthere will be a new stable release soon as far as I heard
07:28clgvttmrichter: well that does not mean it's the projects fault ;)
07:29ttmrichterWell, it's probably more the Eclipse project's fault given that it's all dependency Hell.
07:29clgvI installed it on 4 different computers, one of them running windows 7. all went smooth
07:30clgvttmrichter: I just took a "normal java development bundle" and there was no need to get any other dependencies
07:31ttmrichterWhich version of Eclipse? I installed Helios, ran updates, then tried to install counterclockwise. No dice.
07:31clgv3.6.2
07:31ttmrichterI did install the Java EE version, mind.
07:33dreamrealAn eclipse plugin is not a strength. Eclipse blows.
07:33ttmrichterI thought it rather sucked myself.
07:33ttmrichterAt galactic black hole levels of suction.
07:33clgvdreamreal: well, that depends on your view and experiences with it...
07:34dreamrealclgv: Every time I use Eclipse I'm reminded of how sheeplike developers are. They're attracted by big shiny "free!" labels and ignore those silly old "will make you productive" labels.
07:34dreamrealIt's slow, buggy, user-unfriendly. </opinion>
07:34ttmrichterHuh. Apparently there's a Netbeans plugin ("enclojure") as well.
07:35ttmrichterI've never seen an IDE that made me productive, TBH.
07:35clgvdreamreal: which free-labels?
07:35ttmrichterI prefer a decent text editor and a shell.
07:35dreamrealever used IDEA?
07:35ttmrichterNope.
07:35dreamrealclgv: you know, the labels that say "oh look eclipse is freeeeeee"
07:35ttmrichterNever even HEARD of IDEA.
07:35dreamrealttmrichter: jetbrains.com
07:35dreamrealDunno if IDEA would be any good for clojure, though
07:36ttmrichterhttp://www.enclojure.org/
07:36ttmrichterThat's the Netbeans plugin.
07:36ttmrichterI have no opinion on it whatsoever since I've never seen it before just about thirty seconds ago. :)
07:36clgvdreamreal: never seen one. I got to use eclipse while studying and experienced that it is a quite good IDE.
07:37clgvttmrichter: the netbeans plugin seemed to have some more features than the eclipse one, last time I checked...
07:37ttmrichterOK, clgv, I'm giving CCW another shot.
07:37ttmrichterFirst question: which particular version?
07:37ttmrichterCounterclockwise Feature?
07:37ttmrichterCounterclockwise Feature REPL UI Branch?
07:38clgvI am on the stable 0.0.64
07:38ttmrichterDoes that give the REPL or not?
07:39ttmrichterThat is probably where the dependency Hell came from.
07:39cemerickttmrichter: you want the newer RC's
07:39clgvyes. but with a different input-behaviour than the console one
07:40ttmrichterOK, just trying to install 0.0.64: install failed.
07:40ttmrichterI'll stick to Vim + shell/REPL.
07:40clgvcemerick: *still waiting for that new stable release*
07:40cemerickttmrichter: Did you already have a version of ccw installed?
07:40ttmrichterNope.
07:40clgvttmrichter: you got plenty of bad karma? ;)
07:40ttmrichterAn error occurred while collecting items to be installed
07:40ttmrichtersession context was:(profile=epp.package.cpp, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
07:40ttmrichterNo repository found containing: osgi.bundle,ccw.branding,0.0.64.STABLE01
07:40ttmrichterNo repository found containing: osgi.bundle,ccw.clojure,1.2.0.STABLE12
07:40ttmrichterNo repository found containing: osgi.bundle,ccw.clojurecontrib,1.2.0.STABLE12
07:40ttmrichterNo repository found containing: osgi.bundle,ccw.core,0.0.64.STABLE01
07:40ttmrichterNo repository found containing: osgi.bundle,ccw.debug,1.0.5.STABLE
07:40cemerickttmrichter: if you can post the log somewhere, I'll take a look
07:40ttmrichterNo repository found containing: org.eclipse.update.feature,ccw.feature,0.0.64.STABLE01
07:41ttmrichterNo repository found containing: osgi.bundle,ccw.support.examples,0.0.4.STABLE01
07:41ttmrichterNo repository found containing: org.eclipse.update.feature,ccw.support.examples.feature,0.0.4.STABLE01
07:41ttmrichterNo repository found containing: osgi.bundle,ccw.support.leiningen,1.1.2.STABLE01
07:41ttmrichterNo repository found containing: osgi.bundle,clojure.osgi,1.2.10.STABLE002
07:41ttmrichterNo repository found containing: osgi.bundle,paredit.clj,0.11.1.STABLE01
07:41ttmrichterNo repository found containing: osgi.bundle,parsley,0.0.6.STABLE01
07:41opqdonut_please!
07:41ttmrichterNot that important, cemerick. I hate Eclipse anyway.
07:41opqdonut_don't paste it here
07:41ttmrichterYeah, my bad.
07:41ttmrichterSorry 'bout that. Didn't see how many lines it was.
07:45clgvttmrichter: lol, if you hate eclipse anyway, it doesnt make much sense for trying the clojure plugin anyway, I guess ;)
07:51ttmrichterclgv: I mostly tried it to see if there was any benefit to using more than vim+shell.
07:52cemerickttmrichter: surely lots of benefits, but you'd need to be open to the premise, I think :-)
07:53clgvttmrichter: I didn't try any vim plugins. But I don't like to develop in console texteditors if the project is bigger than an exercise assignment with one or two source files involved ...
07:53__name__There is alway gvim.
07:54__name__*always
07:54clgv__name__: almost identical feature set ;)
07:54__name__But it's not a console editor :)
07:55clgvputting it in a window and using menus and toolbars doesnt change it entirely to an IDE ;)
07:55__name__You did not say that :)
07:55__name__Neither did I.
07:56clgvindeed I didnt say that, it was implied with the texteditor statement ;)
07:56ttmrichterclgv: I've worked on 100,000+ line projects using just plain old text editor + shell.
07:57clgvnot that important anyway - I have counterclokwise and am happy with it! :)
07:57ttmrichterI've never seen an IDE that made me "more productive" than I am with just those raw tools.
07:57clgvttmrichter: if you like it and get your work done...
07:57ttmrichterNow to be fair I haven't done a lot of pro Java work.
07:58ttmrichterIt could be that Java requires such a setup.
07:58wlangstrotheither that, or you keep the class diagrams on your cube wall
07:59wlangstroth(which I have certainly done)
08:00cemerickMore better tools are always associated with higher levels of productivity. Our habits are often the limiting factor in taking advantage of them, though.
08:01ttmrichterThe slippery part is defining "better".
08:02ttmrichterI'm sure that a "good" IDE will do marvels. I just haven't seen one yet.
08:03cemerickIf A provides X but B does not, then it's hard to say that B is better
08:03cemerickI'd submit that minimalism is a habit and cultural bias, not a feature.
08:04ttmrichterYour example presupposes that X is a desirable trait.
08:04ttmrichterAs an example, let me cite "autocompletion".
08:04ttmrichterI've had autocompletion in IDEs and text editors and found them so frustrating I turned them off.
08:04ttmrichterThey caused more errors (with attendant waste of time) than they saved typing.
08:04clgvwell, there really good autocompletion features in the meantime
08:05clgv+are
08:05ttmrichterWould you consider Eclipse's to be good?
08:05cemerickttmrichter: Then you're necessarily limited to "namespaces" that you can memorize.
08:06clgvfor what I used it yes. I'd even say the one in VS 2010 is quite good
08:06ttmrichterWell, I have no opinion on VS past 6. :)
08:17clgvis there a way to load all clojure files in a given directory? or all clojure files with a given namespace prefix?
08:18clgvlike: org.algo.spec.*
08:58bsteuberis there a way to tell clojure how exceptions in futures should be dealt with?
08:59bsteuberbecause it kind of sucks to debug code without being notified of exceptions
09:15raekbsteuber: you do as usual when you want a certain behaviour when a exception is thrown: surround the code in a try/catch block
09:16bsteuberraek: yeah, but I mean the default when an uncought exception is found
09:17raek(catch Throwable e (.printStackTrace e))
09:17raekis this for a background thread (e.g. a server)?
09:17bsteuberyeah but I don't want to write this each time I call future
09:18bsteuberyes sth like that
09:18bsteuberand something that doesn't return anything
09:18bsteuberbecause it just runs and does side effects
09:19raekit would be nice to have some way to send the exception to slime...
09:19raekwith futures, the exception is "sent back" to the creator
09:20bsteuberbut only on deref'ing the future, right?
09:20bsteuberat least currently it just happens to be "silent fail"
09:20raekif you deref the future, you will get the exception wrapped in a ExecutionException
09:21raekso, they are kind of more adapted to the "do some processing in the background and report back" usecase
09:21bsteuberso for "do sth. in the background and never report back", agents are preferred?
09:22bsteuberhm but I guess that might yield the same problem
09:22raekI think so too
09:23bsteuberfor normal java threads, I can use Thread.setDefaultUncaughtExceptionHandler
09:23bsteuberbut this doesn't work with futures
09:23bsteuberbut I'll try agents, too
09:23raekin an application I'm writing now, I have a safety-net macro, which I put the code for printing the stack trace in the right stream and/or do logging
09:23raekagents are built on executors too
09:23raek"futures"
09:23bsteuberI see
09:24raek(a future is what you get back when you send a task to an executor)
09:25bsteuberso maybe sth. analogous to Thread.setDefaultUncaughtExceptionHandler for executors is a reasonable feature request?
09:26raekmy feeling is that the Java people will tell you that a try/catch block is the solution to the problem
09:26raekthe executor framework is in the Java standard library
09:27raekthis default handling of errors make it much more simpler to communicate errors over thread boundaries
09:28bsteuberI see
09:28bsteuberok thanks for your help :)
09:30raek(defmacro safety-net [& body] `(try ~@body (catch Throwable e# (.uncaughtException (Thread/getDefaultUncaughtExceptionHandler) (Thread/currentThread) e#))))
09:30raekyou can do something like that to get the Thread behaviour
09:30kephale00i'm blanking… what is a good way to get a function handle from the respective symbol aside from EVAL
09:31raekif you use slime, that will print a stack trace in the swank-clojure terminal, rather than pop up a message in slime
09:31clgvkephale00: (-> symb resolve var-get)
09:32kephale00clgv: thanks
09:32clgvkephale00: you can also use -?> from contrib to avoid a NullPointerException
09:33kephale00oOoo
09:33clgvkephale00: works nice with if-let or when-let, e.g. (when-let [f (-?> symb resolve var-get)] (f ...))
09:34kephale00phew, i haven't even been using such *-let combos yet
09:35clgvit's just a hint. ;)
09:35kephale00oh yeah, i'll get there before long!
09:49clgvshouldnt the following get me two matches? ##(re-matches #".*\.clj" "bla.clj.clj")
09:49sexpbot⟹ "bla.clj.clj"
09:49clgv"bla.clj" and "bla.clj.clj" ?
09:52clgv(re-matches #".*?\.clj" "bla.clj.clj")
09:52clgv&(re-matches #".*?\.clj" "bla.clj.clj")
09:52sexpbot⟹ "bla.clj.clj"
09:53clgvah it's due to "greedy" vs "reluctant"
09:54clgvwhen using re-find, I mean
10:19rplevyhow can you know (without a try/catch) if some unknown thing is Seqable ?
10:19rplevyinclude something like a java ArrayList
10:20angerman,(doc seq?)
10:20clojurebot"([x]); Return true if x implements ISeq"
10:21rplevyfalse
10:21angermanlol?!
10:21rplevy:)
10:23rplevy(seq? (java.util.ArrayList. ))
10:23clgv&(seq? (java.util.ArrayList. ))
10:23rplevy(seq (java.util.ArrayList. ))
10:23sexpbot⟹ false
10:23opqdonut_,(doc clojure.contrib.seq-utils/seqable?)
10:23clojurebotPardon?
10:23clgvit's not sequable ;)
10:23rplevybut I can seq it
10:23clgv&(seq (java.util.ArrayList. ))
10:23angermanclgv: yes, that's what confuses me about rplevy request as well.
10:23sexpbot⟹ nil
10:24opqdonut_I could've sworn there was something like that
10:24angerman,(doc seq)
10:24clojurebot"([coll]); Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable."
10:25rplevyso is there a predicate that returns true for all of the things listed in that doc string?
10:26clgvhow can I resolve a directory by its name relative to the classpath?
10:26rplevy,(source seq)
10:26clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
10:27clgvif I have no jar I need to prepend "/resources/" what doesnt work in a jar where it has to be removed
10:27clgv$source seq
10:27sexpbotseq is http://is.gd/zebspD
10:32rplevythere must be some function that evaluates to true for all the types of things that work in seq, or if not, there should be. this is isn't something you need often but ocassionally it is useful
10:33cemerickrplevy: see clojure.contrib.core/seqable?
10:34rplevybut as discussed above, seqable is only one of the interfaces supported by seq
10:34cemerickit's not a generally-answerable question at the moment
10:34rplevyhow so?
10:36cemerickrplevy: because "seqable" is a protocol-esque concept that operates over a set of disparate types
10:38cemerickWhen a proper seq protocol becomes available, then you'll be able to query the protocol's var for a set of types for which the protocol has implementations.
10:39trptcolinalso, the contrib seqable? doesn't just check for Seqable - it looks for Iterable, nil, String, Map, etc. as well
10:40cemerickright, I guess I should have been explicit about that
10:40rplevycemerick: thank you, very good to know
10:50clgvrplevy: just do (seq something). if it is nil, it's either empty or not sequable or you passed in nil
10:50rplevytrptcolin: I didn't see what you meant at first -- that solves the problem now (but the protocol version makes sense as the core solution)
10:51rplevyclgv: actually seqable? is better because it doesn't throw exceptions you have to catch
10:51clgvseq does?
10:51rplevyyeah
10:51clgvwhen?
10:52trptcolin,(seq 1)
10:52clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
10:52clgvah ok ;)
10:59pyrhi all
10:59pyri've changed my method of running ring and now use lein ring server
11:00pyrwhich is more useful, but in some cases i have some initialisation to do, how do I make sure before the service is started my init functions are called ?
11:06clgvpyr: do :repl-init or :repl-init-script help you? maybe not if they are only loaded when using a repl
11:09trptcolinpyr: you could use ~/.lein/init.clj - that gets loaded, if present, before any lein task
11:11mefestopyr: this initialization is something you'd like to happen when deployed to production as well, right?
11:12pyrsorry away for a minute
11:13pyrmefesto: yep
11:13pyrbasically i need connections to my database and such initiated
11:13pyrs,initiated,established
11:13cemerickThere's a web.xml entry for that.
11:14pyrcemerick: ?
11:14cemerickThough it sounds like you're not using such things.
11:14pyrno, before i was using a simple -main function
11:14cemerickpyr: are you packaging up the webapp as a .war file?
11:14mefestoi think lein-ring generates a web.xml
11:14pyrso i could set things up, then run (jetty-server)
11:14pyrnow with lein-ring-server my handler gets called automatically
11:14mefestobut it's not configurable afaik
11:14cemerickmefesto: ironic, given that that's all web.xml is for :-)
11:15mefestocemerick: yup it'd be great if it was configurable :)
11:15pyrwell, i'll go back to -main then
11:17cemerickpyr: FWIW, the element is servlet/load-on-startup in web.xml http://download.oracle.com/docs/cd/E13222_01/wls/docs81/webapp/web_xml.html#1039287
11:18cemerick(if you happen to want to go that route eventually)
11:18pyrerf ok
11:19mefestothere's also a ContextListener for on deploy/undeploy events
11:19pyri'm happy with load-balancing jetty servers for now
11:19mefestos/ContextListener/ServletContextListener/
11:19sexpbot<mefesto> there's also a ServletContextListener for on deploy/undeploy events
11:19pyrto tell you the truth
11:19pyri see no compelling reason to do otherwise
11:20cemerickheh, jetty is a servlet container, which by definition uses web.xml descriptors for deployment (whether you see them or not) :-)
11:21pyrprobably :), but compojure hides that from me elegantly
11:22cemerickwhich is OK until you need to fiddle something in your web.xml file
11:23cemerickAnyway; I actually think the abstraction is being provided by the lein ring plugin, not compojure (which actually knows nothing about such things)
11:24pyryeah, agreed
11:24pyri'll just have to stick to starting with a -main for now to get my DB connections setup
12:13angermandoes anyone speak dutch?
12:14ejacksonangerman: sorry, I lost wifi there....
12:15angermanejackson: pardon me?
12:15ejacksonyou asked a question, I answered and then prompty was disconnected
12:15ejacksonif I missed a response, could you repost it, please
12:16angermanejackson: no no, I missed your response
12:16ejacksonangerman: aaah, my response is that I speak Afrikaans which is often servicable for Dutch
12:17angermanI'm looking for someone who'd translate me 5 lines :D
12:17ejacksoninto, our out of, Dutch
12:17angermanhttps://gist.github.com/905947
12:17angerman-> Dutch
12:18angermanThe other way is usually pretty simple for me, (Speaking German and coming from the coastal region of Germany)
12:18ejacksonsorry, can't help that way.
12:18angermanejackson: no worries, thanks anyway :D
12:18ejacksonwhoever read it would think you were a total idiot :)
12:19angermanI am :D
12:20angermanlol
12:33sritchieangerman: appirater's great
12:34angermansritchie: well, memmons fork is :D
12:39devnI have something like this: (with-open [zstream (java.util.zip.GZIPInputStream. (input-stream "/path/to/foo.gz")))
12:39devnmissing a ] on there, but that's basically what I start with
12:39devnwhat I need to do is write the zstream contents out to a file
12:45dakronedevn: check out clojure.java.io/copy
12:51devndakrone: you nailed it -- thank you
12:53dakronedevn: you're welcome
12:57duncanmis there a way to get a literal string syntax in the sexpr reader?
12:57duncanmI don't want to escape strings
12:57technomancyduncanm: it's been discussed. there's been push-back.
12:57duncanmtechnomancy: ahh
12:58duncanmi liked that in C#, @"...." is literal
12:58duncanmcan i implement that as a reader macro?
12:59duncanmsigh, #"...." is already taken
13:00trptcolinduncanm: no, in fact you can't implement *anything* as a reader macro - that power is reserved for the language itself
13:38BorkdudeProgramming a dynamically typed language is like playing fretless guitar.
13:38BorkdudeSo much more expression ;-).
14:40fliebelGood morning. Would it be okay to expose a transient to the outer world?
14:40chouserfliebel: no
14:41chouser:-)
14:41fliebelchouser: Okay. Why? I mean, it does not feel right, but I can't see a direct problem with it.
14:41amalloyonly if the outer world consists solely of co-conspirators (ie, is actually the inner world)
14:41chouserfliebel: it's mutable
14:42chouserif they try to pass it to another thread, it will fail. many functions that work on collections will fail on transients.
14:43fliebelhm, yea, threading.
14:45amalloyfliebel: iirc it's not just "threading could cause bugs", it's "transients intentionally throw an exception when used on a thread other than the one they were created on"
14:45fogus`who is the outer world?
14:45fliebelamalloy: I know, a bit like io! right?
14:46amalloyfliebel: uhhhh. maybe? a bit? io! is something you have to opt into; transients just refuse to work
14:46amalloyand threading is far from the only issue
14:47fliebelfogus`: People writing a game with my library. I do think using a transient in the main game loop would be a lot faster, but would expose that to the game.
14:47fogus`I see.. then I agree with chouser and amalloy
14:48fliebelOkay, then we're four already :)
14:50fliebelNext opportunity to go fast is Threads :) Is there any way seque might break when used with transactions? It did not seem to queue at all.
14:51fliebelI noticed it uses an agent, which might cause it to wait on the transaction, but I havn;t figured out how that affects the queueing.
14:51fliebel$source seque
14:51sexpbotseque is http://is.gd/Ggbm1u
14:54fliebelWeird implementation...
14:54PiskettiSilly question:
14:55PiskettiIs there a way to reduce an infinite seq by somehow using a stop condition?
14:55PiskettiI can't use take to get a non-lazy seq and reduce that because I don't know how many elements I need.
14:55fliebeltake-while
14:57PiskettiOkay, that's exactly what I need. Thanx. :)
15:16fliebelWheee! I had my engine running at 200% cpu for a moment there. But now it got completely stuck. What was that option for seeing what the GC is doing?
15:19fliebelAh, -XX:-PrintGC, now I need to put that to lein
15:26fliebelNot good! [Full GC 126911K->120090K(126912K), 0.5707135 secs]
15:27fliebelI wonder if it's the head-holding all over again, or some Swing thing I'm holing onto.
15:30amalloyfliebel: i think your full GCs should aim to collect a larger percentage of your memory :)
15:31fliebelamalloy: I think so to… :( First it does a lot of normal ones, abut later it repeatedly does the full one.
15:31fliebelI'm trying visualVM now to see what is using the memory.
15:37fliebelIt's 44MB worth of Ducks and another 43MB worth of Longs.
15:41amalloysounds like time to cook some duck soup
15:41fliebelamalloy: duck is a defrecord.
15:56fliebelYea, classic head-holding again -,-
16:12okmijnoobhi ll
16:12okmijnoob+a
16:31fliebelHow do I test Swing code? (assert "Did you see a duck?") does not seem to be the right way.
16:33raekI tried Abbot once in a lab in a testing course: http://sourceforge.net/projects/abbot/
16:36fliebelraek: Thanks… *considers the effort*
16:38cemerickfliebel: any automated approach is bloody difficult.
16:39cemerickat least 10x tougher than web stuff via e.g. selenium
16:40fliebelcemerick: Yea, and I only have 10 lines of Swing stuff copies straight from the docs. So maybe I should just wrote a few dummy objects and leave the real Swing stuff.
16:40fliebel*write
16:41cemerickI'd never consider even attempting it.
16:41fliebel:)
16:41cemerickThick client UI toolkits are a boon for the tester QA employment levels.
16:41cemericks/tester/manual
16:41sexpbot<cemerick> Thick client UI toolkits are a boon for the manual QA employment levels.
16:41cemerickfeh
16:43fliebelAnyway, I've had enough dentistry for today. I'll see if I can get at least *some* test tomorrow.
16:43fliebelthanks all, and have a good night/day :)
16:56bobo_is there any way to make clojuresque to not evaluate al the code when doing a war file for example? so i can have a (run-jetty ...) in one namespace for repl/swank and still be able to create a war with gradle?
16:57tomojwhy do you want a top-level run-jetty for repl/swank?
16:58bobo_its kinda handy for it to run when i require the namespace, its not something i live and die for but still
16:58bobo_or to be able to eval a buffer for it to run
17:00bobo_lein jar for example has no problem with it
17:00cemericklein jar doesn't do AOT; perhaps clojuresque does?
17:01cemerickIn any case, I'll bet gradle or clojuresque sets a system property you can use in a guard around the (run-jetty) call
17:01bobo_you can turn of aot in clojuresque, but from what i understand, it then does require on them instead
17:01bobo_and true, maybe using a guard is the best way.
17:02tomojwith a top-level run-jetty, you can only eval the buffer once, right? or do you have top-level logic for checking whether a server is already running?
17:02bobo_defonce
17:02tomojah, right. does sound handy I guess
17:03tomojshouldn't the effect of alter-var-root on a var in some other namespace be visible to all the code in that namespace?
17:04raekyes
17:04tomojhrm.. I'm removing :link from enlive's self-closing-tags, but <link>s still emit differently than <lin>s
17:04raek(unless some other thread is using 'binding' on it)
17:04tomojalso tried just binding, no effect
17:05tomojno bindings in enlive afaict
17:06raekbobo_: my approach would be to put all "startup" code in a (defn -main [] ...) and then call it
17:06raekone more step to do, though...
17:07bobo_yeh i thought about that aswell
17:08bobo_doesnt look like clojuresque sets a property, but i could add that i guess
17:08raektop-level side-effects like those tends to be hard to combine with AOT compilation too
17:09raek(since the server would be started when the code is compiled, rather than executed)
17:09tomojmaybe *compile-files* is enough?
17:10raekthe nowadays built-in "lein run" task uses the -main fn approach
17:10raek(in contrast to the old lein run plugin, which simply loaded the file)
17:10bobo_yes well it doenst seem like an unsolvable problem atleast. but im to tired now :-(
17:11tomojoh, d'oh, enlive is parsing this as html
17:50devnhello gents
18:06pdk,(rationalize 3.0)
18:06clojurebot3
19:04gfrlogany guesses about the expressive power of alpha-numeric-less clojure?
19:09cemerickgfrlog: what, APL in sexprs?
19:10gfrlogcemerick: sort of...
19:10TimMcgfrlog: Clojure with all alphanumeric-containing fn names removed?
19:10TimMcYou could still do lambda calculus. :-)
19:10gfrlogTimMc: could you?
19:10gfrlogdo we have alphanumericless variable names?
19:11TimMcgfrlog: #( % ) stuff
19:11gfrlogTimMc: that won't nest very far
19:11TimMcoops, right
19:11cemerickYou'll always have to cope with what the special forms are named.
19:11gfrlogI've figured out a surprising amount in Ruby
19:11cemerickSounds painful in any case.
19:12gfrlogone man's pain is another man's
19:12cemerickpowerful beauty, I know :-)
19:12TimMcgfrlog: masturbation?
19:12gfrlogeither would work. I stopped adding words to the sentence when I realized it already parsed the way it was
19:12gfrlogbut I didn't really mean it that way
19:13TimMcI can express an infinite loop.
19:13gfrloggo
19:14TimMc(#(% %) #(% %))
19:14TimMc,(#(% %) #(% %)) ; let's see if I got that right
19:14clojurebotjava.lang.StackOverflowError
19:14TimMcOmega combinator, IIRC.
19:14gfrlogthat's so weird, because I figured that out myself about a year ago
19:14gfrlogand somehow didn't think of it in this context
19:15TimMcThe underlying basis for recursion in a language without self-reference.
19:15devnhello all
19:15gfrlogcan you get an expression that evaluates to an integer?
19:15TimMceep
19:16TimMc,(*)
19:16clojurebot1
19:16TimMcSo I can get all of them.
19:16gfrlogdangit
19:17gfrlogonce again, I've done that before
19:17gfrlogI'm not thinking today
19:17gfrlogokay
19:17gfrlogso now what about alphabetic strings?
19:17TimMcI'm looking at the top line of http://clojure.github.com/clojure/
19:17TimMcI can also get booleans, via equality.
19:17gfrlogah yes
19:18gfrlogI can get "TimMc" in ruby
19:18TimMchaha
19:19gfrlogI'm gonna bet something like that is not possible
19:19gfrlogall we have is ints, booleans, ratios, and infinite recursion
19:19TimMcIf I can catch an exception, I can get alphanumerics... maybe not.
19:20TimMcMan, I can't even index into a string yet.
19:20TimMcOK, metadata... that can get me what I want.
19:21TimMc,^#'*
19:21clojurebotMetadata must be Symbol,Keyword,String or Map
19:21gfrloghaha
19:21TimMcShoot, we can't pull metadata like that in 1.2
19:23TimMcTime to check out the reader macro page.
19:24TimMc,(+ \* \*)
19:24clojurebotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
19:24TimMcdammit
19:24gfrlogit's tough
19:24TimMc::*
19:24TimMc,::*
19:24clojurebot:sandbox/*
19:24TimMcbingo?
19:25gfrloglol
19:25TimMcNah, still can't iterate over that.
19:25TimMcI want to extract chars.
19:25gfrlogit's something new at least
19:25gfrlogwe can get at least two papers out of that
19:26TimMchaha
19:26gfrlogeven if you could get some chars, could you do anything with them?
19:27TimMcregex... can we call/iterate on those?
19:27gfrlogprolly not...
19:27gfrlog,(#" " "tommy")
19:27clojurebotjava.lang.ClassCastException: java.util.regex.Pattern cannot be cast to clojure.lang.IFn
19:27TimMcOh man, we can't even use %2
19:28TimMcbrb, pasta
19:28gfrlogoh dangit pasta
19:31TimMcCan you think of anything that will stringify stuff?
19:31TimMc...and we don't have macros.
19:32gfrlogmore generally seqifying would be nice
19:33TimMcwe have... syntax quote and unquote, including splicing unquote
19:34gfrlogbut no syntax to give it :)
19:37gfrlogwhat about non-alphanumeric variables? definitely not allowed?
19:37TimMchmm?
19:37clojurebothmm, maybe my repl is out of wack
19:37gfrlogwait a minute they're definitely allowed
19:37gfrlogwhat am I talking about
19:37gfrlogwe can do lambda calc
19:37gfrlogno we can't
19:38gfrlogcuz we can't write 'fn'
19:38gfrlognevermind
19:38TimMcWe can do Church numerals, though.
19:38TimMcAnd regular ones. :-P
19:39gfrloghow?
19:39clojurebotwith style and grace
19:39hiredmangfrlog: http://en.wikipedia.org/wiki/SKI_combinator_calculus
19:40gfrloghiredman: ah ha, I think you've sent me here before
19:40gfrlogI still don't think we can do anything interesting without nested fns
19:40TimMcgfrlog: ##(* (+ (*)(*)(*)) (+ (*)(*)) (+ (*)(*)(*)(*)(*)(*)(*)))
19:40sexpbot⟹ 42
19:41gfrlogyeps
19:43hiredmanλ expressions can be transformed into combinators, infact I believe the wiki gives an algorithm for such a transform
19:44gfrlogTimMc: I thought I had even blogged that exact expression, but it seems not
19:44gfrloghiredman: we don't need nested fns for that?
19:44TimMccurrying might be possible
19:45hiredman"next fns"
19:45hiredmancombinators don't have fns
19:45hiredmannested
19:46hiredmannested fns doesn't seem to mean anything unless you'd care to define it
19:46gfrlogsorry
19:46gfrlog(fn [a] (#(% %) a))
19:46gfrlogi.e., a fn in the body of another fn
19:47hiredmanin a combinator calculus you generally just have combinators, like in a pure λ calculus you just have λ forms (and build numbers out of them)
19:47hiredmanso no λ in the combinator calculus and so no nested fns
19:47gfrlogI think it will take me more than some moments to digest the article
19:49devnTimMc: please explain how the hell that worked
19:49devnthe (* (+ (*)(*)...)
19:49hiredman,(+)
19:49clojurebot0
19:49hiredman,(*)
19:49clojurebot1
19:49gfrlog,(/)
19:49clojurebotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$-SLASH-
19:49gfrlog,(-)
19:49clojurebotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$-
19:49TimMcdevn: Identity rules.
19:49hiredmangfrlog: I thought you were busy reading the article
19:50gfrloghiredman: I've put it off because my wife just about has dinner ready. So please don't wait on me.
19:50devnhmph -- ##(*)
19:50sexpbot⟹ 1
19:50devnweird.
19:50gfrloghiredman: there are chicken tacos I think.
19:51devnI guess I still don't see how it follows that * with no args constitutes 1
19:52gfrlogdevn: it doesn't have to be that way, but it makes the definition a bit shinier
19:52devn,(+ (*) (*))
19:52clojurebot2
19:52devngfrlog: shiny in what sense?
19:52hiredmandevn: (= (* x 1) x)
19:53gfrlogdevn: 0 is the additive identity, 1 is the multiplicative identity
19:53gfrlogdevn: it lets you define them recursively
19:54gfrlogdevn: does (+) == 0 make sense to you?
19:55devngfrlog: yes
19:55devn(+) makes sense
19:56devn(*) not so much
19:56hiredmanwhy?
19:56clojurebotwhy not?
19:56devnnevermind, hiredman explained it well -- just needed to meditate for a moment on that
19:56hiredmanclojurebot: I know where you live
19:57clojurebotTitim gan éirí ort.
19:57devnhiredman: because for my entire life * has been between two values, otherwise it was invalid
19:57devnso when I see *, i do not assume (* something 1)
19:57TimMcSOmething with %& could give us currying or multi-arg fns
20:02TimMc,(#(* (% (+)) (% (+(*))) (% (+(*)(*)))) [11 5 3])
20:02clojurebot165
20:02TimMc\o/ Multiarg functions.
20:05TimMcdevn: It's the same as why 5^0 is 1. :-)
20:08amalloyTimMc: that's a cute way to get multiple args
20:09gfrlogTimMc: NICE
20:12TimMcSo we can do some destructuring that way.
20:12TimMcThis gives us lambda calc, yeah?
20:14TimMcWhat if we passed around a large vector of functions as the first arg to every function, and explcitly pulled them out by number for use?
20:15hiredmanλ calculus doesn't have vectors, or numbers in vectors or + or *
20:15TimMchiredman: Sure, but we can emulate it now.
20:15amalloy&(#(% (*)) #(+ % (*)))
20:15sexpbot⟹ 2
20:16amalloyTimMc: higher-order functions^
20:16TimMcBut we still don't have binding. I think my big ol' vector approach is as close as we can get. :-(
20:16hiredmanTimMc: all you need to emulate the λ calculus is SKI
20:17hiredmanyou just have to apply the transform
20:22technomancyclojurebot: tell me about church numerals
20:22clojurebotPardon?
20:47gfrlogI'm glad to see I inspired so much productivity
20:48malkomalkofor the peeps who use paredit, I can't find any docs on wrapping []'s.. say I have [1 2 3] I can't figure out how to make this [[1 2 3]] since everytime I open up a bracket it auto closes it
20:49brehautmalkomalko: C-right inside a [] will make it capture the next expression on the right
20:49devn,````''(+)
20:49clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/seq)) (clojure.core/list (clojure.core/seq (clojure.core/concat # # #)))))
20:50TimMcWhoa, what are those #'s doing in there?
20:50gfrlogand why are there 3 different function calls?
20:50TimMcRecursion exceeded in printing?
20:50gfrlogall alternating and stuff...
20:50gfrlog&````''(+)
20:50sexpbot⟹ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/seq)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/concat)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/li... failed to gist: Connection reset
20:50gfrlog&````''(+)
20:50sexpbot⟹ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/seq)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/concat)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/li... failed to gist: Connection reset
20:51gfrlogclojurebot: plug sexpbot back in
20:51clojurebotCounterclockwise aka ccw at http://code.google.com/p/counterclockwise/
20:51pjstadigi don't think clojurebot acknowledges sexpbots existence
20:53gfrlog,(println "Say I'm pretty! ##(printlin \"Even if I don't mean it?\")")
20:53clojurebotSay I'm pretty! ##(printlin "Even if I don't mean it?")
20:53sexpbotjava.lang.Exception: Unable to resolve symbol: printlin in this context
20:53pjstadig&(partition 0 [])
20:53sexpbot⟹ ()
20:55gfrlogsomebody needs to alter one of the bots so that we're sufficiently motivated to construct a boomerang quine
20:57TimMcpjstadig: Pretty sure the bots do not explicitly ignore each other.
20:57pjstadig&(partition 0 [:a])
20:57sexpbotExecution Timed Out!
20:57TimMc,(str \# \# "(+ 1 2)")
20:57clojurebot"##(+ 1 2)"
20:57sexpbot⟹ 3
20:57TimMcpjstadig: ^
20:58pjstadigTimMc: i was speaking metaphorically
20:58TimMcheh
20:58gfrlogI just realized these bots are open source
20:58pjstadigin my mind they are feuding with each other
20:58TimMcNow, getting it to go the other way is a challenge. I don't think I've been able to get clojurebot to respond to sexpbot, partly because clojurebot doesn't have an inline eval trigger, and partly because sexpbot prefixes its responses.
20:58TimMc$source
20:58sexpbotSource not found.
20:58TimMcsource?
20:58clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
20:59TimMc&source
20:59sexpbotjava.lang.Exception: Unable to resolve symbol: source in this context
20:59TimMcnvm
20:59gfrlogTimMc: I'm looking at patching one or the other
20:59pjstadigsexpbot blames clojurebot for the evils that his family perpetrated against his ancestors
20:59pjstadigand clojurebot looks down on sexpbot as an inferior being
21:00pjstadigthe tension is building toward an epic battle
21:00gfrlogclojurebot is hard to run
21:00gfrloglet's see if Raynes can do better
21:01gfrlogah, lein instead of ant. That's a start.
21:02hiredmanclojurebot is built with lein, and runs by pointing the uberjar at a config file (example in repo)
21:02gfrloghiredman: what happened when I did 'ant' then?
21:03gfrlogI looked at the readme and it mentioned tricky policy files -- will it run w/o sandbox by default?
21:03hiredmangfrlog: who told you to run ant?
21:03gfrloghiredman: I saw a build.xml=
21:03hiredmanso?
21:03gfrlogthey scream "run ant!" at me
21:04gfrlogaw...the sexpbot build failed. Back to hiredman's idea
21:04technomancythat's funny, they scream "run away" to me
21:04technomancybuuuuuurn
21:04gfrlogtechnomancy: as I always refer to myself in the third person as "ant", that's exactly what I just said
21:05technomancyo_O
21:06gfrlogor maybe I meant that "build.xml" files always refer to me as "ant"...or...never mind
21:06pjstadigyour codez talk to you?
21:07gfrlogno, just project maintenance files
21:07gfrlogokay, I was confused and clojurebot is the one that failed to resolve deps
21:07hiredmangfrlog: you must be doing it wrong
21:08gfrloghiredman: likely; I did "lein deps"
21:08hiredmansounds wrong to me
21:10gfrloglein uberjar says it is missing conduit-irc jar
21:11TimMcgfrlog: With [^0-9a-z], can you get me the first element of a list?
21:11gfrlogTimMc:
21:11gfrlogum
21:11gfrlogthere's no way to destructure is there :(
21:12TimMcI'm trying to convert it into a vector or something, or maybe apply to a fn.
21:12gfrlogI'm skeptical
21:13TimMcCan't index into a list either.
21:13gfrlogI just don't think clojure was built for these tasks
21:13gfrlogah, cause the vector gives you indexing
21:13gfrlogright-
21:15pjstadig,([:first :second] (+))
21:15clojurebot:first
21:15TimMcJavaswcript is way better at this: http://sla.ckers.org/forum/read.php?24,32930
21:16gfrlogholy cow
21:16TimMc:-)
21:17gfrlogTimMc: would you happen to have a ruby 1.9.2 prompt lying around?
21:17TimMcdunno
21:18TimMc1.8
21:18gfrlogoh well
21:18gfrlogI haven't figured out something that works for 1.8 yet
21:18TimMcSame with the server at school.
21:18TimMc,`(~@"$\"#")
21:18clojurebot(\$ \" \#)
21:19TimMcI can take apart strings...
21:19gfrlogO_O
21:19TimMcoh!
21:20TimMc,`[~@```!]
21:20clojurebot[clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (quote sandbox/!)))]
21:20TimMc,(`[~@```!] (+))
21:20clojurebotclojure.core/seq
21:20TimMc...but that's still a symbol
21:20gfrlog`[~@"$\"#"]
21:20gfrlog,`[~@"$\"#"]
21:20clojurebot[\$ \" \#]
21:21TimMc,(eval "#=(+ 2 3)")
21:21clojurebotDENIED
21:21TimMc,(read-string "#=(+ 2 3)")
21:21clojurebotjava.lang.RuntimeException: java.lang.Exception: EvalReader not allowed when *read-eval* is false.
21:21gfrlog,(eval "(eval \"#=(+ 2 3)\")")
21:21clojurebotDENIED
21:22gfrlogif we wrap it enough times it's gotta work eventually
21:23hiredmanyou understand eval doesn't take strings?
21:23gfrlogI do
21:23TimMchiredman: Oh hah, right...
21:23gfrlog$google slartibartfast
21:23sexpbotFirst out of 17700 results is: Slartibartfast - Wikipedia, the free encyclopedia
21:23sexpbothttp://en.wikipedia.org/wiki/Slartibartfast
21:24hiredmangfrlog: actions indicate otherwise
21:24gfrloghiredman: and so it goes
21:24TimMc,`*#
21:24clojurebot*__4879__auto__
21:26gfrlogthe only reason I was able to get alphanumerics into ruby was the string ranges
21:26malkomalkobrehaut: C-right didn't seem to do anything inside a [1 2 3]
21:26TimMcmalkomalko: [|][1 2 3]
21:26TimMcthen C-right
21:27TimMcOr try C-left where you are now
21:28TimMc,(`[~@`#(5)] (+))
21:28clojurebotfn*
21:28malkomalkohmm, weird, isn't working
21:28malkomalkowill check to see if I have an older plugin or something
21:28gfrlogholy jackwagon
21:28TimMcmalkomalko: You're in both paredit and clojure-more?
21:28malkomalkoyes
21:29TimMcmalkomalko: Try C-h k C-right
21:29gfrlogTimMc: can we make fns out of that?
21:29TimMcIt should tell you that's paredit-slurp-forward or whatever.
21:29TimMcgfrlog: We can make syntax, but we can't eval.
21:30gfrloghrmph
21:30TimMcIf you allowed a single "eval" we could do whatever.
21:30TimMcCan we resolve a symbol to a value?
21:30malkomalkoyah it doesn't... I'll check my .emacs, although I didn't really do anythin gwith it
21:31gfrlogTimMc: can you get a 'eval somehow?
21:31TimMcgfrlog: How would that help?
21:31gfrlogI have no idea
21:33TimMcGiven a symbol, can we get a var? vars can be derefed.
21:33gfrlog,#'+
21:33clojurebot#'clojure.core/+
21:33TimMc,(type @#'str)
21:33clojurebotclojure.core$str
21:33gfrlog,#(first ['+])
21:33clojurebot#<sandbox$eval4888$fn__4889 sandbox$eval4888$fn__4889@549ed0>
21:34tomojnote that barfs and slurps have arrow-key-less bindings by default as well
21:37gfrlogis (apply partial (repeat partial)) an infinite-order function?
21:38TimMcI think I've almost got soemthing...
21:39TimMcShit, no.
21:39TimMc,(apply partial (repeat partial))
21:39clojurebot#<core$partial$fn__3684 clojure.core$partial$fn__3684@1a00355>
21:40TimMc,((apply partial (repeat partial)) 5)
21:40clojurebot#<core$partial$fn__3684 clojure.core$partial$fn__3684@487600>
21:40TimMchaha
21:40TimMcIt will absorb infinitely many arguments!
21:41gfrlogTimMc: well any function can take an infinite number of args
21:41gfrlogbut it will keep returning functions, right?
21:41TimMc,(trampoline (apply partial (repeat partial)))
21:41clojurebotjava.lang.StackOverflowError
21:42TimMc*infinitely many calls
21:42gfrlogclever
21:43gfrlogif I said "boomerang quine" recently, I probably meant "trampoline quine"
21:43TimMc,`@(var ~'eval) ; if we had eval, we could get eval :-P
21:43clojurebotDENIED
21:43TimMc,`@(var ~'str) ; huh
21:43clojurebot(clojure.core/deref (var str))
21:43gfrlogah, that's the missing piece
21:44mec,(fn forevar [& args] forevar)
21:44clojurebot#<sandbox$eval4900$forevar__4901 sandbox$eval4900$forevar__4901@583f4c>
21:44mec,(trampoline (fn forevar [& args] forevar))
21:44clojurebotExecution Timed Out
21:44gfrlogmine actually keeps the args, doesn't it?
21:44mecorly
21:45gfrlogso it'd run out of memory if it had an infinite stack?
21:45meci think so
21:45TimMc,(loop [] (recur))
21:45gfrlogBORING
21:45clojurebotExecution Timed Out
21:46mecok i see why mine times out instead of stack overflow, but why does the partial overflow
21:46TimMc,(time (loop [] (recur))) ##(time (loop [] (recur)))
21:46sexpbotExecution Timed Out!
21:46clojurebotExecution Timed Out
21:46brehaut,(first (take-while (constantly true) (drop-while (constantly true) (range))))
21:46TimMcOh duh, of course timing wouldn't work.
21:46clojurebotExecution Timed Out
21:47TimMcbrehaut: Now with juxt!
21:48brehauthaha not today
21:48gfrlog,(count range)
21:48clojurebotjava.lang.UnsupportedOperationException: count not supported on this type: core$range
21:48gfrlog,(count (range))
21:48clojurebotExecution Timed Out
21:48mec,(count (range 1 10))
21:49clojurebot9
21:49TimMcgfrlog: Can we get any alphanumeric char?
21:50gfrlogdoubt it
21:50gfrlogI'm the skeptic in this endeavor
21:50TimMcI haven't been able to use math on chars.
21:50tomojis it disallowed to use chars?
21:51TimMctomoj: We're trying to do it without using alphanumerics in the code at all.
21:51TimMcWith that restriction, we can get lambda calculus, rational numbers, and some symbols and keywords.
21:52tomojI see
21:52TimMcIf we can figure out how to convert a symbol into the corresponding var's value, we'll probably win.
21:53TimMcwin = arbitrary code
21:53gfrlogarbitrary code = win
21:54gfrlogI wonder how the sandboxes would react
21:54tomojwtf is that (`[~@`#(5)] (+))
21:55gfrloghe creates a vector
21:55tomojoh
21:55gfrlogthen pulls out the index-0 element
21:55tomojI forgot (+) is 0
21:55gfrlogthe ~@ turns something into a seq
21:55TimMcthe 5 is random junk
21:56gfrlogthe 5 stands for the 6th church numeral
21:56TimMc:-P
21:56tomojwon't you need another approach besides building resolve, for special forms?
21:57tomojor do you think you can use special forms somehow if you have resolve?
21:57TimMcI don't think we need special forms.
21:57gfrlogI think he's trying to get a reference to eval
21:57mec,(+ (*) (*))
21:57clojurebot2
21:57TimMcexactly
21:58TimMcmec: ##(* (+ (*)(*)(*)) (+ (*)(*)) (+ (*)(*)(*)(*)(*)(*)(*)))
21:58sexpbot⟹ 42
21:58mecnice
22:00gfrlogTimMc: can you get a float?
22:00mec(/ (*))
22:00mec(/ (+ (*)(*)))
22:00TimMcmec: We can get rationals.
22:00mec,(/ (+ (*)(*)))
22:00clojurebot1/2
22:01TimMcI think I can get many letters. \c, \o, \n, \a, \t, \s, \e, \q, \v, \r
22:01TimMcNo, wait... I can't stringify yet.
22:03TimMcI can get symbols containing those letters, though.
22:03mectoo bad (+ "" (*)) doesnt work
22:04gfrlog,(.nextProbablePrime 1234567890987654321)
22:04clojurebotjava.lang.ExceptionInInitializerError
22:05not-timm1ooh, my main connection is lagging
22:09TimMcI'm trying to figure out if Java-land can help us, but all the Java method names have alphanumerics in them.
22:10tomojand . is special :1
22:10TimMctomoj: No problem, it isn't alphanumeric.
22:11TimMcNow, if String just happened to have a useful _BANG_ method or something... :-P
22:11tomojI mean, even if you can make symbols like, say, maybeResolveIn, you can't use them with .
22:11tomojbecause it's special
22:11tomojor maybe you can, but I don't see how
22:11TimMc,("" ! (+))
22:11clojurebotjava.lang.Exception: Unable to resolve symbol: ! in this context
22:11TimMc,(. "" ! (+))
22:11clojurebotjava.lang.IllegalArgumentException: No matching method found: _BANG_ for class java.lang.String
22:12TimMcLike that.
22:12tomojeh?
22:14TimMcOh, I see what you're saying... yeah, it would have to be something we could write literally.
22:15gfrlogk my day is over
22:15gfrlogI hope this comes to a happy conclusion
22:22TimMcOK, so if anybody can figure out a way to stringify keywords and symbols using what we have so far, I will give them a cookie.
22:23flea__Hello
22:23TimMc,(ancestors (type :foo))
22:23clojurebot#{java.io.Serializable clojure.lang.Named java.lang.Runnable clojure.lang.IFn java.util.concurrent.Callable java.lang.Object :clojure.contrib.generic/any java.lang.Comparable}
22:24flea__,(1 2 3)
22:24clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
22:24flea__`oic
22:25flea__I just wanted to say that this project is kind of mind boggling
22:25flea__you effectively rewrote lisp, a language with macros and closures, in Java, which has neither ...
22:27tomojis your lisp macros and closures all the way down?
22:27flea__like turtles?
22:27pdkwe're just plain magic
22:28flea__you are indistinguishable from magick
22:29flea__i assume that clojure supports full lambda syntax?
22:29TimMcflea__: All Lisps are implemented in machine code at some level.
22:30TimMc,(let [foo (fn [x y] (+ x y))] (foo 4 5))
22:30clojurebot9
22:30flea__,`(a list test)
22:30clojurebot(sandbox/a clojure.core/list clojure.core/test)
22:31TimMcflea__: Clojure is a lisp http://clojure.org/lisp -- and here are some differences between it and some others: http://clojure.org/lisps
22:32pdknote also that , is whitespace in clojure
22:32pdk~ and ~@ respectively take the role that , and ,@ had in cl
22:32clojurebotadd-classpath is Fraught with Peril!
22:33flea__oic
22:33flea__is ` still quote ?
22:33TimMcsyntax-quote yeah
22:33TimMcand ' is non-namespace-resolving quote
22:33TimMc,'juxt
22:33clojurebotjuxt
22:34TimMc,`juxt
22:34clojurebotclojure.core/juxt
22:34TimMcThe second link I gave you is pretty thorough regarding stuff like that.
22:34flea__reading through it now
22:35TimMcThe difference that really threw me is that clojure's let is like Scheme's let*.
22:35pdki only really studied cl
22:35flea__I don't know scheme
22:35flea__only cl
22:35pdkso do tell about what makes scheme let* unique
22:35pdkiirc cl let* simply allowed symbols referring to each other
22:35TimMcpdk: Scheme's `let` binds in parallel, but `let*` binds in series.
22:36pdkie (let* (a (+ b 1) b 5)) sorta stuff
22:36pdkhm
22:36pdkisn't it basically the same in cl but in reverse
22:36pdkwith let* being parallel
22:36pdkcriminy now i even forget cl let syntax
22:36TimMcSort of. let* in Clojure is a helper macro. I think it doesn't have destructuring.
22:37pdkshould it be (let* (a (1+ b) b 5))
22:37TimMcIt's an unfortunate coincidence of naming for beginners.
22:37pdkcriminy i didnt know let* carried over
22:37pdk,(let [a (inc b) b 5] a)
22:37clojurebotjava.lang.Exception: Unable to resolve symbol: b in this context
22:37pdk,(let* [a (inc b) b 5] a)
22:37clojurebotjava.lang.Exception: Unable to resolve symbol: b in this context
22:37pdkACCURSED BOT
22:38TimMcNaw, you can't do that.
22:38TimMcb isn't bound when a's init-expr is eval'd
22:38pdkgranted!
22:39flea__does let still return a closure?
22:39TimMcYou could do that with letrec if there was delayed evaluation, such as being a reference inside a closure.
22:39mecwhere is let* even defined in clojure?
22:39TimMcflea__: ##(macroexpand `(let [a 1] a))
22:39sexpbot⟹ (let* [clojure.core/a 1] clojure.core/a)
22:40pdkcriminy
22:40pdkso little lets so little time
22:40pdklet can still do closures flea
22:40TimMcmec: flea__: Hard to say. I think let* is actually a compiler form.
22:40TimMc$source let*
22:40sexpbotSource not found.
22:41TimMchttps://github.com/clojure/clojure/blob/1.2.x/src/jvm/clojure/lang/Compiler.java#L41
22:42TimMcYeah, it's a compiler form.
22:43amalloyflea__: "does let still return a closure" is a weird question. in any lisp, you can implement let by using a closure behind the scenes, but to say that it returns a closure would be misleading
22:43tomojTimMc: must it start from clojure.core?
22:43tomoji.e. if you want something else, you've gotta figure out how to require it without alphanums?
22:44TimMctomoj: I think that's the idea, yeah.
22:44amalloytomoj: if that restriction didn't exist it would be trivial
22:44TimMcamalloy: Would it?
22:44amalloydef everything you need in some other library, then require it
22:44tomojnaturally there could be other restrictions
22:45tomojlike "only core/contrib" or "only core" (which is not really the same as "only clojure.core" I think)
22:45TimMcamalloy: Do you think there's anything in clojure.contrib that would help, for instance?
22:45amalloy*shrug*
22:48flea__amalloy: isn't the body-form of let a closure?
22:49flea__,(let ((x 10) (y 12)) (list x y))
22:49clojurebotjava.lang.IllegalArgumentException: let requires a vector for its binding
22:49flea__oO
22:49flea__ic
22:50mec,(let [x 10 y 12] [x y])
22:50clojurebot[10 12]
22:50flea__that returns a vector
22:51mecits normal to use vectors instead of lists for data
22:51flea__,(let [x 10 y 12] (list [x] [y]))
22:51clojurebot([10] [12])
22:51flea__:)
22:54TimMcflea__: let has a body of 0 or more expressions. There's an implicit "do" form around the expressions.
22:54TimMc,(let [x 5] (println "x is" x) (* 2 x))
22:54clojurebotx is 5
22:54clojurebot10
22:55flea__:/
22:55TimMcOh hey, will any Boston-area Clojurians be at the BarCamp this weekend?
22:56flea__,(setf a 10)
22:56clojurebotjava.lang.Exception: Unable to resolve symbol: setf in this context
22:56flea__o
22:57flea__that's .... interesting
22:57flea__,(mapcar)
22:57clojurebotjava.lang.Exception: Unable to resolve symbol: mapcar in this context
22:58flea__I should download and have a play
22:59TimMcflea__: You'll probably want the Leiningen build tool. It's got a REPL command so you don't have to screw with classpath.
23:00TimMcAlso, I highly recommend clojuredocs.org
23:01pdkyou don't say car/cdr in clojure cause lists aren't actually implemented with conses internally anymore
23:01ataggart,(map inc [1 2 3])
23:01clojurebot(2 3 4)
23:01pdkbut cons can still compose lists much in the way it used to
23:01pdkiirc clojure map = cl mapcar
23:01pdkand all the clojure builtin data structures are immutable and persistent
23:01pdkso there isn't really a mapcan :p
23:04TimMcflea__: Clojure abstracts the ideas of lists and lambdas past what Lisps generally have.
23:04TimMcInstead, you have these generic first, rest, conj functions for sequences and collections. Also, many things can be used as functions. :-)
23:04pdkclojure prefers first/rest/next instead of car/cdr
23:05pdk,(doc next)
23:05clojurebot"([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."
23:05pdk,(doc rest)
23:05clojurebot"([coll]); Returns a possibly empty seq of the items after the first. Calls seq on its argument."
23:05flea__,(doc set)
23:05clojurebot"([coll]); Returns a set of the distinct elements of coll."
23:06flea__so how do I setf?
23:06pdkyou don't
23:06mecif you want a good in depth but beginner friendly intro i suggest http://java.ociweb.com/mark/clojure/article.html
23:06pdksymbols defined with def are also immutable unless you just def them again
23:07pdkif you want to store something and use it in a way that lets you treat it like it's mutable then you'd store it in an agent/atom/ref
23:08flea__so lists are not mutable?
23:08TimMcflea__: Right.
23:08TimMcNone of the native Clojure data structures are, except for the reference types.
23:09brehautTimMc, flea__: (and transients)
23:09TimMcOh, there are transients, but those are a different topic.
23:09flea__,(doc push)
23:09clojurebotExcuse me?
23:09pdkthe reference types each work in slightly different ways to ensure atomic updates and thread safety
23:09pdktransients basically exist for xtreme optimizing and java interop iirc
23:09mec,(let [x [1 2 3]] [x (conj x 4) x])
23:09clojurebot[[1 2 3] [1 2 3 4] [1 2 3]]
23:10flea__,(doc remove-if)
23:10clojurebotIt's greek to me.
23:10flea__lol
23:10mec,(doc filter)
23:10clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
23:10pdkfilter and remove are the closest to remove-if
23:10pdkfilter keeps everything for which the predicate is true
23:10pdkremove keeps everything for which the predicate is false
23:11flea__,(filter 1 (list 1 2 3))
23:11clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
23:11pdkdunno what you mean by filter 1 there
23:11flea__ok, so the basic collection is a vector, not a list, right?
23:12pdkif you mean filtering the ones that are equal to 1
23:12flea__sry
23:12pdkrealistically you have 4 basic collection types :p
23:12pdksequences exist as an abstraction over all four basically
23:12flea__ok
23:13pdk,(next {1 2 3 4})
23:13clojurebot([3 4])
23:13pdk,(next #{1 2 3 4})
23:13clojurebot(2 3 4)
23:13pdkright there using sequence functions on maps (hash tables) and sets
23:13pdkso they still support iteration with functions that work on sequences
23:14pdkalso without cons cells being used in the backend there are no dotted lists anymore
23:15flea__,(filter #'(lambda(x) (= 1 x)) #{1 2 3})
23:15clojurebotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
23:16pdklambda is replaced with fn
23:16amalloy&(filter #(= 1 %) [1 2 3])
23:16sexpbot⟹ (1)
23:16pdk# is used as a shorthand syntax for anonymous fns
23:16amalloy&(filter (fn [x] (= 1 x)) [1 2 3])
23:16sexpbot⟹ (1)
23:16amalloy&(filter #{1} [1 2 3])
23:16sexpbot⟹ (1)
23:16TimMcflea__: Argument lists use vector syntax.
23:16pdkalso the argument list for a function or macro is a vector instead of a list
23:17pdkso (fn [x] (= 1 x)) is what you're thinkin of
23:17pdkor #(= 1 %), or #{1}, or (partial = 1) etc etc etc :p
23:17TimMcflea__: You might want to watch rhickey's presentation of Clojure at a Lisp conference -- he does a great job of explaining the abstractions.
23:18flea__got url?
23:18pdki think clojure.blip.tv should have them
23:20flea__found a bunch of videos on YT
23:21mecclojure for lisp programmers part 1: http://clojure.blip.tv/file/1313398/ part 2: http://clojure.blip.tv/file/1313503/
23:21flea__thanks mec
23:22mecalso some good ones here http://www.infoq.com/author/Rich-Hickey
23:22flea__looks like I have a busy afternoon :)
23:23meci could watch infoq all day long, and some days i have ;p
23:23flea__lol
23:29ataggart"Are We There Yet" is a great talk
23:29tomojunrelated awesome infoq: http://www.infoq.com/presentations/Searching-Without-Objectives
23:31mechow the jvm jit works and how current cpus work are good ones, no idea where they were tho