This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class RootPlan extends Plan { | |
| val logger = Logger(classOf[RootPlan]) | |
| val creationDate = new java.util.Date | |
| val eTag = hashCode.toString | |
| val Head = Ok ~> Vary("Accept-Charset", "Accept-Encoding", "Accept-Language", "Accept") | |
| val Caching = | |
| CacheControl("max-age=3600") ~> | |
| LastModified(DateUtils.formatDate(creationDate)) ~> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct ListNode { value, next }; | |
| var n; | |
| var h; | |
| var s; | |
| n = new ListNode; | |
| h = n; | |
| n.value = 2; | |
| n.next = new ListNode; | |
| n = n.next; | |
| n.value = 3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct StudentCourseRecord { firstExamScore, secondExamScore, totalScore }; | |
| struct StudentSemesterRecord { course1, course2 }; | |
| var q; | |
| var r; | |
| r = new StudentSemesterRecord; | |
| r.course1 = new StudentCourseRecord; | |
| r.course1.firstExamScore = 25; | |
| r.course1.secondExamScore = 35; | |
| r.course1.totalScore = r.course1.firstExamScore + r.course1.secondExamScore; | |
| r.course2 = r.course1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x; | |
| var y; | |
| var r; | |
| x = 2; | |
| y = 3; | |
| while (y) { | |
| r = r + x, | |
| y = y - 1 | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct ListNode { value, next }; | |
| n = new ListNode; | |
| n.value = 5; | |
| n.next = 0; | |
| { n.value = 7, n }.next = 12; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # general | |
| *~ | |
| *.log | |
| tmp | |
| dump | |
| # Eclipse | |
| .settings | |
| .cache | |
| .project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Makefile for F# lexing and parsing example from | |
| # http://en.wikibooks.org/wiki/F_Sharp_Programming/Lexing_and_Parsing | |
| # Sources available at https://github.com/obeleh/FsYacc-Example | |
| # | |
| # http://laufer.cs.luc.edu/teaching/372 | |
| # | |
| # Prerequisites | |
| # make | |
| # http://fsharppowerpack.codeplex.com/ for fslex, fsyacc | |
| # http://fsxplat.codeplex.com/ for fsharpc (and fsharpi) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open System | |
| open Sql | |
| let x = " | |
| SELECT x, y, z | |
| FROM t1 | |
| LEFT JOIN t2 | |
| INNER JOIN t3 ON t3.ID = t2.ID | |
| WHERE x = 50 AND y = 20 | |
| ORDER BY x ASC, y DESC, z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // a CPU-intensive task | |
| def isPrime(i: Long): Boolean = | |
| if i == 2 then return true | |
| if i < 2 || i % 2 == 0 then return false | |
| var k = 3L | |
| val half = i / 2 | |
| while k <= half do | |
| if i % k == 0 then return false | |
| k += 2 | |
| true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def p(s: String) = | |
| for i <- 1 to 10 do | |
| Thread.sleep(500) | |
| println(s"$i : $s") | |
| // running two or more tasks sequentially | |
| // about 20 seconds by design | |
| val t0 = System.currentTimeMillis | |
| p("a") |
OlderNewer