get "libhdr" // Read word from selected input let readword(v) = valof $( let ch = ? v%0 := 0 $( ch := rdch() if ch = endstreamch then resultis false if ch = '*N' then resultis true v%0 := v%0 + 1 v%(v%0) := ch $) repeat $) // Does s1 contain s2? let contains(s1, s2) = valof $( for i = 1 to s1%0 - s2%0 + 1 if valof $( for j = 1 to s2%0 unless s1%(i+j-1) = s2%j resultis false resultis true $) resultis true resultis false $) // Test unixdict.txt let start() be $( let word = vec 2+64/BYTESPERWORD let file = findinput("unixdict.txt") let ncie, ncei, nxie, nxei = 0, 0, 0, 0 selectinput(file) while readword(word) test contains(word, "ie") test contains(word, "cie") do ncie := ncie + 1 or nxie := nxie + 1 or if contains(word, "ei") test contains(word, "cei") do ncei := ncei + 1 or nxei := nxei + 1 endread() // Show results writef("CIE: %N*N", ncie) writef("xIE: %N*N", nxie) writef("CEI: %N*N", ncei) writef("xEI: %N*N", nxei) writef("I before E when not preceded by C: %Splausible.*N", 2*nxie > ncie -> "", "not ") writef("E before I when preceded by C: %Splausible.*N", 2*ncei > nxei -> "", "not ") $)