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
3
votes
3 answers

Haskell method that creates infinite list with all combinations of a given list

My Problem is that I want to create a infinite list of all combinations of a given list. So for example: infiniteListComb [1,2] = [[],[1],[2], [1,1],[1,2],[2,1],[2,2], [1,1,1], ...]. other example: infiniteListComb [1,2,3] = [[], [1], [2], [3],…
3
votes
1 answer

How to show the index the user is currently with react-window List + Infinte Loader

I came to this problem when I wanted to show my user at which point he/she was on the list when they were scrolling. In short, I wanted to have a counter indicating the current index of the visible Row. This can be achieved with…
GeorgeCodeHub
  • 131
  • 1
  • 10
3
votes
1 answer

why it was infinite type ? (Occurs check: cannot construct the infinite type: a ~ Tree a)

data Tree a = Branch a a | Leaf deriving (Show) construct :: (Integral a) => [a] -> Tree a construct [] = Leaf construct (x:[]) = Leaf -- _____error________ construct (l:r:xs) = if l>r then Branch l (construct $ r:xs) …
user13101912
3
votes
5 answers

Generate list of Ints in Haskell by adding Ints from a pattern list

I'm playing around with Haskell, mostly trying to learn some new techniques to solve problems. Without any real application in mind I came to think about an interesting thing I can't find a satisfying solution to. Maybe someone has any better…
3
votes
2 answers

Excluding computed results from a map of [1..]?

I'm currently working on a program which computes amicable pairs (Project Euler Problem 21). I've already found the solution, however I noticed that a flaw in my program was that it evaluates all of the numbers of the set [1..] whether or not we…
Emmanuel M. Smith
  • 431
  • 1
  • 5
  • 12
3
votes
4 answers

Assigning values in while condition

First of all I know what is difference between = and ==. I want to use = to implicitly make infinite loop. So my code looks like this: boolean flag= true; while (flag=false){ System.out.println("inside loop"); } …
3
votes
2 answers

Vue component results in infinite loop when updating data

Whenever I try to update medMins the function produces the correct results twice. However, Vue returns with [Vue warn]: You may have an infinite update loop in a component render function. I tried switching medMins to a computed property but got…
3
votes
2 answers

How to implement an eventually repeating list in Haskell?

I can see how cycle can be used to implement a repeating list (eg [0,9,0,9,...], the decimal expansion of 10/11), but how could one implement one that has some initial elements before it settles down to a repeating pattern (eg…
pdmclean
  • 131
  • 3
3
votes
1 answer

How does Haskell type-check infinite recursive values?

Define this data type: data NaturalNumber = Zero | S NaturalNumber deriving (Show) In Haskell (compiled using GHC), this code will run without warning or error: infinity = S infinity inf1 = S inf2 inf2 = S inf1 So both recursive and mutually…
H. User
  • 33
  • 3
3
votes
1 answer

Let recursiveness in Haskell

Could someone explain the behaviour of this little piece of code with the following input: [[1,2],[3,4]]? infiniteList ls = let v = ls ++ v in concat v The result is an infinite list but I don't realise why. I've understood that…
BigMeister
  • 361
  • 2
  • 11
3
votes
1 answer

Infinite Scroll in collectionView swift programmatically

i want to infinite scrolling 10 images in collectionView programmatically of swift. the image came from web by json according to my choice. i have been unable to scrolling 20 image in a times. here is my code import Foundation import UIKit let…
Quiet Islet
  • 536
  • 1
  • 8
  • 28
3
votes
2 answers

While loop that's meant to be infinite freezes after first cycle

My goal is to make a program that prints onscreen all of the prime numbers it can find, however I have this issue where the while loop runs only once, instead of repeating forever. def isPrime(num): if num < 2: return False if num ==…
3
votes
2 answers

How to check if a calculation result is Infinite or not?

Now and then my code calculates a double and returns Infinite. The code does not get stuck and I can even see these results in a .csv file that is saved by the code (the word "Infinite" is written in the .csv file). But I want to avoid my code to…
Veronique
  • 381
  • 1
  • 3
  • 13
3
votes
4 answers

Is it possible to create an infinite array (in javascript) and give it to a function?

I was wondering if it would be possible to create an array infinitely long, so that any number I would put in my function : for exemple : function arr(2,3,4,5,6,7), would be treated as an array and put in a "table", but it didn't mather how many…
Ulysse Corbeil
  • 81
  • 1
  • 3
  • 9
3
votes
2 answers

How to fill in missing sequence lines in a TSV file

I am still a beginner so for starters sorry for the question with likely an obvious answer, and sorry for the messy code, but I have files with ten thousands of lines. I am working with a certain window frame technique to slide along my files so I…
visse226
  • 139
  • 1
  • 7