Skip to content

Instantly share code, notes, and snippets.

@kobi2187
Created November 9, 2017 15:10
Show Gist options
  • Save kobi2187/6839b5867034519546f79a4d61c43d6f to your computer and use it in GitHub Desktop.
Save kobi2187/6839b5867034519546f79a4d61c43d6f to your computer and use it in GitHub Desktop.
# foundit.nim
# ......
42 proc all_perms(list:seq[int]):seq[seq[int]] =
43 var ourlist = list
44 while next_perm(ourlist):
45 result.add(ourlist)
46 return result
47
48
49 var list = @[1,2,3]
50 var res = all_perms(list)
51 echo res
------------
### Traceback (most recent call last)
foundit.nim(50) foundit
foundit.nim(45) all_perms
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment