Skip to content

Instantly share code, notes, and snippets.

@greggirwin
Created March 24, 2017 17:59
Show Gist options
  • Save greggirwin/1495513366febe9bf8019bcb514f19c9 to your computer and use it in GitHub Desktop.
Save greggirwin/1495513366febe9bf8019bcb514f19c9 to your computer and use it in GitHub Desktop.
Interactive typeset list viewer
Red []
form-all: func [blk][forall blk [blk/1: form blk/1] blk]
types-of: function [value [typeset!]][
; typesets don't support reflection
third load mold value
]
get-sys-words: func [test [function!]][
collect [
foreach word words-of system/words [
if test get/any word [keep word]
]
]
]
list-of-sys-words: func [test [function!]][form-all sort get-sys-words :test]
list-of-types-of: func [typeset [typeset!]][form-all sort types-of typeset]
ts: list-of-sys-words :typeset?
dt: list-of-sys-words :datatype?
move find ts "any-type!" head ts ; Put any-type! at the top of the list
lay: copy [
style text-list: text-list 125x350 font-size 12
style _typeset: text [] blue
style _datatype: text [] navy
below
lst-typesets: text-list "Typesets" data ts [
; We have to form data to put it in a list, but convert it back
; to a word to extract its value.
lst-datatypes/data: list-of-types-of get to word! pick face/data face/selected
] return
lst-datatypes: text-list "Datatypes" data dt return
]
view lay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment