Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #54072

Rosetta Code: Find the missing permutation

From "Robert L." <No_spamming@noWhere_7073.org>
Newsgroups comp.lang.forth
Subject Rosetta Code: Find the missing permutation
Date 2017-01-17 09:30 +0000
Organization Aioe.org NNTP Server
Message-ID <o5ko6v$10ej$1@gioia.aioe.org> (permalink)

Show all headers | View raw


> Listed above are all of the permutations of the symbols   A,
> B,   C,   and   D,   except   for one permutation that's   not
> listed.
> 
> Task
> 
> Find that missing permutation.

Ruby:

perms = %w(
ABCD
CABD
ACDB
DACB
BCDA
ACBD
ADCB
CDAB
DABC
BCAD
CADB
CDBA
CBAD
ABDC
ADBC
BDCA
DCBA
BACD
BADC
BDAC
CBDA
DBCA
DCAB)

%w(A B C D).permutation.map(&:join) - perms
    ==>["DBAC"]

In Forth?


-- 
[I]n 1917, ... they had a provisional government set up after the Czar had
abdicated, and ... [the Jew] Kerensky came in as head of the government....
[H]e ... outlawed "anti-Semitism", and even imposed a death penalty for
"anti-Semitism".  http://www.redicecreations.com/radio/2016/03/RIR-160304.php

Back to comp.lang.forth | Previous | Next | Find similar | Unroll thread


Thread

Rosetta Code: Find the missing permutation "Robert L." <No_spamming@noWhere_7073.org> - 2017-01-17 09:30 +0000

csiph-web