From: PencilEd <gstewart@lc...>  20090624 12:54:07

I know this isn't really what xQuery is for, but it would be helpful if I could find a relatively easy way of doing this with xQuery. I need to create a sequence of integers. I start with a min and max value  need to fill in the rest. example: declare function fill_in_the_blanks($min as xs:integer, $max as xs:integer) as xs:sequence { ... do something to get $full_sequence := xs:sequence($min, $min+1, $min+2, $min+3... $max) return $full_sequence }; I've spent an afternoon searching and playing with recursion and think I might be able to create something, but I'm hoping there's an easier way that I just haven't found. Thanks>  View this message in context: http://www.nabble.com/Sequenceofnumberstp24184150p24184150.html Sent from the existopen mailing list archive at Nabble.com. 
From: Mike Sokolov <sokolov@if...>  20090624 14:09:07

This is really much easier than all that: $min to $max is what you want I think Mike PencilEd wrote: > I know this isn't really what xQuery is for, but it would be helpful if I > could find a relatively easy way of doing this with xQuery. > > I need to create a sequence of integers. I start with a min and max value  > need to fill in the rest. > > example: > declare function fill_in_the_blanks($min as xs:integer, $max as xs:integer) > as xs:sequence { > ... do something to get > $full_sequence := xs:sequence($min, $min+1, $min+2, $min+3... $max) > return $full_sequence > }; > > I've spent an afternoon searching and playing with recursion and think I > might be able to create something, but I'm hoping there's an easier way that > I just haven't found. > > Thanks> > 
From: Fraser Hore <fraser.hore@gm...>  20090624 14:15:34
Attachments:
Message as HTML

yes like this I think: let $min := 4 let $max := 19 for $x in ($min to $max) return $x On Wed, Jun 24, 2009 at 3:27 PM, Mike Sokolov <sokolov@...> wrote: > This is really much easier than all that: > > $min to $max > > is what you want I think > > Mike > > PencilEd wrote: > > I know this isn't really what xQuery is for, but it would be helpful if I > > could find a relatively easy way of doing this with xQuery. > > > > I need to create a sequence of integers. I start with a min and max > value  > > need to fill in the rest. > > > > example: > > declare function fill_in_the_blanks($min as xs:integer, $max as > xs:integer) > > as xs:sequence { > > ... do something to get > > $full_sequence := xs:sequence($min, $min+1, $min+2, $min+3... $max) > > return $full_sequence > > }; > > > > I've spent an afternoon searching and playing with recursion and think I > > might be able to create something, but I'm hoping there's an easier way > that > > I just haven't found. > > > > Thanks> > > > > >  > _______________________________________________ > Existopen mailing list > Existopen@... > https://lists.sourceforge.net/lists/listinfo/existopen > 
From: PencilEd <gstewart@lc...>  20090624 14:16:10

Thank you much  Now that you mention it I remember reading that somewhere a long time ago... it had just never come up so it slipped into an unused portion of my brain (which isn't hard seeing as how the unused portion consists of upwards of 97%) Michael Sokolov2 wrote: > > This is really much easier than all that: > > $min to $max > > is what you want I think > > Mike > > PencilEd wrote: >> I know this isn't really what xQuery is for, but it would be helpful if I >> could find a relatively easy way of doing this with xQuery. >> >> I need to create a sequence of integers. I start with a min and max >> value  >> need to fill in the rest. >> >> example: >> declare function fill_in_the_blanks($min as xs:integer, $max as >> xs:integer) >> as xs:sequence { >> ... do something to get >> $full_sequence := xs:sequence($min, $min+1, $min+2, $min+3... $max) >> return $full_sequence >> }; >> >> I've spent an afternoon searching and playing with recursion and think I >> might be able to create something, but I'm hoping there's an easier way >> that >> I just haven't found. >> >> Thanks> >> > >  > _______________________________________________ > Existopen mailing list > Existopen@... > https://lists.sourceforge.net/lists/listinfo/existopen > >  View this message in context: http://www.nabble.com/Sequenceofnumberstp24184150p24185610.html Sent from the existopen mailing list archive at Nabble.com. 
From: Wolfgang <wolfgang@ex...>  20090624 14:21:13

> I need to create a sequence of integers. I start with a min and max value  > need to fill in the rest. How about: let $full_sequence := $min to $max Wolfgang 
From: Andrew Hart CEMS Staff <Andrew2.H<art@uw...>  20090624 14:36:19

Since my slow email is making me look like a retard...how about the general case: ($min to $max)[. mod $step = 0] or something...tada! PencilEd wrote: > I know this isn't really what xQuery is for, but it would be helpful if I > could find a relatively easy way of doing this with xQuery. > > I need to create a sequence of integers. I start with a min and max value  > need to fill in the rest. > > example: > declare function fill_in_the_blanks($min as xs:integer, $max as xs:integer) > as xs:sequence { > ... do something to get > $full_sequence := xs:sequence($min, $min+1, $min+2, $min+3... $max) > return $full_sequence > }; > > I've spent an afternoon searching and playing with recursion and think I > might be able to create something, but I'm hoping there's an easier way that > I just haven't found. > > Thanks> > This email was independently scanned for viruses by McAfee antivirus software and none were found 
From: Andrew Hart CEMS Staff <Andrew2.H<art@uw...>  20090624 20:26:48

I may be mistaken but can't you just do e.g. return (5 to 18) PencilEd wrote: > I know this isn't really what xQuery is for, but it would be helpful if I > could find a relatively easy way of doing this with xQuery. > > I need to create a sequence of integers. I start with a min and max value  > need to fill in the rest. > > example: > declare function fill_in_the_blanks($min as xs:integer, $max as xs:integer) > as xs:sequence { > ... do something to get > $full_sequence := xs:sequence($min, $min+1, $min+2, $min+3... $max) > return $full_sequence > }; > > I've spent an afternoon searching and playing with recursion and think I > might be able to create something, but I'm hoping there's an easier way that > I just haven't found. > > Thanks> > This email was independently scanned for viruses by McAfee antivirus software and none were found 