Created
July 28, 2010 12:37
-
-
Save robertpfeiffer/494341 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec iterate fn prop start = | |
if prop start then start | |
else iterate fn prop (fn start) | |
let rec next node = | |
if is_left node then node |> right |> up |> firstChild | |
else node |> iterate up is_left |> next | |
let rec delete n off node = | |
let newnode = node |> toString |> boundedsubstring n off |> fromString | |
let rem = n + off - length node | |
if rem > 0 then delete rem 0 (next newnode) | |
else newnode | |
let rec insert off node text = | |
let left = (subrope 0 off node) | |
let right = (subrope off (len node - off) node) | |
concat left (concat text right) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment