Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Simple modulus math

Name: Anonymous 2011-01-22 7:16

Solve this prague, I'm having a brain fart.

anus :: Int -> [Int]

0 -> [1,2,3,4]
1 -> [2,3,4,1]
2 -> [3,4,1,2]
3 -> [4,1,2,3]
4 -> [1,2,3,4]
5 -> [2,3,4,1]
e t c...

Name: Anonymous 2011-01-22 7:46

anus = take . repeat

Name: Anonymous 2011-01-22 7:49

anus = take 4 . flip drop (repeat [1..4])

Name: Anonymous 2011-01-22 8:08

Oops.

[code]anus = take 4 . flip drop (cycle [1..4])[\code]

Name: Anonymous 2011-01-22 8:37

You'll get it eventually. I couldn't solve this when I was five years old, either.

Name: Anonymous 2011-01-22 8:58

sub f { (1..4).rotate: $^a % 4 }

Name: Anonymous 2011-01-22 9:17

>>1
(define (rotate x)
  (append (cdr x) (list (car x))))
(let loop ((i 0)
           (x '(1 2 3 4))
           (r '()))
  (if (> i 10) (reverse r)
      (loop (+ i 1) (rotate x) (cons x r))))

Name: Anonymous 2011-01-22 9:20

>>7
Why all you people continue to use Java, isn't the verbosity getting to you?

Name: Anonymous 2011-01-22 9:27

anus dick = take 4 $ drop dick $ cycle [1..4]

Name: Anonymous 2011-01-22 9:28

>>6
.rotate:
I'm surprised that's not an operator.

Name: Anonymous 2011-01-22 9:44

>>8
I already enjoy my Perl, thanks.
(((((((((((λ(f)(λ(c)(λ(!)(λ(m)(λ(@_)(λ(+)(λ(<=>)(λ(i)(λ(x)(λ(r)(if(c i m)(@_ r)((((((((((f f)c)!)m)@_)+)<=>)(+ i))(! x))(<=> x r)))))))))))))(λ(f)(λ(c)(λ(!)(λ(m)(λ(@_)(λ(+)(λ(<=>)(λ(i)(λ(x)(λ(r)(if(c i m)(@_ r)((((((((((f f)c)!)m)@_)+)<=>)(+ i))(! x))(<=> x r))))))))))))))>)(((((λ(a)(λ(d)(λ(l)(λ(c)(λ(x)(a(d x)(l(c x))))))))append)cdr)list)car))10)reverse)(λ(x)(+ x 1)))cons)0)((λ x x)1 2 3 4))'())

Name: Anonymous 2011-01-22 10:02

FIOC my anus

def a(x):
    return [1+(x+y)%4 for y in range(4)]

Name: Anonymous 2011-01-22 10:14

(define (a x)
  (map (λ (y) (modulo (+ 1 x y) 4)) '(1 2 3 4)))

Name: Anonymous 2011-01-22 10:14

>>8
Because the LITHP functions are really short to type.

Name: Anonymous 2011-01-22 10:23

anus x = [1+y`mod`4|y<-[x..x+3]]

Name: Anonymous 2011-01-22 10:33

>>15
What language?

Name: Anonymous 2011-01-22 10:43

>>16
Negro please.

Name: Anonymous 2011-01-22 11:01

>>16
I hate even posting in the same thread as you.

Name: Anonymous 2011-01-22 11:44

>>17-18
I asked a fucking question, what's your God fuqin damned problem?

Name: Anonymous 2011-01-22 11:47

>>19
`mod`
y<-[x..x+3]]

haskal.

Name: Anonymous 2011-02-02 23:26

Name: Anonymous 2011-02-17 20:24

check 'em

Name: Anonymous 2013-09-01 13:44




、___ ノ  、     ̄
   。    、                        、 l il | ll | l| ll i | /
    ◇                           ミ
          \                   Ξ  メ  私  落
 |    |\      \                   ニ  l   は  ち
 .!     \|                       .三  ド   瀟  つ
  :         _                   ニ. 長.  洒  け
           |  \          _      Ξ. な  な   :
           、   l    _r─ァ'´_,,.. ..,ヽ‐- 、 二 の     :
  :          \    r「>-‐''"´     `"'< Ξ よ
               _,lア´              /,
              r' , '  /   {        、 '/ | ll i |l l| l il ||ヽ 
   i           く7  /  ;   /!   .ハ  ヽ  ',   、   ,
              |  ;   '   ' 、  / _」二ム  |  、_,.>.}
   、 l il || ll i | /   <  {  /{´_/  ヽ{ァ'´ソてミヽ\{  \. |
  ミ       彡   /   イ ,ィテミ     {ノ  リノ ハ、  、 >
  ニ    う    ニ ∠、  , ヽl{ {ノ }      ゝ'"´ /i } \  ∨{
  .三   ろ   .三    ∨ ハ  ゞ'  '      xx }メ{ r' ヽノ '、
  ニ.   た     ニ    }イ! {xx     __      {イ}ヽ   \ \
  .二   え    Ξ.    {人    r   ソ  u ;}ド{   、  ヽ  ヽ
  三.   る    ニ     / )X\   `     ,.イハXヽ、 ハ   ハ   }
  .ニ   な    三    .レ {メ) ヽ、     ,.   {  \r\ .}   ノ  /
  Ξ  咲    .ニ    r、(Xソハ 犬ーァ'"    ト、  く,.> ア─-、
  彡  夜    .ミ    }ンムく{\{  /ハ}     /  >'´   {     ヽ
  /,       \     / }  _,.>|__ムrァ-r'  .//   _,r'      '、
   / | ll i | l il ||ヽ    くレ'  ̄/::::://  ハ  \/::;    {        \
                /   /:::::// /  }  |:::::/   rイ/          ':,

Name: Anonymous 2013-09-01 15:15



                   ト、           イ  /
      ト 、,. ‐''"´ ̄ ̄`゙'ー-) \__.           ┼ /
     ./ ´       __     `ヽ.___     /|ヽ | 、  ┼┐ヾ
    /   ./, '"´     ̄`"ヽ(`ーァノ´    / .!  レヘ   ノ、ノ
    ,'   //   /   ,     | Y´ハヽ.__     __
  /  <´     /|‐-/|     /,  |    \ `ヽ     /   /  ┼ ヽ.  / _
  ´)    /     ァテ<、 .|  .//_ ./|    l⌒  |  、__ /┐  /  _|   !   /
  /    八    K_,rソ ` |/ _」_/!/ ,   ,'    /       /  し   (_ノヽ. レ 、_
 ⌒l /   ヽ、__,ゞー       l リ`Y| /| ./  / _____
  ,イ /  ./ ⊂⊃    '  `,,.イソイ レ'-‐''"   ┌┐ |  ___,,.. -‐
 /  ソ   |  ,ハ   ` ー   ⊂! ヽ/       └┘ |   _ヽ_ソ_
 ! (r、   人  ノ 、       人  .ハ             、」 「ノ l_ソヽ| .l   ヽ
 '、   )イ _\(ト、.>-rァ '"´  人r'ノ                 ノーァ   |    |
  \  /´   `ヽr \__ムl(\/)、──- 、           __,メ、,__  ∨ 
    `7  /   \ |\ // ,r'<,ハ     >─< ̄)
    /| /     、Y  /    r‐ ヘ._  /)\    Y    原作:古明地さとり
  /  .∨        \.「ヽ--、_.ノヽ. /´| l´__ノ    ハ
  !    ヽ.        r| /  / ./ヽハ ゝ、____,メイ
  '、    \        !ヽー‐ ァ' ̄/ ヽ/ ∨     /
   \.    \   ./|   ̄   ム/   |    /

Don't change these.
Name: Email:
Entire Thread Thread List