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
| #!/bin/bash | |
| # Required parameters: | |
| # @raycast.schemaVersion 1 | |
| # @raycast.title Column to Comma-Separated | |
| # @raycast.description Converts a column of data into a comma-separated list with single quotes and copies it to the clipboard. | |
| # @raycast.mode compact | |
| # @raycast.packageName Conversions | |
| # Optional parameters: |
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
| #!/bin/bash | |
| set -e | |
| CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/ "$1" stdout -l eng | xml esc) | |
| hex=$((cat <<EOF | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> |
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
| module Duplicate where | |
| duplicate :: [a] -> [a] | |
| duplicate [] = [] | |
| duplicate (x:xs) = [x, x] ++ duplicate xs |
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 select element for the 50 US states and District of Columbia, with two letter state codes for values. --> | |
| <select> | |
| <option value="AL">Alabama</option> | |
| <option value="AK">Alaska</option> | |
| <option value="AZ">Arizona</option> | |
| <option value="AR">Arkansas</option> | |
| <option value="CA">California</option> | |
| <option value="CO">Colorado</option> | |
| <option value="CT">Connecticut</option> | |
| <option value="DE">Delaware</option> |
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
| module AbsoluteValue where | |
| absoluteValue :: Int -> Int | |
| absoluteValue n | n >= 0 = n | |
| | otherwise = -n |
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
| module MySum where | |
| sum :: [Int] -> Int | |
| sum [] = 0 | |
| sum (x:xs) = x + sum xs |
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
| -- Problem 2: Write a function `filter'` that mimics the functionality of `filter` from the standard prelude, making use of `foldr` | |
| module MyFilter where | |
| filter' p = foldr (\x xs -> if p x then x : xs else xs) [] |
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
| -- Problem 1: Redefine Haskell's map using foldr from the standard prelude | |
| module MyMap where | |
| map' :: (a -> b) -> [a] -> [b] | |
| map' f [] = [] | |
| map' f (x:xs) = foldr (\y ys -> (f y):ys) [] xs |
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
| module SelectionSort where | |
| selSort :: (Ord a) => [a] -> [a] | |
| selSort [] = [] | |
| selSort xs = let x = maximum xs in selSort (remove x xs) ++ [x] | |
| where remove _ [] = [] | |
| remove a (x:xs) | |
| | x == a = xs | |
| | otherwise = x : remove a xs |
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
| module InsertionSort where | |
| import Data.List (insert) | |
| insertsort :: Ord a => [a] -> [a] | |
| insertsort = foldr insert [] |
NewerOlder