Download code

Jump to: navigation, search

Back to Basic_constructs_(Unlambda)

Download for Windows: zip

Download for UNIX: zip, tar.gz, tar.bz2

nil

v


tupleext

``s``s`ks``s`kks`kk


input.nw

  1 <<function application>>=
  2 `<<applied function>> <<argument>>
  3 
  4 @ text
  5 
  6 <<applied function>>=
  7 .a
  8 @ text
  9 
 10 <<argument>>=
 11 .b
 12 @ text
 13 
 14 <<funcall.unl>>=
 15 <<function application>>
 16 @ text
 17 
 18 <<funcall2.unl>>=
 19 `<<function application>> .c
 20 @ text
 21 
 22 <<funcall3.unl>>=
 23 `.c<<function application>>
 24 @ text
 25 
 26 <<constant .a>>=
 27 `k.a
 28 @ text
 29 
 30 <<get .a from constant function>>=
 31 `<<constant .a>> .b
 32 @ text
 33 
 34 <<consta.unl>>=
 35 `<<get .a from constant function>> .c
 36 @ text
 37 
 38 <<substabc.unl>>=
 39 ```s.a.b.c
 40 @ text
 41 
 42 <<identity.unl>>=
 43 ``i.a.b
 44 @ text
 45 
 46 <<delayed function>>=
 47 `d`.a.b
 48 <<delay1.unl>>=
 49 <<delayed function>>
 50 @ text
 51 
 52 <<delay2.unl>>=
 53 `<<delayed function>> i
 54 @ text
 55 
 56 <<delayed function without d>>=
 57 ``s``s`k.a`k.bi
 58 <codeblock>
 59 Just as with using <code>d</code>, this doesn't print anything when used directly:
 60 <codeblock language="unlambda">
 61 <<delay1a.unl>>=
 62 <<delayed function without d>>
 63 @ text
 64 
 65 <<delay2.unl>>=
 66 `<<delayed function without d>> i
 67 @ text
 68 
 69 <<callcc.unl>>=
 70 ``c.a.b
 71 @ text
 72 
 73 <<exit.unl>>=
 74 `.a`e`.bi
 75 @ text
 76 
 77 <<printa.unl>>=
 78 `.ai
 79 @ text
 80 
 81 <<println.unl>>=
 82 `ri
 83 @ text
 84 
 85 <<true>>=
 86 i
 87 <<false>>=
 88 v
 89 @ text
 90 
 91 <<and>>=
 92 i
 93 @ text
 94 
 95 <<not>>=
 96 ``s`kc``s`k`s`k`k<<true>>``ss`k`k<<false>>
 97 @ text
 98 
 99 <<return first of two arguments>>=
100 k
101 <<return second of two arguments>>=
102 `ki
103 @ text
104 
105 <<ifthenelse>>=
106 ``s`kc``s`k`s`k`k<<return second of two arguments>>``ss`k`k<<return first of two arguments>>
107 @ text
108 
109 <<or>>=
110 ``s`kc``s`k`s`k`ki``ss`k`k`k<<true>>
111 @ text
112 
113 <<testiftrue.unl>>=
114 `r` ```<<ifthenelse>> <<true>> .T .F i
115 <<testiffalse.unl>>=
116 `r` ```<<ifthenelse>> <<false>> .T .F i
117 @ text
118 
119 <<testifnottrue.unl>>=
120 `r` ```<<ifthenelse>> `<<not>> <<true>> .T .F i
121 <<testifnotfalse.unl>>=
122 `r` ```<<ifthenelse>> `<<not>> <<false>> .T .F i
123 @ text
124 
125 <<printbool>>=
126 ``s``s``s``s`k<<ifthenelse>>i`k.T`k.Fi
127 @ text
128 
129 <<testand.unl>>=
130 `r
131 ``k `<<printbool>> ``<<and>> <<false>> <<false>>
132 ``k `<<printbool>> ``<<and>> <<false>> <<true>>
133 ``k `<<printbool>> ``<<and>> <<true>> <<false>>
134     `<<printbool>> ``<<and>> <<true>> <<true>>
135 @ text
136 
137 <<testor.unl>>=
138 `r
139 ``k `<<printbool>> ``<<or>> <<false>> <<false>>
140 ``k `<<printbool>> ``<<or>> <<false>> <<true>>
141 ``k `<<printbool>> ``<<or>> <<true>> <<false>>
142     `<<printbool>> ``<<or>> <<true>> <<true>>
143 @ text
144 
145 <<pair>>=
146 ``s``s`ks``s`kk``s`ks``s`k`sik`kk
147 @ text
148 
149 <<tfirst>>=
150 c
151 @ text
152 
153 <<tsecond>>=
154 ``s`kc``s``s`ksk`kk
155 @ text
156 
157 <<triple>>=
158 ``s``s`ks``s`k`s`ks``s`k`s`kk``s`k`s`ks``s``s`ks``s`kk``s`ks``s`k`sik`kk`k`kk
159 @ text
160 
161 <<tthird>>=
162 ``s`kc``s``s`ksk`k``s`kkk
163 @ text
164 
165 <<tupleext>>=
166 ``s``s`ks``s`kks`kk
167 @ text
168 
169 <<ci0>>=
170 `ki
171 @ text
172 
173 <<ci1>>=
174 i
175 @ text
176 
177 <<ci2>>=
178 ``s``s`kski
179 @ text
180 
181 <<cisucc>>=
182 `s``s`ksk
183 @ text
184 
185 <<ciplus>>=
186 ``si`k<<cisucc>>
187 @ text
188 
189 <<citimes>>=
190 ``s`ksk
191 @ text
192 
193 <<tci n-th>>=
194 ``s`k`s`kc``s`k`s``s`ksk``s``s`ksk`k`kk
195 @ text
196 
197 <<nil>>=
198 v
199 @ text
200 
201 <<nonempty>>=
202 ``si`k`k`ki
203 @ text
204 
205 <<lfirst>>=
206 <<tfirst>>
207 @ text
208 
209 <<lrest>>=
210 ``si`k`ki
211 @ text
212 
213 <<*lsecond>>=
214 `<<lfirst>>`<<lrest>>
215 @ text
216 
217 <<lsecond>>=
218 ``s`k<<lfirst>>``s`k<<lrest>>i
219 @ text
220 
221 <<*lthird>>=
222 `<<lfirst>>`<<lrest>>`<<lrest>>
223 <<lthird>>=
224 ``s`k<<lfirst>>``s`k<<lrest>>``s`k<<lrest>>i
225 @ text
226 
227 <<lci n-th>>=
228 ``s`k`s`k<<lfirst>>``s``s`ks``s``s`ksk`k`k<<lrest>>`ki
229 @ text
230 


hijacker
hijacker
hijacker
hijacker

funcall3.unl

1 `.c`.a .b
2 


citimes

``s`ksk


testor.unl

1 `r
2 ``k ```s``s``s``s`k``s`kc``s`k`s`k`k`ki``ss`k`kki`k.T`k.Fi ````s`kc``s`k`s`k`ki``ss`k`k`ki v v
3 ``k ```s``s``s``s`k``s`kc``s`k`s`k`k`ki``ss`k`kki`k.T`k.Fi ````s`kc``s`k`s`k`ki``ss`k`k`ki v i
4 ``k ```s``s``s``s`k``s`kc``s`k`s`k`k`ki``ss`k`kki`k.T`k.Fi ````s`kc``s`k`s`k`ki``ss`k`k`ki i v
5     ```s``s``s``s`k``s`kc``s`k`s`k`k`ki``ss`k`kki`k.T`k.Fi ````s`kc``s`k`s`k`ki``ss`k`k`ki i i


hijacker
hijacker
hijacker
hijacker

testand.unl

1 `r
2 ``k ```s``s``s``s`k``s`kc``s`k`s`k`k`ki``ss`k`kki`k.T`k.Fi ``i v v
3 ``k ```s``s``s``s`k``s`kc``s`k`s`k`k`ki``ss`k`kki`k.T`k.Fi ``i v i
4 ``k ```s``s``s``s`k``s`kc``s`k`s`k`k`ki``ss`k`kki`k.T`k.Fi ``i i v
5     ```s``s``s``s`k``s`kc``s`k`s`k`k`ki``ss`k`kki`k.T`k.Fi ``i i i


triple

``s``s`ks``s`k`s`ks``s`k`s`kk``s`k`s`ks``s``s`ks``s`kk``s`ks``s`k`sik`kk`k`kk


tsecond

``s`kc``s``s`ksk`kk


funcall.unl

1 `.a .b
2 


ci1

i


testiffalse.unl

1 `r` `````s`kc``s`k`s`k`k`ki``ss`k`kk v .T .F i


testifnottrue.unl

1 `r` `````s`kc``s`k`s`k`k`ki``ss`k`kk ```s`kc``s`k`s`k`ki``ss`k`kv i .T .F i


printa.unl

1 `.ai


tthird

``s`kc``s``s`ksk`k``s`kkk


delay1.unl

1 `d`.a.b


nonempty

``si`k`k`ki


ciplus

``si`k`s``s`ksk


funcall2.unl

1 ``.a .b
2  .c


consta.unl

1 ```k.a .b .c


pair

``s``s`ks``s`kk``s`ks``s`k`sik`kk


exit.unl

1 `.a`e`.bi


delay1a.unl

1 ``s``s`k.a`k.bi
2 <codeblock>
3 Just as with using <code>d</code>, this doesn't print anything when used directly:
4 <codeblock language="unlambda">


delay2.unl

1 ``d`.a.b i
2 ```s``s`k.a`k.bi
3  <codeblock>
4  Just as with using <code>d</code>, this doesn't print anything when used directly:
5  <codeblock language="unlambda"> i


lsecond

``s`kc``s`k``si`k`kii


testiftrue.unl

1 `r` `````s`kc``s`k`s`k`k`ki``ss`k`kk i .T .F i


lthird

``s`kc``s`k``si`k`ki``s`k``si`k`kii


callcc.unl

1 ``c.a.b


println.unl

1 `ri


identity.unl

1 ``i.a.b


testifnotfalse.unl

1 `r` `````s`kc``s`k`s`k`k`ki``ss`k`kk ```s`kc``s`k`s`k`ki``ss`k`kv v .T .F i


substabc.unl

1 ```s.a.b.c


noweb.log

1 <<*lthird>> cannot be an output chunk; it contains a metacharacter
2 <<*lsecond>> cannot be an output chunk; it contains a metacharacter


ci2

``s``s`kski


ci0

`ki