fnlang
所属分类:编程语言基础
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2021-01-04 14:14:43
上 传 者:
sh-1993
说明: 函数式编程语言
(A functional programming language)
文件列表:
fnlang-draft-00/ (0, 2020-12-05)
fnlang-draft-00/_examples/ (0, 2020-12-05)
fnlang-draft-00/_examples/001-hello-world.fn (25, 2020-12-05)
fnlang-draft-00/_examples/002-arithmetic.fn (23, 2020-12-05)
fnlang-draft-00/_examples/003-square.fn (69, 2020-12-05)
fnlang-draft-00/_examples/004-factorial.fn (114, 2020-12-05)
fnlang-draft-00/_examples/005-fibonacci.fn (193, 2020-12-05)
fnlang-draft-00/cmd/ (0, 2020-12-05)
fnlang-draft-00/cmd/fn/ (0, 2020-12-05)
fnlang-draft-00/cmd/fn/fn.go (497, 2020-12-05)
fnlang-draft-00/context/ (0, 2020-12-05)
fnlang-draft-00/context/context.go (5552, 2020-12-05)
fnlang-draft-00/context/context_test.go (5948, 2020-12-05)
fnlang-draft-00/context/errors.go (326, 2020-12-05)
fnlang-draft-00/context/symbol_table.go (1181, 2020-12-05)
fnlang-draft-00/context/value.go (6140, 2020-12-05)
fnlang-draft-00/error_test.go (1193, 2020-12-05)
fnlang-draft-00/eval.go (7406, 2020-12-05)
fnlang-draft-00/eval_test.go (16629, 2020-12-05)
fnlang-draft-00/stdlib/ (0, 2020-12-05)
fnlang-draft-00/stdlib/stdlib.go (9309, 2020-12-05)
# fn (WIP)
*fn* ([IPA][1]: /fn/) is a functional programming language, a dialect of Lisp
built on top of the [Go](https://golang.org) programming language.
*fn* is still in design phase.
## Early testing
Install the CLI interpreter and feed it with some examples:
```sh
go get github.com/xiam/fnlang/cmd/fn
fn < _examples/001-hello-world.fn
# Hello world!
# [[:nil]]
cat _examples/003-square.fn
# (defn square [x] (* x x))
# (square 10)
# (square 100)
fn < _examples/003-square.fn
# [[:true 100 10000 1000000]]
```
Please note that the CLI is still very rudimentary and it doesn't offer any
REPL capabilities yet:
```sh
echo '(* 34 4 2 3 5 6)' | fn
# [[24480]]
echo '(- 12 34 (+ 3 4 5))' | fn
# [[-34]]
echo '(defn foo [x] [(echo x)]) (foo "hello world!")' | fn
# [[:true ["hello world!"]]]
```
### Examples
#### Fibonacci numbers
```lisp
(defn fib [n]
(when
(= n 0) 0
(= n 1) 1
:true (+ (fib (- n 1)) (fib (- n 2)))
)
)
(fib 0)
(fib 1)
(fib 2)
(fib 3)
(fib 4)
(fib 5)
(fib 6)
```
```
[[:true 0 1 1 2 3 5 8]]
```
## Built-in types
### Atom
### Numeric
#### Integer
#### Float
### String
### List
### Expression
### Map
## License
## Functions
## Error handling
## Concurrency
This project is licensed under the terms of the **MIT License**.
> Copyright (c) 2019-present. José Nieto. All rights reserved.
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[1]: https://en.wiktionary.org/wiki/Wiktionary:International_Phonetic_Alphabet
近期下载者:
相关文件:
收藏者: