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

[REBOL] Re: CORE experimental 2.4.39

From: lmecir:mbox:vol:cz at: 25-Nov-2000 18:34

> [Func context extent] > > My research is showing me, that the opposite is correct: The "indefinite > > extent" functions' behaviour is simpler/more natural/more useful for a
> > than the behaviour of its "definite extent" counterpart (that's probably
> > reason, why Carl introduced "indefinite extent" to Rebol), and,
> > there *is* a way, how to make such functions faster, than the Rebol > > functions are nowadays. > > This seems interesting... Would you mind explaining how? :-) > > Regards, > Gabriele.
thank you for the question. First, I would like to show you an example illustrating the benefits of the "indefinite extent" functions. They are a tool allowing us to generate some useful parse rules: a-b-rule: e-func [ {Generate an A-B parse rule} a [block!] {A-rule} b [block!] {B-rule} /local res-rule ] [ [ [ b (res-rule: [to end skip]) | (res-rule: a) ] res-rule ] ] { Example: a: [any "a" "b"] b: ["aa"] a-b: a-b-rule a b parse "ab" a-b parse "aab" a-b } not-rule: e-func [ "Generate a not A parse rule" a [block!] {A-rule} /local res-rule ] [ [ [ a (res-rule: [to end skip]) | (res-rule: []) ] res-rule ] ] { Example: a: [any "a" "b"] not-a: not-rule a parse "ab" not-a parse "b" not-a parse "" not-a } For the above to work correctly, you should use E-func (my implementation of indefinite extent func) contained at: and the latest Rebol/Core experimental. If you recall my latest attempt to write the above, you should remember, that the implementation was much more complicated, yet it didn't behave correctly in some circumstances... (For all fans of Highfun: the newest version contains corrected Cfor, new Nm-use/E-func and simplified Curry/Refine.) Now to the speed. The speed of the function evaluation is a result of a trade-off. The Rebol function evaluation speed seems to be in relation with the function modification speed. The faster you allow to be the modification, the worse conditions you have to improve the evaluation speed. I think, that there is a way, how to slow down the modification for the benefit of the evaluation. In that case the evaluation speed for the indefinite extent functions can easily become higher, than the speed of the "definite extent" functions evaluation now is. Regards Ladislav