somehow I keep getting crashes today.
(1) -> )se fu ca all compositions
function compositions will cache all values.
(1) -> compositions(n: INT, r: INT): List List PI == if one? r then [[n]] else
reduce(append, [[cons(i, c) for c in compositions(n-i, r-1)] for i in 1..n-1],
[])
Function declaration compositions : (Integer,Integer) ->
List(List(PositiveInteger)) has been added to workspace.
Type: Void
(3) -> r := 2; [# [d for d in compositions(n, r)] for n in 1..]
>> System error:
BAD DO FORMAT
(((#1=G837
(*2;compositions;1;frame1 n (getValueFromEnvironment 'r
'(PositiveInteger))
NIL)
(CDR #1#))
((ELT envArg 0) NIL))
((OR (ATOM #1#) (PROGN (SETQ (ELT envArg 0) (CAR #1#)) NIL))
(NREVERSE0 #2=G836))
(SEQ (EXIT (SETQ #2# (CONS (unwrap (ELT envArg 0)) #2#)))))
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.