패턴 매칭을 할 욕심 매칭 (경기 0 이상), 할 ...
을 가지고 내가 이런 식으로 뭔가 일치 할 경우 : 'no
를 인쇄라켓 패턴 매칭이 없음 욕심이 일치에게 라켓 - 언어
#lang racket
(define (Modifier? t) (equal? t "Modifier"))
(define (SimpleName? t) (equal? t "SimpleName"))
(define (SimpleType? t) (equal? t "SimpleType"))
(define (FieldDeclaration? t) (equal? t "FieldDeclaration"))
(match (match '("FieldDeclaration" ("Modifier") ("Modifier") ("SimpleType") ("VariableDeclarationFragment" ("SimpleName") ("StringLiteral")))
[(list (? FieldDeclaration? id) (? Modifier? m) ... (? SimpleType? t) (list _ (? SimpleName? n)) _ ...)
'yes]
[else 'no])
을, 나는 'yes
을 기대하고 있습니다. 그래서,
목록에 0 3-("Modifier")
의가있을 수있다) ... 그러나 나는 이것에 대해 매우 확실하지 않다, 그것은 which do a greedy matching이 (단지 링크 된 페이지에 "욕심"검색) ...
에 의한 추측 이 양식과 어떻게 일치합니까?는 (사실, 그래서 양식을 사용해야하는 기능 XXX?
에서 할 많은 일들이 있습니다 (? XXX? x)
)
PS : 그래서 m 번에 일치하는 N을 의미 n_m
같은 것을 사용할 수 있는가 그것을 가능 extend the matching syntax에 불과 정규 표현식에서 {n,m}
을 좋아합니까?
많은 많은 많은 감사, 그렉 !! 잘 했어!! –