Multidimensional Matrix digestion through Regex/Kotlin and one line of code.

This will be a quick one as this is more of a way point for me to catalogue the progress than it is for me to 100% explain it. I don’t know how it all work in entirety, but I have been able to find facets in with it can operate theoretically better. Na…


This content originally appeared on DEV Community and was authored by Al

This will be a quick one as this is more of a way point for me to catalogue the progress than it is for me to 100% explain it. I don't know how it all work in entirety, but I have been able to find facets in with it can operate theoretically better. Namely, utilizing matrix data to send specific and cost effective cost data. For this exercise we are going to test out a matrix in which has an axis on its span (I am fairly sure at least). That kind of matrix would look something like this:

    fun matricGen() =
        """
          1000000
          0100000
          0010000
          0001000
          0000100
          0000010
          0000001
        """.trimIndent()

Its still technically a square. I digress. This is important as it allows us to easer do various object transforms and rotables as the spin of the object evenly falls on the span of its axis.

I just want you to think for a second about how you would digest that information.
A couple seconds and we are good.

We digest it as is and utilize the power of pattern recognition and the various and universal usages of regular expressions. I can grab the index of all the one values without and headache or real hassle or worry. In fact, with Kotlin, I can digest all of that accurately in 1 line:

var indiceValues = Regex("[1]{1,}").findAll(matricGen()).map{it.range.start}

That will allow me to grab all the 2d graphical points on the index without have to write a loop of even having to double the project to 2 lines.

Index|`Value|
0 | 1
9 | 1
18 | 1
27 | 1

  1. | 1
  2. | 1
  3. |


This content originally appeared on DEV Community and was authored by Al


Print Share Comment Cite Upload Translate Updates
APA

Al | Sciencx (2021-05-31T16:06:14+00:00) Multidimensional Matrix digestion through Regex/Kotlin and one line of code.. Retrieved from https://www.scien.cx/2021/05/31/multidimensional-matrix-digestion-through-regex-kotlin-and-one-line-of-code/

MLA
" » Multidimensional Matrix digestion through Regex/Kotlin and one line of code.." Al | Sciencx - Monday May 31, 2021, https://www.scien.cx/2021/05/31/multidimensional-matrix-digestion-through-regex-kotlin-and-one-line-of-code/
HARVARD
Al | Sciencx Monday May 31, 2021 » Multidimensional Matrix digestion through Regex/Kotlin and one line of code.., viewed ,<https://www.scien.cx/2021/05/31/multidimensional-matrix-digestion-through-regex-kotlin-and-one-line-of-code/>
VANCOUVER
Al | Sciencx - » Multidimensional Matrix digestion through Regex/Kotlin and one line of code.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/05/31/multidimensional-matrix-digestion-through-regex-kotlin-and-one-line-of-code/
CHICAGO
" » Multidimensional Matrix digestion through Regex/Kotlin and one line of code.." Al | Sciencx - Accessed . https://www.scien.cx/2021/05/31/multidimensional-matrix-digestion-through-regex-kotlin-and-one-line-of-code/
IEEE
" » Multidimensional Matrix digestion through Regex/Kotlin and one line of code.." Al | Sciencx [Online]. Available: https://www.scien.cx/2021/05/31/multidimensional-matrix-digestion-through-regex-kotlin-and-one-line-of-code/. [Accessed: ]
rf:citation
» Multidimensional Matrix digestion through Regex/Kotlin and one line of code. | Al | Sciencx | https://www.scien.cx/2021/05/31/multidimensional-matrix-digestion-through-regex-kotlin-and-one-line-of-code/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.