bs2facdev

Programming

D.R.Y. for Teachers

If it wasn't for SJIS (or some sort of MS Windows Encoding Page) troubles, this script would probably be useful and reliable. I'm fudging the possible encoding issues by, using “key” and “value” as backups when assoc doesn't find what it should in an associative list (alist, als). Playing with Scheme/Racket gives you the confidence to deal with any problem, if some detail isn't working, just throw in an if or cond statement, and maybe the results will help you figure out where the trouble is. DrRacket is great for showing where errors are, it even produces bright red lines that trace the errors for you...

There is a pattern, where I develop the script to generate useful pages to process one data file and then adapt it to handle several files in a directory. After the script seems to work for one data file, I get all the define definitions used to transform data (not those used to make functions) from the original file, and put those definitions into a let* expression (or clause) within a procedure that is used with for-each to go through a list of data files. Some definitions remain global, but all the definitions that rely on the data file go into a let* clause.

This code is re-working of earlier code (fn:1) that, from one .csv data file generated three files: a racket data file, a browser page to print roll sheets, and a browser page to print a seating chart. To get code that will generate three useful files (a rkt data file, a roll sheet, and a seating chart) for each .csv data file in a directory, I just had to see what belongs in a let* clause of the function that is mapped (with for-each for the side-effects and the list-generation) over a list of file paths.

A typo(bug) that disturbed my flow made me appreciate first and second in place of car and cadr. I had build-path errors that confused me for a while. when I moved the define cls-als (class associative list: alist: als) into the let* clause, I forgot the a in cadr. In place of a one-key one-value associative list, I ended up with, not a string, but a long list as the value. Without the string, I could build paths for file-generation. I imagine using first and second could make it easier to spot a mistake like that. But cddr is probably still useful instead of (rest (rest ....

There is another bug, where the first seat is taken up by the keys for associative list, or what could be viewed as column headers in a table of data. If there is time I'll see where in the chart-generation process to intervene, and get rid of the header intrusion. But the bug could be a feature, it can be nice to have an open table at the front of the room for returning papers, for set-up. With the Graded Direct Method teachers haul a lot of “realia” into the classroom, and tend to need tables and seats for demonstrations...

code

Read more...

It might be easier to share Dont' Repeat Yourself (D.R.Y. or OnceAndOnlyOnce) techniques if I get the Guile Scheme scripts(fn:1) to work in DrRacket(fn:2). If Convention Over Configuration principles can direct teachers toward a directory in their home-directory, and toward keeping their .csv data in particular folders, and to look for useful pages in particular folders… Given all that, a script like this could be useful for other people too.

Screenshot of Generated Pages: Roll Sheet and Seating Chart in Firefox Windowshttps://snap.as/bsmall2/racket-facdev/Binke65

I got a Guile script go through a directory of .csv data files (encoded in SJIS) and produce three useful files (encoded in UTF-8) for each data file. The next step is to get DrRacket to do the process below for several .csv files. And then another script should make it possible to use an edited ~-roll-data.rkt file to produce another seating chart. Sometimes the class needs a different ordering of seats: for example, people with hearing trouble might do better at the front of the class. And some class-rooms demand a wider row, in stead of a six-person row, a large class might need a ten-person row. But for now, this code, with build-path is probably more portable than my first attempt in Guile Scheme. (fn:1)

And comparing this Racket Script with the Guile Script is a chance to see differences among regexp-replace\* and regexp-substitute/global, scribble\html\html with its output-xml and sxml simple with its sxml->xml. I enjoyed the oppornity to practice quasiquote while learning to work with sxml->xml, but for the pages I generate here scribble\html and output-xml seems simpler. My regular expression needs are met by the simpler regexp-replace\* , but with more complex processes the pre andpost approach for regexpt![img](images/SJIS-csv-to-RollSheet-SeatingChart-1.png) -substitute/global might be helpful.

A Screenshot of DrRacket with the code used to generate  Roll Sheet and Seating Chart pages https://snap.as/bsmall2/racket-facdev/SNzGnvo

code

Read more...

While rushing to finish pasting .png files into a word processor document, I noticed that plots need a title for context. Maybe if I was able to completely avoid office software and stay with generated html pages it wouldn't matter as much, but while pasting images into documents it was hard to see which semester the plots belonged too.

The generated html page was ok when printed from firefox with the Landscape setting but the “float” layout broke with my laptop screen. Looking over css grid again helped with that issue. Printing to .pdf from Firefox is helpful but the files got really big for my recent pages with plot images..

Read more...

アンケートデータの視覚化 with Racket plot's stacked-histogram

Faculty Development Questionnaires give me an opportunity to work with Racket. Until now the questionnaire data provided opportunities to learn data visualization with two other languages: gnuplot with Philip Janert's book, and R/ggplot2 with Hadley Wickham's book. But for more regular work I was using emacs-lisp with org-mode. Without weekly practice with language like gnuplot or R/ggplot2, it was always a struggle to get back into the data manipulation and visualization flow once every six months. Recently my regular work goes well with Scheme.(fn:1) Guile Scheme is more compact that org-mode and emacs-lisp for converting jpg images to png and svg images and for generating worksheets, roll-sheets, and seating charts. However, I am not yet able to graph/plot/chart with Guile. Racket's plot lets me work well with Questionnaire data.

Racket stacked-histogram with University Data: English Version

It will be interesting to learn how to plot and label points at will, and how to adjust colors, but in the meantime racket/plot's stacked-histograms provide compact visualizations that may serve as springboards for discussion. I made the English version, to make it easier for non-Japanese readers to follow the code. Seeing two versions clearly shows the advantages of Chinese characters for compact information design.

Racket stacked-histogram with Department Data

There are eleven questions on the school's questionnaire. The first three questions attempt to gauge students feelings their participation in the class. What are their feelings about how often they `attended`出席 the class, how much they `spoke` in the class, and how much they `engaged` in the class. The next five questions gauge the students perceptions of how well they `heard` the teacher's voice, how they had `seen` the teacher's materials, how well `timed` the teacher's starting and ending of the classwas, how `responsive` the teacher was, as well as how `enthused` the teacher may have been. The last three questions are about overall perceptions of how much the student `comprehended` and `valued` the class, ending with a overall ranking of how `satisfied` the student is with the classes experienced so far. The questionnaires are usually filled out during the 13th or 14th class a 15-class semester.

もっと読む…