[Ur] Learning Ur with a SimpleApplication

Yves Cloutier yves.cloutier at gmail.com
Sun Mar 27 12:22:45 EDT 2016


Hello,

I'm new to Ur and the ML family of languages, and am trying to learning by
creating a simple application.

I want to create an application to add and store a Resume/CV.

For example:

Education
(here some fields to add education) [add]
* Graduated in xyz prorgam, Phoenix College (2002) [edit][delete]
* Associate degree in abc, Hertz College (2001) [edit][delete]

Employers
(here some fields to add employers) [add]

Employer1 [edit][delete]
(here some fields to add experience for Employer1)[add]
*experience1 [edit][delete]
*experience2 [edit][delete]

Employer2 [edit][delete]
(here some fields to add experience for Employer2)[add]
*experience1 [edit][delete]
*experience2 [edit][delete]

I am trying to follow the example in the article Ur/Web: A Simple Model for
Programming the Web by Adam.  So figuring it out how to do it as a server
application, then refactoring to moe of a client side application.

Following examples in the article, I was able to create some crude code for
the "Employers" section.  However I am trying to understand the best
approach for adding a form for adding a new employer, as well as a form
under each employer so that the user is able to add a new work experience
item under an employer.

Where would be the best placement for both of these forms and their handler
functions?

Below is my ...code... so far.  Any comments or guidance would be
appreciated. Your patience is also appreciated - I'm still very new to ML
style programming and reading ML for the Working Programmer in parallel.

(* Create database tables *)
table employer : (Id: int, Name: string, Start: date, End: date)
table experience: (Description: string, EmployerID: int)


(* A function that queries the experience at a given employer *)
fun showExperience employer =
  experience <- queryX1 (SELECT * FROM experience)
                        (fn row =>
<xml><li>{[row.description]}</li></xml>);
  return {experience}


fun main () =

(* Query the table of employers, and display the work experience related to
each employer *)
workExperience <- queryX1 (SELECT * FROM employer ORDER BY employer.Start )
                          (fn row =>  <xml><h2>{[row.Name]</h2>
{[row.Start]} - {[row.End]}
                                       {showExperience row.Id});

(* Display the professional experience *)
return  <xml><body>
          <h1>Education</h1>
          <h1>Professional Certifications</h1>
          <h1>Acting Assignments<h1>
          <h1>Projects</h1>
          {workExperience}
        </body></xml>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20160327/80989786/attachment.html>


More information about the Ur mailing list