Re: Need XOR solution
Re: Need XOR solution
- Subject: Re: Need XOR solution
- From: "Arthur J. Knapp" <email@hidden>
- Date: Wed, 07 Aug 2002 11:22:06 -0400
>
Date: Tue, 06 Aug 2002 22:22:57 -0400
>
From: "Marc K. Myers" <email@hidden>
>
Subject: Re: Need XOR solution
>
> From: "Arthur J. Knapp" <email@hidden>
>
> This is unlikely to be the right direction, but you may find
>
> my "manual" XORing to be interesting:
>
> on Bitify(n)
>
> return {n div 128 mod 2 `
>
> , n div 64 mod 2 `
>
> , n div 32 mod 2 `
>
> , n div 16 mod 2 `
>
> , n div 8 mod 2 `
>
> , n div 4 mod 2 `
>
> , n div 2 mod 2 `
>
> , n mod 2}
>
> on CharXOR(a, b)
>
> set o to text item delimiters
>
> set aa to my Bitify(my AsciiNumber_t(a))
>
> set bb to my Bitify(my AsciiNumber_t(b))
>
> set text item delimiters to o
>
> set cc to my Xorify(aa, bb)
>
> return my AsciiCharacter(my Numify(cc))
>
I find it more than interesting; I find it mind-boggling. I've printed
>
it out and will attempt to understand it gradually at my leisure. I
>
really like the "Bitify" routine which is much simpler than the one I
>
was playing with to get bytes as bit patterns.
Yes, the Bitify handler is nice and simple. I keep meaning to properly
speed-test it against repeat loops for doing the same thing. One thing
that may confuse some people is the text item delimiters situation.
Bascially, I perform a save and restore in the main handler, CharXOR(),
so that each AsciiNumber_t() handler doesn't have to, (the "_t" is a
warning that the handler sets the tids but makes no attempt to restore
them).
>
One thing I definitely don't understand at this point is why you use the
>
"my" preceeding the handler calls. I tried the script with all the
>
"my"s removed and got the same results. Aren't handler calls always
>
processed at the script level unless they're in a tell block?
Yes, sorry. :)
Recently, I have been deeply involved in a project involving script
objects with inherited properties and handlers, and I've gotten to the
point where I type the word "my" in my sleep. ;-)
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.