dan.ml.901
2019-10-22 18:46:26

is there a modulo on reals in racket?


dan.ml.901
2019-10-22 18:50:46
(require ffi/unsafe)
(define fmod (get-ffi-obj 'fmod #f (_fun _double _double -> _double)))

:sweat_smile:


dan.ml.901
2019-10-23 01:47:26

also, why no for/string?


zenspider
2019-10-23 02:21:03

because it probably wouldn’t be used very much? should be easy for you to compose if you want it


samdphillips
2019-10-23 02:32:56

Also would for/string take a single character per iteration? Or could it take strings and perform string-append (or similar) at the end? I think questions like this are why some things don’t exist.


notjack
2019-10-23 03:53:03

@dan.ml.901 If you like, you can use reducers to achieve that:

#lang racket

> (require rebellion/streaming/reducer)

> (for/reducer into-string
               ([ch (in-string "Hello world")])
    (char-upcase ch))
"HELLO WORLD"

Docs here: https://docs.racket-lang.org/rebellion/Reducers.html