看板 PLT 關於我們 聯絡資訊
※ 引述《slyfox (klanloss)》之銘言: : I was tracing the code from: : http://shivindap.wordpress.com/2009/01/12/permutations-of-a-list-in-haskell/ : but got confused by: : permutation [1] : = [ 1 : permutation [] ] : = [ 1 : [[]] ] : where did i go wrong? Thanks. permutation [] = [ [] ] permutation xs = [ x:ys | x <- xs, ys <- permutation (delete x xs) ] permutation [1] = [ 1:ys | ys <- permutation [] ] = [ 1:ys | ys <- [ [] ] ] = [ 1:[] ] = [ [1] ] -- And in that line now was a whiskered old man, with a linen cap and a crooked nose, who waited in a place called the Stardust Band Shell to share his part of the secret of heaven: that each affects the other and the other affects the next, and the world is full of stories, but the stories are all one. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 128.36.229.73 ※ 編輯: scwg 來自: 128.36.229.73 (06/22 02:12)
slyfox:thx 06/22 08:15