Author Topic: Axe Q&A  (Read 601208 times)

0 Members and 1 Guest are viewing this topic.

Offline Stefan Bauwens

  • Creator of Myst 89 - סטיבן
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1799
  • Rating: +162/-24
  • 68k programmer
    • View Profile
    • Portfolio
Re: Axe Q&A
« Reply #1035 on: November 22, 2011, 08:50:44 am »
Really? I got it to work with multidigit numbers
Using:

Text(25,25,"0",A->Dec

Also a somewhat relating question, how would you put together 2 strings and store it into a new string?
Thanks that works. I just would wanna know if i could save "05" to something. Like this:
"0",A>Dec->B


Very proud Ticalc.org POTY winner (2011 68k) with Myst 89!
Very proud TI-Planet.org DBZ winner(2013)

Interview with me

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #1036 on: November 22, 2011, 01:48:48 pm »
This comes from an IRC discussion.
Code: [Select]
:[0000000000000000....]->GDB1
:For(A,0,8)
:rand^10->{GDB1+A}
:End

Offline Stefan Bauwens

  • Creator of Myst 89 - סטיבן
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1799
  • Rating: +162/-24
  • 68k programmer
    • View Profile
    • Portfolio
Re: Axe Q&A
« Reply #1037 on: November 22, 2011, 01:53:43 pm »
You're my savior man. I'll try it soon. :D

EDIT: Works brilliant. :D
« Last Edit: November 22, 2011, 04:03:18 pm by Stefan Bauwens »


Very proud Ticalc.org POTY winner (2011 68k) with Myst 89!
Very proud TI-Planet.org DBZ winner(2013)

Interview with me

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #1038 on: November 22, 2011, 10:05:13 pm »
If the first two arguments of Copy() are the same, will there be any adverse effects?
Vy'o'us pleorsdti thl'e gjaemue

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #1039 on: November 22, 2011, 10:06:42 pm »
Wouldnt make sense to have any :P

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #1040 on: November 22, 2011, 10:09:38 pm »
Wouldnt make sense to have any :P
..unless it's a line of code with variable inputs, set up in a way that might have it happen. ;)
« Last Edit: November 22, 2011, 10:10:27 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #1041 on: November 22, 2011, 10:11:13 pm »
Wouldnt make sense to have any :P
..unless it's part of a line of code with variable inputs, set up in a way that might have it happen.
Exactly. I may use something like that myself. So will that copy itself to itself?

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #1042 on: November 22, 2011, 10:12:37 pm »
Why would you want to store its self to its self when it is already its self.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Q&A
« Reply #1043 on: November 22, 2011, 10:16:18 pm »
Indeed, nothing bad would happen. It would take just as long as otherwise, and do nothing.
One thing to be aware of, however, if you are copying to/from a variable location, is to deal with overlap properly.
For example, it should be easy to see that this code will not shift 100 bytes, but will copy one byte 100 times:
Copy(L1,L1+1,100)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #1044 on: November 22, 2011, 10:25:04 pm »
Right, the end result is just similar. :)
Good to know, I'm optimizing stuff in Essence...can't be too careful :P
Vy'o'us pleorsdti thl'e gjaemue

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #1045 on: November 22, 2011, 10:35:06 pm »
It's not always the same though.  If you Copy(L1,L1+1,100), it will first copy L1 into L1+1, and then L1+1 into L1+2, effectively filling L1 to L1+100 with the first element, instead of shifting. 

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Axe Q&A
« Reply #1046 on: November 22, 2011, 10:35:49 pm »
It's not always the same though.  If you Copy(L1,L1+1,100), it will first copy L1 into L1+1, and then L1+1 into L1+2, effectively filling L1 to L1+100 with the first element, instead of shifting. 
To fix:
Copy(L1+98,L1+99,100){r}
(I think)
In-progress: Graviter (...)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Q&A
« Reply #1047 on: November 22, 2011, 10:55:02 pm »
It's not always the same though.  If you Copy(L1,L1+1,100), it will first copy L1 into L1+1, and then L1+1 into L1+2, effectively filling L1 to L1+100 with the first element, instead of shifting. 
To fix:
Copy(L1+98,L1+99,100){r}
(I think)
You mean Copy(L1+99,L1+100,100) :)




Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #1048 on: November 22, 2011, 11:38:36 pm »
To be sure of my understanding of Copy(, is
Copy(L1,L2,10)
the same as
For(A,0,9)
{L1+A}->{L2+A}
End

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Q&A
« Reply #1049 on: November 22, 2011, 11:49:54 pm »
That's right. But the same thing happens when you use a For() loop—look at this.

As you said, this:
Quote from: Axe
Copy(L1,L1+1,10)
does essentially the same as this:
Quote from: Axe
For(A,0,9)
{A+L1}{A+L1+1}
End
But if you take it step by step, it's really doing this:
Quote from: Axe
{L1}{L1+1}
{L1+1}{L1+2}
{L1+2}{L1+3}
{L1+3}{L1+4}
{L1+4}{L1+5}
{L1+5}{L1+6}
{L1+6}{L1+7}
{L1+7}{L1+8}
{L1+8}{L1+9}
{L1+9}{L1+10}
See the problem? You're copying the first byte to the second, then the second byte to the third, and so on, so in the end you're just copying the first byte to every byte after it for ten bytes. It would be doing the same as this:
Quote from: Axe
Fill(L1,10)
which isn't what we're trying to do.

If you want to just shift the whole block to the right a few bytes, you start at the end and use Copy()r. Just thought I'd make that a bit more clear :)
« Last Edit: November 22, 2011, 11:50:22 pm by Deep Thought »