1's NONE1 LDAA TEMP ;reload accumulator A LSL MASK ;Shift the mask's 1 bit left BNE LOOP1 ;If we haven't finished our loop, branch LDAA #$01 ;load new mask into A STAA MASK ;store the reset mask into MASK TSX ;pull of return address and store in X PULA ;pull off A STAA TEMP ;store the value into temp TXS ;push return address back onto the stack LOOP2 LDAA TEMP ;Load A into TEMP ANDA MASK ;logical AND MASK with A BNE ADD2 ;add one if we need to BRA NONE2 ADD2 INY ;increment our counter of 1's NONE2 LDAA TEMP LSL MASK ;shift our mask left by one BNE LOOP2 ;loop back until we've exhausted positions
because functions can’t have side-effects • (Every time a function is called, it must return the same result for the same parameters) • In functional reactive programming, time is an implicit parameter • This makes things easy to manage, without using monads
Signals send values over time, until they complete or error out • A signal never sends anything after completing or erring • A signal either completes, or errors out, but never both • A signal has no concept of a “current value” or “past values” • It’s like a pipe
signal • It “maps” each value sent along the signal to a new value • It then passes that new value along, creating a new signal • This is the canonical value transformation
value sent on a signal • Bindings are typically created with the RAC macro • All bindings created with the RAC macro are one-way • Bindings are the secret sauce that hold apps together
Touch isn’t built on FRP, so we need side-effects • RACObserve captures self in its scope implicitly • Avoid reference cycles! • Network results are delivered on a background scheduler • Use deliverOn: to reschedule them