Skip to content

Commit ed256f4

Browse files
committed
update exercises that use removed modules from stdlib
1 parent 66eedd7 commit ed256f4

File tree

26 files changed

+139
-189
lines changed

26 files changed

+139
-189
lines changed

concepts/regular-expressions/about.md

Lines changed: 0 additions & 61 deletions
This file was deleted.

config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@
480480
"prerequisites": [
481481
"options"
482482
],
483+
"status": "deprecated"
483484
},
484485
{
485486
"slug": "two-fer",

exercises/concept/newsletter/.meta/example.gleam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ pub fn read_emails(path: String) -> Result(List(String), Nil) {
1616

1717
pub fn create_log_file(path: String) -> Result(Nil, Nil) {
1818
simplifile.create_file(path)
19-
|> result.nil_error
19+
|> result.replace_error(Nil)
2020
}
2121

2222
pub fn log_sent_email(path: String, email: String) -> Result(Nil, Nil) {
2323
simplifile.append(path, email <> "\n")
24-
|> result.nil_error
24+
|> result.replace_error(Nil)
2525
}
2626

2727
pub fn send_newsletter(

exercises/practice/acronym/.meta/example.gleam

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import gleam/list
2-
import gleam/regex
2+
import gleam/regexp
33
import gleam/string
44

55
pub fn abbreviate(phrase phrase: String) -> String {
6-
let assert Ok(re) = regex.from_string("[ +\\-/;_]+")
7-
regex.split(with: re, content: phrase)
6+
let assert Ok(re) = regexp.from_string("[ +\\-/;_]+")
7+
regexp.split(with: re, content: phrase)
88
|> list.fold("", fn(acc, val) {
99
let assert Ok(letter) =
1010
val

exercises/practice/allergies/.meta/example.gleam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import gleam/bitwise
1+
import gleam/int
22
import gleam/list
33

44
pub type Allergen {
@@ -26,7 +26,7 @@ fn to_score(allergen: Allergen) -> Int {
2626
}
2727

2828
pub fn allergic_to(allergen: Allergen, score: Int) -> Bool {
29-
bitwise.and(to_score(allergen), score) != 0
29+
int.bitwise_and(to_score(allergen), score) != 0
3030
}
3131

3232
pub fn list(score: Int) -> List(Allergen) {

exercises/practice/boutique-inventory/.docs/instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Item(
1414

1515
## 1. Return a list of the names of the items
1616

17-
Implement `item_names` function, which takes an yielder of items and returns an yielder of their names in the same order.
17+
Implement `item_names` function, which takes a yielder of items and returns a yielder of their names in the same order.
1818

1919
```gleam
2020
[
@@ -32,7 +32,7 @@ Implement `item_names` function, which takes an yielder of items and returns an
3232

3333
## 2. Return any items that are cheap
3434

35-
Implement the `cheap` function, which takes an yielder of items and returns an yielder of items that cost less than 30.
35+
Implement the `cheap` function, which takes an yielder of items and returns a yielder of items that cost less than 30.
3636

3737
```gleam
3838
[

exercises/practice/boutique-inventory/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"test": [
1010
"test/boutique_inventory_test.gleam"
1111
],
12-
"exemplar": [
12+
"example": [
1313
".meta/example.gleam"
1414
],
1515
"invalidator": [

exercises/practice/circular-buffer/.meta/example.gleam

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import gleam/queue.{type Queue}
1+
import gleam/deque.{type Deque}
22

33
pub opaque type CircularBuffer(t) {
4-
CircularBuffer(capacity: Int, size: Int, queue: Queue(t))
4+
CircularBuffer(capacity: Int, size: Int, queue: Deque(t))
55
}
66

77
pub fn new(capacity: Int) -> CircularBuffer(t) {
88
let assert True = capacity > 0
9-
CircularBuffer(capacity, 0, queue.new())
9+
CircularBuffer(capacity, 0, deque.new())
1010
}
1111

1212
pub fn read(buffer: CircularBuffer(t)) -> Result(#(t, CircularBuffer(t)), Nil) {
13-
case queue.pop_front(buffer.queue) {
13+
case deque.pop_front(buffer.queue) {
1414
Ok(#(item, queue)) -> {
1515
let buffer = CircularBuffer(..buffer, queue: queue, size: buffer.size - 1)
1616
Ok(#(item, buffer))
@@ -40,14 +40,14 @@ pub fn overwrite(buffer: CircularBuffer(t), item: t) -> CircularBuffer(t) {
4040
}
4141

4242
fn unchecked_write(buffer: CircularBuffer(t), item: t) -> CircularBuffer(t) {
43-
let queue = queue.push_back(buffer.queue, item)
43+
let queue = deque.push_back(buffer.queue, item)
4444
CircularBuffer(..buffer, queue: queue, size: buffer.size + 1)
4545
}
4646

4747
fn discard_oldest(buffer: CircularBuffer(t)) -> CircularBuffer(t) {
48-
let queue = case queue.pop_front(buffer.queue) {
48+
let queue = case deque.pop_front(buffer.queue) {
4949
Ok(#(_, queue)) -> queue
50-
Error(_) -> queue.new()
50+
Error(_) -> deque.new()
5151
}
5252
CircularBuffer(..buffer, queue: queue, size: buffer.size - 1)
5353
}

exercises/practice/dnd-character/.meta/example.gleam

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import gleam/float
22
import gleam/int
3-
import gleam/iterator
43
import gleam/list
4+
import gleam/yielder
55

66
pub type Character {
77
Character(
@@ -36,9 +36,9 @@ pub fn modifier(score: Int) -> Int {
3636
}
3737

3838
pub fn ability() -> Int {
39-
iterator.repeatedly(roll)
40-
|> iterator.take(4)
41-
|> iterator.to_list()
39+
yielder.repeatedly(roll)
40+
|> yielder.take(4)
41+
|> yielder.to_list()
4242
|> list.sort(int.compare)
4343
|> list.drop(1)
4444
|> int.sum()

exercises/practice/dnd-character/gleam.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ version = "0.1.0"
44
[dependencies]
55
gleam_bitwise = "~> 1.2"
66
gleam_otp = "~> 0.7 or ~> 1.0"
7-
gleam_stdlib = "~> 0.32 or ~> 1.0"
7+
gleam_stdlib = ">= 0.32.0 and <= 0.47.0"
88
simplifile = "~> 1.0"
99
gleam_erlang = ">= 0.25.0 and < 1.0.0"
10+
gleam_yielder = ">= 1.1.0 and < 2.0.0"
1011

1112
[dev-dependencies]
12-
exercism_test_runner = "~> 1.4"
13+
exercism_test_runner = "~> 1.8"

0 commit comments

Comments
 (0)