|
|
OK, so I realise absolutely nobody here will think this is in any way
"neat" or "cleaver", but still...
I've managed to construct an interpretter for a kind of primitive logic
programming language. Currently it's extremely hard to operate, and the
output isn't very human-readable, but it can do some interesting stuff.
For example, suppose I define a function "join" as follows:
join(x, y, z) =
x = [] & y = z || x = (t:ts1) & z = (t:ts2) & join(ts1,y,ts2)
In other words, either x is an empty list and y and z are equal, or the
first element of x and z is the same and ... well, you can read.
Given this definition, typing join([1,2,3], [4,5,6], z) yields
z = [1,2,3,4,5,6]
Which is obviously what the answer should be. However, the slightly
bizare thing is that if I do join(x, [4,5,6], [1,2,3,4,5,6]), I get
x = [1,2,3]
In other words, it can "un-join" the list. The join operator works
backwards!
But that's not all. It gets weirder: join([1,2,3], y, [1,2,3,4,5,6] gives
y = [4,5,6]
But now we come to the really mental part: join(x, y, [1,2,3]) yields
x = [] & y = [1,2,3] ||
x = [1] & y = [2,3] ||
x = [1,2] & y = [3] ||
x = [1,2,3] & y = []
In other words, all *possible* ways that x and y could be set such that
their join is [1,2,3]! How neat is that?
OK, I'll sit down now... :-/
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|
|
|
"Jim Henderson" <nos### [at] nospamcom> wrote in message
news:47eac921$1@news.povray.org...
> On Wed, 26 Mar 2008 22:03:54 +0000, St. wrote:
>
>> "Jim Henderson" <nos### [at] nospamcom> wrote in message
>> news:47eabf74$1@news.povray.org...
>>> On Wed, 26 Mar 2008 16:24:30 -0500, Jim Henderson wrote:
>>>
>>>> twaking
>>>
>>> s/twaking/tweaking/
>>>
>>> McKean's law strikes again.....
>>
>> No, "Sods Law" will suffice... ;)
>
> Well, maybe, but McKean's law is much more apropos to the situation, no?
True, true. But Sod's Law will always sneak in there at some point, so
it's got to be relevant. I mean, at some stage when I'm composing an email
or a reply post in OE and I type the word 'the', it will get repeated twice
in a sentence - but I *know* I only typed the word once once once. (Joking.
:) What a weird word 'once' is).
Sods Law. Otherwise, something weird is going on. :oO
~Steve~
>
> Jim
Post a reply to this message
|
|