Data update

This commit is contained in:
Ingy döt Net 2025-06-11 20:16:52 -04:00
parent 72eb4943cb
commit 4d5544505c
2347 changed files with 62432 additions and 16731 deletions

View file

@ -1,8 +1,11 @@
set ary {}
# empty list
set arr {}
lappend ary 1
lappend ary 3
# 10 integers
set arr [list 1 2 3 4 5 6 7 8 9 10 ]
lset ary 0 2
puts [lindex $ary 0]
lappend arr 11
lappend arr 12
puts stdout "$arr"

View file

@ -1 +1,8 @@
puts $ary; # Print the whole array
set x [lindex $arr 4] ; # x <= 5
foreach n $arr {
set idx [expr n -1]
lset arr $idx [expr $n * $n]
}
puts stdout "$arr"

View file

@ -0,0 +1,2 @@
set slice [lrange $arr 5 10]
puts stdout "$slice"

View file

@ -0,0 +1,2 @@
puts stdout "arr has [llength $arr] items."
puts stdout "slice has [llength $slice] items."

View file

@ -0,0 +1,4 @@
set r [lreverse $arr]
set s [lsort -integer $r]
puts stdout $r
puts stdout $s

View file

@ -0,0 +1,10 @@
set term "calico"
set fd [open "cats.txt" "r"]
set contents [read $fd]
set lines [split $contents "\n"]
foreach line $lines {
if { [lsearch $line $term] > 0 } {
puts "found $term in \"$line\""
}
}