# Please assist me with following SWI complier error?

**URL:** <https://swi-prolog.discourse.group/t/please-assist-me-with-following-swi-complier-error/4312>\
**Category:** Help!\
**Created:** [August 18, 2021, 1:47pm UTC](https://swi-prolog.discourse.group/t/please-assist-me-with-following-swi-complier-error/4312 "2021-08-18T13:47:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohamfarahani](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/rohamfarahani/32/3663_2.png) [@rohamfarahani](https://swi-prolog.discourse.group/u/rohamfarahani)\
**Post date:** [August 18, 2021, 1:47pm UTC](https://swi-prolog.discourse.group/t/please-assist-me-with-following-swi-complier-error/4312/1 "2021-08-18T13:47:35Z")

</div>

```prolog
Main :- statistics(cputime, T0),
	write('hello'),
	statistics(cputime, T1),
	T is T1 - T0.
	format ('CPU time: ~w~n', T).

```

When compile the above code the next error is occurred:

```prolog
Warning: d:/l.pl:1:
Warning: Singleton variables: [Main,T]
ERROR: d:/l.pl:1:
ERROR: Arguments are not sufficiently instantiated
ERROR: d:/l.pl:5:15: Syntax error: Operator expected

```

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [August 18, 2021, 1:56pm UTC](https://swi-prolog.discourse.group/t/please-assist-me-with-following-swi-complier-error/4312/2 "2021-08-18T13:56:13Z")

</div>

> [@rohamfarahani](#):
>
> `Main :- statistics(cputime, T0)`

In Prolog words that start with upper case letters are variables. So instead of `Main` use `main`.

* * *

For

```prolog
T is T1 - T0.

```

The period `.` at the end of the line ends the predicate. You don’t want to end the predicate on that line so use `,` instead.

```prolog
T is T1 - T0,

```

* * *

For

```prolog
format ('CPU time: ~w~n', T).

```

you have a space between `format` and `(`. You need

```prolog
format('CPU time: ~w~n', T).

```

* * *

Here is a working version

File: `example.pl`

```prolog
main :-
    statistics(cputime, T0),
	write('hello'),
	statistics(cputime, T1),
	T is T1 - T0,
	format('CPU time: ~w~n', T).

```

Example run

```prolog
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.28-20-g6f8a68f2b)
...

?- working_directory(_,'C:/Users/Groot').
true.

?- [example].
true.

?- main.
helloCPU time: 0.0
true.

```

---

<div class="post-metadata">

**Author:** ![rohamfarahani](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/rohamfarahani/32/3663_2.png) [@rohamfarahani](https://swi-prolog.discourse.group/u/rohamfarahani)\
**Post date:** [August 18, 2021, 4:50pm UTC](https://swi-prolog.discourse.group/t/please-assist-me-with-following-swi-complier-error/4312/3 "2021-08-18T16:50:18Z")

</div>

> [@EricGT](#):
>
> `working_directory(_,'C:/Users/Groot')`

Thank you very much for all you doing and i want all the best for you, I am beginner in pro log and excuse me if i have some simple questions, Please help me again in following code if it is possible:

* * *

I have 5000 facts same as

```prolog
decision(admin,married,highschool,no,58,no,no)

```

if i want use a user predicate (decision) in the following code, What can I do? also my questions from rule-set are done with decision predicate and input variables in decision(X1,X1,)  
Thank you

```prolog
main :- statistics(cputime, T0),
	decision(X1,X2,X3,X4,X5,X6,Y), 
	statistics(cputime, T1),
	T is T1 - T0,
	format('CPU time: ~w~n', T).

```

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [August 18, 2021, 4:59pm UTC](https://swi-prolog.discourse.group/t/please-assist-me-with-following-swi-complier-error/4312/4 "2021-08-18T16:59:17Z")

</div>

> [@rohamfarahani](#):
>
> What can I do?

Since your questions and errors indicate that you are very very new to Prolog you need to learn the basics. I and many here do not have the time to teach you Prolog.

My suggestion would be that you start off with [Learn Prolog Now!](http://www.let.rug.nl/bos/lpn//index.php) and then progress through the [classic Prolog books](https://swi-prolog.discourse.group/t/useful-prolog-references/1089#classics-8).

---

<div class="post-metadata">

**Author:** ![rohamfarahani](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/rohamfarahani/32/3663_2.png) [@rohamfarahani](https://swi-prolog.discourse.group/u/rohamfarahani)\
**Post date:** [August 18, 2021, 5:36pm UTC](https://swi-prolog.discourse.group/t/please-assist-me-with-following-swi-complier-error/4312/5 "2021-08-18T17:36:05Z")

</div>

Thank you for your consideration
