scala
ä¸æºå å§ãã« /path/to/hello-world/project/build.scala ã次ã®ããã«ä¿®æ£ããã // ..snip.. object AndroidBuild extends Build { lazy val main = Project ( "Hello World", file("."), settings = General.fullAndroidSettings ++ AndroidNdk.settingsâ¦
æ¯åãAlertDialog ãä½ãã®ã¯é¢åãªã®ã§ã次ã®ãããªãªãã¸ã§ã¯ããä½ã£ã¦ããã package com.github.cooldaemon.HelloWorld import _root_.android.content.Context import _root_.android.app.{Dialog, AlertDialog => AAlertDialog} import _root_.androâ¦
Scalaã§Androidã¢ããªä½ææãAsyncTaskã®å¯å¤é·å¼æ°ã¡ã½ããã使ããªããã¨ã¸ã®å¯¾çã¨ãµã³ãã« â Gist ã丸ãã¯ãªãScala ã¯ãå¯å¤é·å¼æ°ãæã¤ã¡ã½ãããä¸æ¸ãã§ããªãã®ã§ãå¯å¤é·å¼æ°ãä¸æ¸ãæ¸ã¿ã® /path/to/hello-world/src/main/java/com/github/cooâ¦
ãã°ãåºåããéããã°åºåä½ç½®ã®æ å ±ãä¸ç·ã«åºåããã package com.github.cooldaemon.HelloWorld import _root_.android.util.{Log => ALog} object Log { val TAG = "HelloWorld" def e(m: String) = printlog(ALog.e, m) def w(m: String) = printlogâ¦
ActionBar ã¯ä½¿ãããããã©ãã¿ã¼ã²ããã® API Level ãä½ãå ´åã«éå®ãã ActionBarSherlock ã Scala ãã使ãã sbt ããã¸ã§ã¯ãè¨å® ã¾ãã¯ä¾åããã©ã¤ãã©ãªãæå®ãããæºåç·¨ãåèã«ä½æãããã£ã¬ã¯ã㪠/path/to/hello-world ã®ç´ä¸ã« main.sbâ¦
Toast 表示ä¸ã« Toast ã表示ããã¨åé¡ãããããã*1ã®ã§ã次ã®ãããªã©ããã¼ãªãã¸ã§ã¯ããç¨æããã package ã¯ãæºåç·¨ã§ç¨æãããã®ã package com.github.cooldaemon.HelloWorld import _root_.android.content.Context import _root_.android.widâ¦
åå¿ã¨ããåã®å¼ãç¶ãçãªã¢ã¬ãMac OSX 10.7 ä¸ã§éçºããäºãåæã¨ããã sbt ã®æºå ãã®è¾ºããè¦ãªãã sbt-launch.jar ããã¦ã³ãã¼ããã/usr/local/bin é ä¸ã« sbt-launch-0.11.3.jar ã¨ããååã§ä¿åããã ãã®ã¾ã¾ã ã¨ä½¿ãé£ãã®ã§ãä¸è¨ã® Shâ¦
ã¨ãããã使ãæ¹ã ãã¡ã¢ package com.github.cooldaemon.scalaz_test import scalaz._ object TryIteratee { import Scalaz._ import IterV._ def run { implicit val ListEnum = new Enumerator[Seq] { def apply[E, A](e: Seq[E], i: IterV[E, A]): Iterâ¦
ãã®è¨äºã¯ãScala Advent Calendar JP 2011 ã®14æ¥ç®ã§ããç¡çãè¨ã£ã¦ãäºæ¥éãæ ãé ãã¦ãã¾ãã¾ãããä»åã¯ãScalaz 6.0.3 ã® concurrent ã«ã¤ãã¦è§£èª¬ãè¡ãã¾ããå人çã«ã¯ Scalaz.concurrent ã®ä¸»å½¹ã¯ Promise ã ã¨æã£ã¦ããã®ã§ãæ©éããã®è§£â¦
ãã®è¨äºã¯ãScala Advent Calendar JP 2011 ã®13æ¥ç®ã§ããä»åã¯ãScala STM 0.4 ããå°å ¥ããã CommitBarrier ã®è§£èª¬ãè¡ãã¾ãã CommitBarrier ã®åºæ¬ ã¾ãã¯ãä¸è¨ã®ã³ã¼ããã覧ãã ããã import org.scalatest.fixture.FixtureFunSuite import scaâ¦
ååã¡ã¢ãå¿ãã¦ãã Either ã®å°ãã¿ãç´¹ä»ã ä¾ã®å¦ã scalaz ã® import ã¯å¿ é ã import scalaz._ import Scalaz._ Either ãåå¾ããå¾ãæ®éã¯ãå¦çã®åå²ãä¸è¨ã®ããã«è¨è¿°ããã 1.right[String] match { case Right(n :Int) => n + 1 case Left(sâ¦
ä¸è¨ã§åãä¸ãããã¦ãããã¿ã«ã¤ãã¦ã¡ã¢ãæ®ãã Scala ã® Either ã«ã¤ãã¦ã®èå¯ - scalaã¨ãã»ã»ã» Scalaåå¼·ä¼ç¬¬53å (EitherãScalazã®Validationã«ã¤ãã¦) - Togetter Either 㨠Scalaz Either 㯠flatMap ã¡ã½ãããæããªãã®ã§ for å¼ã§ã¯ä½¿ããªâ¦
scalaz ã® ExampleState ã« StateT ã®ãµã³ãã«ãç¡ãã£ãã®ã§è©¦ãã¦ã¿ãã æ°ãåãããããããã State ã¢ããã£ã¦ä½ãï¼ã¨ããæãã説ææ¸ãããã package com.github.cooldaemon.try_scalaz import scalaz._ object TryState { import Scalaz._ def ruâ¦
STM ã®åä½ç¢ºèªã®ãããä¸è¨ã®ãããªã³ã¼ããæ¸ããã®ã§ããâ¦*1 import org.scalatest.fixture.FixtureFlatSpec import org.scalatest.matchers.ShouldMatchers import scala.concurrent.stm._ class RefSpec extends FixtureFlatSpec with ShouldMatchers {â¦
Scala for = Haskell do (Java ã®ä¾å¤ã Either ã§å ãã å¾ã®è©±ã) ãå°ã好è©ã ã£ãã®ã§ã調åã«ä¹ã£ã¦ã¡ãããã¿ã for æ§æã使ã㨠match case ã®ãã¹ããé¿ããããããã©ãããã¼ãä¸è¨ã®ããã«æ¸ããã®ãã¨è¨ãã¨â¦ for { a <- Some(1) b <- Right(2).â¦
æè¿ããã£ãã㨠RabbitMQ Java Client ã® Scala Wrapper ãæ¸ãã¦ãã¾ãã Scala ãã Java ã®ã©ã¤ãã©ãªã使ãå ´åãä¾å¤å¦çã®æ±ãã«å°ãã®ã§ãããå½ç¶ãRabbitMQ Java Client ãä¾å¤æãã¾ããã§ãã ãã㧠scala.util.control.Exception.allCatch ãâ¦
ãã®1ããã®2ããã®3 ã«å¼ãç¶ããä»å㯠reply ãä¸è¦ãªãã¿ã¼ã³*1ã§è©¦ãã¦ã¿ã¾ããã import scala.concurrent.stm._ import scala.actors.{Actor, Exit} import scala.actors.Actor.actor import scala.actors.Actor.State.{New, Terminated} import Systâ¦
åå¼·ä¼ç¬¬20å - Scalaåå¼·ä¼ in æ¸è°·ã§ä¹ ãã¶ãã«çºè¡¨ããã®ã§ä¸æºåãªã©ã ã¡ãã£ã¨ã¤ãã¤ãã¨ææãã³ã¼ãã§ãã⦠runTest ã¡ã½ããã ã注ç®ãã¦ä¸ãããswitch ã¡ã½ãããè©ä¾¡ãã度㫠Actor ãåãæ¿ããã¾ãã object Trampoline { import scala.actorsâ¦
ä¸è¨ã¯ããã¾ãå¬ãããªããRemote Actor éã§ãã©ã³ããªã³ããæ¹æ³ãèãä¸ããã¼ããreset 㨠shift 以å¤ã®å¶å¾¡æ§é ã欲ããã¨æãã®ã¯ç§ã ãï¼ object RemoteTest { import scala.actors.{Actor, AbstractActor} import scala.actors.Actor.actor import â¦
çªã£è¾¼ã¿å¤§æè¿ã§ããã¨ãããå©ãã¦ãã ãããç°å¢ã¯ãMac OS 10.6.5, Scala 2.8.1.final, Java 1.6.0_22 ã¨ãªãã¾ãã æ¤è¨¼ç¨ã®ã³ã¼ãã¯ãScala STM ã試ãã¦ã¿ã ãã®3 ã§ä½¿ã£ãã³ã¼ãã®ä¿®æ£çã®ãã¡ãã¨ãªãã¾ããSTM ã¨å¯¾æ¯ããããã« Actor ã®ã¿ãç¨ãâ¦
åã åãååã«å¼ãç¶ã ScalaSTM ã試ãã¦ã¿ã¾ããã çµè«ããè¨ãã¨ãç§ã®ç°å¢ã§ã¯ Worker ã®æ°ã 300 ãè¶ ãã辺ããããã«ã¦ã³ã¿ç¨ã® Actor ã¸ã®åãåãããã¿ã¤ã ã¢ã¦ããã¾ããã®ã§ãActor + STM ã®æ¹ãè¯å¥½ãªçµæãå¾ããã¾ããã ä»åãã¹ãã«ä½¿ç¨â¦
ååã«å¼ãç¶ã ScalaSTM ã試ãã¦ã¿ã¾ããã object SampleForSTM2 { import scala.concurrent.stm._ import scala.util.control.Exception.allCatch def main (args: Array[String]) { doTest( "case5" -> case5, "case6" -> case6 ) } def doTest(testCasâ¦
ScalaSTM ã試ãã¦ã¿ã¾ãããæ£ç´ãã©ã¤ãã©ãªå ã§ã©ã®ããã« STM ãå®ç¾ãã¦ãããç解ãã¦ãã¾ããããã¨ããããããªã³ããããã¯ãã¦ã¿ã¾ããã æºå é¢åãªã®ã§ sbt, maven å ±ã«ä½¿ãã¾ããã§ããã % curl -O http://scala-tools.org/repo-releases/orgâ¦
ãã®è¨äºã¯ Scala Advent Calendar JP 2010 22 æ¥ç®(12/28)ã§ãã Scala Actor + NIO 㧠Echo server ãæ¸ãã¦ã¿ã¾ããã æ¯åº¦ã®äºã§ãããçªã£è¾¼ã¿æ·»å大æè¿ã§ãã Source 解ãæ¹ç¨ã®èª¬æãããã£ã¨è¡ãã¨ãActor 㯠Thread Pool ã¨ãã¦å©ç¨ãã¦ãããNIO â¦
Loan pattern in cps - hano - GitHub Perl ã® Coro ã«æ £ãã¦ããã¨ãScala ã®éå®ç¶ç¶ã¯ä½¿ãé£ããªã¼ã¨æã£ã¦ããããèªèãè¦ãããã®ã§ã¡ã¢ãç§ã®ç解ä¸è¶³ã§ããã¨ã 以ä¸ã«ç°¡åãªãµã³ãã«ãç¨æãã¾ããã object Sample { import scala.util.continuatiâ¦
以åãScala 㧠XML ã Parse ãã(æ·»åå¸æ) ã¨ããè¨äºãæ¸ããã¨ããããããããäºã« Scala 㧠XML ã Parse ãã ( DSL ç·¨ ) - å½éåå å·é«æ¶ä¸ ã¨ãããã©ãã¯ããã¯ãé ããã®ã§ãåã³åãã§æèªããã¦é ããã ããããæ®å¿µãªããç§ã®ã¹ãã«ã§ã¯ãâ¦
Twitter 㧠FSM ã Actor ç¡ãã§â¦ã¿ãããªè©±ããåºã¦ããã®ã§ãã£ã¦ã¿ã¾ããã çªã£è¾¼ã¿æ·»å大æè¿ã§ãã main ã®ä¸ã® zip ãä½åã ã£ããList(FSM(GetState) -> State1, FSM(ToState2) -> State2, ...) ã®æ¹ãèªã¿ãããã object Test { def main (args: Aâ¦
Scala 㧠簡æç㪠httpd ãä½ããªããã¨èª¿ã¹ã¦ããããJava ã« HttpServer ã¨ãã便å©ãªã¯ã©ã¹ããã£ãã handler ã¯ãActor ä¸ã§ä½¿ãããã®ã§ Executor ãç¶æ¿ãã ActorExecutor ã¨ããã®ãä½ã£ã¦ã¿ãã import java.net.InetSocketAddress import java.uâ¦
Scala ã§å¸¸é§ãã Daemon ãä½ãç¨éããããfsc ã使ã£ã¦ããæ¹æ³ããã¯ã£ãã®ã§ã¡ã¢ãæ®ããä¾ã«ãã£ã¦æ·»åã¯ç±ç大æè¿ã§ãã ããã£ã¨æ¦è¦ã説æãã㨠ProcessBuilder çµç±ã§å¥ã® Java VM ãèµ·åãããã£ã㨠exit ãã¦ãã¾ãã° Daemonize å®äºã¨ãªããâ¦
Scala ã使ãå§ã㦠Java æå*1ã«è¾æãã¦ããæ¹ã¯çµ¶å¯¾ã«ä½¿ã£ãæ¹ãè¯ã Play framework ã® Tutorial ãè¡ã£ã¦ã¿ãã®ã§ããã®ã¡ã¢ãæ®ããPlay framework ã¯ã1.1 ã® beta version ãã¤ã³ã¹ãã¼ã«æ¸ã¿ã§ããã¨ä»®å®ããã Tutorial ãå§ããåã®ä¸æºå Play â¦