New pkgsrc packages for Mac OS X Yosemite

(UPD: there is a newer version of the pkgin repo, based on pkgsrc-2015Q2. See my post in Russian blog.)

I started to build packages for Mac OS X Yosemite from pkgsrc-2014Q3.

As always, to bootstrap pkgin package manager run:

curl | bzip2 -dc | sudo tar -C /usr -xf -

See details in my old post.

Just to remind you, these are built with clang for x86_64.

See also: Pkgsrc binary packages for Mac OS X by Jonathan Perkin

Megatools are in pkgsrc-wip

I hope you know what is, if you don't I recommend to have a look.

In short, it's a secure cloud service with end-to-end encryption.

Well, anyway, megatools is a set of utilities to access your files at via command line interface. I tried to build it on my Mac this morning and it was surprisingly easy. And what is the next thing to do if you see something opensource and good? Right, you add it to pkgsrc!

Unfortunately, I am not an pkgsrc commiter, so I was able to add megatools to pkgsrc-wip only. But that's still a success.

If you don't know what pkgsrc is, look at docs.

If you don't want to know what pkgsrc is, but still want to try megatools, you can install pkgin and use my binary repo. See how to do it in one line of shell code. After installing pkgin, you can get megatools (as well as tons of other useful software) by running:

pkgin install megatools

Have fun! And don't forget to tell me if anything goes wrong!

Common Lisp-style macros in Racket

Today I put myself together and read a couple of sections of Racket documentation. Now I finally know how to implement Common Lisp-style macros in Racket. I'm still not 100% sure it will work exactly as expected but common cases work right.

Here it is:

(define-syntax define-macro
  (syntax-rules ()
   ((_ name fn)
    (define-syntax (name stx)
      (datum->syntax stx (apply fn (cdr (syntax->datum stx))))))))

(define-macro mac
  (lambda (sig . body)
    (cond ((symbol? sig) `(define-macro ,sig ,@body))
          ((pair? sig)   `(define-macro ,(car sig) (lambda ,(cdr sig) ,@body)))
          (else           (error "wrong use of mac")))))

This will give you macro-defining macro mac as in Paul Graham's Arc, except that I defined it in a Scheme way. You will easily figure out how to use it from this example:

(mac (with var exp . body)
    `((lambda (,var) ,@body) ,exp))

(with a 2 (+ a  4)) ; => 6

Binary pkgsrc packages for FreeBSD-10.0

I started to build packages from pkgsrc on my FreeBSD machine.

If you want to try, run:

fetch -q -o - | bzip2 -dc | sudo tar -C /usr -xf -

This fetches and extracts the minimal distribution of pkgin.

After that you'll have to add /usr/pkg/sbin and /usr/pkg/bin to your path to be able to run pkgin.

If you don't know how to use pkgin, you will probably want to have a look at the docs.

If you're happy with pkgin, I'm glad that I could help.

If not, please tell me why. Then run sudo rm -r /usr/pkg /usr/pkg-current and continue living with FreeBSD's pkgng.

Ripple daemon in pkgsrc wip

Just added rippled (Ripple peer-to-peer network daemon) to pkgsrc wipRipple is a peer-to-peer payment system created by Ripple Labs Inc.

Here is how you can install it on Mac OS X. First, you need to bootstrap pkgin, see my previous post.

And then run: pkgin update && pkgin install rippled

If you're not using Mac OS X, you can still build it yourself using pkgsrc.

If you're not using pkgsrc, you're missing out ;-).

Binary pkgsrc packages for Mac OS X Maverics (Darwin 13.1.0)

As I already wrote, I build pkgsrc packages for Mac OS X. Some time ago I update to Darwin 13.1.0.

To use the new repository, you need to change the path in /usr/pkg/etc/pkgin/repositories.conf to

If you want to install everything from scratch run the following:

curl | bzip2 -dc | sudo tar -C /usr -xf -

Again, you need to add /usr/pkg/sbin and /usr/pkg/bin to your path. That can be done by putting these paths to /etc/paths.d/90-pkgsrc-current or by adding the line PATH=$PATH:/usr/pkg/sbin:/usr/pkg/bin to .profile in your home directory.

To those who want to know more about pkgin, look at the pkgin official web page.

If you have any questions, ask here or send me an email.

P. S. If you want to try pkgin but afraid that it will be difficult to remove it, please notice that I configured it so that everything can be removed with just this one command: rm -rf /usr/pkg /usr/pkg-current

Thoughts about z-talk

Decided to write down some ideas about z-talk.

The language

Z-talk is, of course, a lisp. It's lisp-1. It will support traditional CL-style macros as well as first-class continuations. It will be much like PG's Arc and Clojure but differ in that it will not compile for JVM and will not use Racket (mzscheme) which will make it very lightweight much like Scheme48. But it will differ from Scheme48 in that it will support CL-style macros and will not require any top-level declarations that are inspected in compile time. It will support automatic compilation and storing byte-code cache much like in Python.


I've been back and forth on the question of what to implement z-talk in and now I think C++ (mostly plain C) will do just fine. Another option that is very attractive is to use PreScheme compiler... You know what? I just changed my mind back again. PreScheme is very small, easy to use and seems much more powerful than C++ or C. OK, back to PreScheme! Stick to it!

Anyway z-talk will compile to byte-code. Compilation unit is one expression (not one file). Conses, vectors and strings are mutable. But I'm thinking about making variable bindings to be fixed forever. This might greatly simplify the implementation of environment structures and allow inlining procedures. Users will be advised to use mutable boxes (or cells, whatever the name) to modify lexically bound values. But I'm still not sure about that.

Data representation

Values in z-talk are ether immediate or non-immediate. Immediate values are represented by single machine word exactly as in Chicken scheme. But there are fewer types of them in z-talk: fixnums, characters and nil. Nil is of its own type and is not a symbol. There is however symbol nil bound to nil value. Lists are terminated by nil. No boolean type. Nil is false, any other value is true.

Non-immediate values are pointers to the objects stored in blocks. There is a separate list of blocks for each object type. Blocks are aligned so that it is easy to find the beginning of a block by dropping the last few bits in a pointer to an object. This is to avoid storing the type tags in every object. Type tag is stored in the header of each block instead.

Small objects of fixed size are stored just like that. Memory is allocated from a singly-linked lists of free cells.

Objects of variable size are stored differently. Vectors are referenced by descriptors very much like in STL vectors in C++. Descriptors are stored the same way as any other small fixed-sized objects. Strings are much like vectors. Symbols are unique in that all equal symbols are just pointers to the same location. Still haven't decided what is the best layout scheme for symbols but here is one important constraint: it must be easy to look them up by the representation. So they must be arranged in some kind of hash.

WJF 9 Day 2

Day 2 has passed. It turned out that I missed a lot on day 1 because I got to bed early. There were juggling games, cambat and round 1 of juggling jukebox. Fortunately, yesterday all this continued. I even attended combat master class.

Well, here is what happened yesterday. I missed Beginning 3 Balls workshop by Frank Chilese and came to Jason Garfield's 5-7 balls master class. Here is Jason explaining something.

I was at 3 ball cascade masterclass a day before that. It was interesting but that one was acutally usefull.

I was standing in the group who learned 5 balls, on my left are those learning 6 balls and in front are those learning 7 balls.

I was pretty much the worst juggler at the event. Well, except maybe some parents. But they were not really into juggling at all. Although most of them attended beginner's master classes anyway.

After that there were juniors' and advanced competitions. Here is the scene:

A couple of photos from the juggling games. Vladik doing 5 balls 5 up 360 inside the chicken box:

Jonah trying to do the same with rings. (Turned out then that nobody could manage to do it in this box.)

And that's a short video from the combat training by Joe Showers.

WJF 9 Day 1

I started to write this when it was 5am in Vegas. Still can't get used to the local time.

Anyway, yesterday was day 1 of WJF 9. Apparently not all the jugglers arrived yesterday because I still haven't seen Vova Galchenko, Olga Kay, Doug Sayers and many others. Don't know may be they all registered when I took a break to grab a bite.

And also I fell asleep at 7pm yesterday. I set the alarm clock not to miss the evenings juggling games, but when it ringed I just automatically turned it off and slept until 4 am. Really hope that it won't happen today.

Anyway I met Mark from Scotland who's at the WJF event first time and Stieve from Las Vegas who missed only one WJF event. You probably already know Stieve from his How to juggle 5 ball cascade video.

Almost everyone who were at the gym practiced for all the time they were there. It was at least 7 hours with small breaks. No wander they all are so good!

I didn't take many pictures yesterday but I recorded a short video of an impromptu combat battle.

And that's a picture from Jason's 3 balls cascade master class.