Skip to content

Commit

Permalink
fix let*-values with mixed values #322
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Feb 26, 2024
1 parent 7e68f95 commit bfcab37
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* fix `repr` of delay expressions [#315](https://github.com/jcubic/lips/issues/315)
* fix `try..catch` [#317](https://github.com/jcubic/lips/issues/317)
* fix handling `^` and `$` syntax extension [#318](https://github.com/jcubic/lips/issues/318)
* fix mixed values in `let*-values` [#322](https://github.com/jcubic/lips/issues/322)

## 1.0.0-beta.18
### Breaking
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ publish:
jest-test: dist/lips.js
@$(JEST) --coverage spec/*.spec.js

test: dist/lips.js dist/std.min.scm
test: dist/lips.js dist/std.xcb
@$(NPM) run test

test-file: dist/lips.js dist/std.min.scm
test-file: dist/lips.js dist/std.xcb
@$(NPM) run test -- -- -f $(FILE)

test-update: dist/lips.js dist/std.scm
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![npm](https://img.shields.io/badge/npm-1.0.0%E2%80%93beta.18.1-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&f565a6f71eb6e66a96e6192bc9d35925)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&d6071503773f4af852fb53b8e700b12d)](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
2 changes: 1 addition & 1 deletion dist/std.min.scm

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

8 changes: 5 additions & 3 deletions dist/std.scm

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

Binary file modified dist/std.xcb
Binary file not shown.
8 changes: 5 additions & 3 deletions lib/R7RS.scm
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,15 @@

;; -----------------------------------------------------------------------------
(define-syntax let*-values
(syntax-rules ()
(syntax-rules (multi single)
((_ ()) nil)
((_ () body ...) (begin body ...))
((_ ((bind values) rest ...) . body)
((_ ((bind obj) rest ...) . body)
(apply (lambda bind
(let*-values (rest ...) . body))
(vector->list ((. values "valueOf"))))))
(if (instanceof lips.Values obj)
(vector->list (obj.valueOf))
(list obj)))))
"(let*-values binding body ...)
The macro work similar to let* but variable is list of values and value
Expand Down
4 changes: 2 additions & 2 deletions templates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ publish:
jest-test: dist/lips.js
@$(JEST) --coverage spec/*.spec.js

test: dist/lips.js dist/std.min.scm
test: dist/lips.js dist/std.xcb
@$(NPM) run test

test-file: dist/lips.js dist/std.min.scm
test-file: dist/lips.js dist/std.xcb
@$(NPM) run test -- -- -f $(FILE)

test-update: dist/lips.js dist/std.scm
Expand Down
11 changes: 11 additions & 0 deletions tests/std.scm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@
(cons x (cons y (cons z a))))
'(1 2 3 4 5))))

(test "std: let*-values mixed values"
(lambda (t)
(define (div-mul x y)
(values (/ x y) (* x y)))

(t.is (let*-values (((x) 2)
((y) 10)
((div mul) (div-mul x y)))
(+ div mul))
101/5)))

(test "std: should render SXML string"
(lambda (t)
(define preact (require "preact"))
Expand Down

0 comments on commit bfcab37

Please sign in to comment.