Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacvando committed Sep 7, 2024
1 parent 31cee74 commit 3e7ed70
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
12 changes: 9 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@
"average_run_time": 2
},
"files": {
"solution": ["%{pascal_slug}.roc"],
"test": ["%{kebab_slug}-test.roc"],
"example": [".meta/Example.roc"]
"solution": [
"%{pascal_slug}.roc"
],
"test": [
"%{kebab_slug}-test.roc"
],
"example": [
".meta/Example.roc"
]
},
"exercises": {
"practice": [
Expand Down
13 changes: 1 addition & 12 deletions exercises/practice/forth/forth-test.roc
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
# https://github.com/exercism/problem-specifications/tree/main/exercises/forth/canonical-data.json
# File last updated on 2024-09-07
app [main] {
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br"
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
}

main =
Task.ok {}

import Forth exposing [evaluate]


# parsing and numbers: numbers just get pushed onto the stack
expect
result = evaluate "1 2 3 4 5"
Expand All @@ -21,7 +20,6 @@ expect
result = evaluate "-1 -2 -3 -4 -5"
result == Ok [-1, -2, -3, -4, -5]


# addition: can add two numbers
expect
result = evaluate "1 2 +"
Expand All @@ -37,7 +35,6 @@ expect
result = evaluate "1 +"
Result.isErr result


# subtraction: can subtract two numbers
expect
result = evaluate "3 4 -"
Expand All @@ -53,7 +50,6 @@ expect
result = evaluate "1 -"
Result.isErr result


# multiplication: can multiply two numbers
expect
result = evaluate "2 4 *"
Expand All @@ -69,7 +65,6 @@ expect
result = evaluate "1 *"
Result.isErr result


# division: can divide two numbers
expect
result = evaluate "12 3 /"
Expand All @@ -95,7 +90,6 @@ expect
result = evaluate "1 /"
Result.isErr result


# combined arithmetic: addition and subtraction
expect
result = evaluate "1 2 + 4 -"
Expand All @@ -106,7 +100,6 @@ expect
result = evaluate "2 4 * 3 /"
result == Ok [2]


# dup: copies a value on the stack
expect
result = evaluate "1 dup"
Expand All @@ -122,7 +115,6 @@ expect
result = evaluate "dup"
Result.isErr result


# drop: removes the top value on the stack if it is the only one
expect
result = evaluate "1 drop"
Expand All @@ -138,7 +130,6 @@ expect
result = evaluate "drop"
Result.isErr result


# swap: swaps the top two values on the stack if they are the only ones
expect
result = evaluate "1 2 swap"
Expand All @@ -159,7 +150,6 @@ expect
result = evaluate "1 swap"
Result.isErr result


# over: copies the second element if there are only two
expect
result = evaluate "1 2 over"
Expand All @@ -180,7 +170,6 @@ expect
result = evaluate "1 over"
Result.isErr result


# user-defined words: can consist of built-in words
expect
result = evaluate
Expand Down

0 comments on commit 3e7ed70

Please sign in to comment.