User:Decora/Spam

Spam is a horrible language that uses wiki pages to store variables. It is not only unimplemented, but it would be morally wrong to do so.

Variables
Every variable is essentially a character on a wiki page. The notation used to refer to a variable is as follows:

url [ # ]

Or, for example:

http://en.wikipedia.org/wiki/Jeannette_Rankin[32]

This would indicate the 32nd character in the Jeanette Rankin artice on English Wikipedia.

Alternatively, you can use tinyurl or other services.

http://tinyurl.com/qq9q8[32]

Namespace
The aforementioned variable address space, while saving lots of memory on the local machine, nevertheless has the drawback, like Network Headache, of meaning that everyone, everywhere, running any Spam program is sharing the same namespace.

This may cause some problems with concurrency, as the only way you can create a lock is to become an administrator on the wiki in question and lock the article from editing. However, if more than one person is an administrator, this may cause deadlocks. Some variables might become de-facto read only due to wiki edit wars.

Source code notes
Newlines and whitespace are ignored.

Comments are pythonic (#).

Variables are printed to stdout.

Examples
Hello World: http://en.wikipedia.org/wiki/Kevin_Bacon[534] #H http://en.wikipedia.org/wiki/Kevin_Bacon[549] #e http://en.wikipedia.org/wiki/Kevin_Bacon[519] #l http://en.wikipedia.org/wiki/Kevin_Bacon[519] #l http://en.wikipedia.org/wiki/Kevin_Bacon[541] #o http://en.wikipedia.org/wiki/Kevin_Bacon[474] # http://en.wikipedia.org/wiki/Kevin_Bacon[1091] #W http://en.wikipedia.org/wiki/Kevin_Bacon[541] #o http://en.wikipedia.org/wiki/Kevin_Bacon[1110] #r http://en.wikipedia.org/wiki/Kevin_Bacon[265] #l http://en.wikipedia.org/wiki/Kevin_Bacon[308] #d

Sorting numbers:

I'm kind of stuck on this one.