Sysrpl: Using lists in a conditional expression? - Hewlett Packard

This is a discussion on Sysrpl: Using lists in a conditional expression? - Hewlett Packard ; There may be better ways, but I was thinking of using a list which is produced from a collection of "check box" selections within an inform box, to trigger program variables that perform related actions. For example, lets say I ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: Sysrpl: Using lists in a conditional expression?

  1. Sysrpl: Using lists in a conditional expression?

    There may be better ways, but I was thinking of using a list which is
    produced from a collection of "check box" selections within an inform
    box, to trigger program variables that perform related actions.

    For example, lets say I have five check box fields and after
    completing the inform process, a list is produced like so:

    {TRUE FALSE FALSE TRUE FALSE}

    Associated with the outcome of the check boxes is another list which
    contains a collection of program objects that I would like to execute
    if the related check box was TRUE. Like this:

    {ABLE BAKER CHARLIE DOG EASY}

    I've been able to stumble my way through sysrpl programming in a very
    linear fashion, but this is a little above my skill level at this
    point. If possible, could someone explain how this could be
    implemented? In a sort of pseudo code something on the order of this
    is what I have in mind:

    ::
    LIST1 = {Logical outcome} ( LIST1 has the check box truth )
    LIST2 = {program objects} ( LIST2 has the prog vars )
    IT LIST1 LIST2 ( If #n in LIST1 is TRUE, EVAL #n in LIST2 )
    ;

    In which case I would like to use something like DOLIST that would
    ripple through each element of LIST1 and if TRUE then EVAL the
    corresponding indexed element in LIST2. If FALSE, it would just
    index to the next element.


  2. Re: Sysrpl: Using lists in a conditional expression?

    On Wed, 28 Mar 2007 19:54:18 -0500, dot wrote:

    > let's say I have five check box fields and after
    > completing the inform process, a list is produced like so:
    >
    > {TRUE FALSE FALSE TRUE FALSE}
    >
    > Associated with the outcome of the check boxes is another list which
    > contains a collection of program objects that I would like to execute
    > if the related check box was TRUE. Like this:
    >
    > {ABLE BAKER CHARLIE DOG EASY}


    > I would like to use something like DOLIST that would
    > ripple through each element of LIST1 and if TRUE then EVAL the
    > corresponding indexed element in LIST2. If FALSE, it would just
    > index to the next element.


    That's exactly what the UserRPL DOLIST command does --
    it presents corresponding elements from N lists at a time,
    which you can handle as you like.

    Even in the midst of a SysRPL program, one can sneak in
    a user command (often via EvalNoCK to skip extra stuff
    that isn't desired inside of SysRPL programs);
    in fact, there's quite a bit of exactly that sort of thing
    scattered throughout HP-written ROM

    As an example of this power of DOLIST,
    the following *transposes* a "list of lists,"
    in a rather elegant fashion,
    and was used in HP48G, before AXL ever existed:

    \<< LIST\-> DUP \-> n \<< \<< n \->LIST \>> DOLIST \>> \>>

    Input:

    { { 11 12 }
    { 21 22 }
    { 31 32 } }

    Output:

    { { 11 21 31 }
    { 12 22 32 } }

    [r->] [OFF]

  3. Re: Sysrpl: Using lists in a conditional expression?

    On Mar 29, 9:21 am, "Steen Schmidt" wrote:
    > dot wrote:
    > > I've been able to stumble my way through sysrpl programming in a very
    > > linear fashion, but this is a little above my skill level at this
    > > point. If possible, could someone explain how this could be
    > > implemented? In a sort of pseudo code something on the order of this
    > > is what I have in mind:

    >
    > > ::
    > > LIST1 = {Logical outcome} ( LIST1 has the check box truth )
    > > LIST2 = {program objects} ( LIST2 has the prog vars )
    > > IT LIST1 LIST2 ( If #n in LIST1 is TRUE, EVAL #n in LIST2 )
    > > ;

    >
    > > In which case I would like to use something like DOLIST that would
    > > ripple through each element of LIST1 and if TRUE then EVAL the
    > > corresponding indexed element in LIST2. If FALSE, it would just
    > > index to the next element.

    >
    > Since we don't know how your secondaries affect the stack, you'll have
    > to save your arguments first, and then index through them in a loop
    > like this:
    >
    > ::
    > OVER FPTR2 ^2LAMBIND LENCOMP
    > #1+_ONE_DO
    > 1GETLAM INDEX@ NTHCOMPDROP IT :: 2GETLAM INDEX@ NTHCOMPDROP EVAL ;
    > LOOP
    > ;
    >
    > Regards

    Debug4x does not understand FPTR2 ^2LAMBIND. There is no such verb in
    it's repertoire.
    It is described in some of the reference material, so it may have just
    been overlooked, and / or not included for some reason.



  4. Re: Sysrpl: Using lists in a conditional expression?

    > Debug4x does not understand FPTR2 ^2LAMBIND. There is no such verb in
    > it's repertoire.
    > It is described in some of the reference material, so it may have just
    > been overlooked, and / or not included for some reason.


    That is MASD (on calc compiler) syntax.

    In debug4x you write: FLASHPTR 2LAMBIND. Look in the autocomplete and
    you will see FLASH next to the entry. This means you need to write
    FLASHPTR before.

    TW



  5. Re: Sysrpl: Using lists in a conditional expression?

    On Mar 29, 2:05 pm, "TW" wrote:
    > > Debug4x does not understand FPTR2 ^2LAMBIND. There is no such verb in
    > > it's repertoire.
    > > It is described in some of the reference material, so it may have just
    > > been overlooked, and / or not included for some reason.

    >
    > That is MASD (on calc compiler) syntax.
    >
    > In debug4x you write: FLASHPTR 2LAMBIND. Look in the autocomplete and
    > you will see FLASH next to the entry. This means you need to write
    > FLASHPTR before.
    >
    > TW


    Thanks for your help. I did use autocomplete for FPTR2^LAMBIND and of
    course there was nothing; but your information clears this up for me.

    drd


  6. Re: Sysrpl: Using lists in a conditional expression?

    hello,

    you might want to look at ForAllComposit which takes a composit as a input
    and a program in the runstream and execute that program for all object in
    the composit.
    an example of usage: add all the numbers in a list:
    %0 OVER ForAllComposit :: %+ ;

    and it is fast and easy to use...

    cyrille

    "Steen Schmidt" wrote in message
    news:xn0f4agmy2wjq4000@news.tele.dk...
    > dot wrote:
    >
    >> I've been able to stumble my way through sysrpl programming in a very
    >> linear fashion, but this is a little above my skill level at this
    >> point. If possible, could someone explain how this could be
    >> implemented? In a sort of pseudo code something on the order of this
    >> is what I have in mind:
    >>
    >> ::
    >> LIST1 = {Logical outcome} ( LIST1 has the check box truth )
    >> LIST2 = {program objects} ( LIST2 has the prog vars )
    >> IT LIST1 LIST2 ( If #n in LIST1 is TRUE, EVAL #n in LIST2 )
    >> ;
    >>
    >> In which case I would like to use something like DOLIST that would
    >> ripple through each element of LIST1 and if TRUE then EVAL the
    >> corresponding indexed element in LIST2. If FALSE, it would just
    >> index to the next element.

    >
    > Since we don't know how your secondaries affect the stack, you'll have
    > to save your arguments first, and then index through them in a loop
    > like this:
    >
    > ::
    > OVER FPTR2 ^2LAMBIND LENCOMP
    > #1+_ONE_DO
    > 1GETLAM INDEX@ NTHCOMPDROP IT :: 2GETLAM INDEX@ NTHCOMPDROP EVAL ;
    > LOOP
    > ;
    >
    > Regards
    > Steen




  7. Re: Sysrpl: Using lists in a conditional expression?

    On Mon, 2 Apr 2007 06:44:01 -0600, "cyrille de brebisson"
    wrote:

    Thanks for a useful tip ... that looks like something I can use in
    several similar routines.

    -Dot-

    >hello,
    >
    >you might want to look at ForAllComposit which takes a composit as a input
    >and a program in the runstream and execute that program for all object in
    >the composit.
    >an example of usage: add all the numbers in a list:
    > %0 OVER ForAllComposit :: %+ ;
    >
    >and it is fast and easy to use...
    >
    >cyrille
    >
    >"Steen Schmidt" wrote in message
    >news:xn0f4agmy2wjq4000@news.tele.dk...
    >> dot wrote:
    >>
    >>> I've been able to stumble my way through sysrpl programming in a very
    >>> linear fashion, but this is a little above my skill level at this
    >>> point. If possible, could someone explain how this could be
    >>> implemented? In a sort of pseudo code something on the order of this
    >>> is what I have in mind:
    >>>
    >>> ::
    >>> LIST1 = {Logical outcome} ( LIST1 has the check box truth )
    >>> LIST2 = {program objects} ( LIST2 has the prog vars )
    >>> IT LIST1 LIST2 ( If #n in LIST1 is TRUE, EVAL #n in LIST2 )
    >>> ;
    >>>
    >>> In which case I would like to use something like DOLIST that would
    >>> ripple through each element of LIST1 and if TRUE then EVAL the
    >>> corresponding indexed element in LIST2. If FALSE, it would just
    >>> index to the next element.

    >>
    >> Since we don't know how your secondaries affect the stack, you'll have
    >> to save your arguments first, and then index through them in a loop
    >> like this:
    >>
    >> ::
    >> OVER FPTR2 ^2LAMBIND LENCOMP
    >> #1+_ONE_DO
    >> 1GETLAM INDEX@ NTHCOMPDROP IT :: 2GETLAM INDEX@ NTHCOMPDROP EVAL ;
    >> LOOP
    >> ;
    >>
    >> Regards
    >> Steen

    >



  8. Re: Sysrpl: Using lists in a conditional expression?

    On Mon, 02 Apr 2007 07:44:01 -0500, cyrille wrote:

    > ForAllComposit


    Is this in ROM? (not in standard Extable)

    Is it similar to xSTREAM?

    Thanks.

    [r->] [OFF]

  9. Re: Sysrpl: Using lists in a conditional expression?

    hello,

    yes it is in ROM.... but now that you ask, I do not remember if it is
    supported or not
    Darn, sorry, it is not supported on the 49/50 (it is on the 39/40)..... I am
    sorry.

    cyrille

    "John H Meyers" wrote in message
    newsp.tp6kz62lnn735j@w2kjhm.ia.mum.edu...
    > On Mon, 02 Apr 2007 07:44:01 -0500, cyrille wrote:
    >
    >> ForAllComposit

    >
    > Is this in ROM? (not in standard Extable)
    >
    > Is it similar to xSTREAM?
    >
    > Thanks.
    >
    > [r->] [OFF]




+ Reply to Thread