Crumb は最新のオープンソース プログラミング言語であり、そのリリース後、Reddit のプログラミング セクションで広範な議論を引き起こしました。
タイトルにあるように、Crumb は関数型プログラミング言語であり、「キーワード」はなく、すべてが関数です (キーワードが 0 で、すべてが関数です)。その他の機能には、ガベージ コレクション (GC)、動的型付け、簡潔な構文、および詳細な標準ライブラリの提供が含まれます。
サンプルコード
table = (map (range 10) {_ y ->
<- (map (range 10) {item x ->
<- (multiply (add x 1) (add y 1))
})
})
(loop 100 {i ->
i = (add i 1)
(if (is (remainder i 15) 0) {
(print "fizzbuzz\n")
} {
(if (is (remainder i 3) 0) {
(print "fizz\n")
} {
(if (is (remainder i 5) 0) {
(print "buzz\n")
} {
(print i "\n")
})
})
})
})
- フィボナッチ数列の実装
// use a simple recursive function to calculate the nth fibonacci number
fibonacci = {n ->
<- (if (is n 0) {<- 0} {
<- (if (is n 1) {<- 1} {
<- (add
(fibonacci (subtract n 1))
(fibonacci (subtract n 2))
)
})
})
}
(until "stop" {state n ->
(print (add n 1) "-" (fibonacci (add n 1)) "\n")
})
サンプルコードの詳細: https://github.com/liam-ilan/crumb/tree/main/examples
標準ライブラリには、 IO、比較、論理演算子、算術演算などが含まれます。