パーソナルブログメモリ

a = [1, 1]
for _ in "*" * 999: a += [sum(a[-2:])]
print(a)

Haskell 学習中

2017-12-05 | コンピュータ
難しい。トップページに端末があっていきなり学習できるのでやってみます。

Haskell Language


今後このあたりを丁寧にやっていければ、なんとかなるかも
learnyouahaskell
Documentation


Try it!
Type Haskell expressions in here.
λ help
λ 5+7
12
:: Num a => a
λ "ch"
"ch"
:: [Char]
λ [12,13,22]
[12,13,22]
:: Num t => [t]
λ sort [9,8,7]
[7,8,9]
:: (Num a, Ord a) => [a]
λ sort"kdsffnsgj"
"dffgjknss"
:: [Char]
λ (28,"take")
(28,"take")
:: Num t => (t, [Char])
λ (1,"hats",23/35)
(1,"hats",0.6571428571428571)
:: (Fractional t1, Num t) => (t, [Char], t1)
λ fst (28,"kuni")
28
:: Num a => a
λ let x = 4 in x*x
16
:: Num a => a
λ let x = 8*10 in x+x
160
:: Num a => a
λ ler x = 8*10 in x+x in x*x
<hint>:1:7: parse error on input ‘=’
λ let v =(28,"take")in fst v
28
:: Num a => a
λ let v =(28,"take")in lst v
Not in scope: ‘lst’
Perhaps you meant one of these:
‘fst’ (imported from Prelude), ‘last’ (imported from Prelude)
λ let v =(28,"take")in last v
Couldn't match expected type ‘[a]’
with actual type ‘(Integer, [Char])’
In the first argument of ‘last’, namely ‘v’
In the expression: last v
λ let v =(28,"take")in last v
Couldn't match expected type ‘[a]’
with actual type ‘(Integer, [Char])’
In the first argument of ‘last’, namely ‘v’
In the expression: last v
λ let v =(28,"take")in lst v
Not in scope: ‘lst’
Perhaps you meant one of these:
‘fst’ (imported from Prelude), ‘last’ (imported from Prelude)
λ let v =(28,"take")in fst v
28
:: Num a => a
λ ler villain = (28,"chirs") in fst vbillain
<hint>:1:13: parse error on input ‘=’
λ let villain = (28,"chirs") in fst vbillain
Not in scope: ‘vbillain’
Perhaps you meant ‘villain’ (line 1)
λ let villain = (28,"chirs") in fst villain
28
:: Num a => a
λ 'a' : []
"a"
:: [Char]
λ "a" : "b" : []==["a","b"]
True
:: Bool
λ 'a' : 'b' : []==['a','b']
True
:: Bool
λ ['a','b','c']=="ab
<hint>:1:19:
lexical error in string/character literal at end of input
λ ['a','b','c']=="ab"
False
:: Bool
λ ['a','b','c']=="abc"
True
:: Bool
λ ['a','b','c']=="abc"
True
:: Bool
λ ['a','b','c']==['a','b','c']
True
:: Bool
λ map (+1) [1..5]
[2,3,4,5,6]
:: (Enum b, Num b) => [b]
λ map (/5) [13,24,52,42]
[2.6,4.8,10.4,8.4]
:: Fractional b => [b]
λ filter (>5) [63,3,25,7,1,9]
mueval-core: Time limit exceeded
ExitFailure 1
λ (1,"George")
(1,"George")
:: Num t => (t, [Char])
λ 1 : [2,3]
[1,2,3]
:: Num a => [a]
λ let square x = x * x in square 52
2704
:: Num a => a
λ let square x = x * x in map square [1..10]
[1,4,9,16,25,36,49,64,81,100]
:: (Enum b, Num b) => [b]
λ let take5s = filter (==5) in map takes [[1,5],[5],[1,1,5],[1,1]]
Not in scope: ‘takes’
Perhaps you meant one of these:
‘take5s’ (line 1), ‘take’ (imported from Prelude)
λ let take5s = filter (==5) in map take5s [[1,5],[5],[1,1,5],[1,1]]
[[5],[5],[5],[]]
:: (Eq a, Num a) => [[a]]
λ toLower 'A'
'a'
:: Char
λ toUpper 'a'
'A'
:: Char
λ map toUpper "chris"
"CHRIS"
:: [Char]
λ let (a,b)=(10,12) in a * 2
20
:: Num a => a
λ let (a,b)=(10,12) in ba * 2
Not in scope: ‘ba’
Perhaps you meant one of these: ‘a’ (line 1), ‘b’ (line 1)
λ let (a,b)=(10,12) in b * 2
24
:: Num a => a
λ let (a,b)=(10,12) in a * 2
20
:: Num a => a
λ let (a,b)=(10,12) in a * 2
20
:: Num a => a
λ let (a,b)=("100","goo") in b * 2
No instance for (Num [Char]) arising from a use of ‘*’
In the expression: b * 2
In the expression: let (a, b) = ("100", "goo") in b * 2
λ let (a,b)=("100","goo") in b
"goo"
:: [Char]
λ let (a,b) = (10,12) in a * 2
20
:: Num a => a
λ let (a:b:c:[]) = "xyz" in a
'x'
:: Char
λ let (a:_) = "xyz" in a
'x'
:: Char
λ let (a,b)=(10,"abc") in a
10
:: Num t => t
λ let (a,b)=(10,"abc") in b[3]
Couldn't match expected type ‘[Integer] -> t’
with actual type ‘[Char]’
The function ‘b’ is applied to one argument,
but its type ‘[Char]’ has none
In the expression: b [3]
In the expression: let (a, b) = (10, "abc") in b [3]
λ let (_,(_a_)) = (10,"abc") in a
Not in scope: ‘a’
λ let (_,(_:a:_)) = (10,"abc") in a
'b'
:: Char
λ let (_,(a:_)) = (10,"abc") in a
'a'
:: Char
λ let [a,b,c] = "cat" in (c,a,a,b)
('t','c','c','a')
:: (Char, Char, Char, Char)
λ let abc@(a,b,c) = (10,20,30) in (abc,a,b,c)
((10,20,30),10,20,30)
:: (Num t, Num t1, Num t2) => ((t, t1, t2), t, t1, t2)
λ let abc@(a,b,c) = (10,20,30) in (abc,a,(b,abc),c)
((10,20,30),10,(20,(10,20,30)),30)
:: (Num t, Num t1, Num t2) => ((t, t2, t1), t, (t2, (t, t2, t1)), t1)
λ

最新の画像もっと見る

コメントを投稿

ブログ作成者から承認されるまでコメントは反映されません。