unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* lat? and atom? not in guile?
@ 2018-06-19 15:18 Joshua Branson
  2018-06-19 16:13 ` Thompson, David
  2018-06-19 16:46 ` John Cowan
  0 siblings, 2 replies; 14+ messages in thread
From: Joshua Branson @ 2018-06-19 15:18 UTC (permalink / raw)
  To: guile-user


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



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
  2018-06-19 15:18 lat? and atom? not in guile? Joshua Branson
@ 2018-06-19 16:13 ` Thompson, David
  2018-06-20 14:37   ` Joshua Branson
  2018-06-19 16:46 ` John Cowan
  1 sibling, 1 reply; 14+ messages in thread
From: Thompson, David @ 2018-06-19 16:13 UTC (permalink / raw)
  To: Joshua Branson; +Cc: Guile User

Hi Joshua,

On Tue, Jun 19, 2018 at 11:18 AM, Joshua Branson <jbranso@fastmail.com> wrote:
>
> 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.

> 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



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
  2018-06-19 15:18 lat? and atom? not in guile? Joshua Branson
  2018-06-19 16:13 ` Thompson, David
@ 2018-06-19 16:46 ` John Cowan
  1 sibling, 0 replies; 14+ messages in thread
From: John Cowan @ 2018-06-19 16:46 UTC (permalink / raw)
  To: Joshua Branson; +Cc: guile-user

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 <jbranso@fastmail.com>
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
>
>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
       [not found] <mailman.107.1529424021.11270.guile-user@gnu.org>
@ 2018-06-19 17:33 ` Zelphir Kaltstahl
  2018-06-20 10:15   ` Shakthi Kannan
  0 siblings, 1 reply; 14+ messages in thread
From: Zelphir Kaltstahl @ 2018-06-19 17:33 UTC (permalink / raw)
  To: guile-user


> ------------------------------
>
> Message: 2
> Date: Tue, 19 Jun 2018 11:18:30 -0400
> From: Joshua Branson <jbranso@fastmail.com>
> To: guile-user@gnu.org
> Subject: lat? and atom? not in guile?
> Message-ID: <877emuyfcp.fsf@fastmail.com>
> 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



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
  2018-06-19 17:33 ` Zelphir Kaltstahl
@ 2018-06-20 10:15   ` Shakthi Kannan
  2018-06-20 14:33     ` Joshua Branson
  0 siblings, 1 reply; 14+ messages in thread
From: Shakthi Kannan @ 2018-06-20 10:15 UTC (permalink / raw)
  To: guile-user

Hi,

--- On Tue, Jun 19, 2018 at 11:03 PM, Zelphir Kaltstahl
<zelphirkaltstahl@gmail.com> wrote:
> 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



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
  2018-06-20 10:15   ` Shakthi Kannan
@ 2018-06-20 14:33     ` Joshua Branson
  0 siblings, 0 replies; 14+ messages in thread
From: Joshua Branson @ 2018-06-20 14:33 UTC (permalink / raw)
  To: guile-user

Shakthi Kannan <shakthimaan@gmail.com> writes:

> Hi,
>
> --- On Tue, Jun 19, 2018 at 11:03 PM, Zelphir Kaltstahl
> <zelphirkaltstahl@gmail.com> wrote:
>> 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!

>
> SK



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
  2018-06-19 16:13 ` Thompson, David
@ 2018-06-20 14:37   ` Joshua Branson
  2018-06-20 14:40     ` John Cowan
  0 siblings, 1 reply; 14+ messages in thread
From: Joshua Branson @ 2018-06-20 14:37 UTC (permalink / raw)
  To: guile-user

"Thompson, David" <dthompson2@worcester.edu> writes:

> Hi Joshua,
>
> On Tue, Jun 19, 2018 at 11:18 AM, Joshua Branson <jbranso@fastmail.com> wrote:
>>
>> 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.  

>
>> 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



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
  2018-06-20 14:37   ` Joshua Branson
@ 2018-06-20 14:40     ` John Cowan
  2018-06-20 14:55       ` Thompson, David
  2018-06-20 16:54       ` lat? and atom? not in guile? Joshua Branson
  0 siblings, 2 replies; 14+ messages in thread
From: John Cowan @ 2018-06-20 14:40 UTC (permalink / raw)
  To: Joshua Branson; +Cc: guile-user

On Wed, Jun 20, 2018 at 10:37 AM, Joshua Branson <jbranso@fastmail.com>
wrote:


> 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        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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
  2018-06-20 14:40     ` John Cowan
@ 2018-06-20 14:55       ` Thompson, David
  2018-06-20 16:55         ` Joshua Branson
  2018-06-20 23:47         ` Scheme books [was: lat? and atom? not in guile?] Matt Wette
  2018-06-20 16:54       ` lat? and atom? not in guile? Joshua Branson
  1 sibling, 2 replies; 14+ messages in thread
From: Thompson, David @ 2018-06-20 14:55 UTC (permalink / raw)
  To: John Cowan; +Cc: Guile User, Joshua Branson

On Wed, Jun 20, 2018 at 10:40 AM, John Cowan <cowan@ccil.org> wrote:
> On Wed, Jun 20, 2018 at 10:37 AM, Joshua Branson <jbranso@fastmail.com>
> wrote:
>
>
>> 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. :)

- Dave



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
  2018-06-20 14:40     ` John Cowan
  2018-06-20 14:55       ` Thompson, David
@ 2018-06-20 16:54       ` Joshua Branson
  1 sibling, 0 replies; 14+ messages in thread
From: Joshua Branson @ 2018-06-20 16:54 UTC (permalink / raw)
  To: guile-user

John Cowan <cowan@ccil.org> writes:

> On Wed, Jun 20, 2018 at 10:37 AM, Joshua Branson <jbranso@fastmail.com> wrote:
>  
>  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.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: lat? and atom? not in guile?
  2018-06-20 14:55       ` Thompson, David
@ 2018-06-20 16:55         ` Joshua Branson
  2018-06-20 23:47         ` Scheme books [was: lat? and atom? not in guile?] Matt Wette
  1 sibling, 0 replies; 14+ messages in thread
From: Joshua Branson @ 2018-06-20 16:55 UTC (permalink / raw)
  To: guile-user

"Thompson, David" <dthompson2@worcester.edu> writes:

> On Wed, Jun 20, 2018 at 10:40 AM, John Cowan <cowan@ccil.org> wrote:
>> On Wed, Jun 20, 2018 at 10:37 AM, Joshua Branson <jbranso@fastmail.com>
>> wrote:
>>
>>
>>> 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.

>
> - Dave



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Scheme books [was: lat? and atom? not in guile?]
  2018-06-20 14:55       ` Thompson, David
  2018-06-20 16:55         ` Joshua Branson
@ 2018-06-20 23:47         ` Matt Wette
  2018-06-21 13:44           ` Joshua Branson
  1 sibling, 1 reply; 14+ messages in thread
From: Matt Wette @ 2018-06-20 23:47 UTC (permalink / raw)
  To: guile-user

On 06/20/2018 07:55 AM, Thompson, David wrote
[regarding "The Little Schemer"]:
> 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




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Scheme books [was: lat? and atom? not in guile?]
  2018-06-20 23:47         ` Scheme books [was: lat? and atom? not in guile?] Matt Wette
@ 2018-06-21 13:44           ` Joshua Branson
  2018-06-21 14:01             ` Matt Wette
  0 siblings, 1 reply; 14+ messages in thread
From: Joshua Branson @ 2018-06-21 13:44 UTC (permalink / raw)
  To: guile-user

Matt Wette <matt.wette@gmail.com> writes:

> On 06/20/2018 07:55 AM, Thompson, David wrote
> [regarding "The Little Schemer"]:
>> 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.  :)

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



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Scheme books [was: lat? and atom? not in guile?]
  2018-06-21 13:44           ` Joshua Branson
@ 2018-06-21 14:01             ` Matt Wette
  0 siblings, 0 replies; 14+ messages in thread
From: Matt Wette @ 2018-06-21 14:01 UTC (permalink / raw)
  To: guile-user

On 06/21/2018 06:44 AM, Joshua Branson wrote:
> Matt Wette <matt.wette@gmail.com> writes:
>
> 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




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-06-21 14:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-19 15:18 lat? and atom? not in guile? Joshua Branson
2018-06-19 16:13 ` Thompson, David
2018-06-20 14:37   ` Joshua Branson
2018-06-20 14:40     ` John Cowan
2018-06-20 14:55       ` Thompson, David
2018-06-20 16:55         ` Joshua Branson
2018-06-20 23:47         ` Scheme books [was: lat? and atom? not in guile?] Matt Wette
2018-06-21 13:44           ` Joshua Branson
2018-06-21 14:01             ` Matt Wette
2018-06-20 16:54       ` lat? and atom? not in guile? Joshua Branson
2018-06-19 16:46 ` John Cowan
     [not found] <mailman.107.1529424021.11270.guile-user@gnu.org>
2018-06-19 17:33 ` Zelphir Kaltstahl
2018-06-20 10:15   ` Shakthi Kannan
2018-06-20 14:33     ` Joshua Branson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).