|
|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 896 (0x380)
Types: TextFile
Names: »SORTER.SCL«
└─⟦216f59cd8⟧ Bits:30002641 SCANLOG - Piccoline vers. nov. 87
└─⟦this⟧ »SORTER.SCL«
; Jan Rubæk Pedersen 1.Juli 1985
;
; Hurtigsortering. Kan sortere en liste af strenge eller tal.
;
; Hvis man ønsker at sortere andet, f.eks. lister, skal reglen for
; orden laves om.
;
; Kaldes paa formen
; find alle Svar saa sorter(<4,56,7,12,3>,Svar)
vælg_een sorter
sorter(<X..Y>,S) hvis
split(X,Y,A,B),
sorter(A,S1),
sorter(B,S2) og
konkatener(S1,<X..S2>,S).
sorter(<>,<>).
slut.
vælg_een konkatener
konkatener(<X..Y>,L,<X..Z>) hvis
konkatener(Y,L,Z).
konkatener(<>,L,L).
slut.
split(Element,<A..Hale1>,<A..Hale2>,L) hvis
orden(A,Element) og
split(Element,Hale1,Hale2,L).
split(Element,<A..Hale1>,L,<A..Hale2>) hvis
ikke(orden(A,Element)) og
split(Element,Hale1,L,Hale2).
split(Element,<>,<>,<>).
orden(A,B) hvis
A < B.
«eof»