W1215 Function Signatures
From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Prerequisites[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 ~/Experiences
mkdir W1215
cd W1215
swift-init
Edit a new file named "main.swift"
emacs main.swift
Helpful Hint
For this project you'll repeatedly edit the same file. It's probably easiest to test this file within emacs by typing: F5-r 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.