[Info-vax] Text processing on VMS
Arne Vajhøj
arne at vajhoej.dk
Sun Oct 13 20:51:12 EDT 2024
On 10/13/2024 8:47 PM, Arne Vajhøj wrote:
>> $ type s.groovy
>> import java.nio.file.*
>>
>> Files.lines(Paths.get("login.com"))
>> .filter(line -> line.contains("java"))
>> .map(line -> line[2..12])
>> .forEach(System.out::println)
>
> Note that it is probably more groovysk with:
>
> $ type s2.groovy
> import java.nio.file.*
>
> Files.lines(Paths.get("login.com"))
> .filter({ it.contains("java") })
> .map({ it[2..12] })
> .forEach({ println(it) })
>
> But I don't think that improves readability.
Or:
$ type s3.groovy
import java.nio.file.*
Files.lines(Paths.get("login.com"))
.filter({ it.contains("java") })
.map({ it[2..12] })
.each(this.&println)
Arne
More information about the Info-vax
mailing list