Here's a version of your code that runs in the Intermediate Student
language ("local" isn't part of Beginning Student):
(define (maxval lst)
(local ((define (aux lst max)
(cond [(null? lst) max]
[(> (car lst) max) (aux (cdr lst) (car lst))]
[
You may wish to read up on the design recipe and the necessity of ‘local’
definitions in HtDP2e:
http://www.ccs.neu.edu/home/matthias/HtDP2e/
> On Feb 13, 2017, at 3:46 PM, Angus Comber wrote:
>
> But it has to have the signature maxval lst - it is a homework problem.
>
> So I thought
But it has to have the signature maxval lst - it is a homework problem.
So I thought I would need max in the helper function. Basically to keep an
internal max saved value. Is there another way?
On 13 February 2017 at 20:38, Matthias Felleisen
wrote:
>
> Just lift aux out.
>
>
> > On Feb 13,
Just lift aux out.
> On Feb 13, 2017, at 3:18 PM, Angus Comber wrote:
>
> If I change the code to:
>
> (define (maxval lst)
>(define (aux lst max)
> (cond [(null? lst) max]
>[(> (car lst) max) (aux (cdr lst) (car lst))]
>[#t (aux (cdr lst) max)]))
>(aux
If I change the code to:
(define (maxval lst)
(define (aux lst max)
(cond [(null? lst) max]
[(> (car lst) max) (aux (cdr lst) (car lst))]
[#t (aux (cdr lst) max)]))
(aux lst 0))
and comment out #lang racket at the top of the file and select Beginning
Student as
I will definitely check out the CSS package this weekend!
On 13 Feb 2017 13:48, "Leandro Facchinetti" wrote:
> Hi all,
>
> I’m here to announce three packages I published recently, because I want
> feedback from the community:
>
> - CSS-expressions: S-expression-based CSS.
> https://docs.racke
Hi all,
I’m here to announce three packages I published recently, because I want
feedback from the community:
- CSS-expressions: S-expression-based CSS.
https://docs.racket-lang.org/css-expr/index.html
- Pollen Component: Component-based development for Pollen.
https://docs.racket-lang.org/p
7 matches
Mail list logo