Learn how to create a command-line interface for the program.
- [Narrator] In this video we'll create a command line…interface to display all of the results.…First, I'll create a function called display results,…make it take a value n for the size…of boards we want to display.…Now I'll use doseq, and we'll iterate over…all of the solutions and print each one.…Inside of the doseq binding I'll call generate n…to generate our solutions.…Next I'll wrap this in map-indexed with the function vector.…
In this way we'll have an index for…every board that we generate.…On the left hand side now I'll de-structure the return…into I, for the index of the board,…and board for the board itself.…Inside of the doseq I'll now use print+ln…to print a caption that says board, and a few spaces,…then I'll print the index.…I'll increment it here because the indexes are zero-indexed…and humans expect them to be one-indexed.…
Now, for each board, I simply call…board display on that board.…We can now call display results to print the solutions…for all boards of size n.…To wire this into a command line application…
Skill Level Intermediate
1. Problem 1: Exploring Lake Pend Oreille
2. Problem 2: Image Analysis
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Recursion and Directories
6. Problem 6: Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.