Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scheme: About cond

Tags:

lisp

scheme

(cond ((test-1) (expression-1)))

When i use a cond, can i give the several functions in (expression-1)?

Like this:

(cond ((= 1 1) ((fun1) (fun2)) )

like image 967
Sam aprk Avatar asked Nov 30 '25 15:11

Sam aprk


1 Answers

The begin is actually optional -- cond (in Scheme as well as in Emacs Lisp, at least) take multiple expressions after each test expression and evaluate them in turn in an implicit begin

(cond ((= 1 1) (fun1 ...) (fun2 ...))
      (t (something-else)))

Use #t instead of t for Scheme

like image 108
michel-slm Avatar answered Dec 03 '25 09:12

michel-slm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!