junkcode
Check-in [b44195af3d]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Empty line, trailing whitespace.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:b44195af3d00f9832dc579bdfc71bc47417639ca169a04ae1ae339ffe4bad03f
User & Date: jaccarmac 2017-12-30 07:31:30
Context
2017-12-31
06:40
Try to update API project. check-in: 03a16ca781 user: jaccarmac tags: trunk
2017-12-30
07:31
Empty line, trailing whitespace. check-in: b44195af3d user: jaccarmac tags: trunk
07:30
Working Nim example. check-in: 02c0300a5a user: jaccarmac tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to polymorphic-recursion/nim/polymorphic_recursion.nim.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

proc length(il: IntList): int =
  case il.kind
  of ilNil: 0
  of ilCons: 1 + il.tail.length

method length[T](n: Nested[T]): int {.base.} = quit "override!"
  
method length[T](n: NestedEpsilon[T]): int = 0

method length[T](n: NestedCons[T]): int = 1 + n.tail.length
  

let test_il = IntList(kind: ilCons, head: 0, tail: IntList(kind: ilCons, head: 1, tail: IntList(kind: ilNil)))
echo test_il.length

let test_nest = NestedCons[int](head: 0, tail: NestedCons[seq[int]](head: @[1, 2, 3], tail: NestedCons[seq[seq[int]]](head: @[@[1, 2, 3]], tail: NestedEpsilon[seq[seq[seq[int]]]]())))
echo test_nest.length







|



<






16
17
18
19
20
21
22
23
24
25
26

27
28
29
30
31
32

proc length(il: IntList): int =
  case il.kind
  of ilNil: 0
  of ilCons: 1 + il.tail.length

method length[T](n: Nested[T]): int {.base.} = quit "override!"

method length[T](n: NestedEpsilon[T]): int = 0

method length[T](n: NestedCons[T]): int = 1 + n.tail.length


let test_il = IntList(kind: ilCons, head: 0, tail: IntList(kind: ilCons, head: 1, tail: IntList(kind: ilNil)))
echo test_il.length

let test_nest = NestedCons[int](head: 0, tail: NestedCons[seq[int]](head: @[1, 2, 3], tail: NestedCons[seq[seq[int]]](head: @[@[1, 2, 3]], tail: NestedEpsilon[seq[seq[seq[int]]]]())))
echo test_nest.length