Added to TW-Scripts and Yazd! By the way, to document macro could Mark explain the logic a little bit?
For cross checking the below link may be helpful http://www.unitconversion.org/unit_converter/numbers.html Mohammad On Friday, October 11, 2019 at 5:15:12 PM UTC+3:30, @TiddlyTweeter wrote: > > In another thread Mark S. presented a magic macro to convert from decimal > to other bases. > > I think its a rather marvellous bit of coding.* I have no idea how it > works*, but it does work well. > > Its a VERY good illustration of using TW macros to achieve something > specific in a direct very useful, economic way. > > This is my slight cosmetic re-order of it for converting decimal to > base-2 through to base-36. > > \define base-convertor(num,base,result:"") > <$list filter="[<__num__>remainder<__base__>add[1]]" variable=remidx> > <$list filter="[<__num__>divide<__base__>trunc[]]" variable=num> > <$list filter="[enlist<syms>nth<remidx>addsuffix<__result__>]" > variable="result"> > <$list filter="[<num>!regexp[^0$]]" emptyMessage=<<result>>> > <$macrocall $name=base-convertor num=<<num>> base="$base$" > result=<<result>>/> > </$list> > </$list> > </$list> > </$list> > \end > > \define re-base(base,num) > <$vars > syms="0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X > Y Z" > > > <<base-convertor $num$ $base$>> > </$vars> > \end > > Syntax: re-base "base" "decimal input" > Supports base-2 to base-36. > > ;Examples > :1025 decimal = <<re-base 2 1025>> base 2 > :1025 decimal = <<re-base 10 1025>> base 10 > :1025 decimal = <<re-base 16 1025>> base 16 > :1025 decimal = <<re-base 26 1025>> base 26 > :1025 decimal = <<re-base 27 1025>> base 27 > :1025 decimal = <<re-base 36 1025>> base 36 > > > Partly Mark responded because I needed that tool to properly document > non-Westren body-part counting systems. > As soon as I had it up I wrote a note for a culture that counts in > base-27. I could not have done it without it. > > Thanks Mark! > > [image: Annotation 2019-10-11 145847.jpg] > > > Best wishes > TT > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/65f3a4a9-25f4-4d11-96d9-0d185b2f7e62%40googlegroups.com.

