Skip to content

Commit 303e2e6

Browse files
committed
chore(website): update readme
1 parent 7f397de commit 303e2e6

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

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

0 commit comments

Comments
 (0)