Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let* please, possibly even letrec, letrec* #1352

Closed
reuleaux opened this issue Jan 9, 2024 · 4 comments
Closed

let* please, possibly even letrec, letrec* #1352

reuleaux opened this issue Jan 9, 2024 · 4 comments

Comments

@reuleaux
Copy link

reuleaux commented Jan 9, 2024

This is on my wishlist: let*

I am currently using nested let instead, which seems a little awkward:

(let [
         foo ‘bar
     ]
 (let [
           baz (do-something-with foo)
      ]
    body))

with let* this would be as simple as

(let [
            foo ‘bar
            bar (do-something-with foo)
     ]
   body)

Even one step further: recursive defs - with letrec/letrec* - have a look at the (Gauche- Guile-) Scheme src/docs for example.
Thanks!

@sogaiu
Copy link
Contributor

sogaiu commented Jan 9, 2024

Doesn't let already do what you want?

$ janet
Janet 1.33.0-f91e5994 linux/x64/gcc - '(doc)' for help
repl:1:> (let [x 1 y x] (+ x y))
2

@sogaiu
Copy link
Contributor

sogaiu commented Jan 9, 2024

Regarding letrec and friends, it's not the same, but see this discussion.

@iacore
Copy link
Contributor

iacore commented Jan 9, 2024

(def [x y] [1 2])

@reuleaux
Copy link
Author

reuleaux commented Jan 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants