The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

patb23 (8) [Avatar] Offline
#1
disclosuresmilie: I jumped to this chapter from 6th Chapter and hence

Could you please explain the 'reduce' in this example? can it have different param list - 3 instead of 2?
I tried having 3 map and one reduce with 3 params.
am getting
"Caught: groovy.lang.MissingMethodException: No signature of method: com.xyz.pcg.groovy.MapReduce$_main_closure1_closure5.doCall() is applicable for argument types: (java.lang.String, java.lang.String) values: [AAXX, BAXX]

Possible solutions: doCall(java.lang.Object, java.lang.Object, java.lang.Object), findAll(), findAll()

groovy.lang.MissingMethodException: No signature of method: com.xyz.pcg.groovy.MapReduce$_main_closure1_closure5.doCall() is applicable for argument types: (java.lang.String, java.lang.String) values: [AAXX, BAXX]

Possible solutions: doCall(java.lang.Object, java.lang.Object, java.lang.Object), findAll(), findAll()"

Message was edited by:
patb23
Mittie (397) [Avatar] Offline
#2
Listing 18.4 works fine for me as is.
Please try copying it literally into the groovy console.
Make sure you have all the line breaks right.

From your error message it looks like a line break is missing and you try to call "reduce" on a closure like

{ it ** 2}.reduce

but there needs to be a line break before the (.reduce) dot.

cheers
Dierk