如何在Haskell

时间:2015-05-11 03:17:32

标签: haskell

我有一个像[[a,c,e],[b,d,f]]这样的列表列表,我想知道如何从列表中打印出每个值,每个列表一次打印一个。

我打印时所需的订单是abcdef

我已经考虑了一段时间,但我似乎无法弄明白。

2 个答案:

答案 0 :(得分:1)

以下是

[1,4,2,5,3,6]

mapM_ (putStr . show) [1,4,3,5,3,6]

返回

 public function CanBet($bettilltime, $bettilldate, $betsettime, $betsetdate, $amount) {
    $can_bet = true;
    $bettilltime = new DateTime(date("Y-m-d", $bettilltime));
    $bettilldate = new DateTime(date("Y-m-d", $bettilldate));

    $betsettime = new DateTime(date("Y-m-d", $betsettime));
    $betsetdate = new DateTime(date("Y-m-d", $betsetdate));
    if ($this->GetUserBalance() > $amount) {
        if (date_diff($betsetdate, $bettilldate) > 0) {
            if (date_diff($betsettime, $bettilltime) > 0) {
                $can_bet = true;
            }
            else {
                $can_bet = false;
            }
        }
        else {
            $can_bet = false;
        }
    }
    else {
        $can_bet = false;
    }

    return $can_bet;
}

答案 1 :(得分:0)

from collections import Counter

def is_palindrome(letters):
    return len([v for v in Counter(letters).values() if v % 2]) <= 1

输出:[1,2,3,4,5,6]