Fork me on GitHub
#clojure
<
2016-07-01
>
rickmoynihan00:07:23

Does anyone know of a good academic paper citation to support the statement that "...pure functions on immutable data, are significantly easier to reason about."

rickmoynihan00:07:08

Out of the tar pit is one... are there better ones that more directly support those claims though?

groglogic01:07:29

@rickmoynihan: I would suggest you don't need to cite a paper to back that up. at least out in the "real world" outside academia. it should be obvious to anyone with enough smarts & experience, who knows what all those words mean. a bit like do you need an academic paper to "prove" that it is safer for you to juggle a small foam ball than a running chainsaw. 😛

calvin.iyer06:07:12

Hi, could someone suggest me a good clojure templating library for html. I have explored a few like selmer, hiccup and clostache but I am not sure which one to go forward with. My requirements are basically to render a html file so hiccup doesn't fit in. Selmer fits my requirements but it seems like there hasn't been any activity in it for quite sometime so I am not really sure I should go with it. Any suggestions would be great.

seancorfield06:07:51

We use Selmer very heavily in production at World Singles and we're very happy with it. It's mature and rock solid. The lack of activity reflects that.

seancorfield06:07:07

Besides, it's had a few minor updates in the last week or two.

seancorfield06:07:45

(we send over half a million HTML emails every day built with Selmer, FWIW)

calvin.iyer06:07:18

@seancorfield: Thanks for the suggestion I will probably go with Selmer then.

rickmoynihan07:07:19

@groglogic: it is for an academic/journal paper. It's not really a key claim it's basically just provided as a justification for why the system was implemented in clojure; but the reviewer has challenged it. I'd rather not expand the statement, to provide a full explanation of the benefits of FP over imperative / pure functions vs impure etc... which is what he seems to be asking for. I'd rather save the words for more important claims and just cite something that says why it's better.

rickmoynihan07:07:34

The problem I have with Out of the tarpit for these purposes is that it's advocating more than FP...

casperc12:07:07

Is there a way to call a static method from an instance of a class?

agile_geek12:07:02

@casperc: why would you want to do that if it's a static method. Unless it's a method named coincidently the same in several classes and you don't know which you have?

casperc12:07:38

@agile_geek: Long story, I am fiddling around with proxy and running into a situation where this seems to be the only way. There may be another way, but was wondering why it isn’t possible to do.

agile_geek12:07:43

Surely if you know the method to call you know the class the method is implemented on and therefore can call it the usual way?

casperc12:07:49

Maybe, my question is whether it is possible though 🙂

agile_geek12:07:17

Not that I'm aware of but not sure why you would need to.

casperc12:07:34

Fair enough.

ska13:07:28

Hi. For a small service I am writing, I need to display the last N loglines on a status page. I thought I could just pass the lines through a fixed max size buffer. Would you implement this yourself (conj'ing on vec or subvec depending on size) or do you know any suitable datatype from the top of your head? PersistentQueue does not really help, I think; neither amalloy/ring-buffer)

loganmhb14:07:32

@casperc: if I understand what you want, you can get it with eval. you probably don’t want to do that, though

loganmhb14:07:57

boot.user=> (defn static-call [obj method-name & args] (let [c (class obj)] (eval `(~(symbol (pr-str c) method-name) ~@args))))
#'boot.user/static-call
boot.user=> (static-call "s" "valueOf" 7)
“7”

danlebrero14:07:11

@ska why ring-buffer doesnt help? It seems like what you want

asolovyov15:07:41

@dnolen: I'm trying to get up and running with modules and get an error like this:

java.lang.NoSuchMethodError: com.google.javascript.jscomp.JSModule.sortInputsByDeps(Lcom/google/javascript/jscomp/Compiler;)V
	at cljs.closure$optimize_modules$fn__4074.invoke(closure.clj:1247)
Any ideas what can I do about that? I tried something simple in repl and it works:
(import '[com.google.javascript.jscomp JSModule])
(def q (JSModule. "qwe"))
(require 'cljs.closure)
(def compiler (cljs.closure/make-closure-compiler))
(.sortInputsByDeps q compiler)
and that is not throwing exception I'm lost...

si1415:07:06

I have an idea at the back of my mind for some time already: how good/bad idea would it be to build a mixed Django/Clojure webapps? Let Django manage DB tables, migrations, sessions and CRUD for the backoffice stuff; let Clojure pull data using e.g. hugsql and do its user-facing magic. In a few cases where interop can be required, one can always provide a bunch of REST handles. Nginx in front of the whole contraption will make it transparent to everyone

rmuslimov15:07:03

I’m building something close to that now, and now interop on memcached level is enough (reading user sessions)

si1415:07:42

rmuslimov: did you have any problems with the setup? Why did you consider it?

rmuslimov15:07:58

I’m using it only for websockets now, and have plans to expand to other parts of the app. Btw, I concerned how to agree on which parts of app will implement on python and which on clojure

rmuslimov15:07:14

no problems with setup so far

dnolen15:07:50

@asolovyov: sounds like a dep issue to me

si1415:07:29

@rmuslimov: I see, thank you!

ska15:07:36

@danlebrero: It does not really add a lot (that I need in this case) over just a vector and adds another dependency.

ddellacosta17:07:48

Are there any best practices/standard conventions wrt command-line arguments for Clojure programs run via lein run?

asolovyov18:07:32

@si14: I'm migrating from django to cljs/clj app, and some pages are displayed to user by django, some by clojure. Works well (I can show you public site), I just had to implement django sessions support in clojure. Plus my admin interface is in flask-admin.

si1418:07:46

@asolovyov: thanks! I'll ask for more details in DM :)

candiedcode23:07:56

I’m having some problems with amazonica.aws.s3 , i’m wanting to take a collection and save it as a csv in s3

candiedcode23:07:32

i’ve done this to a file, using (with-open [file (io/writer filename)] (csv/write-csv file (cons headers rows)))))

candiedcode23:07:20

but since i’m going straight to s3, i it looks like i need to pass s3 an input stream, I’m not sure what type of stream to use,

candiedcode23:07:16

actually i think i just answered my question,