SlideShare uma empresa 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

Mais conteúdo relacionado

Destaque

yr11 Litpoetry 27/2/08
yr11 Litpoetry 27/2/08yr11 Litpoetry 27/2/08
yr11 Litpoetry 27/2/08qbEnglish
 
Yr11 Litpoetry 3/3/08
Yr11 Litpoetry 3/3/08Yr11 Litpoetry 3/3/08
Yr11 Litpoetry 3/3/08qbEnglish
 
웹표준_건대스터디_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/08qbEnglish
 
Yr10 set1 RandJ 22/4/08
Yr10 set1 RandJ 22/4/08Yr10 set1 RandJ 22/4/08
Yr10 set1 RandJ 22/4/08qbEnglish
 
Troglo Village Limoges France
Troglo Village Limoges FranceTroglo Village Limoges France
Troglo Village Limoges FranceGlobal Estates
 
Absolutely Fantastic Slideshow
Absolutely Fantastic SlideshowAbsolutely Fantastic Slideshow
Absolutely Fantastic Slideshowgueste2d727
 

Destaque (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

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
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 WoodJuan lago vázquez
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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 SavingEdi Saputra
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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].pdfOverkill Security
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

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...