File tree Expand file tree Collapse file tree
resistor-color-trio/.meta Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313
1414jobs :
1515 verify_exercises :
16- # apk has an old nu version, so alpine is used to ensure compatibility
1716 runs-on : ubuntu-24.04
1817
1918 steps :
@@ -22,11 +21,11 @@ jobs:
2221
2322 - name : Use nushell
2423 run : |
25- curl -L -o nu.tar.gz https://github.com/nushell/nushell/releases/download/0.104.1 /nu-0.104.1 -x86_64-unknown-linux-gnu.tar.gz && \
24+ curl -L -o nu.tar.gz https://github.com/nushell/nushell/releases/download/0.111.0 /nu-0.111.0 -x86_64-unknown-linux-gnu.tar.gz && \
2625 tar -xzf nu.tar.gz && \
27- sudo mv nu-0.104.1 -x86_64-unknown-linux-gnu/* /usr/bin/ && \
26+ sudo mv nu-0.111.0 -x86_64-unknown-linux-gnu/* /usr/bin/ && \
2827 rm nu.tar.gz && \
29- rm -r nu-0.104.1 -x86_64-unknown-linux-gnu
28+ rm -r nu-0.111.0 -x86_64-unknown-linux-gnu
3029
3130
3231 - name : Verify all exercises
Original file line number Diff line number Diff line change 1+ alias find = find - n
12def macro ? [item ] {
23 let trimmed = ($item | str trim )
34 ($trimmed | find -- regex " ^:\\ s+[^\\ s]+\\ s+.+\\ s+;$" ) == $trimmed
@@ -168,4 +169,4 @@ export def evaluate [instructions: list<string>] {
168169 $stack = perform $stack $norm
169170 }
170171 $stack
171- }
172+ }
Original file line number Diff line number Diff line change 11def color_code [color ] {
22 [black brown red orange yellow green blue violet grey white ]
33 | enumerate
4- | filter {| item | $item .item == $color }
4+ | where $it .item == $color
55 | get index
66 | get 0
77}
88export def value [colors ] {
99 (color_code $colors.0 ) * 10 + (color_code $colors.1 )
10- }
10+ }
Original file line number Diff line number Diff line change 11def color_code [color ] {
22 [black brown red orange yellow green blue violet grey white ]
33 | enumerate
4- | filter {| item | $item .item == $color }
4+ | where $it .item == $color
55 | get index
66 | get 0
77}
@@ -14,13 +14,13 @@ def unit [] {
1414 if $ohms < 1_000 {
1515 $" ($ohms ) ohms"
1616 } else if $ohms < 1_000_000 {
17- $" ($ohms / 1_000 ) kiloohms"
17+ $" ($ohms // 1_000 ) kiloohms"
1818 } else if $ohms < 1_000_000_000 {
19- $" ($ohms / 1_000_000 ) megaohms"
19+ $" ($ohms // 1_000_000 ) megaohms"
2020 } else {
21- $" ($ohms / 1_000_000_000 ) gigaohms"
21+ $" ($ohms // 1_000_000_000 ) gigaohms"
2222 }
2323}
2424export def label [colors ] {
2525 (value $colors ) * 10 ** ((color_code $colors.2 )) | unit
26- }
26+ }
Original file line number Diff line number Diff line change 11export def color_code [color ] {
2- colors | enumerate | filter {| item | $item .item == $color } | get index | get 0
2+ colors | enumerate | where $it .item == $color | get index | get 0
33}
44
55export def colors [] {
66 [black brown red orange yellow green blue violet grey white ]
7- }
7+ }
You can’t perform that action at this time.
0 commit comments