solvingj
03/03/2024, 1:54 AM"takeUntil"
which takes all elements from a collection but stops when the predicate is true. I thought of some hacks to do it. I guess the most concise is: list.reverse().dropWhile{!predicate}.reverse()
but it feels like there might be something first class i’m missing.paulk_asert
03/03/2024, 8:20 AMlist.takeWhile{ predicate }
? You'd normally negate the predicate but you have already done that in your workaround?solvingj
03/03/2024, 12:54 PMsolvingj
03/03/2024, 12:57 PMsolvingj
03/03/2024, 1:03 PMfindIndexOf { predicate }
and then subList(0, index + 1)
and all thatsolvingj
03/03/2024, 1:16 PMsum()
return Object
and not infer the return type is the same as the input type, and take a generic parameter for the overload which takes the custom closure?paulk_asert
03/03/2024, 2:31 PMassert '123' == [1, 2, 3].sum('')
But we probably could have done smarter generics for the no initial value case if we assume that we will only ever deal with objects in our aggregates which have types which are closed under plus.bsdooby
03/04/2024, 8:27 AMtrait
w/ @CompileStatic
, a reference to "${this}"
is working, but not "${this.y()}"
(given that my record type as a member called y
). If I omit the static compile annotation, then it works...Why is this so?solvingj
03/05/2024, 3:16 PMgrep
?solvingj
03/05/2024, 3:17 PMGroovy Duke
03/05/2024, 3:29 PMgrep
. I doubt many others have either, but it might become popular on Google for a second because of your question.Groovy Duke
03/05/2024, 10:54 PM@AnnotationCollector
and a processor. Does the processor need to be precompiled because all I get is the following error when I try to debug using a remote debugger and I never get to the processor:
BUG! exception in phase 'semantic analysis' in source unit '/.../SomeController.groovy' Index 0 out of bounds for length 0
Suresh
03/07/2024, 3:34 PMbsdooby
03/09/2024, 4:28 PM@CompileStatic
does not allow the following:
//@CompileStatic
trait Printable {
def printMe() {
println "${x} ${y} ${z}";
}
}
bsdooby
03/09/2024, 4:31 PMetxaleku
03/15/2024, 9:14 PMpaulk_asert
03/15/2024, 9:19 PMetxaleku
03/15/2024, 9:47 PMetxaleku
03/15/2024, 9:55 PMInternal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at <mailto:admin@groovy-lang.org|admin@groovy-lang.org> to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apache/2.4.29 (Ubuntu) Server at <http://groovy-lang.org|groovy-lang.org> Port 80
paulk_asert
03/16/2024, 9:49 AMetxaleku
03/22/2024, 5:00 PMetxaleku
03/22/2024, 5:03 PMpaulk_asert
03/23/2024, 8:57 AMetxaleku
03/25/2024, 4:27 PMsolvingj
03/30/2024, 12:26 PMinterface Mergeable {
<T extends Mergeable> T merge(T other)
}
class MergeImpl implements Mergeable {
@Override
MergeImpl merge(MergeImpl other) {
return other
}
}
solvingj
03/30/2024, 12:31 PMCURRENT_TYPE
and return an instance of CURRENT_TYPE
because there’s no keyword in the type system which represents CURRENT_TYPE
solvingj
03/30/2024, 12:32 PMinterface Mergeable<T extends Mergeable> {
T merge(T other)
}
class MergeImpl implements Mergeable<MergeImpl> {
@Override
MergeImpl merge(MergeImpl other) {
return other
}
}
Ben Sherman
04/04/2024, 2:59 PMThomas Rasmussen
04/17/2024, 7:57 PMgroovyConsole
on Ubuntu with dark OS theme, unfortunately the colors are "dark on dark" and "white on white" and therefore almost impossible to read.
Is there a way to change the colors or force the light theme (without changing the OS theme)?M3
04/24/2024, 4:27 PMclass Parent {
String name
Parent(String name){
this.name = name
}
}
class Child extends Parent {
Child(){
super(this.getClass().name) // << how do I fix this?
}
}
(ignore the silliness of the example, just trying to oversimplify for sake of example)
Obviously this does not work because this
is not available before super()
is called - so it will not compile. Obvious thing to do is to make the this.getClass().name
into parent, but that breaks a number of other use-cases - is there a way to do it? (It being - get the class name BEFORE calling super constructor?)