Let’s take the assembly-line function and refactor it to make things a bit more clear, and also as a recap. (defn go-body body-chan ) (defn go-wheel1 wheel1-chan) (defn go-wheel2 [wheel2-chan] (go (while true (let [wheel2 (loop  (let [part (take-part)] (if (wheel?
One way to boost productivity in traditional factories is to use assembly line. From Wikipedia: An assembly line is a manufacturing process (often called a progressive assembly) in which parts (usually interchangeable parts) are added as the semi-finished assembly moves from workstation to workstation where the parts are added in sequence until the final assembly is produced. By mechanically moving the parts to the assembly work and moving the semi-finished assembly from work station to work station, a finished product can be assembled faster and with less labor than by having workers carry parts to a stationary piece for assembly.
In Part 1 we have already defined the process of building toy cars, by one worker. Here is the code again for easy reference. (defn build-car n (let [body (loop  (let part (take-part))) _ (prn n "Got body") wheel1 (loop  (let part (take-part))) _ (prn n "Got wheel1") wheel2 (loop  (let [part (take-part)] (if (wheel?
After learning the core.async library in Clojure, I was craving for a real-world example. Now I found one from purelyfunctional.tv. The original code can be found here. The Toy Car Factory Let’s describe how a worker builds a toy car. Take a car body from the part box. Take a wheel from the part box. Take another wheel from the part box. Attach the first wheel to the body.
In this post, we will be focusing on the Paint. Color The color in Paint has 3 parts: basic color, color filter and xfermode. Basic color There are 2 ways to set color in Paint: use setColor() and use Shader. Set color directly Two methods can be used: paint.setColor(Color.parseColor("#B90E83"); paint.setARGB(100, 255, 0, 0); There is no difference, pick whichever you like. Set color using Shader There are different types of Shader, let’s look them one by one.