Skip to content

Instantly share code, notes, and snippets.

@ymizushi
Last active December 27, 2015 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ymizushi/7388185 to your computer and use it in GitHub Desktop.
Save ymizushi/7388185 to your computer and use it in GitHub Desktop.
dot notation
;変更前
(define (sum-multi n [sum 0])
(if (= n 0)
sum
(if (or
(= 0 (remainder n 3))
(= 0 (remainder n 5)))
(sum-multi (- n 1) (+ sum n))
(sum-multi (- n 1) sum))))
;変更後
(define (sum-multi-dot n [sum 0])
(if (n . = . 0)
sum
(if ((0 . = . (n . remainder . 3))
. or .
(0 . = . (n . remainder . 5)))
(sum-multi-dot ( n . - . 1) (sum . + . n))
(sum-multi-dot ( n . - . 1) sum))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment