Skip to content

Instantly share code, notes, and snippets.

@lsparrish
Created December 25, 2009 19:49
Show Gist options
  • Select an option

  • Save lsparrish/263734 to your computer and use it in GitHub Desktop.

Select an option

Save lsparrish/263734 to your computer and use it in GitHub Desktop.
( This is an implementation of crc's ifExists which demonstrates the )
( parsing of curly braces for the conditional evaluation of text. )
{{
: cut ( a-a )
dup getLength over + 1- dup @ 32 =if
0 swap ! else drop then ;
: "cut ( c"-a ) accept tib tempString cut ;
: '{ ( "-a ) char: { "cut ;
: '} ( "-a ) char: } "cut ;
---reveal---
: ifExists ( "- )
'{ find
'} swap if dup getLength eval ;then drop ;
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment