Hi,

I'm currently TAing a course on functional programming. The course is quite
theory-oriented, and the language used in the course is SML. However, the
instructor has given me the opportunity to give a lecture on some of the
practical applications of the topics we've covered. What I'd like to do is
come up with some examples of how I've applied these topics practically in
my work, which for the most part has been heavily oriented toward
development with JavaScript, both in and out of the web browser.

So far, we've covered the following topics in the course:

* recursive functions
* recursive datatypes
* induction and reasoning about programs
* higher-order functions
* closures
* continuations
* streams

 Off the top of my head, I've thought of the following practical examples to
discuss from my own experience:

* Function closures to manage asynchronous behaviour, e.g. asynchronous
network requests. Provide an example using XMLHTTPRequest.
* Higher-order functions and how they can enable patterns like MapReduce.
This enables iteration to be abstracted out, so that it can be implemented
in many ways while remaining transparent to the developer, e.g. run on a
cluster, or split across multiple threads. Provide an example using
CouchDB's MapReduce.
* Using function closures for data hiding in languages that do not directly
support things like private attributes on classes. Provide an example using
the js module pattern.
* Continuations and the continuation-passing style in JavaScript. Show how
this is useful if you wish to stop and resume execution, without using
threads, while maintaining the state of the stack. Provide an example of how
this could be used in the context of programming an asynchronous HTTP
server.

If anyone has other ideas of suggestions for examples to present, I'd really
like to hear them. Let me know what you think. Thanks,

Jake

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to