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

koazee reduce wont accept the subsequent function param values or state outside the reduce function #58

Open
dekanayake opened this issue Sep 1, 2020 · 0 comments

Comments

@dekanayake
Copy link

dekanayake commented Sep 1, 2020

Ex :

type test struct {
	name string
}

func test33(names []string, test test ) string{
	stream := koazee.StreamOf(names).
		Reduce(func(acc string, name string) (string, error) {

			log.Info( test.name)

			return acc, nil
		})



	return stream.Val().(string)

}

func main() {
	test1 := test{
		name:"name1",
	}

	test2 := test{
		name:"name2",
	}

	array := []string{"33","44"}
	test33(array,test1)
	test33(array,test2)
}

output :-

name1
name1
name1
name1

Expected :-

name1
name1
name2
name2

@dekanayake dekanayake changed the title koazee reduce wont accept the subsequent function param values koazee reduce wont accept the subsequent function param values or state outside the reduce function Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant