Accessing element from Stream in agda

对着背影说爱祢 提交于 2019-12-11 03:52:55

问题


I have made a stream of (N x N) type. How can i access the individual element of the pair ??

genL : ℕ →  Stream (ℕ × ℕ) →  Stream (ℕ × ℕ)
genL k ((x , y) :: xs)  = if ((y * k) lt x) then (x , y) :: (♯ genL k (♭ xs))
                          else genL k (♭ xs)

It says there is no constuctor , in stream. I have one solution in mind that i will create records of pair then it will works. Apart from that is there any other way to acccess the element.


回答1:


The constructor is _∷_ (type \:: to get ), not _::_.

Anyway your definition is not productive and doesn't convince the termination checker.



来源:https://stackoverflow.com/questions/29369643/accessing-element-from-stream-in-agda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!