[email protected] writes: > On comma, if comma is the first character, the code is expanded into > (unquote ...), but otherwise it is accepted in a name (like #\# and > others): > > <1> (define a,b 43) > 43 > <2> a,b ; a,b is a legitimate symbol
I'm aware of this and I like being able to have comma, dot, etc. within symbols. That isn't what I was referring to. The same thing happened when I had a more complex key which is where I first discovered it: ./s7load "(define X (hash-table)) (define B 'b) (set! (X '(a b)) 'foo) (display (X '(a ,B)))(newline)" #f > (unquote b) ; no error because it's not evaluated This is likely to be what's happening and again I'm not sure whether this is a bug or expected behaviour from the quote operator. What I know is that there was a bug in my own code and when I found it thought something along the lines that I should have got an error from using , outside of a ` construct. I made a note of it and forgot about it until I sent in this report. > I don't know if this is how other Schemes work. It's possible > for two objects in a sort to be eq? if, for example, you're > sorting integers. I'm sorry I was not using "object" in a way which includes simple objects like integers but rather to mean something complex that's been constructed from primitives. The sort! function was being called with the list ((1) (2)) and the comparator was receiving the same (1) in both of its arguments, but only when getting at the list item with (A 0) and not with (car A). Or in the pre-golf version it was being called with a list of hash tables and both comparator arguments were the same hash table object. > The (A 0) case should be the same as (car A). This seems to be the crux of the matter. I was actually a little surprised when I switched to (car A) "just to check" and the problem went away. > <1> (eq? 1 1) > #t > <2> (eq? 123123 123123) > #f Aside: It annoys me that scheme has taken the usefully short symbol eq? for the most useless comparison operator. If I wanted to think about pointers and how the runtime allocates small objects I'd be using C. ... Which I am --- the ease with which I can integrate scheme and C is why I'm using S7 --- but that's beside the point. Matthew _______________________________________________ Cmdist mailing list [email protected] https://cm-mail.stanford.edu/mailman/listinfo/cmdist
