Fork me on GitHub
#beginners
<
2015-09-19
>
timfield09:09:22

What does the #' syntax do?

timfield10:09:10

Ok I think I get it now, gets the value of a thing at time of execution, not definition

timfield11:09:02

Hi, I'm a newbie and am trying to use the stuartsierra.component framework. I'm confused as to how I use components that I've created. For example. Here we have the function upload-receipt. https://github.com/Moocar/clojure-west-2015/blob/master/src/system.clj#L49 Where would this be called from / who would be passing the uploader and receipt params here?

moocar15:09:42

@timfield: It’s completely up to you. If you were to call upload-receipt from a repl, you’d first instantiate a system and then pull the component you want out of it. Then you can just call upload-receipt with that component and any other data it takes. If you have something like a server, it’s a little more involved. You need to figure out how to pass the system or some of its components into the context of each request

moocar15:09:01

Using something like pedestal, you could simply create an interceptor that adds the system as a top level key to each request, or if you go further own the rabbit hole, you can even define each endpoint as a component that implements a protocol, and then in your routing table, wire up the url path to the appropriate component