bs2gs

Learning Guile Scheme

Learning Guile Scheme is helping me to implement D.R.Y. for teachers. The script below opens .csv files (encoded in the troublesome SJIS or cp932 Japanese character set). For each .csv file the script saves three files: two html files and a scheme file. Printing the html files provides a seating chart to start the semester, and a roll sheet for use throughout the semester. The scheme file is provides a way to end the semester by printing a simple html page to show class dates and attendance. That second script still needs to be made presentable. But the starting script may be useful.

Developing the script let me discover compact expressions to open and write files. Longer expressions derived from Kent Dybvig's /The Scheme Programming Language: Fourth Edition/ worked. Shorter expressions from the Guile Manual helped. There must be a simpler way to print scheme definitions to a file but now I use and output string and juggle symbols and strings. It's awkward, but it works for now.

With simple html (generated by sxml->xml) and .css (view2.css file) the pages have a good “ink to data” ratio. I think the style is consistent with that found in Koreo Kinoshita's (木下是雄) books: “Writing Techniques for Science Majors” 理科系の作文技術 and “Putting Together Reports” レポートの組み立て方 .

Here is a collage of samples from the script's generated pages, and Kinoshita's book on reports.

Read more...

After a few weeks with Guile I can now do with Scheme what I used to do with org-mode. The work flow is still in emacs but with the Geiser and shell modes there is less overhead. With less overhead it is easier to focus on the data, the solutions, and learning Guile Scheme with emacs as a second language. Typing data into Lisp lists may be simpler than working with tables, even org-table which seem to have so much less overhead than office software spreadsheets.

With free software, even irritating administrative work demanded by bureaucracy can be fun. With some time and free approach, bureacracy doesn't have to make us stupid all the time.(fn:1)

Emacs, Guile, and Firefox

Later I will show how to convert a csv data file to associative lists, but for now this script is an example of getting data(lists) from a file(port) and using the file name and data to generate an html page with sxml. I took me a while to get used to opening ports, and to remember to set their encodings to overcome issues with Japanese characters.

At first glance the sxml->xml and backquoting seemed overwhelming, but after some immersion experiences, mapping over lists to generate markup becomes second nature. If you see a lot of (quote (unquote ... in the generated sxml, it means that you typed a single-quote “ ' ” instead of a back-tick “ ` “.

Read more...

Guile lets us use ImageMagick and potrace with the procedures system and system*. I use (system "ls") to check the files in the REPL's current working directory. Browsing the manual(fn:1) showed (getcwd) as a way to avoid (system "pwd"), and (chdir "directory-to-change-to") as a way to stay in scheme.

もっと読む…

Recursion in general and named let in particular provide a natural way to implement many algorithms, whether iterative, recursive, or partly iterative and partly recursive; the programmer is not burdened with two distinct mechanisms. —– R. Kent Dybvig (fn:1)

This paragraph made me think of Ogden's Basic English and the English Through Pictures by I.A. Richards and Christine Gibson. Avoiding unnecessary burdens makes for better learning and working with ideas. Named let might have a place in a sequence with the aim of learning the most lucid and widely useful constructs for working with a computer language.

“Named let” didn't make sense to me when I first read in The Scheme Programming Language. (fn:1)

Read more...

Scheme Languages have fascinated me for a while, along with Racket, Emacs Lisp, and Common Lisp. It's hard to decide(fn:0) which language to concentrate on. But, on principle, I have to go with Guile: Gnu's Ubiquitous Intelligent Language Extension. And, in practice, SXML and scheme seem like a good way for me to re-implement the way I generate teaching worksheets from pictures and sentences. Also, the quote notation of I.A. Richards might be made more accessible with scheme-generated html pages too. Ethically, the most principled way, doing the right thing is the most important. Probably, in the long run, the time and attention dedicated to working with Free Software is the best way to grow and contribute as a decent person.

Free Programming Start: Computers on Kotatsu

Debian 9 with Gnome makes these computers, an older smaller notebook bought used and a newer larger laptop, work for me. I've been using the larger laptop for much longer than the older notebook, which I bought used and loaned to people as an free software experience.

Along with Racket, GNU's Guile Scheme from Debian's apt repositories had been on the bigger computer for some time. I was able to play with some examples while reading R. Kent Dybvig's The Scheme Programming Language ,but, Skribilo's installation gave me trouble a few months ago.

With a few free hours the other night, I read slow enough to see the Skribilo needs Guile 2.2 while I only had Guile 2.0. Complications took some time to overcome during the installation on larger computer that had Guile 2.0. Overcoming those complications made installation on the next computer easier, but Guile 2.2.4 seems to need a Guile 2.0 installation in order to have shared libraries to access. For learning Skribilo, and if all goes well – Artanis as well, I imagine I will only need one Guile. So I uninstalled Guile 2.0 apt uninstall guile after installing Guile 2.2.4.

Read more...