(wildsearch) (wildsearch takes a string and array of search strings on the stack. It returns a .true or .false depending on whether the array of search strings are all found in the target string) [ (.true)# (.exch)# [ (.exch)# (.pop)# (.search)# [ (.pop)# (.pop)# (.true)# ] [ (.pop)# (.false)# (.exit)# ] (.ifelse)# (.cvx)# (.exec)# ] (.cvx)# (.arrayforall)# [ (.pop)# (.true)# ] [ (.false)# ] (.ifelse)# (.cvx)# (.exec)# ] /xdef (wildbuild) (wildbuild takes a string of the form *s1*s2*...sn* and builds the array: [s1,s2...,sn].) [ (.mark)# (.exch)# (*) [ (.search)# [ 3 1 (.roll)# ] [ (.cnttomrk)# (.array)# (.astore)# (.exch)# (.pop)# (.exit)# ] (.ifelse)# (.cvx)# (.exec)# ] (.cvx)# (.loop)# ] /xdef (!S) [ () ] .def (/wildcard) (/wildcard takes a dictionary and a string of the form *s1*s2*...sn* on the stack. It then prints all names in the dict that contain the search pattern.) [ (wildbuild)# !S (.exch)# 0 (.exch)# (.aput)# [ (.pop)# ( ) (.cvis)# (.dup)# !S 0 (.aget)# (wildsearch)# [ (=)# ] [ (.pop)# ] (.ifelse)# (.cvx)# (.exec)# ] (.cvx)# (.dictforall)# ] /xdef