fixing compiler warnings
							parent
							
								
									e9e4028999
								
							
						
					
					
						commit
						d3c87db85f
					
				| 
						 | 
				
			
			@ -19,9 +19,10 @@ TUPLE: coroutine resumecc exitcc originalcc ;
 | 
			
		|||
: coresume ( v co -- result )
 | 
			
		||||
  [ 
 | 
			
		||||
    >>exitcc
 | 
			
		||||
    resumecc>> call
 | 
			
		||||
    resumecc>> call( -- )
 | 
			
		||||
    #! At this point, the coroutine quotation must have terminated
 | 
			
		||||
    #! normally (without calling coyield, coreset, or coterminate). This shouldn't happen.
 | 
			
		||||
    #! normally (without calling coyield, coreset, or coterminate).
 | 
			
		||||
    #! This shouldn't happen.
 | 
			
		||||
    f over
 | 
			
		||||
  ] callcc1 2nip ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,7 @@
 | 
			
		|||
! Copyright (C) 2008 William Schlieper <schlieper@unc.edu>
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
 | 
			
		||||
USING: kernel combinators fry continuations sequences arrays vectors assocs hashtables heaps namespaces ;
 | 
			
		||||
 | 
			
		||||
USING: kernel combinators fry continuations sequences arrays
 | 
			
		||||
vectors assocs hashtables heaps namespaces ;
 | 
			
		||||
IN: graph-theory
 | 
			
		||||
 | 
			
		||||
MIXIN: graph
 | 
			
		||||
| 
						 | 
				
			
			@ -35,7 +34,7 @@ M: graph num-vertices
 | 
			
		|||
    vertices length ;
 | 
			
		||||
 | 
			
		||||
M: graph num-edges
 | 
			
		||||
   [ vertices ] [ '[ _ adjlist length ] map sum ] bi ;
 | 
			
		||||
   [ vertices ] [ '[ _ adjlist length ] sigma ] bi ;
 | 
			
		||||
 | 
			
		||||
M: graph adjlist
 | 
			
		||||
    [ vertices ] [ swapd '[ _ swap _ adj? ] filter ] bi ;
 | 
			
		||||
| 
						 | 
				
			
			@ -88,5 +87,5 @@ PRIVATE>
 | 
			
		|||
 | 
			
		||||
: topological-sort ( graph -- seq/f )
 | 
			
		||||
    dup dag?
 | 
			
		||||
    [ V{ } swap [ drop ] [ prefix ] [ ] full-depth-first drop ]
 | 
			
		||||
    [ V{ } clone swap [ drop ] [ prefix ] [ ] full-depth-first drop ]
 | 
			
		||||
    [ drop f ] if ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
! Copyright (C) 2008 Doug Coleman.
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: arrays kernel sequences namespaces make math math.ranges
 | 
			
		||||
math.vectors vectors ;
 | 
			
		||||
USING: kernel math math.ranges math.vectors namespaces
 | 
			
		||||
sequences ;
 | 
			
		||||
IN: math.numerical-integration
 | 
			
		||||
 | 
			
		||||
SYMBOL: num-steps
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ SYMBOL: num-steps
 | 
			
		|||
    length 2 / 2 - { 2 4 } <repetition> concat
 | 
			
		||||
    { 1 4 } { 1 } surround ;
 | 
			
		||||
 | 
			
		||||
: integrate-simpson ( from to f -- x )
 | 
			
		||||
: integrate-simpson ( from to quot -- x )
 | 
			
		||||
    [ setup-simpson-range dup ] dip 
 | 
			
		||||
    map dup generate-simpson-weights
 | 
			
		||||
    v. swap [ third ] keep first - 6 / * ;
 | 
			
		||||
    v. swap [ third ] keep first - 6 / * ; inline
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue