guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scheme 101


From: bciceron
Subject: Scheme 101
Date: Tue, 27 Nov 2001 18:23:53 -0600 (CST)

hello,

the test-case:

(define (f x y) (+ x y))
(define g 'f)
(display (f 1 2))
(newline)
(display ((eval g) 1 2))
(newline)
(define ef-str "f")
((eval ef-str) 1 2)
(newline)

produce the follwoing:

3
3
ERROR: Wrong type to apply: "f"

i was expecting to get the same result with
g
and
ef-str

is there a way to use a string as a function name ?
i also tried string->symbol, eval and operator ":"
i'm pretty sure it is possible.

it would be very usefull when ef-str is read from user input for e.g

thx.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]