Mercurial > repos > rhope
diff extendlib.rhope @ 1:b3f71490858c
Small fixes and enhancements from main windows box
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 29 Apr 2009 02:13:24 -0400 |
parents | 76568becd6d6 |
children | 23dd9c766699 |
line wrap: on
line diff
--- a/extendlib.rhope Tue Apr 28 23:06:07 2009 +0000 +++ b/extendlib.rhope Wed Apr 29 02:13:24 2009 -0400 @@ -70,9 +70,19 @@ } } +To String@String[string:out] +{ + out <- string +} + +Empty@String[string:out] +{ + out <- "" +} + In[needle,haystack:found?] { - [haystack]Get DString[needle] + [haystack]Get DString[To String[needle]] { found? <- Yes } {} {} { @@ -201,6 +211,41 @@ } } +_Zip[left,lindex,right,rindex,outlist:out] +{ + nlist <- [outlist]Append[ + [[()]Append[ [left]Index[lindex] ]]Append[ [right]Index[rindex] ] + ] + nlindex <- [left]Next[lindex] + { + [right]Next[rindex] + { + out <- _Zip[left,nlindex,right,~,nlist] + }{ + out <- Val[nlist] + } + }{ + out <- Val[nlist] + } +} + +Zip[left,right:out] +{ + lindex <- [left]First + { + Print[~] + [right]First + { + Print[~] + out <- _Zip[left,lindex,right,~,()] + }{ + out <- () + } + }{ + out <- () + } +} + _Dict Split[dict,entry,index,keydelim:out] { parts <- [entry]Split[keydelim] @@ -524,3 +569,28 @@ out <- Fold["_Keys", New@List[], container] } +And[left,right:out] +{ + ,out <- If[left] + { + out,out <- If[right] + } +} + +Or[left,right:out] +{ + out <- If[left] {} + { + out,out <- If[right] + } +} + +After[text,prefix:after,not found] +{ + If[[text]Starts With[prefix]] + { + ,after <- [text]Slice[[prefix]Length] + }{ + not found <- text + } +}