#How to get a location of where a function is called while inside the function.

11 messages · Page 1 of 1 (latest)

hazy remnant
#
#import "expression.typ" : node,expression

#let oldnode = node
#let oldexpr = expression
#let state = state("expr",("type":"exprstate"))
#let node(x,data) = {
  state.update(
    i => {
      i.insert(x,oldnode(x,data))
      i
    }
  )
  [node #x]
  [#oldnode(x,data)]
}

#let expression(x,..y) = {
  [<l>]
  oldexpr(x,..y, nodes : state.at(?????????) )
}

#node("a",40)

#node("b",50)

#expression(
  ":a^2 * :a^2",      
    digit : 0,
)


#

final() would be alright as well but I don't understand how to call it as well...

next harness
#

I'm not completely sure what you mean, but can't you use locate for that?

hazy remnant
#

I tried but I dont know what arg to give to locate then

#

or when to call location

next harness
#

In this case you might want something like
locate(loc => state.at(loc))

hazy remnant
#

Oh thank you !

#

?render

#let state = state("expr",("type":"exprstate"))
#let x = locate(loc => state.at(loc))
#type(x)

hazy remnant
#

I wish to retrieve the dictionary but I can only get content

#

Oh I know what im gonna try