This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"go/ast" | |
"go/parser" | |
) | |
func main() { | |
expr, _ := parser.ParseExpr("2 + 3 * 5") | |
ast.Print(nil, expr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <bitset> | |
#include <cassert> | |
#include <cctype> | |
#include <cerrno> | |
#include <cfloat> | |
#include <ciso646> | |
#include <climits> | |
#include <clocale> | |
#include <cmath> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys, os, time | |
from datetime import datetime, timedelta | |
from slackclient import SlackClient | |
try: | |
from urllib.request import urlopen, Request | |
except ImportError: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use compat.sicp) | |
(define (memq item x) | |
(cond ((null? x) false) | |
((eq? item (car x)) x) | |
(else (memq item (cdr x))))) | |
;;; Ex 2.53 | |
(list 'a 'b 'c) | |
;;; => (a b c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use math.prime) | |
(use compat.sicp) | |
(use gl) | |
(use gl.glut) | |
;;; picture language primitives ------------------------------ | |
(define (draw-line v1 v2) | |
(gl-begin* GL_LINES | |
(gl-vertex (xcor-vect v1) (ycor-vect v1) 0.0) | |
(gl-vertex (xcor-vect v2) (ycor-vect v2) 0.0))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use math.prime) | |
(use compat.sicp) | |
(use gl) | |
(use gl.glut) | |
;;; Ex 2.17 | |
(define (last-pair. lst) | |
(if (null? (cdr lst)) | |
lst | |
(last-pair. (cdr lst)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use compat.sicp) | |
(define (make-rat n d) | |
(cons n d)) | |
(define (numer r) | |
(car r)) | |
(define (denom r) | |
(cdr r)) | |
(define (add-rat x y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use compat.sicp) | |
(use math.prime) | |
(define (cube x) | |
(* x x x)) | |
(define (sum-integers a b) | |
(if (> a b) | |
0 | |
(+ a (sum-integers (+ a 1) b)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Ex1.9 | |
;;; | |
;;; (define (+ a b) (if (= a 0) b (inc (+ (dec a) b)))) の場合 | |
;;; | |
;;; (+ 4 5) | |
;;; (inc (+ 3 5)) | |
;;; (inc (inc (+ 2 5))) | |
;;; (inc (inc (inc (+ 1 5)))) | |
;;; (inc (inc (inc (inc (+ 0 5))))) | |
;;; (inc (inc (inc (inc 5)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Ex 1.1 | |
10 ;; => 10 | |
(+ 5 3 4) ;; => 12 | |
(- 9 1) ;; => 8 | |
(/ 6 2) ;; => 3 | |
(+ (* 2 4) (- 4 6)) ;; => 6 |
NewerOlder