並び順

ブックマーク数

期間指定

  • から
  • まで

41 - 59 件 / 59件

新着順 人気順

arrayの検索結果41 - 59 件 / 59件

  • GitHub - tc39/proposal-change-array-by-copy: Provides additional methods on Array.prototype and TypedArray.prototype to enable changes on the array by returning a new copy of it with the change.

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

      GitHub - tc39/proposal-change-array-by-copy: Provides additional methods on Array.prototype and TypedArray.prototype to enable changes on the array by returning a new copy of it with the change.
    • CからZigに書き直して激遅になったと思ったら最適化オプションの変更で改善した話

      メモとして残します。 MJPEGを入力してJPEGに切り出すプログラム ChatGPT-4 に作らせました。 USBカメラから入力された生のmjpegの映像データを標準入力から受けて、jpegの静止画に切り出してファイルに保存するプログラムをC言語で書いてください。書き出すファイル名はout%03d.jpg という感じでフレーム番号を含めてください。ソースコード内のコメントは英語で書いてください。 最初のものはffmpegやらたくさん外部のライブラリに依存するコードを出してきたので、もっとシンプルなやつにしてくれとお願いしました。できたものはこれ。[1] #include <stdio.h> #include <fcntl.h> #include <unistd.h> #define BUF_SIZE 1024 #define OUTPUT_FILENAME_PATTERN "out%03

        CからZigに書き直して激遅になったと思ったら最適化オプションの変更で改善した話
      • GitHub - miguelmota/golang-for-nodejs-developers: Examples of Golang compared to Node.js for learning 🤓

        You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

          GitHub - miguelmota/golang-for-nodejs-developers: Examples of Golang compared to Node.js for learning 🤓
        • GitHub - cube2222/jql: Easy JSON Query Processor with a Lispy syntax in Go

          Hey there! You're probably here cause you're fed up with other json query processors being too complicated to use for anything surpassing simple single field selection. Well, at least that's what led me here. And that's why I've written jql, a json query processor with an even more cryptic - lispy - syntax (Maybe not that cryptic after all? I quite like it :) ) jql aims to be friendly, helpful, pa

            GitHub - cube2222/jql: Easy JSON Query Processor with a Lispy syntax in Go
          • Rustで書くソートアルゴリズム - Qiita

            Emma Bostianの“De-Coding The Technical Interview Process”では、Javascriptで書かれたソートアルゴリズムがわかりやすく紹介されている。読みながら、Rustのいい紹介ないかなと探したら、ちょうどいい投稿が見つからなかったので、自分で修正しながらまとめた。 エピステミックステータス:学習中 (詳しい説明は今度追加する予定) 以下がクイックソート、マージソートとバブルソートの例: バブルソート これは一番簡単なやつ。 fn sort(array: &mut Vec<i32>) { for i in 0..array.len() { for j in 0..array.len() - i - 1 { if array[j + 1] < array[j] { // let tmp = array[j]; // array[j] = arr

              Rustで書くソートアルゴリズム - Qiita
            • Ruby(とC)でRubyを実装してみた(builtinで遊んでみた) - Qiita

              はじめに タイトルにもあるようにRubyのbuiltin(正式名称を知らないので呼び出し方法から拝借)というものを使ってRuby自体をRuby(とC)で実装してみた話です。 内容としてはRuby自体の実装に興味のある方向けの話になります。 builtinって? builtinとはRuby(とC)でRuby自体を実装するというものです(正式な名前は今のところないみたい?)。以下のように__builtin_<Cで定義した関数名>をRubyのコードから呼び出すことでRubyとCを使い、より簡単にRubyの実装を行うことができます。 たとえば、Hash#deleteはCで以下のように実装されています。 static VALUE rb_hash_delete_m(VALUE hash, VALUE key) { VALUE val; rb_hash_modify_check(hash); val =

                Ruby(とC)でRubyを実装してみた(builtinで遊んでみた) - Qiita
              • 各メジャーバージョンの Perl に同梱されている List::Util で使える関数一覧 - Qiita

                リスト処理に有用な関数群を収録している Perl モジュール List::Util はコアモジュールであり、原則的にどの Perl 環境でも同梱されています。 とはいえ、Perl のバージョンアップに伴って、同梱されている List::Util もバージョンアップしており、収録されている関数にも差異があります。2010年前後の古い Perl だと外部モジュール List::MoreUtils を別途インストールしないと出来なかったことも、2020年代の新しい Perl であれば List::Util のみで完結することもあります。 以下、Perl のバージョンと、それに同梱されている List::Util のバージョン、そしてその List::Util が提供する関数一覧を表にしてみました。なお Perl 5.8 より前のバージョンの Perl は省略しています。 Perl List::U

                  各メジャーバージョンの Perl に同梱されている List::Util で使える関数一覧 - Qiita
                • PHPerのための配列処理100本ノック

                  はじめに 「配列」は、プログラミング初学者の最初の関門のひとつであり、 そして一生の付き合いでもあります。 本記事は、PHPで配列を操作する演習問題集です。 ここに掲載している問題は全て for / foreach を使えば解けます。 初学者の方は、すぐにスマートな方法が思いつかなければ、 まずは for / foreach を使って解決してみてください。 それだけでも、十分配列の理解は深まります。 ただし、ここに掲載している問題は全て for / foreach を使わずに解けます。 ステップアップを目指す方は、ループ処理を使わない方法も考えてみてください。 使用方法 各問題のソースコードを手元のエディタに全文コピペします。 末尾の var_dump() の出力が、コメントの通りになるように、 // SOME CODE HERE // の箇所に、 処理を記述してください。 難易度:低 問

                    PHPerのための配列処理100本ノック
                  • Typing Arrays in TypeScript

                    In this blog post, we examine how Arrays can be typed in TypeScript. Roles of Arrays  # Arrays are used in the following two roles in JavaScript (and sometimes a mix of the two): Lists: All elements have the same type. The length of the Array varies. Tuple: The length of the Array is fixed. The elements do not necessarily have the same type. TypeScript accommodates these two roles by offering vari

                    • To Learn a New Language, Read Its Standard Library - Pat Shaughnessy

                      If I was learning to read English as a foreign language, I would need something simple to get started. (from The Remarkable Story of Chicken Little, 1840) The best way to learn a new programming language, just like a human language, is from example. To learn how to write code you first need to read someone else’s code. But who is the best person to learn from? Which code should we read? Where shou

                      • 池田 泰延 on Twitter: "JavaScriptの配列操作。 調べるのがいつも面倒なので、利用頻度の高いものをまとめました。 「もとの配列を変化させない」ことがポイント。 https://t.co/EXU0EoTK8L"

                        JavaScriptの配列操作。 調べるのがいつも面倒なので、利用頻度の高いものをまとめました。 「もとの配列を変化させない」ことがポイント。 https://t.co/EXU0EoTK8L

                          池田 泰延 on Twitter: "JavaScriptの配列操作。 調べるのがいつも面倒なので、利用頻度の高いものをまとめました。 「もとの配列を変化させない」ことがポイント。 https://t.co/EXU0EoTK8L"
                        • JavaScript Features To Forget · djf.log()

                          The first demo of the language that was to become JavaScript took place almost exactly 25 years ago. The language was released, as LiveScirpt, in a beta of Netscape Navigator in the fall of 1995, and renamed to JavaScript later that year. Sometime late that year I began work on the first edition (O’Reilly published it as the “beta edition”) of JavaScript: The Definitive Guide, and it was published

                          • PHP 8.1 において名前付き引数で NULL と引数省略を区別する方法

                            CREATE TABLE users( id INTEGER PRIMARY KEY, name TEXT NOT NULL, description TEXT NOT NULL ); このテーブルに関して, 「指定された ID のユーザの, 指定されたフィールドのみを 差分更新したい」 という要求があり,それに合わせて以下のように UserRepository クラスを実装した。 class UserRepository { public function update( int $id, ?string $name = null, ?string $description = null, ): void { // 処理内容はダミー $updated = []; if ($name !== null) { $updated['name'] = $name; } if ($descript

                              PHP 8.1 において名前付き引数で NULL と引数省略を区別する方法
                            • 【JavaScript】Arrayの重複を排除する最もシンプルな方法

                              RDBMSなどでは、Distinctという構文があったりするのですが、JavaScriptでは重複を排除するために少しの工夫が必要になります。 例えば、以下のような配列があるとします。 let arr = [0,1,1,2,3,4,4,4,5]; このうち、重複するデータが必要ないケースを考えてみます。 Setを使う ES2015(ES6)で導入されたSetは、今回のように重複を許さない使い方には非常に有効なオブジェクトです。 実際に配列を変換してみます。 let arr = [0,1,1,2,3,4,4,4,5]; let set = new Set(arr); console.log(set); // -> Set { 0, 1, 2, 3, 4, 5 } 簡単ですね。 SetからArrayへの変換 Arrayオブジェクトには、mapやfilterなどの便利なメソッドがありますが、Se

                              • GitHub - tc39/proposal-array-grouping: A proposal to make grouping of array items easier

                                You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                  GitHub - tc39/proposal-array-grouping: A proposal to make grouping of array items easier
                                • Array.prototype.with による不変の配列の更新  |  Blog  |  web.dev

                                  最近、配列に対して呼び出すことができる新しい相互運用可能なメソッド Array.prototype.with() がブラウザに追加されました。 この記事では、このメソッドの仕組みと、元の配列を変更せずに配列を更新する方法について説明します。 Array.prototype.with(index, value) の概要 Array.prototype.with(index, value) メソッドは、指定された新しい value に index を設定して、呼び出された配列のコピーを返します。 次の例は、年齢層の配列を示しています。配列の新しいコピーを作成し、第 2 の年齢を 15 から 16 に変更します。 const ages = [10, 15, 20, 25]; const newAges = ages.with(1, 16); console.log(newAges); // [1

                                    Array.prototype.with による不変の配列の更新  |  Blog  |  web.dev
                                  • 【PHP】参照渡しの配列の要素をunsetしても参照は解除されない - Qiita

                                    タイトルの通りです。 参照渡し(参照の代入)が推奨できるかはさておき、挙動の一例として参考にしてください。 テストデータの作成 配列$foodsを作成し、$ref_foodsへ参照を代入します。 $foods = [ 'fruits' => [ 'apple', 'orange' ], 'vegetables' => [ 'carrot', 'tomato' ] ]; $ref_foods = &$foods; var_dump($ref_foods); /* array(2) { ["fruits"]=> array(2) { [0]=> string(5) "apple" [1]=> string(6) "orange" } ["vegetables"]=> array(2) { [0]=> string(6) "carrot" [1]=> string(6) "tomato" } }

                                      【PHP】参照渡しの配列の要素をunsetしても参照は解除されない - Qiita
                                    • Zigで配列をなめるときにはできるだけwhileでなくてforを使いましょうという話

                                      まあ、当たり前のことなんですけどね。 前回の記事のプログラムを書き直した 前回の記事のMJPEGからJPEGを切り出すプログラムにはバグがありました。脚注にも書きましたが、それは読み込んだバッファの最後のバイトが0xffで、次のバッファの先頭が0xd9のときに、JPEGの終わりを見逃してしまうというものです。 なので、ちゃんと4つの状態を遷移するように書き直しました。 const std = @import("std"); const fs = std.fs; const io = std.io; const os = std.os; const BUF_SIZE = 64 * 1024; const OUTPUT_FILENAME_PATTERN = "out{d:0>4}.jpg"; const JPEG_START0 = 0xff; const JPEG_START1 = 0xd8;

                                        Zigで配列をなめるときにはできるだけwhileでなくてforを使いましょうという話
                                      • ⚙️ proconio::input!の仕組みを追ってみる | Happy developing

                                        この記事ではRustのproconio::input! macroについて書きます。 documentやtest caseで想定されているユースケースをどうやって実現しているのかを追っていきます。 versionは記事を書いている時点で最新のp-v0.4.3 を対象にしています。 proconio::input! とはproconio とは以下のREADME にあるように競技プログラミングで利用されることを意図したIO libraryです。 Easy IO library for competitive programming. proconio provides an easy way to read values from stdin (or other source). The main is input! macro. input! は出題としてstdinからあたえられる入力を読み

                                        新着記事