diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2025-10-20 16:58:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-20 16:58:05 +0100 |
| commit | d821c7cb2589513d6504f298c6ce1e1c696d0f8e (patch) | |
| tree | e8f197d14cf935042492f15b7c70aadbfcb51e5c | |
| parent | 12bea413dde33182ccc24bc96b0cf434892deedc (diff) | |
| parent | 2aabb5ade5d569a04f94f3c02903a27cd1fcf065 (diff) | |
| download | perlweeklychallenge-club-d821c7cb2589513d6504f298c6ce1e1c696d0f8e.tar.gz perlweeklychallenge-club-d821c7cb2589513d6504f298c6ce1e1c696d0f8e.tar.bz2 perlweeklychallenge-club-d821c7cb2589513d6504f298c6ce1e1c696d0f8e.zip | |
Merge pull request #12883 from fluca1978/PWC344
PWC 344
| -rw-r--r-- | challenge-344/luca-ferrari/blog-1.txt | 1 | ||||
| -rw-r--r-- | challenge-344/luca-ferrari/blog-2.txt | 1 | ||||
| -rw-r--r-- | challenge-344/luca-ferrari/pljava/pom.xml | 72 | ||||
| -rw-r--r-- | challenge-344/luca-ferrari/raku/ch-1.raku | 15 | ||||
| -rw-r--r-- | challenge-344/luca-ferrari/raku/ch-2.raku | 43 |
5 files changed, 60 insertions, 72 deletions
diff --git a/challenge-344/luca-ferrari/blog-1.txt b/challenge-344/luca-ferrari/blog-1.txt new file mode 100644 index 0000000000..5460028345 --- /dev/null +++ b/challenge-344/luca-ferrari/blog-1.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2025/10/20/PerlWeeklyChallenge344.html#task1 diff --git a/challenge-344/luca-ferrari/blog-2.txt b/challenge-344/luca-ferrari/blog-2.txt new file mode 100644 index 0000000000..da55eccb99 --- /dev/null +++ b/challenge-344/luca-ferrari/blog-2.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2025/10/20/PerlWeeklyChallenge344.html#task2 diff --git a/challenge-344/luca-ferrari/pljava/pom.xml b/challenge-344/luca-ferrari/pljava/pom.xml deleted file mode 100644 index 674fcf6c4d..0000000000 --- a/challenge-344/luca-ferrari/pljava/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - -<project - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > - <modelVersion>4.0.0</modelVersion> - - <groupId>PWC</groupId> - <artifactId> - PWC341 - </artifactId> - <version> - 1 - </version> - - <name>Perl Weekly Challenge 341 with package PWC341</name> - <description>Implementation of the tasks in PL/Java for PWC 341</description> - - <properties> - <project.build.sourceEncoding>US-ASCII</project.build.sourceEncoding> - </properties> - - <dependencies> - <dependency> - <groupId>org.postgresql</groupId> - <artifactId>pljava-api</artifactId> - <version>1.6.6</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.1</version> - <configuration> - <release>9</release> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>2.6</version> - <configuration> - <archive> - <manifest> - <!-- This identifies and version-stamps the jar. - Not essential, but easy and useful. --> - <addDefaultImplementationEntries> - true - </addDefaultImplementationEntries> - </manifest> - - <manifestSections> - <!-- This identifies a file in the jar named - pljava.ddr as an SQLJDeploymentDescriptor. --> - <manifestSection> - <name>pljava.ddr</name> - <manifestEntries> - <SQLJDeploymentDescriptor> - true - </SQLJDeploymentDescriptor> - </manifestEntries> - </manifestSection> - </manifestSections> - </archive> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/challenge-344/luca-ferrari/raku/ch-1.raku b/challenge-344/luca-ferrari/raku/ch-1.raku new file mode 100644 index 0000000000..2412847531 --- /dev/null +++ b/challenge-344/luca-ferrari/raku/ch-1.raku @@ -0,0 +1,15 @@ +#!raku + +# +# Perl Weekly Challenge 344 +# Task 1 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-344> +# + +sub MAIN( Int $x, *@numbers where { @numbers.grep( * ~~ Int ).elems == @numbers.elems } ) { + my @n = $x.comb; + @n.unshift: 0 while ( @n.elems < @numbers.elems ); + + say @numbers <<+>> @n; +} diff --git a/challenge-344/luca-ferrari/raku/ch-2.raku b/challenge-344/luca-ferrari/raku/ch-2.raku new file mode 100644 index 0000000000..8c19d1bfb1 --- /dev/null +++ b/challenge-344/luca-ferrari/raku/ch-2.raku @@ -0,0 +1,43 @@ +#!raku + +# +# Perl Weekly Challenge 344 +# Task 2 +# +# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-344> +# + +sub MAIN( ) { + my @source = [2,3], [1], [4]; + my @destination = 1,2,3,4; + + #@source = [9,1], [5,8], [2]; + #@destination = 5, 8, 2, 9, 1; + + # @source = [1], [3]; + # @destination = 1,2,3; + + my $destination-as-string = @destination.sort.join; + + my $found = 0; + for @source -> $current { + my $index = Nil; + + for $current.List -> $x { + 'False'.say and exit if ( ! @destination.grep( * ~~ $x ) ); + if ( ! $index ) { + $index = @destination.grep( * ~~ $x, :k ).first; + } + else { + 'False'.say and exit if ( @destination[ ++$index ] != $x ); + } + + $found++; + } + } + + + + 'True'.say and exit if ( $found == @destination.elems ); + 'False'.say; +} |
