Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel
Last active January 13, 2019 15:58
Show Gist options
  • Save AlexDaniel/f8bde92d90e6853bd1925bdafddd2daa to your computer and use it in GitHub Desktop.
Save AlexDaniel/f8bde92d90e6853bd1925bdafddd2daa to your computer and use it in GitHub Desktop.
use v6;
use Test;
plan 23;
start { sleep 22; exit 42 }
is (1, |(2,3), 4).gist, '(1 2 3 4)', "simple | middle";
is (|(2,3), 4).gist, '(2 3 4)', "simple | left";
is (1, |(2,3)).gist, '(1 2 3)', "simple | right";
is (1, slip(2,3), 4).gist, '(1 2 3 4)', "simple slip middle";
is (slip(2,3), 4).gist, '(2 3 4)', "simple slip left";
is (1, slip(2,3)).gist, '(1 2 3)', "simple slip right";
is (1, Slip(2,3), 4).gist, '(1 2 3 4)', "simple Slip coercion middle";
is (Slip(2,3), 4).gist, '(2 3 4)', "simple Slip coercion left";
is (1, Slip(2,3)).gist, '(1 2 3)', "simple Slip coercion right";
is (1, (2,3).Slip, 4).gist, '(1 2 3 4)', "simple Slip coercion middle";
is ((2,3).Slip, 4).gist, '(2 3 4)', "simple Slip coercion left";
is (1, (2,3).Slip).gist, '(1 2 3)', "simple Slip coercion right";
is (1, slip (2,3), 4).gist, '(1 (2 3) 4)', "simple slip listop middle";
is (slip (2,3), 4).gist, '((2 3) 4)', "simple slip listop left";
is (1, slip (2,3)).gist, '(1 2 3)', "simple slip listop right";
is (1, slip flat (2,3), 4).gist, '(1 2 3 4)', "slip flat listops middle";
is (slip flat (2,3), 4).gist, '(2 3 4)', "slip flat listops left";
is (1, slip flat (2,3)).gist, '(1 2 3)', "slip flat listops right";
# one-arg lazies, not limited to 65536 elems
{
my \a = 0, ([\+] 1..*).Slip;
is a[100000], 5000050000, ".Slip can slip a long lazy list";
my \b = 0, Slip([\+] 1..*);
is b[100000], 5000050000, "Slip() can slip a one-arg long lazy list";
my \c = 0, slip [\+] 1..*;
is c[100000], 5000050000, "slip works with one-arg long lazy";
my \d = 0, |[\+] 1..*;
is d[100000], 5000050000, "prefix:<|> works with one-arg long lazy";
}
{
my $slip = slip <a b c>;
is-deeply [$slip.perl.EVAL], [$slip],
'can .perl.EVAL roundtrip an itemized slip';
}
%*ENV<MVM_SPESH_NODELAY>=1;
%*ENV<MVM_SPESH_BLOCKING>=1;
my $p = run <perl6 sandbox/foo-script>;
say now - BEGIN now;
exit 42 if $p.exitcode == 42;
exit 125 if $p.exitcode != 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment