Skip to content

Instantly share code, notes, and snippets.

FScoward

Block or report user

Report or block FScoward

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@FScoward
FScoward / script.exs
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
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)
}
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
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",
View Luhn.scala
/**
* Created by FScoward on 15/01/18.
*/
object Luhn {
/**
* Luhn algorithm
* */
def isValid(s: String): Boolean = {
val list = doubleOddValues(toReverseIntList(s))
You can’t perform that action at this time.