#clojure logs

2013-08-11

00:19callenMusic for writing Clojure: http://www.youtube.com/watch?v=_aTFLnG3YcY
00:21clj_newb_2345suppose I tag something with "localhost/base"
00:21clj_newb_2345how is it separated between 127.0.0.1:5000/base vs "username localhost" with tag "base" ?
00:26BahmanHi all!
00:27wolfesHello!
00:27callenBahman: hai
00:27BahmanHey wolfes, callen!
00:28wolfesDoes anyone know of a good way to get an aleph server to auto-restart/reload when code changes in development mode?
00:30callenwolfes: prolly hafta to hack it up yourself. That's pretty strange anyway.
00:30callenwolfes: usually you're running and re-running a test harness with something like Aleph. You aren't using that for web dev are you?
00:30callena Guardfile is one option.
00:32wolfescallen: i'm looking to create a simple server that accepts http post requests and forwards messages to specific websocket connections — v1 works (https://github.com/wolfes/nspire), but it uses aleph(http server)+compojure(route), and it doesn't have the nice "lein ring server" possibility that hot-reloads server code on code change
00:32callenwolfes: you should probably consider using http-kit instead unless there's something specifically compelling about Aleph.
00:32wolfesi don't really know that much about aleph and don't have any super compelling reasons to use it over another option :)
00:33callenAleph isn't (ztellman can correct me here) a general purpose web server.
00:33callenhttp-kit is.
00:33wolfescallen: I'll take a look at http-kit though, would you recommend http-kit over ring+compojure?
00:33callenwolfes: er, you're still using ring and compojure.
00:33callenwolfes: do you know what any of these words mean?
00:33callenyou need to take a breather and understand what's going on.
00:34callenRing is the middleware + http abstraction, it's not an HTTP server.
00:34callenCompojure is routes/handlers abstraction.
00:34wolfescompojure handles routing
00:34callenhttp-kit is a web server. Jetty is a webserver.
00:34callenwhen you use vanilla lein ring server, you're firing up a jetty instance.
00:34wolfesah ok, i mistook ring for an http server :)
00:34callenit is decidedly not.
00:34callenit wouldn't make any sense.
00:34callenRing is like Ruby's Rack and Python's WSGI and Perl's Plack and Common Lisp's Clack
00:35callenit's designed to enable tooling that isn't specific to a particular web server.
00:35wolfesring abstracts http into a request map and response map, and gives you middleware
00:35callenit would suck ass if every web library and framework had a homespun web server.
00:35callenwolfes: you don't need to repeat it in here, I know what ring is.
00:35callenI'm sure most others do too.
00:35callenwolfes: use http-kit + ring + compojure.
00:35callenwolfes: read the documentation this time.
00:36wolfescallen: thanks!
00:37callenwolfes: just one thing to be aware of with async libraries like http-kit and and Aleph
00:37callenwolfes: no global state.
00:39wolfescallen: just to clarify, you mean these async libraries don't provide facilities for managing global state themselves right, or that I'll run into some terrible gotcha if I try to manage global state outside of the library?
00:39callenwolfes: well lets work through it.
00:39callenwolfes: async means the code is going to be stopped and started at any given time
00:40callenwolfes: in Jetty, (which is synchronous) you have a thread pool and each http request gets its own thread for processing from that pool.
00:40callenwolfes: in something like http-kit, while a handler is blocking on something else, the thread might get retasked to processing a different request.
00:40callenamong other things
00:41callenthis is why most websocket compatible servers are async, so you can juggle more connections without choking off the machine.
00:41callenwolfes: if you have global state in a thread, what do you suppose happens if that same thread gets retasked to different code?
00:41callenas a result, you should avoid global state (thread local or not) in async code unless you know what you're doing.
00:41callenand if you had any doubt, you don't. So don't do that.
00:45wolfescallen: hmm, the retasked thread would provide access to the thread's global state to the new code and/or the old code, when resumed, may be in a different thread without access to the its previous thread's global state?
00:45callenwolfes: you'd have a state conflict, race conditions, etc
00:45callenBad News Bears (TM)
00:45callenwolfes: have you used a language with threads before?
00:45callenwolfes: where's your book?
00:46wolfescallen: python is my main language now, but the threading i've done in it was for code that didn't have any shared state
00:46callenpython doesn't have real threads anyway because of the GIL
00:47callenroight so
00:47callenwolfes: where's your book?
00:47wolfescallen: i have a pdf of "Clojure Programming"
00:48callenwolfes: you should read it and do the examples.
00:53wolfescallen: I read 1-10, but not the last sections yet, ch16+17 look relevant — i've been using an atom to hold a single point of global state for named message-channels (to avoid race conditions creating new named channels with listeners at the same time), since i don't need multiple identities to change in the same operation (for now)
00:54callen :|
00:54callenwolfes: read and perform the exercises the whole book
00:54callenof the*
00:57wolfescallen: thanks for the advice :)
01:03kristofIs letfn exactly the same thing as let* in Scheme?
01:03kristofAs in, binding everything simultaneously so as to allow referencing between bindings?
01:04kristofI'm learning Clojure coming from Scheme, and I'm really happy to see that the majority of the stuff I know (the VAST majority) is almost exactly the same, and I get some new goodies, too.
01:04callenkristof: simultaneity wouldn't allow for cross-referenced bindings.
01:04wolfeskristof: letfn lets you create a named function closure within your let statement iirc (http://clojuredocs.org/clojure_core/clojure.core/letfn)
01:05john2xdammit am I having a hard time understanding the pedestal dataflow
01:06kristofwolfes, callen, ok!
01:06callenjohn2x: don't use Pedestal.
01:06bts-kristof: i haven't used let* in a while, but i think clojure's let is the same thing. it lets you successively use previous bindings
01:07kristofcool! =)
01:07bts-kristof: i haven't used scheme*
01:07callenit is successive and sequential though.
01:07wolfesbts-: let* lets you swap two variables without creating a third temp var, like python's x,y = y,x iir(scheme)c
01:08bts-wolfes: ah interesting
01:09john2xcallen, yeah I probably shouldn't, just find it really interesting. :P what do you suggest for an alternative to building the client-side of an app with clojure?
01:09wolfeskristof: not entirely sure what your use case is, but you might find trampoline useful (example: http://pramode.net/clojure/2010/05/08/clojure-trampoline/)
01:09callenjohn2x: client-side meaning web app?
01:09john2xyes, simpler alternative to pedestal-app I guess
01:09callenjohn2x: if it's complicated JS + Angular or ClojureScript + Angular. If it's not complicated, and it's probably not, very little JS at all.
01:10callenjohn2x: it's probably not complicated. So just render HTML.
01:10callenstatically.
01:10callenjohn2x: for rendering that - https://github.com/yogthos/Selmer
01:10kristofwolfes: I didn't know that letfn wasn't mutually recursive but I didn't need that to begin with :P I was simply thinking of using previous bindings in later ones, and it turns out it was that.
01:10kristofwolfes: But trampolining looks like the shit and I am so going to use this sometime
01:10callendon't overcomplicate your code.
01:11kristofpffft screw that, that's what LISP is for
01:11callenit's really not.
01:11kristofForgetting about abstraction barriers and making funcitonal spaghetti
01:11kristof*functional
01:11callenit's for making otherwise painful or complicated things doable.
01:11wolfeskristof: just a warning, clojure doesn't optimize non-self-calling tail recursion
01:12kristofwolfes: right, I had a feeling.
01:12kristofwolfes: I'd probably just restructure my logic and use a loop in that case
01:12john2xah cool, so Angular works with ClojureScript. I'm primarily a server-side guy, and whenever I try writing javascript, I always find it terribly ugly.
01:12kristofwolfes: Although how would someone write something like the eval apply loop in that case? :P
01:13callenjohn2x: so don't write JavaScript.
01:13kristofI guess I can look in clojure's core and find out! Haha
01:13callenjohn2x: like I said, static HTML. Keep it simple.
01:16callenjohn2x: shake-n-bake best practices: http://www.luminusweb.net/
01:18akhudekI wish luminus would swap korma for clojure.jdbc
01:18callenakhudek: part of the point of Luminus is the swappability.
01:18callenakhudek: which fits in with the Clojure aesthetic.
01:18callenakhudek: you can swap in whatever you want.
01:18callenakhudek: if you want a luminus sub-template that defaults to JDBC, contribute one.
01:19akhudekcallen: I realize that, but as a "best-practices" recommendation I would prefer clojure.jdbc
01:19akhudekcallen: I often find myself saying "see luminus as a great starting but, but swap korma…."
01:19callenakhudek: I'm the reason it's Korma atm, if you have arguments to make, I'm the person to make it to.
01:20callenthat having been said, since I introduced him to it, yogthos seems to have been satisfied with Korma so far. He's only needed raw sql for a couple of things.
01:20akhudekcallen: the main reason is that korma still has a little too much magic in it. I've still managed to find queries were korma is generating things that don't map to the obvious sql.
01:20akhudekplus there are some dangerous side effects that you might not expect having used sql elsewhere
01:21callenI haven't run into anything egregious or disconcerting yet
01:21akhudeklike returning the entire record on deletion, a killer if you use large binary objects
01:21callenthat's a simple patch.
01:21callen:no-return
01:21callenCome on man.
01:21callenakhudek: this is open source, file issues / send PRs.
01:21callenI'm sure Baranosky would love it if he wasn't the only person writing any code.
01:22callenakhudek: you need to at least document these complaints on the github issues, if not fix them.
01:23akhudekcallen: I have for at least two things, but both were essentially about changing defaults and thus ended up not changing.
01:23akhudekwhich is fine
01:23gcrHey! I'm trying to follow https://github.com/clojure-android/lein-droid/wiki/Tutorial but when I add [lein-droid "0.2.0-SNAPSHOT"] to my (nonexistent) ~/.lein/profiles.clj, running even just "lein2 --version" raises an exception, "java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry"
01:23callenokay, I haven't heard anything sufficiently compelling to switch away from Korma
01:23callenakhudek: but if you run into anything else problematic, if you aren't going to file an issue, please *AT LEAST* tell me in here.
01:24callenI'm always online on IRC and I will see my lastlog and queries.
01:24callenakhudek: if the problems pile up, I'll seriously consider a switch, for now I'm invested in improving Korma when it needs it.
01:25gcrHere's the backtrace and transcript: http://pastebin.com/Atj4SghH
01:26akhudekcallen: sure, didn't realize you were in charge of it now. We've already swapped a lot of code to c.jdbc so won't likely run into anything new. Overall I find the jdbc defaults to work a lot closer to how I'd expect (e.g. much closer to writing raw sql at the console). Now that it has a nice korma-like sql dsl, I don't see the downsides.
01:26callenakhudek: I am decidedly not in charge of it, but I'm very good at convincing/cajoling yogthos to change things. Luminus is his baby and there's another dude that contributed a lot.
01:26akhudekbut as you say, it's not really a big deal
01:26akhudekeasy to swap
01:27callenincidentally, Selmer was also mostly yogthos (thus is being on his github) but I was pushing him along, writing tests, etc there as well.
01:27akhudekthe other weird magic I encountered with korma was something to do with aggregates I think
01:27callenand explaining the performance and design of Django templates.
01:27callenakhudek: Korma is a little weaker on aggregates, partition, etc.
01:27callenThat's a known dilly.
01:27akhudekremember spending hours trying to get it to write the correct sql and being annoyed that it was a query I could write instantly in raw sql. I think that's what first prompted me to switch.
01:28callenakhudek: that's been a common reaction to SQL abstraction layers of all kinds for years.
01:29callenakhudek: the answer is to improve the layer. I like Korma explicitly because it translates pretty closely to the SQL I'd write, just cleaned up.
01:30wolfeswould anyone recommend any libraries over clojurewerkz neocons for use with neo4j's http api (the free, non-embedded edition)?
01:30akhudekcallen: hah, that's an understatement. It took me a long time to get those complaints. I started with clojureql, then moved to korma because of annoying magic, then to jdbc because of the same (though korma is much closer to sql as you say)
01:30callenakhudek: I've been using relatively complicated ORM layers for a little over a decade. Korma is a breath of fresh air and easy to hack for me.
01:31akhudekcallen: Aside from these few pain points with korma, I suppose my argument is more: what does korma offer now, that jdbc doesn't, given the new jdbc dsl?
01:32callenakhudek: the new JDBC DSL is okay. I like it much better than the dumb raw string smashing of yore.
01:32callenI don't hate the new JDBC DSL, but I started using Clojure long before it existed
01:32callenso I was on the Korma train.
01:32callenheh. K(a|o)rma train.
01:35john2xskimmed through all the chapters of the pedestal tutorial. holy shit.
01:35callenjohn2x: just use Luminus.
01:40john2xyeah.. already did a simple project with luminus, though it was all backend with just simple javascript for the client. i guess I could update it to clojurescript as a start.
01:41callenjohn2x: do you need to?
01:42john2xnope. but it'll be a learning experience and fun :)
01:43john2xhmm not too sure about the fun part yet.
01:43gcrnevermind, i found that profiles.clj should contain {:user {:plugins [[lein-droid "0.2.0-SNAPSHOT"]]}} and not just the bare plugin dependency. i edited the lein-droid wiki to say this.
01:51clj_newb_2345on ubuntu, do people use openjdk-7 or openjdk-7-zero ?
01:52callenclj_newb_2345: use Oracle JDK 7
01:52clj_newb_2345callen: as in install via a tgz ?
01:53callenwutevs.
01:54heyloHello
01:54callenheylo: heylo
02:41sinistersnare,(doc when)
02:41clojurebot"([test & body]); Evaluates test. If logical true, evaluates body in an implicit do."
03:51clj_newb_2345so no one else has the stale NFS handle problem with "docker rm" on certain containers?
03:58callenclj_newb_2345: this is #clojure
03:58clj_newb_2345ah, sorry
03:59clj_newb_2345i promise to make up for this in the future
03:59clj_newb_2345when peopel have trouble setting up clojure servers, I'll tell them to use docker :-)
03:59qeduhhhh
04:00qedMaybe he meant: https://github.com/pallet/pallet-docker
04:05callenqed: nope.
04:06callenpeople using docker is hilarious
04:06callenthey're using jails for their apps on jailed VPSes.
04:06qedcallen: whether or not that's the case, he was looking for help
04:06callenmost redundant bullshit I've ever seen.
04:06devn<-qed
04:06callencontainers are for people managing their own instancing on a dedi.
04:06callendevn: how'd you snag the nick qed?
04:07callenI'd have assumed that was taken by now.
04:07callenyou know, like right after "root"
04:07callendevn: he repeatedly forgets what channel he is. I was operating on the basis of "data".
04:07callendevn: as soon as I remind him he's not in the docker channel, he buggers off.
04:07callenhe is in*
04:07devnidk, when i was 16 and without direction I went on a nick hunting spree on freenode, grabbed te and qed
04:08Rayneslol
04:08callenof course it's worth remembering that I don't need data to tell people to fuck off.
04:08devncallen: depends on what you mean by "need"
04:08Raynes$dict need
04:08lazybotRaynes: noun: A condition or situation in which something is required or wanted: crops in need of water; a need for affection.
04:08Raynes^ I expect.
04:09callenpeople don't need affection, unless you are rolling into, "not going postal" into need.
04:09callenpersonally, I think raising the black flag and slitting a few throats is healthy.
04:09devnRaynes: What I mean is that no one strictly requires data, it can sometimes be considered irresponsible to operate without it as a matter of course
04:10callenI'm a nihilist, for me data is just ammo for getting people to stop squawking.
04:10callenI'm going to do what I want regardless.
04:10devnheh, ^-things you're likely only to ever hear on IRC
04:11callendevn: you haven't met me in person. Raynes has though.
04:11callenI'm polite and nice in person, I think, but I still don't really care.
04:11Raynesdevn: I can vouch that he is equally as nihilist in real life.
04:12devnso what's up with clojure and stuff?
04:12devnWhat are you dudes & gals working on?
04:12RaynesI'm writing Elixir because life is meaningless.
04:12callendevn: I'm writing a server defense library for Clojure.
04:12devnhaha
04:12Apage43my funsies project is at the point where I am about to write a parser for a mini language
04:12callenRaynes: nihilist != life is meaningless, it just means there's no inherent/universal meaning.
04:12callenApage43: CFG?
04:12devnApage43: cool! have a repo?
04:12Apage43then again, i could make my users write in edn and not do that
04:13devnRaynes: are you seriously writing a lot of elixir?
04:13callenit's most of what I've seen from him or heard about lately.
04:13callenso I'd vote, "yes"
04:13callenthat and that fucking youtube video.
04:13Apage43callen: nah.. kind of a really light weight math expression language
04:13callenApage43: yeah but is the grammar context free?
04:13Apage43think R-lite-lite
04:13Raynesdevn: I've written https://github.com/Raynes/reap, https://github.com/Raynes/rapture, and I'm working on a website now. If I don't throw my macbook against the wall trying to use simple_oauth2, I might end up writing a lot of Elixir.
04:13callenI'm asking for a Chomsky Hierarchy bro.
04:14callendevn: it's super simple, but I needed it: https://github.com/bitemyapp/trajectile
04:14devnColorless green ideas sleep furiously
04:14callenmy server defense thingy will be out by the end of the weekend.
04:14Apage43probably?
04:14callenApage43: o_O
04:15callenI'm having a hard time coding right now because I'm tired though.
04:15callenand hungry.
04:16Apage43anyway my thing is https://github.com/couchbaselabs/mortimer which is a tool for sifting through the numbers collected from the data-dumps our customer support guys get when Couchbase is acting weird or is on fire
04:17callenthe : separated classpath formatting is not very friendly.
04:17Apage43want to add a way for folks to type expressions "(somestat + otherstat) / overstat" and plot that
04:17callensensible for ${PATH} but jesus guys.
04:17Apage43instead of just the current offering which is the raw numbers or their rates
04:17callenaha, couchbase.
04:17callenI had to shut that daemon down today because it was eating my machine alive.
04:18Apage43miiiight be my fault >.> probably not though
04:18Apage43generally the erlang parts are what do that
04:18callenworking on couchbase has to be annoying sometimes. I hear the weirdest reasons from people for why they still use CouchDB
04:18TEttingerApage43, I think there's an infix math lib for clojure, loading "(somestat + otherstat) / overstat" as a string
04:18Apage43I work on the C parts
04:18callenApage43: it was a long running instance, but yeah, it was taking more than it's fair share of my laptop.
04:18callenlike 10-15% of 4gb
04:18TEttingerhttp://data-sorcery.org/2010/05/14/infix-math/
04:19callendamn you, I was googling so I could be the hero.
04:19callenApage43: isn't Couchbase C++?
04:19Apage43TEttinger: interesting.
04:19Apage43I'm already pulling in incater so
04:19TEttingercool beans
04:20callenApage43: what got you into Clojure if your day-to-day is C/C++?
04:20Apage43callen: Parts. It's memcached on the frontend + C++ in the caching layer + C in the storage layer (my part)
04:20callenlawd.
04:20callenApage43: Couchbase is CP right?
04:20Apage43callen: I've been using Clojure since before I was at Couchbase.
04:20Apage43yes
04:21callencool
04:21callenApage43: I probably mentioned before that I used to work on a big couchdb cluster.
04:21Apage43it's just what I use when I am doing something that I get to pick what I do it in =P
04:21callenand by work on, I mean by brutalized by.
04:21Apage43mostly for tools and stuff
04:21callenthat's very cool.
04:22callenfor some reason a lot of the C programmers I know are fuddy-duddies and don't use anything newer than C89.
04:22callenexcept for the one guy that switched to doing iOS mobile dev.
04:22Apage43I refuse to use a language that hasn't been updated since I've been born
04:22Apage43(which is why my C project recently became C++, since we've decided it has to work on MSVC which won't support C99)
04:23callenRaynes: do you know if most people use rainbow parens in here?
04:23sinistersnare,(doc if)
04:23clojurebotCool story bro.
04:23callenI've been pondering why I don't seem to need paredit yet everyone else here does.
04:23RaynesI think most don't, but I have no scientific data to back that up, callen.
04:24RaynesMost people seem to despise rainbow parens.
04:24callensinistersnare: there is clojure documentation online. are you unable to use http due to a proxy?
04:24callenRaynes: really? they're quite wonderful.
04:24callenRaynes: I use them and I'm friggin' colorblind.
04:24sinistersnareno, ill look it up online
04:24callendevn: see? I was thoughtful about it and checked to make certain he didn't have some sort of extenuating circumstance.
04:25TEttingerI love rainbow parens
04:25TEttingeruse them in light table
04:26Apage43everyone who uses the crap out of paredit says they mostly use slurp and barf, which I pretty much never use
04:26Apage43I tend to use splice and wrap a lot though
04:31callenif limit-break didn't work
04:32callenI would probably cut my wrists.
04:32callentechnomancy: why isn't limit-break on clojars?
05:27callenwell I finally got nrepl ritz to work. sorta.
05:27callenshit's kinda spooky but whatever.
05:27callenI'm going to need it for a future project.
05:45samratif I want to upload a large file with clj-http is there a way to do it without loading that file into memory?
05:59FoxboronRaynes: is famine a web framework'ish/server thingie written in elixir?
06:00callenyeah okay I take that back
06:00callennrepl-ritz is still batshit
06:01callenmeanwhile over in Common Lisp they have a real debugger in their Emacs :\
06:06samratare there any examples using clojure.java.io/input-stream for sending multipart post requests with clj-http?
06:17RaynesFoxboron: Nope.
06:18RaynesFoxboron: It's a web app.
06:18RaynesIt's literally impossible to make a guess at what it'll do yet since I've implemented exactly zero functionality (what's there is oauth experimentation at the moment).
06:18RaynesAll the information currently to go on is the name, which certainly isn't helpful. :p
06:29callenI am scowling so hard right now. https://github.com/noir-clojure/noir/blob/master/src/noir/request.clj
06:30callenmy face might get stuck in this scowl.
06:30callenmy needs may call for a macro.
06:31calleneverybody hold onto something bolted down, dis gon b gud
06:36FoxboronRaynes: yeah, so much more specefic then :
06:36Foxboron:3*
08:36dotemacsHi, I'm running this little snippet, but for some reason, the exception is not getting caught: https://gist.github.com/6204633
08:37dotemacsAny hints as to why ?
08:37dotemacsThanks
08:41IamDrowsydotemacs: only the first matching catch block will be executed. so the FileNotFoundException is already catched by the catch Exception block... if this is what you mean by not getting caught
08:42dotemacsIamDrowsy: no, I mean the following, regardless how many catch blocks I have none of them catch the exception. Even if I have just a single (catch Exception e (prn "error 0")) it gets ignored
08:43dotemacsand the exception still dumps
08:43dotemacsSo lets say I just have this: https://gist.github.com/6204656 the exception gets ignored completely. How come ?
08:44IamDrowsymh.. but you are sure the exception is thrown? i just created a mock run-main that just throws an exception and it works like it should
08:48dotemacsok, i'll show you the real code, it's here: https://github.com/technomancy/leiningen/blob/master/src/leiningen/run.clj#L100
08:49dotemacsI've removed the 'apply' and I'm trying to run just the smallest part of that function
08:54dotemacsIamDrowsy: does it make sense to you ?
08:54IamDrowsyso first guess would be that the exceptions are already caught inside the run main (and are not rethrown as you can see)...
08:55IamDrowsydepends on the implementation of catch and throw
08:57dotemacsgood point, thanks
09:52ziltiSometimes I don't really grok how binding works. Why does this example here fail? https://www.refheap.com/17503
09:54ambrosebszilti: should be (assert *dynvar* "Error!")
09:56ziltiambrosebs: ...oh. Wow. Thanks! Sometimes I hate my brain...
09:56ambrosebs:)
09:57IamDrowsyzilti: or at least (assert (not (nil? *dynvar*)) "Error!") if you really want only nil (and not false) to fail (you missed the '?')
09:57ziltiThat's a typo that the ? is missing
09:58zilti...hmm but wait. Then it still doesn't solve my problem.
09:59IamDrowsynil means nil and is no fn.. nil? checks if something is nil
10:01ziltiThat's so weird. That small example I posted works, but in my code it doesn't...
10:04ambrosebszilti: do you have a link?
10:05ziltiambrosebs: I just found out what doesn't work, I updated the snippet: https://www.refheap.com/17503
10:06ziltiI somehow understand why, but not how to elegantly work around that
10:06ambrosebsmake wrapper2 a macro
10:06ambrosebsit should be a simple with-* macro
10:07ambrosebs(defmacro with-wrapper2 [test & body] `(binding [*dynvar* ~test] ~@body))
10:08ziltiYes, that works. Thanks!
10:08ambrosebscool
10:09zilti,(inc ambrosebs)
10:09clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ambrosebs in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:09zilti...wrong channel I guess
10:09ambrosebs(inc ambrosebs)
10:09lazybotYou can't adjust your own karma.
10:10hyPiRion(inc ambrosebs)
10:10lazybot⇒ 1
10:10ambrosebs(inc ambrosebs) (inc ambrosebs)
10:10lazybot⇒ 1
10:10ambrosebs:)
10:10zilti:)
10:10hyPiRionhuh, no karma? that was unexpected.
10:10hyPiRion(identity hyPiRion)
10:10lazybothyPiRion has karma 20.
10:10hyPiRionhrm.
10:11gavrihow do I use list comprehensions in clojure to generate all m-length lists possible from a sequence of length n, both with and without replacement?
10:12gavriI mean, both permutations and combinations
10:13ambrosebshave you looked at https://github.com/clojure/math.combinatorics
10:14ambrosebsI don't particularly know if it solves your problem.
10:14gavriambrosebs: thanks, I think it does
10:17gavrialso, I guess I wanted permutations and selections
10:17gavrithanks again. that library is what I wanted
10:28gavriis there a shorter way to find the most frequent element in a sequence than calling frequencies on it and picking the map entry with the highest value?
10:29hyPiRionurgh, always forget this paredit command. Anyone remembers how to go from (foo [x y z] (bar |...)) to (bar (foo [x y z] ...)) ?
10:30FoxboronhyPiRion: http://www.emacswiki.org/emacs/PareditCheatsheet
10:31hyPiRionFoxboron: it's unfortunately one of those not on that sheet if I remember correctly
10:31Foxboronyeah, was looking. Didn't see it.
10:32gavrispeaking of paredit, I use evil on emacs. does paredit make sense with evil?
10:32ambrosebsI don't use paredit, but is this paredit-convolute-sexpr?
10:32ambrosebsJust recognise it from the recent posting on clojure ml
10:33hyPiRionambrosebs: Yeah, that's it. Thanks :)
10:33hyPiRion(inc ambrosebs) ; for real this time
10:33lazybot⇒ 2
10:33ambrosebshaha
11:15TimMchyPiRion: Bonus: You can use C-u to change the number of levels you're... convoluting.
11:16hyPiRionTimMc: If I need that I seriously need to reconsider my Clojure/lisp skills.
11:17hyPiRionThat's neat though, I'll keep it whenever I figure out I am horrible at Clojure.
11:17TimMcI've used it once or twice.
11:18TimMcBoth times I think for lifting a let outside several layers of doseq, for, or binding.
11:19hyPiRionTimMc: oh right, so it's not flipping the paren, it's just raising it up
11:19hyPiRionI though (foo (bar (baz ...))) would become (baz (bar (foo ...)))
11:20hyPiRionI realize in hindsight that it would make no sense to have that.
12:40noncomI have a question on optional args to a macro, here it is: https://www.refheap.com/17506
12:42ziltinoncom you have to do & [{:as features}] instead
12:43noncomzilti: looks like it does not work this way... i'm getting IllegalArgumentException Don't know how to create ISeq from: clojure.lang.Keyword clojure.lang.RT.seqFrom (RT.java:505)
12:44noncomlike it is trying to treat :width as a []
12:44noncomi think so
12:44ziltiThat would be weird...
12:45noncomcould copy-paste the reafheap with the changes, maybe i'm missing something..
12:48ziltiOh for me "[name- params & {:as features}]" works as expected.
12:50ziltinoncom: ~features is enough, no need to unsplice with ~@
12:51noncomzilti: oh, you are right, looks like the @ was unnecessary
12:51noncomstill learning macros
12:52noncomwhat is ~@ good for?
12:53muhoononcom: splicing in a whole form
12:53hyPiRion,`[~@[:unsplicing :lists :and :vectors, :etc]]
12:53clojurebot[:unsplicing :lists :and :vectors :etc]
12:54noncomi see, thanks! the official docs seem a little scarce on this
12:54noncomor maybe the problem is that english is not my native language. sometimes i have to ask people of very basic things that are already written somewhere...
13:00TimMcnoncom: What you'll often see is [... & body] as arugments to a macro, and then ~@body in the macro's own body.
13:01TimMcThat allows the macro's caller to have a multi-expression body, useful for side effects.
13:17hyPiRionoh great
13:33shafirehi
13:33shafiredoes anyone know a fastcgi implementation?
13:35wolfesshafire: possibly this? http://pepijndevos.nl/the-perfect-server/index.html
13:35wolfeshttps://github.com/pepijndevos/fastcgi-ring
13:37shafireyeah, thanks
13:40juxovec /join #ruby
14:13shafirewolfes: do you use ring?
14:29wolfesshafire: i've just recently started using ring
14:32shafirewolfes: which serve-protocol do you use?
14:52wolfesshafire: (websocket clients + http api) — http-kit server — ring — compojure is my server's current stack
14:53glosoliHey, I am using nREPL with Clojure mode in Emacs, kinda curious, there is some interesting behaviour I get when I do function calls in nREPL buffer, it shows me at the bottom the parameter I am expected to write for that function call, any ideas how I can get the same behaviour while writing function calls in Clojure code buffer?
14:53wolfesshafire: project is here if you want to look at it: https://github.com/wolfes/cmdsync
14:55ziltiglosoli: That is eldoc-mode.
14:56wolfes^^ is there a plugin that does that for vim?
14:56ziltiglosoli: add this to your config: (add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode)
14:57glosolizilti: thanks !! :)
14:59ziltiArgh, macros + dynamic binding seems to be pretty much impossible with clojurescript...
15:01shafirewolfes: which ide do you use?
15:12ziltiCan't "case" handle symbols?
15:13bbloom,(case 'y x 1 y 2 z 3)
15:13clojurebot2
15:13bbloomseems to work :-)
15:14zilti,(case (symbol "a") (symbol "a") :a (symbol "b") :b)
15:14clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate case test constant: symbol>
15:19hyPiRion,(case (symbol "a") a :a b :b)
15:19clojurebot:a
15:19hyPiRion,(case (symbol "b") (a b c) :foo d :bar)
15:19clojurebot:foo
15:38toxmeisterhowdy! quick Q about cljsbuild: does anyone know if the current version supports Closure compiler's property map export? Or more generally speaking, is there a way to pass any other currently unsupported args (by cljsbuild) to the closure compiler?
15:59H4nsis @ an operator? i'm looking at the http-kit client documentation and it seems as if @ is used to force a future? any pointer would be appreciated.
15:59bbloomH4ns: @x is shorthand for (clojure.core/deref x)
15:59bbloom(doc deref)
15:59clojurebot"([ref] [ref timeout-ms timeout-val]); Also reader macro: @ref/@agent/@var/@atom/@delay/@future/@promise. Within a transaction, returns the in-transaction-value of ref, else returns the most-recently-committed value of ref. When applied to a var, agent or atom, returns its current state. When applied to a delay, forces it if not already forced. When applied to a future, will block if computation not complete. When app
15:59H4nsbbloom: thanks!
16:01ivan,'@x
16:01clojurebot(clojure.core/deref x)
16:04bbloomH4ns: ah yes, ivan demonstrates how to solve this problem on your own
16:04bbloomalthough it can *sometimes* trick you:
16:04bbloom,''x
16:04clojurebot(quote x)
16:04bbloom,'''x
16:04clojurebot(quote (quote x))
16:09ziltiIs there a tool to get from the line in a js-file back to the line in the cljs-file?
16:21sandbagsanyone here know of a better introduction to Pedestal than the tutorial from pedestal.io wiki?
16:22kmicusandbags: you can try https://github.com/taylorSando/pedestal-todo/blob/master/beginners.md but pedestal-app-tutorial is the best IMHO
16:22sandbagskmicu: thanks... that's a shame
16:22kmicuno, no shame
16:23kmicupedestal is like a monad
16:23sandbagsi'm too tired to tell if that was humour zinging over my head
16:23kmicuif you break a barrier, it is very simple (not easy, but simple)
16:25sandbagswell to each their own
16:25kmicuComparative Literate Programming?! soo sweet
16:26sandbagswas that a question? a statement? a philosophy?
16:27ziltiIt seems like pedestal is just pretty much a collection of some clojure/clojurescript libraries out there - so what's the point of using it instead of the libraries and losing flexibility?
16:27kmicuExcitement for a next blog post by dnolen
16:28sandbagszilti: in general there may be value in assembling a set of libraries into an overarching framework, if you select the components well and provide a useful context/glue for them
16:28sandbagsflexibility is a two edged sword
16:29sandbagsi'm not offering that as a justification for pedestal btw... i've no idea if it's any good or not
16:29ziltiI looked at their webpage, and there isn't even an API documentation or a proper overview of what's included, so I closed the tab again :D
16:29ziltiAwesome. "Error: Invalid arity: 1". Thanks, ClojureScript, how meaningful...
16:30kmicuYou can always use elm instead.
16:31sandbagszilti: i thought i'd at least try the tutorial ... i think they used the wrong word though
16:31sandbagsi believe confusamajig would have been a more appropriate term
16:32ziltisandbags: I just don't really have a need for it currently, I'm happy with my plugged-together libraries
16:32sandbagsi've not settled on a way of building web apps with clojure and thought it looked worth a look
16:37sandbagsman what a lot of gobbledegook
16:37kmicuit's a monad
16:37kmicusrlsy
16:42zilti*sigh* debugging clojurescript is such a pain in the ass...
16:43ziltiespecially when macros are involved
16:43kmicuand we can improve that with complaining! yey!
16:44sandbagskmicu: my guess is that zilti is just looking for a little fraternal acknowledgement that some things are just a pain in the ass
16:44sandbagsas someone who has attempted a little ClojureScript I can empathise with him
16:45sandbagseither that or we could turn that lense on your own response?
16:59sisciaI have a weird question: it is possible (if yes how) to get as string the value of a print-dup ?
17:01siscia(something like this: clj-time.print-dup-test> (def u (print-dup {:a :b} *out*))
17:01siscia{:a :b}
17:01siscia#'clj-time.print-dup-test/u
17:01sisciaclj-time.print-dup-test> u
17:01siscia#=(clojure.lang.PersistentArrayMap/create {:a :m})... )
17:02bbloomsiscia: bind *print-dup*, then use with-out-string
17:05sisciawonderful, thank you so much
17:15bosiewhats the proper way of handling access control for users in clojure?
17:15bosiei could hardcode with if-elses and hardcode getting the data to evaluate the if-elses... but...
17:17siscia?
17:18bosiesiscia: for example, in a routine i do things differently depending on the state of the user
17:19sisciamultimethods ?
17:19bosiesiscia: if the user logged in in the last 4 weeks and has 5 documents up, i do ABC. if its the first time, i do BCD. in another method its about payments
17:20bosiesiscia: hm. thought more about core logic to be honest
17:20sisciabosie, humm... let me think...
17:22sisciabosie, you have some "state" (like logged in in the last 3 days and n documents is the sate A, or first time is the state X, or no document is the state C)
17:22sisciayou have to define in what state is the user somehow
17:22bosiesiscia: technically i can (and will) have a lot more states
17:22bosiesiscia: and then i combine those states
17:23sisciabosie, ok, but my point is another...
17:24sisciabosie, you first define the state of your user and then you apply the right function
17:24bosiesiscia: correct
17:24bosiesiscia: now the question is how ;)
17:24sisciabosie, how you define the state is your real problem
17:25sisciabosie, (how you apply the function I will just use multimethods, IMHO
17:25sisciabosie, (how to apply the right function I will just use multimethods, IMHO
17:25ziltiI have this one-line macro that fails me... https://www.refheap.com/17507 Can anyone tell me what's wrong with it?
17:25bosiesiscia: i dont see how
17:26bosiesiscia: even if i define nested states, i have say 100 states. in one particular function i chose 6. one of the 6 is valid on a particular user.
17:29sisciabosie, (defn get-state [user] (vodoo-magic-here)) (defmulti function get-state) (defmethod :state-a [user] (f user)) (defmethod :state-b [user] (g user))
17:29bosiesiscia: well. get-state should be what though?
17:29bosiesiscia: if get-state has another if-else ... it kinda defeats the purpose
17:30sisciabosie, well, this depends on your data...
17:30sisciabosie, one way could be to use logic.core
17:31bosiesiscia: e.g. if profit > 10000 and currently 12 items in the store ELSE IF no sold item ELSE IF no item in store ELSE...
17:31sisciabosie, another could be match.core
17:31bosiewith your method (and correct me if i am wrong) you are basically pushing the if statement into the get-state, no?
17:32sisciabosie, https://github.com/clojure/core.match
17:32bosieyup
17:32sisciabosie, yeah, you can see it like that...
17:34bosiesiscia: prolog-like sounds interesting
17:34sisciabosie, you mean the core.match ?
17:34callenbosie: didn't you do golang before?
17:34bosiecallen: no, have never looked at golang. why?
17:35bosiesiscia: no, the other one you mentioned: https://github.com/clojure/core.logic
17:35bosiesiscia: just realized that logic.core isn't core.logic most likely ;)
17:35bosiecallen: why?
17:35bosiecallen: R, ruby, java for me
17:35callenbosie: your nick is the same as somebody who was briefly prominent in that community.
17:35callenwrote web stff for golang.
17:35callenstuff*
17:36bosiecallen: i wish i was prominent in ANY language really. but no :/
17:36bbloombosie: just start making stuff :-)
17:36bosiebbloom: indeed. so easy ;)
17:37callenbosie: no really, that's what Raynes did for the most part.
17:37bbloombosie: it is! you surely make stuff all the time. half your hacker news and reddit intake, then refocus that extra time on a little thinggie to make. and if it's neat, polish it up and ship it
17:37callenbosie: I'm making a defense library for Clojure right now.
17:37bosiebbloom: ouch
17:37bbloomdo that 5 to 10 times & you'll be "prominent" :-)
17:37callenbbloom: and what time you do spend on HN and Reddit, spend it posting your libraries and explaining them.
17:38bosiecallen: defense?
17:38bosiecallen: i actually block HN and reddit now
17:38callenbosie: you're a rubyist so you should understand the analogy - "Rack::attack"
17:38bbloombosie: i just assume everyone who isn't prominent somewhere spends too much time on some site. b/c that was m problem :-)
17:38bblooms/m/my
17:38bosiecallen: ok
17:38callenbbloom: or vidya games.
17:38bbloomyeah, that too
17:38ziltiI have this one-line macro that fails... https://www.refheap.com/17507 Can anyone tell me what's wrong with it?
17:38bosiebbloom: and now you are prominent?
17:39bbloom*shrug* i'm at least not anonymous
17:39bosiebbloom: well done ;) what you prominent for?
17:39gfrederickshe concatenates
17:39bbloomgfredericks: heh :-)
17:39callenbosie: he's really into trees.
17:39callener, branches.
17:40sisciazilti, replacer is suppose to be a macro ?
17:40ziltisiscia why, should it? It's just a helper function called from the macro
17:41sisciazilti, I have never seen before ~@ inside a function...
17:42sisciareplacer form itself works ?
17:42ziltiYes
17:42ziltiIt does exactly what it is intended to do
17:42siscia(defn replacer [table f]
17:42siscia (if (list? f)
17:42siscia (case (first f)
17:42siscia form `(apply ~sform ~table [~@(rest f)])
17:42siscia field `(apply ~sfield ~table [~@(rest f)])
17:42siscia f)
17:42siscia f))
17:42sisciaopss, sorry
17:42sisciaanyway, nope
17:43sisciathat function does not even compile
17:43bosiebbloom: Brandon Bloom Consulting. how is that treating you if i may ask
17:43bbloommsg me if you're interested in hiring me :-P
17:43bosiebbloom: hah yea no
17:43ziltihere it does compile
17:43callensiscia: please use Refheap next time you need a paste.
17:43bosiebbloom: mostly because i have no work. otherwise you would be my topchoice ;)
17:44sisciacallen, sorry it was a mistake
17:44sisciazilti, honestly, where in the scope of such function is defined ~sform ?
17:45callensiscia: s'okay. jus' sayin'
17:45bhaumanzilti: I don't see how replacer can work as defined
17:45ziltisiscia sform is a variable in the same namespace that contains a (fn ) form, but that is not even relevant here
17:46sisciazilti, that makes sense... anyway, the use of form such as ~ ` and ~@ inside a function is beyond my knowledge...
17:46ziltisiscia Try to "(replacer "test" '(form "asdf" "qwertz"))"
17:47zilti~ ` and ~@ work exactly the same inside a function as they do inside a macro
17:47clojurebotis there a function that is somewhat similar to partition, except that it creates a max number of groups based on a number
17:48gfredericksclojurebot: no
17:48clojurebotno is tufflax: there was a question somewhere in there, the answer
17:49sisciazilti, sorry but I don't get it, what is the point of ~@ inside a function ?
17:50ziltisiscia what's the point of ~@ inside a macro?
17:50hyPiRionboth ~ and ~@ are just syntactic sugar, which isn't strictly speaking needed in Clojure
17:51hyPiRionSame applies to [], {}, #{}, @, etc.
17:51hyPiRion(Granted, it would be a bit harder to work with)
17:51bbloomhyPiRion: actually, the collection syntax is subtly different than the ~ and ~@ syntax
17:51ziltiAnyway, I just found out how it works: (defmacro with-table [table & body] (prewalk (partial replacer table) `(quote ~body))) Though that looks like a very ugly hack
17:52bbloomhyPiRion: ~ and friends are really just sugar, but the data structure literals are self-evaluating and encapsulated, such that you can pass them through to macros, for example
17:52kmicuone big hacky nonidiomatic hack
17:52bosiesiscia: thanks
17:53ziltiThough that's the only solution I could find for that
17:53sisciabosie, :)
17:54hyPiRionbbloom: Well, yeah. Perhaps I should be a bit more careful saying "just" syntactic sugar.
17:54sisciawell, this is the first time that I see such sugar inside a function...
17:57kmicuWe must go deeper inside a function, Mr. Cobs. - Are you talking about syntactic sugar?
17:59sisciakmicu, I am ? Yes...
18:00kmicuIt is not real. It is a one big hack. We must wake up!
18:02sisciastill I am curious how it can work...
18:03zilti,((fn [x] `(1 ~x 3)) 2)
18:03clojurebot(1 2 3)
18:04callenhrm. multi-arity macros. hrm.
18:05ziltihmm what could cause a "java.lang.IllegalArgumentException: No method in multimethod 'emit-constant' for dispatch value: class clojure.lang.LazySeq"?
18:06callenso probably not.
18:08sisciazilti, you are probably using too many macros...
18:08ziltiI'm using exactly one
18:09sisciaI guess it happen something like: (emit-constant clojure.lang.LazySeq)
18:09sisciazilti, where clojure.lang.LazySeq is the class itself... not sure about though...
18:11zilti...hmm now the error just disappeared
18:11lgs32aare there good reasons to learn haskell when you are a happy with clojure? asking those who came to clojure from haskell.
18:12callenlgs32a: I technically learned some Haskell before Clojure
18:12callenlgs32a: I say technically, because I'm not convinced any one person truly "knows" Haskell except for SPJ
18:12lgs32ahaha
18:12callenlgs32a: Haskell will force you to learn things that Clojure merely makes "available"
18:12siscialgs32a, good question...
18:12callenit also has a way of reifying types and making you think in terms of types that can be very education
18:13callenI would never ever use Haskell to actually *make* anything, but it's excellent for learning.
18:13callenClojure makes most of the same FP niceties available (modulo core.typed), but I can actually enjoy making useful things.
18:14sisciahaskel : clojure = C : python ???
18:14lgs32awhat i am interested in to go more deep in terms of function composition
18:14lazybotsiscia: Oh, absolutely.
18:14callenlgs32a: Haskell does a lot more than function composition, haha
18:14callenyou'll be writing monad transformers in like a week
18:14bbloommonad transformers *cring*
18:14callenI see bbloom knows my pain
18:15bbloomcallen: http://lambda-the-ultimate.org/node/4786
18:15lgs32ahm. what is the clojure equivalent to a monad transformer?
18:15bbloomlgs32a: side effects.
18:15lgs32amhm
18:15callenlgs32a: I'll tell you what man, I think Clojure is a practical choice and that Haskell's a good way to learn. If you want to learn, go forth and learn, If you're happy with Clojure, that's cool too. I could even give you some ideas for things to explore in Clojure that cover some of the territory Haskell covers.
18:16callenspeaking of side effects, I just got done making my CMS in Clojure side-effect free.
18:16callenit's an improvement, but I have more macros to write to cleanup Compojure stuff.
18:18lgs32aok
18:18callenwell more accurately, thread-local state free
18:18lgs32amy motivation would basically be to learn about monads, functors and arrows
18:18callenbut it's all immutable data getting passed around
18:18callenlgs32a: you can do those in Clojure, but Haskell will teach them far better.
18:18callenbecause it won't allow you to fuck up.
18:18callenThe compiler will fwack you in the head with a wiffle bat until you "get" it.
18:19lgs32ayeah i have played around with haskell a bit before i came to clojure
18:19callenI don't think there's much more to be said here. Learn it or don't.
18:19callenNobody's going to push you out of the nest. Do as thou wilt (shall the whole of the law...)
18:19lgs32ahehe
18:19lgs32athank you for sharing experiences
18:20callenapropos: http://www.willamette.edu/~fruehr/haskell/evolution.html
18:20lgs32a:)
18:21callenbbloom: I want to like this, but so many EDSLs in Haskell have turned out to be the puzzle box from Hellraiser.
18:22lgs32ahaha that link is quite entertaining
18:22bbloomcallen: IMO, haskell requires at least a dozen compiler extensions to reasonably incorporate the last 20+ years of research. w/ SPJ stepping down, it's time for some new attempts. effect systems are gonna be the next frontier
18:23bbloom10+ languages will show up wit ever more powerful effect systems & then some committee will make the next haskell-ish language
18:23callenbbloom: the amount of effort it takes just to catch Haskell up with the last 50 years of (not types) compile-time metaprogramming is absurd
18:23callenand the result is vomit inducing.
18:24callenI'd rather take a circular saw to my taint than figure out broken Template Haskell again.
18:24bbloomonce again oleg & friends got you covered: http://okmij.org/ftp/meta-programming/index.html
18:24callenthe Haskell community is collectively a useful idiot to steal nifty things from.
18:24bbloomsee MetaOCaml & MetaHaskell
18:24bbloomyeah, that's basically how i view haskell
18:24bbloomthe fact that anyone runs it in production is entertaining to me :-P
18:25callenHaskell is all about "coulda" not about "shoulda"
18:25callensecondarily, it proves my ongoing point that just because you technically can do something, if it's painful, nobody will bother.
18:26lgs32ai must say when i came from c++ to play around in lisp the typelessness was a relief
18:26callenwhen I was actually a CL user, I would've killed for const correctness
18:27callennow that just comes basically for free with Clojure without any real effort.
18:27lgs32aalso true
18:27lgs32ai never thought about it
18:27lgs32abut its gone
18:28callenlearning to constructively think with types, especially in something like Haskell, can be transformative to how you model software
18:28callenespecially since it's not a shitty dumb nominative type system, it can be used to represent generic "structure"
18:28lgs32ayeah i will certainly check out more haskell in my free time
18:28lgs32ajust to keep the head spinning
18:29callenI would kill for an earthquake that didn't crash.
19:26coventry`*ns* and (all-ns) aren't working for me in the pedestal cljs repl. Is that the right way to interrogate namespaces in clojurescript?
19:27callen(dec coventry`)
19:27lazybot⇒ -1
19:27callenfor using pedestal.
19:28coventry`Well, I am just learning it, not actually using it at this stage. I am very interested in hearing any objections to it.
19:29callenover-complicated, bunch of breaky magic that doesn't make very much sense, contributes little to no value to typical web apps, splits client-side and server-side in a *really* annoying way.
19:29callenbunch of complexity for net-negative return on investment.
19:32coventry`Thanks. I'm going to keep working through the tutorial because I'm actually learning a lot from it, but I can see a plausible case for some of what you say. (The rest I'm too ignorant to assess.)
19:33coventry`I'm still interested in the way to interrogate namespaces in clojurescript, too.
19:33dnolencoventry`: I would ignore callen and come to your own conclusions about pedestal. as to namespaces, many REPL niceties are missing in CLJS - mostly because no ones really worked on it.
19:34callencoventry`: I don't use Luminus directly, but it's a good representation of good Clojure web practices. Compare and decide for yourself.
19:34callendnolen: I didn't say not to come to your own conclusions, just that using it is a bad idea if you want to ship.
19:35coventry`Gotta run, will be back in 20 min or so.
19:39chordwhy should I use clojure over haskell which is statically typed
19:40callenchord: you shouldn't. Haskell all the way bro.
19:40chordso you use haskell over lisps
19:40callenyes I use the Haskells all the times.
19:40chordyou making fun of me?
19:40callenI use the haskells in beds, in the showers, and in the offices.
19:40callenchord: no, Haskells is serious businesses.
19:40wolfes(inc callen) ; thanks for the advice last night, I replaced aleph with http-kit server and things make much more sense after getting farther into the docs :)
19:40lazybot⇒ 1
19:40callenwolfes: <3
19:41chordso why are you in this channel i nstead of haskell
19:41callenchord: to save people from the sins of dynamic typing.
19:41callenwolfes: I actually just got done fixing up my CMS to not use thread-local state so that it could be http-kit compatible.
19:42callenI ended up writing a nifty macro that captures enclosing fn data into the rendering function so that I don't have to manually chain the request data.
19:42wolfescallen: awesome! is it somewhere visible that i can look at?
19:43callenwolfes: have a ball: https://github.com/bitemyapp/neubite/
19:43callenI put it up so that people could see a practical Luminus-esque web app.
19:43wolfescallen: thanks :) what's the macro called?
19:43callenwith auth, database access, and a basic CMS
19:43callenwolfes: render-template
19:44chordso you think haskell is the best statically typed functional language?
19:45callenchord: I think the haskells is the best programming languages evers mades.
19:45callenchord: all true hackers write Haskells.
19:45chordYOU STOP MAKING FUN OF ME
19:45callenI'm not making funs, the Haskells are the way and the light
19:46callenin fact, if I were making funs, I'd be writing Erlang!
19:46callenhttp://www.erlang.org/doc/programming_examples/funs.html
19:46callensee ^^ funs! Being made!
19:46dnolenchord: callen an be trollish, best to ignore him until your more familiar w/ his communiation style.
19:46callendnolen: chord's actually been trolling this channel for over a week
19:46callendnolen: and constantly asking about Haskell
19:47chordcallen making up shit now
19:47callendnolen: he also privchat'd me ~8 days ago to ask me perverted questions about my sexuality and insult me.
19:47callenchord: I have logs d00d.
19:47chordI can fabricate logs too
19:47callendnolen: I'm just back-trolling. I was initially polite.
19:47callenchord: there are public logs that don't belong to me.
19:47chordso you admit the private msgs were all madeup?
19:48callenno, they happened, but I can prove part of what I said.
19:48callenthat you're even trying to debate it in this manner proves my point.
19:48callenyou're a troll.
19:49Bronsacallen: just /ignore him
19:50callenBronsa: I'd rather prevent him from wasting anybody else's time
19:50callenBronsa: by cherry-picking him, I rescue other people from taking him seriously
19:50chordyou can't stop me from using haskell
19:50callenbecause I'd rather play linebacker than see other peoples' time wasted.
19:50callenchord: I wouldn't dare - you should use the Haskells.
19:51callenBronsa: this I must do in the absence of any real moderation.
19:51Bronsakeep up the good fight then.
19:51bbloomcallen: you're fighting ICBMs with antiballistic missiles. Have you considered diplomacy? It's much cheaper in the long run.
19:52callenbbloom: sociopaths can't be reasoned with.
19:52callenbbloom: chord's not the only one, there's a sex offender that frequents this channel and wastes peoples' time with idle speculation all the time.
19:52callenI hijack him when he starts misbehaving too.
19:53chordomg how can you compare me to a sex offender
19:53bbloomnot everybody is fond of your policing tactics
19:54callenbbloom: my parents had a rule where if I let my room get too messy, they got to make it clean with the indiscriminate use of garbage bags.
19:54callenI wouldn't have to lift a finger otherwise.
19:54bbloomnobody is interested in your family's parenting tactics either
19:55bbloombelieve me, the folks in this room can handle a troll without counter-trolling. especially without your particular brand of it
19:55callenI can leave chord alone, but the sex offender I'm not going to stop driving off.
19:55callenalso aforementioned just privchat'd me about my parents abusing me. lol.
19:56wolfescallen: nice render-template macro :)
19:56callenwolfes: thanks, it's not really hygienic but works fine in the presence of a contract that the request must always be available.
19:57wolfesnod
19:57callenwolfes: I'm writing a macro to clean up the repetitious Compojure routes right now.
19:57callenwhich will also serve to make the contract moreautomatic.
19:58callenbbloom: http://i.imgur.com/KFR6caY.png
19:58callen(my server is UTC)
19:59wolfeswhat do you see as repetitious about compojure routes? (I've only needed 2 routes so far and haven't gotten to the point where i could experience this)
19:59callenwolfes: ...did you look at the routes in admin?
20:00wolfeslooking
20:00callenmaybe I have a high standard for brevity and clarity but: https://github.com/bitemyapp/neubite/blob/master/src/neubite/routes/admin.clj#L100-L111
20:00callenwolfes: no need, I highlighted for you ^^
20:00callenwolfes: only about 30% of that is unique, useful information
20:00callenthe information density of the code sucks, it's not DRY
20:00wolfescallen: ahhh wow
20:01zilticallen isn't that what routing/context was made for?
20:01callenzilti: context isn't nearly powerful enough.
20:01callenI want to bake it down to :preprocess [superuser-only] and (GET "route/blah" handler)
20:01callenzilti: I have used context in the latest version of the CMS to clean up *some* of it, but it's not good enough.
20:01chordcallen: all those remarks I made were true
20:02callenchord: so you admit you're an abusive troll.
20:02callendnolen: bbloom ^^ see?
20:02chordYES
20:04coventry`dnolen: Thanks for the cljs ns tip.
20:12chordlets talk about clojure vs python/ruby
20:15dnolencallen: ok, you were right
20:17chordare you we going to compare clojure to python?
20:25coventry`Just going on the example application in the Luminus documentation, I get the impression that pedestal designed for different kinds of apps with more complexity in the client behavior.
20:25callenLuminus is agnostic about client-side.
20:25callenworks fine for everything from a heavy CLJS frontend app to a purely static website.
20:25callenthe point is explicitly not to do a heavy framework
20:25callenNo magic.
20:26callenwhich, I sorta thought the community collectively figured out how after we ditched Noir but nobody told Relevance apparently.
20:26callenat least you can extract liberator out of it.
20:27coventry`The heavy-framework aspect of pedestal does worry me.
20:28callenit's not just that, that is why I'm so negative about it
20:28callenI understand when a heavy framework or the added magic/complexity is necessary
20:28callenbut you NEED a big win to justify it.
20:28callenPedestal has very little to show for itself.
20:28callenI'm pragmatic, I can be convinced that composing libraries might not make sense in some case.
20:28callenbut Pedestal just isn't worth it.
20:30callenRaynes: MongoDB and Erlang were never going to end happily.
20:30RaynesThis is pretty pathetic.
20:30RaynesAdmittedly.
20:31callenmy twitter reply sums up the matter handily I think.
20:31callenRaynes: to be fair, I use MongoDB too.
20:32callenI too, have data I do not care about losing.
20:38BufferUnderpantsHello
20:38callenBufferUnderpants: soup.
20:38BufferUnderpantsI'm having trouble doing lein cljsbuild
20:39BufferUnderpantsIt complains about my namespace definition
20:40BufferUnderpantsjava.lang.AssertionError: Assert failed: Only :refer-clojure, :require, :require-macros, :use and :use-macros libspecs supported
20:40BufferUnderpants(#{:import :use-macros :require-macros :require :use} k)
20:41dnolenBufferUnderpants: paste your offending ns expression somewhere
20:41BufferUnderpantsIt doesn't tell =/
20:41BufferUnderpantsI have a bunch of requires of the form (:require [clojure.string :as string])
20:42BufferUnderpantsThat's allowed, right?
20:43BufferUnderpantsAh, hold on
20:44BufferUnderpantsDidn't read the fine print, I can't use a naked :use
20:44BufferUnderpantsAlso, can I reference the classes that would normally be generated by defrecord?
20:45BufferUnderpantse.g. (defmethod frobnicate my.namespace.FancyRecord […] …) ?
20:46dnolenBufferUnderpants: yes you can, but my.ns/FancyRecord is more idiomatic
20:46BufferUnderpantsAlright, thanks
20:52TimMcBufferUnderpants: my.namespace.FancyRecord uses the JVM package and class names; my.ns/FancyRecord uses the Clojure namespace names.
20:52TimMcThe big difference is that - turns into _ for packages and classes.
20:53callendnolen: why not make the worrydream style thing you want? I could build an interactive post creator into my CMS.
20:53dnolencallen: maybe eventually get there - it's not a small amount of work
20:55callendnolen: I don't know the full extent of the thing you're talking about, but I could do in an evening with my CMS.
20:55BufferUnderpants@TimMc: oh, thanks, I had actually encountered the discrepancy in names, I hadn't thought that it was because of that
20:56callendnolen: you mean being able to interact, test, and execute referenced code in the blog post and see output in another column dynamically right?
20:57dnolencallen: that plus, the tangle functionality - also present in LightTable
20:58dnolento some degree
20:58callen'fraid I don't know the tangle bit, but blog post REPLs can be a thing in short order.
21:24TakeVSilly question, but is there actually a function to remove an element from a vector? I can't seem to find the appropriate one in any of the docs...
21:27dnolenTakeV: no such function exists - in the future probably possible with RRB-Trees
21:42TimMcTakeV: You can remove an element from the end, though.
21:51TakeVHmm. Not exactly what I need at the moment. I guess I'll just concat two subvectors.
21:55TakeVActually, is there any downsides to just concating two subvectors of the same vector so it's the original minus the element I want?
21:57bbloom(doc subvec)
21:57clojurebot"([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."
21:58bbloomnotice: "no trimming is done"
21:58TakeVI'm not sure what that means.
21:58bbloomit means that a subvector is a "view" of a full vector, such that holding on to the sub vector holds on to the full vector
21:58bbloomno garbage collection of items outside the view of the sub vector can occur
21:58TakeVAh...
21:59bbloomif you call concat & get back a lazy seq, then you have linearly copied
21:59bbloombut you have a seq, so you need to vec on that to get back to a vector
21:59bbloomluckily! there are rrb-vectors: https://github.com/clojure/core.rrb-vector/
21:59TakeVHmm, perhaps using for to copy it except for the element...
21:59TakeVOr that. >_>
22:00bbloomwhich provide efficient slice and concat with trimming & preserve the vector's asymptotic guarentes
22:00bbloomfuck yeah data structures.
22:00bbloomor
22:00bbloomif you know for a fact that your vector is small
22:01bbloomwhere "small" depends on how often you need to remove an item from it
22:01callenI usually just filter out the element I don't want if it's small/infrequent.
22:01bbloom10 items? 100 items? depends
22:01bbloomyeah, (vec (…. some filtering here …)) gets the job done
22:01bbloomand in fact that's what happens anyway if your vector is < 32 items or something like that
22:02TakeVHmm, is there a function to get the index of the element, then?
22:02callenif you do that, you're going to be iterating over it anyway.
22:02bbloomclojure tries pretty hard to only give you functions that "make sense" for your data structures
22:02bbloomunlike traditional lisps which just give you lists for everything, whether you like it or not
22:03bbloomyou should think more deeply about your requirements & you may find that map or a sorted-set or something works even better for the particular needs you have
22:03TakeVThis rrb-vector isn't in the core yet, it seems.
22:03callen{0 elem 1 lol 2 :dont-do-this}
22:03callendoseq (range) ^^ lol
22:04callenTakeV: rethink what you're doing.
22:04TakeVbbloom: Well, I'm experimenting with making a matrix library, so I'm having a hard time thinking of a better data structure than a vector.
22:04dnolenTakeV: it's unlikely it will appear in the standard lib any time soon, but that's not really a problem.
22:04callenthere are a ton of clojure numerics, array, and matrix libraries.
22:04callenTakeV: you should probably use one of those.
22:05TakeVcallen: It's a learning exercise.
22:05callenIncanter has nice wrappers for stuff like this too.
22:05bbloomTakeV: how large of vectors? 3x3 and 4x4 and friends? or arbitrary size?
22:05callenTakeV: you're going to end up doing some deeply unidiomatic if you don't learn more about how Clojure data structures work and the `why` of it.
22:05TakeVbbloom: Arbitrary.
22:05bbloomTakeV: do you need sparse matrices?
22:05TakeVbbloom: Sparse?
22:06bbloomit's probably best to avoid learning about matrix operations & clojure at the same time :-)
22:06bbloomsparse == large stretches of zeros or nils or whatever
22:06callenthe amateur hour has begun. Dance away people.
22:06bbloomcallen: stop being a fucking dick.
22:06bbloomi'm trying to help this guy and you're belittling him
22:06callenbbloom: http://www.apollotheater.org/amateur-night-history-legacy
22:06callenbbloom: I like dancing.
22:07callenTakeV: you should pick one thing and learn the one thing at a time.
22:07TakeVbbloom: I'm quite capable of ignoring him. I appreciate your help.
22:07callenTakeV: if you knew a lot about matrix processing and libraries, then implementing something in Clojure would make more sense.
22:08bbloomTakeV: i've finally just /ignore-ed him now
22:08callenbabies.
22:08TakeVbbloom: Anyway, I'm making little assumptions about the matrices, except that they are well formed. Have a precondition set up to check for that.
22:09bbloomTakeV: so clojure's data structures are optimized for particular uses & matrix usage is NOT ONE OF THOSE USES
22:09callen^^ don't do what this guy is doing. Implementing a library for something you know nothing about in a language you know nothing about is just going to produce another Rasmus Lerdorf.
22:09TimMccallen: No, seriously. Stop insulting people, especially newcomers. It's rude, it reflects badly on the community, and it's rude. Did I mention it's rude.
22:09callenTimMc: I'll listen to you because you're nice to me. So okay. I'll act on that.
22:10bbloomTimMc: thank you.
22:10TakeVbbloom: Yeah, that's actually why I'm doing it. It's a playground project, sharping the ax and all that. I do realize that if I was using python or java or something I could do it in about a couple of hours, but there is a fun challenge here. :P
22:11bbloomTakeV: well i guess my point is that you can use deftype (which is a bit advanced in clojure) to create your own data structures
22:11callenbbloom: don't thank him or I'll just stop listening on account of you agreeing with him.
22:11bbloomit's probably not a great learning experience to bypass clojure's data types
22:12TakeVbbloom: Probably not, honestly. The rest of the code is quite idiomatic. Just implementing a "get-minor" function is quite... ugly.
22:12bbloomTakeV: *shrug* yeah. Clojure is kinda geared for typical server tasks
22:14callen"I'm going to take my bits here and move my bits there"
22:15TakeVbbloom: Thank you for your help, and pointing out deftype. This looks perfect for what I need.
22:15callenTimMc: also did you miss the mess earlier or what?
22:16bbloomgood luck!
22:20TimMccallen: What mess?
22:23BufferUnderpantsUh, another Clojurescript question: are macros supposed to go in separate Clojure files, or am I missing something?
22:29bbloomBufferUnderpants: yes
22:29bbloomBufferUnderpants: macros are written in clojure, not clojurescript
22:58coventry`In the pedestal cljs-repl, how do I gain access to the functions configuring the app? For instance, if I try ((ns tutorial-client.rendering), I do not seem to end up with a render-config function (I get a backtrace saying "Cannot call method 'call' of undefined."
23:29coventry`I am tampering with the pedestal tutorial app to try and understand it. I'm at tag v2.0.14. I would think that changing the (constantly {}) map in rendering.cljs/render-config to {:my-counter "0" :other-counters {"abc" "0" "xyz" "0"}} would result in the other-counters div of the template being displayed. Why is this not the case?
23:45blrgiven friend has no equivalent of sandbar's stateful-session, does anyone have any suggestions for managing state across api requests? I could drop my data into H2 perhaps?