0
我發現這個代碼的壓縮和解方案:壓縮和排序問題
(define zip
(lambda (leftList rightList)
(if (null? rightList)
leftList
(if (member (car rightList) leftList)
(zip leftList (cdr rightList))
(zip (append leftList (list (car rightList))) (cdr rightList))))))
=> (zip '(1 4) '(2 3))
(1 4 2 3)
但我要對結果進行分類:
=> (zip '(1 4) '(2 3))
(1 2 3 4)
據我所知拉鍊產生列表中的對,這兩個列表的每對contianing元件。例如,http://zvon.org/other/haskell/Outputprelude/zip_f.html。如果我對財產進行了詳細說明,那麼您的期望結果不是zip。 – demas 2010-11-10 10:15:57
'(排序(拉鍊 '(1 4)'(2 3)))' – 2010-11-10 12:43:20
但存在一個錯誤;語法:定義:太多形式值(排序(...)) ;要繼續,呼叫RESTART帶有選項號碼: ; (RESTART 1)=>返回讀EVAL-打印級別1 – fahad 2010-11-10 14:15:57