for n in 0..10 { // 0,1,2,3,4,5,6,7,8,9
let v = vec![4,7,8,9,11,14]
for n in &v {
arch -x86_64 zsh |
for n in 0..10 { // 0,1,2,3,4,5,6,7,8,9
let v = vec![4,7,8,9,11,14]
for n in &v {
#!/bin/bash | |
set -euo pipefail | |
# | |
# | |
# `m3u8.txt` contains urls returned by `https://www.dandanzan.com/url.php` | |
# you can get them from your browser's network tab, look for `url.php`, | |
# copy the response body, and paste into your `m3u8.txt` file | |
# | |
# |
import Url
import Url.Parser exposing ((<?>))
import Url.Parser.Query
"http://example.com/?key=Prefix%3A+Some+text+%2B+Some+words+%3D+Words+%40+%3CLast+word%3E"
|> Url.fromString
|> Maybe.andThen (Url.Parser.parse (Url.Parser.top <?> Url.Parser.Query.string "key"))
--> Just (Just "Prefix: Some text + Some words = Words @ <Last word>")
module ICal exposing | |
( VAlarmAction(..) | |
, VAlarmTrigger(..) | |
, VCalendar(..) | |
, VEvent(..) | |
, VEventProp(..) | |
, VEventStatusValue(..) | |
, eventPropString | |
, eventString | |
, string |
Should be work with 0.18
Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !
myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
module P exposing (..) | |
main : Program () number msg | |
main = | |
Platform.worker | |
{ init = always ( 0, Cmd.none ) | |
, update = \_ _ -> ( 0, Cmd.none ) | |
, subscriptions = always Sub.none | |
} |
type TrafficLight | |
= Red | |
| Yellow | |
| Green | |
allTrafficLight : List TrafficLight | |
allTrafficLight = | |
let | |
helper list = |
In a type specific module, we can name succinctly
module Channel
type Channel
= Alpha
| Beta
resource "aws_iam_role" "foobar-role" { | |
name = "foobar" | |
path = "/" | |
assume_role_policy = data.aws_iam_policy_document.foobar-assume-role-policy-document.json | |
managed_policy_arns = [aws_iam_policy.foobar-policy.arn] | |
} | |
data "aws_iam_policy_document" "foobar-assume-role-policy-document" { | |
statement { | |
actions = ["sts:AssumeRole"] |