soegaard2
2019-8-2 16:08:28

conjoin and disjoin


jab
2019-8-2 16:17:14

Thanks!


jab
2019-8-2 17:37:33

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: +


jab
2019-8-2 17:38:26

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


jab
2019-8-2 17:38:38

Any ideas?



soegaard2
2019-8-2 17:40:37

@jab You need to give eval a namespace


soegaard2
2019-8-2 17:42:41

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


soegaard2
2019-8-2 17:42:54

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


jab
2019-8-2 17:44:41

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


soegaard2
2019-8-2 17:45:13

Note: That creates a new namespace for each symbol.


soegaard2
2019-8-2 17:45:20

You probably don’t want to do that.


jab
2019-8-2 17:46:02

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!


soegaard2
2019-8-2 17:46:41

Everyone asks that the first time they use eval.


edward.hughes1911
2019-8-2 22:46:17

@edward.hughes1911 has joined the channel