guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lat? and atom? not in guile?


From: John Cowan
Subject: Re: lat? and atom? not in guile?
Date: Tue, 19 Jun 2018 12:46:01 -0400

Neither is part of any Scheme standard.  Most Schemes that define atom?,
define it as (lambda (x) (not (pair? x)), tracking the standard Common Lisp
definition.  But TLS excludes () from atoms as well.  The definition used
by TLS is on p. xiii of the fourth edition:

(define atom?
  (lambda (x)
    (and
      (not (pair? x))
      (not (null? x)))))

As for lat?, it is a non-standard acronym for "list of atoms".  It is
defined on page 16:

(define lat?
  (lambda (l)
    (cond
      ((null? l) #t)
      ((atom? (car l)) (lat? (cdr l)))
      (else #f))))


I have rewritten this from TLS's dialect to use standard #t and #f instead
of t and nil.


On Tue, Jun 19, 2018 at 11:18 AM, Joshua Branson <address@hidden>
wrote:

>
> Hello,
>
> This question comes from a non-scheme guy.  I'm not trying to be
> critical of guile.  I'm just curious.
>
> So I have the book "The Little Schemer".  The book describes the
> procedures: "lat?" and "atom?".  Surprisingly, guile does not seem to
> define these procedures by default.  I had assumed that these procedures
> were apart of standard scheme, but I guess that is not the case.
>
> Is there any plan to define these procedures?
>
> Thanks,
>
> Joshua
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]