guile-user
[Top][All Lists]
Advanced

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

Re: pretty-print for 1+


From: Chaos Eternal
Subject: Re: pretty-print for 1+
Date: Wed, 18 Sep 2013 11:27:35 +0800

yet there is another interesting thing:

(symbol? 'a) => #t
(symbol? '+a) => #t
(symbol? '-a) => #t

(symbol? 'b) => #t
(symbol? '+b) => #t
(symbol? '-b) => #t

BUT:
(symbol? 'i) => #t
(symbol? '+i) => #f
(symbol? '-i) => #f

In guile-scsh, user would like the guile recognize -i as symbols
rather than complex numbers, is there any way?

On Tue, Sep 17, 2013 at 6:02 PM, Ludovic Courtès <address@hidden> wrote:
> Brian Killian <address@hidden> skribis:
>
>> On Thu, Sep 12, 2013 at 6:04 PM, Ludovic Courtès <address@hidden> wrote:
>>
>>> Brian Killian <address@hidden> skribis:
>>>
>>> > Using guile 2.0.9 and the ice-9 pretty-print module, when I apply:
>>> >
>>> > (pretty-print '(1+ 1))
>>> >
>>> > I get:
>>> >
>>> > (#{1+}# 1)
>>> >
>>> > I was expecting:
>>> >
>>> > (1+ 1)
>>> >
>>> > Is this an issue with pretty-print or should I adjust my expectation?
>>>
>>> I think it’s an issue with ‘write’.  Specifically,
>>> ‘INITIAL_IDENTIFIER_MASK’ in print.c doesn’t quite match the syntax
>>> recognized by ‘read’.
>>>
>>> Ludo’.
>>>
>>>
>>>
>> Thank you for the information. I'm using (+ arg 1) instead of (1+ arg) as a
>> workaround.
>
> Well note that (#{1+}# 1) is valid and equivalent to (1+ 1).
>
>> I'm using pretty-print to format code snippets as I work through SICP,
>> which is becoming tedious. Do you know of a script or tool that formats
>> Scheme files using the pretty-print rules? I've switched from gedit to
>> Emacs as an editor, but Emacs only seems to indent things properly, rather
>> than stripping extraneous newlines and trying to fit expressions on one
>> line if possible like pretty-print does.
>
> Good question, I don’t know of any such tool.
>
> Ludo’.
>
>



reply via email to

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