Scheme: When to use let, let*, and letrec?

<>

This question already has an answer here:

Answers


Your best bet is to read the official R5RS descriptions of let, let*, and letrec.

In short, however:

(let ((x 2))
 (let ((x 3) (y x))
  y) => 2

(let ((x 2))
 (let* ((x 3) (y x))
  y) => 3

So the difference between let and let* is let will evaluate all the bindings with respect to the level above (so it doesn't matter what order they're listed in) while let* does it sequentially. (let* ((x a) (b y))) is equivalent to (let ((x a)) (let ((b y))).

Letrec, on the other hand, allows you to bind recursive values. So you might write a recursive function that you only want to be within the function scope and bind it to a name using letrec.


Need Your Help

Call external url through $.ajax in WordPress theme

javascript jquery ajax wordpress wordpress-plugin

My WordPress application is hosted on url http://127.0.0.1/wordpress/ and i added following script in WordPress header to get some token but it does not give any token

Wrap border around contained text

html css width border

With the below code, it allows for a "code block" for code to stand out on. Is there a way that I can wrap, but not too tightly (20px border maybe?) the box around the text within? And related, is ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.