VOTING POWER100.00%
DOWNVOTE POWER100.00%
RESOURCE CREDITS100.00%
REPUTATION PROGRESS0.00%
Net Worth
0.034USD
STEEM
0.001STEEM
SBD
0.000SBD
Effective Power
5.001SP
├── Own SP
0.629SP
└── Incoming DelegationsDeleg
+4.372SP
Detailed Balance
| STEEM | ||
| balance | 0.001STEEM | STEEM |
| market_balance | 0.000STEEM | STEEM |
| savings_balance | 0.000STEEM | STEEM |
| reward_steem_balance | 0.000STEEM | STEEM |
| STEEM POWER | ||
| Own SP | 0.629SP | SP |
| Delegated Out | 0.000SP | SP |
| Delegation In | 4.372SP | SP |
| Effective Power | 5.001SP | SP |
| Reward SP (pending) | 0.000SP | SP |
| SBD | ||
| sbd_balance | 0.000SBD | SBD |
| sbd_conversions | 0.000SBD | SBD |
| sbd_market_balance | 0.000SBD | SBD |
| savings_sbd_balance | 0.000SBD | SBD |
| reward_sbd_balance | 0.000SBD | SBD |
{
"balance": "0.001 STEEM",
"savings_balance": "0.000 STEEM",
"reward_steem_balance": "0.000 STEEM",
"vesting_shares": "1023.510396 VESTS",
"delegated_vesting_shares": "0.000000 VESTS",
"received_vesting_shares": "7120.149410 VESTS",
"sbd_balance": "0.000 SBD",
"savings_sbd_balance": "0.000 SBD",
"reward_sbd_balance": "0.000 SBD",
"conversions": []
}Account Info
| name | damii |
| id | 637957 |
| rank | 357,335 |
| reputation | 3988495 |
| created | 2018-01-22T09:48:15 |
| recovery_account | steem |
| proxy | None |
| post_count | 4 |
| comment_count | 0 |
| lifetime_vote_count | 0 |
| witnesses_voted_for | 0 |
| last_post | 2019-01-02T12:54:30 |
| last_root_post | 2019-01-02T12:54:30 |
| last_vote_time | 2019-01-22T14:29:06 |
| proxied_vsf_votes | 0, 0, 0, 0 |
| can_vote | 1 |
| voting_power | 0 |
| delayed_votes | 0 |
| balance | 0.001 STEEM |
| savings_balance | 0.000 STEEM |
| sbd_balance | 0.000 SBD |
| savings_sbd_balance | 0.000 SBD |
| vesting_shares | 1023.510396 VESTS |
| delegated_vesting_shares | 0.000000 VESTS |
| received_vesting_shares | 7120.149410 VESTS |
| reward_vesting_balance | 0.000000 VESTS |
| vesting_balance | 0.000 STEEM |
| vesting_withdraw_rate | 0.000000 VESTS |
| next_vesting_withdrawal | 1969-12-31T23:59:59 |
| withdrawn | 0 |
| to_withdraw | 0 |
| withdraw_routes | 0 |
| savings_withdraw_requests | 0 |
| last_account_recovery | 1970-01-01T00:00:00 |
| reset_account | null |
| last_owner_update | 2018-12-07T20:59:54 |
| last_account_update | 2018-12-07T20:59:54 |
| mined | No |
| sbd_seconds | 0 |
| sbd_last_interest_payment | 1970-01-01T00:00:00 |
| savings_sbd_last_interest_payment | 1970-01-01T00:00:00 |
{
"id": 637957,
"name": "damii",
"owner": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM5fEeQHzKqxKrbMM3W94ZBE84ucRwtvPDdfCaBt4aMhotQ1u3DL",
1
]
]
},
"active": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM8cNV4yHHRWQYiUZA8ue7RZ6tL6acC3h79VsX6pAETWztrQg8je",
1
]
]
},
"posting": {
"weight_threshold": 1,
"account_auths": [
[
"busy.app",
1
],
[
"dtube.app",
1
]
],
"key_auths": [
[
"STM5hSnVkFPRUvLRhxSCug18RnTiG47GGCarcNRL8s8BtrTfyn4AE",
1
]
]
},
"memo_key": "STM5xVLrJ4uW4xhXRGo8KdbBjf7bwBcEzgAPP7vzWppptP1igfgZD",
"json_metadata": "{\"profile\":{\"name\":\"damii\",\"website\":\"http://www.damii.pl\",\"about\":\"Dariusz Mikołajczyk\",\"location\":\"Poland\",\"profile_image\":\"http://www.damii.pl/images/misc/DariuszMikolajczyk.jpg\",\"cover_image\":\"http://www.damii.pl/images/artwork/Moja_Pasieka_06.jpg\"}}",
"posting_json_metadata": "{\"profile\":{\"name\":\"damii\",\"website\":\"http://www.damii.pl\",\"about\":\"Dariusz Mikołajczyk\",\"location\":\"Poland\",\"profile_image\":\"http://www.damii.pl/images/misc/DariuszMikolajczyk.jpg\",\"cover_image\":\"http://www.damii.pl/images/artwork/Moja_Pasieka_06.jpg\"}}",
"proxy": "",
"last_owner_update": "2018-12-07T20:59:54",
"last_account_update": "2018-12-07T20:59:54",
"created": "2018-01-22T09:48:15",
"mined": false,
"recovery_account": "steem",
"last_account_recovery": "1970-01-01T00:00:00",
"reset_account": "null",
"comment_count": 0,
"lifetime_vote_count": 0,
"post_count": 4,
"can_vote": true,
"voting_manabar": {
"current_mana": "8143659806",
"last_update_time": 1779059388
},
"downvote_manabar": {
"current_mana": 2035914951,
"last_update_time": 1779059388
},
"voting_power": 0,
"balance": "0.001 STEEM",
"savings_balance": "0.000 STEEM",
"sbd_balance": "0.000 SBD",
"sbd_seconds": "0",
"sbd_seconds_last_update": "1970-01-01T00:00:00",
"sbd_last_interest_payment": "1970-01-01T00:00:00",
"savings_sbd_balance": "0.000 SBD",
"savings_sbd_seconds": "0",
"savings_sbd_seconds_last_update": "1970-01-01T00:00:00",
"savings_sbd_last_interest_payment": "1970-01-01T00:00:00",
"savings_withdraw_requests": 0,
"reward_sbd_balance": "0.000 SBD",
"reward_steem_balance": "0.000 STEEM",
"reward_vesting_balance": "0.000000 VESTS",
"reward_vesting_steem": "0.000 STEEM",
"vesting_shares": "1023.510396 VESTS",
"delegated_vesting_shares": "0.000000 VESTS",
"received_vesting_shares": "7120.149410 VESTS",
"vesting_withdraw_rate": "0.000000 VESTS",
"next_vesting_withdrawal": "1969-12-31T23:59:59",
"withdrawn": 0,
"to_withdraw": 0,
"withdraw_routes": 0,
"curation_rewards": 0,
"posting_rewards": 0,
"proxied_vsf_votes": [
0,
0,
0,
0
],
"witnesses_voted_for": 0,
"last_post": "2019-01-02T12:54:30",
"last_root_post": "2019-01-02T12:54:30",
"last_vote_time": "2019-01-22T14:29:06",
"post_bandwidth": 0,
"pending_claimed_accounts": 0,
"vesting_balance": "0.000 STEEM",
"reputation": 3988495,
"transfer_history": [],
"market_history": [],
"post_history": [],
"vote_history": [],
"other_history": [],
"witness_votes": [],
"tags_usage": [],
"guest_bloggers": [],
"rank": 357335
}Withdraw Routes
| Incoming | Outgoing |
|---|---|
Empty | Empty |
{
"incoming": [],
"outgoing": []
}From Date
To Date
2026/05/17 23:09:48
2026/05/17 23:09:48
| delegator | steem |
| delegatee | damii |
| vesting shares | 7120.149410 VESTS |
| Transaction Info | Block #106142146/Trx f7df0ad53bdf9527e4f4f44e0ddce9ce464f03a1 |
View Raw JSON Data
{
"trx_id": "f7df0ad53bdf9527e4f4f44e0ddce9ce464f03a1",
"block": 106142146,
"trx_in_block": 1,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2026-05-17T23:09:48",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "7120.149410 VESTS"
}
]
}2026/05/11 23:27:12
2026/05/11 23:27:12
| delegator | steem |
| delegatee | damii |
| vesting shares | 4407.939005 VESTS |
| Transaction Info | Block #105970459/Trx f76945d957b35e3ad8c402de8bc247696cc2593d |
View Raw JSON Data
{
"trx_id": "f76945d957b35e3ad8c402de8bc247696cc2593d",
"block": 105970459,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2026-05-11T23:27:12",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "4407.939005 VESTS"
}
]
}2026/04/25 22:32:30
2026/04/25 22:32:30
| delegator | steem |
| delegatee | damii |
| vesting shares | 7132.665166 VESTS |
| Transaction Info | Block #105509830/Trx c08eca120b67689883e31ec0db94753feeef7bf1 |
View Raw JSON Data
{
"trx_id": "c08eca120b67689883e31ec0db94753feeef7bf1",
"block": 105509830,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2026-04-25T22:32:30",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "7132.665166 VESTS"
}
]
}2026/01/23 04:53:15
2026/01/23 04:53:15
| delegator | steem |
| delegatee | damii |
| vesting shares | 4449.485824 VESTS |
| Transaction Info | Block #102848321/Trx d16c16d2a0ba320516224d9e191682c99a440762 |
View Raw JSON Data
{
"trx_id": "d16c16d2a0ba320516224d9e191682c99a440762",
"block": 102848321,
"trx_in_block": 3,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2026-01-23T04:53:15",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "4449.485824 VESTS"
}
]
}2024/12/17 00:13:00
2024/12/17 00:13:00
| delegator | steem |
| delegatee | damii |
| vesting shares | 4613.705021 VESTS |
| Transaction Info | Block #91294740/Trx d80817c8b01cfab4b1961da5904fd91d2d5d90d1 |
View Raw JSON Data
{
"trx_id": "d80817c8b01cfab4b1961da5904fd91d2d5d90d1",
"block": 91294740,
"trx_in_block": 12,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2024-12-17T00:13:00",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "4613.705021 VESTS"
}
]
}2023/11/13 15:56:51
2023/11/13 15:56:51
| delegator | steem |
| delegatee | damii |
| vesting shares | 4782.838553 VESTS |
| Transaction Info | Block #79848973/Trx 71def34d79bd9e7d46d9101153de58905c2967a6 |
View Raw JSON Data
{
"trx_id": "71def34d79bd9e7d46d9101153de58905c2967a6",
"block": 79848973,
"trx_in_block": 3,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2023-11-13T15:56:51",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "4782.838553 VESTS"
}
]
}2023/09/21 20:33:09
2023/09/21 20:33:09
| delegator | steem |
| delegatee | damii |
| vesting shares | 7720.117339 VESTS |
| Transaction Info | Block #78346302/Trx ef597cdf97e183d14824cd7b4fa9604f70d5b496 |
View Raw JSON Data
{
"trx_id": "ef597cdf97e183d14824cd7b4fa9604f70d5b496",
"block": 78346302,
"trx_in_block": 1,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2023-09-21T20:33:09",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "7720.117339 VESTS"
}
]
}2022/11/03 10:30:27
2022/11/03 10:30:27
| delegator | steem |
| delegatee | damii |
| vesting shares | 7941.798777 VESTS |
| Transaction Info | Block #69111833/Trx a7b2b53b60191106c6b935e44680d2dd2ccbc520 |
View Raw JSON Data
{
"trx_id": "a7b2b53b60191106c6b935e44680d2dd2ccbc520",
"block": 69111833,
"trx_in_block": 3,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2022-11-03T10:30:27",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "7941.798777 VESTS"
}
]
}2022/01/17 09:52:21
2022/01/17 09:52:21
| delegator | steem |
| delegatee | damii |
| vesting shares | 8162.332008 VESTS |
| Transaction Info | Block #60808121/Trx a2f60f4072058128a8ad0be92c560b772ca578b1 |
View Raw JSON Data
{
"trx_id": "a2f60f4072058128a8ad0be92c560b772ca578b1",
"block": 60808121,
"trx_in_block": 22,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2022-01-17T09:52:21",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "8162.332008 VESTS"
}
]
}2021/06/13 23:50:00
2021/06/13 23:50:00
| delegator | steem |
| delegatee | damii |
| vesting shares | 8346.100666 VESTS |
| Transaction Info | Block #54606557/Trx 8a5231d92cbc55172a189252de842dc292cda8ff |
View Raw JSON Data
{
"trx_id": "8a5231d92cbc55172a189252de842dc292cda8ff",
"block": 54606557,
"trx_in_block": 3,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2021-06-13T23:50:00",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "8346.100666 VESTS"
}
]
}2020/12/11 10:10:36
2020/12/11 10:10:36
| delegator | steem |
| delegatee | damii |
| vesting shares | 8533.522640 VESTS |
| Transaction Info | Block #49354061/Trx 6d4857bd0c86030573d8d8fd0f639c28dc97aa64 |
View Raw JSON Data
{
"trx_id": "6d4857bd0c86030573d8d8fd0f639c28dc97aa64",
"block": 49354061,
"trx_in_block": 5,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-12-11T10:10:36",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "8533.522640 VESTS"
}
]
}2020/12/06 03:47:42
2020/12/06 03:47:42
| delegator | steem |
| delegatee | damii |
| vesting shares | 1912.543513 VESTS |
| Transaction Info | Block #49205623/Trx 11c8cd5bd677042c04df1e5124d0581269300c20 |
View Raw JSON Data
{
"trx_id": "11c8cd5bd677042c04df1e5124d0581269300c20",
"block": 49205623,
"trx_in_block": 3,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-12-06T03:47:42",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "1912.543513 VESTS"
}
]
}2020/12/05 11:45:00
2020/12/05 11:45:00
| delegator | steem |
| delegatee | damii |
| vesting shares | 8539.889279 VESTS |
| Transaction Info | Block #49186732/Trx 19cf90f28c8fb93dd1f5ae6bcd5be92e2958a925 |
View Raw JSON Data
{
"trx_id": "19cf90f28c8fb93dd1f5ae6bcd5be92e2958a925",
"block": 49186732,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-12-05T11:45:00",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "8539.889279 VESTS"
}
]
}2020/11/02 13:34:24
2020/11/02 13:34:24
| delegator | steem |
| delegatee | damii |
| vesting shares | 1920.017158 VESTS |
| Transaction Info | Block #48255370/Trx 8a844a0f5db3f632ac19b37ec398fe6ab8e20bd3 |
View Raw JSON Data
{
"trx_id": "8a844a0f5db3f632ac19b37ec398fe6ab8e20bd3",
"block": 48255370,
"trx_in_block": 2,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-11-02T13:34:24",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "1920.017158 VESTS"
}
]
}2020/05/09 04:44:06
2020/05/09 04:44:06
| delegator | steem |
| delegatee | damii |
| vesting shares | 8742.535853 VESTS |
| Transaction Info | Block #43215863/Trx 75c7e51ae152694e7158df12ee7ce9be0c532cee |
View Raw JSON Data
{
"trx_id": "75c7e51ae152694e7158df12ee7ce9be0c532cee",
"block": 43215863,
"trx_in_block": 16,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-05-09T04:44:06",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "8742.535853 VESTS"
}
]
}2020/05/08 08:11:15
2020/05/08 08:11:15
| delegator | steem |
| delegatee | damii |
| vesting shares | 1953.311140 VESTS |
| Transaction Info | Block #43191779/Trx 46b5a38da7b2bd6bbfa9902219f3fb363b7861b3 |
View Raw JSON Data
{
"trx_id": "46b5a38da7b2bd6bbfa9902219f3fb363b7861b3",
"block": 43191779,
"trx_in_block": 15,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-05-08T08:11:15",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "1953.311140 VESTS"
}
]
}2020/03/25 07:46:42
2020/03/25 07:46:42
| delegator | steem |
| delegatee | damii |
| vesting shares | 8766.382379 VESTS |
| Transaction Info | Block #41953100/Trx 709337cb0cdd7aff88d15bd8f3b5b27a9336a5ac |
View Raw JSON Data
{
"trx_id": "709337cb0cdd7aff88d15bd8f3b5b27a9336a5ac",
"block": 41953100,
"trx_in_block": 2,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-03-25T07:46:42",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "8766.382379 VESTS"
}
]
}2020/01/22 10:34:24
2020/01/22 10:34:24
| parent author | damii |
| parent permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| author | steemitboard |
| permlink | steemitboard-notify-damii-20200122t103424000z |
| title | |
| body | Congratulations @damii! You received a personal award! <table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@damii/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table> <sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@damii) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=damii)_</sub> ###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes! |
| json metadata | {"image":["https://steemitboard.com/img/notify.png"]} |
| Transaction Info | Block #40148629/Trx 5d3293b7f76e889838edf1ddcf4c1a60decb23cb |
View Raw JSON Data
{
"trx_id": "5d3293b7f76e889838edf1ddcf4c1a60decb23cb",
"block": 40148629,
"trx_in_block": 5,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-01-22T10:34:24",
"op": [
"comment",
{
"parent_author": "damii",
"parent_permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"author": "steemitboard",
"permlink": "steemitboard-notify-damii-20200122t103424000z",
"title": "",
"body": "Congratulations @damii! You received a personal award!\n\n<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@damii/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>\n\n<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@damii) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=damii)_</sub>\n\n\n###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!",
"json_metadata": "{\"image\":[\"https://steemitboard.com/img/notify.png\"]}"
}
]
}2019/08/22 16:00:18
2019/08/22 16:00:18
| from | dtube |
| to | damii |
| amount | 0.001 STEEM |
| memo | Time is running out, claim your DTube account now before anyone else can! Login at https://d.tube |
| Transaction Info | Block #35779215/Trx 800705b3b8e2fd572c38b4e659199e6272ec2a1f |
View Raw JSON Data
{
"trx_id": "800705b3b8e2fd572c38b4e659199e6272ec2a1f",
"block": 35779215,
"trx_in_block": 19,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-08-22T16:00:18",
"op": [
"transfer",
{
"from": "dtube",
"to": "damii",
"amount": "0.001 STEEM",
"memo": "Time is running out, claim your DTube account now before anyone else can! Login at https://d.tube"
}
]
}2019/04/23 16:13:51
2019/04/23 16:13:51
| delegator | steem |
| delegatee | damii |
| vesting shares | 8962.218121 VESTS |
| Transaction Info | Block #32300178/Trx b79873004a546cc145cd9a0aee16a46b67b3c364 |
View Raw JSON Data
{
"trx_id": "b79873004a546cc145cd9a0aee16a46b67b3c364",
"block": 32300178,
"trx_in_block": 24,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-04-23T16:13:51",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "8962.218121 VESTS"
}
]
}2019/02/26 06:21:36
2019/02/26 06:21:36
| parent author | damii |
| parent permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| author | partiko |
| permlink | partiko-re-damii-uzycie-zmiennej-this-w-jezyku-javascript-20190226t062136226z |
| title | |
| body | Hello @damii! This is a friendly reminder that you have 3000 Partiko Points unclaimed in your Partiko account! Partiko is a fast and beautiful mobile app for Steem, and it’s the most popular Steem mobile app out there! Download Partiko using the link below and login using SteemConnect to claim your 3000 Partiko points! You can easily convert them into Steem token! https://partiko.app/referral/partiko  |
| json metadata | {"app":"partiko"} |
| Transaction Info | Block #30678152/Trx c939c088b542f240344a330506096544b5dd2e29 |
View Raw JSON Data
{
"trx_id": "c939c088b542f240344a330506096544b5dd2e29",
"block": 30678152,
"trx_in_block": 12,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-02-26T06:21:36",
"op": [
"comment",
{
"parent_author": "damii",
"parent_permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"author": "partiko",
"permlink": "partiko-re-damii-uzycie-zmiennej-this-w-jezyku-javascript-20190226t062136226z",
"title": "",
"body": "Hello @damii! This is a friendly reminder that you have 3000 Partiko Points unclaimed in your Partiko account!\n\nPartiko is a fast and beautiful mobile app for Steem, and it’s the most popular Steem mobile app out there! Download Partiko using the link below and login using SteemConnect to claim your 3000 Partiko points! You can easily convert them into Steem token!\n\nhttps://partiko.app/referral/partiko\n\n",
"json_metadata": "{\"app\":\"partiko\"}"
}
]
}damiiupvoted (100.00%) @kralizec / the-senseless-war-between-atari-and-amiga2019/01/22 18:07:36
damiiupvoted (100.00%) @kralizec / the-senseless-war-between-atari-and-amiga
2019/01/22 18:07:36
| voter | damii |
| author | kralizec |
| permlink | the-senseless-war-between-atari-and-amiga |
| weight | 10000 (100.00%) |
| Transaction Info | Block #29685149/Trx 86ab53013317431581ac31ef6db048c800aa9e82 |
View Raw JSON Data
{
"trx_id": "86ab53013317431581ac31ef6db048c800aa9e82",
"block": 29685149,
"trx_in_block": 17,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-22T18:07:36",
"op": [
"vote",
{
"voter": "damii",
"author": "kralizec",
"permlink": "the-senseless-war-between-atari-and-amiga",
"weight": 10000
}
]
}damiiupvoted (100.00%) @patys / postaw-swoj-wlasny-blockchain-implementacja-portfela-i-transakcji2019/01/22 14:44:21
damiiupvoted (100.00%) @patys / postaw-swoj-wlasny-blockchain-implementacja-portfela-i-transakcji
2019/01/22 14:44:21
| voter | damii |
| author | patys |
| permlink | postaw-swoj-wlasny-blockchain-implementacja-portfela-i-transakcji |
| weight | 10000 (100.00%) |
| Transaction Info | Block #29681088/Trx b2ef180d4ce61ae63a70f488b256e9a117e6492b |
View Raw JSON Data
{
"trx_id": "b2ef180d4ce61ae63a70f488b256e9a117e6492b",
"block": 29681088,
"trx_in_block": 9,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-22T14:44:21",
"op": [
"vote",
{
"voter": "damii",
"author": "patys",
"permlink": "postaw-swoj-wlasny-blockchain-implementacja-portfela-i-transakcji",
"weight": 10000
}
]
}2019/01/22 14:29:27
2019/01/22 14:29:27
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"patys","what":["blog"]}] |
| Transaction Info | Block #29680791/Trx 4146856df226015b57951ff1522cba97f13d5294 |
View Raw JSON Data
{
"trx_id": "4146856df226015b57951ff1522cba97f13d5294",
"block": 29680791,
"trx_in_block": 11,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-22T14:29:27",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"patys\",\"what\":[\"blog\"]}]"
}
]
}damiiupvoted (100.00%) @patys / dodajemy-p2p-i-konczymy-blockchain2019/01/22 14:29:06
damiiupvoted (100.00%) @patys / dodajemy-p2p-i-konczymy-blockchain
2019/01/22 14:29:06
| voter | damii |
| author | patys |
| permlink | dodajemy-p2p-i-konczymy-blockchain |
| weight | 10000 (100.00%) |
| Transaction Info | Block #29680784/Trx 89f71e7ea504653a0199934015af3753d8343e04 |
View Raw JSON Data
{
"trx_id": "89f71e7ea504653a0199934015af3753d8343e04",
"block": 29680784,
"trx_in_block": 5,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-22T14:29:06",
"op": [
"vote",
{
"voter": "damii",
"author": "patys",
"permlink": "dodajemy-p2p-i-konczymy-blockchain",
"weight": 10000
}
]
}damiiupvoted (100.00%) @hallmann / skarby-lotwy-zytni-chleb2019/01/22 12:49:36
damiiupvoted (100.00%) @hallmann / skarby-lotwy-zytni-chleb
2019/01/22 12:49:36
| voter | damii |
| author | hallmann |
| permlink | skarby-lotwy-zytni-chleb |
| weight | 10000 (100.00%) |
| Transaction Info | Block #29678794/Trx 58cd3cfdd969e61a42f4e2719fec9386f3779192 |
View Raw JSON Data
{
"trx_id": "58cd3cfdd969e61a42f4e2719fec9386f3779192",
"block": 29678794,
"trx_in_block": 5,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-22T12:49:36",
"op": [
"vote",
{
"voter": "damii",
"author": "hallmann",
"permlink": "skarby-lotwy-zytni-chleb",
"weight": 10000
}
]
}2019/01/22 10:35:36
2019/01/22 10:35:36
| parent author | damii |
| parent permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| author | steemitboard |
| permlink | steemitboard-notify-damii-20190122t103535000z |
| title | |
| body | Congratulations @damii! You received a personal award! <table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@damii/birthday1.png</td><td>Happy Birthday! - You are on the Steem blockchain for 1 year!</td></tr></table> <sub>_[Click here to view your Board](https://steemitboard.com/@damii)_</sub> > Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**! |
| json metadata | {"image":["https://steemitboard.com/img/notify.png"]} |
| Transaction Info | Block #29676114/Trx 80fd8159993887af273306cf0725ea0ee3a2c5dc |
View Raw JSON Data
{
"trx_id": "80fd8159993887af273306cf0725ea0ee3a2c5dc",
"block": 29676114,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-22T10:35:36",
"op": [
"comment",
{
"parent_author": "damii",
"parent_permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"author": "steemitboard",
"permlink": "steemitboard-notify-damii-20190122t103535000z",
"title": "",
"body": "Congratulations @damii! You received a personal award!\n\n<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@damii/birthday1.png</td><td>Happy Birthday! - You are on the Steem blockchain for 1 year!</td></tr></table>\n\n<sub>_[Click here to view your Board](https://steemitboard.com/@damii)_</sub>\n\n\n> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!",
"json_metadata": "{\"image\":[\"https://steemitboard.com/img/notify.png\"]}"
}
]
}damiifollowed @dan.jeffries12019/01/11 13:49:03
damiifollowed @dan.jeffries1
2019/01/11 13:49:03
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"dan.jeffries1","what":["blog"]}] |
| Transaction Info | Block #29363473/Trx 4f371f0eb997e63c6995c8be44c3accd0c95cf9e |
View Raw JSON Data
{
"trx_id": "4f371f0eb997e63c6995c8be44c3accd0c95cf9e",
"block": 29363473,
"trx_in_block": 2,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-11T13:49:03",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"dan.jeffries1\",\"what\":[\"blog\"]}]"
}
]
}damiiupvoted (100.00%) @astromaniak / oto-dlaczego-kryptowaluty-zmienia-swiat2019/01/11 10:23:09
damiiupvoted (100.00%) @astromaniak / oto-dlaczego-kryptowaluty-zmienia-swiat
2019/01/11 10:23:09
| voter | damii |
| author | astromaniak |
| permlink | oto-dlaczego-kryptowaluty-zmienia-swiat |
| weight | 10000 (100.00%) |
| Transaction Info | Block #29359357/Trx 7e3b01519dc48c5e5f5b55996d4adeefa400d3c0 |
View Raw JSON Data
{
"trx_id": "7e3b01519dc48c5e5f5b55996d4adeefa400d3c0",
"block": 29359357,
"trx_in_block": 9,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-11T10:23:09",
"op": [
"vote",
{
"voter": "damii",
"author": "astromaniak",
"permlink": "oto-dlaczego-kryptowaluty-zmienia-swiat",
"weight": 10000
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/07 19:06:15
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/07 19:06:15
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | @@ -1971,80 +1971,88 @@ /* - funkcja tworzy nowy lokaln -y +e %22this%22 -, war. this.prefix2 b%C4%99dzie undefined + zostaje zast%C4%85pione kontekstem objektu BookList dzi%C4%99ki bind(this) */%0A |
| json metadata | {"tags":["javascript","programowanie","polish"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #29254672/Trx 12bfe63cd584c764fa7d967f2d78dd6d3a1b1c9c |
View Raw JSON Data
{
"trx_id": "12bfe63cd584c764fa7d967f2d78dd6d3a1b1c9c",
"block": 29254672,
"trx_in_block": 38,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-07T19:06:15",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "@@ -1971,80 +1971,88 @@\n /*\n- funkcja tworzy nowy\n lokaln\n-y\n+e\n %22this%22\n-, war. this.prefix2 b%C4%99dzie undefined \n+ zostaje zast%C4%85pione kontekstem objektu BookList dzi%C4%99ki bind(this)\n */%0A \n",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\",\"polish\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/07 18:57:33
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/07 18:57:33
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | @@ -4592,22 +4592,22 @@ ona +b%C4%99dzie warto%C5%9B%C4%87 - b%C4%99dzie %22un @@ -4873,16 +4873,19 @@ u%C5%BCycie +%60%60%60 bind(thi @@ -4886,16 +4886,19 @@ nd(this) +%60%60%60 na funk @@ -4912,16 +4912,19 @@ nimowej +%60%60%60 function @@ -4931,16 +4931,19 @@ () %7B... +%60%60%60 bezpo%C5%9Bre @@ -4977,16 +4977,19 @@ funkcja +%60%60%60 bind(thi @@ -4990,16 +4990,19 @@ nd(this) +%60%60%60 przekaz |
| json metadata | {"tags":["javascript","programowanie","polish"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #29254498/Trx b327459556f1b69c7863edc5a0679133e901fe6b |
View Raw JSON Data
{
"trx_id": "b327459556f1b69c7863edc5a0679133e901fe6b",
"block": 29254498,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-07T18:57:33",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "@@ -4592,22 +4592,22 @@\n ona \n+b%C4%99dzie \n warto%C5%9B%C4%87\n- b%C4%99dzie\n %22un\n@@ -4873,16 +4873,19 @@\n u%C5%BCycie \n+%60%60%60\n bind(thi\n@@ -4886,16 +4886,19 @@\n nd(this)\n+%60%60%60\n na funk\n@@ -4912,16 +4912,19 @@\n nimowej \n+%60%60%60\n function\n@@ -4931,16 +4931,19 @@\n () %7B... \n+%60%60%60\n bezpo%C5%9Bre\n@@ -4977,16 +4977,19 @@\n funkcja \n+%60%60%60\n bind(thi\n@@ -4990,16 +4990,19 @@\n nd(this)\n+%60%60%60\n przekaz\n",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\",\"polish\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}fyrstikkenupvoted (1.00%) @damii / uzycie-zmiennej-this-w-jezyku-javascript2019/01/07 18:54:09
fyrstikkenupvoted (1.00%) @damii / uzycie-zmiennej-this-w-jezyku-javascript
2019/01/07 18:54:09
| voter | fyrstikken |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| weight | 100 (1.00%) |
| Transaction Info | Block #29254430/Trx 9ad801bee0b47152bb31c0e45c90d759d38f0eda |
View Raw JSON Data
{
"trx_id": "9ad801bee0b47152bb31c0e45c90d759d38f0eda",
"block": 29254430,
"trx_in_block": 5,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-07T18:54:09",
"op": [
"vote",
{
"voter": "fyrstikken",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"weight": 100
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/07 18:53:15
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/07 18:53:15
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | @@ -817,24 +817,25 @@ nction() %7B %0A +%0A retur @@ -1095,32 +1095,33 @@ ix1 = (() =%3E %7B %0A +%0A return () @@ -1372,24 +1372,25 @@ = (() =%3E %7B %0A +%0A retur @@ -1640,16 +1640,17 @@ ion() %7B%0A +%0A / @@ -1663,47 +1663,35 @@ cja -odwo%C5%82uje si%C4%99 do tego kontekstu, inaczej +tworzy nowy lokalny %22this%22, war @@ -1736,31 +1736,317 @@ -this.localPrefix = '?' +return () =%3E %7B%0A /* zmienna %22this%22 metody getBooksWithPrefix3 */%0A return %5B%22book1%22, %22book2%22, %22book3%22%5D.map(book =%3E %60$%7Bthis.prefix2%7D$%7Bbook%7D%60 ); %0A %7D %0A %7D)();%0A%0A this.getBooksWithPrefix4 = (function() %7B%0A%0A /* funkcja tworzy nowy lokalny %22this%22, war. this.prefix2 b%C4%99dzie undefined */ %0A @@ -2189,27 +2189,23 @@ %60$%7Bthis. -localP +p refix +2 %7D$%7Bbook%7D @@ -2225,18 +2225,30 @@ %7D %0A %7D) +.bind(this) () +; %0A%7D%0A%0Alet @@ -2636,16 +2636,56 @@ ix3() ); +%0Aconsole.log( d.getBooksWithPrefix4() ); %0A%0A// wyn @@ -2918,17 +2918,78 @@ %0A// %5B ' -? +undefinedbook1', 'undefinedbook2', 'undefinedbook3' %5D%0A// %5B 'd book1', @@ -2985,25 +2985,25 @@ 'dbook1', ' -? +d book2', '?bo @@ -3003,9 +3003,9 @@ ', ' -? +d book @@ -3014,16 +3014,18 @@ %5D%0A%60%60%60%0A%0A + Przyk%C5%82ad @@ -3738,16 +3738,19 @@ st%60%60%60). +%0A Podobnie @@ -4017,16 +4017,19 @@ biektu. +%0A Funkcja @@ -4348,15 +4348,19 @@ ra. -Ostatni +%0A Nast%C4%99pny prz @@ -4545,14 +4545,14 @@ efix -ani %60%60%60 +ani te%C5%BC @@ -4583,11 +4583,16 @@ i%C4%99c -aby +zwr%C3%B3cona war @@ -4600,131 +4600,518 @@ o%C5%9B%C4%87 -nie by%C5%82a %22undefined%22 trzeba lokalnie zadeklarowa%C4%87 zmienn%C4%85 %60%60%60local +b%C4%99dzie %22undefined%22 (zwyk%C5%82a funkcja zdefiniowana za pomoc%C4%85 s%C5%82owa kluczowego %60%60%60function%60%60%60 tworzy swoj%C4%85 lokaln%C4%85 zmienn%C4%85 this).%0A I ostatnia funkcja przypisana do pola %60%60%60getBooksWithPrefix4%60%60%60 to dok%C5%82adna kopia funkcji z pola %60%60%60getBooksWith Prefix +3 %60%60%60 - (zwyk%C5%82a funkcja tworzy swoj%C4%85 lokaln%C4%85 zmienn%C4%85 this) +, jedyna r%C3%B3%C5%BCnica to u%C5%BCycie bind(this) na funkcji anonimowej function() %7B... bezpo%C5%9Brednio przed jej wywo%C5%82aniem, funkcja bind(this) przekazuje do funkcji anonimowej kontekst objektu klasy, wi%C4%99c aktualne warto%C5%9Bci p%C3%B3l objektu klasy %60%60%60BookList%60%60%60 s%C4%85 ponownie dost%C4%99pne . |
| json metadata | {"tags":["javascript","programowanie","polish"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #29254412/Trx 0a1e15553ee97eb6ae2e4aff58101a70b2cf3fa3 |
View Raw JSON Data
{
"trx_id": "0a1e15553ee97eb6ae2e4aff58101a70b2cf3fa3",
"block": 29254412,
"trx_in_block": 9,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-07T18:53:15",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "@@ -817,24 +817,25 @@\n nction() %7B %0A\n+%0A\n retur\n@@ -1095,32 +1095,33 @@\n ix1 = (() =%3E %7B %0A\n+%0A\n return ()\n@@ -1372,24 +1372,25 @@\n = (() =%3E %7B %0A\n+%0A\n retur\n@@ -1640,16 +1640,17 @@\n ion() %7B%0A\n+%0A\n /\n@@ -1663,47 +1663,35 @@\n cja \n-odwo%C5%82uje si%C4%99 do tego kontekstu, inaczej\n+tworzy nowy lokalny %22this%22,\n war\n@@ -1736,31 +1736,317 @@\n \n-this.localPrefix = '?' \n+return () =%3E %7B%0A /* zmienna %22this%22 metody getBooksWithPrefix3 */%0A return %5B%22book1%22, %22book2%22, %22book3%22%5D.map(book =%3E %60$%7Bthis.prefix2%7D$%7Bbook%7D%60 ); %0A %7D %0A %7D)();%0A%0A this.getBooksWithPrefix4 = (function() %7B%0A%0A /* funkcja tworzy nowy lokalny %22this%22, war. this.prefix2 b%C4%99dzie undefined */\n %0A \n@@ -2189,27 +2189,23 @@\n %60$%7Bthis.\n-localP\n+p\n refix\n+2\n %7D$%7Bbook%7D\n@@ -2225,18 +2225,30 @@\n %7D %0A %7D)\n+.bind(this)\n ()\n+;\n %0A%7D%0A%0Alet \n@@ -2636,16 +2636,56 @@\n ix3() );\n+%0Aconsole.log( d.getBooksWithPrefix4() );\n %0A%0A// wyn\n@@ -2918,17 +2918,78 @@\n %0A// %5B '\n-?\n+undefinedbook1', 'undefinedbook2', 'undefinedbook3' %5D%0A// %5B 'd\n book1', \n@@ -2985,25 +2985,25 @@\n 'dbook1', '\n-?\n+d\n book2', '?bo\n@@ -3003,9 +3003,9 @@\n ', '\n-?\n+d\n book\n@@ -3014,16 +3014,18 @@\n %5D%0A%60%60%60%0A%0A\n+ \n Przyk%C5%82ad\n@@ -3738,16 +3738,19 @@\n st%60%60%60). \n+%0A \n Podobnie\n@@ -4017,16 +4017,19 @@\n biektu. \n+%0A \n Funkcja \n@@ -4348,15 +4348,19 @@\n ra. \n-Ostatni\n+%0A Nast%C4%99pny\n prz\n@@ -4545,14 +4545,14 @@\n efix\n-ani\n %60%60%60\n+ani\n te%C5%BC\n@@ -4583,11 +4583,16 @@\n i%C4%99c \n-aby\n+zwr%C3%B3cona\n war\n@@ -4600,131 +4600,518 @@\n o%C5%9B%C4%87 \n-nie by%C5%82a %22undefined%22 trzeba lokalnie zadeklarowa%C4%87 zmienn%C4%85 %60%60%60local\n+b%C4%99dzie %22undefined%22 (zwyk%C5%82a funkcja zdefiniowana za pomoc%C4%85 s%C5%82owa kluczowego %60%60%60function%60%60%60 tworzy swoj%C4%85 lokaln%C4%85 zmienn%C4%85 this).%0A I ostatnia funkcja przypisana do pola %60%60%60getBooksWithPrefix4%60%60%60 to dok%C5%82adna kopia funkcji z pola %60%60%60getBooksWith\n Prefix\n+3\n %60%60%60\n- (zwyk%C5%82a funkcja tworzy swoj%C4%85 lokaln%C4%85 zmienn%C4%85 this)\n+, jedyna r%C3%B3%C5%BCnica to u%C5%BCycie bind(this) na funkcji anonimowej function() %7B... bezpo%C5%9Brednio przed jej wywo%C5%82aniem, funkcja bind(this) przekazuje do funkcji anonimowej kontekst objektu klasy, wi%C4%99c aktualne warto%C5%9Bci p%C3%B3l objektu klasy %60%60%60BookList%60%60%60 s%C4%85 ponownie dost%C4%99pne\n .\n",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\",\"polish\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/03 16:31:00
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/03 16:31:00
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | @@ -59,17 +59,17 @@ klasy ob -j +i ekt%C3%B3w, a @@ -185,17 +185,17 @@ ualny ob -j +i ekt klas @@ -315,17 +315,18 @@ i%C4%99 wewn%C4%85 -c +tr z konstr @@ -491,17 +491,18 @@ na zewn%C4%85 -c +tr z, jest @@ -2962,16 +2962,19 @@ powy%C5%BCej +%60%60%60 this.pre @@ -2976,16 +2976,19 @@ s.prefix +%60%60%60 nie jes @@ -3012,16 +3012,19 @@ funkcji +%60%60%60 makeGetB @@ -3037,16 +3037,19 @@ thPrefix +%60%60%60 wi%C4%99c po @@ -3076,24 +3076,30 @@ funkcji +%60%60%60 BookList +%60%60%60 . Poniew @@ -3109,16 +3109,19 @@ funkcja +%60%60%60 makeGetB @@ -3134,16 +3134,19 @@ thPrefix +%60%60%60 tworzy @@ -3246,32 +3246,35 @@ na jest warto%C5%9B%C4%87 +%60%60%60 this.prefix. (je @@ -3268,16 +3268,19 @@ s.prefix +%60%60%60 . (jest @@ -3284,18 +3284,18 @@ st to ak -u t +u alna war @@ -3319,17 +3319,17 @@ fix w ob -j +i ekcie kl @@ -3332,24 +3332,30 @@ e klasy +%60%60%60 BookList +%60%60%60 ). Podob @@ -3413,16 +3413,19 @@ miennej +%60%60%60 getBooks @@ -3435,16 +3435,19 @@ hPrefix1 +%60%60%60 - warto @@ -3441,32 +3441,35 @@ x1%60%60%60 - warto%C5%9B%C4%87 +%60%60%60 this.prefix jest @@ -3463,16 +3463,19 @@ s.prefix +%60%60%60 jest ni @@ -3593,16 +3593,19 @@ warto%C5%9B%C4%87 +%60%60%60 this.pre @@ -3611,17 +3611,20 @@ efix +%60%60%60 tego ob -j +i ektu @@ -3648,32 +3648,35 @@ ana do atrybutu +%60%60%60 getBooksWithPref @@ -3678,16 +3678,19 @@ hPrefix2 +%60%60%60 jest do @@ -3793,16 +3793,19 @@ ow%C4%85 jak +%60%60%60 getBooks @@ -3815,16 +3815,19 @@ hPrefix1 +%60%60%60 ale r%C3%B3%C5%BC @@ -3884,16 +3884,19 @@ trybutu +%60%60%60 this.pre @@ -3899,16 +3899,19 @@ .prefix2 +%60%60%60 kt%C3%B3ry j @@ -4045,16 +4045,19 @@ trybutu +%60%60%60 getBooks @@ -4067,16 +4067,19 @@ hPrefix3 +%60%60%60 . Tutaj @@ -4124,24 +4124,27 @@ t%C4%99pu ani do +%60%60%60 this.prefixa @@ -4149,16 +4149,22 @@ xani +%60%60%60 te%C5%BC do +%60%60%60 this @@ -4171,16 +4171,19 @@ .prefix2 +%60%60%60 wi%C4%99c ab @@ -4250,16 +4250,19 @@ zmienn%C4%85 +%60%60%60 localPre @@ -4264,16 +4264,19 @@ alPrefix +%60%60%60 (zwyk%C5%82a |
| json metadata | {"tags":["javascript","programowanie","polish"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #29136514/Trx 5f34d24c69e9d44b84c41378a00b32575ec60fdf |
View Raw JSON Data
{
"trx_id": "5f34d24c69e9d44b84c41378a00b32575ec60fdf",
"block": 29136514,
"trx_in_block": 36,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-03T16:31:00",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "@@ -59,17 +59,17 @@\n klasy ob\n-j\n+i\n ekt%C3%B3w, a\n@@ -185,17 +185,17 @@\n ualny ob\n-j\n+i\n ekt klas\n@@ -315,17 +315,18 @@\n i%C4%99 wewn%C4%85\n-c\n+tr\n z konstr\n@@ -491,17 +491,18 @@\n na zewn%C4%85\n-c\n+tr\n z, jest \n@@ -2962,16 +2962,19 @@\n powy%C5%BCej \n+%60%60%60\n this.pre\n@@ -2976,16 +2976,19 @@\n s.prefix\n+%60%60%60\n nie jes\n@@ -3012,16 +3012,19 @@\n funkcji \n+%60%60%60\n makeGetB\n@@ -3037,16 +3037,19 @@\n thPrefix\n+%60%60%60\n wi%C4%99c po\n@@ -3076,24 +3076,30 @@\n funkcji \n+%60%60%60\n BookList\n+%60%60%60\n . Poniew\n@@ -3109,16 +3109,19 @@\n funkcja \n+%60%60%60\n makeGetB\n@@ -3134,16 +3134,19 @@\n thPrefix\n+%60%60%60\n tworzy \n@@ -3246,32 +3246,35 @@\n na jest warto%C5%9B%C4%87 \n+%60%60%60\n this.prefix. (je\n@@ -3268,16 +3268,19 @@\n s.prefix\n+%60%60%60\n . (jest \n@@ -3284,18 +3284,18 @@\n st to ak\n-u\n t\n+u\n alna war\n@@ -3319,17 +3319,17 @@\n fix w ob\n-j\n+i\n ekcie kl\n@@ -3332,24 +3332,30 @@\n e klasy \n+%60%60%60\n BookList\n+%60%60%60\n ). Podob\n@@ -3413,16 +3413,19 @@\n miennej \n+%60%60%60\n getBooks\n@@ -3435,16 +3435,19 @@\n hPrefix1\n+%60%60%60\n - warto\n@@ -3441,32 +3441,35 @@\n x1%60%60%60 - warto%C5%9B%C4%87 \n+%60%60%60\n this.prefix jest\n@@ -3463,16 +3463,19 @@\n s.prefix\n+%60%60%60\n jest ni\n@@ -3593,16 +3593,19 @@\n warto%C5%9B%C4%87 \n+%60%60%60\n this.pre\n@@ -3611,17 +3611,20 @@\n efix\n+%60%60%60\n tego ob\n-j\n+i\n ektu\n@@ -3648,32 +3648,35 @@\n ana do atrybutu \n+%60%60%60\n getBooksWithPref\n@@ -3678,16 +3678,19 @@\n hPrefix2\n+%60%60%60\n jest do\n@@ -3793,16 +3793,19 @@\n ow%C4%85 jak \n+%60%60%60\n getBooks\n@@ -3815,16 +3815,19 @@\n hPrefix1\n+%60%60%60\n ale r%C3%B3%C5%BC\n@@ -3884,16 +3884,19 @@\n trybutu \n+%60%60%60\n this.pre\n@@ -3899,16 +3899,19 @@\n .prefix2\n+%60%60%60\n kt%C3%B3ry j\n@@ -4045,16 +4045,19 @@\n trybutu \n+%60%60%60\n getBooks\n@@ -4067,16 +4067,19 @@\n hPrefix3\n+%60%60%60\n . Tutaj \n@@ -4124,24 +4124,27 @@\n t%C4%99pu ani do \n+%60%60%60\n this.prefixa\n@@ -4149,16 +4149,22 @@\n xani\n+%60%60%60\n te%C5%BC do \n+%60%60%60\n this\n@@ -4171,16 +4171,19 @@\n .prefix2\n+%60%60%60\n wi%C4%99c ab\n@@ -4250,16 +4250,19 @@\n zmienn%C4%85 \n+%60%60%60\n localPre\n@@ -4264,16 +4264,19 @@\n alPrefix\n+%60%60%60\n (zwyk%C5%82a\n",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\",\"polish\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/03 16:27:09
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/03 16:27:09
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | Definiując funkcję w języku Javascript możemy też tworzyć klasy objektów, a dokładniej konstruktory tych klas. Tutaj należy zwrócić szczególną uwagę na zmienną "this" wskazującą na aktualny objekt klasy, bo zasięg tej zmiennej może być ograniczony lokalną zmienną "this" zwykłej funkcji której definicja znajduje się wewnącz konstruktora. Problemu tego nie ma z funkcjami strzałkowymi które nie tworzą swoje lokalnego kontekstu (closure) i dlatego zawsze odwołują się do "this" widzianego na zewnącz, jest to szczególnie użyteczne w momencie kiedy użyjemy całego łańcucha funkcji ze strzałką gdzie wynik jednej funkcji => jest parametrem wejściowym drugiej funkcji strzałkowej. ```javascript function BookList (prefix) { this.prefix = prefix; this.prefix2 = 'd' this.makeGetBooksWithPrefix = function() { return () => { /* zmienna "this" objektu klasy BookList lub*/ /* zmienna "this" metody getBooksWithPrefix */ return ["book1", "book2", "book3"].map(book => `${this.prefix}${book}` ); } } this.getBooksWithPrefix1 = (() => { return () => { /* atrybut "this.prefix" objektu klasy BookList, nieokreślony jeszcze w definicji klasy */ return ["book1", "book2", "book3"].map(book => `${this.prefix}${book}` ); } })(); this.getBooksWithPrefix2 = (() => { return () => { /* atrybut "this.prefix2" klasy BookList, określony w definicji klasy */ return ["book1", "book2", "book3"].map(book => `${this.prefix2}${book}` ); } })(); this.getBooksWithPrefix3 = (function() { /* funkcja odwołuje się do tego kontekstu, inaczej war. this.prefix2 będzie undefined */ this.localPrefix = '?' return () => { /* zmienna "this" metody getBooksWithPrefix3 */ return ["book1", "book2", "book3"].map(book => `${this.localPrefix}${book}` ); } })() } let c = new BookList('*'); let d = new BookList('x'); /* użycie funkcji wygenerowanej lokalnie w miejscu wywołania: */ console.log( c.makeGetBooksWithPrefix()() ); console.log( d.makeGetBooksWithPrefix()() ); /* użycie funkcji wygenerowanych wcześniej w konstruktorze: */ console.log( d.getBooksWithPrefix1() ); console.log( d.getBooksWithPrefix2() ); console.log( d.getBooksWithPrefix3() ); // wynik funkcji stworzonej lokalnie: // [ '*book1', '*book2', '*book3' ] // [ 'xbook1', 'xbook2', 'xbook3' ] // wynik funkcji stworzonych w konstruktorze: // [ 'xbook1', 'xbook2', 'xbook3' ] // [ 'dbook1', 'dbook2', 'dbook3' ] // [ '?book1', '?book2', '?book3' ] ``` Przykład powyżej pokazuje jak zastosowanie notacji strzałkowej (arrow functions) zmienia znaczenie zmiennej "this". Każde odwołanie do "this" wewnątrz funkcji strzałkowej odnosi się do zasięgu w którym taka funkcja jest definiowana, jeżeli brakuje szukanej zmiennej to sprawdzany jest zasięg bardziej zewnęczny - w przykładzie powyżej this.prefix nie jest zdefiniowany w funkcji makeGetBooksWithPrefix więc pobrany jest prefix z funkcji BookList. Ponieważ funkcja makeGetBooksWithPrefix tworzy i zwraca właściwą funkcję anonimową w miejscu jej wywołania to właśnie w tym momencie określana jest wartość this.prefix. (jest to akutalna wartość atrybutu prefix w objekcie klasy BookList). Podobnie zachowuje się anonimowa funkcja przypisana do zmiennej getBooksWithPrefix1 - wartość this.prefix jest nieokreślona w momencie generowania tej funkcji więc użycie tej funkcji dla konkretnego obiektu pobiera aktualną wartość this.prefix tego objektu. Funkcja przypisana do atrybutu getBooksWithPrefix2 jest dokładnie taką samą anonimową funkcją strzałkową wygenerowaną przez inną anonimową funkcję strzałkową jak getBooksWithPrefix1 ale różnica polega na tym że funkcja ta odwołuje się do atrybutu this.prefix2 który jest dostępny w definicji konstruktora. Ostatni przypadek to zwykła funkcja która zwraca funkcję strzałkową i przypisuje ją do atrybutu getBooksWithPrefix3. Tutaj zwracana funkcja strzałkowa nie ma dostępu ani do this.prefixani też do this.prefix2 więc aby wartość nie była "undefined" trzeba lokalnie zadeklarować zmienną localPrefix (zwykła funkcja tworzy swoją lokalną zmienną this). |
| json metadata | {"tags":["javascript","programowanie","polish"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #29136437/Trx 965a95db3a4b2ece19e18c8725d72267a687c3e3 |
View Raw JSON Data
{
"trx_id": "965a95db3a4b2ece19e18c8725d72267a687c3e3",
"block": 29136437,
"trx_in_block": 32,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-03T16:27:09",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "Definiując funkcję w języku Javascript możemy też tworzyć klasy objektów, a dokładniej konstruktory tych klas. Tutaj należy zwrócić szczególną uwagę na zmienną \"this\" wskazującą na aktualny objekt klasy, bo zasięg tej zmiennej może być ograniczony lokalną zmienną \"this\" zwykłej funkcji której definicja znajduje się wewnącz konstruktora. Problemu tego nie ma z funkcjami strzałkowymi które nie tworzą swoje lokalnego kontekstu (closure) i dlatego zawsze odwołują się do \"this\" widzianego na zewnącz, jest to szczególnie użyteczne w momencie kiedy użyjemy całego łańcucha funkcji ze strzałką gdzie wynik jednej funkcji => jest parametrem wejściowym drugiej funkcji strzałkowej.\n\n```javascript\nfunction BookList (prefix) { \n \n this.prefix = prefix; \n this.prefix2 = 'd' \n\n this.makeGetBooksWithPrefix = function() { \n return () => {\n /* zmienna \"this\" objektu klasy BookList lub*/\n /* zmienna \"this\" metody getBooksWithPrefix */ \n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.prefix}${book}` );\n } \n }\n\n this.getBooksWithPrefix1 = (() => { \n return () => { \n /* atrybut \"this.prefix\" objektu klasy BookList, nieokreślony jeszcze w definicji klasy */\n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.prefix}${book}` );\n } \n })();\n\n this.getBooksWithPrefix2 = (() => { \n return () => { \n /* atrybut \"this.prefix2\" klasy BookList, określony w definicji klasy */ \n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.prefix2}${book}` ); \n } \n })();\n\n this.getBooksWithPrefix3 = (function() {\n /* funkcja odwołuje się do tego kontekstu, inaczej war. this.prefix2 będzie undefined */\n this.localPrefix = '?' \n return () => {\n /* zmienna \"this\" metody getBooksWithPrefix3 */\n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.localPrefix}${book}` ); \n } \n })()\n}\n\nlet c = new BookList('*');\nlet d = new BookList('x');\n\n/* użycie funkcji wygenerowanej lokalnie w miejscu wywołania: */\nconsole.log( c.makeGetBooksWithPrefix()() );\nconsole.log( d.makeGetBooksWithPrefix()() );\n\n/* użycie funkcji wygenerowanych wcześniej w konstruktorze: */\nconsole.log( d.getBooksWithPrefix1() );\nconsole.log( d.getBooksWithPrefix2() );\nconsole.log( d.getBooksWithPrefix3() );\n\n// wynik funkcji stworzonej lokalnie:\n// [ '*book1', '*book2', '*book3' ]\n// [ 'xbook1', 'xbook2', 'xbook3' ]\n\n// wynik funkcji stworzonych w konstruktorze:\n// [ 'xbook1', 'xbook2', 'xbook3' ]\n// [ 'dbook1', 'dbook2', 'dbook3' ]\n// [ '?book1', '?book2', '?book3' ]\n```\n\nPrzykład powyżej pokazuje jak zastosowanie notacji strzałkowej (arrow functions) zmienia znaczenie zmiennej \"this\". Każde odwołanie do \"this\" wewnątrz funkcji strzałkowej odnosi się do zasięgu w którym taka funkcja jest definiowana, jeżeli brakuje szukanej zmiennej to sprawdzany jest zasięg bardziej zewnęczny - w przykładzie powyżej this.prefix nie jest zdefiniowany w funkcji makeGetBooksWithPrefix więc pobrany jest prefix z funkcji BookList. Ponieważ funkcja makeGetBooksWithPrefix tworzy i zwraca właściwą funkcję anonimową w miejscu jej wywołania to właśnie w tym momencie określana jest wartość this.prefix. (jest to akutalna wartość atrybutu prefix w objekcie klasy BookList). Podobnie zachowuje się anonimowa funkcja przypisana do zmiennej getBooksWithPrefix1 - wartość this.prefix jest nieokreślona w momencie generowania tej funkcji więc użycie tej funkcji dla konkretnego obiektu pobiera aktualną wartość this.prefix tego objektu. Funkcja przypisana do atrybutu getBooksWithPrefix2 jest dokładnie taką samą anonimową funkcją strzałkową wygenerowaną przez inną anonimową funkcję strzałkową jak getBooksWithPrefix1 ale różnica polega na tym że funkcja ta odwołuje się do atrybutu this.prefix2 który jest dostępny w definicji konstruktora. Ostatni przypadek to zwykła funkcja która zwraca funkcję strzałkową i przypisuje ją do atrybutu getBooksWithPrefix3. Tutaj zwracana funkcja strzałkowa nie ma dostępu ani do this.prefixani też do this.prefix2 więc aby wartość nie była \"undefined\" trzeba lokalnie zadeklarować zmienną localPrefix (zwykła funkcja tworzy swoją lokalną zmienną this).",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\",\"polish\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/03 16:25:51
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/03 16:25:51
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | Definiując funkcję w języku Javascript możemy też tworzyć klasy objektów, a dokładniej konstruktory tych klas. Tutaj należy zwrócić szczególną uwagę na zmienną "this" wskazującą na aktualny objekt klasy, bo zasięg tej zmiennej może być ograniczony lokalną zmienną "this" zwykłej funkcji której definicja znajduje się wewnącz konstruktora. Problemu tego nie ma z funkcjami strzałkowymi które nie tworzą swoje lokalnego kontekstu (closure) i dlatego zawsze odwołują się do "this" widzianego na zewnącz, jest to szczególnie użyteczne w momencie kiedy użyjemy całego łańcucha funkcji ze strzałką gdzie wynik jednej funkcji => jest parametrem wejściowym drugiej funkcji strzałkowej. ```javascript function BookList (prefix) { this.prefix = prefix; this.prefix2 = 'd' this.makeGetBooksWithPrefix = function() { return () => { /* zmienna "this" objektu klasy BookList lub*/ /* zmienna "this" metody getBooksWithPrefix */ return ["book1", "book2", "book3"].map(book => `${this.prefix}${book}` ); } } this.getBooksWithPrefix1 = (() => { return () => { /* atrybut "this.prefix" objektu klasy BookList, nieokreślony jeszcze w definicji klasy */ return ["book1", "book2", "book3"].map(book => `${this.prefix}${book}` ); } })(); this.getBooksWithPrefix2 = (() => { return () => { /* atrybut "this.prefix2" klasy BookList, określony w definicji klasy */ return ["book1", "book2", "book3"].map(book => `${this.prefix2}${book}` ); } })(); this.getBooksWithPrefix3 = (function() { /* funkcja odwołuje się do tego kontekstu, inaczej war. this.prefix2 będzie undefined */ this.localPrefix = '?' return () => { /* zmienna "this" metody getBooksWithPrefix3 */ return ["book1", "book2", "book3"].map(book => `${this.localPrefix}${book}` ); } })() } let c = new BookList('*'); let d = new BookList('x'); /* użycie funkcji wygenerowanej lokalnie w miejscu wywołania: */ console.log( c.makeGetBooksWithPrefix()() ); console.log( d.makeGetBooksWithPrefix()() ); /* użycie funkcji wygenerowanych wcześniej w konstruktorze: */ console.log( d.getBooksWithPrefix1() ); console.log( d.getBooksWithPrefix2() ); console.log( d.getBooksWithPrefix3() ); // wynik funkcji stworzonej lokalnie: // [ '*book1', '*book2', '*book3' ] // [ 'xbook1', 'xbook2', 'xbook3' ] // wynik funkcji stworzonych w konstruktorze: // [ 'xbook1', 'xbook2', 'xbook3' ] // [ 'dbook1', 'dbook2', 'dbook3' ] // [ '?book1', '?book2', '?book3' ] ``` Przykład powyżej pokazuje jak zastosowanie notacji strzałkowej (arrow functions) zmienia znaczenie zmiennej "this". Każde odwołanie do "this" wewnątrz funkcji strzałkowej odnosi się do zasięgu w którym taka funkcja jest definiowana, jeżeli brakuje szukanej zmiennej to sprawdzany jest zasięg bardziej zewnęczny - w przykładzie powyżej this.prefix nie jest zdefiniowany w funkcji makeGetBooksWithPrefix więc pobrany jest prefix z funkcji BookList. Ponieważ funkcja makeGetBooksWithPrefix tworzy i zwraca właściwą funkcję anonimową w miejscu jej wywołania to właśnie w tym momencie określana jest wartość this.prefix. (jest to akutalna wartość atrybutu prefix w objekcie klasy BookList). Podobnie zachowuje się anonimowa funkcja przypisana do zmiennej getBooksWithPrefix1 - wartość this.prefix jest nieokreślona w momencie generowania tej funkcji więc użycie tej funkcji dla konkretnego obiektu pobiera aktualną wartość this.prefix tego objektu. Funkcja przypisana do atrybutu getBooksWithPrefix2 jest dokładnie taką samą anonimową funkcją strzałkową wygenerowaną przez inną anonimową funkcję strzałkową jak getBooksWithPrefix1 ale różnica polega na tym że funkcja ta odwołuje się do atrybutu this.prefix2 który jest dostępny w definicji konstruktora. Ostatni przypadek to zwykła funkcja która zwraca funkcję strzałkową i przypisuje ją do atrybutu getBooksWithPrefix3. Tutaj zwracana funkcja strzałkowa nie ma dostępu ani do this.prefixani też do this.prefix2 więc aby wartość nie była "undefined" trzeba lokalnie zadeklarować zmienną localPrefix (zwykła funkcja tworzy swoją lokalną zmienną this). |
| json metadata | {"tags":["javascript","programowanie"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #29136411/Trx f073a5d81537c5431c367d279ffc0897a3b5df22 |
View Raw JSON Data
{
"trx_id": "f073a5d81537c5431c367d279ffc0897a3b5df22",
"block": 29136411,
"trx_in_block": 56,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-03T16:25:51",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "Definiując funkcję w języku Javascript możemy też tworzyć klasy objektów, a dokładniej konstruktory tych klas. Tutaj należy zwrócić szczególną uwagę na zmienną \"this\" wskazującą na aktualny objekt klasy, bo zasięg tej zmiennej może być ograniczony lokalną zmienną \"this\" zwykłej funkcji której definicja znajduje się wewnącz konstruktora. Problemu tego nie ma z funkcjami strzałkowymi które nie tworzą swoje lokalnego kontekstu (closure) i dlatego zawsze odwołują się do \"this\" widzianego na zewnącz, jest to szczególnie użyteczne w momencie kiedy użyjemy całego łańcucha funkcji ze strzałką gdzie wynik jednej funkcji => jest parametrem wejściowym drugiej funkcji strzałkowej.\n\n```javascript\nfunction BookList (prefix) { \n \n this.prefix = prefix; \n this.prefix2 = 'd' \n\n this.makeGetBooksWithPrefix = function() { \n return () => {\n /* zmienna \"this\" objektu klasy BookList lub*/\n /* zmienna \"this\" metody getBooksWithPrefix */ \n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.prefix}${book}` );\n } \n }\n\n this.getBooksWithPrefix1 = (() => { \n return () => { \n /* atrybut \"this.prefix\" objektu klasy BookList, nieokreślony jeszcze w definicji klasy */\n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.prefix}${book}` );\n } \n })();\n\n this.getBooksWithPrefix2 = (() => { \n return () => { \n /* atrybut \"this.prefix2\" klasy BookList, określony w definicji klasy */ \n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.prefix2}${book}` ); \n } \n })();\n\n this.getBooksWithPrefix3 = (function() {\n /* funkcja odwołuje się do tego kontekstu, inaczej war. this.prefix2 będzie undefined */\n this.localPrefix = '?' \n return () => {\n /* zmienna \"this\" metody getBooksWithPrefix3 */\n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.localPrefix}${book}` ); \n } \n })()\n}\n\nlet c = new BookList('*');\nlet d = new BookList('x');\n\n/* użycie funkcji wygenerowanej lokalnie w miejscu wywołania: */\nconsole.log( c.makeGetBooksWithPrefix()() );\nconsole.log( d.makeGetBooksWithPrefix()() );\n\n/* użycie funkcji wygenerowanych wcześniej w konstruktorze: */\nconsole.log( d.getBooksWithPrefix1() );\nconsole.log( d.getBooksWithPrefix2() );\nconsole.log( d.getBooksWithPrefix3() );\n\n// wynik funkcji stworzonej lokalnie:\n// [ '*book1', '*book2', '*book3' ]\n// [ 'xbook1', 'xbook2', 'xbook3' ]\n\n// wynik funkcji stworzonych w konstruktorze:\n// [ 'xbook1', 'xbook2', 'xbook3' ]\n// [ 'dbook1', 'dbook2', 'dbook3' ]\n// [ '?book1', '?book2', '?book3' ]\n```\n\nPrzykład powyżej pokazuje jak zastosowanie notacji strzałkowej (arrow functions) zmienia znaczenie zmiennej \"this\". Każde odwołanie do \"this\" wewnątrz funkcji strzałkowej odnosi się do zasięgu w którym taka funkcja jest definiowana, jeżeli brakuje szukanej zmiennej to sprawdzany jest zasięg bardziej zewnęczny - w przykładzie powyżej this.prefix nie jest zdefiniowany w funkcji makeGetBooksWithPrefix więc pobrany jest prefix z funkcji BookList. Ponieważ funkcja makeGetBooksWithPrefix tworzy i zwraca właściwą funkcję anonimową w miejscu jej wywołania to właśnie w tym momencie określana jest wartość this.prefix. (jest to akutalna wartość atrybutu prefix w objekcie klasy BookList). Podobnie zachowuje się anonimowa funkcja przypisana do zmiennej getBooksWithPrefix1 - wartość this.prefix jest nieokreślona w momencie generowania tej funkcji więc użycie tej funkcji dla konkretnego obiektu pobiera aktualną wartość this.prefix tego objektu. Funkcja przypisana do atrybutu getBooksWithPrefix2 jest dokładnie taką samą anonimową funkcją strzałkową wygenerowaną przez inną anonimową funkcję strzałkową jak getBooksWithPrefix1 ale różnica polega na tym że funkcja ta odwołuje się do atrybutu this.prefix2 który jest dostępny w definicji konstruktora. Ostatni przypadek to zwykła funkcja która zwraca funkcję strzałkową i przypisuje ją do atrybutu getBooksWithPrefix3. Tutaj zwracana funkcja strzałkowa nie ma dostępu ani do this.prefixani też do this.prefix2 więc aby wartość nie była \"undefined\" trzeba lokalnie zadeklarować zmienną localPrefix (zwykła funkcja tworzy swoją lokalną zmienną this).",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}hozn4ukhlytriwcupvoted (20.00%) @damii / uzycie-zmiennej-this-w-jezyku-javascript2019/01/02 15:43:21
hozn4ukhlytriwcupvoted (20.00%) @damii / uzycie-zmiennej-this-w-jezyku-javascript
2019/01/02 15:43:21
| voter | hozn4ukhlytriwc |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| weight | 2000 (20.00%) |
| Transaction Info | Block #29106798/Trx 76ddf39e3fff9e52accc14f4d9287cf9a525a622 |
View Raw JSON Data
{
"trx_id": "76ddf39e3fff9e52accc14f4d9287cf9a525a622",
"block": 29106798,
"trx_in_block": 32,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-02T15:43:21",
"op": [
"vote",
{
"voter": "hozn4ukhlytriwc",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"weight": 2000
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/02 15:13:03
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/02 15:13:03
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | @@ -672,16 +672,30 @@ kowej.%0A%0A +%60%60%60javascript%0A function @@ -2620,16 +2620,19 @@ ook3' %5D%0A +%60%60%60 %0A%0APrzyk%C5%82 |
| json metadata | {"tags":["javascript","programowanie"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #29106192/Trx efda9420cabefd4dc56d147a8ae6d5ccf6ddf246 |
View Raw JSON Data
{
"trx_id": "efda9420cabefd4dc56d147a8ae6d5ccf6ddf246",
"block": 29106192,
"trx_in_block": 5,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-02T15:13:03",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "@@ -672,16 +672,30 @@\n kowej.%0A%0A\n+%60%60%60javascript%0A\n function\n@@ -2620,16 +2620,19 @@\n ook3' %5D%0A\n+%60%60%60\n %0A%0APrzyk%C5%82\n",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}2019/01/02 13:45:09
2019/01/02 13:45:09
| delegator | steem |
| delegatee | damii |
| vesting shares | 29124.301549 VESTS |
| Transaction Info | Block #29104438/Trx c9b6f720fd274848b411e00b09adfd1b2c0795b2 |
View Raw JSON Data
{
"trx_id": "c9b6f720fd274848b411e00b09adfd1b2c0795b2",
"block": 29104438,
"trx_in_block": 23,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-02T13:45:09",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "29124.301549 VESTS"
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/02 13:07:39
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/02 13:07:39
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | @@ -2607,16 +2607,17 @@ ok3' %5D%0A%0A +%0A Przyk%C5%82ad |
| json metadata | {"tags":["javascript","programowanie"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #29103688/Trx 7d962ffd43da95e8e38c5f9a50c9f0d5a040f935 |
View Raw JSON Data
{
"trx_id": "7d962ffd43da95e8e38c5f9a50c9f0d5a040f935",
"block": 29103688,
"trx_in_block": 15,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-02T13:07:39",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "@@ -2607,16 +2607,17 @@\n ok3' %5D%0A%0A\n+%0A\n Przyk%C5%82ad\n",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/02 12:54:30
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/02 12:54:30
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | Definiując funkcję w języku Javascript możemy też tworzyć klasy objektów, a dokładniej konstruktory tych klas. Tutaj należy zwrócić szczególną uwagę na zmienną "this" wskazującą na aktualny objekt klasy, bo zasięg tej zmiennej może być ograniczony lokalną zmienną "this" zwykłej funkcji której definicja znajduje się wewnącz konstruktora. Problemu tego nie ma z funkcjami strzałkowymi które nie tworzą swoje lokalnego kontekstu (closure) i dlatego zawsze odwołują się do "this" widzianego na zewnącz, jest to szczególnie użyteczne w momencie kiedy użyjemy całego łańcucha funkcji ze strzałką gdzie wynik jednej funkcji => jest parametrem wejściowym drugiej funkcji strzałkowej. function BookList (prefix) { this.prefix = prefix; this.prefix2 = 'd' this.makeGetBooksWithPrefix = function() { return () => { /* zmienna "this" objektu klasy BookList lub*/ /* zmienna "this" metody getBooksWithPrefix */ return ["book1", "book2", "book3"].map(book => `${this.prefix}${book}` ); } } this.getBooksWithPrefix1 = (() => { return () => { /* atrybut "this.prefix" objektu klasy BookList, nieokreślony jeszcze w definicji klasy */ return ["book1", "book2", "book3"].map(book => `${this.prefix}${book}` ); } })(); this.getBooksWithPrefix2 = (() => { return () => { /* atrybut "this.prefix2" klasy BookList, określony w definicji klasy */ return ["book1", "book2", "book3"].map(book => `${this.prefix2}${book}` ); } })(); this.getBooksWithPrefix3 = (function() { /* funkcja odwołuje się do tego kontekstu, inaczej war. this.prefix2 będzie undefined */ this.localPrefix = '?' return () => { /* zmienna "this" metody getBooksWithPrefix3 */ return ["book1", "book2", "book3"].map(book => `${this.localPrefix}${book}` ); } })() } let c = new BookList('*'); let d = new BookList('x'); /* użycie funkcji wygenerowanej lokalnie w miejscu wywołania: */ console.log( c.makeGetBooksWithPrefix()() ); console.log( d.makeGetBooksWithPrefix()() ); /* użycie funkcji wygenerowanych wcześniej w konstruktorze: */ console.log( d.getBooksWithPrefix1() ); console.log( d.getBooksWithPrefix2() ); console.log( d.getBooksWithPrefix3() ); // wynik funkcji stworzonej lokalnie: // [ '*book1', '*book2', '*book3' ] // [ 'xbook1', 'xbook2', 'xbook3' ] // wynik funkcji stworzonych w konstruktorze: // [ 'xbook1', 'xbook2', 'xbook3' ] // [ 'dbook1', 'dbook2', 'dbook3' ] // [ '?book1', '?book2', '?book3' ] Przykład powyżej pokazuje jak zastosowanie notacji strzałkowej (arrow functions) zmienia znaczenie zmiennej "this". Każde odwołanie do "this" wewnątrz funkcji strzałkowej odnosi się do zasięgu w którym taka funkcja jest definiowana, jeżeli brakuje szukanej zmiennej to sprawdzany jest zasięg bardziej zewnęczny - w przykładzie powyżej this.prefix nie jest zdefiniowany w funkcji makeGetBooksWithPrefix więc pobrany jest prefix z funkcji BookList. Ponieważ funkcja makeGetBooksWithPrefix tworzy i zwraca właściwą funkcję anonimową w miejscu jej wywołania to właśnie w tym momencie określana jest wartość this.prefix. (jest to akutalna wartość atrybutu prefix w objekcie klasy BookList). Podobnie zachowuje się anonimowa funkcja przypisana do zmiennej getBooksWithPrefix1 - wartość this.prefix jest nieokreślona w momencie generowania tej funkcji więc użycie tej funkcji dla konkretnego obiektu pobiera aktualną wartość this.prefix tego objektu. Funkcja przypisana do atrybutu getBooksWithPrefix2 jest dokładnie taką samą anonimową funkcją strzałkową wygenerowaną przez inną anonimową funkcję strzałkową jak getBooksWithPrefix1 ale różnica polega na tym że funkcja ta odwołuje się do atrybutu this.prefix2 który jest dostępny w definicji konstruktora. Ostatni przypadek to zwykła funkcja która zwraca funkcję strzałkową i przypisuje ją do atrybutu getBooksWithPrefix3. Tutaj zwracana funkcja strzałkowa nie ma dostępu ani do this.prefixani też do this.prefix2 więc aby wartość nie była "undefined" trzeba lokalnie zadeklarować zmienną localPrefix (zwykła funkcja tworzy swoją lokalną zmienną this). |
| json metadata | {"tags":["javascript","programowanie"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #29103426/Trx 29d7a1ebeb4d743cd2adbebe076d9ec0b4beaf7d |
View Raw JSON Data
{
"trx_id": "29d7a1ebeb4d743cd2adbebe076d9ec0b4beaf7d",
"block": 29103426,
"trx_in_block": 23,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-02T12:54:30",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "Definiując funkcję w języku Javascript możemy też tworzyć klasy objektów, a dokładniej konstruktory tych klas. Tutaj należy zwrócić szczególną uwagę na zmienną \"this\" wskazującą na aktualny objekt klasy, bo zasięg tej zmiennej może być ograniczony lokalną zmienną \"this\" zwykłej funkcji której definicja znajduje się wewnącz konstruktora. Problemu tego nie ma z funkcjami strzałkowymi które nie tworzą swoje lokalnego kontekstu (closure) i dlatego zawsze odwołują się do \"this\" widzianego na zewnącz, jest to szczególnie użyteczne w momencie kiedy użyjemy całego łańcucha funkcji ze strzałką gdzie wynik jednej funkcji => jest parametrem wejściowym drugiej funkcji strzałkowej.\n\nfunction BookList (prefix) { \n \n this.prefix = prefix; \n this.prefix2 = 'd' \n\n this.makeGetBooksWithPrefix = function() { \n return () => {\n /* zmienna \"this\" objektu klasy BookList lub*/\n /* zmienna \"this\" metody getBooksWithPrefix */ \n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.prefix}${book}` );\n } \n }\n\n this.getBooksWithPrefix1 = (() => { \n return () => { \n /* atrybut \"this.prefix\" objektu klasy BookList, nieokreślony jeszcze w definicji klasy */\n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.prefix}${book}` );\n } \n })();\n\n this.getBooksWithPrefix2 = (() => { \n return () => { \n /* atrybut \"this.prefix2\" klasy BookList, określony w definicji klasy */ \n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.prefix2}${book}` ); \n } \n })();\n\n this.getBooksWithPrefix3 = (function() {\n /* funkcja odwołuje się do tego kontekstu, inaczej war. this.prefix2 będzie undefined */\n this.localPrefix = '?' \n return () => {\n /* zmienna \"this\" metody getBooksWithPrefix3 */\n return [\"book1\", \"book2\", \"book3\"].map(book => `${this.localPrefix}${book}` ); \n } \n })()\n}\n\nlet c = new BookList('*');\nlet d = new BookList('x');\n\n/* użycie funkcji wygenerowanej lokalnie w miejscu wywołania: */\nconsole.log( c.makeGetBooksWithPrefix()() );\nconsole.log( d.makeGetBooksWithPrefix()() );\n\n/* użycie funkcji wygenerowanych wcześniej w konstruktorze: */\nconsole.log( d.getBooksWithPrefix1() );\nconsole.log( d.getBooksWithPrefix2() );\nconsole.log( d.getBooksWithPrefix3() );\n\n// wynik funkcji stworzonej lokalnie:\n// [ '*book1', '*book2', '*book3' ]\n// [ 'xbook1', 'xbook2', 'xbook3' ]\n\n// wynik funkcji stworzonych w konstruktorze:\n// [ 'xbook1', 'xbook2', 'xbook3' ]\n// [ 'dbook1', 'dbook2', 'dbook3' ]\n// [ '?book1', '?book2', '?book3' ]\n\nPrzykład powyżej pokazuje jak zastosowanie notacji strzałkowej (arrow functions) zmienia znaczenie zmiennej \"this\". Każde odwołanie do \"this\" wewnątrz funkcji strzałkowej odnosi się do zasięgu w którym taka funkcja jest definiowana, jeżeli brakuje szukanej zmiennej to sprawdzany jest zasięg bardziej zewnęczny - w przykładzie powyżej this.prefix nie jest zdefiniowany w funkcji makeGetBooksWithPrefix więc pobrany jest prefix z funkcji BookList. Ponieważ funkcja makeGetBooksWithPrefix tworzy i zwraca właściwą funkcję anonimową w miejscu jej wywołania to właśnie w tym momencie określana jest wartość this.prefix. (jest to akutalna wartość atrybutu prefix w objekcie klasy BookList). Podobnie zachowuje się anonimowa funkcja przypisana do zmiennej getBooksWithPrefix1 - wartość this.prefix jest nieokreślona w momencie generowania tej funkcji więc użycie tej funkcji dla konkretnego obiektu pobiera aktualną wartość this.prefix tego objektu. Funkcja przypisana do atrybutu getBooksWithPrefix2 jest dokładnie taką samą anonimową funkcją strzałkową wygenerowaną przez inną anonimową funkcję strzałkową jak getBooksWithPrefix1 ale różnica polega na tym że funkcja ta odwołuje się do atrybutu this.prefix2 który jest dostępny w definicji konstruktora. Ostatni przypadek to zwykła funkcja która zwraca funkcję strzałkową i przypisuje ją do atrybutu getBooksWithPrefix3. Tutaj zwracana funkcja strzałkowa nie ma dostępu ani do this.prefixani też do this.prefix2 więc aby wartość nie była \"undefined\" trzeba lokalnie zadeklarować zmienną localPrefix (zwykła funkcja tworzy swoją lokalną zmienną this).",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}damiideleted a comment or post2019/01/02 12:50:48
damiideleted a comment or post
2019/01/02 12:50:48
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| Transaction Info | Block #29103352/Trx a7b764278120795b9dbac1ac8c64d9521a4072b2 |
View Raw JSON Data
{
"trx_id": "a7b764278120795b9dbac1ac8c64d9521a4072b2",
"block": 29103352,
"trx_in_block": 2,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-02T12:50:48",
"op": [
"delete_comment",
{
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript"
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/02 12:50:27
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/02 12:50:27
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | <html> <p>fsgsf</p> <p>asdfasd</p> <p>asdf</p> </html> |
| json metadata | {"tags":["javascript","programowanie"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #29103345/Trx da54fa17e2fb19c46e3ec07053fa64081b6b2141 |
View Raw JSON Data
{
"trx_id": "da54fa17e2fb19c46e3ec07053fa64081b6b2141",
"block": 29103345,
"trx_in_block": 16,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-02T12:50:27",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "<html>\n<p>fsgsf</p>\n<p>asdfasd</p>\n<p>asdf</p>\n</html>",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript2019/01/02 12:40:21
damiipublished a new post: uzycie-zmiennej-this-w-jezyku-javascript
2019/01/02 12:40:21
| parent author | |
| parent permlink | javascript |
| author | damii |
| permlink | uzycie-zmiennej-this-w-jezyku-javascript |
| title | Użycie zmiennej "this" w języku Javascript |
| body | <html> <p>Definiując funkcję w języku Javascript możemy też tworzyć klasy objektów, a dokładniej konstruktory tych klas. Tutaj należy zwrócić szczególną uwagę na zmienną "this" wskazującą na aktualny objekt klasy, bo zasięg tej zmiennej może być ograniczony lokalną zmienną "this" zwykłej funkcji której definicja znajduje się wewnącz konstruktora. Problemu tego nie ma z funkcjami strzałkowymi które nie tworzą swoje lokalnego kontekstu (closure) i dlatego zawsze odwołują się do "this" widzianego na zewnącz, jest to szczególnie użyteczne w momencie kiedy użyjemy całego łańcucha funkcji ze strzałką gdzie wynik jednej funkcji => jest parametrem wejściowym drugiej funkcji strzałkowej.</p> <pre><code><strong>function</strong> <strong>BookList</strong> (prefix) { <br> <br> <strong>this</strong>.prefix = prefix; <br> <strong>this</strong>.prefix2 = 'd' <br> <br> <strong>this</strong>.makeGetBooksWithPrefix = <strong>function</strong>() { <br> <strong>return</strong> () => {<br> <em>/* zmienna "this" objektu klasy BookList lub*/</em><br> <em>/* zmienna "this" metody getBooksWithPrefix */</em> <br> <strong>return</strong> ["book1", "book2", "book3"].map(book => `${<strong>this</strong>.prefix}${book}` );<br> } <br> }<br> <br> <strong>this</strong>.getBooksWithPrefix1 = (() => { <br> <strong>return</strong> () => { <br> <em>/* atrybut "this.prefix" objektu klasy BookList, nieokreślony jeszcze w definicji klasy */</em><br> <strong>return</strong> ["book1", "book2", "book3"].map(book => `${<strong>this</strong>.prefix}${book}` );<br> } <br> })();<br> <br> <strong>this</strong>.getBooksWithPrefix2 = (() => { <br> <strong>return</strong> () => { <br> <em>/* atrybut "this.prefix2" klasy BookList, określony w definicji klasy */</em> <br> <strong>return</strong> ["book1", "book2", "book3"].map(book => `${<strong>this</strong>.prefix2}${book}` ); <br> } <br> })();<br> <br> <strong>this</strong>.getBooksWithPrefix3 = (<strong>function</strong>() {<br> /* funkcja odwołuje się do tego kontekstu, inaczej war. this.prefix2 będzie undefined */<br> this.localPrefix = '?' <br> return () => {<br> <em>/* zmienna "this" metody getBooksWithPrefix3 */</em><br> <strong>return</strong> ["book1", "book2", "book3"].map(book => `${<strong>this</strong>.localPrefix}${book}` ); <br> } <br> })()<br> }<br> <br> <strong>let</strong> c = <strong>new</strong> BookList('*');<br> <strong>let</strong> d = <strong>new</strong> BookList('x');<br> <br> <em>/* użycie funkcji wygenerowanej lokalnie w miejscu wywołania: */</em><br> console.log( c.makeGetBooksWithPrefix()() );<br> console.log( d.makeGetBooksWithPrefix()() );<br> <br> <em>/* użycie funkcji wygenerowanych wcześniej w konstruktorze: */</em><br> console.log( d.getBooksWithPrefix1() );<br> console.log( d.getBooksWithPrefix2() );<br> console.log( d.getBooksWithPrefix3() );<br> <br> <em>// wynik funkcji stworzonej lokalnie:</em><br> <em>// [ '*book1', '*book2', '*book3' ]</em><br> <em>// [ 'xbook1', 'xbook2', 'xbook3' ]</em><br> <br> <em>// wynik funkcji stworzonych w konstruktorze:</em><br> <em>// [ 'xbook1', 'xbook2', 'xbook3' ]</em><br> <em>// [ 'dbook1', 'dbook2', 'dbook3' ]</em><br> <em>// [ '?book1', '?book2', '?book3' ]</em></code></pre> <p>Przykład powyżej pokazuje jak zastosowanie notacji strzałkowej (arrow functions) zmienia znaczenie zmiennej "this". Każde odwołanie do "this" wewnątrz funkcji strzałkowej odnosi się do zasięgu w którym taka funkcja jest definiowana, jeżeli brakuje szukanej zmiennej to sprawdzany jest zasięg bardziej zewnęczny - w przykładzie powyżej <code>this.prefix</code> nie jest zdefiniowany w funkcji <code>makeGetBooksWithPrefix</code> więc pobrany jest prefix z funkcji <code>BookList</code>. Ponieważ funkcja <code>makeGetBooksWithPrefix</code> tworzy i zwraca właściwą funkcję anonimową w miejscu jej wywołania to właśnie w tym momencie określana jest wartość <code>this.prefix</code>. (jest to akutalna wartość atrybutu prefix w objekcie klasy <code>BookList</code>). Podobnie zachowuje się anonimowa funkcja przypisana do zmiennej <code>getBooksWithPrefix1</code> - wartość <code>this.prefix</code> jest nieokreślona w momencie generowania tej funkcji więc użycie tej funkcji dla konkretnego obiektu pobiera aktualną wartość <code>this.prefix</code> tego objektu. Funkcja przypisana do atrybutu <code>getBooksWithPrefix2</code> jest dokładnie taką samą anonimową funkcją strzałkową wygenerowaną przez inną anonimową funkcję strzałkową jak <code>getBooksWithPrefix1</code> ale różnica polega na tym że funkcja ta odwołuje się do atrybutu <code>this.prefix2</code> który jest dostępny w definicji konstruktora. Ostatni przypadek to zwykła funkcja która zwraca funkcję strzałkową i przypisuje ją do atrybutu <code>getBooksWithPrefix3</code>. Tutaj zwracana funkcja strzałkowa nie ma dostępu ani do <code>this.prefix</code>ani też do <code>this.prefix2</code> więc aby wartość nie była "undefined" trzeba lokalnie zadeklarować zmienną <code>localPrefix</code> (zwykła funkcja tworzy swoją lokalną zmienną <code>this</code>).</p> </html> |
| json metadata | {"tags":["javascript","programowanie"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #29103143/Trx 265bbdedd32d4f34515e15f9d555cb2693d39c45 |
View Raw JSON Data
{
"trx_id": "265bbdedd32d4f34515e15f9d555cb2693d39c45",
"block": 29103143,
"trx_in_block": 25,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-01-02T12:40:21",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "javascript",
"author": "damii",
"permlink": "uzycie-zmiennej-this-w-jezyku-javascript",
"title": "Użycie zmiennej \"this\" w języku Javascript",
"body": "<html>\n<p>Definiując funkcję w języku Javascript możemy też tworzyć klasy objektów, a dokładniej konstruktory tych klas. Tutaj należy zwrócić szczególną uwagę na zmienną \"this\" wskazującą na aktualny objekt klasy, bo zasięg tej zmiennej może być ograniczony lokalną zmienną \"this\" zwykłej funkcji której definicja znajduje się wewnącz konstruktora. Problemu tego nie ma z funkcjami strzałkowymi które nie tworzą swoje lokalnego kontekstu (closure) i dlatego zawsze odwołują się do \"this\" widzianego na zewnącz, jest to szczególnie użyteczne w momencie kiedy użyjemy całego łańcucha funkcji ze strzałką gdzie wynik jednej funkcji => jest parametrem wejściowym drugiej funkcji strzałkowej.</p>\n<pre><code><strong>function</strong> <strong>BookList</strong> (prefix) { <br>\n <br>\n <strong>this</strong>.prefix = prefix; <br>\n <strong>this</strong>.prefix2 = 'd' <br>\n<br>\n <strong>this</strong>.makeGetBooksWithPrefix = <strong>function</strong>() { <br>\n <strong>return</strong> () => {<br>\n <em>/* zmienna \"this\" objektu klasy BookList lub*/</em><br>\n <em>/* zmienna \"this\" metody getBooksWithPrefix */</em> <br>\n <strong>return</strong> [\"book1\", \"book2\", \"book3\"].map(book => `${<strong>this</strong>.prefix}${book}` );<br>\n } <br>\n }<br>\n<br>\n <strong>this</strong>.getBooksWithPrefix1 = (() => { <br>\n <strong>return</strong> () => { <br>\n <em>/* atrybut \"this.prefix\" objektu klasy BookList, nieokreślony jeszcze w definicji klasy */</em><br>\n <strong>return</strong> [\"book1\", \"book2\", \"book3\"].map(book => `${<strong>this</strong>.prefix}${book}` );<br>\n } <br>\n })();<br>\n<br>\n <strong>this</strong>.getBooksWithPrefix2 = (() => { <br>\n <strong>return</strong> () => { <br>\n <em>/* atrybut \"this.prefix2\" klasy BookList, określony w definicji klasy */</em> <br>\n <strong>return</strong> [\"book1\", \"book2\", \"book3\"].map(book => `${<strong>this</strong>.prefix2}${book}` ); <br>\n } <br>\n })();<br>\n<br>\n <strong>this</strong>.getBooksWithPrefix3 = (<strong>function</strong>() {<br>\n /* funkcja odwołuje się do tego kontekstu, inaczej war. this.prefix2 będzie undefined */<br>\n this.localPrefix = '?' <br>\n return () => {<br>\n <em>/* zmienna \"this\" metody getBooksWithPrefix3 */</em><br>\n <strong>return</strong> [\"book1\", \"book2\", \"book3\"].map(book => `${<strong>this</strong>.localPrefix}${book}` ); <br>\n } <br>\n })()<br>\n}<br>\n<br>\n<strong>let</strong> c = <strong>new</strong> BookList('*');<br>\n<strong>let</strong> d = <strong>new</strong> BookList('x');<br>\n<br>\n<em>/* użycie funkcji wygenerowanej lokalnie w miejscu wywołania: */</em><br>\nconsole.log( c.makeGetBooksWithPrefix()() );<br>\nconsole.log( d.makeGetBooksWithPrefix()() );<br>\n<br>\n<em>/* użycie funkcji wygenerowanych wcześniej w konstruktorze: */</em><br>\nconsole.log( d.getBooksWithPrefix1() );<br>\nconsole.log( d.getBooksWithPrefix2() );<br>\nconsole.log( d.getBooksWithPrefix3() );<br>\n<br>\n<em>// wynik funkcji stworzonej lokalnie:</em><br>\n<em>// [ '*book1', '*book2', '*book3' ]</em><br>\n<em>// [ 'xbook1', 'xbook2', 'xbook3' ]</em><br>\n<br>\n<em>// wynik funkcji stworzonych w konstruktorze:</em><br>\n<em>// [ 'xbook1', 'xbook2', 'xbook3' ]</em><br>\n<em>// [ 'dbook1', 'dbook2', 'dbook3' ]</em><br>\n<em>// [ '?book1', '?book2', '?book3' ]</em></code></pre>\n<p>Przykład powyżej pokazuje jak zastosowanie notacji strzałkowej (arrow functions) zmienia znaczenie zmiennej \"this\". Każde odwołanie do \"this\" wewnątrz funkcji strzałkowej odnosi się do zasięgu w którym taka funkcja jest definiowana, jeżeli brakuje szukanej zmiennej to sprawdzany jest zasięg bardziej zewnęczny - w przykładzie powyżej <code>this.prefix</code> nie jest zdefiniowany w funkcji <code>makeGetBooksWithPrefix</code> więc pobrany jest prefix z funkcji <code>BookList</code>. Ponieważ funkcja <code>makeGetBooksWithPrefix</code> tworzy i zwraca właściwą funkcję anonimową w miejscu jej wywołania to właśnie w tym momencie określana jest wartość <code>this.prefix</code>. (jest to akutalna wartość atrybutu prefix w objekcie klasy <code>BookList</code>). Podobnie zachowuje się anonimowa funkcja przypisana do zmiennej <code>getBooksWithPrefix1</code> - wartość <code>this.prefix</code> jest nieokreślona w momencie generowania tej funkcji więc użycie tej funkcji dla konkretnego obiektu pobiera aktualną wartość <code>this.prefix</code> tego objektu. Funkcja przypisana do atrybutu <code>getBooksWithPrefix2</code> jest dokładnie taką samą anonimową funkcją strzałkową wygenerowaną przez inną anonimową funkcję strzałkową jak <code>getBooksWithPrefix1</code> ale różnica polega na tym że funkcja ta odwołuje się do atrybutu <code>this.prefix2</code> który jest dostępny w definicji konstruktora. Ostatni przypadek to zwykła funkcja która zwraca funkcję strzałkową i przypisuje ją do atrybutu <code>getBooksWithPrefix3</code>. Tutaj zwracana funkcja strzałkowa nie ma dostępu ani do <code>this.prefix</code>ani też do <code>this.prefix2</code> więc aby wartość nie była \"undefined\" trzeba lokalnie zadeklarować zmienną <code>localPrefix</code> (zwykła funkcja tworzy swoją lokalną zmienną <code>this</code>).</p>\n</html>",
"json_metadata": "{\"tags\":[\"javascript\",\"programowanie\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}damiifollowed @five34a4b2018/12/09 09:05:42
damiifollowed @five34a4b
2018/12/09 09:05:42
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"five34a4b","what":["blog"]}] |
| Transaction Info | Block #28408093/Trx d6bf596574c7679ccaf2660b9355710df2d77d1c |
View Raw JSON Data
{
"trx_id": "d6bf596574c7679ccaf2660b9355710df2d77d1c",
"block": 28408093,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-12-09T09:05:42",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"five34a4b\",\"what\":[\"blog\"]}]"
}
]
}damiifollowed @apismellifera2018/12/08 17:46:12
damiifollowed @apismellifera
2018/12/08 17:46:12
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"apismellifera","what":["blog"]}] |
| Transaction Info | Block #28389710/Trx 72f38e0ff62b5932bc942f85379d82ebde28425c |
View Raw JSON Data
{
"trx_id": "72f38e0ff62b5932bc942f85379d82ebde28425c",
"block": 28389710,
"trx_in_block": 23,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-12-08T17:46:12",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"apismellifera\",\"what\":[\"blog\"]}]"
}
]
}damiiupdated their account properties2018/12/07 20:59:54
damiiupdated their account properties
2018/12/07 20:59:54
| account | damii |
| owner | {"weight_threshold":1,"account_auths":[],"key_auths":[["STM5fEeQHzKqxKrbMM3W94ZBE84ucRwtvPDdfCaBt4aMhotQ1u3DL",1]]} |
| active | {"weight_threshold":1,"account_auths":[],"key_auths":[["STM8cNV4yHHRWQYiUZA8ue7RZ6tL6acC3h79VsX6pAETWztrQg8je",1]]} |
| posting | {"weight_threshold":1,"account_auths":[["busy.app",1],["dtube.app",1]],"key_auths":[["STM5hSnVkFPRUvLRhxSCug18RnTiG47GGCarcNRL8s8BtrTfyn4AE",1]]} |
| memo key | STM5xVLrJ4uW4xhXRGo8KdbBjf7bwBcEzgAPP7vzWppptP1igfgZD |
| json metadata | {"profile":{"name":"damii","website":"http://www.damii.pl","about":"Dariusz Mikołajczyk","location":"Poland","profile_image":"http://www.damii.pl/images/misc/DariuszMikolajczyk.jpg","cover_image":"http://www.damii.pl/images/artwork/Moja_Pasieka_06.jpg"}} |
| Transaction Info | Block #28364810/Trx 0591b0a07d0f96e92f142b5992afed7e71a62dc3 |
View Raw JSON Data
{
"trx_id": "0591b0a07d0f96e92f142b5992afed7e71a62dc3",
"block": 28364810,
"trx_in_block": 19,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-12-07T20:59:54",
"op": [
"account_update",
{
"account": "damii",
"owner": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM5fEeQHzKqxKrbMM3W94ZBE84ucRwtvPDdfCaBt4aMhotQ1u3DL",
1
]
]
},
"active": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM8cNV4yHHRWQYiUZA8ue7RZ6tL6acC3h79VsX6pAETWztrQg8je",
1
]
]
},
"posting": {
"weight_threshold": 1,
"account_auths": [
[
"busy.app",
1
],
[
"dtube.app",
1
]
],
"key_auths": [
[
"STM5hSnVkFPRUvLRhxSCug18RnTiG47GGCarcNRL8s8BtrTfyn4AE",
1
]
]
},
"memo_key": "STM5xVLrJ4uW4xhXRGo8KdbBjf7bwBcEzgAPP7vzWppptP1igfgZD",
"json_metadata": "{\"profile\":{\"name\":\"damii\",\"website\":\"http://www.damii.pl\",\"about\":\"Dariusz Mikołajczyk\",\"location\":\"Poland\",\"profile_image\":\"http://www.damii.pl/images/misc/DariuszMikolajczyk.jpg\",\"cover_image\":\"http://www.damii.pl/images/artwork/Moja_Pasieka_06.jpg\"}}"
}
]
}2018/11/26 17:09:06
2018/11/26 17:09:06
| delegator | steem |
| delegatee | damii |
| vesting shares | 9046.410313 VESTS |
| Transaction Info | Block #28043523/Trx 8a665e9fbf2ec53cda85b6985c08a17f59d26213 |
View Raw JSON Data
{
"trx_id": "8a665e9fbf2ec53cda85b6985c08a17f59d26213",
"block": 28043523,
"trx_in_block": 35,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-11-26T17:09:06",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "9046.410313 VESTS"
}
]
}2018/09/21 23:59:21
2018/09/21 23:59:21
| delegator | steem |
| delegatee | damii |
| vesting shares | 29293.662288 VESTS |
| Transaction Info | Block #26152430/Trx 4b462c37757eccb832a4e39bf2a7378367659620 |
View Raw JSON Data
{
"trx_id": "4b462c37757eccb832a4e39bf2a7378367659620",
"block": 26152430,
"trx_in_block": 22,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-09-21T23:59:21",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "29293.662288 VESTS"
}
]
}damiifollowed @indywidualista2018/08/23 19:47:30
damiifollowed @indywidualista
2018/08/23 19:47:30
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"indywidualista","what":["blog"]}] |
| Transaction Info | Block #25328179/Trx f49cff1c1f632c33a61033b8c74f6ca745f126c6 |
View Raw JSON Data
{
"trx_id": "f49cff1c1f632c33a61033b8c74f6ca745f126c6",
"block": 25328179,
"trx_in_block": 3,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-08-23T19:47:30",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"indywidualista\",\"what\":[\"blog\"]}]"
}
]
}damiifollowed @wideoprezentacje2018/08/10 08:49:27
damiifollowed @wideoprezentacje
2018/08/10 08:49:27
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"wideoprezentacje","what":["blog"]}] |
| Transaction Info | Block #24940746/Trx 96e7cc9a1e2a9f18e658f4d3e66a966812b2ac12 |
View Raw JSON Data
{
"trx_id": "96e7cc9a1e2a9f18e658f4d3e66a966812b2ac12",
"block": 24940746,
"trx_in_block": 2,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-08-10T08:49:27",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"wideoprezentacje\",\"what\":[\"blog\"]}]"
}
]
}damiifollowed @ency-kryptowalut2018/08/08 08:33:03
damiifollowed @ency-kryptowalut
2018/08/08 08:33:03
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"ency-kryptowalut","what":["blog"]}] |
| Transaction Info | Block #24882855/Trx 5ac04c42d98c1b019ee00afc7bc96394e0186d38 |
View Raw JSON Data
{
"trx_id": "5ac04c42d98c1b019ee00afc7bc96394e0186d38",
"block": 24882855,
"trx_in_block": 24,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-08-08T08:33:03",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"ency-kryptowalut\",\"what\":[\"blog\"]}]"
}
]
}damiiremoved vote from (0.00%) @haejin / s-and-p-500-daily-update-keep-an-eye-on-this-h-and-s-top-patern2018/08/01 12:32:06
damiiremoved vote from (0.00%) @haejin / s-and-p-500-daily-update-keep-an-eye-on-this-h-and-s-top-patern
2018/08/01 12:32:06
| voter | damii |
| author | haejin |
| permlink | s-and-p-500-daily-update-keep-an-eye-on-this-h-and-s-top-patern |
| weight | 0 (0.00%) |
| Transaction Info | Block #24686104/Trx 65e5a0d6fb3a0f0f4336569e8dc17a03cd166350 |
View Raw JSON Data
{
"trx_id": "65e5a0d6fb3a0f0f4336569e8dc17a03cd166350",
"block": 24686104,
"trx_in_block": 51,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-08-01T12:32:06",
"op": [
"vote",
{
"voter": "damii",
"author": "haejin",
"permlink": "s-and-p-500-daily-update-keep-an-eye-on-this-h-and-s-top-patern",
"weight": 0
}
]
}damiiupvoted (100.00%) @haejin / s-and-p-500-daily-update-keep-an-eye-on-this-h-and-s-top-patern2018/08/01 12:31:54
damiiupvoted (100.00%) @haejin / s-and-p-500-daily-update-keep-an-eye-on-this-h-and-s-top-patern
2018/08/01 12:31:54
| voter | damii |
| author | haejin |
| permlink | s-and-p-500-daily-update-keep-an-eye-on-this-h-and-s-top-patern |
| weight | 10000 (100.00%) |
| Transaction Info | Block #24686100/Trx c64736b343005a142989a3268adfca1efca6ba1e |
View Raw JSON Data
{
"trx_id": "c64736b343005a142989a3268adfca1efca6ba1e",
"block": 24686100,
"trx_in_block": 32,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-08-01T12:31:54",
"op": [
"vote",
{
"voter": "damii",
"author": "haejin",
"permlink": "s-and-p-500-daily-update-keep-an-eye-on-this-h-and-s-top-patern",
"weight": 10000
}
]
}2018/05/18 19:07:00
2018/05/18 19:07:00
| delegator | steem |
| delegatee | damii |
| vesting shares | 29496.009529 VESTS |
| Transaction Info | Block #22546032/Trx 4ca86c7ac567d2b01b5c5a76583c0a31adbaf69f |
View Raw JSON Data
{
"trx_id": "4ca86c7ac567d2b01b5c5a76583c0a31adbaf69f",
"block": 22546032,
"trx_in_block": 35,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-18T19:07:00",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "damii",
"vesting_shares": "29496.009529 VESTS"
}
]
}damiiupvoted (100.00%) @gurghet / write-eos-contracts-in-rust-instead-of-c2018/05/17 17:50:57
damiiupvoted (100.00%) @gurghet / write-eos-contracts-in-rust-instead-of-c
2018/05/17 17:50:57
| voter | damii |
| author | gurghet |
| permlink | write-eos-contracts-in-rust-instead-of-c |
| weight | 10000 (100.00%) |
| Transaction Info | Block #22515716/Trx 4ce27104748330c7792afbafc552b3d915a82707 |
View Raw JSON Data
{
"trx_id": "4ce27104748330c7792afbafc552b3d915a82707",
"block": 22515716,
"trx_in_block": 11,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-17T17:50:57",
"op": [
"vote",
{
"voter": "damii",
"author": "gurghet",
"permlink": "write-eos-contracts-in-rust-instead-of-c",
"weight": 10000
}
]
}2018/05/14 20:25:27
2018/05/14 20:25:27
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"ivanli","what":["blog"]}] |
| Transaction Info | Block #22432419/Trx 2a8bc9288a033f94c867f3016509209508defbd7 |
View Raw JSON Data
{
"trx_id": "2a8bc9288a033f94c867f3016509209508defbd7",
"block": 22432419,
"trx_in_block": 89,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-14T20:25:27",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"ivanli\",\"what\":[\"blog\"]}]"
}
]
}damiiupvoted (100.00%) @ivanli / programming-on-eos-vs-eth-programmer-explains2018/05/14 20:23:30
damiiupvoted (100.00%) @ivanli / programming-on-eos-vs-eth-programmer-explains
2018/05/14 20:23:30
| voter | damii |
| author | ivanli |
| permlink | programming-on-eos-vs-eth-programmer-explains |
| weight | 10000 (100.00%) |
| Transaction Info | Block #22432380/Trx e9549f344e942a1406fb664e4d4850599911113a |
View Raw JSON Data
{
"trx_id": "e9549f344e942a1406fb664e4d4850599911113a",
"block": 22432380,
"trx_in_block": 36,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-14T20:23:30",
"op": [
"vote",
{
"voter": "damii",
"author": "ivanli",
"permlink": "programming-on-eos-vs-eth-programmer-explains",
"weight": 10000
}
]
}2018/05/01 17:13:45
2018/05/01 17:13:45
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"lafzaia","what":["blog"]}] |
| Transaction Info | Block #22054263/Trx 381d99006e7f2211130018d5dab64a4490aad4c7 |
View Raw JSON Data
{
"trx_id": "381d99006e7f2211130018d5dab64a4490aad4c7",
"block": 22054263,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-01T17:13:45",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"lafzaia\",\"what\":[\"blog\"]}]"
}
]
}damiiupvoted (100.00%) @lafzaia / travelling-dream-city2018/05/01 17:13:24
damiiupvoted (100.00%) @lafzaia / travelling-dream-city
2018/05/01 17:13:24
| voter | damii |
| author | lafzaia |
| permlink | travelling-dream-city |
| weight | 10000 (100.00%) |
| Transaction Info | Block #22054256/Trx 4a2cdf064de1d9424cd0b0838b8ee0614487b976 |
View Raw JSON Data
{
"trx_id": "4a2cdf064de1d9424cd0b0838b8ee0614487b976",
"block": 22054256,
"trx_in_block": 9,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-01T17:13:24",
"op": [
"vote",
{
"voter": "damii",
"author": "lafzaia",
"permlink": "travelling-dream-city",
"weight": 10000
}
]
}2018/05/01 17:07:45
2018/05/01 17:07:45
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"bania","what":["blog"]}] |
| Transaction Info | Block #22054143/Trx c4e714afc070c655f3a932d3cc83887892237c92 |
View Raw JSON Data
{
"trx_id": "c4e714afc070c655f3a932d3cc83887892237c92",
"block": 22054143,
"trx_in_block": 29,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-01T17:07:45",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"bania\",\"what\":[\"blog\"]}]"
}
]
}damiiupvoted (100.00%) @bania / binance-will-support-eos-mainnet-token-swap2018/05/01 17:04:09
damiiupvoted (100.00%) @bania / binance-will-support-eos-mainnet-token-swap
2018/05/01 17:04:09
| voter | damii |
| author | bania |
| permlink | binance-will-support-eos-mainnet-token-swap |
| weight | 10000 (100.00%) |
| Transaction Info | Block #22054071/Trx 6ac5c37d9b2c0632d5b24b36df0513557a962458 |
View Raw JSON Data
{
"trx_id": "6ac5c37d9b2c0632d5b24b36df0513557a962458",
"block": 22054071,
"trx_in_block": 52,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-01T17:04:09",
"op": [
"vote",
{
"voter": "damii",
"author": "bania",
"permlink": "binance-will-support-eos-mainnet-token-swap",
"weight": 10000
}
]
}2018/04/15 15:55:03
2018/04/15 15:55:03
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"eosio","what":["blog"]}] |
| Transaction Info | Block #21592618/Trx b8ba5345b1f50787b5e1650e6bd86c0df0272b73 |
View Raw JSON Data
{
"trx_id": "b8ba5345b1f50787b5e1650e6bd86c0df0272b73",
"block": 21592618,
"trx_in_block": 59,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-15T15:55:03",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"eosio\",\"what\":[\"blog\"]}]"
}
]
}damiifollowed @eos-helpguide2018/04/15 15:53:54
damiifollowed @eos-helpguide
2018/04/15 15:53:54
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"eos-helpguide","what":["blog"]}] |
| Transaction Info | Block #21592595/Trx 5657ca69d2f4b47c3ec8ddadbc9c5a678c182e03 |
View Raw JSON Data
{
"trx_id": "5657ca69d2f4b47c3ec8ddadbc9c5a678c182e03",
"block": 21592595,
"trx_in_block": 52,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-15T15:53:54",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"eos-helpguide\",\"what\":[\"blog\"]}]"
}
]
}damiiupvoted (100.00%) @penguinpablo / how-did-the-top-50-cryptocurrencies-perform-in-march-20182018/04/02 20:38:33
damiiupvoted (100.00%) @penguinpablo / how-did-the-top-50-cryptocurrencies-perform-in-march-2018
2018/04/02 20:38:33
| voter | damii |
| author | penguinpablo |
| permlink | how-did-the-top-50-cryptocurrencies-perform-in-march-2018 |
| weight | 10000 (100.00%) |
| Transaction Info | Block #21223938/Trx 8806fc00a6b693e266a4229059eb5461c2f0ed0a |
View Raw JSON Data
{
"trx_id": "8806fc00a6b693e266a4229059eb5461c2f0ed0a",
"block": 21223938,
"trx_in_block": 15,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-02T20:38:33",
"op": [
"vote",
{
"voter": "damii",
"author": "penguinpablo",
"permlink": "how-did-the-top-50-cryptocurrencies-perform-in-march-2018",
"weight": 10000
}
]
}damiifollowed @penguinpablo2018/04/02 20:38:12
damiifollowed @penguinpablo
2018/04/02 20:38:12
| required auths | [] |
| required posting auths | ["damii"] |
| id | follow |
| json | ["follow",{"follower":"damii","following":"penguinpablo","what":["blog"]}] |
| Transaction Info | Block #21223931/Trx 5920d98b91c85d3488b68b3a2baeb797058f39a7 |
View Raw JSON Data
{
"trx_id": "5920d98b91c85d3488b68b3a2baeb797058f39a7",
"block": 21223931,
"trx_in_block": 68,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-02T20:38:12",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"damii"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"damii\",\"following\":\"penguinpablo\",\"what\":[\"blog\"]}]"
}
]
}damiiupvoted (100.00%) @brandonh / real-world-haskell-book-review2018/04/02 20:31:36
damiiupvoted (100.00%) @brandonh / real-world-haskell-book-review
2018/04/02 20:31:36
| voter | damii |
| author | brandonh |
| permlink | real-world-haskell-book-review |
| weight | 10000 (100.00%) |
| Transaction Info | Block #21223799/Trx e2232238017d14513dd32da8ab0e1033b806e908 |
View Raw JSON Data
{
"trx_id": "e2232238017d14513dd32da8ab0e1033b806e908",
"block": 21223799,
"trx_in_block": 35,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-02T20:31:36",
"op": [
"vote",
{
"voter": "damii",
"author": "brandonh",
"permlink": "real-world-haskell-book-review",
"weight": 10000
}
]
}damiipublished a new post: monadic-parsing-in-haskell2018/04/01 22:45:54
damiipublished a new post: monadic-parsing-in-haskell
2018/04/01 22:45:54
| parent author | |
| parent permlink | haskell |
| author | damii |
| permlink | monadic-parsing-in-haskell |
| title | Monadic Parsing in Haskell |
| body | @@ -670,18 +670,28 @@ g point -to +for learning parsers @@ -704,14 +704,9 @@ onad - topic +s in |
| json metadata | {"tags":["haskell","parser","monads"],"links":["https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell","https://www.youtube.com/watch?v=OrAVS4QbMqo"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #21197689/Trx b004bca58952dfb3b7585e63e1c6e37e653c76b0 |
View Raw JSON Data
{
"trx_id": "b004bca58952dfb3b7585e63e1c6e37e653c76b0",
"block": 21197689,
"trx_in_block": 44,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-01T22:45:54",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "haskell",
"author": "damii",
"permlink": "monadic-parsing-in-haskell",
"title": "Monadic Parsing in Haskell",
"body": "@@ -670,18 +670,28 @@\n g point \n-to\n+for learning\n parsers\n@@ -704,14 +704,9 @@\n onad\n- topic\n+s\n in \n",
"json_metadata": "{\"tags\":[\"haskell\",\"parser\",\"monads\"],\"links\":[\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\",\"https://www.youtube.com/watch?v=OrAVS4QbMqo\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}damiipublished a new post: monadic-parsing-in-haskell2018/04/01 22:43:54
damiipublished a new post: monadic-parsing-in-haskell
2018/04/01 22:43:54
| parent author | |
| parent permlink | haskell |
| author | damii |
| permlink | monadic-parsing-in-haskell |
| title | Monadic Parsing in Haskell |
| body | <html> <p>Just running piece of code..</p> <p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href="https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p> <p>Older version of this parser example was used by Erik Meijer in video "C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13" here: <a href="https://www.youtube.com/watch?v=OrAVS4QbMqo">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p> <p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p> <pre><code>import System.IO import Data.Char import Control.Monad import Control.Applicative --https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell newtype Parser a = Parser (String -> [(a, String)]) instance Functor Parser where fmap = liftM instance Applicative Parser where pure a = Parser (\cs -> [(a,cs)]) (<*>) = ap instance Monad Parser where return a = Parser (\cs -> [(a,cs)]) p >>= f = Parser (\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) instance MonadPlus Parser where p `mplus` q = Parser (\cs -> parse p cs ++ parse q cs) mzero = Parser (const []) instance Alternative Parser where (<|>) = mplus empty = mzero parse :: Parser a -> String -> [(a, String)] parse (Parser p) = p apply :: Parser a -> String -> [(a,String)] apply p = parse (do {space; p}) failure :: Parser a failure = mzero -- (+++) :: Parser a -> Parser a -> Parser a -- p +++ q = Parser (\cs -> case parse (p ++ q) cs of -- [] -> [] -- (x:xs) -> [x]) (+++) :: Parser a -> Parser a -> Parser a p +++ q = p `mplus` q -- sat :: (Char -> Bool) -> Parser Char -- sat p = do {c <- item; if p c then return c else zero} sat :: (Char -> Bool) -> Parser Char sat p = do { ; x <- item ; if p x then return x else failure } char :: Char -> Parser Char char c = sat (c ==) manyP :: Parser a -> Parser [a] manyP p = manyP1 p +++ return [] manyP1 :: Parser a -> Parser [a] manyP1 p = do { ; a <- p; ; as <- manyP p; ; return (a:as) } space :: Parser String space = manyP (sat isSpace) item :: Parser Char item = Parser (\cs -> case cs of "" -> [] (c:cs) -> [(c,cs)]) main = do { ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) "abcd" ; putStrLn "bye" } </code></pre> </html> |
| json metadata | {"tags":["haskell","parser","monads"],"links":["https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell","https://www.youtube.com/watch?v=OrAVS4QbMqo"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #21197649/Trx 18525a8c17210f568e25b16ab9eb13cce3ddc7ce |
View Raw JSON Data
{
"trx_id": "18525a8c17210f568e25b16ab9eb13cce3ddc7ce",
"block": 21197649,
"trx_in_block": 47,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-01T22:43:54",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "haskell",
"author": "damii",
"permlink": "monadic-parsing-in-haskell",
"title": "Monadic Parsing in Haskell",
"body": "<html>\n<p>Just running piece of code..</p>\n<p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href=\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p>\n<p>Older version of this parser example was used by Erik Meijer in video \"C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13\" here: <a href=\"https://www.youtube.com/watch?v=OrAVS4QbMqo\">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p>\n<p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p>\n<pre><code>import System.IO\nimport Data.Char\nimport Control.Monad\nimport Control.Applicative\n\n--https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\n\nnewtype Parser a = Parser (String -> [(a, String)])\n\ninstance Functor Parser where\n fmap = liftM\n\ninstance Applicative Parser where\n pure a = Parser (\\cs -> [(a,cs)])\n (<*>) = ap\n\n\ninstance Monad Parser where\n return a = Parser (\\cs -> [(a,cs)])\n p >>= f = Parser (\\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) \n\n\ninstance MonadPlus Parser where\n p `mplus` q = Parser (\\cs -> parse p cs ++ parse q cs)\n mzero = Parser (const [])\n\n\ninstance Alternative Parser where\n (<|>) = mplus\n empty = mzero\n\n\nparse :: Parser a -> String -> [(a, String)]\nparse (Parser p) = p\n\n\napply :: Parser a -> String -> [(a,String)]\napply p = parse (do {space; p})\n\n\nfailure :: Parser a\nfailure = mzero\n\n\n-- (+++) :: Parser a -> Parser a -> Parser a\n-- p +++ q = Parser (\\cs -> case parse (p ++ q) cs of\n-- [] -> []\n-- (x:xs) -> [x])\n(+++) :: Parser a -> Parser a -> Parser a\np +++ q = p `mplus` q\n\n\n-- sat :: (Char -> Bool) -> Parser Char\n-- sat p = do {c <- item; if p c then return c else zero}\nsat :: (Char -> Bool) -> Parser Char\nsat p = do {\n\n ; x <- item\n ; if p x then return x else failure\n}\n\nchar :: Char -> Parser Char\nchar c = sat (c ==)\n\n\nmanyP :: Parser a -> Parser [a]\nmanyP p = manyP1 p +++ return []\nmanyP1 :: Parser a -> Parser [a]\nmanyP1 p = do {\n\n ; a <- p; \n ; as <- manyP p; \n ; return (a:as)\n}\n\n\nspace :: Parser String\nspace = manyP (sat isSpace)\n\n\nitem :: Parser Char\nitem = Parser (\\cs -> case cs of\n \"\" -> []\n (c:cs) -> [(c,cs)])\n\n\nmain = do {\n\n ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) \"abcd\"\n ; putStrLn \"bye\"\n}\n</code></pre>\n</html>",
"json_metadata": "{\"tags\":[\"haskell\",\"parser\",\"monads\"],\"links\":[\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\",\"https://www.youtube.com/watch?v=OrAVS4QbMqo\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}damiipublished a new post: monadic-parsing-in-haskell2018/04/01 22:43:15
damiipublished a new post: monadic-parsing-in-haskell
2018/04/01 22:43:15
| parent author | |
| parent permlink | haskell |
| author | damii |
| permlink | monadic-parsing-in-haskell |
| title | Monadic Parsing in Haskell |
| body | <html> <p>Just running piece of code..</p> <p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href="https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p> <p>Older version of this parser example was used by Erik Meijer in video "C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13" here: <a href="https://www.youtube.com/watch?v=OrAVS4QbMqo">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p> <p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p> <pre><code>import System.IO<br> import Data.Char<br> import Control.Monad<br> import Control.Applicative<br> <br> <br> newtype Parser a = Parser (String -> [(a, String)])<br> <br> instance Functor Parser where<br> fmap = liftM<br> <br> instance Applicative Parser where<br> pure a = Parser (\cs -> [(a,cs)])<br> (<*>) = ap<br> <br> <br> instance Monad Parser where<br> return a = Parser (\cs -> [(a,cs)])<br> p >>= f = Parser (\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) <br> <br> <br> instance MonadPlus Parser where<br> p `mplus` q = Parser (\cs -> parse p cs ++ parse q cs)<br> mzero = Parser (const [])<br> <br> <br> instance Alternative Parser where<br> (<|>) = mplus<br> empty = mzero<br> <br> <br> parse :: Parser a -> String -> [(a, String)]<br> parse (Parser p) = p<br> <br> <br> apply :: Parser a -> String -> [(a,String)]<br> apply p = parse (do {space; p})<br> <br> <br> failure :: Parser a<br> failure = mzero<br> <br> <br> -- (+++) :: Parser a -> Parser a -> Parser a<br> -- p +++ q = Parser (\cs -> case parse (p ++ q) cs of<br> -- [] -> []<br> -- (x:xs) -> [x])<br> (+++) :: Parser a -> Parser a -> Parser a<br> p +++ q = p `mplus` q<br> <br> <br> -- sat :: (Char -> Bool) -> Parser Char<br> -- sat p = do {c <- item; if p c then return c else zero}<br> sat :: (Char -> Bool) -> Parser Char<br> sat p = do {<br> <br> ; x <- item<br> ; if p x then return x else failure<br> }<br> <br> char :: Char -> Parser Char<br> char c = sat (c ==)<br> <br> <br> manyP :: Parser a -> Parser [a]<br> manyP p = manyP1 p +++ return []<br> manyP1 :: Parser a -> Parser [a]<br> manyP1 p = do {<br> <br> ; a <- p; <br> ; as <- manyP p; <br> ; return (a:as)<br> }<br> <br> <br> space :: Parser String<br> space = manyP (sat isSpace)<br> <br> <br> item :: Parser Char<br> item = Parser (\cs -> case cs of<br> "" -> []<br> (c:cs) -> [(c,cs)])<br> <br> <br> main = do {<br> <br> ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) "abcd"<br> ; putStrLn "bye"<br> }<br> </code></pre> </html> |
| json metadata | {"tags":["haskell","parser","monads"],"links":["https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell","https://www.youtube.com/watch?v=OrAVS4QbMqo"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #21197636/Trx 89c8bdcffb2609ad8d89295db5685071940a52ff |
View Raw JSON Data
{
"trx_id": "89c8bdcffb2609ad8d89295db5685071940a52ff",
"block": 21197636,
"trx_in_block": 32,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-01T22:43:15",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "haskell",
"author": "damii",
"permlink": "monadic-parsing-in-haskell",
"title": "Monadic Parsing in Haskell",
"body": "<html>\n<p>Just running piece of code..</p>\n<p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href=\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p>\n<p>Older version of this parser example was used by Erik Meijer in video \"C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13\" here: <a href=\"https://www.youtube.com/watch?v=OrAVS4QbMqo\">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p>\n<p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p>\n<pre><code>import System.IO<br>\nimport Data.Char<br>\nimport Control.Monad<br>\nimport Control.Applicative<br>\n<br>\n<br>\nnewtype Parser a = Parser (String -> [(a, String)])<br>\n<br>\ninstance Functor Parser where<br>\n fmap = liftM<br>\n<br>\ninstance Applicative Parser where<br>\n pure a = Parser (\\cs -> [(a,cs)])<br>\n (<*>) = ap<br>\n<br>\n<br>\ninstance Monad Parser where<br>\n return a = Parser (\\cs -> [(a,cs)])<br>\n p >>= f = Parser (\\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) <br>\n<br>\n<br>\ninstance MonadPlus Parser where<br>\n p `mplus` q = Parser (\\cs -> parse p cs ++ parse q cs)<br>\n mzero = Parser (const [])<br>\n<br>\n<br>\ninstance Alternative Parser where<br>\n (<|>) = mplus<br>\n empty = mzero<br>\n<br>\n<br>\nparse :: Parser a -> String -> [(a, String)]<br>\nparse (Parser p) = p<br>\n<br>\n<br>\napply :: Parser a -> String -> [(a,String)]<br>\napply p = parse (do {space; p})<br>\n<br>\n<br>\nfailure :: Parser a<br>\nfailure = mzero<br>\n<br>\n<br>\n-- (+++) :: Parser a -> Parser a -> Parser a<br>\n-- p +++ q = Parser (\\cs -> case parse (p ++ q) cs of<br>\n-- [] -> []<br>\n-- (x:xs) -> [x])<br>\n(+++) :: Parser a -> Parser a -> Parser a<br>\np +++ q = p `mplus` q<br>\n<br>\n<br>\n-- sat :: (Char -> Bool) -> Parser Char<br>\n-- sat p = do {c <- item; if p c then return c else zero}<br>\nsat :: (Char -> Bool) -> Parser Char<br>\nsat p = do {<br>\n<br>\n ; x <- item<br>\n ; if p x then return x else failure<br>\n}<br>\n<br>\nchar :: Char -> Parser Char<br>\nchar c = sat (c ==)<br>\n<br>\n<br>\nmanyP :: Parser a -> Parser [a]<br>\nmanyP p = manyP1 p +++ return []<br>\nmanyP1 :: Parser a -> Parser [a]<br>\nmanyP1 p = do {<br>\n<br>\n ; a <- p; <br>\n ; as <- manyP p; <br>\n ; return (a:as)<br>\n}<br>\n<br>\n<br>\nspace :: Parser String<br>\nspace = manyP (sat isSpace)<br>\n<br>\n<br>\nitem :: Parser Char<br>\nitem = Parser (\\cs -> case cs of<br>\n \"\" -> []<br>\n (c:cs) -> [(c,cs)])<br>\n<br>\n<br>\nmain = do {<br>\n<br>\n ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) \"abcd\"<br>\n ; putStrLn \"bye\"<br>\n}<br>\n</code></pre>\n</html>",
"json_metadata": "{\"tags\":[\"haskell\",\"parser\",\"monads\"],\"links\":[\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\",\"https://www.youtube.com/watch?v=OrAVS4QbMqo\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}damiipublished a new post: monadic-parsing-in-haskell2018/04/01 21:31:30
damiipublished a new post: monadic-parsing-in-haskell
2018/04/01 21:31:30
| parent author | |
| parent permlink | haskell |
| author | damii |
| permlink | monadic-parsing-in-haskell |
| title | Monadic Parsing in Haskell |
| body | <html> <p>Just running piece of code..</p> <p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href="https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p> <p>This parser example also was mentioned by Erik Meijer in video "C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13" here: <a href="https://www.youtube.com/watch?v=OrAVS4QbMqo">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p> <p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p> <pre><code>import System.IO import Data.Char import Control.Monad import Control.Applicative newtype Parser a = Parser (String -> [(a, String)]) instance Functor Parser where fmap = liftM instance Applicative Parser where pure a = Parser (\cs -> [(a,cs)]) (<*>) = ap instance Monad Parser where return a = Parser (\cs -> [(a,cs)]) p >>= f = Parser (\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) instance MonadPlus Parser where p `mplus` q = Parser (\cs -> parse p cs ++ parse q cs) mzero = Parser (const []) instance Alternative Parser where (<|>) = mplus empty = mzero parse :: Parser a -> String -> [(a, String)] parse (Parser p) = p apply :: Parser a -> String -> [(a,String)] apply p = parse (do {space; p}) failure :: Parser a failure = mzero -- (+++) :: Parser a -> Parser a -> Parser a -- p +++ q = Parser (\cs -> case parse (p ++ q) cs of -- [] -> [] -- (x:xs) -> [x]) (+++) :: Parser a -> Parser a -> Parser a p +++ q = p `mplus` q -- sat :: (Char -> Bool) -> Parser Char -- sat p = do {c <- item; if p c then return c else zero} sat :: (Char -> Bool) -> Parser Char sat p = do { ; x <- item ; if p x then return x else failure } char :: Char -> Parser Char char c = sat (c ==) manyP :: Parser a -> Parser [a] manyP p = manyP1 p +++ return [] manyP1 :: Parser a -> Parser [a] manyP1 p = do { ; a <- p; ; as <- manyP p; ; return (a:as) } space :: Parser String space = manyP (sat isSpace) item :: Parser Char item = Parser (\cs -> case cs of "" -> [] (c:cs) -> [(c,cs)]) main = do { ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) "abcd" ; putStrLn "bye" } </code></pre> </html> |
| json metadata | {"tags":["haskell","parser","monads"],"links":["https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell","https://www.youtube.com/watch?v=OrAVS4QbMqo"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #21196201/Trx 1e93628324711f674afd86a1daecfe30726780c1 |
View Raw JSON Data
{
"trx_id": "1e93628324711f674afd86a1daecfe30726780c1",
"block": 21196201,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-01T21:31:30",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "haskell",
"author": "damii",
"permlink": "monadic-parsing-in-haskell",
"title": "Monadic Parsing in Haskell",
"body": "<html>\n<p>Just running piece of code..</p>\n<p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href=\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p>\n<p>This parser example also was mentioned by Erik Meijer in video \"C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13\" here: <a href=\"https://www.youtube.com/watch?v=OrAVS4QbMqo\">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p>\n<p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p>\n<pre><code>import System.IO\nimport Data.Char\nimport Control.Monad\nimport Control.Applicative\n\n\nnewtype Parser a = Parser (String -> [(a, String)])\n\ninstance Functor Parser where\n fmap = liftM\n\ninstance Applicative Parser where\n pure a = Parser (\\cs -> [(a,cs)])\n (<*>) = ap\n\n\ninstance Monad Parser where\n return a = Parser (\\cs -> [(a,cs)])\n p >>= f = Parser (\\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) \n\n\ninstance MonadPlus Parser where\n p `mplus` q = Parser (\\cs -> parse p cs ++ parse q cs)\n mzero = Parser (const [])\n\n\ninstance Alternative Parser where\n (<|>) = mplus\n empty = mzero\n\n\nparse :: Parser a -> String -> [(a, String)]\nparse (Parser p) = p\n\n\napply :: Parser a -> String -> [(a,String)]\napply p = parse (do {space; p})\n\n\nfailure :: Parser a\nfailure = mzero\n\n\n-- (+++) :: Parser a -> Parser a -> Parser a\n-- p +++ q = Parser (\\cs -> case parse (p ++ q) cs of\n-- [] -> []\n-- (x:xs) -> [x])\n(+++) :: Parser a -> Parser a -> Parser a\np +++ q = p `mplus` q\n\n\n-- sat :: (Char -> Bool) -> Parser Char\n-- sat p = do {c <- item; if p c then return c else zero}\nsat :: (Char -> Bool) -> Parser Char\nsat p = do {\n\n ; x <- item\n ; if p x then return x else failure\n}\n\nchar :: Char -> Parser Char\nchar c = sat (c ==)\n\n\nmanyP :: Parser a -> Parser [a]\nmanyP p = manyP1 p +++ return []\nmanyP1 :: Parser a -> Parser [a]\nmanyP1 p = do {\n\n ; a <- p; \n ; as <- manyP p; \n ; return (a:as)\n}\n\n\nspace :: Parser String\nspace = manyP (sat isSpace)\n\n\nitem :: Parser Char\nitem = Parser (\\cs -> case cs of\n \"\" -> []\n (c:cs) -> [(c,cs)])\n\n\nmain = do {\n\n ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) \"abcd\"\n ; putStrLn \"bye\"\n}\n</code></pre>\n</html>",
"json_metadata": "{\"tags\":[\"haskell\",\"parser\",\"monads\"],\"links\":[\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\",\"https://www.youtube.com/watch?v=OrAVS4QbMqo\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}damiipublished a new post: monadic-parsing-in-haskell2018/04/01 21:30:45
damiipublished a new post: monadic-parsing-in-haskell
2018/04/01 21:30:45
| parent author | |
| parent permlink | haskell |
| author | damii |
| permlink | monadic-parsing-in-haskell |
| title | Monadic Parsing in Haskell |
| body | <html> <p>Just running piece of code..</p> <p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href="https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p> <p>This parser example also was mentioned by Erik Meijer in video "C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13" here: <a href="https://www.youtube.com/watch?v=OrAVS4QbMqo">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p> <p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p> <pre><code>import System.IO<br> <br> import Data.Char<br> <br> import Control.Monad<br> <br> import Control.Applicative<br> <br> <br> <br> <br> <br> newtype Parser a = Parser (String -> [(a, String)])<br> <br> <br> <br> instance Functor Parser where<br> <br> fmap = liftM<br> <br> <br> <br> instance Applicative Parser where<br> <br> pure a = Parser (\cs -> [(a,cs)])<br> <br> (<*>) = ap<br> <br> <br> <br> <br> <br> instance Monad Parser where<br> <br> return a = Parser (\cs -> [(a,cs)])<br> <br> p >>= f = Parser (\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) <br> <br> <br> <br> <br> <br> instance MonadPlus Parser where<br> <br> p `mplus` q = Parser (\cs -> parse p cs ++ parse q cs)<br> <br> mzero = Parser (const [])<br> <br> <br> <br> <br> <br> instance Alternative Parser where<br> <br> (<|>) = mplus<br> <br> empty = mzero<br> <br> <br> <br> <br> <br> parse :: Parser a -> String -> [(a, String)]<br> <br> parse (Parser p) = p<br> <br> <br> <br> <br> <br> apply :: Parser a -> String -> [(a,String)]<br> <br> apply p = parse (do {space; p})<br> <br> <br> <br> <br> <br> failure :: Parser a<br> <br> failure = mzero<br> <br> <br> <br> <br> <br> -- (+++) :: Parser a -> Parser a -> Parser a<br> <br> -- p +++ q = Parser (\cs -> case parse (p ++ q) cs of<br> <br> -- [] -> []<br> <br> -- (x:xs) -> [x])<br> <br> (+++) :: Parser a -> Parser a -> Parser a<br> <br> p +++ q = p `mplus` q<br> <br> <br> <br> <br> <br> -- sat :: (Char -> Bool) -> Parser Char<br> <br> -- sat p = do {c <- item; if p c then return c else zero}<br> <br> sat :: (Char -> Bool) -> Parser Char<br> <br> sat p = do {<br> <br> <br> <br> ; x <- item<br> <br> ; if p x then return x else failure<br> <br> }<br> <br> <br> <br> char :: Char -> Parser Char<br> <br> char c = sat (c ==)<br> <br> <br> <br> <br> <br> manyP :: Parser a -> Parser [a]<br> <br> manyP p = manyP1 p +++ return []<br> <br> manyP1 :: Parser a -> Parser [a]<br> <br> manyP1 p = do {<br> <br> <br> <br> ; a <- p; <br> <br> ; as <- manyP p; <br> <br> ; return (a:as)<br> <br> }<br> <br> <br> <br> <br> <br> space :: Parser String<br> <br> space = manyP (sat isSpace)<br> <br> <br> <br> <br> <br> item :: Parser Char<br> <br> item = Parser (\cs -> case cs of<br> <br> "" -> []<br> <br> (c:cs) -> [(c,cs)])<br> <br> <br> <br> <br> <br> main = do {<br> <br> <br> <br> ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) "abcd"<br> <br> ; putStrLn "bye"<br> <br> }<br> <br> </code></pre> </html> |
| json metadata | {"tags":["haskell","parser","monads"],"links":["https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell","https://www.youtube.com/watch?v=OrAVS4QbMqo"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #21196186/Trx 6e9ede52c36b4f3fe93e5198b81312c78536ee33 |
View Raw JSON Data
{
"trx_id": "6e9ede52c36b4f3fe93e5198b81312c78536ee33",
"block": 21196186,
"trx_in_block": 36,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-01T21:30:45",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "haskell",
"author": "damii",
"permlink": "monadic-parsing-in-haskell",
"title": "Monadic Parsing in Haskell",
"body": "<html>\n<p>Just running piece of code..</p>\n<p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href=\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p>\n<p>This parser example also was mentioned by Erik Meijer in video \"C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13\" here: <a href=\"https://www.youtube.com/watch?v=OrAVS4QbMqo\">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p>\n<p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p>\n<pre><code>import System.IO<br>\n<br>\nimport Data.Char<br>\n<br>\nimport Control.Monad<br>\n<br>\nimport Control.Applicative<br>\n<br>\n<br>\n<br>\n<br>\n<br>\nnewtype Parser a = Parser (String -> [(a, String)])<br>\n<br>\n<br>\n<br>\ninstance Functor Parser where<br>\n<br>\n fmap = liftM<br>\n<br>\n<br>\n<br>\ninstance Applicative Parser where<br>\n<br>\n pure a = Parser (\\cs -> [(a,cs)])<br>\n<br>\n (<*>) = ap<br>\n<br>\n<br>\n<br>\n<br>\n<br>\ninstance Monad Parser where<br>\n<br>\n return a = Parser (\\cs -> [(a,cs)])<br>\n<br>\n p >>= f = Parser (\\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) <br>\n<br>\n<br>\n<br>\n<br>\n<br>\ninstance MonadPlus Parser where<br>\n<br>\n p `mplus` q = Parser (\\cs -> parse p cs ++ parse q cs)<br>\n<br>\n mzero = Parser (const [])<br>\n<br>\n<br>\n<br>\n<br>\n<br>\ninstance Alternative Parser where<br>\n<br>\n (<|>) = mplus<br>\n<br>\n empty = mzero<br>\n<br>\n<br>\n<br>\n<br>\n<br>\nparse :: Parser a -> String -> [(a, String)]<br>\n<br>\nparse (Parser p) = p<br>\n<br>\n<br>\n<br>\n<br>\n<br>\napply :: Parser a -> String -> [(a,String)]<br>\n<br>\napply p = parse (do {space; p})<br>\n<br>\n<br>\n<br>\n<br>\n<br>\nfailure :: Parser a<br>\n<br>\nfailure = mzero<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n-- (+++) :: Parser a -> Parser a -> Parser a<br>\n<br>\n-- p +++ q = Parser (\\cs -> case parse (p ++ q) cs of<br>\n<br>\n-- [] -> []<br>\n<br>\n-- (x:xs) -> [x])<br>\n<br>\n(+++) :: Parser a -> Parser a -> Parser a<br>\n<br>\np +++ q = p `mplus` q<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n-- sat :: (Char -> Bool) -> Parser Char<br>\n<br>\n-- sat p = do {c <- item; if p c then return c else zero}<br>\n<br>\nsat :: (Char -> Bool) -> Parser Char<br>\n<br>\nsat p = do {<br>\n<br>\n<br>\n<br>\n ; x <- item<br>\n<br>\n ; if p x then return x else failure<br>\n<br>\n}<br>\n<br>\n<br>\n<br>\nchar :: Char -> Parser Char<br>\n<br>\nchar c = sat (c ==)<br>\n<br>\n<br>\n<br>\n<br>\n<br>\nmanyP :: Parser a -> Parser [a]<br>\n<br>\nmanyP p = manyP1 p +++ return []<br>\n<br>\nmanyP1 :: Parser a -> Parser [a]<br>\n<br>\nmanyP1 p = do {<br>\n<br>\n<br>\n<br>\n ; a <- p; <br>\n<br>\n ; as <- manyP p; <br>\n<br>\n ; return (a:as)<br>\n<br>\n}<br>\n<br>\n<br>\n<br>\n<br>\n<br>\nspace :: Parser String<br>\n<br>\nspace = manyP (sat isSpace)<br>\n<br>\n<br>\n<br>\n<br>\n<br>\nitem :: Parser Char<br>\n<br>\nitem = Parser (\\cs -> case cs of<br>\n<br>\n \"\" -> []<br>\n<br>\n (c:cs) -> [(c,cs)])<br>\n<br>\n<br>\n<br>\n<br>\n<br>\nmain = do {<br>\n<br>\n<br>\n<br>\n ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) \"abcd\"<br>\n<br>\n ; putStrLn \"bye\"<br>\n<br>\n}<br>\n<br>\n</code></pre>\n</html>",
"json_metadata": "{\"tags\":[\"haskell\",\"parser\",\"monads\"],\"links\":[\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\",\"https://www.youtube.com/watch?v=OrAVS4QbMqo\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}damiipublished a new post: monadic-parsing-in-haskell2018/04/01 21:29:51
damiipublished a new post: monadic-parsing-in-haskell
2018/04/01 21:29:51
| parent author | |
| parent permlink | haskell |
| author | damii |
| permlink | monadic-parsing-in-haskell |
| title | Monadic Parsing in Haskell |
| body | <html> <p>Just running piece of code..</p> <p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href="https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p> <p>This parser example also was mentioned by Erik Meijer in video "C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13" here: <a href="https://www.youtube.com/watch?v=OrAVS4QbMqo">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p> <p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p> <pre><code>import System.IO<br> import Data.Char<br> import Control.Monad<br> import Control.Applicative<br> <br> <br> newtype Parser a = Parser (String -> [(a, String)])<br> <br> instance Functor Parser where<br> fmap = liftM<br> <br> instance Applicative Parser where<br> pure a = Parser (\cs -> [(a,cs)])<br> (<*>) = ap<br> <br> <br> instance Monad Parser where<br> return a = Parser (\cs -> [(a,cs)])<br> p >>= f = Parser (\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) <br> <br> <br> instance MonadPlus Parser where<br> p `mplus` q = Parser (\cs -> parse p cs ++ parse q cs)<br> mzero = Parser (const [])<br> <br> <br> instance Alternative Parser where<br> (<|>) = mplus<br> empty = mzero<br> <br> <br> parse :: Parser a -> String -> [(a, String)]<br> parse (Parser p) = p<br> <br> <br> apply :: Parser a -> String -> [(a,String)]<br> apply p = parse (do {space; p})<br> <br> <br> failure :: Parser a<br> failure = mzero<br> <br> <br> -- (+++) :: Parser a -> Parser a -> Parser a<br> -- p +++ q = Parser (\cs -> case parse (p ++ q) cs of<br> -- [] -> []<br> -- (x:xs) -> [x])<br> (+++) :: Parser a -> Parser a -> Parser a<br> p +++ q = p `mplus` q<br> <br> <br> -- sat :: (Char -> Bool) -> Parser Char<br> -- sat p = do {c <- item; if p c then return c else zero}<br> sat :: (Char -> Bool) -> Parser Char<br> sat p = do {<br> <br> ; x <- item<br> ; if p x then return x else failure<br> }<br> <br> char :: Char -> Parser Char<br> char c = sat (c ==)<br> <br> <br> manyP :: Parser a -> Parser [a]<br> manyP p = manyP1 p +++ return []<br> manyP1 :: Parser a -> Parser [a]<br> manyP1 p = do {<br> <br> ; a <- p; <br> ; as <- manyP p; <br> ; return (a:as)<br> }<br> <br> <br> space :: Parser String<br> space = manyP (sat isSpace)<br> <br> <br> item :: Parser Char<br> item = Parser (\cs -> case cs of<br> "" -> []<br> (c:cs) -> [(c,cs)])<br> <br> <br> main = do {<br> <br> ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) "abcd"<br> ; putStrLn "bye"<br> }<br> </code></pre> </html> |
| json metadata | {"tags":["haskell","parser","monads"],"links":["https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell","https://www.youtube.com/watch?v=OrAVS4QbMqo"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #21196168/Trx 37e24a8ea35eedea15d7120ce3c39b8ab4c2fe8f |
View Raw JSON Data
{
"trx_id": "37e24a8ea35eedea15d7120ce3c39b8ab4c2fe8f",
"block": 21196168,
"trx_in_block": 18,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-01T21:29:51",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "haskell",
"author": "damii",
"permlink": "monadic-parsing-in-haskell",
"title": "Monadic Parsing in Haskell",
"body": "<html>\n<p>Just running piece of code..</p>\n<p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href=\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p>\n<p>This parser example also was mentioned by Erik Meijer in video \"C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13\" here: <a href=\"https://www.youtube.com/watch?v=OrAVS4QbMqo\">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p>\n<p>Hope this will be usefull for somebody, this minimal example is good starting point to parsers and monad topic in Haskell language.</p>\n<pre><code>import System.IO<br>\nimport Data.Char<br>\nimport Control.Monad<br>\nimport Control.Applicative<br>\n<br>\n<br>\nnewtype Parser a = Parser (String -> [(a, String)])<br>\n<br>\ninstance Functor Parser where<br>\n fmap = liftM<br>\n<br>\ninstance Applicative Parser where<br>\n pure a = Parser (\\cs -> [(a,cs)])<br>\n (<*>) = ap<br>\n<br>\n<br>\ninstance Monad Parser where<br>\n return a = Parser (\\cs -> [(a,cs)])<br>\n p >>= f = Parser (\\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) <br>\n<br>\n<br>\ninstance MonadPlus Parser where<br>\n p `mplus` q = Parser (\\cs -> parse p cs ++ parse q cs)<br>\n mzero = Parser (const [])<br>\n<br>\n<br>\ninstance Alternative Parser where<br>\n (<|>) = mplus<br>\n empty = mzero<br>\n<br>\n<br>\nparse :: Parser a -> String -> [(a, String)]<br>\nparse (Parser p) = p<br>\n<br>\n<br>\napply :: Parser a -> String -> [(a,String)]<br>\napply p = parse (do {space; p})<br>\n<br>\n<br>\nfailure :: Parser a<br>\nfailure = mzero<br>\n<br>\n<br>\n-- (+++) :: Parser a -> Parser a -> Parser a<br>\n-- p +++ q = Parser (\\cs -> case parse (p ++ q) cs of<br>\n-- [] -> []<br>\n-- (x:xs) -> [x])<br>\n(+++) :: Parser a -> Parser a -> Parser a<br>\np +++ q = p `mplus` q<br>\n<br>\n<br>\n-- sat :: (Char -> Bool) -> Parser Char<br>\n-- sat p = do {c <- item; if p c then return c else zero}<br>\nsat :: (Char -> Bool) -> Parser Char<br>\nsat p = do {<br>\n<br>\n ; x <- item<br>\n ; if p x then return x else failure<br>\n}<br>\n<br>\nchar :: Char -> Parser Char<br>\nchar c = sat (c ==)<br>\n<br>\n<br>\nmanyP :: Parser a -> Parser [a]<br>\nmanyP p = manyP1 p +++ return []<br>\nmanyP1 :: Parser a -> Parser [a]<br>\nmanyP1 p = do {<br>\n<br>\n ; a <- p; <br>\n ; as <- manyP p; <br>\n ; return (a:as)<br>\n}<br>\n<br>\n<br>\nspace :: Parser String<br>\nspace = manyP (sat isSpace)<br>\n<br>\n<br>\nitem :: Parser Char<br>\nitem = Parser (\\cs -> case cs of<br>\n \"\" -> []<br>\n (c:cs) -> [(c,cs)])<br>\n<br>\n<br>\nmain = do {<br>\n<br>\n ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) \"abcd\"<br>\n ; putStrLn \"bye\"<br>\n}<br>\n</code></pre>\n</html>",
"json_metadata": "{\"tags\":[\"haskell\",\"parser\",\"monads\"],\"links\":[\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\",\"https://www.youtube.com/watch?v=OrAVS4QbMqo\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}damiipublished a new post: monadic-parsing-in-haskell2018/04/01 21:11:06
damiipublished a new post: monadic-parsing-in-haskell
2018/04/01 21:11:06
| parent author | |
| parent permlink | haskell |
| author | damii |
| permlink | monadic-parsing-in-haskell |
| title | Monadic Parsing in Haskell |
| body | @@ -808,16 +808,17 @@ cative%0A%0A +%0A newtype @@ -858,25 +858,24 @@ String)%5D)%0A%0A -%0A instance Fun @@ -910,17 +910,16 @@ liftM%0A%0A -%0A instance @@ -998,16 +998,17 @@ ) = ap%0A%0A +%0A instance @@ -1535,16 +1535,17 @@ mzero%0A%0A +%0A -- (+++) @@ -1884,22 +1884,24 @@ sat p = + do %7B%0A +%0A ; x @@ -1951,17 +1951,16 @@ lure%0A%7D%0A%0A -%0A char :: @@ -2066,18 +2066,16 @@ turn %5B%5D%0A -%0A%0A manyP1 : @@ -2115,16 +2115,17 @@ = do %7B%0A +%0A ; a @@ -2429,16 +2429,17 @@ %22end%22%0A%7D - +%0A %3C/code%3E%3C |
| json metadata | {"tags":["haskell","parser","monads"],"links":["https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell","https://www.youtube.com/watch?v=OrAVS4QbMqo"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #21195793/Trx 42df0e6484cfe906d33a0e9f403a15e45449141a |
View Raw JSON Data
{
"trx_id": "42df0e6484cfe906d33a0e9f403a15e45449141a",
"block": 21195793,
"trx_in_block": 28,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-01T21:11:06",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "haskell",
"author": "damii",
"permlink": "monadic-parsing-in-haskell",
"title": "Monadic Parsing in Haskell",
"body": "@@ -808,16 +808,17 @@\n cative%0A%0A\n+%0A\n newtype \n@@ -858,25 +858,24 @@\n String)%5D)%0A%0A\n-%0A\n instance Fun\n@@ -910,17 +910,16 @@\n liftM%0A%0A\n-%0A\n instance\n@@ -998,16 +998,17 @@\n ) = ap%0A%0A\n+%0A\n instance\n@@ -1535,16 +1535,17 @@\n mzero%0A%0A\n+%0A\n -- (+++)\n@@ -1884,22 +1884,24 @@\n sat p =\n+ \n do %7B%0A\n+%0A\n ; x \n@@ -1951,17 +1951,16 @@\n lure%0A%7D%0A%0A\n-%0A\n char :: \n@@ -2066,18 +2066,16 @@\n turn %5B%5D%0A\n-%0A%0A\n manyP1 :\n@@ -2115,16 +2115,17 @@\n = do %7B%0A\n+%0A\n ; a \n@@ -2429,16 +2429,17 @@\n %22end%22%0A%7D\n-\n \n+%0A\n %3C/code%3E%3C\n",
"json_metadata": "{\"tags\":[\"haskell\",\"parser\",\"monads\"],\"links\":[\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\",\"https://www.youtube.com/watch?v=OrAVS4QbMqo\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}damiipublished a new post: monadic-parsing-in-haskell2018/04/01 21:08:48
damiipublished a new post: monadic-parsing-in-haskell
2018/04/01 21:08:48
| parent author | |
| parent permlink | haskell |
| author | damii |
| permlink | monadic-parsing-in-haskell |
| title | Monadic Parsing in Haskell |
| body | <html> <p>Just running piece of code..</p> <p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href="https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p> <p>This parser example also was mentioned by Erik Meijer in video "C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13" here: <a href="https://www.youtube.com/watch?v=OrAVS4QbMqo">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p> <p>Hope this will be usefull for somebody, this minimal example is good starting point to parser and monad topic in Haskell language.</p> <pre><code>import System.IO import Data.Char import Control.Monad import Control.Applicative newtype Parser a = Parser (String -> [(a, String)]) instance Functor Parser where fmap = liftM instance Applicative Parser where pure a = Parser (\cs -> [(a,cs)]) (<*>) = ap instance Monad Parser where return a = Parser (\cs -> [(a,cs)]) p >>= f = Parser (\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) instance MonadPlus Parser where p `mplus` q = Parser (\cs -> parse p cs ++ parse q cs) mzero = Parser (const []) instance Alternative Parser where (<|>) = mplus empty = mzero parse :: Parser a -> String -> [(a, String)] parse (Parser p) = p apply :: Parser a -> String -> [(a,String)] apply p = parse (do {space; p}) failure :: Parser a failure = mzero -- (+++) :: Parser a -> Parser a -> Parser a -- p +++ q = Parser (\cs -> case parse (p ++ q) cs of -- [] -> [] -- (x:xs) -> [x]) (+++) :: Parser a -> Parser a -> Parser a p +++ q = p `mplus` q -- sat :: (Char -> Bool) -> Parser Char -- sat p = do {c <- item; if p c then return c else zero} sat :: (Char -> Bool) -> Parser Char sat p = do { ; x <- item ; if p x then return x else failure } char :: Char -> Parser Char char c = sat (c ==) manyP :: Parser a -> Parser [a] manyP p = manyP1 p +++ return [] manyP1 :: Parser a -> Parser [a] manyP1 p = do { ; a <- p; ; as <- manyP p; ; return (a:as) } space :: Parser String space = manyP (sat isSpace) item :: Parser Char item = Parser (\cs -> case cs of "" -> [] (c:cs) -> [(c,cs)]) main = do { ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) "abcd" ; putStrLn "end" }</code></pre> </html> |
| json metadata | {"tags":["haskell","parser","monads"],"links":["https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell","https://www.youtube.com/watch?v=OrAVS4QbMqo"],"app":"steemit/0.1","format":"html"} |
| Transaction Info | Block #21195747/Trx ed1e4d92fae0e6fca5972a9f10a9a234aee66c59 |
View Raw JSON Data
{
"trx_id": "ed1e4d92fae0e6fca5972a9f10a9a234aee66c59",
"block": 21195747,
"trx_in_block": 24,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-04-01T21:08:48",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "haskell",
"author": "damii",
"permlink": "monadic-parsing-in-haskell",
"title": "Monadic Parsing in Haskell",
"body": "<html>\n<p>Just running piece of code..</p>\n<p>I had some problems with code from Erik Meijer and Graham Hutton publication from this pdf: <a href=\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\">https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell</a> </p>\n<p>This parser example also was mentioned by Erik Meijer in video \"C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13\" here: <a href=\"https://www.youtube.com/watch?v=OrAVS4QbMqo\">https://www.youtube.com/watch?v=OrAVS4QbMqo</a></p>\n<p>Hope this will be usefull for somebody, this minimal example is good starting point to parser and monad topic in Haskell language.</p>\n<pre><code>import System.IO\nimport Data.Char\nimport Control.Monad\nimport Control.Applicative\n\nnewtype Parser a = Parser (String -> [(a, String)])\n\n\ninstance Functor Parser where\n fmap = liftM\n\n\ninstance Applicative Parser where\n pure a = Parser (\\cs -> [(a,cs)])\n (<*>) = ap\n\ninstance Monad Parser where\n return a = Parser (\\cs -> [(a,cs)])\n p >>= f = Parser (\\cs -> concat [parse (f a) cs' | (a,cs') <- parse p cs]) \n\n\ninstance MonadPlus Parser where\n p `mplus` q = Parser (\\cs -> parse p cs ++ parse q cs)\n mzero = Parser (const [])\n\n\ninstance Alternative Parser where\n (<|>) = mplus\n empty = mzero\n\n\nparse :: Parser a -> String -> [(a, String)]\nparse (Parser p) = p\n\n\napply :: Parser a -> String -> [(a,String)]\napply p = parse (do {space; p})\n\n\nfailure :: Parser a\nfailure = mzero\n\n-- (+++) :: Parser a -> Parser a -> Parser a\n-- p +++ q = Parser (\\cs -> case parse (p ++ q) cs of\n-- [] -> []\n-- (x:xs) -> [x])\n(+++) :: Parser a -> Parser a -> Parser a\np +++ q = p `mplus` q\n\n\n-- sat :: (Char -> Bool) -> Parser Char\n-- sat p = do {c <- item; if p c then return c else zero}\nsat :: (Char -> Bool) -> Parser Char\nsat p = do {\n ; x <- item\n ; if p x then return x else failure\n}\n\n\nchar :: Char -> Parser Char\nchar c = sat (c ==)\n\n\nmanyP :: Parser a -> Parser [a]\nmanyP p = manyP1 p +++ return []\n\n\nmanyP1 :: Parser a -> Parser [a]\nmanyP1 p = do {\n ; a <- p; \n ; as <- manyP p; \n ; return (a:as)\n}\n\n\nspace :: Parser String\nspace = manyP (sat isSpace)\n\n\nitem :: Parser Char\nitem = Parser (\\cs -> case cs of\n \"\" -> []\n (c:cs) -> [(c,cs)])\n\n\nmain = do {\n\n ; print $ apply ( do {a <- item ; b <- item; return (a,b)} ) \"abcd\"\n ; putStrLn \"end\"\n}</code></pre>\n</html>",
"json_metadata": "{\"tags\":[\"haskell\",\"parser\",\"monads\"],\"links\":[\"https://www.researchgate.net/publication/2619685_Monadic_Parsing_in_Haskell\",\"https://www.youtube.com/watch?v=OrAVS4QbMqo\"],\"app\":\"steemit/0.1\",\"format\":\"html\"}"
}
]
}Manabar
Voting Power100.00%
Downvote Power100.00%
Resource Credits100.00%
Reputation Progress0.00%
{
"voting_manabar": {
"current_mana": "8143659806",
"last_update_time": 1779059388
},
"downvote_manabar": {
"current_mana": 2035914951,
"last_update_time": 1779059388
},
"rc_account": {
"account": "damii",
"rc_manabar": {
"current_mana": "10164408779",
"last_update_time": 1779059388
},
"max_rc_creation_adjustment": {
"amount": "2020748973",
"precision": 6,
"nai": "@@000000037"
},
"max_rc": "10164408779"
}
}Account Metadata
| POSTING JSON METADATA | |
| profile | {"name":"damii","website":"http://www.damii.pl","about":"Dariusz Mikołajczyk","location":"Poland","profile_image":"http://www.damii.pl/images/misc/DariuszMikolajczyk.jpg","cover_image":"http://www.damii.pl/images/artwork/Moja_Pasieka_06.jpg"} |
| JSON METADATA | |
| profile | {"name":"damii","website":"http://www.damii.pl","about":"Dariusz Mikołajczyk","location":"Poland","profile_image":"http://www.damii.pl/images/misc/DariuszMikolajczyk.jpg","cover_image":"http://www.damii.pl/images/artwork/Moja_Pasieka_06.jpg"} |
{
"posting_json_metadata": {
"profile": {
"name": "damii",
"website": "http://www.damii.pl",
"about": "Dariusz Mikołajczyk",
"location": "Poland",
"profile_image": "http://www.damii.pl/images/misc/DariuszMikolajczyk.jpg",
"cover_image": "http://www.damii.pl/images/artwork/Moja_Pasieka_06.jpg"
}
},
"json_metadata": {
"profile": {
"name": "damii",
"website": "http://www.damii.pl",
"about": "Dariusz Mikołajczyk",
"location": "Poland",
"profile_image": "http://www.damii.pl/images/misc/DariuszMikolajczyk.jpg",
"cover_image": "http://www.damii.pl/images/artwork/Moja_Pasieka_06.jpg"
}
}
}Auth Keys
Owner
Single Signature
Public Keys
STM5fEeQHzKqxKrbMM3W94ZBE84ucRwtvPDdfCaBt4aMhotQ1u3DL1/1
Active
Single Signature
Public Keys
STM8cNV4yHHRWQYiUZA8ue7RZ6tL6acC3h79VsX6pAETWztrQg8je1/1
Posting
Single Signature
Public Keys
STM5hSnVkFPRUvLRhxSCug18RnTiG47GGCarcNRL8s8BtrTfyn4AE1/1
Memo
STM5xVLrJ4uW4xhXRGo8KdbBjf7bwBcEzgAPP7vzWppptP1igfgZD
{
"owner": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM5fEeQHzKqxKrbMM3W94ZBE84ucRwtvPDdfCaBt4aMhotQ1u3DL",
1
]
]
},
"active": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM8cNV4yHHRWQYiUZA8ue7RZ6tL6acC3h79VsX6pAETWztrQg8je",
1
]
]
},
"posting": {
"weight_threshold": 1,
"account_auths": [
[
"busy.app",
1
],
[
"dtube.app",
1
]
],
"key_auths": [
[
"STM5hSnVkFPRUvLRhxSCug18RnTiG47GGCarcNRL8s8BtrTfyn4AE",
1
]
]
},
"memo": "STM5xVLrJ4uW4xhXRGo8KdbBjf7bwBcEzgAPP7vzWppptP1igfgZD"
}Witness Votes
0 / 30
No active witness votes.
[]