Mark et all, I think the new reduce operator may simplify this with each byte being converted at a time, making use of the accumulator and index.
Regards 'Tones On Thursday, 3 December 2020 at 17:46:07 UTC+11 TW Tones wrote: > Mark, > > I have followed your code through, More testing but it seems to all make > sense to me now, It would be great if we could turn such code into a > hierarchy chart that also recognised the list re-iterations. The > information is all there so automation would be possible. In this case I > can use the decimals in the range operator to satisfy the OT. > > Thank you > > Regards > Tones > > On Thursday, 3 December 2020 at 17:05:17 UTC+11 TW Tones wrote: > >> Testing, >> >> Nice work, It takes a bit to follow the code, but I am sure I will learn >> something, thanks so much. >> >> You may see it in a Unicode database soon. >> >> Tones >> >> >> On Thursday, 3 December 2020 at 16:53:47 UTC+11 Mark S. wrote: >> >>> Here's a recursive version that that can be any length of hex. Lightly >>> tested. Hopefully it's working OK. >>> >>> \define hex2dec2(byte,mult:1) >>> <$vars >>> myfilter="[search-replace:g[A],[10]search-replace:g[B],[11]search-replace:g[C],[12]search-replace:g[D],[13]search-replace:g[E],[14]search-replace:g[F],[15]]"> >>> <$list filter=" >>> [<__byte__>subfilter<myfilter>] >>> =[<__mult__>] >>> +[product[]] >>> "/> >>> </$vars> >>> \end >>> \define hex2dec-r(hex,mult) >>> <$list filter="[<__mult__>] =16 +[product[]]" variable="mult"> >>> <$list filter="[<__hex__>split[]nth[1]]" variable="byte"> >>> <$list filter="[<__hex__>split[]rest[]join[]]" variable="hex" >>> emptyMessage="<$macrocall $name=hex2dec2 byte=<<__hex__>> >>> mult=<<__mult__>> />" >>> > >>> <$macrocall $name=hex2dec2 byte=<<byte>> mult=<<__mult__>> /> >>> <$macrocall $name="hex2dec-r" hex=<<hex>> mult=<<mult>> /> >>> </$list></$list></$list> >>> \end >>> \define hex2dec-setup(hex) >>> <$list filter="[<__hex__>split[]reverse[]join[]]" variable=rhex> >>> <$macrocall $name=hex2dec-r hex=<<rhex>> mult=1 /> >>> </$list> >>> \end >>> \define hex2dec(hex) >>> <$wikify text="<<hex2dec-setup $hex$>>" name=dec> >>> <$list filter="[enlist<dec>sum[]]"/> >>> </$wikify> >>> \end >>> >>> <<hex2dec F111>> >>> >>> >>> >>> On Wednesday, December 2, 2020 at 5:42:55 PM UTC-8 TW Tones wrote: >>> >>>> Mark, >>>> >>>> Good start. I was thinking how to get 16^0 16^1 16^2 and 16^3 and you >>>> have hard coded it. If moving to a recursive process we may be able to >>>> handle variable length hex. >>>> >>>>> >>>>>>>> -- 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/94bc3380-fe29-4c99-9522-5e19104a3826n%40googlegroups.com.

