Post Reply 
(50g) String inside string manipulation, UserRPL
10-18-2016, 07:32 PM (This post was last modified: 10-18-2016 09:33 PM by Vtile.)
Post: #16
RE: (50g) String inside string manipulation, UserRPL
Now tested more, I can not make any errors or odd behaviour that would be really odd. I'm using the escaped character and not the "34 CHR" -method this time so it propably makes difference. That said look at the first two snippets, they produce cryptic outcome without system giving any type of warning.

The results have "right" amount of quotation marks and other symbols as they exist on editor, in case of string objects the outermost quotation marks are also written snippets below.

So yep, I think I now can compose/parse new programs programmatically from existing program parts, if I want to. Wishful thinking? Edit. Yes and no... Program that contains escape character, will not convert to string and back to program nicely, I need to cook up some analytics. ... Yep, got it right my bad Need fresh eyes. ugh. Not work when you convert program to string (by replacing the program symbols with quotation marks) and adding one extra pair around both and the adding two programs together, quotation mismatch and kaboom. Tongue

Code:

"ABC"
« " \\\" " + » 
------------------[EVAL]
"ABC \" "
« "»" + "«" SWAP + STR→ »    @@ Convert str to prg
==================[EVAL]
"ABC \ " »" »            @@ Cryptic


Code:

"ABC"
« " \\\" " + » 
------------------[EVAL]
"ABC \" "
"ABC"
+
------------------[EVAL]
"ABC \" ABC"
« "»" + "«" SWAP + STR→ »     @@ Convert str to prg
==================[EVAL]
« "ABC \ " ABC»" »        @@ Cryptic


Code:

"ABC"
« " \\\" " + » 
------------------[EVAL]
"ABC \" "
"ABC"
+
------------------[EVAL]
"ABC \" ABC"
« → X « "\"" X "\"" + + »»    @@ Increase str depth
------------------[EVAL]
""ABC \" ABC""
« "»" + "«" SWAP + STR→ »    @@ Convert str to prg
==================[EVAL]
« "ABC \" ABC" »        @@ OK


Code:

"ABC "\"" +"
« "»" + "«" SWAP + STR→ »    @@ Convert str to prg
------------------[EVAL]
« ABC "\"" + »
==================[EVAL]
"ABC""                @@ OK


Code:

{ "ABC" "\"" }
→STR                @@ Converts lst to str. Note: Needs typecheck in program since "\"" + method doesn't work.
------------------[EVAL]
"{ "ABC" "\"" }"
« "»" + "«" SWAP + STR→ »    @@ Converts str to prg
==================[EVAL]
« { "ABC" "\"" } »        @@ OK


Code:

{{{ "ABC" "\"" }}}
→STR                @@ Converts lst to str. 
------------------[EVAL]
"{ { { "ABC" "\"" } } }"
« "»" + "«" SWAP + STR→ »    @@ Converts str to prg
==================[EVAL]
«{ { { "ABC" "\"" } } }»    @@ OK


Code:

""A""B""C""
« "»" + "«" SWAP + STR→ »    @@ Converts str to prg
==================[EVAL]
« "A" "B" "C" »            @@ OK


Code:

""A"B"C""
STR→                 @@ Converts str to objects
==================[EVAL]
"A"
'B'
"C"                @@ OK


Code:

"[ A 1 ]"
« "»" + "«" SWAP + STR→ »    @@ Converts str to prg
==================[EVAL]
"«[ A 1 ]»"            @@ STR→ Invalid syntax, OK!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (50g) String inside string manipulation, UserRPL - Vtile - 10-18-2016 07:32 PM



User(s) browsing this thread: 1 Guest(s)