{{ message }}

Instantly share code, notes, and snippets.

# FScoward

Created Dec 11, 2017
Elixirにおけるwithの挙動
View script.exs
 defmodule Etc do def hello do IO.puts "Hello" end def return_ok do {:ok, "ok"} end
Created Mar 28, 2015
View excercise2.4_2.5.scala
 def uncurry[A, B, C](f: A => B => C): (A, B) => C = { // (A, B) => C なので、まずは (a, b) を受ける // a, b を受けたら C を返せば良い。 // Cを返すためには 引数として受け取っている f に適用すれば良い // f: A => B => C なので f(a, b) とすることは出来ないため // f(a)(b)の部分適用とする // f(a)(b) は C を返す (a, b) => f(a)(b) }
Created Mar 23, 2015
View exercise2.1.scala
 object Main extends App { // your code goes here def fib(n: Int): Int = { @annotation.tailrec def loop(count: Int, pp: Int, p: Int): Int = { // println(s"n: \$n, count: \$count, pp: \$pp, p: \$p") if(count < n - 2) { loop(count + 1, p, p + pp) } else { pp + p
Created Jan 21, 2015
View packetcapture.scala
 /* sbt */ name := "packetCapture" version := "1.0" scalaVersion := "2.11.4" libraryDependencies ++= Seq( "org.pcap4j" % "pcap4j-core" % "1.3.0", "org.pcap4j" % "pcap4j-packetfactory-static" % "1.3.0",
Created Jan 18, 2015
View Luhn.scala
 /** * Created by FScoward on 15/01/18. */ object Luhn { /** * Luhn algorithm * */ def isValid(s: String): Boolean = { val list = doubleOddValues(toReverseIntList(s))