Re: Weird behavior of hash-table

2019-11-24 Thread John Cowan
On Sun, Nov 24, 2019 at 3:58 AM wrote: So the best thing for one's brain is to train it to read #(...) > as some weird relative of '(...)? > Not really: that oversimplification will get you into trouble in more complex cases. In Scheme (and Lisp languages generally), there are two contexts for

Re: Weird behavior of hash-table

2019-11-24 Thread tomas
On Sun, Nov 24, 2019 at 06:00:43AM -0500, Mark H Weaver wrote: > Hi tomás, > > wrote: > > > So the best thing for one's brain is to train it to read #(...) > > as some weird relative of '(...)? > > Yes. They are both literals, and no part of a literal is evaluated. > #(...) is actually a short

Re: Weird behavior of hash-table

2019-11-24 Thread tomas
On Sun, Nov 24, 2019 at 11:55:40AM +0100, Zelphir Kaltstahl wrote: > Hi Tomas! > > On 11/24/19 9:57 AM, to...@tuxteam.de wrote: > > Yikes. I'd fall into this trap, too [...] > > Is there a corresponding weird relative of `(...)? > > > > Cheers > > -- tomás > > Do you mean a way to write a vector

Re: Weird behavior of hash-table

2019-11-24 Thread Mark H Weaver
Hi tomás, wrote: > So the best thing for one's brain is to train it to read #(...) > as some weird relative of '(...)? Yes. They are both literals, and no part of a literal is evaluated. #(...) is actually a shorthand for '#(...), and incidentally, one which was not standardized until the R7RS

Re: Weird behavior of hash-table

2019-11-24 Thread Zelphir Kaltstahl
Hi Tomas! On 11/24/19 9:57 AM, to...@tuxteam.de wrote: > Yikes. I'd fall into this trap, too. Thanks you both for illustrating > it so well -- and thanks, Mark, for your unfailing sharp vision :-) > > So the best thing for one's brain is to train it to read #(...) > as some weird relative of '(...

Re: Weird behavior of hash-table

2019-11-24 Thread Zelphir Kaltstahl
Hi Mark! Thank you, that is the solution and the explanation! I read my procedures multiple times, wondering whether I am returning another hash table or anything. It would have taken me a long time before trying to create the vector without the additional quotes. Regards, Zelphir On 11/24/19 9

Re: Weird behavior of hash-table

2019-11-24 Thread tomas
On Sun, Nov 24, 2019 at 03:04:36AM -0500, Mark H Weaver wrote: > Hi Zelphir, > > Zelphir Kaltstahl writes: > > > I've noticed a strange behavior of hash tables [...] > > (define SQUARES > > ;; vector, constant time access > > #('A1 'B1 'C1 'D1 'E1 'F1 'G1 'H1 [...] > I guess that you meant

Re: Weird behavior of hash-table

2019-11-24 Thread Mark H Weaver
Hi Zelphir, Zelphir Kaltstahl writes: > I've noticed a strange behavior of hash tables. I put in symbols as keys > and integers as values, but when I try to get the integers out again by > using the same symbol, I get back a #f instead. Here is the code I am using: > > > (use-modules >