Old 05-10-2022, 01:17 PM   #1
Frantick
Human being with feelings
 
Join Date: Aug 2012
Posts: 28
Default How Walter expressions are evaluated?

Hi, I wanted to tweak the theme a bit, but I don't understand how the walter expressions are evaluated.
Documentation is very brief on this subject and search I run on forum was not productive either. I try to modify this line
Code:
set tcp_LabelSize      tcp_control_align{0}==2 + - tcp_LabelSize{0} * tcp_indent{0} folderdepth{0} * maxfolderdepth{0} tcp_indent{0} ; extend names for fist line alignment
I'm confused by the adjacent operators right after the first check and the lack of any operators between some variables.

or some more extreme example that can be found few lines before the one mentioned
Code:
set meter_sec           + + + * scale + [0 0 tcp_MeterSize{0}] [0 0 33] [folder_sec{2} 0 0 h] h<soloFlip_h{0} tcp_MeterSize{0}<tcp_MeterSize_min{0} * scale [0 0 17] [0] [0] [0]
+ + + *

Can someone more experienced with Walter help me understand the concept behind using multiple operators by going step by step through what is added/subtracted/multiplied with what in those examples?
Frantick is offline   Reply With Quote
Old 05-10-2022, 02:30 PM   #2
White Tie
Pixel Pusher
 
White Tie's Avatar
 
Join Date: Mar 2007
Location: Blighty
Posts: 4,950
Default

Walter uses Polish Notation. See WALTER : A themer's guide p11,

Code:
set tcp_LabelSize      tcp_control_align{0}==2 + - tcp_LabelSize{0} * tcp_indent{0} folderdepth{0} * maxfolderdepth{0} tcp_indent{0}
is

Code:
set tcp_LabelSize      
   tcp_control_align{0}==2 
      + 
        - 
           tcp_LabelSize{0} 
           * tcp_indent{0} folderdepth{0} 
        * maxfolderdepth{0} tcp_indent{0}

Your second example is so convoluted I'm afraid I lost the will to live half way through, which brings me to my point: do you really care? There's nothing to learn here, its all simple stuff but a bit too much of it. This is someone else's code, and if that person is anything like me (or maybe it is me!) then each line probably grew like mould on a piece of cheese till it was this big unwieldy thing.

Once you start writing your own Walter, you'll write lots of silly lines like that. And then you'll come back to them a few days later and just stare at the line going "whaaaaaaat?" but then noticing that your theme works so who cares
__________________
The House of White Tie
White Tie is offline   Reply With Quote
Old 05-10-2022, 03:18 PM   #3
ernzo
Human being with feelings
 
ernzo's Avatar
 
Join Date: Sep 2013
Posts: 715
Default

A-ha, this is a Great example,
as it goes beyond what's explained on the guide having 4 consecutive operators..
ernzo is offline   Reply With Quote
Old 05-11-2022, 01:17 PM   #4
Frantick
Human being with feelings
 
Join Date: Aug 2012
Posts: 28
Default

@White Tie
Thank you very much, and you had a good hunch, both of these examples are excerpts from the default 6 theme.

Edit:
I read the wiki and it is indeed not black magic as it seemed at first.
And to answer my question for a step-by-step explanation in more "regular math", I leave it here for another wandering soul like me (hope I got it right)

if tcp_control_align{0}==2 then

+ - tcp_LabelSize{0} * tcp_indent{0} folderdepth{0} * maxfolderdepth{0} tcp_indent{0}

become
step 1:

+ - tcp_LabelSize{0} (tcp_indent{0} * folderdepth{0}) ( maxfolderdepth{0} * tcp_indent{0})

step 2:

+ (tcp_LabelSize{0} - (]tcp_indent{0} * folderdepth{0})) ( maxfolderdepth{0} * tcp_indent{0})

step 3:

(tcp_LabelSize{0} - (tcp_indent{0} * folderdepth{0})) + ( maxfolderdepth{0} * tcp_indent{0})

Last edited by Frantick; 05-11-2022 at 02:20 PM.
Frantick is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.