tekknolagi / scrapscript

A functional, content-addressable programming language.
https://scrapscript.fly.dev/repl
Other
376 stars 10 forks source link

Add assorted list functions to prelude #56

Closed gregorybchris closed 10 months ago

gregorybchris commented 11 months ago

Adding the following functions to the prelude:

gregorybchris commented 10 months ago

@tekknolagi I know at first you were excited about adding quicksort to the prelude. Perhaps this large addition of multiple functions is more than you bargained for though..?

If there's a concern that this beautifully simple language is getting too complex, maybe we want to remove the prelude altogether? If we don't want map and reduce, the same probably apples to filter and id (which already exist in the prelude).

Alternatively, we could avoid polluting the global namespace too much by making the prelude opt-in via a CLI flag. Then we can continue to add common functions to the prelude without affecting all users of the interpreter. Something like python scrapscript.py eval program.scrap --prelude. I would personally prefer this option, at least until we have scrapyards to pull in dependencies.

tekknolagi commented 10 months ago

I think we can just dump them all in for now. We can namespace later.

tekknolagi commented 10 months ago

Another alternative, if you are concerned about growth of prelude, is to work together to get scrap loading functionality working and then we can publish this somewhere

gregorybchris commented 10 months ago

Another alternative, if you are concerned about growth of prelude, is to work together to get scrap loading functionality working and then we can publish this somewhere

I'm personally not concerned at all about the absolute size of the prelude. If the prelude is large I think that's ok. What I would be concerned about is 1. Adding something that's not standard in most programming languages 2. Adding something with inconsistent/confusing naming (e.g. fold vs reduce is potentially worth a few seconds of thought before merging)

I also think it'd be easy to throw them behind a CLI flag and/or in a new file, which imo addresses some of the potential simplicity concerns.