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
| import os | |
| # deafult file descriptor values of standard in and standard out | |
| STDIN_FD_DEFAULT = 0 | |
| STDOUT_FD_DEFAULT = 1 | |
| def execute_pipe(pipe_1_tokens, pipe_2_tokens): | |
| pipe_read, pipe_write = os.pipe() |
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
| import Data.Char | |
| -- what a palindrome is | |
| isPalindrome :: String -> Maybe Bool | |
| isPalindrome string = | |
| isOwnReverseMaybe (rejectEmpty (normalise string)) | |
| normalise :: String -> String | |
| normalise string = |
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
| import Data.Char | |
| spell :: Integer -> String | |
| spell int = | |
| case int of | |
| 1 -> "one" | |
| _ -> "I don't know this number!" | |
| idk :: (Num a, Ord a) => a -> a |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| 101 CONSTANT SIZE | |
| VARIABLE ARR SIZE CELLS ALLOT | |
| : INDEX ( index# -- addr ) | |
| CELLS | |
| ARR | |
| + | |
| ; |
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
| """ | |
| Each node is an instance of node class. It has data, and the nodes before and after. | |
| """ | |
| class Node(object): | |
| def __init__(self, data, prev, next): | |
| self.data = data | |
| self.prev = prev | |
| self.next = next | |
| if prev: prev.update_next(self) #in if statement to account for start | |
| def update_next(self, next): |
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
| a_list = [5, 1, 3, 8, 7, 1, 30, 6, -4, 20, 9] | |
| b_list = [5, 1, 3, 8, 7, 1, 30, 6, -4, 20, 9] | |
| #options 0 for swap, options 1 for shift | |
| def insertion_sort(the_list, options=0): | |
| x = None #x is to store the item currently being sorted | |
| i = 1 #index of currently being sorted, start at second to left most item | |
| while i < len(the_list): # move right along the list | |
| j = i - 1 #store position to move to as j |
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 Square(object): | |
| def __init__(self): | |
| self.empty = True | |
| self.player = '' | |
| class Board(object): | |
| winning_combinations = [[0, 1, 2], [3, 4, 5], [6, 7, 8], | |
| [0, 3, 6], [1, 4, 7], [2, 5, 8], | |
| [0, 4, 8], [2, 4, 6]] |