<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">What called my attention to PLT scheme was its editor, and unicode processing facilities. I am a very poor writer. Therefore, since I know Ancient Greek, my teachers suggested reading and translating Homer to improve my writing skills. Homer wrote in a kind of language that has many similarities with Ancient Greek. The first step was to write an editor to deal with Homer's language (there aren't many of them around, you know :-) I tried to write the editor in Clean. However, Clean does not deal with Unicode strings at all. I switched to Bigloo. Although Bigloo has tools to work with unicode, these tools are awkward, and I failed. <br><br>To my surprise, PLT worked almost flawlessly with the Homeric text. I mean, the IDE didn't work correctly, but the resulting program is almost perfect. Interesting enough, the only charcter that the editor
does not renders well is ... lambda, the symbol of functional programming. Below, you will find a simplified version of the module that produces a latex document from a unicode edition of the Odyssey (www.perseus.tufts..edu). Here are the first two lines of the Odyssey, with latex produced by the program:<br><br>ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ<br>πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν:<br><br>>'andra moi >'ennepe, mo\~usa, pol'utropon, <`oc m'ala poll`a\\<br>pl'agqjh, >epe`i Tro'ihc <ier`on ptol'iejron >'epersen;<br><br><br><br><br>(module greekfilter scheme/gui<br> <br> (define (geragreek b n)<br> (cond ( (< n 1) '())<br> ( (cons (list b (list->string
<br> (list(integer->char b))))<br> (geragreek (+ b 1) (- n 1))))))<br> <br> (define (gb b n)<br> (geragreek b n))<br> <br> (define gcod<br> '( <br> (913 "A") (914 "B") (915 "G") (916 "D")(917 "E")<br> (918 "Z") (919 "H") (920 "J") (921 "I") (922 "K")<br> (923 "L") (924 "M") (925 "N") (926 "X") (927 "O")<br> (928 "P") (929 "R") (931 "S") (932 "T") (933 "U")<br> (934 "F") (935 "X") (936 "Y") (937
"W")<br> (945 "a") (946 "b") (947 "g") (948 "d") (949 "e")<br> (950 "z") (951 "h") (952 "j") (953 "i") (954 "k")<br> (955 "l") (956 "m") (957 "n") (958 "x") (959 "o")<br> (960 "p") (961 "r") (962 "c") (963 "s") (964 "t")<br> (965 "u") (966 "f") (967 "q") (968 "y") (969 "w")<br> ;; ἀἁἂἃ ἄἅἆἇ ἈἉἊἋ ἌἍἎἏ <br> (7936 ">a") (7937 "<a") (7938 ">`a") (7939 "<`a")<br> (7940 ">'a") (7941 "<'a") (7942 "{\\char 146}") <br> (7943 "\\char 145")<br> (7944 ">A") (7945 "<A") (7946 ">`A") (7947
"<'A")<br> (7948 ">'A") (7949 "<'A") (7950 "\\~>A") (7951 "\\~<A")<br> ;; ἐἑἒ ἓἔἕ<br> (7952 ">e") (7953 "<e") (7954 ">`e") <br> (7955 "<`e") (7956 ">'e") (7957 "<'e")<br> ;; ἘἙἚ ἛἜἝ<br> (7960 ">E") (7961 "<E") (7962 ">`E") (7963 "<`E") (7964 ">'E") (7965 "<'E")<br> ;; ἠἡἢἣ ἤἥἦἧ ἨἩἪἫ ἬἭἮἯ<br> (7968 ">h") (7969 "<h") (7970 ">`h") (7971 "<`h")<br> (7972 ">'h") (7973 "<'h") (7974 "{\\ese}") (7975
"{\\hee}")<br> (7976 ">H") (7977 "<H") (7978 ">`H") (7979 "<`H")<br> (7980 ">'H") (7981 "<'H") (7982 "\\~>H") <br> (7983 "\\~<H")<br> ;;<br> (8032 ">w") (8033 "<w") (8034 ">`w") (8035 "<`w")<br> (8036 ">'w") (8037 "<'w") (8038 "{\\w}") (8039 "{\\hw}")<br> (8040 ">W") (8041 "<W") (8042 ">`W") (8043 "<`W")<br> (8044 ">'W") (8045 "<'W") (8046 "\\~>W") (8047 "\\~<W")<br> (8000 ">o") (8001 "<o") (8002 ">`o") (8003 "<`o")(8004 ">'o")(8005 "<'o")<br>
(8008 ">O")(8009 "<O") (8010 ">`O") (8011 "<`O") (8012 ">'O") (8013 "<'O")<br> <br> (8016 ">u") (8017 "<u") (8018 ">`u") (8019 "<`u") (8020 ">'u") (8021 "<'u")<br> (8022 "{\\usu}") (8023 "{\\huu}") (8025 "<U")(8027 "<`U")(8029 "<'U")<br> (8031 "\\~<U") (8160 "\\u u") (8161 "\\=u")<br> (8162 "`u"); ῢ<br> (8163 "'u"); ΰ<br> (8164 ">r") (8165 "<r") (8166 "\\~u")<br> (8167 "\\~u") ;ῧ<br> (8168 "U") ; Ῠ<br> (8169 "U") ; Ῡ<br> (8170 "`U")
(8171 "'U") (8172 "<R") (8048 "`a") (8049 "'a") (8050 "`e")<br> (8051 "'e") (8052 "`h") (8053 "'h") (8054 "`i") (8055 "'i") (8056 "`o")<br> (8057 "'o") (8058 "`u") (8059 "'u") (8060 "`w") (8061 "'w") (7984 ">i")<br> (7985 "<i") (7986 ">`i") (7987 "<`i") (7988 ">'i")<br> (7989 "<'i") (7990 "{\\ii}") (7991 "{\\hii}") (7992 ">I")<br> (7993 "<I") (7994 ">`I") (7995 "<`I") (7996 ">'I")<br> (7997 "<'I") (7998 "\\~>") (7999 "\\~<") (8125 "\\e")<br> (8178 "`w|") (8179 "w|") (8180 "'w|") (8182 "\\~w")<br> (8183 "{\\wi}")
(8184 "`O") (8185 "'O") (8186 "`W") <br> (8187 "'W") (8188 "Wi") (8128 "\\~") (8130 "`h|")<br> (8131 "h|") (8132 "'h|") (8134 "\\~h") (8135 "{\\eei}")<br> (8136 "`E") (8137 "'E") (8138 "`H") (8139 "'H")<br> (8140 "Hi") (8141 "{>`}") (8142 "{>'}") (8143 "\\~>") (8144 "{\\u i}")<br> (8145 "{\\=i}")<br> (8146 "`i") ;;ῒ<br> (8147 "'i") ;;ΐ<br> (8150
"\\~i")<br> (8151 "\\~i") ;;ῗ<br> (8152 "I") ;;Ῐ<br> (8153 "\\=I") ;;Ῑ<br> (8154 "`I") (8155 "'I")<br> (8220 "{\\oq}") (8221 "{\\cq}") (8064 ">a|") (8065 "<a|")<br> (8066 ">`a|") (8067 "<`a|") (8068 ">'a|") (8069 "<'a|")<br> (8070 "{\\char 150}") (8071 "{\\char 149}")<br> (8080 ">h|") (8081 "<h|") (8082 ">`h|") (8083 "<`h|")<br> (8084 ">'h|") (8085 "<'h|") (8086 "{\\esei}") (8087 "{\\heei}")<br> <br> (8096 ">w|") (8097 "<w|") (8098 ">`w|") (8099
"<`w|")<br> (8100 ">'w|") (8101 "<'w|") (8102 "{\\wswi}") (8103 "{\\hwi}")<br> (8104 ">Wi") (8105 "<Wi") (8106 ">`Wi") (8107 "<`Wi")<br> (8108 ">'Wi") (8109 "<'Wi") (8110 "\\~>Wi") (8111 "\\~<Wi")<br> (8112 "\\u a") (8113 "\\=a") (8114 "`a|") (8115 "a|")<br> (8116 "'a|") (8118 "\\~a") (8119 "{\\ai")<br> (8122 "`A") (8123 "'A") (970 "{\\\"i}")<br> )<br> )<br> <br> (define (convert1 c)<br> (cond ( (equal? c #\newline) "\\\\\n")<br> ( (equal? c #\:) ";")<br> ( (<
(char->integer c) 255) c)<br> (else (let ((x (assoc (char->integer c) gcod)))<br> (if x (cadr x) "*"))) ))<br> <br> (define diálogo <br> (new dialog% (label "GreekFilter")))<br> <br> (define txt<br> (new text%))<br> <br> (define edtxt<br> (new editor-canvas% [parent diálogo]<br> [editor txt]<br> (min-height 200)<br> (min-width 500)))<br> <br> (define painel (new horizontal-panel% [parent diálogo] <br>
(alignment '(center center))))<br> <br> (define pasteButton<br> (new button% [parent painel] (label "Paste")<br> (callback (lambda(b e) (send txt paste )))))<br><br> (define cpyButton<br> (new button% [parent painel] (label "Cut")<br> (callback (lambda(b e) (send txt cut )))))<br><br> (define (convert b e)<br> (send txt insert<br> (with-output-to-string <br> (lambda()<br> (let ((s (send txt get-text)))<br> (newline)(newline)<br> (do ( (i 0 (+ i
1)))<br> ( (>= i (string-length s)))<br> (display (convert1 (string-ref s i)))))))))<br> <br> (define prtFirst<br> (new button% [parent painel] (label "2TEX")<br> (callback convert)))<br> <br> (send diálogo show #t) <br>)<br><br><br><br><br><br>--- On <b>Sat, 7/4/09, Matthew Flatt <i><mflatt@cs.utah.edu></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Matthew Flatt <mflatt@cs.utah.edu><br>Subject: Re: [plt-scheme] GUI editor simple example<br>To: "Hugh Myers" <hsmyers@gmail.com><br>Cc: plt-scheme@list.cs.brown.edu<br>Received: Saturday, July 4, 2009, 7:47 AM<br><br><div class="plainMail">At Sat,
4 Jul 2009 01:44:42 -0600, Hugh Myers wrote:<br>> Given:<br>> <br>> (define f (new frame% [label "Simple Edit"]<br>> [width 200]<br>> [height 200]))<br>> (define c (new editor-canvas% [parent f]))<br>> (define t (new text%))<br>> (send c set-editor t)<br>> <br>> How do I control the initial font?<br><br>Setting the font is more complicated than it should be. You have to<br>create a `style-delta%' (which has a poor API), and then apply the<br>style delta with `change-style'.<br><br>For example, to change the font to size 20:<br><br> (send t change-style (make-object style-delta% 'change-size 20))<br><br>To set the font to "Times":<br><br> (send t change-style (send (make-object
style-delta%)<br> set-delta-face "Times"))<br><br>> How do I insert a line of text? <br><br>(send t insert "Hello\n")<br><br>> Lines?<br><br>(send t insert "Hello\n")<br>(send t insert "Goodbye\n")<br><br>_________________________________________________<br> For list-related administrative tasks:<br> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br></div></blockquote></td></tr></table><br>
<hr size=1>Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the <a href="http://ca.promos.yahoo.com/newmail/overview2/"><b>All-new Yahoo! Mail </b></a>