Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

mndrix/sweet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synopsis

:- use_module(library(sweet)).

?- (false -> throw(oops); otherwise -> writeln(ok)).
ok
true.

?- if(fail,throw(oops)), if(true,writeln(ok)).
ok
true.

?- forall(X in [1,2,3], writeln(ok)).
ok
ok
ok
true.

:- use lists -> append/{2,3}, last/2.
% same as use_module(library(lists),[append/2,append/3,last/2]).

Description

The sweet pack adds some convenient syntactic sugar to Prolog. The main goal is to reduce the amount of redundant code that one must read (and write). Some of the predicates and macros are simple aesthetic adjustments (like otherwise/0). Others, like in/2, define powerful interfaces which can be extended by library authors.

Changes in this Version

  • Support cut/0 inside if/2
  • Remove trailing choicepoint on X in [foo]

Installation

Using SWI-Prolog 6.3 or later:

?- pack_install(sweet).

This module uses semantic versioning.

Source code available and pull requests accepted at http://github.com/mndrix/sweet

@author Michael Hendricks michael@ndrix.org @license unlicense

About

Sugar to make Prolog a little sweeter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages