nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ad93cd0
)
lib/vsm: access to non-existing keys return 0.0
author
Alexandre Terrasa
<alexandre@moz-code.org>
Thu, 12 Oct 2017 00:47:50 +0000
(20:47 -0400)
committer
Alexandre Terrasa
<alexandre@moz-code.org>
Thu, 12 Oct 2017 00:49:00 +0000
(20:49 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
lib/vsm/vsm.nit
patch
|
blob
|
history
diff --git
a/lib/vsm/vsm.nit
b/lib/vsm/vsm.nit
index
41d5152
..
8eaeca8
100644
(file)
--- a/
lib/vsm/vsm.nit
+++ b/
lib/vsm/vsm.nit
@@
-72,6
+72,11
@@
class Vector
return cos
end
+ redef fun [](k) do
+ if not has_key(k) then return 0.0
+ return super
+ end
+
# The norm of the vector.
#
# `||x|| = (x1 ** 2 ... + xn ** 2).sqrt`