Created
January 11, 2021 15:59
-
-
Save deanwampler/e59ad8d12536d24e9a612e4794be6b76 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
scala> val list = 1 +: "two" +: DTNil | |
val list: DTNonEmptyList[1, Int, ? <: DTNonEmptyList[0, String, DTNil.type]] = | |
DTNonEmptyList(1,DTNonEmptyList(two,DTNil)) | |
scala> list.size | |
| list.head | |
| list.tail | |
val res0: Int = 2 | |
val res1: Int = 1 | |
val res2: list.T = DTNonEmptyList(two,DTNil) | |
scala> list.tail.size | |
| list.tail.head | |
| list.tail.tail | |
| list.tail.tail.size | |
val res3: Int = 1 | |
val res4: String = two | |
val res5: DTNil.type = DTNil | |
val res6: Int = 0 | |
scala> list.tail.tail.head // list.tail.tail is res5 == DTNil | |
| list.tail.tail.tail | |
1 |list.tail.tail.head | |
|^^^^^^^^^^^^^^^^^^^ | |
|value head is not a member of object DTNil | |
2 |list.tail.tail.tail | |
|^^^^^^^^^^^^^^^^^^^ | |
|value tail is not a member of object DTNil | |
scala> DTNil.head | |
1 |DTNil.head | |
|^^^^^^^^^^ | |
|value head is not a member of object DTNil | |
scala> DTNil.tail | |
1 |DTNil.tail | |
|^^^^^^^^^^ | |
|value tail is not a member of object DTNil - did you mean DTNil.wait? | |
scala> DTNil.size | |
val res7: Int = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment