top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Could anybody state the functionality of lazy operation in F#?

+1 vote
49 views
Could anybody state the functionality of lazy operation in F#?
posted Jan 9, 2015 by Prashanth

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

I believe you means lazy evaluation - It is an evaluation strategy which delays the evaluation of an expression until its value is needed (non-strict evaluation) and which also avoids repeated evaluations (sharing). The sharing can reduce the running time of certain functions by an exponential factor over other non-strict evaluation strategies, such as call-by-name.

The benefits of lazy evaluation:
1. Performance increases by avoiding needless calculations, and error conditions in evaluating compound expressions
2. The ability to construct potentially infinite data structures
3. The ability to define control flow (structures) as abstractions instead of primitives

In F# lazy evaluation is done by the lazy keyword -

let identifier = lazy ( expression )
// expression is code that is evaluated only when a result is required, and identifier is a value that stores the result

To force the computation to be performed, you call the method Force. Force causes the execution to be performed only one time. Subsequent calls to Force return the same result, but do not execute any code.

Example

let x = 10
let result = lazy (x + 10)
printfn "%d" (result.Force())
answer Jan 10, 2015 by Salil Agrawal
Similar Questions
+2 votes

Could anybody send me some examples of UML diagrams (CLASS DIAGRAM, USE CASE DIAGRAM, SEQUENCE DIAGRAM, COLLABORATION DIAGRAM and ACTIVITY DIAGRAM) of handover procedures (Inter eNB Handover, Inter RAT Handover and Intra eNB Handover) ?

+2 votes

During my study about the measurement and ANR, I have the question. Please help to let me get the proper answer.
[ Condition]
1. UE is in the connected state.
2. UE measures one PCI and reports it to eNB but it does not belong to NRT(Neighbor Relation Table) in eNB.
3. eNB sends rrcConnectionReconfigurationMessage to read CGI for that PCI.
4. UE should read MIB/SIB1 to report CGI info to eNB.

In Step 4), In some materials on the web, UE should use IDLE periods to get SIB1, which is configured as DRX config in rrcConectionReconfigurationMesage. Because Measurement Gap is too short to read MIB/SIB1 and it's only for the measurement purpose.

[Question]
When UE is in the Connected State, How UE could use DRX configuration which is intended to use in IDLE state?

As my basic understanding, DRX configuration is to improve the battery life in idle mode.

...