`
cloverprince
  • 浏览: 127253 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
看了一点LISP的书,猛然觉得,LISP的原理很简单。LISP里面只有1种数据结构:Symbolic Expression,简称sexp。程序本身也是sexp,处理的数据也是sexp。也就是,如果你能解释用sexp写成的程序,你就制成了LISP解释器。 LISP里面,sexp分为两种:表和原子。list(表),内部有序地包含0个或多个sexp。除此之外,其他东西都是atom(原子),比如symbol(符号,类似“标识符”), 数字,字符串,布尔值等。例外是nil,既是表(空表)又是原子。 LISP的执行,就是sexp的求值(evaluation)过程。求值规则如下: - 非符号的原子,解释 ...
.NET有Extension Methods。当你: using System.Linq; 然后,你的所有数组对象神奇般地“拥有”了Contains, Count, GroupBy, OrderBy等一系列“前所未有”的方法。你感觉你的“Array”类被人注入了额外的东西。 C#的Extension Method定义为静态方法。如果第一个参数加上了this修饰符,那么这个方法就被认为是Extension Method。该方法被加在this修饰的参数的类型上。 注意ShyBoyKissSupport.Kiss方法 using System; namespace BoyKiss ...
本文解决我的某个未解之谜: http://cloverprince.iteye.com/blog/336641 说一个笑话:请问,Java语言的使用者看到了如下的代码会怎么想: int calculate(int a, int b, char op) { int c; switch(op) { case '+': c=a+b; break; case '-': c=a-b; break; case '*': c=a*b; break; case '/': if (b==0) { errno=1; return ...
学习Java语言是几年前,但近期才开始深入学习各种应用,主要是web。但是,不久就被各种术语淹没。感觉到Java也是个TIMTOWTDI的东西。从web到数据库,每种应用至少有3种以上的构件可供选择。 以下列举一堆词汇,很多至今还不甚明了。我希望每个词汇都能找到一句话解释其本质。请用批判的眼光阅读以下列表。 这个表可能会越列越长。 Ant: 一种构建工具,类似make Apache DBCP: 数据库连接池。 c3p0: 据说能做DBCP没做好的一些事。 Hibernate: 一种持久化框架,供不愿写SQL语句的懒人用。 jakarta-commons-logging Java ...
现有很多wav文件,转换成ogg,可以: $ oggenc -q5 *.wav 但是,如果你用的是双核,只有一个核心在工作。 所以,写一个Makefile: SRCS = $(wildcard *.wav) OBJS = $(patsubst %.wav,%.ogg,$(SRCS)) all: ${OBJS} %.ogg: %.wav oggenc -q5 $< 然后,命令行执行: $ make -j2 # 把2改成你的CPU的数量 讲解: Makefile里面,$(wildcard .....)是通配符,可以匹配很多文件名。$(pat ...
My coding style has been so weird that no proper GObject programmers would ever use. GObject do have their coding/naming convention which is "designed by both smart and experienced people" and I am supposed "to put my ego aside". Here are the official document about the "co ...
(难得,我在JavaEye博客的第一篇Java文章。) Java: 一种语言。具体的说: 引用来自http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html 1996 - James Gosling invents Java. Java is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single impl ...
An interface is a class with multiple abstract methods.  A class may implement one or more interfaces which means that the class provides all the abstract methods specified in the interfaces.  This separates the behavior pattern from the actual implementation. An interface cannot be instantiated.  H ...
转载自http://py.vaults.ca/~x/python_and_vim.html paste into your ~/.vimrc 引用set tabstop=4       " A four-space tab indent width is the prefered coding style                     " for Python (and everything else!), although of course some                     " disagree. This page general ...
A GObject may emit signals to show that something have happened.  Signals can be connected to many "handlers" which are called when the signals are emitted. Full code: /* A subclass of GObject with a property. */ #include <stdio.h> #include <glib-object.h> typedef struct ...
A good practice of Object-oriented Programming is to hide implementation details from the user.  As explained before, programmers are encouraged to use "private" fields.  However, if you want to let users access those fields, you could do this: typedef { int foo; } MyInstancePrivate; ...
This time GObject refers to the type named GObject in the GObject library.  Don't be confused. The type GObject is supposed to be the base class of other user-defined classes. GObject has reference counting and deallocate the instance when reference count reaches zero. GObject allows users to add ...
In this article I will implement a class inheriting another. An inherited class is also known as a "child class", a "derived class" or a "subclass".  The class it inherits is call the "parent class", the "base class" or the "superclass".  T ...
A private member is a member that is only accessible by other methods of the class. Q: Why private?  It is inconvenient, isn't it? A: Exposing all details may offer some convenience, but it is almost always undesirable. Q: Why? A: You may allow your users to directly access your private data and yo ...
Most of the time classes are instantiatable.  It can create "instances", which have their own data and share common methods of the class. So a CLASS is shared by many INSTANCEs. In GObject, we need two structs.  One for the class and one for the instance. /* A fundamental type. Instanti ...
Global site tag (gtag.js) - Google Analytics