New rule function "backtrack" & reflect #
#9
(10-01-2012, 10:45 AM)atom Wrote: Lets say you have "m1" for memorize, "m2" for append buffer and "m3" for prepend buffer.

The rule: m1 r [ m3

Should do the same as "b".

m1 remembers the original buffer "p@ssW0rd".

r reverses it, so it becomes "dr0Wss@p"

[ removes the first character, so it becomes "r0Wss@p"

m3 prepends the saved buffer, so it becomes p@ssW0rdr0Wss@p

But there should be a lot of other scenarios where this could be used

Very interesting, yes. There may be a better way but off the top of my head my other function suggestions BN/FN could be implemented using your new method as:

Code:
f/F1 : f (obviously)

Equivalent to FN (for N > 1):
N Even : m1 f p((N/2)-1) m2
N Odd  : f p((N-1)/2)

&

b/B1 : m1 r [ m3 <- As you pointed out

Equivalent to BN (for N > 1):
N Even : m1 r ] m2 [ p((N/2)-1) m3
N Odd  : m1 r [ m3 m1 ] p(((N-1)/2)-1) m2

Where p0 is assumed to fall out / do nothing.

Obviously these are significantly more complex for this specific use-case than b/BN/FN, but the extra flexibility is very nice.

Perhaps you could consider going one step further with this idea and allow manipulation of the buffer itself using standard rule functions prepended by m. For instance:

m$s <- append s to the buffer
mr <- reverse the buffer
mp3 <- duplicate the buffer three time

etc..

Allowing this kind of functionality could really give a ton of flexibility. Either way though, this buffer idea is a good one, and would be very welcome.


Messages In This Thread
RE: New rule function "backtrack" & reflect # - by pragmatic - 10-03-2012, 06:57 PM