Refinement Help output
[1/5] from: ptretter::charter::net at: 20-Aug-2000 22:09
I got the following function which I enhanced from a previous posting with
some help from members of this list. How do you get help to display the
comments for the refinements.
Paul Tretter
dec2bin: func[
"Converts Based 10 Integers to Binary"
dn [integer!] "Base 10 Integer"
/local holder neghold
/pad+ zr+ [string!] "Add String to beginning of Output value"
/pad- zr- [string!] "Add String to tail of Output value"
/rev "Reverses the normal output of the value"][
holder: make string! ""
if dn = 0 [holder: "0"]
if negative? dn [
dn: absolute dn
neghold: 1]
while [dn / 2 <> 0][
either dn // 2 > 0 [insert holder 1][insert holder 0]
dn: to-integer dn / 2
]
if rev [reverse holder]
if pad+ [insert head holder zr+]
if pad- [insert tail holder zr-]
if neghold = 1 [return join "-" holder]
return holder
]
[2/5] from: allen:rebolforces at: 21-Aug-2000 13:43
Hi Paul,
/local should always be the last refinement. (Because everything from
/local
to "]" is local, which allows multiple lines of locals to be
declared.)
Change the order so /local is the last refinement, and it will work as
expected.
Cheers,
Allen K
[3/5] from: al:bri:xtra at: 21-Aug-2000 15:47
Allen wrote:
> /local should always be the last refinement. (Because everything from
/local
to "]" is local, which allows multiple lines of locals to be
declared.)
> Change the order so /local is the last refinement, and it will work as
expected.
It's for these reasons that I prefer to use 'function with it's block for
locals. Then I automatically avoid this problem.
Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
[4/5] from: ptretter:charter at: 20-Aug-2000 22:54
Thanks. That works.
[5/5] from: bhandley:zip:au at: 21-Aug-2000 16:34
You made all your refinements and their arguments local. You will need to
move the "/local..." after the description for "/rev".
Brett.