Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Yoda programming language

This thread is locked; no one can reply to it. rss feed Print
Yoda programming language
Trezker
Member #1,739
December 2001
avatar

I just set here programming and suddenly I inversed the order of a return so it became "x return;" instead of "return x;"

So the thought struck me that a Yoda programming language would be a fun addition to the likes of chef, shakespeare etc...

Of course I'm not the first guy to think of this. A microsoft emplyoee apparently took some time off blogging about getting this idea. But he didn't go very deep, and I would like to argue that his example sucks. http://blogs.msdn.com/mattwar/archive/2005/10/09/479008.aspx

So I'm wondering if the members of this community can do better.

if imaginative you are
example make you must

Matthew Leverton
Supreme Loser
January 1999
avatar

Perl seems to do everything backward to me. Maybe it is the Yoda language?

Neil Black
Member #7,867
October 2006
avatar

I'm still waiting on the Chewbacca programming language:

BBWWAAAA!!!("Hello World");

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

Perl seems to do everything backward to me. Maybe it is the Yoda language?

I think you're thinking of Forth :)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

alethiophile
Member #9,349
December 2007
avatar

It wouldn't be hard to write a grammar alterer with lex/yacc that takes some-language-with-reversed-words and returns that-language-correct.

--
Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.
C++: An octopus made by nailing extra legs onto a dog.
I am the Lightning-Struck Penguin of Doom.

Kibiz0r
Member #6,203
September 2005
avatar

But how would you do exception handling, since there is no try?

Erikster
Member #9,510
February 2008
avatar

Kibiz0r said:

But how would you do exception handling, since there is no try?

Dang, beat me to it.

Cat! I'm a kitty cat. And I dance dance dance, and I dance dance dance.

Trezker
Member #1,739
December 2001
avatar

do?
{
    codestuff
}
did not(reason)
{
    speak(reason);
}

Arthur Kalliokoski
Second in Command
February 2005
avatar

Doesn't Polish notation (for calculators) fit the bill?

Otherwise, if this Yoda language took off, there wouldn't be a need for allegro.cc to aid beginners, since "There is no try, there is only do!"

They all watch too much MSNBC... they get ideas.

Cody Harris
Member #4,406
March 2004
avatar

Yoda does not need to worry about exceptions, his code is infallible.

---------------------------------
Homepage - Art (Photography)
I'm QBasicer on #allegro on Freenode.

alethiophile
Member #9,349
December 2007
avatar

(do||!do)
!try

;)

--
Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.
C++: An octopus made by nailing extra legs onto a dog.
I am the Lightning-Struck Penguin of Doom.

ReyBrujo
Moderator
January 2001
avatar

Perl does something similar:

print "Hello World!" if ($test == 1);

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

Thomas Fjellstrom
Member #476
June 2000
avatar

print "Hello World!\n" unless not $test;
;)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

ixilom
Member #7,167
April 2006
avatar

Neil Black said:

BBWWAAAA!!!("Hello World");

haha, that made me laugh and its only 9.30 am, good job :P

___________________________________________
Democracy in Sweden? Not since 2008-Jun-18.
<someone> The lesbians next door bought me a rolex for my birthday.
<someone> I think they misunderstood when I said I wanna watch...

Gr4|\|f
Member #9,499
February 2008
avatar

But luke, not ready are you.

if (!ready)
{
     throw(jedi['luke']);
}

;)

Ping me @ 127.0.0.1

alethiophile
Member #9,349
December 2007
avatar

question = (2b||!2b)

8-)

--
Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.
C++: An octopus made by nailing extra legs onto a dog.
I am the Lightning-Struck Penguin of Doom.

Gr4|\|f
Member #9,499
February 2008
avatar

Quote:

question = (2b||!2b)

No, that's already the question, you don't have to set it.

question == (2b||!2b)

Ping me @ 127.0.0.1

alethiophile
Member #9,349
December 2007
avatar

No, but you're stating that "that is the question", you're not asking "Is that the question?"

--
Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.
C++: An octopus made by nailing extra legs onto a dog.
I am the Lightning-Struck Penguin of Doom.

Trezker
Member #1,739
December 2001
avatar

that=(2b||!2b)?question:!question;

Go to: