#clojure logs

2011-10-13

00:00technomancybecause it returns false for some listy things
00:00dsantiagoThen why do they both exist?
00:01technomancydsantiago: a lot of useful predicates got promoted from contrib together, and list? snuck in. but it shouldn't be in clojure.core; it's very misleading
00:01dsantiagoNo, I mean why do both clojure.core.PersistentList and clojure.core.Cons both exist?
00:01technomancyone's PersistentList is counted; Cons isn't
00:01technomancybut caring about the difference is like caring about array maps vs hash maps
00:02dsantiagoI know, I'm trying to understand Clojure's code. Why does it return one sometimes and the other other times?
00:03amalloywhen it has the list as a source-code literal it usually uses a list
00:03amalloybut consider, eg, ##(let [x 1] `(+ ~x 2)) - it has to cons a bunch of stuff together to get the list you want
00:03lazybot⇒ (clojure.core/+ 1 2)
00:04amalloyand especially ##(let [elts (range 5)] `(+ ~@elts))
00:04lazybot⇒ (clojure.core/+ 0 1 2 3 4)
00:05dsantiagoAnd it can't do that with a list and conj?
00:06amalloynot really? what list would it conj to?
00:07amalloyi mean, for this example, maybe. but `(+ ~@foo 10), and lots of more complicated forms, it's a waste of time to try to optimize for list-y-ness
00:07amalloysince these forms are generally just fed back to the compiler anyway, which doesn't care
00:08dsantiagoI feel like I'm missing something big, if that is an explanation for why both data structures are needed.
00:11amalloyit's not, i think. you asked why it sometimes returns one and why another
00:12amalloythey both exist so you can choose what tradeoffs to make, i think? you can have conj-to-front with or without being Counted
00:17amalloybut mostly lists are just seqs with some slightly different performance characteristics; you should usually care whether something is a seq, not a list
00:17dsantiagoRight, I get that.
00:17dsantiagoJust trying to understand the compiler.
00:31brehaut,(map #(class (partial cons)) [nil ())
00:31clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
00:32brehaut,(map #(class (partial cons)) [nil ()])
00:32clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval51$fn>
00:32roodytoodThe plant then took the guano molecule into it's root... going up it's stalk or shoot it deftly
00:32roodytoodturned into a pollen grain, swept up by a bee taking it to it's nest
00:32roodytoodThe nest gave birth to a larvae, which turned into a pupae, and finally into an adult bee
00:32roodytoodThey see me mowin' my front lawn
00:32roodytoodI know they're all thinkin' I'm so
00:32roodytoodWhite and nerdy
00:32roodytoodThink I'm just too white and nerdy
00:32roodytoodThink I'm just too white and nerdy
00:32roodytoodCan't you see I'm white and nerdy
00:32roodytoodLook at me, I'm white and nerdy
00:32roodytoodI wanna roll with the gangstas
00:32roodytoodBut so far they all think I'm too
00:32roodytoodWhite and nerdy
00:32roodytoodThink I'm just too white and nerdy
00:32roodytoodThink I'm just too white and nerdy
00:32roodytoodI'm just too white and nerdy
00:32roodytoodReally, really white and nerdy
00:32roodytood
00:32roodytoodThey see me mowing my front lawn
00:32roodytoodI know they're all thinking I'm so
00:32roodytoodWhite and great at math and science but socially unskilled and
00:32roodytoodunaccepted
00:32roodytoodThink I'm just too white and nerdy
00:32roodytoodThink I'm just too white and nerdy
00:32roodytoodCan't you see I'm white and nerdy
00:32roodytoodLook at me, I'm white and nerdy
00:32roodytoodANSWER ME!\
00:32roodytoodI want to go places with the gangsters
00:32roodytoodBut so far they all think I'm too
00:32roodytoodWhite and nerdy
00:32roodytoodThink I'm just too white and nerdy
00:32roodytoodThink I'm just too white and nerdy
00:32roodytoodI'm just too white and nerdy
00:32roodytoodReally, really white and nerdy
00:32roodytoodFirst in my class here at MIT
00:32roodytoodGot skills, I'm a champion at D&D
00:32roodytoodM.C. Escher, that's my favorite M.C.
00:32roodytoodKeep your 40, I'll just have an Earl Grey tea
00:32roodytoodMy rims never spin, to the contrary
00:32roodytoodYou'll find that they're quite stationary
00:32roodytoodAll of my action figures are cherry
00:32roodytoodStephen Hawking's in my library
00:32roodytoodI'm the best student here at MIT
00:32roodytoodI have got skills, but they are not rapping skills--I'm a champion at
00:32roodytoodDungeons and Dragons, a fantasy role playing game favored by nerds
00:33roodytoodWhen I think of the term "M.C." I don't think about rappers (the
00:33roodytoodassociation cool people would make.) Instead, I think of Dutch artist
00:33roodytoodM.C. Escher, whose math related art focused on impossible fantasy
00:33roodytoodworlds
00:33roodytoodKeep your 40 oz. malt liquor that rappers like, I'll just have an Earl
00:33roodytoodGrey tea
00:33roodytoodThe rims on my car never spin, to the contrary
00:33roodytoodYou'll find that they don't move
00:33roodytoodAll of my action figures are in perfect, original condition because I
00:33roodytooddon't take them out of the box or play with them
00:33roodytoodI have books by astrophysicist Stephen Hawking in my library
00:33roodytoodMy MySpace page is all totally pimped out
00:33roodytoodGot people beggin' for my top eight spaces
00:33roodytoodYo, I know pi to a thousand places
00:33roodytoodAin't got no grills but I still wear braces
00:33roodytoodI order all of my sandwiches with mayonnaise
00:33roodytoodI'm a wiz at Minesweeper, I could play for days
00:33roodytoodOnce you've seen my sweet moves, you're gonna stay amazed
00:33roodytoodMy fingers movin' so fast I'll set the place ablaze
00:33roodytoodMy MySpace page is wonderfully designed and decorated
00:33roodytoodI have got people begging to be one of my favorite friends
00:33roodytoodAnd listen to this! I know pi to a thousand places
00:33roodytoodI don't have dental jewelry, like rappers. Instead, I still wear
00:33roodytoodbraces like a teenager
00:33roodytoodI order all of my sandwiches with mayonnaise
00:33roodytoodI'm a great at the Minesweeper computer game and I could play for days
00:33roodytoodOnce you've see how good I am, you're going to stay amazed
00:33roodytoodMy fingers are moving so fast my keyboard will catch on fire
00:33roodytoodThere's no killer app I haven't run
00:33roodytoodAt Pascal, well I'm number one (one)
00:33roodytoodDo vector calculus just for fun
00:33roodytoodI ain't got a gat, but I got a soldering gun
00:33roodytood"Happy Days" is my favorite theme song
00:33roodytoodI could sure kick your butt in a game of ping pong
00:33roodytoodI'll ace any trivia quiz you bring on
00:33roodytoodI'm fluent in JavaScript as well as Klingon
00:33roodytoodHere's the part I sing on...
00:33duck1123well, this is going to be in the logs
00:33roodytoodThere's no wonderful computer program I haven't run
00:33roodytoodI am the best at computer programming in Pascal
00:33roodytoodI do vector calculus just for fun
00:33roodytoodI don't have a real gun, but I have got a tool that looks like a gun,
00:33roodytoodwhich I can use to connect pieces together in electronics projects
00:33roodytood"Happy Days" is my favorite theme song
00:33roodytoodI could sure beat you in a game of ping pong
00:33roodytoodI'll get a high score in any trivia quiz you bring me
00:33roodytoodI'm fluent in JavaScript programming language as well as Klingon,
00:33roodytoodlanguage spoken by the Klingons (an alien race) on the series Star
00:33roodytoodTrek.*
00:33roodytoodHere's the part I sing on...
00:33roodytood*Note: Most speakers of Klingon are nerds. not space aliens.
00:33roodytoodYou see me roll on my Segway
00:33roodytoodI know in my heart they think I'm
00:33roodytoodWhite and nerdy
00:33roodytoodThink I'm just too white and nerdy
00:33roodytoodThink I'm just too white and nerdy
00:34roodytoodCan't you see I'm white and nerdy
00:34roodytoodLook at me, I'm white and nerdy
00:34roodytoodI'd like to roll with the gangstas
00:34roodytoodAlthough it's apparent I'm too
00:34roodytoodWhite and nerdy
00:34roodytoodThink I'm just too white and nerdy
00:34roodytoodThink I'm just too white and nerdy
00:34roodytoodI'm just too white and nerdy
00:34roodytoodHow'd I get so white and nerdy
00:34roodytoodYou see me travel on my Segway
00:34roodytoodI know in my heart they think I'm
00:34roodytoodWhite and nerdy
00:34roodytoodThink I'm just too white and nerdy
00:34roodytoodThink I'm just too white and nerdy
00:34roodytoodCan't you see I'm white and nerdy
00:34brehaut,(map #(class (cons 1 %)) [nil ()])
00:34clojurebot(clojure.lang.PersistentList clojure.lang.Cons)
00:35brehauti.e., nothing major, just interesting
00:35dsantiagoInteresting.
00:35duck1123because you can't create a cons with a nil?
00:37amalloy&((juxt identity class) (cons 1 (lazy-seq nil)))
00:37lazybot⇒ [(1) clojure.lang.Cons]
00:37brehautduck1123: its particularly curious because () is a PeresistentList$EmptyList
00:37dsantiagohttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L547
00:52brehaut4clojure is indicating that i rely too heavily on point free
00:54amalloybrehaut: how so?
00:54brehautI'm still working through all the easy ones, and partial and comp are my default tools
00:54brehautim sure id be more succinct if just wrote some fns
00:58brehautwell, frinstance i could write #(map first (partition-by identity %)) for 30, but instead i wrote (comp (partial map first) (partial partition-by identity))
00:58brehautwhich is getting a bit ridiculous
00:58amalloyblech. you *do* deserve to be hanged
00:59amalloyi mean, it's sad that clojure doesn't let you express that with less typing
01:00amalloybut given that it doesn't, your code is surely less clouttered if you write some functions :P
01:00brehautobviously :P
01:13zakwilsonhttp://pastebin.com/VbW6TkLG <-- this congomongo update isn't changing the value and I have no idea why.
01:17amalloyzakwilson: the "where" part of your update doesn't make a lot of sense to me
01:18amalloywhich is not to say that it's necessarily wrong, but it's definitely what i'd look into first
01:20ibdknoxis it guaranteed to give you the same item each time you call fetch-one?
01:20zakwilsonibdknox: I don't know if it is, but it has been while I was trying to test this.
01:21zakwilsonamalloy: there isn't a where part. This is (update! collection old new).
01:21amalloyright. your "old"
01:21amalloyibdknox: fetch-one, without a where clause, gives you any arbitrary object
01:22ibdknoxthat's what I would have expected
01:22zakwilsonYeah, it can be anything, but every time I've called it on this collection, it has given me the same object.
01:23zakwilsonWhy doesn't the old make sense? It's the item to be updated.
01:24amalloyzakwilson: i usually update based on just a sub-part of the object
01:24amalloyeg, (update! :users {:user "amalloy"} {:$set {:skill "AWESOME"}})
01:27technomancyoh man; I found some of my old code from 2008
01:27technomancyseven add-classpath calls at the top of the file
01:27technomancyAWWW YEAH
01:28hiredman:D
01:28zakwilsonamalloy: an approach based on that worked, but I don't understand why using the whole object didn't.
01:29ibdknoxtechnomancy: that's the old vintage stuff, code gets better with age right? ;)
01:30technomancyibdknox: well it's not a fine wine if that's what you mean.
01:30hiredman~search for Vars
01:30clojurebot<#clojure:technomancy> hiredman: heh; vals vs vars? so like ... clojure.lang.IRefs are all blue? =)
01:30clojurebot<#clojure:duck1123> I really wish the dynamic warnings had shown the fully-qualified vars
01:30clojurebot<#clojure:duck1123> melipone: usually it's better to either require with a prefix (:as) or use only the vars you need (:only)
01:30clojurebot<#clojure:duck1123> I like vars because they allow me to write multimethods that dispatch on the function
01:30hiredmanbleh
01:30technomancyibdknox: actually it's funny you say that because I'm considering porting it to noir
01:31ibdknoxhaha
01:31ibdknoxso it *will* be wine.
01:31ibdknoxzakwilson: I wonder if it doesn't use all of the keys in the "where" and was picking one that wasn't unique?
01:32ibdknoxzakwilson: or some such
01:32zakwilsonibdknox: could be. That would be a bit pathological though.
01:32ibdknoxtechnomancy: well if you do, feedback is very welcome :)
01:32technomancyibdknox: so far its competition is "HERE IS SOME ELISP TO START A SWANK SERVER THAT CAN BE USED TO LAUNCH JETTY"
01:33technomancyso, thumbs up!
01:33ibdknoxlol
01:34ibdknoxNow if only I can convince amalloy to use it some day. That's when I know I've succeeded... Also that hell has frozen over :D
01:34technomancyibdknox: although my version did have fewer 80-column violations
01:35ibdknoxtechnomancy: I've never been good about that
01:35amalloyzakwilson: suppose that, for example, entry is {:text "Everything OK"}
01:36amalloyif there are multiple objects in the db with that text, then ibdknox's possible problem should arise
01:37zakwilsonamalloy: entry, in the call from my paste is the return value of calling (fetch-one :http-log) and has an :_id of the autogenerated and supposedly guaranteed to be unique sort.
01:38ibdknoxzakwilson: if you just use the _id does it work?
01:39amalloyokay. then you're just seeing that fetch-one returns the "first" object, and updating an object causes it to no longer be "first"
01:39amalloyyour update should work, but your later fetch is getting a different object
01:39zakwilsonibdknox: yes
01:39ibdknoxthat was my first guess! :D
01:39ibdknoxlol
01:39technomancyibdknox: having the newly-generated project include next steps as the default static splash page is a nice touch
01:40technomancythough it's a little vague about what file should be used
01:40ibdknoxtechnomancy: years of being annoyed with trying to figure out what to do next :)
01:40zakwilsonamalloy: I thought that, but that wasn't what was happening. It was the same object, with the same :_id and no :date.
01:40ibdknoxtechnomancy: I haven't touched it since I first created it
01:40ibdknoxtechnomancy: definitely should get cleaned up and made a bit nicer
01:40amalloyzakwilson: ibdknox is okay for debugging database problems, but he can pry my HTTP headers out of my cold dead hands
01:41ibdknoxhahaha
01:41ibdknoxoh it'll happen
01:41zakwilsoneh?
01:41ibdknoxone day.
01:41amalloy*ashamed* yes, it will
01:42amalloyzakwilson: i persist in telling people ring/compojure are cooler than noir
01:42ibdknoxooo
01:42technomancycan I just say... HTTP status code jokes: great jokes or greatest jokes?
01:42zakwilsonOk, let's see if trying to do this to all 15000 log entries blows up the server!
01:43ibdknoxthe latest version of ring fixed some things I've been wanting for a while :)
01:43technomancyso I was kind of on the whole "you should use lower-level libs like ring and compojure if you already know how the whole web stack works and maybe use something like noir if you are still figuring things out" idea
01:43brehautamalloy: you are half right; ring/moustache is cooler than both
01:43technomancythen I realized *I* don't really know the web stack all that well
01:43technomancyand I'm not sure I have the patience to do a lot of that stuff by hand
01:44ibdknoxbrehaut: I'll get you too
01:44ibdknoxlol
01:44brehaut:)
01:44ibdknoxjust wait.
01:44amalloytechnomancy: you can only tinker with so many things at once, i guess
01:44ibdknoxhaha
01:44ibdknoxit's true
01:44amalloyi prefer http to elisp :P
01:44ibdknoxeverybody should prefer http to elisp
01:45technomancyhttp is a lot more stateless that elisp
01:45ibdknoxthough I'm sure the greater clojure community is glad technomancy took up the burden
01:45zakwilsonI haven't tried noir yet. I've built a few things on compojure/ring.
01:45amalloyhigh five, bro
01:45ibdknoxlol
01:45technomancywhether I'm glad I got caught up in the madness is another question...
01:46ibdknoxtechnomancy: too late now lol
01:46ibdknoxthat's always the problem with these things
01:46ibdknoxyou get pegged as the go to guy for x... and then you're stuck with it forever
01:47zakwilsonI need to read over the noir docs and see if it's something I should be interested in.
01:47ibdknoxhm
01:47technomancyibdknox: is there a reason the pregenerated server.clj must call load-views?
01:47ibdknoxI vote.. yes.
01:47technomancyseems like that could be infered
01:48ibdknoxtechnomancy: I suggest a project structure, but you don't have to keep to it
01:48amalloytechnomancy: i need to have a better recall of the http response codes
01:48ibdknoxI *do* need to load view files somehow though, to capture the routes
01:48amalloyso that i can more quickly respond with 406 to your suggestion that we tell status-code jokes
01:49technomancyibdknox: seems like server/start gets the ns root; it could call (load-views (format "src/%s/views" (:ns opts))) or something
01:49technomancyamalloy: sudo gem install cheat; cheat http
01:49technomancymy secret is out
01:49technomancyalthough that leaves out important ones like 418
01:49ibdknoxtechnomancy: ah, there's a load-views-ns function as well
01:49amalloyi assume that's the teapot?
01:49ibdknoxbut yeah
01:49technomancyamalloy: naturally
01:50brehautibdknox: i could be convinced to switch to noir if you include support for HTCPCP
01:50cemerickare the auxiliary namespaces like clojure.zip available in 4clojure?
01:50ibdknoxbrehaut: lol
01:50zakwilsonI once considered causing everything on a non-paying client's site to return 402.
01:50brehauti don't need the 418 response handled though
01:50amalloycemerick: they often are, by accidents of sandboxing, but we don't put them there on purpose
01:51cemerickamalloy: Thanks. BTW, try-clojure is down for the count, if you've got a hand in that.
01:51amalloyi think what happens is you can use whatever namespaces we happen to already use while implementing the site
01:51amalloycemerick: thanks, i'll go restart it
01:51technomancyibdknox: the filter call in load-views-ns doseq should be a :when clause
01:51cemerickamalloy: It was a permgen error — is class GC not enabled there?
01:52amalloywhuuuuut? it runs with the same settings as 4clojure, and i *know* classes get GCed there
01:52cemerickI didn't keep the window open, but the error was "PermGen Space" IIRC
01:53ibdknoxtechnomancy: indeed, I always forget to use those
01:53amalloyRaynes: ^
01:53amalloycemerick: the process is still running, too. this has happened before, and i don't know why it's not serving responses
01:54amalloyi'm not going to restart it till Raynes has a chance to look at it and maybe know what's going on
01:54Raynesamalloy: Don't look at me. I've got no clue.
01:54RaynesIt has been doing this since forever, so no, not really.
01:54amalloywell then. /me gets out the axe
01:56technomancyibdknox: any plans to trim down the bare :use clauses in the skeleton project?
01:57ibdknoxtechnomancy: I like nit-picks :) Yeah, I need to go through the whole project and clean that up.
01:57ibdknoxI'm making a list :)
01:57technomancya public list?
01:58ibdknoxif you want to add them as issues, I'm fine with that, but I was just keeping a list here
01:58technomancyok, I may
01:59technomancyhave you looked at the lein spawn plugin?
01:59ibdknoxI think I did once upon a time ago
02:00technomancyI haven't tried it myself, but it seems like it could be a good fit
02:00technomancyhm; can you only label issues in repos you can write to?
02:01technomancygithub issues; that is
02:01amalloytechnomancy: yeah, you can't do much otherwise
02:01technomancyI guess that makes sense
02:04technomancyyou never know!
02:04amalloyor i did, anyway, but i guess they're not secret anymore
02:05technomancyI know a guy who makes pull requests that delete every whole file and submits them as "Architectural Improvements to MongoDB"
02:05amalloy*chuckle*
02:05technomancywhich I secretly find hilarious
02:05amalloy$google clojure lava github pull request
02:05lazybot[renamed all references to "clojure" to "lava" - GitHub] https://github.com/clojure/clojure/pull/6
02:06amalloy^ my favorite ever
02:06technomancyclassic
02:07hiredmangood thing clojure doesn't take pull requests...
02:10amalloytechnomancy: in fairness, i *did* once get an issue filed by some spambot
02:10amalloyselling shoes or something
02:11hiredmandid you close it "wontfix"?
02:11amalloyhiredman: man, i wish github issues let you categorize closed issues
02:12amalloyi guess i could create a wontfix label, and only apply it to closed issues
02:12technomancyEINSUFFICIENTTOEROOM
02:13ibdknoxlol
02:15hiredmanEENTSCHEIDUNGSPROBLEM
02:15ibdknoxach nein!
02:15ibdknoxwas sollten wir tün?
02:15ibdknoxlol
02:16technomancyibdknox: there's a 16kb .swp binary file in noir-1.2.0.jar; I assume that's unintentional?
02:16ibdknoxhaha
02:16hiredmanibdknox: cry
02:16amalloyhiccup has a couple .swp files too
02:17ibdknoxthat is indeed unintentional :-p
02:17amalloyit's nice of the vim pariahs to label themselves to clearly
02:17amalloy*so
02:17ibdknoxA badge of courage ;)
02:47cemerickwho needs reliable REPL interruption when there's OOM errors?
02:47amalloyeh?
02:49cemerickdon't mind me, just melting chips over here
02:50companion_cubeamalloy: .swp is more discrete than a myfile~ :þ
02:51amalloycompanion_cube: there are a fair share of those in jars too, i'm sure
02:52amalloybe a good citizen, and configure your editor to back your files up somewhere OTHER than the cwd. then nobody needs to know what editor you're using :P
02:52cemerickstandard .gitignores are good things, too
02:53amalloycemerick: not much use for jar files, though
02:53cemerickyou all do releases out of working directories, huh? o.0
02:59brehautits there a tails function in clj?
02:59amalloybrehaut: (partial reductions rest), i think
02:59amalloyer, no
02:59brehaut(take-while seq (iterate next s)) ?
02:59amalloy&((partial reductions conj []) [1 2 3 4])
02:59lazybot⇒ ([] [1] [1 2] [1 2 3] [1 2 3 4])
03:00amalloythough seq/next is probably closer to how tails would be implemented in haskell
03:00brehauti think reductions is backwards to tails
03:01brehauttime to eat anyway
03:01amalloyi guess it probably is. alas
03:02cemerickchouser: nice problem
03:02cemerick(if you're awake)
03:37amalloycemerick: the requirement for ordering is no fun at all :P
03:37cemerickyeah
03:38cemerickI've got the 'hard' case, just filling in for the smaller ones.
03:43Blktgood morning everyone
03:48emil`does anyone know why the clojurescript repl sample doesn't respond after the second post is sent to the server? can't get the example to work :|
03:57symboleWhen editing in the SLIME repl, is there a way to insert new expressions in the middle of the code without causing evaluation? In other words, I want to evaluate my code when I hit ENTER at the end of the expression, not in the middle of it.
04:01tomojhitting C-j instead of RET is a workaround
04:01ibdknoxtechnomancy: I addressed your nits :)
04:02symboletomoj: That worked. Maybe I should use paredit. Hmmm...
04:12tomojsymbole: you convinced me to finally figure out how to do that
04:12tomoj(add-hook 'slime-repl-mode-hook 'durendal-slime-repl-paredit)
04:12tomojdurendal being in marmelade
04:20symboletomoj: So that's paredit in the repl?
04:27fhdDoes anybody know what the status of Leiningen's transition to Aether is?
04:28fhdI've read a one year old post by technomancy saying it would be a good idea, but couldn't find much more.
04:29symbolefhd: Look into Pomegranate. That might be of interest.
04:30fliebelWhat are these? *googles*
04:30symbolehttps://github.com/cemerick/pomegranate
04:31fhdsymbole: Wow, very fresh. So I guess Leiningen is waiting for this to reach a usable state, eh?
04:31cemerickfhd: coming sooner rather than later, insofar as I need lein to do things it can't do yet.
04:32fhdcemerick: I'm asking because a colleague of mine is a Maven geek and I guess Aether would make him not curse about Leiningen all the time :)
04:32fhdcemerick: He might want to help out, I'll point him to the GitHub project.
04:32cemerickI doubt technomancy is waiting for pomegranate, but I'll bet he'll take a clojure wrapper if he can get one.
04:33carkis anyone using hsqldb ? is it good enough for embedded use, and is there any bad war stories to tell ?
04:34symboleWhat is Leiningen using now to interact work with Maven artifacts?
04:35fhdsymbole: The Maven Ant Tasks
04:35fhdsymbole: Makes it kind of hairy to work with Leiningen in a pure Maven environment here
04:35fliebelcark: That is like... SQLite in Java?
04:36carkfliebel: kinda, got tired of doing type conversions with sqlite so i'm looking for an alternative
04:36carklooks like the java contenders are h2 and hsql
04:36fliebelcark: I think Clojurebot uses derby.
04:36carkderby looks a bit too hairy
04:36carkah =)
04:37carkit's a shame postgres is not embeddable
04:40cemerickfhd: Yes, aether will make it so that all of settings.xml and settings-security.xml is recognized
04:40lpetitcark: what about java db, which is embedded with the JDK ? (afaik, not an expert in this area)
04:40carklpetit: it's derby
04:41carkmy application is time sensitive (not too much but still)
04:41carkso i need good concurrency in the database
04:41carkcan't have a long statistics query blocking the whole thing for a couple seconds
04:42symboleEmbedded Derby is easy to work with. The standalone Derby is a bit hairy because of all the tools and options available.
04:42carkso h2 is out, and i *think* i read somewhere derby's concurrency wasn't top notch
04:42fhdcemerick: That's exactly our problem right now. Some settings are respected, some not. Makes for very ugly project.cljs and custom scripts.
04:43carkchanging database engine is always such a pain =(
04:44cemerickfhd: Totally understood. Getting that fixed is fairly high on my priority list.
04:44fhdcemerick: I've pointed my colleague to pomegranate, it would already be a big help for us, simplifying our custom scripts. Hope he is in a mood to contribute :)
04:45fhdWhile I'm at it, does anybody know a process library for Clojure? Couldn't find anything.
04:45fhdI want to execute processes, read stdio and write stdin. Pretty ugly with pure Java.
04:48symbolefhd: This might help http://commons.apache.org/exec/.
04:48raekclojure.java.shell wraps java.lang.Runtime.exec
04:53lpetitfhd: plain old contrib's sh worked well for me. Maybe clojure.java.shell is it's reincarnation ?
05:10cemericklpetit, fhd: it is, and has worked well enough for me, though I'm not a big shell/script user in general
05:24kzarI'm destructuring a vector into a bunch of names, I then need to return a map of those names and values. It seems redundant writing out the map manually like `{:var-name var-name :something something :example example}`, is there a better way?
05:24kzar(I figured there might already be a way to do it, but if not I figure I could write a macro to do it.)
05:26raekkzar: nothing in core, but a macro that does that is simple to write
05:27kzarraek: Yea I reckon I can do it, OK thanks
05:27raek(I know I have at least one gist with that macro somewhere)
05:29kzarraek: (Although I now realised I would have to pass each variable name into the macro so it would still be quite verbose. Figure it's better to write a function that's designed for destructuring a vector into a map.)
05:29raek,(zipmap [:a :b :c] [0 1 2])
05:30clojurebot{:c 2, :b 1, :a 0}
05:30fhdlpetit: Wow, didn't know about clojure.java.shell, looks good!
05:30kzarraek: Oh, cool!
05:31raekkzar: if you're not going to touch the values from the vector before you put them in a map then I think zipmap does the trick
05:31kzarraek: Then I can always use update-in or the likes afterwards
05:33carkkzar : have you looked into the :as keyword when destructuring ?
05:33mindbender1hi All.
05:33cark,(let [{:keys [a b c] :as m} {:a 1 :b 2 :c 3}] (assoc m :a 3))
05:33clojurebot{:a 3, :c 3, :b 2}
05:33kzarcark: Yea, :as is handy sometimes. Not sure it helps me here though
05:34mindbender1Is code completion possible with emacs when doing clojure dev?
05:34carkmindbender1: yes
05:34mindbender1ok. How do I get it?
05:34carkmindbender1: i assume you have a slime setup already ?
05:34mindbender1cark: yes I do
05:35carkmindbender1: i'm using the auto-complete mode
05:35carki think you can get it through packages
05:36raekyou can press C-c tab with standard slime
05:36carkraek : that's too long =P
05:36carkthink about your RSI !
05:36carkhttp://www.emacswiki.org/emacs/AutoComplete
05:36raekit's not as impressive as auto-complete-mode, though
05:37carkwe emacs users are well known for wrist pains already =D
05:38winkso it seems La Clojure won't work with WebIde, only with IDEA, right? :|
05:41kzarcark: As Slashdotters liked to incant; "correlation is not causation". Or, in other words, the average EMACS user has used a computer for years - a lot - and spends a decent amount of time programming.
05:41carktrue, but correlation *may* imply causation
05:41kzarcark: Perhaps the hotkeys in EMACS are the cause for people's problems but I suspect not, I worry that it gets a bad name.. but then on the other hand people have been making fun out of it for years
05:42carkor at least correlation is a first lead
05:42carkyou cannot deny that emacs key-chords are sometimes painfull
05:43carkspecially for non-us keyboards
05:43kzarWell I can, but it's personal I guess
05:43carkanyways, best tool for the job, so we're stuck with it
05:44kzartrue, true also you can re-bind any combinations you find painful
05:44carkoh that's something i try to avoid as much as possible
05:45carki try to learn new hand positions for the same combinations instead
05:57mindbender1cark: how does auto-completion pick out the list of words to use for completion?
05:57carki don't know, it has several different sources it seems
05:58mindbender1but when we define new words does it get listed automatically?
05:58carkyes
05:58mindbender1ok, that's just what I wanted. thanks
06:00guwhat is the most ideomatic way of writing this? (get (:my-key my-map) my-map)
06:19fliebelgu: Huh, so you get key of the value of the key for the map? or are my-map and my-map two different things?
06:23gufliebel: nope, my-map and my-map are the sa
06:23gu*same
06:24fliebelYour approach looks valid to me.
06:24fliebel&(let [m {:a :b :b :c :c :d}] (take-while identity (iterate (partial get m) :a)))
06:24lazybot⇒ (:a :b :c :d)
06:24cark((:my-key my-map) my-map) seems the smallest
06:27fliebel&(take-while identity (iterate {:a :b :b :c :c :d} :a))
06:27lazybot⇒ (:a :b :c :d)
06:28fliebelI keep writing iterate with take-while around it. Maybe iterate should have a stop condition built in?
06:29raekisn't that operation called "unfold"?
06:29raekin FP terminology
06:30fliebelraek: We don't have that, do we?
06:30raekno
06:30fliebelI think amalloy-util has :)
06:34fliebelraek: unfold seems to do a couple of extra things.
06:51thorwilhmm, i guess hiccup can be helpful for writing atom, too
07:24thorwili have a file atom_fee.clj that used to def "base" via a macro. it no longer contains any symbol or even string of that name anymore and has been recompiled
07:25thorwilbut if i try to :use it, on compiling i get a complaint "java.lang.IllegalStateException: base already refers to: #'tlog.views.parts/base in namespace: tlog.views.views"
07:26thorwilhow can this be and how to mend it, short of terminating the session?
07:27fliebelDoes anyone know why vimclojure uses a custom nailgun server?
07:31raekthorwil: you can use ns-unmap and remove-ns to clean up old vars
07:32raekwhen you use remove-ns to remove namespace foo, you also need to remove the namespaces that use any vars from foo
07:33raekthorwil: but in this case the solution could be as simple as (ns-unmap 'something-here.atom-fee 'base)
07:33thorwilraek: i just did that, worked, thanks!
07:34thorwiltime and time again i run into issues because what's in the session is not what is in the (compiled) files
07:34thorwilbut usually i only notice starting up the next time, when something breaks. not during a session /:
07:36thorwilis the only way out to pay attention to the vars i remove and to manually remove them from my namespaces?
08:39mindbender1with the way clojure talks about identity and state, is there a way to retrieve previous state of an object after mutation? Or am I not grabbing the concept?
08:46lnostdal_,(+ 2 2)
08:46clojurebot4
08:47lnostdal_mindbender1, perhaps you mean http://paste.lisp.org/display/125291
08:48lnostdal_..or do you mean when using STM (DOSYNC etc.)? .. the FN for ADD-WATCH is passed the old-value
08:49raekmindbender1: when you get the current state ("deref") the reference you get an object that never changes. if the reference is then changed, that state object becomes the previous state. the point is that once you have something that was the current state for a certain point in time, that something does not change when the reference changes
08:51raekso the point is not to have the history available as a list of values that you can browse through, but the ability to take a snapshot that does not change
08:51raek(however it's possible to record the history using add-watch, as lnostdal_ pointed yout)
08:52mindbender1I am now enlightened.. thanks
08:52mindbender1I thought probably you could browse it as a history:-D
08:53raekwell, refs (the reference type that is governed by transactions) actually keep a history of values internally
08:54raekbut I don't know if you can access it
08:55mindbender1ok
08:55raekthe STM simply makes sure there is enough history there so that you can read from multiple refs atomically in a transaction
08:56mindbender1ok
08:57raekall this lets you program without worrying that a value "changes beneath your feet" while you process it
08:57raekby separating mutation from data
08:57mindbender1ok
09:16fliebelWhat is teh question mark? (java) new StdHttpClient?.Builder()
09:16fliebelJust a type in the docs?
09:16fliebel*typo
09:24jcromartieHI EVERYBODY!
09:29jcromartieReading a journal file of 100K simple changes to a map (assoc :x n) is pretty fast: 4 seconds.
09:29jcromartiereading and applying, that is
09:30jcromartie(reduce apply-event {} (form-seq "/path/to/journal-file"))
09:31raflfor integration with another build system, i'm looking for a way to get the version number out of my lein project's project.clj. can anyone think of a way to do that without actually reading the file myself?
09:37wilkesrafl: we do this, https://gist.github.com/1284233
09:37wilkesnot sure if this the best way, but it works for us
09:38wjlroeI'm having a problem with atoms. http://paste.lisp.org/display/125292 The first time I run get-setting - it returns the setting I want (@config isn't null) - then @config is null, stacktraces - then it works, then is breaks again. I can't see where @config is being repeatedly set back to nil
09:39dnolenwow Google Closure canvas graphic is slow … less I'm missing somthing
09:52ThreeCupsI'm new to clojure. I'm building a REST app. I'm looking at https://github.com/ordnungswidrig/compojure-rest. It looks simple and useful (in my very un-informed opinion). But it's old. Any thoughts on libs to build a REST app?
09:53ThreeCupsHmm... I can't build it using leiningen. org.clojure:clojure:jar:1.1.0-alpha-SNAPSHOT is missing
09:53ThreeCupsIt's pretty old...
09:55raflwilkes: that does help. cheers!
10:08ThreeCupsHow does one figure out what version to put in a leinengen project.clj file for clojure (1.3) contrib libs?
10:08ThreeCupsfor the :dependencies key
10:09ThreeCupsin the defproject form
10:10wilkesrafl: you're welcome
10:11ThreeCupsI'd like to use the 'raise' function (form?)
10:11wjlroeDoes anyone know how to get DNS name resolution working with Clojure on 64bit Ubuntu?
10:13TimMcwjlroe: I'm using Clojure on x64 Ubuntu. Whta's the problem?
10:14wjlroeTimMc: java.net.UnknownHostException for everything
10:14TimMcwjlroe: Give me a snippet to try.
10:15TimMc...but I'm pretty sure it works for me, given that lein can bootstrap itself.
10:15TimMcMaybe it only uses curl and maven.
10:24arohnerwjlroe: it's very likely a problem with your box. There's nothing special about Clojure + DNS
10:24arohnerClojure just uses the built-in Java sockets code
10:26wjlroeYeah but there are problems with Java and DNS: http://stackoverflow.com/questions/6277692/how-can-i-set-the-dns-servers-to-use-from-a-java-program
10:28arohnerwjlroe: right, a problem with your ubuntu install :-)
10:31wjlroeWell it's seems that it's that it can't resolve using IPv6 - you can work around by forcing IPv4 but that's really messy with Leiningen +Clojure
10:31jcromartieso I made this journaled ref thing https://gist.github.com/1284348
10:32jcromartiebut I am not sure it's effective
10:32jcromartieor that it needs to be refs
10:32TimMcwjlroe: Do you have lib32nss-mdns installed?
10:32wjlroeTimMc: there is no such package afaics
10:32TimMcOh, I see.
10:32wjlroeTimMc: probably quite out-of-date and related to debian.
10:32jcromartieSince the (dosync) is inside my command-processing function, are the benefits lots?
10:32jcromartielost?
10:32jcromartieor no...
10:33jcromartiethe actual commands could still take advantage of other refs inside the transaction
10:33jcromartieso that's fine I guess
10:34TimMcwjlroe: I think it is a problem Ubuntu inherits from Debian... nasty bug. Can you get the package to install stand-alone?
10:36TimMchttp://packages.ubuntu.com/dapper/libnss-mdns it was present in hardy, then dropped out of sight until lucid.
10:38jweissi have a coll i want to process in parallel, it does some calls over the network (side-effecty), but i want to limit the number of threads. future appears to be unlimited. what's the suggested solution here? agents?
10:43TimMcjweiss: Java might provide some sort of thread pool lib.
10:46ThreeCupsjweiss: I can speak for Java, it has java.util.concurrent package. Look at the Executors class. You could also look at the Google Guava stuff. It has a ListenableFuture that helps in composing these things.
10:46jcromartieanybody want to take a look at this... https://gist.github.com/1284348
10:46ThreeCupsnot sure if there's a pure clojure solution
10:46wjlroeTimMc: libnss-mdns hasn't changed anything. but the problem seems to be that Java ignores /etc/resolv.conf
10:46jweissThreeCups: ok, i know about Executors, thought there might be an alternative here. thanks
10:46TimMcweird
10:47jcromartie(the code is not set up as a proper lib yet... just copy/pasted out of the middle of my new project's scratch pad)
10:47TimMcjweiss: And if the thread pool stuff is too cumbersome... make a wrapper and share it! :-)
10:50duck1123jweiss: you might want to check out getwoven/work, but I had some dependency issues when I tried it
10:50jweissthis is actually a pretty thorny problem - the items in my coll could either call xmlrpc (in which case too many threads overloads the apache client and throws errors), or attempt to deref a promise, which could block. so it's very difficult to avoid both deadlocking AND overloading the xmlrpc client.
10:51jweissright now i'm using futures and getting xmlrpc client thread errors
10:51jweissthat xmlrpc client sucks by the way
11:05devn,`',(o'_'o);'
11:05clojurebot(quote (sandbox/o'_'o))
11:05devnyay for ascii art
11:11TimMcOK, time for a Clojure/Perl bilingual programming contest!
11:11TimMcYou start. :-P
11:13devnhaha, no thanks.
11:13devnI was just thinking about a fun sticker or something -- someone once showed me a really nice fish-looking combination with '` and such
11:25devn,(conj [(symbol "<")] [:o])
11:25clojurebot[< [:o]]
11:25devnAnyone have a more convincing whale up their sleeve?
11:25dnolenhuh one of the largest online forums in China - Clojure users
11:25devndnolen: whoa.
11:26devndnolen: methinks I need to go back to studying mandarin
11:27devndnolen: out of curiosity, how did you come across that info?
11:27dnolendevn: the Clojure Success Stories on Confluence
11:27clojurebotclojureql is http://gitorious.org/clojureql
11:29ejacksonthats unexpected
11:31devndnolen: interesting.
11:31devnclojurebot: clojureql
11:31clojurebotclojureql is http://gitorious.org/clojureql
11:31devnthe Clojure Success Stories on Confluence
11:31devndevn: the Clojure Success Stories on Confluence
11:36dnolenOMG, http://objectcommando.com/blog/2011/10/13/appendo-the-great/
11:39kevinburkehttps://groups.google.com/group/compojure/browse_thread/thread/42d6e550d7bdeae5?pli=1 is the syntax here still valid or is this out of date?
11:39zerokarmaleftdnolen: hah, nice army of darkness reference
11:42dnolenlooks like puredanger put it on HN, upvote! http://news.ycombinator.com/item?id=3107531
11:45gtrakstill waiting for my copy of 'reasoned schemer' to show up from your talk
11:46ejacksonupvoted....
11:47gtrakmitpress is dropping the ball
11:48dnolengtrak: it may be out of print? Amazon is saying it ships 1 to 2 months now. That's not how it was before.
11:49gtrakyou possibly single-handedly caused a run on them
11:50dnolennice 4 more days before strangeloop releases Simple Made Easy video
11:51stevedbI'm glad they are starting with that talk
12:00lobotomyhey guys, any ideas for clojure syntax highlighting for a blog? apparently there are a few syntaxhighlighter brushes around for it
12:05sridlobotomy: octopress. or just plain old pygments.org
12:06lobotomycheers
12:06sridi use octopress for my blog, and it can highlight clojure without any extra configuration
12:13kzarsrid: What's octopress like? Also what's it written in?
12:13srid$google octopress blog
12:13lazybot[imathis/octopress - GitHub] https://github.com/imathis/octopress
12:14sridits written in ruby, with plugins and good enough default configuration for programmer blogs
12:16arkhhow does one use dec' without fouling up the reader? e.g. this doesn't work: (let [x (atom 0)] (swap! x dec'))
12:16jcromartiewhat is dec'
12:16hiredmanit works if you are using clojure 1.3
12:16arkhlike dec but promoted to long if needed
12:16hiredmanno
12:16arkhoh... busted
12:16hiredmanlike dec but promoted to bigint if needed
12:17jcromartieah
12:17sridwhy would you want to promote to bigint if dec will return a smaller number?
12:17arkhhiredman: I'm still using 1.2, my bad
12:17jcromartieis there any hope of getting reader macros in Clojure?
12:17jcromartiesrid: overflow
12:18jcromartie,dec Integer/MIN_VALUE)
12:18clojurebot#<core$dec clojure.core$dec@8c6282>
12:18jcromartie,(dec Integer/MIN_VALUE)
12:18clojurebot-2147483649
12:18jcromartieoh
12:18jcromartie:P well apparently it works for clojurebot
12:19jcromartie,*clojure-version*
12:19clojurebot{:interim true, :major 1, :minor 3, :incremental 0, :qualifier "master"}
12:19sridi get overflow exception
12:19srid.. on 1.2
12:19jcromartie,(type (inc Integer/MAX_VALUE))
12:19clojurebotjava.lang.Long
12:19jcromartie,(type (inc' Integer/MAX_VALUE))
12:19clojurebotjava.lang.Long
12:19jcromartieso yeah
12:19jcromartie,(doc inc')
12:19clojurebot"([x]); Returns a number one greater than num. Supports arbitrary precision. See also: inc"
12:20jcromartie,(type (inc' Long/MAX_VALUE))
12:20clojurebotclojure.lang.BigInt
12:20jcromartiehere we go
12:21joly,(let [x (atom 0)] (swap! x dec'))
12:21clojurebot-1
12:23arkh1.2 thinks the quote is a reader macro character
12:23gtrakdnolen, would you say the curviness of the kinesis is particularly useful? I'm looking at this one: http://www.trulyergonomic.com/
12:25dnolengtrak: yes, the bowled Kinesis design is actually by the same fellow who did the Maltron keyboards
12:26dnolenlike a piece of sculpture, http://www.amazon.com/gp/product/B000YL4EPM/r
12:26dnolen$645 dollars just for one side!
12:27gtrak those look pretty awesome
12:27hiredman"A maker of particularly durable, expensive, ergonomic keyboards" -- product features
12:28dnolenthey're not kidding about the durable thing, I think this Kinesis could easily last me another ten years.
12:33sriddnolen: are these keyboards significantly better than the MS ergo keyboard 4000?
12:34srid(i don't use much of the arrow keys)
12:35dnolensrid: honestly can't say I've been using the Kinesis for 5 years. but the again the innovation around the Kinesis is the ability to leverage your thumbs for control keys, so a lot less moving off home.
12:36dnolenthey're also reprogrammable, and all the keys are physically switchable
12:41arohnerdnolen: are you an emacs user?
12:41wastrelemacs
12:41dnolenarohner: yup
12:43arohnerI notice my left wrist getting sore more often than my right. I blame the control keys on emacs for that. Do you notice any improvement with your keyboard?
12:43dnolenalso OS X user, and OS X supports the basic Emacs bindings for movement everywhere.
12:43arohnerthe faux emacs irritates me more than no emacs at all
12:43dnolenarohner: I hate control pinkie. mapping CTRL to Caps Lock doesn't fix that.
12:44dnolenarohner: when I was using the GUI Cocoa Emacs 24, I mapped CTRL to Command, stink to move off home keys but no more CTRL pinkie.
12:45arohnerwhere is ctrl on your keyboard? It looks like caps lock is in the same place
12:45dnolenpeople like to complain about Emacs chording, TextMate chords are way more insane (hold down 4 keys at the same time, seriously?!)
12:45arohnerI have caps -> control on an MS ergonomic
12:45dnolenarohner: on my laptop caps lock is in a different spot
12:47TimMcdnolen: C-M-H-S-8
12:49sridEnlive question -- within an <li>, I need to inject a different HTML structure based on the element in a collection. should I construct this HTML structure (hiccupp-style) and then add to it to the <li> in enlive template, or is that possible to do from enlive itself?
12:49technomancythe MS natural uses rubber membranes that get pretty mushy after 3-4 years
12:49technomancyit'll still work, but the key response is a lot less present
12:50srid<li><b>event1</b1>: <i>attr</i></li> ............. <li><b>event2</b1>: <div>event's data</div></li> ... etc..
12:50technomancynot that it's all that crisp when new
12:50TimMctechnomancy: On the other hand, it is only like $45.
12:50arohnertechnomancy: why is crispness desirable?
12:50technomancyTimMc: true, it's definitely the best in that price range
12:51technomancymost people like a crisp response, but I guess it's a matter of taste
12:51TimMcI can't figure out how you would use that Maltron.
12:51carkmechanical keyboards are the best
12:52carkclicky ones =)
12:52arohnertechnomancy: no, it's just I've never met people in real life who had an opinion about keyboard response, so I haven't thought about it enough to develop a taste
12:52TimMc\o/
12:52technomancyI guess one thing is that with a mushy response it's not clear exactly when the keypress registers.
12:52dnolenTimMc: you do have to spend some time training - 2 weeks, then you get up to full speed in a couple of months
12:52technomancyso it makes you press harder than necessary
12:52TimMctechnomancy: Exactly.
12:52dnolenarohner: Kinesis keyboard response is incredible.
12:52TimMcdnolen: My hand hurts just looking at it.
12:52technomancycark: if they made a split model M, that would make my day
12:53dnolenthey actually have a little speaker inside the keyboard that clicks when you pass the threshold for activation.
12:53dnolenand a physical click as well
12:53TimMcIt looks like you have to move and re-angle your hand quite a bit.
12:53TimMcdnolen: Nice.
12:53dnolenTimMc: you do not reangle your hand
12:53dnolenTimMc: you reangle your hand on traditional keyboards
12:54carktechnomancy: i made a unicomp comme accros from usa, that's the same technology than model M
12:54carkand feels the same too
12:54carkalso they do all layouts (even belgian ones)
12:55carkand you can kill someone with it =)
12:56carkbut no split that i know of
12:56TimMcdnolen: To hit those top keys in the curve, don't you have to straighten your fingers and punch them forward?
13:06ghiuwhat is the best way to join two sets? like #{} #{:a :b} => #{:a :b} || #{:a} #{:a :b} => #{:a :b} || #{:a :c} #{:a :b} => #{:a :c}
13:07ghiu(set (concat a b)) ?
13:07raekghiu: are you looking for set union?
13:07raekclojure.set/union
13:07Bronsao
13:07ghiuthanks
13:08raekis the last example correct? shouldn't it be #{:a :c} #{:a :b} => #{:a :b :c}
13:08ghiuraek: yes, sorry, you stand correct
13:08raekhttp://clojuredocs.org/clojure_core/clojure.set
13:09ghiuthank you very much, union is what i was looking for :)
14:06jamiltronWhere did clojure.contrib.math go in 1.3?
14:08mattmitchellis there a way to replace a value with another in a list? example: (replace '(1 4 990) 990 7) => '(1 4 7) ?
14:09mattmitchellugh, yeah the replace function :)
14:09nickmbaileydid 1.3 allow you to type hint java arrays or can you still not do that?
14:10hiredmanyou've always been able to
14:10nickmbaileywell that's interesting, wonder why i thought you couldn't
14:12thorwiljamiltron: clojure.math.numeric-tower
14:13jamiltronAnything crazy I need to do to be able to use that? When I try using or requiring it I get a message that its not in my classpath. This is in a lein-created project using 1.3
14:14gfredericksjamiltron: probably need to add it as a separate dependency
14:15thorwilyou need to add the right repository. one moment
14:15thorwilin your project.clj: :repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/&quot;}
14:15raekisn't that one included by leiningen by default? (I could be wrong)
14:16technomancyraek: it's not; default is just central and clojars
14:16gfrederickswhy would a clojure library not be in clojars?
14:17thorwilsome of the former contrib libs are in beta state
14:17brehautbecause clojars is for the hop polloi ?
14:17brehautgoddamn autocorrect
14:18amalloybrehaut: you can't even disable that "feature"?
14:18gfredericks"hop polloi" is a good way to indicate to a crowd of people that you want them to get riled up
14:18brehautamalloy: I've disabled it multiple times
14:18amalloynice
14:18thorwilit autocorrects the disablement?
14:18gfredericks:D
14:20jamiltronSorry for being completely ignorant, but how do I go about including this in lein. I'm only really accustomed to looking on clojars for dependencies.
14:20nickmbaileyhiredman: i see how to type hint primitive arrays but how do you type hint arrays of java Objects 'Object[]'
14:20amalloy^"[Ljava.lang.Object"
14:21nickmbaileyaha
14:21raek^"[Ljava.lang.Object;" ?
14:21amalloyraek: probably
14:22amalloy&(aget ^"[Ljava.lang.Object;" (into-array Object [1]) 0)
14:22lazybot⇒ 1
14:22amalloy&(aget ^"[Ljava.lang.Object" (into-array Object [1]) 0)
14:22lazybot⇒ 1
14:22amalloy&(aget ^"[Ljava.lang.String" (into-array Object [1]) 0)
14:22lazybot⇒ 1
14:22amalloyhm
14:23amalloyif the hinting is working, at least one of those should fail, no?
14:23thorwiljamiltron: like http://paste.pocoo.org/show/492114/
14:24jamiltronThank you!
14:24thorwilnp
14:35jcrossley3what's the equivalent of (. "foo" contains "f") using apply?
14:35jcrossley3apply doesn't seem to like the dot operator as its fn
14:36amalloyyou answered your question right there: . isn't a function
14:36amalloyapply applies functions, therefore you can't apply .
14:37PPPaulis there anything in javascript similar to clojure's walk?
14:38SqueeseI wanted to learn something new, clojure and I had the book "Land of Lisp" avaliable but it's using Common Lisp, thinking.. lisp is lisp, right? I sure as hell hope Clojure is prettier than Common Lisp.. caddrd cddrrrd cdrrdr >P
14:38TimMcPPPaul: Does ClojureScript have walk? :-P
14:39SqueeseSo anyway, tips on book for Clojure, any tips? :)
14:39apage43_caddrd sounds like something out of watership down
14:39Squeesefunction named CAAAAR, CADAAR, CDDDDR.. really?
14:40PPPaulit does, and it's sexy
14:40PPPauli'm making half assed walks for some of my JS stuff
14:40TimMcSqueese: nth and get-in are better names, no?
14:41amalloySqueese: meh. when your primitive data structure is a pair, having a way to walk through pairs is important
14:41SqueeseDunno, refering to clojure? Im 1hour into my Lisp venture
14:41PPPaulhow well does clojurescript work with stuff like jQuery?
14:41TimMcca*d*r are there for ... what amalloy said
14:41Iceland_jackTimMc: the C*R were mainly thought of as arguments to higher-order functions
14:41amalloyc[ad]+r
14:41TimMcamalloy: Oh, right.
14:41amalloycause you know you love using CDDAAR
14:42TimMcc[ad]{1,4}r as far as I know
14:42amalloysound like a confused pirate
14:42amalloyTimMc: that's all that are guaranteed, yes
14:42TimMcSqueese: Clojure has actual data abstractions. Not everything is a cons cell.
14:43SqueeseTimMc: ok
14:43amalloyLet Over Lambda spends some time developing a (with-c*r ...) macro. inside the body of that it checks to see which c*rs you use, and defines any that don't already exist
14:44SqueeseI got curious of Lisp because I was told "its beutifly symmetric", CAADDR doesnt strike me as symmetric
14:44TimMcamalloy: Haha, nice.
14:44amalloySqueese: well, that's why you're here instead of in #lisp :P
14:45Squeesehaha
14:45amalloy&car
14:45lazybotjava.lang.Exception: Unable to resolve symbol: car in this context
14:45amalloy&first
14:45lazybot⇒ #<core$first clojure.core$first@1797e27>
14:46amalloycommon lisp has a lot of beauty too, but i prefer to admire it from afar
14:46Squeesehehe ^^
14:46TimMcSqueese: Be forewarned, Clojure has some pragmatic design decisions baked in that aren't entirely pure, beautiful, symmetric, or whatever. I don't disagree with them, though.
14:47TimMcIf you want purity over all else, Haskell is probably a good candidate.
14:47SqueeseDont disagree with the pragmatic decisions?
14:47TimMcright
14:47TimMcFor the most part. :-)
14:49chewbrancaSqueese: port land of lisp to clojure! fun times and not overly
14:49chewbranca difficult. gives you the benefit of reading land of lisp while
14:49chewbranca still using clojure
14:49amalloychewbranca: someone did that already though
14:49Squeesechewbranca: DING! thanks =)
14:49chewbrancaamalloy: didn't mean publish it, just to do it, he's looking for
14:49chewbranca a fun way to learn clojure
14:50amalloyi mean, i'm sure it's still a good exercise if you're interested. but don't do it because you think it's the only way to read it
14:50gfrederickschewbranca: you got something going on with line breaks there?
14:50amalloyerc word-wrap strikes again?
14:50chewbrancagfredericks: odd, so not just on my end? breaking at the edge of
14:50chewbranca the window
14:51chewbrancaamalloy: yeap :/
14:51amalloychewbranca: your multi-line messages are being sent as multi-lnie
14:51amalloy*line
14:51chewbrancaamalloy: ok wasn't sure, I'll keep lines short
14:51chewbrancawhile I look for a fix
14:51chewbrancaI take it erc word wrap like this has presented itself before?
14:52amalloyi've seen it before, yeah
14:52chewbrancaodd I haven't seen it before, just showed up after erc disconnected
15:12jamiltronIf I wanted to go about converting base10 to base62 in clojure, is there any way to do it better than something like this: https://gist.github.com/1285184
15:13amalloybase...62? why not the usual 64?
15:13amalloyalso, base10-base62 is a weird name. the number it's taking in isn't in base2, or indeed in any base
15:13jamiltronI want to use the translation in a url. Doesn't base64 include '/'
15:13amalloys/base2/base10
15:13lazybot<amalloy> also, base10-base62 is a weird name. the number it's taking in isn't in base10, or indeed in any base
15:13@chouserjamiltron: start with () instead of [] and you can skip the reverse at the end
15:14jamiltronRight
15:14@chouserjamiltron: use (pos? q) instaed of (>= 0 q)
15:14amalloychouser: those are different comparisons. not sure if it makes a difference here, but...
15:15amalloyjamiltron: you...want to use it in a url? why not just url-encode, then?
15:15chouseroh, indeed!
15:15chousersorry
15:15chouserjamiltron: I take back the pos? suggestion
15:17amalloyi'm not sure if my url-encoding suggestion makes sense, but eg going number->base64->urlencode seems less error-prone, because there are well-tested algorithms for both of those
15:17jamiltronI'm trying to go about building a url-shortener for web app practice.
15:20jamiltronI was just thinking base62 would be an easy way to go about that while keeping the extra libraries to a (relative) minimum.
15:22amalloyjamiltron: yeah, it's probably not an actual bad idea, i was just confused
15:23jamiltronI understand for a production app it would be silly to do, but for a quick throw-something together I think its easier to just do the conversion myself and not have to worry about encoding special characters.
15:24jamiltronThanks for the help
15:39MasseRDamn that clojurebot is starting to annoy me. Time to either ignore it or check whether I can prevent actions triggering highlight event
15:49amalloyMasseR: wait, what? what is he saying that's causing your client to highlight you?
15:49amalloyyou're not talking about the NOTICEs he's sending, are you? your client is supposed to treat those as low-importance, not high-importance
15:56thoeferimagine i start in namespace A, then call a func X in namespace B. Is it possible to def a var in X that can be used in ns A? It seems not, but maybe I´m missing something ...
15:57MasseRamalloy: Ah yeah, notices not actions, but irssi blings on every one of them
15:57amalloyMasseR: nuke irssi from orbit; that's a terrible behavior
15:58amalloythoefer: you could probably hack something together, but i doubt that you should
15:59thoeferthis implies yes - it´s possible?!
16:00zerokarmaleftMasseR: you can configure irssi to ignore NOTICES
16:01zerokarmalefte.g. /set beep_msg_level MSGS DCC DCCMSGS
16:03zerokarmaleftMasseR: you can include any of the levels specified here: http://irssi.org/documentation/settings#a_a
16:04jcromartieoh look it's what I'm building :) http://nathanmarz.com/blog/how-to-beat-the-cap-theorem.html
16:04jcromartie(in a very small capacity)
16:05jcromartieappending data and updating queries happen at the same time
16:55TimMcneat article
17:00amalloyyeah, thanks for the link
17:03Borkdudeanyone using twitter-api (the clojure project) here?
17:05ibdknox~anyone
17:05clojurebotPlease do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.
17:05ibdknoxhm
17:05ibdknoxthat sounds meaner than it should
17:05ibdknoxlol
17:07amalloyibdknox: yeah. draft a better message and replace it
17:07technomancyI just stole it wholesale from #emacs
17:07Borkdudelol
17:07ghiuis there any function that given a seq and a function, returns two seqs, one with the values that applied the function return true and the other with the false, like this? odd? (1 2 3 4 5) => (1 3 5) (2 4)?
17:08amalloy(juxt filter remove)
17:08ghiui can make one with a recursion, but i wanted to know if there is a built-in
17:08Borkdudeok I'm wondering why it asks for the monolithic contrib, I thought I didn't need it anymore in Clojure 1.3
17:08amalloyclojurebot: anyone is <reply> Why so vague? You know ibdknox is going to be the one to answer anyway.
17:08clojurebotAck. Ack.
17:08amalloythere. now you have a real motivation to fix it
17:09Borkdudeusing version 0.6.0 here of the project
17:09bhenryis it possible to view all namespaces on the classpath?
17:09manutteror anyone could fix it, eh?
17:09ibdknox:p
17:09ibdknoxlol
17:09bhenryjust a list of them?
17:09jamiltronMan amalloy I'm continuously amazed at how quick you can recall/think-up this stuff.
17:10jamiltronI can never remember to use juxt, especially when I need it.
17:10ibdknoxjamiltron, juxt is awesome
17:10ibdknox~juxt
17:10clojurebotjuxt is usually the right answer
17:10zerokarmaleft~amalloy
17:10clojurebotamalloy is <amalloy> just use juxt, it'll be great
17:10jamiltronHaha
17:10technomancybhenry: clojure.tools.namespaces I think
17:10zerokarmaleftthings to live by, apparently
17:10TimMcand for
17:10technomancyit's a separate project
17:11ibdknoxbhenry, just keep in mind it only works in relatively simple scenarios... i.e. not in a WAR
17:11bhenryi just have a jar i want to explore.
17:11bhenrythanks technomancy and ibdknox
17:11jamiltronI always put together way over-complicated recursions or destructuring scenerios and then come back to it like two months later and find all this work I did easily replaced by a single juxt.
17:11technomancybhenry: if you have Emacs you can just open the jar like a regular file and browse
17:12bhenrytechnomancy: even better. thanks
17:12ibdknoxyou can do that in VIM too :)
17:13zerokarmaleftBorkdude: clj-oauth hasn't been updated for 1.3
17:13amalloyjamiltron: in fairness, i've answered the filter/remove question a number of times
17:14jamiltronYou've probably answered me asking that same questions several times, in fact :P
17:14ibdknoxjamiltron, don't listen to him amalloy is a magical being able to always produce the correct, very succinct answer every time
17:14amalloyclojurebot: separate is in clojure.contrib.seq-utils, but just use (juxt filter remove) instead
17:14clojurebot'Sea, mhuise.
17:15bsod1clojure.contrib still has priority-map, right? I can't use clojure.contrib.priority-map, I'm getting this error: java.io.FileNotFoundException: Could not locate clojure/contrib/priority_map__init.class or clojure/contrib/priority_map.clj on classpath: (NO_SOURCE_FILE:0)
17:16amalloyoh, interesting. clojurebot doesn't like ?s in |is| messages
17:16amalloyhiredman: he didn't correctly soak up my instruction earlier: "anyone is <reply> Why so vague? You know ibdknox is going to be the one to answer anyway." instead he just learned to reply "Why so vague"
17:17ibdknoxhah
17:17ibdknoxI win. :D
17:17amalloyis that even a victory??
17:17lazybotamalloy: What are you, crazy? Of course not!
17:18ibdknoxlol
17:18ibdknoxIs amalloy trying to cheat to win???
17:18lazybotibdknox: How could that be wrong?
17:19bhenrywhat has to go in my dependencies in order to (use 'clojure.java.jdbc)? or is that from an outdated wiki?
17:19bsod1can anyone help me? I can't find priority-map in clojure.contrib
17:20ibdknoxbhenry, https://github.com/clojure/java.jdbc
17:20ibdknoxbhenry, tells you at the bottom
17:20ibdknoxyou'll also need a driver
17:20bhenryibdknox: just found that thanks
17:21ibdknoxwhich is specific to whatever db you want
17:21bhenryi have the driver. it was the jar i wanted to explore
17:23Borkdudezerokarmaleft: so I should include clojure.contrib?
17:26jamiltronbsod1: are you using 1.3?
17:26bsod1jamiltron: 1.2
17:27amalloyclojurebot: forget anyone |is| <reply> Why so vague
17:27clojurebotI forgot that anyone is <reply> Why so vague
17:28bsod1jamiltron: so, do you know where is priority-map?
17:31bsod1ok, I downloaded it from github and loaded..
17:32jamiltronbsod1: sorry, stepped away
17:32dnolenrhickey cites a pretty sick paper on the problems of mutability from 1981, http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.108.7810
17:32dnolenchoice quote
17:32dnolen"Update-in-place strikes many systems designers as a cardinal sin: it violates traditional accounting practices that have been observed for hundreds of years."
17:34hiredmansites where?
17:35dnolenhiredman: HN thread on nathanmarz CAP blog post
17:35hiredmaninteresting
17:38brehautdnolen: is there any mechanism in core.logic to store and index relations on disk rather than in memory?
17:39dnolenbrehaut: nope, and nothing planned. Though very interested in other folks ideas about that.
17:39mindbender1please how can I get a tree view with emacs
17:40dnolenmindbender1: of your files?
17:40mindbender1dnolen: yes
17:40mindbender1project files
17:40dnolenmindbender1: there's a couple things, speedbar is one
17:41dnolenmindbender1: might want to ask on emacs, I just use Dired
17:41brehautdnolen: it seems like it would be a really great alternative to something like sqlite
17:41mindbender1ok I'm on emacs already and getting response thanks
17:43dnolenbrehaut: yes, tho there some things missing (negation). it's not clear to me what needs to happen in core.logic to achieve datalog (guranteed termination) beyond tabling.
17:44dnolenbrehaut: I agree, tho, would be cool.
17:45amalloyugh. (update-in some-map [:key-to-ref] alter f) *looks* like it should work, in the same way that (alter some-ref update-in [:subkey] f) does, but because alter returns the value rather than the ref it doesn't
17:45hiredman(alter (:key a-map) f)
17:46amalloyhiredman: i needed to actually return the updated version of a-map from this function, so an update-in/alter chain felt natural
17:47duck1123srid: Are you running aleph behind Apache, by any chance?
17:47hiredmanbut, uh, it doesn't change the map
17:48hiredman,(let [m {:a (ref 1)} _ (dosync (alter m inc)) m2 m] (= m2 m))
17:48clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.Ref>
17:48hiredmanbleh
17:48amalloyhiredman: context is more like (-> m (assoc :foo :bar) (update-in [:key] alter f)), which is what i wished would work
17:48hiredman,(let [m {:a (ref 1)} _ (dosync (alter (:a m) inc)) m2 m] (= m2 m))
17:48clojurebottrue
17:48amalloyi understand why it doesn't, of course
17:49amalloyie, the alter doesn't change the map, but something else does
17:49technomancydo folks use swank.swank/-main much?
17:49hiredmanyes
17:49hiredmanclojurebot does, so does sunyata
17:50amalloytechnomancy: what does it do?
17:50technomancyamalloy: just starts a server
17:50hiredmanoh foo
17:50hiredmanI take that back, I use start-repl
17:50technomancyI'm fixing a bug where it doesn't let you customize the host it listens on
17:51technomancybriefly considered changing its arglist, but I think that's a bad idea
17:51arohneranyone have experience using clojure + rails on jruby?
17:52technomancyarohner: no, but I saw this: http://yokolet.blogspot.com/2011/09/haml-on-clojure-web-app.html
17:52technomancyI guess that's not actually rails
17:54arohneribdknox: I know. not my preferred solution either
17:54technomancy,(re-find #"\w" "ö")
17:54clojurebotnil
17:54ibdknoxhuh
17:55technomancyis \w specifically ASCII word constituents?
17:55ibdknoxI didn't know that
17:55TimMcew
18:03brehaut,user=> (re-find #"\p{L}" "ö")
18:03clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: user=> in this context, compiling:(NO_SOURCE_PATH:0)>
18:03brehaut,(re-find #"\p{L}" "ö")
18:03clojurebot"ö"
18:03brehautthose pattern incantations get crazy fast
18:04ipostelnikibdknox, in noir, is there a way for a defpartial to get access to the current request, specifically the uri?
18:04ibdknoxipostelnik, in 1.2.0 yes, though what's the use case? :)
18:05amalloyibdknox: i dunno what this defpartial is but given the number of people who ask this exact question maybe there's some doc somewhere that needs to be updated?
18:05ipostelnikibdknox, I have a partial that renders a menu, I'd like to render the current item specially. I could have everyone pass the current in or have it figure out automatically
18:07ibdknoxamalloy, usually it's defpage :p
18:07ibdknoxipostelnik, look at the noir.request namespace
18:08ipostelnikyeah , amalloy shamed me into scouring the docs :)
18:21brehauthow do i get slime to interupt the currently executing expression in the repl?
18:31duck1123C-c C-c
18:32brehautthanks
18:32amalloyi love that command, because it's so natural. "ack holy shit stop" and you start pounding on C-c by shell-reflex
18:33duck1123That's what I do in the terminal. C-c till it's all better
18:49ghiu,(-> 1 (partial and 1))
18:49clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0)>
18:50ghiucan anyone explain the problem and how to fix it?
18:50dnolenghiu: and is not a function
18:51ghiuit is a macro
18:51dnolenghiu: thus you can't pass it around as an argument
18:51ghiuhow to express the same ?
18:51brehautim pretty happy with my answer to 4clojure 65
18:52amalloy&(->> 1 (and 1))?
18:52lazybot⇒ 1
18:53amalloybrehaut: if i'd thought of it soon enough i would have disallowed empty, too
18:53brehauthaha
18:53ghiuwhat is the & sign?
18:55brehautamalloy: has that been the go to trick for a bunch of people?
18:55amalloybrehaut: have you looked at any of the solutions?
18:55brehautnot yet
18:55amalloythe super-hacky ones are to condp on the first character of (str x)
18:56brehauthaha oh man
18:56brehauthow do i see other people solutions if im not following them?
18:56amalloybrehaut: you gotsta follow them
18:56brehautok
18:56amalloy&(map #({\# :set \[ :vector \{ :map \( :list \c :list} (first (str %)) [{} #{} [] ()])
18:56lazybotjava.lang.Exception: EOF while reading
18:57brehauthaha oh man
18:57brehautsuddently i dont feel like my solution was that sneaky
18:57amalloy&(map #({\# :set \[ :vector \{ :map \( :list \c :list} (first (str %))) [{} #{} [] ()])
18:57lazybot⇒ (:map :set :vector :list)
18:57amalloy\c is the one that makes me laugh
18:58amalloybecause of ##(str (range 5))
18:58lazybot⇒ "clojure.lang.LazySeq@1b554e1"
18:58brehauthaha
18:58brehautwho came up with this ?
18:58amalloybrehaut: i think youz was first
18:58brehautamalloy: i mean the string sneak
18:58amalloyhe's always got the craziest, shortest solutions. follow him for endless laughs
18:59amalloyyeah, i meant him
18:59brehautoh right
18:59brehautwill do
19:00brehauthis solution to #63 just broke my brain
19:02brehauti dont think i would ever have thought to use syntax quotes outside of a macro
19:03amalloyyep, that's a trick i learned from 4clojure and have used a few times outside now
19:03brehautanyone else got particular clever solutions worth following?
19:04amalloynobody else stands out like youz, but i follow a couple dozen people. most of the contributors, the top 10, and people i know from irc
19:06amalloywow, #65 is labeled Hard? the difficulty of the site has gone up since then
19:07brehauti think #53 is the one that has caused me the most consternation so far. im sure theres a better solution than mine
19:13gfredericks65 is weird...
19:17brehautamalloy: is clojure.set available in 4clojure?
19:17amalloyshould be
19:17amalloybut also, just try it?
19:26rascionare you supposed to escape-html stuff before you put it in your db, or after you take it out of the db before you display it to the user?
19:27gfredericksrails does the latter, which makes sense to me
19:27gfredericksthat way you always have the original if you want it for some reason. On the other hand, maybe that could be considered riskier.
19:28amalloyi think you're supposed to do whatever you want, provided it doesn't cause problems. the latter makes more sense to me
19:29TimMcrascion: Never encode for html before putting in a DB!
19:29TimMcIt's a terrible idea that will bite you in the ass.
19:29gfredericksalso if you like premature optimization you'll prefer encoding beforehand
19:29TimMcgfredericks: Probably.
19:30gfrederickssince then you only have to do it once!
19:30gfredericksit's obviously a good idea!
19:30TimMcgfredericks: And then undo it later once you find out why it's wrong.
19:30gfredericksyeah, because you always write inverses for all your functions, right?
19:30gfredericksthat's right up there with basic TDD
19:30amalloyTimMc: it's not really invertible anyway, right?
19:31TimMcrascion: Only encode when you need to. Embedding in HTML? Encode for HTML. Embedding in SQL? ENcode for SQL.
19:31TimMcamalloy: Maybe?
19:31amalloyhm. i think that what i just said is probably nonsense
19:31gfredericksshouldn't be -- what if the user inputs sanitize(s)?
19:32TimMcgfredericks: For example?
19:32gfredericksso your function does f("<p>") => "&lt;p&gt;", right?
19:32amalloygfredericks: then you escape it another level, and on unescaping get back their original input
19:32TimMc"Sanitize" is ambiguous. There is validation and there is encoding.
19:33gfredericksoh right, I forgot you'd escape the '&' too
19:33gfredericksnevermind, I believe it's invertible
19:33TimMcYou can make it invertible.
19:34rascionis there some kind of escaping necessary with congomongo before putting data from user in mongodb?
19:34TimMcrascion: I worked at Crutchfield, and a third-party product did encode-before-store. The result was that searching for "amp" (amplifier) returned &amp; all over the place.
19:35gfredericksTimMc: so the search-result size was amplified?
19:35TimMc:-)
19:36brehautall these mathy 4clojure problems are going to kick my arse
19:37TimMcrascion: I'm not familiar with mongo, but it will have some sort of injection-prevention feature you should familiarize yourself with.
19:37TimMcrascion: SQL RDBMSs use prepared statements and such; Mongo will have something equivalent, possibly not even requiring any effort on your part.
19:39TimMcgfredericks: I'm going to steal that.
19:40amalloyrascion, TimMc: i don't think mongo needs any kind of escaping
19:40mattmitchellhow do i check if a var has been bound?
19:40TimMcamalloy: No query-building?
19:40amalloybound?
19:40sridduck1123: no, i'm running aleph using netty.
19:40amalloyTimMc: no
19:40TimMcnice
19:40TimMcI guess
19:41amalloyTimMc: i mean, obviously you have to write queries somehow. but they're structured data structures, not strings
19:41TimMcgfredericks: Maybe I should write a rant like the StackOverflow "regexps can't parse HTML" one, descending into a mess of &&amp;;
19:41TimMc&amp;amp; I mean
19:41lazybotjava.lang.Exception: Unable to resolve symbol: amp in this context
19:41gfredericksTimMc: lol
19:41amalloya typical call looks like (update! :users {:username "amalloy"} {:$set {:skills ["juxt"]}})
19:41amalloyalso that SO post is epic
19:41TimMcSweet.
19:42gfredericksI only saw it just recently
19:42gfredericksis that a coincidence?
19:42gfredericksI can't remember why I saw it
19:42amalloyprobably. i saw it ~5mo ago
19:42TimMcgfredericks: I revisit it about twice a year, I think.
19:42gfredericksoh yes it is. was a link on cs-theory stack-exchange
19:43TimMcIt's also a little unfair -- you *can* use regexes to parse HTML, just not in a single call. You have to iterate and keep a stack.
19:43gfrederickshmm.
19:43gfrederickswithout backtracking?
19:44TimMcDepends how fancy you want to get.
19:44mattmitchellamalloy: thanks, i forgot i needed to do #'my-var and not just my-var
19:44gfredericksI guess it ought to be no trickier than parsing matching parens
19:46TimMcgfredericks: Example in JS: http://lab.brainonfire.net/markup-sanitizer/demo.html
19:47TimMc(I really should put some non-copyrighted Lorem Ipsum in there.)
19:47rascionin compojure how do you wrap only a subset of routes with a piece of middleware?
19:48gfredericksTimMc: wait are we talking about 'regular expressions' or regexes? former being the strict cs-theory type
19:49brehautgfredericks: the things in perl are irregular expressions
19:49gfrederickssomebody tell chomsky!
19:50TimMcgfredericks: Regular expressions. I'm only matching tags, not pairs.
19:50TimMcThe SO rant is (IIRC) in response to someone wanting to build a regex that could match a pair at a time.
19:52gfredericksah ha. I guess what you're really doing is using the regular expression as a tagger and then writing the parser yourself
20:09hiredman′ is what you want
20:09hiredmanunicode prime mark
20:09gfredericksfront-tick? :)
20:09hiredmanprime
20:10hiredmanhttp://en.wikipedia.org/wiki/Prime_%28symbol%29
20:10gfredericksyou're quite a fan of unicode aren't you?
20:11hiredman
20:11gfrederickshiredman: do you use non-ascii in serious code?
20:12TimMcI � Unicode
20:12hiredmanI have used ′ in code at work
20:12hiredmantechnomancy may have added an interrobang somewhere
20:12technomancyit's perfect for destructive predicates!
20:13hiredmanfor a mutating predicate
20:13TimMcI used alpha, beta, and gamma in a Clojure HW assignment once.
20:13technomancyI am also known to use the venerable page break character, though that's actually in ascii.
20:13hiredmanbut I don't think my ′ survived very long
20:13gfredericksyou're all horrible people
20:14hiredmanof the best sort
20:14technomancypage breaks are unanimously treated as whitespace!
20:14gfredericks:)
20:14technomancyI did also run into a clojure bug where the non-breaking space wasn't being treated as whitespace
20:14amalloyrascion: (routes foo bar (-> (routes baz bang) (wrap-whatever)))
20:14technomancyand it got closed as WONTFIX; can you believe the nerve?
20:14duck1123especially if you define two different functions that look the same like that
20:14hiredmanthe meaning of prime is taylor made for computing with values
20:15gfrederickstechnomancy: why would you ever need anything besides the comma?
20:15hiredmantailor
20:15technomancygfredericks: it's actually a terrifying story
20:15technomancygfredericks: I was attempting to start a swank server via wine
20:15technomancyand wine wouldn't let me escape things properly
20:15technomancyI needed something like clojure.main -e "(foo.bar/-main abc)"
20:16technomancybut the quotes got swallowed by wine and no amount of escaping would make them propagate to the JVM
20:16gfrederickstechnomancy: the first line of your story sounds like a reasonable rule of thumb for when to stop drinking
20:16rascionamalloy: do you know if you can just wrap-foo a specific route? like (defroutes app (wrap-something (GET "/blah"...)) (GET ....))
20:16technomancyso I tried clojure.main -e (foo.bar/-main abc)
20:17technomancyso the shell treated everything after -e as a single token
20:17technomancyproblem solved
20:17technomancyexcept clojure didn't honor the non-breaking space!
20:17technomancyFISSION MAILED
20:17gfredericksand it doesn't work with a comma?
20:18technomancywait a minute
20:18technomancythat actually makes tons of sense
20:18pandeirois select-keys supposed to exclude keys whose value is false? in clojure it includes them, in clojurescript it excludes
20:18technomancywhy didn't I just do that?
20:18gfrederickstechnomancy: story woulda been boringer?
20:19technomancygfredericks: that's right; it wouldn't have resulted in this epic bug report: http://dev.clojure.org/jira/browse/CLJ-419
20:19technomancydang. a comma. of course.
20:19duck1123now it has a punchline
20:20amalloyrascion: that probably works, but trying it would be easier than asking me
20:20gfredericksthe man got up and walked away, leaving my unopened bag of cookies on the table.
20:21gfredericks:)
20:23amalloypandeiro: seems like it should include keys whose value is false *or* nil
20:23amalloy&(select-keys {:x nil, nil :y} [:x nil])
20:23lazybot⇒ {nil :y, :x nil}
20:23gfredericksI would assume select-keys wouldn't consider values at all
20:24hiredmanshould have used contains?
20:24gfredericksexactly
20:24pandeiroamalloy: it seems to exclude keys that have false values in ClojureScript
20:25hiredmaninteresting, uses RT/find
20:25amalloyhiredman: probably more like get w/not-found, or find
20:26hiredman(doc find)
20:26clojurebot"([map key]); Returns the map entry for key, or nil if key not present."
20:26amalloy&(map #(find {:x nil} %) [:x :y])
20:26lazybot⇒ ([:x nil] nil)
20:28amalloy&((fn select-keys [m ks] (->> ks (map #(find m %)) (filter identity) (into {}))) {:x nil :y 5} [:x])
20:28lazybot⇒ {:x nil}
20:30hiredmanis filter required there?
20:30amalloy&((fn select-keys [m ks] (->> ks (map #(find m %)) (into {}))) {:x nil :y 5} [:x])
20:30lazybot⇒ {:x nil}
20:30hiredman,(into {} [nil])
20:30amalloyapparently not
20:30clojurebot{}
20:33st3fanhey i grabbed the latest clojure mode but i am getting a lot of errors and beeping inside emacs now .. http://pastebin.com/8DvEuT4Z
20:33st3fanhas anyone seen that before?
20:55technomancyst3fan: you probably have two versions of slime installed?
20:59gfredericksdang vim doesn't color :R' correctly :/
21:00gfredericksnor with prime
21:00TimMcW00t! I'm on the /contributing list!
21:00TimMcredinger: Thanks!
21:02st3fanhmm two versions of slime .. let me check
21:03st3fantechnomancy: no but i might have an old version of slime, i'll try to update it
21:03technomancyst3fan: you should be able to remove any slime you have installed and use M-x clojure-jack-in; see the swank readme
21:03lazybotjava.lang.Exception: EOF while reading
21:03st3fanok
21:05st3fanoh i had a slime in .emacs.d
21:05st3fanwhere did that come from
21:05st3fanyay this is much better
21:07st3fanhow do i turn a keyword :foo into a string "foo" ?
21:08st3fanah! name :)
21:09st3fan&(name :foo)
21:09lazybot⇒ "foo"
21:10aperiodichi all, i'm having some trouble using gen-class. specifically, i'm trying to generate multiple classes in the same source file, but only the class file for the main class (which has :main true and shares its name with the name of the namespace) shows up after compilation
21:13amalloy$findfn :foo "foo" ; st3fan
21:13lazybot[clojure.core/name clojure.contrib.string/as-str]
21:21gfredericksaperiodic: you're using the fully qualified class names in the :name arg?
21:21aperiodicgfredericks: yes
21:23gfredericksaperiodic: and you're doing this with the gen-class macro rather than the (:gen-class) expression in the (ns) macro?
21:23aperiodicgfredericks: also yes
21:23gfredericksaperiodic: then I have no idea.
21:24gfredericksaperiodic: I don't think gen-class gets used a lot. I've been using it lately though. Just not with multiple classes in a single file.
21:24aperiodicgfredericks: that's the answer i was fearing
21:24TimMcIs that even supported?
21:24gfredericksTimMc: it's in the docs
21:25TimMcOK
21:25gfredericksaperiodic: I don't mean that it's probably broken, I just mean that help with gen-class is scarse, in my experience
21:25gfredericksat least in #clojure
21:27aperiodicit's kinda the seedy underbelly of clojure :)
21:27gfredericksaperiodic: doing sticky interop?
21:28aperiodicgfredericks: yup, with hbase and hadoop
21:28gfredericksaperiodic: I did get some weird behavior with "lein compile", where I started running clean first just to make sure I knew what was coming out.
21:29gfredericksI was seeing one class compiled and not the other, but after cleaning realized actually none of them were
21:29aperiodici thought lein might be interfering with it as well, so i tried compiling with the repl, with the same result
21:30gfredericksaperiodic: you know about the *compile-files* var, right?
21:30aperiodicand i've been compulsively rm -rf-ing the classes dir
21:30aperiodicno
21:30gfredericksI guess it's kind of explained in the docs
21:30gfredericksthe "when not compiling does nothing" part
21:31gfredericksbut I think you can simulate compiling with (binding [*compile-files* true] (gen-class ...)), if that helps for some reason
21:31gfredericks(e.g., when testing at the repl)
21:32aperiodicthat's the special var that controls whether or not "compile mode" is on?
21:32gfrederickswell it controls whether or not gen-class does anything at least
21:32gfredericksgen-class is implemented as (when *compile-files* ...)
21:33aperiodicalright, i'll try messing around with that in the repl to see if i can replicate it there
21:34aperiodicmight as well make a minimal test case too
21:34gfredericksyeah. don't the gen-class docs give an explicit example of two classes? Or maybe that was a blog...
21:35gfrederickseither way, if you can find that, I'd start there and see if that works.
21:35aperiodicyeah, they do
21:36aperiodicit's at http://clojure.org/compilation, FYI
21:36gfredericksah ha
21:38jcromartiewow, for $3K I can get 12 cores and 24 GB of RAM
21:39jcromartiethat would make quite a beastly Clojure-leveraging application server
21:39gfredericksthat's more ram than my server has disk
21:49aperiodicwell, the example from the docs works
21:49aperiodichuh
21:50gfrederickstime to bisect
21:58gfredericksaperiodic: will be interested to hear what it ends up being
22:00aperiodicgfredericks: my own incompetence! an error in the macro i was using to generate the gen-class macro form
22:01gfrederickssilly macros
22:02aperiodicsomehow the string i was using for the name came out of the macro \o \n \e \b \y \o \n \e
22:02gfredericks:)
22:03aperiodicwell, good to know that lein/clojure work as advertised, sorry to cast aspersions on them
22:03aperiodicthanks for the help, gfredericks!
22:04gfredericksaperiodic: np
22:04jcromartieaperiodic: ah yes, anything that converts a string to a seq
22:04jcromartie,(seq "asdf")
22:04clojurebot(\a \s \d \f)
22:04gfredericksjcromartie: I prefer ##(seq "aoeu")
22:04lazybot⇒ (\a \o \e \u)
22:05jcromartiedvorak weenie
22:06jcromartie:P
22:06gfredericks:P :P :P
22:06aperiodici was generating the name based off of the namespace name by invoking another fn in the macro
22:06aperiodicmust confess that i haven't quite grokked macros
22:07aperiodicjcromartie: on my second week using dvorak! still rather inaccurate
22:08gfredericksnever look back
22:08jcromartieaperiodic: I find it best to keep macros "lightweight"
22:09gfredericksaperiodic: yeah, what jcromartie said. Outsource the work to regular functions.
22:09jcromartieyes that's the key
22:09jcromartiewrite functions to compile your code
22:09jcromartie"compile", I should say
22:09jcromartiebut yeah, pretty much :P
22:10jcromartiecongratulations you're a compiler writer now
22:12aperiodicthis seemed pretty lightweight, just sticking a name into a syntax-quoted gen-class construct... i think the issue was that i didn't understand the distinction between unquoting and unquote-splicing
22:13aperiodici see how the string came out as a seq now :)
22:16aperiodicis unquote splicing just a mechanims for sticking exprs that evaluate to sequences inside of other sequences without having to do inconvenient things like concat them?
22:16gfredericksI think so.
22:17gfredericksaperiodic: handy tip: you can play with the quotes at the repl without writing macros
22:17gfredericks,`(foo ~@(range 5) bar)
22:17clojurebot(sandbox/foo 0 1 2 3 ...)
22:18aperiodicoh, nurr
22:18aperiodicthanks
22:18gfredericksyep
22:19ibdknox_that's not entirely true
22:20ibdknox_it lets you do some things that you can't do with apply
22:20ibdknox_like call a macro with by unpacking the vars
22:20aperiodiccould you give some examples?
22:20ibdknox_-with
22:21aperiodicwhat do you mean by "unpacking"?
22:21amalloyibdknox_: i'm not sure what point you're making but i think you're wrong
22:22ibdknox_amalloy: I can't (apply some-macro ..)
22:23ibdknox_but I could do `(some-macro ~@(range 0 2))
22:23amalloyibdknox_: his question was whether ~@ is a convenient way to avoid writing concat, not apply
22:23amalloywhich is true
22:23ibdknox_ah
22:23dnolenamalloy: is it possible to see other solutions to 4clojure 130?
22:23ibdknox_I misread
22:23amalloydnolen: yeah, if you've solved it you can see solutions of any users you follow
22:24aperiodicoops, stupid qwerty reflexes
22:24gfredericksibdknox_: for your example, don't you have to have the seq at compile-time?
22:24dnolenamalloy: I have no interest in solving, only comparing the kotarak's core.logic version to other solutions.
22:24amalloyheh
22:24amalloyi'll go steal them for you, then
22:24dnolenamalloy: thx
22:25gfredericksI think I just witness dnolen hacking into 4clojure and stealing consumer data
22:25dnolenhaha
22:26aperiodicibdknox_: could you list your example regarding ~@ again?
22:26aperiodici accidentally parted right after you posted it
22:27amalloy~search for ~@
22:27clojurebot#<Exception java.lang.Exception: 500>
22:27amalloyhiredman: ^?
22:31amalloyaperiodic: https://gist.github.com/32a3730c04fcee671ab1
22:31aperiodicgrazie
22:45ThreeCupsI've got a string that I'm trying to put quotes around. I've done this: (str "\"" my-str "\""). Is there a better way to do this?
22:46dnolenof course the fun part about kotarak's solution (white longer) is that we can go from the solution and infer the node and the original tree :D
22:46dnolens/white/while
22:46lazybot<dnolen> of course the fun part about kotarak's solution (while longer) is that we can go from the solution and infer the node and the original tree :D
22:46amalloyThreeCups: it seems unlikely that what you actually want to do is put quotes around a string
22:46dnolenwill have to see if we can make it shorter later ...
22:46amalloymore likely you want to take a string that you have, and embed it in some other string, like ##(pr-str "test")
22:46lazybot⇒ "\"test\""
22:47amalloyin which case if the original string already has a quote inside it, your version has an "injection" issue, while pr-str doesn't: ##(pr-str "this is kinda \"cool\"")
22:47lazybot⇒ "\"this is kinda \\\"cool\\\"\""
22:48ThreeCupsamalloy: I hear you... I know there are no quotes inside it. But there prolly is a better way to go about this
22:48ThreeCupsThis is my first clojure code, so I've got a lot that I'm trying to figure out
22:49amalloyThreeCups: pr-str is the simplest, shortest, and safest solution. there doesn't seem to be much point to go looking for something more complicated because pr-str provides features you don't need :P
22:50ThreeCupsamalloy: sounds good. right now I'm just trying to get familiar with what's available in the std lib. FWIW, I'm using the clojure-contrib.json stuff and I need to quote a date string
22:52BruceBGordonnewbie alert: I tried to install Clojure following the directions at http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
22:53brehautBruceBGordon: http://dev.clojure.org/display/doc/Getting+Started+for+Beginners
22:53BruceBGordon...running ant to build clojure use sun jdk the build fails because clojure.test-clojure.java.io fails
22:53ThreeCupsVery beginner question: I'm on linux. I write my code in vim. I'm building using leiningen. I'm using compojure (and ring). So I ran
22:53ThreeCups$ lein ring server
22:53brehautgithub.com/technomancy/leiningen
22:53ThreeCupsand I've got my browser up and running. Now I need to debug some code. How do I go about this? Logging? Debugger? print to the output stream?
22:54brehautBruceBGordon: go get lein from github and flag installing clojure from source
22:54jcromartieThreeCups: the REPL and println are your friend
22:55brehautBruceBGordon: the leiningen readme tells you how to install it
22:55jcromartieyou should be able to test anything your web app does from the REPL
22:55jcromartiei.e. pass requests to routes
22:55brehauti second jcromartie's comments
22:55BruceBGordonok, will abandon http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
22:56ThreeCupsjcromartie: Thanks! so $lein repl?
22:56BruceBGordonFor my information, does "git://github.com/clojure/clojure.git" get the equivalent of "head"
22:58amalloyBruceBGordon: it gets everything
22:58jcromartieThreeCups: yes, from your project directory
22:58BruceBGordonand then the ant task will build what? the latest?
22:59amalloyBruceBGordon: brehaut's suggestion, to not build clojure, is a good one in almost all cases
22:59Apage43mrm, on clojure 1.3 now. The one thing I used from old-contrib pretty much all the time was clojure.contrib.json. What's the favorite json parser right now?
23:00BruceBGordonk, I'm following http://dev.clojure.org/display/doc/Getting+Started+for+Beginners
23:00jkkramer~cheshire
23:00clojurebothttps://github.com/dakrone/cheshire
23:00jkkramerApage43: ^
23:00Apage43heck yeah
23:01brehautBruceBGordon: clojure differs from a lot of languages in that the compiler etc is treated more like a service, and other tools – such as leiningen – provide the enviroment (project managment, repls, etc) that you interact with.
23:01amalloyBruceBGordon: looks like a good guide. afaict it's not telling you to build anything, right?
23:01brehautBruceBGordon: in particular its quite uncommon to have a system wide clojure installation
23:01brehautamalloy: the prior link BruceBGordon was following had pages of crap to build
23:05BruceBGordonamalloy: re good guide, are you talking about http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
23:05amalloyno, definitely not
23:05BruceBGordon:-), k
23:06brehautthere are far too many guides in the wild with no version numbers or datestamps
23:06brehaut(as well as completely crazy instructions)
23:07ibdknox_brehaut: something I'll complain about at the conj
23:08brehautibdknox_: problem is, the people at the conj are going to be the sort of people who a) produce non-lunatic docs b) know how to either get them in a central place or keep them up to date themselves
23:09jcromartiebrehaut: true that
23:09ibdknox_I was thinking more of coming up with a canonical solution to the problem
23:10ibdknox_as in clojure.org is pretty :)
23:10jcromartiebrehaut: I'd say most Clojure writing on the web is obsolete
23:10ibdknox_and gets you going very quickly
23:10brehautjcromartie: i think you are right
23:10ibdknox_I find that weird
23:10jcromartieclojure.org reads very nicely
23:10jcromartieyou can go read it in order and get a nice terse overview
23:10ibdknox_hm
23:11ibdknox_jcromartie: the front page doesn't have a single line of Clojure on it
23:11brehauti personally found clojure.org really helpful, but i know people who found it impenatrable
23:11jcromartieno, but if you start going down the left-hand list of topics, it's great
23:11jcromartieif you can read, that is :)
23:11ibdknox_lol
23:11jcromartiemany people just don't have the patience to read something from the beginning
23:11ibdknox_I think it can be improved immensely :)
23:12jcromartieof course a "Hello, World!" would be great on the front page
23:12jcromartiebut it's really so trivial that it's not worth it
23:12ibdknox_I disagree
23:12ibdknox_let's say your friend goes "hey check out this Clojure thing"
23:12ibdknox_and the first thing you do is go to clojure.org
23:13ibdknox_tons of text
23:13ibdknox_it looks academic
23:13jcromartieit is
23:13jcromartieyes
23:13ibdknox_no obvious getting started path
23:13ibdknox_compare that to: http://www.ruby-lang.org/en/
23:13aperiodicclojure.org has been invaluable to me, especially all those topics along the lhs
23:13jcromartieso
23:13jcromartie"Clojure is..."
23:14aperiodicbut then again, i have a lot of patience for reading
23:14jcromartieyeah
23:14ibdknox_aperiodic: there's no doubt that there's great content there
23:14brehautaperiodic: what sort of background do you have?
23:14ibdknox_aperiodic: it just needs to be presented in a slightly better way :)
23:14brehaut(aperiodic: programming / learning experience)
23:15ibdknox_I suspect the people using clojure at this point are also the more patient (and/or gung ho') types anyways
23:15brehautibdknox_: i agree
23:15ibdknox_but we should try to break that barrier at some point :)
23:15jcromartiethe Ruby front-page code is not the best way to show off a language though
23:15ibdknox_and at the end of the day it helps those types too
23:16ibdknox_jcromartie: don't get me wrong, I don't like ruby's page either
23:16brehauti think the blub paradox is a good argument against code on teh front page
23:16ibdknox_brehaut: you need to anchor people, even if they can't understand it at first
23:16aperiodici started out programming in actionscript (don't laugh), but i really cut my teeth on processing. then i mainly programmed in c or obj-c, with a little bit of ruby
23:17jcromartieI'd like to see some snippet of code involving an agent or something.
23:17jcromartieor pmap
23:17scottjI think the clojure website design is the way it is bc it came from before there were any books on clojure so it filled that gap and also before there was much of a community so it didn't have to play a portal role. I personally still like it though
23:18aperiodici was exposed to scheme in a pl course, but didn't use it after that; clojure is the first lisp i've really gotten into
23:18aperiodicoh, i also did a lot of fooling around with haskell, but nothing too serious
23:19brehautaperiodic: given all that, im not surprised you found the clojure.org site useful
23:19aperiodicbrehaut: why do you say that?
23:20brehautaperiodic: because the content favors people who have a broad programming experience
23:21aperiodicyeah, they do kind of assume that you know what to expect in a language
23:22jcromartienot many noobs come to Clojure
23:22jcromartieor Lisp of any kind
23:22jcromartieexcept 3rd graders in Logo :P
23:22jcromartie20 years ago
23:22brehautclojure solves problems that noobs dont really know they have ;)
23:22jcromartieyeah
23:22jcromartiehah
23:22aperiodichaha
23:24ibdknox_I'm actually very curious to try teaching programming from scratch with Clojure
23:24jcromartiemy brother just started working in finance, and has inherited some gnarly C++ mess, where (SURPRISE, SURPRISE!) concurrency and mutable state are causing all sorts of headaches
23:25jcromartieibdknox_: I think it's actually pretty hard, because a lot of the Java underpinnings show through
23:26ibdknox_jcromartie: I don't know that I believe that. When you first start, interacting with the host is largely unimportant
23:26ibdknox_assuming it's instructor lead
23:26jcromartieibdknox_: until you want to upper-case a string
23:26ibdknox_,(use 'clojure.string)
23:26clojurebotWARNING: replace already refers to: #'clojure.core/replace in namespace: sandbox, being replaced by: #'clojure.string/replace
23:26jcromartieor catch an exception?
23:26clojurebotWARNING: reverse already refers to: #'clojure.core/reverse in namespace: sandbox, being replaced by: #'clojure.string/reverse
23:26clojurebotnil
23:26ibdknox_,(upper-case "woohoo")
23:26clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox>
23:26jcromartie:) I got it
23:27brehauti think someone broke the bot :P
23:27ibdknox_whoops
23:27ibdknox_lol
23:27brehaut,1
23:27clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox>
23:27ibdknox_haha
23:27ibdknox_,(+ 1 2)
23:27clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox>
23:27ibdknox_:(
23:27ibdknox_hiredman: I killed clojurebot
23:27jcromartieYOU BROKE HIM
23:27amalloyhaha again? wasn't it ibdknox last time too?
23:28ibdknox_no
23:28amalloy&(+ 1 2)
23:28lazybot⇒ 3
23:28ibdknox_I did no such thing
23:28jcromartiehow many bots are there?
23:28amalloylazybot: see if you can impress them
23:28jcromartieclojurebot, lazybot, sexpbot
23:28clojurebotsexpbot is not a clojurebot
23:28amalloyjcromartie: sexpbot is dead, long live lazybot
23:28ibdknox_&(require 'clojure.string)
23:28lazybot⇒ nil
23:28ibdknox_&(clojure.string/upper-case "hey")
23:28lazybot⇒ "HEY"
23:28ibdknox_in any case
23:29ibdknox_I think you can actually get quite far learning "programming" without ever running into the java bits
23:29ibdknox_what's also interesting, is teaching the java-bits in the context of clojure to being with
23:29jcromartieibdknox_: probably pretty far
23:29jcromartieibdknox_: and Java is probably easy after Clojure :)
23:29ibdknox_hehe
23:30amalloyjcromartie: that's a brave assertion
23:30ibdknox_I actually think Clojure is simpler than Java
23:30amalloy"Argh I just want to map over this stupid array, why do I have to write another freaking for loop?"
23:30jcromartieheh
23:30ibdknox_the problem is you had to unlearn a bunch
23:30jcrossley3is it possible to catch multiple exception types in a single catch clause?
23:30jcromartiethat's true
23:30ibdknox_but if you started from there...
23:30amalloyjcrossley3: no, but you can catch a common parent if they have one
23:30jcromartiejcrossley3: only with a shared superclass
23:31aperiodic"why do i have to spend half my time casting things?"
23:31jcromartieand with one fell swoop, jcrossley3 demonstrates how easily Java concepts bleed through :)
23:31jcrossley3heh
23:31ibdknox_jcromartie: you wouldn't even know what an exception is :p
23:31ibdknox_but yeah
23:31jcromartieibdknox_: until you did (/ 1 0)
23:32jcromartie&(/ 1 0)
23:32lazybotjava.lang.ArithmeticException: Divide by zero
23:32ibdknox_but again, you'd understand it as a Clojure concept
23:32ibdknox_I produced an error
23:32ibdknox_not as some class that follows some crazy hierarchy
23:32jcromartie&(int nil)
23:32lazybotjava.lang.NullPointerException
23:33jcromartie&(int "asdf")
23:33lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character
23:33ibdknox_lol
23:33jcromartieOH GOD WHAT IS THAT'
23:33jcrossley3i need to react the same way for both javax.naming.NameNotFoundException and javax.jms.JMSException. seems verbose. thought there might be some clever destructuring trick.
23:33jcromartie'says the n00b
23:33ibdknox_no different than if they did the same thing in *any* language
23:33jcromartiejcrossley3: you can nest try/catches and re-throw
23:34jcromartieor... if you're feeling really brave, write a multi-exception try/catch macro
23:34amalloyyou don't need a macro *really*
23:34jcromartie(multi-try ... (catch [javax.naming.NameNotFoundException javax.jms.JMSException] e ...))
23:35jcromartiesounds wrong though
23:35amalloy(let [handle (fn [e] (...deal with it...))] (try (...) (catch SomeException e (handle e)) (catch OtherException e (handle e))))
23:35amalloyyou're repeating more than you'd have to if you had a macro, but functions get you most of the way there
23:36jcrossley3amalloy: that's the direction i was headed. just wanted to make sure i wasn't missing something. thanks!
23:38jcromartiepffft, sissy... you don't want to make a recursive try-catch-generating macro?
23:38jcromartie:)
23:39amalloyhuh? it's not hard, it's just silly
23:40jcromartieyes
23:41ibdknox_amalloy is a no-nonsense kind of guy
23:44dnolenibdknox: not only is Clojure simple, I think there's good argument that it's simpler then many, many languages. ClojureScript's compiler is ~1K LOC! CLJS ~3K LOC.
23:45ibdknox_dnolen: I agree.
23:45dnolenit's shameful to say, but core.match is bigger than the CLJS compiler :P
23:45ibdknox_haha
23:57dnolenibdknox_: have you messed around much w/ CLJS + Canvas. I tried out Google Closure CanvasGraphics, dog slow.