Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list handling: whole list or contents? #4

Open
mmitch opened this issue Apr 18, 2017 · 0 comments
Open

list handling: whole list or contents? #4

mmitch opened this issue Apr 18, 2017 · 0 comments

Comments

@mmitch
Copy link
Owner

mmitch commented Apr 18, 2017

Currently seq applied to a list will create sublists:
[ 1 2 3 ] seq -> [ [ 1 ] [ 1 2 ] [ 1 2 3 ] ]
This is inconsistent because normally seq will just push multiple values onto the current stack without wrapping them in a group. But providing a flat list is not very useful: [ 1 1 2 1 2 3 ]. Also changing the number of list elements is unusual. Perhaps this can be seen as a case of cross-product and everything is OK.

What about applying a function to a list?

  • Should the list be bound as a parameter inside the function? This might be useful.
  • Should the function be applied to every parameter of the list? This might be useful, too.

Same thing with drop: Currently there is plain drop (d) which is treating lists in any way: It will just drop a list. To drop elements from inside a list, there is di (drop indirect). But there is currently no way to drop elements from inside multiple lists (dii? how many indirections do we need?), think of transforming [ [ 1 2 ] [ 3 4 ] [ 5 6 ] ] into [ [ 2 ] [ 4 ] [ 6 ] ].

Perhaps we need explicit map and flatMap operations that tie in together with other operations and remove the explicit list handling currently hardcoded to every (well, at least some) operation? This might also help with deduping the list handling parts in the code (see #3).

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

No branches or pull requests

1 participant