refactors u3v_wish for clarity
@@ -89,34 +89,23 @@ u3v_start(u3_noun now)
u3_noun
u3v_wish(const c3_c* str_c)
{
- u3_noun exp;
-
- if ( u3R == &u3H->rod_u ) {
u3_noun txt = u3i_string(str_c);
-
- exp = u3kdb_get(u3k(u3A->yot), u3k(txt));
+ u3_weak exp = u3kdb_get(u3k(u3A->yot), u3k(txt));
if ( u3_none == exp ) {
exp = _cv_nock_wish(u3k(txt));
+
+ // It's probably not a good idea to use u3v_wish()
+ // outside the top level... (as the result is uncached)
+ //
+ if ( u3R == &u3H->rod_u ) {
u3A->yot = u3kdb_put(u3A->yot, u3k(txt), u3k(exp));
}
- u3z(txt);
- return exp;
}
- else {
- // It's probably not a good idea to use u3v_wish()
- // outside the top level...
- //
- u3_noun txt = u3i_string(str_c);
- u3_noun exp = u3kdb_get(u3A->yot, u3k(txt));
- if ( u3_none != exp ) {
u3z(txt);
return exp;
}
- else return _cv_nock_wish(u3i_string(str_c));
- }
-}
/* _cv_mung(): formula wrapper with gate and sample.
*/
