SlideShare una empresa de Scribd logo
1 de 27
Various use of continuations in Kahua Applications in practical web programming experience ,[object Object],[object Object]
Higher-Level APIs for web-applications
Continuation for web-application ,[object Object],[object Object],[object Object]
Continuation of components How continuations of components work? component page -> page component -> component? component -> page? component HTML HTML HTML HTML click here click here Hello,Mr.
Start from this issue by “Take THE Arc Challenge” http://www.paulgraham.com/arcchallenge.html Write a program: ,[object Object],[object Object],[object Object]
Easy to write control flow ;; said ( define-entry  (said)‏ ( page (form/cont/ (@@/ ( cont  ( lambda  ()‏ (let1 say (kahua-context-ref  "say" )‏ ( page (a/cont/ (@@/ ( cont  ( lambda  ()‏ ( page (p/  "you said: "  say)))))‏ "click here" ))))))‏ (readln/  "say" )‏ (submit/))))‏ Call continuation procedure Generate page
Individual component ,[object Object],[object Object],[object Object],[object Object],[object Object]
Motivation We want to write like this: The “said5” has 5 individual “said” components. ;; using individual “said” (define-entry (said5)‏ ( page (map/  said  '( ”Alf” “Willie” “Kate” “Lynn” “Brian” ))))‏
How about this? ;; Does this “said” works individually? ( define  (said id)‏ (form/cont/ (@@/ ( cont  ( lambda  ()‏ (let1 say (kahua-context-ref id)‏ (a/cont/ (@@/ ( cont  ( lambda  ()‏ (p/ id  " said: "  say))))‏ "click here" )))))‏ (readln/ id)‏ (submit/)))‏ ;;http://localhost/app/said5 (define-entry (said5)‏ ( page  (map/  said  '(“ Alf” “Willie” “Kate” “Lynn” “Brian” ))))‏ Call continuation procedure Generate page
Diff : Said application ( define-entry  (said)‏ ( page (form/cont/ (@@/ ( cont  ( lambda  ()‏ (let1 say (kahua-context-ref  "say" )‏ ( page (a/cont/ (@@/ ( cont  ( lambda  ()‏ ( page (p/  "you said: "  say)))))‏ "click here" ))))))‏ (readln/  "say" )‏ (submit/))))‏
( define-entry  (said  id )‏ (form/cont/ (@@/ ( cont  ( lambda  ()‏ (let1 say (kahua-context-ref  "say" )‏ (a/cont/ (@@/ ( cont  ( lambda  ()‏ (p/  id   " said: "  say))))‏ "click here" )))))‏ (readln/  "say" )‏ (submit/)))‏ Diff : Said component(?)‏
The problem Continuation generates  the whole page Each component to be  independent from the others Expected Happened Continuation must know the others Continuation does not have to know the others
Solution : parts-cont ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Diff : buggy said component ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Diff : parts-cont version
What “parts-cont” does Alf Willie Brian Lynn Kate Input form Anchor link Show text submit! click! form link Text form form form link link link Text Text Text Make each “said” to work individually
What “parts-cont” does body link text form link link html link Generate the whole html tree by the continuation of Brian's “said” Alf Willie Kate Lynn Brian head
Mechanism : the key idea Create continuation that generate next page by replace target node with a new node which return from “parts-cont” clause
Design of the mechanism create continuation that generate next page by replace target node with a new node which return from “parts-cont” clause Server interpreter Continuation to generate  page Continuation to generate  node HTML tree
More ... The “parts-cont” mechanism highlights a new need  to keep client-side context
Keep client-side context ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A more interesting sample ;; this “calendar/” function works as a widget of date selector. (define-entry (plan)‏ (page (form/cont/ (@@/ (cont (entry-lambda (:keyword from to memo)‏ (make <plan> :from from :to to :memo memo)‏ (plan))))‏ ( calendar/   ”from”   ”Start”   (current-date) )‏ ( calendar/   ”to”   ”End”   (current-date) )‏ (readtext/  ”memo” )‏ (submit/))‏ (map/ display/ (sort (coerce-to <list> (make-kahua-collection <plan>)) plan>=?))))‏
Design of the mechanism client-side context Server interpreter Continuation to generate page with keeping client-side context Continuation to generate node HTML tree
Now, we have ... The “parts-cont” mechanism, which supports individual components. We can write web application  in smart way.
What next? Refine the design of “parts-cont” mechanism. Challenge this by using partial continuation technique.
What next? Of course, Fix  some known bugs  of parts-cont...
Thank you

Más contenido relacionado

Destacado (8)

yr11 Litpoetry 27/2/08
yr11 Litpoetry 27/2/08yr11 Litpoetry 27/2/08
yr11 Litpoetry 27/2/08
 
Yr11 Litpoetry 3/3/08
Yr11 Litpoetry 3/3/08Yr11 Litpoetry 3/3/08
Yr11 Litpoetry 3/3/08
 
2013_SL-Class_120409.pdf
2013_SL-Class_120409.pdf2013_SL-Class_120409.pdf
2013_SL-Class_120409.pdf
 
웹표준_건대스터디_1st
웹표준_건대스터디_1st웹표준_건대스터디_1st
웹표준_건대스터디_1st
 
Yr10 set1 RandJ 22/2/08
Yr10 set1 RandJ 22/2/08Yr10 set1 RandJ 22/2/08
Yr10 set1 RandJ 22/2/08
 
Yr10 set1 RandJ 22/4/08
Yr10 set1 RandJ 22/4/08Yr10 set1 RandJ 22/4/08
Yr10 set1 RandJ 22/4/08
 
Troglo Village Limoges France
Troglo Village Limoges FranceTroglo Village Limoges France
Troglo Village Limoges France
 
Absolutely Fantastic Slideshow
Absolutely Fantastic SlideshowAbsolutely Fantastic Slideshow
Absolutely Fantastic Slideshow
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Various use of continuations in Kahua - Application in practical web programming experience

  • 1.
  • 2. Higher-Level APIs for web-applications
  • 3.
  • 4. Continuation of components How continuations of components work? component page -> page component -> component? component -> page? component HTML HTML HTML HTML click here click here Hello,Mr.
  • 5.
  • 6. Easy to write control flow ;; said ( define-entry (said)‏ ( page (form/cont/ (@@/ ( cont ( lambda ()‏ (let1 say (kahua-context-ref &quot;say&quot; )‏ ( page (a/cont/ (@@/ ( cont ( lambda ()‏ ( page (p/ &quot;you said: &quot; say)))))‏ &quot;click here&quot; ))))))‏ (readln/ &quot;say&quot; )‏ (submit/))))‏ Call continuation procedure Generate page
  • 7.
  • 8. Motivation We want to write like this: The “said5” has 5 individual “said” components. ;; using individual “said” (define-entry (said5)‏ ( page (map/ said '( ”Alf” “Willie” “Kate” “Lynn” “Brian” ))))‏
  • 9. How about this? ;; Does this “said” works individually? ( define (said id)‏ (form/cont/ (@@/ ( cont ( lambda ()‏ (let1 say (kahua-context-ref id)‏ (a/cont/ (@@/ ( cont ( lambda ()‏ (p/ id &quot; said: &quot; say))))‏ &quot;click here&quot; )))))‏ (readln/ id)‏ (submit/)))‏ ;;http://localhost/app/said5 (define-entry (said5)‏ ( page (map/ said '(“ Alf” “Willie” “Kate” “Lynn” “Brian” ))))‏ Call continuation procedure Generate page
  • 10. Diff : Said application ( define-entry (said)‏ ( page (form/cont/ (@@/ ( cont ( lambda ()‏ (let1 say (kahua-context-ref &quot;say&quot; )‏ ( page (a/cont/ (@@/ ( cont ( lambda ()‏ ( page (p/ &quot;you said: &quot; say)))))‏ &quot;click here&quot; ))))))‏ (readln/ &quot;say&quot; )‏ (submit/))))‏
  • 11. ( define-entry (said id )‏ (form/cont/ (@@/ ( cont ( lambda ()‏ (let1 say (kahua-context-ref &quot;say&quot; )‏ (a/cont/ (@@/ ( cont ( lambda ()‏ (p/ id &quot; said: &quot; say))))‏ &quot;click here&quot; )))))‏ (readln/ &quot;say&quot; )‏ (submit/)))‏ Diff : Said component(?)‏
  • 12. The problem Continuation generates the whole page Each component to be independent from the others Expected Happened Continuation must know the others Continuation does not have to know the others
  • 13.
  • 14.
  • 15.
  • 16. What “parts-cont” does Alf Willie Brian Lynn Kate Input form Anchor link Show text submit! click! form link Text form form form link link link Text Text Text Make each “said” to work individually
  • 17. What “parts-cont” does body link text form link link html link Generate the whole html tree by the continuation of Brian's “said” Alf Willie Kate Lynn Brian head
  • 18. Mechanism : the key idea Create continuation that generate next page by replace target node with a new node which return from “parts-cont” clause
  • 19. Design of the mechanism create continuation that generate next page by replace target node with a new node which return from “parts-cont” clause Server interpreter Continuation to generate page Continuation to generate node HTML tree
  • 20. More ... The “parts-cont” mechanism highlights a new need to keep client-side context
  • 21.
  • 22. A more interesting sample ;; this “calendar/” function works as a widget of date selector. (define-entry (plan)‏ (page (form/cont/ (@@/ (cont (entry-lambda (:keyword from to memo)‏ (make <plan> :from from :to to :memo memo)‏ (plan))))‏ ( calendar/ ”from” ”Start” (current-date) )‏ ( calendar/ ”to” ”End” (current-date) )‏ (readtext/ ”memo” )‏ (submit/))‏ (map/ display/ (sort (coerce-to <list> (make-kahua-collection <plan>)) plan>=?))))‏
  • 23. Design of the mechanism client-side context Server interpreter Continuation to generate page with keeping client-side context Continuation to generate node HTML tree
  • 24. Now, we have ... The “parts-cont” mechanism, which supports individual components. We can write web application in smart way.
  • 25. What next? Refine the design of “parts-cont” mechanism. Challenge this by using partial continuation technique.
  • 26. What next? Of course, Fix some known bugs of parts-cont...