What languages do people prefer to code in?

Discussion in 'Programming & Software Development' started by chiquee, Oct 29, 2003.

  1. Aamdaron

    Aamdaron Member

    Joined:
    Jul 25, 2002
    Messages:
    2,113
    Location:
    Melbourne
    ok that is kind of confusing ive never touched haskell before but how do you get things done without variables? :confused:
     
  2. praiseB

    praiseB Member

    Joined:
    Dec 28, 2001
    Messages:
    6,489
    Location:
    Ferntree Gully
    how do you get things done without loops?
     
  3. Aamdaron

    Aamdaron Member

    Joined:
    Jul 25, 2002
    Messages:
    2,113
    Location:
    Melbourne
    fuxx0r so what can you use it for besides learning concepts? im sure the creators wanted it to be used for something other than learning?
     
  4. Thunder

    Thunder Member

    Joined:
    Jul 22, 2001
    Messages:
    782
    Location:
    Brisbane
    its why you need 10,000 functions to get things done, you have to call other functions to get your vars.

    as for the loops you have to use recursion, which is a pain in the arse. although it does have a built in construct for processing lists (haskell equiv of arrays)

    it can't really be explained in terms of C/Java etc because its a completly different way programming.

    its a crap language, seriously. don't learn it unless you have to.
     
  5. praiseB

    praiseB Member

    Joined:
    Dec 28, 2001
    Messages:
    6,489
    Location:
    Ferntree Gully
    Lists and recursion I can understand
     
  6. saba

    saba Evil Vizier

    Joined:
    Aug 4, 2001
    Messages:
    2,710
    Location:
    Melbourne
    I fully agree. The language is amazingly powerful and pristine and smooth, dont reject it until you have at least covered monads or lambda calculus.

    The only thing I really dislike about the language at all is IO, but then again how do you propose to do IO without variables and looping structures? ;)
     
  7. saba

    saba Evil Vizier

    Joined:
    Aug 4, 2001
    Messages:
    2,710
    Location:
    Melbourne
    So why do Ericson and Nokie use it extensively? What about Texas Instruments using it as prototyping?
     
  8. akura

    akura Member

    Joined:
    Jun 26, 2001
    Messages:
    570
    Location:
    Melbourne
    It's hard to say lists in Haskell are the equivilent of arrays in C as they are so much _more_ than that. Lists in Haskell would be directly compared to linked lists in C, which is a great pain to implement too.

    Admittedly when we first treaded into Haskell territory I wasn't a very big fan of it, mainly because I was used to procedural programming. However after a few months of working with it, I have found it to be an extremely elegant language. What may take lines and lines of code in C could well take 3 or 4 in haskell.

    Saba's right though, IO is terrible.
     
  9. grimwood

    grimwood Member

    Joined:
    Feb 26, 2002
    Messages:
    1,554
    Location:
    Perth
    Fortran is what I use most of the time, it is easy and fast. Also use Perl for string manipulation and general purpose stuff.

    Would like to learn Assembly, Ada and C, probably in the reverse of the order that I mentioned. Python looks nice but the indenting puts me off. Don't care too much for Java, C++ and the trendy languages of today. OO seems to be redefined every day depending on people's biases of langauges - the important stuff can be done in any language.

    Daniel.
     
  10. praiseB

    praiseB Member

    Joined:
    Dec 28, 2001
    Messages:
    6,489
    Location:
    Ferntree Gully
    So like the List interface in the Java Collections framework.
     
  11. Thunder

    Thunder Member

    Joined:
    Jul 22, 2001
    Messages:
    782
    Location:
    Brisbane
    Yeah, lists arne't quite arrays, and you can have lists of lists, which is a bit eaiser to work with that multi dimensional arrays

    but on the other hand, what may take 3 or 4 functions in C (or none at all if you wanted to write spaghetti code) could take many in haskell :p

    my main beef with the language is that it forces you to program in a rather annoying way, im sure it has its applications, but i can't see any mainstream ones (oh, and there is no way im gonna do any calculus)

    but seriously tho, did they really have to do away with looping?
    recursion has its uses, but there are times when iteration is better.
     
  12. Thunder

    Thunder Member

    Joined:
    Jul 22, 2001
    Messages:
    782
    Location:
    Brisbane
    erm, because they make mobile phones and not win32 apps? :p
     
  13. praiseB

    praiseB Member

    Joined:
    Dec 28, 2001
    Messages:
    6,489
    Location:
    Ferntree Gully
    And mobile applications are becoming more in demand than what win32 applications are. So whats your point
     
  14. rockuman_ex

    rockuman_ex Member

    Joined:
    Apr 3, 2002
    Messages:
    3,860
    Location:
    Brisbane
    Visual Basic.
    ColdFusion :D
     
  15. deepspring

    deepspring Member

    Joined:
    Jul 8, 2002
    Messages:
    3,601
    Location:
    Maitland, NSW
    And cell phones are starting to adopt Java... so whats his point (not you praiseB).
     
  16. k0ncept0ne

    k0ncept0ne Member

    Joined:
    Jul 12, 2003
    Messages:
    69
    this is what I mean, you learn new languages and you learn new things. you can iterate over list elements with recursion, and you can also create the same functionality as say a while loop in C++.

    I don't know why everyone bitches about recursion, as it's no real hassle to implement a recursive function. the only problem is the possiblity of eating up memory, but if you know anything about recursion you will be able to avoid it. memory leaks and such errors caused by pointers are more of a problem than errors due to recursion.

    care to explain that... way?

    the indenting is a wonderful feature. firstly, if you've got a clean coding style, you should be indenting anyway. secondly, the fact that it forces you to use tabs to delimit code blocks (which becomes second nature after about 15 minutes anyway) means your code is so much easier to read, and therefore so much easier to maintain.
     
  17. grimwood

    grimwood Member

    Joined:
    Feb 26, 2002
    Messages:
    1,554
    Location:
    Perth
    I'm another who generally dislikes recursion, although I think it is better than while loops. It does have its place and there are times when it is the best choice, such as when the number of iterations/recursions are unknown. When the number of iterations can be determined beforehand, it is far more efficient for a compiler and CPU to use a simple do loop than recursively call functions. A lot of the time people don't bother with this, and end up with very slow code.

    I do indent in all my codes, for readability and debugging. However, sometimes there is so much indentation that it is more readable not to indent than to have lines starting in say the 60th column of the text editor. (One could get around this by chopping it out and sticking it in another routine, but that has its own problems). Using indentation is good, but it shouldn't be required.

    Regards,
    Daniel.
     
    Last edited: Nov 5, 2003
  18. tacheonmaster

    tacheonmaster Member

    Joined:
    Jun 26, 2001
    Messages:
    1,864
    Location:
    4128
    If you are having to indent that far, then you are doing something wrong.
     
  19. Thunder

    Thunder Member

    Joined:
    Jul 22, 2001
    Messages:
    782
    Location:
    Brisbane
    recursion is inefficent in a lot of cases, a function call creates an overhead whereas looping dosn't. however i would never write iterative code to traverse a binary tree etc. however writing recursive code to generate a fibonacci sequence (i think it is) is just plain stupid, it will create thousands of recursive function calls


    the Haskell(tm) way

    ie, no looping (my pet peeve if you havn't worked this one out)
    and being forced to write a bazillion little functions to do things
    and the shithouse IO support


    but enough of this, it's going to turn into a holy war if it hasn't already.
     
  20. Shalmanese

    Shalmanese Member

    Joined:
    Jun 27, 2001
    Messages:
    1,160
    Location:
    Seattle
    So what your basically saying is that Haskell is crap because its not like C?

    Which is precisely the reason one should learn it. From a theoretical point of view, Variables are as dangerous as goto's in code. Sure, they make code a lot simpler in certain limited regards but they make debugging almost a nightmare at times. Arrays are important only if you care about performance and can be viewed merely as a generalised version of lists with some performance optimisations. I never claimed that Haskell was useful in "real world" situations but if thats the criterion you judge it by, then, yes, it is a crap language. However, it lets you do things that no other language I have seen can do.

    For example: Infinitely large Integers (Well, 256MB I think). You can enter something like 2^1024 and do math with it. You never need to worry about overflows or wrapping.

    Higher order functions. You pass functions to other functions. In C, this is possible though clunky, in Haskell its elegant and far more powerful.

    Lazy execution. Haskell only executes things when it needs them, thus you can do really funky stuff like pass infinitely large lists to objects without it freezing. you can map a relation onto an infinite list.

    However, its really hard to describe it's true elegance without actually sitting down and writing the code out. If you go to it thinking how you can port a C alogorithm over, then its going to be awful. If you treat Haskell as Haskell, its wonderful and beautiful. It along with Lisp are probably the most advanced languages out there.
     

Share This Page

Advertisement: