This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const allButFirst = string => string.slice(1); | |
const allButLast = string => string.slice(0, -1); | |
const lastChar = string => string[string.length - 1] | |
const evaluate = (string) => string.replace('(', '').replace(')', '').split(' '); | |
const clean = (string) => string.replace('(', '').replace(')', ''); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (crackle-pop n upto) | |
(display-value n) | |
(if (not (= n upto)) | |
(crackle-pop (+ n 1) upto))) | |
(define (display-value n) | |
(display (get-num n)) | |
(display "\n")) | |
(define (get-num n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (crackle-pop n upto) | |
(display-value n) | |
(if (not (= n upto)) | |
(crackle-pop (+ n 1) upto))) | |
(define (display-value n) | |
(display (get-value n divisible-by)) | |
(display "\n")) | |
(define (get-value n compare) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (crackle-pop n upto) | |
(display (get-value n divisible-by)) | |
(display "\n") | |
(if (not (= n upto)) | |
(crackle-pop (+ n 1) upto))) | |
(define (get-value n compare) | |
(if (not (or (compare n 3) | |
(compare n 5))) | |
n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (crackle-pop n upto) | |
(display-value n divisible-by) | |
(if (not (= n upto)) | |
(crackle-pop (+ n 1) upto))) | |
(define (display-value n compare) | |
(if (not (or (compare n 3) | |
(compare n 5))) | |
(display n)) | |
(if (compare n 3) (display "crackle")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FosterParent | |
def foster_method | |
puts "watching soccer" | |
end | |
end | |
class Child | |
def initialize | |
@type = "child" # same as before | |
super() #same as before |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FosterParent | |
def foster_method | |
puts "watching soccer" | |
end | |
end | |
class Child | |
def initialize | |
@type = "child" # same as before | |
super() #same as before |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent | |
def initialize | |
@type = "parent" | |
puts "Initializing #{type}" | |
end | |
def parent_method1 | |
puts "this is a parent method" | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent | |
def initialize | |
@type = "parent" | |
puts "Initializing parent. What're you gonna do about it?" | |
end | |
end | |
Parent.new | |
#=> Initializing parent. What're you gonna do about it? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent | |
def initialize | |
@type = "parent" | |
puts "Initializing #{type}" | |
end | |
def parent_method1 | |
puts "this is a parent method" | |
end | |