SlideShare is now on Android. 15 million presentations at your fingertips.  Get the app

×
  • Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
 

From Lisp to Clojure/Incanter and RAn Introduction

by software developer at - on Jan 31, 2010

  • 6,344 views

 

Statistics

Views

Total Views
6,344
Views on SlideShare
6,282
Embed Views
62

Actions

Likes
3
Downloads
76
Comments
1

2 Embeds 62

http://www.slideshare.net 52
http://paper.li 10

Accessibility

Categories

Upload Details

Uploaded via SlideShare as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • jsa-aerial jsa-aerial WRT the trivial example. Your results don't match what I see.

    user> (defn div-3-5 [n] (or (= 0 (rem n 3)) (= 0 rem n 5))))
    user> (time (count (filter div-3-5 (range 1 10000001)))) ; this is 1 - 10000000 inclusive
    'Elapsed time: 2743.388577 msecs'
    About 5X better than R
    Even if you use mod (which you shouldn't) it is still only around 3.3 secs

    Of course (even w/o par and fork/join) providing parallelism for this is simple:

    (defn check-chunk [s e]
    (count (filter div-3-5 (range s (inc e)))))

    (defn par-count []
    (reduce
    + 0 (pmap (fn[[x y]] (check-chunk x y))
    (map #(do [% (+ % 1000000 -1)])
    (take 10 (iterate #(+ % 1000000) 1))))))

    (time (par-count))
    'Elapsed time: 290.739005 msecs'
    4666667


    /Jon
    2 years ago
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

From Lisp to Clojure/Incanter and RAn Introduction From Lisp to Clojure/Incanter and RAn Introduction Presentation Transcript