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
import Foundation | |
struct LaunchProcessArgs: OptionSet { | |
let rawValue: Int | |
static let attachStdIn = LaunchProcessArgs(rawValue: 1 << 0) | |
static let attachStdOut = LaunchProcessArgs(rawValue: 1 << 1) | |
static let attachStdErr = LaunchProcessArgs(rawValue: 1 << 2) | |
static let interactive: LaunchProcessArgs = [.attachStdIn, .attachStdOut, .attachStdErr] |
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
(* Problem: Write a function that returns true | |
* when invoked with list of alternate 1's and 2's | |
* | |
* Example: | |
* matcher [1,2,1,2] | |
* matcher [1,2,1] | |
* matcher [1,2] | |
* matcher [1] | |
* | |
* all of the above should return true |
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
indirect enum IntList { | |
case empty | |
case cons(Int, IntList) | |
} | |
extension IntList { | |
static func append(_ xs: IntList, _ ys: IntList) -> IntList{ | |
switch xs { | |
case .empty: return ys; | |
case let .cons(head, tail): return .cons(head, append(tail, ys)); |
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
#!/bin/bash | |
# | |
# Faster toolchain build: skips as much as possible. | |
# | |
# To use this toolchain from the command line:" | |
# export TOOLCHAINS=$(whoami) | |
# | |
# we build to the same prefix every time (instead of building | |
# to a versioned prefix) because every time the prefix changes | |
# *everything* rebuilds. |
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
_ _ | |
| |__ | |__ __ _ _ __ __ _ __ ___ ____ _ | |
| '_ \| '_ \ / _` | '__/ _` |/ _` \ \ / / _` | | |
| |_) | | | | (_| | | | (_| | (_| |\ V / (_| | | |
|_.__/|_| |_|\__,_|_| \__, |\__,_| \_/ \__, | | |
|___/ |___/ | |
Just a dummy text file to have a proper titles for gists 😒 |
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
_ _ | |
| |__ | |__ __ _ _ __ __ _ __ ___ ____ _ | |
| '_ \| '_ \ / _` | '__/ _` |/ _` \ \ / / _` | | |
| |_) | | | | (_| | | | (_| | (_| |\ V / (_| | | |
|_.__/|_| |_|\__,_|_| \__, |\__,_| \_/ \__, | | |
|___/ |___/ | |
Just a dummy text file to have a proper titles for gists 😒 |
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
_ _ | |
| |__ | |__ __ _ _ __ __ _ __ ___ ____ _ | |
| '_ \| '_ \ / _` | '__/ _` |/ _` \ \ / / _` | | |
| |_) | | | | (_| | | | (_| | (_| |\ V / (_| | | |
|_.__/|_| |_|\__,_|_| \__, |\__,_| \_/ \__, | | |
|___/ |___/ | |
Just a dummy text file to have a proper titles for gists 😒 |
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
[ | |
{ | |
"name": { | |
"first_name": "Lex", | |
"last_name": "Luthor" | |
}, | |
"age": 28, | |
"gender": "male", | |
"address": { | |
"street": "244 Clifton Place", |
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
func makePerson(name: String) -> (age: Int) -> (status: MaritalStatus) -> (requestIDs: [Int]) -> (address: Address) -> Person { | |
return { age in { status in { requestIDs in { address in | |
Person(name: name, age: age, status: status, requestIDs: requestIDs, address: address) | |
}}}} | |
} | |
func makeAddress(flatNo: String) -> (buildingName: String) -> Address { | |
return { buildingName in | |
Address(flatNo: flatNo, buildingName: buildingName) | |
} |
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
#!/bin/bash | |
# | |
# _ _ | |
# | |__ | |__ __ _ _ __ __ _ __ ___ ____ _ | |
# | '_ \| '_ \ / _` | '__/ _` |/ _` \ \ / / _` | | |
# | |_) | | | | (_| | | | (_| | (_| |\ V / (_| | | |
# |_.__/|_| |_|\__,_|_| \__, |\__,_| \_/ \__, | | |
# |___/ |___/ | |
# | |
# title : script.sh |
NewerOlder