02 Message
Important
The message structure goes in a separate file called “ic-msg.rkt”.The message structure gets its name abbreviated to “ic-msg” because we type it a lot.
A IC-Msg is a structure.
(make-ic-msg Number Number Color-String)
Interpretation:
(make-ic-msg from to col)
from: the id of the world sending the messageto: the id of the world the message is intended forcol: the new color that world is to show
The structure definition for a message should go in a separate file so
we can use advanced #lang racket features to make it simple to send.
Instructions
-
Open a new, empty file (new tab; Control-T).
-
Change the new file to Racket language mode. Go to the menu “Language”, select “Choose Language…” and then “The Racket Language”.
-
The file should contain only these three lines below:
#lang racket (provide (all-defined-out)) (define-struct ic-msg (from to col) #:prefab) -
Save the file in the same folder that contains your other code. (This works like the
posn-util.rktfile.)
After saving, verify that the file says “Determine language from source” in the bottom left part of the window. Not “Beginning Student”.
Common Problems
- The file must be in Racket language mode. (Menu: Language -> Choose Language … -> The Racket Language)
- There should be no space between the
#:andprefab. - This file should not begin with
(require picturing-programs).
If you have problems creating the file yourself, download it using Save link as… (ic-msg.rkt).