I before E except after C: Difference between revisions

no edit summary
(Add SETL)
No edit summary
(4 intermediate revisions by 2 users not shown)
Line 2,701:
 
rule is not plausible
</pre>
 
 
=={{header|langur}}==
{{trans|Perl}}
<syntaxhighlight lang="langur">val .words = rest split "\n", readfile "./data/unixdict.txt"
 
val .print = impure fn(.support, .against) {
val .ratio = .support / .against
writeln "{{.support}} / {{.against}} = {{.ratio : r2}}:", if(.ratio < 2: " NOT"; ""), " PLAUSIBLE"
return if(.ratio >= 2: 1; 0)
}
 
val .keys = fw/ei cei ie cie/
var .count = {:}
 
for .w in .words {
for .k in .keys {
.count[.k; 0] += if(.k in .w: 1; 0)
}
}
 
var .support = .count'ie - .count'cie
var .against = .count'ei - .count'cei
 
var .result = .print(.support, .against)
.result += .print(.count'cei, .count'cie)
 
writeln "Overall:", if(.result < 2: " NOT"; ""), " PLAUSIBLE\n"
</syntaxhighlight>
 
{{out}}
<pre>465 / 213 = 2.18: PLAUSIBLE
13 / 24 = 0.54: NOT PLAUSIBLE
Overall: NOT PLAUSIBLE
</pre>
 
Line 5,080 ⟶ 5,115:
 
Also there are seven words which fall into two categories and which have therefore been double-counted.
<syntaxhighlight lang="ecmascriptwren">import "io" for File
import "./pattern" for Pattern
import "./fmt" for Fmt
 
var yesNo = Fn.new { |b| (b) ? "yes" : "no" }
Line 5,162 ⟶ 5,197:
And the code and results for the 'stretch goal' which has just the one double-counted word:
 
<syntaxhighlight lang="ecmascriptwren">import "io" for File
import "./pattern" for Pattern
import "./fmt" for Fmt
 
var yesNo = Fn.new { |b| (b) ? "yes" : "no" }
Line 5,241 ⟶ 5,276:
Plausible overall: no
</pre>
 
 
=={{header|Yabasic}}==
1,006

edits