[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Handling Errors
From: |
Bahman Movaqar |
Subject: |
[Chicken-users] Handling Errors |
Date: |
Sun, 14 Dec 2014 15:14:59 +0330 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
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)
signature.asc
Description: OpenPGP digital signature
- [Chicken-users] Handling Errors,
Bahman Movaqar <=