Hello Evan,
 Many thanks for your clarification! Formula plugin is a very useful tool 
and I am using it. Yes, I expect a programmer range like Python.


What do you think if we make the below change in range.js code! I revised 
it in Formula plugin 
<http://evanbalster.com/tiddlywiki/formulas.html#%24%3A%2Fplugins%2Febalster%2Fformula%2Ffilters%2Frange.js>
 here 
in your formula wiki.



switch (parts.length) {
case 1:
beg = 0;
end = parts[0];
inc = 1;
break;
case 2:
beg = parts[0];
end = parts[1];
inc = 1;
break;
case 3:
beg = parts[0];
end = parts[1];
//inc = Math.abs(parts[2]);
                        inc = parts[2];


if (inc === 0) return ["range: increment 0 causes infinite loop"];

        if (end>beg) {
            if (inc < 0) return ["range: wrong increment, step>0 is 
required"];

            }

        if (end<beg) {
            if (inc > 0) return ["range: wrong increment, step<0 is 
required"];

            }

break;
  }    

// May need to count backwards
// var direction = ((end<beg) ? -1 : 1);
// inc *= direction;
var direction = 1;


Note to the part starts with 
case 3:

Also I removed direction.

It works now as below:


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
>>
>>  

I have attached the revised code here!

What do you think?

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/667a1e86-2676-46b6-ac71-e847af20fa33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: $__plugins_ebalster_formula_filters_range.js.tid
Description: Binary data

Reply via email to