« Innumeracy. Why the blog is it tolerated?! | Main

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.

Comments

Hi
Sorry to have missed your talk. At Paisley we have a coding challenge running - I usually do Rebol or Smalltalk, but this time I chose ICON.
I am partnered with a good PERL guy was is put off by the errors running UI.exe for UNICON under WIN32 XP expecially through remote desktop. And UI.exe freezes if you use the HELP menu to open the HTML UNICON or ICON help.
I posted one issue to the maillist.
Robert

Robert: Unicon isn't Icon! It's a separate development effort that started some time back with the Icon source distribution from the University of Arizona and has since diverged. The University of Arizona distribution is reliable and well maintained. There is a cygwin distribution for Windows programming.
Carl.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.