Scripting with Scala and SBT
来源:互联网 发布:迅捷网络的初始密码 编辑:程序博客网 时间:2024/06/05 04:19
scabl: Scripting with Scala and SBT
http://scabl.blogspot.com/2013/05/scripting-with-scala-and-sbt.html
Scripting with Scala and SBT
I wanted to write about a great experience I had with Scala and SBT today. This morning I had to write a script to convert one .csv file into another. I figured, there's no way I'm notdoing this in Scala. So I sat down to write my little script. I opened up script.scala in my current directory, and started typing:
object script extends App {
println("hi")
}
At first, I was entering scalac script.scala and scala script at the command line, but that didn't last long. Ridiculously slow. So I created a build.sbt and wrote:
scalaVersion := "2.10.1"
mainClass := Some("script")
Switch to my compiling window and launch sbt. Enter ~ run. Then it was off to the races! I have a two-key command (C-z C-z) to switch between emacs and sbt. By the time I save in emacs and switch windows to sbt, I'm already looking at the latest output. This is much better turnaround than I used to get in Python or Perl, where I would switch windows and rerun the script after saving a change. Of course, the best part is I'm scripting in Scala and not Python or Perl. I get to use vals and immutable and typed collections. And Option and map and flatMap and foldLeft and for-comprehensions.
I was really pleasantly surprised at how easy it was to get things going in SBT with this.
object script extends App {
println("hi")
}
At first, I was entering scalac script.scala and scala script at the command line, but that didn't last long. Ridiculously slow. So I created a build.sbt and wrote:
scalaVersion := "2.10.1"
mainClass := Some("script")
Switch to my compiling window and launch sbt. Enter ~ run. Then it was off to the races! I have a two-key command (C-z C-z) to switch between emacs and sbt. By the time I save in emacs and switch windows to sbt, I'm already looking at the latest output. This is much better turnaround than I used to get in Python or Perl, where I would switch windows and rerun the script after saving a change. Of course, the best part is I'm scripting in Scala and not Python or Perl. I get to use vals and immutable and typed collections. And Option and map and flatMap and foldLeft and for-comprehensions.
I was really pleasantly surprised at how easy it was to get things going in SBT with this.
- Scripting with Scala and SBT
- Install scala and sbt on Ubuntu
- AJAX and scripting Web services with E4X, Part 1
- AJAX and scripting Web services with E4X, Part 2
- Everyday Scripting with Ruby: For Teams, Testers, and You [ILLUSTRATED]
- Accelerated DOM Scripting with Ajax, APIs, and Libraries
- Uploading File with PHP and Client Side Scripting
- 强烈推荐《深入浅出JavaScript》(beginning JavaScript with DOM Scripting and Ajax
- DOM scripting: web design with javascript and DOM
- sbt构建scala工程
- sbt 构建scala 项目
- [Scala] sbt install script
- sbt构建scala项目
- scala sbt 代理设置
- apt安装sbt(Scala)
- scala + sbt + intellij
- RAD with Scala and Vaadin (zt)
- Remote Scripting with IFrame
- 求1到n的正整数中某个字符出现的次数
- Git详解之五:分布式Git
- javax.persistence.Cacheable
- Java调用Groovy的方法总结
- 有关于strlen的小细节
- Scripting with Scala and SBT
- Python学习—持续更新
- 托盘编程全接触
- linux C内存泄露检测实现及内存泄露检测的一般方法
- 求职感想
- magento 更换IP地址和基本URL方法
- iPhone5C三大看点:性能不输iPhone5 或售3399元
- Windows socket-重叠模型
- 初次发布自己的App到AppStore