Cool Code

From Sch3m3rs Stuph

(Difference between revisions)
Line 1: Line 1:
== Cool Code ==
== Cool Code ==
This page is for interesting bits and bobbles of coding:  
This page is for interesting bits and bobbles of coding:  
-
    Format is:
+
Format is:
         Name for code
         Name for code
         Code
         Code
Line 11: Line 11:
Display List W/ line-breaks
Display List W/ line-breaks
-
(define (displayx x)
+
  (define (displayx x)
-
  (begin
+
    (begin
-
    (display x)
+
      (display x)
-
    (newline)))
+
      (newline)))
-
(define (for-each-disp a-list)  
+
  (define (for-each-disp a-list)  
-
  (for-each displayx a-list))
+
    (for-each displayx a-list))
When given a list it takes each item displays it in the interactions window with each piece separated with a line break.
When given a list it takes each item displays it in the interactions window with each piece separated with a line break.
----
----

Revision as of 01:18, 22 March 2008

Cool Code

This page is for interesting bits and bobbles of coding: Format is:

        Name for code
        Code
        What it does



Display List W/ line-breaks

 (define (displayx x)
   (begin
     (display x)
     (newline)))
  (define (for-each-disp a-list) 
    (for-each displayx a-list))

When given a list it takes each item displays it in the interactions window with each piece separated with a line break.


Personal tools