Pairs (was It's a list!...) (was Function Newbie...)
erik hansen
erikhans08 at yahoo.com
Sat Dec 7 15:04:01 EST 2002
--- Dar Scott <dsc at swcp.com> wrote:
> -- Rev 1.1.1 OS X 10.15
>
> -- Pairs
> -- Dar Scott thunked this up 2002
> --
> -- Make a pair with P(a,b), extract with
> L(p)-->a, R(p)-->b
>
> -- create a pair from two strings, the left and
> the right
> function P A B
> local lenBytes
> put A & empty into A
> put binaryEncode("N",length(A)) into
> lenBytes
> return lenBytes & A & B
> end P
>
> -- get the left side of a pair
> function L thePair
> local lenBytes, lenNum, numConverted
> put char 1 to 4 of thePair into lenBytes
> put binaryDecode("N",lenBytes,lenNum) into
> numConverted
> if numConverted is not 1 then return empty
> return char 5 to (lenNum+4) of thePair
> end L
>
> --get the right side of a pair
> function R thePair
> local lenBytes, lenNum, numConverted
> put char 1 to 4 of thePair into lenBytes
> put binaryDecode("N",lenBytes,lenNum) into
> numConverted
> if numConverted is not 1 then return empty
> return char (lenNum+5) to -1 of thePair
> end R
if all of this "binary" business relates to MIDI,
please comment.
=====
erik at erikhansen.org http://www.erikhansen.org
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
More information about the use-livecode
mailing list