Skip to content

Instantly share code, notes, and snippets.

@zaphar
Last active August 29, 2015 14:22
Show Gist options
  • Save zaphar/bfe174b4aba4f4ed5fd4 to your computer and use it in GitHub Desktop.
Save zaphar/bfe174b4aba4f4ed5fd4 to your computer and use it in GitHub Desktop.
++ showbadcode
|= [code=tape]
=+ ^= result
(mule |.((slap !>(.) (ream (crip code)))))
?: ?=(%.y -.result)
=+ good=p.result :: successful!
;code
;pre: {code}
;pre: product => {<good>}
;pre: result => {~(ram re (sell good))}
==
=+ error=p.result :: Oh noes it didn't work.
;code
;pre: {code}
;* %+ turn
error
|= a=tank
^- manx
;pre: error: {~(ram re a)}
==
++ testbadcode
(showbadcode "=+(a=1 a)")
:: Usage example below.
;pre: {<testbadcode>} :: this works and outputs: [[%code ~] [[%pre ~] [[%~. [%~. "=+(a=1 a)"] ~] ~] ~] [[%pre ~] [[%~. [%~. "product => "] ~] ~] [[%~. [%~. "[p=#t/@ud q=1]"] ~] ~] ~] [[%pre ~] [[%~. [%~. "result => "] ~] ~] [[%~. [%~. "1"] ~] ~] ~] ~]
;- testbadcode :: This causes a type-fail error
;- %- showbadcode """ :: This also causes a type-fail error.
=+ a=1
b
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment