--- a/progs/cw1.scala Wed Oct 24 13:07:13 2018 +0100
+++ b/progs/cw1.scala Wed Oct 24 16:03:07 2018 +0100
@@ -19,6 +19,14 @@
case class NOT(r: Rexp) extends Rexp // not
case class CFUN(f: Char => Boolean) extends Rexp // subsuming CHAR and RANGE
+def CHAR(c: Char) = CFUN(d => c == d)
+val ALL = CFUN(_ => true)
+def RANGE(cs: Set[Char]) = CFUN(d => cs.contains(d))
+
+def CHAR(c: Char) = CFUN(c == _)
+val ALL = CFUN(_ => true)
+def RANGE(cs: Set[Char]) = CFUN(cs.contains(_))
+
// nullable function: tests whether the regular
// expression can recognise the empty string