Lazy evaluation of a list item in R

Is there a way to lazily load elements of a list? I have a list of large data.frames that each take a long time to generate and load. Typically I would not use all of the data.frames during a session, so would like them to generate and load lazily as

Load the lazy load

I have a property which getter should load its value only the first time. The second time it returns the loaded value without loading it again: private Object _MemberValue; public Object MemberValue { get { if(_MemberValue == null) { _MemberValue = L

Laziness in Swift

Why is lazy used here? extension SequenceType { func mapSome<U>(transform: Generator.Element -> U?) -> [U] { var result: [U] = [] for case let x? in lazy(self).map(transform) { result.append(x) } return result } } this extension takes a transf

How is Haskell lazy?

I need some clarification about laziness with Haskell. If I have this function: myFunction arg | arg == 1 = a | arg == 2 = a*b | arg == 3 = b+c | otherwise = (a+b)*c where a = ... b = ... c = ... d = ... When I call myFunction 1, Haskell will evaluat

Is there a lazy `String.Split` in C #

All string.Split methods seems to return an array of strings (string[]). I'm wondering if there is a lazy variant that returns an IEnumerable<string> such that one for large strings (or an infinite length IEnumerable<char>), when one is only i

Design Pattern to implement this type of lazy load?

I have a number of classes that implement an interface like this: public interface IProcessor { Foo Foo { get; set; } int Process(); } I have a factory that produces these, and I don't know ahead of time how many of them will be produced. The issue i

my images are not displayed using a lazy load

I have browesed through many posts here including this here Lazy Loading doesnt display my images but i still have the problem, i do not what could be the reason but the img are not displayed at all. this is my code <head> <script src="jquer

Scheme (Lazy Racket) an infinite list of natural numbers

I think that Lazy Racket should be useful for handling infinite lists. According to the Wikipedia Lazy Racket article, fibs (the infinite list of Fibonacci numbers) can be defined as: ;; An infinite list: (define fibs (list* 1 1 (map + fibs (cdr fibs

Explain a lazy evaluation whim

I am reading Hadley Wickhams's book on Github, in particular this part on lazy evaluation. There he gives an example of consequences of lazy evaluation, in the part with add/adders functions. Let me quote that bit: This [lazy evaluation] is important

Are Haskell's thunks mutable in evaluation?

While looking into parallel programming, and subsequently evaluation strategies, the question whether thunks are mutable came up. To give an example, let's say I have the following code: foo = 1 + 2 -- Thunk bar = foo `seq` foo -- Evaluates foo Calli

How can I implement lazy bitmap loading?

I want to write a function that will get as input string fileName and return an ImageDrawing object. I don't want to load the Bitmap from the disk in this function. Instead, I want to have some kind of lazy evaluation. In order to find out the dimens

Understanding Lazy Assessment in Haskell

I am trying to learn Haskell, but i am stuck in understanding lazy evaluation. Can someone explain me lazy evaluation in detail and the output of the following 2 cases[with explaination] in relation to the below given Pseudo Code: x = keyboard input

Is the use of the .Net Lazy class exaggerated in this case?

I learned about Lazy class in .Net recently and have been probably over-using it. I have an example below where things could have been evaluated in an eager fashion, but that would result in repeating the same calculation if called over and over. In

Lazily evaluate monadic functions in Haskell

I can't seem to figure out a workaround for this issue i'm having. I have something like this: getFilePathForDay :: Day -> IO (Maybe FilePath) getFilePathForDays date days = do files <- mapM getFilePathForDay $ iterate (addDays 1) date return . take

Java, lazily initialized field without synchronization

Sometimes when I need lazily initialized field, I use following design pattern. class DictionaryHolder { private volatile Dictionary dict; // some heavy object public Dictionary getDictionary() { Dictionary d = this.dict; if (d == null) { d = loadDic

Directory.EnumerateFiles = & gt; UnauthorizedAccessException

There is a nice new method in .NET 4.0 for getting files in a directory in a streaming way via enumeration. The problem here is that if one wishes to enumerate all files one may not know in advance which files or folders are access protected and can

Looking for a basic PHP / MySQL course

Noob-ish question: I'm looking for a lightweight but decent php way to search all fields of a MySql table, regardless the structure. I first gave it a try on my own with the default mysql select but that's too basic. I'm looking for something that sh

Playing with infinity - lazy arithmetic

Many modern programming languages allow us to handle potentially infinite lists and to perform certain operations on them. Example [Python]: EvenSquareNumbers = ( x * x for x in naturals() if x mod 2 == 0 ) Such lists can exist because only elements

C # How to divide (A: B = C) * using regex?

This is supposedly a very easy question, but I just can't seem to find the right solution. There is a string in the format: A:B=C;D:E=F;G:E=H;... whereas A, B and C are alphanumeric (and may be lower as well as upper case). A and B are of length 1+,

put lazy as true while running HQL

In our application, we have various objects set to lazy false based on the application needs. However, in one of the use case we want to ignore all the lazy settings within the HBM files, and get ONLY the target object. So the question is: is there a

Haskell script running out of space

I'm using project Euler to teach myself Haskell, and I'm having some trouble reasoning about how my code is being executed by haskell. The second problem has me computing the sum of all even Fibonacci numbers up to 4 million. My script looks like thi