Non-existing package MatchedPairs.jl hallucinated by a LLM

  1. To install the MatchedPairs package in Julia, you can use the following commands in the Julia REPL:
using Pkg
Pkg.add("MatchedPairs")
  1. Once the package is installed, you can use the following code to use the MatchedPairs and @matchedpair macros:
using MatchedPairs

# Define transformation rules
@matchedpair begin
    (+, -) => (-, +)
    (*, /) => (/, *)
end

# Define transformation function
function transform(expr)
    if !isdefined(transform, :rules)
        # Compile rules
        global rules = compile_matchedpairs(mps)
    end
    # Transform expression
    return transform(rules, expr)
end

# Test transformation function
println(transform((2 + 3) * 4)) # Output: (2 - 3) / 4

  1. If you encounter an error message “The following package names could not be resolved: * MatchedPairs (not found in project, manifest or registry)”, it is possible that the MatchedPairs package is no longer maintained or has been removed from the official Julia package registry. You can try using other similar packages for pattern matching and transformation, such as MacroTools.jl, CSTParser.jl, or MacroParse.jl.
  2. Here is an example code for pattern matching and transformation using the MacroTools.jl package:
using MacroTools

# Define transformation rules
function mytransform(ex::Expr)
    quote
        $(esc(ex.args[2]))($(esc(ex.args[3])), $(esc(ex.args[1])))
    end
end

# Test transformation function
@assert @capture(2 + 3) == :(2 + 3)
@assert @capture(mytransform(:(2 + 3))) == :(3(2))

  1. The Github link for the MatchedPairs package is: https://github.com/davidanthoff/MatchedPairs.jl. You can access the Github page of the MatchedPairs package through this link, which includes all the source code and other related information of this package. On the right-hand sidebar of the page, you can find the “Clone or download” button, from which you can download all the source code of the MatchedPairs package.

Please note that the MatchedPairs package is a third-party package, and its source code is maintained by its developers, not the official Julia source code. Therefore, if you want to contribute to the MatchedPairs package, you need to follow the contribution guidelines and code conventions specified by its developers.

by a somewhat AI tutor

And It seems the MatchedPairs.jl never exist, right?
I was going to explore the algorithm tree feature of @grammar
TIA

1 Like

Looks like ChatGPT took ayahuasca.

Why do you want such a package, anyway?

4 Likes

Creat algo trees, modify them, batching and iterating.