dictionary-ref now returns a pair or #f
This commit is contained in:
parent
d01b72835d
commit
238f5999bc
|
@ -17,9 +17,9 @@
|
||||||
(letrec ((setter
|
(letrec ((setter
|
||||||
(lambda (proc)
|
(lambda (proc)
|
||||||
(let ((setter (dictionary-ref (attribute proc) '@@setter)))
|
(let ((setter (dictionary-ref (attribute proc) '@@setter)))
|
||||||
(if (undefined? setter)
|
(if setter
|
||||||
(error "no setter found")
|
(cdr setter)
|
||||||
setter))))
|
(error "no setter found")))))
|
||||||
(set-setter!
|
(set-setter!
|
||||||
(lambda (proc setter)
|
(lambda (proc setter)
|
||||||
(dictionary-set! (attribute proc) '@@setter setter))))
|
(dictionary-set! (attribute proc) '@@setter setter))))
|
||||||
|
|
|
@ -117,7 +117,7 @@ Symbol-to-object hash table.
|
||||||
|
|
||||||
- **(dictionary-ref dict key)**
|
- **(dictionary-ref dict key)**
|
||||||
|
|
||||||
Look up dictionary dict for a value associated with key. If dict has a slot for key `key`, the value stored in the slot is returned. Otherwise `#undefined` is returned.
|
Look up dictionary dict for a value associated with key. If dict has a slot for key `key`, a pair containing the key object and the associated value is returned. Otherwise `#f` is returned.
|
||||||
|
|
||||||
- **(dictionary-set! dict key obj)**
|
- **(dictionary-set! dict key obj)**
|
||||||
|
|
||||||
|
|
|
@ -116,9 +116,9 @@ pic_dict_dictionary_ref(pic_state *pic)
|
||||||
pic_get_args(pic, "dm", &dict, &key);
|
pic_get_args(pic, "dm", &dict, &key);
|
||||||
|
|
||||||
if (! pic_dict_has(pic, dict, key)) {
|
if (! pic_dict_has(pic, dict, key)) {
|
||||||
return pic_undef_value();
|
return pic_false_value();
|
||||||
}
|
}
|
||||||
return pic_dict_ref(pic, dict, key);
|
return pic_cons(pic, pic_obj_value(key), pic_dict_ref(pic, dict, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
|
|
Loading…
Reference in New Issue