[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: orthogonality and generalized references

> I wish other languages exploited the fundamental difference between
> success and failure that is essential to Icon.  It's awkward to code
> your way around their absence in other languages.

To some degree, unix shell scripts use
success and failure -- both as a means
of generating values, and as a means of
short-circuiting those series.  Is that
similar to the Icon usage?

For instance, the following script was
hacked together to provide a list of
possible mnemonizations; for an input
of 3.1415926 it gives me 13 mnemonics,
including "moderately paunchy".



# greedy-match digits in a mnemisis bundle file
# cf <http://mnemisis.sourceforge.net/>

function matchup()	{
	(look $1 ${BUNDLE:-bundle.words} | egrep "^$1 ") && generate $2

function greedy()	{
	read pre post
	matchup $pre $post || greedy

function generate()	{
	[ -z $1 ] || ./substrs $1 | greedy

generate `echo $1 | tr -cd [0-9]`