Logo - gregorymorrison/euler1 GitHub Wiki

Logo was designed as a teaching language way back in 1967, and has been hailed as one of the easiest languages - a good teaching language for children. Really? It took me around three hours to write Euler1 in Logo, and that's with the massive help of RosettaCode, reverse-engineering their examples to try to figure out what would shut the compiler up. Maybe this language was great in 1970, but time has passed it by. The only good thing I see here is the built-in graphics, which may attract your child, but is out of scope for our purposes. There's so much suckage here - the baroque syntax, the lack of documentation, the cryptic compiler errors. What do you think your child would think of this admittedly simple version of [Euler1}(http://projecteuler.net/problem=1)?

; Euler1 in Logo

to euler :size
    localmake "result 0
    for [i 1 :size-1] [
        if or [equal? 0 modulo :i 3][equal? 0 modulo :i 5] [
            make "result :result + :i]]
    output :result
end

print euler 1000

bye

At least it didn't take me that long to figure out how to execute the code - maybe 15 minutes. The runtime is a shell; you pass it your code that includes 'bye' as a final statement to terminate:

$ logo euler1.logo
233168