# B-Prolog 7.4

Version of implementation B-Prolog of programming language Prolog

A version of B-Prolog, released on March 9, 2010.

Changes:

• Support foreach/2-n and list comprehensions.
• Array subscript notation for lists and structures in arithmetic expressions, arithmetic constraints, and calls to @=/2.
• The two atoms, minint and maxint, can be used as integers in arithmetic expressions.
• Improvements in the garbage collection policy.
• A bug fix in the LP/MIP interface.
• New Prolog flags: contiguous_warning and stratified_warning
• New syntax for matching clauses: A determinate matching clause takes the form ‘H,G => B’ and a nondeterminate matching clause takes the form ‘H,G ?=> B’.

## Examples:

### Quadratic equation - Prolog (241):

This is an ISO Prolog example, using standard read/1 predicate for reading input. Note that when using read/1, you have to put full stop . after each value you input.

``````q :- write('A = '),
(   A = 0, write('Not a quadratic equation');
write('B = '),
write('C = '),
D is B*B-4*A*C,
(   D = 0, write('x = '), X is -B/2/A, write(X);
D > 0, write('x1 = '), X1 is (-B+sqrt(D))/2/A, write(X1), nl, write('x2 = '), X2 is (-B-sqrt(D))/2/A, write(X2);
R is -B/2/A, I is abs(sqrt(-D)/2/A),
write('x1 = ('), write(R), write(', '), write(I), write(')'), nl,
write('x1 = ('), write(R), write(', -'), write(I), write(')')
)
).
``````