laurent.orseau
2021-2-13 12:43:22

Script of the day: Don’t wait for @notjack’s resyntax, fix your #t and #f https://gist.github.com/Metaxal/52ec3ee6fc43b0e8917d19c3daf2c57b\|today! #lang racket/base ;;; License: [Apache License, Version 2.0](<http://www.apache.org/licenses/LICENSE-2.0>) or ;;; [MIT license](<http://opensource.org/licenses/MIT>) at your option. (require quickscript) (script-help-string "Replaces all occurrences of #t and #f with #true and #false in the selected text (warning: in strings too!)") (define-script fix-true-false #:label "fix-true-false" (λ (selection) (regexp-replaces selection '([#px"#t\\b" "#true"] [#px"#f\\b" "#false"]))))


spdegabrielle
2021-2-13 12:47:01

You gotta submit this for Racket News! I’d love for the full code to be included in racket news as it is so short.


laurent.orseau
2021-2-13 12:48:14

I guess you could make it even yummier: (define-script fix-true-false #:label "fix-true-false" (λ (selection) (regexp-replaces selection '([#px"#t\\b" "#true"] [#px"#f\\b" "#false"])))) (edit: top post edited too)


spdegabrielle
2021-2-13 12:49:25

I’m going to post on racket-users - if you don’t mind?