#clojure logs

2012-12-07

00:04lynaghkamalloy: no luck. Here's what I'm trying: https://www.refheap.com/paste/7370
00:05RaynesYay, Kevin uses refheaps.
00:05lynaghkeach invocation takes the same amount of time (7 seconds...)
00:05lynaghkRaynes: trying to get my money's worth =P
00:05RaynesAnd he even takes the time to set the syntax highlighting to the actual language instead of leaving it at 'Clojure'
00:05amalloywell at the very least you need to export those vars to the drip process
00:06amalloyit can't see those at all, right now
00:06Rayneslynaghk: Man, you don't know how helpful that was.
00:06lynaghkamalloy: prefixing with export? No change.
00:06amalloyafter that i think you have to look up the arcane format of the INIT variables
00:07amalloyISTR they're a bit weird
00:07RaynesI've been getting back into refheap. Going to be working on some new features soon. Important ones are paste history, markdown rendering, and a mechanism for displaying multiple pastes on one page (analogous to github's mutli-file pastes).
00:07amalloybut tbh i haven't looked deeply into it; you might want to just email ninjudd, who probably remembers it all
00:07RaynesI'll give you your money's worth. Just slowly.
00:07Raynes;)
00:08RaynesAnd you will definitely want to *email* him, because you will never elicit a response on IRC.
00:08lynaghkamalloy: okay, I might try that. I'm still a bit confused as to why those things are necessary. In the wiki for, e.g., JRuby, it shows drip making: drip -cp jruby.jar org.jruby.Main -e 'puts 8 * 8' super fast
00:09lynaghkand I would have that that AOT compiling my class and calling in the exact same way would make it, fast as well.
00:10lynaghkamalloy, Raynes: I'll open up an issue on the github project. thanks for the help.
00:10amalloyclojure probably does a runtime require anyway if the sources are available, even if the class is AOTed
00:11amalloylynaghk: note that INIT_ARGS is newline-separated list of args
00:12amalloyso it's supposed to be something like "-e\n(require\n'ccplot.samples.markdown-env)", except i don't know the right way to get newlines into a bash string
00:12lynaghkamalloy: I would think "-e '(+ 1 2)'" is one arg, not tow
00:13amalloyit's definitely two
00:13amalloytry passing that, with quotes, to a normal java -jar invocation
00:14amalloy(it won't work, because -e has to be a separate arg from the thing to eval)
00:15lynaghkamalloy: ah, that seemed to have made a difference
00:16lynaghkthough it looks like I am outpacing drip's ability to spin up new JVMs---I assumed it was doing some kind of forking from a pristene copy, but that doesn't seem to be the case
00:17amalloyno
00:17amalloyif you know how to do that, i'm sure ninjudd would love a pull request :P
00:17lynaghkheh
00:18amalloybut i think you lose the ability to fork(2) once you're inside the jvm
00:18lynaghkyeah, that's what stackoverflow is telling me.
00:19lynaghkdamn, I guess I'll just have to throw a copy of Compojure into this library and have that provide fast access
00:22bbloomso what's the correct way to go about making tagged literals now?
00:22bbloomi need to use `lein trampoline repl` right?
00:22lynaghkbbloom: how do you mean?
00:24bbloomlynaghk: whats the right way to add my own #bbloom [1 2 3]
00:24RaynesI don't think we have the technology to serialize human consciousness yet, bbloom.
00:25lynaghkbbloom: I register records with print-method to spit out tagged literal strings.
00:25bbloomRaynes: i was attempting to avoid further abuse of #foo :-)
00:25lynaghkbbloom: https://github.com/keminglabs/c2po-clojure/blob/master/src/clj/c2po/literals.clj
00:27bbloomlynaghk: not sure what i'm looking at
00:27bbloomi know i can just set! *data-readers* but is there a proper api for that?
00:27lynaghkwhen you say making tagged literals, do you mean writing or reading from strings?
00:27bbloomi want to define a new tagged literal to be read in my own source files
00:28lynaghkbbloom: ah, I see. so you're typing it in and need it to be read
00:28lynaghkyeah, set *data-readers*
00:28lynaghkor you can add to a magic file
00:28lynaghkdata_readers.clj, I believe.
00:29bbloomi saw mention of that, but can't find any real documentation
00:32ChrisPHi everyone, wondering if there was a quick answer to this -- is there a framework that gives Websocket / SSE with long-polling fallback? Similar to Atmosphere, but lighter and... clojure-y?
00:32bbloomoh dur lynaghk it's documented on *data-readers*
00:32bbloomi feel dumb for missing that
00:33lynaghkbbloom: nah, it took me forever to figure out the *data-readers* stuff. Clojure is not the hottest w.r.t documentation
00:33lynaghk(I am part of the problem here, of course. Learning how to use Sphinx now...)
00:34cemerickbbloom, lynaghk: this is the clearest official statement on them AFAIK: https://github.com/clojure/clojure/blob/master/changes.md#21-reader-literals
00:35bbloomcemerick: thanks
00:35bbloomtpope: how are you determining what an expression is? ie for cpp. searching for enclosing parens? delegating to VimClojure?
00:45bbloomk i seem to have it all working
00:46bbloomfeels kinda weird that namespace-free tags are reserved
00:46bbloombut i guess if they weren't then tagged literals would need complete integration with require, refer, use, etc
00:46bbloom:-/ namespaces are hard.
00:46bbloombut oh so damn useful
00:46Apage43bbloom: pretty sure it sends what you would select if you type %v%
00:47bbloomApage43: ah, that makes sense
00:47Apage43er, or not
00:47bbloomalthough, sadly, it's not sufficient for tagged literals, which i just accidentally discovered
00:47bbloom#foo 1
00:47bbloomgotta visual-select :Eval for that
00:48Apage43bbloom: or cp<motion>
00:48Apage43cp$ for (from here to end of line)
00:48bbloomah yes, you're right
00:48bbloomactually, i think my fingers knew that
00:49bbloomi certainly didn't, but i'm almost certain i did that several times already :-)
00:50sshackOkay, clojure tools for database schema migration ? What's available in Clojure?
00:50Apage43bbloom: mmhm, I kind of instinctively figured up cpap for doing whole defns (as long as I don't have line breaks inside the defn, of course)
00:50cemerickdanger, will robinson!
00:50cemericksshack: here be dragons, re: schema migration
00:50sshackOkay, enlighten me.
00:51bbloommmm schema migrations, the cause of and solution to all of your database problems
00:51sshackbbloom: I thought that was php and mysql "coders"?
00:51cemerickit's a nightmare in general, and in clojure-land
00:51bbloomsshack: heh, are you on postgres?
00:52sshackI am.
00:52sshackII've been button by mysql data bugs before.
00:52sshacks/button/bitten/
00:52bbloomsshack: hurray transactional DLL!
00:53sshackbbloom: No. This was back in the late 90's when mysql would just eat your data for no reason.
00:53bbloomI'll let cemerick comment on clojure-related database stuff, since all my SQL database experience is prior to clojure
00:53bbloommy hurray was for postgres
00:53sshackcemerick: Enlighten me on the clojure way of databases.
00:53sshackbbloom: ahh, yes. I agree.
00:54sshackI got bitten by that bug tou recently. But it was in the process of exporting from mysql to postgres.
00:55cemericksshack: don't ask me, really. I try to stay away from real RDBMS stuff.
00:55cemerickI abuse postgres as a kv store sometimes, but that's the extent of it.
00:56cemericksshack: technomancy was deep into schema migration bits for a while, I think.
00:56bbloomheh
00:56sshackOkay, We have very different viewpoints then.
00:56bbloomsshack: my schema migration strategy of choice has always been a custom bag of bash and ruby
00:56bbloomsshack: i never found a schema migration package i liked. especially not activerecord
00:56sshackI'm trying to bring my platform for this project down to two languages.
00:56bbloombut then again, i'm a well known ORM hater :-P
00:56sshackMathematica, and Clojure.
00:56bbloomheh
00:57cemerickWhen I *did* use a database, it was with sqlalchemy. Magic and terror.
00:57cemerickLoooong time ago. Sorta.
00:58cemericksshack: there are clojure libs for this, I just don't know of them
00:58cemerickoh, right, this is one: http://budu.github.com/lobos/
00:59cemerickThere was one other that was jousting for the privilege of being hated for all time by all Clojure database programmers.
00:59amalloysqleton?
00:59sshackSo clojure programmers are a very easy going, accepting bunch, right?
01:00cemerickheh, quite
01:00cemericksshack: do you have a grand confession to make or something? ;-)
01:02sshackI'm a secret lover of visual basic.
01:02bbloomsshack: you say you only want to use mathematica and clojure, but you kinda have no choice but to use pgsql… why not just write pgsql ?
01:02cemerickhah, nice!
01:02bbloomhence my vote for cat scripts....
01:03bbloomcat <<EOF
01:03bbloom….pg sql here ...
01:03bbloomEOF
01:03sshackbbloom: I like tools to automate parts of my lifting for me.
01:03bbloomslap that in migrate.sh
01:03cemerickyou *could* use plv8 + ClojureScript :-P
01:03bbloom./migrate.sh | psql ...
01:03sshackactually, experience has taught me it is a requirement.
01:03bbloompoof works like magic
01:03cemericksshack: the first code I sold was written in RealBasic, targeting windows :-D
01:04sshackcemerick: Nice. Pascal, technically. But first real work was c++ on iris/sco and linux (all at once)
01:04sshacks/iris/irix/
01:04bbloomwe did several migrations a week and all the automation in rails annoyed the hell out of me. i replaced it all with a handful of lines of bash and everythign was more pleasant
01:04bbloomand faster too
01:05sshackbbloom: Fair enough. Different folks, different strokes.
01:05bbloomsshack: it was still automated
01:05bbloomit was just *simpler*
01:05sshackI understand.
01:05bbloomhit the db once with select max(version) from migrations
01:06bbloomthen do a find -newer … ./migrations
01:06bbloomor whatever
01:06bbloomthen a for loop cat into a single psql call
01:06bbloomand poof, fully automated migrations
01:06bbloombe sure to set -x on your deploy scripts and everything is magic
01:07sshackbbloom: So you're suggesting I write my own migration tool.
01:07bbloomsshack: i'm suggesting migrations are much simpler than needing a tool :-)
01:07bbloomalso, i'm saying right tool for the job
01:07bbloomi wouldn't use a big clojure library where a simple cat script would get the job done
01:08muhoowhat's the current status of cljs in nrepl.el?
01:10sshackbbloom: We'll agree to disagree here. I've stepped on a few land mines before where something a bit more sophisticated than a cat script would have helped out.
01:11bbloom*shrug* i also prefer Makefiles over Puppet and Chef, so I understand my tastes aren't for everyone
01:11sshackParticularly with altering data in columns.
01:11sshackHave you tried scons by any chance?
01:12bbloomno
01:12sshackI switched from makefiles to scons about a decade ago. Can't stand brittle makefiles now.
01:13sshackIt's a build system based on python code. Very nice.
01:13bbloom*shrug*
01:20derridaDo I want to be using nrepl or REPL-y as my repl in emacs?
01:20Raynesbbloom: Agreeing to disagree is the best thing to do when you're obviously wrong.
01:20brehautnprepl is a protocol
01:20brehautreply is an nrepl client
01:20derridahm
01:20brehautreply is also the default repl for the 'lein repl' command
01:21bbloomRaynes: which thing am i wrong about? it's not obvious to me? :-)
01:21Raynesbbloom: That was a joke, sir.
01:21derridafor some reason my setup keeps getting confused and it knows about two different looking repls, one is REPL-y and the other is what I was calling "nrepl"
01:21bbloomheh, ok then
01:21muhooderrida: are you using nrepl.el?
01:22derridaIf I C-c C-z from a clj file before manually entering nrepl-interaction-mode in the file, it connects to REPL-y. If I nrepl-jack-in from the file buffer, it will create a more sparse repl that just says: "; nREPL 0.1.6-preview"
01:23derridamuhoo: yes, and clojure-mode
01:23brehautbbloom, schema migrations arent the cause of all your database problems, only a large chunk :P
01:23brehautbbloom: you have to give the query optimizer some credit too
01:23derridaI had to strip the swank stuff out of clojure-mode to stop it from borking my slime-repl though :(
01:23bbloombrehaut: was a homer simpson beer reference :-)
01:23brehautoh true. lol
01:23bbloomhaha but yeah brehaut you're right, that damn query optimizer
01:25muhooderrida: oh, you've got slime/swank going too for another lisp? i've never tried to get those to coexist. hmm.
01:25derridabbloom: I think there is something to be said for the ubiquity of Makefiles. I had to deal with a project that was using premake last week and it really hammered in for me why I will never use an obscure build system.
01:26bbloomderrida: the main problem with makefiles is that people try to use them to do anything other than shell out to other things based on file time stamps
01:26bbloompeople try to figure out crazy complex fancy features
01:26derridamuhoo: yeah, I'm a CL person that's exploring/learning clojure. they seem to coexist a heck of a lot better than they did a year ago now that nrepl is around.
01:26bbloomand in reality, the simplest thing to do is to run a shell script which outputs makefile gunk, and then causes re-evaluation to occur in gnu or bsd make
01:26bbloommy make files generally have zero logic in them
01:27bbloomand are like 10 or 20 lines
01:27bbloomand then i have a bunch of shell scripts that do any interesting work
01:27derridayeah, I agree, I've seen very clean makefiles that prove it.
01:27bbloomso pleasant to work with
01:28bbloomredis, for example
01:28muhooderrida: great, welcome! nrepl is the current recommended way to do emacs interation with clojure IIRC
01:28Apage43psh, makefiles
01:28bbloomantirez needs to teach a course :-)
01:28Apage43just write your app as a single .c file; make <name> will run $CC main.c -o main
01:29derridamuhoo: so, the "correct" repl that should appear is the 0.1.6 nrepl preview? not the REPL-y one?
01:29muhooderrida: nrepl.el basically just talks to a running clojure process using the nrepl protocol. nrepl is editor-or-client-independent.
01:30muhooderrida: i have a slightly different workflow than most people, but just doing jack-in is supposed to Just Work (TM)
01:30muhoonrepl-jack-in
01:30muhoonot clojure-jack-in
01:30derridayeah, that's what I'm using
01:30derridadidn't Just Work for me though :D
01:31seangroveIs there a way to specify the 'g' flag in cljs using the regex literal syntax?
01:31derridaI'm having to manually put buffers in nrepl-interaction-mode after jacking in
01:31derridawhich I can probably fix by adding a hook, but I'm guessing something is up since I have to do that?
01:32muhooderrida: yeah, sounds like something in clojure-mode
01:32muhoothe hook is supposed to make nrepl-minor-mode for all clojure-mode files
01:32derridamaybe the clojure-mode in melpa is too old or something, I'll try cloning from git
01:32derrida*github
01:32muhooderrida: i'm using elpa, and it works
01:33muhooemacs 24
01:33muhooclojure-mode 1.11.5, nrepl 0.1.5
01:33derridahmm, older nrepl than me
01:34muhooyeah, i have made a few additions to it. was lazily wondering if cljs support is improved, i should just go rtfc on github
01:34derridaah, yeah, looks like there's a new update from yesterday
01:36muhooit may not be a bad idea to start up a fresh emacs too, without any cl/swank/slime stuff running, and try nrepl-jack-in from there
01:38derridaI actually did try that, behaves the same way.
01:39derridamuhoo: is it normal for nrepl to give you a buffer that's in the user> ns? (or should it be putting me in the ns of the project being loaded)
01:41muhooyes
01:41muhooi always get user>
01:42muhoothen i have some stupid macros i wrote to do what i want from there
01:42muhooand by stupid, i mean elisp code, because i haven't figured out how to write nrepl middleware yet
01:42muhoohttps://www.refheap.com/paste/7372
01:45muhooi usually do (require 'my.project.foo :reload-all) and then (in-ns 'my.project.foo)
01:45muhooand then i hit that hotkey again to run my elisp. it's, um, ridiculous, but it works.
01:48muhooheh, i love that there's a branch in nrepl.el git called "blowing-chunks"
01:54seangrove,(map identity {:a 10 :b 12})
01:54clojurebot([:a 10] [:b 12])
01:54seangroveuhg
01:54seangroveIn cljs I think that comes out as 12
01:54seangroveBut glad I'm not totally insane anyway
01:58seangroveNeed to get a clojurebot hooked up to cljs in a browser env in here
01:58seangrove~cljs
01:58clojurebotTitim gan éirí ort.
02:02Apage43seangrove: http://himera.herokuapp.com/index.html ?
02:02Apage43shows the same as clojurebot in here when I punch that in
02:02amalloyApage43: if it came out as 12 i'm pretty sure all of cljs would explode on itself
02:02seangroveYeah, I think that's rhino
02:03seangroveHaha
02:03seangroveAlright, well, I've just done something wron here then
02:03Apage43seangrove: it executs in the browser
02:03Apage43Try (js/alert "BLAH")
02:03Apage43*executes
02:04seangrovehrm, wow
02:04seangroveIt's working properly now, same repl, same line
02:04seangroveI'll attribute it to user error
02:36llasramseangrove: Hey, did you get your "M-up" -> "A" issue sorted out?
02:36seangrovellasram: Yes, appreciate you tip, ended up googling around for that and figuring it out
02:37llasramOh, ok, cool. You'd logged off, but I figured out I'd actually ended up just teaching Emacs the new keys. How did you end up fixing it?
02:38llasrams,new keys,new key mappings,
02:38seangroveI'm using iTerm2, ended up configuring the profile to use the keys properly
02:38llasramOh ok, cool
02:38seangroveIt's a better solution over, since I think emacs isn't getting someother keys I'd like it to, and now I have a better idea why
02:38llasram(A phrase I apparently say a lot when I wake up at 2am)
02:38llasramOh, I agree
02:39seangroveHeh, I'm about to pass out if I can just get this cljs-form validation bit working
02:39seangroveVery close now...
02:41llasramWell best of luck
02:41TolstoyHas anyone used clojure.java.jmx? I've set up a bean, and a thread to adjust the value once in a while, but console doesn't graph it.
02:42TolstoyEr, mbean, and jconsole.
02:49borkdudegoat moaning everyone
02:52llasramheh
02:56andrewmcveighmorning.
02:56p_lborkdude: and yak shaving to you
03:08borkdudeis there a kind of "powered by Clojure" logo you can use on your website when it is mainly written in Clojure?
03:16TolstoyHm. Creating a proxy / interface to use as an MXBean seems to allow jconsole to graph changes in attribute values. The dynamicMbean prevents that for some reason.
05:17jmlis there a web page w/ release notes for clojure? (something analogous to http://docs.python.org/3/whatsnew/index.html, say)
05:18llasramjml: https://github.com/clojure/clojure/blob/master/changes.md
05:18jmlllasram: thanks.
05:25muhoothis feels... wrong https://www.refheap.com/paste/7379
05:26muhooah, maybe another situation where for is the right answer
05:27llasramWhat feels wrong about it?
05:41hyPiRionI'd probably do it like this
05:42hyPiRionhttps://www.refheap.com/paste/7381
05:42hyPiRionBut it seems pretty much right for me
05:44ro_stis it possible to destructure both a seq of args and a map of optional params from the same fn args?
05:48Mr_Bondro_st: should be fine if you use the sequence-functions ?
05:49muhoohyPiRion: that improves it a lot. i think it's the anonymous inside map that makes me think i should bust out for.
05:49Mr_Bondro_st: the zipmap function maybe?
05:58ro_sti've realised it's not going to solve my problem
05:58ro_stthanks for responding, even so :-)
06:18borkdudeso, what's the coolest static site generator in clojure nowadays?
06:23ro_stclojure has those?
06:23vijaykiranthere's misaki
06:24vijaykiranhttps://github.com/liquidz/misaki
06:24borkdudeI added a footer to my little app: http://twitter.michielborkent.nl/
06:24borkdudevijaykiran ah that's the one I searched for
06:25vijaykiranBtw, http://amsclj.nl/ is built using that
06:25ivaraasenborkdude: getting an error on the redirect after authing with Twitter
06:25ivaraasenredirected to localhost:8080
06:26vijaykiraninteresting clojure-toolbox.com doesn't have static-site-gen section. Someone should fix that :)
06:26borkdudeivaraasen hmm, shit. will have to change my apache config then
06:26borkdudeivaraasen tnx for noticing
06:27borkdudeivaraasen try again
06:28ivaraasenborkdude: works now, awesome
06:29ivaraasenonly thing you'll need to implement next is a selection list to unfollow en masse.
06:30borkdudeivaraasen yes, well, that's a bit rigorous, I would never use that ;)
06:37ivaraasenborkdude: select all -> defollow, and deselecting important people. I would use it, at least
06:37ivaraasendunno if the Twitter API would allow it tho
06:37borkdudeivaraasen it allows it, I'd have to create a new app key for it though
06:46borkdudeivaraasen this was more a proof of concept for me, such sites already exist btw
06:53tgoossensi never quite understand how you dynamically typed languages in general can lead to robust code. don't you just have to do the type checks yourself.. reinventing overloading etc?
06:58tgoossensits a design decision in clojure i don't understand why it was done that way
06:59tgoossensmaybe just because being a lisp?
07:00borkdudetgoossens more freedom
07:01tgoossensbut that freedom comes at a cost
07:01borkdudetgoossens yes, but type systems have costs too
07:01borkdudetgoossens it's an ancient old discussion
07:02tgoossensi'm just getting into it. clojure is my first experience with dynamically typed language
07:02kmicutgoossens https://s3.amazonaws.com/github/downloads/frenchy64/papers/paper.pdf
07:02borkdudetgoossens it's strongly typed though, which is better than weakly typed imho
07:03kmicuA Practical Optional Type. System for Clojure. Ambrose Bonnaire-Sergeant.
07:03tgoossensborkdude: access denied link ?
07:04borkdudekmicu do you have experience with typed clojure?
07:05kmicuonly read paper
07:06borkdudetgoossens there are other functional langs that have advanced type systems though (Haskell)
07:06borkdudetgoossens so you could just choose what suits you
07:08borkdudeso, debian seems like a good choice for a vps… going for it then
07:12tkoskineComing from Ada (with all this very strongly typed goodness), I still haven't got used to Clojure's system and I use a lot of assertions and pre/post-conditions, but it is nice to see how little effort you need to see to get even some more complex algorithm done in Clojure (good for prototyping, for example).
07:13borkdudesolid set of unit tests help of course
07:14borkdudebut again, it's a discussion that's probably never going to end
07:14tkoskineYep.
07:15borkdudehaving an optional type system (typing by demand) would be really cool, so typed clojure could maybe fulfill that role
07:15borkdudehaven't worked with it yet though
07:20kmicutgoossens: you can check also http://blog.fogus.me/2010/05/25/trammel-contracts-programming-for-clojure/
07:22fredyrjust how much do you guys feel you get bitten by the dynamic typing though?
07:23cshellfredyr: do you mean how much do we have runtime casting exceptions?
07:24kmicuper hour
07:24kmicu;]
07:24kmicuor per LOC
07:24cshelllol
07:24fredyrlol
07:24fredyri wasn't really looking for a metric
07:24fredyrbut if you think it's a big issue not having static typing
07:25cshellwhen I was really new I had a couple problems, but that was cause I was still thinking the java way
07:25kmicuit's not an issue, it's a choice/tradeoff and I take it fully!
07:25tgoossensfredyr: never made large software projects with a dynamic language so far. My only real experiency lies with java
07:25cshellhickey's talk on using abstractions really helped me, so now I usually return a map or a sequence and then everythign works well
07:26tgoossensi figured that
07:26kmicutgoossens: why not scala then?
07:26tgoossensin clojure for example it doesn't really matter that much because you don't invent a new type for every new piece of data you want to represent
07:26kmicuif you love type system so much :)
07:26fredyrohmy, what did i start now :)
07:27tgoossenskmicu: i don't love type system so much, its just, i have no significant experience with any dynamically typed language.
07:27cshellit's very different when you're used to all these different types (ie java)
07:27tgoossensand during my student job somebody gave me some initiation to clojure
07:27tgoossensand i kept playing with it
07:28cshellbut if you learn to use one or two types/abstractions everywhere then there's a very low chance of type problems and much higher reuse
07:28cshellso I wonder if it's fair to say that strong typing can reduce reusability
07:28tgoossensit was my first experience with dynamically typed languages.
07:28kmicuit will be good
07:28kmicubut do not trust me :)
07:28tgoossenshaha
07:29tgoossenscshell: i think it is more valid to say that using less types for representing data increases reusability
07:30cshelltgoossens: yes, that might be something you learn once you've used both
07:30kmicutgoossens: http://www.infoq.com/presentations/Code-Testing
07:30cshelltgoossens: cause in java we could pass around maps everywhere
07:32tgoossenscshell: i've been experimenting with using maps in java instead of classes
07:32tgoossensalso using ImmutableMap from guava
07:33tgoossensbut to get it to work i had to invent some ways to
07:33tgoossensput any type in the map
07:33kmicuthere is not reason to be upset because of the lack of typing system
07:33tgoossensand then get that value out with proper casting
07:34tgoossenscurrently i've done it with something like this:
07:34tgoossensMap<FieldName<T>,T>
07:35tgoossensbut it is probably a good way
07:35tgoossens*not a good way
07:35borkdudetechnomancy what linux do you use, just wondering
07:35kmicunot idiotmatic for sure
07:36tgoossensno but its not because it is not idiomatic it is bad
07:36kmicutgoossens: why not scala? :)
07:36borkdudeor Haskell
07:37kmicuHaskell@JVM?
07:37kmicu;]
07:37tgoossensnever looked into it. Maybe i should. but first i'm going to continue experimentation with clojure :D
07:37borkdudekmicu Frege
07:37borkdudetgoossens knowing at least one lisp is good for common programming knowledge probably, and clojure is a very nice lisp
07:38tgoossensand haskell i'll be seeing in next year's course (also prolog) so for now i'm exploring other languages
07:39borkdudeI think I read sometime in a common lisp book or essay: "Lisp is the language of love", I think that's true - it makes many programmers happy. =)
07:40fredyr:D
07:40fredyri like that
07:41kmicuit makes me happy for sure ;]
07:44borkdudeah, this is it: "Lisp is the language of loveliness." http://www.dreamsongs.com/ArtOfLisp.html
07:45borkdudeby Richard P. Gabriel (foreword of Succesful Lisp)
07:45kmicuborkdude: thx!
07:46Mr_Bondthe guys at the office like the "Land of lisp" book
07:47Mr_Bondnot read it my self
08:10borkdudelol: http://www.youtube.com/watch?feature=player_embedded&amp;v=cZ34RDn34Ws
08:39yediwhen building non-trivial webapps, do you think it's a pain in the ass to use multiple kinds of dbs (depending on what fits the job) or would you recommend just sticking to one?
08:54clgvDoes anyone know whether I can use a FileOutputStream to write header data first and after that wrap it into a DeflaterOutputStream to compress the following data? I am encountering an exception complaining about a too short ZLIB header
09:23clojure-newbhey guys, how do I set response encoding to UTF-8 with ring-json 0.1.2 ?
09:26clgvdoes anyone have experience with apache commons-compress related to its performance?
09:38tgoossensSomeone should start Google plus clojure community :D
09:42tgoossensOh nvm
09:53bsalty@tgoossens it would be plus Google then wouldn't it?
09:58hyPiRion(inc Google) is more like it
09:59carkrather (partial + google)
09:59bsaltydammit i still need to read about partial
10:00carkit's easy : partial application
10:00cark,((partial + 3) 5)
10:00clojurebot8
10:08borkdudeeh, someone an idea what could be wrong? https://www.refheap.com/paste/7387
10:11borkdudeeh nm.. fixed
10:11bsalty@borkdude maybe this is a stupid answer but looks like ning is missing from class path?
10:12borkdudebsalty that's right, I included a dependency indirectly before, so when I removed one dependency only then I saw this error
10:12bsaltyah
10:12bsaltytoo much magic in inferred deps
10:41gfredericksis there any documentation about using a proxy with clojure.java.jdbc?
11:09pepijndevosHow to find a good ASP dev. It seems to me the ecosystem doesn't culture good devs.
11:12S11001001pepijndevos: find good non-ASP dev willing to learn it
11:12rkzpepijndevos: look for people doing ASP in F#
11:14S11001001rkz: sounds right
11:14pepijndevosOh yea, I heard good things about F#. F# is to C# what Scala is to Java, I imagine.
11:14S11001001pepijndevos: yeah
11:15S11001001the best devs I know won't be pigeonholed into "<some language/framework> dev", pepijndevos
11:15pepijndevosS11001001: Yea, my initial thought was, find a polyglot.
11:22borkdudeF# is quite nice
11:23tpopebbloom: right now cpp is just mapped to cpab
11:35DaReaper5I am still slightly confused with defn and how it returns values. How can I do an action/method call before returning an actual value?
11:35HodappDaReaper5: The same way you'd do it in any other expression.
11:36Hodappor do you mean you need side effects or something?
11:36tufflaxDaReaper5, I don't understand your question :p
11:37DaReaper5(defn take-from-q [q key] (some-method)(.take q))
11:37DaReaper5i can do that
11:37DaReaper5but what if i want to call some-method after the take
11:37DaReaper5can i store it in a let and then return the let after
11:38HodappDaReaper5: why are you concerned with the order here?
11:38tufflaxYou can save the result of (.take q) with a let, and return it after (some-method)
11:38DaReaper5how do i return the let value
11:39DaReaper5hodapp i am concerned because .take is a blocking action and i need to change something after it unblocks
11:39DaReaper5(defn take-from-q [q key] (let [r-value (.take q)](some-method)(r-value))
11:39DaReaper5?
11:39tufflaxYou know that in both let and defn the last form is returned, right? So you can do (let [result (.take q)] (some-method) result)
11:39DaReaper5ok just wihtout the brackets
11:39DaReaper5ok thanks
11:40DaReaper5thats what I was thinking but i couldn't find any examples along those lines
11:40DaReaper5Thanks tufflax
11:40tufflaxDaReaper5, parens almost always is a call, so (r-value) would try to call r-value as a function
11:41DaReaper5ya
11:41DaReaper5i keep forgetting that but i realized after i typed it. Force of habbit i guess
11:41DaReaper5lol
11:41tufflax;)
12:09Kowboyanyone here use the counterclockwise eclipse plugin?
12:11joegallo~anybody
12:11clojurebotNo entiendo
12:11joegallo~anyone
12:11clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
12:12HodappI used to use it, until I stopped because I found it to be awful.
12:14cemerickKowboy: Yeah, I use it.
12:14seangroveIs there let-when or something similar?
12:14cemerickHodapp: not an eclipse fan? :-P
12:14Kowboywhen I try to create a new Leiningen project, it created the project directory and then seems to "hang"
12:14apwalkseangrove: when-let
12:15seangroveapwalk: Hah, thanks
12:16Hodappcemerick: Eclipse is fine. Counterclockwise just did not work right.
12:17cemerickKowboy: I see a delay of ~5s while it does an initial dependency resolution, but it doesn't hang.
12:21jmlwhat's the point of the discard operator in edn? https://github.com/edn-format/edn
12:28technomancyborkdude: hey just saw your message
12:28technomancyI use Debian
12:28technomancyclojurebot: anybody is anyone
12:28clojurebotYou don't have to tell me twice.
12:28borkdudetechnomancy ok tnx, I'm thinking about using it too
12:28technomancyit's pretty great
12:28technomancyespecially when you add nix into the mix
12:30borkdudenix?
12:30clojurebotnix is a purely functional package manager exhibiting many similar characteristics to Clojure's persistent data structures or git commit trees: http://nixos.org/nix/
12:31borkdudewhaa
12:31technomancynix is amazing
12:33uvtcanybody?
12:33clojurebotanybody is anyone
12:34technomancydang it clojurebot
12:34technomancyhow does the inference engine work again?
12:34hiredmanthat is how it works
12:34hiredmaninference may or may not happen
12:34hiredman~anybody
12:35clojurebotanybody is anyone
12:35hiredman~anybody
12:35clojurebotanybody is anyone
12:35hiredman~anybody
12:35clojurebotanybody is anyone
12:35hiredman~anybody
12:35clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
12:35hiredman~botsnack
12:35clojurebotThanks! Can I have chocolate next time
12:35metellus~chocolate
12:35clojurebotNo entiendo
12:36hiredmanif you want to reinforce an inferred fact, you need to give a botsnack with in some amount of time of the inference
12:37hiredman~anybody
12:37clojurebotanybody is anyone
12:37hiredman~anybody
12:37clojurebotanybody is anyone
12:37hiredmanbleh
12:37technomancywait seriously?
12:37DaReaper5if i define a "let" and then try to return it. Does that nto work because of the lifetime of the let?
12:37hiredmanI was going to say "since I did that, it is now more likely to show up"
12:37technomancybotsnacks have an effect; that's sweet
12:37thorwiltechnomancy: heard of guix https://savannah.gnu.org/projects/guix/
12:37hiredman~anybody
12:37clojurebotanybody is anyone
12:37hiredmanclojurebot: jerk
12:37clojurebotyou cut me deep, man.
12:37technomancythorwil: yeah... mixed feelings about it
12:37technomancyhiredman: does "jerk" have the opposite effect?
12:38hiredmantechnomancy: no
12:38technomancythorwil: I think it's a really good thing that nix package definitions are 100% declarative, and doing them in scheme loses that property
12:38technomancythorwil: I wish they had used racket instead of guile so they could define a subset of scheme instead of being limited to a superset
12:38technomancybut OTOH building your own language is crazy and tooling sucks, so maybe it's a win
12:39thorwiltechnomancy: interesting points. i guess racket was out because this project is meant to be very gnu
12:39DaReaper5if i define a "let" and then try to return it. Does that not work because of the lifetime of the let?
12:40technomancythorwil: yeah, shame when politics get in the way of technical decisions like that
12:40technomancyguile is probably a lot smaller though
12:40technomancywhich is ironic considering racket's appeal here comes from the ability to define a smaller language
12:40hiredmanDaReaper5: please continue repeating your nonsense question every few minutes
12:40DaReaper5 (defn take-from-q [q] (let [q-interaction (.take q)] q-interaction ))
12:40DaReaper5hiredman: np
12:41DaReaper5q-interaction is null
12:41DaReaper5when i know it is not because i have a println
12:41DaReaper5or more specificaly take-from-q returns null
12:42tmciverDaReaper5: then (.take q) must be returning null
12:42hiredmanor the code you pasted is not the code that is running
12:43hiredmantmciver: java queues cannot hold nil (null) and take blocks until it can return an element
12:43hiredmanso it cannot return nil
12:43tmciverah, right
12:59Kowboycemerick, my network at work can be god aweful slow sometimes
12:59Kowboyit may just be that
12:59Kowboybut if I create the project outside of eclipse and then import it, I seem to get up and running much faster
12:59cemerickinteresting
13:00cemerickKowboy: Your slow network may very well have something to do with it
13:00KowboyI am behind a proxy
13:00KowboyI will try again shortly
13:01cemerickI don't know much about the lein integration, but IIRC, it doesn't make any use of offline mode when it might otherwise be able to (yet?)
13:05Kowboyis the leiningen plugin for eclipse a separate project?
13:05Kowboybtw, I tried again and no luck
13:06KowboyI click on finish, I see the project pop up in the project explorer, but the Leiningen project wizard is still open, and the project directory has nothing in it but a .project file
13:08dabdshould I go for JNA or JNI for interfacing with native C code that does not require passing huge data structures but relies mostly on speed?
13:09cemerickKowboy: it's a separate plugin, but has the same lead
13:09cemerickKowboy: I'd suggest reporting the hang to the ccw ML
13:53nDuffCan :type metadata be used for protocol dispatch, or do I need multimethods to take advantage of that?
13:55technomancynDuff: need to use multimethods
13:55technomancyor rather, you get to use multimethods
13:55SegFaultAXIs there an online resource for looking at the Java source?
13:55SegFaultAXI'm interested at looking at java.util.concurrent.CountDownLatch
13:56gfredericksjml: #_ is a reader-level comment; it is useful often.
13:57jmlgfredericks: when would you want to use that rather than ';'?
13:57gfredericksjml: to comment a form rather than a line
13:57jmlgfredericks: makes sense. thanks.
13:57gfredericksclojure's comment macro does a similar thing, but that wouldn't be available in edn
13:58gfredericks,[1 2 #_ 3 4]
13:58clojurebot[1 2 4]
14:01hiredman,(comment 1)
14:01clojurebotnil
14:01hiredman,(first [(comment 1)])
14:01clojurebotnil
14:01hiredman,(first [#_1])
14:01clojurebotnil
14:02hiredmanerr
14:02hiredman,(first [(comment 1) 2])
14:02clojurebotnil
14:02jmolet_SegFaultAX: javasourcode.org ? http://javasourcecode.org/html/open-source/jdk/jdk-6u23/java/util/concurrent/CountDownLatch.java.html
14:02hiredman,(first [#_1 2])
14:02clojurebot2
14:02hiredmananyway, the comment macro is meh
14:03SegFaultAXjmolet_: Thanks!
14:10gfredericks(defmacro don't [& args])
15:24gfredericksis it unlikely to be possible to use the postgres UUID type in korma?
15:24gfredericks(insertion as a string fails)
15:24thmzltgfredericks: that will do it
15:25gfredericksHA that's fantastic
15:25gfredericksthank goodness these things are immutable
15:30technomancyirony: ruby's UUID gem requires you to instantiate a factory before you can get any UUIDs, while Java's implementation doesn't
15:31gfredericksruby has always bragged about being more object-oriented than java :)
15:32hyPiRion"Yay, we're more complex!"
15:32technomancygfredericks: yeah, the irony there is that "more object oriented" usually means "it doesn't have primitives" which translates to "impossible to write fast numerics"
15:32gfrederickstechnomancy: the main thing it lacks is mutable numbers
15:33gfredericksI started a library to fix that
15:33gfredericksimagine being able to empty an array with my_array.length.zero!
15:35hyPiRiongfredericks: Well, that's convenient.
15:35technomancywell given that you can redefine == on an eigenclass...
15:36gfrederickstechnomancy: well fixnums don't have eigenclasses
15:36technomancyactually that probably only works once you leave tagged fixnums
15:36gfredericksI was going to define Flexnums as a separate class
15:36gfredericksbut you can redefine the Fixnum math operations so that everything turns into a flexnum everywhere
15:36technomancydun dun dun
15:37gfrederickssuddenly your system is flowing with unheard of power
15:37gfredericksif your numbers don't have callbacks you're doing it wrong.
15:37technomancygfredericks: did you see that one gem that defined class=
15:37gfrederickswat.
15:38technomancyI think it was from http://www.confreaks.com/videos/198-rubyconf2009-worst-ideas-ever
15:39gfredericksdid it redefinie Object#class to go with it?
15:39gfredericksapparently you can redefine it but it doesn't have any effect :/
15:43muhoodoes nrepl do cljs yet?
15:43osbertis -?> in any of the modular clojure contrib libraries?
15:43gfredericksincubator maybe?
15:44osbertthanks
15:45cemerickmuhoo: see piggieback
15:45tgoossensfor the record a google plus community for clojure has been created
15:45tgoossenshttps://plus.google.com/communities/103410768849046117338
15:46borkdudeI hate these kinds of messages http://michielborkent.nl:8080/ <- how the hell can I see what is going wrong, it works locally
15:48muhoocemerick: thanks, i'd forgotten about that
15:50muhooborkdude: look in your logs
15:51muhooborkdude: or hacks like this might work for production, https://github.com/kenrestivo/firealarm
15:51borkdudeI'm going to try compojure next holiday ;)
15:51muhoogood plan
15:52borkdudefuck, I've been bitten by the require views inside jar thing again in Noir
15:52borkdudesorry for the language
15:53muhooone of the hardest things i've ever done is teach a programming class to grade-school kids
15:53muhoobecause, it is impossible for me to not curse when dealing with computers
15:53muhooit's not a semicolon, it's a "fucking semicolon". always.
15:54seangroveSame here, but I drink heavily too at the end of it all
15:54borkdudelol
15:55seangroveJavascript, or closure's, event listening model is baffling
15:55tgoossensseangrove: explain!
15:55seangrove"When this even happens, call a function with this name"
15:55seangroveThat's what I'd like
15:55seangroveSo I can, in the repl, update the function and test
15:56seangroveInstead it seems to be "When this event happens, call *this* function, even though I've just given you a function reference"
15:57bendlas`cemerick: can you include patches and cut releases to/from incubator?
15:58hiredmanseangrove: clojurescripts reference model is not very good
15:58hiredmanseangrove: I would try giving it something like (fn [e] (my-fun e)) instead of just my-fun
15:58seangrovehiredman: good idea, let me try
15:59cemerickbendlas: yes, why?
15:59hiredmanwhich is kind of lame, and in advanced complication will even get stripped away (I think)
16:00hiredmanwhere as in clojure you can just do #'my-fun
16:00cemerickhiredman: waiting for you to build cljs vars out of atoms :-P
16:00bendlascemerick: people have asked for apply-kw, so I made a patch: http://dev.clojure.org/jira/browse/CINCU-3
16:00hiredmancemerick: :(
16:00seangroveI'm kind of with it being stripped out in advanced mode, though it seems a bit dangerous
16:00bendlascould you take a look at it and maybe apply it?
16:01hiredmanseangrove: advanced mode munges names of everything anyway
16:01hiredmanseangrove: so re-defining a function will not work anyway
16:01seangroveYeah, not worried about redefining it once it's in advanced-mode/production
16:01seangroveJust worried I'll do something stupid forget it, and lose a night tracking it down
16:02seangrovehiredman: That did it, yes, thanks
16:02seangroveDoes that mean I can't do #'my-fun inc ljs?
16:02seangrovecljs*
16:04seangroveAnd is that something that can be changed in the compiler, or a fundamental limitation of the js model?
16:04hiredman#' is var quote, clojurescript has no vars
16:04seangroveAh, ok
16:04cemerickbendlas: oh, I generally don't touch anything in core.incubator outside of the strint stuff I wrote originally...
16:05cemerick...which I need to just bust out into a separate library (again) so it can breathe free ;-)
16:06cemerickbendlas: honestly, it's been suggested that incubator should be shuttered, as it's premise seems faulty
16:07cemerickor, suboptimal, anyway
16:07seangrovecemerick: Actually, I just came across your strint stuff this morning, hoping to use it in cljs
16:07bendlascemerick: I see
16:07cemerickseangrove: Should just work :-)
16:07hiredmanor the name is misleading
16:08cemerickgithub.com/clojure/bag-o-stuff
16:09cemericknow that more threading macros are in core, all that's left is dissoc-in, seqable?, new-by-name (WTF), and strint
16:09bendlascemerick: isn't it supposed to be potential new clojure.core/... entries?
16:10cemerickbendlas: that was the theory. *maybe* dissoc-in would get in, but none of the rest would.
16:10cemericks/would/would or have
16:10cemerickAll of it has been sitting around for a while.
16:11hiredmannew-by-name?
16:11bendlashm, in the case of apply-kw I'd discourage its use in most cases, but it should be there for people building DSLs
16:11cemerickhiredman: "Constructs a Java object whose class is specified by a String."
16:11amalloyhiredman: presumably for (let [x 'String] (new-by-name x)) or some similar
16:12cemerickbendlas: maybe amalloy et al. have something similar in flatland/useful?
16:12bendlasso I also see it for functions that are general purpose but might be a code smell in a lot of cases.
16:12cemerickamalloy: which is busted on travis atm
16:13bendlascemerick: good idea, I'll look that up
16:13bendlasit's definitely one of the bigger bags-o-stuff around ;)
16:14amalloycemerick: we should probably stop pretending to support 1.2, then :P
16:14cemerickwas that some version of Clojure or something?
16:15amalloycemerick: yes, flatland/useful is failing on clojure 1.2
16:18technomancy"bag-o-stuff" <- sounds like the goal of original monolithic contrib was preserved in 1.3+
16:18cemerickIIRC, it was created after a bunch of stuff didn't make the first cut into new-contrib.
16:19muhoodoesn't python have a "from future import" feature for stuff like that?
16:19muhoostuff that didn't make it into the current version, but was backported, so to speak?
16:20cemerickIt does, but future is supposed to include only things that will actually be in the stdlib eventually.
16:20cemerickAs of 1.5, nothing in core.incubator qualifies on that count AFAICT.
16:21Raynesamalloy, cemerick: I'll fix that in a second.
16:21borkdudeis there an way to "force" a path and a file into existence, like writing to ~/.somename/logs.txt, even if .somename doesn't exist yet (without manually checking, etc)
16:22technomancyborkdude: pretty sure you need .mkdirs
16:23muhooborkdude: "mkdir -p"?
16:23borkdudemuhoo in clojure (or Java for that matter)
16:24muhooborkdude: oh, then, what technoancy said
16:24RaynesBahahaha
16:24borkdudek tnx you both
16:24Raynestechnomancy, amalloy: I was trying to figure out why no useful tests would pass just now and realized it's because my copy of leiningen is broken because of the test selector mods I'm making. :p
16:25RaynesStash time.
16:25muhoodeveloper cut by own sharp edges :-)
16:26muhoohell, i didn't know piggieback existed, except that 4 months ago i not only knew it existed, but submitted patches to it! early alzheimer's sucks.
16:27cemerickmuhoo: we have similar ailments :-)
16:27borkdudemuhoo is that a joke, or real? ;)
16:35muhoocemerick: i'm not sure, actually. could be normal aging, docs are still tracking that one down.
16:38borkdudeI'm starting to like working with paredit…. finally!
16:39Raynesmuhoo: borkdude was the one that asked you.
16:39RaynesWhich is even more cause for concern.
16:40borkdudelol
16:40RaynesI'm sorry to hear there is an actual problem. :(
16:40borkdudeah, wait, I didn't even took it that seriously… I read docs as documentation (wtf..)
16:42RaynesOh no, not you too!
16:42muhoohehe
16:44borkdudecemerick what do you mean?
16:45borkdude(kidding)
16:45Raynesmuhoo: Seriously though, hope you find out you're just stupid and that it isn't a medical issue.
16:45muhoowell let's just put it this way: don't eat shrimp from the gulf of mexico 6 months after a major oil spill, unless you want to risk toxic poisoning and liver (and potentially brain) damage. that's the current theory anyway, nobody really knows yet.
16:47borkdudemuhoo sucks man, sorry to hear it's a real issue
16:47RaynesI like to drip my shrimp in 10W-40.
16:48muhoothanks, i didn't want to get into TMI, but i figured, maybe best to just out with it
16:48muhooindeed, corexit makes a fine condiment.
16:49muhoobut if i can get piggieback + browser repl working than i can at least have more opportunites to be stupid in a great language.
17:05brondohello, does anyone have any experience loading a directory from resources/ in an uberjar?
17:05hiredmanyou cannot load a directory via the classloader
17:05brondoloading files works great, but I want to get the path to a lucene index that's in my resources folder and always get nil with (clojure.java.io/resource "indexes/")
17:05tmarbletechnomancy: I can't seem to get clj-stacktrace to work with lein2, despite the tips on https://github.com/mmcgrana/clj-stacktrace (are those instructions up-to-date)?
17:05borkdudeI think I've seen this once, but I forgot.. is it possible to "use" one var like with use and :only, but then with require?
17:06brondohiredman, thank you! is there any known way to do this?
17:06hiredmanbrondo: you cannot do that
17:07borkdudebrondo I'm currently working around an issue exactly like that… sometimes it works great, but now it gives me problems again..
17:08brondoborkdude, hiredman is the normal way to do this to have an absolute reference to the directory and not try to pacakge it in the uberjar?
17:09borkdudethere was something like "you can do everything with require (or was it use?) now", can't remember exactly what it was
17:09hiredmanone way is to package it as a single file (zip or something) inside the jar, then pull it from the jar and extract it to tmp or something
17:09brondoI see
17:10borkdudelet's put it like this: I want to require a namespace with :as, but want to use one thing from it with :only
17:10amalloy:refer
17:11borkdudeamalloy :refer in require?
17:11amalloyyes
17:11borkdudeamalloy does this work in clojure 1.3?
17:11JorejiHey everybody, I'm trying to call clojure from java by doing: "RT.loadResourceScript("main/clojure/de/karolski/berkelium_clj/core.clj"); clojure.lang.RT.`var`("de.karolski.berkelium-clj","ensure-init").invoke();" But for some reason I get the exception: "Exception in thread "Thread-1" java.lang.IllegalStateException: Attempting to call unbound fn: #'de.karolski.berkelium_clj/ensure-init" Anyone knows what I'm doing wrong? The function ...
17:12Joreji... definitely exists.
17:12amalloyi think it's 1.4
17:12borkdudeamalloy ok, good, because I dont see it on clojuredocs
17:15eggheadis {:keys [field otherfield] :as whole-map} a legal destructuring?
17:15eggheadnvm, typo in my source..
17:17Jorejinvm, found the error. Was missing a .core in the ns.
17:37TEttinger@title http://duckduckgo.com
17:37TEttinger!title http://duckduckgo.com
17:37TEttingerhm, what is lazybot's prepend?
17:38bbloom,(inc 5)
17:38clojurebot6
17:38bbloom&(inc 5)
17:38lazybot⇒ 6
17:39bbloomor ##(identity "inline")
17:39lazybot⇒ "inline"
17:40TEttinger&title http://duckduckgo.com
17:40lazybotjava.lang.RuntimeException: Unable to resolve symbol: title in this context
17:40TEttingerno, not trying to eval
17:40bbloom~lazybot
17:40clojurebotHuh?
17:40TEttingertrying to call the plugin, I have a lazybot of my own
17:40TEttingernot here
17:41TEttinger`title http://duckduckgo.com
17:41amalloyTEttinger: lazybot's prepend is $. iirc if you start your own instance it defaults to @
17:41TEttinger$title http://duckduckgo.com
17:41lazybot"DuckDuckGo"
17:41TEttingerthanks amalloy
17:41TEttinger$title https://duckduckgo.com/?q=github+lazybot
17:41lazybotPage has no title.
17:41TEttingerah that's why
17:41TEttinger$title https://duckduckgo.com/?q=\!github+lazybot
17:41lazybotPage has no title.
17:42TEttinger$title https://duckduckgo.com/?q=\\!github+lazybot
17:42lazybotPage has no title.
17:42TEttingersorry about the spam
17:42amalloyTEttinger: you can /msg him
17:42TEttingeris there a better place to test lazybot oh ok
17:43TEttingerwell amalloy, maybe you can answer my question...
17:43TEttingerhttps://duckduckgo.com/?q=\!github+lazybot should be a redirect page. how can I get the title of what it redirects to?
17:44TEttingerhttps://duckduckgo.com/?q=\feeling+lucky+punk should also be a redirect page.
17:44amalloyimprove the title plugin to use something smarter than slurp
17:45TEttingerit uses slurp-or-default right?
17:46TEttingeri mean would clj-http have something for that?
17:46amalloyprobably
17:47bbloomi never know what to call "setter" functions
17:47bbloomi much prefer foo over get-foo, but set-foo just seems wrong when talking about an immutable structure
17:48TEttingercould it be... as simple as slurping the slurp?
17:48bbloomand with-foo implies dynamic context
17:48bbloomfoo! implies mutation
17:48bbloomfoo= implies equality
17:48bbloom(foo x new-val) is ambiguous with (foo x default-val)
17:48bbloomnames are hard.
17:50bbloomconventions? opinions?
17:53technomancyupdate-*
17:54bbloomtechnomancy: better, but feels kinda long
17:56bbloomtpope: so far plugin is working beautifully
17:56tpopeawesome
17:57bbloomfeels vim-y too, which is nice
17:57tpopethat was a design goal
17:57tpopethat's always a design goal
17:58ohpauleezbbloom: You mean it isn't a mess of over-used leader key combos? :)
17:58Sgeo|webWhat is this "disable locals clearing" about?
17:58Sgeo|webI see it mentioned in Compiler.java
17:58bbloomohpauleez: bingo. plus it plays nice with text objects
17:58ohpauleezbbloom: I name setter functions the verb of the mutation, or an arrow if it's a conversion (foo->bar ...)
17:59bbloomohpauleez: yeah, sometimes there isn't an obvious verb. in *many* cases i discover that anytime there isn't a verb or an obvious x->y name, then there is a better design
18:00bbloomshortly after i asked that previous question, i realized that there was a far superior name for my use case
18:00ohpauleezagreed
18:00ohpauleezoh, stellar
18:00bbloomit also changed the signature of the function and cleaned up some of my thinking
18:00bbloomwhich is what clojure tends to do :-)
18:01rlanderHey, does anyone care to critique this for style and idiomatic usage? https://www.refheap.com/paste/7395
18:03bbloomrlander: you don't need to convert a character back to a string
18:03bbloom,(= \/ (last "some/url/")
18:03clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
18:03bbloom,(= \/ (last "some/url/"))
18:03clojurebottrue
18:04rlanderbbloom oh, thats nice, thanks!
18:04nDuffIt's going to be a lot slower to convert the string to a seq and back than to use (.endsWith url "/")
18:04nDuff(or whatever the java.lang.String method is
18:04bbloomnDuff: premature optimization
18:05rlandernDuff at this point I'm just trying to write idiomatic code, but thanks for the tip
18:06Raynesbbloom: Common sense, I think.
18:06RaynesNothing wrong with .endsWith
18:06nDuffbbloom: There's optimization, and then there's writing code that's not needlessly slow.
18:06RaynesI use it all the time.
18:06nDuffbbloom: I'm pretty sure this is a cat-2.
18:06RaynesAnd I'm a pretty cool guy.
18:07bbloomas a guy doing lots of CLJS, damn you and your usage of common java-isms in core code paths! :-)
18:07bbloomalso available: regexes
18:07nDuffAhh. :)
18:07bbloom,(re-matches #".*/$" "some/url/")
18:07clojurebot"some/url/"
18:07bbloom,(re-matches #".*/$" "some/url")
18:07clojurebotnil
18:07bbloomwhich, might be what he actually wants here:
18:07RaynesThe day I start trying to write Clojure code that works in ClojureScript is the day I check myself into Arkham.
18:08rlanderbbloom sorry, I don't follow
18:08RaynesI had a feeling you were a leader.
18:09bbloomrlander: clojure.string/replace allows regexes
18:10bbloomalthough my knowledge of java regex expressions is apparently poor
18:11hyPiRionHmm, that would also be an issue with regexes
18:11Apage43I need to whip out the reference most of the time
18:11hyPiRionand interop
18:11bbloomyeaaaaah java regexes != javascript regexes :-/
18:11hyPiRion/s/interop/other clojures on other platforms
18:11ohpauleezjava regexes != ANY OTHER REGEX
18:11ohpauleez:)
18:12technomancycould be worse; could be elisp regexes
18:12bbloomtrue story.
18:12hyPiRioncould be worse, could be no regexes
18:12hyPiRionWell, I'm not even sure if that's worse sometimes.
18:12ohpauleezhaha
18:12rlanderbbloom Ok, I see. add-slash is actually going to be a middleware that adds a missing "/' to :uri. It's not used inside any of the functions in that paste
18:12bbloomfun fact: there generally aren't REGexes
18:13bbloomperl regexes are not regular
18:13bbloom:-/
18:13arrdemdoes clojure have an equivalent to C's __file__ variable for use in macro expansion?
18:13ohpauleezcue the regex joke, "You have a problem and you think, 'Oh! I can solve this with regex' ..."
18:13hyPiRionbbloom: Do you mean the formal definition of regular expressions?
18:13technomancyarrdem: clojure code is usually loaded from jar files, so it's not very useful but there's *file*
18:13arrdemsilly perl... regexes can't be recursive...
18:13bbloomhyPiRion: http://swtch.com/~rsc/regexp/regexp1.html
18:13bbloomhyPiRion: and http://code.google.com/p/re2/
18:14arrdemtechnomancy: gah ofc. Been writing C for the last few months and my brains a little addled from it.
18:15bbloomi recall a dramatic performance bug that i fixed at google by inserting the character "2" to the code `#include "goog/whatever/re.h"`
18:15seangroveAbout to dive into goog.async.Deferred - anyone have any experience or quick high-level tips around it?
18:15nDuffarrdem: ...there's also reader matadata...
18:15nDuffgah, metadata
18:16hyPiRionbbloom: The first one's just speedups though
18:16hyPiRionThe second one shows the issue better :)
18:17bbloomrlander: also on the idiomatic list: (if ?x ?y nil) can be (when ?x ?y)
18:17arrdemback in the C project I'm now running away from I had a DEBUG() macro that generated printf()s with the file and line no. that's what I'm trying to get.
18:17bbloomrlander: it's not common to see commas used in such short expressions like [k, v]
18:17bbloomrlander: indentation on line 29 is weird
18:18rlanderbbloom Honest mistake from a Pythonista [k, v]
18:19rlanderbbloom the identation is sublimetext's fault. Just fixed it.
18:23rlanderbbloom all fixed https://www.refheap.com/paste/7397
18:23rlanderbbloom again, thanks for the corrections, much appreciated
18:25Foxboronrlander, using Sublime Text?
18:26rlanderFoxboron yup. Not very good for clojure.
18:26Foxboronrlander, i did put up some snippets for Clojure with package manager.
18:26FoxboronIts lacking a REPL with the Lein version 2, but.
18:27rlanderFoxboron: excellent for everything else.
18:27FoxboronI was wondering if you would like to test a Sbulime plugin i have been working on.
18:27FoxboronBasically a ClojureDoc searcher with some neat features
18:28rlanderFoxBoron, sure. Sounds nice.
18:28rlanderFoxboron https://github.com/Foxboron/ClojureDoc-Search ?
18:28FoxboronHah, yeah :)
18:29FoxboronAlso, the snippets i have pushed to Package manager should help on some of the functionality
18:29FoxboronJust hoping they will get SublimeREPL working soon :/
18:29rlanderFoxboron I'll try it right now
18:30FoxboronFoxboron, snippets are at the package manager, the searcher is submitted but not accept atm
18:30Foxboronhah, i just highlighted myself :P
18:31Foxboronrlander, just come with suggestions and bug reports if you encounter them.
18:31rlanderFoxboron, package manager has totally spoiled me.
18:31Foxboronhaha, yeah :P
18:32rlandertrying to remember how to manually install a package from a repo
18:32Foxboronrlander, download the zip, go to sublime. pref -> browse packages
18:32FoxboronMove folder to the package folder.
18:34rlanderFoxboron, oh, right, thanks
18:34Foxboronnp ^^
18:36rlanderFoxboron, cmd+shift+c doesn't seem to be working
18:37Foxboronhmmm
18:38Foxboronrlander, Linux or OSX?
18:38Foxboronor Windows?
18:38rlanderFoxboron osx
18:38Foxboronyeah umm, go to the keybidn file and change ctrl to cmd.
18:38Foxboroni forgot adding Linux and OSX keymap files.
18:38FoxboronDoing that now
18:39Foxboronkeybind*
18:44rlanderFoxboron this is awesome
18:45Foxboronrlander, thanks :)
18:45flying_rhinohello guys
18:46Foxboronrlander, if you get an auto-match, but still wanna see other results, you can bush esc
18:46Foxboronpush*
18:46Foxboronactually, you can push back.
18:47flying_rhinoit is possible that I am a friggin idiot, but I installed leinangen and got it to work, but can't figure out how to use anything bigger than REPL in command prompt. I can create new project but have no idea what to do with it.
18:48Foxboronflying_rhino, common beginner problem TBH. I had the same problem. Lets see if i can find the tutorial which sat me on the right track :D
18:48technomancyflying_rhino: have you read `lein help tutorial`?
18:48rlanderFoxboron, you mean, for example, when searching for "cond" I'd push esc to see "condp" too?
18:49Foxboronrlander, you can use the option back, and you see other search results.
18:49FoxboronI justs did so that 100% matches gets right to the main menu.
18:49rlanderFonxboron push back does work, but esc doesn't
18:49Foxboronyeah, i was wrong.
18:49Foxboronesc works in other scenarios :)
18:50rlanderFoxboron seriously, this is very useful
18:50Rich_MorinAre there any ClojureWest group discounts for Meetup groups, etc?
18:50rlanderwhy is it "Insert example" and not "View examples" ?
18:51eggheadoo reminds me, I wanna go to clj west!
18:52Foxboronrlander, good question, i thought it would be more reasonable. Dunno why.
18:52nDuffHrm.
18:53Foxboronrlander, however glad you liked it. If you get any problems or find any bugs, just PM me. Been striving for a long time to find a clojure user using Sublime which would try the plugin :)
19:34bbloomis there a way to get nrepl to pretty print by default?
19:39ohpauleezbbloom: it looks like the middleware is marked TODO - but I'm not a definitive source
19:39bbloomohpauleez: i'm getting so spoiled by cpw to print the value of a def
19:40bbloomused to have to type out (pprint thevar)
19:40ohpauleezit's pretty stellar
19:40tpopeI didn't even think of that
19:41hiredman(alter-var-root #'clojure.core/prn (constantly @#'clojure.pprint/pprint))
19:41hiredmanor something
19:42bbloomtpope: oh yeah, it's glorious :-)
19:43bbloomtpope: some more feedback: i expect {} and [] to count as blocks, not just ()
19:43tpopereasonable
19:43tpopeI used ab as a quick hack
19:43tpopewith the idea that it could be swapped out later
19:44bbloomtpope: it's pretty effective for a quick hack
19:44tpopeyep, which is why I haven't been in a rush to fix it
19:44bbloomalso, i'm almost 100% convinced that cpp should be top level by default
19:44bbloommaybe ohpauleez wants to weigh in on that too
19:44tpopewait, you have top level {} and []?
19:44bbloomno
19:44bbloomi'm referring to our conversation from yesterday regarding eval form or eval top-level form as the default for cpp
19:45bbloombut top level {} and [] aren't completely unheard of in my scratch files when they have sub expressions that are interesting
19:45tpopeI mean on one hand you want cpp to see []/{}, but on the other hand you just want it to do toplevel?
19:45bbloom[:foo (some-complex-thing :bar)]
19:46bbloomtpope: i want cpab to see [] and {}
19:46tpopewell it'd have to be some other operator, since ab is a built in
19:46bbloomhm ok
19:46tpopebut yeah, I agree
19:47tpopebut for that matter, should it also grab atoms?
19:47bbloomif we ever meet, remind me that i owe you a beer.
19:47tpopewill do :)
19:47bbloomyou mean the @ outside of () ?
19:47tpopeno I mean like symbols or strings or whatever
19:47bbloomhm, not sure
19:48bbloomwould have to play with it, i think
19:48ohpauleezbbloom: tpope: Originally I wanted top-level (paragraph), but I actually like it form, since I can toggle to top-level pretty fast
19:48tpopeby toggle you just mean move your cursor?
19:48tpope(that's what I do)
19:48ohpauleezlike I said in my ticket, I don't use f,t - so I've been banging cpp cpw cpf constantly
19:49ohpauleeztpope: (yeah, hit next ")")
19:49tpopeI was going to revisit the whole file mapping this weekend
19:50tpopealong with the associated bug
19:50ohpauleezI could cpp, cpf), cpf), etc
19:50bbloomonce i discovered `` as the intra-line equivalent of '', then (cpp`` became somewhat reasonable
19:50bbloomstill kinda long
19:50ohpauleezwelp, I'll remap to cpr right now
19:50tpope:)
19:51ohpauleezbbloom: does my recipe above work for you?
19:51bbloomohpauleez: i'm not sure i follow it
19:51ohpauleeztpope: Please ignore all of terrible ideas - eventually I'll find the light :)
19:52nDuffIs there a standard-library equivalent to (partial map-indexed (fn [x y] [x y]))?
19:52tpopeI'm pretty good at filtering out terrible ideas :)
19:52ohpauleezbbloom: You start in some inner form, you cpp, you want to see what the next form is going to be, you cpf)
19:52tpopesome might say too good
19:52ohpauleeztpope: I still hate how r breaks the sentence-format
19:52bbloomohpauleez: the next form may span multiple lines
19:53nDuff...oh.
19:53bbloomohpauleez: also, that doesn't go back to the beginning of the current top level
19:53tpopehmm?
19:53nDuff*facepalm*.
19:53ohpauleezI need to see how f and F differ
19:53bbloomfX searches current line until X
19:53tpopeyou mean cpr?
19:53bbloomFX searches backwards
19:53ohpauleezahh
19:53bbloomohpauleez: you need to learn to use f and t :-)
19:54ohpauleezI never use them
19:54ohpauleezhaha
19:54bbloomohpauleez: i use them constantly
19:54ohpauleezI just use search and %
19:54ohpauleezbut now I'm thinking, I'd use cpf) a lot
19:55bbloomf and t are crazy useful for modifications intrasymbol
19:55ohpauleezcs'"
19:55ohpauleezI use surround for that
19:55bbloomeg if you have foo-bar and you're cursor is before the f, you can ct-xyz<esc> and you've got xyz-bar
19:55antoineBhello, does exist a parser for clojure?
19:55ohpauleezchange-surrounding-symbol-symbol
19:56ChongLiantoineB: for clojure source code?
19:56nDuffCould I ask for some eyes on https://gist.github.com/2235a2fa03ecd57b0a7c? I'm trying to get a flat sequence of nodes from walking a tree, and that's very much not actual behavior.
19:56antoineBChongLi: yes
19:56ChongLiantoineB: well, there's eval
19:56ChongLiwhat exactly are you looking to do?
19:56ohpauleezbbloom: ahh gotcha
19:57ohpauleezI usually blast words away at that point
19:57antoineBChongLi: i would like to do a little helping tool to deal with clojurescript
19:57bbloomwhen i was learning vim for real, i decided to print out a cheat sheet and to pick one key per week to learn
19:58antoineBChongLi: i need to parse ns, deftype, def, defn and defprotocol
19:58bbloomi'd force myself to use it every time it was applicable until i had it committed to muscle memory
19:58bbloomthen i'd X the letter off my printed cheatsheet
19:58bbloomwithin 3 months, i became a text editing ninja :-)
19:58bbloomyet i still discover new stuff nearly daily!
19:58ChongLiantoineB: you'll want to look at the clojurescript compiler
19:58ChongLihttps://github.com/clojure/clojurescript
19:59ohpauleeztpope: what about cpn?
19:59ohpauleeznamespace
20:00tpopeohpauleez: you could conceively push "till next search result"
20:00ohpauleezah true
20:00ChongLiantoineB: there was a commit just a few weeks ago adding parse-ns to the compiler
20:00ChongLihttps://github.com/clojure/clojurescript/commit/a27f811f046cd1ace9e4b9461181e5a5fb23b682
20:00tpopeyou need something that actually changes the buffer for the third character
20:01tpopeohpauleez: I never heard a good explanation of why evaluating the buffer is superior to just requiring it
20:01tpopecpr is perfect for "require"
20:02ohpauleeztpope: Oh yeah, I agree with :Require
20:02ohpauleezbut that's a verb
20:02ohpauleezI want a noun
20:02ohpauleezcp-word cp-paragraph
20:02ohpauleezcp-require?
20:02dnolenantoineB: but what do you mean by "parse", parse into an AST?
20:02tpopewell think of it as "requiring"
20:02dnolenlynaghk: ping
20:02tpopeyou're pushing a require request
20:03tpopea "requiring"
20:03clojurebotPardon?
20:03tpopea "dumb bot"
20:04ohpauleezhaha
20:04tpopea "requirement"
20:04tpopea "require dispatch"
20:04ohpauleezI'm going to personally map to cpa; cp-all-of-it
20:04ohpauleeznice on qwert and dvorak
20:04antoineBdnolen: parse into something more easy to deal with (in order to extract information)
20:04tpopethen you clobber cpab, cpap, etc
20:04ohpauleezdamnit!
20:04ohpauleezhahaha
20:04tpopeI almost said cpA
20:04tpopethat's perfectly available
20:04ohpauleezI'm for it
20:04tpopebut not quite as nice
20:05dnolenantoineB: analyzer parses and produces AST which you can extract info if that's what you mean.
20:05dnolenantoineB: but it doesn't handle full Clojure of course
20:06ohpauleezI'll just think of "cpr - bringing it back to life"
20:06tpopeha!
20:09tufflaxwhat's going on here? tpope making some sort of vim plugin for clojure?
20:09eggheadlol
20:10bbloomtufflax: https://github.com/tpope/vim-foreplay
20:10tpopemade
20:10tpopein the shade
20:10ohpauleeztpope: Just a heads up, I'm getting an EOF Java Exception with cpF(
20:10antoineBdnolen: what i want to do is for a given namespace (bounded to a file) give a list of all function, protocol, type, definition and protocol function + their associated data like doc, arguments name etc
20:10tpopeohpauleez: pretty sure you've misunderstood F :/
20:10dnolenantoineB: if you want this for ClojureScript the analyzer does that for you.
20:11tpopeohpauleez: that will evaluate everything from the cursor position to the previous (
20:11antoineBdnolen: i think a function that take a file/string and give me a clojure list could do the trick
20:11tpopeohpauleez: you're looking for more like F(cpp
20:11tpopealthough hcpp would work just as well
20:11dnolenantoineB: anayzer doesn't give you a list but it does give you a atom that holds a map of everything.
20:11dnolenanalyzer
20:15ohpauleeztpope: Ah yes, this makes more sense now
20:16tomojbbloom: do you plan to integrate qplan with core.logic somehow? I guess core.logic won't work for doubles, so your test needs a=2b-c written thrice? but core.logic might work for grid layout? pixels??
20:16lazybottomoj: Definitely not.
20:17bbloomtomoj: i'm not using qplan yet, so i'm not sure how it will evolve. the part written 3 times was just a test case. some higher level binding framework with explicit knowledge of linear equations could generate it
20:17ohpauleezbbloom: Personal question -
20:17ohpauleezWhere do you think you really leveled up?
20:18ohpauleezbetween Drexel and now
20:18ohpauleezbecause there is a stark (very good) difference
20:18bbloomi'm just a shitty student.
20:18ohpauleez(not to say I ever thought you were bad)
20:18ohpauleezahh
20:19bbloomhappy to discuss further details privately :-P
20:19ohpauleez:)
20:22tpopeI pushed cpr
20:22tomojwriting out equations would seem great. I don't understand yet how working manually with constraint methods would be
20:22tpopeso you can stop trying to rename it :)
20:24bbloomtomoj: i'd expect not to write too many methods by hand, they are tricky to get right
20:24bbloomeven that little test case is probably horribly wrong in a larger application
20:25tomojbecause usually you don't want to implement all the methods for a relation?
20:25bbloomtomoj: because you need to design your methods such that you have free variables
20:26bbloomso you wind up with constraints being a higher-level grouping then you'd expect
20:26bbloomconsider that slider with a midpoint example
20:27bbloomif you had three constraints: left > 0, midpoint = (left+right)/2, and right < max
20:27bbloomthen only the midpoint would be a free variable
20:27bbloomso it wouldn't be resolvable in some cases
20:27bbloombut moreover, it would involve the other two as outputs, so there wouldn't be a free method
20:27bbloomit's a pretty constrained solving approach
20:28bbloomno pun intended RE: "constrainted"
20:34stokachuhi ive got a question about doing some multi-site work with clojure/enlive.. my problem is I am unable to get the template to reload based on what the current server-name in the ring request is: http://stackoverflow.com/questions/13772481/clojure-enlive-multi-site
20:34stokachui can get the server-name based on whatever host i've setup but it seems like deftemplate will not re-request a new template page if the hostname changes
20:36tomoj"left > 0" is, uh, {:inputs #{:left} :outputs #{:left} :f (fn [{:keys [left]}] (max left 1e-100))}.. or what?
20:36tomojer, {:left (max left 1e-100)} ofc
20:39brehautstokachu: im running from memory here, but deftemplate is a macro that builds a template function and caches the html content. I think you'll need to go a bit lower level if you wish to have templates change their html content on each request
20:39stokachubrehaut: ah ok, it seemed like something was caching ill look through the enlive source at the other functions to see what i can find
20:40stokachubrehaut: thanks for clearing that up
20:40brehautstokachu: from memory still i think 'at' is the form used for the guts of templates and snippets
20:41stokachucool i will definately start there
20:41stokachui saw the tutorial which mentioned using at so ill refresh my memory from that too
20:41brehautyou will probably want to investigate some sort of caching yourself though, based on hostname, because loading the templates isnt exactly fast
20:42bbloomtomoj: (min left 0)
20:42stokachugood point i haven't really given much thought about that, it may be wise to break up this app further and keep it hostname specific
20:43bbloomtpope: is there a way to interrupt an evaluation?
20:43bbloomsay, if i, stupidly wrote an infinite loop?
20:44stokachuim curious though, is a "cloud" type deployment with a war for each domain running under a jetty instance seem like a decent idea?
20:44stokachui was trying to do a umbrella approach where clients coming in would be proxied to a different template based on the url
20:45brehautI have no experience with war deployment, or clouds in general
20:46stokachuyea me either still trying to jump on the boatr
20:48brehauti dont think theres any problem with the 'umbrella' mechanism you are suggesting though
21:05antoineBdnolen: analyze-file is what i need, but how use it in my personal project? (i copy paste for now)
21:07bbloomany idea how i'd go about walking a sub tree with a zipper? looping with zip/next and zip/end? is pretty easy, but it's not obvious to me how to stop at (zip/right sub-tree-root)
21:19tpopebbloom: if it's using if_ruby, no :(. it times out after 16 seconds
21:23bbloomtpope: it seems like the request timed out, but the nrepl session got blocked
21:23bbloomi had to restart nrepl since i didn't know how to attach to a headless session and terminate the process
21:24tpopeafter my first infinite loop, I added a 16 second timeout wrapped around the connection code
21:25tpopewhen I tried exceeding it, I got a socket error over in the nrepl, but everything seemed to work fine after that
21:25tpopeif you're having issues, it's presumably possible to send an interrupt back to nrepl. the interface is "interruptable eval" after all
21:27tpopeyou should try with a head and see if you can reproduce
21:27bbloomtpope: just upgraded to master a tiny bit ago. next time i write an infinite loop ill explore
21:31devnhowdy tpope
21:31devnwelcome to the party
21:36ghacheyHi, not sure if this is the best place to ask. I'm trying to get started with ClojureScript One. But one of the very first step, lein bootstrap, fails with: 'bootstrap' is not a task. See 'lein help'. I read a few places that people think this is because of an incompatibility lein (my first thought as well). I use the latest lein 2. I don't really won't to downgrade. Any suggestions where to go next? Thank you.
21:37devnghachey: let me try it out... I'm on lein 2 as well, one moment...
21:38devnghachey: i have the same issue.
21:38devnone second, let me see if i can figure out a way around it
21:40devnghachey: yeesh. this project looks awfully neglected. 52 issues and 5 open pull requests.
21:41devnghachey: the lein version is definitely the problem, and i dont blame you for not wanting to downgrade
21:41tpopeyou should see my repos :/
21:42devntpope: :) it's a blessing and a curse, i'm sure.
21:44devnghachey: perhaps there's a fork of the project that works with lein2, it looks like a couple of people have been working on that...
21:45flying_rhinoFoxboron: found that tutorial yet?
21:46devnghachey: check out brentonashworth's other branches, speficially M003
21:46devnit looks like that might work out of the box?
21:48devnghachey: try this: `git fetch origin && git branch --track M003 origin/M003 && git checkout M003 && lein repl`
21:48ghacheydevn: thank you will check that out.
21:48devnat the REPL type: (go)
21:48devnit worked for me.
21:49devnghachey: also, open an issue to bug brenton to merge some of this lein2 support into master :)
21:50ghacheydevn: will do, thanks.
21:50devncheers!
21:51devnflying_rhino: what tutorial are you looking for?
21:51Foxboronflying_rhino, oh f-... totally forgot.
21:52Foxboronflying_rhino: http://debugme.wordpress.com/2012/05/30/leiningen-a-basic-tutorial/
21:52flying_rhinothanks
21:52flying_rhinoand this shows how you work with projects and stuff?
21:52devntpope: by virtue of the above feedback from bbloom I'm guessing you have a repo out in public now, 'zat true?
21:53devnforeplay! :D
21:54Foxboronflying_rhino, pure basics. It should get you started with lein. Leiningen isnt that complicated ;)
21:54flying_rhinothanks again
21:54devn(happy clojuring)
21:55Foxboronflying_rhino, np. Sorry for the time, coding stuff and forgot my place in the time.
21:55flying_rhinoFoxboron: no problem at all. I should have reminded you sooner
21:55devnFoxboron: he didn't forget your identity, though.
21:55flying_rhinoI was also doing other stuff
21:55tpopedevn: yep
21:56tpopehow did you miss foreplay.vim?!
21:56Foxborondevn, and great is that :)
21:56devntpope: :X I've been sick for a week, quite literally. The flu is *rough* this year.
21:58tpopeaww
22:02flying_rhinoFoxboron: I must say (I feel like broken record really) that while there is plenty to like about clojure I wish that mutability wasn't the dirty word it is. Functional is okay as DOMINANT paradigm, but something doesn't sit right with excluding everything else. For example how am I going to create the new sort of immutable type, (say vector that acts like db table) if I don't have acess to basic (i.e. mutable) building blocks?
22:03flying_rhinoI fell like building blocks I have aren't fine grained enough...
22:04bbloomflying_rhino: what mutable building blocks don't you have?
22:06muhooany ideas how i'd convert a jodatime object to json using cheshire?
22:06devnflying_rhino: you *do* have access. You can do whatever you like.
22:07devnflying_rhino: it's just, state is dealt with differently in clojure.
22:07flying_rhinomaybe I can tell you what I would like to do and then you can tell me how to do it? If I am not annoying to you.
22:08devnflying_rhino: specifics are good. for instance: "I have (1 2 3) and I want (6 5 4)"
22:08devnbut more general questions are of course encouraged as well
22:10devnflying_rhino: either way, clojure is not purely functional. it strongly encourages it for numerous reasons, but it doesn't prevent you from doing what you need to do. stuart halloway put it best a long time ago: "Clojure is a consenting adults language."
22:12devnflying_rhino: for instance...
22:12devn,(let [x (transient [1 2 3])] (persistent! (conj! x 1)))
22:12clojurebot[1 2 3 1]
22:13muhoohm, found it, add-encoder. sweet.
22:13devnflying_rhino: see http://clojure.org/transients
22:15devnflying_rhino: so uh, long story short, no, you're not annoying anyone. this isn't that kind of community. no one is going to kick you out of the channel for asking questions. :)
22:15muhoohmm, wait, no. add-encoder doesn't exist. gah, documentation mismatch
22:15muhoook, this is why i really REALLY would love it if README.md for the version of a jar were included in the actual jar.
22:16flying_rhinoI would like to have new data type that is similar to vector but acts more like db table. It acts like db table in that, when you remove something from the middle (or rather make cheap copy with something removed) higher numbers stay intact. if you have 5 elements and remove third, last two are still marked as 4 and 5. If you remove 5 and then add new thing, it will be marked 6. So index should act like auto increment primary key.
22:16flying_rhino If this was Java I would use hash table that has numeric keys and bundle it with increment_number in a class. How do you do it in Clojure?
22:16muhoobecause, digging up the README.md from github produces stuff having nothing to do with the particular version of the library i've actually got loaded into the repl :-/
22:16tomojhmm.. conj!, end!, deliver, and fail in cljque scare me
22:17tomojbut I rationalize their presence with "consenting adults.."
22:17flying_rhinodevn: that, in short is what I need :)
22:17tomojin q.js, the promise is a separate object from the thing which you deliver to or fail
22:18tomojone big reason for that is that the author wants to make a promise a safe thing to share across some kind of semitrusted (untrusted?) js boundary
22:19tomojbut I tend to think of "the rest of my code" as semitrusted..
22:20RaynesI have devn and I want tomoj.
22:20flying_rhinodevn: I hope I havent lost you :)
22:21devnflying_rhino: what about sorted-map?
22:21tomojyou want me?
22:21devnRaynes: im trying to golf on that as we speak
22:22devn,(require '[clojure.string :as s])
22:22clojurebotnil
22:22devn,(s/replace "devn" #"devn" "tomoj")
22:22clojurebot"tomoj"
22:23devnerr i guess you want a damned symbol back, eh Raynes? ;)
22:23tomoja synchronous analogy would be that, when you block on a lazy seq, any other consumer of that lazy seq may throw an exception up to you
22:23tomojI think?
22:23flying_rhinodevn: it is more about encapsulation. I would like to 'hide' the mechanism that auto-increments numbers so it is simple to use and you can't screw something up accidentally. I am just not sure how to create new data type. But yes, sorted-map or something should be used at the core of what I want.
22:27flying_rhinoam I talkin nonsense?
22:27devnnah, im just not sure the answer
22:27devni've never needed that, personally
22:29devnflying_rhino: extend-type clojure.lang.IPersistentVector?
22:29devnflying_rhino: i realize that is wildly vague, but it seems like it's moving closer to what you're after
22:29flying_rhinobecause the way it would work now whould be two variables one sorted-map and one integer containing next-id.
22:30flying_rhinowhat does persistent vector do?
22:30devn,(class [])
22:30clojurebotclojure.lang.PersistentVector
22:31devn,(class (sorted-map))
22:31clojurebotclojure.lang.PersistentTreeMap
22:33devnflying_rhino: you want this type. maybe another question would be why?
22:34flying_rhinoI want to implement Entity Systems in clojure.
22:34flying_rhinothere is whole blog dedicated to those.
22:34devnflying_rhino: clojure-games?
22:35flying_rhinoNormaly they are mutable, but I would love to see if it is viable to create immutable Entity Systems.
22:35flying_rhinoyeah they are mostly for games.
22:35devnflying_rhino: http://www.clojure-games.org/component-entity-system
22:35devnhave you seen that?
22:35flying_rhinonope
22:36flying_rhinoI'll have to study that
22:36devnflying_rhino: hopefully that gives you a place to start?
22:37flying_rhinoto see if it is what I meant (since there are several similar but subtly differen ES approaches). But yes it is a place to start !
22:37flying_rhinothank you!
22:37devnflying_rhino: wish i could be of more help!
22:38devnflying_rhino: https://gist.github.com/858586
22:38devnthat seems to be the bread and butter.
22:39devnflying_rhino: boom! https://github.com/ibdknox/gambit
22:41devnflying_rhino: more reading... http://stevelosh.com/blog/2012/07/caves-of-clojure-interlude-1/
22:45flying_rhinohave to study that A LOT more but at a glance it seems to be different kind of entity systems. Ones I am interested in are purer, with more separation of code and data. These seem to bunde everything together. http://t-machine.org/index.php/category/entity-systems/
22:48flying_rhinodevn: if you want to read more, start here http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/
22:49devnflying_rhino: thanks. interesting stuff.
22:49flying_rhinodevn: that page isn't labeled as entity system on his blog, but is first and most importatnt
22:50devnflying_rhino: how familiar are you with clojure's agents, refs, and atoms?
22:50flying_rhinodevn: basics only, at this point. But I have idea what are they for.
22:51devni havent finished reading your suggestions, but the first post you linked above under the category "entity-systems" immediately made me think about refs and agents
22:52devnagain, that is wildly vague. it just seems to sort of "fit"
22:52devnthe whole idea of "identity matters"
22:52flying_rhinopoint of entity systems (the ones used in mmorpgs as described on blog) is to separate code and data
22:52devnyou want a db-like datatype
22:52devnetc.
22:53flying_rhinobasically at one pile you ahve bunch of pseudo-tables
22:53devnflying_rhino: but i mean, that's sort of the fundamental draw of clojure
22:53devncode *is* data
22:54flying_rhinothese are tables are components. Entities provide identity (like that creature consists of this and that component)
22:54flying_rhinosystems are where code is
22:54flying_rhino*these tables are components
22:54flying_rhinoevery tick systems process components
22:54devnis this akin to agent-based modeling?
22:55flying_rhinonot sure
22:55devnhttp://en.wikipedia.org/wiki/Agent-based_model
22:56tomoja db-like datatype.. like datomic.Database? :)
22:57tomojbut "mmorpg" hmm.. :/
23:03devntomoj: im stargazing as well :)
23:04devni keep thinking of the ants simulation
23:04devnbut with added metadata
23:04flying_rhinobasically componets are like records. Physic component would be (:x-position :y-position :x-speed :y-speed) . Health would be (:current-health :max-health :regeneration-rate) . Weapon would be (:ammo :rate-of-fire :damage :max-ammo). You get the point. Entity is solely to keep track of what components each creature in game has. It just has list of components (and each component refers to it). Systems are where actual code is. Phys
23:04flying_rhinoics system graphic system, interface, ai
23:05muhoocheshire is awesome. the way javascript handles floats is not awesome.
23:05devnthe way javascript handles numerics in general: not awesome.
23:06flying_rhinothus is possible to compose new creature by simply entering right data, without code.
23:06flying_rhinoonly when you want brand new behaivor you need to touch code
23:06flying_rhinoit is VERY data driven
23:07devnflying_rhino: i wish ibdknox were here...
23:07flying_rhinoibknox?
23:07devnchris granger -- he wrote gambit and i'm guessing has some opinions or ideas about what you're discussing
23:08devnmuhoo: exactly :)
23:08flying_rhinodevn: it is actually quite simple
23:08flying_rhinoI am not sure if doing it this way in immutable language is even a right approach
23:08tomojflying_rhino: I think you should look into datomic, but it probably can't handle an mmorpg, at least not without using multiple transactors (and dealing with that somehow..)
23:08flying_rhinotomoj: I am not building mmorpg per se
23:09devnflying_rhino: it is all quite simple ceteris paribus
23:10flying_rhinoI just want code to be (potentialy) extremely scalable and to be easy to compose new stuff. And I am aware that entity systems are great for that.
23:10tomojwell, if you can afford to put all your write load on one box (which is not as bad as usual with datomic, but still a problem sometimes) and have all your writes broadcast to all jvms doing queries, then I think you should definitely look into it
23:11tomojeven if just to take ideas from it
23:11devntomoj: it seems like he's not in need of that, that the regular facilities in clojure provide for what he's looking for
23:11tomojthat is, no durability?
23:11dabdI'd like to keep the largest value in the resulting list without having to invoke last which is O(n). What is the idiom?
23:11dabd(take-while (fn [x] (< x 72)) (map #(i/choose % 5) (range 4 72)))
23:11dabdi/choose is incanter.core/choose
23:12devntomoj: it seems like he's describing passing around game state
23:12tomojoh I missed the actual problem and only looked at the mmorpg stuff
23:12devnlike the whole board is visible to all actors, and actors can be imbued with properties
23:13flying_rhinoystems should create new state (that is new copies of components) every thick
23:13flying_rhino*systems
23:13tomojnevermind :)
23:13flying_rhinoand no, not every systems needs to see every component
23:15flying_rhino*system
23:15tomojso in the ants demo, each grid cell is a ref and each ant is an agent?
23:15flying_rhinoI have no idea if building this in clojure is a good idea
23:15clojurebotOk.
23:15flying_rhinoAT ALL
23:16devnflying_rhino: nor do i. my guess? try it. :)
23:16devnflying_rhino: your response to other component entity systems written using clojure are coupled
23:16flying_rhinowe are still stuck with what datatype acts like a table :)
23:17devnbut maybe your version of coupled doesn't fit in clojure
23:17devnmaybe it *isn't*
23:17devnim just posing what-ifs here, not saying you're wrong
23:18devns/using clojure are coupled/using clojure is that they are coupled
23:19bbloomflying_rhino: "acts like a table" isn't just one datatype
23:20flying_rhinodevn: if you mean coupling data and code, t=machine guy doesn't consider those to be 'real' entity systems http://t-machine.org/index.php/2007/11/11/entity-systems-are-the-future-of-mmog-development-part-2/
23:21bbloomflying_rhino: the built in data types provide various space/time guarentees for various protocol functions
23:21bbloomyou can create a compound data structure that provides indexes, etc
23:21bbloombut none of the built ins are going tod o that for you for multiple sorts, perspectives, views etc
23:21bbloomif you want a single sorted order preserved, you should use sorted-map or sorted-set
23:21bbloom(most likely)
23:22flying_rhinobbloom: how would you build compound data type? I know how to do that with classes, but what clojure uses for that?
23:22bbloomyou can define types with deftype
23:22tomojit's somewhat likely that idiomatic clojure for doing what you want would use something pretty different from what you think you need
23:22bbloomhowever, if you're really new to clojure, i suggest avoiding defining types right away
23:23bbloomstart with getting really comfortable with the built in types
23:23devndefrecord
23:23devndeftype, defrecord
23:23flying_rhinodefrecord is just for structs with no behaivor. Or am I wrong?
23:23bbloomflying_rhino: deftype is a primitive, so to speak
23:24bbloomdefrecord is sugar which calls deftype and then adds map-like behavior to that new type it defines
23:24bbloomyou can add ADDITIONAL behavior to your record types
23:25bbloomyou most likely won't want to even use deftype if you don't need it
23:25bbloomlet's say you have a collection of people with first and last names
23:25bbloom[{:first "Brandon" :last "Bloom"} {:first "Dev" :last "N"}]
23:26bbloomcall that rows
23:26bbloomyou can use a sorted set: (sorted-set compare-first-name rows)
23:26bbloomand (sorted-set compare-last-name rows)
23:26devn(or sorted-set-by)
23:26bbloomyeah that
23:26devn((if that's helpful to you))
23:26bbloomyou can stick those inside a map to group them together
23:27bbloom{:indexed-by-first-name …, :indexed-by-last-name ...}
23:27bbloomand you can create a one-off function which lets you insert-person or remove-person
23:27bbloominsert-person would just add an item to both sets
23:27bbloomremove would remove it from both sets
23:27bbloomjust start with that
23:27bbloomget used to working with those core data types
23:28bbloomyou don't need to define a new type to have two indexes
23:28bbloomjust create a small set of functions that do the operations you want
23:28bbloomstart there
23:29bbloomif you're in a rush to deftype, then you're not thinking clojure-y enough yet :-)
23:29bbloomflying_rhino: does that make sense?
23:30devnflying_rhino: i gotta agree with bbloom -- there's a lot of room (and rope) in the core datatypes. when you find the point where you actually need to use deftype, that's the point at which you start trying to build your own
23:31bbloomdeftype when you need type dispatch
23:31flying_rhinoI don't want two indexes. I just want that when I remove something from the middle, higher stuff has same index. If you remove from the end and add something else, it has bigger index. Like auto increment primary key. In java I would implement it with hash table and next-id integer.
23:31devnflying_rhino: but this isn't java
23:32flying_rhinobut changing indexes for items is what I seek to avoid!
23:32flying_rhinoindex must be unique for each item and must not be re-used.
23:33flying_rhinookay I'll think about this stuff
23:33flying_rhinoI am a bit tired, it is late over here
23:33bbloom(let [db {:next-id 1 :rows {}}, id (:next-id db), new-row "fred"] (-> db (assoc :next-id (inc id)) (update-in [:rows] assoc id)))
23:33bbloom,(let [db {:next-id 1 :rows {}}, id (:next-id db), new-row "fred"] (-> db (assoc :next-id (inc id)) (update-in [:rows] assoc id)))
23:33clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$assoc>
23:33bbloom,(let [db {:next-id 1 :rows {}}, id (:next-id db), new-row "fred"] (-> db (assoc :next-id (inc id)) (update-in [:rows] assoc id new-row)))
23:33clojurebot{:next-id 2, :rows {1 "fred"}}
23:33bbloomflying_rhino: there, that 1 worked
23:33devn:)
23:33flying_rhinothanks
23:34bbloomit's the same idea: top level map to group a next-id and a set of rows together
23:34bbloomtransform them at once
23:34bbloomwrap the whole thing up in an atom, and you've got a mini db :-)
23:34devnthat reminds me a bit of stupiddb
23:34devnan old Licenser project
23:34flying_rhinothanks
23:35devnhttps://github.com/Licenser/stupiddb
23:35flying_rhinowell a kind of stupid db is more or less what this thing is. Although bonus is that you can serialize stuff to actuall db easy.
23:35bbloomdevn: nice.
23:36bbloomflying_rhino: https://github.com/Licenser/stupiddb/blob/master/src/stupiddb/core.clj kinda neat
23:37flying_rhinoalso some mmorpgs use (I hear) actual DB's for backend. No idea how they take data in and out in real time games.
23:38flying_rhinobut that's flexibility of entity systems. You can start with pseudo-db and later switch to real one.
23:38dOxxxprobably snapshots that are written to the disk in background
23:38flying_rhinoand use db to serialize data in between.
23:39flying_rhinowhen you entangle code and data, you lose that flexibility.
23:41bbloomyou're preaching to the choir about tangling code & data in this channel :-)
23:43devnflying_rhino: that temporary serialization of data is exactly what stupiddb provides
23:43flying_rhinoOOP S.U.C.K.S (well, at least as a general purpose organizational technique; it has some use for specific stuff)
23:43devnor, close to it
23:44flying_rhino(now I better come down from a soapbox before I am lynched)
23:45flying_rhino*the
23:45dOxxxDoes a hammer suck? Yes, if you're trying to put a turn a nut on a bolt with it.
23:45dOxxx:)
23:45devnflying_rhino: a "soapbox" is what snake oil salesman use.
23:46devnyou don't strike me as a snake oil salesman.
23:46devnsoapbox away!
23:47flying_rhinobut really I no longer have any idea if ES (the kind I want to use) make any sense in clojure.
23:47devnflying_rhino: perhaps you're too concerned with up-front verification? Why don't you give it a try?
23:49devnflying_rhino: maybe the kind you want to use just *looks* different in clojure.
23:49dOxxxThe Entity System that t-machine article is about seems to be fairly independent of language.
23:49dOxxxIt's more of a architectural thing.
23:50flying_rhinobasically we are using systems to create chaep copies of components (tables) every game tick (that is every quater second)
23:50flying_rhino*cheap
23:51dOxxxI'd think that creating copies of a non-trivial amount of data 4 times per second is going to cause you trouble no matter language you use
23:51devnflying_rhino: cheap "copies" over time sounds like persistent data structures to me.
23:51devndOxxx: that's an assumption
23:51flying_rhinodOxxx: in mutable language I would simply alter those components
23:52flying_rhinohere I can't alter anything.
23:52devnflying_rhino: that's patently false
23:52devnatoms, refs, agents
23:52devnalter them.
23:53flying_rhinoI thout that here you alter stuff primarily via creating modified (cheap) copies of stuff.
23:53flying_rhino*thought
23:53devn,(let [my-ref (ref [])] (dosync (alter my-ref conj 1)))
23:53clojurebot[1]
23:53flying_rhino(I am new to clojure)
23:53devnliterally (alter)
23:54devnflying_rhino: no, take a deeper look at refs, agents, and atoms
23:54devni think everything you need is right there
23:54dOxxxbasically, clojure does have mutable state
23:54dOxxxit's just mutable state that uses immutable structures
23:54devn(but it's done in a way that doesn't suck)
23:55dOxxxi.e. you have a list that you want to change. you don't modify the list itself, you replace its with a new list that contains the original and the new elements
23:55devnnot a new list per se
23:55devna shared structure
23:55dOxxxyeah
23:56flying_rhinodOxxx: and that is called cheap copy, since it is shared structure?
23:56dOxxxyes since new list is constructed like (head = new item, tail = old list)
23:56dOxxxit doesn't have to make a copy of old list into the new list, it just references it. that's what makes it cheap
23:57flying_rhinothen my description "basically we are using systems to create chaep copies of components (tables) every game tick (that is every quater second)"
23:57flying_rhinois correct
23:57flying_rhinoI specified "cheap" copies. I know those are shared memory structures.
23:57devnflying_rhino: i dont think anyone is arguing
23:57devnflying_rhino: but cheap copies does not immediately imply "persistent hash array mapped tries"
23:58dOxxxI think my point was that it may be "cheap" but it's not "free" :)
23:58flying_rhinodOxxx: so the question is is there too much overhead or not?
23:58dOxxxthat's what testing is for
23:59dOxxxI actually went through something like this a few months ago
23:59dOxxxI had an algorithm for parsing a text file of a fixed format written in Scala, in an mostly imperative fashion using mutable structures.
23:59dOxxxI decided to rewrite it using immutable structures in Clojure.