Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: ROUND function (like TRUNC, FLOOR, etc...)

From: joel:neely:fedex at: 18-Feb-2002 6:38

BEWARE: Totally unofficial and unsanctioned opinion... [riusa--email--it] wrote:
> after this... a curiosity: why Rebol does not implement native round > functions? >
It appears to me that -- for the most part -- REBOL includes as native functions only those things that are: * critical to the core mission of REBOL, and * impractical to implement effectively as mezzanines. For example, parsing of strings is crucial to the concept of REBOL as a "messaging language". I also suspect that a version of PARSE built on top of explicit string/series manipulation via INDEX, NEXT, BACK, etc. would be substantially slower (based on small experiments, but no inside knowledge...) In contrast, a rounding function is both trivial to write round: func [x [decimal!]][ to-integer x + either x < 0 [-0.5][0.5] ] and only occasionally needed that it misses on both of the criteria mentioned above. I realize that this is not a perfect model (given the existence of such trivial shortcuts as CONTEXT, DOES, and HAS) but nobody's perfect! ;-) -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" ;