Author Topic: dupbool  (Read 7805 times)

Offline Gobo

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
dupbool
« on: December 03, 2007, 11:30:37 AM »
It would be extraordinary useful to have dupbool operator. For now, Sanger's nested if's do not work right, since only the deepest's if condition is checked. The right thing would be dupbool the top value and and it with a new condition.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
dupbool
« Reply #1 on: December 03, 2007, 02:19:07 PM »
dupbool would do what exactly?  Push another value onto the stack that is the same as the top value?
Many beers....

Offline Gobo

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
dupbool
« Reply #2 on: December 03, 2007, 02:24:36 PM »
Quote from: EricL
dupbool would do what exactly?  Push another value onto the stack that is the same as the top value?
Yes. And I havn't found a workaround to do it.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
dupbool
« Reply #3 on: December 03, 2007, 02:28:42 PM »
Me neither.  I'll add it in 2.43v.
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
dupbool
« Reply #4 on: December 03, 2007, 03:24:41 PM »
While you're adding operators, a swap had been requested once upon a time.  And then go ahead and add a boolswap, too.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
dupbool
« Reply #5 on: December 03, 2007, 06:00:39 PM »
Quote from: Numsgil
While you're adding operators, a swap had been requested once upon a time.  And then go ahead and add a boolswap, too.
Swap swaps the top two entires in the stack, yes?
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
dupbool
« Reply #6 on: December 03, 2007, 07:35:11 PM »
right.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
dupbool
« Reply #7 on: December 04, 2007, 12:43:53 PM »
dupbool
swapbool
dupint
swapint

added for 2.43v.  Names chosen by convention with other stack operators.
Many beers....

Offline Gobo

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
dupbool
« Reply #8 on: December 05, 2007, 02:32:12 PM »
Thanks. BTW,
Quote from: EricL
dupint
was known as dup. Is it considered alias now?

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
dupbool
« Reply #9 on: December 05, 2007, 02:52:36 PM »
whoops.  Didn't realize it existed.  Yes, their aliases.  You can use either in bot DNA.  They have different underlying BP numbers in 2.43u, but I'll make them the same in 2.43v (so as not to skew mutation probabilities).
Many beers....

Offline Gobo

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
dupbool
« Reply #10 on: December 05, 2007, 03:32:44 PM »
It would be cool to have also over operators, which copy the second value on the top of the stack ( a b -- a b a ). For example:
Code: [Select]
if ( A ) {
    if ( B ) {
        C
    }
    else {
        D
    }
}
else {
    E
}
could be then coded as:
Code: [Select]
A dupbool B overbool overbool and C dropbool not and D dropbool not E dropbool
« Last Edit: December 05, 2007, 05:49:07 PM by Gobo »

Offline MacadamiaNuts

  • Bot Destroyer
  • ***
  • Posts: 273
    • View Profile
dupbool
« Reply #11 on: December 05, 2007, 03:46:46 PM »
Wacky. Why not a general operator that returns the value at a specified backwards position in the stack?

like:
{a b c d e f}

3 return = value d
5 return = value b

But then, evolved DNA may lose the little sequencial readability it had.

I suspect a forward-only GoTo could be more straightforward for flow forking. And it would be a lovely retro addition, too.  

I betcha, someday we will be able to code Emacs in DB DNA.
Sometimes you win, and sometimes you lose...

Offline Gobo

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
dupbool
« Reply #12 on: December 05, 2007, 03:50:48 PM »
Quote from: MacadamiaNuts
I suspect a forward-only GoTo could be more straightforward for flow forking. And it would be a lovely retro addition, too.  
Foo! If you head on DNA readability, goto is perhaps the thing you want the least

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
dupbool
« Reply #13 on: December 05, 2007, 03:54:10 PM »
An over operator is starting to push the boundary a bit.  Can you achieve the same effect using swap and dup somehow?  If it's really impossible to do using other operators, we might need to implement it, but I'm really leaning towards no on this.  Evolved DNA can get really wacky, so it's best to keep the language as straightforward as possible.

The good news is that for DB3, I'm implementing codules, which would (should) easily allow forking.

Offline Gobo

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
dupbool
« Reply #14 on: December 05, 2007, 04:00:11 PM »
Quote from: Numsgil
An over operator is starting to push the boundary a bit.  Can you achieve the same effect using swap and dup somehow?
I believe no.