Hier sind: 
Inhalt getlcommon compare2lists lp2lingo l2lingo formatval2string


Inhalt von List Tools vom. 28.03.98

Übersicht
-- Tools for lists


on getLCommon ListOfLists
-- returns a list of common elements of ListOfLists input

on compare2Lists list1, list2

on lp2lingo dLp, dHandlerName
-- transform a propListe into scripttext
-- of a function which returns that propList

on l2lingo dLp, dHandlerName
-- wandle eine lineare Liste in scripttext
-- der eben diese Liste erzeugt

on formatVal2String dVal
-- save #symbol and #string vor der automatischen Typkonvertierung


Inhalt top Callers

on getLCommon ListOfLists
-- returns a list of common elements of ListOfLists input
if ilk(ListOfLists)<>#list then exit
set theList = duplicate(ListofLists)
repeat while Count(theList) > 1
set list1=getat(theList,1)
set list2=getat(theList,2)
deleteAt theList,1
setAt theList,1,compare2Lists(list1,list2)
end repeat
return getat(theList,1)
end


Inhalt top Callers

on compare2Lists list1, list2
set rslt=[]
repeat with anItem in list1
if getOne(List2, anItem) and not getOne(rslt,anItem) then append rslt,anItem
end repeat
return rslt
end

------------------


Inhalt top Callers

on lp2lingo dLp, dHandlerName
-- transform a propListe into scripttext
-- of a function which returns that propList
set dTxt = RETURN
set dTxt = dTxt & " on " & string(dHandlername) & RETURN
set dTxt = dTxt & " " & "set dLp=[:]" & RETURN

set dLp.Anz = Count(dLp)
repeat with rum=1 to dLp.Anz
set dProp = getPropAt(dLp,rum)
set dVal = getat(dLp,rum)

-- #symbol, #string need some special formatting
set dProp = formatVal2String(dProp)
set dVal = formatVal2String(dVal)

set dLine= "setaProp dLp," & dProp & "," & dVal
set dTxt = dTxt & " " & dLine & RETURN
end repeat

set dTxt = dTxt & " " & "return dLp" & RETURN
set dTxt = dTxt & "end "
return dTxt
end


Inhalt top Callers

on l2lingo dLp, dHandlerName
-- wandle eine lineare Liste in scripttext
-- der eben diese Liste erzeugt

set dTxt = RETURN
set dTxt = dTxt & " on " & string(dHandlername) & RETURN
set dTxt = dTxt & " " & "set dL=[]" & RETURN

set dL.Anz = Count(dL)
repeat with rum=1 to dL.Anz
set dVal = getat(dL,rum)

-- wenn #symbol dann handarbeit
set dVal = formatVal2String(dVal)

set dLine= "add dL," & dVal
set dTxt = dTxt & " " & dLine & Return
end repeat
set dTxt = dTxt & " " & "return dL" & RETURN
set dTxt = dTxt & " end " & string(dHandlername) & RETURN
return dTxt
end



Inhalt top Callers

on formatVal2String dVal
-- save #symbol and #string vor der automatischen Typkonvertierung
set dTxt=""
set dIlk = ilk(dVal)
case dIlk of
#symbol:
set dTxt = "#" & string(dVal)
#string:
set dTxt = QUOTE & string(dVal) & QUOTE
otherwise
set dTxt = string(dVal)
end case
return dtxt
end

-------------------------




-- /IHV


 

 

 

 

 

 

 

 

HTML created by dp tiny script documenting xtra v0.2 28.03.98 pageID=ListTools