Watch this video for a definition of the recursive process.
- [Instructor] In this video,…we'll finish our inductive solution…by implementing the recursive process.…I'll create a function called generate,…and this will take either an n…or an n and the current board.…So I'll need to use the multi-arity syntax in Clojure.…I do this by creating an expression…and then putting a parameter within.…For this body, I'd like to call generate…with the given n, and an empty collection for the board.…Now I'll implement the version…of generate that takes two parameters.…
I'll give it n and board.…In this way, we can call generate…with just the n that we want, such as four or eight…to begin the recursive process.…As this function calls itself recursively,…it will provide the current board as the board parameter.…We'll start with using the lazy-seq macro…so that the function body will be lazy.…Using this, we'll be able to call generate…on a large input such as 20, and use take one…to take just a single solution for that board size.…
We're now in the body of the function.…Since this is recursive,…
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.