Skip to content

Instantly share code, notes, and snippets.

@lazywithclass
Last active March 21, 2017 04:08
Show Gist options
  • Save lazywithclass/fae8a4afbc17233e59d4bc1c043b81d4 to your computer and use it in GitHub Desktop.
Save lazywithclass/fae8a4afbc17233e59d4bc1c043b81d4 to your computer and use it in GitHub Desktop.
[RC Diary] For every step there's another hole to jump (-90)

[RC Diary] For every step there's another hole to jump (-90)

Implement Dijkstra's algorithm

Implemented a version using a priority queue.

Cerebro

I managed to have it "working" for a base, meaning that it can read a source code, read the test, mutate the source code and run source concatenated with test using mocha.

I thought I was almost there but no, I have another kind of error now, more subtle, that I didn't have before because I was just evaluating a given piece of code, far from how it looks like in reality:

// read from the source file
function check() {    
  return false
}
module.exports = check

// read from the test file
let assert = require('assert')
let check = require('../lib/source');

describe('simple project', () => {    
  it('returns true', () => {
    assert.equal(check(true), true);
  })
})

mocha.run()

As you can see check is declared twice. One easy fix in this case is to remove the require which imports check, some other solutions might be comparing the path of the require with the path of the file I am mutating.

Plans

  • Cerebro
  • project lamp
  • still need some attention needed for timsort, radix sort, dijkstra algo
  • chapter 3 of the little schemer in Clojure
  • allow some time to think
  • find a new apartment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment