This file contains hidden or 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
| (* | |
| Simple Abstract Binding Tree implementation inspired by Robert Harper book and Neel Krishnaswami blog post: | |
| https://semantic-domain.blogspot.com/2015/03/abstract-binding-trees.html | |
| This version is not modular but it's simpler to understand. | |
| *) | |
| type var = string | |
| (* set of variables *) | |
| module V = Set.Make(struct type t = var let compare = compare end) |
This file contains hidden or 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
| ################################################################################# | |
| def foobar | |
| if hello | |
| 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' | |
| end | |
| end |
This file contains hidden or 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
| def check_target_ruby | |
| return if KNOWN_RUBIES.include?(target_ruby_version) | |
| msg = if OBSOLETE_RUBIES.include?(target_ruby_version) | |
| "Unsupported Ruby version #{target_ruby_version} found in " \ | |
| "#{target_ruby_source}. #{target_ruby_version}-compatible " \ | |
| 'analysis was dropped after version ' \ | |
| "#{OBSOLETE_RUBIES[target_ruby_version]}." | |
| else | |
| "Unknown Ruby version #{target_ruby_version.inspect} found in " \ |
This file contains hidden or 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
| ###################################################################### | |
| # INPUT MODULE | |
| import copy | |
| class LineStorage: | |
| def __init__(self, linelist): | |
| self.line_storage = copy.copy(linelist) | |
| def lines(self): | |
| return len(self.line_storage) |
This file contains hidden or 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
| ###################################################################### | |
| # INPUT MODULE | |
| import copy | |
| class LineStorage: | |
| def __init__(self, linelist): | |
| self.line_storage = copy.copy(linelist) | |
| def lines(self): | |
| return copy.copy(self.line_storage) |
This file contains hidden or 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
| # Ability to go back into the past, and see what a user's todo list | |
| # looked like at any point in time. | |
| # Explain how this would work for todo lists that already exist. | |
| # | |
| # This feature wouldn't work for a time before it was implemented. | |
| # Every modification made in a list would create a new record, | |
| # the list would be immutable. If a user choose to go back in time | |
| # we could delete the versions that were created after the time selected. | |
| class User |
This file contains hidden or 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
| 1. Derive a program with the following precondition and postcondition: | |
| { x > 0 } S { x − 1 > 0 } | |
| Draft: | |
| { [E/v]x-1>0 } x := E { x−1>0 } | |
| { [E/x]x-1>0 } x := E { x−1>0 } | |
| { [x+1/x]x-1>0 } x := x+1 { x-1>0 } | |
| { x>0 } x := x+1 { x-1>0 } | |
| Proof: |
This file contains hidden or 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 FieldName: | |
| def __init__(self, name): | |
| self.name = name.lower() | |
| def __str__(self): | |
| return self.name | |
| def __hash__(self): | |
| return hash(self.name) |
This file contains hidden or 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
| # Ability to go back into the past, and see what a user's todo list | |
| # looked like at any point in time . | |
| # Explain how this would work for todo lists that already exist. | |
| # | |
| # Since I haven't implemented any timestamp tracking for the resources and | |
| # my repository is deleting resources from the project, it seems like | |
| # that this feature wouldn't work for a time before it was implemented. | |
| # A possible implementation would be to add a timestamp and a flag to every | |
| # entity and change the delete and update method in the repository to just | |
| # set the flag as 1 and create a new entity. |
This file contains hidden or 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
| require 'pry' | |
| class Position | |
| attr_reader :row, :column | |
| def initialize(row:, column:) | |
| @row = row | |
| @column = column | |
| end |
NewerOlder