Skip to content

Commit

Permalink
Project revamp
Browse files Browse the repository at this point in the history
- `ArithmeticObject` is now a subclass of Magnitude
- Introduce `ArithmeticFormula` as an abstract class for formulas modeling calculations and two new sub classes: `Summation` and `SequenceProduct`
- Introduce `IntegerAsSuperscriptFormatter`
- Introduce `DiscreteInterval` to model an interval that can work with any arithmetic object as its boundaries and step
- Improve quantitative analysis and align the project with the ISO 80000 standard:
	- Add support for physical dimensions and units defined in the standard system of units
	- Add support for information units (bit related) and angle units also
- Add support for common units in the US Customary Units system
- Improve documentation
- Add localization messages in English and Spanish for error texts and standard unit names
- Add Pharo 12 to the build matrix

## Breaking changes
- Remove `Measure` in favor of `Quantity`
- Remove `MeasureBag` and friends
- The `UnitBehavior` hierarchy changed its implementation; now is no longer required to create new sub classes for the quantitative analysis, `UnitOfAccount` is usable with other object as its reference.
- Remove `Evaluation` and friends in favor of `ArithmeticFormula`
- Remove several exceptions in favor of `ArithmeticError`
- Remove `CircularReadStream`
- Remove `InfinityClass` and friends, and infinity intervals because they cannot be enumerated so the only method non failing for these cases was `includes:`
- Remove Pharo 8 support
  • Loading branch information
gcotelli committed Jan 1, 2025
1 parent 2b93c24 commit fd7ef50
Show file tree
Hide file tree
Showing 176 changed files with 8,053 additions and 14,756 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/loading-groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
fail-fast: false
matrix:
smalltalk:
- Pharo64-8.0
- Pharo64-9.0
- Pharo64-10
- Pharo64-11
- Pharo64-12
load-spec:
- development
- deployment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
strategy:
matrix:
smalltalk:
- Pharo64-8.0
- Pharo64-9.0
- Pharo64-10
- Pharo64-11
- Pharo64-12
name: ${{ matrix.smalltalk }}
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion .project
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
'srcDirectory' : 'source'
'srcDirectory' : 'source',
'tags': [ 'Buenos Aires Smalltalk' ]
}
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Logo](assets/logo.svg)

This model represents measures as first class objects, that is, an object that
This model represents quantities as first class objects, that is, an object that
encapsulates a number with its unit.

[![Unit Tests](https://github.com/ba-st/Aconcagua/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/ba-st/Aconcagua/actions/workflows/unit-tests.yml/badge.svg)
Expand All @@ -11,10 +11,10 @@ encapsulates a number with its unit.
[![Markdown Lint](https://github.com/ba-st/Aconcagua/actions/workflows/markdown-lint.yml/badge.svg)](https://github.com/ba-st/Aconcagua/actions/workflows/markdown-lint.yml)

[![GitHub release](https://img.shields.io/github/release/ba-st/Aconcagua.svg)](https://github.com/ba-st/Aconcagua/releases/latest)
[![Pharo 8.0](https://img.shields.io/badge/Pharo-8.0-informational)](https://pharo.org)
[![Pharo 9.0](https://img.shields.io/badge/Pharo-9.0-informational)](https://pharo.org)
[![Pharo 10](https://img.shields.io/badge/Pharo-10-informational)](https://pharo.org)
[![Pharo 11](https://img.shields.io/badge/Pharo-11-informational)](https://pharo.org)
[![Pharo 12](https://img.shields.io/badge/Pharo-12-informational)](https://pharo.org)

[![GS64 3.7.0](https://img.shields.io/badge/GS64-3.7.0-informational)](https://gemtalksystems.com/products/gs64/)
[![GS64 3.7.1](https://img.shields.io/badge/GS64-3.7.1-informational)](https://gemtalksystems.com/products/gs64/)
Expand All @@ -23,30 +23,34 @@ encapsulates a number with its unit.
> mountain in both the southern and western hemispheres. It is located in the
> Andes, in the Mendoza Province, Argentina.*
This representation allows the programmer to use measures in arithmetic
This representation allows the programmer to use quantities in arithmetic
expressions as if they were numbers, but with the advantage of providing
explicit information to the system, specifically, the measures units.
explicit information to the system, specifically, the units.
See [Arithmetic with measurements on dynamically-typed object-oriented languages](http://dl.acm.org/citation.cfm?id=1094964)
or [download the article PDF](http://stephane.ducasse.free.fr/Teaching/CoursAnnecy/0506-M1-COO/aconcagua-p292-wilkinson.pdf)
for more about this.
for more about the original design of the project.

## Quick links

- [**Explore the docs**](docs/)
- [Report a defect](https://github.com/ba-st/Aconcagua/issues/new?labels=Type%3A+Defect)
- [Request a feature](https://github.com/ba-st/Aconcagua/issues/new?labels=Type%3A+Feature)

## Features

- Arithmetic Objects and Formulas: Summation and Product
- Discrete Intervals
- Integer superscript formatting
- Quantitative analysis
- Units and dimensions in the International System of Units
- US Customary Units support
- Units of account

## License

- The code is licensed under [MIT](LICENSE).
- The documentation is licensed under [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/).

## Quick Start

- Download the latest [Pharo 32](https://get.pharo.org/) or [64 bits VM](https://get.pharo.org/64/).
- Download a ready to use image from the [release page](https://github.com/ba-st/Aconcagua/releases/latest)
- Explore the [documentation](docs/)

## Installation

To load the project in a Pharo image, or declare it as a dependency of your own
Expand Down
58 changes: 0 additions & 58 deletions docs/Installation.md

This file was deleted.

35 changes: 35 additions & 0 deletions docs/how-to/how-to-load-in-pharo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# How to load Aconcagua in a Pharo image

## Using Metacello

1. Download a [Pharo VM and image](https://pharo.org/download)
2. Open your Pharo image
3. Open a Playground
4. Evaluate:

```smalltalk
Metacello new
baseline: 'Aconcagua';
repository: 'github://ba-st/Aconcagua:release-candidate';
load: 'Development'.
```
> Change `release-candidate` to some released version if you want a pinned version
## Using Iceberg
1. Download [pharo VM and image](https://pharo.org/download)
2. Open your Pharo image
3. Open Iceberg
4. Click the *Add* repository button
5. Select *Clone from github.com* and enter `ba-st` as owner name and `Aconcagua`
as project name
6. Click *Ok*
7. Select the repository in the main Iceberg window
8. Open the contextual menu and select
*Metacello → Install baseline of Aconcagua ...*
9. Type `Development` and click *Ok*
> After Iceberg cloned a repository, it will be checked-out at the default
> branch (in this case `release-candidate`). If you want to work on a different
> branch or commit, perform the checkout before the baseline installation step.
42 changes: 42 additions & 0 deletions docs/how-to/how-to-use-as-dependency-in-pharo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# How to use Aconcagua as dependency in a Pharo product

In order to include **Aconcagua** as part of your project, you should reference
the package in your product baseline:

1. Define the Aconcagua repository and version to be used, and the [baseline groups](../reference/Baseline-groups.md)
you want to depend on (usually it will be `Deployment`).

If you're unsure on what to depend use the *Dependency Analyzer*
tool to choose an appropriate group including the packages you need.

2. Create a method like this one in the baseline class of your product:

```smalltalk
setUpDependencies: spec
spec
baseline: 'Aconcagua'
with: [ spec repository: 'github://github://ba-st/Aconcagua:v{XX}' ];
project: 'Aconcagua-Deployment'
copyFrom: 'Aconcagua' with: [ spec loads: 'Deployment' ]
```
This will create `Aconcagua-Deployment` as a valid target that can be used
as requirement in your own packages.
> Replace `{XX}` with the version you want to depend on
3. Use the new loading target as a requirement on your packages. For example:
```smalltalk
baseline: spec
<baseline>
spec
for: #pharo
do: [
self setUpDependencies: spec.
spec
package: 'My-Package'
with: [ spec requires: #('Aconcagua-Deployment') ] ]
```
89 changes: 89 additions & 0 deletions docs/reference/Arithmetic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Arithmetic

## Arithmetic Object

An `ArithmeticObject` is an abstract class declaring the common behavior for
arithmetic objects:

- Fundamental math operations: addition, subtraction, multiplication and division
- Exponentiation

## Arithmetic Formula

An `ArithmeticFormula` is a mathematical expression that involves arithmetic
operations like addition, subtraction, multiplication, and division.

It typically describes a relationship between numbers, variables, or both, and
is used to perform calculations.

Concrete subclasses provide specific calculations.

## Summation

A `Summation` is the addition of a finite sequence of numbers or arithmetic objects,
called addends or summands; the result is their sum or total.

Besides numbers, other types of values can be summed as well: functions, vectors,
matrices, polynomials and, in general, elements of any type of mathematical objects
on which an operation denoted "`+`" is defined.

For example:

```smalltalk
(Summation of: [:i | i squared] from: 1 to: 4) = (1 + 4 + 9 + 16)
```

```smalltalk
(Summation ofAll: #(1 2 3 4)) = (1 + 2 + 3 + 4)
```

```smalltalk
(Summation ofAll: #(1 2 3 4) applying: #squared) = (1 + 4 + 9 + 16)
```

## Sequence Product

A `SequenceProduct` (or finite product) is the multiplication of a finite sequence
of numbers or arithmetic objects, called factors; the result is their product.

Besides numbers, other types of values can be multiplied as well: functions,
vectors, matrices, polynomials and, in general,
elements of any type of mathematical objects on
which an operation denoted "`×`" is defined.

For example:

```smalltalk
(SequenceProduct of: [:i | i ] from: 1 to: 4) = 4 factorial
```

```smalltalk
(SequenceProduct ofAll: #(1 2 3 4)) = 4 factorial
```

```smalltalk
(SequenceProduct ofAll: #(1 2 3 4) applying: #squared) = (4 * 9 * 16)
```

## Discrete Interval

A discrete interval is a finite set of discrete values that lie within certain bounds,
usually taken from the set of integers or some other countable set.

This implementation can be used with any arithmetic objects as the values, not
only numbers.

## Superscript formatting

An `IntegerAsSuperscriptFormatter` is a formatter that can convert
any integer to its superscript form. Useful when printing exponents.

For example:

```smalltalk
( IntegerAsSuperscriptFormatter new format: -10 ) >>> '⁻¹⁰'
```

```smalltalk
( IntegerAsSuperscriptFormatter new format: 1234 ) >>> '¹²³⁴'
```
23 changes: 23 additions & 0 deletions docs/reference/Baseline-groups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Baseline Groups & GS 64 Components

## Pharo Baseline Groups

Aconcagua includes the following groups in its Baseline that can be used as
loading targets:

- `Deployment` will load all the packages needed in a deployed application
- `Tests` will load the test cases
- `Tools` will load tooling extensions
- `Dependent-SUnit-Extensions` will load extensions to SUnit
- `CI` is the group loaded in the continuous integration setup, in this
particular case it is the same as `Tests`
- `Development` will load all the needed packages to develop and contribute to
the project

## GS64 Components

Aconcagua includes the following components in its Rowan configuration that can be
used as loading targets:

- `Deployment` will load all the packages needed in a deployed application
- `Tests` will load the test cases
Loading

0 comments on commit fd7ef50

Please sign in to comment.