Skip to content

Instantly share code, notes, and snippets.

View godrm's full-sized avatar

Jung Kim godrm

  • Codesquad
  • Seoul, KOREA
  • X @godrm
View GitHub Profile
@godrm
godrm / pascalTriangle.swift
Created July 11, 2017 00:00
Functional Pascal Triangle
func makePascalTriangle(numOfRows: Int) -> ([[Int]]) {
func getNextRow(_ arr: [Int]) -> [Int] {
let a = zip([0]+arr, arr+[0])
return a.map({
(e: (Int, Int)) -> Int in
e.0 + e.1
})
}
func helper(_ countDown: Int, results: [[Int]]) -> (Int, [[Int]]) {
var x : Int? = 10
//arguments
func foo(arg : Int?) {
guard let arg = arg else {
return
}
print(arg)
}
foo(arg:x)
//
// main.swift
// HelloOperator
//
// Created by JK on 09/04/2018.
// Copyright © 2018 JK. All rights reserved.
//
import Foundation
//
// MyCustomView.swift
// CustomView
//
// Created by JK on 12/04/2018.
// Copyright © 2018 JK. All rights reserved.
//
import UIKit
//
// ViewController.swift
// HelloAnimation
//
// Created by JK on 19/04/2018.
// Copyright © 2018 JK. All rights reserved.
//
import UIKit
class Entity {
var name : String = ""
init(name : String) {
self.name = name
}
}
class Order {
private (set) var id = UUID()
private (set) var date = Date()
class Customer :
Entity,
AggregateProtocol
{
private (set) var id : UUID
private (set) var email : String
private var orders : Array<Order>
//...중간생략...
class Product {
private var id = UUID()
}
class CustomOrderRequest {
private (set) var products = [Product]()
}
protocol OrderCommand {
protocol CustomerRepositoryProtocol {
}
protocol ProductRepositoryProtocol {
}
struct ConversionRate {
var fromCurrency : String
class CustomerOrderController {
private (set) var orderService : OrderService
init(service: OrderService) {
self.orderService = service
}
}