Comparing two hash tables for equality?

2018-08-26 Thread Aleksandar Sandic
Hello everyone, I have been looking through the reference manual, but there does not seem to be a procedure for comparing two hash tables for equality. The procedure 'equal?' only returns true if the two tables are also 'eq?': scheme@(guile-user)> (define h1 (make-hash-table)) scheme@(g

What should the constructor for a record look like?

2018-08-26 Thread HiPhish
Hello, it's me again, the guy who wants to implement MessagePack [1] in Guile. The specification defines a type of "extension" [2], a pair of an 8-bit integer and a byte array for data. Implementing this type as a record is obvious, but what should be the name of the constructor? (define-re

A value for "nothing"

2018-08-26 Thread HiPhish
Hello Schemers, I am writing an implementation of MessagePack [1] for Guile and a part of the spec is the presence of a "nil" data type. What would be a good value to express "nothing" in Guile? I cannot use '() because that would be indistinguishable from the empty list, so I thought that the

Re: What should the constructor for a record look like?

2018-08-26 Thread Matt Wette
On 08/26/2018 06:04 AM, HiPhish wrote: Hello, it's me again, the guy who wants to implement MessagePack [1] in Guile. The specification defines a type of "extension" [2], a pair of an 8-bit integer and a byte array for data. Implementing this type as a record is obvious, but what should be the

Re: A value for "nothing"

2018-08-26 Thread Joshua Branson
HiPhish writes: > Hello Schemers, > > > [1] https://msgpack.org/ Thanks for mentioning this! I'm not sure how to answer your question, but thanks for pointing out msgpack. I hadn't realized that json could be faster if it was encoded in binary. That's awesome!

Re: A value for "nothing"

2018-08-26 Thread Thomas Morley
2018-08-26 12:13 GMT+02:00 HiPhish : > Hello Schemers, > > I am writing an implementation of MessagePack [1] for Guile and a part of the > spec is the presence of a "nil" data type. What would be a good value to > express "nothing" in Guile? I cannot use '() because that would be > indistinguishabl

Re: A value for "nothing"

2018-08-26 Thread John Cowan
Well, you could use #nil, a Guile-specific unique object that is both falsy (like #f) and answers #t to the null? predicate. It is used to emulate Common Lisp's and Elisp's nil. But a more portable approach would be to define a record type with no slots and make just one instance of it. On Sun,

Re: How to get started in guile & programming generally

2018-08-26 Thread Joshua Branson
Amirouche Boubekki writes: > On 2018-08-25 19:16, Joshua Branson wrote: >> > > You can play with Guile without much C knowledge and I dare to say that you > need little of C with things like guile-bytestructures or nyacc's ffi-helper > to use the full power of GNU Guile. Can you elaborate on gui

Re: How to get started in guile & programming generally

2018-08-26 Thread Pierre Neidhardt
> I've heard about chickadee! I've tried to install it before, but I > haven't been successful yet. Perhaps I'll have to try again. What's the issue? Please post a backtrace. I can chickadee flawlessly here, maybe I can help. And by the way, chickadee is an awesome piece of software: it is su

Re: A value for "nothing"

2018-08-26 Thread Mark H Weaver
Hi, HiPhish writes: > I am writing an implementation of MessagePack [1] for Guile and a part of the > spec is the presence of a "nil" data type. What would be a good value to > express "nothing" in Guile? First of all, thank you very much for asking the question. I often wish that authors of

Re: A value for "nothing"

2018-08-26 Thread HiPhish
The main advantage of JSON is that it is human-readable. This is great if you want to save the data on disc and be able to get it without needing special software, or if you want to write it out by hand but be able to parse it by a computer. I actually had done that, I maintained a number of rec

Re: Setting up Guile for use with Guix

2018-08-26 Thread HiPhish
On Sonntag, 19. August 2018 22:41:30 CEST you wrote: > It depends on how haunt package definition is written. Because of how guix > works, you can use a program that uses guile without having 'guile' command > available. Similarly, it makes it possible to run two programs at the same > time that d

Re: A value for "nothing"

2018-08-26 Thread Matt Wette
On 08/26/2018 01:07 PM, Mark H Weaver wrote: HiPhish writes: I am writing an implementation of MessagePack [1] for Guile and a part of the spec is the presence of a "nil" data type. What would be a good value to express "nothing" in Guile? However, I would strongly advise against writing c

Re: Comparing two hash tables for equality?

2018-08-26 Thread Mark H Weaver
Hi Aleksandar, Aleksandar Sandic writes: > I have been looking through the reference manual, but there does not seem to > be a procedure for comparing two hash tables for equality. The procedure > 'equal?' only returns true if the two tables are also 'eq?': > > scheme@(guile-user)> (define

Re: Comparing two hash tables for equality?

2018-08-26 Thread John Cowan
On Sun, Aug 26, 2018 at 6:51 PM Mark H Weaver wrote: > An equality test on hash tables needs to know how to compare the keys > and how to compare the values. There's no way to pass those additional > arguments to 'equal?', so it can't do that job. > Correct. However, it's possible given eithe

Re: A value for "nothing"

2018-08-26 Thread Panicz Maciej Godek
niedz., 26 sie 2018 o 16:09 HiPhish napisaƂ(a): > Hello Schemers, > > I am writing an implementation of MessagePack [1] for Guile and a part of > the > spec is the presence of a "nil" data type. What would be a good value to > express "nothing" in Guile? I cannot use '() because that would be > i

Re: A value for "nothing"

2018-08-26 Thread Mark H Weaver
John Cowan writes: > Well, you could use #nil, a Guile-specific unique object that is both falsy > (like #f) and answers #t to the null? predicate. It is used to emulate > Common Lisp's and Elisp's nil. As I wrote earlier, I would avoid using #nil for anything outside of its intended use case.