Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
18 May, 2013, 19:48:24 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 [2] 3 4   Go Down
  Print  
Author Topic: [Tutorial] Edition 2: Using Axe to its full functional form λ -  (Read 3059 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Quigibo
The Executioner
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 00:55:01
Date Registered: 22 January, 2010, 05:02:37
Location: Los Angeles
Posts: 2022


Total Post Ratings: +1019

View Profile
« Reply #15 on: 19 July, 2011, 21:30:42 »
0

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.
Logged

___Axe_Parser___
Today the calculator, tomorrow the world!
Ashbad
Guest
« Reply #16 on: 19 July, 2011, 21:31:44 »
0

Good point.  But I prefer the old style better Wink even if it is valid the other way.
Logged
LincolnB
Check It Out Now
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 20 February, 2013, 05:44:25
Date Registered: 02 May, 2011, 00:56:28
Location: Utah Valley
Posts: 1114


Total Post Ratings: +121

View Profile
« Reply #17 on: 19 July, 2011, 21:41:52 »
0

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
Logged

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
« Reply #18 on: 19 July, 2011, 21:58:41 »
0

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.
Logged
LincolnB
Check It Out Now
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 20 February, 2013, 05:44:25
Date Registered: 02 May, 2011, 00:56:28
Location: Utah Valley
Posts: 1114


Total Post Ratings: +121

View Profile
« Reply #19 on: 19 July, 2011, 22:14:24 »
0

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?
Logged

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
« Reply #20 on: 19 July, 2011, 22:20:43 »
0

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.
Logged
LincolnB
Check It Out Now
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 20 February, 2013, 05:44:25
Date Registered: 02 May, 2011, 00:56:28
Location: Utah Valley
Posts: 1114


Total Post Ratings: +121

View Profile
« Reply #21 on: 19 July, 2011, 22:32:47 »
0

Oh, all right.
Logged

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)


ztrumpet
The Rarely Active One
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 23 April, 2013, 16:09:52
Date Registered: 08 November, 2009, 21:10:12
Location: Michigan
Posts: 5687


Total Post Ratings: +360

View Profile
« Reply #22 on: 19 July, 2011, 22:55:40 »
0

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.
Logged

nemo
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: 04 April, 2013, 01:12:57
Date Registered: 16 May, 2010, 03:55:30
Posts: 1198

Total Post Ratings: +83

View Profile
« Reply #23 on: 20 July, 2011, 01:27:36 »
0

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
Logged


Ashbad
Guest
« Reply #24 on: 20 July, 2011, 01:41:27 »
0

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.
Logged
selectcoaxial
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 01 May, 2013, 09:19:09
Date Registered: 01 June, 2011, 13:11:03
Posts: 29

Total Post Ratings: 0

View Profile
« Reply #25 on: 24 July, 2011, 13:58:48 »
0

beginner question, how do you get r1 and r2 on the graphics calculator?
Logged
mrmprog
LV7 Elite (Next: 700)
*******
Offline Offline

Last Login: 28 September, 2012, 05:58:25
Date Registered: 15 February, 2011, 01:35:36
Location: Somewhere
Posts: 559


Total Post Ratings: +34

View Profile
« Reply #26 on: 24 July, 2011, 14:02:29 »
+1

Vars->Y-Vars->Polar
Hope that helps.
Logged

Ashbad
Guest
« Reply #27 on: 24 July, 2011, 14:37:20 »
0

You can have up to 6, using tokens r1-r6.
Logged
Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 07 May, 2013, 22:49:01
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #28 on: 24 July, 2011, 19:14:13 »
0

A subroutine is called like:


1
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...
Logged
Ashbad
Guest
« Reply #29 on: 29 July, 2011, 03:33:52 »
0

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 Undecided

Edit:

A subroutine is called like:


1
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.


1
2
3
4
5
6
(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: 29 July, 2011, 03:41:44 by Ashbad » Logged
Pages: 1 [2] 3 4   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.367 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.