Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9315675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:25:45+00:00 2026-06-19T02:25:45+00:00

In Haskell, inside a list comprehension, i can bind expressions to a variable every

  • 0

In Haskell, inside a list comprehension, i can bind expressions to a variable every iteration:

[a | x <- xs, let a = x ^ 2, a >= 25]

How do i bind lexical variables in Racket’s for comprehension?

Currently i have this code:

(define (euler4)
  (apply max
         (for*/list ([i (in-range 100 1000)]
                     [j (in-range i 1000)]
                     #:when (string=? (number->string (* i j))
                                      (string-reverse (number->string (* i j)))))
           (* i j))))

I want to bound (* i j) to a variable and replace the expression to it everywhere in function.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T02:25:46+00:00Added an answer on June 19, 2026 at 2:25 am

    Use the in-value form to have a loop variable that is bound to a single value.

    In your example:

    (define (euler4)
      (apply max
             (for*/list ([i (in-range 100 1000)]
                         [j (in-range i 1000)]
                         [ij (in-value (* i j))]
                         #:when (string=? (number->string ij)
                                          (string-reverse (number->string ij))))
               (* i j))))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can use let inside other expression. foo n = (let a = True
Does haskell-mode or some alternative package offer something akin to the wonderful inferior-haskell-type inside
Haskell provides the feature something like f = f1 . f2 How can I
In Haskell, how can I generate Fibonacci numbers based on the property that the
In Haskell in 5 steps the factorial function is defined as follows: let fac
In Haskell, there is a function take n list which returns the first n
Just started learning Haskell. I have an empty source file with this inside: pe
Haskell's Network.Browser module seems to not do any compression. How can I configure it
I am studying Haskell. I have the next question: The List type is a
my Haskell* is a bit rusty, so i can imagine that I’m missing the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.