This file contains hidden or 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
| continuousIncrementDecrement : Msg -> Int -> Model -> Model | |
| continuousIncrementDecrement msg num currentCounter = | |
| List.foldl (\_ cc -> update msg cc |> Tuple.first) currentCounter (List.repeat num ()) |
This file contains hidden or 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
| class MyHash | |
| attr_accessor :table | |
| def initialize | |
| @table = Array.new(100) | |
| end | |
| def get(key) | |
| table[hash(key)] | |
| end |
This file contains hidden or 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
| #初期設定 | |
| capacity = 500 | |
| numOfGene = 20 | |
| numOfElement = 50 | |
| maxGoodsWeight = 20 | |
| maxGoodsValue = 10 | |
| weight = Array.new(numOfElement) | |
| value = Array.new(numOfElement) | |
| for i in 0..numOfElement-1 |
This file contains hidden or 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 * as index from '../index'; | |
| describe('Tests', () => { | |
| describe('isMan /* index.tsで書いた関数名 */', () => { | |
| it('manなら男' /* 渡した文字列はmanですか? という質問が正しいなら男 */, () => { | |
| expect(index.isMan('man' /* sex = 'man' */)).toBeTruthy(); | |
| }); | |
| it('womanなら男ではない' /* 渡した文字列はmanですか? という質問が正しくないなら男ではない*/, () => { | |
| expect(index.isMan('woman')).toBeFalsy(); | |
| }); |
This file contains hidden or 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 * as index from '../index'; | |
| describe('Tests', () => { | |
| describe('isAdult /* index.tsでexportした関数名が入る */', () => { | |
| it('18歳なら大人' /* isAdult(大人ですか?) という質問に対して trueなので大人 */, () => { | |
| expect(index.isAdult(18 /* age */)).toBeTruthy(); | |
| }); | |
| it('17歳なら子供' /* isAdult(大人ですか?) という質問に対して trueなので子供 */, () => { | |
| expect(index.isAdult(17 /* age */)).toBeFalsy(); | |
| }); |
This file contains hidden or 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
| -- 重い処理の結果、数字を返す関数。Futureと同じ。 | |
| -- https://package.elm-lang.org/packages/elm/core/latest/Task#succeed | |
| heavyTask : Int -> Task () Int | |
| heavyTask n = | |
| Task.succeed n | |
| tasks : Int -> String -> Task () String | |
| tasks n result = | |
| heavyTask n |
This file contains hidden or 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
| type Tree | |
| = Node Tree Int Tree | |
| | Empty | |
| empty : Int -> Tree | |
| empty v = | |
| Node Empty v Empty | |
This file contains hidden or 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
| type Tree | |
| = Node Tree Int Tree | |
| | Nil | |
| leaf : Int -> Tree | |
| leaf v = | |
| Node Nil v Nil | |
This file contains hidden or 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
| jsonResolver : D.Decoder a -> Http.Resolver Http.Error a | |
| jsonResolver decoder = | |
| Http.stringResolver <| | |
| \response -> | |
| case response of | |
| Http.BadUrl_ url -> | |
| Err (Http.BadUrl url) | |
| Http.Timeout_ -> | |
| Err Http.Timeout |
This file contains hidden or 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
| module Main exposing (OriginalFoo, json2OriginalFoo) | |
| import Browser | |
| import Html exposing (Html, div, h1, img, text) | |
| import Html.Attributes exposing (src) | |
| import Json.Decode as D exposing (Decoder) | |
| import Task as Task exposing (Task) | |
| type alias OriginalFoo = |