Questions tagged [mutual-recursion]
Mutual recursion is a case in computer science where multiple problems that depend on each other form a cycle, like the chicken and egg problem.
mutual-recursion
107
questions
0
votes
2
answers
64
views
Is Mutual Recursion Supported in Kotlin?
I stumbled upon an old question from 8 years ago (Kotlin: Tail recursion for mutually recursive functions), which discusses tail recursion in Kotlin. However, my concern is with mutual recursion for ...
1
vote
1
answer
46
views
Coq : mutually recursive definitions with [mrec] in InteractionTrees Library
I'm studying this great library for Representing Recursive and Impure Programs in Coq
I am having problems with mutual recursion (very first example in documentation gives me an error)
https://...
1
vote
2
answers
47
views
Parameterised datatype as a module parameter?
In Agda, how can I define a parameterised module equivalent to the following?
data Sig : Set ℓ where
■ : Sort → Sig
ν : Sig → Sig
module SortedABT {ℓ} (Sort : Set ℓ) (Op : Sort → Set ℓ) (sig : (s ...
1
vote
1
answer
200
views
How to make mutual recursion in APL?
I'm trying the following mutual recursion example in Dyalog APL Win10:
even ← { (odd ⍵-1) ∨ ⍵=0 }
odd ← { (even ⍵-1) ∧ ⍵>0 }
even 7
WS FULL
It looks like the ∨ and ∧ doesn't ...
1
vote
1
answer
59
views
F#: To Design or not design with mutually dependably record types
I try to model trees with their nodes using F# records.
Here is an abstraction of what my design looks like:
type Tree = { Root: Node }
and Node = { Tree: Tree }
(There are other record fields, of ...
1
vote
2
answers
526
views
Impossible to delete in Django Admin — object refers to ITSELF as a protected object
In Django Admin, I have a model called Modules.
When I try to delete a Module object, I get the following error:
Deleting the module 'FR menu' would require deleting
the following protected related ...
0
votes
0
answers
18
views
Mutual Inclusion of header files and class members c++ [duplicate]
I have the following situation:
3 C++ Classes:
ClassA
ClassB
ClassC
class A
{
int member;
B bmember;
};
class B
{
int member;
std::shared_ptr <A> amember;
C cmember;
};
...
3
votes
2
answers
229
views
Julia: Question about variable binding, mutating, and mutable functions
I am writing code in Julia which collects some output from a function foo (which mutates its input argument), and I'm trying to append the recursive evaluations from this function in an array A.
For ...
-1
votes
1
answer
151
views
How to solve this indirect recursion error? [duplicate]
#include <iostream>
#include <stdio.h>
using namespace std;
void funB(int n){
if (n>1){
cout<<n<<" ";
funA(n/2);
}
}
void funA(int m)
{
if (m>0)...
0
votes
1
answer
101
views
Racket two methods referencing each other
I'm doing exercises from The Little Schemer, but I do them in Racket using DrRacket.
One of the exercises has two methods referencing each other. Can this be done in Racket and if so, how?
When trying ...
2
votes
1
answer
235
views
Clarification of Haskell mutual recursion
I've come across these discussions of mutual recursion, initially in the context of the let expression, i.e., a let allows for bindings to refer to one another with no mind for order. (See here.) I ...
1
vote
1
answer
318
views
Expression for defining letrec implementing little language in Haskell
I'm writing an evaluator for a little expression language, but I'm stuck on the LetRec construct.
This is the language:
data Expr = Var Nm | Lam (Nm,Ty) Expr | App Expr Expr
| Val Int | Add ...
2
votes
1
answer
391
views
how to make HTML from a list in scheme, racket
This is a very long question ... I am new and joined, so please don't attack me. Apologies for my bad communications in English. I have some defintions:
An HTML(H) is one of
Str
Tag
A Tag is
(cons ...
1
vote
1
answer
74
views
ANTLR4 self and mutual left-recursion
Is there a simple transformation or workaround to make this work in ANTLR4?
a : a p
| b q
| c
;
b : b r
| a s
| d
;
That is, a and b are self-left-recursive and mutual-left-recursive, ...
2
votes
1
answer
605
views
How can I define a decreases for mutually recursive functions in Dafny?
In the "Draft Dafny Reference Manual" 4.0.2 it describes defining decreases clauses for mutually recursive functions but where the variables decreasing in both functions are of the type ...