Lecture 20: Car-Cdr Recursion Problem that Returns the Sum of Every Element in a List of Integers
published: Sept. 7, 2010, recorded: April 2008, views: 145
released under terms of: Creative Commons Attribution Non-Commercial (CC-BY-NC)
Report a problem or upload filesIf you have found a problem with this lecture or would like to send us extra material, articles, exercises, etc., please use our ticket system to describe your request and upload the data.
Enter your e-mail into the 'Cc' field, and we will keep you updated with your request's status.
Okay, if I want to go ahead and do something like this, I want it to come back with a zero. And so, what I’m going to exploit here is – I think it’s something that’s pretty conceptually obvious to everyone – is that the sum of this entire list is gonna be 1 plus whatever the sum of this list is. I’m gonna exploit the fact that cuda is available to me, and it’s very, very fast to just kind of recurse on the tail of the list. For the implementation, is this right here. If it is the case that null of num list passes, or comes back with a true, then it evaluates this expression. ...
See the whole transcript at Programming Paradigms - Lecture 20
Link this pageWould you like to put a link to this lecture on your homepage?
Go ahead! Copy the HTML snippet !