Skip to content

Commit

Permalink
add defineFunction action
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Jun 21, 2023
1 parent c56df46 commit 02cd06a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

**Heta** is a modeling language for quantitative systems pharmacology and systems biology.

The current version is **0.4.2**.
The current version is **0.4.3**.

See also the [Heta video tutorial](https://hetalang.github.io/#/resources/?id=lesson-0-introduction)

Expand Down
33 changes: 33 additions & 0 deletions actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ If no statement is written the default statement is `#upsert` which is the equiv
- [export](#export)
- [importNS](#importns)
- [import](#import)
- [defineFunction](#definefunction)

## insert

Expand Down Expand Up @@ -431,3 +432,35 @@ end
| prefix | string | | "" | | prefix of new ids |
| suffix | string | | "" | | suffix of new ids|
| rename | Dictionary | | {} | | id matching table |

## defineFunction

_EXPERIMMENTAL_

The `defineFunction` action allows users to write a simple function in the platform and use it together with pre-defined functions [from the list](math#list-of-functions).

The `math` property of `defineFunction` may include arythmetic operators, pre-defined constants, identifiers of arguments, pre-defined functions and functions added with other `defineFunction` statements. It cannot include other identifiers like for components.

| property | type | required | default | ref | description |
| ---------|------|----------|---------|-----|-------------|
| id | `ID` | true | | | unique identifier of `FunctionDef` |
| arguments | `ID[]` | | `[]` | | identifiers of arguments |
| math | `string[]` | true | | | single string representing math expression |

### Example 1

```heta
#defineFunction pow7 {
arguments: [x],
math: "pow(x, 7)"
};
```

### Example 2

```heta
#defineFunction f3 {
arguments: [x1, x2, x3],
math: sqrt(x1^2 + x2^2 + x3^2)
};
```
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 0.4.3

- add `#defineFunction` action as an experimental

## 0.4.2

- use `import xxx.xlsx type table` instead of `import xxx.xlsx type xlsx`
Expand Down

0 comments on commit 02cd06a

Please sign in to comment.