Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIx Reduction of empty array error #10

Open
rgertenbach opened this issue Nov 7, 2016 · 5 comments
Open

FIx Reduction of empty array error #10

rgertenbach opened this issue Nov 7, 2016 · 5 comments
Labels

Comments

@rgertenbach
Copy link
Owner

mapkob.Row.prototype.sum generates

C:\Users\Robin\Desktop\mapkob.js:239
}, this).reduce(function(x, y) {
^

TypeError: Reduce of empty array with no initial value
at Array.reduce (native)
at mapkob.Row.sum (C:\Users\Robin\Desktop\mapkob.js:239:12)
at mapkob.Row.probabilities (C:\Users\Robin\Desktop\mapkob.js:251:18)
at mapkob.TransitionMatrix.generateChain (C:\Users\Robin\Desktop\mapkob.js:190:7)
at Object. (C:\Users\Robin\Desktop\mapkob.js:318:19)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
[Finished in 19.1s]

@rgertenbach rgertenbach added the bug label Nov 7, 2016
@rgertenbach
Copy link
Owner Author

Fixed

@rgertenbach
Copy link
Owner Author

Nope, still there:
C:\Users\Robin\Desktop\mapkob.js:239
}, this).reduce(function(x, y) {
^

TypeError: Reduce of empty array with no initial value
at Array.reduce (native)
at mapkob.Row.sum (C:\Users\Robin\Desktop\mapkob.js:239:12)
at mapkob.Row.probabilities (C:\Users\Robin\Desktop\mapkob.js:251:18)
at mapkob.TransitionMatrix.generateChain (C:\Users\Robin\Desktop\mapkob.js:190:7)
at Object. (C:\Users\Robin\Desktop\mapkob.js:321:19)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
[Finished in 18.9s with exit code 1]

With holmes and lovecraft short

@rgertenbach rgertenbach reopened this Nov 7, 2016
@rgertenbach
Copy link
Owner Author

A B C. D:

causes

{ stateSpace: [ 'A', 'B', 'C', undefined, 'D:' ],
  matrix: 
   { A: { 'B C': 1 },
     B: { 'C undefined': 1 },
     C: { 'undefined:': 1 },
     undefined: { 'D: undefined': 1 },
     'D:': { undefined: 1 } },
  initialStates: { row: { A: 1, 'D:': 1 }, stateSpace: [ 'A', 'D:' ] },
  n: 3 }
A
C:\Users\Robin\Desktop\mapkob.js:241
  }, this).reduce(function(x, y) {
           ^

TypeError: Reduce of empty array with no initial value
    at Array.reduce (native)
    at mapkob.Row.sum (C:\Users\Robin\Desktop\mapkob.js:241:12)
    at mapkob.Row.probabilities (C:\Users\Robin\Desktop\mapkob.js:253:18)
    at mapkob.TransitionMatrix.generateChain (C:\Users\Robin\Desktop\mapkob.js:192:7)
    at Object.<anonymous> (C:\Users\Robin\Desktop\mapkob.js:324:19)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
A
B C
undefined:
[Finished in 0.3s with exit code 1]

@rgertenbach
Copy link
Owner Author

Probably it's failing because : is not a \w character

@rgertenbach
Copy link
Owner Author

part of the dicst is actually linking to: "undefined:"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant