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
771
votes
13 answers

How can I represent an infinite number in Python?

How can I represent an infinite number in python? No matter which number you enter in the program, no number should be greater than this representation of infinity.
ssierral
  • 8,537
  • 6
  • 26
  • 44
240
votes
5 answers

Is it possible to set a number to NaN or infinity?

Is it possible to set an element of an array to NaN in Python? Additionally, is it possible to set a variable to +/- infinity? If so, is there any function to check whether a number is infinity or not?
Bob
  • 10,741
  • 27
  • 89
  • 143
235
votes
12 answers

Bash: infinite sleep (infinite blocking)

I use startx to start X which will evaluate my .xinitrc. In my .xinitrc I start my window manager using /usr/bin/mywm. Now, if I kill my WM (in order to f.e. test some other WM), X will terminate too because the .xinitrc script reached EOF. So I…
watain
  • 4,838
  • 4
  • 34
  • 35
73
votes
5 answers

Left and Right Folding over an Infinite list

I have issues with the following passage from Learn You A Haskell (Great book imo, not dissing it): One big difference is that right folds work on infinite lists, whereas left ones don't! To put it plainly, if you take an infinite list at some…
TheIronKnuckle
  • 7,224
  • 4
  • 33
  • 56
51
votes
3 answers

Javascript: "Infinite" parameters for function?

In Chrome, when I type console.log in the one below: console.log("A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A…
auroranil
  • 2,621
  • 6
  • 24
  • 34
46
votes
6 answers

How to tell if a list is infinite?

Is there a way to tell if a list in Haskell is infinite? The reason is that I don't want to apply functions such as length to infinite lists.
alexkelbo
  • 724
  • 6
  • 18
41
votes
5 answers

Scala, repeat a finite list infinitely

I want to use Stream class in scala to repeat a given list infinitely. For example the list (1,2,3,4,5) I want to create a stream that gives me (1,2,3,4,5,1,2,3,4,5,1,2,3....) So that I can wrap the take operation. I know this can be implemented in…
Felix
  • 8,385
  • 10
  • 40
  • 59
39
votes
16 answers

Are infinite for loops possible in Python?

Is it possible to get an infinite loop in for loop? My guess is that there can be an infinite for loop in Python. I'd like to know this for future references.
Britni.M
  • 459
  • 1
  • 4
  • 6
36
votes
4 answers

Why does this Haskell code work successfully with infinite lists?

I have some Haskell code that does work correctly on an infinite list, but I do not understand why it can do so successfully. (I modified my original code -- that did not handle infinite lists -- to incorporate something from some other code online,…
Charlie Flowers
  • 17,338
  • 10
  • 71
  • 88
35
votes
3 answers

Program with loop will not terminate with CTRL + C

I have a program that I want to run until interrupted by user pressing CTRL + C. When I press it nothing happens and I can only terminate the program by suspending it and manually killing it after that. This is the part of the code that needs to run…
humra
  • 360
  • 3
  • 7
33
votes
5 answers

What's exactly happening in infinite nested lists?

It's possible to create an infinite nested list in Python. That's clear and, although not popular and definitely not useful is a known fact. >>> a = [0] >>> a[0] = a >>> a [[...]] >>> a[0] == a True My question is, what is happening here: >>> a =…
Gandi
  • 3,522
  • 2
  • 21
  • 31
32
votes
4 answers

Android: How can I stop an infinite animation applied on an ImageView?

I have an ImageView on which I have applied a rotate animation. Since I want the rotation to go on continuously, I gave the repeatCount as infinite in my rotate.xml: android:repeatCount="infinite" In onCreate(), I load the animation and start…
kiki
  • 13,627
  • 17
  • 49
  • 62
31
votes
3 answers

Are Lists Inductive or Coinductive in Haskell?

So I've been reading about coinduction a bit lately, and now I'm wondering: are Haskell lists inductive or coinductive? I've also heard that Haskell doesn't distinguish the two, but if so, how do they do so formally? Lists are defined inductively,…
Crazycolorz5
  • 747
  • 6
  • 12
22
votes
4 answers

Java: Infinite loop using Scanner in.hasNextInt()

I am using the following code: while (invalidInput) { // ask the user to specify a number to update the times by System.out.print("Specify an integer between 0 and 5: "); if (in.hasNextInt()) { // get the update value …
Tomek
  • 4,689
  • 15
  • 44
  • 52
21
votes
4 answers

jQuery Infinite Scrolling/Lazy Loading

I'm currently redesigning my website and have been looking into using JavaScript and jQuery. Here is what I have so far: http://www.tedwinder.co.uk/gallery2/. My vision is to have all of the photos on one page, which the user can scroll through,…
Ted
  • 245
  • 2
  • 3
  • 5
1
2 3
72 73