Am I crazy? R looks like Javascript?

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?

Compartilhe este insight:

Elemar Júnior

Sou fundador e CEO da EximiaCo e atuo como tech trusted advisor ajudando diversas empresas a gerar mais resultados através da tecnologia.

Elemar Júnior

Sou fundador e CEO da EximiaCo e atuo como tech trusted advisor ajudando diversas empresas a gerar mais resultados através da tecnologia.

Mais insights para o seu negócio

Veja mais alguns estudos e reflexões que podem gerar alguns insights para o seu negócio:

The example which motivated this post comes from the excellent book Designing Distributed Systems by Brendan Burns (co-founder of the...
Como você pode se considerar um profissional se você não sabe se todo seu código funciona? Como você pode saber...
This one comes from Ayende’s book about RavenDB. If you want to learn RavenDB basics, I would recommend you to...
Já está disponível o registro da conversa com os meninos da Lambda3, meus amigos Giovanni Bassi e Victor Cavalcante, sobre...
When designing systems that need to scale you always need to remember that [tweet]more computing power does not necessarily mean...
Se há algo que aprendi na “escola da vida” é que sempre que temos algo importante para decidir, se não...