GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    screwlisp (screwtape@mastodon.sdf.org)'s status on Sunday, 17-Nov-2024 11:26:43 JST screwlisp screwlisp

    I cannot say this is the easiest thing I have ever written. #lisp
    (defun fizzbuzz-of (x)
    (let* ((nos (scan-range))
    (fizz-src (series 'fizz))
    (buzz-src (series 'buzz))
    (by3s (scan-range :from 0 :by 3))
    (by5s (Scan-range :from 0 :by 5))
    (fizzes (mask by3s))
    (buzzes (mask by5s))
    (fizz/buzzes (#Mlist (#Mand fizzes fizz-src)
    (#Mand buzzes buzz-src))))
    (or (collect (choose-if #'identity
    (scan (collect-nth x fizz/buzzes))))
    (list (collect-nth x nos)))))

    In conversation about 6 months ago from mastodon.sdf.org permalink
    • Embed this notice
      screwlisp (screwtape@mastodon.sdf.org)'s status on Sunday, 17-Nov-2024 11:29:00 JST screwlisp screwlisp
      in reply to
      • Colin

      Who named this "lazy" ?
      @fosskers was it you?

      In conversation about 6 months ago permalink
    • Embed this notice
      screwlisp (screwtape@mastodon.sdf.org)'s status on Sunday, 17-Nov-2024 11:51:03 JST screwlisp screwlisp
      in reply to
      • Colin

      @fosskers
      Ugh, it's 10x slower than this loop facility one.
      (defun loopfizz-of (no)
      (let ((res (loop :repeat (1+ no)
      :for x :from 0 :by 1 :for y := '0 :then y :for z := '0 :then z
      :when (eql x y) :do (incf y 3)
      :When (eql x z) :do (incf z 5)
      :finally (return (list x (decf y 3) (decf z 5))))))
      (cond ((and (= (car res) (cadr res)) (= (car res) (caddr res))) '(fizz buzz))
      ((= (car res) (cadr res)) '(fizz)) ((= (car res) (caddr res)) '(buzz))
      (:otherwise (butlast res 2)))))

      In conversation about 6 months ago permalink
    • Embed this notice
      screwlisp (screwtape@mastodon.sdf.org)'s status on Sunday, 17-Nov-2024 11:55:41 JST screwlisp screwlisp
      in reply to
      • Colin

      @fosskers
      (defun eg (x)
      (let* ((nos (scan-range))
      (fizz-src (series 'fizz))
      (buzz-src (series 'buzz))
      (by3s (scan-range :from 0 :by 3))
      (by5s (Scan-range :from 0 :by 5))
      (fizzes (mask by3s))
      (buzzes (mask by5s))
      (fizz/buzzes (#Mlist (#Mand fizzes fizz-src)
      (#Mand buzzes buzz-src))))
      (list (collect-nth x (#Mand fizzes fizz-src))
      (collect-nth x (#Mand buzzes buzz-src))
      (collect-nth x nos))))
      Oh if I don't tell it to cons, it's faster than loop.

      In conversation about 6 months ago permalink
    • Embed this notice
      screwlisp (screwtape@mastodon.sdf.org)'s status on Sunday, 17-Nov-2024 12:43:44 JST screwlisp screwlisp
      in reply to
      • Nicola
      • Colin

      @CryogenicIce9
      I used to always feel like I was being super fast when I was using it though. So it losing a race against The First Series Thing I Wrote Ever has me kind of sore as well!
      Over here -> https://mastodon.sdf.org/@screwtape/113496220378967727
      / https://lispy-gopher-show.itch.io/lispmoo2/devlog/835106/richard-waters-series-and-lispmoo2
      @fosskers

      In conversation about 6 months ago permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        Richard Waters' Series and lispmoo2
        This is a quite technical fizzbuzz article about totally avoiding writing iteration with your own hands. Based on these Mastodon toots by KMP, mdh, jackdaniel and all: https://mastodon.sdf.org/@screwt...
      2. No result found on File_thumbnail lookup.
        screwlisp (@screwtape@mastodon.sdf.org)
        from screwlisp
        Viz the discussion of #memory and #programming and memories of Richard C. Waters' memory and programming, I adopted Waters' #MIT #AI Memo on #Series for lispmoo2 (#MOO DSL in lisp). https://lispy-gopher-show.itch.io/lispmoo2/devlog/835106/richard-waters-series-and-lispmoo2 #itch_io I used it to solve #fizzbuzz in my first lazy experience ever. It's about 10% better than me using the loop facility. #lispGames #lisp #commonLisp https://dspace.mit.edu/bitstream/handle/1721.1/6035/AIM-1082.pdf?sequence=2&isAllowed=y
    • Embed this notice
      Nicola (cryogenicice9@mastodon.online)'s status on Sunday, 17-Nov-2024 12:43:45 JST Nicola Nicola
      in reply to
      • Colin

      @screwtape @fosskers I hate loop soooo much, every time I see it, it gnaws at me like an open wound

      In conversation about 6 months ago permalink
    • Embed this notice
      screwlisp (screwtape@mastodon.sdf.org)'s status on Thursday, 21-Nov-2024 11:41:11 JST screwlisp screwlisp
      in reply to
      • Colin

      @fosskers oh, I guess so. It is an oddity that Series mandates lazy evaluation only for Series stuff, as compiled in between calling
      (series::install :pkg :my-package)
      <some lazy series functionality in :my-package>
      (series::install :pkg :my-package :remove t)

      In conversation about 6 months ago permalink
    • Embed this notice
      Colin (fosskers@m.fosskers.ca)'s status on Thursday, 21-Nov-2024 11:41:26 JST Colin Colin
      in reply to

      @screwtape When I mentioned "laziness" in the Transducers README, I was referring to Haskell's notion of it. Namely, a first-class language feature that's built in to the compiler and affects everything.

      In conversation about 6 months ago permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.