Skip to content

How to match both k and -k with sets? #821

Closed

Description

@veretin

Hi!

I want to match both +k and -k in one line with set restriction.
Is it possible? In this case "k" is a vector

v k,k1,k2, p, q;
set kk: k, k1, k2;
c A;

g ff1 = A(k);
g ff2 = A(-k);

id A(k?kk) = 0;
id A(-k?kk) = 0;

print;
.end

We need 2 lines to capture both. Can we do this in one line?
Regards,
OVeretin

Activity

  1. tueda commented on Apr 28, 2026

    @tueda
    Collaborator

    Seems to work:

    V k,k1,k2,k3,k4,p;
    Set kk: k1,k2,k4,-k1,-k3,-k4;
    CF f;
    L F =
    #do k={k1,k2,k3,k4,-k1,-k2,-k3,-k4,p}
      + f(`k')
    #enddo
    ;
    id f(k?kk) = 0;
    P +s;
    .end
    
       F =
           + f(k3)
           + f(p)
           + f(-k2)
          ;
    
  2. github-actions commented on Oct 5, 2026

    @github-actions

    This issue has been marked as stale after 90 days of inactivity. It will be closed automatically in 30 days unless there is any further activity. If this issue is still relevant, please leave a comment to keep it open.

  3. added
    staleNo recent activity. This may be closed if there is no further activity.
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about FORMstaleNo recent activity. This may be closed if there is no further activity.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions