Forum menu
Yep. LISP is [u]L[/u]ots of [u]I[/u]rritating and [u]S[/u]illy [u]P[/u]arentheses.
Prolog is the one where you give it some rules and then ask it questions, which seems a little similar to what IA was doing in his code:
[code]!hello.
+!hello : true
<- .println("hello world").[/code]
which I'm guessing either means something like
"the goal is hello. To make the goal true then println hello word"
or it means
"hello is false. Create a rule that if hello is false, make it true by printlning hello world."
Awaits with baited breath to find out. ๐
epicsteve you sure you aren't thinking of lisp ?
Well it was a long time ago! Doesn't Prolog use lots of curly brackets?
[code]HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE[/code]
- [url= http://lolcode.com/examples/hai-world ]lolcode[/url]
Some Prolog:
[code]/* The Facts */
father( john, jim ).
mother( jane, jim ).
father( jack, john ).
[/code]
[code]/* The Rules */
parent( Person1, Person2 ) :- father( Person1, Person2 ).
parent( Person1, Person2 ) :- mother( Person1, Person2 ).
grandparent( Person1, Person2 ) :-
parent( Person3, Person2 ),
parent( Person1, Person3 ).
[/code]
[code]/* Some queries */
?- father( Who, jim ).
Who = john
?- mother( jane, fred ).
No.
?- mother( jane, jim ).
Yes.
?- grandparent( jack, ).
jim
[/code]
Prolog is close-ish, (one of the) interpreters for the language uses prolog in the implementation.
The language is AgentSpeak(L) (technically AgentSpeak(XL) actually).
!hello is a goal, and then goals are selected according to the agent's beliefs and desires. In this case, there's only one plan, and the guard on it is simply true.
The above code would work with Jason (jason.sf.net)
I like C# but I have to admit I'm going off it with all the new features that keep going in. Whatever happened to K.I.S.S.
A long time ago I coded Tcl/Tk and now I'm getting to like Ruby which seems like the offspring of a perl/tcl/smalltalk orgy. Nice simple hello worlds in those types of thing:
puts "hello world"
I wrote a compiler once in a mixture of prolog, and ml (wacky functional language) that compiled to a pseudo machine that was emulated in ml also.
I think I might have a claim to the king of the nerds crown too!
Why? I needed to learn the basics of compiler stuff for my compilers course, prolog for the ai course, and some functional programming rubbish - just thought i could more efficently learn all that stuff in one go. Oh and it was useful for another course (architectures or something) to write emulators - I did an Arm one too when we had to do firmware hacking and I couldn't be bothered to go to the lab where the chips were.
Joe
You'd never know I'm a nerd for a living still!
Now [url= http://en.wikipedia.org/wiki/Brain**** ]this[/url] is what I call a difficult language. Hope the swear filter doesn't corrupt the URL!
If you think ML is whacky you aint seen nothing...
*hunts down Hume hello world example*
I used to work on AS/400s, many moons ago. RPG was quite possibly one of the worst languages ever invented. Designed to be written on punch cards originally, when they swapped it to a screen based version they kept all the punchcard layout, so everything had to be in exactly the right place.
All you could do with it was crunch numbers and move data around. No graphics other than plain text on a green/black screen. Can't believe I spent 6 years doing that crap. Tis no wonder I had a nervous breakdown! ๐
Far more interesting than using an obscure language is writing obscure code in a mainstream language http://www.ioccc.org/
*_="on8gi$kjg-(kojn$pkjntWnm&r*&~ep!wPer{5vcvw0^obnq";__(___){putchar
(_[___]-___);_[++___]!=___-___?__(___):___;}main(){__(1);}
Wouldn't win any prizes, but I didn't want to make it too hard!
Slightly modified to run without error in http://codepad.org/
*_="on8gi$kjg-(kojn$pkjntWnm&r*&uep!mPer{5vcnw0^~bnq";___(__){putchar
(_[__]-__);_[++__]!=!_?___(__):_;}main(){___(*_/(*_));return(!_);}
Or for a clean compile with gcc -std=c99 -pedantic -Wall :-
#include <stdio.h>
int *string = (int *)"on8gi$kjg-(kojn$pkjntWnm&r*&~ep!wPer{5vcvw0^obnq";
void hello(int idx)
{
putchar(string[idx] - idx);
if (string[++idx] != 0) hello(idx);
}
int main(void)
{
hello(1);
return 0;
}
Nice bit of dodgy pointer conversion from char * to int * in there ๐
[EDIT]
Actually I'm surprised the obfuscated version didn't take the chance to use one of C's strangest features:-
value = array[index];
...can legally be replaced with...
value = index[array];
...yielding exactly the same result. ๐ฏ
Dodgy pointer conversion kind of forced on me by the desire to use as few keywords as possible - though it has the nice side effect of helping to hide the data. I'm actually quite proud of that bit of code (bear in mind I hand coded it just now, hence why I might not have used all possible obfuscation techniques)!
BTW you should try the second version - output is slightly different ๐

