SlideShare a Scribd company logo
1 of 37
Scala

   id:clairvy
  2010/09/04
  @Scala 01
Scala
 id:clairvy
2010/09/04
@Scala 01
• id:clairvy (
•4           PHPer

• Perl
•
Church
             0 := λf x. x
•            1 := λf x. f x
•                  :
object Main {
  override def main(args : Array[String]) {
    println("zero: " + zero(0)(i => i +1))
    println("one: " + succ[Int](zero)(0)(i => i + 1))

      def zero[A](i : A) = (f : A => A) => i
      def succ[A](n : A=>(A=>A)=>A) = (i:A)=>(f:A=>A)=>f(n(i)(f))
    }
}
• [Int]
• [Int]
•
• [Int]
•
•
Android Recipes
  with Scala
Android Recipes
      with Scala
• 108104     1        …
Android Recipes
      with Scala
• 108104                  1       …

•          id:papamitra       …
Android Recipes
      with Scala
• 108104                  1       …

•          id:papamitra       …

•          @gabu          …
Android Recipes
       with Scala
• 108104                  1       …

•           id:papamitra      …

•           @gabu         …

• Recipe001              YO
orz
orz
•   OCamlMeetingNagoya
orz
•      OCamlMeetingNagoya

• OCamlGolf        sort
orz
•      OCamlMeetingNagoya

• OCamlGolf        sort

•
•
•
•
•
•
•
•   scala + zsh
export JAVACMD=$HOME/local/bin/java
function scall () {
  local f
  while getopts 'e:B:E:' opt; do
     case $opt in
       B) B=$OPTARG;;
       E) E=$OPTARG;;
       e) f=$OPTARG;;
     esac
  done
  shift $((OPTIND - 1))
  if [[ x"$f" == x"" ]]; then
    f='println'
  fi
  scala -e "import scala.io._;$B;
(if(args.length>0)args.map(arg=>Source.fromFile(arg,
"UTF-8"))else
Array(Source.stdin)).foreach(s=>s.getLines.foreach($f));$E" "$@"
}
#compdef scall

function _scall () {
  _arguments : 
    '-h[Show message and exit]' 
    '-e[Specify expression to run with each line]:Expression' 
    '-B[Specify expression to run on begin of
program]:Expression' 
    '-E[Specify expression to run on end of program]:Expression'

    '*:argument:_files'
}
•   Zsh

•
•   …
$ time (scall ~/.zshrc > /dev/null)
(; scall ~/.zshrc > /dev/null; )
1.76s user 0.17s system 42% cpu 4.536 total
$ time (cat ~/.zshrc > /dev/null)
(; cat ~/.zshrc > /dev/null; )
0.00s user 0.00s system 61% cpu 0.004 total
$ time (perl -pe1 ~/.zshrc > /dev/null)
(; perl -pe1 ~/.zshrc > /dev/null; )
0.00s user 0.00s system 52% cpu 0.008 total
•
object Scall {
  import scala.tools.nsc._
  import scala.io._

     def main(args : Array[String]) {
//
    val interp : Interpreter = new Interpreter()
    val script = "((" + begin + "), (" + expression + "), (" +
end + "))"
    var result : (()=>Unit, (String)=>Unit, ()=>Unit) = null
    interp.eval[(()=>Unit, (String)=>Unit, ()=> Unit)](script)
match {
      case Some(ret) => result = ret;
      case _ => println("compile error");exit(1);
    }

    result._1()
    (if (files.length > 0) files.map(f=>Source.fromFile(f)) else
List(Source.stdin)).foreach(f=>f.getLines.foreach((l:String)=>re
sult._2(l)))
    result._3()
  }
}
…
•       …

•
#
$ time (scall ~/.zshrc > /dev/null)
(; scala-2.8 -deprecation -cp com.myexample.Scall ~/.zshrc > /
dev/null; )
13.35s user 0.75s system 72% cpu 19.502 total
$ time (cat ~/.zshrc > /dev/null)
(; cat ~/.zshrc > /dev/null; )
0.00s user 0.00s system 61% cpu 0.004 total
$ time (perl -pe1 ~/.zshrc > /dev/null)
(; perl -pe1 ~/.zshrc > /dev/null; )
0.00s user 0.00s system 52% cpu 0.008 total
•
    (by   )
Command Liner with Scala
Command Liner with Scala

More Related Content

What's hot

Basic ASM by @binaryheadache
Basic ASM by @binaryheadacheBasic ASM by @binaryheadache
Basic ASM by @binaryheadachecamsec
 
Educational slides by venay magen
Educational slides by venay magenEducational slides by venay magen
Educational slides by venay magenvenaymagen19
 
Google Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & AndroidGoogle Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & AndroidJordi Gerona
 
미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정SeungChul Kang
 
Scala and Hadoop @ eBay
Scala and Hadoop @ eBayScala and Hadoop @ eBay
Scala and Hadoop @ eBayebaynyc
 
Introduction to meta-programming in scala
Introduction to meta-programming in scalaIntroduction to meta-programming in scala
Introduction to meta-programming in scalaAlessandro Marrella
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)riue
 
An introduction to scala
An introduction to scalaAn introduction to scala
An introduction to scalaXing
 
Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Kenji HASUNUMA
 
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
TDC218SP | Trilha Kotlin - DSLs in a Kotlin WayTDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Waytdc-globalcode
 
fme Alfresco Day 06-2013 - alfresco.js and share
fme Alfresco Day 06-2013 - alfresco.js and sharefme Alfresco Day 06-2013 - alfresco.js and share
fme Alfresco Day 06-2013 - alfresco.js and shareAlfresco by fme AG
 
À la découverte des Observables - HumanTalks Paris 2017
À la découverte des Observables - HumanTalks Paris 2017À la découverte des Observables - HumanTalks Paris 2017
À la découverte des Observables - HumanTalks Paris 2017Nicolas Carlo
 
Invertible-syntax 入門
Invertible-syntax 入門Invertible-syntax 入門
Invertible-syntax 入門Hiromi Ishii
 
The Ring programming language version 1.5.4 book - Part 77 of 185
The Ring programming language version 1.5.4 book - Part 77 of 185The Ring programming language version 1.5.4 book - Part 77 of 185
The Ring programming language version 1.5.4 book - Part 77 of 185Mahmoud Samir Fayed
 
WebAssembly. Neither Web Nor Assembly, All Revolutionary
WebAssembly. Neither Web Nor Assembly, All RevolutionaryWebAssembly. Neither Web Nor Assembly, All Revolutionary
WebAssembly. Neither Web Nor Assembly, All RevolutionaryC4Media
 
Getting Functional with Scala
Getting Functional with ScalaGetting Functional with Scala
Getting Functional with ScalaJorge Paez
 
Tips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationTips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationJoni
 
The Ring programming language version 1.8 book - Part 96 of 202
The Ring programming language version 1.8 book - Part 96 of 202The Ring programming language version 1.8 book - Part 96 of 202
The Ring programming language version 1.8 book - Part 96 of 202Mahmoud Samir Fayed
 

What's hot (20)

Basic ASM by @binaryheadache
Basic ASM by @binaryheadacheBasic ASM by @binaryheadache
Basic ASM by @binaryheadache
 
Educational slides by venay magen
Educational slides by venay magenEducational slides by venay magen
Educational slides by venay magen
 
Google Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & AndroidGoogle Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & Android
 
미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정
 
Scala and Hadoop @ eBay
Scala and Hadoop @ eBayScala and Hadoop @ eBay
Scala and Hadoop @ eBay
 
Introduction to meta-programming in scala
Introduction to meta-programming in scalaIntroduction to meta-programming in scala
Introduction to meta-programming in scala
 
A bit about Scala
A bit about ScalaA bit about Scala
A bit about Scala
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
 
Scala for Jedi
Scala for JediScala for Jedi
Scala for Jedi
 
An introduction to scala
An introduction to scalaAn introduction to scala
An introduction to scala
 
Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Collections Framework Begineers guide 2
Collections Framework Begineers guide 2
 
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
TDC218SP | Trilha Kotlin - DSLs in a Kotlin WayTDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
 
fme Alfresco Day 06-2013 - alfresco.js and share
fme Alfresco Day 06-2013 - alfresco.js and sharefme Alfresco Day 06-2013 - alfresco.js and share
fme Alfresco Day 06-2013 - alfresco.js and share
 
À la découverte des Observables - HumanTalks Paris 2017
À la découverte des Observables - HumanTalks Paris 2017À la découverte des Observables - HumanTalks Paris 2017
À la découverte des Observables - HumanTalks Paris 2017
 
Invertible-syntax 入門
Invertible-syntax 入門Invertible-syntax 入門
Invertible-syntax 入門
 
The Ring programming language version 1.5.4 book - Part 77 of 185
The Ring programming language version 1.5.4 book - Part 77 of 185The Ring programming language version 1.5.4 book - Part 77 of 185
The Ring programming language version 1.5.4 book - Part 77 of 185
 
WebAssembly. Neither Web Nor Assembly, All Revolutionary
WebAssembly. Neither Web Nor Assembly, All RevolutionaryWebAssembly. Neither Web Nor Assembly, All Revolutionary
WebAssembly. Neither Web Nor Assembly, All Revolutionary
 
Getting Functional with Scala
Getting Functional with ScalaGetting Functional with Scala
Getting Functional with Scala
 
Tips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationTips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET Application
 
The Ring programming language version 1.8 book - Part 96 of 202
The Ring programming language version 1.8 book - Part 96 of 202The Ring programming language version 1.8 book - Part 96 of 202
The Ring programming language version 1.8 book - Part 96 of 202
 

Viewers also liked

Cell & its organelles, inter cellular conections
Cell & its organelles, inter cellular conectionsCell & its organelles, inter cellular conections
Cell & its organelles, inter cellular conectionsDr K Ambareesha Goud PhD
 
Chemistry: Electron orbitals and sub levels
Chemistry: Electron orbitals and sub levels Chemistry: Electron orbitals and sub levels
Chemistry: Electron orbitals and sub levels tt7647tt
 
Chemistry - Chp 5 - Electrons In Atoms - Powerpoint
Chemistry - Chp 5 - Electrons In Atoms - PowerpointChemistry - Chp 5 - Electrons In Atoms - Powerpoint
Chemistry - Chp 5 - Electrons In Atoms - PowerpointMr. Walajtys
 
IB Biology 1.1 Slides: Introduction to Cells
IB Biology 1.1 Slides: Introduction to CellsIB Biology 1.1 Slides: Introduction to Cells
IB Biology 1.1 Slides: Introduction to CellsJacob Cedarbaum
 
Cell structure and function biology
Cell structure and function biologyCell structure and function biology
Cell structure and function biologygreencycle
 
Cell Organelles Power Point
Cell Organelles Power PointCell Organelles Power Point
Cell Organelles Power Pointbethgombert
 
Structure of atom ppt
Structure of atom pptStructure of atom ppt
Structure of atom pptlekshmisg91
 
IB Biology 1.2 Slides: Ultrastructure of Cells
IB Biology 1.2 Slides: Ultrastructure of CellsIB Biology 1.2 Slides: Ultrastructure of Cells
IB Biology 1.2 Slides: Ultrastructure of CellsJacob Cedarbaum
 
Chemistry - Chp 4 - Atomic Structure - PowerPoint
Chemistry - Chp 4 - Atomic Structure - PowerPointChemistry - Chp 4 - Atomic Structure - PowerPoint
Chemistry - Chp 4 - Atomic Structure - PowerPointMr. Walajtys
 
Cells Powerpoint Presentation
Cells Powerpoint PresentationCells Powerpoint Presentation
Cells Powerpoint Presentationcprizel
 

Viewers also liked (16)

Ap Chapter 10 Bonding Ii
Ap Chapter 10 Bonding IiAp Chapter 10 Bonding Ii
Ap Chapter 10 Bonding Ii
 
Cell & its organelles, inter cellular conections
Cell & its organelles, inter cellular conectionsCell & its organelles, inter cellular conections
Cell & its organelles, inter cellular conections
 
Chemistry: Electron orbitals and sub levels
Chemistry: Electron orbitals and sub levels Chemistry: Electron orbitals and sub levels
Chemistry: Electron orbitals and sub levels
 
Chemistry - Chp 5 - Electrons In Atoms - Powerpoint
Chemistry - Chp 5 - Electrons In Atoms - PowerpointChemistry - Chp 5 - Electrons In Atoms - Powerpoint
Chemistry - Chp 5 - Electrons In Atoms - Powerpoint
 
IB Biology 1.1 Slides: Introduction to Cells
IB Biology 1.1 Slides: Introduction to CellsIB Biology 1.1 Slides: Introduction to Cells
IB Biology 1.1 Slides: Introduction to Cells
 
Biology ppt(cell)
Biology ppt(cell)Biology ppt(cell)
Biology ppt(cell)
 
Cell structure and function biology
Cell structure and function biologyCell structure and function biology
Cell structure and function biology
 
Cell Organelles Power Point
Cell Organelles Power PointCell Organelles Power Point
Cell Organelles Power Point
 
Cell Organelles
Cell OrganellesCell Organelles
Cell Organelles
 
Atomic structure ppt
Atomic structure pptAtomic structure ppt
Atomic structure ppt
 
Struture of an atom
Struture of an atomStruture of an atom
Struture of an atom
 
Structure of atom ppt
Structure of atom pptStructure of atom ppt
Structure of atom ppt
 
Cell Structure And Function
Cell Structure And FunctionCell Structure And Function
Cell Structure And Function
 
IB Biology 1.2 Slides: Ultrastructure of Cells
IB Biology 1.2 Slides: Ultrastructure of CellsIB Biology 1.2 Slides: Ultrastructure of Cells
IB Biology 1.2 Slides: Ultrastructure of Cells
 
Chemistry - Chp 4 - Atomic Structure - PowerPoint
Chemistry - Chp 4 - Atomic Structure - PowerPointChemistry - Chp 4 - Atomic Structure - PowerPoint
Chemistry - Chp 4 - Atomic Structure - PowerPoint
 
Cells Powerpoint Presentation
Cells Powerpoint PresentationCells Powerpoint Presentation
Cells Powerpoint Presentation
 

Similar to Command Liner with Scala

Scala introduction
Scala introductionScala introduction
Scala introductionvito jeng
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghStuart Roebuck
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Mario Camou Riveroll
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CAlexis Gallagher
 
Front end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript coreFront end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript coreWeb Zhao
 
Spark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted MalaskaSpark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted MalaskaSpark Summit
 
楽々Scalaプログラミング
楽々Scalaプログラミング楽々Scalaプログラミング
楽々ScalaプログラミングTomoharu ASAMI
 
Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)mircodotta
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Qiangning Hong
 
Scala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldScala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldWerner Hofstra
 
The Ring programming language version 1.2 book - Part 80 of 84
The Ring programming language version 1.2 book - Part 80 of 84The Ring programming language version 1.2 book - Part 80 of 84
The Ring programming language version 1.2 book - Part 80 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 181 of 185
The Ring programming language version 1.5.4 book - Part 181 of 185The Ring programming language version 1.5.4 book - Part 181 of 185
The Ring programming language version 1.5.4 book - Part 181 of 185Mahmoud Samir Fayed
 
并发模型介绍
并发模型介绍并发模型介绍
并发模型介绍qiang
 
ScalaCheck
ScalaCheckScalaCheck
ScalaCheckBeScala
 
PHP security audits
PHP security auditsPHP security audits
PHP security auditsDamien Seguy
 
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵Wanbok Choi
 
Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C SurvivesS Akai
 

Similar to Command Liner with Scala (20)

Scala introduction
Scala introductionScala introduction
Scala introduction
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-C
 
Front end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript coreFront end fundamentals session 1: javascript core
Front end fundamentals session 1: javascript core
 
Spark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted MalaskaSpark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted Malaska
 
楽々Scalaプログラミング
楽々Scalaプログラミング楽々Scalaプログラミング
楽々Scalaプログラミング
 
Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010
 
Scala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldScala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereld
 
The Ring programming language version 1.2 book - Part 80 of 84
The Ring programming language version 1.2 book - Part 80 of 84The Ring programming language version 1.2 book - Part 80 of 84
The Ring programming language version 1.2 book - Part 80 of 84
 
Scala coated JVM
Scala coated JVMScala coated JVM
Scala coated JVM
 
Angular2 for Beginners
Angular2 for BeginnersAngular2 for Beginners
Angular2 for Beginners
 
Scala on Android
Scala on AndroidScala on Android
Scala on Android
 
The Ring programming language version 1.5.4 book - Part 181 of 185
The Ring programming language version 1.5.4 book - Part 181 of 185The Ring programming language version 1.5.4 book - Part 181 of 185
The Ring programming language version 1.5.4 book - Part 181 of 185
 
并发模型介绍
并发模型介绍并发模型介绍
并发模型介绍
 
ScalaCheck
ScalaCheckScalaCheck
ScalaCheck
 
PHP security audits
PHP security auditsPHP security audits
PHP security audits
 
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
 
Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C Survives
 

Recently uploaded

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

Command Liner with Scala

  • 1. Scala id:clairvy 2010/09/04 @Scala 01
  • 3. • id:clairvy ( •4 PHPer • Perl
  • 4.
  • 5.
  • 6. Church 0 := λf x. x • 1 := λf x. f x • :
  • 7. object Main { override def main(args : Array[String]) {   println("zero: " + zero(0)(i => i +1))   println("one: " + succ[Int](zero)(0)(i => i + 1))   def zero[A](i : A) = (f : A => A) => i   def succ[A](n : A=>(A=>A)=>A) = (i:A)=>(f:A=>A)=>f(n(i)(f)) } }
  • 11. Android Recipes with Scala
  • 12. Android Recipes with Scala • 108104 1 …
  • 13. Android Recipes with Scala • 108104 1 … • id:papamitra …
  • 14. Android Recipes with Scala • 108104 1 … • id:papamitra … • @gabu …
  • 15. Android Recipes with Scala • 108104 1 … • id:papamitra … • @gabu … • Recipe001 YO
  • 16. orz
  • 17. orz • OCamlMeetingNagoya
  • 18. orz • OCamlMeetingNagoya • OCamlGolf sort
  • 19. orz • OCamlMeetingNagoya • OCamlGolf sort •
  • 20.
  • 21.
  • 24. scala + zsh
  • 25. export JAVACMD=$HOME/local/bin/java function scall () { local f while getopts 'e:B:E:' opt; do case $opt in B) B=$OPTARG;; E) E=$OPTARG;; e) f=$OPTARG;; esac done shift $((OPTIND - 1)) if [[ x"$f" == x"" ]]; then f='println' fi scala -e "import scala.io._;$B; (if(args.length>0)args.map(arg=>Source.fromFile(arg, "UTF-8"))else Array(Source.stdin)).foreach(s=>s.getLines.foreach($f));$E" "$@" }
  • 26. #compdef scall function _scall () { _arguments : '-h[Show message and exit]' '-e[Specify expression to run with each line]:Expression' '-B[Specify expression to run on begin of program]:Expression' '-E[Specify expression to run on end of program]:Expression' '*:argument:_files' }
  • 27. Zsh •
  • 28.
  • 29. $ time (scall ~/.zshrc > /dev/null) (; scall ~/.zshrc > /dev/null; ) 1.76s user 0.17s system 42% cpu 4.536 total $ time (cat ~/.zshrc > /dev/null) (; cat ~/.zshrc > /dev/null; ) 0.00s user 0.00s system 61% cpu 0.004 total $ time (perl -pe1 ~/.zshrc > /dev/null) (; perl -pe1 ~/.zshrc > /dev/null; ) 0.00s user 0.00s system 52% cpu 0.008 total
  • 30.
  • 31.
  • 32. object Scall { import scala.tools.nsc._ import scala.io._ def main(args : Array[String]) { // val interp : Interpreter = new Interpreter() val script = "((" + begin + "), (" + expression + "), (" + end + "))" var result : (()=>Unit, (String)=>Unit, ()=>Unit) = null interp.eval[(()=>Unit, (String)=>Unit, ()=> Unit)](script) match { case Some(ret) => result = ret; case _ => println("compile error");exit(1); } result._1() (if (files.length > 0) files.map(f=>Source.fromFile(f)) else List(Source.stdin)).foreach(f=>f.getLines.foreach((l:String)=>re sult._2(l))) result._3() } }
  • 33. … • … •
  • 34. # $ time (scall ~/.zshrc > /dev/null) (; scala-2.8 -deprecation -cp com.myexample.Scall ~/.zshrc > / dev/null; ) 13.35s user 0.75s system 72% cpu 19.502 total $ time (cat ~/.zshrc > /dev/null) (; cat ~/.zshrc > /dev/null; ) 0.00s user 0.00s system 61% cpu 0.004 total $ time (perl -pe1 ~/.zshrc > /dev/null) (; perl -pe1 ~/.zshrc > /dev/null; ) 0.00s user 0.00s system 52% cpu 0.008 total
  • 35. (by )

Editor's Notes