Suggestion for Rebol-list
[1/2] from: rebolinth::nodep::dds::nl at: 14-Mar-2002 19:27
Hello All and RT,
I have a suggestion???
Why not make a suggestion listing comming from the rebol-list?
Im noticing that there is many input from users maybe we can
summerize those per Rebol/xxx package and present them to the Rebol Team?
Thats easier for us and for the RT..
I.e. I have some enhancements I would like to see inside rebol/core
but maybe someone else also has this suggestion?...etc....
Like:>
to-positive: func ["Converts to positive value." value "Value to convert"]
[to integer! :value ] [ value: value - (value + value) ]
to-negative: func ["Converts to positive value." value "Value to convert"]
[to integer! :value] [ value: - value ]
and some more...
Its just a kick infront of the goal...but lets see who is interested
in sharing the thought??
(R)egards,
Norman.
[2/2] from: joel:neely:fedex at: 14-Mar-2002 19:57
Hi, Norman,
[rebolinth--nodep--dds--nl] wrote:
> to-positive: func ["Converts to positive value." value "Value to convert"]
> [to integer! :value ] [ value: value - (value + value) ]
>
> to-negative: func ["Converts to positive value." value "Value to convert"]
> [to integer! :value] [ value: - value ]
>
The existing REBOL word ABS returns the non-negative (don't
forget about zero! ;-) magnitude of its argument, as in
>> abs 5
== 5
>> abs -5
== 5
AFAICT, that's what TO-POSITIVE was expected to do.
Romano has already mentioned NEGATE, which seems to cover the
goal of TO-NEGATIVE.
Finally, on notation and style, you could drop the
value:
from both of your proposed functions, simply allowing the
value of the remaining expression to be returned.
-jn-
--
; sub REBOL {}; sub head ($) {@_[0]}
REBOL []
# despam: func [e] [replace replace/all e ":" "." "#" "@"]
; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"}
print head reverse despam "moc:xedef#yleen:leoj" ;