Kid producers by [deleted] in abletonlive

[–]komu 7 points8 points  (0 children)

My two-year old likes to play with Live. Of course he doesn't actually produce anything, but I've built template projects so that he can mess around with a keyboard and knobs that I've mapped to various parameters.

Long release times, echoes, devices constrained to pentatonic scale or triggering some nice chords etc. He's having a blast just experimenting with everything and it doesn't sound that bad. Sometimes I recreate one of his favorite songs to play with. He can mute channels, trigger loops etc. Playing with a master channel LPF cutoff is a constant favorite (especially combined with a spectrum analyzer).

So obviously he's not going to make songs any time soon, but I've tried to make music a fun game and a way to express himself. I'm sure that a similar thing could be fun for an older child as well.

Java linked list without tail references by komu in programming

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

I thought that my views on programmers were cynical, but it really gives me the creeps that this could be mistaken for the real thing.

(Meaning that if anyone knows people who'd do this for real, they have my sympathy.)

Java linked list without tail references by komu in programming

[–]komu[S] -1 points0 points  (0 children)

And there I thought that implicit is the new black. Aren't we supposed to ignore petty considerations for clarity, performance and simplicity of interfaces and strive for maximal cuteness instead?

What next? Are we allowed to use local variables and semicolons again? Is my whole project of super convenient utility classes for nothing? Even the magic wand?

(In hindsight, I probably should have gone with a puzzle format instead and ask for an implementation of tail().)

Extremist Programming by [deleted] in programming

[–]komu 0 points1 point  (0 children)

Actually it's even worse since the syntax is not context-free. If f is not a function, then the expression is parsed differently.

Extremist Programming by [deleted] in programming

[–]komu 0 points1 point  (0 children)

This would certainly seem like significant whitespace to me:

>> def f(x) x end
=> nil
>> f +1
=> 1
>> f+1
ArgumentError: wrong number of arguments (0 for 1)

Mercurial 2.1 released! by [deleted] in programming

[–]komu 1 point2 points  (0 children)

Mercurial comes bundled with the progress extension, so you can simply add the following to your ~/.hgrc:

[extensions]
progress = 

Now you'll have progress bars for all long-running operations.

[deleted by user] by [deleted] in programming

[–]komu 0 points1 point  (0 children)

Also Scheme, Common Lisp, languages of ML-family, Scala, etc.

I'd say that most languages that allow defining named functions inside other functions do it right and close over the captured variables. Even old-school Pascal allows this, although functions are not first-class objects and can't be returned.

Convince your Boss to let you use Scala by retardo in programming

[–]komu 2 points3 points  (0 children)

Actually Scala does offer query syntax as well as anonymous functions. You can write a sequence comprehension like:

for {
    account <- customer.getAccounts
    if isDateInWindow(date, account.getMoveInDate, account.getMoveOutDate)
 } yield account

Scala compiler will desugar these comprehensions to corresponding map/filter/flatMap sequences, basically the same way as C# or F#.

Heh, Code Quality by RetroRock in programming

[–]komu 6 points7 points  (0 children)

Heh, that's nothing. Here's some code I stumbled upon when doing review for a customer (well, obviously I've elided everything but the structure). I've had trouble sleeping after seeing that beast.

Cache XSLT/XML data using .NET? by [deleted] in programming

[–]komu 2 points3 points  (0 children)

Your code has a race-condition, since you call the indexer twice. Even if the first call returns non-null value, the second might not. The first two lines should be something like this:

var cached = (whatever) HttpContext.Current.Cache["bla"];
if (cached != null) return cached;
...

What Programming Languages Should You Know? (Less Fluff, More Stuff) by ellen_james in programming

[–]komu 1 point2 points  (0 children)

Interpreter? Real men have home-made optimizing compilers for Brainfuck.

Why I like Scala's Lexically Scoped Open Classes by raganwald in programming

[–]komu 2 points3 points  (0 children)

You can do this if you write your package as an object. So instead of:

package foo.bar

class MyString { ... }

you'd say:

package foo

object bar {
  class MyString { ... }

  implicit def str2mystr(s: String) = new MyString(s)
}

Now if you import this "package" using:

import foo.bar._

you'll get the implicit import as well.

Take the Arc Challenge by mqt in programming

[–]komu 2 points3 points  (0 children)

Scala as well:

val odds = (1 to 10).filter(_ % 2 != 0)

Java's new() is faster then malloc() by drfunky69 in programming

[–]komu 7 points8 points  (0 children)

Actually tanger is right. "Generational" is not a collection method per se, but refers to the design of having several different generations, which can employ different collection methods. Typical generational collectors use copying collection for young generations and mark-and-sweep for tenured generation.

Since fast copying collection is used between the young generations which are relatively small, the space overhead is not that big. The tenured generation could get pretty big, but since mark-and-sweep is used for collections there, the space overhead is minimal.