Project

General

Profile

Useful list functions

  • Returns the part of a list between two given indexes.
fun extractList2 (l, start, end, counter)=
    if (counter > end) || (l == nil) then
        nil
    else
        if counter < start then
            extractList2 tl l start end counter+1
        else
            (hd l) :: extractList2 tl l start end counter+1;;

fun extractList (l, start, end)=
    extractList2 l start end 0;;

Author : iri
Date : december 2011

Return to Examples