LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-05-2011, 02:55 PM   #121
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723

Now it seems to loop over and over and over without adding to i, and then it eventually throws an exception about not being able to add something that isn't a number to a number.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-06-2011, 08:33 AM   #122
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Finally:

Code:
$ cat testprog
i = 0;
while (not i == 10) {
        i.print();
        i = i + 1;
};

$ ./newlang < testprog
0.000000
1.000000
2.000000
3.000000
4.000000
5.000000
6.000000
7.000000
8.000000
9.000000
And it even does closures and fake OOP:

Code:
$ cat testprog2
MyObject = func () {

        value = 0;

        value! = func (x) {
                value = x;
        };

        value? = func () {
                value;
        };

        apply_function = func (f) {
                value = f(value);
        };

        this;
};

create_adder = func (x) {
        func (y) {
                x + y;
        };
};

o = MyObject();
o.value!(3);
adder = create_adder(5);
o.apply_function(adder);

o.value?().print();

$ ./newlang < testprog2
8.000000

Last edited by MTK358; 03-06-2011 at 10:11 AM.
 
Old 03-20-2011, 08:36 AM   #123
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by Nominal Animal View Post
I made a severe misjudgment and deleted this post; sorry.
Would you considering restoring your posts?

You can see your edit history, & recover the original text by clicking on "Last edited by Nominal Animal" at the bottom of each of your edited posts. Those posts, especially the code content, were admired by several members & they would appreciate them being restored.

Thanks for your consideration.
 
Old 03-21-2011, 01:29 AM   #124
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
Quote:
Originally Posted by archtoad6 View Post
Would you considering restoring your posts?

You can see your edit history, & recover the original text by clicking on "Last edited by Nominal Animal" at the bottom of each of your edited posts. Those posts, especially the code content, were admired by several members & they would appreciate them being restored.

Thanks for your consideration.
Archtoad6, thank you for the recovery tip; it was exactly what I had been looking for all over. I've now restored all my posts.

I didn't know about that feature, and I didn't see it mentioned in the FAQ or the HowTo, either. (I guess it must have seemed pretty odd to you, though -- I had been slowly recreating my posts from memory.)

Last edited by Nominal Animal; 03-21-2011 at 09:17 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
would and could somebody help me with my homework assignment please... DarDevy Linux - Newbie 3 04-20-2009 02:43 PM
LXer: Java Data Objects and Service Data Objects in SOA LXer Syndicated Linux News 0 01-17-2009 06:10 AM
Objects in C?? kickzha Programming 6 06-17-2006 08:38 PM
IP address assignment n3tw0rk Linux - Networking 1 01-05-2004 12:23 AM
need help with class assignment tenraek Linux - General 4 04-03-2003 12:31 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration