![]() Each value is processed by each node as it arrives at the parameter input. Instead of arrays and array processing, everything is represented as a stream of values in a continuously running, interactive program loop. He wrote about the experience in his 1966 paper, “The On-Line Graphical Specification of Computer Procedures”. He built a data flow programming environment on top of Sketchpad, which described software “procedures” as directed graphs of operator nodes with outputs linked to the inputs of other nodes. Ivan’s brother, William Robert “Bert” Sutherland was one of several pioneers in data flow programming. Ivan Sutherland’s famous Sketchpad, developed in 1961–1962, was an early example of object prototype delegation and graphical programming using a light pen. In the 1960s, groundbreaking work was happening in graphical computing in MIT’s Lincoln Laboratory using the TX-2 computer system, a precursor to the US Air Force SAGE defense system. It’s possible to encounter the term in early computer science literature - particularly in the context of Digital Signal Processing (DSP) and data flow programming. Hence, thinking of computational processes as “transducers” was not particularly novel. The general study of computer science in those days often dealt both with hardware and software design. Many software engineers in the early days of computer science were also electrical engineers. Use of the word “transducers” and the general concept of composable pipelines of data transformations in software date back at least to the 1960s, but our ideas about how they should work have changed from one language and context to the next. Likewise, a transducer in code converts from one signal to another signal. In other words, it transforms one kind of signal into another kind of signal. In hardware signal processing systems, a transducer is a device which converts one form of energy to another, e.g., audio waves to electrical, as in a microphone transducer. Keep in mind when I say “stream”, I’m not referring to any specific data type: simply a sequence of zero or more values, or a list of values expressed over time. ![]() ![]() I will use the words “signal” and “stream” somewhat interchangeably in this section. You may be tempted to do something like this: const friends = [. For example, it’s very common to select some data from a larger set, and then process that data. Often, when we process data, it’s useful to break up the processing into multiple independent, composable stages. Transducers have a different signature: f: reducer => reducer g: reducer => reducer h: reducer => reducer Why Transducers? The types don’t line up: f: (a, c) => a g: (a, c) => a h: ? Normal reducers can’t compose, because they expect two arguments, and only return a single output value, so you can’t simply connect the output to the input of the next reducer in the series. In other words, you can combine any number of transducers to form a new transducer which links each component transducer together in series. Transducers do much the same thing, but unlike ordinary reducers, transducers are composable using normal function composition. ![]() There’s a lot more of this to come! a + c // Products: (2, 4) = 8 const multiply = (a, c) => a * c // String concatenation: ('abc', '123') = 'abc123' const concatString = (a, c) => a + c // Array concatenation: (, ) = const concatArray = (a, c) => Note: This is part of the “Composing Software” serie s (now a book!) on learning functional programming and compositional software techniques in JavaScript ES6+ from the ground up. Smoke Art Cubes to Smoke - MattysFlicks - (CC BY 2.0)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |