Help on usage of send or call
MisterX
b.xavier at internet.lu
Sun May 8 02:09:18 EDT 2005
On Behalf Of Dar Scott
>
> On May 7, 2005, at 10:53 PM, MisterX wrote:
>
> I think you just hit on an interesting area of research:
> motivating code.
>
Here's a preview of my php library stack... you get the idea...
-- TAOO sub-Libs
function arrayToList array
put the keys of arr into alist
repeat for each line l in alist
put array[l] & cr after outlist
end repeat
delete last char of outlist
return outlist
end arrayToList
-- php compatibility layer
-- callback functions that are not included
-- array_diff_uassoc
-- array_diff_ukey
function array_change_key_case arr, caz
put the keys of arr into arrk
if arrk is empty then return arr
switch caz
case "lower"
case "CASE_LOWER"
put tolower(arr[l]) into arr[l]
break
case "upper"
case "CASE_UPPER"
repeat for each line l in arrk
put toupper(arr[l]) into arr[l]
end repeat
break
case "title"
case "each word"
repeat for each line l in arrk
get arr[l]
repeat with x = 1 to the number of words in it
put toupper(char 1 of word x of it) into char 1 of word x of it
end repeat
put it into arr[l]
end repeat
break
end switch
return arr
end array_change_key_case
function array_chunk input_array, achunk
return input_array[achunk]
end array_chunk
function array_combine array1, array2
repeat with x = 1 to the number of items in array1
put item x of array2 into outarray[item x of array1]
end repeat
return outarray
end array_combine
function array_count_values array1
get the keys of array1
replace comma with cr in it
return the number of lines in it
end array_count_values
function array_diff_assoc array1, array2
put the keys of array1 into array1_items
put arrayToList(array2) into alist2
repeat for each line l in array1_items
get array1[l]
if l is not among the lines of alist2 then
put it into outarray[l]
end if
end repeat
return outarray
end array_diff_assoc
function array_diff_key array1, array2
put the keys of array1 into alist1
put the keys of array2 into alist2
repeat for each line l in alist1
if l is not among the lines of alist2 then
put l & cr after outlist
end if
end repeat
delete last char of outlist
return outlist
end array_diff_key
fuction array_diff
and hundreds to come...
Porting a script from PHP or using PHP's facilities in Rev just got
easier...
Same for Python...
More information about the use-livecode
mailing list