Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "sweet"

Title:Sugar to make Prolog a little sweeter
Rating:Not rated. Create the first rating!
Latest version:0.1.1
SHA1 sum:7430a98fec98bb4a30c30aea8b00fd49645587e1
Author:Michael Hendricks <michael@ndrix.org>
Maintainer:Michael Hendricks <michael@ndrix.org>
Packager:Michael Hendricks <michael@ndrix.org>
Home page:http://packs.ndrix.com/sweet/index.html
Download URL:http://packs.ndrix.com/sweet/sweet-0.1.1.tgz
Requires:lambda

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.0.1e935cd147e1d903d02c29358a93cd38133db2c3b1http://packs.ndrix.com/sweet/sweet-0.0.1.tgz
0.0.391439fd775c4dfe1f94e4c71160b33192f5189f41http://packs.ndrix.com/sweet/sweet-0.0.3.tgz
0.1.09393c84988801fa83844b8bed813f8f421d0a8b83http://packs.ndrix.com/sweet/sweet-0.1.0.tgz
0.1.17430a98fec98bb4a30c30aea8b00fd49645587e173http://packs.ndrix.com/sweet/sweet-0.1.1.tgz

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

Contents of pack "sweet"

Pack contains 10 files holding a total of 15.8K bytes.