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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:42:21+00:00 2026-06-17T17:42:21+00:00

In Scala macro, I want to do something like this: I have a Tree

  • 0

In Scala macro, I want to do something like this:

I have a Tree (possibly large). Now I want to find a subtree of this tree that has some concrete form, e.g. Apply(_, _). And now I want to create a new tree that is a copy of the original tree, but the found subtree is replaced by some other tree.

With something like this, I could for example replace invocation of some method with invocation of some other method.

Is something like this possible?

  • 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-17T17:42:23+00:00Added an answer on June 17, 2026 at 5:42 pm

    I’m very interested in seeing alternative approaches to tree transformation, however, they have yet to arrive (and we actually have an ongoing investigation in this direction).

    To get things done in the meanwhile, you can extend Transformer, override its transform method and then pattern match against the concrete form of trees you’re interested in. Call super.transform to recursively replace in subtrees.

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

Sidebar

Related Questions

Scala programmer should have known that this sort of writing : class Person{ var
I would like to program a Scala macro that takes an instance of a
I have some Scala code that does something nifty with two different versions of
Scala doesn't have type-safe enum s like Java has. Given a set of related
I'm looking for a way to have classes that behave just like case classes,
I'm trying to build some SQL-like abstraction and I have hit a problem. This
I'm a newbie in boost.python and i'm getting this error that I would like
scala.math.BigDecimal.toString can return something like 0.888200000. What can be the best I can do
I have a generic script that creates a Gnuplot macro. Is there a way
So I have this web app that in theory may one day become a

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.