Skip to main content
1 vote
1 answer
76 views

I need to extend the definition of left scan to Cofree structures, to accumulate annotations from the root of an annotated AST to the leaves, however I don't understand why my naive implementation ...
ocramz's user avatar
  • 841
4 votes
2 answers
181 views

I'm learning recursion patterns, but I can't figure out the usefulness of futumorphism and histomorphism. The couple of Scala examples I found look very unconvincing. I also found Haskell examples, ...
Sergey Sviridov's user avatar
-1 votes
1 answer
106 views

I am learning about different recursive approaches for reversing a linked list in C++. I have implemented both head and tail recursion methods, but I'm unsure about their differences and which one is ...
Aman maurya's user avatar
2 votes
1 answer
71 views

I have this data structure, that I'd like to introduce recursion schemes to in order to attach metadata to nodes: sealed trait Schema[A] extends Product, Serializable sealed trait Collection[A] ...
Taig's user avatar
  • 7,418
2 votes
1 answer
122 views

This is a definition of foldr and foldl in terms of foldr: foldr :: (a -> b -> b) -> b -> [a] -> b foldr f z [] = z foldr f z (x:xs) = f x (foldr f z xs) foldl :: (a -> b -> a)...
cocorudeboy's user avatar
1 vote
1 answer
103 views

I need to model a computation task and some sub-tasks depend on it: First I run a task, if it fails then it's over. If it succeeds then run a bunch of sub-tasks(zero or many), any of them can fail or ...
Annihilus's user avatar
5 votes
1 answer
278 views

Is it possible to memoize a recursion scheme? If so, how would you? For example, the following uses anamophism and catamorphism newtype Fix f = In (f (Fix f)) deriving instance (Eq (f (Fix f))) => ...
cocorudeboy's user avatar
1 vote
1 answer
158 views

I'm trying to use paramorphisms and apomorhisms (in haskell): -- Fixed point of a Functor newtype Fix f = In (f (Fix f)) ...
cocorudeboy's user avatar
3 votes
1 answer
156 views

I've got anamorphism defined as follows: -- Fixed point of a Functor newtype Fix f = In (f (Fix f)) deriving instance (Eq (f (Fix f))) => Eq (Fix f) deriving instance (Ord (f (Fix f))) => Ord (...
cocorudeboy's user avatar
1 vote
1 answer
201 views

I'm playing around with some recursion schemes, namely catamorphisms and anamorphisms, and would like to try to implement a solution to the lattice paths algorithm as described below using them (taken ...
cocorudeboy's user avatar
2 votes
1 answer
140 views

From this talk about nanopass compilers in 2017 (https://github.com/sellout/recursion-scheme-talk/blob/master/nanopass-compiler-talk.org) I found the code snippet below. In this code snipped, I see ...
Charles Josephs's user avatar
2 votes
1 answer
177 views

I'm trying to implement a binary search tree (or set) using fixed points of functors. I've defined my fixed point as follows: newtype Fix f = In (f (Fix f)) out :: Fix f -> f (Fix f) out (In f)...
Conor Quinn's user avatar
3 votes
2 answers
270 views

I have this AST data structure data AST = Integer Int | Let String AST AST | Plus AST AST | Minus AST AST | Times AST AST | Variable String | ...
Ace shinigami's user avatar
1 vote
1 answer
196 views

I wound up with this skeleton: f :: (Monad m) => b -> m () f x = traverse_ (f . g x) =<< h x -- how avoid explicit recursion? g :: b -> a -> b -- h :: (Foldable t) => b -> m (t ...
user1441998's user avatar
8 votes
1 answer
1k views

I'm trying to get more proficient with recursion schemes as they have so far been really helpful for turning gnarly explicit recursion code into something less spike-y. One of the other tools I tend ...
Ace shinigami's user avatar

15 30 50 per page
1
2 3 4 5
8