This is How Easy it is to Make Changes to DrRacket

DrRacket is open-source (LGPL) editor for Racket. Sometimes you want to make changes to it. For example today I wanted to enable online compilation on single-core machines. Here is how easy it is to do it:

  1. Assuming that DrRacket is already installed. This is a normal installation using the installer; you do not typically have to check out the Git repo to make changes.
  2. Asked Robby how to make the change. Robby is super everybody knows that, he explained the fix. The check for enabling the feature is in module-language.rkt. Here are the steps
  3. cd /opt/racket/5.3.1/collects/drracket/private/
    sudo cp module-language.rkt module-language.rkt-ORG
    # Made the change
    # View it
    diff module-language.rkt module-language.rkt-ORG
    1329,1330c1329
    <                    ;;(> (processor-count) 1))
    <                    (> (processor-count) 0))
    ---
    >                    (> (processor-count) 1))
    1348,1349c1347
    <                    ;;(> (processor-count) 1))
    <                    (> (processor-count) 0))
    ---
    >                    (> (processor-count) 1))
    # Tell Racket to recompile that collection (aka library)
    sudo raco setup -l drracket
    # Restart DrRacket
    
  4. Now the online compilation indicator shows up and errors are automatically flagged.
  5. It works fine on a 1.6GHz Pentium with 2GB of RAM.

Hope this gave you a taste of how easily and quickly you can try new stuff out in DrRacket itself.
Here is how it looks with it turned on:

DrRacket for the Truly Impatient V02

DrRacket is a wonderful editor. It is so feature rich that the first time you begin using it, you may end up missing out on how powerful and pleasant it is to use due to the multitude of options and features. The following is my attempt to share the most useful and interesting features and get a new-user up and running and feeling really good about it as quickly as possible.
Continue reading “DrRacket for the Truly Impatient V02”

Which power function is right for Clojure?

(ns power.examples)
(defn non-acc-pow [base exp]
  (if (zero? exp)
    1
    (* base (non-acc-pow base (dec exp)))))
(defn acc-pow [base exp]
  (letfn [(loop [base exp acc]
            (if (zero? exp)
              acc
              (recur base (dec exp) (* base acc))))]
    (loop base exp 1)))
(defn lazy-pow [base exp]
  (letfn [(loop [cur]
            (cons cur (lazy-seq (loop (* cur base)))))]
    (nth (take exp (loop base)) (dec exp))))
(defn iter-pow [base exp]
  (nth (take exp (iterate (partial * base) base)) (dec exp)))
(defn apply-pow [base exp]
  (apply * (repeat exp base)))
(= 16
   (non-acc-pow 2 4)
   (acc-pow 2 4)
   (lazy-pow 2 4)
   (iter-pow 2 4)
   (apply-pow 2 4))

Geiser 0.2.1 ELPA Package

Here is an ELPA package for the Geiser library.
The code is original from the author, I just packaged it up!
Here is one way to install it:

(require 'package)
(when (not (package-installed-p 'geiser))
  (url-copy-file
 "https://www.wisdomandwonder.com/wp-content/uploads/2012/09/geiser-0.2.1.tar"
 "/tmp/geiser-0.2.1.tar"
 t)
  (package-install-file "/tmp/geiser-0.2.1.tar"))

Emacs Pretty Mode Plus ELPA Package

Here is an ELPA package for the pretty-mode.el library.
The code functionality is original from the author, I just tweaked the pretty symbols and packaged it up!
Here is one way to install it:

(url-copy-file
 "https://www.wisdomandwonder.com/wp-content/uploads/2012/09/pretty-mode-plus-1.0.tar"
 "/tmp/pretty-mode-plus-1.0.tar"
 t)
(require 'package)
(package-install-file "/tmp/pretty-mode-plus-1.0.tar")

Addendum: 09/29/12
Fixed the package definition and now it is on Marmalade here.
Addendum: 11/29/12
Added Jess mode support.