Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,6 +1,7 @@
{{Data structure}}
Create a compound data type Point(x,y).
A compound data type is one that holds multiple independent values. See also [[Enumeration]].
A compound data type is one that holds multiple independent values.
See also [[Enumeration]].
{{Template:See also lists}}

View file

@ -1,2 +1,11 @@
p["x"]=10
p["y"]=42
BEGIN {
p["x"]=10
p["y"]=42
z = "ZZ"
p[ z ]=999
p[ 4 ]=5
for (i in p) print( i, ":", p[i] )
}

View file

@ -0,0 +1,11 @@
enum x, y
sequence point = {0,0}
printf(1,"x = %d, y = %3.3f\n",point)
point[x] = 'A'
point[y] = 53.42
printf(1,"x = %d, y = %3.3f\n",point)
printf(1,"x = %s, y = %3.3f\n",point)

View file

@ -0,0 +1,11 @@
typeset -T Point=(
typeset x
typeset y
)
Point p
p.x=1
p.y=2
echo $p
echo ${p.x} ${p.y}
Point q=(x=3 y=4)
echo ${q.x} ${q.y}

View file

@ -0,0 +1,5 @@
point=()
point.x=5
point.y=6
echo $point
echo ${point.x} ${point.y}

View file

@ -0,0 +1,9 @@
function MakePoint(x, y) " 'Constructor'
return {"x": a:x, "y": a:y}
endfunction
let p1 = MakePoint(3, 2)
let p2 = MakePoint(-1, -4)
echon "Point 1: x = " p1.x ", y = " p1.y "\n"
echon "Point 2: x = " p2.x ", y = " p2.y "\n"