Main

April 3, 2008

Programming with Generators

I gave a talk about programming with generators in the remarkable programming language Icon courtesy of the local ACM chapter. Here are the small programs I used to illustrate Icon's expression evaluation mechanism. Here is the flyer! As you can see at the bottom of the flyer, I have written a dynamic 'glue' library for the Icon virtual machine in C++. This library makes writing dynamic libraries for Icon in C++ very simple. The current documentation for the glue is here. which I am currently writing it as of 2008/4/1. The glue is complete and being tested and cleaned up as I do this.

=================

Title: Paradigm Lost?
Subtitle: Programming without Booleans: using Generators in Icon
Author: Carl Sturtivant, Dept. of CS & E, U of M
When & Where: 5:30pm Thursday April 17, EE/CSci 3-115

Abstract

The otherwise conventional programming language Icon is designed around a powerful control mechanism called generators. Instead of testing whether something can be done, and if so attempting to do it, generators enable a much more natural programming style: simply attempt to do it, and the success or failure of the attempt will automatically be propagated to the surrounding context. There may be more than one way to succeed, and if the first way found leads to the failure of something else, then control can automatically backtrack to get a second way to succeed and then go forward with a second attempt to do the something else, and so forth. For this reason expressions in Icon may implicitly produce a sequence of results: an empty result sequence is interpreted as failure, and a non-empty one as success.

A small, mature and powerful language, Icon is implemented through a 300K virtual machine, iconx, implemented in C. The source has been placed overtly in the public domain. An Icon program is compiled into an icode file with an executable header, that when run will automatically invoke iconx. Benchmarks indicate that Icon runs at a similar speed to Perl or Python, and about twice as fast as Ruby. Icon was developed at the University of Arizona over a period of two decades, and the implementation is both robust and available for a wide variety of platforms. Designed for the purpose of manipulating text effectively, Icon has sufficient expressive power that regular expressions are unecessary. In this talk I will demonstrate programming with generators in Icon with applications, as well as giving a survey of the features of the language.

Those who wish to try out some of the ideas in his talk may pick up Icon 9.4.3 The Icon 9.5x binary distribution is currently only available for cygwin, macintosh and linux, though source is available with builds for many platforms. MSWindows users will need to install cygwin and will need to get Icon 9.5x which has vital bug fixes.

Icon related bio: Dr. Sturtivant has built an experimental dynamic 'glue' library for Icon in C++ that enables additions to Icon to be written cleanly in C++. Such an addition can then be compiled into its own dynamic library and loaded by an Icon program at runtime, without any modification to iconx or the icode compiler. The glue library enables further C++ to routinely do esoteric things such as call an Icon procedure, or when called by Icon act as an Icon generator that suspends a sequence of results. He also inspired and co-wrote the new external value datatype for Icon, that will be a part of the standard distribution of version 9.5.

January 5, 2007

Innumeracy. Why the blog is it tolerated?!

If you don't have a little mathematics or coding up your sleeve or more conveniently placed in your head, then you won't like the overhead necessary to understand this blog. Sorry --- for some reason liberal arts ignorance (illiteracy being the ultimate form) is socially and culturally unacceptable, but scientific ignorance (of which the inability to read and understand simple mathematics or code is the ultimate form) is considered the norm. The latter is called innumeracy by the very literate, and given that the root of this word gives a completely misleading impression that it's all about numbers, I am convinced that it was coined by an innumerate. So I say sorry to apologize for your ignorance for you, if you're one of those people, since for cultural reasons you're unlikely to endeavor to fix the problem for yourself, or perhaps even to realize there is a problem. Don't take this personally --- the educational apparatus around the world strongly supports this strange situation, especially primary and secondary education.

Mathematics is an international language evolved to talk of the world with far greater intellectual economy than the best so-called natural languages. The syntax and semantics of mathematics have been much more consciously honed than those of natural languages. A person who does not speak at least a basic core of mathematics is ignorant indeed, unable to grasp simple attributes of artifacts or nature, or communicate without immense difficulty about such. It's like going through life with a paper bag over your head. And just like any other language it's best learned when you're young. Eradicating illiteracy in adults is difficult. Eradicating innumeracy in adults is likewise difficult. So a better path would be to eliminate it at source during primary and secondary education. And given that innumeracy is the default, we have a catch-22 roadblock to doing that: innumerate parents, teachers and peers.

If you do have some active calculus and some mathematical maturity, then you speak a second language and I hope you proclaim "I speak mathematics", and use it wherever possible with others. Like any minority language only use and a cultural perception that speaking it is important will have an effect on its spread. Add your vote to the widespread occurrence of mathematical speech by speaking mathematics. It occupies a unique position among natural languages, making it the most important second language.
math.jpg

December 13, 2006

favicon.jpg We blog

therefore we cyber-exist. This 'blog will contain a rag-bag of fragments of information, useless by default, serendipitously assembled. Examining this 'blog will be less like watching paint dry than like checking the content of an obscure storage closet in a sub-basement.