BAM: [new] _MAPSET and _MAPGET
#7
Total aside.

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
'
Reply


Messages In This Thread
BAM: [new] _MAPSET and _MAPGET - by CharlieJV - 03-11-2023, 06:46 PM
RE: BAM: [new] _MAPSET and _MAPGET - by CharlieJV - 03-11-2023, 11:18 PM
RE: BAM: [new] _MAPSET and _MAPGET - by Petr - 03-12-2023, 10:41 AM
RE: BAM: [new] _MAPSET and _MAPGET - by CharlieJV - 03-12-2023, 04:16 PM
RE: BAM: [new] _MAPSET and _MAPGET - by CharlieJV - 03-12-2023, 04:28 PM
RE: BAM: [new] _MAPSET and _MAPGET - by Petr - 03-12-2023, 05:29 PM
RE: BAM: [new] _MAPSET and _MAPGET - by CharlieJV - 03-12-2023, 06:28 PM
RE: BAM: [new] _MAPSET and _MAPGET - by Petr - 03-12-2023, 06:55 PM
RE: BAM: [new] _MAPSET and _MAPGET - by CharlieJV - 03-12-2023, 08:19 PM



Users browsing this thread: 3 Guest(s)