Created
March 8, 2012 01:33
-
-
Save harms/1997868 to your computer and use it in GitHub Desktop.
J akin to a Scala Option example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NB. preparatory | |
OrFailureReport=: adverb : ' u ` asFailure @. fails ' | |
UnlessFailed=: adverb : ' u ` ] @. fails ' | |
NotingUnknownParsingError=: ::((makeFailure 'Unknown error in parsing attempt.')"_) | |
FAILMARK=: < s:'`_|_' NB. arbitrary | |
makeFailure=: [: < FAILMARK ; < :[: | |
fails=: [:+./ [:flatten (FAILMARK e. ]) L:1 | |
NB. main | |
respond =: (asFile OrFailureReport) @: qualifyFile @: qualifyRequest | |
asFile =: 200 ; ] | |
asFailure=: 400 ; formatErrors | |
qualifyFile =: parseFile NotingUnknownParsingError UnlessFailed | |
qualifyRequest =: getSheet, getCustCode, getAttachment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment