Skip to content

宿題013-Lambda式、匿名関数のこと #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
domanthan opened this issue Aug 31, 2018 · 0 comments
Open

宿題013-Lambda式、匿名関数のこと #13

domanthan opened this issue Aug 31, 2018 · 0 comments

Comments

@domanthan
Copy link
Contributor

domanthan commented Aug 31, 2018

Lambda式、匿名関数のこと

© Gridscale Inc. http://www.gridscale.com

前振り

Pythonはマルチパラダイム言語です。関数型オブジェクトが存在します。
ラムダ式は式を名前のない関数オブジェクトに変関数式のことです。
一つの式のためにわざわざ関数を定義したくない場合、Lamda式を使うのが有効でしょ。
でも、あまりにも乱用すると、ソースコードがあえて読みづらくなりますので、ほどほど使いましょう。

■ 関数ですから、パラメータを持つことができます。
■ 式ですから、この関数の中には一つの式しか表現できない。
Keywork: lambda

x + y         ------>  lambda (x,y) : x + y
x*2 + y*2  ----->  lambda (x,y) : x*x + y*y

要件説明

挨拶できるラムダ式を作ってくだい。
xxと渡したら、と出力。 こんにちは、xxさん。

「田中さん、こんにち」はでもいいけどね。

reference

宿題学習ポイント(Concept)

https://docs.python.jp/3/reference/expressions.html#lambda

参考実装

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# What we learn here: xxxxx

言語リファレンス

https://docs.python.org/ja/3/reference/index.html

宿題の提出について

githubに宿題をコミットする際、必ず下記の様なフォルダ構成にしたがって欲しいです。
宿題を完成させたエビデンスファイルも合わせて出してください。できれば。

     ---- 「ご自分のgithubid]  
         ---   less001  
               -- file001.py  
               -- evidence001.txt  
@domanthan domanthan changed the title 宿題013-式 (予定) 宿題013-Lambda式、匿名関数のこと Sep 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant