Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,32 @@
task{
⍝ Squeeze a string
squeeze (/)1,1¯1
⍝ Display string and length in the manner given in the task
display {(¯2),' «««',,'»»»'}
⍝ Squeeze string and display output
show {
r 'chr: ''',,''''
rr,' in: ',display
rr,'out: ',display squeeze
r,''
}
⍝ Strings from the task
s1''
s2'"If I were two-faced, would I be wearing this one?"'
s2s2,' --- Abraham Lincoln '
s3'..1111111111111111111111111111111111111111111111111'
s3s3,'111111111111117777888'
s4'I never give ''em hell, I just tell the truth, and t'
s4s4,'hey think it''s hell. '
s5' '
s5s5,' --- Harry S Truman '
' ' show s1
'-' show s2
'7' show s3
'.' show s4
{ show s5}¨' -r' ⍝⍝ note use of 'show' here in a lambda (dfn)
}

View file

@ -0,0 +1,36 @@
#!/usr/local/bin/apl --script
r c squeeze s
s 0,s,0
r 1¯2((sc)s),¨c
r display s
r (¯2s),' «««',s,'»»»'
r c show s
r ("chr: '",c,"'")
r r, (" in: ",display s)
r r, ("out: ",display c squeeze s)
r r
main
s1''
s2'"If I were two-faced, would I be wearing this one?"'
s2s2,' --- Abraham Lincoln '
s3'..1111111111111111111111111111111111111111111111111'
s3s3,'111111111111117777888'
s4'I never give ''em hell, I just tell the truth, and t'
s4s4,'hey think it''s hell. '
s5' '
s5s5,' --- Harry S Truman '
' ' show s1
'-' show s2
'7' show s3
'.' show s4
{ show s5}¨' -r'