Oh yeah - the "vectorless" forms of the functions use case-lambda so the originals are all still usable as is.
------Original Message------ From: Shiny Happy People To: [email protected] Sent: Mar 10, 2009 6:41 PM Subject: Apropos, Printing matrices and a little syntactic sugar Hey folks - I don't know if anyone is interested, but I've implemented the following functions and am happy to share. Since I'm trying to learn/remember scheme programming and discovering all the different libraries out there, including libfluxus I find apropos to be REALLY HELPFUL. ; apropos - Searches the global symbol table for symbols containing the string passed to it > (apropos "format") ("format" "pretty-format") ; pmat and pvec - pretty print matrices and vectors . > (define m (mtranslate (vector 1 2 3))) > (pmat m) 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0.000 1.000 2.000 3.000 1.000 > (pvec (vector 1 2 (sin 3))) 1.000 2.000 0.141 ; non vector forms of (m)rotate and (m)translate > (pmat (mrotate 0 180 0)) -1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 -0.000 0.000 -1.000 0.000 0.000 0.000 0.000 1.000 ; same results as: >(pmat (mrotate (vector 0 180 0))) -1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 -0.000 0.000 -1.000 0.000 0.000 0.000 0.000 1.000 -- Here's the code that implements apropos... I'm thinking it might be cool to link it in with fluxus documentation functions too. ;; apropos (define apropos-regex #f) (let ((apropos-list (map symbol->string (namespace-mapped-symbols)))) (set! apropos-regex (lambda (s) (let ((al (filter (lambda (l) (regexp-match s l)) apropos-list))) al)))) (define (apropos s) (apropos-regex (string-append ".*" s ".*"))) -Scott Sent via BlackBerry from T-Mobile
