Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The Sensible Language

Name: Anonymous 2008-04-10 16:30

display message, ask for age and print age in words,
where message is "Welcome to the example program of The Sensible Language."

ask for x1 means print "What's your age?" and get a line as x1

print x1 in words means:
 print the hundreds, tens and units.
 where units is num words at index n, where n is the last char of x1 or ""
 where tens is num words at index n, where n is x1 at index 2 (backwards) or ""
 where hundreds is num words at index n, where n is x1 at index 3 (backwards) or ""

the last char of x1 means x1 at index i, where i is the length of x1 - 1

x1 of words means num words at index x1

num words is a hash-table of nums to strings, containing
 "one","two","three","four","five","six","seven","eight","nine".
 failing with "".

-- Standard IO library

get a line means get x1 from stdin

get x1 from x2 means, using ffi function `get' as `ffiget', ffiget x2 as x1

print x1 means, using ffi function `putstr', putstr x1

Name: Anonymous 2008-04-10 22:21

>>30
Unfortunately, natural languages are very ambiguous and context-sensitive, both very undesirable traits for a programming language.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List