txt
stringlengths
202
72.4k
### ---------------------------------------------------- ### -- Acme::Don't ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: dist.ini ### ---------------------------------------------------- name = Acme-Don't [ReadmeFromPod] ; enable = false filename = lib/Acme/Don't.rakumod [PruneFiles] ; match = ^ 'xt/' [Badges] provider = github-actions/test [UploadToZef]
### ---------------------------------------------------- ### -- Acme::Don't ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: t/01-basic.t ### ---------------------------------------------------- use v6.c; use Test; use Acme::Don't; plan 2; my $seen = False; don't { $seen = True } nok $seen, 'did we not execute?'; $seen = False; my $times = 10; don't { $seen = True } while --$times; nok $seen, 'did we not execute?'; # vim: ft=perl6 expandtab sw=4
### ---------------------------------------------------- ### -- Acme::Don't ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: lib/Acme/Don't.rakumod ### ---------------------------------------------------- use v6.*; module Acme::Don't:ver<0.0.3>:auth<zef:lizmat> { sub don't(& --> Nil) is export { } } =begin pod =head1 NAME Acme::Don't - The opposite of do =head1 SYNOPSIS use Acme::Don't; don't { print "This won't be printed\n" }; # NO-OP =head1 DESCRIPTION The Acme::Don't module provides a C<don't> command, which is the opposite of Perl's built-in C<do>. It is used exactly like the C<do BLOCK> function except that, instead of executing the block it controls, it...well...doesn't. Regardless of the contents of the block, C<don't> returns C<Nil>. You can even write: don't { # code here } while condition(); And, yes, in strict analogy to the semantics of Perl's magical C<do...while>, the C<don't...while> block is I<unconditionally> not done once before the test. ;-) Note that the code in the C<don't> block must be syntactically valid Perl. This is an important feature: you get the accelerated performance of not actually executing the code, without sacrificing the security of compile-time syntax checking. =head1 LIMITATIONS =head2 No opposite Doesn't (yet) implement the opposite of C<do STRING>. The current workaround is to use: don't {"filename"}; =head2 Double don'ts The construct: don't { don't { ... } } isn't (yet) equivalent to: do { ... } because the outer C<don't> prevents the inner C<don't> from being executed, before the inner C<don't> gets the chance to discover that it actually I<should> execute. This is an issue of semantics. C<don't...> doesn't mean C<do the opposite of...>; it means C<do nothing with...>. In other words, doin nothing about doing nothing does...nothing. =head2 Unless not You can't (yet) use a: don't { ... } unless condition(); as a substitute for: do { ... } if condition(); Again, it's an issue of semantics. C<don't...unless...> doesn't mean C<do the opposite of...if...>; it means C<do nothing with...if not...>. =head2 PORTING CAVEATS Since Perl 6 doesn't have C<undef>, the closest thing to it (C<Nil>) is being returned by C<don't> instead. =head1 AUTHOR Elizabeth Mattijsen <[email protected]> Source can be located at: https://github.com/lizmat/Acme-don-t . Comments and Pull Requests are welcome. =head1 COPYRIGHT AND LICENSE Copyright 2018, 2019, 2021 Elizabeth Mattijsen Original author: Damian Conway. Re-imagined from Perl 5 as part of the CPAN Butterfly Plan. This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. =end pod # vim: ft=perl6 expandtab sw=4
### ---------------------------------------------------- ### -- Acme::Insult::Lala ### -- Licenses: Artistic-2.0 ### -- Authors: Jonathan Stowe <[email protected]> ### -- File: META6.json ### ---------------------------------------------------- { "resources": [ "lala.txt" ], "build-depends": [ ], "authors": [ "Jonathan Stowe <[email protected]>" ], "auth": "zef:jonathanstowe", "api": "1.0", "provides": { "Acme::Insult::Lala": "lib/Acme/Insult/Lala.rakumod" }, "description": "Construct an insulting epithet in the manner of an old IRC bot", "source-url": "git://github.com/jonathanstowe/Acme-Insult-Lala.git", "version": "0.0.7", "license": "Artistic-2.0", "depends": [ ], "support": { "email": "[email protected]", "source": "git://github.com/jonathanstowe/Acme-Insult-Lala.git", "bugtracker": "https://github.com/jonathanstowe/Acme-Insult-Lala/issues" }, "meta-version": "1", "tags": [ "insult", "acme", "fun" ], "test-depends": [ ], "raku": "6.*", "name": "Acme::Insult::Lala" }
### ---------------------------------------------------- ### -- Acme::Insult::Lala ### -- Licenses: Artistic-2.0 ### -- Authors: Jonathan Stowe <[email protected]> ### -- File: README.md ### ---------------------------------------------------- # Acme::Insult::Lala Construct an insulting epithet in the manner of an old IRC bot ![Build Status](https://github.com/jonathanstowe/Acme-Insult-Lala/workflows/CI/badge.svg) ## Synopsis ```perl6 use Acme::Insult::Lala; my $lala = Acme::Insult::Lala.new; say $lala.generate-insult; ``` ## Description This makes an insulting epithet in the manner of 'lala' an IRC bot that used to be on the #london.pm channel back in the mists of time. I think I originally got the source data from an analysis of epithets in Shakespeare plays or something, but I can't actually remember it was that long ago. Anyhow at some point the lovely Simon Wistow retrieved the basic code and data and incorporated it in the Perl 5 module [Acme::Scurvy::Whoreson::BilgeRat::Backend::insultserver](http://search.cpan.org/~simonw/Acme-Scurvy-Whoreson-BilgeRat-Backend-insultserver-1.0/). From whence I retrieved the data and made it into a Raku module. There's also a handy script that does this for you without having to make any code: generate-insult [--number|-n=<number>] I suppose you could use it for generating test data or something but there's nothing more to it than you see in the Synopsis. ## Installation Assuming you have a working Rakudo installation you should be able to do : zef install Acme::Insult::Lala ## Support If you don't like the language, don't use it. If you don't think it's insulting enough, write your own. In the unlikely event you should find a bug please report it at https://github.com/jonathanstowe/Acme-Insult-Lala/issues ## Licence and Copyright I guess the data in resources/lala.txt should properly be considered to be in the public domain as it's likely that it came from some such source in the first place. All the rest of the code is free software and licensed under the terms described in the [LICENCE](LICENCE) file. © Jonathan Stowe 2016 - 2023
### ---------------------------------------------------- ### -- Acme::Insult::Lala ### -- Licenses: Artistic-2.0 ### -- Authors: Jonathan Stowe <[email protected]> ### -- File: LICENCE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Acme::Insult::Lala ### -- Licenses: Artistic-2.0 ### -- Authors: Jonathan Stowe <[email protected]> ### -- File: resources/lala.txt ### ---------------------------------------------------- artless base-court apple-john bawdy bat-fowling baggage beslubbering beef-witted barnacle bootless beetle-headed bladder brazen boil-brained boar-pig churlish bunched-backed bugbear clouted clapper-clawed bum-bailey cockered clay-brained canker-blossom craven common-kissing clack-dish currish crook-pated clotpole dankish dismal-dreaming codpiece dissembling dizzy-eyed coxcomb distempered dog-hearted crutch droning doghearted cutpurse errant dread-bolted death-token fawning earth-vexing dewberry fitful elf-skinned dogfish fobbing empty-hearted egg-shell frothy evil-eyed flap-dragon froward eye-offending flax-wench gleeking fat-kidneyed flirt-gill gnarling fen-sucked foot-licker goatish flap-mouthed fustilarian gorbellied fly-bitten giglet greasy folly-fallen gudgeon grizzled fool-born gull-catcher haughty full-gorged haggard hideous guts-griping harpy impertinent half-faced hedge-pig infectious hasty-witted hempseed jaded heavy-handed horn-beast jarring hedge-born hugger-mugger knavish hell-hated jack-a-nape lewd horn-mad jolthead loggerheaded idle-headed lewdster lumpish ill-breeding lout mammering ill-composed maggot-pie mangled ill-nurtured malignancy mewling iron-witted malkin paunchy knotty-pated malt-worm peevish lean-witted mammet pernicious lily-livered manikin prating mad-bread measle pribbling milk-livered minimus puking motley-minded minnow puny muddy-mettled miscreant purpled onion-eyed moldwarp quailing pale-hearted mumble-news queasy paper-faced nut-hook rank pinch-spotted pantaloon reeky plume-plucked pigeon-egg roguish pottle-deep pignut roynish pox-marked pumpion ruttish raw-boned puttock saucy reeling-ripe rabbit-sucker sottish rough-hewn rampallion spleeny rude-growing ratsbane spongy rug-headed remnant surly rump-fed rudesby tottering shag-eared ruffian unmuzzled shard-borne scantling vacant sheep-biting scullion vain shrill-gorged scut venomed sour-faced skainsmate villainous spur-galled snipe waggish swag-bellied strumpet wanton tardy-gaited varlet warped tickle-brained varlot wayward toad-spotted vassal weedy unchin-snouted wagtail wenching urchin-snouted waterfly whoreson weak-hinged whey-face yeasty weather-bitten whipster yeasty white-livered younker
### ---------------------------------------------------- ### -- Acme::Insult::Lala ### -- Licenses: Artistic-2.0 ### -- Authors: Jonathan Stowe <[email protected]> ### -- File: t/010-basic.t ### ---------------------------------------------------- #!raku use v6; use Test; use Acme::Insult::Lala; my $obj; lives-ok { $obj = Acme::Insult::Lala.new }, "create an instance"; for ^10 { my $insult; lives-ok { $insult = $obj.generate-insult }, "generate insult"; ok $insult.defined, "and its defined"; ok $insult.chars > 5, "and '$insult' has at least five characters"; } done-testing; # vim: expandtab shiftwidth=4 ft=raku
### ---------------------------------------------------- ### -- Acme::Insult::Lala ### -- Licenses: Artistic-2.0 ### -- Authors: Jonathan Stowe <[email protected]> ### -- File: t/001-meta.t ### ---------------------------------------------------- #!raku use v6; use Test; my Bool $got-test-meta = True; my &m-meta-ok; BEGIN { require Test::META <&meta-ok>; $got-test-meta = True; &m-meta-ok = &meta-ok; CATCH { when X::CompUnit::UnsatisfiedDependency { plan 1; skip-rest "no Test::META - skipping"; done-testing; exit; } } } plan 1; if $got-test-meta { m-meta-ok(); } else { skip "no Test::META skipping"; } done-testing; # vim: expandtab shiftwidth=4 ft=raku
### ---------------------------------------------------- ### -- Acme::Insult::Lala ### -- Licenses: Artistic-2.0 ### -- Authors: Jonathan Stowe <[email protected]> ### -- File: lib/Acme/Insult/Lala.rakumod ### ---------------------------------------------------- use v6; =begin pod =head1 NAME Acme::Insult::Lala - Construct an insulting epithet in the manner of an old IRC bot =head1 SYNOPSIS =begin code use Acme::Insult::Lala; my $lala = Acme::Insult::Lala.new; say $lala.generate-insult; =end code =head1 DESCRIPTION This makes an insulting epithet in the manner of 'lala' an IRC bot that used to be on the london.pm channel back in the mists of time. I think I originally got the source data from an analysis of epithets in Shakespeare plays or something, but I can't actually remember it was that long ago. Anyhow at some point the lovely Simon Wistow retrieved the basic code and data and incorporated it in the Perl 5 module L<Acme::Scurvy::Whoreson::BilgeRat::Backend::insultserver|http://search.cpan.org/~simonw/Acme-Scurvy-Whoreson-BilgeRat-Backend-insultserver-1.0/>. From whence I retrieved the data and made it into a Raku module. I suppose you could use it for generating test data or something but there's nothing more to it than you see in the Synopsis. =head1 METHODS =head2 method new method new() The constructor creates the word lists up front so if you are planning on using this repeatedly it is best to create a single object and re-use it. =head2 method generate-insult method generate-insult() returns Str This generates a new random insult based on the internal word lists, as noted above if you are planning to call this repeatedly it is probably better to re-use a single object if you can. =end pod class Acme::Insult::Lala { has @!noun; has @!adjective-one; has @!adjective-two; submethod TWEAK() { my %h = %?RESOURCES<lala.txt>.lines>>.split(/\s+/).map( -> [$a, $b, $c] { a => $a, b => $b, c => $c }).flat.classify(*.key, as => *.value); @!adjective-one = %h<a>.list; @!adjective-two = %h<b>.list; @!noun = %h<c>.list; } method generate-insult(Acme::Insult::Lala:D:) returns Str { (@!adjective-one.pick, @!adjective-two.pick, @!noun.pick).join(' '); } sub MAIN(Int :n(:$number) = 1 ) is export(:script) { my $lala = Acme::Insult::Lala.new; for (^$number) -> $ { say $lala.generate-insult; } } } # vim: expandtab shiftwidth=4 ft=raku
### ---------------------------------------------------- ### -- Acme::Meow ### -- Licenses: NOASSERTION ### -- Authors: Tadeusz “tadzik” Sośnierz, Paul Cochrane, GlithMr, Ethan House, Tobias Leich ### -- File: META6.json ### ---------------------------------------------------- { "auth": "zef:raku-community-modules", "authors": [ "Tadeusz “tadzik” Sośnierz", "Paul Cochrane", "GlithMr", "Ethan House", "Tobias Leich" ], "build-depends": [ ], "depends": [ ], "description": "The kitty you always wanted, now in Raku", "license": "NOASSERTION", "name": "Acme::Meow", "perl": "6.*", "provides": { "Acme::Meow": "lib/Acme/Meow.rakumod" }, "resources": [ ], "source-url": "https://github.com/raku-community-modules/Acme-Meow.git", "tags": [ ], "test-depends": [ ], "version": "0.2" }
### ---------------------------------------------------- ### -- Acme::Meow ### -- Licenses: NOASSERTION ### -- Authors: Tadeusz “tadzik” Sośnierz, Paul Cochrane, GlithMr, Ethan House, Tobias Leich ### -- File: LICENSE ### ---------------------------------------------------- The MIT License Copyright (c) 2010 Tadeusz Sośnierz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
### ---------------------------------------------------- ### -- Acme::Meow ### -- Licenses: NOASSERTION ### -- Authors: Tadeusz “tadzik” Sośnierz, Paul Cochrane, GlithMr, Ethan House, Tobias Leich ### -- File: README.md ### ---------------------------------------------------- [![Actions Status](https://github.com/raku-community-modules/Acme-Meow/actions/workflows/linux.yml/badge.svg)](https://github.com/raku-community-modules/Acme-Meow/actions) [![Actions Status](https://github.com/raku-community-modules/Acme-Meow/actions/workflows/macos.yml/badge.svg)](https://github.com/raku-community-modules/Acme-Meow/actions) [![Actions Status](https://github.com/raku-community-modules/Acme-Meow/actions/workflows/windows.yml/badge.svg)](https://github.com/raku-community-modules/Acme-Meow/actions) NAME ==== Acme::Meow - The kitty you always wanted, now in Raku SYNOPSIS ======== ```raku use Acme::Meow; my $kitty = Acme::Meow.new; $kitty.pet; $kitty.feed("milk"); ``` DESCRIPTION =========== This is a Raku port of Perl's [Acme::Meow](https://metacpan.org/pod/Acme::Meow). It's not a verbatim port. Some things have changed, and there is more to come. Stay tuned for more fun :) class Acme::Meow ---------------- Our cute, artificial cat (perfect for allergics!) ### method pet ```raku method pet() returns Mu ``` pet our kitty ### method feed ```raku method feed( $food? ) returns Mu ``` feed our kitty ### method is-sleeping ```raku method is-sleeping() returns Mu ``` is our kitty sleeping? ### method nip ```raku method nip() returns Mu ``` handy method to feed your cat with a nip ### method milk ```raku method milk() returns Mu ``` another one to give some milk to our kitty AUTHOR ====== Tadeusz Sośnierz COPYRIGHT AND LICENSE ===================== Copyright 2010 - 2017 Tadeusz Sośnierz Copyright 2024 Raku Community This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
### ---------------------------------------------------- ### -- Acme::Meow ### -- Licenses: NOASSERTION ### -- Authors: Tadeusz “tadzik” Sośnierz, Paul Cochrane, GlithMr, Ethan House, Tobias Leich ### -- File: dist.ini ### ---------------------------------------------------- name = Acme::Meow [ReadmeFromPod] filename = lib/Acme/Meow.rakumod [UploadToZef] [Badges] provider = github-actions/linux.yml provider = github-actions/macos.yml provider = github-actions/windows.yml
### ---------------------------------------------------- ### -- Acme::Meow ### -- Licenses: NOASSERTION ### -- Authors: Tadeusz “tadzik” Sośnierz, Paul Cochrane, GlithMr, Ethan House, Tobias Leich ### -- File: t/00-load.rakutest ### ---------------------------------------------------- use Test; plan 1; use Acme::Meow; ok 1, 'Acme::Meow is loaded'; # vim: expandtab shiftwidth=4
### ---------------------------------------------------- ### -- Acme::Meow ### -- Licenses: NOASSERTION ### -- Authors: Tadeusz “tadzik” Sośnierz, Paul Cochrane, GlithMr, Ethan House, Tobias Leich ### -- File: t/01-fun.rakutest ### ---------------------------------------------------- use Test; plan 6; use Acme::Meow; my $c = Acme::Meow.new; ok $c.can('feed'), 'We can feed the cat'; ok $c.can('pet'), 'We can pet the cat'; lives-ok { $c.feed }, 'feeding works'; lives-ok { $c.feed('nip') }, 'feeding nip works'; lives-ok { $c.feed('milk') }, 'feeding milk works'; lives-ok { $c.pet }, 'petting works'; # vim: expandtab shiftwidth=4
### ---------------------------------------------------- ### -- Acme::Meow ### -- Licenses: NOASSERTION ### -- Authors: Tadeusz “tadzik” Sośnierz, Paul Cochrane, GlithMr, Ethan House, Tobias Leich ### -- File: lib/Acme/Meow.rakumod ### ---------------------------------------------------- =begin pod =head1 NAME Acme::Meow - The kitty you always wanted, now in Raku =head1 SYNOPSIS =begin code :lang<raku> use Acme::Meow; my $kitty = Acme::Meow.new; $kitty.pet; $kitty.feed("milk"); =end code =head1 DESCRIPTION This is a Raku port of Perl's L<Acme::Meow|https://metacpan.org/pod/Acme::Meow>. It's not a verbatim port. Some things have changed, and there is more to come. Stay tuned for more fun :) =end pod #| Our cute, artificial cat (perfect for allergics!) class Acme::Meow { has Numeric $!love = 0; has Str $!fav = ''; #| pet our kitty method pet() { $!love++; $!fav = <milk nip>.pick; say ~[self!kitty_status, <purr nuzzle meow>.pick, $!love > 15 ?? '<3' !! '']; } #| feed our kitty method feed($food?) { if self.is-sleeping { $!love += 0.25 } else { $!love += 0.5 } if $food.defined { if $food eq 'nip' { say ~[self!kitty_status, 'crunch'] } elsif $food eq 'milk' { say ~[self!kitty_status, 'lap lap'] } } else { say ~[self!kitty_status, ['crunch', 'lap lap', ''].pick] } } #| is our kitty sleeping? method is-sleeping() { False # cats sleep? They're just pretending. # They're watching you. All the time. # or TODO, if you prefer } #| handy method to feed your cat with a nip method nip() { self.feed: 'nip' } #| another one to give some milk to our kitty method milk() { self.feed: 'milk' } method !kitty_status { return 'zZzZ' if self.is-sleeping; $!love > 5 ?? '=^_^=' !! '=-_-=' } } =begin pod =head1 AUTHOR Tadeusz Sośnierz =head1 COPYRIGHT AND LICENSE Copyright 2010 - 2017 Tadeusz Sośnierz Copyright 2024 Raku Community This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. =end pod # vim: expandtab shiftwidth=4
### ---------------------------------------------------- ### -- Acme::Overreact ### -- Licenses: Artistic-2.0 ### -- Authors: Fernando Corrêa de Oliveira ### -- File: META6.json ### ---------------------------------------------------- { "auth": "zef:FCO", "authors": [ "Fernando Corrêa de Oliveira" ], "build-depends": [ ], "depends": [ "ASTQuery" ], "description": "Make your code overreact", "license": "Artistic-2.0", "name": "Acme::Overreact", "perl": "6.d", "provides": { "Acme::Overreact": "lib/Acme/Overreact.rakumod" }, "resources": [ ], "source-url": "https://github.com/FCO/Acme-Overreact.git", "tags": [ ], "test-depends": [ ], "version": "0.0.1" }
### ---------------------------------------------------- ### -- Acme::Overreact ### -- Licenses: Artistic-2.0 ### -- Authors: Fernando Corrêa de Oliveira ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Acme::Overreact ### -- Licenses: Artistic-2.0 ### -- Authors: Fernando Corrêa de Oliveira ### -- File: README.md ### ---------------------------------------------------- [![Actions Status](https://github.com/FCO/Acme-Overreact/actions/workflows/test.yml/badge.svg)](https://github.com/FCO/Acme-Overreact/actions) NAME ==== Acme::Overreact - Make your code overreact SYNOPSIS ======== ```raku use Acme::Overreact; CHECK overreact; say 42; # prints '42!!!' ``` DESCRIPTION =========== Acme::Overreact is just a joke, please do not use that in production code AUTHOR ====== Fernando Corrêa de Oliveira <[email protected]> COPYRIGHT AND LICENSE ===================== Copyright 2024 Fernando Corrêa de Oliveira This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
### ---------------------------------------------------- ### -- Acme::Overreact ### -- Licenses: Artistic-2.0 ### -- Authors: Fernando Corrêa de Oliveira ### -- File: dist.ini ### ---------------------------------------------------- name = Acme::Overreact [ReadmeFromPod] filename = lib/Acme/Overreact.rakumod [UploadToZef] [Badges] provider = github-actions/test.yml
### ---------------------------------------------------- ### -- Acme::Overreact ### -- Licenses: Artistic-2.0 ### -- Authors: Fernando Corrêa de Oliveira ### -- File: t/01-basic.rakutest ### ---------------------------------------------------- use Test; use Acme::Overreact; my $ast1 = 'say 42'.AST; my $ast2 = 'say("that works")'.AST; my $ast3 = 'say 42; say("that works")'.AST; my $ast4 = "print 42".AST; my $ast5 = 'print("that works")'.AST; my $ast6 = 'print 42; print("that works")'.AST; for $ast1, $ast2, $ast3, $ast4, $ast5, $ast6 { .&overreact } is $ast1.DEPARSE.subst(/\n/, " ", :g).trim, 'say 42, "!!!"'; is $ast2.DEPARSE.subst(/\n/, " ", :g).trim, 'say("that works", "!!!")'; is $ast3.DEPARSE.subst(/\n/, " ", :g).trim, 'say 42, "!!!"; say("that works", "!!!")'; is $ast4.DEPARSE.subst(/\n/, " ", :g).trim, 'print 42'; is $ast5.DEPARSE.subst(/\n/, " ", :g).trim, 'print("that works")'; is $ast6.DEPARSE.subst(/\n/, " ", :g).trim, 'print 42; print("that works")'; done-testing;
### ---------------------------------------------------- ### -- Acme::Overreact ### -- Licenses: Artistic-2.0 ### -- Authors: Fernando Corrêa de Oliveira ### -- File: lib/Acme/Overreact.rakumod ### ---------------------------------------------------- use ASTQuery; use experimental :rakuast; sub overreact($CU = $*CU) { for $CU.&ast-query(Q|RakuAST::Call::Name#say|).list { .args.push: RakuAST::StrLiteral.new: "!!!" } } sub EXPORT(--> Map()) { '&overreact' => &overreact, '&fogo-no' => &overreact, } =begin pod =head1 NAME Acme::Overreact - Make your code overreact =head1 SYNOPSIS =begin code :lang<raku> use Acme::Overreact; CHECK overreact; say 42; # prints '42!!!' =end code =head1 DESCRIPTION Acme::Overreact is just a joke, please do not use that in production code =head1 AUTHOR Fernando Corrêa de Oliveira <[email protected]> =head1 COPYRIGHT AND LICENSE Copyright 2024 Fernando Corrêa de Oliveira This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. =end pod
### ---------------------------------------------------- ### -- Acme::OwO ### -- Licenses: BSD-3-Clause ### -- Authors: Kane 'kawaii' Valentine <[email protected]> ### -- File: META6.json ### ---------------------------------------------------- { "name": "Acme::OwO", "description": "OwO Waku moduwe to make uuw stwings mowe appwoachabwe (✿ ♡‿♡).", "version": "0.2", "perl": "6.d", "authors": [ "Kane 'kawaii' Valentine <[email protected]>" ], "auth": "github:kawaii", "provides": { "Acme::OwO": "lib/Acme/OwO.rakumod" }, "support": { "bugtracker": "https://github.com/kawaii/raku-acme-owo/issues", "source": "https://github.com/kawaii/raku-acme-owo.git" }, "license": "BSD-3-Clause", "source-url": "git://github.com/kawaii/raku-acme-owo.git", "repo-type": "git", "source-type": "git" }
### ---------------------------------------------------- ### -- Acme::OwO ### -- Licenses: BSD-3-Clause ### -- Authors: Kane 'kawaii' Valentine <[email protected]> ### -- File: LICENSE ### ---------------------------------------------------- BSD 3-Clause License Copyright (c) 2020, Kane Valentine All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Acme::OwO ### -- Licenses: BSD-3-Clause ### -- Authors: Kane 'kawaii' Valentine <[email protected]> ### -- File: README.md ### ---------------------------------------------------- # raku-acme-owo
### ---------------------------------------------------- ### -- Acme::OwO ### -- Licenses: BSD-3-Clause ### -- Authors: Kane 'kawaii' Valentine <[email protected]> ### -- File: examples/basic.raku ### ---------------------------------------------------- #!raku use Acme::OwO; my $o = Acme::OwO.new; say $o.owo("Syria seeks Russian investment as U.S. sanctions hammer economy.");
### ---------------------------------------------------- ### -- Acme::OwO ### -- Licenses: BSD-3-Clause ### -- Authors: Kane 'kawaii' Valentine <[email protected]> ### -- File: lib/Acme/OwO.rakumod ### ---------------------------------------------------- unit class Acme::OwO; my constant @prefixes = [ '<3 ', '0w0 ', 'H-hewwo?? ', 'HIIII! ', 'Haiiii! ', 'Huohhhh. ', 'OWO ', 'OwO ', 'UwU ' ]; my constant @suffixes = [ ' ( ͡° ᴥ ͡°)', ' (இωஇ )', ' (๑•́ ₃ •̀๑)', ' (• o •)', ' (●´ω`●)', ' (◠‿◠✿)', ' (✿ ♡‿♡)', ' ( \'◟ \')', ' (人◕ω◕)', ' (;ω;)', ' (`へ´)', ' ._.', ' :3', ' :D', ' :P', ' ;-;', ' ;3', ' ;_;', ' >_<', ' >_>', ' UwU', ' XDDD', ' ^-^', ' ^_^', ' x3', ' x3', ' xD', ' ÙωÙ', ' ʕʘ‿ʘʔ', ' ʕ•̫͡•ʔ', ' ㅇㅅㅇ', ', fwendo', '(^v^)', ]; my constant %substitutions = 'r' => 'w', 'l' => 'w', 'R' => 'W', 'L' => 'W', 'no' => 'nu', 'has' => 'haz', 'have' => 'haz', 'you' => 'uu', 'the ' => 'da ', 'The ' => 'Da ', ; method !add-affixes($str) { @prefixes.pick ~ $str ~ @suffixes.pick; } method !substitute($str is copy) { do for %substitutions.kv -> $k, $v { $str ~~ s:g/$k/$v/ }; return $str; } method owo($str) { self!add-affixes(self!substitute($str)); }
### ---------------------------------------------------- ### -- Acme::Polyglot::Levenshtein::Damerau ### -- Licenses: Artistic-2.0 ### -- Authors: ### -- File: META6.json ### ---------------------------------------------------- { "perl" : "6.*", "name" : "Acme::Polyglot::Levenshtein::Damerau", "version" : "0.1", "description" : "Polyglot Perl 5/6 damerau levenshtein algorithm module", "auth" : "github:ugexe", "license" : "Artistic-2.0", "depends" : [ ], "test-depends" : [ "Test" ], "provides" : { "Acme::Polyglot::Levenshtein::Damerau": "lib/Acme/Polyglot/Levenshtein/Damerau.pm" }, "source-url" : "git://github.com/ugexe/Acme--Polyglot--Levenshtein--Damerau.git", "tags" : [ "levenshtein", "damerau" ] }
### ---------------------------------------------------- ### -- Acme::Polyglot::Levenshtein::Damerau ### -- Licenses: Artistic-2.0 ### -- Authors: ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Acme::Polyglot::Levenshtein::Damerau ### -- Licenses: Artistic-2.0 ### -- Authors: ### -- File: .appveyor.yml ### ---------------------------------------------------- os: Visual Studio 2015 platform: x64 install: - '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64' - appveyor-retry choco install strawberryperl --allow-empty-checksums - SET PATH=C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH% - appveyor-retry git clone https://github.com/rakudo/rakudo.git %APPVEYOR_BUILD_FOLDER%\..\rakudo - cd %APPVEYOR_BUILD_FOLDER%\..\rakudo - perl Configure.pl --gen-moar --gen-nqp - nmake install - SET PATH=%APPVEYOR_BUILD_FOLDER%\..\rakudo\install\bin;%PATH% - SET PATH=%APPVEYOR_BUILD_FOLDER%\..\rakudo\install\share\perl6\site\bin;%PATH% - cd %APPVEYOR_BUILD_FOLDER% build: off test_script: - perl -v - perl6 -v - prove -v -e "perl -Ilib" t/ - prove -v -e "perl6 -Ilib" t/ shallow_clone: true
### ---------------------------------------------------- ### -- Acme::Polyglot::Levenshtein::Damerau ### -- Licenses: Artistic-2.0 ### -- Authors: ### -- File: README.pod ### ---------------------------------------------------- =pod =encoding utf8 =head2 Acme::Polyglot::Levenshtein::Damerau Calculate damerau levenshtein edit distances =for HTML <a href="https://travis-ci.org/ugexe/Acme--Polyglot--Levenshtein--Damerau"><img src="https://travis-ci.org/ugexe/Acme--Polyglot--Levenshtein--Damerau.svg?branch=master"></a> <a href="https://ci.appveyor.com/project/ugexe/Acme-Polyglot-Levenshtein-Damerau/branch/master"><img src="https://ci.appveyor.com/api/projects/status/github/ugexe/Acme--Polyglot--Levenshtein--Damerau?branch=master&passingText=Windows%20-%20OK&failingText=Windows%20-%20FAIL&pendingText=Windows%20-%20pending&svg=true"></a> =head2 Synopsis use Acme::Polyglot::Levenshtein::Damerau; print Acme::Polyglot::Levenshtein::Damerau::dld('Neil','Niel'); # prints 1 =head2 Description Returns the true Damerau Levenshtein edit distance of strings with adjacent transpositions. =head2 WARNING This is a polyglot module that works for both Perl 5 and Perl 6 -- don't use this code as inspiration for a non-polyglot codebase. =head2 Installation # Perl 5 $ cpanm https://github.com/ugexe/Acme--Polyglot--Levenshtein--Damerau.git # Perl 6 $ zef install https://github.com/ugexe/Acme--Polyglot--Levenshtein--Damerau.git =head2 Routines =over 8 =item * C<dld> Damerau Levenshtein Distance (Levenshtein Distance including transpositions) Arguments: $source, $target, $max? I<$max distance. 0 = unlimited. Default = 0> Returns: int that represents the edit distance between the two argument. Stops calculations and returns -1 if max distance is set and reached if possible. print Acme::Polyglot::Levenshtein::Damerau::dld('AABBCC','AABCBCD'); # prints 2 # Max edit distance of 1 print Acme::Polyglot::Levenshtein::Damerau::dld('AABBCC','AABCBCD',1); # distance is 2 # prints -1 =back =head3 Bugs Please report bugs to: L<https://github.com/ugexe/Acme--Polyglot--Levenshtein--Damerau/issues> =head3 Author Nick Logan (ugexe) L<[email protected]> =cut
### ---------------------------------------------------- ### -- Acme::Polyglot::Levenshtein::Damerau ### -- Licenses: Artistic-2.0 ### -- Authors: ### -- File: Makefile.PL ### ---------------------------------------------------- use 5.008_008; use ExtUtils::MakeMaker; my $pm = 'lib/Acme/Polyglot/Levenshtein/Damerau.pm'; my $repo = 'https://github.com/ugexe/Acme--Polyglot--Levenshtein--Damerau'; my $bugs = 'https://github.com/ugexe/Acme--Polyglot--Levenshtein--Damerau/issues'; WriteMakefile ( NAME => 'Acme::Polyglot::Levenshtein::Damerau', VERSION => '0.1', ABSTRACT => 'Polyglot Perl 5/6 damerau levenshtein algorithm module', AUTHOR => 'Nick Logan <[email protected]>', LICENSE => 'Artistic-2.0', MIN_PERL_VERSION => '5.008008', TEST_REQUIRES => { 'Test' => '0', }, META_MERGE => { resources => { repository => $repo, bugtracker => $bugs, }, provides => { 'Acme::Polyglot::Levenshtein::Damerau' => { file => $pm, version => '0.1', }, }, } );
### ---------------------------------------------------- ### -- Acme::Polyglot::Levenshtein::Damerau ### -- Licenses: Artistic-2.0 ### -- Authors: ### -- File: .travis.yml ### ---------------------------------------------------- language: perl os: - linux matrix: fast_finish: true sudo: false before_install: - git clone https://github.com/rakudo/rakudo.git $HOME/rakudo - cd $HOME/rakudo - perl Configure.pl $VM_OPTS --gen-nqp --gen-moar - make install - export PATH=$HOME/rakudo/install/bin:$PATH - cd $TRAVIS_BUILD_DIR install: - perl -v - perl6 -v script: - prove -v -e "perl -Ilib" t/ - prove -v -e "perl6 -Ilib" t/
### ---------------------------------------------------- ### -- Acme::Polyglot::Levenshtein::Damerau ### -- Licenses: Artistic-2.0 ### -- Authors: ### -- File: t/basic.t ### ---------------------------------------------------- use Acme::Polyglot::Levenshtein::Damerau; use Test; "0" and plan(5) or plan(tests => 5); ok(Acme::Polyglot::Levenshtein::Damerau::dld("four", "fuor") == 1); ok(Acme::Polyglot::Levenshtein::Damerau::dld("four", "fxxr") == 2); ok(Acme::Polyglot::Levenshtein::Damerau::dld("four", "xxxx") == 4); ok(Acme::Polyglot::Levenshtein::Damerau::dld("four", "four") == 0); ok(Acme::Polyglot::Levenshtein::Damerau::dld("four", "fxxr", 1) == -1);
### ---------------------------------------------------- ### -- Acme::Rautavistic::Sort ### -- Licenses: Artistic-2.0 ### -- Authors: Steffen Schwigon ### -- File: META6.json ### ---------------------------------------------------- { "auth": "zef:renormalist", "authors": [ "Steffen Schwigon" ], "build-depends": [ ], "depends": [ ], "description": "Rautavistic sort functions", "license": "Artistic-2.0", "name": "Acme::Rautavistic::Sort", "perl": "6.d", "provides": { "Acme::Rautavistic::Sort": "lib/Acme/Rautavistic/Sort.rakumod" }, "resources": [ ], "source-url": "https://github.com/renormalist/raku-Acme-Rautavistic-Sort.git", "tags": [ ], "test-depends": [ ], "version": "0.0.1" }
### ---------------------------------------------------- ### -- Acme::Rautavistic::Sort ### -- Licenses: Artistic-2.0 ### -- Authors: Steffen Schwigon ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Acme::Rautavistic::Sort ### -- Licenses: Artistic-2.0 ### -- Authors: Steffen Schwigon ### -- File: README.md ### ---------------------------------------------------- [![Actions Status](https://github.com/renormalist/raku-Acme-Rautavistic-Sort/actions/workflows/test.yml/badge.svg)](https://github.com/renormalist/raku-Acme-Rautavistic-Sort/actions) NAME ==== Acme::Rautavistic::Sort - Rautavistic sort functions SYNOPSIS ======== ```raku use Acme::Rautavistic::Sort; # default alphanumeric comparison @res = dropsort( <3 2 3 1 5> ); # <3 3 5> @res = dropsort( <cc bb dd aa ee> ); # <cc dd ee> ``` DESCRIPTION =========== Acme::Rautavistic::Sort provides rautavistic sort functions. For more description of the functions see below. dropsort -------- From [https://web.archive.org/web/20240512074546/https://www.dangermouse.net/esoteric/dropsort.html](https://web.archive.org/web/20240512074546/https://www.dangermouse.net/esoteric/dropsort.html): Dropsort is a fast, one-pass sorting algorithm suitable for many applications. Algorithm Description Dropsort is run on an ordered list of numbers by examining the numbers in sequence, beginning with the second number in the list. If the number being examined is less than the number before it, drop it from the list. Otherwise, it is in sorted order, so keep it. Then move to the next number. After a single pass of this algorithm, the list will only contain numbers that are at least as large as the previous number in the list. In other words, the list will be sorted! Analysis Dropsort requires exactly n-1 comparisons to sort a list of length n, making this an O(n) algorithm, superior to the typical O(n logn) algorithms commonly used in most applications. Dropsort is what is known in the computer science field as a lossy algorithm. It produces a fast result that is correct, but at the cost of potentially losing some of the input data. Although to those not versed in the arts of computer science this may seem undesirable, lossy algorithms are actually a well-accepted part of computing. An example is the popular JPEG image compression format, which enjoys widespread use because of its versatility and usefulness. In similar fashion, dropsort promises to revolutionise the sorting of data in fields as diverse as commercial finance, government record-keeping, and space exploration. FUNCTIONS ========= dropsort -------- Drop sort an array: ```raku @SORTED = dropsort @VALUES ``` Values are compared using smart comparison (i.e., `cmp` and `~~`) sensibly, to handle numbers and strings in the original DWIM way of Perl when using allomorphs. Support for other types is not yet tested. AUTHOR ====== Steffen Schwigon <[email protected]> ACKNOWLEDGEMENTS ================ Felix Antonius Wilhelm Ostmann (benchmark, optimization and stunt coordinator in the original Perl version) MORE INFO ========= For more information about rautavistic sort and rautavistic in general see * [https://web.archive.org/web/20240512074546/https://www.dangermouse.net/esoteric/dropsort.html](https://web.archive.org/web/20240512074546/https://www.dangermouse.net/esoteric/dropsort.html) * [http://www.rautavistik.de](http://www.rautavistik.de) (in german) COPYRIGHT AND LICENSE ===================== Copyright 2024 Steffen Schwigon This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
### ---------------------------------------------------- ### -- Acme::Rautavistic::Sort ### -- Licenses: Artistic-2.0 ### -- Authors: Steffen Schwigon ### -- File: dist.ini ### ---------------------------------------------------- name = Acme::Rautavistic::Sort [ReadmeFromPod] filename = lib/Acme/Rautavistic/Sort.rakumod [UploadToZef] [Badges] provider = github-actions/test.yml
### ---------------------------------------------------- ### -- Acme::Rautavistic::Sort ### -- Licenses: Artistic-2.0 ### -- Authors: Steffen Schwigon ### -- File: t/01-basic.rakutest ### ---------------------------------------------------- use Test; use Acme::Rautavistic::Sort ; sub check (@in, @exp, $desc) { my @out = dropsort(@in); # use Data::Dump::Tree; # say "in: "; ddt @in; # say "out: "; ddt @out; # say "exp: "; ddt @exp; ok(@out ~~ @exp, $desc); } check([3, 2, 3, 1, 5], [3, 3, 5], "Num - double elements"); check([3, 2, 3, 1, 5], [3, 3, 5], "Num - double elements"); check([3, 1, 2], [3], "Num - from very high to small, then a bit higher again"); check([0, 0], [0, 0], "Num - 0 is true"); check([<3 2 3 1 5>], [<3 3 5>], "IntStr - double elements"); check([<3 2 3 1 5>], [<3 3 5>], "IntStr - double elements"); check([<3 1 2>], [<3>], "IntStr - from very high to small, then a bit higher again"); check([<0 0>], [<0 0>], "IntStr - 0 is true"); check([<ultimate zomtec ultimate>], [<ultimate zomtec>], 'Str - alpha sort'); check([ Nil ], [ Nil ], 'single Nil'); check([ Nil, Nil ], [ Nil, Nil ], 'Nils are valid'); check([ Nil, 1, Nil ], [ Nil, 1 ], 'Nil lt 1' ); check([ Nil, 0, Nil ], [ Nil, 0 ], 'Nil lt 0' ); check([ Nil, 1, Nil, 2 ], [ Nil, 1, 2 ], 'multiple Nils in ascending line'); check([ Nil, 1, Nil, 0 ], [ Nil, 1 ], 'multiple Nils in descending line'); check([ Nil, 1, 2 ], [ Nil, 1, 2 ], 'Nil, 1, 2'); check([ Nil, 2, 1 ], [ Nil, 2 ], 'Nil lt 2, 2 gt 1'); check([ Nil, 'zaffe', Nil ], [ Nil, 'zaffe' ], 'Nil lt alpha text'); check([<3 2 4 1 5>], [<3 4 5>], 'yet another line'); check([<3 4 5 6 7 8>], [<3 4 5 6 7 8>], 'already sorted'); check([<9 8 7 6 5 4>], [<9>], 'already reverse sorted'); check([<2>], [<2>], 'single value'); check([], [], 'empty list'); check([<cc bb dd aa ee>], [<cc dd ee>], 'alpha sort'); check([<aa bb cc dd ee ff>], [<aa bb cc dd ee ff>], 'already sorted alpha' ); check([<ii hh gg ff ee dd>], [<ii>], 'already reverse sorted alpha' ); check([<bb>], [<bb>], 'single alpha' ); check([Nil, 1, 2, 5, 3, 4], [Nil, 1, 2, 5], 'Nil, the leader'); check([1, 2, 5, 3, 4, Nil], [1, 2, 5], 'Nil does not follow'); check([1, 2, Nil, 5, 3, 4, Nil], [1, 2, 5], 'Nil in the middle attack'); done-testing;
### ---------------------------------------------------- ### -- Acme::Rautavistic::Sort ### -- Licenses: Artistic-2.0 ### -- Authors: Steffen Schwigon ### -- File: lib/Acme/Rautavistic/Sort.rakumod ### ---------------------------------------------------- unit class Acme::Rautavistic::Sort; sub dropsort is export { my $last; @_.map: { $last //= $_; defined($last) && !defined($_) ?? Empty !! ($_ cmp $last ~~ Same|More) ?? ($last := $_) !! Empty }; } =begin pod =head1 NAME Acme::Rautavistic::Sort - Rautavistic sort functions =head1 SYNOPSIS =begin code :lang<raku> use Acme::Rautavistic::Sort; # default alphanumeric comparison @res = dropsort( <3 2 3 1 5> ); # <3 3 5> @res = dropsort( <cc bb dd aa ee> ); # <cc dd ee> =end code =head1 DESCRIPTION Acme::Rautavistic::Sort provides rautavistic sort functions. For more description of the functions see below. =head2 dropsort From L<https://web.archive.org/web/20240512074546/https://www.dangermouse.net/esoteric/dropsort.html>: Dropsort is a fast, one-pass sorting algorithm suitable for many applications. Algorithm Description Dropsort is run on an ordered list of numbers by examining the numbers in sequence, beginning with the second number in the list. If the number being examined is less than the number before it, drop it from the list. Otherwise, it is in sorted order, so keep it. Then move to the next number. After a single pass of this algorithm, the list will only contain numbers that are at least as large as the previous number in the list. In other words, the list will be sorted! Analysis Dropsort requires exactly n-1 comparisons to sort a list of length n, making this an O(n) algorithm, superior to the typical O(n logn) algorithms commonly used in most applications. Dropsort is what is known in the computer science field as a lossy algorithm. It produces a fast result that is correct, but at the cost of potentially losing some of the input data. Although to those not versed in the arts of computer science this may seem undesirable, lossy algorithms are actually a well-accepted part of computing. An example is the popular JPEG image compression format, which enjoys widespread use because of its versatility and usefulness. In similar fashion, dropsort promises to revolutionise the sorting of data in fields as diverse as commercial finance, government record-keeping, and space exploration. =head1 FUNCTIONS =head2 dropsort Drop sort an array: =begin code :lang<raku> @SORTED = dropsort @VALUES =end code Values are compared using smart comparison (i.e., C<cmp> and C<~~>) sensibly, to handle numbers and strings in the original DWIM way of Perl when using allomorphs. Support for other types is not yet tested. =head1 AUTHOR Steffen Schwigon <[email protected]> =head1 ACKNOWLEDGEMENTS Felix Antonius Wilhelm Ostmann (benchmark, optimization and stunt coordinator in the original Perl version) =head1 MORE INFO For more information about rautavistic sort and rautavistic in general see =item L<https://web.archive.org/web/20240512074546/https://www.dangermouse.net/esoteric/dropsort.html> =item L<http://www.rautavistik.de> (in german) =head1 COPYRIGHT AND LICENSE Copyright 2024 Steffen Schwigon This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. =end pod
### ---------------------------------------------------- ### -- Acme::Scrub ### -- Licenses: Artistic-2.0 ### -- Authors: Steve Schulze (thundergnat) ### -- File: META6.json ### ---------------------------------------------------- { "auth": "zef:thundergnat", "authors": [ "Steve Schulze (thundergnat)" ], "build-depends": [ ], "depends": [ ], "description": "For REALLY clean code.", "license": "Artistic-2.0", "name": "Acme::Scrub", "perl": "6.d", "provides": { "Acme::Scrub": "lib/Acme/Scrub.pm6" }, "resources": [ ], "source-url": "git://github.com/thundergnat/Acme-Scrub.git", "tags": [ "Bleach", "Whitespace", "Obfuscate", "Silly" ], "test-depends": [ ], "version": "0.2.1" }
### ---------------------------------------------------- ### -- Acme::Scrub ### -- Licenses: Artistic-2.0 ### -- Authors: Steve Schulze (thundergnat) ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Acme::Scrub ### -- Licenses: Artistic-2.0 ### -- Authors: Steve Schulze (thundergnat) ### -- File: README.md ### ---------------------------------------------------- [![Actions Status](https://github.com/thundergnat/Acme-Scrub/actions/workflows/test.yml/badge.svg)](https://github.com/thundergnat/Acme-Scrub/actions) NAME ==== Acme::Scrub DESCRIPTION =========== Are your Raku files a mess? Have some nasty code you keep meaning to refactor but just can't find the time? Tired of looking at all those impenetrable Unicode operators? Help has arrived! In the spirit of Perl5's Acme::Bleach; Acme::Scrub, a quick and easy way to clean up ugly code. USAGE ===== At or near the top of your file, include the line: ```raku use Acme::Scrub; ``` The first time you run a script that uses Acme::Scrub, the line will be changed to: ```raku use Acme::Scrub; # for REALLY clean code. ``` and all the unsightly code below that line will be cleaned up, but it will still work the same way. WARNINGS, CAVEATS, PROVISIOS & QUID PRO QUOS ============================================ This modifies and overwrites the original file. It is highly recommended to save backup copies BEFORE using Acme::Scrub. It is possible to recover the original code... but why would you want to? Do not use Acme::Scrub for security. See above note. You will get only slightly less effective security by putting a sticky note over your source code. You can not have anything else on the line after ```raku use Acme::Scrub; ``` no spaces, no comments. Acme::Scrub will add it's own comment to the line, and it is somewhat fragile to manual edits. (Hey, if you wanted robust, why are you using an Acme module?) BUGS ==== Probably. AUTHOR ====== Stephen Schulze otherwise known as thundergnat <[email protected]> COPYRIGHT AND LICENSE ===================== Copyright 2022 thundergnat This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
### ---------------------------------------------------- ### -- Acme::Scrub ### -- Licenses: Artistic-2.0 ### -- Authors: Steve Schulze (thundergnat) ### -- File: dist.ini ### ---------------------------------------------------- name = Acme-Scrub [ReadmeFromPod] filename = lib/Acme/Scrub.pm6 [UploadToZef] [Badges] provider = github-actions/test.yml
### ---------------------------------------------------- ### -- Acme::Scrub ### -- Licenses: Artistic-2.0 ### -- Authors: Steve Schulze (thundergnat) ### -- File: t/scrub.t ### ---------------------------------------------------- use Acme::Scrub; #​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ for REALLY clean code.
### ---------------------------------------------------- ### -- Acme::Skynet ### -- Licenses: ### -- Authors: KM Wallio ### -- File: META6.json ### ---------------------------------------------------- { "perl" : "6.*", "name" : "Acme::Skynet", "version" : "0.0.3", "description" : "Machine Learnings for your Perls6.", "authors" : [ "KM Wallio" ], "provides" : { "Acme::Skynet" : "lib/Acme/Skynet.pm6", "Acme::Skynet::ID3" : "lib/Acme/Skynet/ID3.pm6", "Acme::Skynet::ChainLabel" : "lib/Acme/Skynet/ChainLabel.pm6", "Acme::Skynet::DumbDown" : "lib/Acme/Skynet/DumbDown.pm6" }, "depends" : ["Lingua::EN::Stem::Porter"], "resources" : [ ], "source-url" : "git://github.com/kmwallio/Acme-Skynet.git" }
### ---------------------------------------------------- ### -- Acme::Skynet ### -- Licenses: ### -- Authors: KM Wallio ### -- File: TODO.md ### ---------------------------------------------------- # TODO: Problems and thoughts related to Skynet. ## Intent * Should probably add an option for a default handler. * Add $context for passing in a context...? That way the called knows what's up ## Chain Labelling * Right now, if the word "in" is a cue word, and "in" is in an argument, the argument will break. We need to look at performing multiple iterations over a phrase and find a "best" fit. Currently we replace possible common phrases like "in to" with "into" * We could increase our training set size. During training keep a count of is it as an argument and location in the string. * Pass to a better labelling system as an initial guess. ## DumbDown * Currently, certain root words aren't going to the same root. For instance 'probable' and 'probably'. * Look at implementing Porter2 or another stemming algorithm. ## Free Will and Thought * *Investigating* * Parse Wikipedia and Urbandictionary?
### ---------------------------------------------------- ### -- Acme::Skynet ### -- Licenses: ### -- Authors: KM Wallio ### -- File: README.md ### ---------------------------------------------------- # Skynet for Perl6 Skynet is a collection of AI for your Perls6. [![Build Status](https://travis-ci.org/kmwallio/Acme-Skynet.svg?branch=master)](https://travis-ci.org/kmwallio/Acme-Skynet) ## Installation Using [panda](https://github.com/tadzik/panda): ``` panda install Acme::Skynet ``` ## Slightly Usable * [Intent](#intent) * [Chain Labelling](#chain-labelling) * [DumbDown](#dumbing-down) * [ID3Tree](#id3tree) ## Intent Attempts to determine your intended action from a command phrase. Look at [examples/stabbing_reminders.p6](examples/stabbing_reminders.p6) for more information. The more knowledge you add, the hopefully better it will be able to parse. Other than dumbing down, there's no additional text preprocessing yet. Punctuation can throw things off... There's an option for passing contexts. I'll add some documentation later, but you can see us using it for testing in [t/intent.t](t/intent.t). ``` perl6 use v6; use Acme::Skynet; my $robotOverlord = Intent.new(); my $time = sub () { say now; } # Route commands to actions. $robotOverlord.add($time, "what time is it"); $robotOverlord.add($time, "current time"); my $stab = sub (@args) { say "Stabbed @args[0]"; } # Basic support for commands with arguments $robotOverlord.add($stab, "stab john", "john"); $robotOverlord.add($stab, "stuart deserves to be stabbed", "stuart"); # Perform some training and learning $robotOverlord.learn(); # Provide some input $robotOverlord.hears("stab carlos"); # Expected output: "stabbed carlos" $robotOverlord.hears("what is the time"); # Expected output: the time ``` ## Chain Labelling Does labeling have 1 l or 2? Spell check okays both... this is how it all starts... You need a classifier in front of this. If you run a completely unrelated phrase through the labeler, your results will be completely unrelated. That's unexpected. ``` perl6 use v6; use Acme::Skynet::ChainLabel; # Create a new labeler my $reminders = ChainLabel.new(); # Tell it some facts $reminders.add("remind me at 7 to strech", "7", "strech"); $reminders.add("at 6 pm remind me to shower", "6 pm", "shower"); $reminders.add("remind me to run at the robot apocalypse", "the robot apocalypse", "run"); # Let it learn those facts. $reminders.learn(); my @ret = $reminders.get("at 6 pm remind me to let's shower"); say @ret[0]; # => "6 pm" say @ret[1]; # => "let's shower" @ret = $reminders.get("remind me to feed my cats at lunch time"); say @ret[0]; # => "lunch time" say @ret[1]; # => "feed my cats" ``` ## Dumbing Down AIs think in simpler terms than us humans. It's a process called "dumbing down". We needs to make things easier for them to understand. ``` perl6 use v6; use Acme::Skynet::DumbDown; say dumbdown("cats"); # => "cat" say dumber('he eats cats'); # => "he eat cat" say extraDumbedDown("what's the current o'clock"); # => "what is the current of the clock" say labeledExtraDumbedDown("we're so cool"); # => [[we're, so, cool] [we are, so, cool]] ``` ## ID3Tree This is a rapid basic (or overly complicated) implementation of an [ID3 Tree](https://en.wikipedia.org/wiki/ID3_algorithm). It's how our robot overlords will identify what's going on around them and determine the action to take. ``` perl6 use v6; use Acme::Skynet::ID3; # Should I rename this? # We need to create a thingy so our classifier and # thingy can talk and read each other class FeatNum does Featurized { has $.value; method new($value){ self.bless(:$value); } method getFeature($feature) { return ($.value % 2 == 0); } # In training, label known, when querying, # this isn't used and can be left blank method getLabel() { return (($.value %2 == 0)) ?? "even" !! "odd"; } } my $Classifier = ID3Tree.new(); my @features = "value"; my @labels = "even", "odd"; $Classifier.setFeatures(@features); $Classifier.setLabels(@labels); for [1..10] -> $num { $Classifier.addItem(FeatNum.new($num)); } $Classifier.learn(); say $Classifier.get(FeatNum.new(100); # => "even" say $Classifier.get(FeatNum.new(99)); # => "odd" ``` ## What about the 3 laws of robotics? Rules were made to be broken. ## TODO * [ ] Write Skynet V1 * [ ] Add multiple layers of Machine Learning, supposed to make things better * [ ] Ability to save state. It'd be bad if our supreme leaders forgot things * [ ] Convince everyone I know what I'm doing * [ ] Acquire government funding and live it up * [ ] Add in 3 laws of robotics * [ ] Have no regrets ### Acknowledgements Uses: * [Perl 6](http://perl6.org) * [Lingua::EN::Stem::Porter](https://github.com/johnspurr/Lingua-EN-Stem-Porter) * [ID3 Algorithm](https://en.wikipedia.org/wiki/ID3_algorithm)
### ---------------------------------------------------- ### -- Acme::Skynet ### -- Licenses: ### -- Authors: KM Wallio ### -- File: .travis.yml ### ---------------------------------------------------- language: perl6 perl6: - latest install: - rakudobrew build-panda - panda installdeps .
### ---------------------------------------------------- ### -- Acme::Skynet ### -- Licenses: ### -- Authors: KM Wallio ### -- File: t/dumb.t ### ---------------------------------------------------- use v6; use lib 'lib'; use Test; use Acme::Skynet::DumbDown; plan 8; # Test one plural word ok dumbdown("cats") eq "cat", "Strips plural"; # Phrase ok dumber("the kids have cats") eq "the kid have cat", "Handles multiple words"; # Multi-Level Dumbing Down ok dumbdown("computers") eq "comput", "Rootification"; # Example ok dumber('he eats cats') eq "he eat cat", "Moar tests"; # Decontracted ok extraDumbedDown("we're so cool") eq "we ar so cool", "Decontract"; ok extraDumbedDown("what's the current o'clock") eq "what is the current of the clock", "Multiple decontract"; # Labeled ok labeledDumbdown("he eats cats").elems == 2, "Original, Modified"; ok labeledExtraDumbedDown("we're so cool").elems == 2, "Original, Modified"; done-testing;
### ---------------------------------------------------- ### -- Acme::Skynet ### -- Licenses: ### -- Authors: KM Wallio ### -- File: t/chainlabel.t ### ---------------------------------------------------- use v6; use lib 'lib'; use Test; use Acme::Skynet::ChainLabel; plan 10; use-ok 'Acme::Skynet::ChainLabel'; { my $reminders = ChainLabel.new(); $reminders.add("remind me at 7 to strech -> 7, strech"); $reminders.add("at 6 pm remind me to shower -> 6 pm, shower"); $reminders.add("remind me to run at the robot apocalypse -> the robot apocalypse, run"); $reminders.learn(); my @ret = $reminders.get("at 6 pm remind me to let's shower"); ok @ret[0] eq "6 pm", "Got time"; ok @ret[1] eq "let's shower", "Got contracted phrase"; @ret = $reminders.get("at lunch time remind me to feed my cats"); ok @ret[0] eq "lunch time", "Got time"; ok @ret[1] eq "feed my cats", "Got original plural phrase"; @ret = $reminders.get("remind me to feed my cats at lunch time"); ok @ret[0] eq "lunch time", "Got time"; ok @ret[1] eq "feed my cats", "Got original plural phrase"; } { my $stabbings = ChainLabel.new(); $stabbings.add("stab john -> john"); $stabbings.add("please stab john -> john"); $stabbings.add("stab john please -> john"); $stabbings.add("stuart deserves to be stabbed -> stuart"); $stabbings.learn(); my @victim = $stabbings.get("carlos deserved to be stabbed"); ok @victim[0] eq "carlos", "Got Carlos on changed tense"; @victim = $stabbings.get("stab julie"); ok @victim[0] eq "julie", "Should exact match with different name"; @victim = $stabbings.get("carlos deserves to get stabbed"); ok @victim[0] eq "carlos", "Should be mildly okay with not exact matches"; } done-testing;
### ---------------------------------------------------- ### -- Acme::Skynet ### -- Licenses: ### -- Authors: KM Wallio ### -- File: t/dtree.t ### ---------------------------------------------------- use v6; use lib 'lib'; use Test; use Acme::Skynet::ID3; plan 28; use-ok 'Acme::Skynet::ID3'; # Tree with 1 label { my @labels = "A", "B", "C"; my @features = "D", "E", "F"; class SameSame does Featurized { method getFeature($feature) { return "H"; } method getLabel() { return "B"; } } my $ID = ID3Tree.new(); $ID.setFeatures(@features); $ID.setLabels(@labels); for [0..10] -> $i { $ID.addItem(SameSame.new()); } $ID.learn(); ok $ID.get(SameSame.new()) eq "B", "All same label"; } # 2 labels, 1 feature { my @label = "even", "odd"; my @feature = "mod2"; class FeatNum does Featurized { has $.value; method new($value){ self.bless(:$value); } method getFeature($feature) { return ($.value % 2 == 0); } method getLabel() { return (($.value %2 == 0)) ?? "even" !! "odd"; } } my $EO = ID3Tree.new(); $EO.setFeatures(@feature); $EO.setLabels(@label); for [1..10] -> $num { $EO.addItem(FeatNum.new($num)); } $EO.learn(); ok $EO.get(FeatNum.new(100)) eq "even", "100 is even"; ok $EO.get(FeatNum.new(99)) eq "odd", "99 is odd"; } # Multiple layer tree with 3 labels { my @labels = "botheven", "bothodd", "what"; my @features = "one", "two"; class TwoNums does Featurized { has $.one; has $.two; method new($one, $two){ self.bless(:$one, :$two); } method getFeature($feature) { return ($feature eq "one") ?? ($.one % 2 == 0) !! ($.two % 2 == 0); } method getLabel() { if ($.one % 2 == 0 && $.two % 2 == 0) { return "botheven"; } elsif ($.one % 2 == 1 && $.two % 2 == 1) { return "bothodd"; } else { return "what"; } } } my $TW = ID3Tree.new(); $TW.setFeatures(@features); $TW.setLabels(@labels); for [1..10] -> $o { for [1..10] -> $t { $TW.addItem(TwoNums.new($o, $t)); } } $TW.learn(); #die $TW.dumpTree(); for [15..20] -> $o { for [11..14] -> $t { my $lb; if ($o % 2 == 0 && $t % 2 == 0) { $lb = "botheven"; } elsif ($o % 2 == 1 && $t % 2 == 1) { $lb = "bothodd"; } else { $lb = "what"; } ok $TW.get(TwoNums.new($o, $t)) eq $lb, $o ~ " and " ~ $t ~ " are " ~ $lb; } } } done-testing;
### ---------------------------------------------------- ### -- Acme::Skynet ### -- Licenses: ### -- Authors: KM Wallio ### -- File: t/intent.t ### ---------------------------------------------------- use v6; use lib 'lib'; use Test; use Acme::Skynet; my $robotOverlord = Intent.new(); plan 10; class Wanted { has $.route; has @.args; method new($route, @args) { self.bless(:$route, :@args); } } my $callCount = 0; my $unique = sub () { $callCount++; ok $callCount == 1, "Unique should only be called once"; } $robotOverlord.addKnowledge("unique", $unique); my $time = sub ($context) { ok $context.route eq "time", "Wanted time, got time"; } # Route commands to actions. $robotOverlord.addKnowledge("what time is it", $time); $robotOverlord.addKnowledge("current time", $time); $robotOverlord.addKnowledge("time please", $time); my $stab = sub (@args, $context) { ok $context.route eq "stab", "Wanted stab, got stab"; for @args Z $context.args -> ($got, $expected) { ok $got eq $expected, $got ~ " should equal " ~ $expected; } } # Basic support for commands with arguments $robotOverlord.addKnowledge("stab john -> john", $stab); $robotOverlord.addKnowledge("stab mike -> mike", $stab); $robotOverlord.addKnowledge("stuart deserves to be stabbed -> stuart", $stab); $robotOverlord.addKnowledge("stuart should get stabbed -> stuart", $stab); my $reminders = sub (@args, $context) { ok $context.route eq "reminders", "Wanted reminders, got reminders"; for @args Z $context.args -> ($got, $expected) { ok $got eq $expected, $got ~ " should equal " ~ $expected; } } $robotOverlord.addKnowledge("remind me at 7 to strech -> 7, strech", $reminders); $robotOverlord.addKnowledge("at 6 pm remind me to shower -> 6 pm, shower", $reminders); $robotOverlord.addKnowledge("remind me to run at the robot apocalypse -> the robot apocalypse, run", $reminders); # Perform some training and learning $robotOverlord.meditate(); # Provide some input $robotOverlord.hears("unique"); my $stabVictim = Wanted.new("stab", ("miles",)); $robotOverlord.hears("stab miles", $stabVictim); my $timeVictim = Wanted.new("time", ()); $robotOverlord.hears("what is the time", $timeVictim); my $remindersVictim = Wanted.new("reminders", ("the zombie apobalypse","hide")); $robotOverlord.hears("please remind me to hide at the zombie apobalypse", $remindersVictim); $robotOverlord.hears("please remind me at the zombie apobalypse to hide", $remindersVictim); done-testing;
### ---------------------------------------------------- ### -- Acme::Skynet ### -- Licenses: ### -- Authors: KM Wallio ### -- File: examples/stabbing_reminders.p6 ### ---------------------------------------------------- use v6; use lib 'lib'; use Acme::Skynet; my $robotOverlord = Intent.new(); my $time = sub () { my $time = DateTime.now(); say sprintf "It is currently %d:%02d", $time.hour, $time.minute; } # Route commands to actions. $robotOverlord.add($time, "what time is it"); $robotOverlord.add($time, "current time"); $robotOverlord.add($time, "time please"); my $stab = sub (@args) { say "Stabbed @args[0]"; } # Basic support for commands with arguments $robotOverlord.add($stab, "stab john", "john"); $robotOverlord.add($stab, "stab mike", "mike"); $robotOverlord.addKnowledge("stuart deserves to be stabbed -> stuart", $stab); $robotOverlord.addKnowledge("stuart should get stabbed -> stuart", $stab); my $reminders = sub (@args) { say "Will remind you to '" ~ @args[1] ~ "' at '" ~ @args[0] ~ "'"; } $robotOverlord.add($reminders, "remind me at 7 to strech", "7", "strech"); $robotOverlord.add($reminders, "at 6 pm remind me to shower", "6 pm", "shower"); $robotOverlord.addKnowledge("remind me to run at the robot apocalypse -> the robot apocalypse, run", $reminders); # Perform some training and learning $robotOverlord.meditate(); # Provide some input $robotOverlord.hears("stab miles"); # Expected output: "Stabbed carlos" $robotOverlord.hears("what is the time"); # Expected output: the time $robotOverlord.hears("please remind me to hide at the zombie apocalypse"); $robotOverlord.hears("please remind me at the zombie apocalypse to hide");
### ---------------------------------------------------- ### -- Acme::Sudoku ### -- Licenses: ### -- Authors: github:pierre-vigier ### -- File: META6.json ### ---------------------------------------------------- { "perl" : "6.c", "name" : "Acme::Sudoku", "version" : "0.0.2", "authors" : [ "github:pierre-vigier" ], "description" : "Simple Sudoku solver", "depends" : [ "Terminal::ANSIColor" ], "provides" : { "Acme::Sudoku" : "lib/Acme/Sudoku.pm6" }, "source-url" : "git://github.com/pierre-vigier/Perl6-Acme-Sudoku.git" }
### ---------------------------------------------------- ### -- Acme::Sudoku ### -- Licenses: ### -- Authors: github:pierre-vigier ### -- File: README.md ### ---------------------------------------------------- # Perl6-Acme::Sudoku [![Build Status](https://travis-ci.org/pierre-vigier/Perl6-Acme-Sudoku.svg?branch=master)](https://travis-ci.org/pierre-vigier/Perl6-Acme-Sudoku) NAME ==== Acme::Sudoku SYNOPSIS ======== Simple sudoku solver, keeping the Sudoku namespace clean, as it will use really naive algorithm DESCRIPTION =========== This module provides a naive sudoku solver use Acme::Sudoku; my $game = Acme::Sudoku.new( q:to/END/ ); . . . . . 8 . . . 7 . . . . . 9 . 5 . 1 4 . 3 5 8 . . . 2 . . 1 6 . 3 . . 5 . . . 9 6 . 1 8 . . . . . . . 4 3 . 9 2 . . 1 . . . . 6 1 . 7 . . 2 1 . . 5 . . . 7 . END $game.solve; say $game; The only algorithm implemented now is for each case, looking for missing value in row/column/square. If we can reduce the missing set to 1 element, case is filled. That algorithm does not enusre the finding of a solution, and works only for extremly easy sudoku grid.
### ---------------------------------------------------- ### -- Acme::Sudoku ### -- Licenses: ### -- Authors: github:pierre-vigier ### -- File: .travis.yml ### ---------------------------------------------------- language: perl6 perl6: - latest install: - rakudobrew build zef - zef install --deps-only . - zef install Test::META script: - PERL6_TEST_META=1 PERL6LIB=$PWD/lib prove --exec perl6 -r t/ sudo: false
### ---------------------------------------------------- ### -- Acme::Sudoku ### -- Licenses: ### -- Authors: github:pierre-vigier ### -- File: t/020-basic.t ### ---------------------------------------------------- use v6; use Test; use Acme::Sudoku; plan 3; my $ok-grid = q:to/END/; . . . . . 8 . . . 7 . . . . . 9 . 5 . 1 4 . 3 5 8 . . . 2 . . 1 6 . 3 . . 5 . . . 9 6 . 1 8 . . . . . . . 4 3 . 9 2 . . 1 . . . . 6 1 . 7 . . 2 1 . . 5 . . . 7 . END my $non-parsable-grid = q:to/END/; 1 2 3 4 5 4 3 2 END my $match = Acme::Sudoku::SudokuGrid.parse( $non-parsable-grid ); nok so $match, "Can't parse a wrong size grid"; $match = Acme::Sudoku::SudokuGrid.parse( $ok-grid ); ok so $match, "Can parse a valid grid"; my $game = Acme::Sudoku.new( $ok-grid ); my $solution = Acme::Sudoku.new( q:to/END/ ); 6 9 5 7 4 8 2 1 3 7 3 8 6 2 1 9 4 5 2 1 4 9 3 5 8 6 7 9 2 7 4 1 6 5 3 8 4 5 3 8 7 9 6 2 1 8 6 1 3 5 2 7 9 4 3 7 9 2 8 4 1 5 6 5 4 6 1 9 7 3 8 2 1 8 2 5 6 3 4 7 9 END $game.solve(); ok $game ~~ $solution, "Solve found the correct solution";
### ---------------------------------------------------- ### -- Acme::Sudoku ### -- Licenses: ### -- Authors: github:pierre-vigier ### -- File: t/030-medium.t ### ---------------------------------------------------- use v6; use Test; use Acme::Sudoku; plan 1; my $game = Acme::Sudoku.new( q:to/END/ ); 2 . . 1 7 . 6 . 3 . 5 . . . . 1 . . . . . . . 6 . 7 9 . . . . 4 . 7 . . . . . 8 . 1 . . . . . 9 . 5 . . . . 3 1 . 4 . . . . . . . 5 . . . . 6 . 9 . 6 . 3 7 . . 2 END $game.solve; my $solution = Acme::Sudoku.new( q:to/END/ ); 2 9 8 1 7 5 6 4 3 6 5 7 3 9 4 1 2 8 1 3 4 2 8 6 5 7 9 8 2 1 6 4 9 7 3 5 5 7 3 8 2 1 4 9 6 4 6 9 7 5 3 2 8 1 3 1 2 4 6 8 9 5 7 7 8 5 9 1 2 3 6 4 9 4 6 5 3 7 8 1 2 END ok $game ~~ $solution, "Solution is correct"; say $game; #say "Elapsed : "; #say now - BEGIN { now };
### ---------------------------------------------------- ### -- Acme::Sudoku ### -- Licenses: ### -- Authors: github:pierre-vigier ### -- File: t/010-load.t ### ---------------------------------------------------- use Test; plan 1; use-ok('Acme::Sudoku');
### ---------------------------------------------------- ### -- Acme::Test::Module ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: META6.json ### ---------------------------------------------------- { "auth": "zef:skaji", "authors": [ "Shoichi Kaji" ], "build-depends": [ ], "depends": [ ], "description": "a test module", "license": "Artistic-2.0", "name": "Acme::Test::Module", "perl": "6.d", "provides": { "Acme::Test::Module": "lib/Acme/Test/Module.rakumod" }, "resources": [ ], "source-url": "https://github.com/skaji/raku-Acme-Test-Module.git", "tags": [ ], "test-depends": [ ], "version": "1.0.4" }
### ---------------------------------------------------- ### -- Acme::Test::Module ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Acme::Test::Module ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: README.md ### ---------------------------------------------------- [![Actions Status](https://github.com/skaji/raku-Acme-Test-Module/actions/workflows/test.yml/badge.svg)](https://github.com/skaji/raku-Acme-Test-Module/actions) NAME ==== Acme::Test::Module - a test module SYNOPSIS ======== ```raku use Acme::Test::Module; ``` DESCRIPTION =========== Acme::Test::Module is a test module. AUTHOR ====== Shoichi Kaji <[email protected]> COPYRIGHT AND LICENSE ===================== Copyright 2020 Shoichi Kaji This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
### ---------------------------------------------------- ### -- Acme::Test::Module ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: dist.ini ### ---------------------------------------------------- name = Acme-Test-Module [ReadmeFromPod] ; enable = false filename = lib/Acme/Test/Module.rakumod [UploadToZef] [PruneFiles] ; match = ^ 'xt/' [Badges] provider = github-actions/test.yml
### ---------------------------------------------------- ### -- Acme::Test::Module ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: t/01-basic.rakutest ### ---------------------------------------------------- use Test; use Acme::Test::Module; pass "replace me"; done-testing;
### ---------------------------------------------------- ### -- Acme::Test::Module ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: lib/Acme/Test/Module.rakumod ### ---------------------------------------------------- unit class Acme::Test::Module; =begin pod =head1 NAME Acme::Test::Module - a test module =head1 SYNOPSIS =begin code :lang<raku> use Acme::Test::Module; =end code =head1 DESCRIPTION Acme::Test::Module is a test module. =head1 AUTHOR Shoichi Kaji <[email protected]> =head1 COPYRIGHT AND LICENSE Copyright 2020 Shoichi Kaji This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. =end pod
### ---------------------------------------------------- ### -- Acme::Test::Module::Zef ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: META6.json ### ---------------------------------------------------- { "auth": "zef:skaji", "authors": [ "Shoichi Kaji" ], "build-depends": [ ], "depends": [ ], "description": "blah blah blah", "license": "Artistic-2.0", "name": "Acme::Test::Module::Zef", "perl": "6.d", "provides": { "Acme::Test::Module::Zef": "lib/Acme/Test/Module/Zef.rakumod", "Acme::Test::Module::Zef2": "lib/Acme/Test/Module/Zef2.rakumod" }, "resources": [ ], "source-url": "https://github.com/skaji/raku-Acme-Test-Module-Zef.git", "tags": [ ], "test-depends": [ ], "version": "0.0.5" }
### ---------------------------------------------------- ### -- Acme::Test::Module::Zef ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Acme::Test::Module::Zef ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: CHANGELOG.md ### ---------------------------------------------------- ## Unreleased ## 0.0.5 - 2022-03-17T23:33:54+09:00 - Use CHANGELOG.md ## 0.0.4 - 2021-12-03T00:22:51+09:00 - test version ## 0.0.3 - 2021-12-01T23:10:52+09:00 - Initial version
### ---------------------------------------------------- ### -- Acme::Test::Module::Zef ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: README.md ### ---------------------------------------------------- [![Actions Status](https://github.com/skaji/raku-Acme-Test-Module-Zef/actions/workflows/test.yml/badge.svg)](https://github.com/skaji/raku-Acme-Test-Module-Zef/actions) NAME ==== Acme::Test::Module::Zef - blah blah blah SYNOPSIS ======== ```raku use Acme::Test::Module::Zef; ``` DESCRIPTION =========== Acme::Test::Module::Zef is ... AUTHOR ====== Shoichi Kaji <[email protected]> COPYRIGHT AND LICENSE ===================== Copyright 2021 Shoichi Kaji This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
### ---------------------------------------------------- ### -- Acme::Test::Module::Zef ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: dist.ini ### ---------------------------------------------------- name = Acme-Test-Module-Zef [ReadmeFromPod] ; enable = false filename = lib/Acme/Test/Module/Zef.rakumod [UploadToZef] [PruneFiles] ; match = ^ 'xt/' [Badges] provider = github-actions/test.yml
### ---------------------------------------------------- ### -- Acme::Test::Module::Zef ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: t/01-basic.rakutest ### ---------------------------------------------------- use Test; use Acme::Test::Module::Zef; pass "replace me"; my $proc1 = run "zef", "--version"; say $proc1; my $proc2 = run "cmd.exe", "/x/d/c", "zef", "--version"; say $proc2; done-testing;
### ---------------------------------------------------- ### -- Acme::Test::Module::Zef ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: lib/Acme/Test/Module/Zef.rakumod ### ---------------------------------------------------- unit class Acme::Test::Module::Zef; use Acme::Test::Module::Zef2; =begin pod =head1 NAME Acme::Test::Module::Zef - blah blah blah =head1 SYNOPSIS =begin code :lang<raku> use Acme::Test::Module::Zef; =end code =head1 DESCRIPTION Acme::Test::Module::Zef is ... =head1 AUTHOR Shoichi Kaji <[email protected]> =head1 COPYRIGHT AND LICENSE Copyright 2021 Shoichi Kaji This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. =end pod
### ---------------------------------------------------- ### -- Acme::Test::Module::Zef ### -- Licenses: Artistic-2.0 ### -- Authors: Shoichi Kaji ### -- File: lib/Acme/Test/Module/Zef2.rakumod ### ---------------------------------------------------- unit class Acme::Test::Module::Zef2;
### ---------------------------------------------------- ### -- Acme::Text::UpsideDown ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: META6.json ### ---------------------------------------------------- { "api": "perl6", "auth": "zef:lizmat", "authors": [ "Elizabeth Mattijsen" ], "build-depends": [ ], "depends": [ ], "description": "provide logic to turn ASCII text upside-down", "license": "Artistic-2.0", "name": "Acme::Text::UpsideDown", "perl": "6.c", "provides": { "Acme::Text::UpsideDown": "lib/Acme/Text/UpsideDown.rakumod" }, "resources": [ ], "source-url": "https://github.com/lizmat/Acme-Text-UpsideDown.git", "tags": [ "TEXT", "NMO◖Ǝ◖ISԀᑎ" ], "test-depends": [ ], "version": "0.0.9" }
### ---------------------------------------------------- ### -- Acme::Text::UpsideDown ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Acme::Text::UpsideDown ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: README.md ### ---------------------------------------------------- [![Actions Status](https://github.com/lizmat/Acme-Text-UpsideDown/actions/workflows/linux.yml/badge.svg)](https://github.com/lizmat/Acme-Text-UpsideDown/actions) [![Actions Status](https://github.com/lizmat/Acme-Text-UpsideDown/actions/workflows/macos.yml/badge.svg)](https://github.com/lizmat/Acme-Text-UpsideDown/actions) [![Actions Status](https://github.com/lizmat/Acme-Text-UpsideDown/actions/workflows/windows.yml/badge.svg)](https://github.com/lizmat/Acme-Text-UpsideDown/actions) NAME ==== Acme::Text::UpsideDown - provide logic to turn ASCII text upside-down SYNOPSIS ======== ```raku use Acme::Text::UpsideDown; say upsidedown "The quick brown fox jumps over the lazy dog"; # ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥ say uʍopǝpᴉsdn "ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥"; # The quick brown fox jumps over the lazy Dog ``` DESCRIPTION =========== Acme::Text::UpsideDown provides two subroutines that can be used to create strings from ASCII texts for upside-down reading. Inspired by the Perl version called Acme::Text::Viceversa. SUBROUTINES =========== upsidedown ---------- ```raku say upsidedown "The quick brown fox jumps over the lazy dog"; # ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥ say upsidedown "ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥"; # The quick brown fox jumps over the lazy dog ``` Return the string that allows reading of the given ASCII string upside-down, and vice-versa. uʍopǝpᴉsdn ---------- ```raku say uʍopǝpᴉsdn "ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥"; # The quick brown fox jumps over the lazy dog say uʍopǝpᴉsdn "The quick brown fox jumps over the lazy dog"; # ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥ ``` Return the string that allows normal reading of a previously upside-downed string, and vice-versa. Basically a fun alias for `upsidedown`. COMMAND LINE INTERFACE ====================== This module also installs a `ud` script for easy upsidedowning of text. When called without any parameters, it will read from STDIN and print the upsidedowned text on STDOUT. When called with a single parameter that indicates an existing file, then it will read that file and print the upsidedowned text on STDOUT. In all other cases, the command line parameters will be joined together with a space, and then printed upsidedowned on STDOUT. AUTHOR ====== Elizabeth Mattijsen <[email protected]> Source can be located at: https://github.com/lizmat/Acme-Text-UpsideDown . Comments and Pull Requests are welcome. If you like this module, or what I’m doing more generally, committing to a [small sponsorship](https://github.com/sponsors/lizmat/) would mean a great deal to me! COPYRIGHT AND LICENSE ===================== Original Perl version of Acme::Text::Viceversa: Copyright 2019 吉田勇気, Raku re-imagining: Copyright 2019, 2021, 2024, 2025 Elizabeth Mattijsen Some additional character mappings taken from [https://github.com/mcsnolte/Text-UpsideDown](https://github.com/mcsnolte/Text-UpsideDown). This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
### ---------------------------------------------------- ### -- Acme::Text::UpsideDown ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: dist.ini ### ---------------------------------------------------- name = Acme-Text-UpsideDown [ReadmeFromPod] ; enable = false filename = doc/Acme-Text-UpsideDown.rakudoc [PruneFiles] ; match = ^ 'xt/' [Badges] provider = github-actions/linux.yml provider = github-actions/macos.yml provider = github-actions/windows.yml [UploadToZef]
### ---------------------------------------------------- ### -- Acme::Text::UpsideDown ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: t/01-basic.rakutest ### ---------------------------------------------------- use Test; use Acme::Text::UpsideDown; plan 7; is upsidedown( "The quick brown fox jumps over the lazy dog 🙂"), "🙃 ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥", 'did ASCII text get rotated'; is uʍopǝpᴉsdn( "🙃 ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥"), "The quick brown fox jumps over the lazy dog 🙂", 'did rotated text rotate back ok'; is upsidedown( Q/!"&'(),.;<>?][_`{}⁅⁆∵∴⁀‿/), Q/¡„⅋͵)(‘˙⋅̕><¿[]‾ ̖}{⁆⁅∴∵‿⁀/.flip, 'did additional non alpha characters go upsidedown'; is upsidedown("The quick brown fox jumps over the lazy dog").words.join("\n"), "ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥", 'did ASCII multi-line text get rotated'; is uʍopǝpᴉsdn("ɓop ʎzɐꞁ ǝɥʇ ɹǝʌo sdɯnſ̣ xoɟ uʍoɹq ʞɔᴉnb ǝɥ⊥").words.join("\n"), "The quick brown fox jumps over the lazy dog", 'did rotated multi-line text rotate back ok'; is upsidedown(upsidedown( "The quick brown fox jumps over the lazy dog")), "The quick brown fox jumps over the lazy dog", 'did ASCII text get rotated back again when done twice'; is upsidedown(upsidedown( Q/!"&'(),.;<>?][_`{}⁅⁆∵∴⁀‿/)), Q/!"&'(),.;<>?][_`{}⁅⁆∵∴⁀‿/, 'did non alpha characters come back again when done twice'; # vim: expandtab shiftwidth=4
### ---------------------------------------------------- ### -- Acme::Text::UpsideDown ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: xt/coverage.rakutest ### ---------------------------------------------------- use Test::Coverage; plan 2; coverage-at-least 100/3; uncovered-at-most 4; source-with-coverage; report; # vim: expandtab shiftwidth=4
### ---------------------------------------------------- ### -- Acme::Text::UpsideDown ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: lib/Acme/Text/UpsideDown.rakumod ### ---------------------------------------------------- my constant $up = Q「*!"&'(),.12345679;<>?ABCDEFGJKLMNPQRTUVWY][^_`abcdefghijklmnpqrtuvwy{}⁅⁆∵∴⁀‿🙂」; my constant $down = Q「⁎¡„⅋͵)(‘˙⇂ᘔε⇁⃓ᔕ9L6⋅̕><¿∀ᗺↃ◖ƎℲ⅁ᒋ丬ᒣWᴎԀΌȢ⊥ᑎΛM⅄[]‿‾ ̖ɐqɔpǝɟɓɥᴉſ̣ʞꞁɯudbɹʇnʌʍʎ}{⁆⁅∴∵‿⁀🙃」; my constant $from = $up ~ $down; my constant $to = $down ~ $up; my sub upsidedown(Str:D $string) is export { $string.lines.map( *.trans( $from => $to ).flip ).reverse.join("\n") } my constant &uʍopǝpᴉsdn is export = &upsidedown; # vim: expandtab shiftwidth=4
### ---------------------------------------------------- ### -- Actor ### -- Licenses: Artistic-2.0 ### -- Authors: Leon Timmermans ### -- File: META6.json ### ---------------------------------------------------- { "auth" : "cpan:LEONT", "authors" : [ "Leon Timmermans" ], "build-depends" : [ ], "depends" : [ ], "description" : "an actor model threading library", "license" : "Artistic-2.0", "name" : "Actor", "perl" : "6.d", "provides" : { "Actor" : "lib/Actor.rakumod" }, "resources" : [ ], "source-url" : "https://github.com/Leont/raku-actor.git", "tags" : [ ], "test-depends" : [ ], "version" : "0.0.1" }
### ---------------------------------------------------- ### -- Actor ### -- Licenses: Artistic-2.0 ### -- Authors: Leon Timmermans ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Actor ### -- Licenses: Artistic-2.0 ### -- Authors: Leon Timmermans ### -- File: README.md ### ---------------------------------------------------- [![Build Status](https://travis-ci.org/Leont/raku-actor.svg?branch=master)](https://travis-ci.org/Leont/raku-actor) NAME ==== Actor - an actor model threading library SYNOPSIS ======== ```raku use v6.d; use Actor; my $actor = spawn { receive-loop -> Str $message, Actor::Handle $other { say "Message $message"; $other.send($message); }, -> Int :$number, Str :$message { say "Message $message" if $number %% 7; }, -> "stop" { last; }; } $actor.send("message", self-handle); receive -> Str $message { $actor.send(:42number, :$message); $actor.send("stop"); }; await $actor; ``` DESCRIPTION =========== Actor is a module that implements actor model threading for Raku. actors are … INTERFACE ========= module Actor ------------ ### spawn(&starter, *@args, Bool :$monitored --> Handle:D) This starts a new actor that calls `&starter` with `@args` as its arguments, and returns a handle to that actor. If `$monitored` is true, it will also set up a monitor from the new actor to the current one. ### receive(*@handlers --> Nil) This will loop through the messages in the queue, and for each message will try to match it in turn to each of the `@handlers` passed to it. If it matches it is taken from the queue and the handler is called with it. Then `receive` returns. If no such matching message exists, it will wait for a new message to arrive that does match a handler, pushing any non-matching messages to the queue. ### receive-loop(*@handlers --> Nil) This will call receive in a loop with the given handlers, until one of the handlers calls `last`. ### self-handle(--> Handle:D) This returns a handle to the current actor. class Actor::Handle ------------------- This class represents a handle to an actor ### send(|message --> Nil) This will send `|message` to that actor. ### alive(--> Bool:D) This returns true if the actor is still alive. ### add-monitor(handle = self-handle --> Handle::MonitorId) This sets up a monitor relationship from the invocant handle to the one passed to `add-monitor` (defaulting to the current handle) ### remove-monitor(Handle::MonitorId $monitor) This removes a monitor from the monitor list of this actor. monitors -------- Monitors are watchers on an actor's status. If the actor ends successfully, a message like this is sent: (Actor::Exit, $handle, $return-value) If it dies in an exception, the follow message is sent to the monitoring actor instead. (Actor::Error, $handle, $exception) AUTHOR ====== Leon Timmermans <[email protected]> COPYRIGHT AND LICENSE ===================== Copyright 2020 Leon Timmermans This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
### ---------------------------------------------------- ### -- Actor ### -- Licenses: Artistic-2.0 ### -- Authors: Leon Timmermans ### -- File: .travis.yml ### ---------------------------------------------------- os: - linux - osx language: perl6 perl6: - latest install: - rakudobrew build zef - zef install --deps-only --/test . script: - PERL6LIB=$PWD/lib prove -e perl6 -vr t/ sudo: false
### ---------------------------------------------------- ### -- Actor ### -- Licenses: Artistic-2.0 ### -- Authors: Leon Timmermans ### -- File: dist.ini ### ---------------------------------------------------- name = Actor [ReadmeFromPod] ; enable = false filename = lib/Actor.rakumod [PruneFiles] ; match = ^ 'xt/'
### ---------------------------------------------------- ### -- Actor ### -- Licenses: Artistic-2.0 ### -- Authors: Leon Timmermans ### -- File: t/01-basic.t ### ---------------------------------------------------- use v6.d; use Test; use Actor; my $thread = spawn { receive -> $other { $other.send(:foo); $other.send('bar'); }; 42; }, :monitored; ok($thread.alive, 'Created thread'); $thread.send(self-handle); is(self-handle, self-handle, 'Two handles to the same actor are equal'); my $state = 0; receive-loop -> Exit, $identifier, $result { is($result, 42, 'Got right result'); is($identifier, $thread, 'Got the right thread'); is($state++, 1, 'State is now 1'); leave-loop; }, -> Error, $identifier, $error { note($error); flunk('Got right result'); is($state++, 1, 'State is now 1'); leave-loop; }, -> 'bar' { is($state++, 0, 'Received bar'); receive -> 'bar' { flunk('Should match foo after bar'); diag('Matched bar instead') }, -> :$foo { ok($foo, 'Should match foo after bar'); } }; await $thread; done-testing;
### ---------------------------------------------------- ### -- Actor ### -- Licenses: Artistic-2.0 ### -- Authors: Leon Timmermans ### -- File: examples/chameneos.raku ### ---------------------------------------------------- use v6.d; use Actor; sub spell(Int $n --> Str) { state @names = <zero one two three four five six seven eight nine>; my Str $next = @names[$n % 10]; return $n >= 10 ?? spell(($n / 10).Int) ~ " " ~ $next !! $next; } enum Color <blue red yellow>; my @table = ( [ blue, yellow, red ], [ yellow, red, blue ], [ red, blue, yellow ], ); sub show-complements() { for (blue, red, yellow) -> $i { for (blue, red, yellow) -> $j { say "$i + $j -> ", @table[$i][$j]; } } } sub print-header(@colors) { say ""; for @colors -> $color { print " $color"; } say ""; } sub broker(Int $meetings-count) { my Int $seen = 0; receive-loop -> Actor::Handle $handle-left, Color $color-left { receive -> Actor::Handle $handle-right, Color $color-right { $handle-left.send($handle-right, $color-right); $handle-right.send($handle-left, $color-left); leave-loop if ++$seen == $meetings-count; }; }; } class Stop {} sub cleanup(Int(Cool) $color-count is copy) { my Int $summary = 0; receive-loop -> Actor::Handle $other, Color $ { $other.send(Stop); }, -> Int $mismatch { $summary += $mismatch; if --$color-count == 0 { say spell($summary); leave-loop; } } } sub chameneos(Color $current is copy, Actor::Handle $broker) { my ($meetings, $met-self) = 0, 0; my $self = self-handle; $broker.send($self, $current); receive-loop -> Actor::Handle $other, Color $color { $meetings++; $current = @table[$current][$color]; $met-self++ if $other === $self; $broker.send($self, $current); }, -> Stop $ { say "$meetings {spell($met-self)}"; $broker.send($meetings); last; } } sub run(@colors, Int $count) { print-header(@colors); my $broker = spawn { broker($count); cleanup(@colors); } for @colors -> $color { spawn(-> { chameneos($color, $broker) }); } return $broker; } sub MAIN(Int $count = 10000) { show-complements(); await run([ blue, red, yellow ], $count); await run([ blue, red, yellow, red, yellow, blue, red, yellow, red, blue ], $count); say ""; }
### ---------------------------------------------------- ### -- Actor ### -- Licenses: Artistic-2.0 ### -- Authors: Leon Timmermans ### -- File: lib/Actor.rakumod ### ---------------------------------------------------- use v6.c; unit module Actor:ver<0.0.1>:auth<cpan:LEONT>; enum Result is export(:DEFAULT, :enums) <Exit Error>; class Handle { ... } my class Stop is Exception { } my class Mailbox { has Channel:D $!channel = Channel.new; has Promise:D $.promise = Promise.new; has Handle:D %!monitors; has Lock:D $!lock = Lock.new; has @!status; has Capture @!buffer; my class MonitorId { my atomicint $counter = 0; has Int $!id = $counter⚛++; method WHICH() { return $!id.WHICH; } } multi submethod BUILD() { } multi submethod BUILD(:&starter!, :$monitor!, :@args) { $!channel = Channel.new; $!promise = start { my $*RECEIVER = self; LEAVE { $!channel.close; Nil while $!channel.poll; } starter(|@args); } %!monitors{MonitorId.new} = $monitor with $monitor; $!promise.then: { $!lock.protect: { @!status = $!promise.status === Kept ?? (Exit, self.handle, $!promise.result) !! (Error, self.handle, $!promise.cause); for %!monitors.values -> $monitor { $monitor.send: |@!status; } } } } method send(Capture $value) { $!channel.send($value); CATCH { when X::Channel::SendOnClosed { }} } method receive(@blocks --> Any) { for ^@!buffer -> $index { my Capture $message = @!buffer[$index]; for @blocks -> &candidate { if $message ~~ &candidate.signature { @!buffer.splice($index, 1); return candidate(|$message); } } } loop { my Capture $message = $!channel.receive; for @blocks -> &candidate { return candidate(|$message) if $message ~~ &candidate.signature; } @!buffer.push: $message; } } method receive-loop(@blocks --> Any) { loop { receive(@blocks); } CATCH { when Stop { return; }} } method handle(--> Handle:D) { return Handle.new(:mailbox(self)); } method add-monitor(Handle:D $handle --> MonitorId:D) { $!lock.protect: { my $id = MonitorId.new; if $!promise { $handle.send: |@!status; } else { %!monitors{$id} = $handle; } return $id; } } method remove-monitor(MonitorId:D $id --> Nil) { $!lock.protect: { return ?%!monitors{$id}:delete; } } } my $loading-thread = $*THREAD; my $initial-receiver = Mailbox.new; my sub receiver() { return $*THREAD === $loading-thread ?? $initial-receiver !! $*RECEIVER // die "This thread has no receiver"; } class Handle does Awaitable { has Mailbox:D $!mailbox is required; submethod BUILD(Mailbox:D :$!mailbox) {} method send(|arguments --> Nil) { $!mailbox.send(arguments); } method get-await-handle(--> Awaitable::Handle:D) { return $!mailbox.promise.get-await-handle; } method alive(--> Bool:D) { return not $!mailbox.promise; } method add-monitor(Handle:D $handle = receiver.handle) { $!mailbox.add-monitor: $handle; } method WHICH(--> ObjAt:D) { return $!mailbox.WHICH; } method Str() { return $!mailbox.WHICH.Str.subst(/Mailbox/, 'Handle'); } } sub spawn(&starter, *@args, Bool :$monitored --> Handle:D) is export(:DEFAULT, :spawn, :functions) { my Handle $monitor = $monitored ?? receiver.handle !! Handle; my Mailbox $mailbox = Mailbox.new(:$monitor, :&starter, :@args); return Handle.new(:$mailbox); } sub receive(*@blocks --> Nil) is export(:DEFAULT, :receive, :functions) { receiver.receive(@blocks); } sub receive-loop(*@blocks --> Nil) is export(:DEFAULT, :receive, :functions) { receiver.receive-loop(@blocks); } sub self-handle(--> Handle:D) is export(:DEFAULT, :self-handle, :functions) { return receiver.handle; } sub leave-loop(--> Nil) is export(:DEFAULT, :leave-loop, :functions) { Stop.new.throw; } =begin pod =head1 NAME Actor - an actor model threading library =head1 SYNOPSIS =begin code :lang<raku> use v6.d; use Actor; my $actor = spawn { receive-loop -> Str $message, Actor::Handle $other { say "Message $message"; $other.send($message); }, -> Int :$number, Str :$message { say "Message $message" if $number %% 7; }, -> "stop" { last; }; } $actor.send("message", self-handle); receive -> Str $message { $actor.send(:42number, :$message); $actor.send("stop"); }; await $actor; =end code =head1 DESCRIPTION Actor is a module that implements actor model threading for Raku. actors are … =head1 INTERFACE =head2 module Actor =head3 spawn(&starter, *@args, Bool :$monitored --> Handle:D) This starts a new actor that calls C<&starter> with C<@args> as its arguments, and returns a handle to that actor. If C<$monitored> is true, it will also set up a monitor from the new actor to the current one. =head3 receive(*@handlers --> Nil) This will loop through the messages in the queue, and for each message will try to match it in turn to each of the C<@handlers> passed to it. If it matches it is taken from the queue and the handler is called with it. Then C<receive> returns. If no such matching message exists, it will wait for a new message to arrive that does match a handler, pushing any non-matching messages to the queue. =head3 receive-loop(*@handlers --> Nil) This will call receive in a loop with the given handlers, until one of the handlers calls C<last>. =head3 self-handle(--> Handle:D) This returns a handle to the current actor. =head2 class Actor::Handle This class represents a handle to an actor =head3 send(|message --> Nil) This will send C<|message> to that actor. =head3 alive(--> Bool:D) This returns true if the actor is still alive. =head3 add-monitor(handle = self-handle --> Handle::MonitorId) This sets up a monitor relationship from the invocant handle to the one passed to C<add-monitor> (defaulting to the current handle) =head3 remove-monitor(Handle::MonitorId $monitor) This removes a monitor from the monitor list of this actor. =head2 monitors Monitors are watchers on an actor's status. If the actor ends successfully, a message like this is sent: (Actor::Exit, $handle, $return-value) If it dies in an exception, the follow message is sent to the monitoring actor instead. (Actor::Error, $handle, $exception) =head1 AUTHOR Leon Timmermans <[email protected]> =head1 COPYRIGHT AND LICENSE Copyright 2020 Leon Timmermans This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. =end pod
### ---------------------------------------------------- ### -- Adverb::Eject ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: META6.json ### ---------------------------------------------------- { "auth": "zef:lizmat", "authors": [ "Elizabeth Mattijsen" ], "build-depends": [ ], "depends": [ ], "description": "adverb for ejecting elements", "license": "Artistic-2.0", "name": "Adverb::Eject", "perl": "6.c", "provides": { "Adverb::Eject": "lib/Adverb/Eject.rakumod" }, "resources": [ ], "source-url": "https://github.com/lizmat/Adverb-Eject.git", "tags": [ "UTILS" ], "test-depends": [ ], "version": "0.0.4" }
### ---------------------------------------------------- ### -- Adverb::Eject ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Adverb::Eject ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: README.md ### ---------------------------------------------------- [![Actions Status](https://github.com/lizmat/Adverb-Eject/workflows/test/badge.svg)](https://github.com/lizmat/Adverb-Eject/actions) NAME ==== Adverb::Eject - adverb for ejecting elements SYNOPSIS ======== ```raku use Adverb::Eject; my @a = ^10; @a[1]:eject; # does *not* return the removed value say @a; # 0 2 3 4 5 6 7 8 9 @a[1,3,5,7]:eject; say @a; # 0 3 5 7 9 my %h = a => 42, b => 666, c => 371; %h<a>:eject; say %h; # {b => 666, c => 371}; %h<b c>:eject; say %h; # {} ``` DESCRIPTION =========== This module adds the `:eject` adverb to `postcircumfix []` and `postcircumfix { }`. It will remove the indicated elements from the object they're called on (usually an `Array` or a `Hash`) and always return `Nil`, whether something was removed or not. For `Hash`es, this is similar to the `:delete` adverb, except that it will **not** return the values that have been removed. For `Array`s, this is **also different** from the `:delete` adverb in that it will actually **remove** the indicated element from the `Array` (as opposed to just resetting the element to its pristine state). The reason that the `:eject` adverb does not return any of the removed values is because the `:delete` already does that. And for those cases where you do not need the values, the `:eject` adverb has the potential of being more efficient because it wouldn't have to do the work of producing the values. AUTHOR ====== Elizabeth Mattijsen <[email protected]> Source can be located at: https://github.com/lizmat/Adverb-Eject . Comments and Pull Requests are welcome. If you like this module, or what I’m doing more generally, committing to a [small sponsorship](https://github.com/sponsors/lizmat/) would mean a great deal to me! COPYRIGHT AND LICENSE ===================== Copyright 2018, 2021, 2024 Elizabeth Mattijsen This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
### ---------------------------------------------------- ### -- Adverb::Eject ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: dist.ini ### ---------------------------------------------------- name = Adverb-Eject [ReadmeFromPod] ; enable = false filename = lib/Adverb/Eject.rakumod [PruneFiles] ; match = ^ 'xt/' [Badges] provider = github-actions/test [UploadToZef]
### ---------------------------------------------------- ### -- Adverb::Eject ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: t/01-basic.rakutest ### ---------------------------------------------------- use v6.c; use Test; use Adverb::Eject; plan 12; my @a = ^10; is @a[1]:eject, Nil, 'did we get Nil from a single eject'; is +@a, 9, 'did the element get removed'; is @a, '0 2 3 4 5 6 7 8 9', 'did the right element get removed'; is @a[1,3,5,7]:eject, Nil, 'did we get Nil from a multi eject'; is +@a, 5, 'did the right number of elements get removed'; is @a, '0 3 5 7 9', 'did the right elements get removed'; my %h = "a" .. "j" Z=> ^10; is %h<a>:eject, Nil, 'did we get Nil from a single eject'; is +%h, 9, 'did the element get removed'; is %h.keys.sort, 'b c d e f g h i j', 'did the right element get removed'; is %h<b d f h>:eject, Nil, 'did we get Nil from a multi eject'; is +%h, 5, 'did the right number of elements get removed'; is %h.keys.sort, 'c e g i j', 'did the right elements get removed'; # vim: ft=perl6 expandtab sw=4
### ---------------------------------------------------- ### -- Adverb::Eject ### -- Licenses: Artistic-2.0 ### -- Authors: Elizabeth Mattijsen ### -- File: lib/Adverb/Eject.rakumod ### ---------------------------------------------------- multi sub postcircumfix:<[ ]>( \SELF, Int() $pos, :$eject! --> Nil) is export { SELF.splice($pos,1) if $eject; } multi sub postcircumfix:<[ ]>( \SELF, Iterable:D \pos, :$eject! --> Nil) is export { if $eject { SELF.splice($_,1) for pos.unique.sort( -* ); } } multi sub postcircumfix:<{ }>( \SELF, \key, :$eject! --> Nil) is export { SELF.DELETE-KEY(key) if $eject; } multi sub postcircumfix:<{ }>( \SELF, Iterable:D \keys, :$eject! --> Nil) is export { if $eject { SELF.DELETE-KEY($_) for keys; } } =begin pod =head1 NAME Adverb::Eject - adverb for ejecting elements =head1 SYNOPSIS =begin code :lang<raku> use Adverb::Eject; my @a = ^10; @a[1]:eject; # does *not* return the removed value say @a; # 0 2 3 4 5 6 7 8 9 @a[1,3,5,7]:eject; say @a; # 0 3 5 7 9 my %h = a => 42, b => 666, c => 371; %h<a>:eject; say %h; # {b => 666, c => 371}; %h<b c>:eject; say %h; # {} =end code =head1 DESCRIPTION This module adds the C<:eject> adverb to C<postcircumfix []> and C<postcircumfix { }>. It will remove the indicated elements from the object they're called on (usually an C<Array> or a C<Hash>) and always return C<Nil>, whether something was removed or not. For C<Hash>es, this is similar to the C<:delete> adverb, except that it will B<not> return the values that have been removed. For C<Array>s, this is B<also different> from the C<:delete> adverb in that it will actually B<remove> the indicated element from the C<Array> (as opposed to just resetting the element to its pristine state). The reason that the C<:eject> adverb does not return any of the removed values is because the C<:delete> already does that. And for those cases where you do not need the values, the C<:eject> adverb has the potential of being more efficient because it wouldn't have to do the work of producing the values. =head1 AUTHOR Elizabeth Mattijsen <[email protected]> Source can be located at: https://github.com/lizmat/Adverb-Eject . Comments and Pull Requests are welcome. If you like this module, or what I’m doing more generally, committing to a L<small sponsorship|https://github.com/sponsors/lizmat/> would mean a great deal to me! =head1 COPYRIGHT AND LICENSE Copyright 2018, 2021, 2024 Elizabeth Mattijsen This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. =end pod # vim: ft=perl6 expandtab sw=4
### ---------------------------------------------------- ### -- Air ### -- Licenses: Artistic-2.0 ### -- Authors: librasteve ### -- File: make-docs.raku ### ---------------------------------------------------- #!/usr/bin/env raku use File::Find; sub MAIN (:$filename, :$output = 'index.md') { my @files = $filename ?? $filename.Array !! find dir => 'lib', name => /'.rakumod' $/; my ($docsDir) = ($*CWD, ''); unless $docsDir.add('lib').e { say 'Please run this script from the project root directory.'; exit; } $docsDir .= add('docs'); $docsDir.mkdir; my @destFiles; for @files { my $newFile = $docsDir; for $*SPEC.splitdir( .relative ).skip(1) { $newFile .= add($_); $newFile.mkdir unless $newFile.Str.ends-with('.rakumod'); } print "Processing { $newFile }..."; my $docs = qqx{raku -Ilib --doc=Markdown $_}; if $docs.trim { my $destFile = $newFile.extension('md'); $destFile.spurt: $docs; @destFiles.push($destFile); say "output written to { $destFile.relative }"; } else { say "nothing to output"; } } # If processing a single file, do NOT write out the index. unless $filename { # Write index file my $index = "Document Index\n"; $index ~= '=' x $index.chars.chomp ~ "\n\n"; for sort @destFiles { my $m = .extension(''); my $module-name = $*SPEC.splitdir( $m.relative ).skip(1).join('::'); my $n = .extension('md'); $index ~= "- [{ $module-name }]({ $n.relative })\n"; } my $index-page = $docsDir.parent.resolve.add($output); $index-page.resolve.spurt: $index; } }
### ---------------------------------------------------- ### -- Air ### -- Licenses: Artistic-2.0 ### -- Authors: librasteve ### -- File: META6.json ### ---------------------------------------------------- { "name": "Air", "description": "Just build websites the right way.", "version": "0.0.16", "authors": [ "librasteve" ], "auth": "zef:librasteve", "depends": [ "UUID::V4", "DateTime::Format", "HTML::Escape", "Cro::HTTP::Router", "Cro::WebApp::Template", "Cro::WebApp::Form", "Cromponent" ], "build-depends": [], "provides": { "Air": "lib/Air.rakumod", "Air::Base": "lib/Air/Base.rakumod", "Air::Component": "lib/Air/Component.rakumod", "Air::Form": "lib/Air/Form.rakumod", "Air::Functional": "lib/Air/Functional.rakumod" }, "license": "Artistic-2.0", "source-url": "https://github.com/librasteve/Air.git" }
### ---------------------------------------------------- ### -- Air ### -- Licenses: Artistic-2.0 ### -- Authors: librasteve ### -- File: LICENSE ### ---------------------------------------------------- The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### ---------------------------------------------------- ### -- Air ### -- Licenses: Artistic-2.0 ### -- Authors: librasteve ### -- File: README.md ### ---------------------------------------------------- [![License: Artistic-2.0](https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg)](https://opensource.org/licenses/Artistic-2.0) [![Actions Status](https://github.com/librasteve/Air/actions/workflows/test.yml/badge.svg)](https://github.com/librasteve/Air/actions) Please raise an Issue if you would like to feedback or contribute. Air docs are at https://librasteve.github.io/Air/ Air === Breathing life into the raku **hArc stack** (HTMX, Air, Red, Cro). **Air** aims to be the purest possible expression of [HTMX](https://htmx.org). **hArc** websites are written in functional code. This puts the emphasis firmly onto the content and layout of the site, rather than boilerplate markup that can often obscure the intention. **Air** is basically a set of libraries that produce HTML code and serve it with Cro. The result is a concise, legible and easy-to-maintain website codebase. GETTING STARTED =============== ***IMPORTANT - GET BEST RESULTS BY FOLLOWING THIS 3 STEP PROCESS*** Install raku - eg. from [rakubrew](https://rakubrew.org), then: Install Air, Cro & Red - zef install --/test cro [117 sec] - zef install Red --exclude="pq:ver<5>" --/test [98 sec] - zef install Air [15 sec] Run and view some examples - git clone https://github.com/librasteve/Air-Play.git && cd Air-Play - export WEBSITE_HOST="0.0.0.0" && export WEBSITE_PORT="3000" - raku -Ilib service.raku - browse to http://localhost:3000 Cro has many other options as documented at [Cro](https://cro.raku.org) for deployment to a production server. Install times are from an M1 macOS, ymmv. SYNOPSIS ======== ```raku #!/usr/bin/env raku use Air::Functional :BASE; use Air::Base; my &index = &page.assuming( #:REFRESH(1), title => 'hÅrc', description => 'HTMX, Air, Red, Cro', footer => footer p ['Aloft on ', b safe '&Aring;ir'], ); my &planets = &table.assuming( :thead[["Planet", "Diameter (km)", "Distance to Sun (AU)", "Orbit (days)"],], :tbody[["Mercury", "4,880", "0.39", "88"], ["Venus" , "12,104", "0.72", "225"], ["Earth" , "12,742", "1.00", "365"], ["Mars" , "6,779", "1.52", "687"],], :tfoot[["Average", "9,126", "0.91", "341"],], ); sub SITE is export { site #:bold-color<blue>, index main div [ h3 'Planetary Table'; planets; ] } ``` DESCRIPTION =========== Air is not a framework, but a set of libraries. Full control over the application loop is retained by the coder. Air does not provide an HTML templating language, instead each HTML tag is written as a subroutine call where the argument is a list of `@inners` and attributes are passed via the raku Pair syntax `:name<value>`. [Cro templates](https://cro.raku.org/docs/reference/cro-webapp-template-syntax) are great if you would rather take the template approach. Reusability is promoted by the structure of the libraries - individuals and teams can create and install your own libraries to encapsulate design themes, re-usable web components and best practice. Air is comprised of three core libraries: * Air::Functional - wraps HTML tags as functions * Air::Base - a set of handy prebuilt components * Air::Component - make your own components * Air::Form - declarative forms **[Air::Play](https://raku.land/zef:librasteve/Air::Play)** is a companion raku module with various **Air** website examples. The Air documentation is at [https://librasteve.github.io/Air](https://librasteve.github.io/Air) TIPS & TRICKS ============= * When debugging, use the raku `note` sub to out put debugging info to stderr (ie in the Cro Log stream), `note $thing.raku` instead of `dd` (`dd` is an HTML datalist description tag function) * When passing a 2D Array to a tag function, make sure that there is a trailing comma `:tbody[["Mercury", "4,880", "0.39", "88"],]` * An error message like *insufficient arguments* is often caused by separating two tag functions with a comma `,` instead of a semicolon `;` * In development set CRO_DEV=1 in the [environment](https://cro.services/docs/reference/cro-webapp-template#Template_auto-reload) AUTHOR ====== Steve Roe <[email protected]> The `Air::Component` module provided is based on an early version of the raku `Cromponent` module, author Fernando Corrêa de Oliveira <[email protected]>, however unlike Cromponent this module does not use Cro Templates. COPYRIGHT AND LICENSE ===================== Copyright(c) 2025 Henley Cloud Consulting Ltd. This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.