Thanks again for your explanations Alex, still some comments...
On Fri, Jan 27, 2017 at 8:16 AM, Alexander Burger <a...@software-lab.de>
> BTW, I thought again about the terminology of "list" versus "cons pairs"
> plain "cells". "list" is a rather unprecise term, I feel it is not limited
> to "a
> chain of cells with NIL at the end". I use "list" for any sequence of
> cells (as
> opposed to other structures like "tree", "graph" or "set"). These include
> e.g. "circular lists" like (1 2 3 .), which have no NIL at the end (in
> fact, no
> end at all).
Ok, so from this point of view every cons pair is a list even those with a
dotted pair in the tail
But I think it's interesting to distinguish between two different kind of
lists, those having a NIL symbol in last cell CDR (let's say ending in NIL
symbol) and with a non NIL in las cell CDR (those ending in a symbol not
NIL) just because of almost every function dealing with lists assume they
belong to NIL-ending kind.
I mean, with a NIL ending list you have an empty list condition (NIL) but
how do you know a non-NIL ending list is empty? and since most functions
dealing with lists have a recursive pattern looking for an empty list
condition to finish processing the list I think it would be interesting to
discriminate between those two kinds of lists.
For example, let's define f as:
(de f (L) (print (car L)) (if (<> NIL (cdr L)) (f (cdr L))))
then f is well defined for NIL ending lists but fails with non-NIL ending
> > but when describing functions ' is a notation mark with a
> > semantic, what is the semantic of dot notation mark when used in formal
> > parameters in function description?
> > I mean, you have these two notations for functions:
> > - (dbs+ 'num . lst)
> > - (delete 'any 'lst) -> lst
> > are they applied the same? with the same kind of parameters?
> The functions behave differently. (dbs+ 'num . lst) means that the the
> takes an unlimited number of arguments, where only the first one is
> while (delete 'any 'lst) takes two evaluated arguments.
what about these two? are they equivalent?
(f num lst) -> num
(g num . lst) -> num
> > evaluate to a number and rest of parameters will be bound to Z, so you
> > this function like (dbs+ 4 a b c) , what notation will you use to
> > you have to pass a list as parameter to a function? maybe (dbs+ 'lst) ?
> These function definitions say nothing about the types of the arguments
> number, list etc. This is determined by the behavior of the function's
of course it's the function body which determines the "type" of parameters,
if the body applies a parameter to a function expecting a number, that
parameter's type must be a number and not a symbol or list or the function
call in the body will fail, but you use a notation for describing functions
just to help users know what kind of parameter you must provide, that's the
reason to use that list of meaningful words, type is not enforced (not
possible) but suggested to user using the function, right?
so a function described as (f 'num 'num) informs that function f
expects two parameters being numbers and since parameters are evaluated
it's the value what is expected to be numers, so you can call f as (f 1 2)
or (f a b) or even (f (x y z) 3) provided that values of symbols a and b
are numbers and the result of x function call (x y z) returns a number but
sure you cannot call f as (f (1 2)) or (f 'x 4)
>From this point of view my question is about the difference of using or not
using dot when describing a function, for example, take the if description:
(if 'any1 any2 . prg) -> any
Would the description below describe the same function?
(if 'any1 any2 prg) -> any
Even more, having into account notation used for describing functions I
any - Anything: Any data type
prg - Prog-Body: A list of executable expressions (run)
so from description of function "if" which is "Conditional execution: If
the condition any1 evaluates to non-NIL, any2 is evaluated and returned.
Otherwise, prg is executed and the result returned." I undestand the "then"
clause is any2 which gets evaluated when evaluated any1 is T and also it
could be any type of value while prg is the "else" clause being evaluated
only if evaluation of any1 returns NIL and also it is a list of executable
expressions, from this I understand the following is a list of valid and
invalid if function calls:
(if T 3 (print "no")) # valid
(if (< 2 2) 'x (print "yeah")) # valid
(if T 3 4) # invalid because
4 is a number not a prg (a list)
(if NIL (print "then") (print "else") (print "finally")) # a doubt here,
I think it's invalid because two executable expressions are two lists not
one prg (one list of executable expressions)
prg - Prog-Body: A list of executable expressions (run)
> To indicate that an argument is *expected* to be a list, I usually use
> (de foo (Lst)
> > mean a notation to express you *must* call a function using a list like
> > (a b c)) and not (f a b c)
> Note that (f (a b c)) does not mean that a list will be passed, but
> depends on
> the return value of the function 'a'). Same for (f a b c), it depends on
> values of the symbols 'a', 'b', and 'c'.
> There is no strict, static notation for the types of arguments to a
> This is a dynamic issue.
> > Also taking about dot, as you said you have to use delimiters to separate
> > symbols and thus you must surround dot with spaces (or any other
> > I suppose, probably you can write the weird sentence (a,.,b) as an
> > alternative to (a . b) dotted pair), so I suppose dot is kind of operator
> > (maybe a read macro as ' ?) anyway I think it would be interesting if dot
> It is *similar* to a read macro, as it controls the behavior of the
> reader. I
> would not call it a "macro", because it has no corresponding expanded or
> evaluated representation, like:
> 'abc -> (quote . abc)
> `(* 3 4) -> 12
> Instead, it is Lisp "syntax", on the same level as parentheses etc.
> > could act as an operator being associative to the right, so you can
> > ( a . b . c . d . NIL)
> > to be equal to
> > (a . (b . (c . (d . NIL))))
> > and also equal to (a b c d)
> > does it have any sense?
> It would be possible to change the reader to accept (a . b . c . d . NIL),
> I'm not sure at the moment. Would there be any advantage?
> ♪♫ Alex
> UNSUBSCRIBE: mailto:email@example.com?subject=Unsubscribe
*~ La mejor manera de librarse de la tentación es caer en ella**. ~ Oscar