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:

What kind of optimizations could we expect from the C# compiler and the JIT? In this post, I would like...
Que nível de otimizações podemos esperar do compilador do C# e do JIT? Neste post, compartilho um pequeno, mas esclarecedor...
No meu cotidiano, reconheço que, por mais estranho que pareça, comprometo muito do meu tempo ouvindo música ruim até que,...
Last post, I asked an explanation about the execution result of the following code. using System; using System.Threading.Tasks; using static...
Would you like to learn about NoSQL? Are you looking for help to make your first steps using RavenDB? So,...
Um dos princípios que mais valorizo em práticas ágeis é o feedback. De todos os tipos de feedback que já...
× Precisa de ajuda?