-------- Forwarded Message --------
Subject: Lag specification with "to" keyword fails for passed list parameters in functions
Date: Fri, 22 May 2026 10:26:10 +0200
From: Artur T. <artur.tarassow@gmail.com>
Reply-To: artur.tarassow@gmail.com
To: Gretl development <gretl-devel@gretlml.univpm.it>


I've encountered what appears to be a bug (or unsupported feature) when using
lag specifications with the "to" keyword inside functions when referring to a
passed list parameter.


The following code produces an error: "The symbol 'to' is undefined"

<hansl>
set verbose off
open denmark.gdt --quiet

function void foo(list D)
list L = LRM D.LRM(-1)
L += D.LRM(-2 to -4) # Error: "The symbol 'to' is undefined"

I would guess it's a parser issue.

Doing it in two steps seems to work even inside a function:

function void foo(list D)
    list L = LRM D.LRM(-1)
    series s = D.LRM
    list temp = s(-2 to -4)
    
    L += temp
    # L += D.LRM(-2 to -4) # Error: "The symbol 'to' is undefined"

end function

However, perhaps you lose the series name which could be an unwanted side effect.

cheers

sven