Skip to content

Commit

Permalink
Merge pull request #1 from samuelneo/main
Browse files Browse the repository at this point in the history
Add PA2 from 2320
  • Loading branch information
RussellDash332 authored Apr 21, 2024
2 parents a53ad02 + 25a2a82 commit 486043a
Show file tree
Hide file tree
Showing 9 changed files with 662 additions and 0 deletions.
17 changes: 17 additions & 0 deletions PA/PA2/2320/AbstractStateM.java
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);
}
}
Loading

0 comments on commit 486043a

Please # to comment.