rendered paste body# Diccionario.
var.def dict {first:im the first word,second:im the second,third:im the third}
# Buscar la palabra / definicion numero N.
func.def dict.nth.word (dict arg) { return [string.gettok [string.gettok $dict "," $arg] ":" 0]; }
func.def dict.nth.def (dict arg) { return [string.gettok [string.gettok $dict "," $arg] ":" 1]; }
# Insertar una palabra.
var.def dict.add.word {
var.def dict $dict,[io.read]:[io.read];
}
# Buscar el significado de una palabra.
func.def dict.search.word (dict word) {
loop.for (var.def n 0) (< $n [string.numtok $dict ","]) (var.def n [+ $n 1]) {
cond.if (string.comp [dict.nth.word $dict $n] $word) { io.write Meaning: [dict.nth.def $dict $n]; }
}
}
# Probar una busqueda.
io.write Word to search for:
dict.search.word $dict [io.read];
# Pedimos una palabra para insertar.
io.write Word to add and definition:
eval $dict.add.word;
# Buscar otra vez.
io.write Word to search for:
dict.search.word $dict [io.read];