{"action":"created","comment":{"url":"https://api.github.com/repos/jackfirth/lens/pulls/comments/37705818","id":37705818,"diff_hunk":"@@ -0,0 +1,76 @@\n+#lang sweet-exp racket/base\n+\n+provide lens-join/struct\n+\n+require racket/local\n+        racket/match\n+        lens/base/main\n+        kw-make-struct\n+        for-syntax racket/base\n+                   syntax/parse\n+module+ test\n+  require rackunit lens/hash/main lens/test-util/test-multi\n+\n+(begin-for-syntax\n+  (define-splicing-syntax-class field-lenses\n+    #:attributes ([lens-expr 1] [lens-id 1] [vw-id 1] [norm 1])\n+    [pattern (~seq lens-expr:expr ...)\n+      #:with [lens-id ...] (generate-temporaries #'[lens-expr ...])\n+      #:with [vw-id ...] (generate-temporaries #'[lens-expr ...])\n+      #:with [norm ...] #'[vw-id ...]]\n+    [pattern (~seq fst-lens:expr ...+ rst:field-lenses)\n+      #:with [fst-lens-id ...] (generate-temporaries #'[fst-lens ...])\n+      #:with [fst-vw-id ...] (generate-temporaries #'[fst-lens ...])\n+      #:with [lens-expr ...] #'[fst-lens ... rst.lens-expr ...]\n+      #:with [lens-id ...] #'[fst-lens-id ... rst.lens-id ...]\n+      #:with [vw-id ...] #'[fst-vw-id ... rst.vw-id ...]\n+      #:with [norm ...] #'[fst-vw-id ... rst.norm ...]]\n+    [pattern (~seq (~seq kw:keyword fst-lens:expr) ...+ rst:field-lenses)\n+      #:with [fst-lens-id ...] (generate-temporaries #'[fst-lens ...])\n+      #:with [fst-vw-id ...] (generate-temporaries #'[fst-lens ...])\n+      #:with [lens-expr ...] #'[fst-lens ... rst.lens-expr ...]\n+      #:with [lens-id ...] #'[fst-lens-id ... rst.lens-id ...]\n+      #:with [vw-id ...] #'[fst-vw-id ... rst.vw-id ...]\n+      #:with [[fst-kw/vw-id ...] ...] #'[[kw fst-vw-id] ...]\n+      #:with [norm ...] #'[fst-kw/vw-id ... ... rst.norm ...]]\n+    ))\n+\n+(define-syntax lens-join/struct\n+  (lambda (stx)\n+    (syntax-parse stx\n+      [(lens-join/struct s:id flds:field-lenses)\n+       #:with make/kw-form (syntax/loc stx (make/kw s flds.norm ...))\n+       #:with [[lens-id/vw-id ...] ...] #'[[flds.lens-id flds.vw-id] ...]\n+       #`(local [(define flds.lens-id flds.lens-expr) ...]\n+           (make-lens\n+            (λ (tgt)\n+              (define flds.vw-id (lens-view flds.lens-id tgt))\n+              ...\n+              make/kw-form)\n+            (λ (tgt nvw)\n+              (match-define make/kw-form nvw)\n+              (lens-set/list tgt lens-id/vw-id ... ...))))])))\n+\n+(module+ test\n+  (struct foo (a b c) #:transparent)\n+  (define foo-hash-lens1\n+    (lens-join/struct foo\n+                      (hash-ref-lens 'a)\n+                      (hash-ref-lens 'b)\n+                      (hash-ref-lens 'c)))\n+  (define foo-hash-lens2\n+    (lens-join/struct foo\n+                      #:a (hash-ref-lens 'a)\n+                      #:b (hash-ref-lens 'b)\n+                      #:c (hash-ref-lens 'c)))","path":"unstable/lens/struct-join.rkt","position":65,"original_position":65,"commit_id":"c0f76cba91aefd533b8f1799a75048f8e7ed5091","original_commit_id":"b6b77650137cb4dcc9af3581ea47b8a619f5235c","user":{"login":"AlexKnauth","id":6600123,"avatar_url":"https://avatars.githubusercontent.com/u/6600123?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexKnauth","html_url":"https://github.com/AlexKnauth","followers_url":"https://api.github.com/users/AlexKnauth/followers","following_url":"https://api.github.com/users/AlexKnauth/following{/other_user}","gists_url":"https://api.github.com/users/AlexKnauth/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexKnauth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexKnauth/subscriptions","organizations_url":"https://api.github.com/users/AlexKnauth/orgs","repos_url":"https://api.github.com/users/AlexKnauth/repos","events_url":"https://api.github.com/users/AlexKnauth/events{/privacy}","received_events_url":"https://api.github.com/users/AlexKnauth/received_events","type":"User","site_admin":false},"body":"Done: https://github.com/jackfirth/lens/pull/179/files#diff-4bb3f2c3b3e622559dfe86b110dcb878R71","created_at":"2015-08-23T13:27:06Z","updated_at":"2015-08-23T13:27:06Z","html_url":"https://github.com/jackfirth/lens/pull/179#discussion_r37705818","pull_request_url":"https://api.github.com/repos/jackfirth/lens/pulls/179","_links":{"self":{"href":"https://api.github.com/repos/jackfirth/lens/pulls/comments/37705818"},"html":{"href":"https://github.com/jackfirth/lens/pull/179#discussion_r37705818"},"pull_request":{"href":"https://api.github.com/repos/jackfirth/lens/pulls/179"}}},"pull_request":{"url":"https://api.github.com/repos/jackfirth/lens/pulls/179","id":43092780,"html_url":"https://github.com/jackfirth/lens/pull/179","diff_url":"https://github.com/jackfirth/lens/pull/179.diff","patch_url":"https://github.com/jackfirth/lens/pull/179.patch","issue_url":"https://api.github.com/repos/jackfirth/lens/issues/179","number":179,"state":"open","locked":false,"title":"add lens-join/struct","user":{"login":"AlexKnauth","id":6600123,"avatar_url":"https://avatars.githubusercontent.com/u/6600123?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexKnauth","html_url":"https://github.com/AlexKnauth","followers_url":"https://api.github.com/users/AlexKnauth/followers","following_url":"https://api.github.com/users/AlexKnauth/following{/other_user}","gists_url":"https://api.github.com/users/AlexKnauth/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexKnauth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexKnauth/subscriptions","organizations_url":"https://api.github.com/users/AlexKnauth/orgs","repos_url":"https://api.github.com/users/AlexKnauth/repos","events_url":"https://api.github.com/users/AlexKnauth/events{/privacy}","received_events_url":"https://api.github.com/users/AlexKnauth/received_events","type":"User","site_admin":false},"body":"closes https://github.com/jackfirth/lens/issues/171\nI also put in support for specifying struct fields as keywords as well as by position.","created_at":"2015-08-22T00:14:50Z","updated_at":"2015-08-23T13:27:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"420742367a58c805532c05d20320e56ecc845943","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jackfirth/lens/pulls/179/commits","review_comments_url":"https://api.github.com/repos/jackfirth/lens/pulls/179/comments","review_comment_url":"https://api.github.com/repos/jackfirth/lens/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jackfirth/lens/issues/179/comments","statuses_url":"https://api.github.com/repos/jackfirth/lens/statuses/c0f76cba91aefd533b8f1799a75048f8e7ed5091","head":{"label":"AlexKnauth:lens-join-struct","ref":"lens-join-struct","sha":"c0f76cba91aefd533b8f1799a75048f8e7ed5091","user":{"login":"AlexKnauth","id":6600123,"avatar_url":"https://avatars.githubusercontent.com/u/6600123?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexKnauth","html_url":"https://github.com/AlexKnauth","followers_url":"https://api.github.com/users/AlexKnauth/followers","following_url":"https://api.github.com/users/AlexKnauth/following{/other_user}","gists_url":"https://api.github.com/users/AlexKnauth/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexKnauth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexKnauth/subscriptions","organizations_url":"https://api.github.com/users/AlexKnauth/orgs","repos_url":"https://api.github.com/users/AlexKnauth/repos","events_url":"https://api.github.com/users/AlexKnauth/events{/privacy}","received_events_url":"https://api.github.com/users/AlexKnauth/received_events","type":"User","site_admin":false},"repo":{"id":34539243,"name":"lens","full_name":"AlexKnauth/lens","owner":{"login":"AlexKnauth","id":6600123,"avatar_url":"https://avatars.githubusercontent.com/u/6600123?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexKnauth","html_url":"https://github.com/AlexKnauth","followers_url":"https://api.github.com/users/AlexKnauth/followers","following_url":"https://api.github.com/users/AlexKnauth/following{/other_user}","gists_url":"https://api.github.com/users/AlexKnauth/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexKnauth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexKnauth/subscriptions","organizations_url":"https://api.github.com/users/AlexKnauth/orgs","repos_url":"https://api.github.com/users/AlexKnauth/repos","events_url":"https://api.github.com/users/AlexKnauth/events{/privacy}","received_events_url":"https://api.github.com/users/AlexKnauth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlexKnauth/lens","description":"A Racket package for creating and composing pure functional lenses","fork":true,"url":"https://api.github.com/repos/AlexKnauth/lens","forks_url":"https://api.github.com/repos/AlexKnauth/lens/forks","keys_url":"https://api.github.com/repos/AlexKnauth/lens/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlexKnauth/lens/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlexKnauth/lens/teams","hooks_url":"https://api.github.com/repos/AlexKnauth/lens/hooks","issue_events_url":"https://api.github.com/repos/AlexKnauth/lens/issues/events{/number}","events_url":"https://api.github.com/repos/AlexKnauth/lens/events","assignees_url":"https://api.github.com/repos/AlexKnauth/lens/assignees{/user}","branches_url":"https://api.github.com/repos/AlexKnauth/lens/branches{/branch}","tags_url":"https://api.github.com/repos/AlexKnauth/lens/tags","blobs_url":"https://api.github.com/repos/AlexKnauth/lens/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlexKnauth/lens/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlexKnauth/lens/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlexKnauth/lens/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlexKnauth/lens/statuses/{sha}","languages_url":"https://api.github.com/repos/AlexKnauth/lens/languages","stargazers_url":"https://api.github.com/repos/AlexKnauth/lens/stargazers","contributors_url":"https://api.github.com/repos/AlexKnauth/lens/contributors","subscribers_url":"https://api.github.com/repos/AlexKnauth/lens/subscribers","subscription_url":"https://api.github.com/repos/AlexKnauth/lens/subscription","commits_url":"https://api.github.com/repos/AlexKnauth/lens/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlexKnauth/lens/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlexKnauth/lens/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlexKnauth/lens/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlexKnauth/lens/contents/{+path}","compare_url":"https://api.github.com/repos/AlexKnauth/lens/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlexKnauth/lens/merges","archive_url":"https://api.github.com/repos/AlexKnauth/lens/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlexKnauth/lens/downloads","issues_url":"https://api.github.com/repos/AlexKnauth/lens/issues{/number}","pulls_url":"https://api.github.com/repos/AlexKnauth/lens/pulls{/number}","milestones_url":"https://api.github.com/repos/AlexKnauth/lens/milestones{/number}","notifications_url":"https://api.github.com/repos/AlexKnauth/lens/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlexKnauth/lens/labels{/name}","releases_url":"https://api.github.com/repos/AlexKnauth/lens/releases{/id}","created_at":"2015-04-24T20:07:08Z","updated_at":"2015-07-07T02:48:51Z","pushed_at":"2015-08-23T13:26:20Z","git_url":"git://github.com/AlexKnauth/lens.git","ssh_url":"git@github.com:AlexKnauth/lens.git","clone_url":"https://github.com/AlexKnauth/lens.git","svn_url":"https://github.com/AlexKnauth/lens","homepage":null,"size":480,"stargazers_count":0,"watchers_count":0,"language":"Racket","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jackfirth:master","ref":"master","sha":"8f7295976e8bab466ca55faba2f6b9ba4069097d","user":{"login":"jackfirth","id":8175575,"avatar_url":"https://avatars.githubusercontent.com/u/8175575?v=3","gravatar_id":"","url":"https://api.github.com/users/jackfirth","html_url":"https://github.com/jackfirth","followers_url":"https://api.github.com/users/jackfirth/followers","following_url":"https://api.github.com/users/jackfirth/following{/other_user}","gists_url":"https://api.github.com/users/jackfirth/gists{/gist_id}","starred_url":"https://api.github.com/users/jackfirth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackfirth/subscriptions","organizations_url":"https://api.github.com/users/jackfirth/orgs","repos_url":"https://api.github.com/users/jackfirth/repos","events_url":"https://api.github.com/users/jackfirth/events{/privacy}","received_events_url":"https://api.github.com/users/jackfirth/received_events","type":"User","site_admin":false},"repo":{"id":31137793,"name":"lens","full_name":"jackfirth/lens","owner":{"login":"jackfirth","id":8175575,"avatar_url":"https://avatars.githubusercontent.com/u/8175575?v=3","gravatar_id":"","url":"https://api.github.com/users/jackfirth","html_url":"https://github.com/jackfirth","followers_url":"https://api.github.com/users/jackfirth/followers","following_url":"https://api.github.com/users/jackfirth/following{/other_user}","gists_url":"https://api.github.com/users/jackfirth/gists{/gist_id}","starred_url":"https://api.github.com/users/jackfirth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackfirth/subscriptions","organizations_url":"https://api.github.com/users/jackfirth/orgs","repos_url":"https://api.github.com/users/jackfirth/repos","events_url":"https://api.github.com/users/jackfirth/events{/privacy}","received_events_url":"https://api.github.com/users/jackfirth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jackfirth/lens","description":"A Racket package for creating and composing pure functional lenses","fork":false,"url":"https://api.github.com/repos/jackfirth/lens","forks_url":"https://api.github.com/repos/jackfirth/lens/forks","keys_url":"https://api.github.com/repos/jackfirth/lens/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jackfirth/lens/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jackfirth/lens/teams","hooks_url":"https://api.github.com/repos/jackfirth/lens/hooks","issue_events_url":"https://api.github.com/repos/jackfirth/lens/issues/events{/number}","events_url":"https://api.github.com/repos/jackfirth/lens/events","assignees_url":"https://api.github.com/repos/jackfirth/lens/assignees{/user}","branches_url":"https://api.github.com/repos/jackfirth/lens/branches{/branch}","tags_url":"https://api.github.com/repos/jackfirth/lens/tags","blobs_url":"https://api.github.com/repos/jackfirth/lens/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jackfirth/lens/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jackfirth/lens/git/refs{/sha}","trees_url":"https://api.github.com/repos/jackfirth/lens/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jackfirth/lens/statuses/{sha}","languages_url":"https://api.github.com/repos/jackfirth/lens/languages","stargazers_url":"https://api.github.com/repos/jackfirth/lens/stargazers","contributors_url":"https://api.github.com/repos/jackfirth/lens/contributors","subscribers_url":"https://api.github.com/repos/jackfirth/lens/subscribers","subscription_url":"https://api.github.com/repos/jackfirth/lens/subscription","commits_url":"https://api.github.com/repos/jackfirth/lens/commits{/sha}","git_commits_url":"https://api.github.com/repos/jackfirth/lens/git/commits{/sha}","comments_url":"https://api.github.com/repos/jackfirth/lens/comments{/number}","issue_comment_url":"https://api.github.com/repos/jackfirth/lens/issues/comments{/number}","contents_url":"https://api.github.com/repos/jackfirth/lens/contents/{+path}","compare_url":"https://api.github.com/repos/jackfirth/lens/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jackfirth/lens/merges","archive_url":"https://api.github.com/repos/jackfirth/lens/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jackfirth/lens/downloads","issues_url":"https://api.github.com/repos/jackfirth/lens/issues{/number}","pulls_url":"https://api.github.com/repos/jackfirth/lens/pulls{/number}","milestones_url":"https://api.github.com/repos/jackfirth/lens/milestones{/number}","notifications_url":"https://api.github.com/repos/jackfirth/lens/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jackfirth/lens/labels{/name}","releases_url":"https://api.github.com/repos/jackfirth/lens/releases{/id}","created_at":"2015-02-21T19:30:13Z","updated_at":"2015-08-07T03:59:39Z","pushed_at":"2015-08-23T13:26:21Z","git_url":"git://github.com/jackfirth/lens.git","ssh_url":"git@github.com:jackfirth/lens.git","clone_url":"https://github.com/jackfirth/lens.git","svn_url":"https://github.com/jackfirth/lens","homepage":null,"size":1082,"stargazers_count":4,"watchers_count":4,"language":"Racket","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":21,"forks":3,"open_issues":21,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jackfirth/lens/pulls/179"},"html":{"href":"https://github.com/jackfirth/lens/pull/179"},"issue":{"href":"https://api.github.com/repos/jackfirth/lens/issues/179"},"comments":{"href":"https://api.github.com/repos/jackfirth/lens/issues/179/comments"},"review_comments":{"href":"https://api.github.com/repos/jackfirth/lens/pulls/179/comments"},"review_comment":{"href":"https://api.github.com/repos/jackfirth/lens/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jackfirth/lens/pulls/179/commits"},"statuses":{"href":"https://api.github.com/repos/jackfirth/lens/statuses/c0f76cba91aefd533b8f1799a75048f8e7ed5091"}}}}