This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-287
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-287 by this push:
     new 50404c0  WIP.
50404c0 is described below

commit 50404c03d1970d1e825e6709f3df89af044a1ac1
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Apr 15 15:07:50 2021 +0300

    WIP.
---
 .../scala/org/apache/nlpcraft/common/util/NCUtils.scala  | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
index 636878b..f0c9f2b 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
@@ -2131,12 +2131,13 @@ object NCUtils extends LazyLogging {
     def isContinuous(idxs: Seq[Int]): Boolean = {
         require(idxs.nonEmpty)
 
-        val list = idxs.view
-
-        list.size match {
+        idxs.size match {
             case 0 ⇒ throw new AssertionError()
             case 1 ⇒ true
-            case _ ⇒  list.zip(list.tail).forall { case (x, y) ⇒ x + 1 == y }
+            case _ ⇒
+                val list = idxs.view
+
+                list.zip(list.tail).forall { case (x, y) ⇒ x + 1 == y }
         }
     }
 
@@ -2151,7 +2152,10 @@ object NCUtils extends LazyLogging {
         idxs.size match {
             case 0 ⇒ throw new AssertionError()
             case 1 ⇒ true
-            case _ ⇒  !idxs.zip(idxs.tail).exists { case (x, y) ⇒ x > y }
+            case _ ⇒
+                val list = idxs.view
+
+                !list.zip(list.tail).exists { case (x, y) ⇒ x > y }
         }
     }
-}
+}
\ No newline at end of file

Reply via email to