並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 40 件 / 158件

新着順 人気順

python for loop in list if elseの検索結果1 - 40 件 / 158件

  • とほほのHaskell入門 - とほほのWWW入門

    概要 Haskellとは 関数型言語 純粋関数型言語 インストール Haskell Stack Hello world 基本 予約語 コメント ブロック レイアウト 入出力 型 変数 数値 文字(Char) 文字列(String) エスケープシーケンス リスト([...]) タプル((...)) 演算子 関数 演算子定義 再帰関数 ラムダ式 パターンマッチ ガード条件 関数合成(.) 引数補足(@) 制御構文 do文 let文 if文 case文 where文 import文 ループ データ型 データ型(列挙型) データ型(タプル型) データ型(直和型) 新型定義 (newtype) 型シノニム (type) 型クラス (class) メイビー(Maybe) ファンクタ(Functor) アプリケイティブ(Applicative) モナド(Monad) モジュール (module) 高階関

    • CPUエミュレータをRustで自作する - Don't Repeat Yourself

      この記事は Rust Advent Calendar 2020 ならびに CyberAgent Developers Advent Calendar 25日目の記事です。 今年のはじめの頃になりますが、『CPUの創り方』という本に載っている TD4 という CPU を実装してみました。TD4 は「とりあえず動作するだけの4bit CPU」の略です。この本に載っている CPU エミュレータを実際に実装してみました。ただし、本書には GUI が載っていましたが、それは省略しました。 CPUの創りかた 作者:渡波 郁発売日: 2003/10/01メディア: 単行本(ソフトカバー) 「最近話題の RISC-V などの CPU エミュレータを作ってみたいものの、いきなり作るにはハードルが高い。何か簡単なもので素振りをして CPU の動作の仕組みをまずは知りたい」という方にはかなりオススメできる教材だ

        CPUエミュレータをRustで自作する - Don't Repeat Yourself
      • Pythonで理解するMCP(Model Context Protocol) | gihyo.jp

        動作環境 Python 3.12 ライブラリの使用バージョン gradio 5.34.2 anthropic 0.54.0 mcp 1.9.4 python-dotenv 1.1.0 仮想環境とライブラリインストール % cd mcp-host-with-gradio % python3 -m venv venv % source venv/bin/activate (venv) % pip install gradio anthropic mcp dotenv .envファイルの設定 AnthropicのAPIキーが必要です。APIキーの作成は以下を参考にしてください。APIの利用には料金がかかりますが、API従量課金であれば5ドルから始めることが可能です。 Claudeを使い始める -Anthropic .env ANTHROPIC_API_KEY=xxxxxxxxxxxxxxxxxx

          Pythonで理解するMCP(Model Context Protocol) | gihyo.jp
        • N番目の素数を求める - すぎゃーんメモ

          SNSなどで話題になっていたので調べてみたら勉強になったのでメモ。 環境 Pythonでの実装例 例1 例2 例3 エラトステネスの篩 Rustでの実装例 試し割り法 エラトステネスの篩 アトキンの篩 おまけ: GMP Benchmark 高速化のテクニック 上限個数を見積もる Wheel factorization オチ Repository References 環境 手元のMacBook Pro 13-inchの開発機で実験した。 2.8 GHz Intel Core i7 16 GB 2133 MHz LPDDR3 Pythonでの実装例 例1 最も単純に「2以上p未満のすべての数で割ってみて余りが0にならなかったら素数」とする、brute force 的なアプローチ。 import cProfile import io import pstats import sys def m

            N番目の素数を求める - すぎゃーんメモ
          • Microsoft Power Automate DesktopでRPAを実現してみる | 🌴 officeの杜 🥥

            自分自身の個人的意見としては、エンドユーザコンピューティングは大いに結構だと思ってるけれど、一方で日本でジリジリと熱さが消えつつある国内の有象無象のRPAについては滅んだほうが良いとも思ってる。理由は後述するとして、本日良いニュースが発表されました。Power Automate Desktopについて追加費用無し無償で利用可能になるとのこと。これは既にあるMicrosoft365のEnterpriseプランなどに標準で利用できてるPower Automateのデスクトップ版のようで、Windows10に標準でついてくるようになるとのこと。 ということで、現時点のMicrosoft365で使えてるPower Automate Desktopを使ってみて、どんな感じなのか?またリリース後にその違いなどをここに記述していこうかなと思っています。また、Seleniumベースのウェブ自動化についても

              Microsoft Power Automate DesktopでRPAを実現してみる | 🌴 officeの杜 🥥
            • プロと読み解くRuby 3.4 NEWS - STORES Product Blog

              プロと読み解くRuby 3.4 NEWS テクノロジー部門技術基盤グループの笹田(ko1)と遠藤(mame)です。Ruby (MRI: Matz Ruby Implementation、いわゆる ruby コマンド) の開発をしています。お金をもらって Ruby を開発しているのでプロの Ruby コミッタです。 本日 12/25 に、恒例のクリスマスリリースとして、Ruby 3.4.0 がリリースされました(Ruby 3.4.0 リリース )。今年も STORES Product Blog にて Ruby 3.4 の NEWS.md ファイルの解説をします(ちなみに、STORES Advent Calendar 2024 の記事になります。他も読んでね)。NEWS ファイルとは何か、は以前の記事を見てください。 プロと読み解く Ruby 2.6 NEWS ファイル - クックパッド開発者

                プロと読み解くRuby 3.4 NEWS - STORES Product Blog
              • The Prompt Engineering Playbook for Programmers

                Developers are increasingly relying on AI coding assistants to accelerate our daily workflows. These tools can autocomplete functions, suggest bug fixes, and even generate entire modules or MVPs. Yet, as many of us have learned, the quality of the AI’s output depends largely on the quality of the prompt you provide. In other words, prompt engineering has become an essential skill. A poorly phrased

                  The Prompt Engineering Playbook for Programmers
                • Python×株式投資:従来の100倍!銘柄選抜のバックテストを高速化した話 - Qiita

                  # ----------------------------- # 2nd Screening V1 # ----------------------------- import time global_start_time = time.time() from google.colab import drive drive.mount('/content/drive') import pandas as pd import numpy as np import os from tqdm.notebook import tqdm import yfinance as yf from curl_cffi import requests # -------------------------------------------------- # ヘルパー関数定義セクション # --------

                    Python×株式投資:従来の100倍!銘柄選抜のバックテストを高速化した話 - Qiita
                  • GPT in 60 Lines of NumPy | Jay Mody

                    January 30, 2023 In this post, we'll implement a GPT from scratch in just 60 lines of numpy. We'll then load the trained GPT-2 model weights released by OpenAI into our implementation and generate some text. Note: This post assumes familiarity with Python, NumPy, and some basic experience with neural networks. This implementation is for educational purposes, so it's missing lots of features/improv

                    • Writing a C compiler in 500 lines of Python

                      A few months ago, I set myself the challenge of writing a C compiler in 500 lines of Python1, after writing my SDF donut post. How hard could it be? The answer was, pretty hard, even when dropping quite a few features. But it was also pretty interesting, and the result is surprisingly functional and not too hard to understand! There's too much code for me to comprehensively cover in a single blog

                      • How I Use Every Claude Code Feature

                        I use Claude Code. A lot. As a hobbyist, I run it in a VM several times a week on side projects, often with --dangerously-skip-permissions to vibe code whatever idea is on my mind. Professionally, part of my team builds the AI-IDE rules and tooling for our engineering team that consumes several billion tokens per month just for codegen. The CLI agent space is getting crowded and between Claude Cod

                          How I Use Every Claude Code Feature
                        • ChatGPT Retrieval Pluginに任意のベクトル検索エンジンProviderを実装する - エムスリーテックブログ

                          Overview エムスリーエンジニアリンググループ AI・機械学習チームでソフトウェアエンジニアをしている中村(po3rin) です。検索とGoが好きです。 エムスリーではChatGPTの可能性にいち早く注目して活用を検討している段階ですが、本格的なデータ投入にはまだ懸念もあり、セキュリティチームと検討を進めている段階です。 そんな中で個人または組織のドキュメントのセマンティック検索と取得を可能にするChatGPTプラグイン「ChatGPT Retrieval Plugin」が登場しました。 github.com 情報検索好きとしては黙っていられず、外部公開用のエムスリーAI・機械学習チームのメンバー紹介ドキュメントを使ってローカルで試してみました。 # 用意したドキュメント 中村弘武は東京都在住で、エムスリーという企業で働いでいます。 エムスリーの検索基盤を主に担当しています。また、書

                            ChatGPT Retrieval Pluginに任意のベクトル検索エンジンProviderを実装する - エムスリーテックブログ
                          • LogLog Games

                            The article is also available in Chinese. Disclaimer: This post is a very long collection of thoughts and problems I've had over the years, and also addresses some of the arguments I've been repeatedly told. This post expresses my opinion the has been formed over using Rust for gamedev for many thousands of hours over many years, and multiple finished games. This isn't meant to brag or indicate su

                            • バグらせやすい書き方をすれば当然バグは出やすい - えびちゃんの日記

                              導入 rsk0315.hatenablog.com こういう話はある*1んですが、最初からバグらせやすい書き方をしておいて「バグが出たー」と言われてもそれはそうとなってしまうので、そういうのを控えるくらいのことはするべきだと思います。 書き方が悪いせいで「十分に複雑なコード」になってしまっているものもあります(もちろん概念自体が複雑なものを実装するときは複雑になって当然ですが)。 「控えるべき書き方」とか「書くときに気をつけるべきこと」とかを紹介します。 あくまで自分の主観であって、読み手の人の方針に反するのであれば強制する気はないです。「こういう書き方もあるよー」くらいに捉えてください。 導入 紹介 控えたいこと フラグ変数を乱用しない デバッグは標準エラー出力に書く 出力パートは一箇所にまとめる 計算パートと入出力パートは分ける いくつかの具体例だけで考察を終わらせない 書きながら気を

                                バグらせやすい書き方をすれば当然バグは出やすい - えびちゃんの日記
                              • The Scary Thing About Automating Deploys - Engineering at Slack

                                Most of Slack runs on a monolithic service simply called “The Webapp”. It’s big – hundreds of developers create hundreds of changes every week. Deploying at this scale is a unique challenge. When people talk about continuous deployment, they’re often thinking about deploying to systems as soon as changes are ready. They talk about microservices and 2-pizza teams (~8 people). But what does continuo

                                • Prototyping in Rust | corrode Rust Consulting

                                  Programming is an iterative process - as much as we would like to come up with the perfect solution from the start, it rarely works that way. Good programs often start as quick prototypes. The bad ones stay prototypes, but the best ones evolve into production code. Whether you’re writing games, CLI tools, or designing library APIs, prototyping helps tremendously in finding the best approach before

                                    Prototyping in Rust | corrode Rust Consulting
                                  • 📖 vLLMのコードを読んでみよう - ENGINEERING BLOG ドコモ開発者ブログ

                                    こんにちは、NTTドコモR&D戦略部の門間です。 この記事では、vLLMのコードを追いつつその中身の動きに迫りたいと思います。 最近、業務やプライベートでLLM関連のいろいろを触っていますが、 OSSのコードリーディングを通じてLLMの推論処理への理解を深めたいというモチベーションです。 🤖 vLLMって? 📚 前提知識 Attention Is All You Need Paged Attention Continuous Batching 📦 vLLMの開発用インストール (Pythonコード開発のみ) Wheelのインストール リポジトリのクローン 起動確認 Pythonコードの改変 デバッガを使ったOSSのコードリーディングのススメ 🧩 vLLMのソフトウェアアーキテクチャ オンライン推論 : FastAPIサーバの立ち上げとEngineClientの生成 1. Engin

                                      📖 vLLMのコードを読んでみよう - ENGINEERING BLOG ドコモ開発者ブログ
                                    • Python 3.13 gets a JIT

                                      Happy New Year everyone! In late December 2023 (Christmas Day to be precise), CPython core developer Brandt Bucher submitted a little pull-request to the Python 3.13 branch adding a JIT compiler. This change, once accepted would be one of the biggest changes to the CPython Interpreter since the Specializing Adaptive Interpreter added in Python 3.11 (which was also from Brandt along with Mark Shann

                                        Python 3.13 gets a JIT
                                      • Changing std::sort at Google’s Scale and Beyond

                                        TL;DR; We are changing std::sort in LLVM’s libcxx. That’s a long story of what it took us to get there and all possible consequences, bugs you might encounter with examples from open source. We provide some benchmarks, perspective, why we did this in the first place and what it cost us with exciting ideas from Hyrum’s Law to reinforcement learning. All changes went into open source and thus I can

                                          Changing std::sort at Google’s Scale and Beyond
                                        • Things we learned about LLMs in 2024

                                          31st December 2024 A lot has happened in the world of Large Language Models over the course of 2024. Here’s a review of things we figured out about the field in the past twelve months, plus my attempt at identifying key themes and pivotal moments. This is a sequel to my review of 2023. In this article: The GPT-4 barrier was comprehensively broken Some of those GPT-4 models run on my laptop LLM pri

                                            Things we learned about LLMs in 2024
                                          • openai/gpt-oss-120b · Hugging Face

                                            ","eos_token":"<|return|>","pad_token":"<|endoftext|>"},"chat_template_jinja":"{#-\n In addition to the normal inputs of `messages` and `tools`, this template also accepts the\n following kwargs:\n - \"builtin_tools\": A list, can contain \"browser\" and/or \"python\".\n - \"model_identity\": A string that optionally describes the model identity.\n - \"reasoning_effort\": A string that describes t

                                              openai/gpt-oss-120b · Hugging Face
                                            • 4 Pandas Anti-Patterns to Avoid and How to Fix Them

                                              pandas is a powerful data analysis library with a rich API that offers multiple ways to perform any given data manipulation task. Some of these approaches are better than others, and pandas users often learn suboptimal coding practices that become their default workflows. This post highlights four common pandas anti-patterns and outlines a complementary set of techniques that you should use instea

                                                4 Pandas Anti-Patterns to Avoid and How to Fix Them
                                              • The Legends of Runeterra CI/CD Pipeline

                                                The Legends of Runeterra CI/CD Pipeline Hi, I’m Guy Kisel, and I’m a software engineer on Legends of Runeterra’s Production Engineering: Shared Tools, Automation, and Build team (PE:STAB for short). My team is responsible for solving cross-team shared client technology issues and increasing development efficiency. We focus on the areas that empower other teams to do more and protect the team from

                                                  The Legends of Runeterra CI/CD Pipeline
                                                • SageMakerとStep Functionsを用いた機械学習パイプラインで構築した検閲システム(後編) - コネヒト開発者ブログ

                                                  皆さん,こんにちは!機械学習エンジニアの柏木(@asteriam)です. 今回は前回のエントリーに続いてその後編になります. tech.connehito.com はじめに 後編は前編でも紹介した通り以下の内容になります. 後編:SageMakerのリソースを用いてモデルのデプロイ(サービングシステムの構築)をStep Functionsのフローに組み込んだ話 モデル学習後の一連の流れで,推論を行うためにモデルのデプロイやエンドポイントの作成をStep Functionsで実装した内容になります. 今回紹介するのは下図の青枠箇所の内容になります. 検閲システムのアーキテクチャー概略図 目次 はじめに Step Functionsを使ってサービングシステムを構築する方法 学習済みモデルを含んだ推論コンテナの設定(モデルの作成) エンドポイントの構成を設定 エンドポイントの作成とデプロイ 機械

                                                    SageMakerとStep Functionsを用いた機械学習パイプラインで構築した検閲システム(後編) - コネヒト開発者ブログ
                                                  • Gamedev in Lisp. Part 1: ECS and Metalinguistic Abstraction - cl-fast-ecs by Andrew

                                                    Gamedev in Lisp. Part 1: ECS and Metalinguistic Abstraction In this series of tutorials, we will delve into creating simple 2D games in Common Lisp. The result of the first part will be a development environment setup and a basic simulation displaying a 2D scene with a large number of physical objects. It is assumed that the reader is familiar with some high-level programming language, has a gener

                                                      Gamedev in Lisp. Part 1: ECS and Metalinguistic Abstraction - cl-fast-ecs by Andrew
                                                    • WSL2でunslothのGPROトレーニングを試してみる|noguchi-shoji

                                                      「DeepSeek-R1 の推論を自分のローカル デバイスで再現できるように」「わずか7GBのVRAMでアハ体験を」とのことなので、UnslothのGRPO(Group Relative Policy Optimizatin)トレーニングを試してみます。 今回は Phi-4 (14B)で試してみます。 You can now reproduce DeepSeek-R1's reasoning on your own local device! Experience the "Aha" moment with just 7GB VRAM. Unsloth reduces GRPO training memory use by 80%. 15GB VRAM can transform Llama-3.1 (8B) & Phi-4 (14B) into reasoning models. Blo

                                                        WSL2でunslothのGPROトレーニングを試してみる|noguchi-shoji
                                                      • RFC 9562: Universally Unique IDentifiers (UUIDs)

                                                         Internet Engineering Task Force (IETF) K. Davis Request for Comments: 9562 Cisco Systems Obsoletes: 4122 B. Peabody Category: Standards Track Uncloud ISSN: 2070-1721 P. Leach University of Washington May 2024 Universally Unique IDentifiers (UUIDs) Abstract This specification defines UUIDs (Universally Unique IDentifiers) -- also known as GUIDs (Globally Unique IDentifiers) -- and a Uniform Resou

                                                          RFC 9562: Universally Unique IDentifiers (UUIDs)
                                                        • Weird Lexical Syntax

                                                          I just learned 42 programming languages this month to build a new syntax highlighter for llamafile. I feel like I'm up to my eyeballs in programming languages right now. Now that it's halloween, I thought I'd share some of the spookiest most surprising syntax I've seen. The languages I decided to support are Ada, Assembly, BASIC, C, C#, C++, COBOL, CSS, D, FORTH, FORTRAN, Go, Haskell, HTML, Java,

                                                            Weird Lexical Syntax
                                                          • CUPID: for joyful coding

                                                            What started as lighthearted iconoclasm, poking at the bear of SOLID, has developed into something more concrete and tangible. If I do not think the SOLID principles are useful these days, then what would I replace them with? Can any set of principles hold for all software? What do we even mean by principles? I believe that there are properties or characteristics of software that make it a joy to

                                                            • Golang Mini Reference 2022: A Quick Guide to the Modern Go Programming Language (REVIEW COPY)

                                                              Golang Mini Reference 2022 A Quick Guide to the Modern Go Programming Language (REVIEW COPY) Harry Yoon Version 0.9.0, 2022-08-24 REVIEW COPY This is review copy, not to be shared or distributed to others. Please forward any feedback or comments to the author. • feedback@codingbookspress.com The book is tentatively scheduled to be published on September 14th, 2022. We hope that when the release da

                                                              • CohereLabs/c4ai-command-r-plus · Hugging Face

                                                                ","chat_template":[{"name":"default","template":"{{ bos_token }}{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% elif false == true %}{% set loop_messages = messages %}{% set system_message = 'You are Command-R, a brilliant, sophisticated, AI-assistant trained to assist human users by providing thorough responses. You

                                                                  CohereLabs/c4ai-command-r-plus · Hugging Face
                                                                • WhisperのモデルをONNXにする - TadaoYamaokaの開発日記

                                                                  WhisperのモデルをONNXに変換する方法について記述する。 Whisperのモデル WhisperのモデルはPyTorchを使ってPythonで実装されている。 そのため、実行にはPyTorchをインストールしたPython環境が必要になる。 環境構築なしでスタンドアロンで利用できると用途が広がる。 また、アプリへの組み込みも行いやすくなる。 ONNXモデル ONNXは、ニューラルネットワークの標準ファイルフォーマットである。 モデルをONNXにすると、ONNX Runtimeなどの推論用のライブラリを使って推論できる。 推論用のライブラリは、組み込みで使うことを意図しているので、スタンドアロンのアプリに組み込むことができる。 ONNXへの変換 WhisperのモデルからONNXへの変換は、pytorch.onnxを使って行う。 ただし、Whisperは、デコーダのループ処理で、前の

                                                                    WhisperのモデルをONNXにする - TadaoYamaokaの開発日記
                                                                  • Parsing SQL - Strumenta

                                                                    The code for this tutorial is on GitHub: parsing-sql SQL is a language to handle data in a relational database. If you worked with data you have probably worked with SQL. In this article we will talk about parsing SQL. It is in the same league of HTML: maybe you never learned it formally but you kind of know how to use it. That is great because if you know SQL, you know how to handle data. However

                                                                      Parsing SQL - Strumenta
                                                                    • Implementing Logic Programming

                                                                      Most of my readers are probably familiar with procedural programming, object-oriented programming (OOP), and functional programming (FP). The majority of top programming languages on all of the language popularity charts (like TIOBE) support all three to some extent. Even if a programmer avoided one or more of those three paradigms like the plague, they’re likely at least aware of them and what th

                                                                        Implementing Logic Programming
                                                                      • Building a Toy Programming Language in Python

                                                                        I thought it would be fun to go outside of my comfort zone of web development topics and write about something completely different and new, something I have never written about before. So today, I'm going to show you how to implement a programming language! The project will parse and execute programs written in a simple language I called my (I know it's a lame name, but hey, it is "my" language).

                                                                          Building a Toy Programming Language in Python
                                                                        • A new way to bring garbage collected programming languages efficiently to WebAssembly · V8

                                                                          Show navigation A recent article on WebAssembly Garbage Collection (WasmGC) explains at a high level how the Garbage Collection (GC) proposal aims to better support GC languages in Wasm, which is very important given their popularity. In this article, we will get into the technical details of how GC languages such as Java, Kotlin, Dart, Python, and C# can be ported to Wasm. There are in fact two m

                                                                          • Kalyn: a self-hosting compiler for x86-64

                                                                            Over the course of my Spring 2020 semester at Harvey Mudd College, I developed a self-hosting compiler entirely from scratch. This article walks through many interesting parts of the project. It’s laid out so you can just read from beginning to end, but if you’re more interested in a particular topic, feel free to jump there. Or, take a look at the project on GitHub. Table of contents What the pro

                                                                            • Patterns for Building LLM-based Systems & Products

                                                                              Patterns for Building LLM-based Systems & Products [ llm engineering production 🔥 ] · 66 min read Discussions on HackerNews, Twitter, and LinkedIn “There is a large class of problems that are easy to imagine and build demos for, but extremely hard to make products out of. For example, self-driving: It’s easy to demo a car self-driving around a block, but making it into a product takes a decade.”

                                                                                Patterns for Building LLM-based Systems & Products
                                                                              • LLM音声対話システムの応答を高速化してみた | CyberAgent Developers Blog

                                                                                はじめまして、CyberAgent AI Lab Intaractive Agentチームの技術研究員の大平といいます。 この記事は CyberAgent Developers Advent Calendar 2023 1日目の記事です。 ChatGPTの登場以降、自然なチャット対話はAPI呼び出しだけで簡単に実装できるようになりました。 更に人間のようなインタラクションを実現しようとすれば、音声対話に発展させたいと思う方も多いかと思われます。 しかし実際にLLMを使って音声対話システムを構築してみると、そのレスポンスの遅さに不満を感じることになります。 この記事ではよくあるシンプルなLLMを用いた音声対話に対していくつかの工夫を施し、その応答速度をできるだけ早めてみようという試みになります。 よくある構成として、以下を用います。 音声認識 Google STT LLM ChatGPT 3

                                                                                  LLM音声対話システムの応答を高速化してみた | CyberAgent Developers Blog
                                                                                • A Walk with LuaJIT

                                                                                  The following is a chronicle of implementing a general purpose zero-instrumentation BPF based profiler for LuaJIT. Some assumptions are made about what this entails and it may be helpful to read some of our other work in this area. One major change from prior efforts is that instead of working with the original Parca unwinder we are now working with the OpenTelemetry eBPF profiler. If you missed t

                                                                                    A Walk with LuaJIT