Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exercises(zebra-puzzle): implement #575

Merged
merged 9 commits into from
Apr 6, 2024
Merged

exercises(zebra-puzzle): implement #575

merged 9 commits into from
Apr 6, 2024

Conversation

ErikSchierboom
Copy link
Member

No description provided.

@ErikSchierboom ErikSchierboom requested a review from ee7 April 6, 2024 09:03
Copy link
Member

@ee7 ee7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix minor formatting issues, otherwise LGTM.

Verified configlet sync:

$ git log -1 --oneline
316e3e4b (HEAD -> add-zebra-puzzle, exercism/add-zebra-puzzle) Add `zebra-puzzle` exercise
$ bin/configlet sync -e zebra-puzzle
Updating cached 'problem-specifications' data...
Checking exercises...
The `zebra-puzzle` exercise has up-to-date docs, filepaths, metadata, and tests!

exercises/practice/zebra-puzzle/.meta/example.nim Outdated Show resolved Hide resolved
exercises/practice/zebra-puzzle/.meta/example.nim Outdated Show resolved Hide resolved
exercises/practice/zebra-puzzle/.meta/example.nim Outdated Show resolved Hide resolved
@ee7 ee7 changed the title Add zebra-puzzle exercise exercises(zebra-puzzle): implement Apr 6, 2024
ee7 added 8 commits April 6, 2024 12:26
These were the only empty trailing parens in the repo. Before this
commit, running in the repo root directory:

    $ git grep --break --heading '(): ' -- '*.nim'
    exercises/practice/zebra:puzzle/.meta/example.nim
    25:iterator permutations[T](): array[5, T] =
    31:proc solve(): Solution =
    58:proc waterDrunkBy*(): Nationality =
    61:proc zebraOwnedBy*(): Nationality =

    exercises/practice/zebra:puzzle/zebra_puzzle.nim
    5:proc waterDrunkBy*(): Nationality =
    8:proc zebraOwnedBy*(): Nationality =
There should be a hyphen in "compile-time solution", but not in "calculate
at compile time".

From e.g. the Google developer documentation style guide [1]:

    Use the noun runtime when referring to the environment in which
    software runs, such as a Ruby or Java runtime.

    Use the noun phrase run time when referring to the time during
    program execution when something occurs, as contrasted with
    compile time, for example.

    Recommended: The profiler collects data at run time, and the
    scheduler uses this data at compile time to improve performance for
    subsequent runs.

[1] https://developers.google.com/style/word-list#runtime
There's a precedent for new test files using this style [1][2].

The older test files will be changed later, ensuring that tests don't
get re-run.

[1] 155cf46, 2023-03-06, "exercises(linked-list): implement"
[2] fab149e, 2023-03-07, "exercises(binary-search): implement"
Resolve compiler warning:

    Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
The other example solutions in this repo use `proc` only if `func` is
not possible:

    $ git grep --break --heading 'proc ' -- '*example.nim'
    exercises/practice/diffie:hellman/.meta/example.nim
    19:proc privateKey*(p: int): int =

    exercises/practice/dnd:character/.meta/example.nim
    15:proc ability*: int =
    27:proc initCharacter*: Character =

    exercises/practice/gigasecond/.meta/example.nim
    3:proc addGigasecond*(date: DateTime): DateTime =

    exercises/practice/linked:list/.meta/example.nim
    16:proc push*[T](list: var LinkedList[T], val: T) =
    26:proc unshift*[T](list: var LinkedList[T], val: T) =
    36:proc pop*[T](list: var LinkedList[T]): T =
    43:proc shift*[T](list: var LinkedList[T]): T =
    58:proc delete*[T](list: var LinkedList[T], val: T) =

    exercises/practice/meetup/.meta/example.nim
    9:proc meetup*(y: int, m: int, sched: Schedule, d: WeekDay): string =

    exercises/practice/nth:prime/.meta/example.nim
    25:proc prime*(n: int): int =

    exercises/practice/prime:factors/.meta/example.nim
    28:proc primeFactors*(n: int64): seq[int] =

    exercises/practice/react/.meta/example.nim
    35:proc newComputeCell*(dependencies: seq[Cell], compute: ComputeFunc): Cell =
    42:proc `value=`*(cell: Cell, val: int) =
    51:proc addCallback*(cell: Cell, callback: Callback) =
    54:proc removeCallback*(cell: Cell, callback: Callback) =

    exercises/practice/robot:name/.meta/example.nim
    11:proc shuffledNames: seq[Name] =
    34:proc getUnusedName: Name {.inline.} =
    40:proc makeRobot*: Robot {.inline.} =
    43:proc reset*(r: var Robot) {.inline.} =
@ee7
Copy link
Member

ee7 commented Apr 6, 2024

I'll take the liberty of pushing the nits, to save us both a bit of time. See the commit messages. Please yell at me if you object to anything there.

Copy link
Member

@ee7 ee7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Merging.

@ee7 ee7 merged commit 933068d into main Apr 6, 2024
19 checks passed
@ee7 ee7 deleted the add-zebra-puzzle branch April 6, 2024 11:14
@ErikSchierboom
Copy link
Member Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants