Skip to content

Commit

Permalink
Split some code cells in intro section
Browse files Browse the repository at this point in the history
  • Loading branch information
johnW-ret committed Apr 25, 2024
1 parent 5632236 commit 2dc4876
Showing 1 changed file with 130 additions and 13 deletions.
143 changes: 130 additions & 13 deletions index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,73 @@
"dotnet_repl_cellExecutionStartTime": "2024-02-29T00:55:59.6027499-06:00"
},
"source": [
"In F#, the `,` separates tuple elements, not collection elements. Tuples are useful for all kinds of things in F#, and the language comes with a terse syntax for representing them:"
"In F#, the `,` separates tuple elements, not collection elements."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"dotnet_interactive": {
"language": "fsharp"
},
"polyglot_notebook": {
"kernelName": "fsharp"
}
},
"outputs": [
{
"data": {
"text/html": [
"<details open=\"open\" class=\"dni-treeview\"><summary><span class=\"dni-code-hint\"><code>(1, 2)</code></span></summary><div><table><thead><tr></tr></thead><tbody><tr><td>Item1</td><td><div class=\"dni-plaintext\"><pre>1</pre></div></td></tr><tr><td>Item2</td><td><div class=\"dni-plaintext\"><pre>2</pre></div></td></tr></tbody></table></div></details><style>\r\n",
".dni-code-hint {\r\n",
" font-style: italic;\r\n",
" overflow: hidden;\r\n",
" white-space: nowrap;\r\n",
"}\r\n",
".dni-treeview {\r\n",
" white-space: nowrap;\r\n",
"}\r\n",
".dni-treeview td {\r\n",
" vertical-align: top;\r\n",
" text-align: start;\r\n",
"}\r\n",
"details.dni-treeview {\r\n",
" padding-left: 1em;\r\n",
"}\r\n",
"table td {\r\n",
" text-align: start;\r\n",
"}\r\n",
"table tr { \r\n",
" vertical-align: top; \r\n",
" margin: 0em 0px;\r\n",
"}\r\n",
"table tr td pre \r\n",
"{ \r\n",
" vertical-align: top !important; \r\n",
" margin: 0em 0px !important;\r\n",
"} \r\n",
"table th {\r\n",
" text-align: start;\r\n",
"}\r\n",
"</style>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"// two-ple\n",
"1, 2"
]
},
{
"cell_type": "markdown",
"id": "ada78109",
"metadata": {},
"source": [
"Tuples are useful for all kinds of things in F#, and the language comes with a terse syntax for representing them:"
]
},
{
Expand Down Expand Up @@ -249,9 +315,6 @@
}
],
"source": [
"// two-ple\n",
"1, 2\n",
"\n",
"// 4-ary tuple\n",
"3, 4, 5, 6\n",
"\n",
Expand Down Expand Up @@ -390,7 +453,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 2,
"id": "000ad7b4",
"metadata": {
"dotnet_interactive": {
Expand All @@ -406,7 +469,7 @@
{
"data": {
"text/html": [
"<div class=\"dni-plaintext\"><pre>[ 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5 ]</pre></div><style>\r\n",
"<div class=\"dni-plaintext\"><pre>[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</pre></div><style>\r\n",
".dni-code-hint {\r\n",
" font-style: italic;\r\n",
" overflow: hidden;\r\n",
Expand Down Expand Up @@ -446,9 +509,63 @@
],
"source": [
"// start..end (both inclusive)\n",
"[| 1 .. 10 |]\n",
"// evaluates to [| 1; 2; 3; .. 10 |]\n",
"\n",
"[| 1 .. 10 |]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"dotnet_interactive": {
"language": "fsharp"
},
"polyglot_notebook": {
"kernelName": "fsharp"
}
},
"outputs": [
{
"data": {
"text/html": [
"<div class=\"dni-plaintext\"><pre>[ 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5 ]</pre></div><style>\r\n",
".dni-code-hint {\r\n",
" font-style: italic;\r\n",
" overflow: hidden;\r\n",
" white-space: nowrap;\r\n",
"}\r\n",
".dni-treeview {\r\n",
" white-space: nowrap;\r\n",
"}\r\n",
".dni-treeview td {\r\n",
" vertical-align: top;\r\n",
" text-align: start;\r\n",
"}\r\n",
"details.dni-treeview {\r\n",
" padding-left: 1em;\r\n",
"}\r\n",
"table td {\r\n",
" text-align: start;\r\n",
"}\r\n",
"table tr { \r\n",
" vertical-align: top; \r\n",
" margin: 0em 0px;\r\n",
"}\r\n",
"table tr td pre \r\n",
"{ \r\n",
" vertical-align: top !important; \r\n",
" margin: 0em 0px !important;\r\n",
"} \r\n",
"table th {\r\n",
" text-align: start;\r\n",
"}\r\n",
"</style>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"// ..step..\n",
"[| 5 .. -1 .. -5 |]"
]
Expand Down Expand Up @@ -2860,9 +2977,9 @@
]
},
"kernelspec": {
"display_name": ".NET (F#)",
"language": "F#",
"name": ".net-fsharp"
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"language_info": {
"file_extension": ".fs",
Expand All @@ -2873,7 +2990,7 @@
},
"polyglot_notebook": {
"kernelInfo": {
"defaultKernelName": "fsharp",
"defaultKernelName": "csharp",
"items": [
{
"aliases": [],
Expand Down

0 comments on commit 2dc4876

Please sign in to comment.