Tag: closures
-
A bit of a Groovy gotcha
This tripped me up this afternoon so it might be useful to write about it… I have been tidying up my classwork exercise Groovy, seeking to eliminate the repeated redefinition of constants – so I defined something like this: enum ExerciseConstants { FIRST(1) SECOND(2) THIRD(3) final int value ExerciseConstants(int value) { this.value = value }…
-
The lambda calculus and closures in Groovy
No sooner had I written about the lambda calculus and Structure and Interpretation of Computer Programs than I sat in a lecture on closures in Groovy and was presented with a structure like this (which multiplies two numbers, in this case 3 and 4): Which immediately reminded me of one of Alonzo Church‘s formulations of…