- 古代VBプログラマ質問スレ(Ver.6.0 まで) part65 [転載禁止]©2ch.net
34 :デフォルトの名無しさん[sage]:2015/09/05(土) 14:49:55.04 ID:6dKeptfV - 古代っていうからファルコムと何か関係があるのか思った
|
- VB.NET質問スレ(Part42) [転載禁止]©2ch.net
558 :デフォルトの名無しさん[sage]:2015/09/05(土) 22:12:29.19 ID:6dKeptfV - (define (combination ls)
(let loop ((n (length ls)) (r '())) (if (zero? n) (reverse r) (loop (- n 1) (append (combination-r ls n) r))))) (define (combination-r ls r) (cond ((null? ls)'()) ((or (zero? r)(> r (length ls)))'()) ((= r 1)(map list ls)) ((= r (length ls))(list ls)) (else (append (map (lambda (n)(cons (car ls) n)) (combination-r (cdr ls)(- r 1))) (combination-r (cdr ls) r))))) (combination '(1 3 5 9)) =>((1 3 5 9) (3 5 9) (1 5 9) (1 3 9) (1 3 5) (5 9) (3 9) (3 5) (1 9) (1 5) (1 3) (9) (5) (3) (1))
|
- Lisp Scheme Part40 [転載禁止]©2ch.net
211 :デフォルトの名無しさん[sage]:2015/09/05(土) 22:53:19.39 ID:6dKeptfV - >(+ 3 (call/ccc
式中の副作用(call/cc)は評価順序不定の罠が 判ってると思うけど一応
|
- Lisp Scheme Part40 [転載禁止]©2ch.net
212 :デフォルトの名無しさん[sage]:2015/09/05(土) 23:07:18.97 ID:6dKeptfV - ついでにこの式の評価順序ってR6RS以降で何か変わったのかなーと思って調べたら変わってないっぽいね
式を多用するlisp族ではついつい書いてしまうからどっちかに決めた方がいいと思うんだけどな 継続は一見副作用に見えなかったりするからややこしい そういや評価順の問題ってトップレベルにもあったなあ
|