Esoteric .NET Language Challenge
It's Friday afternoon, I'm bored with "conventional languages" such as C# and VB, so let's play a game! I've got four different code snippets from somewhat esoteric languages. They've only one thing in common - they can all be compiled with a .NET compiler into intermediate language. Can you guess a) what language each is, and b) what the snippets actually do?
I'll reveal the answers and the compilers in a couple of days if there's anything nobody can get! In ascending order of difficulty, then:
Snippet 1
<%@ page language="#omitted#" %>
<script runat="server">
OBJECT.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 FONT-SIZE PIC S9(9) COMP-5.
END OBJECT.
</script>
<% PERFORM VARYING FONT-SIZE FROM 1 BY 1 UNTIL FONT-SIZE > 7 %>
<font size="<%=FONT-SIZE%>">Nostalgia with a disturbingly novel twist...</font> <br>
<% END-PERFORM. %>
This is fairly straightforward, I think.
Snippet 2
! This is the main program
Program MultiDog
use System
use VirtualDog
type (Dog) :: d
type (Greyhound) :: g
type (Labrador) :: l
call d%RollOver()
call g%RollOver()
call l%RollOver()
end program MultiDog
A little bit less obvious in terms of the language, but its meaning is pretty clear.
Snippet 3
<%@ page language="#omitted#" %>
<script runat="server">
</script>
<html>
<body>
<H1>Can you guess what I do?</H1>
<form runat=server>
<asp:Button id="Pressme" Text="Press Me" runat="server" OnClick="Reverse" />
</form>;/form>
</body>
</html>
In this one, the language is a giveaway but it takes more skill to work out what the code is doing!
Snippet 4
400 constant bar
: foo \ Performs a mystery operation
2
begin
over over mod 0= 0=
rot rot dup >r
over 2 / > 0=
rot and r> swap
while
1+
repeat
over 2 / >
;
: main \ Entry point
."Values up to " bar . .": "
limit 1 do
i foo
if i . space then
loop
;
This is much harder to get right, I think...
Let the challenge commence :-)
Comments
- Anonymous
October 01, 2004
Hi,
I think number 1) is COBOL, number 2) might be Smalltalk, no idea about the other two though :)
I havent programmed in either, but I tried googling on the syntax to see what was brought back. - Anonymous
October 01, 2004
- COBOL, 3. APL, 4. FORTH
I think...
- Anonymous
October 01, 2004
- COBOL 2. FORTRAN 3. APL 4. FORTH
- Anonymous
October 01, 2004
Educated Guesses
1) Cobol
Sets a the font size to 9pt
2) SETL
instantiates 3 classes in VirtualDog and makes them roll over :)
3) APL
Reverses the Array Args
4) Forth
Err ... Some kinda loop :) - Anonymous
October 01, 2004
Some of you are doing well at guessing the languages - but still a little way to go in terms of the operations performed by each! - Anonymous
October 01, 2004
The comment has been removed - Anonymous
October 01, 2004
Thanks Raymond :-) If I've edited that duplicate 2 out once, I've edited it out ten times. There's some funny bug in the HTML editor, I think, as it just wouldn't stick. Hope it's now fixed for good. - Anonymous
October 01, 2004
Woohoo,
1) COBOL : Which is nice. Displays "Nostalgia with a disturbingly novel twist..." in increasing font sizes from 5 to 7. I think 5 is the staring point
2) Isn't smalltalk, the comments look wrong, and making 3 different types of dog, inherited from the dog class rollover. Where's the "beg for biscuit" method? :) Now the only thing I can remember using ! for comments is Fortran90, so Lahey's fortran.net?
3) Is APL, and maybe reverses the args on the query string?
4) Forth. And I only just remember the Jupiter Ace, as the only consumer computer in the early eighties which used forth instead of basic :) Caculating mystery operation on all values up to 400. Aggh, stack manipulation - Anonymous
October 01, 2004
Somebody should implement INTERCAL.NET - Anonymous
October 01, 2004
Looks like others beat me to it. The only one I know is number 2. It's Fortran. Though I never use FORTRAN or Fortran professionally it's the first "real" language I used so I've been keeping an eye on it for years. Maybe someday I'll get a project that requires heavy duty calculations and I'll have an excuse to install my copy of Fortran.NET. - Anonymous
October 02, 2004
The comment has been removed