Skip to content

Commit

Permalink
get rid of intermediate arguments in named let expansion #398
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Nov 2, 2024
1 parent 6391f79 commit 38f3d79
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* fix exception during error from eval [#362](https://github.com/LIPS-scheme/lips/issues/362)
* allow to catch exceptions from eval
* fix else keyword as only expression in cond [#366](https://github.com/LIPS-scheme/lips/issues/366)
* fix clash of variable named `list` in named `let` [#398](https://github.com/LIPS-scheme/lips/issues/398)

## 1.0.0-beta.19
### Breaking
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![npm](https://img.shields.io/badge/npm-1.0.0%E2%80%93beta.19-blue.svg)](https://www.npmjs.com/package/@jcubic/lips)
![1.0.0 Complete](https://img.shields.io/github/milestones/progress-percent/jcubic/lips/1?label=1.0.0%20Complete)
[![Build and test](https://github.com/jcubic/lips/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/lips/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&395903f2a79f3fd8d9ca3c439886a723)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&d99e59bdd4421bb215d5bb781449d63f)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Join Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jcubic/lips)
![NPM Download Count](https://img.shields.io/npm/dm/@jcubic/lips)
![JSDelivr Download count](https://img.shields.io/jsdelivr/npm/hm/@jcubic/lips)
Expand Down
11 changes: 5 additions & 6 deletions dist/lips.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions dist/lips.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.esm.min.js

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions dist/lips.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.min.js

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions src/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -5363,16 +5363,14 @@ function let_macro(symbol) {
params = code.cdr.car.map(pair => pair.car);
args = code.cdr.car.map(pair => pair.cdr.car);
}
const args_name = gensym('args');
return Pair.fromArray([
LSymbol('let'),
[[args_name, Pair(LSymbol('list'), args)]],
[LSymbol('letrec'),
[[code.car, Pair(
LSymbol('lambda'),
Pair(params, code.cdr.cdr))]],
[LSymbol('apply'), code.car, args_name]]
]);
return new Pair(
Pair.fromArray([
LSymbol('letrec'),
[[code.car, Pair(
LSymbol('lambda'),
Pair(params, code.cdr.cdr))]],
code.car]),
args);
} else if (macro_expand) {
// Macro.defmacro are special macros that should return lips code
// here we use evaluate, so we need to check special flag set by
Expand Down

0 comments on commit 38f3d79

Please sign in to comment.