---
title: "两行代码实现全排列，erlang好强悍"
author: "luckyclouds"
date: "2010-09-27T11:34:07Z"
tags: ["C", "C#", "C++", "Erlang"]
categories: ["编程语言"]
slug: "erlang"
draft: false
lastmod: "2010-09-27T11:34:07Z"
id: 772992
url: "https://luckyclouds.iteye.com/blog/772992"
---

```erlang

-module(libmis).
-export([perms/1]).

perms([])   -> [[]];
perms(L)    -> [ [h|t] || H <- L, T <- perms(L--[h])].


```


Eshell V5.7.4  (abort with ^G)
1> c(libmis).
{ok,libmis}
2> libmis:perms("123").

3>