is it possible to implement the specification patt...
# announcements
m
is it possible to implement the specification pattern in kotlin? as i tried https://dzone.com/articles/java-using-specification but i get the following undefined references: Predicate CriteriaBuilder Root
d
If C# can do it, Kotlin can do it.
p
m
oh
the
specification pattern
is used to implement logic such as
val b = v("1").and("2").and("3").and("4")
in
Copy code
val i = txt("1234")

val a = v("1234")

val b = v("1").and("2").and("3").and("4")

AssertEquals(a.peek() == b.peek())
// fails if both are not equal
in applications such as parser combinators right?
c
I’ve actually built a small library for this https://copper-leaf.github.io/trellis/
Pretty easy to do overall, relies heavily on generics and extension functions
m
ill check it out
154 Views