mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-15 05:44:58 +00:00
Estimated hours taken: 1 Branches: main, release Add some synonyms for various functions in the string module and make some more general cleanups to parts of the standard library. library/array.m: s/applys/applies/ library/list.m: Position descriptive comments according to our coding standard. Fix a cut and paste error. list.foldl6 has six accumulators not five. library/parser.m: library/pqueue.m: library/set_bbbtree.m: library/set_ctree234.m: Fix minor formatting problems and spelling mistakes. library/string.m: Add functions string.from_int/1, string.from_char/1 and string.from_float/1 as synonyms for string.int_to_string/1 etc. library/version_types.m: s/incurrs/incurs/
46 lines
2.0 KiB
Mathematica
46 lines
2.0 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 2004-2005 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU Library General
|
|
% Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
|
|
%-----------------------------------------------------------------------------%
|
|
% version_types.m
|
|
% Ralph Becket <rafe@cs.mu.oz.au>
|
|
% Fri Jul 9 15:31:16 EST 2004
|
|
%
|
|
% (This module only provides documentation describing general properties
|
|
% of version types.)
|
|
%
|
|
% Version types are efficient pure implementations of typically imperative
|
|
% structures, subject to the following caveat: efficient access is only
|
|
% guaranteed for the "latest" version of a given structure. An older version
|
|
% incurs an access cost proportional to the number of its descendants.
|
|
%
|
|
% For example, if A0 is a version array, and A1 is created by updating A0,
|
|
% and A2 is created by updating A1, ..., and An is created by updating An-1,
|
|
% then accesses to An cost O(1) (assuming no further versions of the array
|
|
% have been created from An), but accesses to A0 cost O(n).
|
|
%
|
|
% Most of these data structures come with impure, unsafe means to "rewind"
|
|
% to an earlier version, restoring that version's O(1) access times, but
|
|
% leaving later versions undefined (i.e. only do this if you are discarding
|
|
% all later versions of the structure.)
|
|
%
|
|
% The motivation for using version types is that they are ordinary ground
|
|
% structures and do not depend upon uniqueness, while in many circumstances
|
|
% offering similar levels of performance.
|
|
%
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module version_types.
|
|
|
|
:- interface.
|
|
|
|
% This is just to stop the compiler complaining about this module
|
|
% not defining anything.
|
|
%
|
|
:- type prevent_warning_about_empty_interface ---> dummy.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
%-----------------------------------------------------------------------------%
|