• A list, subpatterns, and mixing them

    From gamo@21:1/5 to All on Tue Apr 19 12:18:07 2022
    Hi there!

    I have a list of attributes, say it's middle sized.

    After that, I have a bunch of subpatterns of this attributes that are
    coherent both internally and to concatenate to another subpatterns.

    How could I structure this both teorethically and practically?

    Thanks in advance, as usual.




    --
    http://gamo.sdf-eu.org/
    perl -E 'say "Error: Total mess"'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben@21:1/5 to gamo on Tue Apr 19 15:24:39 2022
    gamo <[email protected]> writes:

    I have a list of attributes, say it's middle sized.

    After that, I have a bunch of subpatterns of this attributes that are coherent both internally and to concatenate to another subpatterns.

    How could I structure this both teorethically and practically?

    I, for one, don't know what you are asking. I think an example would
    help you get better answers.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From RAT@21:1/5 to gamo on Wed Apr 20 07:16:02 2022
    On Tuesday, April 19, 2022 at 5:18:16 AM UTC-5, gamo wrote:
    Hi there!

    I have a list of attributes, say it's middle sized.

    After that, I have a bunch of subpatterns of this attributes that are coherent both internally and to concatenate to another subpatterns.

    How could I structure this both teorethically and practically?

    Thanks in advance, as usual.




    --
    http://gamo.sdf-eu.org/
    perl -E 'say "Error: Total mess"'

    You're probably looking for Moose or any of the various OO methodologies in Perl.
    Perhaps have a look at this: https://metacpan.org/pod/Moo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From gamo@21:1/5 to All on Wed Apr 20 19:01:44 2022
    El 19/4/22 a las 16:24, Ben escribió:
    gamo <[email protected]> writes:

    I have a list of attributes, say it's middle sized.

    After that, I have a bunch of subpatterns of this attributes that are
    coherent both internally and to concatenate to another subpatterns.

    How could I structure this both teorethically and practically?

    I, for one, don't know what you are asking. I think an example would
    help you get better answers.


    #!/usr/bin/perl -w

    use 5.032;

    my @m = 'a' .. 'f';

    my @pars = qw ( ac ce bf db ee );

    my $l = 7; # a squared

    my $n = 4 * 4; # size



    my $c =0;
    my $pick;
    my @square;
    do {
    $pick = @m[int rand(scalar @m)];
    if (@square == 0 || @square != $l-1 || @square != 2*$l-1 || @square
    != 3*$l-1){
    push @square, $pick;
    $c++;
    }else{
    for (@pars){
    if ($square[$c-1].$pick != $_){
    push @square, $pick;
    $c++;
    last;
    }
    }
    }
    }until ($c == $l);


    exit 2;

    --
    http://gamo.sdf-eu.org/
    perl -E 'say "Thank you."'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben@21:1/5 to gamo on Wed Apr 20 21:17:10 2022
    gamo <[email protected]> writes:

    El 19/4/22 a las 16:24, Ben escribi�:
    gamo <[email protected]> writes:

    I have a list of attributes, say it's middle sized.

    After that, I have a bunch of subpatterns of this attributes that are
    coherent both internally and to concatenate to another subpatterns.

    How could I structure this both teorethically and practically?

    I, for one, don't know what you are asking. I think an example would
    help you get better answers.


    #!/usr/bin/perl -w

    use 5.032;

    my @m = 'a' .. 'f';

    my @pars = qw ( ac ce bf db ee );

    my $l = 7; # a squared

    my $n = 4 * 4; # size

    No used.

    my $c =0;
    my $pick;
    my @square;
    do {
    $pick = @m[int rand(scalar @m)];

    I'd put my $pick = @m[int rand(scalar @m)]; here.

    if (@square == 0 || @square != $l-1 || @square != 2*$l-1 || @square != 3*$l-1){

    Let's see when this condition would not be true by inverting it using
    the rule not(A or B or C) = not A and not B and not C:

    @square != 0 && @square == $l-1 && @square == 2*$l-1 && @square == 3*$l-1

    This condition (the "else" case) can never be true. Basically your code
    makes a random list of $l letters from @m.

    push @square, $pick;
    $c++;
    }else{
    for (@pars){
    if ($square[$c-1].$pick != $_){
    push @square, $pick;
    $c++;
    last;
    }
    }
    }
    }until ($c == $l);


    exit 2;

    I can't relate this code to the words in the question, and I can't work
    out what it is you are trying to do. You are making helping you very
    hard!

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From gamo@21:1/5 to I try to on Thu Apr 21 05:18:31 2022
    El 20/4/22 a las 22:17, Ben escribió:
    I, for one, don't know what you are asking. I think an example would
    help you get better answers.


    I try to write a draft as you requested.


    #!/usr/bin/perl -w

    use 5.032;

    my @m = 'a' .. 'f';

    my @pars = qw ( ac ce bf db ee );

    my $l = 7; # a squared

    my $n = 4 * 4; # size
    No used.

    my $c =0;
    my $pick;
    my @square;
    do {
    $pick = @m[int rand(scalar @m)];
    I'd put my $pick = @m[int rand(scalar @m)]; here.

    if (@square == 0 || @square != $l-1 || @square != 2*$l-1 || @square != 3*$l-1){

    Wrong. This is a always match case.

    Let's see when this condition would not be true by inverting it using
    the rule not(A or B or C) = not A and not B and not C:

    @square != 0 && @square == $l-1 && @square == 2*$l-1 && @square == 3*$l-1


    Wrong. This is a never match case.

    The case is that neither redactions are correct.

    What I really mean (as an example) is

    @square == 0 && @square != $l-1 et cetera.

    This condition (the "else" case) can never be true. Basically your code makes a random list of $l letters from @m.

    push @square, $pick;
    $c++;
    }else{
    for (@pars){
    if ($square[$c-1].$pick != $_){
    push @square, $pick;
    $c++;
    last;
    }
    }
    }
    }until ($c == $l);


    exit 2;

    I can't relate this code to the words in the question, and I can't work
    out what it is you are trying to do. You are making helping you very
    hard!


    That's because what I mean in the first place is what I really want to
    mean. Summary:

    1) You have a pool of types of attributes
    2) You have pairs of undesiderable neighbors or better, a cost function
    3) You have to make subgroups of the 1) in order to get a great arrange

    This is similar to the knapsack problem.
    BUT there are additional problems as how many times you admit a certain attribute or that you must check different sizes in different orders.

    Not a simple problem.

    Thanks, anyhow.






    -- Ben.


    --
    http://gamo.sdf-eu.org/
    perl -E 'say "Error: Batteries low"'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben@21:1/5 to gamo on Thu Apr 21 11:24:42 2022
    gamo <[email protected]> writes:

    El 20/4/22 a las 22:17, Ben escribi�:
    I, for one, don't know what you are asking. I think an example would
    help you get better answers.


    I try to write a draft as you requested.


    #!/usr/bin/perl -w

    use 5.032;

    my @m = 'a' .. 'f';

    my @pars = qw ( ac ce bf db ee );

    my $l = 7; # a squared

    my $n = 4 * 4; # size
    No used.

    my $c =0;
    my $pick;
    my @square;
    do {
    $pick = @m[int rand(scalar @m)];
    I'd put my $pick = @m[int rand(scalar @m)]; here.

    if (@square == 0 || @square != $l-1 || @square != 2*$l-1 || @square != 3*$l-1){

    Wrong. This is a always match case.

    Yes, that was my point. This condition is never false.

    Let's see when this condition would not be true by inverting it using
    the rule not(A or B or C) = not A and not B and not C:
    @square != 0 && @square == $l-1 && @square == 2*$l-1 && @square == 3*$l-1

    Wrong. This is a never match case.

    I think you missed what I was saying. Of course it's wrong.

    Anyway, I'm out. I hope you sorted out whatever problem it was you were having.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rainer Weikusat@21:1/5 to RAT on Tue Apr 26 20:11:09 2022
    RAT <[email protected]> writes:
    On Tuesday, April 19, 2022 at 5:18:16 AM UTC-5, gamo wrote:
    Hi there!

    I have a list of attributes, say it's middle sized.

    After that, I have a bunch of subpatterns of this attributes that are
    coherent both internally and to concatenate to another subpatterns.

    How could I structure this both teorethically and practically?

    Thanks in advance, as usual.




    --
    http://gamo.sdf-eu.org/
    perl -E 'say "Error: Total mess"'

    You're probably looking for Moose or any of the various OO methodologies in Perl.

    Perl has a perfectly functional built-in 'OO methodology'.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)