From 68ebc4e25fe44df05e4e4d9506f2889f1ab192e2 Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Tue, 5 Mar 2024 16:46:35 +0100 Subject: [PATCH] add info about promise? predicate --- docs/docs/lips/intro.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/docs/lips/intro.md b/docs/docs/lips/intro.md index d83a3328a..28b27de52 100644 --- a/docs/docs/lips/intro.md +++ b/docs/docs/lips/intro.md @@ -395,6 +395,17 @@ Don't confuse JavaScript promises with `delay` expressions. Their representation ;; ==> # ``` +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), @@ -403,7 +414,6 @@ LIPS Roadmap. Here is example of creating iterator in LIPS: - ```scheme (let ((obj (object)) (max 10))