<commit_before><html>
  <head>
    <script src="../lib/jquery.js"></script>
    <script src="../dist/Bacon.js"></script>
    <script>
      $(function() {
        function isEmpty(s) { return s.length == 0 }

        function always(value) { return function() { return value }}
        
        function keyCodeIs(keyCode) { 
          return function(event) { return event.keyCode == keyCode }
        }

        function keyDownEvents(keyCode) { 
          return $(document).asEventStream("keydown").filter(keyCodeIs(keyCode))
        }

        function keyUpEvents(keyCode) { 
          return $(document).asEventStream("keyup").filter(keyCodeIs(keyCode))
        }

        function keyStateProperty(keyCode) { 
          return keyDownEvents(keyCode).map(always("DOWN"))
            .merge(keyUpEvents(keyCode).map(always("UP")))
            .toProperty("UP")
        }

        $("#clikme")
          .asEventStream("click")
          .subscribe(function(event) { alert("mmmm... bacon!") })

        keyStateProperty(32)
          .onValue(function(value) { $("#spacebar-value").text(value) })

        $("#enabling input")
          .asEventStream("keyup")
          .map(function(event) { return $(event.target).val() })
          .toProperty("")
          .map(isEmpty)
          .assign($("#enabling button"), "attr", "disabled")

        $('#echo input')
          .asEventStream('keyup')
          .map(function(e) { return $(e.target).val() })
          .onValue(function(str) { $('#echo .output').text(str) })
      })
    </script><commit_msg>Make echo example more consistent with others, take advantage of `assign`<commit_after><html>
  <head>
    <script src="../lib/jquery.js"></script>
    <script src="../dist/Bacon.js"></script>
    <script>
      $(function() {
        function isEmpty(s) { return s.length == 0 }

        function always(value) { return function() { return value }}
        
        function keyCodeIs(keyCode) { 
          return function(event) { return event.keyCode == keyCode }
        }

        function keyDownEvents(keyCode) { 
          return $(document).asEventStream("keydown").filter(keyCodeIs(keyCode))
        }

        function keyUpEvents(keyCode) { 
          return $(document).asEventStream("keyup").filter(keyCodeIs(keyCode))
        }

        function keyStateProperty(keyCode) { 
          return keyDownEvents(keyCode).map(always("DOWN"))
            .merge(keyUpEvents(keyCode).map(always("UP")))
            .toProperty("UP")
        }

        $("#clikme")
          .asEventStream("click")
          .subscribe(function(event) { alert("mmmm... bacon!") })

        keyStateProperty(32)
          .onValue(function(value) { $("#spacebar-value").text(value) })

        $("#enabling input")
          .asEventStream("keyup")
          .map(function(event) { return $(event.target).val() })
          .toProperty("")
          .map(isEmpty)
          .assign($("#enabling button"), "attr", "disabled")

        $("#echo input")
          .asEventStream("keyup")
          .map(function(event) { return $(event.target).val() })
          .toProperty("")
          .assign($("#echo .output"), "text")
      })
    </script>
{'fraction_non_alphanumeric': 0.17037269025994362, 'fraction_numerical': 0.0018791105543376136, 'mean_word_length': 2.259183673469388, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1034748', 'n_tokens_mistral': 928, 'n_tokens_neox': 903, 'n_words': 150}