Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Main exposing (..)
- import Bitwise
- import Html
- -- raindrops n =
- -- countOnes n =
- -- chessboard n =
- -- pyramid n =
- main =
- -- Html.pre [] [ Html.text (raindrops 10) ]
- Html.pre [] [ Html.text "Zdravo Elm@FRI" ]
- raindrops n =
- let
- preveri a txt =
- if a == 0 then
- txt
- else if (a % 3) == 0 then
- preveri (a // 3) (txt ++ "Pling")
- else if (a % 5) == 0 then
- preveri (a // 5) (txt ++ "Plang")
- else if (a % 7) == 0 then
- preveri (a // 7) (txt ++ "Plong")
- else
- txt
- in
- preveri n ""
- countOnes n =
- let
- stej a c =
- if a > 0 then
- stej (Bitwise.shiftRightBy 1 a) (c + Bitwise.and a 1)
- else
- c
- in
- stej n 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement