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

What is the difference between a cyclic list and an infinite list in haskell?

Referencing @dfeuer's answer to this question: Least expensive way to construct cyclic list in Haskell, which says that using cyclic lists 'defeats' the garbage collector as it has to keep everything you've consumed from a cyclic list allocated till…
Ramith Jayatilleka
  • 2,132
  • 16
  • 25
19
votes
2 answers

Would the ability to detect cyclic lists in Haskell break any properties of the language?

In Haskell, some lists are cyclic: ones = 1 : ones Others are not: nums = [1..] And then there are things like this: more_ones = f 1 where f x = x : f x This denotes the same value as ones, and certainly that value is a repeating sequence. But…
Jason Orendorff
  • 42,793
  • 6
  • 62
  • 96
18
votes
3 answers

Proving equality of streams

I have a data type data N a = N a [N a] of rose trees and Applicative instance instance Applicative N where pure a = N a (repeat (pure a)) (N f xs) <*> (N a ys) = N (f a) (zipWith (<*>) xs ys) and need to prove the Applicative laws for it.…
emi
  • 5,380
  • 1
  • 27
  • 45
17
votes
6 answers

Is there a standard class for an infinitely nested defaultdict?

Does anyone know if there's a standard class for an infinitely nestable dictionary in Python? I'm finding myself repeating this pattern: d = defaultdict(lambda: defaultdict(lambda: defaultdict(int))) d['abc']['def']['xyz'] += 1 If I want to add…
Cerin
  • 60,957
  • 96
  • 316
  • 522
17
votes
4 answers

Ionic infinite scroll function invoked on page load

I am using ionic framework to create a basic Feed app. I got the refresher going but I'm having trouble with my ion-infinite-scroll. Feed.html
Jad Salhani
  • 235
  • 2
  • 3
  • 7
16
votes
4 answers

Just when is a stackoverflow fair and sensible?

Code updated For fixing the bug of a filtered Interminable, the following code is updated and merged into original: public static bool IsInfinity(this IEnumerable x) { var it= x as Infinity??((Func)(() => { var…
Ken Kin
  • 4,503
  • 3
  • 38
  • 76
15
votes
4 answers

Haskell cartesian product of infinite lists

I want to generate a vectorspace from a basis pair, which looks something like: genFromPair (e1, e2) = [x*e1 + y*e2 | x <- [0..], y <- [0..]] When I examine the output though, it sems like I'm getting [0, e2, 2*e2,...] (i.e. x never gets above 0).…
Xodarap
  • 11,581
  • 11
  • 56
  • 94
15
votes
7 answers

Continuous Looping Page (Not Infinite Scroll)

I'm looking for resources that create scrolling functions like the ones found on these sites: Outpost Journal Unfold Once the scroll bar hits the bottom of the page, I want it to loop back to the top. I'm familiar with with the infinite scroll, and…
Brian Metcalf
  • 169
  • 1
  • 1
  • 9
14
votes
9 answers

How can I make an iterator that never ends?

I was just wondering what the easiest way to iterate over a set indefinitely, i.e. when it reaches the end it next(); calls the first object. I'm assuming that this is not an already predefined function in Java, so just looking for the easiest way…
Bobby
  • 18,217
  • 15
  • 74
  • 89
13
votes
4 answers

Convert first N item in iterable to Array

Something similar to question Convert ES6 Iterable to Array. But I only want first N items. Is there any built-in for me to do so? Or how can I achieve this more elegantly? let N = 100; function *Z() { for (let i = 0; ; i++) yield i; } // This wont…
tsh
  • 4,263
  • 5
  • 28
  • 47
13
votes
2 answers

How do I add infinite scroll with jQuery Masonry?

I am trying to incorporate infinite scroll with my current web site that is using a type of jQuery Masonry. I am trying to understand the language and the basic function of javascript (and html in general), but it can be quite overwhelming. I am…
user2210202
  • 131
  • 1
  • 1
  • 3
12
votes
4 answers

Non-strict, Immutable, Non-memoized Infinite series in Scala

I want an infinite non-strict series x1, x2, x3... that I can work with one element at a time, not memoizing the results in order to keep my memory usage constant. For the sake of specificity let's say it's a series of integers (e.g. the natural…
W.P. McNeill
  • 16,336
  • 12
  • 75
  • 111
12
votes
2 answers

Calendar and PagerAdapter - Unlimited Views

In my activity, I'm using ViewPager to swipe left/right and show month view accordingly. I'm passing the month and year values from onCreate to the PagerAdapter: private static int NUM_AWESOME_VIEWS = 3; viewPager = (ViewPager)…
input
  • 7,503
  • 25
  • 93
  • 150
11
votes
1 answer

Deliberately defining infinite type in haskell

I want to define what seems to require an infinite type. Required : a function "eat" that eats all it's arguments except "3" for which it returns 3 eat 3 = 3 eat x = eat So basically an arbitrary expression like "eat (+) foldl (Just 5) 3" evaluates…
Karan
  • 559
  • 5
  • 12
11
votes
2 answers

Poetry stuck in infinite install/update

My issue is that when I execute poetry install, poetry update or poetry lock the process keeps running indefinitely. I tried using the -vvv flag to get output of what's happening and it looks like it gets stuck forever in the first install. My…
A-fandino
  • 424
  • 5
  • 13
1
2
3
72 73