개인 자료란 (JE)

  서버 커뮤니티

Profile muqhc 대표칭호 없음
Profile

커뮤니티 소통 개발하기 잡담

끔찍한 코틀린 람다 관련 라이브러리

2022.01.07 조회 수 1462 추천 수 0


import io.github.runction.*
val plusTwo = { x: Int -> x + 2 }
val plusTen = { x: Int -> x + 10 }


/ /plusTwelve = { x -> plusTen( plusTwo( x ) ) }
val plusTwelve = plusTwo composite plusTen  // { x -> println( plusTwelve( x ) ) }.invoke( 6 ) plusTwelve composite ::println bind 6 //output: 18
val modulo = runc<Int,Runction<Int,Boolean,Boolean,Boolean>,Int,Int> { b ->
    runc { a ->
        a % b == 0
    }
}

val isOdd = modulo(2) compositeOn { not() }

0..9 bindOn
        { toList() } bindOn
        { this::filter bind isOdd } bind ::println

//output: [1, 3, 5, 7, 9]

documentation : https://github.com/muqhc/runction/blob/master/README.md

github repo : https://github.com/muqhc/runction

maven central : https://search.maven.org/artifact/io.github.muqhc/runction




1개의 댓글

명이
2022.01.09

"코드 일부분의 아름다움을 희생하는 대신 다른 일부분의 아름다움을 극대화 시켜주는 라이브러리"

뉴스 및 창작물
/files/thumbnails/520/751/003/262x150.crop.jpg?20240328020349

레드스톤

마인크래프트 노트블록으로 만든 『 Bling‐Bang‐Bang‐Born 』 1

Sonttukk

2024-03-23

1

/files/thumbnails/467/742/003/262x150.crop.jpg?20240311163123

레드스톤

[노트블럭커버] MILGRAM -ミルグラム(밀그램)- / 아마네 「숙청 행진」 제 2심 2

리비온

2024-03-11

0

/files/thumbnails/846/741/003/262x150.crop.jpg?20240310221214

레드스톤

워든 vs 라마 200마리 1

GlassesFilm

2024-03-10

0

/files/thumbnails/542/739/003/262x150.crop.jpg?20240309070457

레드스톤

[고인의 명복을 빕니다][노트블럭]드래곤볼 GT 오프닝 - 점점 마음이 끌려

리비온

2024-03-09

0

/files/thumbnails/326/738/003/262x150.crop.jpg?20240328020414

레드스톤

마인크래프트 노트블록으로 만든 『 Build Our Machine 』

Sonttukk

2024-03-07

0