Understanding Computation by Tom Stuart
Author:Tom Stuart
Language: eng
Format: epub, pdf
Tags: COMPUTERS / Programming / General
ISBN: 9781449330095
Publisher: O’Reilly Media
Published: 2013-05-14T16:00:00+00:00
Working with Procs
Since we’re going to be building entire programs out of procs, let’s spend a minute looking at their properties before we dive into using them.
Note
For the moment, we’re still using full-featured Ruby to illustrate the general behavior of procs. We won’t impose the restrictions until we start writing code to tackle The Problem.
Plumbing
Procs are plumbing for moving values around programs. Consider what happens when we call a proc:
-> x { x + 2 }.call(1)
The value that’s provided as an argument to the call, in this case 1, flows into the parameter of the block, in this case x, and then flows out of the parameter to all the places where it’s used, so Ruby ends up evaluating 1 + 2. It’s the rest of the language that does the actual work; procs just connect parts of the program together and make values flow to where they’re needed.
This already doesn’t bode well for our experiment in minimal Ruby. If procs can only move values between the pieces of Ruby that actually do something with them, how are we ever going to be able to build useful programs out of procs alone? We’ll get to that once we’ve explored some other properties of procs.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(11876)
Hello! Python by Anthony Briggs(9366)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9338)
The Mikado Method by Ola Ellnestam Daniel Brolund(9303)
Dependency Injection in .NET by Mark Seemann(8854)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(7846)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7310)
Grails in Action by Glen Smith Peter Ledbrook(7291)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7112)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(5953)
Kotlin in Action by Dmitry Jemerov(4634)
Practical Vim (for Kathryn Amaral) by Drew Neil(3724)
Cracking the GRE Premium Edition with 6 Practice Tests, 2015 (Graduate School Test Preparation) by Princeton Review(3593)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3394)
Learn Windows PowerShell in a Month of Lunches by Don Jones(3236)
Learning Java by Patrick Niemeyer & Daniel Leuck(2867)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(2833)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(2595)
Mastering Java 9 by Dr. Edward Lavieri(2570)