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:

2 respostas

  1. 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

    1. 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.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

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:

As lojas que podem e que insistem em funcionar, na minha cidade, estão limitando o número de clientes atendidos simultaneamente....
C++ é uma linguagem de programação velha, charmosa para os iniciados, assustadora para aqueles que conhecem pouco dela. Bjarne Stroustrup desenvolveu...
Time to study again. I just started an online course at the Singularity University. If you could solve one of...
Nessa última semana, Fernando Neiva apresentou um compilado de nossas lições aprendidas implementando Kanban na Guiando. Aqui, compartilhamos o registro...
Aprendemos que a priorização das atividades deve ser feita, invariavelmente, pelo time do negócio. Na prática, entretanto, em nosso time,...
Some days ago, I heard a fantastic interview with Phil Haack on the IT Career Energizer Podcast. Here is the...