Author Topic: [Tutorial] Edition 2: Using Axe to its full functional form λ  (Read 21050 times)

0 Members and 1 Guest are viewing this topic.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #15 on: July 19, 2011, 03:30:42 pm »
Unfortunately I can't add an extra space to the token because of ReturnIf.  I don't think adding in a space is messy, and you can ignore the space if you want, its still valid.
___Axe_Parser___
Today the calculator, tomorrow the world!

Ashbad

  • Guest
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #16 on: July 19, 2011, 03:31:44 pm »
Good point.  But I prefer the old style better ;) even if it is valid the other way.

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #17 on: July 19, 2011, 03:41:52 pm »
Quote
Plus, adding in your own spaces is something I find messy

Really? I think it's great unless you're trying to indent all of your if statements and loops were there's like thirteen nested layers
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Ashbad

  • Guest
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #18 on: July 19, 2011, 03:58:41 pm »
Quote
Plus, adding in your own spaces is something I find messy

Really? I think it's great unless you're trying to indent all of your if statements and loops were there's like thirteen nested layers

Well, I like to think of it as being a last equation -> outside world notation rather than a give equation notation.  I also like to think of Return as an end for a def statement, since explicit routines are only created with a label with no ending keyword, an adding something past that would make it feel akward.

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #19 on: July 19, 2011, 04:14:24 pm »
Well, I like to think of it as being a last equation -> outside world notation rather than a give equation notation.

What in the world do you mean?
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Ashbad

  • Guest
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #20 on: July 19, 2011, 04:20:43 pm »
What I mean is that I think of returning values in Axe in a more functional way, so that the last expression is the overall output value for the entire function.  That way, I only use Return for ending the definition ending.

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #21 on: July 19, 2011, 04:32:47 pm »
Oh, all right.
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #22 on: July 19, 2011, 04:55:40 pm »
What I mean is that I think of returning values in Axe in a more functional way, so that the last expression is the overall output value for the entire function.  That way, I only use Return for ending the definition ending.
Yeah, I tend to think of it this way as well.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #23 on: July 19, 2011, 07:27:36 pm »
quick question, what's the advantage of currying in axe? as runer pointed out, it takes up more memory, and in my opinion, looks messier


Ashbad

  • Guest
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #24 on: July 19, 2011, 07:41:27 pm »
Well, depends on what form of currying you're talking about.  For non-pure-functional currying, its useful because it means in general that you're just passing parameters to explicit or non-explicit functions called or even defined and then called inside of the function.  For Haskellian currying, there is no definite use, unless you want to pass a very, very long list of parameters.

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #25 on: July 24, 2011, 07:58:48 am »
beginner question, how do you get r1 and r2 on the graphics calculator?

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #26 on: July 24, 2011, 08:02:29 am »
Vars->Y-Vars->Polar
Hope that helps.

Ashbad

  • Guest
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #27 on: July 24, 2011, 08:37:20 am »
You can have up to 6, using tokens r1-r6.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #28 on: July 24, 2011, 01:14:13 pm »
A subroutine is called like:

Code: [Select]
sub(DD, A, "HELLO", C, 5)
In this example, A is r1, "HELLO" is r2, C is r3, 5 is r4.

I once needed more arguments...

Ashbad

  • Guest
Re: [Tutorial] Edition 2: Using Axe to its full functional form λ
« Reply #29 on: July 28, 2011, 09:33:52 pm »
So, is this just going to never be in the new "Tutorials" section?  I've asked like 5 times in 3 separate threads, and I'm pretty much forced to give up all hope.  People who want to see this will have to follow the new "this is outdated link" in the old tutorial, I guess :/

Edit:

A subroutine is called like:

Code: [Select]
sub(DD, A, "HELLO", C, 5)
In this example, A is r1, "HELLO" is r2, C is r3, 5 is r4.

I once needed more arguments...

On a side note here is a good example of where Haskellian currying would be put to good use.  Let's say you need 8 arguments.  You can always curry so to get some more parameters.

Code: [Select]
(ADD8(1,2,3,4,5,6))(7,8)

Lbl ADD8
  r1+r2+r3+r4+r5+r6->r6
  λ(r6+r1+r2)
Return

Trivial example again, but shows essentially what I mean.  While this example contradicts it, I suggest you limit curried functions up to 5 parameters so that r6 can hood intermediate values between function followings.
« Last Edit: July 28, 2011, 09:41:44 pm by Ashbad »