小编use*_*607的帖子

使用java日历类获取一周的开始和结束日期

我希望获得给定日期的一周的最后一周和第一周.例如,如果日期是2011年10月12日,那么我需要2011年10月10日(作为一周的开始日期)和2011年10月16日(作为一周的结束日期)的日期有谁知道如何使用日历获得这两个日期class(java.util.Calendar)非常感谢!

java calendar dayofweek

11
推荐指数
1
解决办法
2万
查看次数

如何使用Haskell中的快速排序通过其accountID对列表进行排序

我是一名真正擅长函数式编程的学生.我正在处理已经定义为数据的银行应用程序,

type Accountno = Int 
data Accounttype = Saving | Current  | FixedDeposit deriving (Show,Read)
type Accountamount = Int
type Name = String 
type Account = (Accountno, Name, Accounttype, Accountamount) 


exampleBase :: [Account]
exampleBase = [ (1,"Jennifer",Saving,1000 ) , 
    (5,"Melissa",Current,3000) ,
    (2,"Alex",Saving,1500)]
Run Code Online (Sandbox Code Playgroud)

我试图使用以下代码按其帐号对列表进行排序,

sortByID :: (Ord a) => [a] -> [a]
sortByID [] = []
sortByID (l :ls) =
  let
   smallerSorted = sortByID [x | x <- ls, x <= l]
   biggerSorted = sortByID [x | x <- ls, x …
Run Code Online (Sandbox Code Playgroud)

sorting haskell functional-programming

1
推荐指数
1
解决办法
313
查看次数