Guest User

Untitled

a guest
Jul 19th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. # echo program
  2. _stdio_getbyte<(cont)
  3. !cont>(char)
  4. _stdio_putbyte<(char,cont)
  5. cont>()
  6. _stdio_putbyte<([10],cont)
  7. cont>()
  8. _stdio_getbyte<(cont)
  9.  
  10. # test boolean function
  11. new(cont)
  12. false<(cont)
  13. cont>(b)
  14. pa>()
  15. print_a<(kill)
  16. pb>()
  17. print_b<(kill)
  18. if<(b,pa,pb)
  19.  
  20.  
  21. # test util.
  22. !kill>(k)
  23.  
  24. # "a\n"
  25. !print_a>(k)
  26. new(cont)
  27. _stdio_putbyte<([97],cont)
  28. cont>()
  29. _stdio_putbyte<([10],k)
  30.  
  31. # "b\n"
  32. !print_b>(k)
  33. new(cont)
  34. _stdio_putbyte<([98],cont)
  35. cont>()
  36. _stdio_putbyte<([10],k)
  37.  
  38.  
  39. ## standard data structure library (w/ CPS protocol)
  40. # boolean
  41. !true>(k)
  42. new(b)
  43. b>(then,else)
  44. then<()
  45. k<(b)
  46.  
  47. !false>(k)
  48. new(b)
  49. b>(then,else)
  50. else<()
  51. k<(b)
  52.  
  53. !if>(cond,then,else)
  54. cond<(then,else)
  55.  
  56.  
  57. # maybe
  58. !just>(x,k)
  59. new(m)
  60. m>(j,n)
  61. j<(x)
  62. k<(m)
  63.  
  64. !nothing>(k)
  65. new(m)
  66. m>(j,n)
  67. n<()
  68. k<(m)
  69.  
  70. !maybe>(m,cont_j,cont_n)
  71. m<(cont_j,cont_n)
  72.  
  73.  
  74. # cons
  75. !cons>(car,cdr,cont)
  76. new(t)
  77. t<(car,cdr)
  78. cont<(t)
  79.  
  80. !car>(cc,cont)
  81. cc>(car,cdr)
  82. cont<(car)
  83.  
  84. !cdr>(cc,cont)
  85. cc>(car,cdr)
  86. cont<(cdr)
Add Comment
Please, Sign In to add comment