A module form looks like: (module module-name language-name form ...)
.
So the br
is the name of the language in which the forms form ...
are written in.
In particular the br
language has require
and provide
which are used in the example.
Unless br
has modified versions of require
and provide
, they are probably the same require
and provide
as in the racket
.
So (module reader racket ...)
would probably also work.
Hello !
Sorry for the delay, I needed to mull it over and refresh my knowledge on lazy evaluation. No-arguments lambda are not allowed in ISL+ so I did it in #lang racket.
; String -> [List-of Number]
; Returns a list of numbers corresponding to the code-point number of each character of the string s.
(define (string->int s)
(lambda ()
(map char->integer (string->list s))))
(check-equal? ((string->int "stop")) '(115 116 111 112))
(define my-list (string->int "abc"))
(foldr + 0 (my-list))
You are still doing two steps, and that’s not what I meant by delaying the conversation. I meant, without using lazy evaluation, move the conversion closer to where it is actually required (by the addition).
Here’s another hint. A foldr over something that is a map (two steps) can be made into a foldr (one step) by moving the function argument of the map into the combine argument of the foldr.