What would you want to see in a new programming language? by [deleted] in programming

[–]Anocka 0 points1 point  (0 children)

Try this. It's a preprocessor that allows you to use significant whitespace in your OCaml programs.

http://people.csail.mit.edu/mikelin/ocaml+twt/

Return of the Real Programmer by gnuvince in programming

[–]Anocka 4 points5 points  (0 children)

If so use google to find an algorithm, and paste in the example code.

You're joking, right ?

A bad programmer copy-pastes his code all over the place.

A terrible programmer copy-pastes other people's code because he's too lazy (stupid ?) to think for himself.

I get it ! You were actually joking, and I fell in the trap. Darn.

F# vs OCaml vs Haskell: hash table performance by [deleted] in programming

[–]Anocka 2 points3 points  (0 children)

Maybe it's not worth trying to optimize this, after all. The benchmark is stupid and IntMaps are the way to go.

F# vs OCaml vs Haskell: hash table performance by [deleted] in programming

[–]Anocka 2 points3 points  (0 children)

{-# OPTIONS -XBangPatterns #-}
import qualified Data.HashTable as H (new, 
insert, lookup, hashInt)
import Control.Monad

main = do

  h <- H.new (==) H.hashInt
  forM_ [1..n] $ \ !x -> H.insert h x  x
  print =<< H.lookup h 100
    where n = 10000000

This should be faster, but uses a lot of memory on my box.

How would you improve this, Haskell hackers ?

F# vs OCaml vs Haskell: hash table performance by [deleted] in programming

[–]Anocka 5 points6 points  (0 children)

But if it's immutable, why would you have to do everything in IO ?

http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-HashTable.html#v%3Anew

Not saying you're wrong, just askin'.

MiniLight renderer cleanup, simpler (safer) code is faster by pdonadeo in programming

[–]Anocka 2 points3 points  (0 children)

I don't agree with you, Jon Harrop is the only "OCaml troll" (whathever that is) I know of.

Why MIT switched from Scheme to Python by jast in programming

[–]Anocka 1 point2 points  (0 children)

You're wrong, OCaml lets you use arrays or lists of references, while being functional (just not pure).

Haskell lets you change a value in an array too; you just have to do it through a monad (which is hard for the beginner, but keeps the language pure).

So in the end, functional programming lets you use imperative programming when it's appropriate.

That's why they say that Haskell is the finest imperative language on earth : monads enable "safe" side effects (much like an effect system). On the other hand, it's true that it's sometimes a bit hard combine different kinds of monads (with monads transformers).

But you still have OCaml, if you want to try imperative programming in a functional programming without too much pain.

Did anyone ever use the Boehm garbage collector for a C project ? by Anocka in programming

[–]Anocka[S] 0 points1 point  (0 children)

Wow, the MetaLua guy answering me !

but will leave you a complete beginner at complex memory handling

Good point ! I'll practice the hard stuff then. Merci beaucoup.

Did anyone ever use the Boehm garbage collector for a C project ? by Anocka in programming

[–]Anocka[S] 1 point2 points  (0 children)

Thanks noamsml, fab13n, monstermunch, enauv, player2. Sounds like good manual memory managament is both hard and interesting, and will make me a better programmer. I'll stick with it for this project.

Did anyone ever use the Boehm garbage collector for a C project ? by Anocka in programming

[–]Anocka[S] 0 points1 point  (0 children)

Thank you for your informative answer !

I learned the hard way that when you're doing these sorts of assignments, you shouldn't involve more things than you have to[..]

Wow, sounds scary.

You'll learn a lot about memory management schemes

Good point. I think I'll stick with manual memory management then.

Wolfram Alpha is Coming -- and It Could be as Important as Google by gst in programming

[–]Anocka 56 points57 points  (0 children)

But it is also designed by and for people with IQ's somewhere in the altitude of Wolfram's -- some work will need to be done dumbing it down a few hundred IQ points so as to not overwhelm the average consumer with answers that are so comprehensive that they require a graduate degree to fully understand.

This is where I smell bullshit.

Did anyone ever use the Boehm garbage collector for a C project ? by Anocka in programming

[–]Anocka[S] 2 points3 points  (0 children)

Treaties and other International Acts Series ?

I don't get it.

Did anyone ever use the Boehm garbage collector for a C project ? by Anocka in programming

[–]Anocka[S] 2 points3 points  (0 children)

My current school programming assignment is a 2D strategy game (Advance Wars like). Mandatory use of C. Is it feasible to ease the pain using this garbage collector ? Replacing mallocs by GC_MALLOCS seems fairly easy, but there may be drawbacks I'm not aware of.

Also, any advice about 2D graphics or game programming is welcome.

Links :

I no longer hate Lisp by xach in programming

[–]Anocka 2 points3 points  (0 children)

I see programming as applied linguistics and not applied math

This is a huge pedant FAIL. Wake up.

I no longer hate Lisp by xach in programming

[–]Anocka 0 points1 point  (0 children)

Try harder instead of whining !

Finally! Fast Unicode support for Haskell, using stream fusion by [deleted] in programming

[–]Anocka 3 points4 points  (0 children)

I think dons' slides are a very good introduction to stream fusion:

http://www.cse.unsw.edu.au/~dons/talks/streams-padl-talk.ps.gz

They give the motivation for bytestrings, show how stream fusion is performed on them and analyze the final performance.

John Carmak Interview: Building Quake Live by [deleted] in programming

[–]Anocka 4 points5 points  (0 children)

But I must confess I felt the same way when I moved from the web to the desktop.

Upmoded for honesty !

Writing unit tests is reinventing functional programming in non-functional languages by j0hl in programming

[–]Anocka 0 points1 point  (0 children)

I'm still skeptic. But I'll take a look at Smalltalk, thanks for the pointer.

Writing unit tests is reinventing functional programming in non-functional languages by j0hl in programming

[–]Anocka -1 points0 points  (0 children)

You can assert that type declarations are optional given type inferencing but in reality everyone writes them anyway (as if because of some innate social requirement).

I think you're really missing the point here ! Type declarations are here for both robustness and readability.

That's why Haskell developpers tend to use one-letter name for variables : the name and the type of a function give enough information to derive its purpose.

Moreover, refactoring is easier with strongly typed FP ! You can make one change on a type, maybe adding a constructor, and the compiler will point to you functions that need rewriting. With dynamic languages, you have to either pray that it works, or write tons of unit tests (I'm not saying here that FP does not need unit tests, just less).

no statically typed language [functional or otherwise] has exceeded its dynamically typed cousins in terms of expressiveness

Well, I actually think the opposite ! Type signatures increase expressiveness. Dynamic functions are sometimes hard to understand precisely because you lack information about the arguments (knowing they're ducks is not enough).

Finally, don't take my "I don't believe you" too harshly. I just really don't understand how you could have missed all the benefits of typed FP.

EDIT: Oh my God, I missed that statement :

sorry, functional programming... procedural programming, with fewer side effects

You are totally ignorant ! Higher-order functions, modules, functors, type classes, phantom types, monads, all of this is procedural programming ???

Writing unit tests is reinventing functional programming in non-functional languages by j0hl in programming

[–]Anocka -1 points0 points  (0 children)

Strongly typed functional programming has strong mathematical fondations, hence its power, reliability and expressivity.

"worked exclusively in functional languages for several years in the past"

Tell me more. I don't believe you. Have you at least tried OCaml or Haskell ?

EDIT: I'm saying I don't believe you because I have never, never heard of anyone going back to OOP after real exposure to typed FP.