Skip to content

Commit

Permalink
Fixing incorrect uses of halt_error
Browse files Browse the repository at this point in the history
  • Loading branch information
glennj committed Oct 1, 2023
1 parent 8f46504 commit 689e72e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions exercises/concept/grade-stats/grade-stats.jq
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
# - "F" is 0% - 59%

def letter_grade:
halt_error("Implement this function");
"Implement this function" | halt_error;


# Given an object that maps a student's name to their grade,
# generate an object that maps the letter grade to the number of
# students with that grade

def count_letter_grades:
halt_error("Implement this function using reduce");
"Implement this function using reduce" | halt_error;
12 changes: 6 additions & 6 deletions exercises/concept/high-score-board/high-score-board.jq
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
# input: none.
# output: a score board object with a default player and score.
def create_score_board:
halt_error("Please implement the create_score_board function");
"Please implement the create_score_board function" | halt_error;

# Add a player to a score board.
# input: a score board object.
# output: the score board with the new player added.
def add_player(player; score):
halt_error("Please implement the add_player function");
"Please implement the add_player function" | halt_error;

# Remove a player from a score board.
# input: a score board object.
# output: the score board with the player removed, if they exist.
def remove_player(player):
halt_error("Please implement the remove_player function");
"Please implement the remove_player function" | halt_error;

# Increase a player's score by the given amount.
# input: a score board object.
# output: the score board with the player's score increased, if they exist.
def update_score(player; points):
halt_error("Please implement the update_score function");
"Please implement the update_score function" | halt_error;

# Apply 100 bonus points to all players on the board.
# input: a score board object.
# output: the score board with each player's score increased.
def apply_monday_bonus:
halt_error("Please implement the apply_monday_bonus function");
"Please implement the apply_monday_bonus function" | halt_error;

# Calculate the total score of all players.
# input: a score board object.
# output: the sum of all scores, or zero for an empty board.
def total_score:
halt_error("Please implement the total_score function");
"Please implement the total_score function" | halt_error;
6 changes: 3 additions & 3 deletions exercises/concept/recursive-functions/recursive-functions.jq
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
# [1, 2, 3] | array_add # => 6

def array_add:
halt_error("Implement this as a recursive function.");
"Implement this as a recursive function." | halt_error;

# Reverse the input array, and return the result in a new array.
#
# Example:
# [1, 2, 3] | array_reverse # => [3, 2, 1]

def array_reverse:
halt_error("Implement this as a recursive function.");
"Implement this as a recursive function." | halt_error;

# Run the filter `f` for each element of the input array,
# and return the outputs in a new array.
Expand All @@ -21,4 +21,4 @@ def array_reverse:
# [1, 2, 3] | array_map(. + 1) # => [2, 3, 4]

def array_map(f):
halt_error("Implement this as a recursive function.");
"Implement this as a recursive function." | halt_error;
6 changes: 3 additions & 3 deletions exercises/concept/vehicle-purchase/vehicle-purchase.jq
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# output: {boolean} whether a license is required

def needs_license:
halt_error("Please implement the needsLicense function");
"Please implement the needsLicense function" | halt_error;

# Task 2
# Helps choosing between two options by recommending the one that
Expand All @@ -14,7 +14,7 @@ def needs_license:
# input: {array of strings} options to consider
# output: {string} a sentence of advice which option to choose
def choose_vehicle:
halt_error("Please implement the chooseVehicle function");
"Please implement the chooseVehicle function" | halt_error;

# Task 3
# Calculates an estimate for the price of a used vehicle in the dealership
Expand All @@ -24,4 +24,4 @@ def choose_vehicle:
# output: {number} expected resell price in the dealership

def resell_price:
halt_error("Please implement the calculateResellPrice function");
"Please implement the calculateResellPrice function" | halt_error;

0 comments on commit 689e72e

Please sign in to comment.