Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Derek Maffett
    @DerekMaffett
    Not sure how the #map function handles proc arguments internally
    Anyways, the basic idea is just that something like { |e| e + 1 } is a function
    When it's passed into another method without first being assigned to a variable, it's referred to as a block, or anonymous function
    When that bit of code is first assigned to a variable, it's a proc
    They're basically the same concept, though - objects containing code which can be passed around.
    If I were to make a method to accept the top example, I could do this:
    def method_accepting_proc(variable, proc)
      proc.call(variable)
    end
    
    method_accepting_proc(2, x) =># 3
    Rachel Lanman
    @RSR312-206
    ok- assigned to a var is a proc, passed into another method as is creates a block?
    Derek Maffett
    @DerekMaffett
    Like that
    This function accepts a named function (proc) as a second argument, and calls it internally (here using the x I defined above)
    Alternatively
    def method_using_block(variable, &block)
      block.call(variable)
    end
    Or:
    def method_using_block(variable)
      yield(variable)
    end
    Both of those would be called like this:
    method_using_block(2) do |x|
      x + 1
    end
    
    =># 3
    Derek Maffett
    @DerekMaffett
    Don't worry if it's hard to wrap your mind around - functional programming can be crazy at times
    Rachel Lanman
    @RSR312-206
    no that makes sense - thank you!
    Derek Maffett
    @DerekMaffett
    :+1:
    Ryan Sobol
    @ryansobol
    @/all let’s meet at 7pm so everyone has time to work on the hw
    Zac Mrowicki
    @zmrow
    should be fun!
    NoahNim
    @NoahNim
    Where will we meet
    My dad might come too cause he is out here visiting
    Ryan Sobol
    @ryansobol
    @/all also want to suggest checking out this excellent Ruby resource https://github.com/neo/ruby_koans
    i think you’ll find that you have all the ruby, unix, and git knowledge to get started with these
    Ryan Sobol
    @ryansobol
    Zac Mrowicki
    @zmrow
    Those ruby_koans are pretty cool sounding! will have to check that out
    Katie Kim
    @kayeon
    haha. i just have no idea.
    NickManos
    @NickManos
    The koans are a good exercise. They really helped me think about what's actually going on with the ruby code.
    Zac Mrowicki
    @zmrow
    crap! :( wife reminded me that I have a doc's appt today at 4 on the eastside... I'm probably out since traffic's terrible on teh way back
    :( :( :( will have to catch you all another time
    Ryan Sobol
    @ryansobol
    bummer zach!
    hopefully its just a checkup
    NoahNim
    @NoahNim
    with those ruby koans should I download them onto my computer?
    Rachel Lanman
    @RSR312-206
    hi friends, I unfortunately may have to bail on drinks tonight too, I have a project at work right now that demands my undivided attention :( If I can make a dent in it before 7, I'll stop by!
    Katie Kim
    @kayeon
    awww :|
    Katie Kim
    @kayeon
    @RSR312-206 gonna be headin' to cactus soon... if you can, stop by! hope the project is goin'!!
    Jane Fung
    @janefung
    We're here at the bar
    Katie Kim
    @kayeon
    pumpkin flan!! yumma yumma
    Katie Kim
    @kayeon
    https://www.youtube.com/watch?v=EWFXttBlSJI how I feel about Ruby after an evening at cactus :D
    Jane Fung
    @janefung
    This is how I feel after an evening at cactus with awesome peeps
    Katie Kim
    @kayeon
    heh. agreed :D love the bell... i have the video of you guys dancin'! i wish there was a way to post video on here... hm, will have to figure out something
    Amanda Kom
    @mandarenee
    Noticed that Foundations III is up on CodeFellows to sign up for! Woo hoo!
    Katie Kim
    @kayeon
    did they take it down? I can't seem to find it... uh oh
    oh i see it
    Zac Mrowicki
    @zmrow
    I keep coming across kata on code wars that make you write your own tests. Am I doing the wrong ones?
    Amanda Kom
    @mandarenee
    I had to leave at 9 the last class, so I didn't hear Ryan's last words. I was expecting to get an email or something for all of the things we have to practice before Foundations III, can anybody point me to what we should be practicing? Thanks guys!
    Katie Kim
    @kayeon
    I haven't heard anything about stuff to prepare for foundations III yet either...