Skip to content

Instantly share code, notes, and snippets.

練習問題E

Prelude> 1 + (2 + 3)
6
Prelude> (1 + 2) + 3
6
Prelude> [1] ++ ([2] ++ [3])
[1,2,3]
Prelude> ([1] ++ [2]) ++ [3]

練習問題A

Prelude> :{
Prelude| double :: Integer -> Integer
Prelude| double x = x * 2
Prelude| :}
Prelude> map double [1, 4, 4, 3]
[2,8,8,6]
Prelude> map (double . double) [1, 4, 4, 3]
enum 真理値 {真, 偽}
enum 騎士か奇人 {騎士, 奇人}
abstract sig 命題 {真偽: one 真理値}
abstract sig 人間 {
発言: lone 命題,
種族: 騎士か奇人
} {
some 発言 => (種族 = 騎士 <=> 発言.真偽 = 真)
}
@bpk-t
bpk-t / 0_reuse_code.js
Created June 4, 2016 09:56
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Microphone Input Test</title>
</head>
<body>
<div>LevelMeter</div>
<div>

#概念 #設定 ##Editor コレ設定しないとcommitメッセージ入力するときエラーみたいなのが出る

git config --global core.editor /usr/bin/vim

##設定ファイルを直に見る

import java.util.concurrent.{ConcurrentHashMap, Callable, Executors, ExecutorService}
import scala.collection.{mutable, concurrent}
import scala.collection.JavaConverters._
object Main extends App {
val ex = Executors.newFixedThreadPool(2)
val len = 50
val m: concurrent.Map[Integer, Integer] = new ConcurrentHashMap[Integer, Integer]().asScala
m.clear()
import akka.actor._
import akka.pattern.ask
import akka.util.Timeout
import java.util.concurrent.TimeUnit
import scala.util.{Failure, Success, Random}
import scala.util.control.Breaks.{break, breakable}
import scala.concurrent.duration.Duration
import scala.concurrent.Await
object Main extends App {
headOption :: [x] -> Maybe x
headOption [] = Nothing
headOption (x:xs) = Just x
tailOption :: [x] -> Maybe [x]
tailOption [] = Nothing
tailOption (x:xs) = Just xs
fizzBuzzList :: [Int] -> [String]
fizzBuzzList = map fizzBuzz
fizzBuzz :: Int -> String
fizzBuzz v
| v `mod` 5 == 0 && v `mod` 3 == 0 = "FizzBuzz"
| v `mod` 3 == 0 = "Fizz"
| v `mod` 5 == 0 = "Buzz"
| otherwise = show v