Skip to content

Update lfe_doc's guard handling in 1.1.1 #243

Closed

Description

@yurrriq

Currently (and for 1.1):

%% function_patterns(LambdaForm) -> {Arity,Patterns}.
%% macro_patterns(LambdaForm)    -> Patterns.
%%  Given a {match-,}lambda form, attempt to return its patterns (or
%%  arglist).  N.B. A guard is appended to its pattern and Patterns is
%%  a list of lists.  A macro definition must have two args, the pattern
%%  and the environment.

-spec function_patterns(LambdaForm) -> {Arity,Patterns} when
      LambdaForm :: nonempty_list(),
      Arity      :: non_neg_integer(),
      Patterns   :: nonempty_list(pattern()).
-spec macro_patterns(LambdaForm) -> Patterns when
      LambdaForm :: nonempty_list(),
      Patterns   :: nonempty_list(pattern()).

For 1.1.1:

I think I would prefer to separate them, sort of {Patterns,GuardTests}.

%% Something like:
-spec function_patterns(LambdaForm) -> {Arity,PatternGuards} when
      LambdaForm    :: nonempty_list(),
      Arity         :: non_neg_integer(),
      PatternGuards :: nonempty_list({Patterns,GuardTests}),
      Patterns      :: nonempty_list(pattern()),
      GuardTests    :: nonempty_list(guard()).   %Assuming guard/0 is defined.
-spec macro_patterns(LambdaForm) -> PatternGuards
      LambdaForm    :: nonempty_list(),
      PatternGuards :: nonempty_list({Patterns,GuardTests}),
      Patterns      :: nonempty_list(pattern()),
      GuardTests    :: nonempty_list(guard()).   %Assuming guard/0 is defined.

Related: #220

Activity

  1. rvirding commented on Jun 15, 2016

    @rvirding
    Member

    Yes, to separating the patterns and guards in that fashion. However the API has changed so it mightn't be those functions where you see it.

  2. added a commit that references this issue on Jul 26, 2020
    3c9c3a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions