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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:42:02+00:00 2026-06-11T16:42:02+00:00

I am attempting to evaluate a literal as an expression in Scheme (using Guile

  • 0

I am attempting to evaluate a literal as an expression in Scheme (using Guile currently). Example:

(define x '(+ 6 6))
(define y (evaluate-literal x))     ; Expected result:  y = 12

(Here, evaluate-literal is a placeholder for what I’m looking for.) Is there a lisp function/idiom that allows this to be done? The reason why I need to do this is because the expression may be invalid at the time of definition, but would be a valid expression later when it is evaluated.


Currently my workaround solution is to use delay and force but it’s not very elegant:

(define x (delay (+ 6 6)))
(define y (force x))
  • 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-11T16:42:04+00:00Added an answer on June 11, 2026 at 4:42 pm

    The simplest way would be to use eval, although difficult to use safely. See this post to see the reasons why.

    (define x '(+ 6 6))
    (define y (eval x))
    

    Using the built-in delay/force procedures is a fine solution:

    (define x (delay (+ 6 6)))
    (define y (force x))
    

    Or, as has been suggested in the comments, you could use a lambda for implementing your own delay/force syntax:

    (define-syntax my-delay
      (syntax-rules ()
        ((my-delay object)
         (lambda () object))))
    
    (define (my-force delayed-object)
      (delayed-object))
    
    (define x (my-delay (+ 6 6)))
    (define y (my-force x))
    

    The above is a toy implementation, a real-world implementation would memoize the result for avoiding the need to call the lambda each time, but you get the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to select from a List using a linq expression where the
Within SQL Server 2005 Reporting Services I am attempting to evaluate an expression which
I'm attempting to make a function in PHP that will evaluate a mathematical expression
I am attempting to parse, not evaluate, rails ERB files in a Hpricot/Nokogiri type
I am trying to evaluate two dynamically assigned variables; then attempting to assign a
Attempting to use the data series from this example no longer passes the JSONLint
I'm attempting to use the OpenAmplify API to evaluate the content of a URI.
I'm attempting to dump a bunch of get functions into a spreadsheet using cfspreadsheet
I'm trying to pass context into a dynamic expression that I evaluate every iteration
I'm attempting to use mod_rewrite to redirect requests to 123.example.com/456/file.html to example.com/123/456/file.html . 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.