Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,31 @@
10 READ N
20 FOR A = 1 TO N
30 READ SQ$, I$
35 FOR S = 1 TO LEN(SQ$)
36 S$ = MID$(SQ$, S, 1)
40 GOSUB 100" SQUEEZE
45 PRINT "Character: '" S$ "'"
50 PRINT LEN(I$) "<<<" I$ ">>>"
60 PRINT LEN(O$) "<<<" O$ ">>>"
70 PRINT
80 NEXT S, A
90 END
REM SQUEEZE
100 O$ = I$
110 IF LEN(I$) < 2 THEN RETURN
120 O$ = ""
130 P$ = ""
140 FOR I = 1 TO LEN(i$)
150 C$ = MID$(I$,I,1)
160 IF C$ <> S$ OR C$ <> P$ THEN O$ = O$ + C$
170 P$ = C$
180 NEXT I
190 RETURN
400 DATA 5
410 DATA " ",""
420 DATA "-","'If I were two-faced, would I be wearing this one?' --- Abraham Lincoln "
430 DATA "7","..1111111111111111111111111111111111111111111111111111111111111117777888"
440 DATA ".","I never give 'em hell, I just tell the truth, and they think it's hell. "
450 DATA " -r"," --- Harry S Truman "

View file

@ -0,0 +1,10 @@
Squeeze (1»«)/
> Squeeze {(("<<<"">>>")𝕏)´𝕨}˜
'e'"The better the 4-wheel drive, the further you'll be from help when ya get stuck!"
's'"headmistressship"
' '""
'-'"""If I were two-faced, would I be wearing this one?"" --- Abraham Lincoln "
'7'"..1111111111111111111111111111111111111111111111111111111111111117777888"
'.'"I never give 'em hell, I just tell the truth, and they think it's hell. "
" -r" 01 ¯72"--- Harry S Truman "

View file

@ -0,0 +1,32 @@
fun squeeze ← text by text input, text include
text sb
for int i ← 0 ; i < input.length ; ++i
if i æ 0 or input[i - 1] ≠ input[i] or (input[i - 1] æ input[i] and input[i] ≠ include)
sb.append(input[i])
end
end
return sb
end
fun main ← int by List args
List strings ← text["",
"\"If I were two-faced, would I be wearing this one?\" --- Abraham Lincoln ",
"..1111111111111111111111111111111111111111111111111111111111111117777888",
"I never give 'em hell, I just tell the truth, and they think it's hell. ",
" --- Harry S Truman ",
"122333444455555666666777777788888888999999999",
"The better the 4-wheel drive, the further you'll be from help when ya get stuck!",
"headmistressship"]
List chars ← text[" ", "-", "7", ".", " -r", "5", "e", "s"]
for int i ← 0; i < strings.length ; ++i
text s ← strings[i]
for each text c in chars[i]
text result ← squeeze(s, c)
writeLine("use: '", c, "'")
writeLine("old: ", s.length, " <<<", s, ">>>")
writeLine("new: ", result.length, " <<<", result, ">>>")
writeLine()
end
end
return 0
end
exit(main(Runtime.args))

View file

@ -0,0 +1,36 @@
local fn Squeeze( string as CFStringRef, chr as CFStringRef ) as CFStringRef
CFStringRef seq = concat(chr,chr)
while ( fn StringContainsString( string, seq ) )
string = fn StringByReplacingOccurrencesOfString( string, seq, chr )
wend
end fn = string
CFStringRef s
s = @"<<<The bell tolls loudly in the still night>>>"
print len(s),s
s = fn Squeeze( s, @"l" )
print len(s),s
print
s = @"<<<A sudden breeze rattled the shutters>>>"
print len(s),s
s = fn Squeeze( s, @"t" )
print len(s),s
print
s = @"<<<The fluffy bunny hopped across the green grass>>>"
print len(s),s
s = fn Squeeze( s, @"f" )
print len(s),s
print
s = @"<<< I saw a massive balloon floating above the valley >>>"
print len(s),s
s = fn Squeeze( s, @"l" )
print len(s),s
HandleEvents