Removed redundant constant named origin.

This commit is contained in:
Christian Rinderknecht 2020-04-15 12:00:54 +02:00
parent fb7abe045f
commit a2c03ad848

View File

@ -138,8 +138,6 @@ updated record.
Let us consider defining a function that translates three-dimensional Let us consider defining a function that translates three-dimensional
points on a plane. points on a plane.
<Syntax syntax="pascaligo"> <Syntax syntax="pascaligo">
In PascaLIGO, the shape of that expression is In PascaLIGO, the shape of that expression is
@ -348,8 +346,6 @@ points on a plane.
type point is record [x : int; y : int; z : int] type point is record [x : int; y : int; z : int]
type vector is record [dx : int; dy : int] type vector is record [dx : int; dy : int]
const origin : point = record [x = 0; y = 0; z = 0]
function xy_translate (var p : point; const vec : vector) : point is function xy_translate (var p : point; const vec : vector) : point is
block { block {
patch p with record [x = p.x + vec.dx]; patch p with record [x = p.x + vec.dx];
@ -374,8 +370,6 @@ the value of `p` indeed changed. So, a shorter version would be
type point is record [x : int; y : int; z : int] type point is record [x : int; y : int; z : int]
type vector is record [dx : int; dy : int] type vector is record [dx : int; dy : int]
const origin : point = record [x = 0; y = 0; z = 0]
function xy_translate (var p : point; const vec : vector) : point is function xy_translate (var p : point; const vec : vector) : point is
block { block {
patch p with record [x = p.x + vec.dx; y = p.y + vec.dy] patch p with record [x = p.x + vec.dx; y = p.y + vec.dy]
@ -399,8 +393,6 @@ one we want to update* and use a functional update, like so:
type point is record [x : int; y : int; z : int] type point is record [x : int; y : int; z : int]
type vector is record [dx : int; dy : int] type vector is record [dx : int; dy : int]
const origin : point = record [x = 0; y = 0; z = 0]
function xy_translate (var p : point; const vec : vector) : point is function xy_translate (var p : point; const vec : vector) : point is
block { block {
const p : point = p with record [x = p.x + vec.dx; y = p.y + vec.dy] const p : point = p with record [x = p.x + vec.dx; y = p.y + vec.dy]
@ -1151,4 +1143,3 @@ let updated_map : register =
``` ```
</Syntax> </Syntax>