Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I do exponents in Scheme?

Tags:

scheme

pow, ^, ** doesn't work, and Scheme seems to be too common a word to be able to effectively google it.

like image 854
Claudiu Avatar asked Nov 06 '09 22:11

Claudiu


People also ask

How do you write an exponent in scheme?

(expt z1 z2) Returns z1 raised to the power z2. For z1 0 z1z2 = ez2 log z1 0z is 1 if z = 0 and 0 otherwise. Searching for "scheme reference" turns up this document.

What is a scheme function?

A function object can be bound to a name via define like any other kind of value. But we often use a slightly different, equivalent syntax for function definitions, where the ' lambda ' is implicitly specified. (define f (lambda (p1 p2) ... ))


2 Answers

From R5RS Standard Pocedures:

(expt z1 z2)   Returns z1 raised to the power z2. For z1 0  z1z2 = ez2 log z1  0z is 1 if z = 0 and 0 otherwise. 

Searching for "scheme reference" turns up this document.

like image 50
Laurence Gonsalves Avatar answered Sep 22 '22 15:09

Laurence Gonsalves


The answer is expt and I am typing because StackOverflow doesn't like too short answers.

like image 21
Claudiu Avatar answered Sep 18 '22 15:09

Claudiu