Skip to content

Instantly share code, notes, and snippets.

@marcrasi
Created July 3, 2019 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcrasi/d8797d3aa9d80a483364cec45c5cc780 to your computer and use it in GitHub Desktop.
Save marcrasi/d8797d3aa9d80a483364cec45c5cc780 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "blank_swift.ipynb",
"version": "0.3.2",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "swift",
"display_name": "Swift"
}
},
"cells": [
{
"cell_type": "code",
"metadata": {
"id": "kZRlD4utdPuX",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 476
},
"outputId": "85ab94ba-0411-4b5a-b04a-2daa5b3f3134"
},
"source": [
"%install '.package(url: \"https://github.com/NSHipster/DeckOfPlayingCards\", from: \"4.0.0\")' DeckOfPlayingCards"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"Installing packages:\n",
"\t.package(url: \"https://github.com/NSHipster/DeckOfPlayingCards\", from: \"4.0.0\")\n",
"\t\tDeckOfPlayingCards\n",
"With SwiftPM flags: []\n",
"Working in: /tmp/tmp7pzunm6d/swift-install\n",
"Fetching https://github.com/NSHipster/DeckOfPlayingCards\n",
"Fetching https://github.com/apple/example-package-fisheryates.git\n",
"Fetching https://github.com/nshipster/example-package-playingcard.git\n",
"Completed resolution in 3.66s\n",
"Cloning https://github.com/NSHipster/DeckOfPlayingCards\n",
"Resolving https://github.com/NSHipster/DeckOfPlayingCards at 4.0.0\n",
"Cloning https://github.com/apple/example-package-fisheryates.git\n",
"Resolving https://github.com/apple/example-package-fisheryates.git at 2.0.5\n",
"Cloning https://github.com/nshipster/example-package-playingcard.git\n",
"Resolving https://github.com/nshipster/example-package-playingcard.git at 4.0.0\n",
"[1/6] Compiling PlayingCard Rank.swift\n",
"[2/6] Compiling PlayingCard PlayingCard.swift\n",
"[3/6] Compiling PlayingCard Suit.swift\n",
"[4/7] Merging module PlayingCard\n",
"[7/8] Merging module FisherYates\n",
"[8/9] Compiling DeckOfPlayingCards Deck.swift\n",
"[9/10] Merging module DeckOfPlayingCards\n",
"[10/11] Compiling jupyterInstalledPackages jupyterInstalledPackages.swift\n",
"[11/12] Merging module jupyterInstalledPackages\n",
"[12/12] Linking libjupyterInstalledPackages.so\n",
"Initializing Swift...\n",
"Installation complete!\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "EnZ43tsRZDHL",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "4d260247-593a-4b1b-f0af-f040c38da5bd"
},
"source": [
"import DeckOfPlayingCards\n",
"var deck = Deck.standard52CardDeck()\n",
"deck.shuffle()\n",
"print(deck)"
],
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": [
"Deck(cards: [♢ 4, ♣︎ 4, ♣︎ 5, ♡ 5, ♠︎ 2, ♣︎ 8, ♣︎ 3, ♡ Q, ♠︎ 6, ♠︎ 10, ♠︎ 9, ♠︎ 4, ♢ 2, ♢ 8, ♣︎ 6, ♣︎ 7, ♠︎ 8, ♣︎ 2, ♣︎ A, ♠︎ 3, ♢ A, ♢ K, ♡ K, ♡ 4, ♡ A, ♠︎ 5, ♠︎ A, ♡ 7, ♣︎ K, ♡ 8, ♢ 7, ♢ 3, ♡ 6, ♡ 10, ♡ J, ♢ J, ♢ 9, ♢ 5, ♣︎ 9, ♠︎ Q, ♠︎ J, ♣︎ Q, ♠︎ K, ♣︎ 10, ♢ 10, ♡ 2, ♡ 9, ♢ 6, ♣︎ J, ♠︎ 7, ♢ Q, ♡ 3])\r\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "UYkqXsgxZTO_",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment