首页 > 解决方案 > 这里的“isSome old(tl dates)”是什么意思;为什么“最旧(tl 日期)”有一个选项类型?

问题描述

fun oldest (dates: (int*int*int) list) =
    if null dates
    then NONE
    else let
    val ans = oldest(tl dates)
    in
    if isSome ans andalso is_older(valOf ans, hd dates)
    then ans
    else SOME (hd dates)
    end

一个函数比较列表中的所有日期(如 2018、2、28),并获取最旧的日期

标签: sml

解决方案


推荐阅读