about summary refs log tree commit diff
path: root/usth/ICT2.1/labwork/4/construct.c
blob: 887b6d899b0010036d6b3f57fe05b97c98b81252 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Lisp construct implementation.
 * This is free and unencumbered software released into the public domain.
 */

#include <stdlib.h>

#include "construct.h"

construct *cons(void *first, construct *rest)
{
	construct *list = malloc(sizeof(construct));
	list->car = first;
	list->cdr = rest;
	return list;
}

void *car(construct *list)
{
	return list->car;
}

construct *cdr(construct *list)
{
	return list->cdr;
}