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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:55:11+00:00 2026-05-20T07:55:11+00:00

As an exercise I am trying to define a rule match-rewriter that behaves the

  • 0

As an exercise I am trying to define a rule match-rewriter that behaves the same as match-lambda but returns its argument if no match is found. So far I have this:

(define-syntax match-rewriter
  (syntax-rules ()
    ((_ (patt body) ...)
      (λ (x) (match x (patt body) ...)))))

which seems to work perfectly if a match is found.

But, I can’t figure out how to return the argument x if no match is found.

I know that match will throw an exception if no match is found. But I can’t figure out how to catch it and I would like a simpler solution if one exists.

  • 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-05-20T07:55:12+00:00Added an answer on May 20, 2026 at 7:55 am

    If this question is about the Racket‘s match, then just add a clause that matches anything:

    (match x [patt body] ... [_ x])
    
    • 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 2 class with the same methods name. Its an exercise,
As an exercise I am trying to define let as a lambda function something
I'm trying to complete an exercise to write a program that takes the following
I'm trying (as a self-learning exercise) to create a Clojure macro that will generate
I'm trying to make an iPad-like popover div as an exercise, but I can't
I'm learning C++. I'm trying to do an exercise where I define several implementations
I trying to complete this exercise; Write a Lisp function that takes as input
I'm trying to solve a K&R exercise(5.10) that uses the argc and argv arguments.It's
I'm trying to learn scheme via SICP. Exercise 1.3 reads as follow: Define a
I'm trying to solve an exercise which requires that : the starting process must

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.