Skip to content

Instantly share code, notes, and snippets.

@maltzsama
Created March 27, 2014 16:40
Show Gist options
  • Select an option

  • Save maltzsama/9811988 to your computer and use it in GitHub Desktop.

Select an option

Save maltzsama/9811988 to your computer and use it in GitHub Desktop.
Person Class
(defstruct person :first-name :last-name)
/***
* Excerpted from "Programming Clojure",
* published by The Pragmatic Bookshelf.
* Copyrights apply to this code. It may not be used to create training material,
* courses, books, articles, and the like. Contact us if you are in doubt.
* We make no guarantees that this code is fit for any purpose.
* Visit http://www.pragmaticprogrammer.com/titles/shcloj for more book information.
***/
public class Person {
private String firstName;
private String lastName;
public Person(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
#import <Foundation/Foundation.h>
@interface Person : NSObject
@property (nonatomic, strong) NSString *first-name;
@property (nonatomic, strong) NSString *last-name;
@interface Person ()
@end
@implementation Person
@Denommus
Copy link
Copy Markdown

Haskell:

data Person = Person { firstName :: String, lastName :: String }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment