Hi,

The technical/dry question:
Is it possible to shortcut the value resolution of transient
symbols with a custom function? Something like:
(de shortcut_transient (name)
  (pack name "!"))
This would add a "!" to the default value of a transient sym.
If I had to answer, I'd say «no», but PicoLisp is full of surprises!
I will need this functionnality in EmuLisp anyway so I'll
implement this. Any suggestion for a syntax/interface will be
appreciated.

BTW I had a related question (maybe for many months!):
Is there a PicoLisp function/mechanism like «unknown» in Tcl:
http://wiki.tcl.tk/795
(I'm a big fan of Tcl!!!)

Some context for the reason I need this kind of transient
manipulation (for the curious and because maybe I'm trying
to solve the wrong problem):
I'm embedding a language in Picolisp. I managed to build
Blockly blocks for this language:
http://microalg.info/ide.html (click on «Commandes»,
arrange blocks and see the generated code below).
This means I built the blocks and a generator that builds Lisp
programs from blocks configurations.
(for those who don't know Blockly:
https://blockly-demo.appspot.com/static/apps/index.html
https://code.google.com/p/blockly
)
I'm currently trying to do the converse operation:
build blocks configurations from Lisp programs.
(some docs and a live example
https://code.google.com/p/blockly
/wiki/Installation#Importing_and_Exporting_Blocks
See the XML tab here, after having built a program:
https://blockly-demo.appspot.com/static/apps/code/index.html
)
For this I need to produce XML from Lisp code. This is quite
easy considering that the data is not data but some source code.
The trick is to reprogram my language so that each command
will output some XML recursively (thanks to Lisp!!!).
I was quite happy to have this idea last night before sleeping, but
faced the transient problem in front of the screen this morning:
what about transient syms?

One example program: (Display "Hello world!")

This should translate to:
<block type="display">
  <value name="VALUE">
    <block type="text">
      <field name="TEXT">Hello world!</field>
    </block>
  </value>
</block>

I reprogram the Display command like this:
(de Display (content)
  (pack "<block type=\"display\"><value name=\"VALUE\">"
        content
        "</value></block>"))

But I need "Hello world!" to have the value:
<block type="text">
  <field name="TEXT">Hello world!</field>
</block>

And more generally (and this is the problem I post about), I need
"any transient sym" to dynamically have the value  (based on its name):
<block type="text">
  <field name="TEXT">any transient sym</field>
</block>

I note that this transient thing is VERY powerful. Alex, could you
provide us with some historical hindsight about transient syms? Do
they exist in other languages? Are they your brainchildren?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to