(def HOME "/home/") (def PORCH "/porch/") (def BOWL "/porch/bowl/") (def USER (first ($ "whoami"))) (def NAME "simon") (def PRONOUN "he") (def CAT " |\ _,,,---,,_ /,`.-'`' -. ;-;;,_ |,4- ) )-,_..;\ ( `'-' '---''(_/--' `-'\_) ") (func user-from-path (inp) (first (rest (rest (split inp "/"))))) ; get all users who have a "porch" (func get-porches () (map user-from-path (glob (concat HOME "*" PORCH)))) (func concat-star (inp) (concat " * " inp)) (func print-porches () (map print (map concat-star (get-porches)))) (func get-eats (porch) (glob (concat HOME porch BOWL "*"))) (func get-porches-with-eats () (map get-eats (get-porches))) (func locate () (glob (concat HOME "*" PORCH NAME))) (func get-random-eats () (safe-first (shuf (safe-first (shuf (get-porches-with-eats)))))) (func safe-first (inp) (if (empty? inp) () (first inp))) (func wander () (print (concat "off " PRONOUN " goes!")) (def current-location (locate)) (if (not (empty? current-location)) (print (concat "need to unlink: " (first current-location)))) ; this should probably return and not exit? (def target-eats (get-random-eats)) (if (and (list? target-eats) (empty? target-eat)) (exit)) (def target-porch (user-from-path target-eats)) ) ; end of wander ; options ;(print-porches) ;(print (->string (get-porches-with-eats))) ;(print USER) ;(print (->string (locate))) (wander)