A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/NonlinearFruit/advent-of-code-2024 below:

NonlinearFruit/advent-of-code-2024: Using thematic puzzles to TDD in Nushell


          .-----.          .------------------.         
       .--'~ ~ ~|        .-' *       \  /     '-.   1 **
    .--'~  ,* ~ |        |  >o<   \_\_\|_/__/   |   2 **
.---': ~ '(~), ~|        | >@>O< o-_/.()__------|   3 **
|@..#'. ~ " ' ~ |        |>O>o<@< \____       .'|   4 **
|               |        |          ..          |   5 
|               |        |        .'  '.        |   6 
|               |        |        |    |        |   7 
|   .--.        |        |        |    |        |   8 
'---'  |        |        |        |    |        |   9 
       |        |        |        |    |        |  10 
       |        |        |        |    |        |  11 
       |        |        |        |    |        |  12 
       |        |        |        |    |        |  13 
       |        |        |        |    |        |  14 
       |        |        |        |    |        |  15 
       |        |        |        |    |        |  16 
       |        |        |        |    |        |  17 
       |        |        |        |    |        |  18 
       |        |        |        |    |        |  19 
       |        |        |        '.  .'        |  20 
.------'        '------. |          ''          |  21 
|                      | |                      |  22 
|                      | |                      |  23 
|                      | |                      |  24 
|                      | '-.                  .-'  25 
'----------------------'   '------------------'         

Nushell was placed on my radar in early 2023. My gut reaction was 'I hate powershell'. With some persistance from friends, the idea of Nushell was starting to take root. In the fall, it was time to put pen to paper and satiate my curiousity. Advent of Code 2023 (source) was the testing ground. I learned a lot about Nushell and started using it day-to-day for scripting. The built-in testing framework was sunsetted at some point in 2024. That was a problem so I built nuUnit (source).

This year when Advent of Code 2024 came around, I evaluated several other languages. In a proper familiar language, maybe I could complete all 25 days... It also could be a great chance to learn Clojure or Go... Practicing Lua or Python would be fun... But it was hard to resist battle testing nuUnit and pushing Nushell to it's limits. So I buckled in for another rocky ride exploring what Nushel is capable of.

cargo install nushell # https://github.com/nushell/nushell
cargo install aoc-cli # https://github.com/scarvalhojr/aoc-cli
vim ~/.adventofcode.session # https://github.com/scarvalhojr/aoc-cli?tab=readme-ov-file#session-cookie
nu -c 'use toolkit.nu; toolkit pull puzzle'
Download the puzzle input and description

Usage:
  > pull puzzle <day> 

Flags:
  -h, --help: Display the help message for this command

Parameters:
  day <int>

Input/output types:
  ╭───┬───────┬────────╮
  │ # │ input │ output │
  ├───┼───────┼────────┤
  │ 0 │ any   │ any    │
  ╰───┴───────┴────────╯


nu -c 'use toolkit.nu; toolkit run puzzle'
Run a puzzle solver

Usage:
  > run puzzle <day> 

Flags:
  -h, --help: Display the help message for this command

Parameters:
  day <int>

Input/output types:
  ╭───┬───────┬────────╮
  │ # │ input │ output │
  ├───┼───────┼────────┤
  │ 0 │ any   │ any    │
  ╰───┴───────┴────────╯


nu -c 'use toolkit.nu; toolkit submit answer'
Submit an answer to a puzzle

Usage:
  > submit answer <day> 

Flags:
  -h, --help: Display the help message for this command

Parameters:
  day <int>

Input/output types:
  ╭───┬───────┬────────╮
  │ # │ input │ output │
  ├───┼───────┼────────┤
  │ 0 │ any   │ any    │
  ╰───┴───────┴────────╯


nu -c 'use toolkit.nu; toolkit update readme'
Recalculate the README

Usage:
  > update readme 

Flags:
  -h, --help: Display the help message for this command

Input/output types:
  ╭───┬───────┬────────╮
  │ # │ input │ output │
  ├───┼───────┼────────┤
  │ 0 │ any   │ any    │
  ╰───┴───────┴────────╯


Nushell v0.100.0: Lessons Learned

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4