Skip to content

Instantly share code, notes, and snippets.

@lanwin
Last active December 25, 2015 11:49
Show Gist options
  • Save lanwin/6971441 to your computer and use it in GitHub Desktop.
Save lanwin/6971441 to your computer and use it in GitHub Desktop.
Less types and more functions.
As lisp programmers have know for a long time it is better to have a smallish number of ubiquitous data types and a large number of small functions that work on them, than to have a large number of data types and a small number of functions that work on them.
@forki
Copy link

forki commented Oct 14, 2013

It's better to have a separate file data type that can be distinguished from string.

But of course all string functions should also work on the "Content" property of the file. But a file is usally more than just a string. You have a FileName and maybe other functions which allow to process the file sequentially. You don't want to load the big files completely into the RAM.

@forki
Copy link

forki commented Oct 14, 2013

But in order to understand the statement keep in mind Lisp has no strong typing.

All Lisp functions should work on the generic data types like array, map,...

If you look at ML, F# or haskell then you'll see that you can have both. You can define generic functions which work on complicated data structures and keep the types distinguishable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment