-
Notifications
You must be signed in to change notification settings - Fork 23
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
SETOF support #11
Comments
Is here something new maybe? 😇 |
So the SETOF functionality isn't just eg. a function that returns an array func FibonacciSETOF(n int) []int {
f := make([]int, n+1, n+2)
if n < 2 {
f = f[0:2]
}
f[0] = 0
f[1] = 1
for i := 2; i <= n; i++ {
f[i] = f[i-1] + f[i-2]
}
return f
} and expect it to be a SETOF returning function. It is possible to split the function to these calls. something like: //returning the data to be stored in context and the maximum number of calls
func FibonacciSETOFInit(n int) (interface{}, int) {
f := make([]int, n+1, n+2)
if n < 2 {
f = f[0:2]
}
f[0] = 0
f[1] = 1
return f, n
}
//this function will be called n-times
//getting the context, with the data and iteration number
func FibonacciSETOFNext(ctx plgo.Context) int {
f := ctx.Value().([]int)
f[ctx.Iteration()] = f[ctx.Iteration()-1] + f[ctx.Iteration()-2]
return f[ctx.Iteration()]
} so if you call There is a And if it is somehow possible, writing something like this is complicated. |
Is possible to get SETOF support
The text was updated successfully, but these errors were encountered: