Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion resonable use of internal functions
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Friedrich Dominicus  
View profile  
 More options Nov 17 1999, 3:00 am
Newsgroups: comp.lang.lisp
From: Friedrich Dominicus <Friedrich.Domini...@inka.de>
Date: 1999/11/17
Subject: Re: resonable use of internal functions

Rainer Joswig wrote:

> In article <38325B95.60768...@inka.de>, Friedrich.Domini...@inka.de wrote:

> > (defun next-sine-val (val x n)
> >   (let ((alternating (expt -1 n))
> >                 (nom-factor (expt x (+ (* 2 n) 1)))
> >                 (denom-factor (fact (+ (* 2 n) 1))))
> >         (next-val val nom-factor denom-factor alternating)))

> Actually I don't think it is generally necessary to
> LET-bind every expression.

> (defun next-sine-val (val x n)
>   (next-val val
>             (expt x (+ (* 2 n) 1))
>             (fact (+ (* 2 n) 1))
>             (expt -1 n)))

Of course one can write it this way but I personally think that your
solution does not give hints on what's going on. But of course that
would work fine too. And maybe the function next-val is some lines above
where it is used than it's maybe not so clear what is going on.

So I think I prefer using local-variables, but of course YMMV.

> Above would be enough for me, given that the
> variable and function names are "speaking".
> Remember that in Lisp you have expressions that
> return values and writing additional variables
> and bindings is often a waste of time and space.

Now, maybe but I trade normaly readability for time and space. I think
that may pay off sooner or later.

> Also a development environment (hopefully) has documentation
> and arglist info available either instantly or on keypress.

This is a good point and I've to admit documentation is completely
missing here. This should be improved. But for now it was just playing
around with figuring out common behaviar and with that simple next-val I
can buile chains of sum and the like. And I think for that reason
next-val is quite a good candidate for a function on it's own.

Regards
Friedrich


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.