Agda User Manual v2.6.3record type Stream. Now we can use copatterns to create Streams, like one that repeats a given element a infinitely many times: repeat : {A : Set} (a : A) -> Stream A hd (repeat a) = a tl (repeat a) hd : A tl : Stream' A However, this constructor cannot be pattern-matched: -- Get the third element of a stream third : ∀{A} → Stream' A → A -- Not allowed: -- third (cons _ (cons _ (cons x _))) = However, it doesn’t count as ‘guarding’ for the productivity checker: -- Make a stream with one element repeated forever cycle : ∀{A} → A → Stream' A -- Does not termination-check: -- cycle a = cons a0 码力 | 379 页 | 354.83 KB | 1 年前3
Agda User Manual v2.6.2.2that allows us to move along the elements of a data type A. For example, we can get the “third” element of a type A: open Enumeration 3rd : {A : Set} → Enumeration A → A 3rd e = forward e (forward e definitions In fact, we do not need to start at 0. We can allow the user to specify the starting element. Without copatterns, we just add the extra argument to the function declaration: open Enumeration (enum-Nat _) zero = zero backward (enum-Nat _) (suc n) = n Tip When using copatterns to define an element of a record type, the fields of the record must be in scope. In the examples above, we use open Enumeration0 码力 | 354 页 | 433.60 KB | 1 年前3
Agda User Manual v2.6.2.1that allows us to move along the elements of a data type A. For example, we can get the “third” element of a type A: open Enumeration 3rd : {A : Set} → Enumeration A → A 3rd e = forward e (forward e definitions In fact, we do not need to start at 0. We can allow the user to specify the starting element. Without copatterns, we just add the extra argument to the function declaration: open Enumeration (enum-Nat _) zero = zero backward (enum-Nat _) (suc n) = n Tip When using copatterns to define an element of a record type, the fields of the record must be in scope. In the examples above, we use open Enumeration0 码力 | 350 页 | 416.80 KB | 1 年前3
Agda User Manual v2.6.0.1that allows us to move along the elements of a data type A. For example, we can get the “third” element of a type A: open Enumeration 3rd : {A : Set} → Enumeration A → A 3rd e = forward e (forward e definitions In fact, we do not need to start at 0. We can allow the user to specify the starting element. Without copatterns, we just add the extra argument to the function declaration: open Enumeration (enum-Nat _) zero = zero backward (enum-Nat _) (suc n) = n Tip When using copatterns to define an element of a record type, the fields of the record must be in scope. In the examples above, we use open Enumeration0 码力 | 256 页 | 247.15 KB | 1 年前3
Agda User Manual v2.6.2that allows us to move along the elements of a data type A. For example, we can get the “third” element of a type A: open Enumeration 3rd : {A : Set} → Enumeration A → A 3rd e = forward e (forward e definitions In fact, we do not need to start at 0. We can allow the user to specify the starting element. Without copatterns, we just add the extra argument to the function declaration: open Enumeration (enum-Nat _) zero = zero backward (enum-Nat _) (suc n) = n Tip When using copatterns to define an element of a record type, the fields of the record must be in scope. In the examples above, we use open Enumeration0 码力 | 348 页 | 414.11 KB | 1 年前3
Agda User Manual v2.6.1.3that allows us to move along the elements of a data type A. For example, we can get the “third” element of a type A: open Enumeration 3rd : {A : Set} → Enumeration A → A 3rd e = forward e (forward e definitions In fact, we do not need to start at 0. We can allow the user to specify the starting element. Without copatterns, we just add the extra argument to the function declaration: open Enumeration (enum-Nat _) zero = zero backward (enum-Nat _) (suc n) = n Tip When using copatterns to define an element of a record type, the fields of the record must be in scope. In the examples above, we use open Enumeration0 码力 | 305 页 | 375.80 KB | 1 年前3
Agda User Manual v2.6.1.2that allows us to move along the elements of a data type A. For example, we can get the “third” element of a type A: open Enumeration 3rd : {A : Set} → Enumeration A → A 3rd e = forward e (forward e definitions In fact, we do not need to start at 0. We can allow the user to specify the starting element. Without copatterns, we just add the extra argument to the function declaration: open Enumeration (enum-Nat _) zero = zero backward (enum-Nat _) (suc n) = n Tip When using copatterns to define an element of a record type, the fields of the record must be in scope. In the examples above, we use open Enumeration0 码力 | 304 页 | 375.60 KB | 1 年前3
Agda User Manual v2.6.1.1that allows us to move along the elements of a data type A. For example, we can get the “third” element of a type A: open Enumeration 3rd : {A : Set} → Enumeration A → A 3rd e = forward e (forward e definitions In fact, we do not need to start at 0. We can allow the user to specify the starting element. Without copatterns, we just add the extra argument to the function declaration: open Enumeration (enum-Nat _) zero = zero backward (enum-Nat _) (suc n) = n Tip When using copatterns to define an element of a record type, the fields of the record must be in scope. In the examples above, we use open Enumeration0 码力 | 297 页 | 375.42 KB | 1 年前3
Agda User Manual v2.6.1that allows us to move along the elements of a data type A. For example, we can get the “third” element of a type A: open Enumeration 3rd : {A : Set} → Enumeration A → A 3rd e = forward e (forward e definitions In fact, we do not need to start at 0. We can allow the user to specify the starting element. Without copatterns, we just add the extra argument to the function declaration: open Enumeration (enum-Nat _) zero = zero backward (enum-Nat _) (suc n) = n Tip When using copatterns to define an element of a record type, the fields of the record must be in scope. In the examples above, we use open Enumeration0 码力 | 297 页 | 375.42 KB | 1 年前3
Agda User Manual v2.6.0that allows us to move along the elements of a data type A. For example, we can get the “third” element of a type A: open Enumeration 3rd : {A : Set} → Enumeration A → A 3rd e = forward e (forward e definitions In fact, we do not need to start at 0. We can allow the user to specify the starting element. Without copatterns, we just add the extra argument to the function declaration: open Enumeration (enum-Nat _) zero = zero backward (enum-Nat _) (suc n) = n Tip When using copatterns to define an element of a record type, the fields of the record must be in scope. In the examples above, we use open Enumeration0 码力 | 256 页 | 246.87 KB | 1 年前3
共 535 条
- 1
- 2
- 3
- 4
- 5
- 6
- 54













