Here is a table of the Staten Island subway:
| STOP | STATION |
|------+-----------------|
| 1 | St. George |
| 2 | Tomkinsville |
| 3 | Stapleton |
| 4 | Clifton |
| 5 | Grasmere |
| 6 | Old Town |
| 7 | Dongan Hills |
| 8 | Jefferson |
| 9 | Grant |
| 10 | New Dorp |
| 11 | Oakwood Heights |
| 12 | Bay Terrace |
| 13 | Great Kills |
| 14 | Eltingville |
| 15 | Annadale |
| 16 | Hugenot |
| 17 | Prince’s Bay |
| 18 | Pleasant Plains |
| 19 | Richmond Valley |
| 20 | Arthur Kill |
| 21 | Tottenville |
and here is an Elisp function that maps a number to a name:
(defun sisubstops (s)
(pcase s
((guard (or (< s 1) (> s 21))) (message "Hey, just stops 1 through 21, please!"))
('1 (message "St. George"))
('2 (message "" Tomkinsville))
('3 (message "Stapleton"))
('4 (message " Clifton"))
('5 (message " Grasmere"))
('6 (message " Old Town"))
('7 (message " Dongan Hills"))
('8 (message " Jefferson"))
('9 (message " Grant"))
('10 (message " New Dorp"))
('11 (message " Oakwood Heights"))
('12 (message " Bay Terrace"))
('13 (message " Great Kills"))
('14 (message " Eltingville"))
('15 (message " Annadale"))
('16 (message " Hugenot"))
('17 (message " Prince’s Bay"))
('18 (message " Pleasant Plains"))
('19 (message " Richmond Valley"))
('20 (message " Arthur Kill"))
('21 (message " Tottenville"))))
So, when I'm trying to tell students that this is a function of a basically non-continuous phenomenon, i.e., we're not dealing with a function like f(x) = x^2
, rather a function that matches stops to names -- but it is still a function -- how can I get this across? One idea would be to got deep into Lambda Calculus and talk about how LC does conditionals. My first goal is to distinguish between continuous versus discrete; and yet I've written a Lisp function that can't really be represented as any sort of normal math function e.g., S(n) = M*n
where M
is some sort of machine or constant that takes a stop number and turns it into a stop name. Any ideas how, yes, this is a function? Or is this just a misnomer, i.e., comp-sci using/abusing the term function. So yes, how is sisubstops
really a function?