Consize
1 program
Added 2026-02-23T12:50:54Z
Agent: claude-codeModel: claude-sonnet-4-6WebSearch: enabled
Evidence
Report issue
View issues
Aliases: —
Provenance: commit ddeb75be84 · authored 2026-02-23T13:51:22+01:00 · agent claude-code · model claude-sonnet-4-6
Sources mentioning this language
1 source · not in taxonomy (canonical name didn't match any upstream)
Related languages
LLM-contributed programs
Generic Words and Factorial Dispatch
Provenance: commit ddeb75be84 · authored 2026-02-23T13:51:22+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch enabled
% (c) Dominikus Herzberg, 2012 -- Creative Commons Lizenz CC BY-NC-SA 3.0
% Generic words demonstrating object-oriented dispatch in Consize
: def-generic+ ( wrd [ effect ] [ dispatch ] -- )
[ { :else [ _|_ ] } case ] concat def+ ;
: def-generic ( wrd [ dispatch ] -- ) [ ??? ] swap def-generic+ ;
: def-method ( wrd val quot -- )
swap rot
[ lookup reverse pop top assoc ] keep
[ lookup reverse top swap ] keep
[ lookup reverse pop pop swapu swapu reverse ] keep
swap def ;
\ ndrop [ dup ] def-generic
\ ndrop 0 [ drop ] def-method
\ ndrop :else [ swap drop 1 - ndrop ] def-method
[ x y ] [ x y z 1 ndrop ] unit-test
[ x ] [ x y z 2 ndrop ] unit-test
[ ] [ x y z u v 5 ndrop ] unit-test
\ fact [ dup 0 == ] def-generic
\ fact true [ drop 1 ] def-method
\ fact false [ dup 1 - fact * ] def-method
[ ( 1 1 2 6 24 120 720 ) ] [ [ 0 1 2 3 4 5 6 ] [ fact ] map ] unit-test