Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

A student's question

Name: Anonymous 2011-05-30 12:20

My teacher keeps drilling into our collective heads that using the break command is harmful, and that if we wish to terminate a loop early it would be far better to create a boolean variable, set it to 0, and add a condition to the head of the loop, and set the boolean variable to 1 when a break is needed. Note that this way you actually have to check this every single loop (where it is not needed almost every time) as well as waste a command to reset the boolean in case it was set to true.

Is there a reason to this?

Name: Anonymous 2011-05-30 21:17

>>78

$ mzscheme
Welcome to MzScheme v372 [3m], Copyright (c) 2004-2007 PLT Scheme Inc.
    (define this-function
      (make-parameter #f))

    (define-syntax-rule (defun f args . body)
      (define (f . args)
        (parameterize ((this-function 'f))
          . body)))

    (defun f () (this-function))
    (f)

stdin::78: application: bad syntax in: (defun f args . body)
reference to undefined identifier: defun
reference to undefined identifier: f

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List