@@ -11,14 +11,14 @@ Prolog-as-scalaDSL is a library providing a DSL for writing Prolog programs in s
11
11
## How to use
12
12
13
13
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
+ ```
22
22
2 . Replace `<version>` with the desired of latest version of the library.
23
23
24
24
## Demo
@@ -182,3 +182,42 @@ to specify how to convert them to term. Here's a cumbersome but explicative exam
182
182
def father (f : String , s : String ): TermConvertible = new TermConvertible :
183
183
override def toTerm : Struct = " father" (f, s)
184
184
```
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