리슾 계열이 답이지.


1. 프로토타입 OOP

몇라인 안되는데 매크로를 이용하면 프로토타입 시스템 흉내 가능.

https://blog.jverkamp.com/2013/04/18/a-prototype-object-system-for-racket/

> ; Create a basic thing
(define-thing color [red 0] [green 0] [blue 0])
; Extend things
(define-thing red color [red 255])

; Get values, with optional default
(thing-get color 'red) => 0
(thing-get red 'red) => 255


2. 모나드

새로운 언어를 정의한 예인데 모나드도 들어가 있음.

역시 깃헙까서 보면 100라인 넘는 구현파일이 별로 없음.

https://pkgs.racket-lang.org/package/heresy


> (list-do
(rank <- (append (range 2 to 10) '(J Q K A)))
(suit <- '( ))
(if (equal? suit '))
(card = (format$ "#_#_" rank suit))
(yield card))

'("2♦" "3♦" "4♦" "5♦" "6♦" "7♦" "8♦" "9♦" "10♦" "J♦" "Q♦" "K♦" "A♦")



3. 논리형

아래것처럼 프롤로그 흉내낸 것도 있고.

https://pkgs.racket-lang.org/package/parenlog


> (type Gamma numConst num)

(type Gamma boolConst bool)
(:- (type Gamma (if Test Then Else) Tau)
(type Gamma Test bool)
(type Gamma Then Tau)
(type Gamma Else Tau))
(? (type mt numConst num))
(? (type mt (if boolConst numConst numConst) num))
(? (type mt (if boolConst numConst boolConst) num))
(? (type mt boolConst T))
(? (type mt (if boolConst numConst numConst) T))
(? (type mt (if boolConst numConst boolConst) T))


yes
yes
no
T=bool
T=num
no