home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / e / amigae30a_fr.lha / AmigaE30f / Sources / Tools / Lisp / lisptest.e < prev   
Encoding:
Text File  |  1994-10-03  |  588 b   |  34 lines

  1. -> module test lisp
  2.  
  3. MODULE 'tools/lisp'
  4.  
  5. PROC main()
  6.   DEF a,b
  7.  
  8.   -> map a reverse over lists
  9.  
  10.   showcellint(map(<<1,2,3>,<4,5,6>,<7,8,9>>,{nrev}))
  11.  
  12.   -> somme une liste
  13.  
  14.   WriteF('\n\d\n',foldr(<1,2,3>,{add},0))
  15.  
  16.   -> selectionne une liste du paires 'zipped' qui ont head>tail
  17.  
  18.   showcellint(filter(zip(<1,2,3,4,5>,<2,1,-1,5,4>),{greater}))
  19.  
  20.   -> nombre de nombre positif et négatif d'une liste
  21.  
  22.   a,b:=partition(<1,-5,8,2,-2,4,5,7>,{pos})
  23.   WriteF('\n\d \d\n',length(a),length(b))
  24.  
  25. ENDPROC
  26.  
  27. PROC add(x,y) IS x+y
  28. PROC pos(x) IS x>=0
  29.  
  30. PROC greater(c)
  31.   DEF h,t
  32.   c <=> <h|t>
  33. ENDPROC h>t
  34.