mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 07:33:57 +00:00
[lfe/en] proofread
This commit is contained in:
parent
ae280b79ec
commit
842937f79f
@ -1,21 +1,15 @@
|
|||||||
---
|
---
|
||||||
|
language: "Lisp Flavoured Erlang (LFE)"
|
||||||
language: "Lisp Flavoured Erlang(LFE)"
|
|
||||||
filename: lispflavourederlang.lfe
|
filename: lispflavourederlang.lfe
|
||||||
contributors:
|
contributors:
|
||||||
- ["Pratik Karki", "https://github.com/prertik"]
|
- ["Pratik Karki", "https://github.com/prertik"]
|
||||||
---
|
---
|
||||||
|
|
||||||
Lisp Flavoured Erlang(LFE) is a functional, concurrent, general-purpose programming
|
Lisp Flavoured Erlang (LFE) is a functional, concurrent, general-purpose programming
|
||||||
language and Lisp dialect(Lisp-2) built on top of Core Erlang and the Erlang Virtual Machine(BEAM).
|
language and Lisp dialect (Lisp-2) built on top of Core Erlang and the Erlang Virtual Machine (BEAM).
|
||||||
|
|
||||||
LFE can be obtained from [LFE](https://github.com/rvirding/lfe)
|
|
||||||
|
|
||||||
The classic starting point is [LFE DOCS.](http://docs.lfe.io)
|
|
||||||
|
|
||||||
Another new site is being built to replace it.[LFE DEV.](http://docs.lfe.io/dev)
|
|
||||||
|
|
||||||
|
|
||||||
|
LFE can be obtained from [LFE](https://github.com/rvirding/lfe).
|
||||||
|
The classic starting point is the [LFE docs](http://docs.lfe.io).
|
||||||
|
|
||||||
```lisp
|
```lisp
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@ -24,7 +18,7 @@ Another new site is being built to replace it.[LFE DEV.](http://docs.lfe.io/dev)
|
|||||||
|
|
||||||
;;; General form.
|
;;; General form.
|
||||||
|
|
||||||
;; Lisp comprises of two syntax called: the ATOM and the S-expression.
|
;; Lisp is comprised of two syntaxes, the ATOM and the S-expression.
|
||||||
;; `forms` are known as grouped S-expressions.
|
;; `forms` are known as grouped S-expressions.
|
||||||
|
|
||||||
8 ; an atom; it evaluates to itself
|
8 ; an atom; it evaluates to itself
|
||||||
@ -65,15 +59,15 @@ t ; another atom which denotes true.
|
|||||||
|
|
||||||
;;; Integers
|
;;; Integers
|
||||||
|
|
||||||
1234 -123 ; Regular decimal notation
|
1234 -123 ; Regular decimal notation
|
||||||
#b0 #b10101 ; Binary notation
|
#b0 #b10101 ; Binary notation
|
||||||
#0 #10101 ; Binary notation (alternative form)
|
#0 #10101 ; Binary notation (alternative form)
|
||||||
#o377 #o-111 ; Octal notation
|
#o377 #o-111 ; Octal notation
|
||||||
#d123456789 #d+123 ; Explicitly decimal notation
|
#d123456789 #d+123 ; Explicitly decimal notation
|
||||||
#xc0ffe 0x-01 ; Hexadecimal notation
|
#xc0ffe 0x-01 ; Hexadecimal notation
|
||||||
#2r1010 #8r377 ;Notation with explicit base (up to 36)
|
#2r1010 #8r377 ;Notation with explicit base (up to 36)
|
||||||
#\a #$ #\ä #\🐭 ;Character notation (the value is the Unicode code point of the character)
|
#\a #$ #\ä #\🐭 ;Character notation (the value is the Unicode code point of the character)
|
||||||
#\x1f42d; ;Character notation with the value in hexadecimal
|
#\x1f42d; ;Character notation with the value in hexadecimal
|
||||||
|
|
||||||
;;; Floating point numbers
|
;;; Floating point numbers
|
||||||
1.0 +2.0 -1.5 1.0e10 1.111e-10
|
1.0 +2.0 -1.5 1.0e10 1.111e-10
|
||||||
@ -91,19 +85,19 @@ t ; another atom which denotes true.
|
|||||||
|
|
||||||
;;; Character escaping
|
;;; Character escaping
|
||||||
|
|
||||||
\b ; => Backspace
|
\b ; => Backspace
|
||||||
\t ; => Tab
|
\t ; => Tab
|
||||||
\n ; => Newline
|
\n ; => Newline
|
||||||
\v ; => Vertical tab
|
\v ; => Vertical tab
|
||||||
\f ; => Form Feed
|
\f ; => Form Feed
|
||||||
\r ; => Carriage Return
|
\r ; => Carriage Return
|
||||||
\e ; => Escape
|
\e ; => Escape
|
||||||
\s ; => Space
|
\s ; => Space
|
||||||
\d ; => Delete
|
\d ; => Delete
|
||||||
|
|
||||||
;;; Binaries
|
;;; Binaries
|
||||||
;; It is used to create binaries with any contents.
|
;; It is used to create binaries with any contents.
|
||||||
#B((#"a" binary) (#"b" binary)) ; #"ab" (Evaluated form)
|
#B((#"a" binary) (#"b" binary)) ; #"ab" (Evaluated form)
|
||||||
|
|
||||||
;;; Lists are: () or (foo bar baz)
|
;;; Lists are: () or (foo bar baz)
|
||||||
|
|
||||||
@ -130,7 +124,7 @@ lfe> (list-comp
|
|||||||
;; 2. Core forms
|
;; 2. Core forms
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; These forms are same as those found at Common Lisp and Scheme.
|
;; These forms are the same as those found in Common Lisp and Scheme.
|
||||||
|
|
||||||
(quote e)
|
(quote e)
|
||||||
(cons head tail)
|
(cons head tail)
|
||||||
@ -189,7 +183,7 @@ lfe> (list-comp
|
|||||||
;; 3. Macros
|
;; 3. Macros
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; Macros are part of the language to allow you to create abstractions
|
;; Macros are part of the language and allow you to create abstractions
|
||||||
;; on top of the core language and standard library that move you closer
|
;; on top of the core language and standard library that move you closer
|
||||||
;; toward being able to directly express the things you want to express.
|
;; toward being able to directly express the things you want to express.
|
||||||
|
|
||||||
@ -263,7 +257,7 @@ lfe> (list-comp
|
|||||||
|
|
||||||
;; Guards
|
;; Guards
|
||||||
|
|
||||||
;; Whenever pattern occurs(let, case, receive, lc, etc) it can be followed by an optional
|
;; Whenever pattern occurs (let, case, receive, lc, etc) it can be followed by an optional
|
||||||
;; guard which has the form (when test ...).
|
;; guard which has the form (when test ...).
|
||||||
|
|
||||||
(progn gtest ...) ;; => Sequence of guard tests
|
(progn gtest ...) ;; => Sequence of guard tests
|
||||||
@ -437,22 +431,15 @@ apply _F/3 ( a1, a2, a3 )
|
|||||||
(io:format "Error: ~p~n" `(,reason)))
|
(io:format "Error: ~p~n" `(,reason)))
|
||||||
(`#(http #(,request-id ,result))
|
(`#(http #(,request-id ,result))
|
||||||
(io:format "Result: ~p~n" `(,result))))))
|
(io:format "Result: ~p~n" `(,result))))))
|
||||||
|
|
||||||
|
|
||||||
;; Check out Erlang's documentation for more concurrency and OTP docs.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Further Reading
|
## Further Reading
|
||||||
|
|
||||||
* [LFE DOCS](http://docs.lfe.io)
|
* [LFE DOCS](http://docs.lfe.io)
|
||||||
* [LFE GitBook](https://lfe.gitbooks.io/reference-guide/index.html)
|
* [LFE GitBook](https://lfe.gitbooks.io/reference-guide/index.html)
|
||||||
* [LFE Wiki](https://en.wikipedia.org/wiki/LFE_(programming_language))
|
* [LFE Wiki](https://en.wikipedia.org/wiki/LFE_(programming_language))
|
||||||
|
|
||||||
## Extra Info
|
## Extra Info
|
||||||
* [LFE PDF](http://www.erlang-factory.com/upload/presentations/61/Robertvirding-LispFlavouredErlang.pdf)
|
|
||||||
* [LFE mail](https://groups.google.com/d/msg/lisp-flavoured-erlang/XA5HeLbQQDk/TUHabZCHXB0J)
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
|
|
||||||
Lots of thanks to Robert Virding for creating LFE, Duncan McGreggor for documenting it and other LFE contributors who made LFE awesome.
|
|
||||||
|
|
||||||
|
* [LFE PDF](http://www.erlang-factory.com/upload/presentations/61/Robertvirding-LispFlavouredErlang.pdf)
|
||||||
|
* [LFE mail](https://groups.google.com/d/msg/lisp-flavoured-erlang/XA5HeLbQQDk/TUHabZCHXB0J)
|
||||||
|
Loading…
Reference in New Issue
Block a user