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
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
I'm sure it has something to do with lazy evaluation, but still, I just can't give myself an explanation of why it acts this way. Why does evaluating the right hand side in verboseAdd2 reverse the debug traces output? This is the code: import Debug.T
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
I have the following identity, that defines (implicitly) the number of partitions of positive integers (that is, the number of ways you can write the integer as the sum of ordered positive nonzero integers): Some notes: This is studied in the book An
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
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
I've coded a simplified version of my problem below. So I've got this service and in the method DoSomething - I want to do a synchronous check ( IsTrue() method ) followed by an async call ( database lookup ). I only want to do the database lookup (E
One of R's greatest feature is lazy evaluation. This leads to the often encountered style that one can use an arguments as the value of another arguments. For example, in Hadley's great book on Advanced R you see this example: g <- function(a = 1, b
I'm writing a script that needs two input files. I wrote the following code: if (( $# < 3 || ! ( -f $1 && -f $2 ) )); then echo Cannot open input files exit 1 fi But if I supply only one input file, I get this error: line 4: ((: 1 < 3 || ! (
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
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
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
To practice, I'm writing some useless methods/functions in Scala. I'm trying to implement a fibonacci sequence function. I wrote one in Haskell to use as a reference (so I don't just end up writing it Java-style). What I've come up with in Haskell is
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
I use str to construct strings all the time: user> (str '(1 2 3) " == " '(1 2 3)) "(1 2 3) == (1 2 3)" and roughly once a day I get bitten on the ass by: user> (str '(1 2 3) " == " (map identity '(1 2 3))) "(1 2 3)
I have table "permission" like | user_id | object_id | readable | writable | I need to find out if the given object_id can be accesible by current user_id with following rules: if there is no records for object_id at all, then return true if the
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
I have a memory issue with mongoengine (in python). Let's say I have a very large amount of custom_documents (several thousands). I want to process them all, like this: for item in custom_documents.objects(): process(item) The problem is custom_docum
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
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
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
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
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
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
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
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
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+,
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
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