algorithm-archivists / algorithm-archive

A collaborative book on algorithms
https://www.algorithm-archive.org
MIT License
2.38k stars 356 forks source link

1D Convolutions: Hardcoded code strings #833

Open stormofice opened 3 years ago

stormofice commented 3 years ago

Bug Report

Description

A few code strings in this chapter are not backed by the implementation dependent code under code/. Changing these to rely on the language specific implementation will improve consistency with the other code (for example if length() is not a function in another language).

Screenshots

The aforementioned strings have been marked up here: image

For Algorithm Archive Developers

leios commented 3 years ago

I don't really know how to solve this issue. We could have a language method at the start of the file that allows us to create html variables or something that we then slot in to the text?

So like

{% method %}
{% sample lang="jl" %}
    set variables to i, j, k
{% common %}
    Set variables to some other name
{% endmethod %}

Sorry it's hand-wavey. Still thinking about it!

jiegillet commented 3 years ago

Honestly, I would probably change the text to say something like:

Finally, as we mentioned before, it is possible to center bounded convolutions by changing the location where we calculate the each point along the filter. This can be done by offsetting the filter signal

Because depending on the language, that line you reference may look vastly different. I'm working on a Haskell version and it's not there at all.

leios commented 3 years ago

To be honest, it said that originally, then I changed it due to feedback. I am happy to change it back