This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Hoge = function() {} | |
Hoge.prototype = { | |
hoge: "foo", | |
fuga: [] | |
} | |
test( "hoge", function() { | |
var h1 = new Hoge() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
last' :: [a] -> a | |
last' (x:[]) = x | |
last' (x:xs) = last' xs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isPrime :: Int -> Bool | |
isPrime 1 = False | |
-- 約数リストを作成し、それが1,xのみである(それ以外の約数リストがnull)かどうかを判定して返却 | |
-- | |
-- lazy evaluation(怠惰な評価)で、最初の約数がリストに入れられた時点で | |
-- null評価されFalseを返すことを期待しているが、そうなのか? | |
-- | |
isPrime x = null [f| f<-[2..x-1], 0 == mod x f] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
primenumber :: Int -> [Int] | |
primenumber x | |
| 1 > x = error "argument 0 must be >0." | |
| 1 == x = [] | |
primenumber x = sieve [2..x] | |
where | |
s = (sqrt . fromIntegral) x | |
sieve :: [Int] -> [Int] | |
sieve (x:[]) = x : [] | |
sieve all@(x:xs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fizzbuzz xs = | |
let fb x | |
-- fb x 以下のブロックになるので、fb x よりも深いインデントが無いとエラー | |
| 0 == mod x 15 = "FizzBuzz" | |
| 0 == mod x 5 = "Buzz" | |
| 0 == mod x 3 = "Fizz" | |
| otherwise = show x | |
in [ fb x | x <- xs ] | |
fizzbuzz'' xs = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List (sort) | |
-- make histogram | |
-- | |
-- @param xs [Double] Data array | |
-- @param delta Double histogram's step width. | |
-- @param pivot Double | |
-- | |
histogram :: Double -> Double -> [Double] -> [(Double,Int)] | |
-- sortすると遅くなりそうだけど、再代入できないからこんな感じなのかな |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Data ( | |
TimeSeries(..) | |
) where | |
data TimeSeries a = TimeSeries { | |
delta :: a | |
, dataArray :: [a] | |
} deriving (Show) | |
computeDerivative :: (Floating a) => TimeSeries a -> TimeSeries a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Vector3 a = Vector3 | |
( | |
a, | |
a, | |
a | |
) deriving (Show, Eq) | |
data Matrix3 a = Matrix3 | |
( | |
(a, a, a), | |
(a, a, a), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.example.touchtest" | |
android:versionCode="1" | |
android:versionName="1.0"> | |
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> | |
<activity android:name="MainActivity" | |
android:label="@string/app_name" | |
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"> | |
<intent-filter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Bernoulli ( | |
f, | |
p, | |
c, | |
bp, | |
be, | |
bv | |
) where | |
{-- |
OlderNewer