Re: Mentoring euphoria on Exercism

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...

Can you give me a the TL;DR of mentoring? I see your "raindrops" code. What now?

So the student wants to know how to be a better Euphoria programmer. You look at the code, stifle a yawn, stifle a face-palm, and then carefully suggest remediation. Give links to resources. You're not giving them the answers. You're walking alongside.

So Pete had a go at mentoring and suggested

You could use "result &=" instead of result = result &" (times 3) 
 
Were this Phix I'd probably also suggest for nr in {{3,"Pling"},{5,"Plang"},{7,"Plong"}} do.. 

From that I used &= and approximated the Phix with

include std/text.e  
include std/math.e  
 
public function raindrops( atom n ) 
    sequence result = "" 
    sequence rules = {{3,"Pling"},{5,"Plang"},{7,"Plong"}} 
    for i = 1 to length(rules) do 
        sequence rule = rules[i] 
        if (mod(n, rule[1])) = 0 then 
            result &= rule[2] 
        end if 
    end for 
    if length(result) = 0 then 
        result = sprintf("%d", n) 
    end if 
    return result 
end function 

The full Mentoring blurb is here: https://exercism.org/docs/mentoring

-Bruce

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu