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

std.functional calls should be chainable #87

Open
gvvaughan opened this issue Sep 30, 2014 · 0 comments
Open

std.functional calls should be chainable #87

gvvaughan opened this issue Sep 30, 2014 · 0 comments
Milestone

Comments

@gvvaughan
Copy link
Contributor

With the current design, calls have to be nested like this:

map (function (k) package.loaded[k] = nil end, 
     filter (function (k) return (k == "std") or (k:match "^std%.") end,
             package.loaded))

Which, aside from being ugly as hell, is not terribly functional. We should be able to write functional code like this:

Map (package.loaded).
  filter (lambda 'return (_1 == "std") or (_1:match "^std%.")').
  map (lambda 'package.loaded[_1] = nil')

Here, Map is an arbitrary constructor to make a new object with functional methods that can be chained -- but these might be usefully integrated into the Object hierarchy relatively close to the root, maybe even to std.object itself.

(yes, I know it's a bad example with side effects, but it still illustrates the point of not being able to get the most out of std.functional when you have to nest or compose everything before you can use it readably)

@gvvaughan gvvaughan added this to the v42 milestone Sep 30, 2014
@gvvaughan gvvaughan removed the ready label Sep 30, 2014
@gvvaughan gvvaughan modified the milestones: v41.4, v41.3 Sep 12, 2015
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