Embedded   




 What's Next for VHDL/Verilog? 5/14/2020

    Posted by Changyi at 1:46 AM 2 Comments  

 Running Scala from Windows Batch file (.cmd file) 5/12/2020

Scala is by far the most versatile language I have ever seen. And personally, I would use it to replace all the existing script solutions.

To run Scala in Windows batch file (.cmd file), the following can be a good example. It shows how to break a long list of numbers into multiple groups, and print them out in a different format:


::#!

@echo off

set path_name=%~p0
set file_name=%~n0%~x0

pushd %path_name% & scala -cp C:\repo\scala_pkg -deprecation %file_name% %* & popd

::!#

// The true Scala code starts here

object Main {

    def main(args : Array[String]) = {
   
        val coef  : List[Int]  = List (-1, 2, 3, 4, -5, 6, 7, 8, 9, 10, -11, -12, 13, 14, 15, 16, 17, 18, -19, 20)
        val coefGroup : List [List[Int]] = coef.grouped(5).toList
        val coefStr  : List[String] = coefGroup map (_.mkString("(", ", ", ", others => 0),"))
                     
        coefStr.foreach(println)
    }
}

    Posted by Changyi at 10:34 PM 0 Comments  

   

 

    

README

*) Legal Disclaimer
*) The Book

Links

*) PulseRain
*) FPGA Limerick
*) GitHub
*) Forum


*) FCC Wireless
*) ARRL
*) PAPA System
*) EARS

Archives
Recent Posts
  << Home