flexitaya.blogg.se

Ammonite scala
Ammonite scala









ammonite scala
  1. #Ammonite scala how to
  2. #Ammonite scala code

ext BTW, you’re getting some kind of code completion and highlighting Because it’s statically typed we even can use code completion to get the.

  • To list all Scala files we list the working directory and then just run `filter` on the extension.
  • Ammonite is doing pretty print and fold long results.
  • ammonite scala

    The cool part here is that the result is a Scala class! //This is another syntax-saving extension, that makes it easy to call functions without having to constantly be opening and closing brackets. To list files we use `ls!`, the bang means executing a shell command. Let’s try to do the same things with Ammonite. Welcome Ammonite! It’s a combination of a better Scala REPL and a shell like operations library.Don’t we deserve something better? //It’s very verbose, and I don’t even want to go into all problems scala REPL have (like CTRL+C kicks us out of REPL) What do you think? Again, Scala is much more verbose. We get where this goes, I’m not going to go into the recursive examples here. So a simple bash `ls` command unfolds to more than 5 lines of Scala code.We’re all Scala developers! Why don’t we use Scala? Let’s try.If the function failed, it will fail silently and the execution of the script will continue with an empty string as the result of the function - Oh! Then it will delete the root folder :( What will happen? It depends! If the function returned the path to delete, it will delete everything under this path. Now let’s have a look at another example.maybe replace ‘can’t understand’ with - WAT !?! So you run it! Seems to work! -> You happy! That’s the amount of confidence we usually have in many our bash scripts In addition to that amount of confidence, the result is a string, so to use it we need to parse it and extract what we need. Probably very few people in this room can understand it. Then you look at it and try to understand it, look at it again …. You google for it, and you find many results.

    #Ammonite scala how to

    Who even remember how to do simple stuff like for loop or an if statement? So usually you pick the one with most votes on StackOverflow And you need to google for everything, even if you had to do the same thing few weeks ago. Who can do it without Google? You might be familiar of this process … let’s ask google. I assume that most of you are familiar with bash. To understand why we need it, let’s start with the traditional way - bash.In the next 10 minutes I will introduce you with a new powerful tool for writing rock-solid shell scripts. “system shell” and a “programming language” UnixFileAttributeViews$Basic.readAttributes(U Uni圎xception.rethrowAsIOException(UnitExcept











    Ammonite scala