Questions tagged [infinite]

An infinite structure or process is one which does not terminate. Infinite loops or structures may be bugs in certain contexts, but also may be desired behavior, particularly in server-processes or lazy languages.

An infinite structure or process is one which does not terminate. Infinite loops or structures may be bugs in certain contexts, but also may be desired behavior, particularly in server-processes or lazy languages.

1090 questions
5
votes
4 answers

Is setTimeout / clearTimeout dangerous?

I wanted to ask if exist a another implementation of setTimeout / clearTimeout to replace this kind of nested structure avoiding the loop back function timedCount() { document.getElementById('txt').value=c; c=c+1; …
5
votes
1 answer

How can I define an infinite / looped algebraic datatype in haskell?

I have a music note datatype defined like so: data Note = Ab | A | Bb | B | C | Db | D | Eb | E | F | Gb | G deriving (Eq, Ord) How can i make it an instace of Enum so that succ G returns Ab ?
Atavixion
  • 53
  • 4
5
votes
2 answers

Explanation for why append/3 produces infinite number of solutions in these cases

I'm having trouble understanding this question about Prolog. The question is as follows: Select all of the following goals that have an infinite number of solutions. And here are the possible answers: append([a,b,c,d], Y, Z) append(X, Y,…
Veins
  • 59
  • 5
5
votes
8 answers

c++ recursion exits without obvious reason

I wrote a function using a recursion. While testing it, it turned out, that the function is killed without any obvious reason, while the recursion is still running. To test this, I wrote an infinite recursion. On my PC this function quits after…
Crisscross
  • 51
  • 1
5
votes
2 answers

Getting all Substrings with length 4 out of infinite list

I'm quite new to Haskell and I'm trying to solve the following problem: I have a function, that produces an infinite list of strings with different lengths. But the number of strings of a certain length is restricted. Now I want to extract all…
T.Naz
  • 125
  • 8
5
votes
3 answers

Optimization for: while (true)

I'm using a while (true) { if (x == y) { break; } else { //do stuff } } loop like so, the frame is just an example frame, as the actual code itself is convoluted and overly complicated that it requires a…
5
votes
1 answer

Replace -Inf in dataframe with NA in R

I have a problem in my dataframe. https://gofile.io/?c=eNeEAL I have several values with -Inf entries. When I want to use the cor-function, I always get NA because of that. So I want to replace the -Inf with NA before I use the cor-function, but I…
Essi
  • 761
  • 3
  • 12
  • 22
5
votes
5 answers

how to replace infinite value with maximum value of a pandas column?

I have a dataframe which looks like City Crime_Rate A 10 B 20 C inf D 15 I want to replace the inf with the max value of the Crime_Rate column , so that my resulting dataframe should look like City Crime_Rate A …
Ahamed Moosa
  • 1,395
  • 7
  • 16
  • 30
5
votes
1 answer

jQuery & jQuery UI: Building a draggable infinite grid with content (imgs) of varying size

Essentially, I would like to (re-)build the infinite grid of this site: https://grafilu.ch/, or rather my own version of it. To do so, I am using the plugin Infinite Drag by Ian Li. I believe on the site I'm using as a reference for building the…
JoSch
  • 869
  • 1
  • 15
  • 35
5
votes
2 answers

iPhone and iPad end of scrolling

I'm making some jQuery cross-browser gallery with infinite scroll i works great but on iPhone (i suppose also on iPad) instead equal values i have some disproportion values don't match ($(window).scrollTop() == ($(document).height() -…
Nikola
  • 339
  • 4
  • 8
5
votes
1 answer

finite recursive "List" type

It is easy to reconstruct the list type in Haskell: data MyList a = Cons a (MyList a) | Empty deriving (Show) someList = Cons 1 (Cons 2 (Cons 3 Empty)) -- represents [1,2,3] This allows for constructing infinites…
flawr
  • 10,814
  • 3
  • 41
  • 71
5
votes
1 answer

This is an infinite loop, but I cannot for the life of me figure out why

So pretty much I'm making a little web app to get better with using the canvas, but I'm stuck. I would like a rotating n-sided polygon (the drawing of lines already works). The game loop loops through a grid array (each point on the grid holds a…
5
votes
3 answers

Cartesian product of infinite lists in Haskell

I have a function for finite lists > kart :: [a] -> [b] -> [(a,b)] > kart xs ys = [(x,y) | x <- xs, y <- ys] but how to implement it for infinite lists? I have heard something about Cantor and set theory. I also found a function like > genFromPair…
haskellnoob
  • 211
  • 3
  • 13
5
votes
3 answers

Mockito mock a method with infinite loop

I have a method as follows public class ClientClass { public void clientMethod() { while(true){ doSomethings..... } } } I am trying to test using mockito. I am able to make the call to clientMethod, but since…
kk1957
  • 8,246
  • 10
  • 41
  • 63
5
votes
4 answers

infinite assignment in python list?

I've come cross this question. Code: >>> values = [0, 1, 2] >>> values[1] = values >>> values [0, [...], 2] The result I expect is: [0, [0, 1, 2], 2] Is this an infinite assignment for python list? What is behind the scene? Thanks.
lulyon
  • 6,707
  • 7
  • 32
  • 49