Download Higher-Order Perl: Transforming Programs with Programs by Mark Jason Dominus PDF

By Mark Jason Dominus

So much Perl programmers have been initially informed as C and Unix programmers, so the Perl courses that they write endure a powerful resemblance to C courses. in spite of the fact that, Perl accommodates many gains that experience their roots in different languages comparable to Lisp. those complex positive aspects should not good understood and are infrequently utilized by so much Perl programmers, yet they're very strong. they could automate projects in daily programming which are tough to unravel in the other approach. essentially the most robust of those suggestions is writing services that manufacture or adjust different features. for instance, rather than writing ten related capabilities, a programmer can write a normal trend or framework which may then create the capabilities as wanted in accordance with the development. For numerous years Mark Jason Dominus has labored to use sensible programming thoughts to Perl. Now Mark brings those versatile programming tools that he has effectively taught in several tutorials and coaching classes to a much broader viewers.

* Introduces robust programming methods—new to so much Perl programmers—that have been formerly the area of computing device scientists
* progressively builds up self belief via describing options of innovative sophistication
* exhibits the best way to enhance daily courses and comprises a variety of attractive code examples to demonstrate the tools

Show description

Read Online or Download Higher-Order Perl: Transforming Programs with Programs PDF

Best programming books

Beginning Perl (3rd Edition)

This can be a e-book for these people who believed that we didn’t have to study Perl, and now we all know it truly is extra ubiquitous than ever. Perl is intensely versatile and strong, and it isn’t petrified of net 2. zero or the cloud. initially touted because the duct tape of the net, Perl has on the grounds that developed right into a multipurpose, multiplatform language current completely all over the place: heavy-duty net functions, the cloud, platforms management, typical language processing, and fiscal engineering.

Additional info for Higher-Order Perl: Transforming Programs with Programs

Sample text

The parameter will itself be a function that tells total_size() what we want it to do. '; dir_walk("$top/$file", $code); } } } 3 Some people find this unpersuasive, so perhaps I should point out that if we make ourselves useful to other people, they will love and admire us, and they might even pay us more. TEAM LinG 18   Recursion and Callbacks This function, which I’ve renamed dir_walk() to honor its new generality, gets two arguments. The first, $top, is the name of the file or directory that we want it to start searching in, as before.

For $i (1 .. \n"; } } This is the really interesting check. The function loops over all the disks that are smaller than the one hanoi() is trying to move, and makes sure that the smaller disks aren’t in the way. The first if branch makes sure that each smaller disk is not on top of the one hanoi() wants to move, and the second branch makes sure that hanoi() is not trying to move the current disk onto the smaller disk. \n"; $position[$disk] = $end; } Finally, the function has determined that there is nothing wrong with the move, so it prints out a message as before, and adjusts the @position array to reflect the new position of the disk.

2 Partitioning Fibonacci numbers are rather abstruse, and it’s hard to find simple realistic examples of programs that need to compute them. Here’s a somewhat more realistic example. We have some valuable items, which we’ll call “treasures,” and we want to divide them evenly between two people. We know the value of each item, and we would like to ensure that both people get collections of items whose total value is the same. Or, to recast the problem in a more mundane light: we know the weight of each of the various groceries you bought today, and since you’re going to carry them home with one bag in each hand, you want to distribute the weight evenly.

Download PDF sample

Rated 4.01 of 5 – based on 30 votes