W1215 Function Signatures
Function Signatures[edit]
Research[edit]
Function signatures consist of the function's name (identifier); parameter arity, types, names, and order; and the function's return type. (Note that various languages treat some of these items differently. For example, not all languages allow for a different return type if the signature is otherwise identical.)
- Read Functions (First paragraph only) (Swift Documentation)
- Read Type Signature (Wikipedia)
- Read Computer Science I Textbook (by Bourke) Chapter 5.1.1. Function Signatures
Experiment[edit]
Create a directory within your "project" directory.
cd ~/projects
mkdir project-1215
cd project-1215
Edit a new file named "main.swift"
emacs main.swift
For this project you'll repeatedly edit the same file. It's probably easiest to test this file within emacs by typing: M-& (async-shell-command) and observing the results. For each question, be sure to understand the behavior before proceeding to the next question. It will be helpful to record your answers and reasoning for later review.
Helpful hint: The async-shell-command can be executed with Alt-Shift-7. The command to execute each time is: swift main.swift