Difference between revisions of "Template:Quick links smart lingo"

From QBWiki
Jump to navigation Jump to search
m
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#vardefine:index|{{{1|1}}}}}{{#if:{{Quick links lingo|{{#var:index}}}}
+
{{Smart lookup|Quick links lingo|{{{1|1}}}}}<noinclude>
|{{Quick links lingo|{{#var:index}}}}
+
 
|{{#vardefine:minindex|{{#var:index}}}}{{#vardefine:maxindex|1}}<!--
+
Incremental improvement on [[Template:Quick links lingo]]
just for fun, binary search for last list entry if out of bounds
+
 
-->{{#dowhile:
 
|{{#ifexpr:{{#var:maxindex}}+1<{{#var:minindex}}|continue}}
 
|{{#if:{{Quick links lingo|{{#var:index}}}}
 
<!--undershoot-->|{{#ifexpr:{{#var:index}}>{{#var:maxindex}}|{{#vardefine:maxindex|{{#var:index}}}}}}
 
<!-- overshoot-->|{{#ifexpr:{{#var:index}}<{{#var:minindex}}|{{#vardefine:minindex|{{#var:index}}}}}}
 
}}
 
{{#vardefine:index|{{#expr:floor(({{#var:maxindex}}+{{#var:minindex}})/2)}}}}
 
}}{{#vardefine:adjusted_index|{{#expr:({{{1|1}}} mod {{#var:index}})}}}}{{#ifexpr:{{#var:adjusted_index}}=0|{{#vardefine:adjusted_index|{{#var:index}}}}}}{{Quick links lingo|{{#var:adjusted_index}}}}
 
}}
 
<noinclude>
 
 
When index i <= # of lingo quips, return quip straight away. If i > #, it'll wrap around (mod #).
 
When index i <= # of lingo quips, return quip straight away. If i > #, it'll wrap around (mod #).
  

Latest revision as of 14:07, 8 December 2025

Confused what a "vulcher" is?

Incremental improvement on Template:Quick links lingo

When index i <= # of lingo quips, return quip straight away. If i > #, it'll wrap around (mod #).

Index Quip
1 Confused what a "vulcher" is? Test sentence
2 Want to find out about "superpowers"? Test sentence
3 Wondering just what makes something "important"? Test sentence