Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XQuery: self-dependencies #1095

Open
ChristianGruen opened this issue Mar 11, 2015 · 4 comments
Open

XQuery: self-dependencies #1095

ChristianGruen opened this issue Mar 11, 2015 · 4 comments
Labels
Milestone

Comments

@ChristianGruen
Copy link
Member

Query:

declare variable $a := function-name(local:f#0);
declare function local:f() { $a };
local:f()

Expected:

local:f

Returns:

[XQDY0054] Static variable depends on itself

@ChristianGruen ChristianGruen added this to the HOLD milestone Dec 7, 2016
@ChristianGruen
Copy link
Member Author

Related (see https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg13171.html):

declare variable $local:test := local:test#1 ;
declare %private function local:test( $i) { if ( $i > 0)  then $local:test( $i - 1) } ;
$local:test( 10)

@ChristianGruen
Copy link
Member Author

Related (see #1951):

declare variable $f := function($a) {
  if($a < 1) then $a else $a + $f($a - 1)
};
$f(10)

…shouldn’t raise XPST0008.

@ChristianGruen
Copy link
Member Author

Related:

declare variable $f := map {
  'A': function($r, $f) { $r/x ! $f?B(., $f) },
  'B': function($r, $f) { $r/x ! $f?A(., $f) }
};
$f?A(<a/>, $f)

@ChristianGruen
Copy link
Member Author

Related:

let $even := fn($n, $self, $odd) {
  $n = 0 and $odd($n - 1, $odd, $self)
}
let $odd := fn($n, $self, $even) {
  $n != 0 or $even($n - 1, $even, $self)  
}
return $even(1, $even, $odd)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant