codata Questions

1

Solved

This is a corecursive algorithm, because with each iteration it calls itself on data that is greater then what it had before: iterate f x = x : iterate f (f x) It is similar to tail recursion ac...
Superheat asked 10/5, 2020 at 19:42

0

I find that Lazy and Inf is very close: Lazy and Inf are closely related (in fact, the underlying implementation uses the same type). The only difference in practice is in totality checking, w...
Misreport asked 13/1, 2018 at 3:35

1

Solved

There is filter : (a -> Bool) -> List a -> List a for List, but there is no filter : (a -> Bool) -> Stream a -> Stream a for Stream, why? Is there some alternatives to do the sim...
Dallman asked 24/4, 2017 at 14:38

1

There is some explanation here. Intuitively I understand how finite data structures differ from infinite data structures like streams. Nevertheless, it's interesting to see other explanations of di...
Kori asked 3/3, 2015 at 20:24

2

Solved

Imagine the following function to give an infinite lazy sequence of fibonacci in Clojure: (def fib-seq (concat [0 1] ((fn rfib [a b] (lazy-cons (+ a b) (rfib b (+ a b)))) 0 1))) user> (tak...
Exclusive asked 12/7, 2013 at 11:19

1

Solved

In terms of pithy summaries - this description of Comonads seems to win - describing them as a 'type for input impurity'. What is an equivalent pithy (one-sentence) description for codata?
Translucid asked 11/7, 2013 at 22:48
1

© 2022 - 2024 — McMap. All rights reserved.