bsmall2 Learning Racket

Scheme

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...