Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:

jobs:
verify_exercises:
# apk has an old nu version, so alpine is used to ensure compatibility
runs-on: ubuntu-24.04

steps:
Expand All @@ -22,11 +21,11 @@ jobs:

- name: Use nushell
run: |
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 && \
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 && \
tar -xzf nu.tar.gz && \
sudo mv nu-0.104.1-x86_64-unknown-linux-gnu/* /usr/bin/ && \
sudo mv nu-0.111.0-x86_64-unknown-linux-gnu/* /usr/bin/ && \
rm nu.tar.gz && \
rm -r nu-0.104.1-x86_64-unknown-linux-gnu
rm -r nu-0.111.0-x86_64-unknown-linux-gnu


- name: Verify all exercises
Expand Down
3 changes: 2 additions & 1 deletion exercises/practice/forth/.meta/example.nu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
alias find = find -n
def macro? [item] {
let trimmed = ($item | str trim)
($trimmed | find --regex "^:\\s+[^\\s]+\\s+.+\\s+;$") == $trimmed
Expand Down Expand Up @@ -168,4 +169,4 @@ export def evaluate [instructions: list<string>] {
$stack = perform $stack $norm
}
$stack
}
}
4 changes: 2 additions & 2 deletions exercises/practice/resistor-color-duo/.meta/example.nu
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
def color_code [color] {
[black brown red orange yellow green blue violet grey white]
| enumerate
| filter {|item| $item.item == $color}
| where $it.item == $color
| get index
| get 0
}
export def value [colors] {
(color_code $colors.0) * 10 + (color_code $colors.1)
}
}
10 changes: 5 additions & 5 deletions exercises/practice/resistor-color-trio/.meta/example.nu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def color_code [color] {
[black brown red orange yellow green blue violet grey white]
| enumerate
| filter {|item| $item.item == $color}
| where $it.item == $color
| get index
| get 0
}
Expand All @@ -14,13 +14,13 @@ def unit [] {
if $ohms < 1_000 {
$"($ohms) ohms"
} else if $ohms < 1_000_000 {
$"($ohms / 1_000) kiloohms"
$"($ohms // 1_000) kiloohms"
} else if $ohms < 1_000_000_000 {
$"($ohms / 1_000_000) megaohms"
$"($ohms // 1_000_000) megaohms"
} else {
$"($ohms / 1_000_000_000) gigaohms"
$"($ohms // 1_000_000_000) gigaohms"
}
}
export def label [colors] {
(value $colors) * 10 ** ((color_code $colors.2)) | unit
}
}
4 changes: 2 additions & 2 deletions exercises/practice/resistor-color/.meta/example.nu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export def color_code [color] {
colors | enumerate | filter {|item| $item.item == $color} | get index | get 0
colors | enumerate | where $it.item == $color | get index | get 0
}

export def colors [] {
[black brown red orange yellow green blue violet grey white]
}
}
Loading