Fibonacci Butt Sort
1
Name:
Anonymous
2009-08-16 23:08
Let us discuss the various implementations of theF I B O N A C C I B U T T S O R T .
2
Name:
Anonymous
2009-08-16 23:09
3
Name:
Anonymous
2009-08-16 23:11
4
Name:
Anonymous
2009-08-16 23:14
>>1
U MENA
BINARY DICKS TREE ?
5
Name:
Anonymous
2009-08-16 23:18
6
Name:
Anonymous
2009-08-16 23:39
<3
7
Name:
Anonymous
2009-08-16 23:42
What does (binary_dicks_tree)<(fibonacci_butt_sort) evaluate to?
8
Name:
Anonymous
2009-08-17 0:15
9
Name:
Anonymous
2009-08-17 2:33
a,b = 0,1
while 1:
print b,
a,b = b,a+b
10
Name:
Anonymous
2009-08-17 11:03
11
Name:
Anonymous
2009-08-17 15:26
>>10
ANUSES[10] = {ANUS, ANUS, ANUS, ANUS, ANUS, ANUS, ANUS, ANUS, ANUS, ANUS, } ;
12
Name:
Anonymous
2009-08-17 15:42
From this point forward, if anyone on /prog/ asks about data structures, I'm going to reply F I B O N A C C I B U T T S O R T
13
Name:
Anonymous
2009-08-17 15:43
>>1,12
Will you GPL your BBCode?
14
Name:
Anonymous
2009-08-17 15:43
>>12
Don't you mean Haskell?
15
Name:
Anonymous
2009-08-17 15:44
[b][i][u]F[/u][o]I[/o][u]B[/u][o]O[/o][u]N[/u][o]A[/o][u]C[/u][o]C[/o][u]I[/u] [o]B[/o][u]U[/u][o]T[/o][u]T[/u] [o]S[/o][u]O[/u][o]R[/o][u]T[/u][/i][/b]
16
Name:
Anonymous
2009-08-17 15:48
Im writing a 'butt sorter' in J A V A to output the FBSorted BBCode for any text.
17
Name:
Anonymous
2009-08-17 15:50
>>16
BUTT SORT FAILURE
J A V A
18
Name:
Anonymous
2009-08-17 15:52
>>16
I hope you are going to use Fibonacci tail recursion to do it...
19
Name:
Anonymous
2009-08-17 16:14
F I B O N A C C I B U T T S O R T
20
Name:
Anonymous
2009-08-17 16:25
21
Name:
Anonymous
2009-08-17 16:47
>>15
Did you mean:
FIBONACCIBUTTSORT
Hint:
BBCode tags don't work inside the [code] tag.
22
Name:
Anonymous
2009-08-17 16:49
>>21
Your implementation needs work. Try skipping spaces
23
Name:
Anonymous
2009-08-17 16:57
>>21
Did you mean to read the fucking thread?
24
Name:
Anonymous
2009-08-17 17:05
>>21
lol no, that was just the source code.
25
Name:
Anonymous
2009-08-17 17:11
>>1
WTF is this shit? And how do I implement it to my advantage?
26
Name:
Anonymous
2009-08-17 17:32
( d e f u n w r i t e - t a g ( t a g s t r i n g )
( i f ( n u l l t a g )
" "
( f o r m a t n i l " [ ~ a ] ~ a [ / ~ a ] " t a g s t r i n g t a g ) ) )
( d e f u n b b - b u t t s o r t ( s )
" F I B O N A C C I B U T T S O R T "
( w r i t e - t a g " i "
( w r i t e - t a g " b "
( a p p l y # ' c o n c a t e n a t e ' s t r i n g
( l o o p f o r c a c r o s s s
a n d p a r i t y = n i l t h e n ( n o t p a r i t y )
c o l l e c t ( w r i t e - t a g ( i f p a r i t y " o " " u " ) c ) ) ) ) ) )
(defun write-tag (tag string)
(if (null tag)
""
(format nil "[~a]~a[/~a]" tag string tag)))
(defun bb-buttsort (s)
(write-tag "i"
(write-tag "b"
(apply #'concatenate 'string
(loop for c across s
and parity = nil then (not parity)
collect (write-tag (if parity "o" "u") c))))))
27
Name:
Anonymous
2009-08-17 17:33
F I B O N A C C I B U T T S O R T
28
Name:
>>26
2009-08-17 17:34
>>26
S e e m s i t n e e d s s o m e m o r e w o r k : ( B u t a t l e a s t F I B O N A C C I B U T T S O R T w o r k s
29
Name:
Anonymous
2009-08-17 17:58
Here's my implementation:
buttSort = b . i . unwords . map concat $ map xmap fbf `xmap` fbs
where fbf = cycle [u, o] : cycle [cycle [o, u]]
fbs = map tacnoc . words $ "FIBONACCI BUTT SORT"
xmap = zipWith ($)
tacnoc = map (:[])
A bit of a kludge, to be honest. What I ought to have done is written a custom iterator function instead of juggling map and xmap, so it would be intrinsically aware of the space-skipping requirement and I wouldn't have to fuck with fbf.
F I B O N A C C I B U T T S O R T
30
Name:
Anonymous
2009-08-17 18:16
>>29
Like this?
buttSort = b . i . go (cycle [u, o])
where go fs (' ':xs) = " " ++ go fs xs
go (f:fs) (x:xs) = f [x] ++ go fs xs
go _ [] = []
31
Name:
Anonymous
2009-08-17 18:18
>>30
I T H I N K T H E O U T P U T O F T H I S V E R S I O N I S A B S O L U T E L Y P E R F E C T
32
Name:
Anonymous
2009-08-17 18:37
>>30
buttSort = b . i . go (cycle [u, o]) where go fs (' ':xs) = " " ++ go fs xs go (f:fs) (x:xs) = f [x] ++ go fs xs go _ [] = []
33
Name:
Anonymous
2009-08-17 19:00
T e s t i n g m y k l u d g y s c h e m e b u t t s o r t
34
Name:
Anonymous
2009-08-17 19:01
>>33
Whoops, used
[sup] /
[sub] instead of
[o] /
[u]
T e s t i n g m y k l u d g y s c h e m e b u t t s o r t
35
Name:
Anonymous
2009-08-17 19:06
This works in PLT scheme. It's not the best solution, but I wanted to use unfold.
[code] (require srfi/1)
(define (make-cycle x)
(let ((clist (apply circular-list x)))
(lambda ()
(begin0
(car clist)
(set! clist (cdr clist))))))
(define bbcode-select
(let ((c (make-cycle (list o u))))
(lambda (x)
(if (string=? x " ")
" "
((c) x)))))
(define (buttsort x)
(b (i (apply string-append (unfold null? (lambda (y) (bbcode-select (car y))) cdr (regexp-split #rx"" x))))))[code]
36
Name:
Anonymous
2009-08-17 19:16
>>35
EXPERT BBC O D E F A I L U R E
37
Name:
Anonymous
2009-08-17 19:20
>>36
AmIforgiven? Am I forgiven?
AmIforgiven? Am I forgiven?
How abou t n o w ?
38
Name:
Anonymous
2009-08-17 19:29
>>37
No.
39
Name:
Anonymous
2009-08-17 19:30
40
Name:
Anonymous
2009-08-17 19:53
dicks
/ \
/ \
dicks dicks
/ \ / \
/ * / \
dicks dicks dicks
/ \ / \ / \
* dicks * * * dicks
Newer Posts