freenode/#ecl - IRC Chatlog
Search
14:00:18
d3j
hiyall. I just got my first embed of ECL to work, and now it lives at the root of my program. :-) I'm an experienced C++ programmer, but new to CL. I've read halfway through a lot of books, including CLTL, and done only the most basic experimenting at the REPL, so I'm a newb. I want to learn lisp from inside my own program, but I have a hurdle first
14:06:56
d3j
I'm in windows, however my program uses a custom gui. Currently I have a simple repl in a command window that I use for debugging but my program's gui runs in another window. I'm looking for a way to convert every result printed in the repl to a string representation. This seems like a problem that should be easy to solve in lisp, but as a newb, figuring out the right place to look for a similar example or the right macro
14:11:41
jackdaniel
so if you (format nil "~A" *) you should have its string representation returned
14:20:33
jackdaniel
also if you call eval from c/xx world then you have variant which outputs string I think
14:59:30
onion
d3j: can hijack the repl, but i was doing this myself yesterday, with ocaml and also with C. the builtin ECL toplevel uses "(si:toplevel t)" but i havent found where its defined yet =)
15:46:03
d3j
thanks. I've tried the (format nil "~A" (list 1 2 3)) approach and the string I'm getting out is always a length of 78 in unknown character types. is it maybe a wide char? example here: https://paste.ee/p/o4kAU
15:48:41
d3j
of course not (list 1 2 3) but lisp("(defun last-result-to-string () (format nil \"~A\" *))");
15:58:11
jackdaniel
d3j: you may be interested in this material: https://common-lisp.net/project/ecl/#orgheadline10
16:35:03
d3j
so the to_std_string function outlined in that material is just what I'm looking for, but luckily the most dense line in the function, which I don't really understand, is the one with a non standard call to typeof so I can't just cut and paste