Rename the language from Dino to Rex
Files use .rex, the command is rex, and the crate, runtime prefixes, docs, editor files and examples all use the new name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f44f09b6a
commit
7cf9727bcd
94 files changed
+858
-858
No files matched your search
@@ -0,0 +1,48 @@
|
||||
struct Team {
|
||||
name: string
|
||||
scores: map[string, int]
|
||||
}
|
||||
|
||||
func total(m: map[string, int]): int {
|
||||
var sum = 0
|
||||
for k, v in m { sum += v }
|
||||
return sum
|
||||
}
|
||||
|
||||
func main() {
|
||||
var ages = {"alice": 30, "bob": 25}
|
||||
ages["carol"] = 41
|
||||
ages["bob"] = 26
|
||||
print(ages["bob"], ages.len(), ages.has("dave"), ages)
|
||||
print(ages.get("alice"), ages.get("zed"), ages.get_or("zed", -1))
|
||||
var counts: map[string, int] = {}
|
||||
for w in "a b a c b a".split(" ") {
|
||||
counts[w] += 1
|
||||
}
|
||||
print(counts)
|
||||
for k, v in counts { print(k, "->", v) }
|
||||
for k in counts.keys() { print("key", k) }
|
||||
print(counts.values(), total(counts))
|
||||
counts.remove("b")
|
||||
print(counts, counts.len())
|
||||
var copy = counts
|
||||
copy["z"] = 9
|
||||
print(counts.len(), copy.len())
|
||||
var nums = map[int, []string]{}
|
||||
nums[1] = ["x", "y"]
|
||||
nums[2] = []
|
||||
nums[1].push("z")
|
||||
print(nums)
|
||||
var t = Team{name: "red", scores: {"a": 1}}
|
||||
t.scores["b"] = 2
|
||||
var t2 = t
|
||||
t2.scores["c"] = 3
|
||||
print(t.scores.len(), t2.scores.len())
|
||||
var big = map[int, int]{}
|
||||
for i in 0..2000 { big[i * 7] = i }
|
||||
var s = 0
|
||||
for i in 0..2000 { s += big[i * 7] }
|
||||
print(s, big.len())
|
||||
for i in 0..1000 { big.remove(i * 7) }
|
||||
print(big.len())
|
||||
}
|
||||
Reference in new issue
Block a user