File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -15,33 +15,33 @@ CachedOps <- setRefClass("CachedOps",
15
15
16
16
methods = list (
17
17
initialize = function (expr ,... ){
18
- cached <<- FALSE
19
- result <<- function (){
20
- cached <<- TRUE
21
- expr
22
- }
18
+ cached <<- FALSE
19
+ result <<- function (){
20
+ cached <<- TRUE
21
+ expr
22
+ }
23
23
callSuper(... )
24
24
},
25
25
26
26
getResult = function (){
27
27
" Calculating result of operation on matrix.
28
28
Once it was calculated result is cached and returned in any consecutive call"
29
- if (cached ) message(" getting cached data" )
29
+ if (cached ) message(" getting cached data" )
30
30
result()
31
31
})
32
32
)
33
33
34
34
makeCacheMatrix <- function (expr ,... ) {
35
- # Creating new caching object
36
- # Args:
37
- # func - function, result of calculation is need to cache
38
- # ... - parameters for function calling
35
+ # Creating new caching object
36
+ # Args:
37
+ # func - function, result of calculation is need to cache
38
+ # ... - parameters for function calling
39
39
CachedOps $ new(expr ,... )
40
40
}
41
41
42
42
cacheSolve <- function (x ) {
43
- # Calculating result of function on matrix
44
- # once it was calculated result is cached
45
- # and returned in any consecutive call
43
+ # Calculating result of function on matrix
44
+ # once it was calculated result is cached
45
+ # and returned in any consecutive call
46
46
x $ getResult()
47
47
}
You can’t perform that action at this time.
0 commit comments