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 8470835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:37:48+00:00 2026-06-10T16:37:48+00:00

I am trying to create a procedure that has a user input a non-empty

  • 0

I am trying to create a procedure that has a user input a non-empty string and then returns a random letter from the input in a substring of length one.

i.e.

(pick-at-random "word")

~"w"

(pick-at-random "word")

~"r"

So far I’ve got:

    (define pick-at-random
      (lambda (s)
        (substring s (random(string-length s)) ())))

This gives me the position of the letter I want to display and I feel like where the () is, I should have some variable representing the start value of the substring and then add one to it. However, I don’t know how to do this. Simply put, I am asking how I can limit the substring to length one while using the random function in the start value.

  • 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-10T16:37:50+00:00Added an answer on June 10, 2026 at 4:37 pm

    You may use let to bind the random number to a variable.

    (define pick-at-random
      (lambda (s)
        (let ((index (random (string-length s))))
          (substring s index (+ index 1)))))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a procedure that will enter data and then return a
I am trying to create a stored procedure that has optional parameters. I followed
I'm trying to create a simple class THistory that has one procedure that takes
I'm trying to optimize a procedure that has code like the following: CREATE TABLE
As part of my login procedure I'm trying to check that the user has
I'm trying to create a stored procedure that will be used by a client
i am trying to create sql procedure or function that need to find duplicate
I'm trying to create table from view from remote server (calling procedure UPDATE_PROC), like
Ok, so I am trying to create a procedure that call an extended procedure.
I'm trying to run a stored procedure from my website that disables a trigger.

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.