# getting-started

Travis Griggs

09/28/2023, 10:13 PM
Is there a good library idiom for enumerating with a separated by function? I've been (ab)using an overly clever anonymous function hack as such to insert divider line in my Compose columns:
Copy code
var separator: @Composable () -> Unit
separator = { separator = @Composable { HorizontalDivider(thickness = Dp.Hairline) } }
for(...) { thing ->
I wish I could actually declare the ratcheting free function in one statement, but I haven't been able to intuit the the proper syntax to do that. As "clever"/"evil" as this is, I wish there were a clearer/idiomatic way to do this operation. If there were a more generic join function/method that wasn't just for string concatenating, I could map a set of transforming closures and join them with a separating closure, and then enumerate all of them, but that would be just as "round about" as the above (imo)