News for hackers. Stuff that matters.
Re:Making the obvious code fast (2016) by carapace on Wednesday April 17, 2019 @04:03PM (#19685972)
FWIW, working in the Joy language you could write this:

    [dup *] map sum
And given the definition of sum (the Joy combinator step is like fold),

    sum == 0 swap [+] step
There could be a (pre-)compilation transform that generated:

    0 swap [dup * +] step
From which the proverbial "sufficiently smart compiler" would generate SIMD instructions. (I'm working on that now, in Prolog. At this point the type-inferencer can already tell that this function expects a list of numbers and returns a single number (it's a "Catamorphism"[1].) But I'm nowhere near specializing the output code to SIMD. My target architecture is Prof. Wirth RISC machine for Project Oberon. However, there's a body of research on Prolog compilation that includes work on retargeting machine code generator generators, so there's that.)

[1] http://joypy.osdn.io/notebooks/Recursion_Combinators.html

There are no comments on this comment yet.