Skip to content

std.functional calls should be chainable #87

@gvvaughan

Description

@gvvaughan

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions