Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/henoc/scalaapp
Stone言語のScalaによる変形版
https://github.com/henoc/scalaapp
Last synced: about 1 month ago
JSON representation
Stone言語のScalaによる変形版
- Host: GitHub
- URL: https://github.com/henoc/scalaapp
- Owner: henoc
- Created: 2015-04-23T07:55:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-31T09:01:20.000Z (over 9 years ago)
- Last Synced: 2023-03-01T12:41:57.175Z (almost 2 years ago)
- Language: Scala
- Size: 227 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README
Stone言語の変形版
自分の学習用## 例文
### フィボナッチ数列
let fib n = {
if (n == 0) {
0
} else {
if (n == 1) {
1
} else {
(fib (n - 1)) + (fib (n - 2))
}
}
}
fib 10
### unless構文(マクロ)
let macro unless cond thenBlock = {
if (cond == 0) thenBlock
}
### 独自の変数定義構文(マクロ)
let macro def symbol literal = {
let symbol = literal
}
### for構文(マクロ)
let macro for init cond each body = [
init
while (cond) {
body
each
}
]
#### 使用例
for {let i = 0} (i < 10) (i <- i + 1) {
println i
}
### HSP風のrepeat構文(アナフォリックマクロ)
let macro repeat bound body = [
let cnt = 0
while (cnt < bound) {
body
cnt <- cnt + 1
}
]