Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Your Email:

Higher Order Functions

By Jonathan Bartlett
2005-05-13


Of the highest order

So, why go to all that trouble to define objects when there are good object-oriented languages and object-oriented extensions to Scheme already available? Well really, you shouldn't; however, I wanted to point out the basic equivalence between objects and closures. In fact, it's almost a rite of passage for a programmer to have built his or her own object system using closures while learning Scheme.

Why have both closures and objects when they are both somewhat equivalent?

• For small systems, closures are almost always easier to handle than objects. The amount of code that goes into creating a class for an object dwarfs the code needed to make an anonymous function on a local environment.
• However, when you need to define several functions (probably more than three or four) that work in tandem on a local environment, objects often work better.

Now that you know how both systems work, if they language you are working in is missing one or the other, you can always use what you have to simulate what you don't have.

Tutorial Pages:
» Using functions for such higher order purposes as arguments, function-generating functions, and anonymous functions
» Creating anonymous functions
» Functions as function arguments
» Using functions as arguments
» Building functions at runtime
» Functions and object-oriented programming
» Of the highest order
» Resources


First published by IBM DeveloperWorks


 | Bookmark
Related Tutorials:
» How to Install PHP 5 on Linux
» How to Install Apache 2 on Linux
» How to Install MySQL 5.0 on Linux
» SMB Caching
» Mound --Bind
» Tar Wild Card Interpretation