diff options
Diffstat (limited to 'haunt/jakob/dynamic/util.scm')
| -rw-r--r-- | haunt/jakob/dynamic/util.scm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/haunt/jakob/dynamic/util.scm b/haunt/jakob/dynamic/util.scm index a7fd38d..92b2f25 100644 --- a/haunt/jakob/dynamic/util.scm +++ b/haunt/jakob/dynamic/util.scm @@ -82,3 +82,24 @@ If KEY does not exist in TABLE, initialize kEY to (list ITEM)" (if (hash-ref table key) (hash-set! table key (cons item (hash-ref table key))) (hash-set! table key (list item)))) + +(define (emoji? str) + "Determine if `str' is an 'acceptable' emoji character + +Acceptable is the following subset: + +- The 'Emoticons' block +- The 'Supplemental Symbols and Pictographs' block, excluding U+1F900 + through U+1F90B +- The hand symbols from the 'Miscellaneous Symbols and Pictographs' + block +- The hand symbols from the 'Dingbats' block + +Notably, U+1F946 isn't normally treated an emoji, but it is here. I +think it should be! As an American, I should be able to use pictographs +to express my God-given constitutional rights!" + (and (string str) + (= 1 (string-length str)) + (let ((codepoint (char->integer + (first (string->list str))))) + (and (>= codepoint #x1F600) (<= codepoint #x1F64F))))) |