Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Created March 25, 2020 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CMCDragonkai/79446a9c025b1cfc14a53571f0f4e4b4 to your computer and use it in GitHub Desktop.
Save CMCDragonkai/79446a9c025b1cfc14a53571f0f4e4b4 to your computer and use it in GitHub Desktop.
Singleton List Syntax #python #haskell

Singleton List Syntax

Sometimes you want to have a singleton list or an empty list.

In Python:

[1] * (True) # [1]
[1] * (False) # []

In Haskell:

[1 | True] -- [1]
[1 | False] -- []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment