Language APL
(version two)
Date: | 05/30/05 |
Author: | JT. Taylor |
URL: | http://www.jttaylor.net/ |
Comments: | 8 |
Info: | n/a |
Score: | (2.98 in 47 votes) |
⍝ APL (A Programming Language) ⍝ Program written by JT. Taylor, www.jttaylor.net T1←98↑[1]ØΦ1 99ρι99 T4←ØΦ1 98ρι98 T1,(98 30ρ’ BOTTLES OF BEER ON THE WALL, ‘),T1,(98 47ρ’BOTTLES OF BEER, TAKE ONE DOWN, PASS IT AROUND,’),T4,(98 28ρ’BOTTLES OF BEER ON THE WALL ,’) ‘1 BOTTLE OF BEER ON THE WALL, 1 BOTTLE OF BEER, TAKE IT DOWN, PASS IT AROUND, NO BOTTLES OF BEER ON THE WALL.’
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
JS Brilleaud said on 10/21/05 00:49:23
For better lisibility, I tried to write it this way (I don't guarantee the exact count of white spaces)
T <- (- iota 98) outer.+ ,100
Z <- (fmt T), (98 30 rho ' BOTTLES OF BEER ON THE WALL, ')
Z <- Z, (fmt T), (98 47 rho ' BOTTLES OF BEER, TAKE ONE DOWN, PASS IT AROUND, ')
Z, (fmt T-1), (98 28 rho ' BOTTLES OF BEER ON THE WALL.')
'1 BOTTLE OF BEER ON THE WALL, 1 BOTTLE OF BEER, TAKE IT DOWN, PASS IT AROUND, NO BOTTLES OF BEER ON THE WALL.'
nb. the idea is to build an array with lines for from 99 to 2 bottles , print it, then print line for 1 bottle.
nb. iota, outer, fmt, rho are to be replaced with corresponding APL symbols.
Geraldo Xexeo said on 01/13/09 18:18:30
Which font should be used to read this APL program correctly?
Jim de Graff said on 04/20/09 19:52:53
The author has spelled out the APL primitive operators because the actual characters either were not available or because there was concern that they might not render properly in a given browser on a given system. As such, if you have the APL charset, replace as follows (see http://www.aplusdev.org/keyboard.html)
iota = shift I
rho = shift R
outer = shift O
fmt = shift N
David Given said on 05/15/09 17:05:35
This program seems to be using a very odd encoding --- all the APL characters are in the ISO-8859-1 range (0x80..0xff). Shouldn't it be using Unicode instead, which would make it display properly on any web browser with access to a decent Unicode font?
Andrew Gallagher said on 05/26/09 16:17:15
David: It IS written in Unicode, specifically UTF-8. Unfortunately, the website has mis-annotated the page as being in iso-8895-1.
If you don't believe me, save the page source and edit the content-type header. Voila!
David Given said on 07/01/09 02:46:43
So it does (using Firefox' View->Encoding->UTF-8 works just as well). Ta!
Chaad said on 07/28/09 05:03:06
Louis Kessler said on 01/05/10 06:21:43
C'mon, this is APL people. It's got to be just ONE line.