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 listUsers(r: Request): RequestResult = listForm.bind(request){ | |
success(form) => Ok (ToJson( | |
users.filter(_.name contains form.q).page(form.offset,form.limit) | |
) ) | |
failure(f,message, ex) => Error(403, message) | |
} | |
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 ProfileInfo | |
{ | |
1: required string uid; | |
2: optional string firstName; | |
3: optional string middleName; | |
4: optional string lastName; | |
5: optional string email; | |
6: optional string phone; | |
7: optional string addrPostal; | |
} |
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
macro dowhile (cond, body) | |
syntax ("do", body, "while", "(", cond, ")") | |
{ | |
def loop = Nemerle.Macros.Symbol (Util.tmpname ("do_while")) | |
<[ | |
(($("_N_break" : global) : { | |
def $(loop : name) () : void { | |
($("_N_continue" : global) : { $body }) : void; | |
when ($cond) | |
$(loop : name) (); |
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
proc do {body whileword condition} { | |
global errorInfor errorCode | |
if {![string equal $whileword while]} { | |
error "should be \"do body while condition\"" | |
} | |
while {1} { | |
set code [catch {uplevel 1 $body} message] | |
if { !ok( $code) } { | |
return handleBreak($code, $body, $message) | |
} |
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
set x 1 | |
do { | |
set d [expr ($s/$x - $x)/2] | |
while { $d != 0 } |
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
sqrtd(s,x,0) -> x | |
sqrtd(s,x,d) -> sqrt(s, x+d, (s/x - x)/2 ) | |
sqrt(s) -> sqrtd(s,1,(s-1)/2) | |
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
int x = 1 | |
int d = 1 | |
while(d != 0) { | |
d = (s/x - x)/2 | |
x = x+d | |
} |
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
: sqrt-closer (square guess -- square guess adjustment) 2dup / over - 2 / ; | |
: sqrt ( square -- root ) 1 begin sqrt-closer dup while + repeat drop nip ; | |
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
0 10 1 DO i + LOOP; |
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
int _ = 10; | |
int _ = 0; | |
for(int _ = 1; _ < _; ++x) { | |
_ += _; | |
} |