Hello, Mohammad, BurningTreeC, everybody — I'm the author of the range filter. The long and short of it is, this is not a "programmer's range" like a for-loop in C. This is a "layman's range" which uses natural numbers by default, includes the end-value, and counts from begin to end. The sign of step size is ignored. I chose to do this instead of disallowing negative steps in order to make it fault-tolerant and to make it behave as expected when counting down.
For example, range[10,0,2] produces 10,8,6,4,2,0 because we're counting down by twos. range[10,0,-2] produces the same result because it's also a reasonable way to ask to count down by twos. (We're allowing a double negative, so to speak.) This intuitive behavior produces an unintuitive behavior where range[0,10,-2] counts up... But in terms of the expected uses of the operator, I think it's a purely aesthetic deficiency. I would also like to implement a "programmer's range" at some point that defaults <begin> to 0, does not include <end>, and respects the sign of <step>, producing a zero-length list when it doesn't match up. That operator would behave much more like a for-loop and would be used for similar purposes, especially with my formula plugin. (I might introduce it there before making a PR to TiddlyWiki.) On Sunday, December 2, 2018 at 9:36:20 PM UTC-6, Mohammad wrote: > > @Mark > That's right! But the code is error prone! If you change the begin end by > mistake it still works! > My sygesstion is > > range[a,b], if a< b then step=1 > range[a,b], if a>b then step=-1 > range[a,b,c], if a<b, then c>0 otherwise empty list > range [a,b,c] if a a>b then c<0 otherwise empty list > > > The python range function can used to correct the code! > > Mohammad > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/b296db6d-960b-4584-b894-9bcb3022b38a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

