dict_update   xtlang

Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/adt.xtm


(bind-func dict_update:[!v,List{Pair{String*,!v}*}*,String*,[!v,!v]*]*
  "set (or update) value for key in dict according to update_fn (returns the old value)"
  (lambda (dict key update_fn)
    (if (null? dict)
        (convert null)
        (if (equal (first (car dict)) key)
            (let ((oldval (second (car dict)))
                  (newval (update_fn oldval)))
              ;; if update_fn returns null, do nothing. otherwise
              ;; update the value for key
              (tset! (car dict) 1 newval)
            (if (null? (cdr dict))
                (begin (append_destructive dict (list (Pair key (update_fn (convert null)))))
                       (convert null))
                (dict_update (cdr dict) key update_fn))))))

Back to Index

Similar Entries

  • VBO_update_data    xtlang
  • clock:update-metro    scheme
  • clock:update-metro    scheme
  • dict_get    xtlang
  • dict_set    xtlang
  • impc:ti:check-to-update-generic-vars    scheme
  • impc:ti:update-closure-name    scheme
  • impc:ti:update-var    scheme
  • kinect_update_body    xtlang
  • model_update    xtlang
  • position_update    xtlang
  • shader_update_bones    xtlang
  • shader_update_camera    xtlang
  • shader_update_envmap    xtlang
  • shader_update_light    xtlang
  • shader_update_lights    xtlang
  • shader_update_material    xtlang
  • shader_update_material    xtlang
  • shader_update_material    xtlang
  • shader_update_matrices    xtlang
  • shader_update_matrices_lv    xtlang
  • shader_update_matrices_lvs    xtlang
  • shader_update_projection_texture    xtlang
  • shader_update_uvwmatrix    xtlang
  • update    xtlang
  • update    xtlang
  • update-borders    xtlang
  • update-fluid-sym-state    xtlang
  • update_cube    xtlang
  • update_data_points    xtlang
  • xtm_update_camera    xtlang
  • xtm_update_lights    xtlang
  • xtm_update_matrices    xtlang
  • xtmtest-update-test-result    scheme
  • xtmtest-update-test-result    scheme