chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] strange csc-warning (Version 4.13.0)


From: Martin Schneeweis
Subject: Re: [Chicken-hackers] strange csc-warning (Version 4.13.0)
Date: Sat, 30 Jun 2018 23:48:20 +0200

Hi John,

thank you very much for this detailed answer!

John Cowan <address@hidden> wrote:
> I've reformatted your code to Lisp standard style (2 spaces instead of
> tabs, no parens on their own lines) for better readability.

Thank you for that input - I am relatively new to Scheme/Lisp and
therefore my idea of readability is influenced by other languages. But
obviously I will use the lisp-standard in future code examples.

> [...]
> I would say that discriminating between pairs and lists this way is a
> bad idea: you should always use lists with a car that distinguishes
> the two types of values you want to treat differently.

I agree - I am using this (or rather the unabbreviated version) to pick
data from an "association list" I get from an egg. Unfortunately this
data looks like

  '((a "a")(b . "b") ...)

It might be the correct view that '("a") is the value for key 'a and "b"
is the value for key 'b - but at the end of the day I am interested in
"a" and "b" => (cdr (memq ... / (cadr (memq...

> [...] However, this code is *not* semantically identical with
> strange-warning. If el is (), then it is a list but not a pair, and
> this procedure will return "list", whereas strange-warning will
> return "found nothing".

You are right. I guess I will use unabbreviated versions in the bug
description then (in the "list"-branch there is obviously a
length-check before returning "cadr ..." - and if that fails "found
nothing" is returned (or rather #f))

lg
Martin



reply via email to

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