Skip to content

contract declarations on functions not of the form "function name(){}" #23

Open
@joelmccracken

Description

@joelmccracken

I can't seem to get anything to work except for the named function form. EX:

import @ from "contracts.js"

@ ({name: Str}, [...{loc: Num}]) -> Str
var calcAverageLoc =  }function(person, locArr) {
    var sum = locArr.reduce(function (l1, l2) {
        return l1.loc + l2.loc;
    });
    return "Average lines of code for " +
           person.name + " was " +
           sum / locArr.length;
}


var typoPerson = {nam: "Bob"};
calcAverageLoc(typoPerson, [{loc: 1000}, {loc: 789}, {loc: 9001}]);
SyntaxError: [macro] Macro `@` could not be matched with `() - > Str var...`
9: @ ({name: Str}, [...{loc: Num}]) -> Str
   ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions