bsmall2 Learning Racket

Learning to Learn Racket, the Lisp- Scheme-like language with DrRacket

The Racket language lets me enjoy scripting, so that the adding machine does work that would be repetitive drudgery the human being. Automating “the boring stuff” is what computers are for.

This little script makes it easy for me to share pictures that have been batch-converted with Racket. (fn:1) I have a script that takes a text file of image basenames (such as “010”) with sentences and generates an html page to print out as a worksheet. The worksheets have been working well for our GDM (Graded Direct Method) class, but uploading the pictures with Markdown to WriteFreely is going to get more cumbersome as the sentences get longer and more numerous.

An hour or two of focus this evening let me WriteFreely blog the fourth lesson in a smooth manner. (fn:2)

Dr Racket Screenshot of text to markdown script

Read more...

宮崎県立都城農業高校の冷水機

A water fountain at Miyakonojyo Agricultural High School reminded me of a Financial Literacy lesson idea. I used to do this with emacs org-mode tables and it was fun. But now, with Beginning/Basic Education in the back of my mind, I try to do everything in DrRacket (and then use emacs to get a shell script to work).

Water Fountain Financial Literacy with DrRacket

Code

Read more...

At some point, I should use student comments to help explain teaching English with the Graded Direct Method. (fn:1) At the start of the semester more than half the students write comments at the bottom of the class worksheets. (fn:2) I print out the comments and leave them on the table where students collect the previous's classes worksheets at the start of every class. With emacs org-mode I used two windows and a keyboard shortcuts to keep a list of comments and their student's numbers in sync. Then I exported just the comments. Without consent to publicize the comments it seemed like a decent way to share the comments in class. (The few comments included in the script were edited and/or translated beyond recognition from among 58 comments.) After working with Guile and Racket over the past month or so, it seems simpler to just work with nested association lists. At least the data entry part will be simpler. I might end up re-inventing the wheel in the area of data-base-like approaches, but re-discovery will be good for my learning when/if I ever need to learn/use databases.

Nested Association Lists to Generate Pages of Class Comments.

During a rainy afternoon, I wondered how working with nested association lists would be. The exercise helped me clear up vague misunderstandings about association lists.

もっと読む…

Before posting pictures to Diaspora*, pixelfed, or writefreely I often select the worthwhile parts in Gimp. After selecting the worthwile part of a pictures, if the part is still larger than 700 pixels (for Diaspora*) or 1400 pixels (for pixelfed) I try to re-size the snippet before uploading. Re-sizing seems like a decent, or “ethical”, thing to do. I haven't been able to donate to some of the servers that make my free SNS accounts possible, and I hope to avoid burdening any viewers. Resizing before uploading lessens burdens on servers and devices (I imagine). Besides the general ethical reasons, some servers have volume limits, so keeping image sizes down should let me share more photos before approaching my limits.

I re-size the image in Gimp before exporting the photo to an “edited” folder. The photo manager shotwell organizes photos in year/month/day directories. So one day a program could go through the directories created by Shotwell, find all the edited pictures, and organize them in a useful way. In the meantime, I just want save a step in Gimp. With this Racket script I can just save selections to the “edited” directoy without the extra step of resizing the image canvas. It will save time to avoid working with menus…

DrRacket Screenshot: Resize jpg files script

This time I got the script working in DrRacket first, then made an executable script in Emacs…

Read more...

With Racket's path utilities I was able to get this script working a lot faster than I was able to get an earlier Guile script working. (fn:1) Why are command-line arguments treated as vectors? That's a mystery for later. In the meantime this script is useful, and it is the first step toward getting all my teaching materials generated through Racket scripts. DrRacket on windows may provide a way to ease teachers towards independence with free software. Once people can do everything with free applications, like DrRacket, Gimp, Firefox, and Inkscape: they won't feel dependent on a proprietary OS.

DrRacket Screenshot: jpgs->svgs

Maybe it's just because of all the hours spent with the Racket Language since I made the Guile Scheme script, but Racket seemed to let me develop a batch conversion script much faster. Previous experience with `build-path` helped a lot, I never saw anything similar in the Guile documentation so a lot of time went into developing string-based utilities to manipulat paths. I imagine this Racket version could work in DrRacket on a Windows OS, if ImageMagick's `convert` and the `potrace` utility are installed.

Emacs script and shell buffers

Read more...

Since Racket grew out of Scheme, and Scheme is a honed Lisp, maybe Learning Racket Through Examples should start with list . It might be fun to introduce some of this on a white-board while learners guess how DrRacket will respond. With four or five procedures (functions?) to play with, how much time would learners like to spend trying out various combinations?

Screenshot of DrRacket: Thinking of a Graded Sequence of Examples for Learning

Would these examples be suggestive enough for English-language learners to think about the meaning of list , map , build , string , character , integer ....

Read more...

A student having trouble in English class came for some help. We ended up talking about computers, programming, and free software. The next time, he came with his computer. It seemed to be the computer recommended and sold by the university co-op. The computer booted into the MS Windows OS, so the easiest way to get started seemed to be with DrRacket. There wasn't much time to play with Inkscape, Gimp, or Emacs. The student seemed to enjoy DrRacket. He wanted to play with big numbers, so I had to figure out the term for exponent and how to do exponents ( (expt 6 36) )with the Racket Language.

DrRacket catches errors before RUNning

The episode has been in my mind for the last nine months or so. After learning Scheme's iota and Racket's plot over the past month or so I'm wondering if this sort of sequence might be fun for learners with a desire to play with numbers.

Possible Graded Sequence for Plotting Functions

Read more...