comparison list.rhope @ 92:e73a93fb5de1

Beginning of port of compiler to itself, some bugfixes and a refcount optimization
author Mike Pavone <pavone@retrodev.com>
date Mon, 02 Aug 2010 00:58:55 -0400
parents 004f0fc8941f
children 5a08705f7610
comparison
equal deleted inserted replaced
91:bcdc326b3d6e 92:e73a93fb5de1
275 { next <- [~]+[[list]Right Offset >>] } 275 { next <- [~]+[[list]Right Offset >>] }
276 } 276 }
277 } 277 }
278 } 278 }
279 279
280 New Like@List[in:out]
281 {
282 out <- List[]
283 }
284
285 New Like@List Leaf[in:out]
286 {
287 out <- List[]
288 }
289
290 //TODO: Implement a more efficent version of this
291 _Tail[list, cur, dest:out]
292 {
293 ndest <- [dest]Append[[list]Index[cur]]
294 [list]Next[cur]
295 {
296 out <- _Tail[list, ~, ndest]
297 }{
298 out <- Val[ndest]
299 }
300 }
301 Tail[list,start:out]
302 {
303 newlist <- New Like[list]
304 [list]Index[start]
305 {
306 out <- _Tail[list, start, newlist]
307 }{
308 out <- Val[newlist]
309 }
310 }
311
312 Concatenate[left,right:out]
313 {
314 out <- Fold[Append[?], left, right]
315 }
316
317 Print@List Leaf[list:out]
318 {
319 If[[[list]Buffer >>]Length]
320 {
321 Print["List"]
322 { _Print Seq[list, [list]First] }
323 }{
324 Print["List\n\t{Empty}"]
325 }
326 }
327
328 Print@List[list:out]
329 {
330 Print["List"]
331 { _Print Seq[list, [list]First] }
332 }
333