09.qmd (5816B)
1 --- 2 title: Cohort 9 3 --- 4 5 {{< video https://www.youtube.com/embed/WaGydI-0eDk >}} 6 7 <details> 8 9 <summary>Meeting chat log</summary> 10 ``` 11 00:09:26 Jo Hardin: sorry, didn’t mean to have my mic on! i’m driving in the car, so won’t be able to say much. 12 00:09:34 Olivier Leroy: Reacted to "sorry, didn’t mean t..." with 👍 13 00:09:38 Jo Hardin: *i’m not actually *driving*. 14 00:10:45 Tinashe Tapera: American holidays are so rare I was so surprised when I moved here 15 00:13:10 Derek Sollberger (he/him): Yes, kudos for making the slides! 16 00:13:27 Steffi LaZerte (she/her): Reacted to "Yes, kudos for makin..." with 💯 17 00:14:01 Olivier Leroy: Reacted to "Yes, kudos for makin..." with 💯 18 00:18:21 Olivier Leroy: I have done a quick check on internet and did not find good ressource on dynamic / lexical scoping (except an SO post) 19 00:18:33 Jo Hardin: Reacted to "I have done a quick ..." with 👍 20 00:22:12 Steffi LaZerte (she/her): I think env_parents() stops if you use a created environment 21 00:24:08 Derek Sollberger (he/him): Replying to "I think env_parents(..." 22 23 It seems like every week we learning something new that was brought by rlang or the tidyverse :-) 24 00:24:29 Olivier Leroy: ecur <- globalenv() # starting point 25 repeat { 26 cat(paste0(format(ecur), " (", attr(ecur, "name"), ")")) # pretty-print 27 28 if (exists("<", envir=ecur, inherits=FALSE)) # look for `<` 29 cat(strrep(" ", 25), "`<` found here!") 30 cat("\n") 31 32 ecur <- parent.env(ecur) # advance to its enclosure 33 } 34 00:24:48 Olivier Leroy: https://deepr.gagolewski.com/chapter/330-environment.html 35 00:29:43 Olivier Leroy: Btw I do not understand what using random order speed up the search (I will learn it someday) 36 00:29:49 Olivier Leroy: why* 37 00:32:31 Olivier Leroy: This also help understanding some “name conflicts” order 38 00:32:42 Derek Sollberger (he/him): Reacted to "This also help under..." with 👍 39 00:33:16 Steffi LaZerte (she/her): Reacted to "This also help under..." with 👍 40 00:35:20 Jo Hardin: but what you are showing is where the function *lives* right? doesn’t the function still have its own environment? 41 00:35:45 Steffi LaZerte (she/her): Replying to "but what you are sho..." 42 43 I think only when it's run... 44 00:36:09 Olivier Leroy: Replying to "but what you are sho..." 45 46 Yes where it lives 47 00:36:10 Steffi LaZerte (she/her): Replying to "but what you are sho..." 48 49 I think there are three things: 50 00:36:11 Tinashe Tapera: Just want to include a comment: the knowledge of path searching is very useful for when you’re debugging things on your computer in general. If ever something goes wrong, look at your path in the terminal 51 52 echo $PATH 53 00:36:21 Olivier Leroy: Reacted to "Just want to include..." with 👍 54 00:36:27 Derek Sollberger (he/him): Reacted to "Just want to include..." with 👍 55 00:36:28 Steffi LaZerte (she/her): Replying to "but what you are sho..." 56 57 Where it lives, where it looks for variables, and it's environment when it runs 58 00:36:46 Jo Hardin: Reacted to "Where it lives, wher..." with 👍 59 00:37:10 Olivier Leroy: Reacted to "Where it lives, wher..." with 👍 60 00:37:57 Steffi LaZerte (she/her): Replying to "but what you are sho..." 61 62 "The distinction between binding and being bound by is subtle but important; the difference is how we find g versus how g finds its variables." 63 00:38:03 Jo Hardin: Replying to "but what you are sho..." 64 65 doesn’t it look for variables in “its environment” ? i don’t understand the different between Steffi’s last two. 66 00:39:01 Jo Hardin: Replying to "but what you are sho..." 67 68 but it always looks inside the function first because that is “the function’s environment”… and then it just keeps going up the parent chain? 69 00:39:09 Steffi LaZerte (she/her): Reacted to "but it always looks ..." with 👍🏻 70 00:39:24 Jo Hardin: Replying to "but what you are sho..." 71 72 doesn’t really matter whether the parent is global or any other environment, right? 73 00:39:35 Jo Hardin: Reacted to ""The distinction bet..." with ❤️ 74 00:41:33 Steffi LaZerte (she/her): Replying to "but what you are sho..." 75 76 I think there is a difference if it's a function you create in the global vs. one in a package environment 77 00:41:49 Steffi LaZerte (she/her): Replying to "but what you are sho..." 78 79 because package functions won't use variables in your global environment 80 00:42:09 Jo Hardin: Replying to "but what you are sho..." 81 82 well, that’s because functions in packages don’t have global as a parent. right? 83 00:42:25 Steffi LaZerte (she/her): Replying to "but what you are sho..." 84 85 Hmmm... that's a good point! 86 00:42:45 Steffi LaZerte (she/her): Reacted to "Just want to include..." with 👍 87 00:43:58 Jo Hardin: can you copy and paste your code into the chat? i’d love to play with it! 88 00:46:32 Olivier Leroy: ei$a 89 00:49:07 Diana Garcia Cortes: g <- "hello" 90 91 e1 <- env( 92 g = 10, 93 a = 78 94 ) 95 96 e1$funcion_in_e1 <- function(x = a) { 97 print(x) 98 g 99 } 100 101 fn_env(e1$funcion_in_e1) 102 e1$funcion_in_e1(e1$a) 103 00:49:36 Jo Hardin: Replying to "g <- "hello" 104 105 e1 <- ..." 106 107 thank you! 108 00:49:41 Olivier Leroy: Reacted to "g <- "hello" 109 110 e1 <- ..." with 👍 111 00:49:54 Derek Sollberger (he/him): Reacted to "g <- "hello" 112 113 e1 <- ..." with 😻 114 00:50:40 Olivier Leroy: It matter for us but not for the package namepace 115 00:58:54 Olivier Leroy: I am so bad with reading “!” 116 01:03:35 Jo Hardin: Really great, thank you! 117 01:05:04 Jo Hardin: i teach, so i like getting as much done before the semester starts. 118 01:05:21 Derek Sollberger (he/him): Reacted to "i teach, so i like g..." with 💯 119 01:05:46 Diana Garcia Cortes: Reacted to "Just want to include..." with 👍 120 01:05:54 Jo Hardin: thanks everyone. see you next week. 121 01:05:58 Tinashe Tapera: Good job everybody 122 01:06:04 Tinashe Tapera: See you next time 123 01:06:08 Olivier Leroy: End 124 ``` 125 </details>