A+: a programming language for people who like to program
Reference Manual

Terms Of Use

About A+
History of A+
Who Wrote A+?
Screenshots
Programs Written in A+

Getting A+
Download
Other Software
Installation
Documentation

A+ Community
FAQ
Mail Contacts
Other Resources
The Reviews

A+ Web Site

Programs Written in A+

99 Bottles of Beer was submitted to Tim Robinson's collection in 1997 by Malcolm Austin. It appears there in A+'s ASCII form. Here it uses the A+ font.


Here's a variant of uniq(1) that does not require sorted input. However, trailing blanks are ignored on input and likely added on output and most grievously, standard input is ignored. APL programmers surely won't like the iteration. Bummed? Rewrite it and send it back.

          
#! /usr/local/bin/a+ -q

unique{x}:((xx)=#x)/x
nl{x}:,"\n",@1 x

 found these functions in /u/apter
btom{x}:>(/>#x)١x
vtoe{y;x}:if (`null=x) x else 1ա(xy)x((~(1x)y)/1y),x
vtom{y;x}:btom{vtoe{y;x}}
noLines{x}:vtom{"\n";(-"\n"=1x)x}

a0''
(n1+#_argv) do {
  a[,]nl sys.readmat >_argv[n+1];
}

if (0a) {
  unique noLines a
}

sys.exit 0
	  
          
Here's the same code in ascii mode which A+ parses as well:
#! /usr/local/bin/a+ -q

$mode ascii

unique{x}:((x iota x)= iota #x)/x
nl{x}:,"\n",@1 x

 'found these functions in /u/apter';
btom{x}:>( max/># each x) take each x
vtoe{y;x}:if (`null= ? x) x else 1 drop each ( bag x in y) bag x := (( iota (1 take x) in y)/1 take y),x
vtom{y;x}:btom{vtoe{y;x}}
noLines{x}:vtom{"\n";(-"\n"=(-1) take x) drop x}

a := 0 rho ''
(n := (-1)+#_argv) do {
  a[,] := nl sys.readmat >_argv[n+1];
}

if (0 ~= rho a) {
  unique noLines a
}

sys.exit 0
          

I haven't installed the A+ fonts yet but I want to see the code with the A+ character set so I'll click here.

Thanks to the designers
of www.xemacs.org for
their inspirational look
and feel.
This page is part of the A+ website <http://www.aplusdev.org/>
Maintained by webmaster@aplusdev.org
Hosted by Morgan Stanley Logo
This page last modified Fri Apr 4 10:55:18 EST 2003
© 1992-2008 Morgan Stanley Dean Witter & Co.  All rights reserved.