-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from samuelneo/main
Add PA2 from 2320
- Loading branch information
Showing
9 changed files
with
662 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import java.util.function.Function; | ||
|
||
abstract class AbstractStateM<T,S> { | ||
private final Function<S,Pair<T,S>> f; | ||
|
||
AbstractStateM(T t) { | ||
this.f = s -> new Pair<T,S>(t, s); | ||
} | ||
|
||
AbstractStateM(Function<S,Pair<T,S>> f) { | ||
this.f = f; | ||
} | ||
|
||
Pair<T,S> accept(S s) { | ||
return this.f.apply(s); | ||
} | ||
} |
Oops, something went wrong.