Fork me on GitHub

@hoopes As a bit of a follow up to the discussion earlier about JVM-based web servers: it's common for them to handle each new request in a separate thread automatically. They typically have a pool of threads and if no threads are available, incoming requests will stall until a thread is available (so it is important to tune threads if you're dealing with really high traffic). When folks talk about async in the Clojure world tho', they generally mean something a bit different (since the basic web servers are already multi-threaded and handle concurrent requests out-of-the-box). Pretty much all Clojure web apps are built with Ring, which is a nice abstraction over HTTP requests and responses. Ring -- and other similar libraries -- have the concept of both synchronous and asynchronous requests -- and the latter is what most folks will think of when you talk about "async" in the context of web servers. With a synchronous request, the request comes in, is processed, and a response is sent back to the client -- and the handler functions for such requests take just one argument: the Ring request hash map. With an asynchronous request, the handler functions have three arguments: the Ring request hash map, a response function to be called with a successful result and a raise function to be called with a failure (as in "raising an exception"). /cc @azzurite


Library pandoc has some namespaces like pandoc.core, pandoc.pre pandoc.render etc. I want to apropos search all pandoc related namespaces. like (apropos "pandoc.*"). How to do this?

Vincent Cantin06:09:35

What is the meaning of the convention of ending function’s names with a *?


@vincent.cantin Usually they pop up when you need a wrapper around the actual main function. For example, you have a function that does something, call it something*. Then you want to memoize it, so you (def something (memoize something*)).

👍 4
Vincent Cantin06:09:37

I see, thank you.


@vincent.cantin No, the * is not literal, the meaning is like in regexp or wildchar etc.

Vincent Cantin18:09:37

yeah, that was not related, sorry.


i don't think he was reacting to your question


Aha, misunderstand. 😂


what are your opinions what are the easyiest fastest and most fun ways to learn the language, to have a solid and gounded knowledge?


<Http://> and the book "Clojure for the Brave and True", or "programming clojure" if you already know enough about programming in general


1. How do you learn best? 2. What is your current programming background? 3. what is your end-game goal?


There are many alternatives


@borblytams Doing the problems at meets a lot of those criteria


actually i tried, but not really understood, and i can just solve some problems


You probably also want to pick up a book on the language


I’ve used advent of code (see resulting blog post here: ) to get some fun problems.

👍 4

using depstar, i can create a jar file easily. But I'm not sure I understand how to set the main entry point? I'm very new to the java side of clojure. Does anyone know offhand how to do this? I used clj -A:new app test/newapp to use sean's extremely nice template system. Then clj -A:depstar -m hf.depstar.uberjar test.jar. The only ns in this project has (:gen-class) on it so it should have a java class there I'm just not sure of that final part of how to mark this as the entry point


java -jar test.jar yields "Error: Invalid or corrupt jarfile test.jar"

Alex Miller (Clojure team)17:09:00

The default main is defined by the manifest, which is just a file at META-INF/MANIFEST.MF


It looks like depstar excludes any local META-INF folder from the JAR. I created src/META-INF/MANIFEST.MF containing Main-Class: clojure.main and the uberjar that depstar built didn't contain it. Is that right @ghadi? Depstar excludes any META-INF it finds on the classpath? /cc @dpsutton


OK, you can add one manually:

jar ufm myuber.jar mymanifest
where mymanifest contains just
Main-Class: clojure.main
or whatever main namespace you'd prefer. I'll add that to issue #5 (and suggest the README be updated to include that information!).

Alex Miller (Clojure team)17:09:07

perhaps you could just build and include it manually?

Alex Miller (Clojure team)17:09:57

I think you just need a Main-Class:


Thanks Alex.


kind of a weird problem: I’m trying to get the line number and position of a key and value in a data structure when it’s pretty printed


is there a clever way to do this?

Alex Miller (Clojure team)18:09:11

I think there are only clever ways to do this :)


I’m just afraid I’m going to have to parse the string myself


I started off with a naive approach to get the line number by replacing the value at the path with a special keyword, but that can affect the line width which in turn can cause the line to break/not break when pprinting

Alex Miller (Clojure team)18:09:02

it seems like the best time to discover this is when you’re printing. I can’t think of any kind of printer that currently tracks that though


:thinking_face: good point. maybe I can copy + extend pprint’s code to track it


oof, the source for pprint is very complex

Alex Miller (Clojure team)19:09:33

a lot of that stuff was ported from common lisp and is hard to track

Alex Miller (Clojure team)19:09:42

there are other printers like fipp and zprint


thanks, I’ll take a look at those!


@dpsutton I thought with Depstar you could just specify the main namespace at runtime but I also get that "Error: Invalid or corrupt jarfile test.jar" -- just following the README doesn't seem to work. @ghadi What are we both missing here?


@dpsutton Looks like we're not the only ones to run into this


yeah i saw that but unfortunately there was no action and no even explanation of circumstances of how they ran into the issue 😞


I just added a full repro example.

👍 4

@seancorfield depstar doesn't do any AOT, nor let you specify a main class


java -jar only works if you've specified a main class


@ghadi so how do you use the uberjar? When you say "uberjar" people have expectations 😄


I don't want or need AOT by the way. The clojure.main class is in there and that's what I'd use.


What is the best method to stylise websites made with re-frame? is it with css or how does it work?


Or any other advice to make websites more beautiful with re-frame/clojurescript for a beginner like me is highly appreciated


jmp it's very easy to toss bootstrap and font awesome to get a structure going. these have some reusable components that can help you quickly create a styled webapp. if you're going to do webapps for a while and design is a focus it would be worth your time to pursue css and design more deeply but these are great starting points


Awesome @dpsutton! thanks! Is CSS needed for deeper control over the visual design?


It's the language of design on the front end


But does it make sense to do it within clojure using something like the one you linked or is it most common to keep the css part and the cljs part separate as much as possible? I’m just wondering how to structure my project when it comes to visuals/logic


it really depends on how complex your app is and what you (or your team) is comfortable with


IMO I think CSS-in-JS is really excellent, but I also work on a huuuuge application with lots of devs. so being able to easily isolate and import/export styles is a big deal for my project


for general web dev, plain CSS is just fine and garden can help write that without having to context switch from Clojure


And while you're learning css it may be better to stay vanilla without garden


FWIW, at work we use plain CSS in separate files, and HTML templates with Selmer rather than Hiccup, so that our front end folks and, in particular, our UI/UX designer, can work with our web app's visuals.


We used Hiccup for a couple of things and we couldn't get any support from the front end folks since they work with CSS, JS, and HTML.


So, yes, I'd agree with @dpsutton here and recommend keeping your CSS external and learning it standalone rather than trying to learn CSS via something like Garden.


Right. That makes total sense to me then 🙂


Thank you so much guys! I’ll make sure to come back with more question ;D


lein does some release stuff, but you can't increment version in dev-> merge into master -> tag master -> go back and increment version on dev branch, right?


rich hickey opposes pattern matching, what is the alternative? how does one parse input and capture it in a parameter? what am i missing?


what is that snippet supposed to do?


it is supposed to be the specification for the kind of messages a custom repl understands