Consider the following simple function:

  (define (foo lis) (cdr lis))

Obviously LIS should neither be an empty list nor a list with only one
element.
What is the recommended way to deal with such constraints? Should I
enforce them by writing conditionals at the beginning of the
function[1]? Or is it conventional to just let the function fail and
catch the error somewhere else (probably in a top-level function)?

[1] This quickly leads to dirty and not-easy-to-read code.

What say you seasoned schemers on this?

-- 
Bahman Movaqar

http://BahmanM.com - https://twitter.com/bahman__m
https://github.com/bahmanm - https://gist.github.com/bahmanm
PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to