#clojure log - Jun 20 2017

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

12:45 otwieracz: What's your first try when it comes to templating engine?

12:47 I've got pretty simple app utilizing compojure

12:48 pereferably, I'd like something what can be used to generate some pretty simple view without even knowing HTML and CSS.

12:48 Just to display some text

12:49 lxsameer: otwieracz: selmer

13:47 charlesh`: Re

13:51 I have an issue between s/with-gen and other spec generators override

13:51 If I define a spec using s/with-gen I cannot override it later

13:53 puredanger: There is one bug similar but not same as this files

13:53 Filed

13:54 https://dev.clojure.org/jira/browse/CLJ-2079 - any chance that looks familiar?

13:54 it's specifically related to alias specs, but that seems different than what you're describing

13:55 maybe it's a bug in how you're declaring the overrides map?

13:56 charlesh`: it looks like it, indeed.

14:02 Yeah. I think it's exactly that. What I'm doing is schematically the following : (s/def ::bar any?) (s/def (s/with-gen any? (fn [] (s/gen ::bar)))) then (gen/generate (s/gen ::foo {::bar (fn [] (s/gen int)?)}))

14:02 the second s/def is ::foo ::fo

14:03 ::foo *

14:04 puredanger: yeah, could be

14:05 feel free to drop an example in a comment there

14:05 when someone gets to it, would be great to verify it's addressed

14:20 charlesh`: I've post a comment as you suggested

14:43 rjungemann: Quick question: I want to use a recursive macro to manipulate a form. Is it "safe enough" to use real recursion? It would be hard for me to use clojure.walk because I would like to conditionally halt execution down certain paths (so if I have a macro called `notes`, and inside the form, I call `notes` again, I don't want to evaluate the inner call—the idea is to have a small set of recursive macros which don't step on

14:43 each others' toes)

14:44 dysfun: why would it be unsafe?

14:44 rjungemann: I guess for very deep forms there's a risk of stack overflow

14:44 They'd have to be like... very deep

14:45 dysfun: in clojure, we tend to use loop/recur where possible to avoid accruing stack frames

14:45 rjungemann: Is it possible to use loop-recur on tree-like structures? I'd have to keep a context of some sort, yeah? And then I'd probably want to use a zipper instead... maybe that's what I should do

14:46 dysfun: loop-recur optimises recursion from the tail position

14:46 hiredman_: generally, the way to do recursive macros is you have the macro expand to a call to itself

14:47 rjungemann: Oh interesting. Right now I have a very tiny macro which passes the form to a regular function which does the recursion. If I refactored it so the macro did the recursion and the function just handled one step of the recursion, would that prevent stack overflow?

14:48 hiredman: it really shouldn't matter

14:48 rjungemann: Cool that's sort of what I wanted to hear :¬)

14:48 I'll keep dabbling a bit but I'll probably keep using the working version with "true recursion" for now, thanks for the advice everyone!

16:49 joschka: guys whats this again in clojure? https://msdn.microsoft.com/de-de/library/bb548651(v=vs.110).aspx

16:50 dysfun: reduce?

16:50 clojurebot: reduce accumulates the men from the boys

16:50 justin_smith: joschka: to accumulate over a sequence, yeah reduce

16:51 joschka: reduce

16:51 man I'm an idiot

16:51 justin_smith: there's also reductions if you want a lazy-seq of states of the accumulator

16:51 and reduced to make it short-circuit

16:51 it's a handy corner of the language

16:51 see also core.reducers for parallelism and other weird stuff

16:52 joschka: I remember raging about the fact that c# calls this aggregate and now I only remembered the C# name :D

17:35 TimMc: In some languages it's called fold.

19:02 nickbird: hello

19:03 clojure is good

Logging service provided by n01se.net