03-12-2023, 06:28 PM
Total aside.
One of the things I'm working on: debugging/fine-tuning meta-programming (macro-handling). For example:
The above results in:
One of the things I'm working on: debugging/fine-tuning meta-programming (macro-handling). For example:
Code: (Select All)
<$vars ingredients="APPLE CARROT BEEF BARLEY CHICKEN PAPRIKA">
INIT:
_initaudio
<$list variable="ingredient" filter="[enlist<ingredients>sort[]]" counter="i">
_mapset("<<ingredient>>",<<i>>) </$list>
'
MAIN_PROGRAM:
'
getselection:
input "Search for recipes: enter one ingredient:", selection$
selection$ = ucase$(selection$)
if _mapget(selection$) = "" then beep : print "sorry, no recipes for " + selection$ : goto getselection
'
on _mapget(selection$) gosub {{{ [enlist<ingredients>sort[]join[, ]] }}}
'
goto getselection
'
end
'
SUBROUTINES:
'
<$list variable="ingredient" filter="[enlist<ingredients>sort[]]" counter="i">
<<ingredient>>:
print "setup special processing for <<ingredient>>-related recipes and info"
RETURN
'
</$list>
</$vars>
The above results in:
Code: (Select All)
INIT:
_initaudio
_mapset("APPLE",1)
_mapset("BARLEY",2)
_mapset("BEEF",3)
_mapset("CARROT",4)
_mapset("CHICKEN",5)
_mapset("PAPRIKA",6)
'
MAIN_PROGRAM:
'
getselection:
input "Search for recipes: enter one ingredient:", selection$
selection$ = ucase$(selection$)
if _mapget(selection$) = "" then beep : print "sorry, no recipes for " + selection$ : goto getselection
'
on _mapget(selection$) gosub APPLE, BARLEY, BEEF, CARROT, CHICKEN, PAPRIKA
'
goto getselection
'
end
'
SUBROUTINES:
'
APPLE:
print "setup special processing for APPLE-related recipes and info"
RETURN
'
BARLEY:
print "setup special processing for BARLEY-related recipes and info"
RETURN
'
BEEF:
print "setup special processing for BEEF-related recipes and info"
RETURN
'
CARROT:
print "setup special processing for CARROT-related recipes and info"
RETURN
'
CHICKEN:
print "setup special processing for CHICKEN-related recipes and info"
RETURN
'
PAPRIKA:
print "setup special processing for PAPRIKA-related recipes and info"
RETURN
'