unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* pretty-print for 1+
@ 2013-09-11 18:31 Brian Killian
  2013-09-12 22:04 ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Killian @ 2013-09-11 18:31 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

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?

[-- Attachment #2: Type: text/html, Size: 287 bytes --]

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

* Re: pretty-print for 1+
  2013-09-11 18:31 pretty-print for 1+ Brian Killian
@ 2013-09-12 22:04 ` Ludovic Courtès
  2013-09-14 20:06   ` Brian Killian
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2013-09-12 22:04 UTC (permalink / raw)
  To: guile-user

Brian Killian <brian.c.killian@gmail.com> 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’.




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

* Re: pretty-print for 1+
  2013-09-12 22:04 ` Ludovic Courtès
@ 2013-09-14 20:06   ` Brian Killian
  2013-09-17 10:02     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Killian @ 2013-09-14 20:06 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

On Thu, Sep 12, 2013 at 6:04 PM, Ludovic Courtès <ludo@gnu.org> wrote:

> Brian Killian <brian.c.killian@gmail.com> 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.

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.

[-- Attachment #2: Type: text/html, Size: 1580 bytes --]

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

* Re: pretty-print for 1+
  2013-09-14 20:06   ` Brian Killian
@ 2013-09-17 10:02     ` Ludovic Courtès
  2013-09-18  3:27       ` Chaos Eternal
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2013-09-17 10:02 UTC (permalink / raw)
  To: guile-user

Brian Killian <brian.c.killian@gmail.com> skribis:

> On Thu, Sep 12, 2013 at 6:04 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>
>> Brian Killian <brian.c.killian@gmail.com> 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’.




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

* Re: pretty-print for 1+
  2013-09-17 10:02     ` Ludovic Courtès
@ 2013-09-18  3:27       ` Chaos Eternal
  2013-09-18 18:57         ` Taylan Ulrich B.
  0 siblings, 1 reply; 6+ messages in thread
From: Chaos Eternal @ 2013-09-18  3:27 UTC (permalink / raw)
  To: guile-user

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 <ludo@gnu.org> wrote:
> Brian Killian <brian.c.killian@gmail.com> skribis:
>
>> On Thu, Sep 12, 2013 at 6:04 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>>
>>> Brian Killian <brian.c.killian@gmail.com> 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’.
>
>



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

* Re: pretty-print for 1+
  2013-09-18  3:27       ` Chaos Eternal
@ 2013-09-18 18:57         ` Taylan Ulrich B.
  0 siblings, 0 replies; 6+ messages in thread
From: Taylan Ulrich B. @ 2013-09-18 18:57 UTC (permalink / raw)
  To: Chaos Eternal; +Cc: guile-user

Chaos Eternal <chaoseternal@shlug.org> writes:

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

I doubt that there is a way.  Arguably, one should use a different
mechanism to represent command-line switches.  Keyword symbols would
probably be suitable for this, and if #:foo is too verbose, one can
(read-set! keywords 'prefix) and use :foo instead.  I don't know if it
would require a substantial change to Scsh, and even if not, it would
certainly be an unportable extension.  Also, arguably, the usage of
stand-alone keyword symbols as arguments to a function (as opposed to
using them to mark keyword arguments) is an abuse of their first-class
nature in Guile, which might be subject to change in the future.



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

end of thread, other threads:[~2013-09-18 18:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-11 18:31 pretty-print for 1+ Brian Killian
2013-09-12 22:04 ` Ludovic Courtès
2013-09-14 20:06   ` Brian Killian
2013-09-17 10:02     ` Ludovic Courtès
2013-09-18  3:27       ` Chaos Eternal
2013-09-18 18:57         ` Taylan Ulrich B.

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