Discussion:
lat? and atom? not in guile?
Joshua Branson
2018-06-19 15:18:30 UTC
Permalink
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
Thompson, David
2018-06-19 16:13:38 UTC
Permalink
Hi Joshua,
Post by Joshua Branson
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.
Great book! One of my favorites. But yeah, you guessed correctly. They
are not part of any Scheme standard nor are they a part of Guile's own
standard library. They are unique to The Little Schemer's vocabulary.
In the 4th edition of the book, an implementation of atom? is given
for both Scheme and Common Lisp on page 10, and lat? on page 16, since
the authors knew they couldn't expect the user's Lisp implementation
to have those built-in.
Post by Joshua Branson
Is there any plan to define these procedures?
I'm not a maintainer but I wouldn't expect these to be added.

Hope this helps!

- Dave
Joshua Branson
2018-06-20 14:37:20 UTC
Permalink
Post by Thompson, David
Hi Joshua,
Post by Joshua Branson
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.
Great book! One of my favorites. But yeah, you guessed correctly. They
are not part of any Scheme standard nor are they a part of Guile's own
standard library. They are unique to The Little Schemer's vocabulary.
In the 4th edition of the book, an implementation of atom? is given
for both Scheme and Common Lisp on page 10, and lat? on page 16, since
the authors knew they couldn't expect the user's Lisp implementation
to have those built-in.
Oh hey David! Thanks for the explanation! Maybe I need to take another
look at that book then. I found it a little repetitive, but I am
probably not quite grasping some of the fundamentals.
Post by Thompson, David
Post by Joshua Branson
Is there any plan to define these procedures?
I'm not a maintainer but I wouldn't expect these to be added.
Hope this helps!
- Dave
John Cowan
2018-06-20 14:40:36 UTC
Permalink
Post by Joshua Branson
Oh hey David! Thanks for the explanation! Maybe I need to take another
look at that book then. I found it a little repetitive, but I am
probably not quite grasping some of the fundamentals.
It's meant to be repetitive. It's explicitly compared in the introduction
to Hanon's finger exercises for the piano: C-E-F-G-A-G-F-E,
D-F-G-A-B-A-G-F, E-G-A-B-C-B-A-D and so on forever, up the scale and down
in every key. Boring as hell, but just the thing to get fluency into your
fingers.
--
John Cowan http://vrici.lojban.org/~cowan ***@ccil.org
As we all know, civil libertarians are not the friskiest group around --
comes from forever being on the qui vive for the sound of jack-booted
fascism coming down the pike. --Molly Ivins
Thompson, David
2018-06-20 14:55:43 UTC
Permalink
This post might be inappropriate. Click to display it.
Joshua Branson
2018-06-20 16:55:26 UTC
Permalink
Post by Thompson, David
Post by John Cowan
Post by Joshua Branson
Oh hey David! Thanks for the explanation! Maybe I need to take another
look at that book then. I found it a little repetitive, but I am
probably not quite grasping some of the fundamentals.
It's meant to be repetitive. It's explicitly compared in the introduction
to Hanon's finger exercises for the piano: C-E-F-G-A-G-F-E,
D-F-G-A-B-A-G-F, E-G-A-B-C-B-A-D and so on forever, up the scale and down
in every key. Boring as hell, but just the thing to get fluency into your
fingers.
It's repetitive but honestly I found that the comedic writing made the
exercises very entertaining. I was rarely bored. I don't play the
piano, but I do play drums, and the equivalent to Hanon's finger
exercises is an old book called Stick Control, which is definitely in
the boring as hell category! I'm glad that Lisp beginners have
something more fun available. :)
hahaha. Well thanks for the fresh perspective.
Post by Thompson, David
- Dave
Matt Wette
2018-06-20 23:47:06 UTC
Permalink
Post by Thompson, David
It's repetitive but honestly I found that the comedic writing made the
exercises very entertaining. I was rarely bored. I don't play the
piano, but I do play drums, and the equivalent to Hanon's finger
exercises is an old book called Stick Control, which is definitely in
the boring as hell category! I'm glad that Lisp beginners have
something more fun available. :)
And on this topic, I'm currently reading 'The Reasoned Schemer,' written
in the same style.   The style gets the stuff into my head w/o resorting to
trying out problems on the computer (yet).

I have also read
Structure and Interpretation of Computer Programs
The Scheme Programming Language

Matt
Joshua Branson
2018-06-21 13:44:52 UTC
Permalink
Post by Matt Wette
Post by Thompson, David
It's repetitive but honestly I found that the comedic writing made the
exercises very entertaining. I was rarely bored. I don't play the
piano, but I do play drums, and the equivalent to Hanon's finger
exercises is an old book called Stick Control, which is definitely in
the boring as hell category! I'm glad that Lisp beginners have
something more fun available. :)
And on this topic, I'm currently reading 'The Reasoned Schemer,' written
in the same style.   The style gets the stuff into my head w/o resorting to
trying out problems on the computer (yet).
Hmmm. I've heard about the seasoned schemer, but not the reasoned one.
I also have downloaded Structure and Interpretation of Computer
Programs. I need to actually spend some time going through it.

I've just got several programming projects that I want to do, and I need
to remind myself that I probably can't learn it all at once. :)
Post by Matt Wette
I have also read
Structure and Interpretation of Computer Programs
The Scheme Programming Language
Matt
Matt Wette
2018-06-21 14:01:36 UTC
Permalink
Post by Matt Wette
And on this topic, I'm currently reading 'The Reasoned Schemer,' written
in the same style.   The style gets the stuff into my head w/o resorting to
trying out problems on the computer (yet).
Hmmm. I've heard about the seasoned schemer, but not the reasoned one.
I also have downloaded Structure and Interpretation of Computer
Programs. I need to actually spend some time going through it.
I've just got several programming projects that I want to do, and I need
to remind myself that I probably can't learn it all at once. :)
The Reasoned Schemer is about miniKanren, a Scheme library thatuses
unification to generate a system of relations (versusfunctions).For
example, while (append '(a b) '(c d)) => '(a b c d), miniKanren can
solve "find x such that (append '(a b) x) yields '(a b c d)" :

  scheme@(guile-user)> (run* (x) (appendo '(a b) x '(a b c d)))
  $2 = ((c d))

where appendo is defined as:
(define appendo
  (lambda (l s ls)
    (conde
      ((== '() l) (== s ls))
      ((fresh (a d res)
     (== `(,a . ,d) l)
     (== `(,a . ,res) ls)
     (appendo d s res))))))

check https://dl.acm.org/citation.cfm?id=3110252

Matt

Joshua Branson
2018-06-20 16:54:46 UTC
Permalink
Post by Joshua Branson
Oh hey David! Thanks for the explanation! Maybe I need to take another
look at that book then. I found it a little repetitive, but I am
probably not quite grasping some of the fundamentals.
It's meant to be repetitive. It's explicitly compared in the introduction to Hanon's finger exercises for the piano: C-E-F-G-A-G-F-E, D-F-G-A-B-A-G-F, E-G-A-B-C-B-A-D and so on forever, up
the scale and down in every key. Boring as hell, but just the thing to get fluency into your fingers.
John Cowan
2018-06-19 16:46:01 UTC
Permalink
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.
Post by Joshua Branson
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
Zelphir Kaltstahl
2018-06-19 17:33:01 UTC
Permalink
------------------------------
Message: 2
Date: Tue, 19 Jun 2018 11:18:30 -0400
Subject: lat? and atom? not in guile?
Content-Type: text/plain
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
Good choice, I am reading it too currently. Maybe I should share my unit
tests somewhere?

I think many Schemes do not implement these procedures. Guile does not
and neither does Racket, which I used for most of the books examples and
exercises. I think those procedures are defined in the book in order to
have a common ground for a lot of Schemes, so that you can use whatever
you want and so that the ideas of the book are clear and not dependent
on one specific Scheme dialect.

I don't know about any plans of the Guile developers though.

~ Zelphir
Shakthi Kannan
2018-06-20 10:15:00 UTC
Permalink
Hi,

--- On Tue, Jun 19, 2018 at 11:03 PM, Zelphir Kaltstahl
Post by Zelphir Kaltstahl
I don't know about any plans of the Guile developers though.
Include it, and the developers can write "The Little Guiler" book.

SK
--
Shakthi Kannan
http://www.shakthimaan.com
Joshua Branson
2018-06-20 14:33:46 UTC
Permalink
Post by Shakthi Kannan
Hi,
--- On Tue, Jun 19, 2018 at 11:03 PM, Zelphir Kaltstahl
Post by Zelphir Kaltstahl
I don't know about any plans of the Guile developers though.
Include it, and the developers can write "The Little Guiler" book.
Haha! That would be perfect!
Post by Shakthi Kannan
SK
Loading...