Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
pp:scala-project [2022/01/11 10:00] pdmatei |
pp:scala-project [2022/01/12 11:58] (current) pdmatei |
||
---|---|---|---|
Line 123: | Line 123: | ||
<code scala> | <code scala> | ||
val l = 1 :: 2 :: 3 :: Nil | val l = 1 :: 2 :: 3 :: Nil | ||
+ | </code> | ||
+ | |||
+ | **Enums** (TDAs) | ||
+ | <code scala> | ||
+ | enum Expr: | ||
+ | case Var (s: String) | ||
+ | case Number (n: Int) | ||
+ | case Sum(e1: Expr, e2: Expr) | ||
+ | case Prod(e1: Expr, e2: Expr) | ||
+ | </code> | ||
+ | |||
+ | Type bounds in generics | ||
+ | <code scala> | ||
+ | def asseertAllPos [S <: IntSet] (r: S): S = ... | ||
</code> | </code> |