--
You received this message because you are subscribed to the Google Groups "Elements of Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elements-of-clo...@googlegroups.com.
To post to this group, send email to elements-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elements-of-clojure/f74abb7c-b46b-4b34-a535-fac7f7ca3678%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Ajay,I'm expanding on these concepts and terms in the fourth chapter, and I agree that this section could use some reworking. It's easiest to think of the "data scope" as what is visible to the current thread. This encompasses things in lexical scope (function parameters, let-bound values) and global scope (vars). Usually, when we spawn a thread we want to operate on more than its initial parameters, so we need to pull data in from some other scope (another thread/process/machine). This might be reading in from stdin, making an HTTP request, or reading from an in-memory queue which is shared with another thread. Once we have data, we can transform it. Any function, like `get-jovian-moon`, which operates on data already contained in our thread, is neither pushing or pulling. Once we've transformed the data, if we want our work to mean anything, we need to push the results to somewhere. This might involve writing to stdout with a `println`, writing to a database, or simply passing it off to some other thread.Does this clarify things at all?Zach
On Thu, Jan 11, 2018 at 11:31 AM Ajay Kamble <ajay.ri...@gmail.com> wrote:
I am not able to understand what is a pull, push or transform. This is explained under 'Naming Functions' on page 22.--The specific questions I have are:
- What does `queue` mean in the following sentence? ‘When we take from a queue, we bring data into scope. When put onto a queue, we push data out of scope'.
- Is return value a push? For example, get-jovian-moon (earlier example) takes a map and a key and returns some value. Is this a push (also is it correct to say that this function does not pull anything).
- What is an example of a pull? Is it only when we bring values from let’s say some service or database or read user input from the console?
- What is a transform? It will have some return value. Then what distinguishes it from the push?
You received this message because you are subscribed to the Google Groups "Elements of Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elements-of-clojure+unsub...@googlegroups.com.