Skip to content

Commit

Permalink
add info about promise? predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Mar 25, 2024
1 parent 6e7d198 commit 68ebc4e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/docs/lips/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,17 @@ Don't confuse JavaScript promises with `delay` expressions. Their representation
;; ==> #<js-promise resolved (number)>
```

You can check if a value is a promise by quoting the expression and using `promise?` predicate:

```scheme
(let ((a '>10)
(b '>(Promise.resolve 10)))
(print (promise? a))
(print (promise? b)))
;; ==> #f
;; ==> #t
```

### JavaScript Generars and interators
Right now there is no way to define JavaScript generators inside LIPS. You can create iterator using
[iteration prorocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols),
Expand All @@ -403,7 +414,6 @@ LIPS Roadmap.

Here is example of creating iterator in LIPS:


```scheme
(let ((obj (object))
(max 10))
Expand Down

0 comments on commit 68ebc4e

Please sign in to comment.