[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Attaching an alist to a grob
From: |
Mattes |
Subject: |
Re: Attaching an alist to a grob |
Date: |
Wed, 14 Jan 2015 12:42:37 +0100 |
User-agent: |
SOGoMail 2.2.9a |
Am Mittwoch, 14. Januar 2015 12:34 CET, Urs Liska <address@hidden> schrieb:
>
> >>> #(define (annotation? obj)
> >>> (and
> >>> (list? obj)
> >>> (every pair? obj)
> >>> (if (assoc-ref obj "type") #t #f)
> >>> (if (assoc-ref obj "location") #t #f)))
> > ... and is this just equivalent to:
> >
> > #(define (annotation? obj)
> > (and
> > (list? obj)
> > (every pair? obj)
> > (assoc-ref obj "type")
> > (assoc-ref obj "location")))
> >
> >
> > ???
>
> I don't think so because the result of the function would be the result
> of the last expression.
> assoc-ref returns the "value" to the "key", so if passed a valid object
> the result of the predicate wouldn't be #t but the content of "location".
> That's why I enclosed these checks in if constructs.
Richard is right, the if-clauses aren't neccessary. Scheme has the
concept "generalized" booleans, i.e. anything that isn't explicitly
false is considered to be true:
guile> (if 42 'true 'false)
I was just trying to keep as much of your code as possible ....
Cheers, RalfD
- Re: Attaching an alist to a grob, (continued)
Re: Attaching an alist to a grob, Urs Liska, 2015/01/14
- Re: Attaching an alist to a grob, Richard Shann, 2015/01/14
- Re: Attaching an alist to a grob, Urs Liska, 2015/01/14
- Re: Attaching an alist to a grob, Richard Shann, 2015/01/14
- Re: Attaching an alist to a grob,
Mattes <=
- Re: Attaching an alist to a grob, Urs Liska, 2015/01/14
- Re: Attaching an alist to a grob, Mattes, 2015/01/14
- Re: Attaching an alist to a grob, Urs Liska, 2015/01/15