Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
99 views

I'm working on making a program to read a chart of accounts and turn it into a tree of Account objects, which I will be doing stuff with later. The chart of accounts in question has several levels of ...
In Hoc Signo's user avatar
0 votes
1 answer
109 views

I want to create menus with options that select other menus, without causing a stack overflow error due to recursion. But the menus have to be initialized, and a menu a can point to a menu b and b to ...
Jakub Kowalski's user avatar
3 votes
1 answer
86 views

I've been trying to make an infinite loop in Node js, and came across this problem. I experimented a bit and came up with these three functions. async function rc1(){ rc1(); } //-> stack ...
minyoung heo's user avatar
4 votes
1 answer
228 views

When called, the method of URLSessionWebSocketTask.receive(completionHandler:), receives only one message. So in order to continue receiving messages I need to call this method again and again. This ...
zzheads's user avatar
  • 1,522
-1 votes
2 answers
87 views

I am trying to force a recursion to loop infinitely for a project of mine. This is my code up so far: putStr' :: String -> IO () putStr' (a:as) = do putChar a putChar '\n' ...
Ciuppo's user avatar
  • 43
2 votes
1 answer
325 views

I wrote a simple wrapper to add special methods to a given PyTorch neural network. While the implementation below works well for general objects like strings, lists etc. I get a RecursionError when ...
GooseFromHell's user avatar
0 votes
1 answer
164 views

The code in the Stack Snippet is meant to work as follows: Click the table cell in the top right corner, which has a value of 0 The value will instantly change to 4 After a delay, the numbers in the ...
Quack E. Duck's user avatar
0 votes
1 answer
94 views

In programming, certain dictionary-based data structures are very useful and important. For example: Revision dictionary: Revision dictionary is a sub-type of dictionary that keeps keys sorted in the ...
xuancong84's user avatar
  • 1,615
2 votes
0 answers
126 views

Recently I had a problem where because of invalid data in DB some PHP script ran into an infinite recursion on production. We have Sentry added in our system for error log management, but that did not ...
bigmacpro's user avatar
0 votes
1 answer
265 views

I can't use other methods or add parameters and can only call the method recursively. I can't really understand how to approach this problem. I am struggling a bit wrapping my mind around recursion so ...
Aqq's user avatar
  • 1
1 vote
1 answer
69 views

I am making a React application for a currency converter website. I have two <input> fields where the user can input the number to get the exchange rate as shown here: Screenshot of Component ...
Amrut Wali's user avatar
0 votes
1 answer
88 views

How do I stop infinite recursion on the following code? I am having a problem creating the parent link to a node being inserted. If you remove the 2 lines node.parent = Some(parent.clone()); x2 The ...
Frank's user avatar
  • 1
0 votes
0 answers
47 views

I want to use the checkedCount variable inside of the generatePassword function in order to not call the function matrixEffect at the end of generatePassword if the value of checkedCount is 0. I used ...
flexbeatz's user avatar
0 votes
0 answers
108 views

I am creating a chess game in Python for a school project, but don't know how to check if a move is legal without causing a stack overflow. My algorithm works by making the move Checking if the king ...
Freddie's user avatar
0 votes
1 answer
95 views

How can I access a Python object by it's address that I get from id(self.__dict__)? The background is the following, I want to access one class instance from the other (both classes mimic custom ...
foobar's user avatar
  • 23
3 votes
4 answers
153 views

I am working on a programming exercise where the goal is to write a function to get the term at the Nth index of Hofstadter's Figure-Figure sequence. Rather come up with a basic solution using the ...
spectre256's user avatar
1 vote
3 answers
140 views

In the book "A Practical Guide to Quantitative Finance Interview", there is a question called Dynamic Card Game, 5.3 Dynamic Programming) The solution according to the book is basically the ...
nyan314sn's user avatar
  • 1,986
1 vote
2 answers
353 views

So I'm working with code in which there are two object that contain each other, inside a list of which I do not know the contents of until runtime. I have a function that needs to convert the first ...
GreenChild's user avatar
0 votes
1 answer
226 views

i have been following this example and here to flatten a type invain. Most of this flatten the object completely into removing the nests. I would like to to maintain my structure, just removing ...
muturiken's user avatar
-2 votes
1 answer
125 views

Using the @property + setter encapsulation, I need a class that raises an exception when someone tries to change the account_number. However, in the __init__ function, I need to set the value. This is ...
Alejandro Veintimilla's user avatar
0 votes
2 answers
970 views

Got two entities: class Entity1{ @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "entity1Id", unique = true, nullable = false) private Integer entity1Id; @OneToMany(mappedBy = "...
Marco's user avatar
  • 382
0 votes
1 answer
46 views

Read input as specified in the question Print output as specified in the question. arr=[34, 57, 82, 41, 65, 35, 82, 27, 36, 12, 6, 40, 66, 99, 25, 29, 22, 25, 12, 24, 65, 15, 5, 43, 28, 33, 76, 32, 13,...
starVandalizer's user avatar
1 vote
1 answer
306 views

I'm currently trying to deduce a std::tuple type from several std::vectors that are passed as parameters. My code works fine using gcc, but the compilation fails with Visual Studio Professional 2019 ...
user16372530's user avatar
0 votes
0 answers
61 views

I can't seem to find where the problem is in my code, i'm essentially storing character patterns, if an existing pattern is already present I'll store it in the duplicate node, otherwise it will shift ...
E.Bassaget's user avatar
2 votes
2 answers
726 views

I am new to Java and am I trying to implement a recursive method for finding "n choose k". However, I've run into a problem. public class App { public static void main(String[] args) throws ...
Manish Joyeuse's user avatar
1 vote
1 answer
613 views

I have a set of data that looks like this: Person1 is the parent of Person2 Person2 is the parent of Person3 and Person4 Person3 is the parent of Person1 If I try to calculate the whole tree for ...
Alex P.'s user avatar
  • 47
0 votes
1 answer
377 views

I am trying to write a metamorphic quine. Without the "spawn" context, the subprocesses seem to inherit the stack, and so I ultimately exceed the max recursion depth. With the "spawn ...
Innovations Anonymous's user avatar
0 votes
3 answers
121 views

The add and mul definitions here are nonsensical because of their dependence on returning self, causing infinite loops. If they create a new distribution using the lambdas then it works fine, as in my ...
Milan's user avatar
  • 352
0 votes
0 answers
67 views

I am battling with this puzzle where I have a small, recursive program that is sort of similar to Conway's life. It has a set of octopuses arranged in a 10x10 grid, and each one has an energy level ...
ProfK's user avatar
  • 51.4k
0 votes
0 answers
215 views

I am trying to knit an R markdown document into pdf, but it keeps failing and shows this message only: Error: evaluation nested too deeply: infinite recursion / options(expressions=)? Execution halted ...
Choi Jae-hyoung's user avatar
0 votes
1 answer
370 views

Myself have an idea to build own metric collection agent for linux systems with various customised features and controls. Would like to know what is the best practice to collect metrics continuous ...
Jithin C V's user avatar
-3 votes
3 answers
405 views

I have this code: def get_girlfriend(): res = input("Will you go out with me? ") if (res == "y"): print("We've done it bois") return get_girlfriend() but I ...
your_average_programmer's user avatar
0 votes
0 answers
41 views

Karachuba algorithm : https://en.wikipedia.org/wiki/Karatsuba_algorithm threshold = 4 def prod2(a, b): n = max(len(str(a)), len(str(b))) if a == 0 or b == 0: return elif n <= ...
user avatar
1 vote
1 answer
131 views

I am trying to make a recursion call of this.isParentEmpty() inside this method and I need to stop this recursion once all the items are visited . Maybe using a counter.. Here for example I have items....
Manisha's user avatar
  • 11
0 votes
0 answers
61 views

I've been working on a side project in Java in order to become more familiar with threads. It's a cookie clicker clone that uses different threads for the clicker, the counter, and everything else. ...
Elijah Zimmerman's user avatar
3 votes
2 answers
171 views

I am new to Haskell, and I have the following code: second (x:y:xs) = y : second xs -- returns every second element of a list second _ = [] xs = [1,2,3,4] ++ second xs I expect xs to be evaluated ...
eivour's user avatar
  • 1,787
0 votes
0 answers
47 views

I came across this great video from computerphile which talked about lazy computing. In the video, they lay out this really beautiful bit of python code that will calculate primes using the sieve ...
lstbl's user avatar
  • 537
1 vote
0 answers
221 views

So, I'm fairly new to Python, and I am trying to learn how the OOP paradigm works there. One thing that confuses me at this stage are the class variables. To be more specific, consider the following ...
Akhaim's user avatar
  • 152
0 votes
1 answer
1k views

I have 2 entities that relate to one another. These 2 entities should map to each other in a Many-To-Many relationship, however, I need to also have a timestamp of their respective relationship (when ...
Mike O.'s user avatar
  • 47
0 votes
1 answer
867 views

I have a war for a JSF 1.1 application built using Sun Java Studio Creator that runs on iPlanet that I have to run on WAS (WebSphere Application Server) 8.5.5. It fails to display welcome page due to ...
Senior Coder's user avatar
1 vote
2 answers
216 views

I am trying to display the total number in each line of a file that does not contain a path to another file as well as the filename, but if it has a path to another file loop through that file and sum ...
Avikky's user avatar
  • 13
3 votes
0 answers
121 views

I have been doing my homework about recursion and I realized something very strange. import java.util.Scanner; public class Recursive{ public static void main ( String [] args){ Scanner ...
asimtot's user avatar
  • 185
1 vote
3 answers
1k views

I'm starting to learn Python. Right now I'm creating a CLI that allows to create, view or delete contacts stored in a SQLite 3 DB. The problem is that everytime I finish a task I call the main ...
Rohen's user avatar
  • 39
1 vote
1 answer
293 views

Here is my implementation of flatten/2: flt([], []). flt([H|L], [H|X]):- not(is_list(H)), flt(L, X). flt([H|L], X):- append(R, F, X), flt(H, R), flt(L, F). The expected result is ...
evil octopus's user avatar
0 votes
1 answer
104 views

I wrote the following code in SML with the NJ Compiler: fun all_answers (f, xs) = let fun aux(accu, xs_left) = case xs of [] => SOME accu | x::...
Pedro Delfino's user avatar
-1 votes
1 answer
910 views

I hear people say a lot of times recursion can be an “endless loop”, but wouldn’t that saying be only applied to something done with loops. Would it be valid and correct to say “endless loop” for ...
wisemovi's user avatar
0 votes
0 answers
199 views

I wanted to do a few little experiments via measuring runtimes, especially comparing three implementations of fibonacci: recursive, lru_cache and linear (with linear space). I accidentally implemented ...
Uncle Dino's user avatar
1 vote
1 answer
173 views

I'm developing a Matlab application that works fine uncompiled, but when I compiled it and tried running the executable, got this error : Out of memory. The likely cause is an infinite recursion ...
alfavictor's user avatar
2 votes
1 answer
175 views

I want to provide a to_string(obj) function for every object type I create. I found this question, applied the accepted answer, and it works. So far so good. Then I created a new type, but forgot to ...
davnat's user avatar
  • 49
0 votes
2 answers
75 views

So I have a template type list like this : template <typename... Types> struct type_list { }; I've made an accessor function like this : template<class TypeList, size_t ElementIndex> ...
Antonio Cantarella's user avatar