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

Pages: 1-

I can't figure out what's wrong

Name: Anonymous 2007-09-16 0:23 ID:TriFJWxv

(defpackage :adaboost
  (:use :common-lisp)
  (:export :adaboost
       :combined-weak-learner
       :brute-force-weak-learner
       :brute-force-sampled-learner
       :sign))
      

(in-package :adaboost) 

(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: Anonymous 2007-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.

Name: Anonymous 2007-09-16 5:05 ID:JuLNy37j

>>2
Stop using stupid quotes motherfucker

Name: Anonymous 2007-09-16 14:34 ID:CUe7HDnI

>>2
yhbt

Name: Anonymous 2007-09-16 15:04 ID:Heaven

OP is a faggot

Name: Anonymous 2007-09-16 15:15 ID:CUe7HDnI

>>5
yhbt

Name: Anonymous 2007-09-16 15:22 ID:uWRoKZgP

>>1
yhbt

Name: Anonymous 2007-09-16 15:59 ID:Q8kblcuS

>>7
ybht

Name: Anonymous 2007-09-16 16:12 ID:7s+lNLwE

no enough CP - gtfo!

Name: Anonymous 2007-09-16 22:26 ID:TriFJWxv

>>7-9
yhbt

Name: Anonymous 2007-09-16 23:25 ID:cQGgu0sg

>>1-
yhbt

Name: Anonymous 2007-09-16 23:32 ID:K/THLYgf

>>1
jesus fuck this is the dumbest thing i have seen on 4chan and i have spent a lot of time on /b/.

Name: Anonymous 2007-09-16 23:43 ID:Q8kblcuS

>>12
I don't speak lisp. What is going on here

Name: Anonymous 2007-09-17 5:46 ID:vQMsJ7j1

>>12
yhbt

Name: Anonymous 2007-09-17 5:49 ID:Z69ukyTf

>>7
yhbt

Name: Anonymous 2007-09-17 7:34 ID:Heaven

>>15
yhbt

Name: Anonymous 2011-11-10 11:26

old thread is old

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