So, I decided to learn how to code using R. That’s something I wrote:
## defining a function
makeCacheMatrix <- function(x = matrix()) {
## internal state
inv <- NULL
## defining some closures
set <- function(y) {
x <<- y
inv <<- NULL
}
get <- function() x
setinverse <- function(inverse = matrix()) inv <<- inverse
getinverse <- function() inv
## returning functions as an object
list(
set = set,
get = get,
setinverse = setinverse,
getinverse = getinverse
)
}
Am I crazy? This code remembers me of JavaScript. Do you agree with that?
2 respostas
Cool! I write a lot of JS in my day job; R bears a resemblance.
p.s. I’m enjoying your flurry of English blog posts.
p.p.s. English tip: That last sentence sounds a little broken. Might be better phrased: “This code reminds me of JavaScript.”
Hope to see you again, my friend. Peace
Hello friend,
I decided to blog in English to improve my English skills. Besides of that, I really enjoy the idea of sharing my thoughts with friends like you.
Thanks. I just changed the post.