Skip to content

Commit 84551ef

Browse files
committed
chore(website): update index
1 parent 303e2e6 commit 84551ef

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def father(f: String, s: String): TermConvertible = new TermConvertible:
188188
```scala 3
189189
object Demo extends PrologDSL:
190190
def main(args: Array[String]): Unit =
191-
// Disjunctions
191+
// Conjunctions
192192
println(&&("a", "b", "c")) // a, b, c
193193
println("a" &: "b" &: "c")
194194
println("a" and "b" and "c")

docs/src/pages/index.md

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ Prolog-as-scalaDSL is a library providing a DSL for writing Prolog programs in s
1111
## How to use
1212

1313
1. Add the following library dependency in your build file.
14-
* for sbt:
15-
```scala
16-
libraryDependencies += "io.github.kelvindev15" % "prolog-as-scaladsl_3" % "<version>"
17-
```
18-
* for gradle:
19-
```kotlin
20-
implementation("io.github.kelvindev15:prolog-as-scaladsl_3:<version>")
21-
```
14+
* for sbt:
15+
```scala
16+
libraryDependencies += "io.github.kelvindev15" % "prolog-as-scaladsl_3" % "<version>"
17+
```
18+
* for gradle:
19+
```kotlin
20+
implementation("io.github.kelvindev15:prolog-as-scaladsl_3:<version>")
21+
```
2222
2. Replace `<version>` with the desired of latest version of the library.
2323

2424
## Demo
@@ -182,3 +182,42 @@ to specify how to convert them to term. Here's a cumbersome but explicative exam
182182
def father(f: String, s: String): TermConvertible = new TermConvertible:
183183
override def toTerm: Struct = "father"(f, s)
184184
```
185+
186+
## Other features
187+
188+
### Conjunction and conjunction of goals
189+
190+
```scala 3
191+
object Demo extends PrologDSL:
192+
def main(args: Array[String]): Unit =
193+
// Conjunctions
194+
println(&&("a", "b", "c")) // a, b, c
195+
println("a" &: "b" &: "c")
196+
println("a" and "b" and "c")
197+
// Disjunctions
198+
println(||("a", "b", "c")) // a; b; c
199+
println("a" |: "b" |: "c")
200+
println("a" or "b" or "c")
201+
```
202+
203+
### Lists
204+
205+
```scala 3
206+
object Demo extends PrologDSL:
207+
def main(args: Array[String]): Unit =
208+
println(list("a", "b", "c")) // [a, b, c]
209+
println(cons("a", cons("b", cons("c", nil)))) // [a, b, c]
210+
println(cons(X, Y)) // [X, Y]
211+
println(cons(X)(Y)) // emulates [X | Y]
212+
println(head(1, 2, 3) | X) // emulates [1, 2, 3 | X]
213+
```
214+
215+
### Builtin predicates
216+
217+
Here's a list of prolog builtins available in the library:
218+
219+
`true/0`, `fail/0`, `var/1`, `nonvar/1`, `atom/1`, `number/1`, `atomic/1`, `clause/2`, `asserta/1`, `assertz/1`,
220+
`retract/1`, `member/2`, `ground/1`, `append/2`, `call/1`, `once/1`, `not/1`, `functor/3`, `arg/3`, `=../2`,
221+
`findall/3`, `op/3`, `length/2`, `[]/0`,`atom_chars/2`, `number_chars/2`, `!/0`, `repeat/0`, `call/1`, `\\+/1`,
222+
`=\1`, `==/2` (as strictEq), `op/3`, `is/2`, `+/2`, `-/2`, `*/2`, `//2`, `///2`, `mod/2`, `=:=/2`, `=\\=/2`, `</2`, `>/2`,
223+
`>=/2`, `=</2`, `@</2`, `@>/2`, `@=</2`, `@>=/2`

0 commit comments

Comments
 (0)