找回密码
 注册
搜索
热搜: java php web
查看: 445|回复: 0

Higher-Order Perl

[复制链接]
发表于 2010-1-9 16:05:03 | 显示全部楼层 |阅读模式
本帖最后由 石头 于 2010-1-9 16:36 编辑



作者:Mark Jason Dominus
出版社:其它
页数:582
ISBN:ISBN 1558607013, 9781558607019
文件格式:PDF

Higher-Order Perl is about functional programmingtechniques in Perl. It’s about how to write functions that can modifyand manufacture other functions.
<!–
It’s difficult to explain briefly exactly what this means—it’s as if
someone was writing a book about object-oriented programming in 1982
when hardly anyone had heard of object-oriented programming.
Obviously, functional programming isn’t simply programming with
functions, because everyone does that already. Perhaps the best summary is
that it’s about writing functions that can manufacture other
functions.–>

Why would you want to do that? Because that way your code ismore flexible and more reusable. Instead of writing ten similarfunctions, you write a general pattern or framework that can generatethe functions you want; then you generate just the functions you needaccording to the pattern. The program doesn’t need to know in advancewhich functions are necessary; it can generate them as needed. Insteadof writing the complete program yourself, you get the computer to writeit for you.
HOP is full of useful and interesting examples that Perl programmerswill want to see. Chapter 1 is about writing recursive functions towalk the file system and to process recursively-structured data such asHTML documents. Chapter 2 discusses dispatch tables in the context ofreading configuration files. Chapter 4 concludes with an improvedreplacement for the WWW::SimpleRobot module, with better functionalityin one-third the code, and also contains a basic database query systemthat searches an HTTP log file backwards, delivering the most recentrecords first. Chapter 6 discusses the frequently asked question of howto generate a list of all the strings that will match a given regex andprovides an astonishingly simple solution. Later on, in Chapter 8, Ishow how to build a parser for regexes and attach it to the stringgenerator. Chapter 9 presents linogram, a complete constraint-baseddiagram-drawing system.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|软晨网(RuanChen.com)

GMT+8, 2024-11-15 06:23

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回复 返回顶部 返回列表