comparison clojure/com/aurellem/run/bootstrap_0.clj @ 293:4a0dbaed7078

preliminary idea for a better pre-bootstrapping program.
author Robert McIntyre <rlm@mit.edu>
date Fri, 30 Mar 2012 18:14:14 -0500
parents c8b0db518de3
children 659a9c84c785
comparison
equal deleted inserted replaced
291:c8b0db518de3 293:4a0dbaed7078
721 721
722 ;; begin deposit 722 ;; begin deposit
723 (menu [[:d] [:a]]) 723 (menu [[:d] [:a]])
724 (do-nothing 40)))) 724 (do-nothing 40))))
725 725
726 (defn deposit-one-item
727 [script]
728 (->> script
729 (do-nothing 100)
730 (play-moves [[:a]])
731 (do-nothing 80)
732 (play-moves [[:a]])
733 (scroll-text)
734 ))
735 726
736 (defn multiple-times 727 (defn multiple-times
737 ([n command args script] 728 ([n command args script]
738 (reduce (fn [script _] 729 (reduce (fn [script _]
739 (apply command (concat args [script]))) 730 (apply command (concat args [script])))
740 script 731 script
741 (range n))) 732 (range n)))
742 ([n command script] 733 ([n command script]
743 (multiple-times n command [] script))) 734 (multiple-times n command [] script)))
744 735
745 (defn create-header 736 (defn deposit-n-items
737 [n script]
738 (->> script
739 (do-nothing 100)
740 (play-moves [[:a]])
741 (do-nothing 80)
742 (multiple-times
743 (dec n)
744 (fn [script]
745 (->> script
746 (play-moves [[:u]])
747 (do-nothing 1))))
748 (play-moves [[:a]])
749 (scroll-text)))
750
751
752 (defn-memo create-header
746 ([] (create-header (begin-deposits))) 753 ([] (create-header (begin-deposits)))
747 ([script] 754 ([script]
748 (->> script 755 (->> script
749 (multiple-times 34 deposit-one-item) 756 (multiple-times 33 deposit-one-item)
750 ;;(deposit-one-item)
751 ;;(deposit-one-item)
752 (do-nothing 1)))) 757 (do-nothing 1))))
753 758
754 759
755 760