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