soegaard2
2019-5-15 18:23:22

A module form looks like: (module module-name language-name form ...).


soegaard2
2019-5-15 18:23:51

So the br is the name of the language in which the forms form ... are written in.


soegaard2
2019-5-15 18:24:33

In particular the br language has require and provide which are used in the example.


soegaard2
2019-5-15 18:25:33

Unless br has modified versions of require and provide, they are probably the same require and provide as in the racket.


soegaard2
2019-5-15 18:25:48

So (module reader racket ...) would probably also work.


diallo.ms
2019-5-15 21:25:52

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))

plragde
2019-5-16 02:12:31

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).


plragde
2019-5-16 02:13:52

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.