Anonymous user
ABC words: Difference between revisions
Implementation of the ABC words in R
m (→{{header|Wren}}: Minor tidy) |
imported>RegalCode (Implementation of the ABC words in R) |
||
Line 2,640:
prefabricate quarterback razorback roadblock sabbatical snapback
strabismic syllabic tabernacle tablecloth
</pre>
=={{header|R}}==
<syntaxhighlight lang="R">
library(stringi)
library(dplyr)
check_abc <- function(w) {
char_list <- stri_split_boundaries(w, type='character')[[1]]
fpos <- lapply(c("a","b","c"),\(x) grep(x,char_list)) %>% sapply(\(x) x[1])
if (any(is.na(fpos)==T)) return(F)
ifelse(all(sort(fpos) == fpos),T,F)
}
rep <- sapply(readLines("unixdict.txt"), \(x) check_abc(x))
print(names(rep[rep == T]))
{{out}}
<pre>[1] "aback" "abacus" "abc" "abdicate" "abduct" "abeyance"
[7] "abject" "abreact" "abscess" "abscissa" "abscissae" "absence"
[13] "abstract" "abstracter" "abstractor" "adiabatic" "aerobacter" "aerobic"
[19] "albacore" "alberich" "albrecht" "algebraic" "alphabetic" "ambiance"
[25] "ambuscade" "aminobenzoic" "anaerobic" "arabic" "athabascan" "auerbach"
[31] "diabetic" "diabolic" "drawback" "fabric" "fabricate" "flashback"
[37] "halfback" "iambic" "lampblack" "leatherback" "metabolic" "nabisco"
[43] "paperback" "parabolic" "playback" "prefabricate" "quarterback" "razorback"
[49] "roadblock" "sabbatical" "snapback" "strabismic" "syllabic" "tabernacle"
[55] "tablecloth"
</pre>
|