// This is from an N-Triples format parser, using a parsing combinator library I wrote.// This parses and decodes encodings of unicode such as \u1D740 and \UF0908D88 and the escapable N-Triple characters t, b, n, r, f, ", ', and \unicode4=pr.WithAction(pr.And(backslash,lowerU,pr.NString(pr.HexDigit,4)),pr.Compose(pr.Third,hex(4)))unicode8=pr.WithAction(pr.And(backslash,upperU,pr.NString(pr.HexDigit,8)),pr.Compose(pr.Third,hex(8)))escapeChar=pr.Or(lowerT,lowerB,lowerN,lowerR,lowerF,doubleQuote,singleQuote,backslash)escaped=pr.WithAction(pr.And(backslash,escapeChar),pr.Compose(pr.Second,decodeEscape))
Comments (1)
Patrick Logan
I've read posts with people saying you can't do FP / composition in Go because errors are conventionally (when warranted!) returned as a second (or third) result.
Of course that is only when warranted. Functional expressions can be written in a functional style and yet meet the Go style guidelines.
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.
I've read posts with people saying you can't do FP / composition in Go because errors are conventionally (when warranted!) returned as a second (or third) result.
Of course that is only when warranted. Functional expressions can be written in a functional style and yet meet the Go style guidelines.