Skip to content

Commit b6251ff

Browse files
committed
[ doc ] Add contributing guides
1 parent c25d7ac commit b6251ff

File tree

2 files changed

+77
-51
lines changed

2 files changed

+77
-51
lines changed

CONTRIBUTING.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Lice contributing guides
2+
3+
Pull requests are welcomed, but please follow our code style guide below:
4+
5+
## Code style
6+
7+
### compiler
8+
9+
0. Use actual tab character instead of spaces
10+
0. Please use Java or Kotlin as a development language
11+
0. Functional collection APIs are prefered.
12+
0. Results of functions should be lazy evaluation.
13+
14+
### Lice language
15+
16+
0. Use symbols like `-\>`, `?` to represent `to`, `orNot`. It's clearer.
17+
0. Use Lisp-style function names.
18+
19+
Example:
20+
21+
```lisp
22+
; good
23+
(int->str 1)
24+
; bad
25+
(intToStr 1)
26+
27+
; good
28+
(null? ())
29+
; bad
30+
(nullOrNot ())
31+
```

README.md

+46-51
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ for a interpreted language.
2929

3030
See [FeatureTest](src/test/kotlin/org/lice/FeatureTest.kt) to learn more about the language's features.
3131

32-
# It looks like:
32+
## It looks like
3333

3434
```lisp
3535
; print a string
@@ -51,6 +51,13 @@ See [FeatureTest](src/test/kotlin/org/lice/FeatureTest.kt) to learn more about t
5151
5252
; to define a call-by-need lambda, use `lazy`.
5353
```
54+
55+
# Building
56+
57+
To use Lice with build tools, see [JitPack instruction](https://jitpack.io/#lice-lang/lice).
58+
59+
Alternatively, you can download the nightly jar for the newest commit on [AppVeyor](https://ci.appveyor.com/project/ice1000/lice/branch/master/artifacts).
60+
5461
# Script API
5562

5663
```java
@@ -65,67 +72,55 @@ public class LiceScriptEngineTest {
6572
}
6673
```
6774

68-
# Building
69-
70-
You can use `lice-lang` with Gradle by simply adding Jitpack into your repository; then add the lice-lang dependency
75+
## Lice performance
7176

72-
```groovy
73-
allprojects {
74-
repositories {
75-
// ...
76-
maven { url 'https://jitpack.io' }
77-
}
78-
}
77+
Code to run:
7978

80-
dependencies {
81-
compile 'com.github.lice-lang:lice:v3.2.0'
82-
}
79+
```lisp
80+
; loops
81+
(def loop count block (|>
82+
(-> i 0)
83+
(while (< i count) (|> (block i)
84+
(-> i (+ i 1))))))
85+
86+
; invoking the function
87+
(loop 200000 (lambda i (|>
88+
(defexpr let x y block (|>
89+
(-> x y) ; this is actually an issue of lice.
90+
(block)
91+
(undef x)))
92+
(let reimu 100 (lambda (|> x))))))
93+
94+
(print "loop count: " i)
8395
```
8496

85-
If you use Scala, you can add it to your sbt dependency, by adding the lines below:
97+
Condition|Time
98+
:---:|:---:
99+
Lice call Java using `extern`|350ms
100+
Lice call Java using Lice API|295ms
101+
Pure Java|13ms
102+
Pure Lice|897ms
103+
Java call Lice using Lice API|629ms
86104

87-
```sbtshell
88-
resolvers += "jitpack" at "https://jitpack.io"
105+
## Lice invoking Java
89106

90-
libraryDependencies += "com.github.lice-lang" % "lice" % "v3.2.0"
91-
```
92-
93-
And if you're a Clojure developer, why not try to build it with leiningen?
107+
Lice has handy APIs for interacting with Java.
94108

95-
```leiningen
96-
:repositories [["jitpack" "https://jitpack.io"]]
109+
```lisp
110+
; declare an extern function
111+
; must be a static Java function
112+
(extern "java.util.Objects" "equals")
97113
98-
:dependencies [[com.github.lice-lang/lice "v3.2.0"]]
114+
; calling the extern function
115+
(equals 1 1)
99116
```
100117

101-
# Contributing
102-
103-
Pull requests are welcomed, but please follow our code style guide below:
104-
105-
## Code style
118+
## Java invoking Lice
106119

107-
### compiler
120+
This project provides handy APIs for running Lice codes from Java.
108121

109-
0. Use actual tab character instead of spaces
110-
0. Please use Java or Kotlin as a development language
111-
0. Functional collection APIs are prefered.
112-
0. Results of functions should be lazy evaluation.
113-
114-
### Lice language
115-
116-
0. Use symbols like `-\>`, `?` to represent `to`, `orNot`. It's clearer.
117-
0. Use Lisp-style function names.
118-
119-
Example:
122+
```java
123+
System.out.println(Lice.run("(+ 1 1)")); // prints 2
120124

121-
```lisp
122-
; good
123-
(int->str 1)
124-
; bad
125-
(intToStr 1)
126-
127-
; good
128-
(null? ())
129-
; bad
130-
(nullOrNot ())
125+
System.out.println(Lice.run(new File("example.lice"))); // run codes in a file
131126
```

0 commit comments

Comments
 (0)