incr-set prlevel 1
if #0=3 START
incr-set prlevel -1
;;; Usage:
;;; 	<res_and_dim m mres proj_dim
;;;
;;; sets mres to the 
;;; minimal resolution of m, and proj_dim to the projective dimension.
;;;
incr-set prlevel 1
jump END
;;; Parameters:
;;;      m= module
;;; Output values:
;;;      mres=resolution
;;;      proj_dim=integer

; created 11/11/89
START:
nvars #1 @n
<nres #1 #2 

;initialize
int @i 0

loop:
int @i @i+1
compress #2.@i @comp
ncols @comp @comp
int @comp @comp-1
if @comp>=0 loop

int #3 @i-1
kill @i @comp @n
END:
incr-set prlevel -1

$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;
reset
<ring 3 a-z r
<ideal i a2 ab ac
<res_and_dim i ir d
type d
;3
betti ir
; total:      1     3     3     1 
; --------------------------------
;     0:      1     -     -     - 
;     1:      -     3     3     1 
listvars
;;;;;;;;;;
<ring 3 a-z r
<ideal i a2 b2
<ideal j a b c
power j 3 j
intersect i j i
type i

<res_and_dim i ir d
betti ir 
type d
