Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scheme help (unbound error)
#2
Far from a Scheme expert(*), but I would expect to do something like:
Code:
(if (> ((string-length g1Text)  0)
that would entirely side-step the issue.

Also it is usually considered good style to use "guard clauses" to avoid putting the bulk of the code in a nested condition. In other words, instead of doing:
Code:
if (some-condition)
    do a lot of things
else
    complain about some-condition not met
endif
return
Good style would be:
Code:
if (not some-condition)
  complain and return
# from that point everything is fine...

do a lot of things
return

This becomes even more necessary when you have several conditions.

(*) We are in the third millennium, why don't you use Python instead of a 1950-era language?
Reply


Messages In This Thread
Scheme help (unbound error) - by ssallen - 12-21-2017, 08:31 PM
RE: Scheme help (unbound error) - by Ofnuts - 12-21-2017, 09:25 PM
RE: Scheme help (unbound error) - by ssallen - 12-21-2017, 09:41 PM
RE: Scheme help (unbound error) - by Ofnuts - 12-21-2017, 10:47 PM

Forum Jump: