package prolog.ast.terms

import io.Logger
import prolog.Substitutions

class AnonymousVariable(private val id: Int) : Variable("_$id") {
    companion object {
        private var counter = 0
        fun create(): AnonymousVariable {
            val id = counter
            counter++
            Logger.debug("Creating anonymous variable: _${id}")
            return AnonymousVariable(id)
        }
    }

    override fun applySubstitution(subs: Substitutions): AnonymousVariable = this

    override fun toString(): String = "_"
}