-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more to Core (including tests); improvements to the monad and JSO…
…N parser examples
- Loading branch information
1 parent
4bb4543
commit 4609dd2
Showing
5 changed files
with
93 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Result { | ||
module MonadInfix { | ||
fun >>=(Ok(x), f) = f(x) | ||
fun >>=(err, _) = err | ||
|
||
fun return(x) = Ok(x) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#lang at-exp racket | ||
|
||
(module+ test | ||
(require "common.rkt" | ||
rackunit) | ||
|
||
(test-case "partition" | ||
(check-equal? | ||
@interp{ | ||
import Core.List | ||
|
||
fun isFiveChars(str) = length(str) == 5 | ||
|
||
partition( | ||
isFiveChars, ["he", "hello", "world", "foo", "bar", "fubar"]) | ||
} | ||
@line{%(["hello", "world", "fubar"], ["he", "foo", "bar"])}))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters