"Omid Mo'menzadeh" <[email protected]> writes: > Thank you for your reply. This is working, but like this: > main = #(if (not (defined? 'is-loaded-file)) > #{ > \score { \vocal } > #} > ) > > \main > > Any idea why it wouldn't work without defining the main variable? It's fine > for me, but I don't get why the following snippet does not work for me: > #(if (not (defined? 'is-loaded-file)) > #{ > \score { \vocal } > #} > )
#... at the top level is executed but not interpreted. That is because it may contain things like assignments where the value is irrelevant. If you want to force interpretation of the result, use $ instead of # . In fact, apart from requiring a variable name instead of a Scheme expression behind it $ and \ behave the same, so you could write $main instead of \main , and you could write $(if (not (defined? ... . There is a wrinkle here: what happens if the condition is not met? In that case, $... would want to interpret whatever value (if #f #f) returns. This value is undefined, but Guile specifically returns *undefined* (a special value) in this case and LilyPond has been wired to do nothing given $*undefined* so this happens to work as expected anyway. -- David Kastrup
