Viewing 21 posts - 41 through 61 (of 61 total)
  • One for the programmers out there!
  • GrahamS
    Full Member

    Looks like some kind of rule-based logic language, similar to Prolog?

    UrbanHiker
    Free Member

    NZCol, That made me chuckle.

    Up till 12 months ago I programmed assembler full time for the best part of a decade.

    I actually remember dreaming in Z80!!

    epicsteve
    Free Member

    Never had to use COBOL, fortunately, not being old

    Only had to use it once since uni, and that was Pro*Cobol (i.e. linked to an Oracle database). I was on site as an Oracle consultant and got asked if I could help on another project where the original programmer wasn't around any longer. Horrible language to work in.

    At uni I was taught a lot of programming languages and of them I liked Pascal and Modula-2 – both of which are virtually unused in the real world. I've spend most of my career doing PL/SQL & SQL plus 4GL's and a bit of Java.

    epicsteve
    Free Member

    Looks like some kind of rule-based logic language, similar to Prolog?

    I did Prolog at uni – not the nicest to work in 'cause of all the brackets if I recall correctly.

    Surfr
    Free Member

    epicsteve you sure you aren't thinking of lisp ?

    GrahamS
    Full Member

    Yep. LISP is Lots of Irritating and Silly Parentheses.

    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:

    !hello.
    +!hello : true
    <- .println("hello world").

    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
    Free Member

    epicsteve you sure you aren't thinking of lisp ?

    Well it was a long time ago! Doesn't Prolog use lots of curly brackets?

    miketually
    Free Member

    HAI
    CAN HAS STDIO?
    VISIBLE "HAI WORLD!"
    KTHXBYE

    lolcode

    GrahamS
    Full Member

    Some Prolog:

    /* The Facts */
    father( john, jim ).
    mother( jane, jim ).
    father( jack, john ).

    /* The Rules */
    parent( Person1, Person2 ) :- father( Person1, Person2 ).
    parent( Person1, Person2 ) :- mother( Person1, Person2 ).
    grandparent( Person1, Person2 ) :-
    parent( Person3, Person2 ),
    parent( Person1, Person3 ).

    /* Some queries */
    ?- father( Who, jim ).
    Who = john
    ?- mother( jane, fred ).
    No.
    ?- mother( jane, jim ).
    Yes.
    ?- grandparent( jack, ).
    jim

    IA
    Full Member

    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)

    GrahamS
    Full Member

    Prolog is close-ish

    Good enough for me. I declare myself King of Geeks.

    llama
    Full Member

    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"

    joemarshall
    Free Member

    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!

    GrahamS
    Full Member

    joemarshall pictured yesterday in his lair:

    😉

    hoodoo
    Free Member

    Now this is what I call a difficult language. Hope the swear filter doesn't corrupt the URL!

    IA
    Full Member

    If you think ML is whacky you aint seen nothing…

    *hunts down Hume hello world example*

    Davy
    Free Member

    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! 🙂

    aracer
    Free Member

    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!

    aracer
    Free Member

    Slightly modified to run without error in http://codepad.org/

    *_="on8gi$kjg-(kojn$pkjntWnm&r*&uep!mPer{5vcnw0^~bnq";___(__){putchar
    (_[__]-__);_[++__]!=!_?___(__):_;}main(){___(*_/(*_));return(!_);}

    elliptic
    Free Member

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

    aracer
    Free Member

    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 😉

Viewing 21 posts - 41 through 61 (of 61 total)

The topic ‘One for the programmers out there!’ is closed to new replies.