unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Functional hashtables
@ 2020-05-05 18:10 Christopher Lemmer Webber
  2020-05-05 19:45 ` Linus Björnstam
  2020-05-16 20:42 ` Ludovic Courtès
  0 siblings, 2 replies; 9+ messages in thread
From: Christopher Lemmer Webber @ 2020-05-05 18:10 UTC (permalink / raw)
  To: guile-user

Hello hello,

I'm working on porting a library I've written from Racket to Guile.
Some interesting news on that soon.

In the meanwhile, I'm trying to figure out what to do about my need for
functional hashmaps in Guile.  Right now Guile ships with vlist and
vhash.  Andy also wrote fash.scm, which is what I've generally preferred
and used previously.

The reason I don't want to use vhashes is specifically this part of
vhashes in the Guile manual:

>   • It is _not_ thread-safe.  Although operations on vlists are all
>     “referentially transparent” (i.e., purely functional), adding
>     elements to a vlist with ‘vlist-cons’ mutates part of its internal
>     structure, which makes it non-thread-safe.  This could be fixed,
>     but it would slow down ‘vlist-cons’.

Oop!  That's a no-go for me.  But maybe there are other reasons to
prefer fash.scm too?

There's no separate package of guile-fash available anywhere, but it
would be easy enough to do if we're just using it with Guix.  It's
desirable to not have to keep copy-pasta'ing fash.scm around at least.

My time in Racket has convinced me that it's an extremely good idea to
have a well supported functional hashmap type in the language... extra
points if it's "first class" in syntax (my code has improved
considerably because of it; no more using alists where they'll bite you
later just because it "looks prettier").

Anyway, thoughts?

Nice to be back in Guile land!
 - Chris



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

* Re: Functional hashtables
  2020-05-05 18:10 Functional hashtables Christopher Lemmer Webber
@ 2020-05-05 19:45 ` Linus Björnstam
  2020-05-06 11:23   ` Christopher Lemmer Webber
  2020-05-06 11:24   ` Christopher Lemmer Webber
  2020-05-16 20:42 ` Ludovic Courtès
  1 sibling, 2 replies; 9+ messages in thread
From: Linus Björnstam @ 2020-05-05 19:45 UTC (permalink / raw)
  To: Christopher Lemmer Webber, guile-user

I made a module out of Andy's dash (and added some comfort functions over fash-fold): https://hg.sr.ht/~bjoli/guile-fash/browse/fash.scm?rev=default 

What it lacks is a proper way to remove elements..I had a couple of stabs at it, but I fear I was too dumb.

-- 
  Linus Björnstam

On Tue, 5 May 2020, at 20:10, Christopher Lemmer Webber wrote:
> Hello hello,
> 
> I'm working on porting a library I've written from Racket to Guile.
> Some interesting news on that soon.
> 
> In the meanwhile, I'm trying to figure out what to do about my need for
> functional hashmaps in Guile.  Right now Guile ships with vlist and
> vhash.  Andy also wrote fash.scm, which is what I've generally preferred
> and used previously.
> 
> The reason I don't want to use vhashes is specifically this part of
> vhashes in the Guile manual:
> 
> >   • It is _not_ thread-safe.  Although operations on vlists are all
> >     “referentially transparent” (i.e., purely functional), adding
> >     elements to a vlist with ‘vlist-cons’ mutates part of its internal
> >     structure, which makes it non-thread-safe.  This could be fixed,
> >     but it would slow down ‘vlist-cons’.
> 
> Oop!  That's a no-go for me.  But maybe there are other reasons to
> prefer fash.scm too?
> 
> There's no separate package of guile-fash available anywhere, but it
> would be easy enough to do if we're just using it with Guix.  It's
> desirable to not have to keep copy-pasta'ing fash.scm around at least.
> 
> My time in Racket has convinced me that it's an extremely good idea to
> have a well supported functional hashmap type in the language... extra
> points if it's "first class" in syntax (my code has improved
> considerably because of it; no more using alists where they'll bite you
> later just because it "looks prettier").
> 
> Anyway, thoughts?
> 
> Nice to be back in Guile land!
>  - Chris
> 
>



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

* Re: Functional hashtables
  2020-05-05 19:45 ` Linus Björnstam
@ 2020-05-06 11:23   ` Christopher Lemmer Webber
  2020-05-06 11:24   ` Christopher Lemmer Webber
  1 sibling, 0 replies; 9+ messages in thread
From: Christopher Lemmer Webber @ 2020-05-06 11:23 UTC (permalink / raw)
  To: Linus Björnstam; +Cc: guile-user

Linus Björnstam writes:

> I made a module out of Andy's dash (and added some comfort functions
> over fash-fold):
> https://hg.sr.ht/~bjoli/guile-fash/browse/fash.scm?rev=default
>
> What it lacks is a proper way to remove elements..I had a couple of
> stabs at it, but I fear I was too dumb.

Ah excellent!

I could contribute fash-keys, fash-values, fash-map, and fash-for-each.
Those shouldn't be too difficult to do.

As for deleting elements, why don't we take the simple way for now?
Let's make a procedure that just uses fash-fold and copies over to a new
fash, sans the removed element.  We can note that it's O(n) but that a
faster version is possible but needs to be writtten.

What do you think?
 - Chris




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

* Re: Functional hashtables
  2020-05-05 19:45 ` Linus Björnstam
  2020-05-06 11:23   ` Christopher Lemmer Webber
@ 2020-05-06 11:24   ` Christopher Lemmer Webber
  2020-05-06 13:32     ` Linus Björnstam
  2020-05-06 18:29     ` ArneBab
  1 sibling, 2 replies; 9+ messages in thread
From: Christopher Lemmer Webber @ 2020-05-06 11:24 UTC (permalink / raw)
  To: Linus Björnstam; +Cc: guile-user

Linus Björnstam writes:

> I made a module out of Andy's dash (and added some comfort functions
> over fash-fold):
> https://hg.sr.ht/~bjoli/guile-fash/browse/fash.scm?rev=default

BTW, I am getting:

cwebber@twig:~/devel$ git clone https://hg.sr.ht/~bjoli/guile-fash
Cloning into 'guile-fash'...
fatal: repository 'https://hg.sr.ht/~bjoli/guile-fash/' not found



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

* Re: Functional hashtables
  2020-05-06 11:24   ` Christopher Lemmer Webber
@ 2020-05-06 13:32     ` Linus Björnstam
  2020-05-06 18:29     ` ArneBab
  1 sibling, 0 replies; 9+ messages in thread
From: Linus Björnstam @ 2020-05-06 13:32 UTC (permalink / raw)
  To: Christopher Lemmer Webber; +Cc: guile-user

My code is still using mercurial. I will migrate it to git when I have the time.

-- 
  Linus Björnstam

On Wed, 6 May 2020, at 13:24, Christopher Lemmer Webber wrote:
> Linus Björnstam writes:
> 
> > I made a module out of Andy's dash (and added some comfort functions
> > over fash-fold):
> > https://hg.sr.ht/~bjoli/guile-fash/browse/fash.scm?rev=default
> 
> BTW, I am getting:
> 
> cwebber@twig:~/devel$ git clone https://hg.sr.ht/~bjoli/guile-fash
> Cloning into 'guile-fash'...
> fatal: repository 'https://hg.sr.ht/~bjoli/guile-fash/' not found
>



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

* Re: Functional hashtables
  2020-05-06 11:24   ` Christopher Lemmer Webber
  2020-05-06 13:32     ` Linus Björnstam
@ 2020-05-06 18:29     ` ArneBab
  2020-05-08 18:11       ` Christopher Lemmer Webber
  1 sibling, 1 reply; 9+ messages in thread
From: ArneBab @ 2020-05-06 18:29 UTC (permalink / raw)
  To: Christopher Lemmer Webber; +Cc: guile-user


Christopher Lemmer Webber <cwebber@dustycloud.org> writes:

> Linus Björnstam writes:
>
>> I made a module out of Andy's dash (and added some comfort functions
>> over fash-fold):
>> https://hg.sr.ht/~bjoli/guile-fash/browse/fash.scm?rev=default
>
> BTW, I am getting:
>
> cwebber@twig:~/devel$ git clone https://hg.sr.ht/~bjoli/guile-fash
> Cloning into 'guile-fash'...
> fatal: repository 'https://hg.sr.ht/~bjoli/guile-fash/' not found

You need

hg clone https://hg.sr.ht/~bjoli/guile-fash

(which I like — I don’t intend to move my hobby stuff to git; even after
2 years of using it professionally, git is still painful to use)

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken



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

* Re: Functional hashtables
  2020-05-06 18:29     ` ArneBab
@ 2020-05-08 18:11       ` Christopher Lemmer Webber
  0 siblings, 0 replies; 9+ messages in thread
From: Christopher Lemmer Webber @ 2020-05-08 18:11 UTC (permalink / raw)
  To: ArneBab; +Cc: guile-user

ArneBab writes:

> Christopher Lemmer Webber <cwebber@dustycloud.org> writes:
>
>> Linus Björnstam writes:
>>
>>> I made a module out of Andy's dash (and added some comfort functions
>>> over fash-fold):
>>> https://hg.sr.ht/~bjoli/guile-fash/browse/fash.scm?rev=default
>>
>> BTW, I am getting:
>>
>> cwebber@twig:~/devel$ git clone https://hg.sr.ht/~bjoli/guile-fash
>> Cloning into 'guile-fash'...
>> fatal: repository 'https://hg.sr.ht/~bjoli/guile-fash/' not found
>
> You need
>
> hg clone https://hg.sr.ht/~bjoli/guile-fash
>
> (which I like — I don’t intend to move my hobby stuff to git; even after
> 2 years of using it professionally, git is still painful to use)
>
> Best wishes,
> Arne

Linus Björnstam writes:

> My code is still using mercurial. I will migrate it to git when I have
> the time.

Hey... sorry I just didn't realize.  Cloned, thank you! :)



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

* Re: Functional hashtables
  2020-05-05 18:10 Functional hashtables Christopher Lemmer Webber
  2020-05-05 19:45 ` Linus Björnstam
@ 2020-05-16 20:42 ` Ludovic Courtès
  2020-05-17  7:31   ` Catonano
  1 sibling, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2020-05-16 20:42 UTC (permalink / raw)
  To: guile-user

Hi there!

Christopher Lemmer Webber <cwebber@dustycloud.org> skribis:

> There's no separate package of guile-fash available anywhere, but it
> would be easy enough to do if we're just using it with Guix.  It's
> desirable to not have to keep copy-pasta'ing fash.scm around at least.
>
> My time in Racket has convinced me that it's an extremely good idea to
> have a well supported functional hashmap type in the language... extra
> points if it's "first class" in syntax (my code has improved
> considerably because of it; no more using alists where they'll bite you
> later just because it "looks prettier").

I’ve never used fash, but I’m all for getting it in Guile proper if Andy
is fine with it.  In general, I agree that having more functional data
structures in Guile is desirable.

Would someone be willing to turn it into a proper Guile module with a
section in the manual and some tests?

> Nice to be back in Guile land!

Heh, good to see you back here!  :-)

Ludo’.




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

* Re: Functional hashtables
  2020-05-16 20:42 ` Ludovic Courtès
@ 2020-05-17  7:31   ` Catonano
  0 siblings, 0 replies; 9+ messages in thread
From: Catonano @ 2020-05-17  7:31 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guile User

Il giorno sab 16 mag 2020 alle ore 22:43 Ludovic Courtès <ludo@gnu.org> ha
scritto:

>
>

Would someone be willing to turn it into a proper Guile module with a
> section in the manual and some tests?
>
>
I'm ready to help

maybe contributing some tests or some manual paragraphs


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

end of thread, other threads:[~2020-05-17  7:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 18:10 Functional hashtables Christopher Lemmer Webber
2020-05-05 19:45 ` Linus Björnstam
2020-05-06 11:23   ` Christopher Lemmer Webber
2020-05-06 11:24   ` Christopher Lemmer Webber
2020-05-06 13:32     ` Linus Björnstam
2020-05-06 18:29     ` ArneBab
2020-05-08 18:11       ` Christopher Lemmer Webber
2020-05-16 20:42 ` Ludovic Courtès
2020-05-17  7:31   ` Catonano

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