
Are there equivalents in Racket to Clojure’s every-pred
and some-fn
? - http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/every-pred - http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/some-fn

conjoin and disjoin

Thanks!

In the following: #lang racket
(define op-symbs '(+ - * / = < > <= >=))
(define op-procs (map eval op-symbs))
The second line gives +: unbound identifier; also, no #%top syntax transformer is bound in: +

But if I execute the second line manually in the interactions window, it works

Any ideas?


@jab You need to give eval a namespace

Do you need the namespace from within the module? A specific module? or is racket-base good enough?

For the last one, you can write: (define ns (make-base-namespace))

Thanks @soegaard2! This seems to have done the trick: (define op-symbs '(+ - * / = < > <= >=))
(define op-procs (map (λ (symb) (eval symb (make-base-namespace))) op-symbs))
(define env (list (make-hash (map cons op-symbs op-procs))))

Note: That creates a new namespace for each symbol.

You probably don’t want to do that.

Literally had just caught that and was going to post this updated version: (define op-symbs '(+ - * / = < > <= >=))
(define ns (make-base-namespace))
(define op-procs (map (λ (symb) (eval symb ns)) op-symbs))
(define env (list (make-hash (map cons op-symbs op-procs))))
Thanks!

Everyone asks that the first time they use eval.

@edward.hughes1911 has joined the channel