Skip to content
Open
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
2 changes: 1 addition & 1 deletion exercises/practice/allergies/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
},
"blurb": "Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies.",
"source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "https://turing.edu"
"source_url": "https://www.turing.edu/"
}
2 changes: 1 addition & 1 deletion exercises/practice/bob/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
},
"blurb": "Bob is a lackadaisical teenager. In conversation, his responses are very limited.",
"source": "Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial.",
"source_url": "https://pine.fm/LearnToProgram/?Chapter=06"
"source_url": "https://pine.fm/LearnToProgram/chap_06.html"
}
2 changes: 1 addition & 1 deletion exercises/practice/etl/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
},
"blurb": "Change the data format for scoring a game to more easily add other languages.",
"source": "Based on an exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "https://turing.edu"
"source_url": "https://www.turing.edu/"
}
2 changes: 1 addition & 1 deletion exercises/practice/gigasecond/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
},
"blurb": "Given a moment, determine the moment that would be after a gigasecond has passed.",
"source": "Chapter 9 in Chris Pine's online Learn to Program tutorial.",
"source_url": "https://pine.fm/LearnToProgram/?Chapter=09"
"source_url": "https://pine.fm/LearnToProgram/chap_09.html"
}
2 changes: 1 addition & 1 deletion exercises/practice/grep/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
},
"blurb": "Search a file for lines matching a regular expression pattern. Return the line number and contents of each matching line.",
"source": "Conversation with Nate Foster.",
"source_url": "https://www.cs.cornell.edu/Courses/cs3110/2014sp/hw/0/ps0.pdf"
"source_url": "https://www.cs.cornell.edu/courses/cs3110/2014sp/hw/0/ps0.pdf"
}
2 changes: 1 addition & 1 deletion exercises/practice/kindergarten-garden/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
},
"blurb": "Given a diagram, determine which plants each child in the kindergarten class is responsible for.",
"source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "https://turing.edu"
"source_url": "https://www.turing.edu/"
}
3 changes: 2 additions & 1 deletion exercises/practice/perfect-numbers/.meta/example.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#:when (zero? (remainder n i)))
i))

(define (classify n)
(define/contract (classify n)
(-> exact-positive-integer? symbol?)
(let ([sumdivisors (divisor-sum n)])
(cond [(= n sumdivisors) 'perfect]
[(> n sumdivisors) 'deficient]
Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/perfect-numbers/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ description = "Abundant numbers -> Medium abundant number is classified correctl
[ec7792e6-8786-449c-b005-ce6dd89a772b]
description = "Abundant numbers -> Large abundant number is classified correctly"

[05f15b93-849c-45e9-9c7d-1ea131ef7d10]
description = "Abundant numbers -> Perfect square abundant number is classified correctly"

[e610fdc7-2b6e-43c3-a51c-b70fb37413ba]
description = "Deficient numbers -> Smallest prime deficient number is classified correctly"

Expand Down
32 changes: 22 additions & 10 deletions exercises/practice/perfect-numbers/perfect-numbers-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@
(classify 33550336)
'perfect)

(test-equal? "Smallest abundant number"
(classify 12)
'abundant)

(test-equal? "Medium abundant number"
(classify 30)
'abundant)

(test-equal? "Large abundant number"
(classify 33550335)
'abundant)

(test-equal? "Perfect square abundant number"
(classify 196)
'abundant)

(test-equal? "Smallest prime deficient number"
(classify 2)
'deficient)
Expand All @@ -41,16 +57,12 @@
(classify 1)
'deficient)

(test-equal? "Smallest abundant number"
(classify 12)
'abundant)
(test-exn "zero is rejected"
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like an unfortunate addition since it will break existing solutions and isn't an interesting case.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can mark the input validation tests as not included since they technically weren’t until I added them here. It’s not a big deal to me to remove them as long as they are marked as not included in the toml.

exn:fail?
(lambda () (classify 0)))

(test-equal? "Medium abundant number"
(classify 30)
'abundant)

(test-equal? "Large abundant number"
(classify 33550335)
'abundant)))
(test-exn "negative integer is rejected"
Copy link
Contributor

Choose a reason for hiding this comment

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

Likewise.

exn:fail?
(lambda () (classify -1)))))

(run-tests suite))
2 changes: 1 addition & 1 deletion exercises/practice/phone-number/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
},
"blurb": "Clean up user-entered phone numbers so that they can be sent SMS messages.",
"source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.",
"source_url": "https://turing.edu"
"source_url": "https://www.turing.edu/"
}
2 changes: 1 addition & 1 deletion exercises/practice/pig-latin/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
},
"blurb": "Implement a program that translates from English to Pig Latin.",
"source": "The Pig Latin exercise at Test First Teaching by Ultrasaurus",
"source_url": "https://github.com/ultrasaurus/test-first-teaching/blob/master/learn_ruby/pig_latin/"
"source_url": "https://github.com/ultrasaurus/test-first-teaching/tree/master/learn_ruby/pig_latin"
}
2 changes: 1 addition & 1 deletion exercises/practice/reverse-string/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
},
"blurb": "Reverse a given string.",
"source": "Introductory challenge to reverse an input string",
"source_url": "https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb"
"source_url": "https://www.freecodecamp.org/news/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb"
}
2 changes: 1 addition & 1 deletion exercises/practice/space-age/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
},
"blurb": "Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.",
"source": "Partially inspired by Chapter 1 in Chris Pine's online Learn to Program tutorial.",
"source_url": "https://pine.fm/LearnToProgram/?Chapter=01"
"source_url": "https://pine.fm/LearnToProgram/chap_01.html"
}
2 changes: 1 addition & 1 deletion exercises/practice/triangle/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
},
"blurb": "Determine if a triangle is equilateral, isosceles, or scalene.",
"source": "The Ruby Koans triangle project, parts 1 & 2",
"source_url": "https://web.archive.org/web/20220831105330/http://rubykoans.com"
"source_url": "https://www.rubykoans.com/"
}