Re: [racket-users] recursive function with multiple arguments

2019-04-11 Thread David Storrs
Others have already given elegant solutions, but if you'd like a simple transliteration that does not require a struct, here you go: #lang racket (require math) (define (logmod y r k thetasd) (define theta (flvector-ref (flnormal-sample 0.0 thetasd 1) 0)) (list (* y (- r (* r (/ y

[racket-users] Re: recursive function with multiple arguments

2019-04-11 Thread Alex Harsanyi
On Thursday, April 11, 2019 at 1:50:23 PM UTC+8, travis@gmail.com wrote: > > Hi All, > > I'm trying to better understand recursion. I decided to rewrite the > logmodr function from this blog post > as > a recursive fun

Re: [racket-users] recursive function with multiple arguments

2019-04-11 Thread Matt Jadud
Hi Travis, Others will probably have better insights. The only part that would be able to be replaced with a recursive call in logmodr seems to be the loop itself. It is walking the list/vector y from the second element to t (which... does numeric on a vector coerce it to a length? I have no idea