コンテンツにスキップ

Miranda

出典: フリー百科事典『ウィキペディア(Wikipedia)』
Miranda
パラダイム 関数型宣言型
登場時期 1985年
設計者 David Turner
開発者 Research Software Ltd
最新リリース 2.066 / 2020年1月31日[1]
型付け 強い静的型付け
主な処理系 Miranda
影響を受けた言語 KRCMLSASL
影響を与えた言語 Haskell
テンプレートを表示

MirandaDavid TurnerSASLKRCMLHopeResearch Software Ltd.

MirandaAPL

1985UnixCHaskellMiranda

[]


Miranda 



||  > 

Miranda  charnumbool  char num 2使使


this_employee = ("Folland, Mary", 10560, False, 35)


week_days = ["Mon","Tue","Wed","Thur","Fri"]

 ++ -- : # !使
days = week_days ++ ["Sat","Sun"]
days = "Nil":days
days!0
 → "Nil"
days = days -- ["Nil"]
#days
 → 7

.. 1
fac n   = product [1..n]
odd_sum = sum [1,3..100]

ZF[2]2
squares = [ n * n | n <- [1..] ]

nn1
powers_of_2 = [ n | n <- 1, 2*n .. ]

2Miranda  [1..] 

HaskellMiranda// 使 diagonalising list comprehensions[1..] 2[(1, 1), (1, 2), (2, 1), (1, 3), (2, 2), (3, 1), ..] 辿辿[(x, y) // x <- [1..]; y <- [1..]] [3]

 sin x 

Miranda 1: 
add a b = a + b
increment = add 1

increment 1add 4 7 2 add  74

2 add $add  + 使2
increment = (+) 1

1
half = (/ 2)
reciprocal = (1 /)

21

Miranda 使char, num, bool anything 
rev [] = []
rev (a:x) = rev x ++ [a]


rev :: [*] -> [*]


[]


 Miranda 
subsets []     = [[]]
subsets (x:xs) = [[x] ++ y | y <- ys] ++ ys
where ys = subsets xs

 primes 
> || The infinite list of all prime numbers, by the sieve of Eratosthenes.

The list of potential prime numbers starts as all integers from 2 onwards;
as each prime is returned, all the following numbers that can exactly be
divided by it are filtered out of the list of candidates.

> primes = sieve [2..]
> sieve (p:x) = p : sieve [n | n <- x; n mod p ~= 0]

[編集]

  1. ^ 出典URL: https://www.cs.kent.ac.uk/people/staff/dat/miranda/downloads/, 閲覧日: 2024年5月17日, 題名: Miranda download page
  2. ^ ZFはツェルメロ・フレンケルの意
  3. ^ https://www.cs.kent.ac.uk/people/staff/dat/miranda/manual/13/3.html

外部リンク[編集]