(defun weighted-error-rate (classifier data weights &key (max-cutoff 1e10))
(declare (type (cons single-float) weights)
(type function classifier))
(declare (type single-float max-cutoff))
(loop :for datum :in data
:for weight of-type single-float :in weights
:until (> total max-cutoff)
:sum (if (eql (sign (funcall classifier (second datum)))
(first datum))
0.0
weight)
:into total of-type single-float
:finally (return total)))
(defun sign (x)
(if (> x 0) 1 -1))
(defun adaboost (weak-learner data &key
weights
(max-iterations 50))
"
HAI
BTW This is a BrainFuck interpreter written in LOLCode
BTW It accepts as input a BF program, followed by a "!", followed by any input to the BF program.
BTW Since BrainFuck is turing-complete, this proves that LOLCode is too
I HAS A INSTRUCTIONS BTW Array for BF instructions
I HAS A IPTR BTW Pointer to first empty element in INSTRUCTIONS
LOL IPTR R 0
I HAS A LOOPZ BTW Array of loop start/end addresses
I HAS A LOOPSTACKZ BTW Loop stack for building the above two
I HAS A LSPTR BTW Pointer to first empty element of LOOPSTACKZ
LOL LSPTR R 0
BTW Read in BF instructions, terminated with "!"
IM IN YR CODE
GIMMEH LETTAR IPTR IN MAH INSTRUCTIONS
IZ IPTR IN MAH INSTRUCTIONS LIEK "["?
LOL LSPTR IN MAH LOOPSTACKZ R IPTR
UPZ LSPTR!!
KTHX
IZ IPTR IN MAH INSTRUCTIONS LIEK "]"?
I HAS A STARTPTR
NERFZ LSPTR!!
LOL STARTPTR R LSPTR IN MAH LOOPSTACKZ
LOL STARTPTR IN MAH LOOPZ R IPTR
LOL IPTR IN MAH LOOPZ R STARTPTR
KTHX
IZ IPTR IN MAH INSTRUCTIONS LIEK "!"?
GTFO
NOWAI
UPZ IPTR!!
KTHX
KTHX
BTW Variables for BF's tape
I HAS A LTAPE
I HAS A RTAPE
I HAS A LPTR
LOL LPTR R 0
I HAS A RPTR
LOL RPTR R 0
I HAS A CELL
LOL CELL R 0
BTW Reset instruction pointer to start
LOL IPTR R 0
BTW Start interpreting
IM IN YR LOOP
I HAS A THING
LOL THING R IPTR IN MAH INSTRUCTIONS
BTW Move tape head right
IZ THING LIEK ">"?
LOL LPTR IN MAH LTAPE R CELL
UPZ LPTR!!
IZ RPTR LIEK 0?
LOL CELL R 0
NOWAI
NERFZ RPTR!!
LOL CELL R RPTR IN MAH RTAPE
KTHX
KTHX
BTW Move tape head left
IZ THING LIEK "<"?
LOL RPTR IN MAH RTAPE R CELL
UPZ RPTR!!
IZ LPTR LIEK 0?
LOL CELL R 0
NOWAI
NERFZ LPTR!!
LOL CELL R LPTR IN MAH LTAPE
KTHX
KTHX
BTW Increment
IZ THING LIEK "+"?
UPZ CELL!!
KTHX
BTW Decrement
IZ THING LIEK "-"?
NERFZ CELL!!
KTHX
BTW Output produces numbers instead of ASCII characters
IZ THING LIEK "."?
VISIBLE CELL!
VISIBLE " "!
KTHX
BTW Input doesn't work because we can't convert characters to integers
BTW Oh well, it doesn't stop it being turing complete
BTW Start of loop
IZ THING LIEK "[" AND CELL LIEK 0?
LOL IPTR R IPTR IN MAH LOOPZ
KTHX
BTW End of loop
IZ THING LIEK "]" AND CELL NOT LIEK 0?
LOL IPTR R IPTR IN MAH LOOPZ
KTHX
BTW End of program!
IZ THING LIEK "!"?
GTFO
KTHX
UPZ IPTR!!
KTHX
KTHXBYE
Name:
Anonymous2007-09-16 4:42 ID:ZmB9lB8v
BTW Output produces numbers instead of ASCII characters BTW Input doesn't work because we can't convert characters to integers BTW Oh well, it doesn't stop it being turing complete
Learn programming you fucking piece of shit. ``convert'' (?) integers to characters?
a char is an integer, a character is a symbol.
``!'' should be ignored in brainfuck, and i do not know why you use it. Maybe because your ``Turing Complete'' language cannot compare to EOF ?
I don't `understand' lolcode, but i think it might be the loops.
[] that is.