Find the missing permutation: Difference between revisions

Added Easylang
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
(Added Easylang)
 
(2 intermediate revisions by 2 users not shown)
Line 1,000:
=={{header|Delphi}}==
See [https://rosettacode.org/wiki/Find_the_missing_permutation#Pascal Pascal].
 
=={{header|EasyLang}}==
<syntaxhighlight>
perms$[] = [ "ABCD" "CABD" "ACDB" "DACB" "BCDA" "ACBD" "ADCB" "CDAB" "DABC" "BCAD" "CADB" "CDBA" "CBAD" "ABDC" "ADBC" "BDCA" "DCBA" "BACD" "BADC" "BDAC" "CBDA" "DBCA" "DCAB" ]
n = len perms$[1]
len cnt[] n
#
nn = 1
for i to n - 1
nn *= i
.
for i to 4
for j to n
cnt[j] = 0
.
for s$ in perms$[]
cod = strcode substr s$ i 1 - 64
cnt[cod] += 1
.
for j to n
if cnt[j] <> nn
miss$ &= strchar (j + 64)
break 1
.
.
.
print miss$
</syntaxhighlight>
 
{{out}}
<pre>
DBAC
</pre>
 
=={{header|EchoLisp}}==
Line 1,263 ⟶ 1,296:
End</syntaxhighlight>
<pre>Output is the same as the first version</pre>
 
=={{header|Frink}}==
<syntaxhighlight lang="frink">p = toSet[trim[splitLines["""ABCD
CABD
ACDB
DACB
BCDA
ACBD
ADCB
CDAB
DABC
BCAD
CADB
CDBA
CBAD
ABDC
ADBC
BDCA
DCBA
BACD
BADC
BDAC
CBDA
DBCA
DCAB"""]]]
 
s = ["A","B","C","D"]
for n = s.lexicographicPermute[]
{
str = join["", n]
if ! p.contains[str]
println[str]
}</syntaxhighlight>
{{out}}
<pre>
DBAC
</pre>
 
=={{header|GAP}}==
Line 3,576 ⟶ 3,646:
{{libheader|Wren-set}}
{{libheader|Wren-perm}}
<syntaxhighlight lang="ecmascriptwren">import "./set" for Set
import "./perm" for Perm
 
2,056

edits